O'Reilly logo

CLI for Noobies: A Primer on the Linux Command Line by Joe Barr

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required