The dd
Linux command is locate for report conversion and copying. The identify dd
stands for ‘Information Duplicator’ which displays its number one serve as – to replicate and convert uncooked information.
It’s identified for its skill to deal with duties that different equivalent instructions can’t carry out as successfully, equivalent to growing bootable USB drives, copying information between onerous drives, and even rescuing information from broken drives.
Alternatively, it’s necessary to make use of dd
with warning. As it operates on a low point, you’ll be able to simply overwrite necessary information for those who’re no longer cautious.
Listed here are many ways to make use of the dd
command:
1. Replica a Document
The fundamental syntax for copying a report is dd if=inputfile of=outputfile
.
dd if=enter.txt of=output.txt
2. Create an ISO Symbol from a CD/DVD
You’ll use dd
to create an ISO symbol from a CD or DVD.
dd if=/dev/cdrom of=/house/person/cdrom_image.iso
3. Create a Bootable USB Force
When you’ve got an ISO symbol of a Linux distribution, you’ll be able to write it to a USB power to create a bootable USB stick.
Substitute /dev/sdb
with the trail in your USB power.
dd if=/trail/to/linux.iso of=/dev/sdb bs=4M
4. Backup an Whole Force
You’ll use dd
to create a backup of a whole power.
dd if=/dev/sda of=/trail/to/backup.img
5. Repair a Force from a Backup Symbol
You’ll repair a power from a backup symbol created with dd
.
dd if=/trail/to/backup.img of=/dev/sda
6. Replica a Partition
You’ll use dd
to replicate a partition to every other partition.
dd if=/dev/sda1 of=/dev/sdb1
7. Create a Document of a Sure Measurement
You’ll use dd
to create a report of a definite measurement stuffed with 0 bytes.
dd if=/dev/0 of=report.txt bs=1M rely=100
This command creates a report named report.txt
this is 100MB
in measurement.
8. Securely Erase a Disk
You’ll use dd
to soundly erase a disk by means of overwriting it with random bytes.
dd if=/dev/urandom of=/dev/sda bs=4M
dd
vs. cp
in Linux
The dd
and cp
instructions in Linux are each used for copying information, however they serve other functions and feature other features.
The cp
command, quick for replica, is used for copying information and directories. It’s normally used for regimen duties equivalent to growing a reproduction of a report or copying information from one listing to every other. It operates at the report point, studying and writing information in this type of approach that the report’s contents are copied.
Then again, the dd
command operates on a decrease point, immediately studying and writing uncooked information from and to gadgets or information. This command is most often used for duties equivalent to growing and writing disk pictures, backing up and restoring complete walls, and even growing bootable USB drives.
In contrast to cp
, dd
can be utilized to replicate information between gadgets of various filesystems and will reproduction non-regular information like directories or software information.
So, in abstract, cp
is a extra general-purpose command for duplicating information and directories, whilst dd
is a extra specialised device used for low-level operations involving uncooked information.
Extra Linux instructions:
Listing Operations | rmdir · cd · pwd |
Document Operations | cat · cp · dd · much less · ls · mkdir · mv · tail · tar · zip |
Document Device Operations | chown · mkfs |
Networking | ping · curl · wget · iptables |
Seek and Textual content Processing | to find · grep · sed · whatis |
Device Data and Control | env · historical past · best · who |
Consumer and Consultation Control | display screen · su · sudo |
The submit Methods to Use dd in Linux gave the impression first on Hongkiat.
WordPress Website Development Source: https://www.hongkiat.com/blog/linux-command-dd/