Re: /dev/zero

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Mike Garfias
Date:  
To: Main PLUG discussion list
Subject: Re: /dev/zero
Its not a file, you don't open it. It is a device that spits out zeros (or
random).

Use dd if=/dev/zero of=/tmp/test bs=512 count=1024
then open /tmp/test with your favorite editor.

You need to realize that things under /dev/ are NOT ordinary files. But unix
is such that it represents everything as a file.

There are four types of files:
Ordinary Files (what you think of as a "file")
Directories (yes, they're files too)
Special Files (IO devices, terminals - think ttys, etc)
Links - Symlinks & hardlinks (yes, they're "files" too!)

You can't just treat them all as files, they are different. But, there are
some very good reasons for representing them as files. For instance, if you
wanted to listen to a wav, you could cat some.wav > /dev/mixer to send it to
the mixer device. Same with a printer cat some.file.txt > /dev/lp/0 - you
might not get what you expect, but it does work.


Mike spoke forth with the blessed manuscript:
> The same thing happened with /dev/random
> what should I open it with?
>
> On Sunday 19 February 2006 06:44 pm, Gerard Snitselaar wrote:
> > This piqued my interest: "What ?does this look
> >
> > > like," I thought. So I typed 'jpico /dev/zero' and guess what happened!
> > > NOTHING.
> > >
> > > The enter went to the next line but nothing happened. No pretty colors
> > > and prompt.
>
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss