John Z.
John Z.

Reputation: 159

How to turn command output to a live status update?

I am curious if there's a tool or an easy way to continually execute a certain command in given intervals, and reprint its output into same place on the screen.

The example that prompted me to think about it is 'dropbox-cli status'. Manually executed:

$> dropbox-cli status
Syncing (6,762 files remaining)
Indexing 3,481 files...
$> dropbox-cli status
Syncing (5,162 files remaining)
Indexing 2,681 files...

I am looking for:

$> tracker --interval=1s "dropbox-cli status"
Syncing (6,743 files remaining)
Indexing 3,483 files

The imaginary command 'tracker' would block and the two output lines would be continually reprinted over every second, rather than creating an appending log output.

Upvotes: 8

Views: 8187

Answers (1)

cb0
cb0

Reputation: 8613

You can use watch

watch -n1 dropbox-cli status

Specify the time in seconds with param -n.

Upvotes: 19

Related Questions