| Tested on | Debian 13 (trixie) |
|---|---|
| Package | net-tools 2.10 |
| Applies to | Debian |
| Privilege | sudo or root |
| Scope | Install netstat on Debian, including fix netstat command not found on minimal images, compare listening ports, routes, and net-tools cleanly. |
| Related guides | Add Apt Repository Command Not Found Apt Install Specific Version Backup Brave Browser Session Ubuntu Check Ubuntu Version Configure Vnc Server Ubuntu |
netstat prints open sockets, routing tables, and interface statistics—the classic view of “what is listening on this host?” On Debian, it is not its own package: you install net-tools with apt. Minimal images usually ship ss from iproute2 instead, so netstat: command not found is normal until you install net-tools or use ss (Super User, linuxconfig.org).
This guide covers install netstat on Debian for Debian 11 (Bullseye), 12 (Bookworm), and 13 (Trixie): fix command not found, install net-tools, verify listeners and routes, compare with ss, and uninstall. I ran these steps on Debian 13 and kept real terminal output below. For interface addresses, see install ifconfig on Debian—the same package provides both tools.
net-tools. apt install netstat returns Unable to locate package netstat.
Choose an approach
| Approach | Best for | On test host |
|---|---|---|
apt install net-tools |
Legacy scripts, exams, tutorials that call netstat |
netstat at /usr/bin/netstat |
ss from iproute2 |
New work, automation, default on minimal Debian | ss -tuln works without net-tools |
| Both | Transition while updating old playbooks | Common on desktop images |
Prefer ss for new automation. Install net-tools when something explicitly runs netstat.
Check whether netstat is installed
List files shipped by a package with dpkg -L; the dpkg command shows how to locate binaries and configuration paths.
. /etc/os-release && echo "$PRETTY_NAME"
command -v netstat || echo "netstat: not in PATH"
command -v ss && ss --version | head -1
dpkg -l net-tools 2>/dev/null | grep ^ii
apt-cache policy net-tools | head -8Before installing on the test host:
Debian GNU/Linux 13 (trixie)
netstat: not in PATH
/usr/bin/ss
ss utility, iproute2-6.15.0ss was already available; net-tools was not:
net-tools:
Installed: (none)
Candidate: 2.10-1.3Prerequisites
-
Debian 11, 12, or 13 with network access for apt.
-
sudo for package install.
-
iproute2 (
ss) is usually already installed. -
For broader CLI reference beyond the
aptandsudosteps below, see the Linux commands.
Commands below that need root use sudo command.
Install netstat with net-tools
Install the NET-3 networking toolkit (Ultahost, Tecmint):
sudo apt update
sudo apt install -y net-toolsFetched 245 kB in 1s (282 kB/s)
Selecting previously unselected package net-tools.
Unpacking net-tools (2.10-1.3) ...
Setting up net-tools (2.10-1.3) ...Verify:
List every PATH match with which -a; the which command compares which to type -a and command -v.
netstat --version | head -1
which netstat
dpkg -S "$(which netstat)"net-tools 2.10
/usr/bin/netstat
net-tools: /usr/bin/netstatOther binaries in net-tools
One install also provides legacy tools (install ifconfig on Debian):
dpkg -L net-tools | grep -E '^/usr/(s)?bin/' | grep -E 'ifconfig|netstat|route|arp'/usr/bin/netstat
/usr/sbin/ifconfig
/usr/sbin/route
/usr/sbin/arpCommon netstat commands
Listening TCP and UDP ports
netstat -tulnActive Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN| Flag | Meaning |
|---|---|
-t |
TCP sockets |
-u |
UDP sockets |
-l |
Listening only |
-n |
Numeric addresses (no DNS) |
Processes owning sockets
sudo netstat -tulnp | head -10Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 807/sshd: /usr/sbin
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 789/cupsdRouting table
netstat -rKernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
default _gateway 0.0.0.0 UG 0 0 0 enp0s3
10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s3For modern route management, see ip route command.
Interface statistics
netstat -iKernel Interface table
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
enp0s3 1500 9194805 0 0 0 691876 0 0 0 BMRU
lo 65536 552758 0 0 0 552758 0 0 0 LRUUse ss instead of netstat (recommended for new scripts)
iproute2 is the maintained replacement. On the test host, ss worked before net-tools was installed:
ss -tuln | head -8Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
tcp LISTEN 0 4096 127.0.0.1:631 0.0.0.0:*
tcp6 LISTEN 0 128 [::]:22 [::]:*| Task | netstat | ss (iproute2) |
|---|---|---|
| Listening TCP/UDP | netstat -tuln |
ss -tuln |
| With process names | sudo netstat -tulnp |
sudo ss -tulnp |
| Routing table | netstat -r |
ip route |
| Interface stats | netstat -i |
ip -s link |
See the ss command cheat sheet and ip guides for filters and scripting.
ss, but net-tools remains in Debian main for compatibility. New playbooks should call ss; keep netstat when a vendor script or certification lab requires it.
Read the manual
MANPAGER=cat man netstat 2>/dev/null | head -8NETSTAT(8) Linux System Administration NETSTAT(8)
NAME
netstat - Print network connections, routing tables, interface statis‐
tics, masquerade connections, and multicast membershipsUpdate net-tools
sudo apt update
sudo apt install --only-upgrade net-tools
netstat --version | head -1Check the installed version with list installed packages on Debian:
dpkg -l net-tools | grep ^iiUninstall netstat (remove net-tools)
Removing net-tools removes netstat, ifconfig, route, and related binaries together:
sudo apt remove net-toolsDry-run on the test host:
The following packages will be REMOVED:
net-tools
Remv net-tools [2.10-1.3]Use ss afterward for socket listing. Scripts that call netstat break until you reinstall net-tools or rewrite them.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
netstat: command not found |
net-tools not installed | sudo apt install net-tools |
Unable to locate package netstat |
No such package name | Install net-tools, not netstat |
| Empty PID column | Not running as root | sudo netstat -tulnp |
netstat vs ss output differs |
Different column layout / filters | Use matching flags; see ss command |
| Works on one host, not another | Minimal image without net-tools | Install package or use ss |
| Still missing after install | Broken dpkg state | dpkg -l net-tools; sudo apt install -f |
References
- packages.debian.org — search netstat (contents)
- linuxconfig.org — netstat command not found
- Super User — netstat does not exist on Debian
- net-tools on Debian
- ss command, , , , apt command,
Summary
Install netstat on Debian with sudo apt install net-tools—there is no separate netstat package. Fix command not found on minimal images by installing net-tools, or use ss -tuln from iproute2 for listening ports. Verify with netstat --version and dpkg -S /usr/bin/netstat, use sudo netstat -tulnp when you need PIDs, and remove net-tools when you no longer need legacy NET-3 utilities.

