3 ms·
Seriously? People still do this? ps -ef | grep foo | grep -v grep This always works: ps -ef | grep '[f]oo' And, if you're running a modern operating sys
by smcdow 15y ago
Seriously? People still do this?
ps -ef | grep foo | grep -v grep
This always works:
ps -ef | grep '[f]oo'
And, if you're running a modern operating system:
pgrep foo
- Despite 15y agoI use both, but 'grep -v grep' is far easier to type. And I almost always want the full ps output, or I'm searching for a commandline argument rather than the process name, so pgrep is out.
- smcdow 15y agofunction psg () { [[ -z "$1" ]] && return ; local _first=${1:0:1} ; local _rest=${1:1} ; [[ -z "$_rest" ]] && _rest='[^]]' ; local _com="ps -ef | grep '[$_first]'$_rest" ; eval "$_com" }
- devicenull 15y agoCheck out pgrep -f