Chapter 20. Pimp Your Prompt

One of the Linux.com 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 Linux.com 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:

warthawg@linux:~>

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 books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.