Example uses of the command "time"

A Brief Introduction

time command

If you want to see how much CPU time the command "head -n 10000 largefile.txt" takes, you can use:


time head -n 10000 largefile.txt

real 0m4.866s
user 0m0.001s
sys 0m0.021s

In order to access the GNU version of the time command you may have to specify the whole path, such as /usr/bin/time. This version provides more functionality, such as memory and I/O statistics. For example:


/usr/bin/time -f "\n%E elapsed,\n%U user,\n%S system,\n%M memory\n%x status" head -n 10000 largefile.txt

0:07.96 elapsed,
0.00 user,
0.01 system,
1 memory
0 status

For more options and the units of the various measures see the time man page.