Talk:/dev/zero

From Wikipedia, the free encyclopedia

< Talk: | dev

I've always wondered why there isn't a /dev/one, or some such, that when read produces a continuous stream of byte 0xFF.

You could create one. Just stick a NOT on the end of /dev/zero... right? --Ihope127 00:13, 12 July 2005 (UTC)

  #! /bin/sh
  tr '\000' '\377' < /dev/zero

Paul Beardsell 03:30, 2 Sep 2004 (UTC)


Some Python code to demonstrate what /dev/zero gives you:

f=open('/dev/zero', 'r')
print repr(f.read(4))
'\x00\x00\x00\x00'

[edit] The unix infinite loop

cp /dev/zero /dev/null

Only if you have a very braindead version of cp. It should copy the device file. Arbitrary username 20:05, 13 June 2006 (UTC)

Then try:

cat /dev/zero > /dev/null

/dev/zero 16:04, 13 September 2006 (UTC)