Friday, September 22, 2023
rated 0 times [  127] [ 0]  / answers: 1 / hits: 34449  / 11 Months ago, thu, november 17, 2022, 4:59:25

I tried to use time command with -f option to format the output of time, but I get the following error:

-f: command not found

Then I tried to use other options -a, -o, etc and I get the same error. Not even time --version doesn't work (--version: command not found).

Don't tell me to read the man because I already do it by many times... All these options are specified there. So, where could be the problem?

More From » command-line


Well, even if you don't like it, I will put you to read again with more attention man time. At the end of EXAMPLES section you will find:

  Users of the bash shell need to use an explicit path in order to run
the external time command and not the shell builtin variant. On system
where time is installed in /usr/bin, the first example would become
/usr/bin/time wc /etc/hosts

So, I'm assuming that you use bash shell which uses an internal version of time, provided as a shell keyword. You can check this using the following command:

type time

and the output will probably be:

time is a shell keyword

If this is the case, then it is clear that to use the real time command you must use its explicit path: /usr/bin/time.

Further, if you don't want to use anymore the shell keyword time, you can create a permanent alias as follow:

alias time='/usr/bin/time'

This will overwrite the shell keyword time because the command:

type time

will give the following output now:

time is aliased to `/usr/bin/time'

[#26510] Friday, November 18, 2022, 11 Months  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 195
Total Questions: 113
Total Answers: 107

Location: Nicaragua
Member since Tue, Dec 8, 2020
3 Years ago