/tmp/thirdfile $ exec 4>/tmp/fourthfi...">

How to see file descriptors, for example, using "lsof -l"?

I executed 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 file descriptors, something like lsof -l?

+3
source share
2 answers

I do not understand why not just use lsof:

lsof -p $$

$$ is a shell variable that contains the shell process identifier

You can also restrict only file descriptors, for example:

lsof -a -d0-65535 -p $$
+7
source

On Linux, you can do something like ls -l /proc/$$/fdthat that will show you which file descriptors are open in your shell.

, $$ , ( , , ).

+4

Source: https://habr.com/ru/post/1716171/


All Articles