If you’re wondering which processes are using your bandwidth on Linux, a little utility called pktstat may be able to help. This command-line tool shows packet activity in real time, with some convenient options for common functions.

What Is pktstat?

pktstatis a utility that shows the behavior of packets going to and from your computer, similar to howtop or htop shows information on processes. It’s a full-screen program that runs in the terminal.

How to Install pktstat

Installing pktstat is easy since it’s available in the package managers for most major Linux distros.

For example, to install it on Debian or Ubuntu:

pktstat running in the Linux terminal

And on Arch:

And on the Red Hat family

Monitoring Network Connections With pktstat

To see any open network connections with pktstat, you can just call it from the command line. Because network connections affect system security, you usually need to run it as root:

This will bring up a full-screen display. It will show any open network connections on your machine. You’ll see the source and destination of any packets going between your local machine and the remote computer.

As with many other Linux programs, the real power of pktstat comes from its various options. The-ioption lets you specify an interface you want to monitor. For example, you may prefer to track connections on a wired Ethernet interface rather than the Wi-Fi:

By default, pktstat will show shortened hostnames. To see the full hostname, use the-Foption.

The-noption will dispense with hostnames completely, just showing IP addresses. You can also pressnto toggle the numeric mode when pktstat is running.

The-coption will separate traffic flows that pktstat would normally combine into one, such as multiple TCP connections.

You can change the sort order by pressingtfor “top mode” to sort by bit count as well as by using the-toption.

pkstat Is a Valuable Addition to Your Sysadmin Toolset

pktstat is a useful console-based tool for monitoring incoming and outgoing network connections on your Linux system in real time. It’s like top or htop for your network.