←back to thread

172 points lnyan | 1 comments | | HN request time: 1.451s | source
Show context
6c696e7578 ◴[] No.42198530[source]
A little more typing, but I find dd present on most systems already, so I tend to do this:

  tar ... | dd status=progress | ...
replies(4): >>42198684 #>>42198757 #>>42200618 #>>42201324 #
fuzztester ◴[] No.42198757[source]
dd conv=swab is a cool and useful option. swab stands for swap bytes, iirc. guess what it is used for, those who don't already know.
replies(1): >>42199256 #
codetrotter ◴[] No.42199256[source]
> guess what it is used for, those who don't already know.

Changing the endianness of the data?

replies(1): >>42200139 #
1. fuzztester ◴[] No.42200139[source]
Exactly!

That's just what I used it for, early in my career, in a software troubleshooting case.

I was a newbie dev, tasked with converting some data from another machine / OS format on tape to a Unix machine format.

Was fairly new to Unix too.

Looked through man pages, found dd, could read and copy the data from tape drive to disk using it. But the data, while in ASCII, and English letters, seemed garbled. Seemed like actual words, but not quite, if you know what I mean. Something seemed off a bit.

I puzzled over it for a while, then checked the dd man page again. I saw the conv=swab option and its meaning, which is to swap adjacent bytes. (Typical Unix cryptic syntax, and I say that as a long term Unix guy). I probably was new to endianess at that time. This was in a pre-Internet time, so I could not google to check what endianness meant.

I added that option to my dd command line, and what was my shock and pleasure to see all the words coming out as proper English words, now, on the screen!

Then I knew that the tape contained actual data, not garbage. I saved it to disk under some file name.

Job done.