Occasionally, a Linux Kill command is what you need to terminate an application. This happened to me last night. I was trying to re-run Firefox 3.0 after it had crashed. I was getting an unusual error which I’ve never witnessed before. I wished I had taken a screenshot of the error since I can’t remember it vis-a-vis. It said something like this, “Firefox is still running, please close the application before running another one.”
It was very unusual error since I could not find a trace of Firefox running on my desktop. There were no minimized windows, no instances of Firefox running whatsoever in the current panel I was in or in any other panel (Ubuntu has multiple panels). Zilch. Absolutely nothing, but my system still thinks Firefox is running.
One way of killing an application is to use Force Quit. You can add a force quit icon to your Top Panel by right clicking your Top Panel and selecting `Add To Panel.` Look for the `Force Quit` icon (it’s the broken window icon) and click Add. You should see a `Force Quit` icon on your Top Panel similar to the snapshot I’ve taken below. It’s the last icon to the right, the one that looks like a broken window.
In my case, I could not use Force Quit. There were no traces of Firefox running on my desktop. Well, it is time for the Kill command. So, I thought about writing a tutorial for Linux newbies on how to terminate an application that will not start because another instance of it is running in the background.
First things first, check if there is a process running in the background. Substitute the name of the offending application in place of Firefox. From the Terminal, type:
# ps -ef | grep firefox
The PS command gives you a snapshot of the current processes running on your system. I’m using the GREP command to display Firefox processes only. You should get a reply similar to the one below.
In this example, we are seeing one process with Firefox running. It has a process ID or PID of 4694. The second process is the GREP command we just issued. Just ignore this one. Based on the PS command, we’ve now determined the PID of the application that we need to KILL.
Going For The Kill
Now, for the fun part. Let’s kill this application. From the terminal, type:
# kill 4694
You can try it with -9 to ensure execution.
# kill -9 4694
That’s it. This application is now dead. You should be able to restart the application. To learn more about Linux commands, check out the following Man pages: