Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

356
Visualizações
Difference between stdout and /dev/stdout
bala@hp:~$ echo "Hello World" > stdout
bala@hp:~$ cat stdout
Hello World

bala@hp:~$ echo "Hello World" > /dev/stdout
Hello World

Kindly clarify what is the difference between stdout and /dev/stdout

Note :

bala@hp:~$ file stdout
stdout: ASCII text

bala@hp:~$ file /dev/stdout
/dev/stdout: symbolic link to `/proc/self/fd/1'

Kindly help to know the difference .

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

In your case

  • stdout is a normal file, created in the same directory where you're running the command.

    So, when you're redirecting the output of echo to stdout, it is written to the file. You need to do cat (as example, here you did) in order to see the content on screen here.

  • /dev/stdout is a device file, which is a link to /proc/self/fd/1, which means it is referring to the file descriptor 1 held by the current process.

    So, when you're redirecting the output of echo to /dev/stdout, it is sent to the standard output (the screen) directly.

over 4 years ago · Santiago Trujillo Relatório

0

stdout on its own is just a file in the current directory, no different to finances.txt. It has nothing to do with the standard output of the process other than the fact you're redirecting standard output to it.

On the other hand, /dev/stdout is a link to a special file on the procfs file system, which represents file descriptor 1 of the process using it1.

Hence it has a very real connection to the process standard output.


1 The procfs file system holds all sorts of wondrous information about the system and all its processes (assuming a process has permissions to get to them, which it should have for /proc/self).

over 4 years ago · Santiago Trujillo Relatório

0

One is a normal file, no different from any other normal file like e.g. ~/foobar.txt.

The other is a symbolic link (like one you can create with ln -s) to a special virtual file that represents file descriptor 1 in the current process.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda