The dd
Linux command is find for file conversion and copying. The establish dd
stands for ‘Knowledge Duplicator’ which presentations its primary function – to copy and convert raw knowledge.
It’s recognized for its ability to care for tasks that other similar directions can’t perform as effectively, similar to rising bootable USB drives, copying knowledge between arduous drives, or even rescuing knowledge from damaged drives.
On the other hand, it’s important to use dd
with caution. Because it operates on a low level, you’ll have the ability to merely overwrite important knowledge for many who’re not wary.
Listed below are some ways to use the dd
command:
1. Copy a Record
The elemental syntax for copying a file is dd if=inputfile of=outputfile
.
dd if=input.txt of=output.txt
2. Create an ISO Image from a CD/DVD
You’ll use dd
to create an ISO image from a CD or DVD.
dd if=/dev/cdrom of=/space/individual/cdrom_image.iso
3. Create a Bootable USB Drive
While you’ve were given an ISO image of a Linux distribution, you’ll have the ability to write it to a USB energy to create a bootable USB stick.
Exchange /dev/sdb
with the path to your USB energy.
dd if=/path/to/linux.iso of=/dev/sdb bs=4M
4. Backup an Entire Drive
You’ll use dd
to create a backup of a complete energy.
dd if=/dev/sda of=/path/to/backup.img
5. Restore a Drive from a Backup Image
You’ll restore an influence from a backup image created with dd
.
dd if=/path/to/backup.img of=/dev/sda
6. Copy a Partition
You’ll use dd
to copy a partition to each different partition.
dd if=/dev/sda1 of=/dev/sdb1
7. Create a Record of a Positive Size
You’ll use dd
to create a file of a certain dimension full of 0 bytes.
dd if=/dev/0 of=file.txt bs=1M depend=100
This command creates a file named file.txt
that is 100MB
in dimension.
8. Securely Erase a Disk
You’ll use dd
to safely erase a disk by the use of overwriting it with random bytes.
dd if=/dev/urandom of=/dev/sda bs=4M
dd
vs. cp
in Linux
The dd
and cp
directions in Linux are each and every used for copying knowledge, then again they serve different purposes and have different options.
The cp
command, fast for reproduction, is used for copying knowledge and directories. It’s in most cases used for routine tasks similar to rising a duplicate of a file or copying knowledge from one record to each different. It operates on the file level, learning and writing knowledge in this sort of manner that the file’s contents are copied.
On the other hand, the dd
command operates on a lower level, in an instant learning and writing raw knowledge from and to devices or knowledge. This command is maximum continuously used for tasks similar to rising and writing disk photos, backing up and restoring entire partitions, or even rising bootable USB drives.
By contrast to cp
, dd
can be used to copy knowledge between devices of more than a few filesystems and can copy non-regular knowledge like directories or tool knowledge.
So, in summary, cp
is a further general-purpose command for duplicating knowledge and directories, while dd
is a further specialized tool used for low-level operations involving raw knowledge.
Additional Linux directions:
List Operations | rmdir · cd · pwd |
Record Operations | cat · cp · dd · much less · ls · mkdir · mv · tail · tar · zip |
Record Software Operations | chown · mkfs |
Networking | ping · curl · wget · iptables |
Search and Text Processing | to find · grep · sed · whatis |
Software Knowledge and Keep an eye on | env · historical past · best · who |
Client and Session Keep an eye on | display screen · su · sudo |
The publish Methods to Use dd in Linux seemed first on Hongkiat.
Supply: https://www.hongkiat.com/blog/linux-command-dd/
0 Comments