Ok here's what and how I did. It easy and a bit tricky.
You must have known that while starting a (bash) terminal, the terminal itself runs the script in the "~/.bashrc" file. If you didnt know, know it now.
Ok. Its straight forward, what we do now is add few lines to the end of the file. So open the file in any editer you like and add the following line at the end of the file
BLUE=$(tput setaf 4)
BOLD=$(tput bold)
RESET=$(tput sgr0)
PS1="\[$BLUE\][\u@\h]\[$RESET\] "
BOLD=$(tput bold)
RESET=$(tput sgr0)
PS1="\[$BLUE\][\u@\h]\[$RESET\] "
Here the env variable PS1 is the normal terminal prompt. FYI PS2 contains the continuation prompt in bash.
So what this says is "DISPLAY A PROMPT IN BLUE COLOR SHOWING [USERNAME@HOSTNAME] AS PROMPT".
Here is the screenshot of my (gnome-)terminal:
Zoomed
EDIT:
Here is a list of Escape Sequence that yuu can use:
http://tldp.org/HOWTO/Bash-Prompt-HOWTO/bash-prompt-escape-sequences.html
No comments:
Post a Comment