Sunday, May 5, 2024
21
rated 0 times [  21] [ 0]  / answers: 1 / hits: 6721  / 2 Years ago, mon, may 16, 2022, 11:04:38

I am trying to get the time it takes to run a command, with the output in a specific format:



time -f "%E" ls -l


This is similar to the example in the man page (and on the online man page). However when I run this command I get:



-f: command not found


It appears as though the time command is not reading the -f as an argument, rather as the command I am trying to run.



How can I get the execution time for a command in a specific format?


More From » command-line

 Answers
1

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

[#41573] Tuesday, May 17, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
antebrow

Total Points: 291
Total Questions: 135
Total Answers: 117

Location: New Caledonia
Member since Thu, Mar 23, 2023
1 Year ago
;