Linux: Shell Commands for GUI Apps

By Xah Lee. Date: . Last updated: .

What is the command equivalent to double clicking?

xdg-open file_path

# open current dir
xdg-open .

In gnome, you can use gvfs-open file_path. (Note: there's gnome-open, but is deprecated.)

What is the Linux command to put file in trash?

gvfs-trash file_path

More detail at Linux: Where is the Trash Location

How to find the command name of a window?

  1. In terminal, type xprop
  2. then click the window
  3. then read the line “WM_CLASS” and “_NET_WM_PID”.

Or, launch the app by mouse. Then, in terminal type ps -ef | grep string, where string is what you think the name contains, for example, {gnome, kde, xfce, unity, setting, viewer, …}.

Or, type top first, then launch the app, and watch it appear in top.

What is the command to put machine to sleep?

sudo pm-suspend

〔➤see Linux: Command to Shutdown / Restart / Sleep

What is the command to associate file with app in GUI?

Linux: Set Default App

How to launch GUI app from terminal?

xyz & → launch GUI app named “xyz”.


setsid xyz

〔➤see Linux: GUI Apps Command Names

〔➤see Linux: Job Control Tutorial

Linux: Sync X11 Primary Selection and Clipboard

Linux: Sync X11 Primary Selection and Clipboard

GUI Apps Command Names

Linux: GUI Apps Command Names

thanks to amirhoshangi, Manuel Lara, Leonardo Torres, Yanko Simeonoff.