I needed to do some profiling using netcat and time and it turns out that there is more to those commands than meets the eyes ;)
Case netcat: netcat is super awesome networking utility. I wanted to test how long does it take to transfer a large file from a cold cache start. So on the server side I did
nc -v -l 5001
and then on the client side I had
nc -v ip 5001 < file_name
and this is perfectly sane. It worked like a charm. But then I moved to another pair box (btw - both systems are running Debian testing Wheezy, in total 2 pair of boxes). On the new pair when I start nc in listen mode I get:
5001: inverse host lookup failed: Unknown host
listening on [any] 47022 ...
This is not what I wanted. Additionally file transfer does not terminate properly which was essential to my benchmarking. After couple of hours of starring at nc code, latter I realize that there are couple of variants around. Notably nc.traditional and nc.openbsd. Things just work fine with openbsd version. The man page is written for openbsd version (the file transfer example I copied from man page). So then I installed openbsd version by apt-get install netcat-openbsd which updated the nc link to it in /bin. Since then things have been back to normal. I still don't know what is missing (could not find as well) and what is the difference between those two, but for now examples from the world of man page started to make sense again !
Case time: Time is another useful command which can give you a lot of useful information about the process stats. But apparently, the version which is build in with bash is badly out-of-sync from man pages. So what I gathered, there are two versions of time: one built in in bash, other is /usr/bin/time. When you just run time, the built-in one gets invoked and ignores all the parameters and even complains about them. This is not what you would expect after reading the man page of time. For example I was trying :
$time -f "%P" ls
-bash: -f: command not found
It is even refusing to accept the command. Then after a while when I figured out the difference between the two versions:
$ /usr/bin/time -f "%P" ls
It worked perfectly ! Again, the world of magnet and miracles aka. man pages started to make sense again.