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.
/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".
[Desktop Entry] Name=Mouse and Touchpad Comment=Set your mouse and touchpad preferences Exec=gnome-control-center mouse Icon=input-mouse Terminal=false Type=Application StartupNotify=true Categories=GNOME;GTK;Settings;HardwareSettings;X-GNOME-Settings-Panel;
To launch the GUI-application from CLI, simply type the executable and press enter from the terminal.
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.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to install Suricata intrusion detection system on Linux - September 3, 2015
- How to switch from NetworkManager to systemd-networkd on Linux - August 31, 2015
- How to set up a system status page of your infrastructure - August 25, 2015