nerdicism
Bitte denken Sie an die Umwelt bevor Sie diese Seite ausdrucken.
Shell hint: Measure bandwidth with netcat (nc) and pipe view (pv)
Categories: Science & Technology | Written by ninan

When my SCP throughput took a nose dive today, I tried to figure out a way to measure the raw bandwidth. Since I am a very lazy person I didn´t want to convert numbers all the time.

netcat is the natural choice to send/receive raw data to a network. But netcat outputs just a byte count at EOD. Pipe View came to help. This handy tool can be put into any shell pipe and visualizes the amount of data going through the pipe. Practice:

On the “server” type into your shell (Please note that 1337 is the port number. You can use another port. If you do so, do it on both sides. :) ):

$ nc -l 1337 | pv

On the “client” run:

$ cat /dev/zero | nc ip.of.ser.ver 1337

This will give you the following output on the server:

5,27GB 0:03:22 [  24MB/s] [<=>

If you found this hint useful please leave me a comment.

Further information:

2 Comments to “Shell hint: Measure bandwidth with netcat (nc) and pipe view (pv)”

  1. [...] This post was mentioned on Twitter by softmetz, dominanz. dominanz said: Shell hint: Measure bandwidth with netcat (nc) and pipe view (pv …: 10.14.2010. Shell hint: Measure bandwi… http://tinyurl.com/2ahnd62 [...]

  2. Ed says:

    Thanks Ninan, I found this very useful although I’d like a way to do this without using pv as typically it’s not installed as part of the base platform.

Leave a Reply