How-To: Kill Misbehaving Applications and Scripts (aka Processes) Under Linux
Ever have your PC freeze up and not know what to do? The following should get you out of a bind and back to normal without having to do a hard (and harmful) reboot.
Scenario #1: X Windows is still up and running but a certain application/script has frozen or is slowing down your PC.
A. [Basic] If you’re Linux distribution is using GNOME, Go to System > Administration > System Monitor and click on the Processes tab. Once there, look to see which process is hogging up your CPU resources, click on the culprit, and then click End Process. Hopefully that should be enough to get everything back to normal.

B. [Advanced] If you prefer to use the Terminal, type top at the command prompt. This will give you a dynamic view all your running processes via a command line interface. Again, look for the culprit hogging up the CPU resources and note the PID (aka Process ID) number. Next, type k and you will be prompted to enter the PID to kill. Type the number and see if the command kills the process. If yes, use Ctrl+c to exit top. If no, read on.

C. [Advanced] Ok, so PID to kill in top didn’t work. No problem. Let’s take it up a notch. Ctrl+c out of top and type:
$ killall nameofprocess
This will kill multiple versions (status: Zombie, Sleeping, Running) of the same process that are active by name. Bonus: notice you don’t have to worry about killing each process individually by PID number when using killall.
If that still doesn’t work, it’s time to literally execute the annoying process by using the parameter -9. Note that you should only use -9 as a last resort because it doesn’t allow the process to clean up after itself gracefully before terminating.
$ killall -9 nameofprocess
Sceniro #2: X Windows is complete frozen – i.e. you can’t move or click on anything.
No problem. All you have to do is:
1. Hold down Ctrl+Alt+F2 to get out of X and login at the command prompt with your username and password.
2. Follow all the same steps described in C.
3. Hold down Ctrl+Alt+F7 to go back into X once again. Everything should be working now.
Popularity: 49% [?]
|
Comments
Leave a Reply

Alexander Grundner is a San Francisco Peninsula based web publisher who spends most of his time tracking down news stories for eHomeUprade, attending technology events, or working on his next big project.