How to create desktop shortcuts in Linux

Many people find it useful to organize some of their most frequented applications as shortcuts on their desktop. This allows for quick launching of programs or custom shortcuts. Although most Linux systems rely on a sidebar app launcher or start menu, desktop shortcut launchers can allow you to open applications or websites super fast, since they live right on your desktop and make the targets only a click away.

In this tutorial, you will see how to create desktop shortcuts on a variety of desktop environments, including GNOME, KDE Plasma, Xfce, Cinnamon, MATE, and LXQt. This will include setting a custom icon and name for your desktop shortcut, in order to make them easily identifiable and tailored to your tastes.

In this tutorial you will learn:

  • How to create desktop shortcuts in Linux
  • How to identify the path to an application’s executable
  • How to allow launching on a desktop shortcut
How to create desktop shortcuts in Linux
How to create desktop shortcuts in Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software Any major desktop environment
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Create desktop shortcuts in Linux step by step instructions



DID YOU KNOW?
Some desktop environments have their own ways to add shortcuts to the desktop. But they do have one method in common, which will work across all desktop environments listed above. That is the method we will be covering in the steps below.

For the following example, we will create a desktop shortcut to the Gedit text editing program. This is an application available on GNOME. However, you can easily adapt the template below to make a shortcut for any application you wish.

  1. Start by creating a new .desktop file on your desktop. For this we will open a command line terminal and edit the file in nano. Feel free to use any text editor you would like.
    $ nano /home/linuxconfig/gedit.desktop
    
  2. Next, paste the following template into the file. Keep in mind this particular example is for gedit, but can be adapted for any application.
    [Desktop Entry]
    Version=1.0
    Type=Application
    Terminal=false
    Exec=/usr/bin/gedit
    Name=gedit
    Comment=gedit
    Icon=/home/linuxconfig/Downloads/icon.png

    After pasting the template above and changing it to fit your needs, you can save and close the file.

  3. For the Exec line above, you can obtain the path to your desired program by using the which command in terminal. For example:
    $ which gedit
    /usr/bin/gedit
    




    For the Terminal line, set this to either true or false based on whether or not your desired application must be launched from the terminal.

    Terminal=false
    OR
    Terminal=true
    

    For the Icon line, it is usually best to download a high quality icon from the internet, preferably in .png format. Then save that file somewhere on your computer and put the full path in the Icon setting.

  4. After creating the desktop shortcut, some desktop environments will first require you to allow launching on the file. Simply right click the file and click “Allow launching.” Some desktop environments might call this “Make executable,” but it is the same idea.
    Right click the file and allow launching in order to use your desktop shortcut
    Right click the file and allow launching in order to use your desktop shortcut

All done. You should now be able to use your desktop shortcut in order to quickly access the application you have set it for. If you run into any errors, be sure to check the Exec setting is correct and leads directly to the application executable that you are trying to launch.

Closing Thoughts




In this tutorial, we saw how to create a desktop shortcut on a Linux system. The method shown here will work on all major desktop environments, including GNOME, KDE Plasma, Xfce, Cinnamon, MATE, and LXQt. Note that some desktop environments include other ways to add shortcuts, such as in the right click context menu of an app, but this has a lot of variance across environments and versions.



Comments and Discussions
Linux Forum