How does /dev/fd relate to /proc/self/fd/?

17,214

Solution 1

/dev/fd and /proc/self/fd are exactly the same; /dev/fd is a symbolic link to /proc/self/fd. /proc/self/fd is part of a larger scheme that exposes the file descriptor of all processes (/proc/$pid/fd/$number). /dev/fd exists on other unices and is provided under Linux for compatibility. /proc/*/fd is specific to Linux.

Solution 2

They mean file descriptor in each case. Look at my answer to the second part of your question about /dev/ files. And also what file descriptors are.

The /proc filesystem is described here. /proc/self contains the properties of the current process.

Share:
17,214

Related videos on Youtube

Tim
Author by

Tim

Elitists are oppressive, anti-intellectual, ultra-conservative, and cancerous to the society, environment, and humanity. Please help make Stack Exchange a better place. Expose elite supremacy, elitist brutality, and moderation injustice to https://stackoverflow.com/contact (complicit community managers), in comments, to meta, outside Stack Exchange, and by legal actions. Push back and don't let them normalize their behaviors. Changes always happen from the bottom up. Thank you very much! Just a curious self learner. Almost always upvote replies. Thanks for enlightenment! Meanwhile, Corruption and abuses have been rampantly coming from elitists. Supportive comments have been removed and attacks are kept to control the direction of discourse. Outright vicious comments have been removed only to conceal atrocities. Systematic discrimination has been made into policies. Countless users have been harassed, persecuted, and suffocated. Q&A sites are for everyone to learn and grow, not for elitists to indulge abusive oppression, and cover up for each other. https://softwareengineering.stackexchange.com/posts/419086/revisions https://math.meta.stackexchange.com/q/32539/ (https://i.stack.imgur.com/4knYh.png) and https://math.meta.stackexchange.com/q/32548/ (https://i.stack.imgur.com/9gaZ2.png) https://meta.stackexchange.com/posts/353417/timeline (The moderators defended continuous harassment comments showing no reading and understanding of my post) https://cs.stackexchange.com/posts/125651/timeline (a PLT academic had trouble with the books I am reading and disparaged my self learning posts, and a moderator with long abusive history added more insults.) https://stackoverflow.com/posts/61679659/revisions (homework libels) Much more that have happened.

Updated on September 18, 2022

Comments

  • Tim
    Tim over 1 year
    $ ls -l /dev/stdin /dev/fd/0
    lrwx------ 1 tim tim 64 2011-08-07 09:53 /dev/fd/0 -> /dev/pts/2
    lrwxrwxrwx 1 root root 15 2011-08-06 08:14 /dev/stdin -> /proc/self/fd/0
    $ ls -l /dev/pts/2 /proc/self/fd/0
    crw--w---- 1 tim tty  136, 2 2011-08-07 09:54 /dev/pts/2
    lrwx------ 1 tim tim     64 2011-08-07 09:54 /proc/self/fd/0 -> /dev/pts/2
    
    1. What differences and relations are between /dev/fd/ and /proc/self/fd/? Do the two fd's mean both floppy disk, both file descriptor, or one for each?
    2. What are /proc/self and /proc usually for?