7
Oct/09
0

Create a pidof command to find PID numbers easily

Most UNIX environments include the pidof command which is put to use whenever one needs to quickly determine, by name, the pid of a running program. Apple’s Mac OS X lacks the pidof command, however, one may approximate its function with the following shell script:

#!/bin/sh
ps axc|awk "{if (\$5==\"$1\") print \$1}";

Save the script as /bin/pidof and be sure to set its executable bit:

chmod a+x /bin/pidof
Tagged as: ,
Comments (0) Trackbacks (0)

No comments yet.

Leave a comment


No trackbacks yet.