Skip to Content
Linux Shell Scripting Cookbook - Third Edition
book

Linux Shell Scripting Cookbook - Third Edition

by Clif Flynt, Sarath Lakshman, Shantanu Tushar
May 2017
Beginner
552 pages
28h 47m
English
Packt Publishing
Content preview from Linux Shell Scripting Cookbook - Third Edition

How to do it...

  1. The time command measures an application's execution time.

Consider the following example:

        $ time APPLICATION

The time command executes APPLICATION. When APPLICATION is complete, the time command reports the real, system, and user time statistics to stderr and sends the APPLICATION's normal output to stdout.

        $ time ls
        test.txt
        next.txt
        real    0m0.008s
        user    0m0.001s
        sys     0m0.003s
An executable binary of the time command is found in /usr/bin/time. If you are running bash, you'll get the shell built-in time by default. The shell built-in time has limited options. Use an absolute path (/usr/bin/time) to access the extended functionality.
  1. The -o option will write the time statistics to a file:
        $ /usr/bin/time -o output.txt ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux Shell Scripting - Second Edition

Mastering Linux Shell Scripting - Second Edition

Mokhtar Ebrahim, Andrew Mallett

Publisher Resources

ISBN: 9781785881985