{
    "content": [
        {
            "type": "text",
            "text": "# time (man)\n\n## NAME\n\ntime - run programs and summarize system resource usage\n\n## SYNOPSIS\n\ntime   [ -apqvV ] [ -f FORMAT ] [ -o FILE ]\n[ --append ] [ --verbose ] [ --quiet ] [ --portability ]\n[ --format=FORMAT ] [ --output=FILE ] [ --version ]\n[ --help ] COMMAND [ ARGS ]\n\n## DESCRIPTION\n\ntime run the program COMMAND with any given arguments ARG....  When COMMAND finishes, time\ndisplays information about resources used by COMMAND (on the standard error output, by\ndefault).  If COMMAND exits with non-zero status, time displays a warning message and the\nexit status.\n\n## TLDR\n\n> Measure how long a command took to run.\n\n- Run the `command` and print the time measurements to `stdout`:\n  `time {{command}}`\n- Create a very simple stopwatch (only works in Bash):\n  `time read`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (7 subsections)\n- **FORMATTING THE OUTPUT**\n- **EXAMPLES**\n- **ACCURACY**\n- **DIAGNOSTICS**\n- **AUTHOR**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "time",
        "section": "",
        "mode": "man",
        "summary": "time - run programs and summarize system resource usage",
        "synopsis": "time   [ -apqvV ] [ -f FORMAT ] [ -o FILE ]\n[ --append ] [ --verbose ] [ --quiet ] [ --portability ]\n[ --format=FORMAT ] [ --output=FILE ] [ --version ]\n[ --help ] COMMAND [ ARGS ]",
        "tldr_summary": "Measure how long a command took to run.",
        "tldr_examples": [
            {
                "description": "Run the `command` and print the time measurements to `stdout`",
                "command": "time {{command}}"
            },
            {
                "description": "Create a very simple stopwatch (only works in Bash)",
                "command": "time read"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-o",
                "long": "--output",
                "arg": "_",
                "description": "Write the resource use statistics to FILE instead of to the standard error stream. By default, this overwrites the file, destroying the file's previous contents. This option is useful for collecting information on interactive programs and programs that produce output on the standard error stream."
            },
            {
                "flag": "-a",
                "long": "--append",
                "arg": null,
                "description": "Append the resource use information to the output file instead of overwriting it. This option is only useful with the `-o' or `--output' option."
            },
            {
                "flag": "-f",
                "long": "--format",
                "arg": null,
                "description": "Use FORMAT as the format string that controls the output of time. See the below more information. --help Print a summary of the command line options and exit."
            },
            {
                "flag": "-p",
                "long": "--portability",
                "arg": null,
                "description": "Use the following format string, for conformance with POSIX standard 1003.2: real %e user %U sys %S"
            },
            {
                "flag": "-v",
                "long": "--verbose",
                "arg": null,
                "description": "Use the built-in verbose format, which displays each available piece of information on the program's resource use on its own line, with an English description of its meaning."
            },
            {
                "flag": "",
                "long": "--quiet",
                "arg": null,
                "description": "Do not report the status of the program even if it is different from zero."
            },
            {
                "flag": "-V",
                "long": "--version",
                "arg": null,
                "description": "Print the version number of time and exit."
            }
        ],
        "examples": [
            "To run the command `wc /etc/hosts' and show the default information:",
            "time wc /etc/hosts",
            "To run the command `ls -Fs' and show just the user, system, and total time:",
            "time -f \"\\t%E real,\\t%U user,\\t%S sys\" ls -Fs",
            "To edit the file BORK and have `time' append the elapsed time and number of  signals  to  the",
            "file `log', reading the format string from the environment variable `TIME':",
            "export TIME=\"\\t%E,\\t%k\" # If using bash or ksh",
            "setenv TIME \"\\t%E,\\t%k\" # If using csh or tcsh",
            "time -a -o log emacs bork",
            "Users  of  the  bash  shell  need  to  use an explicit path in order to run the external time",
            "command and not the shell builtin variant.  On system where time is  installed  in  /usr/bin,",
            "the first example would become",
            "/usr/bin/time wc /etc/hosts"
        ],
        "see_also": [
            {
                "name": "tcsh",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/tcsh/1/json"
            },
            {
                "name": "printf",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/printf/3/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-o _ --output=_",
                        "lines": 5,
                        "flag": "-o",
                        "long": "--output",
                        "arg": "_"
                    },
                    {
                        "name": "-a --append",
                        "lines": 3,
                        "flag": "-a",
                        "long": "--append"
                    },
                    {
                        "name": "-f _ --format _",
                        "lines": 5,
                        "flag": "-f",
                        "long": "--format"
                    },
                    {
                        "name": "-p --portability",
                        "lines": 5,
                        "flag": "-p",
                        "long": "--portability"
                    },
                    {
                        "name": "-v --verbose",
                        "lines": 4,
                        "flag": "-v",
                        "long": "--verbose"
                    },
                    {
                        "name": "--quiet",
                        "lines": 2,
                        "long": "--quiet"
                    },
                    {
                        "name": "-V --version",
                        "lines": 3,
                        "flag": "-V",
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "FORMATTING THE OUTPUT",
                "lines": 64,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 17,
                "subsections": []
            },
            {
                "name": "ACCURACY",
                "lines": 18,
                "subsections": []
            },
            {
                "name": "DIAGNOSTICS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "time - run programs and summarize system resource usage\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "time   [ -apqvV ] [ -f FORMAT ] [ -o FILE ]\n[ --append ] [ --verbose ] [ --quiet ] [ --portability ]\n[ --format=FORMAT ] [ --output=FILE ] [ --version ]\n[ --help ] COMMAND [ ARGS ]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "time run the program COMMAND with any given arguments ARG....  When COMMAND finishes, time\ndisplays information about resources used by COMMAND (on the standard error output, by\ndefault).  If COMMAND exits with non-zero status, time displays a warning message and the\nexit status.\n\ntime determines which information to display about the resources used by the COMMAND from the\nstring FORMAT.  If no format is specified on the command line, but the TIME environment\nvariable is set, its value is used as the format.  Otherwise, a default format built into\ntime is used.\n\nOptions to time must appear on the command line before COMMAND.  Anything on the command line\nafter COMMAND is passed as arguments to COMMAND.\n\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-o _ --output=_",
                        "content": "Write the resource use statistics to FILE instead of to the standard error stream.  By\ndefault,  this  overwrites  the  file,  destroying the file's previous contents.  This\noption is useful for collecting information on interactive programs and programs  that\nproduce output on the standard error stream.\n",
                        "flag": "-o",
                        "long": "--output",
                        "arg": "_"
                    },
                    {
                        "name": "-a --append",
                        "content": "Append  the  resource  use  information  to the output file instead of overwriting it.\nThis option is only useful with the `-o' or `--output' option.\n",
                        "flag": "-a",
                        "long": "--append"
                    },
                    {
                        "name": "-f _ --format _",
                        "content": "Use FORMAT as the format string that controls the output of time.  See the below  more\ninformation.\n\n--help Print a summary of the command line options and exit.\n",
                        "flag": "-f",
                        "long": "--format"
                    },
                    {
                        "name": "-p --portability",
                        "content": "Use the following format string, for conformance with POSIX standard 1003.2:\nreal %e\nuser %U\nsys %S\n",
                        "flag": "-p",
                        "long": "--portability"
                    },
                    {
                        "name": "-v --verbose",
                        "content": "Use the built-in verbose format, which displays each available piece of information on\nthe  program's  resource  use  on  its  own  line,  with an English description of its\nmeaning.\n",
                        "flag": "-v",
                        "long": "--verbose"
                    },
                    {
                        "name": "--quiet",
                        "content": "Do not report the status of the program even if it is different from zero.\n",
                        "long": "--quiet"
                    },
                    {
                        "name": "-V --version",
                        "content": "Print the version number of time and exit.\n\n",
                        "flag": "-V",
                        "long": "--version"
                    }
                ]
            },
            "FORMATTING THE OUTPUT": {
                "content": "The format string FORMAT controls the contents of the time output.  The format string can  be\nset  using  the  `-f' or `--format', `-v' or `--verbose', or `-p' or `--portability' options.\nIf they are not given, but the TIME environment variable is set, its value  is  used  as  the\nformat string.  Otherwise, a built-in default format is used.  The default format is:\n%Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k\n%Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps\n\nThe  format string usually consists of `resource specifiers' interspersed with plain text.  A\npercent sign (`%') in the format string causes the following character to be interpreted as a\nresource specifier, which is similar to the formatting characters in the printf(3) function.\n\nA backslash (`\\') introduces a `backslash escape', which is translated into a single printing\ncharacter upon output.  `\\t' outputs a tab  character,  `\\n'  outputs  a  newline,  and  `\\\\'\noutputs  a  backslash.   A  backslash followed by any other character outputs a question mark\n(`?') followed by a backslash, to indicate that an invalid backslash escape was given.\n\nOther text in the format string is copied verbatim to  the  output.   time  always  prints  a\nnewline  after  printing  the resource use information, so normally format strings do not end\nwith a newline character (or `\\n').\n\nThere are many resource specifications.  Not all resources are measured by  all  versions  of\nUnix,  so  some  of  the values might be reported as zero.  Any character following a percent\nsign that is not listed in the table below  causes  a  question  mark  (`?')  to  be  output,\nfollowed by that character, to indicate that an invalid resource specifier was given.\n\nThe  resource  specifiers,  which  are  a superset of those recognized by the tcsh(1) builtin\n`time' command, are:\n%      A literal `%'.\nC      Name and command line arguments of the command being timed.\nD      Average size of the process's unshared data area, in Kilobytes.\nE      Elapsed real (wall clock) time used by the process, in [hours:]minutes:seconds.\nF      Number of major, or I/O-requiring, page faults that occurred while the  process\nwas  running.   These  are  faults  where the page has actually migrated out of\nprimary memory.\nI      Number of file system inputs by the process.\nK      Average total (data+stack+text) memory use of the process, in Kilobytes.\nM      Maximum resident set size of the process during its lifetime, in Kilobytes.\nO      Number of file system outputs by the process.\nP      Percentage of the CPU that this job got.  This is  just  user  +  system  times\ndivided by the total running time.  It also prints a percentage sign.\nR      Number  of  minor,  or  recoverable, page faults.  These are pages that are not\nvalid (so they fault) but which have not yet  been  claimed  by  other  virtual\npages.   Thus the data in the page is still valid but the system tables must be\nupdated.\nS      Total number of CPU-seconds used by the system on behalf  of  the  process  (in\nkernel mode), in seconds.\nU      Total  number  of CPU-seconds that the process used directly (in user mode), in\nseconds.\nW      Number of times the process was swapped out of main memory.\nX      Average amount of shared text in the process, in Kilobytes.\nZ      System's page size, in bytes.   This  is  a  per-system  constant,  but  varies\nbetween systems.\nc      Number  of  times  the  process was context-switched involuntarily (because the\ntime slice expired).\ne      Elapsed real (wall clock) time used by the process, in seconds.\nk      Number of signals delivered to the process.\np      Average unshared stack size of the process, in Kilobytes.\nr      Number of socket messages received by the process.\ns      Number of socket messages sent by the process.\nt      Average resident set size of the process, in Kilobytes.\nw      Number of times that the program was context-switched voluntarily, for instance\nwhile waiting for an I/O operation to complete.\nx      Exit status of the command.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "To run the command `wc /etc/hosts' and show the default information:\ntime wc /etc/hosts\n\nTo run the command `ls -Fs' and show just the user, system, and total time:\ntime -f \"\\t%E real,\\t%U user,\\t%S sys\" ls -Fs\n\nTo edit the file BORK and have `time' append the elapsed time and number of  signals  to  the\nfile `log', reading the format string from the environment variable `TIME':\nexport TIME=\"\\t%E,\\t%k\" # If using bash or ksh\nsetenv TIME \"\\t%E,\\t%k\" # If using csh or tcsh\ntime -a -o log emacs bork\n\nUsers  of  the  bash  shell  need  to  use an explicit path in order to run the external time\ncommand and not the shell builtin variant.  On system where time is  installed  in  /usr/bin,\nthe first example would become\n/usr/bin/time wc /etc/hosts\n",
                "subsections": []
            },
            "ACCURACY": {
                "content": "The  elapsed time is not collected atomically with the execution of the program; as a result,\nin bizarre circumstances (if the time command gets stopped or swapped out in between when the\nprogram being timed exits and when time calculates how long it took to run), it could be much\nlarger than the actual execution time.\n\nWhen the running time of a command is very nearly zero, some values (e.g., the percentage  of\nCPU used) may be reported as either zero (which is wrong) or a question mark.\n\nMost  information  shown  by  time is derived from the wait3(2) system call.  The numbers are\nonly as good as those returned by wait3(2).  On systems that do not have a wait3(2) call that\nreturns status information, the times(2) system call is used instead.  However,  it  provides\nmuch  less  information  than  wait3(2), so on those systems time reports the majority of the\nresources as zero.\n\nThe `%I' and `%O' values are allegedly only `real' input and output and do not include  those\nsupplied  by  caching  devices.   The  meaning of `real' I/O reported by `%I' and `%O' may be\nmuddled for workstations, especially diskless ones.\n",
                "subsections": []
            },
            "DIAGNOSTICS": {
                "content": "The time command returns when the program exits, stops, or is terminated by a signal.  If the\nprogram exited normally, the return value of time is the  return  value  of  the  program  it\nexecuted  and  measured.   Otherwise,  the  return value is 128 plus the number of the signal\nwhich caused the program to stop or terminate.",
                "subsections": []
            },
            "AUTHOR": {
                "content": "time was written  by  David  MacKenzie.   This  man  page  was  added  by  Dirk  Eddelbuettel\n<edd@debian.org>,   the  Debian  GNU/Linux  maintainer,  for  use  by  the  Debian  GNU/Linux\ndistribution but may of course be used by others.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "tcsh(1), printf(3)\n\nDebian GNU/Linux                                   TIME(1)",
                "subsections": []
            }
        }
    }
}