- Linux Training
- Desktop Tutorials
- Server Tutorials
|Linux Commands - Shells|
Create a colored prompt
You may want to create a color prompt that you can use for visibility. In this example the hostname has been dropped to make a shorter prompt and the prompt is turned red but the commands that you enter will be black. The export command will change these features.
Lesson 10 / Lesson 12
mike@ub:~$ export PS1='\e[0;31m[\u:\w]\$ \e[m '
This will color the prompt but not any commands that you enter.
List of Color code s
Replace digit 0 with 1 for a lighter color.
Make Changes Permanent
All of the changes you make will be lost when you close the terminal or log out. Here are directions to make them permanent.
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
The .bashrc file in each user's home directory allows you to change the default for the prompt to a color prompt by uncommenting the line:
Unfortunately a typo in the line must also be corrected so that it should read:
Ubuntu or CentOS
Place your custom prompt in the user .bashrc file with this command:
export PS1='\e[0;31m[\u:\w]\$ \e[m '
Copyright CyberMontana Inc. and BeginLinux.com
All rights reserved. Cannot be reproduced without written permission. Box 1262 Trout Creek, MT 59874