Search code examples
linuxbashtimeterminallinux-mint

how to get time execution of a program in linux terminal separately


I want to get time of execution of a program in my terminal. I know that I should use this command:

time chmod +x ~/example

but the output is this:

real    0m0.088s
user    0m0.057s
sys     0m0.030s

But I want to access each one separately. for example just real. how can I get that?


Solution

  • You can use -f to format the time command:

    $ /usr/bin/time -f "\t%E Elapsed Real Time" touch a
        0:00.00 Elapsed Real Time
    

    The geek stuff has a very broad documentation on this topic: 12 UNIX / Linux Time Command Output Format Option Examples.

    It is also funny that calling it with time alone did not work to me, I have to use the full path.