Linux: Shell Commands for GUI Apps

By Xah Lee. Date: . Last updated: .

Command Line for Double Click

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.)

Command Line for Move to Trash

[see Linux: Move File to Trash by Command]

Find Command Name of App

  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.

Command to Put Machine to Sleep

[see Linux: Command to Shutdown / Restart / Sleep]

Command to Set Default App

[see Linux: Set Default App]

launch GUI app from terminal?

xyz & → launch GUI app named “xyz”.


setsid xyz

[see Linux: GUI Apps Command Names]

[see Linux: Job Control]

Linux: Sync X11 Primary Selection and Clipboard

Linux: Sync X11 Primary Selection and Clipboard

thanks to [ amirhoshangi ] [ 2012-10-11 ], [Manuel Lara], Leonardo Torres, Yanko Simeonoff.

Linux Shell Basics

Directory and Files

Compress, Archive, Download

Text Processing

User, Group, File Perm


Process, Job Control


Linux Desktop