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?
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
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.
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
$ 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.
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.
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.
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
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.
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.