Logo Background

Unix Standard File And Redirection

  • By on October 28, 2008 | No Comments

    1) Standard output (stdout – file descriptor is 1)

    The standard output from the shell script will goes to the monitor display screen

    2) Standard input (stdin – file descriptor is 0)

    The standard input from shell will read the command from the keyboard

    3) Standard error (stderr – file descriptor is 2)

    By default, the error messages from shell will goes to monitor display screen. However, you might need to redirect the error to a file if you are running scheduled cron jobs using crontab

    Redirection command

    > Redirect output to file

    < Read input from file >> Append, redirect output to end of file

    2> Redirect standard errors to file (good in use for scheduled cron jobs)

    2>> Append, redirect standard error to end of file

    >2&1 Redirect output and error to file

    Previous
    Next
    » Unix SED command
Leave a Comment