Redirecting Standard Output and Standard Error

  1. Run the following find command, noting that both standard output and standard error are returned:
    find /etc -name passwd
  2. Rerun the command, saving standard output to a file:
    find /etc -name passwd > /tmp/find.out
  3. This time, save error message:
    find /etc -name passwd 2> /tmp/find.err
  4. Now, save the ordinary output to one file and the error message to a different file:
    find /etc -name passwd > /tmp/find.out 2> /tmp/find.err

Leave a Comment

%d bloggers like this: