Search code examples
linuxbashloggingdd

which log file or how do I locate this log file?


I have perhaps a dumb question, but this might be an easy point... so i run a dd command at the console and I get a message when it is done like:

 0+1 records in
 0+1 records out
 424 bytes (424 B) copied, 0.0191003 s, 22.2 kB/s

The question is, which log file or record file is this info stored in? To be CLEAR, I need to access the above message and not the output file.

Thanks in advance


Solution

  • If you're talking about the file being created by dd, it's either going to be whatever file you specified with the of= option, or standard output, possibly redirected.

    That's the way dd works: it writes to standard output by default but you can override this by specifying the output file explicitly.

    For example:

    pax> dd if=testprog.c of=/dev/null
    6+1 records in
    6+1 records out
    3454 bytes (3.5 kB) copied, 8.3585e-05 s, 41.3 MB/s
    

    If you're after the actual status output of the dd command rather than the file being copied, dd is simply writing this to standard error, so you can capture it with:

    dd if=somfile of=someotherfile 2>dd.stderr
    

    This will send standard error through to the file dd.stderr. If you don't redirect it, then it's almost certainly gone to your default standard error which tends to be your terminal. The only way to get it from there is to cut and paste it with your terminal program. As far as the file system is concerned, it's gone.