SoCruel.NU

The domain that loves BSD

Home About Me Archive Contact

How to get a colored prompt on FreeBSD

FreeBSD uses the csh as standard shell for the user accounts. This post shows how to get some colors with your prompt.

Requirements

The following requirements have to be in place to be able to implement what is described in this post:

  • an up to date FreeBSD version 10.x or 11.x

A colored prompt

You can also add colors to your prompt. Here at SoCruel.NU prompt colors are used to distingish which system and which user account is used. I.e. an internet facing system has a different prompt than an internal system and root has another prompt then a normal user.

You can set the colors of your prompt with the set prompt command in your users .cshrc file. An example of a colored prompt used at SoCruel.NU is:

set prompt="%{\e[31;1m%}%n%{\e[37m%}@%{\e[31;1m%}%m%{\e[37m%}:%{\e[32;1m%}%C%{\e[37m%} "\$"%{\e[0m%} "

Resources

Some (other) resources about this subject:

Updated: August 21, 2018