Ubuntu: Desktop Shortcut Creation

This note describes two methods of how to create a desktop shortcut in Ubuntu from the command line.

The simplest method is to create the desktop shortcut as a symbolic link using the ln command.

The second method is a bit more complex but it allows to create much more customizable desktop shortcuts using the “Desktop Entry Specification”.

Cool Tip: Systemd service file examples! Read more →

Create Desktop Shortcut in Ubuntu

A simple desktop shortcut in Ubuntu can be created from the command line using ln:

$ ln -s <source> /home/<user>/Desktop/<shortcut-name>

The Link is Broken: To avoid this error – provide the full path to the <source>.

For example, a shortcut of the Chromium browser on the current user’s desktop may be created as follows:

$ which chromium-browser 

$ ln -s /usr/bin/chromium-browser ~/Desktop/Chromium

Much more customizable desktop shortcut in Ubuntu can be created as a “desktop entry” – the configuration file that describes how a particular program is to be launched.

To create such desktop shortcut in Ubuntu – create a file with the .desktop extension, e.g.:

$ touch ~/Desktop/app-launcher.desktop

Open this file in your favorite text editor and type in (copy-paste):

[Desktop Entry]

# "Application", "Link" or "Directory"

# The version of the Desktop Entry Specification

# The name of the application

# A comment which will be used as a tooltip
Comment=Ubuntu desktop shortcut demo

# The path to the folder in which the executable is run

# The executable of the application, possibly with arguments
Exec=/opt/sampleApp/bin/start --debug

# The icon to display

# Describes whether this application needs to be run in a terminal or not

# Describes the categories in which this entry should be shown

Make the desktop shortcut executable:

$ chmod +x ~/Desktop/app-launcher.desktop

A realistic example of how a .desktop file looks like:

[Desktop Entry]
Name=Arduino IDE
GenericName=Arduino IDE
Comment=Open-source electronics prototyping platform
Keywords=embedded electronics;electronics;avr;microcontroller;

All possible settings can be found on the freedesktop site.

Was it useful? Share this post with the world!

Leave a Reply