- How to Create Shortcut on Linux ( GUI & CLI)
- Linux Create Shortcut Using Command Line Interface (Terminal)
- Method #1: Copying folder/application to the desktop
- Method #2: Symbolic links
- Method #3: Creating a “.desktop” file
- Creating Desktop Shortcuts Using GUI
- Final Thoughts
- How to create desktop shortcut or launcher on Linux
- Create a Desktop Shortcut From the Command Line
- Create a Desktop Shortcut on GNOME Desktop
- Create a Desktop Shortcut on KDE Desktop
- Create a Desktop Shortcut on Xfce Desktop
- Create a Desktop Shortcut on Cinnamon Desktop
- Create a Desktop Shortcut on LXDE Desktop
- Support Xmodulo
How to Create Shortcut on Linux ( GUI & CLI)
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.
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:
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:
You have to replace with the original file name and 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.
Now you need to change the file permission using chmod like this:
$ chmod u+x codeblocks.desktop
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.
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.”
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:
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”.
Creating Desktop Shortcuts Using GUI
- 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”.
Final Thoughts
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.
If any of the above solutions did not fix the Windows PC issues, we recommend downloading the below PC repair tool to identify and solve any PC Issues.
Dinesh
Dinesh is the founder of Sysprobs and written more than 400 articles. Enthusiast in Microsoft and cloud technologies with more than 15 years of IT experience.
How to create desktop shortcut or launcher on Linux
If you have a program you use regularly on Linux desktop, you may want to create a desktop shortcut, so you can launch the program by simply clicking on the shortcut. While most GUI programs automatically create their desktop shortcut during installation, GUI programs built from their source or terminal applications may require you to set up associated shortcuts manually.
In this tutorial, I will describe how to create a desktop shortcut or launcher in various Linux desktop environments.
A desktop shortcut is represented by a corresponding .desktop file which contains meta information of a given app (e.g., name of the app, launch command, location of icon file, etc.). Desktop shortcut files are placed in /usr/share/applications or ~/.local/share/applications . The former directory stores desktop shortcuts that are available for every user, while the latter folder contains shortcuts created for a particular user only.
Create a Desktop Shortcut From the Command Line
To manually create a desktop shortcut for a particular program or command, you can create a .desktop file using any text editor, and place it in either /usr/share/applications or ~/.local/share/applications . A typical .desktop file looks like the following.
[Desktop Entry] Encoding=UTF-8 Version=1.0 # version of an app. Name[en_US]=yEd # name of an app. GenericName=GUI Port Scanner # longer name of an app. Exec=java -jar /opt/yed-3.11.1/yed.jar # command used to launch an app. Terminal=false # whether an app requires to be run in a terminal. Icon[en_US]=/opt/yed-3.11.1/icons/yicon32.png # location of icon file. Type=Application # type. Categories=Application;Network;Security; # categories in which this app should be listed. Comment[en_US]=yEd Graph Editor # comment which appears as a tooltip.
Besides manually create .desktop file, there are various desktop-specific ways to create an application shortcut, which I am going to cover in the rest of the tutorial.
Create a Desktop Shortcut on GNOME Desktop
In GNOME desktop, you can use gnome-desktop-item-edit to configure a desktop shortcut easily.
$ gnome-desktop-item-edit ~/.local/share/applications --create-new
In this example, gnome-desktop-item-edit will automatically create a desktop launcher file in ~/.local/share/applications . To customize icon location and other info, you may have to edit the .desktop file manually afterward.
If gnome-desktop-item-edit is not available (e.g., on Ubuntu), you can install it as follows.
$ sudo apt-get install --no-install-recommends gnome-panel
Create a Desktop Shortcut on KDE Desktop
kickoff is the default application launcher in KDE desktop. Adding a new application shortcut to kickoff is straightforward.
First, right-click on kickoff icon located at the left bottom corner of your desktop, and then choose Edit Applications menu.
Click on an appropriate category (e.g., Utilities ) under which you want to create a shortcut, and click on New Item button on the top. Type in the name of the app.
Finally, fill in the meta information of the app being launched by the shortcut.
Create a Desktop Shortcut on Xfce Desktop
If you are on Xfce desktop, right-click on the desktop background, and then select Create Launcher menu. Then fill out the details of the shortcut.
Create a Desktop Shortcut on Cinnamon Desktop
If you are on Linux Mint Cinnamon desktop, you can create an application launcher by right-clicking on the desktop background, and selecting Create Launcher menu.
Create a Desktop Shortcut on LXDE Desktop
On LXDE desktop, simply right click on the desktop background, and choose Create New Shortcut .
Support Xmodulo
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.