Miss the task Manager under Windows, ah, what to look at the pleasing of the program mouse points can be killed.
Today in the Firefox browser to browse the Web page, the interface instantly stuck, nothing can point, test, only switch to command line interface (CTRL+ALT+F1) to respond, cut back to the text interface Ctrl+alt+f7) or stuck. PS: Other keys feel like the failure of the general, very helpless to say ...
Walk in a daze at the command line interface, is going to force shutdown, suddenly found a previously written shell script, the function is to give a process name, will be the associated process ID all kill off.
The shell script source code is as follows:
#!/bin/sh# kill process According to process name if [$#-lt 1]then echo "Missing parameter: procedure_name" exit 1fi process= ' Ps-ef|grep $1|grep-v grep|gr Ep-v Ppid|awk ' {print $} ' for I in $PROCESSdo echo "Kill the" process [$i] " kill-9 $idone |
Effect:
If you feel that the above code is complex, you can use the following sentence directly to achieve.
Ps-ef | grep procedure_name | Grep-v grep | awk ' {print $} ' | Xargs kill-9 |
Reference address
Linux shell script implementation kills processes based on process name