Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

(The linux equivalent of TimeThis.exe)

Something like:

timethis wget foo.com
Receiving foo.com  
...

wget foo.com took 3 seconds.
share|improve this question
up vote 27 down vote accepted

Try just time instead of timethis.

Although be aware that there's often a shell builtin version of time and a binary version, which will give results in different formats:

$ time wget -q -O /dev/null http://unix.stackexchange.com/

real    0m0.178s
user    0m0.003s
sys     0m0.005s

vs

$ \time wget -q -O /dev/null http://unix.stackexchange.com/
0.00user 0.00system 0:00.17elapsed 4%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+613minor)pagefaults 0swaps

Unlike your "timethis" program, you get three values back. That's broken down in What is "system time" when using "time" in command line, but in short: real means "wall-clock time", while user and sys show CPU clock time, split between regular code and system calls.

share|improve this answer

By using the executable time instead of the shell builtin, you can specify the output format and values. E.g. get the real elapsed time together with the command name and parameters

/usr/bin/time --format='%C took %e seconds' sleep 3
sleep 3 took 3.00 seconds

Note that you must specify the path for time, else you will default to using the shell built-in.

share|improve this answer
2  
notice that: the path is important. Don't just use 'time' in bash. Instead, use /usr/bin/time – CodeFarmer Aug 31 '14 at 5:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.