1824971 Members
3150 Online
109678 Solutions
New Discussion юеВ

Re: What is this?

 
SOLVED
Go to solution
Ryan Clerk
Frequent Advisor

What is this?

Hello everyone,

On HP-UX 11i, I have a file called /dev/zero? What is this and do I need it?

TIA, Ryan

5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: What is this?

Well, you might not need it but it certainly does no harm and can be quite handy. This file is essentially the opposite of /dev/null. It can supply an unlimited number of ASCII NUL's. You might use it to do a disk write test. e.g.
dd if=/dev/zero bs=8k count=10000 of=/dev/rdsk/c1t1d0

Note: You only read from this device node; never write to it.
If it ain't broke, I can fix that.
Ryan Clerk
Frequent Advisor

Re: What is this?

Hello Clay,

Wow, that was fast. I'm still confused, I thought I could use /dev/null to both read and write. Is that not correct?

Ryan
Carlos Fernandez Riera
Honored Contributor

Re: What is this?

Similar but not exactly equal.

/dev/null will not send anything
/dev/zero will send 0x00 ( as said James).

You cannot fill a disk using /dev/null.
unsupported
Carlos Fernandez Riera
Honored Contributor

Re: What is this?

Sorry, he was Clay not James ( there are not too much green salads here).
unsupported
A. Clay Stephenson
Acclaimed Contributor

Re: What is this?

Hi Ryan:

Well, you can read and write from/to /dev/null but try this test to see the difference:

1) dd if=/dev/null of=/tmp/test1 bs=1k count=2
(You would expect that to write 2 1k blocks
for a 2048 byte file)

2) dd if=/dev/zero of=/tmp/test2 bs=1k count=2
(You would expect the same thing; test2 should be 2048 bytes long.)

ls -l /tmp/test*

I think you will immediately see the difference. /dev/null supplies zero bytes while /dev/zero supplies an infinite number of NUL's.

That should clear it up, Clay
If it ain't broke, I can fix that.