7

How to redirect output from dd command to /dev/null?

2 Answers 2

15

If you want to redirect the data output, use the of argument:

dd if=/dev/urandom of=/dev/null count=1

If you want to redirect both the data output and the progress messages:

dd if=/dev/urandom count=1 >/dev/null 2>&1

If you want to save the data and throw away the messages:

dd if=/dev/urandom of=output_file count=1 2>/dev/null

In these examples /dev/urandom and the count argument are simply being used for demonstration.

3

By default dd sends what it read from if to stdout, but usually (always?) one wants to redirect it to a file. Use the of parameter for that.

dd if=from of=to

So you want to replace to with /dev/null.

You must log in to answer this question.