help! bash command prompt font/color change
can anyone please help me? i'm a newbie trying to figure out linux files and bold or colored command prompts would stand out a lot! my current command prompt is
PS1=' \h \u \w \#> ' .
how can i show the prompt in BOLD or in a different COLOR? thank you for a fast reply!
richard in washington, dc
see the bash prompt Howto for a complete explanation
You can put colors into your bash prompt using ANSI escape sequences. How to do it is described pretty clearly in the Bash-Prompt-HOWTO which is available at www.tldp.org or, depending on your distribution, in /usr/packages/doc/.
Basically, the sequence for your bash prompt in blue looks like this:
PS1="\[\033[1;34m\]\[\h \u \w \]#>\[\033[0m\] "
I think I got that right. Try it and see how it works for you. You can just start up an xterm and paste that in at the command line. The prompt should change immediately. It will go away when you exit the xterm.
Put this in your .bashrc (or edit to suit your needs first). If you are logged in as user, the prompt is blue. If you su to root, the prompt changes to red. The prompt also shows the full path to the directory you are currently in.
# bash-specific settings
if [ "$UID" -eq "$ROOT_UID" ]
PS1="\[\033[31;1m\]\u \d] \\$\w\n \[\033[0m\]"
PS1="\[\033[34;1m\]\u \d] \\$\w\n \[\033[0m\]"
|All times are GMT -5. The time now is 06:04 AM.|