Is there a way to find the package/executable name (for example, evince for document viewer, or totem for Videos) for an app?
6 Answers
(1) If you know the name of the program
Try on the command line:
find /usr -name 'evince'
Most programs are in the /usr/bin directory.
Then you can type on the command line:
/usr/bin/evince
This will start the evince program.
To know the hierarchy of the Linux filesystem (what is where) you can check the page about the Linux Filesystem Hierarchy on The Linux Documentation Project site
(2) If you don't know the name of the program.
Step 1: Open a terminal and list all running processes with their PID - process identifier number:
ps -e
Step 2: Start your program
Step 3: Switch to the terminal and type again:
ps -e
Step 4: Trial and error to find the process of your program.
Ubuntuone-syncd is in both lists with PID 2911. Ps is the process of the ps⁻command in the terminal. There are three possibilities left:update-notifier, aptd and evince.
On the command line for those 3 possibilities
man name_of_the_process
or
info name_of_the_process
or
name_of_the_process -h
Replace name_of_the_process by the real process name.
In this case if we type
evince -h
we get:
So evince is the GNOME Document Viewer we were looking for.
-
The problem is that the program that I want to find is the executable for the sound control panel, which I don't know the non-ubuntu-namechanged name for. That works if you figured out that document viewer was actually called Evince, but I want to know how to figure that out. May 12, 2013 at 15:26
-
@YetAnotherUser: I adapted my answer to reflect your comment– user85164May 12, 2013 at 21:48
-
ps -e cuts off process names, rendering it useless for my purposes May 13, 2013 at 4:33
-
@YetAnotherUser Then make it ps -ef– user85164May 13, 2013 at 4:45
Frank's answer should work for you. I'll add that for locating application processes I like the pstree
command better than the flat list ps
gives. (Technically, the very capable ps
command can be used to print a tree.) But here's an alternate approach.
You should be able to find the mapping between an application's executable file name and its GUI name in its .desktop file, and these are scattered around your system in several directories. In a terminal try this
grep -l "Categories=.*Settings" /usr/share/applications/*.desktop
to list the primary system .desktop files describing applications shown in settings dialogs.
grep -l "Categories=.*Settings" /usr/share/applications/*.desktop | grep -i sound
pares that list to only files containing the name "sound". The program you're looking for will belong to one of the listed .desktop files, with any luck. They are text files. The "Name=" line gives the GUI name. You're interested in the "Exec=" line, which names the executable file. This line then may even flat-out work:
grep -l "Categories=.*Settings" /usr/share/applications/*.desktop | grep -i sound | xargs grep -e Name= -e Exec=
Even if that doesn't work, the information you want is almost certainly in the Exec line of some .desktop file somewhere, probably in /usr/share/applications, likely in a file with "sound" in the name. Sorry I can't just give you the program name. I don't have a Unity desktop in front of me.
Desktop applications are started through a *.desktop
file. so, if you do locate --regex '.desktop$'
you'll get a list of all the '*.desktop' files on your system. Since they're usually short files, it's easy to find the "EXEC=
" line.
-
Interesting remark. So I did some research. Most applications have a *.desktop file in /usr/share/applications/ . But that is because they adhere to the protocol of freedesktop.org and so they come in a Debian package that will install that file.– user85164May 13, 2013 at 23:45
xprop | grep PID then click on the window. This gives you it's PID, as mentioned at: Tell a process PID by it's window?
Now just ps aux | grep <PID>
.
When you cannot figure out the name of process from the list (I had this issue with document viewer ) you can do the following to narrow down the list of suspects Before running application
ps -e | awk '{print $4}' > before.txt
run application (e.g. document viewer)
ps -e | awk '{print $4}' > after.txt
The diff will tell you which process(es) started.
diff before.txt after.txt | grep ">"
Thanks to the above answers I was able to find the executable evince
If you look under the
Help -> Advanced -> The Command Line
you can find the following:
The command line
To start the Document Viewer from the command line, type evince. You can open a specific file by typing the filename after the evince command:
evince file.pdf
You can open multiple files by typing the filenames after the evince command, separating the filenames by a space:
evince file1.pdf file2.pdf
The document viewer also supports the handling of files on the web. For example, after the evince command you can give the location of a file on the web:
evince http://www.claymath.org/millennium/P_vs_NP/pvsnp.pdf
Opening a document at a specific page
You can use the --page-label switch to open a document at a specific page. For example, to open a document to page 3, you would type:
evince --page-label=3 file.pdf
The page label should be in the same format as the page number displayed in the Document Viewer header bar.
Opening a document in fullscreen mode
evince --fullscreen file.pdf
Opening a document in presentation mode
evince --presentation file.pdf
Opening a document in preview mode
evince --preview file.pdf