User Tools

Site Tools


pages:howtos:bash:bash-fancy-bash-prompt

fancy bash prompt

Modifying the Command Line Prompt

The PS1 variable is the character string that is displayed as the prompt on the command line. Most distributions set PS1 to a known default value, which is suitable in most cases. However, users may want custom information to show on the command line. For example, some system administrators require the user and the host system name to show up on the command line as in:

student@quad32 $

This could prove useful if you are working in multiple roles and want to be always reminded of who you are and what machine you are on. The prompt above could be implemented by setting the PS1 variable to: \u@\h \$

For example:

echo $PS1

\$

PS1="\u@\h \$ "
echo $PS1

\u@\h \$ 

will result in a prompt like: coop@quad64 $


~~DISCUSSION~~

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
pages/howtos/bash/bash-fancy-bash-prompt.txt · Last modified: 2021/12/09 21:58 by The Thing That Should Not Be