Time can not only be counted, but also reflect CPU, memory and so on.
One, time
Format: Time [options] [commands] [arguments]
Such as
Time LS
Real 0m0.016s <== actual use (real time)
User 0m0.001s <== Usage time (the process spent in user mode)
SYS 0m0.002s <== kernel state usage time (the process spent in kernel mode)
The time command, followed by the-p parameter, can print only the number of seconds, not printing units.
Such as
Time–p ls
Real 0.01
User 0.00
SYS 0.00
Second, a more powerful external command/usr/bin/time
In fact:
[Email protected] ~]# type-a time
Time is a shell keyword
Time Is/usr/bin/time
Time is/usr/bin/time a simple execution
/usr/bin/time usage
[Email protected] ~]#/usr/bin/time
Usage:/usr/bin/time [-APVV] [-f format] [-o file] [--append] [--verbose]
[--portability] [--format=format] [--output=file] [--version]
[--help] command [arg ...]
Such as
/usr/bin/time ls
0.00user 0.00system 0:00.01elapsed 10%cpu (0avgtext+0avgdata 4080maxresident) k
0inputs+0outputs (0major+294minor) pagefaults 0swaps
It's strong.
/usr/bin/time–v ls
Command being timed: "LS"
User Time (seconds): 0.00
System Time (seconds): 0.00
Percent of CPU This job got:10%
Elapsed (Wall Clock) time (H:MM:SS or M:SS): 0:00.01
Average shared Text Size (Kbytes): 0
Average unshared Data Size (Kbytes): 0
Average stack size (Kbytes): 0
Average Total size (Kbytes): 0
Maximum resident set Size (Kbytes): 4096
Average resident set Size (Kbytes): 0
Major (requiring I/O) page faults:0
Minor (Reclaiming a frame) page faults:298
Voluntary context Switches:1
Involuntary context Switches:8
swaps:0
File system inputs:0
File system outputs:0
Socket Messages sent:0
Socket Messages received:0
Signals delivered:0
Page size (bytes): 4096
Exit status:0
Redirect to File note format
{Time command-line;} 2>file
(Time command-line) 2>file
Linux Learning Record (iii): Time related