Free Hosting Online for WorkStations

< Previous | Contents | Next >

Disposing Of Unwanted Output

Sometimes “silence is golden,” and we don't want output from a command, we just want to throw it away. This applies particularly to error and status messages. The system pro- vides a way to do this by redirecting output to a special file called “/dev/null”. This file is a system device called a bit bucket which accepts input and does nothing with it. To sup- press error messages from a command, we do this:



[me@linuxbox ~]$ ls -l /bin/usr 2> /dev/null

[me@linuxbox ~]$ ls -l /bin/usr 2> /dev/null


/dev/null In Unix Culture

The bit bucket is an ancient Unix concept and due to its universality, it has ap- peared in many parts of Unix culture. When someone says he/she is sending your comments to /dev/null, now you know what it means. For more examples, see the Wikipedia article on “/dev/null”.


Top OS Cloud Computing at OnWorks: