netstat 的 -t 和 -u 标志在哪里记录?

dot*_*hen 5 command-line documentation netstat

我使用以下命令查找服务器上的开放端口:

$ netstat -ntulp
Run Code Online (Sandbox Code Playgroud)

多年来,我可能在一些随机网站上发现了这一点。但是,我找不到在哪里-t或被-u记录在案。它当然不在手册页中。手册页确实暗示了它们的存在,并可能暗示它们分别是-tcpand 的同义词-udp(也未记录,虽然很容易推断其含义)。

虽然它似乎-t-u是同义词-tcp-udp这哪里是记录?

Mar*_*ich 5

联机帮助页和netstat --help两者都[--tcp|-t] [--udp|-u]在概要中说。这不仅仅是一个提示——这个语法很清楚地说明了-t与 相同--tcp-u相同--udp。尽管联机帮助页没有记录--tcp--udp.

netstat --help显示--tcp--udp是您可以使用的几个套接字选择器中的两个,请参见以下<Socket>行:

host ~ # netstat --help
usage: netstat [-vWeenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help}
       netstat [-vWnNcaeol] [<Socket> ...]
       netstat { [-vWeenNac] -i | [-cWnNe] -M | -s }

        -r, --route              display routing table
        -i, --interfaces         display interface table
        -g, --groups             display multicast group memberships
        -s, --statistics         display networking statistics (like SNMP)
        -M, --masquerade         display masqueraded connections

        -v, --verbose            be verbose
        -W, --wide               don't truncate IP addresses
        -n, --numeric            don't resolve names
        --numeric-hosts          don't resolve host names
        --numeric-ports          don't resolve port names
        --numeric-users          don't resolve user names
        -N, --symbolic           resolve hardware names
        -e, --extend             display other/more information
        -p, --programs           display PID/Program name for sockets
        -c, --continuous         continuous listing

        -l, --listening          display listening server sockets
        -a, --all, --listening   display all sockets (default: connected)
        -o, --timers             display timers
        -F, --fib                display Forwarding Information Base (default)
        -C, --cache              display routing cache instead of FIB

  <Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom
  <AF>=Use '-6|-4' or '-A <af>' or '--<af>'; default: inet
  List of possible address families (which support routing):
    inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) 
    netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) 
    x25 (CCITT X.25) 
Run Code Online (Sandbox Code Playgroud)