nixCraft Poll

Topics

How do I monitor Linux/BSD system over time without scrolling output?

Posted by Vivek Gite [Last updated: March 27, 2006]

Suppose you would like to monitor memory utilization over time without having to look at scrolling output or disk space without scrolling output then normal commands do not provide any options.

You need to use watch command, which execute a program periodically, showing output in fullscreen mode. It runs command repeatedly, displaying its output. This allows you to watch the program output change over time. By default, the program is run every 2 seconds.

To watch memory usage:

$ watch free -m

Run free –m program is run every 5 seconds:

$ watch -n 5 free -m

To watch disk space usage:

$ watch df -h

To watch the contents of a directory change, you could use:

$ watch -d ls –l

Options:

Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. Anonymous Says:

    that doesnt work in bsd. im searching for the solution right now, just letting you know that watch in open and freebsd does something else than it does in linux

  2. John Says:

    For FreeBSD:

    cd /usr/ports/sysutils/cmdwatch && make install clean

    then substitute cmdwatch for watch as listed above.

    The other BSD’s should be very similar.
    The stock BSD watch is for snooping on other tty’s (which can be rather useful too :-D ).

    But thx for this, it’s helpful to keep an eye on httpd errors, during web development, as well as busloads of other tasks.

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.