October 11, 2008

Linux Devices - Tip2 - /dev/null

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

cheers,