Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:

Fedora Tips

by Krishnan Subramanian

2004-02-16 Fedora Tips 45:
If you spend a lot of time remotely logging into several machines, or just have many terminals open using the $PS1 variable can aid in keeping track of the whole mess. Even prevent you from making silly mistakes as root.

For instance I put:

PS1="[\[\033[1;31m\]\u\[\033[0m\]@\h \W]\\$ "
at the bottom of my /root/.bashrc file. Every time I am logged in as root, the terminal will look like this:

[root@hostname root]#

I use a separate color for my developer account (magenta), regular account (blue) and remote machines (green) so I know at a glance which is which without reading every line of output looking for that regular text that blends in.

The actual color code is "1;31" inside the PS1 variable. The 1 says make it bold, and the 31 says the color (red). Other colors are:

1;30 Black
1;32 Green
1;33 Yellow
1;34 Blue
1;35 Magenta
1;36 Cyan
1;37 White#white

This is just a subset of PS1 variable tricks for more information see an IBM developerworks Tutorial - submitted by