Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Dd (Unix)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Use == The [[command line interface]] significantly differs from most modern shell commands in that an [[command-line option|option]] is formatted as <code>''option''{{=}}''value''</code> instead of the more typical syntax that denotes an option with a dash prefix such as: <code>-x</code>, <code>-y ''value''</code>, <code>--abc</code>, <code>--def ''value''</code>. By default, {{code|dd}} reads from [[standard input]] and writes to [[standard output]], but input and output can be overridden. Option {{code|if}} specifies an input file and option {{code|of}} specifies an output file. Non-standardized aspects of {{code|dd}} depend on the underlying system or implementation, including: * Direct memory access * Signal handling * [[End-of-file]] (EOF) handling; in particular the [[Microsoft Windows|Windows]] ports vary: [[Cygwin]] uses {{key|Ctrl|D}} (the usual for Unix) and [[MKS Toolkit]] uses {{key|Ctrl|Z}} (the usual for Windows) === Output messages === On completion, {{code|dd}} writes statistics to [[Standard streams#Standard error (stderr)|standard error]]. The format is standardized in POSIX.<ref name=SUS/>{{rp|at=STDERR}} The manual page for GNU dd does not describe this format, but the BSD manuals do. Each of the "Records in" and "Records out" lines shows the number of complete blocks transferred + the number of partial blocks, e.g. because the physical medium ended before a complete block was read, or a physical error prevented reading the complete block. If {{code|dd}} receives a [[SIGINFO]] signal while it's running {{endash}} typically triggered by the user pressing {{key|Ctrl|T}} {{endash}} it writes intermediate statistics to standard error and continues processing. === Block size === The command processes data in [[Block (data storage)|blocks]]. The default size is 512 (the POSIX-mandated size and a common legacy size for disk hardware) but can be specified via command-line options. Option {{code|bs}} specifies the size for both input (read) and output (write) operations. Alternatively, option {{code|ibs}} specifies the size for input operations and {{code|obs}} for output operations. Option {{code|cbs}} affects conversion operations. Options {{code|count}}, {{code|skip}} and {{code|seek}} specify a number of blocks: maximum to read, to start reading at offset from the start of the input, and to start writing at offset from the start of the output, respectively.<ref name=SUS/>{{rp|at=OPERANDS}} A block size option value is specified as a whole decimal number of bytes with an optional suffix to indicate a multiplier. POSIX requires suffixes {{code|b}} (blocks) for 512 and {{code|k}} ([[kibibytes]]) for 1024,<ref name=SUS/>{{rp|at=OPERANDS}} but implementations differ on other suffixes. (Free) BSD uses {{code|m}} for [[mebibytes]], {{code|g}} for [[gibibyte]]s and so on for larger [[power of two]] units.<ref name=bsd>{{man|1|dd|FreeBSD}}</ref> GNU uses {{code|M}} and {{code|G}} and so on for these units and uses {{code|kB}}, {{code|MB}}, and {{code|GB}} for [[International System of Units|SI units]].<ref name=lin/> For example, for GNU ''dd'', {{code|1=bs=16M}} indicates a size of 16 mebibytes (16777216 bytes) and {{code|1=bs=3kB}} specifies 3000 bytes. For POSIX compliance, some implementations interpret the {{code|x}} character as a multiplication operator for both block size and count option values. For example, {{code|bs{{=}}2x80x18b}} is interpreted as 2 Γ 80 Γ 18 Γ 512 = {{val|1474560|u=bytes}}, the size of a 1440 KiB [[floppy disk]].<ref name=SUS/>{{rp|at=OPERANDS}} For implementations that do not support this feature, the [[POSIX shell]] arithmetic syntax of <syntaxhighlight lang=bash inline>bs=$((2*80*18))b</syntaxhighlight> may be used. Block size affects performance. Many small reads and writes is often slower than fewer, larger ones. On the downside, larger blocks require more [[random access memory|RAM]] and can complicate error recovery. When used with a variable block size device such as a tape drive or a network, the block size may determine the tape record size or [[network packet]] size, depending on the [[communications protocol|network protocol]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)