Saturday, 12 May 2018

Linux from the command line -- Save the repetition with watch

Linux from the command line -- Save the repetition with watch

Did you ever find yourself typing the same command over and over again?
Want to see how a background download is going?
If you said yes, then watch is the command for you.

Suppose a program you are running is downloading something in the background and you want to see how it's coming along?
"watch ls -lah /path/to/Downloads/somefile.tar.gz "

Or maybe you're worried that the USB hard drive you're backing up to is going to fill up.
"watch -n 15 df /path/to/usb-stick"
will let you monitor how much free space is on your USB drive, but only every 15 seconds so as to not overly interfere with the transfer.
https://www.ostechnix.com/run-a-linux-command-every-x-seconds-forever-using-watch-command/

No comments:

Post a Comment