How to shorten your command line prompt (bash) like Spatry does it?
I got the following screenshot from a Spatry linux video from https://www.youtube.com/watch?v=ROyqnJg1Ipo
I want something like this on every prompt
----[myusername@laptop]------[14:30:44]----/mnt/1CFED66BFED63CA8/router/Documents/hacking/1 set up tools/wifiphisher
==>
Solution 1:
Assuming you're using bash, place a line like:
PS1="----[\u@\H]------[\t]----\w\n==> "
into your ~/.bashrc
file, which will set your bash prompt to what you want. If you want to change it further, just consult the page http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
Solution 2:
Though The question is already answered and accepted, but I still want to suggest trying using bash-it.
It has numerous themes, aliases and completion support for several languages and frameworks, including git
, rails
, svn
and many others.
Installation
-
Download the zip archive from here https://github.com/Bash-it/bash-it/archive/master.zip and extract it in a folder
.bash_it
. This folder would be a hidden folder for starting with a dot(.). -
Run
~/.bash_it/install.sh
(it automatically backs up your ~/.bash_profile or ~/.bashrc, depending on your OS) -
Edit your modified config
~/.bashrc
file in order to customize Bash-it.For example if you want to use the
Slick
theme you'd change the line8
of~/.bashrc
file toexport BASH_IT_THEME='slick'
The Themes are in ~/.bash_it/themes/
directory.
The available themes screenshot can be viewed here. https://github.com/Bash-it/bash-it/wiki/Themes
Alternatively, you can preview all of them in your shell using the command
BASH_PREVIEW=true reload
You can start using them by doing command
source ~/.bash_it/themes/<theme-name>/<theme-name>.theme.bash
'bobby' theme has a prompt with time included, try using it. You can also customize them.