Changing the color of characters in the prompt (or shell), make them more readable. If you are using colors group, you can sense by color, this will eliminate the risk of having a lengthy command prompt.
Information that can be transmitted by the colors
You can assign the green commands for a first machine (host) and blue for another, or green when the system is not loaded, yellow when resources are used or you choose a color for root prompt, another for an MC ...
Two methods are available are possible. The most used (but the less effective) is to insert escape characters. The following shows the chain commands in blue:
This method has two major drawbacks: its syntax is unreadable, so prone to entry errors, and it is only applicable if the terminal window supports ANSI escape sequence,
- changing color of the prompt(or shell) using tput, your definitions are portable to other terminal emulators.
$ BLUE=$ (tput setaf 4) $ BLACK=$ (tput setaf 0) $ PS1=" [$BLUE] u@h] [$BLACK] "
- Understanding these lines
- tput is firstly used to define a variable that contains the sequence of characters to force the color to blue.
- The second line did the same for black.It is now necessary to know the escape sequences, since tput manages a correspondence file descriptions to all terminals file to consult to find the appropriate sequence terminal physical or emulated.
- The third line, finally, uses both variable and $ $ BLUE BLACK in the definition of the $ PS1 prompt
- Note: You can view a complete list of commands man tput and man terminfo.
- Shell change color
- Change command prompt color - Best answers
- Command prompt change color - Best answers
- How to change static ip address in command prompt - How-To - Windows
- Windows 7 - Add some custom colors to your command prompt - How-To - Windows 7
- Windows - Change the font of the command prompt - How-To - Windows
- Windows - How to change adminstrator password using the command prompt - How-To - Windows
- How to change language in windows xp using command prompt ✓ - Forum - Windows