I installed time but when I use it, I am getting the portable format, not the default format. When installed I think it said GNU time 1.7 or 1.72.

Commands like

time --help
time --version

fail with the error "command not found". The TIME environment variable is unset. Why is time behaving like this?

  • 2
    time is a shell keyword, you probably have to point to the full path of the installed time to use it: /usr/bin/time --version or maybe alias it. – Jesse_b Jan 27 at 23:42
  • Is it possible you already have an alias for time='time -p' that would explain the portable format? – Jesse_b Jan 28 at 0:05
  • @Jesse_b no alias. I think it is using the bash keyword 'time' which apparently is identical to time -p – Tyler Durden Jan 28 at 0:32
  • On my system the time builtin still has a -p option to print portable. – Jesse_b Jan 28 at 0:46

While Jesse_b is correct about how shells generally look up commands, there's an easier fix.

\time --version

Bash, ksh, zsh, and I believe a few other common shells will treat a leading backslash on a command with no path as 'skip to looking into the PATH for this thing.'

Also, knowing what the time builtin is, we could also get around this by running

time time --version

After all, the reason for the command not found error rather than a no such option error is because the shell builtin just runs the command that follows and checks how long it took to run when it finishes... which is the same thing that /bin/time does.

If you're expecting time to take arguments... are you wanting to find out what time it is? Because that's the date command.


When looking for a command the shell uses the following preference:

  1. aliases
  2. Parameter expansion, command substitution, arithmetic expansion, and quote removal before being assigned to the variable
  3. functions
  4. BUILTIN commands
  5. HASH table
  6. Search PATH

So the time keyword will be used with preference over the installed version of time presumably found in your PATH. You can overcome this with an alias, such as:

alias time=/usr/bin/time

(ensure the path is specific to whatever location you have installed time)



\command builtin type time

to see which version of time you're running.

This is the paranoid version - usually just type time is sufficient, but the above will avoid situations where alias type=echo.

To see all binary versions of time in your $PATH, use which -a time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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