What is the file descriptor 3 assigned by default?
Nothing: there are three standard file descriptions, STDIN, STDOUT, and STDERR. They are assigned to 0, 1, and 2 respectively.
What you are seeing there is an artifact of the way ls(1)
works: in order to read the content of the /proc/self/fd
directory and display it, it needs to open that directory.
That means it gets a file handle, typically the first available ... thus, 3.
If you were to run, say, cat
on a separate console and inspect /proc/${pid}/fd
for it you would find that only the first three were assigned.