dd

Convert a file while copying it (UNIX)

Syntax:

dd [if=input_file] [of=output_file] [bs=bytes] [cbs=bytes]
   [count=blocks] [count=blocks] [ext=extension[,extension...]]
   [ibs=bytes] [iflag=flag[,flag...]] [obs=bytes]
   [oflag=flag[,flag...]] [seek=blocks] [skip=blocks]

Runs on:

QNX Neutrino

Options:

bs=bytes
Read and write bytes bytes at a time. This option overrides ibs and obs.
cbs=bytes
Convert bytes bytes at a time.
conv=conversion[,conversion...]
Convert the file as specified by the conversion arguments. Conversions are:
ascii
Convert EBCDIC to ASCII.
block
Pad newline-terminated records to the size specified by cbs, replacing the newline with trailing spaces.
ebcdic
Convert ASCII to EBCDIC.
ibm
Convert ASCII to alternate EBCDIC.
lcase
Change uppercase characters to lowercase.
noerror
Continue after read errors.
notrunc
Don't truncate the output file.
swab
Swap every pair of input bytes. Unlike the UNIX dd, this works when an odd number of bytes are read. If the input file contains an odd number of bytes, the last byte is simply copied (since there's nothing to swap it with).
sync
Pad every input block with trailing NULs, to the size of ibs.
ucase
Change lowercase characters to uppercase.
unblock
Remove any trailing spaces in each cbs-sized block, and add a newline.
count=blocks
Copy only blocks ibs-sized input blocks. The default is no limit.
ext=extension[,extension...]
(QXN Neutrino 7.0 or later) Apply the given QNX Neutrino extensions:
quickseek
Make the seek option reposition the file pointer by setting it explicitly instead of reading up to the specified offset.
quickskip
Make the skip option reposition the file pointer by setting it explicitly instead of reading up to the specified offset.
ibs=bytes
Read bytes bytes at a time. The default is 512 bytes.
if=input_file
Read from input_file instead of the standard input.
iflag=flag[,flag...]
Set the specified flags on the input stream. The only flag currently defined is:
  • nonblock — use O_NONBLOCK
obs=bytes
Write bytes bytes at a time. The default is 512 bytes.
of=output_file
Write to output_file instead of the standard output. Unless conv=notrunc is given, truncate the file to the size specified by seek (or 0 bytes if seek isn't given).
oflag=flag[,flag...]
Set the specified flags on the output stream. The only flag currently defined is:
  • nonblock — use O_NONBLOCK
seek=blocks
Skip blocks obs-sized blocks at the start of output.
skip=blocks
Skip blocks ibs-sized blocks at the start of input.
Note: You can follow all numbers by a multiplier:
b
Blocks (×512).
k
Kbytes (×1024).
w
Words (×2).
xm
Multiply by m.

Description:

The dd utility copies a file (from the standard input to the standard output, by default) with a user-selectable blocksize, while optionally performing conversions on it. It's meant for writing raw data directly to devices such as tape and disk or writing over the network, with control over blocking factors and character set translations.

Note: This utility is subject to the GNU Public License (GPL).

You can use this command for copying partial files. You can specify the block size, skip count, and the number of blocks to copy. Sizes are in bytes by default; you can append the letters w, b, or k to the number to indicate words (2 bytes), blocks (512 bytes), or K (1024 bytes). When dd is finished, it reports the number of full and partial blocks read and written.

Examples:

Copy file file1 to file2, converting all text to lowercase letters:

dd if=file1 of=file2 conv=lcase

Exit status:

>0
An error occurred.
0
The copy and translation operation was successful.

Contributing author:

GNU