Answer the question
In order to leave comments, you need to log in
How to run a command in Linux in the background saving console output to a file using tee?
I run the command
dd if=/dev/zero of=/tmp/zerofile bs=100M count=5 &
5+0 records in
5+0 records out
524288000 bytes (524 MB, 500 MiB) copied, 2.04649 s, 256 MB/s
[1]+ Done dd if=/dev/zero of=/tmp/zerofile bs=100M count =5
dd if=/dev/zero of=/tmp/zerofile bs=100M count=5 | tee ku.log &
5+0 records in
5+0 records out
524288000 bytes (524 MB, 500 MiB) copied, 2.04649 s, 256 MB/s
[1]+ Done dd if=/dev/zero of=/tmp/zerofile bs=100M count =5 | tee-ku.log
Answer the question
In order to leave comments, you need to log in
The program dd
outputs the report not to stdout, but to stderr. So you need to first redirect stderr to stdout, and then pass it to tee
:
# башизм
dd if=/dev/zero of=/tmp/zerofile bs=100M count=5 |& tee ku.log &
# должно работать везде
dd if=/dev/zero of=/tmp/zerofile bs=100M count=5 2>&1 | tee ku.log &
(dd if=/dev/zero of=/tmp/zerofile bs=100M count=5 > ku.log) &
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question