Shortcuts on your desktop screen are useful for easy and fast navigating to folders you need quick access to. Also, if you have an application you use often, you can launch it using the desktop shortcut.
When Windows users switch to Linux for the first time, one of the common struggles for them is to create shortcuts on Linux. The thing is, creating desktop shortcuts isn’t as straightforward in Linux as it is in Windows.
But that doesn’t mean it’s impossible to do so. This tutorial will show you the different methods of creating desktop shortcuts of folders and software on your Linux machine.
For demonstration purposes, we will be using Ubuntu 22.04. So if you are using a different distribution, you may need to do some modifications in some cases. But the base idea is the same.
Let’s get started!
Linux Create Shortcut Using Command Line Interface (Terminal)
First, we will see how to create shortcuts using terminal commands. No matter which Linux distro you are using (Ubuntu, Linux Mint, CentOS, OpenSUSE) you can always use the CLI for creating shortcuts.
So launch your terminal using “Alt+Ctrl+T” and follow along with this tutorial.
Method #1: Copying folder/application to the desktop
We will first navigate to the folder (or directory) where our application is at. This folder will vary depending on the application and your Linux distro.
For Ubuntu, it’s /usr/share/applications. So go to this directory with the following command:
$ cd /usr/share/applications
Now look at the list of applications in this folder with the ls command:
You can scroll down to see the full list. So in this example, we will create a desktop shortcut of ‘CodeBlocks’. You need to copy the file of your desired application and move it to the desktop. You can do that with this command:
$ cp <file> <destination>
You have to replace <file> with the original file name and <destination> with the desktop directory. Here’s what it looks like in our case:
$ cp codeblocks.desktop /home/ali23/Desktop/
Nice. We’ve successfully copied the app to our desktop. But we’re not finished yet. If you try to launch the app, you will run into an error. That’s because the copied version of the app doesn’t have the required permission to run. But we can change that.
Left-click on the icon. Press “Allow Launching”. The icon will change.
Run the app. It should launch successfully. If not, try changing its permission.
Navigate to the desktop directory using these commands.
$ cd $ cd Desktop/
Now you need to change the file permission using chmod like this:
$ chmod u+x codeblocks.desktop
Now relaunch the app.
Read Also: How to Install Outlook on Linux – Ubuntu
Method #2: Symbolic links
Another way to create shortcuts on Linux is using Symlinks. For this, we use the ln command. The only catch is that ln creates hard links. But we need short links. We can do that by using a flag.
Here is what the basic command looks like.
$ ls -s <path to the file you want to link> <path of where you want to link it>
The first argument will be the directory of your desired file or app. The second argument, in this case, is the Desktop directory.
So, for example, we want to create a shortcut for ‘Vim’. This will be the command we need to use:
$ ln -s /usr/share/applications/vim.desktop ~/Desktop/
You don’t have permission to launch it. So, change the permission mode as shown previously:
$ cd Desktop/$ sudo chmod u+x vim.desktop
Finally, right-click on the icon and press “Allow Launching.”
Run the app.
Method #3: Creating a “.desktop” file
In this method, we will just create a “.desktop” file from scratch. We’re creating a shortcut for Evince document viewer. So we’ll need the path of where the application is located. You can know that with this command:
$ which evince
We will need this information later.
Now we need to open a text editor. We’ll be using nano. Feel free to use your favorite one. Open the file in the text editor with this command:
$ nano ~/Desktop/Evince.desktop
Replace the directory path and file name with one suitable for your device.
Now copy and paste this template into the file:
[Desktop Entry] Version= Type= Terminal= Exec= Name= Comment= Icon=
You will need to fill in the right side with the correct values. Here is what it looks like in our case:
The most important part is the “Exec” line. Remember the path we got from the which command? Paste that in this line.
Once done, save by pressing “Ctrl+O”. Then quit by pressing “Ctrl+X”.
Right-click on the icon and click “Allow Launching”.
Run the application.
Related: iTunes for Linux – Is It Possible?
Creating Desktop Shortcuts Using GUI
If you like doing things from the GUI, then follow this method instead.
- Go to “Files”.
- Go to Other Locations > Computer.
- Go to usr > share > applications. You will find a list of all the applications you saw earlier.
- Right-click on the file you want to create a shortcut of. Then press “Copy”. Alternatively, you can left-click the icon and press “Ctrl+C”.
- Finally, return to the Desktop. Right-click on any empty space to open the options. Click on “Paste”. Alternatively, press “Ctrl+V”.
- Lastly, right-click on the icon and press “Allow Launching”.
- Run the application and enjoy.
This tutorial shows you the different methods of creating shortcuts on a Linux desktop. We’ve covered both the GUI and CLI method so you can do it whichever way you prefer.
You can create shortcuts without writing commands if your Linux distro is GUI-friendly. But if you feel more comfortable on the terminal or your distro isn’t so GUI-centric, then any of the 3 methods should work for you.
If you have any questions regarding this tutorial, feel free to let us know in the comments below.