I did the commands (source):
$ exec 3>/tmp/thirdfile
$ exec 4>/tmp/fourthfile
$ echo drib >&3
$ echo drab >&4
$ echo another drib >&3
$ echo another drab >&4
$ exec 3>&-
$ exec 4>&-
How can I see the file handles, something like with lsof -l
?
I don't understand, why not just use lsof:
lsof -p $$
$$
being a shell variable that holds the shell's process ID
You can also limit to just file descriptors like:
lsof -a -d0-65535 -p $$
On Linux, you can do something like ls -l /proc/$$/fd
, which will show you what file descriptors are open in your shell.
Of course, substitute $$
with other numbers to inspect other processes (at least, the ones you own).
来源:https://stackoverflow.com/questions/1338877/how-to-see-file-handles-like-with-lsof-l