Search code examples
javalinuxdebian

Execution Time of Command Line Command


I am trying to compare two tools execution time, which I have installed in my Debian Linux server. Now, I have to give two command line command to execute those two tools.

For example say,

cat file1 file2 file3 > file4

and

cat file4 file5 file6 > file7

Now, I want to find execution time of 1st and 2nd command.

Can anybody help me, how to find those two commands execution time? Programmatically foundation (say in Java) is also acceptable.


Solution

  • Use the time command

    time cat file1 file2 file3 > file4
    

    time will write it's output to stderr, so the redirection doesn't hurt.