dd: examples of this versatile command

dd

El dd command is quite well known in Linux. It is a fairly versatile command, but few really know what it can do beyond backing up or packaging information. That is why I have decided to create this simple tutorial with some practical examples of what this dd command could do. They are all simple examples of things that need to be done on a daily basis.

Well I guess you already know what dd is a UNIX family command and that allows copying and converting data at a low level, therefore it is quite powerful. It was generally used to make backups or backup copies of some storage media, but also to transfer specific data, convert from one type of encoding to another, etc. Although it seems like a very primitive tool, it is still used today and a lot ...

Some practical and simple examples of this command are:

  • Clone one hard drive to another so that sdb is an exact copy of the sda ​​content:

dd if=/dev/sda of=/dev/sdb

  • Make a backup copy of a directory, a file, or a partition and generate an image (IMG, ISO, ...):

dd if=/dev/sda4 of=/home/backup/imagen.img

  • Restore the previous backup:

dd if=/home/backup/imagen.img of=/dev/sda4

  • Create an ISO of an optical disc:

dd if=/dev/dvdrom of=/home/media/imagen.iso

  • Delete data from a hard drive by overwriting it:

dd if=/dev/random of=/dev/sdb

  • Create a file with a certain size, in this case 10 bytes, but you can choose the amount you want, and if you change count to 2, for example, it doubles it:

dd if=/dev/zero of=~/prueba bs=100 count=1

I hope this tutorial has helped you, as you can see it is very simple, but it can save you installing other additional programs. For example, if you want to make an ISO of a CD / DVD / BD, you can use dd instead of having a specific software for that. That also reminds me of / dev / loop or the loop device, which can also help you mount an ISO and access its content without other additional software… Remember that you can see more information about dd with "man dd". It has more options that you may find interesting.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.