2

I'm playing around with terminal and found stdin@ in /dev. Several questions here.

1) What does an item with an @ symbol at the end of it mean/suggest? When is it used?

2) As the question suggests, it is a link. What command can I use to figure out what this points to?

  • lr-xr-xr-x 1 root wheel 0B Feb 24 01:03 /dev/stdin@ -> fd/0 is the output I get. It points to fd/0? Thanks to @user4556274 I got my answer. But now unsure regarding what fd/0 is. – Mas Mar 6 '17 at 18:57
3
  1. The @ indicates a symbolic link. Your ls is probably an alias to ls -F (and additional flags). If you unalias ls or explicitly execute /bin/ls you won't see the filetype decorations.
  2. Execute ls -l /dev/stdin to see the target of the symbolic link.
  3. On Linux, /dev/stdin links to /proc/self/fd/0 (/dev/stdin is a link to /dev/fd/0 and /dev/fd is a link to /proc/self/fd). /proc/self is a directory on procfs where the kernel exposes information about the calling process (i.e. each process gets information about itself when it reads from /proc/self). The subdirectory fd contains an entry for each open file descriptor in the process, which is a (somewhat magic) symbolic link pointing to the file that the process has open.
  • Ahh okay that makes sense. In my bash_profile: alias ls='ls -GFh' – Mas Mar 6 '17 at 18:52

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.