1836433 Members
2492 Online
110100 Solutions
New Discussion

Re: dd output

 
SOLVED
Go to solution

dd output

Is there a way to turn off the output of dd, you know, "x+y records in", "x+y records out".
I am using dd inside an x-window program that wipes classified disks of their data and those messages look kind of tacky. If I had the dd source code maybe I could modify that and incorporate it into my program, or are there other commands I could use to accomplish the same thing?

Thanks,

Greg
qwerty uiop
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor
Solution

Re: dd output

Hi, Gregory:

Redirect stderr to /dev/null as:

# dd if=inputfile of=outputfile 2>/dev/null

...JRF...


Alan Riggs
Honored Contributor

Re: dd output

dd if=... of=... 2>/logfile

Or 2>/dev/null if you prefer. Logging to file is safer, so that you can check for error conditions.
Dan Hetzel
Honored Contributor

Re: dd output

Hi Gregory,

Redirecting the standard error file descriptor is a mechanism that you can use with many (if not all) programs, not only with dd.

dd if=inputfile of=outputfile bs=xx >/dev/null 2>&1
discards both standard output and standard error

dd if=inputfile of=outputfile bs=xx 2>/dev/null
discards only std error

dd if=inputfile of=outputfile bs=xx 1>log.out 2>log.err
redirects std output and std error in 2 different files.

When redirecting, keep in mind that file descriptor 1 is std output, 2 is std error, and 0 is std input.

Those 3 file descriptors are opened automatically by all programs at runtime.

Best regards,

Dan


PS: have a look at 'man sh-posix', paragraph called Input/output for more explanations.
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Bruce Regittko_1
Esteemed Contributor

Re: dd output

Hi,

One final note: both > and 2> will most likely overwrite the log file so be careful. If you want to append to the log file, use either >> or 2>>.

--Bruce
www.stratech.com/training

Re: dd output

Thanks for all the help. I forgot you can redirect the output that way.

Greg
qwerty uiop