-
Website
http://www.tech-recipes.com/ -
Original page
http://www.tech-recipes.com/rx/742/kill-the-undesired-unix-processes-in-one-go/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
davak
83 comments · 1 points
-
Web Design
3 comments · 1 points
-
danishbacker
9 comments · 1 points
-
flexinfo
11 comments · 1 points
-
Tonychelle
4 comments · 1 points
-
-
Popular Threads
-
Facebook: How To Get Only Status Updates on Your FB Home Page
1 week ago · 4 comments
-
Firefox: Enable Case Sensitive Searches When Using Find (Ctrl+F)
4 days ago · 1 comment
-
Windows 7: How To Disable Live Preview for Taskbar Thumbnails
1 week ago · 2 comments
-
Gmail: How to block a sender from your inbox
2 weeks ago · 3 comments
-
Our first iPhone game GreenThumb available in the App Store
3 weeks ago · 2 comments
-
Facebook: How To Get Only Status Updates on Your FB Home Page
thanks for posting this great help jproctor
In the most basic usage, grep will search through text looking for the search string. If you want to look for commands containing the string 'http' you would simply use:
..... | grep http | ....Grep stands for global regular expression parser and is a magnificently powerful tool. The important thing to take out of that mouthful is 'regular expression' which is a formal language for representing elaborate wildcards for searching. For example, a period matches any single character, so .at would match bat, cat, rat, and so on. Used in a grep statement, it would match that regular expression anywhere in the line, so it would also match brat and bats. Regular expressions would be a great idea for a series of rec.pes.
always try a kill (without -9) first
kill -9 `ps -ef | grep <process-name> | grep -v grep | awk '{print $2}'`
Just make sure that you keyin the correct process name in the above command.
thanks for posting this great help jproctor</ul>
you can use pgrep and pkill
PID TTY COMMAND
2345 ? 0:00 msgcntl //
4977 pts/tc 0:00 ps
3807 ? 0:00 spectrum
3813 ? 0:00 msgcntl //
3802 ? 0:00 printmgr
3814 ? 0:00 ssmcntl//
3810 ? 0:00 ptrcntl//
3815 ? 0:00 ssmcntl//
3811 ? 0:00 termcntl//
3817 ? 0:00 ssmcntl//
3816 ? 0:00 pccntl//
3798 ? 0:00 rsetcntl//
2215 pts/tc 0:00 sh
<font color="blue">In the above scenario, I have to kill all the process except ps and sh . How to do that ?</font>
egrep -v "ps|sh|PID" file | awk '{print $1}' | xargs kill