11 ms·
Unix history is always fascinating. >None of this explains dd. This one really made me think. I have never thought about dd before. Although I have wondered a
by pseudostem 4y ago
Unix history is always fascinating.
>None of this explains dd.
This one really made me think. I have never thought about dd before. Although I have wondered about other commands. Perhaps the author should also have added some command options not requiring a minus prefix, e.g. tar, ps.
The manpage [0] reads:
In the first (legacy) form, all option flags except for -C and -I must be contained within the first argument to tar and must not be prefixed by a hyphen (`-'). Option arguments, if any, are processed as subsequent arguments to tar and are processed in the order in which their corresponding option flags have been presented on the command line.
In the second and preferred form, option flags may be given in any order and are immediately followed by their corresponding option argument values.
[0]: http://man.openbsd.org/tar http://man.openbsd.org/tar
- dredmorbius 4y agodd is a mainframe command, and its syntax follows the JCL conventions used there. https://www.ibm.com/docs/en/zos-basic-skills?topic=concepts-jcl-statements-what-does-dd-statement-do https://www.ibm.com/docs/en/zos-basic-skills?topic=concepts-...
- smcameron 4y agoHuh. I'd always kind of guessed that dd used if=input-file of=output-file as a way to sort of prevent the use of shell globbing and to not rely on the order of arguments (as cp does) since dd as it is often used can be a bit dangerous (I often found myself using it with disk device files) and you want to be extra careful in specifying the input and especially the output files. Edit: wikipedia agrees with your IBM origin story https://en.wikipedia.org/wiki/Dd_(Unix)#History https://en.wikipedia.org/wiki/Dd_(Unix)#History
- dredmorbius 4y agoThe syntax is common to most JCL ("job control language") commands. I'd say "all", though there are probably exceptions. For some reason, this seems to be vanishingly scarce knowledge in Linux / Unix circles. There was a time in my life I knew how to spell JCL....
- reaperducer 4y agoFor some reason, this seems to be vanishingly scarce knowledge in Linux / Unix circles. There was someone on HN a couple of weeks ago who was astounded to learn that "modem" means "modulator-demodulator." Like it was some kind of forbidden magic. Things that you an I consider entry-level knowledge are like scrolls and rune stones to tech people these days.
- dharmab 4y agoI'm old enough to have used modems and never heard the long name before.
- imwillofficial 4y agoI remember when the internet used to scream at me. I remember the proper name of a modem from my ancient CompTIA A+ classes I took as a teenager.
- Stratoscope 4y agoYou don't have to be a certain age to have used modems. You used one today to send that comment! Likely more than one. Radio, cable, and fiber don't carry bits. They carry waves - analog signals - just like an old fashioned copper phone line. They all need a modulator-demodulator to convert between bits and waves.
- onetom 4y agoI had a similar experience, when ppl didn't know that codec comes from coder-decoder... It happened, when I called a Clojure namespace x.y.codec, with encode and decode functions in them. I've also noticed how some of my colleagues hasn't realized, that the Rust serde library is short for serialize-deserialize.
- mixmastamyk 4y agoMore in this area: http://www.catb.org/esr/faqs/things-every-hacker-once-knew/ http://www.catb.org/esr/faqs/things-every-hacker-once-knew/
- thfuran 4y agoFor safety, selecting arguments distinguished only by choice of two letters adjacent on the most common keyboard layout seems unwise.
- elvis70 4y agoThe parameter names don't seem to match those of dd. If you type man dd, the function of the tool will be described as "copy and convert". I can't find the video but there is an interview in which Kernighan, I think, explains that the tool should have been named cc but it was not possible because it was already taken by the c compiler.
- dredmorbius 4y agoThe IBM webpage only covers a few of the JCL DD parameters. There are more at pp. 486ff in Doug Lowe, MVS JCL (1994) here: http://library.lol/main/6784CBC9EE9BBA5AD26993F497514661 http://library.lol/main/6784CBC9EE9BBA5AD26993F497514661 It's still a rather rough fit, though I'm still pretty sure the connection exists. Keep in mind that Unix dd dates to the early 1970s, and JCL itself may have evolved.
- butlerm 4y agoThe name of dd(1) may have some tenuous connection to the JCL DD statement, but otherwise any similarity seems virtually non-existent. They don't even remotely do the same thing, none of the options or parameters are the same or have similar meanings, or anything like that. https://man7.org/linux/man-pages/man1/dd.1.html https://man7.org/linux/man-pages/man1/dd.1.html
- vincent-manis 4y agoMy understanding is that the name dd was essentially a joke. A DD statement in JCL defined a logical name (seen by the program) to refer to a file (`dataset'). It had many strange operands, and often its behavior was completely unintuitive. For example, here is a job that deletes the file MYFILE. //MYJOB JOB //FOOBAR DD DSNAME=MYFILE,DISP=(,DELETE) //STEP1 EXEC PGM=IEFBR14 IEFBR14 is a program that does nothing at all! Although the Unix dd command wasn't patterned on the JCL command, I suspect that the multiplicity of possible options led its designers to choose the key=value option syntax that looked vaguely OS/360ish. By the way, the - flag for options first appeared in MIT's CTSS, which was the direct ancestor (at least at the user level) of Multics.
- dredmorbius 4y agoI'd ... thought that more of the Unix arguments (block, unblock, conv, etc.) were supported on JCL, though my IBM link doesn't support that. I'll see if I can find a more canonical / complete reference.
- GuB-42 4y agodd is fine, at least fine as a disk destroyer can be. It is not standard for UNIX but it is understandable. tar is a bit messy but the worst is definitely ps. It has dash and non-dash options, and they don't have the same meaning and interact in a weird way. Edit: the command is "ps", I somehow managed to mess up the most important word...
- JadeNB 4y ago> tar is a bit messy but the worst is definitely the worst. It has dash and non-dash options, and they don't have the same meaning and interact in a weird way. Sorry if it should be obvious, but "the worst is definitely the worst" … what is the worst? (Presumably not tar, unless I'm reading incorrectly.)
- StringyBob 4y agops. By far the worst. Because it supports multiple syntax types I can never remember the ps command options. Even if you google for examples you get different syntax and end up with a mix of the same option letters doing different things in one command. It seems to lead to all sorts of subtly unexpected behaviors
- mixmastamyk 4y agops -ef | grep foo Is what I use 98% of the time.
- kQq9oHeAz6wLLS 4y agops aux then pipe to grep and/or cut. Or sort. Or...
- qsdf38100 4y agops afx I like the forest (tree) mode.
- lou1306 4y agoThe best explanation for leaving dd in its original form is that it's not really wise to alter the behaviour of a tool that has been nicknamed "destroyer of disks", regardless of that hot new CLI convention.