Redirection of both standard error and output

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to: navigation, search
← Appending redirected outputHomeWriting output to files →

You can redirect both stdout and stderr to file using the following syntax:

command-name &>filename
command-name >cmd.log 2>&1
command-name >/dev/null 2>&1

This syntax is often used with cron jobs:

@hourly /scripts/backup/nas.backup >/dev/null 2>&1

OR

@hourly /scripts/backup/nas.backup &>/dev/null

External links

← Appending redirected outputHomeWriting output to files →