1847700 Members
6977 Online
110265 Solutions
New Discussion

Timing processes

 
SOLVED
Go to solution
Robie Lutsey
Frequent Advisor

Timing processes

Hello again.

I want to time how long a "Tar" operation takes. Is there an easy method to do this?

Thanks!
3 REPLIES 3
Solution

Re: Timing processes

yup - use timex(1)

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Marco Paganini
Respected Contributor

Re: Timing processes

Hello!

Just prepend "time" to the command you want to time.

So, instead of tar whatever...

you use

time tar whatever

and it will show you some time figures at the end (elapsed time, system time and user time)

Regards,
Paga
Keeping alive, until I die.
Geoff Wild
Honored Contributor

Re: Timing processes

If you are running say a backup job with tar over night, you could just write your output to a logfile something like this:

logfile=/tmp/tar.log
if [ -f $logfile ];
then
rm $logfile
touch $logfile
else
touch $logfile
fi

echo "Begin TAR backup command at " `date` >>$logfile 2>&1

tar cf >>$logfile 2>&1

echo "TAR backup command complete at " `date` >>$logfile 2>&1


Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.