On 2008-04-22 15:45 +0200, Matthew Macdonald-Wallace wrote:

> On Tue, 22 Apr 2008 21:35:31 +0800
> paragasu <[EMAIL PROTECTED]> wrote:
>
>> now i am wondering. whether it is because the command i just executed
>> or my hard disk is really dying?
>
> It could be either.  The command you typed effectively formatted the
> disk.

I don't think so.

> /dev/null contains no data. It is the Linux equivalent of a black
> hole.  If you send the output of /dev/null to a file (which is exactly
> what you have done) with a single chevron (>), it will overwrite
> anything that exists in that file (in this case the entire contents of
> your disk).

Only true for an ordinary file and because it's the shell that truncates
the file before the redirection.  Since you cannot read anything from
/dev/null, catting it to device files is harmless.  It's a different
story with /dev/zero instead of /dev/null ...

>  If you use a double chevron (>>) you will append the
> contents of /dev/null to the end of the file (in this case, your disk).

But because you append nothing, that's actually a no-op.

Sven


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to