Home » How to Time a Linux Shell Command

How to Time a Linux Shell Command

October 7th, 2008 by Jim

Date and TimeKnowing how long a Linux command line task executes can be useful in many situations. For example, how long does it take to…

  • …perform a backup? [rsync]
  • …calculate a directory’s size? [du]
  • …find files within large folders? [find]

How to time a Linux command line operation:

$ START=`date`; COMMAND_GOES_HERE; END=`date`; echo -e "Start: $START\nEnd  : $END"

Command Output

Start: Tue Oct  7 10:12:31 CDT 2008
End  : Tue Oct  7 11:42:07 CDT 2008

Leave a Reply »

Revision History

2008.10.07 Initial revision.

Disclaimer

I do not offer a warranty or guarantee for anything described in this article. All of my tips are based on personal and professional experience, but you are solely responsible for your own actions.

Comments are closed.