The desktop shortcut corresponds to the link of a file, drive, folder, or software application. It provides the fastest way to access the frequently used program. Like CentOS, Debian, and Fedora operating systems, Ubuntu allows the creation of desktop shortcuts that open a particular application with one click. It saves the time consumed in launching the application/file from the exact location where it is placed.
This post explains the desktop application shortcut’s complete procedure using the Ubuntu terminal.
- Creating a Desktop Shortcut (CLI)
- Creating a Desktop Shortcut for File (CLI)
How to Create a Desktop Shortcut for Application (CLI)?
The desktop application’s shortcut provides the easiest way to access an application from your desktop by just pressing the double-click. Its creation requires some essential steps:
Step 1: Access the Desktop Applications Directory
In the Ubuntu operating system, all the desktop files of installed applications are placed in the “/usr/share/applications” directory. Navigate to this directory using the “cd(change directory)” command:
$ cd /usr/share/applications
Execute the “ls(list)” command to list down its content in the terminal:
Scroll down the page for more “.desktop” files:
The highlighted file “libreoffice-calc.desktop” will be used to create its desktop shortcuts.
Step 2: Create the Desktop Application Shortcut
Copy the name of the application file that the user wants to create the desktop shortcut. For this, the “libreoffice-calc.desktop” file is copied using the stated command:
$ cp libreoffice-calc.desktop /home/itslinuxfoss/Desktop
In this command:
- cp: Represents the copy command to copy the .desktop file
- libreoffice-calc.desktop: Specify the “libreoffice-calc” desktop application file.
- /home/itslinuxfoss/Desktop: Identifies the absolute path where the libreoffice-calc.desktop file will copy. In this path, the “itslinuxfoss” tells the username of the directory:
The copied command has been executed successfully.
Step 3: Verify the Desktop Application Shortcut
The “libreoffice-calc.desktop” appears on the desktop as a shortcut after the completion of copied operation:
The “x” sign indicates that it does not have the “Launch” permissions.
Step 4: Launch the Shortcut
Right-click on the “libreoffice-calc.desktop” and click on the “Allow Launching” option from the pop-up menu list:
The “libreoffice-calc.desktop” can now launch easily by just double-clicking on it:
The “LibreOffice Calc” application shortcut has been launched.
How to Create a Desktop Shortcut for File (CLI)?
Apart from desktop applications, the user can also create the desktop files shortcut known as a soft/symbolic link. For this purpose, Ubuntu supports the “ln(link)” command. Let’s see how this command creates the desktop shortcut for files.
Step 1: Create the File Desktop Shortcut
Execute the “ln” command followed by the “-s(soft link)” flag to create the desktop shortcut. It also requires the absolute path of the “File1.txt” whose desktop shortcut will create:
$ ln -s /home/itslinuxfoss/Documents/File1.txt /home/itslinuxfoss/Desktop
In the above code block, the “/home/itslinuxfoss/Documents” is the complete path of the “File1.txt”:
The command has successfully created the desktop shortcut of “File1.,txt”:
Step 2: Open the Desktop File Shortcut
Similar to the desktop application shortcut, double-click on the “File1.txt” shortcut, and it will open in the default text editor of Ubuntu:
The desktop shortcut of “File1.txt” has been opened.
To create the desktop shortcuts using the terminal, access the “.desktop” file in the “/usr/share/applications” directory. After that, copy the “.desktop” extension file to the “Desktop” directory. In addition, the user can also create a desktop shortcut for files by using the “ln(link)” command. The desktop shortcut of a file is also called a “soft/symbolic” link.
This post has described the complete procedure to create a desktop shortcut using the terminal in Ubuntu.