How to monitor network connections in Linux with pktstat
If you're wondering what processes are using your bandwidth on Linux, a small utility called pktstat can help.
If you're wondering what processes are using your bandwidth on Linux, a small utility called pktstat can help. This command-line tool displays package activity in real time, with several convenient options for common functions.
What is pktstat?
pktstat is a utility that displays the behavior of packets to and from your computer, similar to how top or htop displays information about processes. It's a full-screen program that runs in the terminal.
How to install pktstat
Installing pktstat is easy as it is available in the package manager for most major Linux distributions.
For example, to install pktstat on Debian or Ubuntu, use the following command:
sudo apt install pktstat
And on Arch, use the command:
sudo pacman -S pktstat
And for the Red Hat family, use the command:
sudo dnf install pktstat
Monitor network connections with pktstat
To see any open network connections with pktstat, you can simply call it from the command line. Because network connectivity affects system security, you usually need to run it as root:
sudo pktstat
This will display full screen. It will display all open network connections on your machine. You'll see the source and destination of any packets moving between your local machine and the remote computer.
As with many other Linux programs, pktstat's real power comes from its various options. The -i option allows you to specify the interface you want to monitor. For example, you might want to monitor connections on a wired Ethernet interface rather than WiFi:
sudo pktstat -i [interface]
By default, pktstat will display shortened hostnames. To see the full hostname, use the -F option .
The -n option will completely strip the hostname, showing only the IP address. You can also press n to switch numeric mode while pktstat is running.
The -c option will separate traffic streams that pktstat would normally combine into one, such as multiple TCP connections.
You can change the sort order by pressing t for 'top mode' to sort by number of bits as well as by using the -t option .
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.
You should read it
- How to monitor network usage for Linux processes
- How to open Network Connections on Windows 10
- Top 10 examples of Netstat commands on Linux
- How to Set Up and Use SSH in Linux
- How to fix an empty Network Connections interface
- How to use ss command on Linux
- Network testing with Network Monitor 3.4 - Part 1
- How to use the Netstat command in Windows 11 to monitor network activity
- Data analysis with Network Monitor
- How to monitor, clean and optimize Linux with Stacer
- Microsoft 'turns the wheel' to bring the old Network Connections settings back to Windows 11
- How to See Active Network Connections (Windows)