quicky: changing your shell prompt

The default bash shell prompt is anything but usable.

Information is compressed and the prompt turns into hell if you’re deep in a directory tree.

To improve the situation I decided to use a two line prompt. On the first line I have the current host, user and path with different colors, while on the second line I have nothing but the actual command prompt.

This way I can easily tell what system I’m on, what user I’m logged in as and what directory I’m in at a glance. I also have lots of space for my commands since the path doesn’t get in my way.

Here’s how it looks like:

To change your prompt when using bash, edit your ~/.bashrc file

(make sure you source ~/.bashrc in ~/.bash_profile, or just edit that file instead)

and add the following

export PS1="\[\033[01;31m\]\h\[\033[00m\]\[\033[01;32m\] \[\033[01;32m\]\u \[\033[00;33m\]\w\n\[\033[01;30m\]$ \[\033[00m\]"

You may also run the above line in your shell to test it without making it permanent.


\h = host
\u = user
\w = current path
\n = new line
$ = $
the rest is color codes, for example [\033[01;31m\] = red :)

tags: , , , , , ,
posted in configs by wired

Follow comments via the RSS Feed | Leave a comment | Trackback URL

2 Responses to “quicky: changing your shell prompt”

  1. […] seems to be a semi-meme going around on some of the planets I […]

Leave a Reply

Powered by Wordpress and MySQL. Original theme by - customization by me :)