How to make the Bash command prompt more useful

Published:

Was on a Linux box today and I found the command prompt rather useless. It looked like this:

-bash-3.2$

I know I'm using bash, and I don't really care about the version. Or that I'm using bash actually... But anyways, to make it more useful you can run this:

PS1="\u@\h:\w$ "

You will then get a prompt which contains your username, hostname and current working directory. Much more useful in my opinion. If you have a different opinion, please share 🙂

You can find more stuff to put in your prompt by reading the prompting section of the bash man page.