/Dev/null 2> & 1 details today a friend suddenly saw the following content in his own Linux maintained:/var/spool/cron/root: www.2cto.com 30 19 ****/usr/bin/** dcon. sh>/dev/null 2> & 159 23 ** 1-7/home/s **-log/squid-log.renew>/dev/null 2> & 150 1 ** 1- 7/usr/local/src/** log. sh>/dev/null 2> & 120 2 ** 1-7/home/sq **-log/** log>/dev/null 2> & 130 2 ** 1-7/home/sq **-log/** log.0130 22 ****/bin/** sync>/dev/null 2> & 100 8 ** 1-7 /home/**-log/rmco Re>/dev/null 2> & 100 16 ** 1-7/home/**-log/rmcore>/dev/null 2> & 1 he asked me why to use/ dev/null 2> & 1. this command redirects all standard output and error output to/dev/null, that is, it discards all generated information. next, let's take a look at the differences between command> file 2> file 2> & 1. www.2cto.com first ~ Command> file 2> file refers to sending the standard output information and error output information generated by the command to file. command> file 2> file: Both stdout and stderr are directly sent to file. The file will be opened twice, so that stdout and stderr will overwrite each other, in this way, both FD1 and FD2 are used to seize the file pipeline at the same time. command> file 2> & 1 directly sends stdout to file. After stderr inherits the FD1 pipeline, it is sent to file. At this time, the file is opened only once, only one pipeline FD1 is used, which includes stdout and stderr content. in terms of IO efficiency, the efficiency of the previous command is lower than that of the subsequent command. Therefore, when writing shell scripts, in most cases, we use command> file 2> & 1.