Online Linux Terminal Logo
OnlineLinuxTerminal
网络与传输CLI Manual

$netstat

Print network connections, routing tables, interface statistics, and listening ports.

命令语法POSIX Standard
netstat [OPTIONS]
Linux 社区2.4k 在线

与真实 Linux 用户交流,学习常用命令并免费获取精美速查表 PDF。

在交互式终端沙盒中实时运行

无需安装的客户端实时仿真环境。

在全屏终端工作区中打开 ↗
bash — terminal

概述与工作原理

`netstat` (Network Statistics) provides comprehensive visibility into incoming and outgoing network connections, listening TCP/UDP ports, routing tables, and interface metrics.

常用参数与选项说明

Flag / OptionDescription
-tDisplay TCP network connections.
-uDisplay UDP network connections.
-lShow only listening server sockets.
-pShow the PID and program name to which each socket belongs.
-nShow numerical addresses and port numbers instead of resolving hostnames.

实际生产案例与代码范例

#1Check all listening ports and services
netstat -tuln

Lists all open TCP and UDP ports in numeric format.