How to know the corresponding command line cmd for the UI click?
open the console and enter
ps --sort start_time x
this should give you a list of active processes, sorted by starting time, with the most recent process at the bottom. For example, I've just started Firefox and got this:
19713 ? S 0:00 /bin/sh /usr/lib/firefox-3.6.3/firefox
19718 ? S 0:00 /bin/sh /usr/lib/firefox-3.6.3/run-mozilla.sh /usr/lib/firefox-3.6.3/firefox-bin
19722 ? Sl 0:01 /usr/lib/firefox-3.6.3/firefox-bin
19737 pts/2 R+ 0:00 ps --sort start_time x
Of course ps --sort start_time x
is always the most recent process.
Right click on the icon and select Properties. That will tell you the command line associated with it in most cases.
The three main GUIs for Ubuntu are Gnome, KDE, Xfce. These projects all try to follow the Free Desktop standards at freedesktop.org . Xfce appears to follow the Desktop Entry standard, which defines how menu items are handled, among other things.
The following instructions should work in Gnome, KDE and Xfce.
The menu items (Also called 'Launchers', or 'Desktop Entries' are stored in /usr/share/applications
.
You know this application is called "Movie Player", so to find the appropriate file do this:
stefanl@HOST:/usr/share/applications $ grep -i "movie player" *.desktop
totem.desktop:Name=Movie Player
Grep shows me that 'totem.desktop' contains the appropriate content. From this, I know that "Movie Player" is associated with the 'totem' application.
Now, to see the command which is executed by this menu item, you search for Exec
:
stefanl@HOST:/usr/share/applications $ grep Exec totem.desktop
Exec=totem %U
The format of these Gnome/KDE/Xfce .desktop files is further described at the freedesktop.org Desktop Entry Specification. The Desktop Entry Specification: The Exec key describes the use of the %U
key:
A list of URLs. Each URL is passed as a separate argument to the executable program. Local files may either be passed as file: URLs or as file path.