UNIX System Commands
Use []
in grep
to find a process
and not include the grep
command itself when you pipe
ps -ef
output to grep
:
For example:
$ ps -ef | grep inet[d]
will normally display one line like this:
root 938 1 0 Dec 6 ? 0:36 /usr/sbin/inetd
but, just:
$ ps -ef | grep inetd
will generally display the grep
process also:
root 938 1 0 Dec 6 ? 0:36 /usr/sbin/inetd root 5494 5398 0 18:45:05 pts/5 0:00 grep inetd
See also the pidof command:
$ pidof sshd 22953 22838 862