3

I was working with Terminal then suddenly I thought of running dd without any arguments. Then it started doing something then I immediately started doing something. I got scared so I aborted it using ^C.

Output of dd:

$ dd
0+0 records in
0+0 records out
0 bytes transferred in 2.556354 secs (0 bytes/sec)
$ 
  • I'm not 100% sure, so won't post this as an answer, but I'm pretty sure nothing happens since dd on its own has no input or output targets. In fact, I would expect it to just hang. – Monomeeth Nov 4 '17 at 13:20
5

dd is a "stream duplicator".

Using dd with no operands means it will be reading and writing to the standard input/output (keyboard and screen).

From the man page (man dd)

The dd utility copies the standard input to the standard output.

So, issuing the command dd and then sending a break ControlC results in nothing being input, and nothing being written. Until you sent the break, dd was waiting for input.

Here are some examples (press ControlD to tell dd you are done entering text)

$ dd
Hello, World

results in

$ dd
Hello, World
Hello, World
0+1 records in
0+1 records out
13 bytes transferred in 6.140313 secs (2 bytes/sec)

To convert from regular to upper/lowercase:

$ dd conv=ucase
Hello, World
HELLO, WORLD

dd conv=lcase
Hello World
hello world
  • You said, "dd is a "stream duplicator".", can you provide an authoritative reference to that statement? – user3439894 Nov 4 '17 at 13:45
  • I put it in quotes because I based it from memory when I first learned it. I think it had to do with IBM, but I don't know for sure. – Allan Nov 4 '17 at 13:52
  • Since we're dealing with I/O and that's a stream, I suppose it's okay. +1. – user3439894 Nov 4 '17 at 14:24

You must log in to answer this question.