Question

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?

Was it helpful?

Solution

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 $$

OTHER TIPS

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top