为了找出机器的哪些端口是由哪些服务打开的,我使用了:
netstat -tulpn
我检查了man
页面中的netstat
命令,但没有发现任何关于该选项的信息。-tulpn
选项的含义是什么?
发布于 2020-03-16 10:23:04
正如在https://serverfault.com/questions/387935/whats-the-difference-betwen-the-single-dash-and-double-dash-flags-on-shell-comm中回答的那样,在Linux命令行中;
一个连字符后面可以有多个单字符标志.双连字符前缀为单个多字符选项。
如果您查看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.
因此,您的命令相当于以下长形式:
netstat --tcp --udp --listening --program --numeric
发布于 2020-03-16 10:36:01
除了man netstat
之外,您还可以键入info netstat
以获得更短的摘要和更长的解释:
NETSTAT(8) Linux Programmer's Manual NETSTAT(8)
NAME
netstat - Print network connections, routing tables, interface statistics, mas‐
querade connections, and multicast memberships
SYNOPSIS
netstat [address_family_options] [--tcp|-t] [--udp|-u] [--raw|-w] [--listening|-l]
[--all|-a] [--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users]
[--symbolic|-N] [--extend|-e[--extend|-e]] [--timers|-o] [--program|-p] [--ver‐
bose|-v] [--continuous|-c]
对于上面的-t -u -l -p -n
,您可以看到--tcp
、--udp
、--listen
、--program
和--numeric
,而不必滚动。
向下滚动,你可以看到详细的解释。
发布于 2020-03-16 10:02:08
看起来您正在寻找netstat(8)的手册页。
Linux.die.net拥有似乎所有Linux工具的手册页。参见下面的netstat(8)手册页,它将回答您的问题。
https://askubuntu.com/questions/1217513
复制相似问题