Linux Devices - Tip2 - /dev/null

October 11, 2008

There are 2 main reasons as to why using /dev/null..

1) Sending any files, data to /dev/null is ignored by the kernel, or must I say “discarded”. For example different output (standart, error) instead of being logged in the log files can be ignored and sent directly to the null device which in turn discards it

2) Try reading from /dev/null ? yup! reading off /dev/null results in an end of file, in thise case as if reading a 0 bytes file. Doing a cp /dev/null myfile results in a nobytes file