-tulpn 选项对 netstat 意味着什么?

M. *_*ami 5 netstat

为了找出哪些服务正在打开机器的哪些端口,我使用了:

netstat -tulpn
Run Code Online (Sandbox Code Playgroud)

我检查了命令man页面netstat,但我没有发现有关此选项的任何信息。-tulpn选项的含义是什么?

Fed*_*eli 17

正如在Linux 命令行中的https://serverfault.com/questions/387935/whats-the-difference-betwen-the-single-dash-and-double-dash-flags-on-shell-comm中回答的那样;

单个连字符后可以跟多个 单字符标志。

双连字符作为单个 多字符选项的前缀。

如果您查看netstat 手册页,您会看到(注意,netstat -tulpn相当于netstat -t -u -l -p -n):

--tcp|-t

--udp|-u

-l, --listening
   Show only listening sockets.  (These are omitted by default.)

-p, --program
   Show the PID and name of the program to which each socket belongs.

--numeric, -n
   Show numerical addresses instead of trying to determine symbolic host, port or user names.
Run Code Online (Sandbox Code Playgroud)

因此,您的命令也等效于以下长格式:

netstat --tcp --udp --listening --program --numeric
Run Code Online (Sandbox Code Playgroud)