An Example on how to setup or change bash prompt (PS1)
Sometimes you want to change the bash prompt to a more friendly format.
We can change it using:
PS1=”my new promot”
See this example:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
brawldare-lm:gzip_learn username$ echo $PS1 \h:\W \u\$ # \h : the hostname up to the first ‘.’ # \u : the username of the current user # \W : the basename of the current working directory, with $HOME abbreviated with a tilde # Only keep the basename of the current working directory + ">>>" PS1="\W>>>" gzip_learn>>> #How about show the full working directory? use "\w" # \w : the current working directory, with $HOME abbreviated with a tilde gzip_learn>>>PS1="\w>>>" ~/test/gzip_learn>>> |











