1

An example would be the badblocks. Just now I was using it as sudo badblocks -sv /dev/sdb

This utility takes a long time to work. Particularly for large disks from years ago that aren't in the best condition. The output is the usual 'interactive' output, roughly looks like the following.

... 5.77% done, 50:44 elapsed. (0/0/0 errors)

I am wondering if there is an utility that I can use, through piping or some other means, that would let me see the stdout as usual, and occasionally (for example once every few minutes), record the output of that program to that point in a text file. Recording every line it ever writes would be an acceptable solution as well. I also would like to keep the realtime stdout I see in the terminal.

Thanks in advance.

FedKad
  • 9,212
  • 7
  • 40
  • 79
Lacey
  • 11
  • 2
  • 3
    You can use the `script` or the `tee` command. – FedKad May 27 '19 at 18:10
  • https://stackoverflow.com/questions/418896/how-to-redirect-output-to-a-file-and-stdout – mook765 May 27 '19 at 18:21
  • If you also want an alert, when there is output, you can see [this link](https://askubuntu.com/questions/1106774/wake-me-up-when-a-slow-command-line-process-wants-my-attention). – sudodus May 27 '19 at 18:26
  • Thanks for the comments, everyone. I would upvote them but I lack the reputation on this site. Most of the equation is solved, now we just need the 'occasionally' part :) which is the hardest part I guess :p – Lacey May 27 '19 at 18:27
  • Here is an example how the command `script` works: https://askubuntu.com/a/971176/566421 – pa4080 May 28 '19 at 11:53

0 Answers0