Re:Ask HN: Who's Hiring? (January 2011 Edition)
by Timothee on Saturday January 01, 2011 @12:40PM
(#2057908)
[OT] Wouldn't "ps aux | grep -c [a]pache" work the same way? Everyone seems to put "| wc -l|" but I have used the -c option to do that directly.
Re:Ask HN: Who's Hiring? (January 2011 Edition)
by twp on Saturday January 01, 2011 @12:10PM
(#2057860)
Or just
pgrep httpd | wc -l
Re:Ask HN: Who's Hiring? (January 2011 Edition)
by snorkel on Saturday January 01, 2011 @02:02PM
(#2058096)
Or just
pgrep -c apache
Re:Ask HN: Who's Hiring? (January 2011 Edition)
by bch on Saturday January 01, 2011 @07:23PM
(#2058933)
kamloops$ pgrep -c apache
pgrep: unknown option -- c
Usage: pgrep [-filnvx] [-d delim] [-G gid] [-g pgrp] [-P ppid] [-s sid] [-t tty]
[-U uid] [-u euid] pattern ...
kamloops$ uname -srNetBSD 5.99.42
kamloops$
edit: formatting.
ps aux | grep [a]pache | wc -l
(because you use the character class, it doesn't find itself as what it searches for is different than its text)