Skip to content

Instantly share code, notes, and snippets.

@ykubota
Created June 8, 2014 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ykubota/a74ee5e0dd8b7c4a4991 to your computer and use it in GitHub Desktop.
Save ykubota/a74ee5e0dd8b7c4a4991 to your computer and use it in GitHub Desktop.
ps and grep
#!/bin/bash
# custom favorite ps option(s)
ps='ps auxww'
this=$0
$ps | head --lines=1
for i in $*
do
# set [c]mmand to avoid grep
command='['${i:0:1}']'${i:1}
$ps | grep -v $this | grep --color=auto $i
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment