Sunday, May 26, 2013

How many programs are running in which directories?

Every program has a "current working directory".

The following will list all of the current "current working directories" and how many processes are in each one.

For Linux:
readlink /proc/*/cwd|sort|uniq -c
For all Unixes:
lsof|grep cwd|awk '{print $9}'|sort|uniq -c

No comments:

Post a Comment