Redirect Error Output To File in Linux

In Bash shell or other advance shell there are three file descriptors and these are:

  • stdin (0)
  • stdout (1)
  • stderr (2)

Redirect all error to file

# command 2> stderr.txt

Redirect output & errors to different files

# tecdistro > stdout.txt 2> stderr.txt

Redirect output and errors to same file

# tecdistro > allout.txt 2>&1
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *