LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-12-2014, 02:04 PM   #1
funkypunkypinkypow
LQ Newbie
 
Registered: Nov 2013
Posts: 10

Rep: Reputation: Disabled
/dev/null or /dev/zero?


Hello,
What is the difference between dd if=/dev/null of=/dev/HDD or HDD parititon and dd if=/dev/zero of=/dev/HDD or HDD parititon? English please, and which one should I use to my sda5 partition?
Thank you in advance
 
Old 04-12-2014, 02:44 PM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 343Reputation: 343Reputation: 343Reputation: 343
Hi there,

Quote:
Originally Posted by funkypunkypinkypow View Post
What is the difference between dd if=/dev/null of=/dev/HDD or HDD parititon and dd if=/dev/zero of=/dev/HDD or HDD parititon?
briefly put, /dev/null yields no input (just an eof() condition), while /dev/zero produces an endless stream of NUL bytes as input. When used as output, both ignore any data being sent to them.

So if you use /dev/null as an input for dd, the operation will stop before it has really started, effectively leaving the hard disk unchanged, while /dev/zero being used as an input really results in your hard disk being erased sector by sector, byte by byte.

Honestly, I also used to mix up /dev/null and /dev/zero for quite some time.

[X] Doc CPU

Last edited by Doc CPU; 04-12-2014 at 03:30 PM. Reason: Fixed a typo.
 
2 members found this post helpful.
Old 04-12-2014, 03:01 PM   #3
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 491Reputation: 491Reputation: 491Reputation: 491Reputation: 491
You send output you don't want to /dev/null. You use /dev/zero to output zeros to a file or device.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Stopping cron job emails to root, do I use >/dev/null 2>&1 or &> /dev/null rjo98 Linux - Newbie 3 11-12-2013 11:21 AM
[SOLVED] Why is there a need for /dev/null, /dev/zero and other special device (files) in /dev suttiwit Linux - General 13 08-07-2012 01:26 AM
LXer: /dev/null And /dev/zero On Linux And Unix: What's The Difference? LXer Syndicated Linux News 0 04-29-2009 11:50 AM
Startx Permission problems on /dev/null and /dev/mem on freshly compiled 2.6.22.1 Eric_Cartman Linux - Kernel 2 09-09-2007 02:42 AM
What is meant by " file > /dev/null 2>&1 </dev/null " attockonian Linux - Newbie 5 06-30-2006 11:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:23 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration