Linux: Shell Commands for GUI Apps
Command to Open File
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 to Move File to Trash
Find Command Name of App
Method 1, Use xprop
- In terminal, type
xprop
- then click the window
- then read the line “WM_CLASS” and “_NET_WM_PID”.
Method 2: Use ps
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}.
Method 3: Use top
type top
first, then launch the app, and watch it appear in top.
Command to Put Machine to Sleep
Command to Set Default App
launch GUI app from terminal?
xyz &
→ launch GUI app named “xyz”.
or
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 https://twitter.com/amirhoshangi ], [Manuel Lara https://plus.google.com/100356143682994881415/posts],
Leonardo Torres,
Yanko Simeonoff.