Linux Watch Command Tutorial With Examples

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-watch-command-tutorial-with-examples/
PINTEREST
PINTEREST
INSTAGRAM

Some time generally long running operations like copying disk needs to track the change like disk usage or change of size of file. We generally run same command again and again but this is very cumbersome way yo see progress. Linux users created a “watch” application to make things better. When we use “watch” we can get change with specified interval times.

Syntax

Help

Help

Help

Just Watch

We will use watch command without providing any options. We wiil provide ls -lh command and run this command at 2 seconds interval. The default interval is 2 seconds.

Just Watch

Just Watch

As we can see from screenshot all files and folders are listed and will be refreshed in 2 seconds interval.

Exit or Quit

While running watch it will not end automatically. We must kill the watch process if we want to end. The simple way to end watch is using following shortcut.

Set Interval

Default interval value for watch is 2 seconds. In each interval provided command runs and the output is refreshed. We may need to change 2 seconds interval more suitable for our situation. -n option can be used to change default interval. We change ls -lh command interval to 5 seconds in the following example.

Remove Header

We can remote the watch title so we just get command output if we want to use the output from different applications.

LEARN MORE  Patch Command Tutorial With Examples For Linux

Remove Header

Remove Header

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-watch-command-tutorial-with-examples/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)