Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Currently i am using the system monitor of gnome. It is like task manager, and has a function to end process, but sometimes this makes everything freeze and it locks up. Is there any way to fully end a process with command line faster?

share|improve this question

8 Answers 8

up vote 10 down vote accepted

Try xkill, there's applet you could put to your panel. You just click on it, then click on the window of application you'd like to kill and it's gone instantly. Very handy.

share|improve this answer
2  
+1, kill -9 can sometimes leave a mess behind and is very rarely necessary. xkill and killall <appname> are much handier for everyday use and give processes a chance to catch the signal and clean up. –  jtb Jul 30 '09 at 4:03
    
this is great, thank you very much. –  demetri Jul 31 '09 at 22:41

I would also like to add xkill. When call this from a terminal ( or a run command prompt) your cursor will change into a skull or crossbones icon, or an "X" icon. And then the next time you click on a window (any window) that application will get killed.

I found this command to be a little more intuitive and user friendly.

share|improve this answer

You want psdoom. This is a first-person shooter game in which the monsters are associated with a pid. Killing a monster sends a SIGKILL to the associated process. It is perhaps not the most efficient way to kill a process, but it may be the most entertaining.

share|improve this answer

Note that if the hanged process is a window, you have a "button" to add in Gnome toolbar, to terminate a process (you click on it, then on the concerned window)

edit : "Force Quit" is the name of it

share|improve this answer

You can use kill to send the desired signal to the process ID. You can find the process ID with pgrep, and send a signal to a named process with pkill. The pattern used to look for the process with pgrep and pkill is normally only matched against the process name. Specify -f to check the entire command line of the process. Start with a TERM signal (it's the default if no signal is specified) before using KILL ('9'), as outright killing a process may have undesirable side effects.

For sake of example, I'll use the dhclient3 process on my system.

Old way, ps | grep:

$ ps awux | grep dhclient3
root      2539  0.0  0.1   2200   220 ?        S<s  Jul28   0:00 dhclient3 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp3/dhclient.eth0.leases eth0
1000     12734  0.0  0.5   3184   732 pts/3    R+   21:58   0:00 grep dhclient3

Kill the dhclient:

$ kill -9 2539

With pgrep/pkill:

$ pgrep dhclient
2539

With -f to specify a pattern anywhere in the commandline:

$ pgrep -f leases
2539

Kill the dhclient process with pkill (signal before -f pattern):

$ pkill -f dhclient3
$ pkill -9 -f dhclient3

About signals (from the kill man page):

The default signal for kill is TERM. Use -l or -L to list available signals. Particularly useful signals include HUP, INT, KILL, STOP, CONT, and 0. Alternate signals may be specified in three ways: -9 -SIGKILL -KILL. Negative PID val‐ ues may be used to choose whole process groups; see the PGID column in ps command output. A PID of -1 is special; it indicates all processes except the kill process itself and init.

share|improve this answer
    
Don't make a habit of using kill -9 , better to ask the process to terminate gracefully (the default -TERM signal) –  nos Sep 6 '09 at 22:29
1  
ah, pkill is exactly what I was looking for as a more powerful killall, and searching for killall bought me to this question. Superuser rocks. –  Dickon Reed Dec 9 '09 at 16:30

I like to use killall as it will allow you tab through the names of the running process and if your using zsh it will give you a nice list of running processes. Start with the first letter of the process you want to kill and hit Tab.

killall fi

hitting tab there will show that I have 'firefox' available. repeat the command and if it says something about no process was killed then you accomplished your task.

share|improve this answer

You are looking for the kill command

to end a process "fully" as you requested, you can use kill like so:

kill -9 PID

although this may have unwanted effects and can leave behind temporary files and such, you should try sending the terminate signal first:

kill -TERM PID

where PID is the id of the process you wish to kill. Using the -9 switch will kill the process no matter what so be careful with this. You can determine a PID of an application using the ps command. If the process is hanging, it is likely using a fair bit of resources, so you would also see it near the top of the list using the top command. System monitor should even tell you the PID.

You could also use something like this to determine the PID:

ps -ax | grep program_name

the number on the far left should be the PID.

share|improve this answer
5  
Always worth mentioning that one should try "kill -TERM" first. It give the process a chance to clean up after itself, while "kill -KILL" causes the OS to terminate the process promptly. Temporary files may be left, and other minor annoyance can occur. –  dmckee Jul 30 '09 at 3:12
    
by fully i assume he meant promptly but that is true. –  John T Jul 30 '09 at 3:24
    
The GNOME system monitor "end process is actually running kill. –  quark Jul 30 '09 at 15:15
2  
-TERM is the default; you can just type kill PID –  bdonlan Jul 30 '09 at 17:31
    
In linux there's also the killall command, which lets you specify the program by its program name rather than its PID. –  nos Sep 6 '09 at 22:28

I usually do:

ps -feax | grep "TaskNameHere"

Which returns the PID of the task

Then

kill -9 the_process_id
share|improve this answer
    
-1 for not using kill -TERM the_process_id –  Andrew Scagnelli Jul 30 '09 at 13:07
    
@A. Scagnelli: :) –  OscarRyz Jul 31 '09 at 0:56

Your Answer

 
discard

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