5

Watch – A Useful Linux Command You May Have Never Heard Of


Posted by Artem Russakovskii on August 4th, 2007 in Linux
Share

Updated: November 9th, 2007

5 Responses to “Watch – A Useful Linux Command You May Have Never Heard Of”

    5 Comments:
  1. Carlos from Philly says:

    Not sure what you mean by:
    "Now if anyone knows how to make watch print the bottom part of the command output rather than the top, please post a comment."
    But using the –no-title option eliminates the:
    Every 5.0s: ls Thu Jul 24 09:53:45 2008
    portion of the output, giving you only the result of the stuff in your quotes (at the specified interval and maintaining the specified options, of course).

  2. Carlos, what I mean is, if you are trying to watch a long directory listing that doesn't fit the screen, screen would show you the top output of 'ls' for example, not the bottom.

  3. Guy says:

    Artem,
    Just pipe it out to the tail function, try this:

    watch -d 'ls -l /usr/bin | tail -n 50'

    Works quite well. Now if it could only take an action when something changed, i.e., move files in a directory when we found changes to a directory.

  4. YB says:

    Thanks, Guy!
    I was looking for a way to watch a certain part of a long output and your tailpipe solution was perfect!

  5. Spyros says:

    Actually i have heard of the command but i must admit that i have really used it :) Nice post, though !

Leave a Reply

Connect with Facebook