Simpler Navigation coming for Servers and Operating Systems
Coming soon: a much simpler Servers and Operating Systems section of the Community. We will combine many of the older boards, and you won't have to click through so many levels to get at the information you need. If you are looking for an older board and do not find it, check the consolidated boards, as the posts are still there.
Showing results for 
Search instead for 
Did you mean: 


Super Advisor


Can anyone please tell me wwhy /dev/null used?

Ivan Ferreira
Honored Contributor

Re: /dev/null

The /dev/null special file is used when you want to discard information. For example:

ls -la 2> /dev/null

This redirection will discard error messages. You won't see it on the screen.

Also, you can do some performance test using /dev/null, for example:

dd if=/dev/rdisk/dsk0c of=/dev/null bs=8k

With this command you can determine how fast can you read from a disk device.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Venkatesh BL
Honored Contributor

Re: /dev/null

There is a wiki page for almost everything these days!....
Check this one:
Rob Leadbeater
Honored Contributor

Re: /dev/null

To make your backups go really quick ... ;-)


Martin Moore

Re: /dev/null

One thing to be aware of is that if /dev/null accidentally gets removed (which I've seen happen) it can cause some odd effects. There are a number of scripts that redirect error output to /dev/null, as shown in an earlier reply. However, if /dev/null doesn't exist, a command like "cat foo 2> /dev/null" will recreate /dev/null...but as a regular file, not a data sink! This file will gradually accumulate junk and possibly fill up the root filesystem eventually.

But even worse, if /dev/null is a regular file and you try to build the kernel with doconfig, the build will fail with some very strange error messages. You can always check for this possibility with the command "file /dev/null". If it doesn't show up as a character special device file, then you should remove it and recreate it properly (cd /dev; rm null; ./MAKEDEV null).

I work for HP
A quick resolution to technical issues for your HP Enterprise products is just a click away HP Support Center Knowledge-base
See Self Help Post for more details