If you use Linux, you’re going to spend a decent amount of time working in the terminal. Why wouldn’t you want it to reflect your style and the theme of your desktop? Through the work of the open-source community, there are loads of different options to trick out your command line experience in Linux, and they’re all simple to use.
One of the first and easiest things that you can do to change up your command line in Linux is to switch your terminal emulator.
When you open the “terminal” on your distribution, you’re really opening a terminal emulator. A terminal emulator just emulates the old dumb terminals that were physically connected to Unix servers. They were just a screen and a keyboard that allowed you to interact with the server from a distance in the absence of networking.
That’s enough of a history lesson. It all just amounts to the fact that the terminal emulator is a piece of software, and like just about every other vital piece of software on Linux, there are loads of options. You’re not stuck with the one your distribution shipped with.
There’s nothing wrong with the terminal emulators that come with Linux distributions, and more specifically, desktop environments. Many people prefer options like Gnome Terminal and Konsole. In fact, plenty of non-KDE users like Konsole. It supports a load of features and tends to be very stable.
If you’re looking for something different, there are even more options out there. Terminator, Termite, and URXVT are all excellent.
Terminator is a rather large and full-featured option that supports splitting the terminal window to do more than one thing in the same place.
Termite and URXVT are both more minimal. They’re better-suited for people who want to heavily customize their terminal emulator.
No matter which terminal emulator you’re using, you can change the color scheme to anything that you want.
The more full-featured terminal emulators usually have a “Settings” menu that allows you to make some minor color adjustments, but they aren’t nearly as good as some of the color schemes out there.
The Solarized color scheme was designed to be both visually appealing and easy on the eyes. It was painstakingly engineered to use specific colors that maintain contrast but aren’t too harsh. Solarized has both light and dark themes that you can rotate based on the time of the day or preference.
Base16 is another whole set of options. It provides a methodology of using sixteen colors to establish a complete color layout for your terminal. There is a whole list of possible color schemes that follow the Base16 pattern.
Maybe you want something a little retro. Gruvbox uses colors inspired by the 70s but in a very modern way. The theme looks stylish and pleasing to the eye. Like Solarized, it also has both light and dark options.
If you want something more custom, you can build it with Terminal.sexy. It follows the Base16 style guidelines but lets you customize our colors in real time. Then, you can export the configuration that you’ve created to match whichever terminal emulator you’re using.
Terminal emulators all have their own configuration files in unique locations. It’s best to look up where your configuration file resides.
The command prompt is the bit of text that greets you every time you open up a terminal emulator. It usually gives you your username, the name of your computer, and maybe the directory that you’re in, but you can customize it, too.
The prompt is stored in a variable called PS1. You don’t have to worry too much about the technical side of it, but you should know that you can change the value of PS1.
There’s a file in your home directory called .bashrc. That file controls the things that the Linux shell will run every time you start a terminal emulator. If you set the value of PS1 in this file, it will apply every time you open a terminal.
Bash uses escape sequences to represent the things that you might want to display. For example
\u stands for your username. Here are some of the more useful ones.
\h= shortened hostname
\H= hostname with domain
\t= 24 hour time
\T= 12 hour time
\w= full working directory
\W= current folder
\e= ASCII escape to use ASCII characters
\n= new line
Bash doesn’t limit you to the default colors either. You can use the ASCII escape sequence to use ASCII colors. Colors look something like this:
\[\e[32m\]. The 32m part determines the color. The colors run 30 to 37. Your color scheme determines the colors that the numbers correspond to.
You can add a 1 or a 4 in front of the color to specify bold or underlined text. It looks like this:
Everything that follows one of these color blocks takes on the properties that it dictates. It will continue that way until another block changes it. To return to the default, use 0 in the color definition. Take a look at the whole thing together.
There are a ton of ways that you can customize your Bash terminal in Linux. It’s hard to point you in a single direction since so much of this is preference. Experiment and look around for additional options. Beware, customizing your terminal emulator can be incredibly addictive.