The Computer Oracle

Time the execution time of multiple commands

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Peaceful Mind

--

Chapters
00:00 Time The Execution Time Of Multiple Commands
00:13 Accepted Answer Score 14
00:23 Answer 2 Score 43
00:42 Thank you

--

Full question
https://superuser.com/questions/608591/t...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #time

#avk47



ANSWER 1

Score 43


Using time use () to create a subshell for the commands you wish to time. The syntax would be:

time ( ls; pwd; ls )

If using /usr/bin/time then add the commands to a shell script (for example my.sh) and time the shell script-:

/usr/bin/time my.sh



ACCEPTED ANSWER

Score 14


You could try to wrap it in a shell command:

/usr/bin/time /bin/sh -c 'ls;pwd;ls'