2 ms·
> everything is text Everything is a byte stream. Usually that means text but sometimes it doesn't. Which means you can do fun stuff like: - copy file systems
by laumars 6y ago
> everything is text
Everything is a byte stream. Usually that means text but sometimes it doesn't. Which means you can do fun stuff like:
- copy file systems over a network: https://docs.oracle.com/cd/E18752_01/html/819-5461/gbchx.html https://docs.oracle.com/cd/E18752_01/html/819-5461/gbchx.htm...
- stream a file into gzip
- backup or restore an SD card using `cat`
- jrumbut 6y agoAlso dd, which may be the disk destroyer but is also a great tool for binary file miracles. See one here: https://unix.stackexchange.com/questions/6852/best-way-to-remove-bytes-from-the-start-of-a-file https://unix.stackexchange.com/questions/6852/best-way-to-re...
- dredmorbius 6y ago"data definition", from MVS JCL. https://news.ycombinator.com/user?id=dredmorbius https://news.ycombinator.com/user?id=dredmorbius
- mjevans 6y agoI recall hearing conjecture that cc was already a routine, and that "copy and convert" became dd as a result in a really old system that may have been pre-unix. Researching, it appears that there are multiple attributions, because it's just that obvious and necessary a routine. https://www2.cs.duke.edu/csl/docs/unix_course/intro-98.html https://www2.cs.duke.edu/csl/docs/unix_course/intro-98.html https://unix.stackexchange.com/questions/6804/what-does-dd-stand-for https://unix.stackexchange.com/questions/6804/what-does-dd-s... https://en.wikipedia.org/wiki/Dd_(Unix) https://en.wikipedia.org/wiki/Dd_(Unix)
- jrumbut 6y agoYeah disk destroyer or data deleter or whatever is the old joke, not it's actual name. For those unaware, dd has often been used for stuff like overwriting a file with random noise as a homespun secure delete function, and it can do a lot of damage with small typos in the command. Could have used a \s or something to clarify.
- laumars 6y agodd doesn’t example byte stream pipelines though ;) But yes, that’s the typical file / block management tool. Just remember to set a block size otherwise you’d suffer from worse performance than using cat
- jrumbut 6y agoYou're right! I was planning to tell a story about some bulk file changes using dd, but then I saw it was a giant "you had to be there" story so I posted with half a context.