I know that most devices are presented in the /dev directory, but only now have I actually noticed two very strange, yet familiar names in there...

I'm talking about stdin@ and stdout@ down there:

enter image description here

What are these for? Are they used by functions of the C language?

1 Answer 1


These files are actually called stdin, stdout and stderr. The @ character is added by ls to tell you that they are symbolic links. ls -l would reveal that the targets of these symbolic links are /proc/self/fd/0, /proc/self/fd/1 and /proc/self/fd/2.

/proc is a virtual filesystem provided by the kernel that shows information about the operating system. Among other things, there are directories like /proc/1234 that contain information about the process with ID 1234. /proc/self is a symbolic link to the directory for whatever process is accessing it (the kernel returns a different target to different processes).

/proc/self/fd (which is also symlinked at /dev/fd) contains one entry per file that the process has open. Each entry corresponds to a file descriptor and is a symbolic link to the file (if possible — for pipes, sockets and deleted files, the symbolic link gives information that's useful for debugging but does not point to a file that you could reopen by name). These file descriptors are the same that you manipulate with C functions such as open, close, dup, read, write, etc. They are not used by the C functions, they're other ways to interact with the same objects.

The reason /dev/stdin and friends exist is that sometimes a program requires a file name, but you want to tell it to use a file that's already open (a pipe, for instance). So you can pass /dev/stdin to tell the program to read its standard input.

Further reading:

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.