Linux: Testing Connectivity With ‘time’
We had a user reporting throughput problems to an NFS mount point recently. The report was that it would take 2 minutes to copy a 1.6mb file via NFS. This was definitely troubling, so I decided to do a basic command line test (CLI) in Linux. I love the command ‘time’. It can be used to calculate how long a command takes from execution to completion. The possibilities here are endless, and I will probably put up a dedicated blog about ‘time’ eventually. In this case, I used it to calculate exactly how long the request took to compete.
Did a find to locate a big file
[user@server ~]# find / -type f -size +10000 -print
/usr/libexec/gcc/i386-redhat-linux/4.1.1/cc1plus
Lets see how big the file is
[user@server ~]# ls -lah /usr/libexec/gcc/i386-redhat-linux/4.1.1/cc1plus
-rwxr-xr-x 1 root root 5.8M Apr 14 2008 /usr/libexec/gcc/i386-redhat-linux/4.1.1/cc1plus
Below tells time to execute cp and start counting
[user@server ~]# time cp /usr/libexec/gcc/i386-redhat-linux/4.1.1/cc1plus /dir/
real 0m0.417s
user 0m0.000s
sys 0m0.150s
Verify that the file did make it over
[user@server ~]# ls -lah /dir/
total 5.9M
drwxrwxr-x 5 root user 4.0K Dec 8 11:39 .
drwxr-xr-x 26 root root 4.0K Dec 1 10:59 ..
rwxr-xr-x 1 root root 5.8M Dec 8 11:39 cc1plus
So in this case, there were no throughput problems! The 5.8M file took only 0m0.417s.
