time command

time, One of the Most Useful Linux Commands

If you run or write a lot of software run on the command line from time to time you probably want to know how long something you ran took to run.  What’s great about the time command is all you need to do to use it is throw it in front of whatever you were already running.

Here are a few examples

How long does it take to download a url
time curl -s 'http://www.google.com' > /dev/null

real 0m0.242s
user 0m0.037s
sys 0m0.017s

 

Time your python script runtime
time python your_cool_script.py

real 0m5.139s
user 0m0.134s
sys 0m0.323s

real – the wall clock time it took a process to complete, or how long it took to run.
user – number of cpu seconds the process used directly.
sys – number of cpu seconds the kernel used on behalf of the process.

 

Leave a Reply

Your email address will not be published.