[wplug] How to know open files

Patryk Laurent patryk at pakl.net
Tue Jan 6 14:18:43 EST 2004


I'll be curious to find out what others say.  I have two suggestions.  

1)  The first one is to check out "lsof" (lists open files.) 

2)  Another possibility is to use /proc/*/fd/

For example, if I am running "less test" to view the file called "test",
and less is running with process ID 3703, I can determine which files that
process has open by doing:

$ cd /proc/3703/fd/
$ ls -l
lrwx------    1 patryk   patryk         64 Jan  6 14:14 0 -> /dev/pts/2
lrwx------    1 patryk   patryk         64 Jan  6 14:14 1 -> /dev/pts/2
lrwx------    1 patryk   patryk         64 Jan  6 14:14 2 -> /dev/pts/2
lr-x------    1 patryk   patryk         64 Jan  6 14:14 3 -> /dev/tty
lr-x------    1 patryk   patryk         64 Jan  6 14:14 4 -> /home/patryk/test


  As you can see, it shows all file descriptors open by that process.

Enjoy,
Patryk





More information about the wplug mailing list