dd

From RaySoft

Copy a file, converting and formatting according to the operands.[1]

Documentation

Parameters

bs=BYTES
Set both input and output block sizes to BYTES. This makes dd read and write bytes per block, overriding any ibs and obs settings. In addition, if no data-transforming conv option is specified, input is copied to the output as soon as it's read, even if it is smaller than the block size.
conv=ARGUMENT,[...]
Convert the file as specified by the conversion argument(s).
ascii
Convert EBCDIC to ASCII, using the conversion table specified by POSIX. This provides a 1:1 translation for all 256 bytes.
ebcdic
Convert ASCII to EBCDIC. This is the inverse of the ascii conversion.
lcase
Change uppercase letters to lowercase.
ucase
Change lowercase letters to uppercase.
count=NUMBER
Copy NUMBER ibs-byte blocks from the input file, instead of everything until the end of the file. If iflag="count_bytes" is specified, NUMBER is interpreted as a byte count rather than a block count.
NOTE:
If the input may return short reads as could be the case when reading from a pipe for example, iflag="fullblock" will ensure that count= corresponds to complete input blocks rather than the traditional POSIX specified behavior of counting input read operations.
if=FILE
Read from FILE instead of standard input.
of=FILE
Write to FILE instead of standard output. Unless conv="notrunc" is given, dd truncates file to zero bytes (or the size specified with seek=).
status=LEVEL
Specify the amount of information printed. If this operand is given multiple times, the last one takes precedence. The LEVEL value can be one of the following:
none
Do not print any informational or warning messages to stderr. Error messages are output as normal.
noxfer
Do not print the final transfer rate and volume statistics that normally make up the last status line.
progress
Print the transfer rate and volume statistics on stderr, when processing each input block. Statistics are output on a single line at most once every second, but updates can be delayed when waiting on I/O.

Examples

Create an ISO image from a CD or DVD on macOS

Show all external physical devices to find the correct device

diskutil list 'external' 'physical'

Unmount the CD or DVD

diskutil unmountDisk '/dev/disk3'

Create the ISO image

dd if='/dev/disk3s0' of="${HOME}/tmp/cd-image.iso"
Create a bootable USB flash drive from a ISO image on macOS

Show all external physical devices to find the correct device

diskutil list 'external' 'physical'

Format the USB flash drive with FAT32

sudo diskutil eraseDisk 'FAT32' 'DRIVE_NAME' 'MBR' '/dev/disk3'

Umount the USB flash drive

sudo diskutil unmountDisk '/dev/disk3'

Copy the ISO image to the USB flash drive

sudo dd if='image.iso' of='/dev/disk3' bs='4M' status='progress'

Eject the USB flash drive

sudo diskutil eject '/dev/disk3'

References

  1. man 1 'dd'