Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Even if there isn't a cli interface. I would like to be able to launch it/ kill it from command line.

share|improve this question
Could you explain exactly what you mean? Do you want to know how to launch programs listed in the applications menu from the command line? – Alvin Row Jan 26 '11 at 1:09
@DoR any application. I would like to know how to launch and kill it from cli – myusuf3 Jan 26 '11 at 1:45
up vote 17 down vote accepted

Short Version:

  • Find the Exec command for your app by grepping the applications directory

    grep 'Calculator' /usr/share/applications/*
  • Start the app

  • Kill it by hitting Ctrl+C

First, find out where your application is. A few directories are in an environment variable $PATH, so that you don't have to type the whole directory.

One way to find your app is to open the Menu Editor (right click on the Applications Menu and select Edit Menus) and find the app's command.

The calculator, for example is gcalctool at /usr/bin/gcalctool (use the whereis command to find the exact path of an app). Since /usr/bin is in the PATH variable (type echo $PATH), you can run it in your terminal by typing gcalctool.

It's now running in the foreground. You can pause it by pressing Ctrl+Z, resume it in the background by typing bg,or resume it in the foreground by typing fg. You can also use fg to raise an app to the foreground.

If you do this with multiple apps, you can use jobs to get a numbered list of all of them, and then use, for example, fg 3 to raise one of them.

An App that is in the foreground can be killed with Ctrl+C or Ctrl+\ (if it doesn't react to the former).

A universal way to find your app is to open the File Browser, go to Filesystem → usr → share → applications and to find your app there.

You'll see a bunch of .desktop files, which you can drag into a Text Editor (or use cat) to read. This is a piece of the Calculators .desktop file:

[Desktop Entry]
Comment=Perform arithmetic, scientific or financial calculations

The Exec entry is what you're interested in here. It's the same you would see if you went to the Menu Editor, just quicker. You can grep the files to search them for your app, if you can't find it.

If the app doesn't have a .desktop file in the applications directory, you have to know it's command of course. Use TAB to get suggestions from just a few letters. Press tab, tab, y to get a huge list of every application.

share|improve this answer
Another way is to use the gnome-system-monitor and find the app's logo + matching command line value in the right column. – Olivier Lalonde Jan 26 '11 at 5:03

Even when some applications uses the terminal to monitor the process of a software, there are some other programs that simply run and returns the control to the terminal. So you can close the terminal keeping the application running.

That way, pressing Ctrl-C in the terminal, won't stop the application.

You can use the "killall" command to stop the program when you face that condition in a program.

In example: if you are running kdenlive and it stops responding or you wish (as you say) to close the application using a command in the terminal, just drop a line like:

killall kdenlive

You can do this with any other application, but if you are running more than one instance of the program which is going to be killed, all the instances of the program are going to be closed.

If you -in example- drop the: killall nautilus in order to close the file browser, you are also closing the main browser that is used for the Desktop management.

share|improve this answer


gnome-open <file>

Opens any file directly from the command line in its default application.

killall <programname>

Kills all processes involving

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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