Quick Linux Tip #04: How long does my script take and how much CPU does it use?

Quick Linux Tip #4:

Try: time ./backup.sh

Info: The time command shows execution time. real is wall clock time, user is CPU time for the program, and sys is CPU time for system calls.

Examples:

  • $ time ./deploy.sh
  • $ /usr/bin/time -v ./process.py
  • $ time tar -czf backup.tar.gz /home/data

Note: Use /usr/bin/time -v for detailed resource usage, including memory.




LinuxTeck.com
linuxteck@ubuntu:~$ time ./backup.sh

real    2m34.567s
user    1m45.234s
sys     0m49.333s

linuxteck@ubuntu:~$

About John Britto

John Britto Founder & Chief-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 20+ years of experience in Linux and Open Source technologies.

View all posts by John Britto →

Leave a Reply

Your email address will not be published.

L