I'm looking for a tool that takes two arguments:

  • a command to execute, and
  • a target value

The tool should then run the command continuously, look for a number in the output of the command, and estimate the time it will take until the number reaches the target value.

(I already know about pv and progress, but these are limited to data going through a pipe and coreutil tools respectively. I'm looking for something more generic.)

Example: Suppose I want to track of an scp file transfer. I would then check the size on the sending end, and continuously run du -b on the receiving end. It would look something like this:

$ du -bs source_directory
$ *sometool* 5798324564 "ssh someserver du -bs destination_directory"
2019-01-28 21:03:10 - 23.2% - ETA 22:15:10 (1h 12m)
2019-01-28 21:03:40 - 26.3% - ETA 22:14:57 (1h 11m)
2019-01-28 21:04:10 - 29.3% - ETA 22:14:49 (1h 10m)
<continous output until 100% is reached>
2019-01-28 22:15:05 - 100% - done.

It would be similar to watch in the sense that it executes a given command repeatedly, but the difference being that instead of printing the output of the command, it should look for a progress value in the output, and compute an ETA.

  • I asked this question before but I worded it poorly. It was hard to understand and it got closed and deleted. Here's another attempt. I also rolled up my sleeves and wrote a tool myself, which I shared in an answer below. Happy to hear about alternative tools as well. Perhaps there's an existing tool that I've missed.
    – aioobe
    Feb 18 '19 at 18:15

There's a tool that does precisely this. It's called eta.

Here's an example:

eta example usage

Here are some resources:

  • Please explain the advantage of this tool compared to for example pv.
    – sudodus
    Feb 18 '19 at 18:25
  • @sudodus The advantage of this tool compared to pv and progress is that it's not limited to stuff that goes through a pipe or to core util processes. As long as you have a way to estimate how far a process has come (du -bs, ls | wc -l, tail -f progress.log, ...) this tool can display progress and eta.
    – aioobe
    Feb 18 '19 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.