Re: Question about /dev/null
From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: 11/11/04
- Next message: Benjamin Khoo: "Re: Palm USB sync?"
- Previous message: Bill Unruh: "Re: Question about /dev/null"
- In reply to: Jeffrey Froman: "Re: Question about /dev/null"
- Next in thread: Thomas Keller: "Re: Question about /dev/null"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Benjamin Khoo: "Re: Palm USB sync?"
- Previous message: Bill Unruh: "Re: Question about /dev/null"
- In reply to: Jeffrey Froman: "Re: Question about /dev/null"
- Next in thread: Thomas Keller: "Re: Question about /dev/null"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|