How to write dd status/result message to a file?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I use this dd
command for checking disk speed:
dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct
which gives back something like this:
1 oflag=direct
1+0 records in
1+0 records out
1073741824 bytes (1,1 GB, 1,0 GiB) copied, 8,52315 s, 126 MB/s
Now I would like to pipe this output, not the file dd
is writing, but to a separate file.
I tried adding
>> /tmp/foo
or
| sudo tee /tmp/foo
to the dd
command, but that just creates an empty file.
command-line pipe dd lubuntu
add a comment |Â
up vote
1
down vote
favorite
I use this dd
command for checking disk speed:
dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct
which gives back something like this:
1 oflag=direct
1+0 records in
1+0 records out
1073741824 bytes (1,1 GB, 1,0 GiB) copied, 8,52315 s, 126 MB/s
Now I would like to pipe this output, not the file dd
is writing, but to a separate file.
I tried adding
>> /tmp/foo
or
| sudo tee /tmp/foo
to the dd
command, but that just creates an empty file.
command-line pipe dd lubuntu
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I use this dd
command for checking disk speed:
dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct
which gives back something like this:
1 oflag=direct
1+0 records in
1+0 records out
1073741824 bytes (1,1 GB, 1,0 GiB) copied, 8,52315 s, 126 MB/s
Now I would like to pipe this output, not the file dd
is writing, but to a separate file.
I tried adding
>> /tmp/foo
or
| sudo tee /tmp/foo
to the dd
command, but that just creates an empty file.
command-line pipe dd lubuntu
I use this dd
command for checking disk speed:
dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct
which gives back something like this:
1 oflag=direct
1+0 records in
1+0 records out
1073741824 bytes (1,1 GB, 1,0 GiB) copied, 8,52315 s, 126 MB/s
Now I would like to pipe this output, not the file dd
is writing, but to a separate file.
I tried adding
>> /tmp/foo
or
| sudo tee /tmp/foo
to the dd
command, but that just creates an empty file.
command-line pipe dd lubuntu
edited Jan 30 at 15:06
Kusalananda
103k13202318
103k13202318
asked Jan 30 at 14:37
rookie_senior
82
82
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
accepted
To be able to insert dd
in a pipeline before or after another command, its informational messages are written to standard error rather than to standard output.
The OpenBSD manual for dd
explicitly mentions this (but the Ubuntu manual seems to omit this fact, but mentions it in the more complete info
page):
When finished,
dd
displays the
number of complete and partial input and output blocks and truncated
input records to the standard error output.
To redirect standard error from a command, use 2>filename
. To append the standard error stream to an already existing file without truncating it, use 2>>filename
.
For example:
dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct 2>dd.txt
Note that you mix appending output in the first of your examples (using >>
) with truncating output in your second example (using tee
). To append to a file with tee
, use tee -a
.
The manual of GNUdd
is in theinfo
page, the man page is just a dump ofdd --help
for convenience for people who are not used toinfo
documentation and/or just want a quick reference with a pager. The bottom of the page will tell you where to look for the actual manual (where the writing to stderr is documented).
â Stéphane Chazelas
Jan 30 at 15:43
@StéphaneChazelas Thanks, I added a short mentianing of that. I personally have never been a friend of theinfo
system... :-/
â Kusalananda
Jan 30 at 15:45
Thanks for this clear and concise answer. Just to be clear: Usingtee
will not work in this case, because it does not read fromstderr
, correct?
â rookie_senior
Jan 30 at 15:47
@rookie_seniordd ... 2>&1 | tee ...
would work.
â Kusalananda
Jan 30 at 15:48
add a comment |Â
up vote
2
down vote
dd
output is actually printing to stderr
not stdout
You can redirect stderr
to a file for your dd
command as follows:
$ dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct
2>> /path/to/file
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
To be able to insert dd
in a pipeline before or after another command, its informational messages are written to standard error rather than to standard output.
The OpenBSD manual for dd
explicitly mentions this (but the Ubuntu manual seems to omit this fact, but mentions it in the more complete info
page):
When finished,
dd
displays the
number of complete and partial input and output blocks and truncated
input records to the standard error output.
To redirect standard error from a command, use 2>filename
. To append the standard error stream to an already existing file without truncating it, use 2>>filename
.
For example:
dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct 2>dd.txt
Note that you mix appending output in the first of your examples (using >>
) with truncating output in your second example (using tee
). To append to a file with tee
, use tee -a
.
The manual of GNUdd
is in theinfo
page, the man page is just a dump ofdd --help
for convenience for people who are not used toinfo
documentation and/or just want a quick reference with a pager. The bottom of the page will tell you where to look for the actual manual (where the writing to stderr is documented).
â Stéphane Chazelas
Jan 30 at 15:43
@StéphaneChazelas Thanks, I added a short mentianing of that. I personally have never been a friend of theinfo
system... :-/
â Kusalananda
Jan 30 at 15:45
Thanks for this clear and concise answer. Just to be clear: Usingtee
will not work in this case, because it does not read fromstderr
, correct?
â rookie_senior
Jan 30 at 15:47
@rookie_seniordd ... 2>&1 | tee ...
would work.
â Kusalananda
Jan 30 at 15:48
add a comment |Â
up vote
3
down vote
accepted
To be able to insert dd
in a pipeline before or after another command, its informational messages are written to standard error rather than to standard output.
The OpenBSD manual for dd
explicitly mentions this (but the Ubuntu manual seems to omit this fact, but mentions it in the more complete info
page):
When finished,
dd
displays the
number of complete and partial input and output blocks and truncated
input records to the standard error output.
To redirect standard error from a command, use 2>filename
. To append the standard error stream to an already existing file without truncating it, use 2>>filename
.
For example:
dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct 2>dd.txt
Note that you mix appending output in the first of your examples (using >>
) with truncating output in your second example (using tee
). To append to a file with tee
, use tee -a
.
The manual of GNUdd
is in theinfo
page, the man page is just a dump ofdd --help
for convenience for people who are not used toinfo
documentation and/or just want a quick reference with a pager. The bottom of the page will tell you where to look for the actual manual (where the writing to stderr is documented).
â Stéphane Chazelas
Jan 30 at 15:43
@StéphaneChazelas Thanks, I added a short mentianing of that. I personally have never been a friend of theinfo
system... :-/
â Kusalananda
Jan 30 at 15:45
Thanks for this clear and concise answer. Just to be clear: Usingtee
will not work in this case, because it does not read fromstderr
, correct?
â rookie_senior
Jan 30 at 15:47
@rookie_seniordd ... 2>&1 | tee ...
would work.
â Kusalananda
Jan 30 at 15:48
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
To be able to insert dd
in a pipeline before or after another command, its informational messages are written to standard error rather than to standard output.
The OpenBSD manual for dd
explicitly mentions this (but the Ubuntu manual seems to omit this fact, but mentions it in the more complete info
page):
When finished,
dd
displays the
number of complete and partial input and output blocks and truncated
input records to the standard error output.
To redirect standard error from a command, use 2>filename
. To append the standard error stream to an already existing file without truncating it, use 2>>filename
.
For example:
dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct 2>dd.txt
Note that you mix appending output in the first of your examples (using >>
) with truncating output in your second example (using tee
). To append to a file with tee
, use tee -a
.
To be able to insert dd
in a pipeline before or after another command, its informational messages are written to standard error rather than to standard output.
The OpenBSD manual for dd
explicitly mentions this (but the Ubuntu manual seems to omit this fact, but mentions it in the more complete info
page):
When finished,
dd
displays the
number of complete and partial input and output blocks and truncated
input records to the standard error output.
To redirect standard error from a command, use 2>filename
. To append the standard error stream to an already existing file without truncating it, use 2>>filename
.
For example:
dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct 2>dd.txt
Note that you mix appending output in the first of your examples (using >>
) with truncating output in your second example (using tee
). To append to a file with tee
, use tee -a
.
edited Jan 30 at 15:45
answered Jan 30 at 14:58
Kusalananda
103k13202318
103k13202318
The manual of GNUdd
is in theinfo
page, the man page is just a dump ofdd --help
for convenience for people who are not used toinfo
documentation and/or just want a quick reference with a pager. The bottom of the page will tell you where to look for the actual manual (where the writing to stderr is documented).
â Stéphane Chazelas
Jan 30 at 15:43
@StéphaneChazelas Thanks, I added a short mentianing of that. I personally have never been a friend of theinfo
system... :-/
â Kusalananda
Jan 30 at 15:45
Thanks for this clear and concise answer. Just to be clear: Usingtee
will not work in this case, because it does not read fromstderr
, correct?
â rookie_senior
Jan 30 at 15:47
@rookie_seniordd ... 2>&1 | tee ...
would work.
â Kusalananda
Jan 30 at 15:48
add a comment |Â
The manual of GNUdd
is in theinfo
page, the man page is just a dump ofdd --help
for convenience for people who are not used toinfo
documentation and/or just want a quick reference with a pager. The bottom of the page will tell you where to look for the actual manual (where the writing to stderr is documented).
â Stéphane Chazelas
Jan 30 at 15:43
@StéphaneChazelas Thanks, I added a short mentianing of that. I personally have never been a friend of theinfo
system... :-/
â Kusalananda
Jan 30 at 15:45
Thanks for this clear and concise answer. Just to be clear: Usingtee
will not work in this case, because it does not read fromstderr
, correct?
â rookie_senior
Jan 30 at 15:47
@rookie_seniordd ... 2>&1 | tee ...
would work.
â Kusalananda
Jan 30 at 15:48
The manual of GNU
dd
is in the info
page, the man page is just a dump of dd --help
for convenience for people who are not used to info
documentation and/or just want a quick reference with a pager. The bottom of the page will tell you where to look for the actual manual (where the writing to stderr is documented).â Stéphane Chazelas
Jan 30 at 15:43
The manual of GNU
dd
is in the info
page, the man page is just a dump of dd --help
for convenience for people who are not used to info
documentation and/or just want a quick reference with a pager. The bottom of the page will tell you where to look for the actual manual (where the writing to stderr is documented).â Stéphane Chazelas
Jan 30 at 15:43
@StéphaneChazelas Thanks, I added a short mentianing of that. I personally have never been a friend of the
info
system... :-/â Kusalananda
Jan 30 at 15:45
@StéphaneChazelas Thanks, I added a short mentianing of that. I personally have never been a friend of the
info
system... :-/â Kusalananda
Jan 30 at 15:45
Thanks for this clear and concise answer. Just to be clear: Using
tee
will not work in this case, because it does not read from stderr
, correct?â rookie_senior
Jan 30 at 15:47
Thanks for this clear and concise answer. Just to be clear: Using
tee
will not work in this case, because it does not read from stderr
, correct?â rookie_senior
Jan 30 at 15:47
@rookie_senior
dd ... 2>&1 | tee ...
would work.â Kusalananda
Jan 30 at 15:48
@rookie_senior
dd ... 2>&1 | tee ...
would work.â Kusalananda
Jan 30 at 15:48
add a comment |Â
up vote
2
down vote
dd
output is actually printing to stderr
not stdout
You can redirect stderr
to a file for your dd
command as follows:
$ dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct
2>> /path/to/file
add a comment |Â
up vote
2
down vote
dd
output is actually printing to stderr
not stdout
You can redirect stderr
to a file for your dd
command as follows:
$ dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct
2>> /path/to/file
add a comment |Â
up vote
2
down vote
up vote
2
down vote
dd
output is actually printing to stderr
not stdout
You can redirect stderr
to a file for your dd
command as follows:
$ dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct
2>> /path/to/file
dd
output is actually printing to stderr
not stdout
You can redirect stderr
to a file for your dd
command as follows:
$ dd if=/dev/zero of=/path/file bs=1G count=1 oflag=direct
2>> /path/to/file
answered Jan 30 at 14:52
imbuedHope
1968
1968
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f420692%2fhow-to-write-dd-status-result-message-to-a-file%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password