Facebook Twitter Instagram
    WiredRevolution.com
    • Home
    • About
    • Contact Us
    • Essential Linux Commands
    • Sitemap
    Facebook Twitter Instagram
    WiredRevolution.com
    commands

    View program output with watch

    RyanBy RyanOctober 6, 2008Updated:December 1, 20081 Min Read
    Facebook Twitter Pinterest LinkedIn Reddit WhatsApp Email

    Watch runs a program at regular interval and continuously displays the output. This allows you keep track of the changes that are occurring in the program over time.

    Run watch in the following way.

    watch [options] command
    

    By default watch updates the command output every 2 seconds. To change this interval us the ‘-n seconds‘ option.

    This will keep an eye on the changes occurring in your home directory. This will update the command output every second.

    $ watch -n 1 ls -l ~/
    

    If you use the ‘-d‘ option, watch will highlight the differences between the current and previous update. Adding ‘-d=cumulative‘ will make the highlights permanent, allowing you to see what has changed throughout the entire run.

    $ watch -d=cumulative ls -l ~/
    

    String longer commands together by enclosing them in single quotes.

    $ watch 'cat logfile | grep somestring'
    

    Watch will continue to run until you exit the program by pressing Ctrl-C.

    Share. Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Email
    Previous ArticleFormat output using printf
    Next Article Using tar to archive files

    Related Posts

    View the status of a long emerge

    Download digital camera photos with gphoto2

    List all open files with lsof

    Most Commented
    March 12, 2009

    Fix blue tinted video in Ubuntu

    September 10, 2010

    Setup SSH access between VirtualBox Host and Guest VMs

    March 8, 2011

    Install GNOME Shell in Ubuntu 10.10 Maverick

    April 4, 2009

    Setup the PS3 Bluetooth Controller on Ubuntu

    October 22, 2008

    How to correctly use LD_LIBRARY_PATH

    Recent Comments
    • Execute command on linux virtual machine (or server) from windows commandline on Setup SSH access between VirtualBox Host and Guest VMs
    • Solved: How to SSH to a VirtualBox guest externally through a host? - Daily Developer Blog on Setup SSH access between VirtualBox Host and Guest VMs
    • How to SSH to a VirtualBox guest externally through a host? [closed] – Code D3 on Setup SSH access between VirtualBox Host and Guest VMs
    • How to copy and paste from VirtualBox? [duplicate] on Setup SSH access between VirtualBox Host and Guest VMs
    • Jackie Laguna on Fix OpenGL: ChoosePixelFormat SketchUp error in WINE
    © 2025 ThemeSphere. Designed by ThemeSphere.

    Type above and press Enter to search. Press Esc to cancel.