How to launch a GUI-based desktop program from command line in Linux

If you often use a particular GUI program in your desktop environment, it may be cumbersome to launch the program by navigating desktop menus which may be several mouse clicks away.

To speed things up, you can create shortcuts to your favorite programs inside Application Launcher (e.g., Ubuntu Desktop). Alternatively, you can use a command line interface (CLI), and start GUI programs from terminals, especially if you spend most of your time in terminal windows.

In this tutorial, I will explain how to launch a GUI program from the command line. This guide is written for GNOME desktop, but it should be applicable to other Linux desktop environments.

In order to run a GUI application from a terminal window, the main question is how to find out the name of an executable that corresponds to the GUI application.

Each GUI application has a corresponding .desktop file which contains
information about the application (including application name and a
name of an executable, icon, etc).

In GNOME desktop, .desktop files for system-wide GUI software are stored in /usr/share/applications directory. Meanwhile, .desktop files for GUI programs that are installed on per-user basis is stored in ~/.local/share/applications folder.

To identify the name of an executable from .desktop files, first check the exact name of a GUI application, from the title bar of the application.

For example, the system settings application for mouse and touchpad is shown below. According to its title bar, the name of this application is "Mouse and Touchpad".

Once you have obtained the name of a GUI application, find a .desktop file that contains the name by running the following command. In this example, the .desktop file is located at /usr/share/applications/gnome-mouse-panel.desktop.

$ find /usr/share/applications ~/.local/share/applications -name "*.desktop" | xargs grep "Mouse and Touchpad"
/usr/share/applications/gnome-mouse-panel.desktop:Name=Mouse and Touchpad

The name of an executable can be found in "Exec=xxxxxxx" line of the .desktop file. In this example, the executable is "gnome-control-center mouse".

$ cat /usr/share/applications/gnome-mouse-panel.desktop
[Desktop Entry]
Name=Mouse and Touchpad
Comment=Set your mouse and touchpad preferences
Exec=gnome-control-center mouse

To launch the GUI-application from CLI, simply type the executable and press enter from the terminal.

$ gnome-control-center mouse

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.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of 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.

Leave a comment

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