In New York City there are a lot of jobs. I went to 3 job interviews and got offers from 2. All 3 had tests of my programming skill, though the 3rd was ruthless about minor syntax errors. For instance, the guy talking to me asked me how to find all of the Apache servers running on a server. He just wanted the number. I typed: ps aux | grep apache | wc -l but this wrongly included the command I was typing. We were wor…
ps aux | grep apache | grep -v grep | wc -l
A more succinct, albeit less portable, alternative is 'pgrep apache | wc -l'. (Or 'pgrep httpd | wc -l', depending on your apache commandline.)