Skip to content

Instantly share code, notes, and snippets.

@malcolmt
Created September 17, 2010 19:21
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malcolmt/584774 to your computer and use it in GitHub Desktop.
Save malcolmt/584774 to your computer and use it in GitHub Desktop.
People keep asking about my fancy bash prompt (I've been using it since the mid-90's). So, here it is.
.-(malcolm@djelibeybi 15:19:34) ~
`--> echo $PS1
\n\[\033[35m\].-(\[\033[33m\]\u@\h \[\033[36m\]\t\[\033[35m\]) \[\033[0m\]\w\n\[\033[35m\]\`-->\[\033[0m\]
I should note that in my .bashrc file, I enter the information like this:
# My fancy two-line, colored prompt
e=\\\033
export PS1="\n\[$e[35m\].-(\[$e[33m\]\u@\h \[$e[36m\]\t\[$e[35m\])\[$e[0m\]\w\n\[$e[35m\]\\\`-->\[$e[0m\] "
The $e variable is the escape character for ANSI terminal sequences. The wikipedia page for ANSI sequences is comprehensive, but a better summary for designing your own prompt might be http://ascii-table.com/ansi-escape-sequences.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment