I am learning about file descriptors for the case of Linux, and I was wondering if there is any command showing a complete list that allows me to know where is each one redirected to in this moment.
Maybe some info like:
0 --> <stdin
1 --> >stdout
2 --> >stderr
3 --> >MyFileForWriting
4 --> <MyFileForReading
I have found this thread that requires lsof
, but it could be useful to have another method not depending on that command, if it exists.
I need this info concerning to Linux (I will try it too for CygWin, that does not include the 'lsof' tool until now, but behaves mostly like a POSIX compliant operating system).
Best Answer
The
/proc
file system will list exactly this information:If you are interested in some other process just replaces "self" with the corresponding PID.