linux bash prompt

Linux bash prompt (smart & colorful)

If you are unhappy with the standard linux prompt then there is a simple way to make your linux prompt to look awesome and also provide some useful infos. The prompt can be used on all linux distributions. I have tried with linux CentOS 6.6

If you want to make this prompt system wide then edit /etc/profile and add this at the end of the file:

In case you just want this prompt for your user account then create/edit the file .bashrcfrom your home dir and add the text mentioned above.

The result is as in the thumbnail used for this post.

PS1 – linux prompt

the code: [\033[0;31m]\u@[\033[0;36m]\h[\033[00m] shows user@host with red and cyan colors
the code: [\033[0;33m]$( pwd ) ($( OUT=$( ls -A | wc -l ); echo $OUT ) entries, $(( $( ls -A | wc -l ) – $( ls | wc -l ) )) hidden) show current dir and also how many files and hidden files are in that dir (hidden files = files that start with .) with yellow colors
the code: \n[\033[1;35m]# ! \$[\033[;m] adds a new line and shows how many command you have typed in the current sessions and the total number of the system command (history) with grey colors

Have fun!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top