Blog → Post


(TIP) watch: Watching Files or Folders
...tips to ease the move to Linux
by @admin, april 16, 2016, 12:10am utc

watch allows you to repeat a command, in place, every n-seconds.

For example, if you're waiting to see when a web server log file is hit, you can run this watch command, using ls. By default it will run every 2 seconds.

$ watch ls logs -lart

The screen will not roll up. The information is just updated in place. (very handy).

Every 2.0s: ls logs -lart  

total 12
drwxr-xr-x 6 root root 4096 May 23 20:45 ..
-rw-r--r-- 1 root root    0 May 24 14:06 error.log
drwxr-xr-x 2 root root 4096 May 24 14:06 .
-rw-r--r-- 1 root root  320 May 24 14:14 access.log

You can have the changes highlighted (-d),
alter the seconds to wait between updates (-n)
and more.

Press Ctrl-c to end the watch.

tags: Beginning users, Tips
RSS Feed
      Privacy Policy
Footer done in Inkscape
© 2018-2020 La Vojo. All Rights Reserved.