APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

2003/12/28 watch


Some material is very old and may be incorrect today

© December 2003 Tony Lawrence

(Linux) Runs some other command at regular intervals and shows you the result. Useful for when you are constantly checking on something like diskpace, the size of a file, some network connection: whatever, it really doesn't matter. Just run "watch" with your command , enclosing it in quotes if you are using pipes:


watch 'ps aux | grep myprocess'
 

The default is to run your command every two seconds, which is usually way too soon. There's a handy -d flag that highlights differences from the last run. You may want to add -c to that if your really need to notice a change whether or not you happened to be looking when it happened.

Finally, "watch" only displays the first screenful of output.

# watch logins every 10 seconds, marking changes cumulatively
watch -n 10 -dc w
 

If you found something useful today, please consider a small donation.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> watch


Inexpensive and informative Apple related e-books:

Take Control of IOS 11

Sierra: A Take Control Crash Course

Take Control of Upgrading to El Capitan

iOS 10: A Take Control Crash Course

Take Control of Apple Mail, Third Edition





More Articles by © Tony Lawrence





Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us


Printer Friendly Version





A man can be destroyed but not defeated. (Ernest Hemingway)




Linux posts

Troubleshooting posts


This post tagged:

Scripting

Shell

UnixWords



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode