Linux: Shell Commands for GUI Apps

, , …,

What's the command to open a file in GUI?

xdg-open file path

What's the Linux command to put things in trash?

You can do gvfs-trash file path.

More detail at Linux: Where is the Trash Location

How to sync X11 primary selection and its clipboard?

in Linux's Windowing System (X11), there are 2 different copy/paste mechanism in popular use.

these two are independent. If you want to sync them always, so you can use both ways to copy/paste, then sudo apt-get install parcellite

then, start it in command line by parcellite &.

then, in the menu bar, you'll see a icon. Right-click on it to go to Preference to setup sync.

note: if you do this, then you can't select something then paste over, because after you select, that will be the content of your clipboard. You'll need to paste first then delete the parts you don't want.

note: KDE has Klipper, Gnome has Glipper. Parcellite works in Xfce or any GTK apps. Clipboard manager

thanks to Dan Christensen

How to find the command name of a window?

In terminal, type xprop, then click the window, 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, ⁖ {gnome, kde, xfce, unity, setting, viewer, …}.

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

What's the command to put machine to sleep?

sudo pm-suspend or sudo pm-hibernate.

for differences, see: Linux: Put Machine to Sleep by Command Line.

What's the command to associate file with app in GUI?

It depends on what desktop are you using. There's no universal way. See:

How to launch GUI app from terminal?

If the name is “xyz”, do xyz &

Names of Common Linux GUI Apps

Here's a list of command names for some common GUI apps on Linux.

In terminal, type “gnome-” then Tab ↹ to list. Example:

gnome-calculator             gnome-menus-blacklist        gnome-settings-daemon
gnome-character-map          gnome-nettool                gnome-sound-applet
gnome-codec-install          gnome-panel-screenshot       gnome-sound-recorder
gnome-control-center         gnome-power-statistics       gnome-sudoku
gnome-file-share-properties  gnome-screensaver            gnome-system-log
gnome-font-viewer            gnome-screensaver-command    gnome-system-monitor
gnome-help                   gnome-screenshot             gnome-terminal
gnome-keyring                gnome-search-tool            gnome-terminal.wrapper
gnome-keyring-3              gnome-session                gnome-text-editor
gnome-keyring-daemon         gnome-session-properties     gnome-thumbnail-font
gnome-language-selector      gnome-session-quit           gnome-www-browser

(Note: not all GUI apps from Gnome starts with “gnome-”)

Here's the common ones.

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

blog comments powered by Disqus