Copying Files via `cat` and `dd`

cat and dd are standard Unix utilities for handling file data.

  • cat outputs the contents of a file to stdout.
  • dd reads stdin (if no if=) and writes to stdout or a file.

To copy a file, you can use a Unix pipe (|) to send cat's output to dd, then write to a destination file:

1
cat sourcefile | dd of=destinationfile

Potential Advantages of cat and dd Over cp

Better progress/statistics

  • dd with the status=progress (GNU dd) option shows live copy statistics:
    1
    cat bigfile | dd of=outfile status=progress

Working Around cp Limitations

  • Some device files, file descriptors, or pseudo-files (like /proc or /sys) do not support cp, but streaming with cat + dd may work.

Copying Files via `cat` and `dd`
https://jifengwu2k.github.io/2025/08/12/Copying-Files-via-cat-and-dd/
Author
Jifeng Wu
Posted on
August 12, 2025
Licensed under