I'm writing a script that tests the read and write speeds of my HDD. I've been able to output the read speeds using the hdparm command. I'm using this line to test the write speeds: dd if=/dev/zero of=/tmp/test.data bs=1k count=128k
This outputs to the window:
131072+0 records in 131072+0 records out 134217728 bytes (134 MB) copied, 1.18678 s, 113 MB/s
I tried using >> and > to output the results to the text file and these didn't work. Does anyone know how I can output my results to a text file?
Redirect Output to a File Only To redirect the output of a command to a file, type the command, specify the > or the >> operator, and then provide the path to a file you want to the output redirected to. For example, the ls command lists the files and folders in the current directory.
In Linux, to write text to a file, use the > and >> redirection operators or the tee command.
They're output to stderr, so try using 2>
instead of >
dd if=/dev/zero of=/tmp/test.data bs=1k count=128k 2> output.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With