This is because time
is a bash builtin command - and the builtin doesn't support the options you're trying to use.
Try this, use the full path of time to skip the built-in and use the real one:
/usr/bin/time -f "%E" ls -l
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 is clear, to use the real time
command, you must to 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'
Best Answer
That means the
time
that you are using is the bash shell built intime
which the only option is-p
and you cannot even use-V
, instead use the actual command with specifying its full path:the man page is for the above command that if you do
which time
, will see/usr/bin/time
. For the bash built-intime
, you canhelp time
.Further reading: