17
$ 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?
18

/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.

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.