Posted By

kitzelh on 10/16/09


Tagged

search process


Versions (?)

Fast Process Search


 / Published in: Bash
 

I'm constantly checking to see if a certain program or process is running. This helps reduce the typing and the clutter.

  1. function fps {
  2. (( $# )) &&
  3. ps -aux | sed -n "1p;/___fps___/d;/$1/p" ||
  4. echo "Usage: fps <search string>"
  5. }
  6.  
  7. #Modified for use with multiple words in any order:
  8.  
  9. function fps {
  10. typeset x y
  11. for x in $@; do y="$y/$x/!d;"; done
  12. ps -ef | sed -n "1p;/___fps___/d;${y}p"
  13. }

Report this snippet  

You need to login to post a comment.