Ano-Tech Computers
Enter keyword:

Linux: How to modify my bash prompt
Problem:
The bash manpage is quite impossible to read. In addition, trying to google for info on how to modify the shell prompt yields dozens of confusing articles discussing various exotic distros each with their own myriad of init scripts.
 
Solution:
Add your own PS1 environment variable to your ~/.bash_profile

Here's the prompt I'm using:

export PS1="\e[33;1m\tSuSE 10.1 {\j} \h:\w \$ "

\e[33;1m yields bold green text color (\e[0m would reset this)
\t yields the current time
\j yields the current background job count
\h yields the hostname
\w yields the pwd
\$ yields $ for ordinary users and # for root

 
Discuss this solution
Did this article solve your problem? Yes No Did not apply

We welcome anyone who is willing to contribute to this public knowledge base, contact siteadmin@atc.no if you have information you would like to share. The idea is not to replace the commercial support sites, but to publish those hard-to-find solutions you've found yourself looking for over and over again.

Show all articles