I recently purchased a power line network adapter and wanted to see how it performed relative to the stated specs on the packaging. After playing around with wget and sftp to copy files from my desktop to my laptop I wondered if there was a better way to test network speed without involving the hard drive of my server or my client machines. What I found was that it's possible to use a few simple commands on the Linux command line to test local network speed without copying actual files.
Since I'm using this to test the speed of my home network, I need two machines up and running Linux on my LAN. I'll call the first machine Desktop and the second machine Laptop.
Start Netcat to Listen
I'm going to use a utility called netcat, or nc to listen on a particular network port on the Desktop machine. Enter the following command into a terminal on Desktop:
This tells the Desktop machine to listen for network traffic on port 2112 and to keep listening. Any output is sent to /dev/null.
Linux network speed test: dd and netcat
Now that the first machine, Desktop, is set up to listen, I'll use the second machine, Laptop, to send and receive data to test the network. The command below assumes that the IP address for Desktop is 192.168.2.2. Adjust the address accordingly for your network. From a terminal on Laptop, enter the following:
The first part of the command tells the machine to copy 10 megabytes of data from /dev/zero in 16 kilobyte blocks. The part after the pipe tells it to send that to the Desktop machine over port 2112.
You should see output similar to the screen shot below. In my case it showed that my wireless network is performing at 8.9 megabytes per second, or 71.2 megabits per second.
Once you're done testing, go to the terminal on Desktop and use [Ctrl]+C to stop netcat.
So there you have it. A simple way to perform a Linux network speed test from the command line. You can adjust the count parameter to send smaller or larger amounts of data if you like.
Look for my review of the TRENDnet TPL-406E power line adapter in a future post.
This content originally appeared on Tux Tweaks at . Copyright 2014