CartMetrix - Do you know yours?

« Wordpress Hack to Debug Themes on a Live Site | Home | Centering a Page with CSS »

4/10/2007

Lsof Tricks

Lsof (LiSt Open Files) is a powerful Unix command utility that comes in handy in many security and performance related sysadmin tasks.

List the PIDs of running httpd processes. The -t option specifies terse output, only PIDs.

lsof -t `which httpd`

List process listening to port 80.

lsof -i : 80

List processes of the specified command (-c). Search is implied in this usage. It essentially searches for any process name starting with the specified value. The second example would list all process starting with m, (mysqld, mutt, etc.)

lsof -c httpd
lsof -c m

Find processes owned by users apache or nobody.

lsof -u apache,nobody

Find the files using the process specified by PID

.

lsof +p <pid>

Find processes with files open in the directory specified.

lsof +D /tmp

Popularity: 15%

Trackback:

Related Posts

Post your opinion

Verification Image

Please type the letters you see in the picture.

Subscribe without commenting


damonparker.org is proudly powered by WordPress
Entries (RSS) and Comments (RSS).

copyright © 2002-2008 damonparker.org. all rights reserved.

Close
E-mail It