Customising your terminal with colors

Submitted by Jochus on Wed, 20/02/2013 - 22:11 | Posted in: Mac

Problem

In my terminal, I like to have the words username@machinename colored. This makes it more easy to separate different commands.

Solution

Add following rule(s) to ~/.bashrc:

User

  • Linux

PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\w \$ \[\033[00m\]'

  • Mac OS X

PS1='\[\033[1;32m\]\u@\h\[\033[0m\] \[\033[1;36m\]\w\[\033[0m\] $ '
CLICOLOR=1
LSCOLORS=ExFxBxDxCxegedabagacad

root

PS1='\[\033[01;31m\]\u@\h \[\033[01;34m\]\w \$ \[\033[00m\]'

Add new comment

The content of this field is kept private and will not be shown publicly.

Full HTML

  • Lines and paragraphs break automatically.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.
  • Web page addresses and email addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <cpp>, <css>, <html5>, <java>, <javascript>, <php>, <sql>, <xml>. The supported tag styles are: <foo>, [foo].
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.