Thursday, 7 November 2024

How to Measure Program Execution Time in the Linux Shell

When running commands or scripts in the Linux shell, it’s often useful to know how long they take to execute, especially when optimizing or testing under different conditions. Here are several ways to measure execution time in Bash, from basic to more advanced methods.

1. Using the time Command

The simplest way to measure execution time is with the built-in time command, which outputs real, user, and system time taken by a command.

time sleep 2
Read more »

Labels: