Monitor USB Bandwidth

Most of us use USB devices regularly, even using USB thumb drives to install Linux, and today we’ll learn how to monitor USB bandwidth. What we don’t tend to do is monitor the bandwidth of our USB devices. Today, we’ll be doing that and just that. It shouldn’t be a long article.

When I say bandwidth, you could also say throughput, I speak of the speeds at which data moves from one place to another. In this case, it’s the speeds supported by your USB devices.

When you move data from one place to another, it does so at various speeds. These days, you have better speeds with USB devices, now that we have USB 3.1 and USB C. Those are pretty speedy.

If you don’t know, USB stands for Universal Serial Bus and USB has been around since 1996. There are a number of standards for transferring things across the bus lines and USB is just one of them. USB is a ratified standard that gives us uninversal connections shared among manufacturers. There’s even USB4 that I’m entirely unfamiliar with.

I suppose I don’t really need to explain this. We all understand USB well enough, I’d think. Still, we may not know some of the details and we may have never thought about monitoring USB bandwidth. Well, that’s what we’re doing and we’ll be doing it in the terminal.

What will we be using?

usbtop:

We’ll be using a nifty application known as ‘usbtop’ for this exercise. While there’s a tiny bit more to it than we’ll cover, we’ll at least use it to monitor USB bandwidth. If the ‘top’ aspect looks familiar, it should. This usbtop is familiar in the sense of top, htop, or atop. All of which are applications I should cover but haven’t. If you’re already familiar with those, you’ll have the right sort of expectations.

The usbtop application runs in the Linux terminal. I know that it’s available for more than just the Ubuntu family, but I’ll be testing this in Linux Mint. That’s just the device I’m using at the moment, though I’d normally be using Lubuntu.

If you’re using Linux Mint (or Debian, Ubuntu, Lubuntu, or even ElementaryOS) you can install usbtop easily. I had to refer to the Arch AUR page for this article, so I’m sure this is available elsewhere – though I think it might be in AUR for Arch derivatives like Mandriva.

But, seeing as we’re using Linux Mint, you can install usbtop with this command:

(Don’t try running it just yet. It won’t work properly.)

Once installed, you can type man usbtop to read the manual but that doesn’t appear to do a darned thing. No, I do not know why. If you want, you can try something like gibberish – like usbtop -help which won’t actually work but will be kind enough to spit out the two options you have with this usbtop application.

Monitor USB Bandwidth:

Well, I’ll assume you were able to run the installation command above. It’s run in the terminal. If you go this far, you didn’t need help opening the terminal. See? You’re getting better with this Linux stuff already!

Now, it’s not going to run. Feel free to try it. If you try, it will spit out an error that looks remarkably similar to this:

No USB bus can be captured thanks to libpcap. Check your name filter and make sure relevent permissions are set !

Don’t blame me. I’m just the messenger. Instead, start with this command:

Now you can run the following command:

Yes, you want elevated permissions to run usbtop.

With usbtop now up and running, you can try transferring something to a USB drive, or something from one USB drive to another USB drive, or anything involving your USB drive. You can even start up a USB webcam and monitor the bandwidth that uses.

I took a crappy screenshot… You’re welcome!

monitor USB bandwidth with usbtop
See? It’s easy enough to monitor USB bandwidth with usbtop. It’s not too difficult to use.

If you want to exit that screen, press CTRL + C. For some reason, the Q doesn’t quit. Then again, what do you expect from a project that can’t even sort out their man page. So, it is what it is. Again, don’t blame me. I’m just the messenger!

Nah, it’s a perfectly usable application. It doesn’t do much. You can expect it to do what it says and just what it says. If you checked the fake help page above, you’ll see that you can monitor a single device and you can list the devices. Those can be monitored individually, but you might as well monitor USB bandwidth on all the devices at once. It’s not too confusing, I swear.

Closure:

Well, now you know how to monitor USB bandwidth. I’m sure the application is available for other distros, but I did not test that. If you do test that, feel free to leave comments so that other people can learn from your labor. It’s a community, so share the wealth of knowledge in a comment.

I promise, it won’t be used as a way to spam you. I’ve been almost 500 articles and I’ve never spammed anyone so far – even with hundreds of comments and a bunch of people signed up to the newsletter. I just don’t see me violating that trust. If I ever do have a commercial message, it’ll just get attached to the newsletter – like a sponsor or something like that.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Limit The Download Speed For ‘wget’

In today’s article, we’re going to learn how to limit the download speed for ‘wget’. It will be a short article because I’m watching a race and didn’t bother writing an article ahead of time. It’ll also be suitable for someone new to ‘wget’. So, to learn how to limit the download speed for ‘wget’, read on!

We’ve had a number of ‘wget’ articles in the past. There’s quite a bit to it. If you don’t know, you use ‘wget’ in the terminal, as a way to transfer files across a network. The ‘wget’ command is often used to download files from the internet. If you’re unfamiliar with the ‘wget’ command, it defines itself as:

Wget – The non-interactive network downloader.

There are a number of existing ‘wget’ articles if you want to gain some familiarity with the command. Here’s some:

Rename A File Downloaded With ‘wget’
How To: Hide The Output From wget
Make wget Use IPv4 or IPv6
How To: Make ‘wget’ Ignore Certificate Errors

Plus, there are numerous articles that used wget to download files.

So, when you’ve taken a look at those articles and feel you have a solid grasp of what ‘wget’ is used for, you might as well take a look at the man page to get a better idea of the possibilities:

With that information properly learned or refreshed, let’s just skip right ahead to the main article…

Limit The Download Speed For ‘wget’:

It’s a bit different lately, as I’ve been using a different ISP. In the past, if I was downloading anything the whole network would bog down. I’d use things like ‘wondershaper‘ to get around that. Else, if I was using ‘wget’ to download a large file, I’d limit the download speed.

This isn’t much of an issue with my current connection, so I don’t worry about it. Still, you might have all sorts of reasons to limit the download speed for ‘wget’. We can do that! You will need an open terminal, however. 

So, open up your default terminal emulator. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

If you don’t know what we’re looking for, we’re looking for the --limit-rate flag. It’s not all that complicated and looks like this:

For example:

Where you see 50k, you can change it to 100k, 500k, or whatever. The k obviously stands for kilobytes. You can also use m, as in --limit-rate=50m and that’s obviously megabytes. If you’ve got enough bandwidth for it to matter, you can even use a g in that space, and it’s obviously for gigabytes.

See? That’s actually all there is to it. I told you it was simple and quick! Tada! It was!

Closure:

And there’s another article. This one was hurried but hopefully is worth reading and sharing with your online friends. You’ll have learned that you can limit the download speed for ‘wget’, a potentially handy way to use the tool. You can combine it with the various other flags, so be sure to read the man page!

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Monitor Bandwidth With nload

Today’s article should be fairly quick and simple, as we learn to monitor bandwidth with nload. It’s a handy tool that’s generally available across the many distros and is something you might find useful in your daily Linux journey.

You may also recall this article:

‘vnStat’ A Tool For Monitoring Your Bandwidth Usage

Well, today we’ll be learning how to monitor bandwidth with nload. You’ll find that nload has some visual similarities with vnStat – but nload doesn’t do logging. It’s a way to monitor your bandwidth in real time and, of course, in the terminal!

We do lots of fun stuff in the terminal! I didn’t actually expect so many articles to be terminal-based when I first started the site. Maybe I just hate taking screenshots?!?

Anyhow, this article will be published on a Sunday. It’s a weekend article, so it’s we can have a little fun with it. I’ll even keep it relatively short. You’re welcome!

So then, let’s just jump into the article…

Monitor Bandwidth With nload:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal now open, let’s go ahead and install nload. It should be in your default repositories, so it’d be installed with something like:

Fedora:

Debian/Ubuntu:

Etc… Fill in the above for your distro. You’ll find that nload defines itself as:

nload – displays the current network usage

With nload installed, you can simply start it with:

That will load all of your network adapters and you use your arrow keys to navigate between the network adapters. It should automatically find all your network adapters, so you don’t need to configure it to do so.

If you want to see the nload options available, press F2 where you’ll find you have some options available, including how long it takes for the application to find the averages.

If you want to monitor the bandwidth of just a single adapter, that command is actually really simple – it’s just:

For example, and using an an oft used Linux adapter name:

That’s about it, other than learning how to close the application. That may not be obvious to everyone, you can use Q or you can press CTRL + C to close out nload.

Closure:

And that is it, really. The article doesn’t really need more details to show you how to monitor bandwidth with nload. It’s quite a simple program and the output is entirely intuitive for even a rank Linux beginner. Enjoy your weekend!

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Test Your Bandwidth From The Terminal

There are all sorts of ways that you can test your bandwidth rate from the terminal. This article is going to cover just one of them. As far as articles go, this one should be pretty easy for anyone to follow and understand. It should also be relatively quick.

So, there’s that…

Which is nice…

The tool we’ll be using is known as ‘speedtest-cli’. You may be more familiar with their website, speedtest.net. If you, like most, visit the site, you can have your bandwidth tested in a number of ways and from a variety of servers. You can do that from the terminal, if you want.

Speedtest.org is pretty handy, though I’d probably recommend librespeed.org to folks who are testing via the web. The latter has no Java, websockets, nor Flash. It is also open source. On the other hand, it lacks a way to easily test it in the terminal.

So, what is speedtest-cli? It’s a way to access the speedtest.net tests via the terminal. There are a number of options and I’ll cover the most important of those options below. For now, speedtest-cli defines itself as:

speedtest-cli – Command line interface for testing internet bandwidth using speedtest.net

That’s a pretty accurate description of what it does. It’s also the tool we’ll be using. It’s just easier and fancier than other ways. Sure, you can download a large file in the terminal and get a good idea of what your download rate is, but it’s not much of a test and doesn’t include things like your upload speed.

Test Your Bandwidth:

As stated above, you will test your bandwidth rate in the terminal. To do this, you’ll obviously need an open terminal. To open your terminal with a keyboard shortcut, just press CTRL + ALT + T and your default terminal should open.

Install speedtest-cli:

So, speedtest-cli is unlikely to be installed by default, you’re going to have to install it. If you go to their official download page, you’ll get to download a script form of the application for pretty much every architecture out there. Those will work just fine and have directions about how to use them.

But, you can probably properly install speedtest-cli. For example, if you want to install it on Ubuntu, your installation command would look like this:

I didn’t check every other distro, but it sure looks like it’s available in the default repositories for a bunch of them. Even in Manjaro, I was able to install speedtest-cli with this command:

And all was good with it installing without any need to mess around with scripts or installing it manually. As near as I can tell, it works the same for Fedora and even CentOS. Just use your package manager to do the installation and it’s probably in there.

Test Your Bandwidth With speedtest-cli:

Next, you’re going to want to run speedtest-cli. If you’re familiar with the web interface, the terminal interface won’t seem too terribly foreign. By default, the bandwidth test will be done with the closest servers to you (based on IP address geolocation). You can also pick the server you want it to test your bandwidth with, overriding the default choice.

If you want to run the command that’d give you the results you’d get by using the defaults on the web page, you just run the command without any flags at all. It looks like:

If you want to list servers based on distance from your location, then you first need to run this command:

That will show you servers and their associated server number. Using that number, you can pick which server you want to use with this command:

Those commands will happily give you the test results right there in the terminal, but you can also opt to generate an image. To do that, you use the --share flag. So, a basic command would look like this:

After it spits out the results, it will give you a URL to an image generated based on your individual results. I suppose this is good for bragging rights or for demonstration purposes when complaining about your throughput to your ISP. An image generated from a VPS of mine looks like:

speedtest-cli results from a VPS
That’s obviously from a VPS. My bandwidth isn’t that good! It’d be pretty sweet if it was!

You can use that image to show off to your friends or, as mentioned, a demonstration for how poorly our ISP is serving you. This is one of a few ways you can tell if your provider is actually providing you with the services you purchased.

Those are pretty much the only ways you’re going to use speedtest-cli in the real world. There are a few more options, so be sure to check the man page. As a general rule, most folks are going to just want those options and those results.

Closure: 

And there you have it. You now have a new article. This one is telling you how to test your bandwidth with speedtest-cli, a test you may find useful from time to time.

The bandwidth from my house? Well, I have a lot of stuff using the ‘net on this line right now – but it’s still enough bandwidth for my needs. It’s not nearly as impressive and the results look like this:

speedteest-cli results from my home
As you can see, it’s not that high. That’s actually a bonded DSL line and twice what it used to be!

It’s useful testing to see if you’re actually getting the bandwidth you paid for. Sadly, ISPs are aware of the IP addresses speedtest.net uses and folks tell me that they’re prioritizing traffic from that service (meaning giving you better results than reality would give you) but I have no idea if that’s true or not. To be fair, it does sound sleazy enough for an ISP to do it, though I’ve had pretty good luck with the service providers I currently use.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Monitor Network Usage On A Per-Application Basis

Today’s article is going to tell you how to use Nethogs to monitor network usage on a per-application basis. It’s actually easier than one might think and we’ll even show you how to install Nethogs on a variety of distros.

Why would you want to monitor this? Well, you may want to know which applications are eating up most of your bandwidth. Not everyone has unlimited bandwidth after all. You might also be looking for rogue applications/malware that’s using up some of your bandwidth. There are all sorts of reasons to monitor your network usage at this level. Feel free to leave a comment telling us how you intend to use Nethogs.

As stated, we’ll be using Nethogs. The man page describes it as:

nethogs – Net top tool grouping bandwidth per process

I suppose that’s mostly useful to those who know what ‘top‘ is. (There’s a future article about top and htop, when I get to it.) But, Nethogs is like a system monitor, except it’s a network monitor with some visual similarity with top. (Yes, that’s an ugly, ugly sentence.)

We’ll be using ‘sudo’ for all of these commands. It’s possible to use Nethogs without sudo, but we won’t be covering that here. If that’s something you’re interested in doing, a search engine will help you get there.

Monitor Network Usage:

Nethogs is a terminal-based application. As such, you’ll need an open terminal. Just press CTRL + ALT + T and your default terminal emulator should open right up.

Once your terminal is open, you can go ahead and install Nethogs. Pick the command that works with your system’s package manager.

Debian/Ubuntu:

RHEL/CentOS (will need to enable EPEL):

Fedora:

Arch/Derivatives: 

Once you have Nethogs installed, you can check the help files. In this case, the help files are better than the man files (I think) so just enter the following into your terminal:

Now, to run Nethogs, we’ll use sudo and just run it in the terminal. Believe it or not, this mode is generally just fine for anything you’re going to do.

That’ll open Nethogs and start monitoring your network usage on a per-application basis. It looks something like this:

Nethogs running in the terminal.
As you can see, bandwidth monitoring on a per-application basis. Tada!

Now, if you’re going to leave it open, you can change the refresh rate. That’s done with the -d <seconds> flag. If you want it to refresh every 15 seconds, your command would look like this:

By the way, if you want to exit Nethogs, you just press Q and it closes – like top and htop do.

If you want, you can specify the network interface you want to use. It doesn’t require any flags, just the network interface name. (Read Also: how to change your network interface name.) An example of that command would be:

While the application is running, you can do some sorting/display changes with the M, R, and S keys. But it’s usually not all that complicated and sorting isn’t needed. If you’re dealing with hundreds of collections, then you may want to start sorting. Really, that’s about all you’ll ever need.

Closure:

And there you have it! You have another article to read. This one is about monitoring your network usage on a per-application basis, a pretty handy skill/tool to have. It’s pretty easy and the output is clear enough for all but the newest Linux users. If you find the tool useful, or already use the tool, please feel free to comment.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.