How to change an app icon in Ubuntu
  John   |     30 Sep 2022

How to change an app icon in Ubuntu

In computing, an icon is a small graphical representation of a program, file, or feature displayed on a computer screen as a way to help the user easily navigate through the computer system.

Clicking or double-clicking on an icon opens its associated program or file.

Contrary to Windows, installing programs (software applications) on Linux distros does not create desktop icons. I assume it's because most Linux users are tech-savvy and can easily navigate around their PCs without them.

However, most of the programs in Linux (in my case Ubuntu) still have icons, only that they are found in the favorites(the equivalent to the Windows taskbar usually on the left) and in the applications menu.

Ubuntu 20.04 Desktop
Ubuntu Linux 20.04 Desktop
Ubuntu Linux 20.04 Applications menu
Ubuntu Linux 20.04 Applications menu

Like on Windows, you use these icons to launch the various applications on Linux though some people prefer to use terminal commands.

For your own reasons, you may want to change an icon of a particular program. Maybe you just don't like the default icon and want to replace it with a modified cooler version. Or maybe you are new to Linux and want to replace an icon with that of its equivalent Windows application so as to easily spot it when looking for it in the applications menu.

You can also do this to deceive someone else into opening or not opening a certain application.

In this tutorial, I will take you through the process of changing an icon of an app in Ubuntu Linux.

Replacing an app's icon on Ubuntu Linux

For demonstration purposes, I will be replacing the Mozilla Firefox icon with that of Internet Explorer.

Follow the steps below to replace a program icon:

Step 1: Prepare the image that you are replacing the current icon with.
I prefer you get a square image with a transparent background (.png). You can download it from the web or you can get it from wherever you want. Store it anywhere in your computer storage.

Step 2: Find the application's .desktop file.

All the applications that show up in the Applications menu have a file with a ".desktop" extension. These files are automatically created during applications' installation. A ".desktop" file is simply a shortcut used to launch an application. It is a simple text file that contains information about a program such as how it should work or look among them being the program icon.

The ".desktop" files are located in /usr/share/applications/ directory.

Ubuntu .desktop files directory
Ubuntu 20.04 .desktop files directory

You can scroll down through the files until you spot the respective file for the application you want to want to change its icon.

If you do have a lot of applications installed, it can be hard to locate files. Therefore, the quickest way is to use these two terminal commands.

First, open the terminal and use the cd command to change the current directory from home to "/usr/share/applications/".

cd /usr/share/applications

Now once in this directory, use the command below to find the .desktop file for your application.

ls | grep <program-name>

Replace "<program-name>" in the above command with the actual name of your program.

Finding firefox .desktop files in terminal

We now know that the Firefox .desktop file located in /usr/share/applications/ is named "firefox.desktop".

Step 3: Edit the application's .desktop file to replace the icon line. This file requires root permission to edit, so you will need to open it as the root user. We will open it with the gedit text editor via terminal with sudo command.

While your current directory in the terminal is still "/usr/share/applications/", run the command below.

sudo gedit firefox.desktop

In your case, replace "firefox.desktop" with the respective .desktop file. Then enter your login password and hit Enter.

Opening the firefox.desktop file in Ubuntu terminal

The .desktop file will open in the gedit editor. Scroll down to where you will see Icon. You can also use the Ctrl+F keyboard shortcut for a quick search.

The firefox.desktop Icon entry

Update the value of the icon with the path to your image which you want to replace the icon with.

If you are not very sure of the actual path, don't worry. Just open where your image file is located, right-click on it and click on the Properties option.

Getting a document filepath in nautilus file manager

In the Basic tab, copy the value of the Parent folder and paste it into the icon value. Then, add a slash "/" followed by the value of the Name field (which is the actual image name).

In my case, the full icon image path is as in the image below. Then click on the Save button at the top right corner of the editor.

Updated icon value in a .desktop file

The icon will automatically and immediately get updated in the favorites bar. However, I had to restart my computer to see the update in the Applications menu.

As you can see in the image below, the Firefox icon has been replaced by the Internet Explorer icon.

Updated application icon in Ubuntu

That's it!

Now you can comfortably replace an application's icon with any of your preferred images on Ubuntu Linux. It is my hope that you found this tutorial helpful and easy to follow.