Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

12
  • 5
    One more special use: dd can read binary data from nonseekable file descriptors without potentially destroying unread data due to stdio buffering. See here for an example: etalabs.net/sh_tricks.html Commented May 7, 2011 at 2:11
  • 3
    @R..: Yes. In GNU coreutils 6.10, head -c N calls read and never goes beyond N. In NetBSD 5.1, head -c calls getc. In FreeBSD 7.4, head -c calls fread. Commented May 7, 2011 at 12:29
  • 1
    Any Bourne-like shell can open a file without truncating with the <> redirection operator (read-write, you can use the reading in place of seek if you want to write in the middle of the file). ksh93 has seeking operators (>#((...))...). Commented Feb 21, 2014 at 21:19
  • 2
    Coreutils dd also exposes O_DIRECT (etc.) to shell scripting, which I think is also unique. Commented Aug 2, 2017 at 16:11
  • 1
    Coreutils truncate allows truncating or extending files, thus eliminating another use of dd. Commented Nov 17, 2018 at 21:14