How to Change Your Application Icon from the Terminal in Linux

Spread the love

Previously, we showed you how you can easily change app icons in Gnome 3. However, some users still prefer to use their terminal for that. It’s doable, but, as expected, the process is a bit more complicated than a few mouse clicks. Let’s examine how you can change your application icon directly from your terminal.

Also read: How to Customize Your Linux Terminal Prompt Using Starship

Find Your Application’s Desktop Parameters

Each application that appears on our desktop has a .desktop configuration file. This comes in the form of a text file, filled with values that define how it should act, work, and look on the desktop. Among those, you can find a value for its icon.

Fire up your favorite terminal and move to the folder where you will find those settings files for all your applications, with:

cd /usr/share/applications/

Note that, depending on your distribution, this path can be different.

This folder may contain hundreds of entries. To find your way among them and locate the application you want to tweak, use grep to filter down the list. We wanted to check that a settings file for Firefox existed, so we used:

ls | grep firefox

Open the settings file in your favorite text editor – we used nano. Since the folder “/usr/share/applications” comes with restricted access, you will have to run your editor with sudo to edit any file. Our command was:

sudo nano /usr/share/applications/firefox.desktop

Swap the Icon

With the file open in your editor, it’s time to change the application’s icon. If you don’t already have an alternative icon, now’s the time to find one. Leave your editor window and jump for a while to your favorite browser.

Search for a free-to-use icon in either PNG or JPG format. We used the query “firefox icon png” and went for the first result that came up.

Save the file locally in a relatively simple path. Make sure to remember both the path and the filename, for you will need them soon. Our full path and filename is “/home/USERNAME/Pictures/icons/black_firefox.png”.

Move back to your editor and search for the string icon.

Change Icon=CURRENT_ICON to point to the file you just downloaded. In our case, the original entry read Icon=firefox.

The updated version was:

Icon=/home/USERNAME/Pictures/icons/black_firefox.png

Save and Refresh

Save the changes (Ctrl + O), exit your editor (Ctrl + X), and wait. The next time your desktop updates, so will your application’s icon.

If it takes too long, you always have the option of logging out and then logging back in to force a full refresh.

You can repeat the process for the rest of your applications to give your desktop a truly unique, personal look.

Now that you have changed the application icon from the terminal, it is also possible to manage your tasks or even search the Web from the terminal. And if your terminal is not working, try these fixes.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe


Odysseas Kourafalos

OK’s real life started at around 10, when he got his first computer – a Commodore 128. Since then, he’s been melting keycaps by typing 24/7, trying to spread The Word Of Tech to anyone interested enough to listen. Or, rather, read.

Comments are closed