My Linux terminal color scheme

Bash: black&white vs colorful
Bash: black&white vs colorful

The Linux terminal color scheme is not always attractive. Often is is just black and white. You will learn how to create a nice Linux terminal color scheme that is pleasant and easy to read.

In this post, you will learn how to add some colors to your terminal which is black and white by default in some distros such as Arch Linux. It is not pleasant to the eye especially to newcomers. It may not seem important, but adding some color to the terminal can greatly improve the user experience.

I will use Arch Linux as an example, and I will apply a color scheme in Bash environment, Pacman (the Arch Linux package manager), and Nano text editor. All settings except Pacman, should work in other Linux distros.

So, let’s start to add a Linux terminal color scheme. As usual, you can follow the video tutorial or continue reading below.

1. Enable colors in Bash

What is Bash?

Most of Linux distros use Bash shell, which stands for Bourne-again shell. The interface you see in the terminal is called Shell environment.

This is Shell
This is Shell

So, when I talk about making terminal colorful, I mean enabling colors in Bash.

By default, you Bash environment does not have any color. Everything is just black and white.

Just black and white Shell
Just black and white shell

Bash settings files

To make your Bash colorful in Arch Linux, you need to edit Bash setting files. There are two files you can edit. One is located in /etc/bash.bashrc, another is ~/.bashrc in your home folder. The file /etc/bash.bashrc defines the system-wide settings for all users and your root account, while ~/.bashrc is user specific. So, if you have several users, you need to edit this user specific file for every user. Also, if you edit .bashrc in your home, its setting will be prioritized over /etc/bash.bashrc.

I recommend you to edit only .bashrc. It is safer. But if you are a confident user, edit /etc/bash.bashrc, this will apply the settings system-wide and save your time in the future if you create several users.

files that you can edit to add color to bash
Two files that you can edit to add color to bash

Make a backup copy of the settings file:

cp .bashrc .bashrc.backup

For system-wide bashrc:

sudo cp /etc/bash.bashrc /etc/bash.bashrc.backup

Note: Regardless of which file you decide to edit, always it is a good idea back up the original file.

Now, it is safe to edit any of these files. So, If something goes wrong, you can simply restore the backup file.

Adding my Linux terminal color scheme

Normally, you would have to go through all the wiki pages of Arch Linux and configure your preferences.

Arch Linux Wiki
Arch Linux Wiki

But you are lucky because I have done all that job already. You just need to download bash.bashrc, DIR_COLORS and .bashrc and move these files to the following places.

The bash.bashrc file to /etc/bash.bashrc

sudo mv bash.bashrc /etc/bash.bashrc

The DIR_COLORS file move it to /etc.

sudo mv DIR_COLORS /etc/

Now, move .bashrc file to your home directory.

mv .bashrc ~/.bashrc

Then, restart the terminal and that is is. Now you have some color in your terminal.

Linux terminal color scheme example
My Linux terminal color scheme

2. Colorful output in Pacman

If you use Arch Linux, you can enable syntax highlighting for pacman. Its output is of the same color by default and it will be easier to read it when it is colorful.

pacman output by default
pacman output by default

As always, first back up your pacman.config file.

cp /etc/pacman.conf /etc/pacman.conf.backup

And uncomment the word color in that file. The fastest way to do that is to run this command:

sed -i 's/#Color/Color/g' /etc/pacman.conf

So, run the pacman update again.

sudo pacman -Suy
Some color in pacman
Some color in pacman

Now, there is some color differentiation in the output.

When you open the manual of pacman, there is some syntax highlighting as well. It is much easier to read.

Pacman manual page in color
Pacman manual is also in color

As I said before these are small changes but they make the terminal look more pleasant.

3. Syntax highlighting in Nano

Nano is a text editor in the terminal. Usually it does not have text highlighting by default. If you use the Nano text editor, as I do, you will benefit from enabling syntax highlighting in it.

For example, when you open, let say awk script, there is no syntax highlighting and this is how it looks.

No syntax highlight on nano
No syntax highlight on nano

Let is enable syntax highlighting.

First, backup your nano config file. If something goes wrong, you will just have to restore the backup.

sudo cp /etc/nanorc /etc/nanorc.backup

Next, activate color mode predefined in the files /usr/share/nano/*.nanorc.

List of color scheme available for nano
Color scheme available for nano

To enable these settings, you have to edit one of these ~/.nanorc or /etc/nanorc files. You already know the difference between those two files nanorc file is for user-specific, whereas /etc/nanorc is for system-wide settings. I will edit the system-wide settings.

Open the file.

sudo nano /etc/nanorc

And paste the following line in the end of the file.

include "/usr/share/nano/*.nanorc"
Enabling the color schemes for nano
Enabling the color schemes for nano

Press Ctrl+O to write the changes, and Ctrl+X to exit Nano.

Now, if open the awk script again, you will see some color.

nano with highlight enabled
nano with highlight enabled

Is not it better now?


Enabling the Linux terminal color scheme is a small thing to do but it will make your terminal more enjoyable to use.

Please, let me know on the comments section if you know more Linux terminal color schemes. Maybe I missed something.

Average Linux User
Average Linux User I am the founder of the Average Linux User project, which is a hobby I work on at night. During the day I am a scientist who uses computers to analyze genetic data.