-
Book Overview & Buying
-
Table Of Contents
Linux Shell Scripting Cookbook, Second Edition - Second Edition
While testing an application's efficiency or comparing different algorithms to solve a given problem, the execution time taken is very critical. A good algorithm should execute in a minimum amount of time. Let's see how to calculate the execution time.
To measure the execution time, just prefix time to the command you want to run.
For example:
$ time COMMAND
The command will execute and its output will be shown. Along with the output, the time command appends the time taken in stderr. An example is as follows:
$ time ls test.txt next.txt real 0m0.008s user 0m0.001s sys 0m0.003s
It will show real, user, and system times for execution.
An executable binary of the time command is available at /usr/bin/time, as well as a shell built-in named time exists. When we run time, it calls the shell built-in by default. The shell built-in time has limited options. Hence, we should use an absolute path for the executable (/usr/bin...
Change the font size
Change margin width
Change background colour