如何查看文件句柄,如"lsof -l"?

Léo*_* 준영 3 unix file-descriptor file-handling

我做了命令(来源):

$ 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>&-
Run Code Online (Sandbox Code Playgroud)

我怎样才能看到文件句柄,类似于lsof -l

der*_*ert 7

我不明白,为什么不使用lsof:

lsof -p $$
Run Code Online (Sandbox Code Playgroud)

$$ 是一个shell变量,用于保存shell的进程ID

您还可以限制只有文件描述符,如:

lsof -a -d0-65535 -p $$
Run Code Online (Sandbox Code Playgroud)