I always forget how to make my bash prompt just the way I like it, so here it is for posterity. In ~/.bashrc:

PS1='\[\e]2;\u@\H \w\a\]\[\e[32m\][\t] \[\e[33m\]\w\[\e[0m\]\n\$ '

On Ubuntu: PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\h]\[$(tput setaf 2)\][\t] \[$(tput setaf 3)\]\w\[$(tput setaf 7 )\]\n\\$ \[$(tput sgr0)\]"

This gives me a prompt like this with the time and path:


[11:00:48] ~/code/database_info
$

And a terminal title like this:
username@host path

Here’s the long guide to the codes, and here’s the one I use from IBM.

Published 29/07/2008 Tags Systems
comments powered by Disqus