Emojifying Your Linux Terminal
All of us wish to express their individualism. Customizing the tools we use is one of the ways to do it. This article will show how we can make our Linux terminal more interesting and user-friendly by tweaking it a little with some nice emoji.
In this experiment, I personally use Debian 10 (Buster) with Chromium web browser, and a terminal called Xfce Terminal, all are running on a virtual machine. The process should be very similar in other Linux distros as well. We’ll also need some site which contains cool emojis. I very like Emojipedia.
Now, when opening Emojipedia for the first time, we might see weird characters instead of nice emojis. Same is true about the terminal. If we try to copy and paste those characters to our terminal, we’ll see similar results.
You can think about emoji 🔥 as a font. If a system (OS) or a browser doesn’t have the appropriate font file installed in it, then it just will not be able to parse custom characters appropriately. Some modern operating systems, like Ubuntu, have already integrated this stuff by default, so you can skip some parts of this article if you see actual emojis instead of unidentified characters on your side.
So, it’s clear, that we need to install some fonts to translate the unattractive characters into beautiful emojis. These two fonts are very common, let’s use them: Google Noto Color Emoji and EmojiOne Android.
If the links above do not work for some reason, then you can download the fonts from my personal drive here: yadi.sk/d/wPiV4h9LRIThFQ
After downloading the fonts, we need to install them. In Debian and Debian-based operating systems (like Ubuntu) we can do this by placing these fonts to “~/.local/share/fonts/” directory, and then running the following command in our terminal: “fc-cache -v -f”, where “v” option provides verbose output and “f” option scans the font directories.
If everything was done correctly, then we should see the following message at the end: “fc-cache: succeeded”. Now we can restart our terminal and web browser, and this time we must see the actual emojis.
After we have our fonts in place, we can start customizing our terminal by using a custom emoji to display it in the bash prompt. For that task, we’ll need to deal with a system variable called “PS1” and change its value. We can do a lot of amazing things with PS1 variable, but this time we’ll just modify the bash prompt message.
Let’s open our bash configuration file located under home directory by using “nano ~/.bashrc” command in the terminal or editing it with our favorite text editor, like Pluma. At the end of that file, we’ll add a new line with PS1 value containing the emoji we want to use, like this: PS1=“🦊 ~ "
After saving the changes, we must apply them by running the following command in our terminal: “source ~/.bashrc”.
Â
Hooray! 🥳 That’s all. We now have a nice bash prompt in the terminal, which will give us more joy every time we use it. 💚
Important! In some older Linux distros you’ll need more recent versions of some packages ( like, cairo and fontconfig ) to allow it to work. There are others as well. Upgrading them all manually can result in incompatibility issues or dependency hell, so think carefully before doing so.
Â
Cheers! 🍻