Skip to main content

Command Palette

Search for a command to run...

How to Add App Shortcut in Linux

Published
6 min readView as Markdown

Adding app shortcuts in Linux can make your workflow faster and more efficient. Whether you want to launch your favorite applications quickly or organize your desktop, creating shortcuts is a handy skill. In this article, I’ll guide you through easy methods to add app shortcuts in Linux, no matter which desktop environment you use.

You might think adding shortcuts is complicated, but it’s actually straightforward once you know the steps. We’ll cover different ways to create shortcuts on your desktop, in the application menu, and even on the taskbar. By the end, you’ll have shortcuts ready to launch your apps with just a click.

Understanding App Shortcuts in Linux

In Linux, an app shortcut is usually a small file that points to an application’s executable. These shortcuts are often called “.desktop files.” They tell your system how to start the app, what icon to display, and where to find it.

Linux uses different desktop environments like GNOME, KDE, XFCE, and others. Each has its own way of handling shortcuts, but the basics remain the same. The .desktop files are stored in specific folders and can be edited or created manually.

Here’s what a typical .desktop file includes:

  • Name: The app’s display name.
  • Exec: The command to run the app.
  • Icon: The path to the app’s icon.
  • Type: Usually set to “Application.”
  • Categories: Helps organize the app in menus.

Knowing this structure helps you create or modify shortcuts easily.

Creating a Desktop Shortcut Manually

One of the simplest ways to add an app shortcut is by creating a .desktop file on your desktop. This method works well across most Linux distributions.

Steps to Create a Desktop Shortcut

  1. Open a text editor like Gedit, Nano, or Vim.
  2. Paste the following template:

    [Desktop Entry]
    Version=1.0
    Type=Application
    Name=App Name
    Exec=command-to-run-app
    Icon=path-to-icon
    Terminal=false
    
  3. Replace App Name with the application’s name.

  4. Replace command-to-run-app with the command you use to launch the app (e.g., firefox).
  5. Replace path-to-icon with the full path to the app’s icon file (usually .png or .svg).
  6. Save the file on your desktop with a .desktop extension, for example, firefox.desktop.
  7. Make the file executable by running this command in the terminal:

    chmod +x ~/Desktop/firefox.desktop
    
  8. The shortcut should now appear on your desktop. Double-clicking it will launch the app.

Tips for Desktop Shortcuts

  • If the icon doesn’t show, check the icon path.
  • You can drag and drop existing apps from the menu to the desktop in some environments.
  • Some desktops require you to right-click the shortcut and select “Allow Launching” to enable it.

Adding App Shortcuts to the Application Menu

Sometimes, you want your app shortcut to appear in the system’s application menu for easy access. This is especially useful for custom or portable apps.

How to Add to the Application Menu

  1. Open your terminal.
  2. Navigate to the local applications folder:

    cd ~/.local/share/applications/
    
  3. Create a new .desktop file here using a text editor.

  4. Use the same template as for desktop shortcuts.
  5. Save and close the file.
  6. Refresh the application menu by logging out and back in, or running:

    update-desktop-database ~/.local/share/applications/
    

Your app will now appear in the menu under the category you set.

Why Use the Local Applications Folder?

  • It keeps your shortcuts user-specific.
  • No need for root permissions.
  • Easy to manage and remove.

Pinning App Shortcuts to the Taskbar or Dock

For quick access, pinning apps to the taskbar or dock is very convenient. The process varies depending on your desktop environment.

GNOME Desktop

  • Open the app from the application menu.
  • Right-click the app icon in the dock.
  • Select “Add to Favorites.”
  • The app icon stays on the dock for easy launching.

KDE Plasma

  • Launch the app.
  • Right-click the app icon in the task manager.
  • Choose “Pin to Task Manager.”

XFCE Desktop

  • Open the app.
  • Right-click the app icon in the panel.
  • Select “Pin to Panel.”

Benefits of Pinning Apps

  • Launch apps with one click.
  • Keep your workspace organized.
  • Customize your workflow.

Using GUI Tools to Create Shortcuts

If you prefer not to edit files manually, many Linux environments offer graphical tools to create shortcuts.

GNOME Alacarte Menu Editor

  • Install Alacarte if not present:

    sudo apt install alacarte
    
  • Open Alacarte from the menu.

  • Click “New Item.”
  • Fill in the app name, command, and icon.
  • Save to add the shortcut to your menu.

KDE Menu Editor

  • Right-click the application launcher.
  • Select “Edit Applications.”
  • Use the GUI to add or edit shortcuts.
  • Save changes to update the menu.

Advantages of GUI Tools

  • User-friendly interface.
  • No need to remember commands.
  • Easy to edit or remove shortcuts.

Troubleshooting Common Issues

Sometimes shortcuts don’t work as expected. Here are common problems and fixes:

  • Shortcut not launching: Check the Exec command for typos.
  • Icon not showing: Verify the icon path and file format.
  • Shortcut not clickable: Make sure the .desktop file is executable (chmod +x).
  • Shortcut not appearing in menu: Refresh the desktop database or log out and back in.
  • Permission issues: Avoid placing shortcuts in system folders unless you have root access.

Best Practices for Managing Shortcuts

To keep your Linux system tidy and efficient, follow these tips:

  • Store personal shortcuts in ~/.local/share/applications/.
  • Use meaningful names and icons.
  • Backup your .desktop files if you customize many shortcuts.
  • Regularly clean unused shortcuts.
  • Use GUI tools for easier management if you’re not comfortable with the terminal.

Conclusion

Adding app shortcuts in Linux is easier than you might think. Whether you want quick desktop access, menu integration, or taskbar pinning, there are simple ways to do it. You can create .desktop files manually, use graphical editors, or drag apps to your desktop.

By mastering these methods, you’ll speed up your workflow and enjoy a more organized Linux experience. Try creating shortcuts for your most-used apps today and see how much time you save!

FAQs

How do I find the command to launch an app in Linux?

You can find the command by searching the app in the terminal or checking existing .desktop files in /usr/share/applications/. Usually, the command is the app’s name, like firefox or gedit.

Can I create shortcuts for scripts or custom commands?

Yes, you can create .desktop files with any command or script. Just set the Exec field to your script’s path and make sure it’s executable.

Why won’t my desktop shortcut open when I double-click it?

This usually happens if the .desktop file isn’t executable. Run chmod +x filename.desktop to fix it. Also, some desktops require you to enable launching for new shortcuts.

Where are system-wide app shortcuts stored?

System-wide shortcuts are typically in /usr/share/applications/. You need root permissions to add or modify files here.

Can I customize the icon of an app shortcut?

Absolutely! Just set the Icon field in the .desktop file to the path of your preferred icon image. You can use .png, .svg, or other supported formats.

More from this blog

L

LinuxBloke | Linux Tips, Tricks & Troubleshooting

672 posts