Unix: find out what files are in use
August 29, 2007 03:50:17 Last update: August 29, 2007 03:53:02
The command
1. List what files are in use by process with id 2512:
2. To find the process that has /u/abe/foo open, use:
3. To find who's accessing the CDROM:
4. To list all files using any protocol on port 80:
This is a link to the man page: http://www.netadmintools.com/html/lsof.man.html
lsof lists all open files. Here are some simple uses:
1. List what files are in use by process with id 2512:
/usr/sbin/lsof -p 2512
2. To find the process that has /u/abe/foo open, use:
lsof /u/abe/foo
3. To find who's accessing the CDROM:
$ /usr/sbin/lsof /media/cdrom COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME bash 4236 drxi cwd DIR 22,0 4096 1856 /media/cdrom $
4. To list all files using any protocol on port 80:
lsof -i :80
This is a link to the man page: http://www.netadmintools.com/html/lsof.man.html
Easy email testing with http://www.ximailstop.com