LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 07-16-2003, 02:03 PM   #1
jon_k
Member
 
Registered: Jul 2003
Location: Fort Worth, Texas
Distribution: Mepis Linux 2004
Posts: 547

Rep: Reputation: 30
/dev/null


What is /dev/null and /dev/zero

They are a device of course and if a file or any type of output is put there it gets put in a black hole which crushes it into nothingness.

But what is it exactly?

hda is a virtual item that resembles the Hard Drive
cpu simulates your cpu
ram0-19 simulates your ram sticks

but what does null and zero simulate? is there an actual chip on your machine for "null" and "zero"

Another question is why is there two devices if they both do the same thing?

Did someone originally create zero but then someone else thought null was better so they made a symbolic link or something??

Thanks, regards,
JOn K
 
Old 07-16-2003, 02:13 PM   #2
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Null is neither 0 nor 1, it is a non-existent state in binary, it is the lack of a value.
 
Old 07-16-2003, 02:25 PM   #3
jon_k
Member
 
Registered: Jul 2003
Location: Fort Worth, Texas
Distribution: Mepis Linux 2004
Posts: 547

Original Poster
Rep: Reputation: 30
RE:

So is there a chip that does that or is that performed by the cpu of changing a value to null or "nil"
 
Old 07-16-2003, 02:32 PM   #4
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
A value cannot be null, it's when the program/processor doesnt have a value assigned to that variable/memory address.
Basic electronics classes taught me that when memory addresses are not connected to the data bus, they're disconnected so that another address can be connected and put it's contained value of 0 or 1 on the bus. When not connected those addresses would have an unknown value.
In binary 0 is not nothing, null is

Deleted data is often overwritten with 0s though, unless the filesystem is one which just reports the disk space to be free to be written to, and not containing anything atm.

Hope this helps a bit.

Last edited by Proud; 07-16-2003 at 02:33 PM.
 
Old 07-16-2003, 02:39 PM   #5
tcaptain
LQ Addict
 
Registered: Jul 2002
Location: Montreal
Distribution: Gentoo 2004 from stage 1 baby!
Posts: 1,403

Rep: Reputation: 45
I don't think /dev/null is supposed to refer to an actual device...

BUT I also would be interested in how it came to be...I mean you don't really have something like that in windows (that I know about anyway)...its useful for routing output into nothing...but how did we come to have it?
 
Old 07-16-2003, 02:40 PM   #6
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
If you use something like "if=/dev/zero", the input file (/dev/zero) acts like a drive (device) full of zeros so you can copy it to another device such as an actual drive (of=/dev/hda)

So, to fill your entire drive with zeros (a good idea if some virus infected os was installed), you have

dd if=/dev/zero of=/dev/hda

Result, a clean drive needing a low level format.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What would happen if I where to cat /dev/mem > /dev/null Joey.Dale Linux - General 11 07-26-2009 12:46 PM
/dev/null linuxprogrammer Linux - Newbie 1 09-05-2005 07:07 AM
/dev/null samek Linux - Software 2 12-11-2004 10:18 AM
mv c:\WINDOWS /dev/null; mount /dev/hda treehead LinuxQuestions.org Member Intro 5 10-19-2004 08:53 AM
>/dev/null lackluster Linux - Networking 5 06-27-2002 09:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration