In appearance, dd is a tool from an IBM operating system that's retained its foreign appearance (its parameter passing), which performs some very rarely-used functions (such as EBCDIC to ASCII conversions or endianness reversal… not a common need nowadays).
I used to think that dd was faster for copying large blocks of data on the same disk (due to more efficient use of buffering), but this isn't true, at least on today's Linux systems.
I think some of dd's options are useful when deadling with tapes, where reading is really performed in blocks (tape drivers don't hide the blocks on the storage medium the way disk drivers do). But I don't know the specifics.
One thing dd can do that can't (easily) be done by any other POSIX tool is taking the first N bytes of a stream. Many systems can do it with head -c 42, but head -c, while common, isn't in POSIX (and ins't available today on e.g. OpenBSD). (tail -c is POSIX.) Also, even where head -c exists, it might read too many bytes from the source (because it uses stdio buffering internally), which is a problem if you're reading from a special file where just reading has an effect. (Current GNU coreutils read the exact count with head -c, but FreeBSD and NetBSD use stdio.)
More generally, dd gives an interface to the underlying file API that is unique amongst Unix tools: only dd can overwrite or truncate a file at any point or seek in a file. (This is dd's unique ability, and it's a big one; oddly enough dd is best known for things that other tools can do.)
- Most Unix tools overwrite their output file, i.e. erase its contents and start it over from scratch. This is what happens when you use
> redirection in the shell as well.
- You can append to a file's contents with
>> redirection in the shell, or with tee -a.
If you want to shorten a file by removing all data after a certain point, this is supported by the underlying kernel and C API through the truncate function, but not exposed by any command line tool except dd:
dd if=/dev/null of=/file/to/truncate seek=1 bs=123456 # truncate file to 123456 bytes
If you want to overwrite data in the middle of a file, again, this is possible in the underyling API by opening the file for writing without truncating (and calling lseek to move to the desired position if necessary), but only dd can open a file without truncating or appending, or seek from the shell (more complex example).
# zero out the second kB block in the file (i.e. bytes 1024 to 2047)
dd if=/dev/zero of=/path/to/file bs=1024 seek=1 count=1 conv=notrunc
So… As a system tool, dd is pretty much useless. As a text (or binary file) processing tool, it's quite valuable!