63

I want to use some applications shown on the Unity Launcher in a terminal, but I need to know the appropriate command to run them. How can I achieve that?

  • Thru System Settings, I configured the launcher to auto-hide and to come back when mouse is in the left upper corner. But then I coudn't activate the launcher, and I needed to start the System Settings again to revert it, and I was with terminal open. But how is the command for System Settings (and other items in the launcher)? – Sony Santos Apr 27 '12 at 18:40
64

Most default applications will have a .desktop file located in /usr/share/applications.

To find out about the corresponding terminal command that will be run when launching one of these applications open the file browser Nautilus and right click on the application's icon to select Properties in the context menu. This will give you all details you need (shown here for System Settings that will run gnome-control-center -overview)

application launcher properties view

  • 2
    Is there any alternative for this by now which can be used from within the Unity Launcher? I pretty often find myself in a situation where I find a program in the launcher and like to get this kind of information without having to fire up Nautilus or the command line first... – suamikim Sep 30 '16 at 8:54
12

If you installed the application through the repositories or through dpkg, you can use this command:

dpkg -l | grep "application name"

This will search through all your installed applications, as well as search their descriptions; searching the description is the important part here, because the description usually contains the name of the application, even if the "command" to run it does not contain the application name.

Example:

In GNOME, there's an application called the Disk Usage Analyzer. However, the command to run it from the terminal is not disk-usage-analyzer. To find out its command, you can run:

dpkg -l | grep "disk usage"

The output should contain this entry:

alaa@aa-lu:~$ dpkg -l | grep "disk usage"
ii  baobab            3.6.4-0ubuntu1          i386         GNOME disk usage analyzer

Look at the second column. The command to actually run the Disk Usage Analyzer is baobab.

6

What you can do is use xprop: it will let you click on a application and display information. To get the name, enter in a terminal:

xprop | grep WM_CLASS

if WM_CLASS doesn't work, then try with WM_COMMAND.

  • This is what I was looking for – blueray May 29 '18 at 23:56
3

First, open Synaptic by running synaptic in the terminal. Type the name of the app in the quick filter box. For an example, I'll use LibreOffice Writer. Type the name of the app in the Synaptic filter: enter image description here

It appears as the first installed result (little green box), with the full package name libreoffice-writer in the first column.

Now, try running libreoffice-writer in the terminal. Sometimes the package will run, but in this case it doesn't work: enter image description here

Now, if you look back at Synaptic, you will see that the very first result is the libreoffice package. You could just run libreoffice in the terminal, in which case you get this window: enter image description here

Or, you could type man libreoffice in the terminal. If you look at the these two screenshots: enter image description here enter image description here

You can see that to directly launch LibreOffice Writer, you can use one of two commands: lowriter or libreoffice --writer. Both work equally well.

  • That's very interesting. Ubuntu 12.04 hasn't synaptic, but it has software-center (whose name I found using it itself). But I coudn't find the System Settings, which I discovered to be gnome-control-center thru the PS way. +1 anyway. – Sony Santos Apr 27 '12 at 18:59
  • Synaptic can be installed by running sudo apt-get install synaptic in terminal. It was removed at the 11.10 release. It is such a fantastic program, such a shame that they removed it from the official install. – Ryan McClure Apr 27 '12 at 19:19
3

Some programs or applications simply run by a binary. By name of application one can find out where binary is located.

whereis name-of-application

ergo little example:

$ whereis gparted
gparted: /usr/sbin/gparted /usr/share/man/man8/gparted.8.gz

You simply can take over /usr/sbin/gparted - for to run this application gparted in entry of icon or application-name (like in cairo-dock). (in this case to run gparted root-password is necessary).

2

xprop allows finding the PID of a running window, while ps allows finding command corresponding to a PID. By combining the two together, we can find a command corresponding to a window , like so :

ps --no-headers -p $(xprop | awk -F '=' '/_NET_WM_PID/{print $2}') -o cmd 

xprop will turn your cursor into X , which you can use to click on a window, it will return the PID, and then ps will use that PID to print the command

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.