//View Tip #22
» Remove every file but one
» Find occurrences of a string in a large code base without firing
» Command examples from shell-fu
» Top ten running processes
Similar Tips
» Hierarchic list of processes» Remove every file but one
» Find occurrences of a string in a large code base without firing
» Command examples from shell-fu
» Top ten running processes
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
Grepping for a process will return the grep command, this can be avoided by adding '| grep -v grep' to a command or easier in some cases altering the regular expression by adding brackets around a character.
The regular expression 'ss[h]' matches the literal string 'ssh' when it appears in the process list, but does not accidentally match the string 'ss[h]' when it appears in the process list as 'grep ss[h]'.
ps | grep 'ss[h]'
The regular expression 'ss[h]' matches the literal string 'ssh' when it appears in the process list, but does not accidentally match the string 'ss[h]' when it appears in the process list as 'grep ss[h]'.
Comments
Add your comment
Comments are currently disabled
No Comments

