本文主要是介绍How to list the open file descriptors (and the files they refer to) in my current bash session,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
轉載 自https://unix.stackexchange.com/questions/333186/how-to-list-the-open-file-descriptors-and-the-files-they-refer-to-in-my-curren
Yes, this will list all open file descriptors:
$ ls -la /proc/$$/fd
total 0
dr-x------ 2 sorontar sorontar 0 Dec 28 00:56 .
dr-xr-xr-x 9 sorontar sorontar 0 Dec 28 00:56 ..
lrwx------ 1 sorontar sorontar 64 Dec 28 00:56 0 -> /dev/pts/6
lrwx------ 1 sorontar sorontar 64 Dec 28 00:56 1 -> /dev/pts/6
lrwx------ 1 sorontar sorontar 64 Dec 28 00:56 2 -> /dev/pts/6
lrwx------ 1 sorontar sorontar 64 Dec 28 00:56 255 -> /dev/pts/6
l-wx------ 1 sorontar sorontar 64 Dec 28 00:56 4 -> /home/sorontar/testfile.txt
Of course, as usual: 0 is stdin, 1 is stdout and 2 is stderr.
The 4th is an open file (to write) in this case.
这篇关于How to list the open file descriptors (and the files they refer to) in my current bash session的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!