How annoying is it when the path gets so long that you can’t type
breaking to a new line? Or when you scroll up through history and all your commands
seem to blend together? Madness!
The default prompt format:
You can clean up the default prompt label pretty easily! Join the revolution and put this in your ~/bash_profile:
export PS1="\n\h:\u \w\n\$ "
The result has a line break before the hostname and a line break after the path. That way you can divide up your commands nicely for scrollback. You’ll also give yourself a full line to type on. How it looks:
[… last command…] MyLaptop:~/Desktop/AwesomeStuff/2015/08/16/OhManILoveThisStuff/Really/How/Far/Can/We/Go johndoe $ echo "I can type sooooooo much stuff here!"
We can improve on that and give it some flavor.
LEETUSER=`whoami | tr abcdefghijklmnopqrstuvwxyz 48\(\)3\|6#1jk\|mn0pqr57uvwxy2` CURDATE=$(date +"%b.%d.%Y @ %I:%M%p") export PS1="\n$LEETUSER|$CURDATE|\w\n\$ "
j0\#n)03|Jul.15.2014 @ 11:39am|~/Desktop/AwesomeStuff/2015/08/16/OhManILoveThisStuff/Really/How/Far/Can/We/Go johndoe $ echo "I'm l33t, )4w6!"
You could add some color to it with the opening tag,
\[\e[1;32m\], and close color with the closing tag,
\[\e[0m\]. Then you could separate the values with ` ::: ` to make it easier to read. The code:
LEETUSER=`whoami | tr abcdefghijklmnopqrstuvwxyz 48\(\)3\|6#1jk\|mn0pqr57uvwxy2` CURDATE=$(date +"%b.%d.%Y @ %I:%M%p") export PS1="\[\e[1;32m\]\n$LEETUSER ::: $CURDATE ::: \w\n\$\[\e[0m\] "
The resulting prompt green will be green!
Perhaps you just want to simplify things with a $ and space? Why not use this:
export PS1="\$ "
$ echo “I know how to type pwd and date, and I never change users, so whatevz.”
There are an infinite number of possibilities so have some fun!