Skip to content

Measuring Execution Time of One or Multiple Commands

Introduction

You may need to know exactly the time it takes to execute some commands. The time command is perfect for this purpose.

This command is a bash builtin.

Examples

The last semicolon ; is important. For example:

time { rm -rf /folder/bar && mkdir -p /folder/bar ; echo "done" ; }

This will give you the time taken to execute the entire block of commands as a single unit.