I am a very beginner of unix, and working on putty shell environment.
I know standard input, output, and error are streams and related to file descriptors, but I did not understand clearly what /dev/stdin does.
What is '/dev/stdin/ and how to use?
Is it a special (block or character) file of a device?
$ echo hello | cp /dev/stdin /dev/stdoutand$ cat /dev/stdin >resultfileto figure out what is the role of /dev/stdin – Godpoong Apr 21 '19 at 02:39file /dev/stdin. Your path is wrong, the trailing slash is redundant. – Weijun Zhou Apr 21 '19 at 04:30/dev/stdinto/dev/stdout, you should usedd if=/dev/stdin of=/dev/stdout,cpcopies the special file itself, it requires superuser privilege to do thiscp. After all, it does not make sense to copy the file itself and you should not trysudo cp /dev/stdin /dev/stdout. Please also checkman dup2. – Weijun Zhou Apr 21 '19 at 04:39cp /dev/stdin /dev/stdoutworks fine. example:echo yup | cp /dev/stdin /dev/stdout. And this works with both BSD's dup-like/dev/std{in,out}and with Linux's fake symlinks and quirks. Where did you get that superuser privilege idea from? – Apr 21 '19 at 16:26/dev/, but now I realize it's wrong. Also I have an aliasedcpwhen I did the tests. – Weijun Zhou Apr 21 '19 at 16:37