Copy input.img to output.img with dd using 1 MiB read/write blocks.
Which command has the correct direction?
dd uses if= for input, of= for output, and bs= for block size. The output file may be overwritten.
Detailed explanation
dd if=output.img of=input.img bs=1MIncorrect. The input and output files are reversed.
Incorrect. The input and output files are reversed.
dd input.img output.img bs=1MIncorrect. dd expects named operands such as if= and of= in this form.
Incorrect. dd expects named operands such as if= and of= in this form.
dd if=input.img of=output.img count=1MIncorrect. count=1M limits the number of blocks and does not set block size.
Incorrect. count=1M limits the number of blocks and does not set block size.
dd if=input.img of=output.img bs=1MCorrect. dd if=input.img of=output.img bs=1M copies in the requested direction.
Correct. dd if=input.img of=output.img bs=1M copies in the requested direction.
Try it yourself
An example you can run in a temporary verification environment.
tmp=$(mktemp -d); printf 'image-data' >"$tmp/input.img"; dd if="$tmp/input.img" of="$tmp/output.img" bs=1M status=none; cmp -s "$tmp/input.img" "$tmp/output.img" && echo identical; rm -rf "$tmp"Expected result
identicalKey points
- if is input file
- of is output file
- bs is block size
Notes
- Environment: GNU coreutils 9.x / 小さな一時ファイル
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.