Take the 2-minute tour ×

I follow this post to check speed with netcat , but in his blog when he do ctrl-c ,he get data on sent received bytes.

In the post he ran :

time yes|nc -v -v -n 2222 >/dev/null
than after ctrl-c het get:
sent 87478272, rcvd 0
real 0m9.993s
user 0m2.075s
sys 0m0.939s

When I do ctrl-c , I don't get this data.

How can I get sent/received data by netcat?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

There are actually two implementations of netcat, the original implementation by *Hobbit* (called netcat-traditional in Debian/Ubuntu) and the OpenBSD implementation (called netcat-openbsd in Debian/Ubuntu). In Debian/Ubuntu the binaries are called nc.traditional and nc.openbsd respectively (and nc is a link to one of those via the alternatives system).

The blog post you reference is using nc.traditional which does show the sent/received bytes when exiting. You are probably using nc.openbsd which doesn't. Install the traditional implementation and call it explicitly.

% time yes | nc.traditional -vvn 10000 > /dev/null
(UNKNOWN) [] 10000 (webmin) open
^C sent 99422208, rcvd 0
yes  1,06s user 0,09s system 38% cpu 3,003 total
share|improve this answer
add comment

You can use the Pipe Viewer (pv) utility to watch the visual progress of a stream. It can be modified to display the units of choice and is available on most distributions.


cat largefile | pv | netcat 1234
share|improve this answer
I want to get it from netcat like in the posted blog ? –  Avihai Marchiano Oct 25 '12 at 14:34
Please show your command string. –  ewwhite Oct 25 '12 at 14:36
add this to the question, thank you. You can see it in the blog link. –  Avihai Marchiano Oct 25 '12 at 14:39
time yes|nc -v -v -n 2222 | pv | >/dev/null –  ewwhite Oct 25 '12 at 14:40
The command should be like this - time yes| pv | nc -v -v -n 2222 >/dev/null –  Avihai Marchiano Oct 25 '12 at 16:37
show 2 more comments

Your Answer


