(The linux equivalent of TimeThis.exe)

Something like:

timethis wget foo.com
Receiving foo.com  

wget foo.com took 3 seconds.

3 Answers 3


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 https://unix.stackexchange.com/

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


$ \time wget -q -O /dev/null https://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.


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. You can also use command time or \time to execute the utility instead of the build-in.

  • 6
    notice that: the path is important. Don't just use 'time' in bash. Instead, use /usr/bin/time
    – CodeFarmer
    Aug 31, 2014 at 5:06
  • 2
    what's the difference if /usr/bin is in their PATH?
    – galois
    Feb 10, 2017 at 22:30
  • @galois The difference is that without the explicit path, the shell's built-in time utility will be used.
    – Kusalananda
    May 30, 2018 at 13:50

@galois : The various shells have a handful of "built-in" commands which take precedence over anything in the path. Normally this is advantageous; the built-ins will tend to run faster (because not calling an external file) and typically give the desired result (i.e., in the case of time command you normally do not care which version you are using, unless you want to use the "--format" flag).

So "time" without any special characters (like /) to make it look like a path will end up running the built-in, regardless of what your PATH looks like.

To force the shell to use the external time command, you must provide the path

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .