Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to time a series of commands in linux?

Perhaps something like this:

/usr/bin/time { ls; pwd; ls }
share|improve this question
up vote 5 down vote accepted

You could try to wrap it in a shell command:

/usr/bin/time /bin/sh -c 'ls;pwd;ls'
share|improve this answer

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
share|improve this answer
1  
This works with time but not with /usr/bin/time. Running the command you gave produces -bash: syntax error near unexpected token ls'` – juniper- Jun 17 '13 at 12:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.