My Linux terminal color scheme
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.
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.
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
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.
Make a backup copy of the settings file:
1 cp .bashrc .bashrc.backup
For system-wide bashrc:
1 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.
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.
bash.bashrc file to
1 sudo mv bash.bashrc /etc/bash.bashrc
DIR_COLORS file move it to
1 sudo mv DIR_COLORS /etc/
.bashrc file to your home directory.
1 mv .bashrc ~/.bashrc
Then, restart the terminal and that is is. Now you have some color in your terminal.
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.
As always, first back up your
1 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:
1 sed -i 's/#Color/Color/g' /etc/pacman.conf
So, run the pacman update again.
1 sudo pacman -Suy
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.
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.
Let is enable syntax highlighting.
First, backup your nano config file. If something goes wrong, you will just have to restore the backup.
1 sudo cp /etc/nanorc /etc/nanorc.backup
Next, activate color mode predefined in the files
To enable these settings, you have to edit one of these
/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.
1 sudo nano /etc/nanorc
And paste the following line in the end of the file.
1 include "/usr/share/nano/*.nanorc"
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.
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.