Re: Question about /dev/null

From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: 11/11/04


Date: 11 Nov 2004 02:48:11 GMT

On 2004-11-11, Jeffrey Froman wrote:
> Thomas Keller wrote:
>
>> This might sound a bit stupid, but could somebody please explain the
>> purpose of such devices like /dev/null or /dev/zero to me?
>
> A use for /dev/null that hasn't been mentioned is to completely clean out a
> file without removing that file. This is sometimes handy for certain log
> files, for example:
>
> cat /dev/null > log.txt
>
> Leaves log.txt intact, but it is now empty.

    So do these, and /dev/null is not needed (nor any external
    command):

echo -n > log.txt
printf "" > log.txt
> log.txt

-- 
    Chris F.A. Johnson                        http://cfaj.freeshell.org
    ===================================================================
    My code (if any) in this post is copyright 2004, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License


Relevant Pages

  • Re: Question about /dev/null
    ... Jeffrey Froman wrote: ... >>This might sound a bit stupid, but could somebody please explain the ... > file without removing that file. ...
    (alt.os.linux)
  • Re: Iranian Pilgrims in Mecca Shout "Death to America" - Video
    ... Though this is a laughable attempt on your part to sound ... > a psycho has neither a boss nor a subordinate, ... Are you telling me you're that stupid and one ...
    (soc.culture.iranian)
  • Re: How to murder these damned cutesy UI sounds in Tiger!!!
    ... Needless to say, I have no use for these stupid bonks, buzzes, ... information overload about almost every aspect of sound, ... trash, ... You can turn these off from the System Preferences>Sound Control Panel. ...
    (comp.sys.mac.system)
  • Re: NYTimes: BluRay vs. HD-DVD
    ... How are DVD-A or that other HD sound format doing?? ... That's a stupid perspective, Rich. ... doesn't make it the highest quality. ... it is dead. ...
    (rec.arts.movies.current-films)