安装

Arch Linux

  1. sudo pacman -S net-tools

Debian/Ubuntu

  1. sudo apt install net-tools

CentOS/RHEL

  1. sudo yum install net-tools

参数应用

  1. Desktop netstat -h
  2. usage: netstat [-vWeenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}
  3. netstat [-vWnNcaeol] [<Socket> ...]
  4. netstat { [-vWeenNac] -i | [-cnNe] -M | -s [-6tuw] }
  5. -r, --route display routing table
  6. -i, --interfaces display interface table
  7. -g, --groups display multicast group memberships
  8. -s, --statistics display networking statistics (like SNMP)
  9. -M, --masquerade display masqueraded connections
  10. -v, --verbose be verbose
  11. -W, --wide don't truncate IP addresses
  12. -n, --numeric don't resolve names
  13. --numeric-hosts don't resolve host names
  14. --numeric-ports don't resolve port names
  15. --numeric-users don't resolve user names
  16. -N, --symbolic resolve hardware names
  17. -e, --extend display other/more information
  18. -p, --programs display PID/Program name for sockets
  19. -o, --timers display timers
  20. -c, --continuous continuous listing
  21. -l, --listening display listening server sockets
  22. -a, --all display all sockets (default: connected)
  23. -F, --fib display Forwarding Information Base (default)
  24. -C, --cache display routing cache instead of FIB
  25. <Socket>={-t|--tcp} {-u|--udp} {-U|--udplite} {-S|--sctp} {-w|--raw}
  26. {-x|--unix} --ax25 --ipx --netrom
  27. <AF>=Use '-6|-4' or '-A <af>' or '--<af>'; default: inet
  28. List of possible address families (which support routing):
  29. inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)
  30. netrom (AMPR NET/ROM) rose (AMPR ROSE) ipx (Novell IPX)
  31. ddp (Appletalk DDP) x25 (CCITT X.25)