Sunday, 21 August 2011

QuickBits-6: Search and Kill Process

Many a times we need to find a process and kill it. The best way to Find a process is

Search
 pgrep -l [pattern] 

-l will list the name of the process or else only pid will be displayed. pgrep searches for the match in any part of the name including the arguments to the command.

Example:
 pgrep -l work


output
217 kworker/u:3
218 kworker/u:4
219 kworker/u:5
863 NetworkManager
900 ./a.out work

Search & Destroy
 pkill [pattern]

It will find and kill all the process that matches the Pattern.


No comments:

Post a Comment