time是 BASH shell 中内建的关键字

[root@server ~]# which time
/usr/bin/which: no time in (/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
[root@server ~]# type -a time
time is a shell keyword
[root@server ~]# help time
time: time [-p] pipeline
    Report time consumed by pipeline's execution.

    Execute PIPELINE and print a summary of the real time, user CPU time,
    and system CPU time spent executing PIPELINE when it terminates.

      -p    print the timing summary in the portable Posix format

    The value of the TIMEFORMAT variable is used as the output format.

    Exit Status:
    The return status is the return status of PIPELINE.
times: times
    Display process times.

    Prints the accumulated user and system times for the shell and all of its
    child processes.

    Exit Status:
    Always succeeds.
[root@server ~]# time cd

real    0m0.000s
user    0m0.000s
sys 0m0.000s

real —— 指的是命令或程序所花费的总时间
user —— 指的是在用户模式下程序所花费的时间
sys —— 指的是在内核模式下程序所花费的时间


您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code