{
    "content": [
        {
            "type": "text",
            "text": "# watch (man)\n\n## NAME\n\nwatch - execute a program periodically, showing output fullscreen\n\n## SYNOPSIS\n\nwatch [options] command\n\n## DESCRIPTION\n\nwatch runs command repeatedly, displaying its output and errors (the first screenfull).  This\nallows you to watch the program output change over time.  By default, command is run every  2\nseconds and watch will run until interrupted.\n\n## TLDR\n\n> Execute a program periodically and monitor the output in full-screen mode.\n\n- Repeatedly run a command and show the result:\n  `watch {{command}}`\n- Re-run a command every 60 seconds:\n  `watch {{-n|--interval}} 60 {{command}}`\n- Monitor disk space, highlighting differences as they appear:\n  `watch {{-d|--differences}} df`\n- Repeatedly run a pipeline and show the result:\n  `watch \"{{command1}} | {{command2}} | {{command3}}\"`\n- Exit `watch` if the visible output changes:\n  `watch {{-g|--chgexit}} {{lsblk}}`\n- Interpret terminal control characters:\n  `watch {{-c|--color}} {{ls --color=always}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (12 subsections)\n- **EXIT STATUS**\n- **ENVIRONMENT**\n- **NOTES**\n- **BUGS**\n- **EXAMPLES**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "watch",
        "section": "",
        "mode": "man",
        "summary": "watch - execute a program periodically, showing output fullscreen",
        "synopsis": "watch [options] command",
        "tldr_summary": "Execute a program periodically and monitor the output in full-screen mode.",
        "tldr_examples": [
            {
                "description": "Repeatedly run a command and show the result",
                "command": "watch {{command}}"
            },
            {
                "description": "Re-run a command every 60 seconds",
                "command": "watch {{-n|--interval}} 60 {{command}}"
            },
            {
                "description": "Monitor disk space, highlighting differences as they appear",
                "command": "watch {{-d|--differences}} df"
            },
            {
                "description": "Repeatedly run a pipeline and show the result",
                "command": "watch \"{{command1}} | {{command2}} | {{command3}}\""
            },
            {
                "description": "Exit `watch` if the visible output changes",
                "command": "watch {{-g|--chgexit}} {{lsblk}}"
            },
            {
                "description": "Interpret terminal control characters",
                "command": "watch {{-c|--color}} {{ls --color=always}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-d",
                "long": "--differences",
                "arg": null,
                "description": "Highlight the differences between successive updates. If the optional permanent argu‐ ment is specified then watch will show all changes since the first iteration."
            },
            {
                "flag": "-n",
                "long": "--interval",
                "arg": null,
                "description": "Specify update interval. The command will not allow quicker than 0.1 second interval, in which the smaller values are converted. Both '.' and ',' work for any locales. The WATCHINTERVAL environment can be used to persistently set a non-default interval (following the same rules and formatting)."
            },
            {
                "flag": "-p",
                "long": "--precise",
                "arg": null,
                "description": "Make watch attempt to run command every --interval seconds. Try it with ntptime (if present) and notice how the fractional seconds stays (nearly) the same, as opposed to normal mode where they continuously increase."
            },
            {
                "flag": "-t",
                "long": "--no-title",
                "arg": null,
                "description": "Turn off the header showing the interval, command, and current time at the top of the display, as well as the following blank line."
            },
            {
                "flag": "-b",
                "long": "--beep",
                "arg": null,
                "description": "Beep if command has a non-zero exit."
            },
            {
                "flag": "-e",
                "long": "--errexit",
                "arg": null,
                "description": "Freeze updates on command error, and exit after a key press."
            },
            {
                "flag": "-g",
                "long": "--chgexit",
                "arg": null,
                "description": "Exit when the output of command changes."
            },
            {
                "flag": "-c",
                "long": "--color",
                "arg": null,
                "description": "Interpret ANSI color and style sequences."
            },
            {
                "flag": "-x",
                "long": "--exec",
                "arg": null,
                "description": "Pass command to exec(2) instead of sh -c which reduces the need to use extra quoting to get the desired effect."
            },
            {
                "flag": "-w",
                "long": "--no-linewrap",
                "arg": null,
                "description": "Turn off line wrapping. Long lines will be truncated instead of wrapped to the next line."
            },
            {
                "flag": "-h",
                "long": "--help",
                "arg": null,
                "description": "Display help text and exit."
            },
            {
                "flag": "-v",
                "long": "--version",
                "arg": null,
                "description": "Display version information and exit."
            }
        ],
        "examples": [
            "To watch for mail, you might do",
            "watch -n 60 from",
            "To watch the contents of a directory change, you could use",
            "watch -d ls -l",
            "If you're only interested in files owned by user joe, you might use",
            "watch -d 'ls -l | fgrep joe'",
            "To see the effects of quoting, try these out",
            "watch echo $$",
            "watch echo '$$'",
            "watch echo \"'\"'$$'\"'\"",
            "To see the effect of precision time keeping, try adding -p to",
            "watch -n 10 sleep 1",
            "You can watch for your administrator to install the latest kernel with",
            "watch uname -r",
            "(Note  that -p isn't guaranteed to work across reboots, especially in the face of ntpdate (if",
            "present) or other bootup time-changing mechanisms)",
            "procps-ng                                    2020-12-06                                     WATCH(1)"
        ],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-d --differences",
                        "lines": 3,
                        "flag": "-d",
                        "long": "--differences"
                    },
                    {
                        "name": "-n --interval",
                        "lines": 5,
                        "flag": "-n",
                        "long": "--interval"
                    },
                    {
                        "name": "-p --precise",
                        "lines": 4,
                        "flag": "-p",
                        "long": "--precise"
                    },
                    {
                        "name": "-t --no-title",
                        "lines": 3,
                        "flag": "-t",
                        "long": "--no-title"
                    },
                    {
                        "name": "-b --beep",
                        "lines": 2,
                        "flag": "-b",
                        "long": "--beep"
                    },
                    {
                        "name": "-e --errexit",
                        "lines": 2,
                        "flag": "-e",
                        "long": "--errexit"
                    },
                    {
                        "name": "-g --chgexit",
                        "lines": 2,
                        "flag": "-g",
                        "long": "--chgexit"
                    },
                    {
                        "name": "-c --color",
                        "lines": 2,
                        "flag": "-c",
                        "long": "--color"
                    },
                    {
                        "name": "-x --exec",
                        "lines": 3,
                        "flag": "-x",
                        "long": "--exec"
                    },
                    {
                        "name": "-w --no-linewrap",
                        "lines": 3,
                        "flag": "-w",
                        "long": "--no-linewrap"
                    },
                    {
                        "name": "-h --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-v --version",
                        "lines": 2,
                        "flag": "-v",
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "EXIT STATUS",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "ENVIRONMENT",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 18,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 20,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "watch - execute a program periodically, showing output fullscreen\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "watch [options] command\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "watch runs command repeatedly, displaying its output and errors (the first screenfull).  This\nallows you to watch the program output change over time.  By default, command is run every  2\nseconds and watch will run until interrupted.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-d --differences",
                        "content": "Highlight  the differences between successive updates. If the optional permanent argu‐\nment is specified then watch will show all changes since the first iteration.\n",
                        "flag": "-d",
                        "long": "--differences"
                    },
                    {
                        "name": "-n --interval",
                        "content": "Specify update interval.  The command will not allow quicker than 0.1 second interval,\nin  which the smaller values are converted. Both '.' and ',' work for any locales. The\nWATCHINTERVAL environment can be used to  persistently  set  a  non-default  interval\n(following the same rules and formatting).\n",
                        "flag": "-n",
                        "long": "--interval"
                    },
                    {
                        "name": "-p --precise",
                        "content": "Make  watch  attempt to run command every --interval seconds.  Try it with ntptime (if\npresent) and notice how the fractional seconds stays (nearly) the same, as opposed  to\nnormal mode where they continuously increase.\n",
                        "flag": "-p",
                        "long": "--precise"
                    },
                    {
                        "name": "-t --no-title",
                        "content": "Turn  off the header showing the interval, command, and current time at the top of the\ndisplay, as well as the following blank line.\n",
                        "flag": "-t",
                        "long": "--no-title"
                    },
                    {
                        "name": "-b --beep",
                        "content": "Beep if command has a non-zero exit.\n",
                        "flag": "-b",
                        "long": "--beep"
                    },
                    {
                        "name": "-e --errexit",
                        "content": "Freeze updates on command error, and exit after a key press.\n",
                        "flag": "-e",
                        "long": "--errexit"
                    },
                    {
                        "name": "-g --chgexit",
                        "content": "Exit when the output of command changes.\n",
                        "flag": "-g",
                        "long": "--chgexit"
                    },
                    {
                        "name": "-c --color",
                        "content": "Interpret ANSI color and style sequences.\n",
                        "flag": "-c",
                        "long": "--color"
                    },
                    {
                        "name": "-x --exec",
                        "content": "Pass command to exec(2) instead of sh -c which reduces the need to use  extra  quoting\nto get the desired effect.\n",
                        "flag": "-x",
                        "long": "--exec"
                    },
                    {
                        "name": "-w --no-linewrap",
                        "content": "Turn  off  line  wrapping. Long lines will be truncated instead of wrapped to the next\nline.\n",
                        "flag": "-w",
                        "long": "--no-linewrap"
                    },
                    {
                        "name": "-h --help",
                        "content": "Display help text and exit.\n",
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-v --version",
                        "content": "Display version information and exit.\n",
                        "flag": "-v",
                        "long": "--version"
                    }
                ]
            },
            "EXIT STATUS": {
                "content": "0      Success.\n1      Various failures.\n2      Forking the process to watch failed.\n3      Replacing child process stdout with write side pipe failed.\n4      Command execution failed.\n5      Closing child process write pipe failed.\n7      IPC pipe creation failed.\n8      Getting child process return value with waitpid(2) failed, or command exited up\non error.\nother  The watch will propagate command exit status as child exit status.",
                "subsections": []
            },
            "ENVIRONMENT": {
                "content": "The behaviour of watch is affected by the following environment variables.\n\nWATCHINTERVAL\nUpdate interval, follows the same rules as the --interval command line option.",
                "subsections": []
            },
            "NOTES": {
                "content": "POSIX  option processing is used (i.e., option processing stops at the first non-option argu‐\nment).  This means that flags after command don't get interpreted by watch itself.",
                "subsections": []
            },
            "BUGS": {
                "content": "Upon terminal resize, the screen will not be correctly repainted until the next scheduled up‐\ndate.  All --differences highlighting is lost on that update as well.\n\nNon-printing  characters are stripped from program output.  Use cat -v as part of the command\npipeline if you want to see them.\n\nCombining Characters that are supposed to display on the character at the last column on  the\nscreen may display one column early, or they may not display at all.\n\nCombining Characters never count as different in --differences mode.  Only the base character\ncounts.\n\nBlank lines directly after a line which ends in the last column do not display.\n\n--precise mode doesn't yet have advanced temporal distortion technology to compensate  for  a\ncommand  that takes more than --interval seconds to execute.  watch also can get into a state\nwhere it rapid-fires as many executions of command as it can to catch up from a previous exe‐\ncutions running longer than --interval (for example, netstat taking ages on a DNS lookup).",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "To watch for mail, you might do\nwatch -n 60 from\nTo watch the contents of a directory change, you could use\nwatch -d ls -l\nIf you're only interested in files owned by user joe, you might use\nwatch -d 'ls -l | fgrep joe'\nTo see the effects of quoting, try these out\nwatch echo $$\nwatch echo '$$'\nwatch echo \"'\"'$$'\"'\"\nTo see the effect of precision time keeping, try adding -p to\nwatch -n 10 sleep 1\nYou can watch for your administrator to install the latest kernel with\nwatch uname -r\n(Note  that -p isn't guaranteed to work across reboots, especially in the face of ntpdate (if\npresent) or other bootup time-changing mechanisms)\n\n\n\nprocps-ng                                    2020-12-06                                     WATCH(1)",
                "subsections": []
            }
        }
    }
}