Login | Sign up

May 29


0

How long did that command take

Comments (0)

Bash has a built in command to tell you how long a command took to execute. There is also a gnu version for those not running Bash.

If you want to know how long a command took to execute, you can use the Bash built-in command time. Simply prepend your command with time and once it finishes, it will tell you the duration.

  1. time cp -R myfolder myfolder2

The output will be something like this

  1.  
  2. real    0m21.093s
  3. user    0m0.008s
  4. sys     0m0.717s

real - is the full time it took to run the command (how long you waited).
user - is the CPU time used by the program itself.
sys - is the CPU time used by the system calls

GNU time

There is also a gnu time command which gives a little bit more information. It also allows non-Bash users to time their commands.

  1. /usr/bin/time cp -R myfolder myfolder2

You can typically run the GNU time command as follows

  1. \time cp -R myfolder myfolder2

Comments

There are no comments yet.


Post a new comment

Note: Items marked * are required fields

Post a comment

You must login before you can do that.

If you don't have an account, register for free. It's completely private.

Why register

  • rate posts and comments
  • ask questions about posts
  • request new topics/tutorials
  • mark posts as favorites to easily find them again