Walker News

How To Change Linux Command Prompt Color?

The trick to customize Linux command prompt color and message is kinda useful for system administrator or developer who has access to live and testing servers. The difference of Linux prompt color and message between production server and staging server could alert users which system they are working on.

The tips to customize Linux command prompt color

The color chart of IBM is useful for system administrator to easily customize the Linux system command prompt color with valid color code.

With reference to IBM Tip: Prompt magic and the nice color chart, I have applied the following Linux system prompt customization to /etc/profile on all Linux production servers (hopefully someone who do remote access to any one of these live systems will be vividly alerted that this is not a staging or testing server):
export PS1="\[[\e[1;33m\]\u@\[\e[1;36;41m\]\H\[\e[0m\] \W] "

If you are not happy with the Linux system prompt color I choose, just change the number in red to other color code, with reference to the color chart above, where 30-37 is foreground color code (text color) and 40-47 is background color code.

The number in blue can be either 0 or 1, where 0 means to reset the Linux system prompt settings to default value (e.g. foreground, background, and boldness) and 1 means to print text with bold font type.

Custom Search

2014  •  Privacy Policy