Chapter 20. Pimp Your Prompt

One of the editors pointed out to me recently that you can make a lot of modifications to the console to make it more attractive and readable without “going over the top” like some felt I did in a column on about a term.

He had a good point. Pull the reins in on that runaway ninny that Linux GUI environments have become, and join me on the CLI to take a look at what he meant.

Stock Bash Prompt

The stock bash prompt on one of my machines looks like this:


That prompt is dynamically created—the user name, machine name, path, and prompt character are inserted by the script located at /etc/bash.bashrc. Here is part of the code snippet that defines the prompt:

if test "$UID" = 0 ; then _u="\h" ...

Get CLI for Noobies: A Primer on the Linux Command Line now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.