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. 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
- 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
May be interested
- Microsoft 'turns the wheel' to bring the old Network Connections settings back to Windows 11obviously the network connections setting is easier to use than the advanced network settings in windows 11's settings.
- How to monitor, clean and optimize Linux with Stacerlooking for ways to optimize your linux system and make it run faster? there are tons of ways and tools for you to do this, and stacer includes everything you need to monitor, clean, and optimize your linux installation.
- How to See Active Network Connections (Windows)you may find yourself needing to check your current network connectivity when using your windows computer. there are a few simple methods that you can use to accomplish this. for windows 10, you can access the network and sharing center....
- How to control WiFi network in Linux using Evillimiterfortunately, controlling a wifi network in linux is pretty easy. you can use evillimiter - an open source application - to monitor and control your device's bandwidth.
- How to use Raspberry Pi to monitor network with Nagiosthe best way to monitor networks with a raspberry pi is to use a software called nagios. nagios is like an error detection tool, it checks something as often as possible (like every 5 minutes) and warns you when this check doesn't work as expected.
- Working with Network Monitor (Part 1)even though a computer network is quite reliable, sometimes problems arise. for example, a network may be slow compared to its capabilities or a device on this network may have trouble communicating.
- Learn about Network Monitor (netmon) 3.3in this article we will show you the latest version of network monitor (version 3.3), support issues for windows 7 and network experts features.
- Guide to network operation for Linux users: 11 commands to knowlinux supports commands to download files, diagnose network problems, manage network interfaces or view network statistics on the terminal. here are some common linux commands to work with, please consult.
- How to use Conky to make Linux more awesomeyou may be tired of trying different wallpapers to improve desktop aesthetics. how to closely monitor cpu temperature, network usage or hard drive? you can do all this with conky.
- Learn Resource Monitor tool in Windows Server 2012the resource monitor is a great tool to determine which programs or services are using resources such as programs, applications, network connections, and memory.