Software & AppsOperating SystemLinux

How To Create a Desktop Icon for an Executable in Ubuntu 20.04

Ubuntu 4

In this guide, we are going to explore how you can create a desktop icon for an executable in Ubuntu 20.04. This can be particularly useful if you frequently use a specific program and want to have quick access to it right from your desktop.

Quick Answer

To create a desktop icon for an executable in Ubuntu 20.04, you can use either a *.desktop file or the Gnome Tweaks application. Using a *.desktop file involves making the executable file executable, creating a *.desktop file, editing the file with the necessary information, and accessing the application from the application menu. Using Gnome Tweaks requires installing the application, enabling the Desktop Icons extension, and creating a shortcut from the file manager. Both methods provide easy access to your frequently used applications from the desktop.

Prerequisites

Before we get started, ensure that you have the following:

  1. A working Ubuntu 20.04 system
  2. Terminal access
  3. The executable file for which you want to create a desktop icon

Method 1: Using a *.desktop file

Step 1: Make the Executable File Executable

Open a terminal (Ctrl+Alt+T) and navigate to the directory where your executable file is located using the cd command. Once there, you need to make sure that your file is executable. You can do this by running the following command:

chmod +x your_executable

Replace “your_executable” with the actual name of your executable file. The chmod +x command changes the permissions of the file to make it executable.

Step 2: Create a *.desktop File

Next, we will create a new *.desktop file. This file will be responsible for launching your application. Run the following command in the terminal:

nano ~/.local/share/applications/your_executable.desktop

Replace “your_executable” with the name of your executable file. The nano command opens up a text editor where you can write the contents of the file.

Step 3: Edit the *.desktop File

In the text editor, paste the following content:

[Desktop Entry]
Type=Application
Name=Your Application Name
Exec=/path/to/your/executable
Icon=/path/to/your/icon

Replace “Your Application Name” with the name you want to display for your application. Replace “/path/to/your/executable” with the full path to your executable file, and “/path/to/your/icon” with the full path to the icon you want to use for the desktop icon.

The Exec parameter points to the executable file, and the Icon parameter points to the icon file.

Press Ctrl+O to save the file, then Ctrl+X to exit the text editor.

Step 4: Access the Application

Now, you should be able to find your application in the application menu or search for it by name. Right-click on it and select “Add to Favorites” to pin it to your taskbar.

Method 2: Using a Graphical Interface (Gnome)

Step 1: Install Gnome Tweaks

If you prefer a graphical interface over using the terminal, you can use the Gnome Tweaks application. To install it, run the following command in the terminal:

sudo apt install gnome-tweaks

The sudo command is used to perform operations that require administrative or root permissions. The apt install command is used to install new software.

Step 2: Enable the Desktop Icons Extension

Open Gnome Tweaks and navigate to the “Extensions” section. Look for the “Desktop Icons” extension and make sure it is enabled. If it’s not, click on the toggle switch to enable it.

Step 3: Create a Shortcut

Open your file manager and navigate to the directory where your executable file is located. Right-click on the executable file and select “Create Shortcut”. Drag the created shortcut to your desktop.

Conclusion

In this guide, we’ve covered two different methods to create a desktop icon for an executable in Ubuntu 20.04. Whether you prefer using the terminal or a graphical interface, these methods should help you easily create desktop icons for your most frequently used applications. Remember to replace the placeholders in the commands with your actual file names and paths. Happy computing!

How can I make an executable file executable in Ubuntu?

To make an executable file executable in Ubuntu, you can use the chmod +x command followed by the name of the executable file. For example, if your executable file is named "my_program", you would run the command chmod +x my_program in the terminal. This command changes the permissions of the file to make it executable.

What is a *.desktop file?

A *.desktop file is a file with a .desktop extension that contains information about an application in Ubuntu. It provides details such as the application name, the path to the executable file, and the icon to be used for the application’s desktop icon. This file is used to create shortcuts and launch applications in Ubuntu.

Leave a Comment

Your email address will not be published. Required fields are marked *