通过指定-n您告诉 netstat 使用端口号而不是服务名称。如果您查看输出,netstat -a您将看到端口号是人类可读的服务名称。这些是映射自/etc/services,因此如果您正在侦听端口 80,您将看到*:http或hostname:http,如果您正在侦听端口 8080,您将看到*:webcache或hostname:webcache。
来自 Fedora 16 上的 netstat 手册页:
--numeric , -n
Show numerical addresses instead of trying to determine symbolic host,
port or user names.
Run Code Online (Sandbox Code Playgroud)