Redirect

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 *

18 − 3 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>