Meaning of `cat /dev/null > file`
The command will output the data from device /dev/null
to the given file (mailbox of the root account). Since /dev/null
responds just with end-of-file when reading from it nothing will be written to the file, but with the redirection >
the shell will have cleared the file already. Actually this is equivalent to writing just
> /var/spool/mail/root
(i.e., the same without cat
or /dev/null
).
cat /dev/null > /var/spool/mail/root
truncates /var/spool/mail/root
Alternative is > /var/spool/mail/root