shell - Selecting a value from output of ps -eaf -


suppose want select 6547 output of "ps -eaf" command, how do it? want select value , give "kill" command kill process.

root      6547     1  0 aug07 ?        00:00:00  root     14805     2  0 aug07 ?        00:00:00  root     17443 30043  0 16:21 pts/0    00:00:00  

you may have write small shell script - contain below option -

    pidlist=`ps -eaf | awk ' print $2'`       pid in pidlist       cmd="kill -9 $pid"       `$cmd`  

now based on critieria (like process name, user etc) can take action specific process. jist here use awk command exact column.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -