Let's have a look at what
time actually is using the
type command (see
$ type -a time
time is a shell keyword
time is /usr/bin/time
time on our system is both
- a keyword directly built into your Bash shell
- an executable file
Because shell keywords take precedence over executables, what you actually run when typing only
time is the shell keyword. You also see that from the order in which
type -a lists them, or from the output of just
type time, which only lists the one effective type.
Now, let's check what each of those can do:
Executables usually have a manpage (manual page), which we can open and read using the
man command, i.e. here
To get help about stuff built into Bash, you have to use the
You will note that the shell keyword supports less options than the executable, but it has other advantages, as you can e.g. time complex Bash constructs like pipelines with it. See the end of this answer for an example.
If you need to use the executable instead of the shell keyword though, you can either type the full path, i.e.
/usr/bin/time, or you can prefix the command with a backslash to stop Bash from evaluating it:
By the way, while
time is a shell keyword in Bash, it does not exist in
sh (Dash), where you would only get the executable.