Search code examples
linuxbashdd

What is the command dd if=/dev/sdb do?


I have formated my pendrive and it is in /dev/sdb. When I execute the command dd if=/dev/sdb command it keep printing some junk in console. My doubt is, when I format the pendrive and execute this command, it should not print anything. But why it is printing ?


Solution

  • Formatting a drive does not (generally) zero out the data; it simply writes data to certain locations on the drive such that your operating system believes that no space is allocated.

    If you really want to zero out the data, you can run:

    dd if=/dev/zero of=/dev/sdb bs=4096
    

    This will write zeros to /dev/sdb.