What Does 2>&1 Means in Crontab Commands? [Duplicate]
I've Seen Many Crontab Commands Written This Way: */5 * * * * ~/Script. Sh >/Dev/Null 2>&1 Can Someone Explain What Is the Exact Meaning of 2>&1? 2 1 Answer...
I've seen many crontab commands written this way:
*/5 * * * * ~/script.sh >/dev/null 2>&1
Can someone explain what is the exact meaning of 2>&1?
1 Answer
It's redirecting standard error to standard output using file descriptors.
This isn't a cron construct but a shell construct and is available in pretty much any shell you may come across. 2 is the file descriptor for STDERR and 1 is the file descriptor for STDOUT. The > sign is the redirection operator.
More information about file descriptors and shell redirection can be found here.