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 on various Linux desktops.

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".

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

13 thoughts on “How to create desktop shortcut or launcher on Linux

  1. Your instructions for KDE are much too complicated.

    1. Right click on desktop and unlock widgets
    2. Locate the programme in the Kmenu and drag/drop it on the desktop.
    3. Reverse action 1. Done

    • But how would you do it if you want to create a desktop shortcut for "java -jar /home/alice/bin/myprog.jar?

      Here I want to support creating desktop shortcuts for any arbitrary command as well as existing GUI apps.

      • When an executable command becomes too complicated, I usually just create a script that issues the needed command to start the program, and then have the desktop shortcut point to the script. I usually store my scripts in a hidden directory called .bin in my home folder.

  2. GNOME:
    /usr/bin (or games, share, lib) > right click 'copy to desktop'. Quick and easy. Or right click 'create link'.
    To add an icon, usually found in 'share'.

  3. This helps, but why not just be able to right click on any icon in the App menu or anywhere and find its location, make a shortcut, send to the Open with menu or wherever?

  4. You can also drag and drop a .desktop file from anywhere to the Menu Editor (Kde).. here it works with konqueror.

    Feel free to amend that :).. Apparently there's a bug somewhere of a method I've been using that isn't working anymore.. of a post I made a while ago (i'll need to contact kde mailinglists)

    https://plus.google.com/105696767572828808697/posts/MSDLVt2MF3n

    You can also post over ^ if you'd like to. I might even share it on other forums ;-)

  5. env: centos 5.10 on 32bit,

    test.sh
    #!/bin/bash
    cd /dump
    sudo /opt/java/jre1.7.0_60/bin/java -jar mytest.jar

    mytest.jar will pop a GUI app in the desktop,

    username is in sudoers with NOPASSWD

    Created a launcher in desktop, on double click it doesnt launch the GUI, where in if i run in terminal like the following it works without issue,

    nicole@localhost#sh test.sh

    can you please advice me

  6. when I download a program where does it go? I see no option to create a shortcut nor do I see anywhere in the menu that tells me where my programs are so I can see what all I have.

  7. Hi
    The directories discussed here appear to be populated by "Application" launchers.

    Where are "Location" launchers stored ?

  8. It's about 1 year ago, and it was really helpful to me. I use it for create a general java app launcher. Thank's a lot.

Leave a comment

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

Current ye@r *