time — Display processor and elapsed times for a command

Format

time [–p] command-line

tcsh shell: time [command]

Description

time runs the command given as its argument and produces a breakdown of total time to run (real), total time spent in the user program (user), and total time spent in system processor overhead (sys).

Times given are statistical, based on where execution is at a clock tick. Output is written to standard error.

time is a built-in shell command.

In the tcsh shell, time executes command (which must be a simple command, not an alias, a pipeline, a command list, or a parenthesized command list) and prints a time summary as described under the tcsh time variable (see tcsh — Invoke a C shell). If necessary, an extra shell is created to print the time statistic when the command completes. Without command, time prints a time summary for the current shell and its children.

Option

–p
Guarantees that the historical format of the time command is output.

Localization

time uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_CTYPE
  • LC_MESSAGES
  • LC_NUMERIC
  • NLSPATH

See Localization for more information.

Exit values

If time successfully invokes command-line, it returns the exit status of command-line. Otherwise, possible exit status values are:
0
Successful completion
1
An error occurred in the time utility
2
Failure due to an invalid command-line option
2
Invalid command-line argument
126
time found command but could not invoke it
127
time could not find command

Portability

POSIX.2 User Portability Extension, X/Open Portability Guide, UNIX systems.

Related information

sh, tcsh