I use the following command to find open ports on my servers:

$ netstat -ntulp

I've probably found that on some random website over the years. However, I cannot find where -t or -u are documented. It certainly isn't in the man page. The man page does allude the their existence, and possibly hints that they are synonyms for -tcp and -udp (also undocumented, though easy enough to infer meaning for) respectively.

Though it seems that -t and -u are synonyms for -tcp and -udp, where is this documented?

  • What operating system? That command varies from system to system – Stéphane Chazelas Jan 24 '14 at 14:45
  • Kubuntu 12.10 and Ubuntu Server 12.04. – dotancohen Jan 26 '14 at 8:02

The manpage and netstat --help both say [--tcp|-t] [--udp|-u] in the synopsis. That's more than a hint - this syntax pretty clearly states that -t is the same as --tcp and that -u is the same as --udp. You're right though that the manpage doesn't document --tcp and --udp.

netstat --help shows that --tcp and --udp are two of the several socket selectors that you can use, see the <Socket> line:

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) 
  • Thank you. I wasn't sure that the way the manual states it ([--tcp|-t] [--udp|-u]) does in fact meant that -t is the same as --tcp and that -u is the same as --udp. Perhaps I should have quoted the manual as you have done and asked that specific question. – dotancohen Jan 26 '14 at 8:04

The man pages are your friends for info such as this:

$ man netstat
   netstat   [address_family_options]   [--tcp|-t]   [--udp|-u]  ...

Notice in the usage that those switches are the short forms of the GNU style switches --tcp and --udp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.