linux命令:netstat

来源:互联网 发布:jenkins 修改端口号 编辑:程序博客网 时间:2024/06/06 21:38

Help说明

usage: netstat [-veenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help}       netstat [-vnNcaeol] [<Socket> ...]       netstat { [-veenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s } [delay]        -r, --route                display routing table        -I, --interfaces=<Iface>   display interface table for <Iface>        -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        -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        -T, --notrim               stop trimming long addresses        -Z, --context              display SELinux security context for sockets  <Iface>: Name of interface to monitor/list.  <Socket>={-t|--tcp} {-u|--udp} {-S|--sctp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom  <AF>=Use '-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) 

常用命令:

  • -a || –all:显示所有连接 (默认仅显示已连接状态);
  • -t || –tcp:显示tcp连接
  • -u || –udp:显示udp连接
  • -x || –unix:显示unix内部
  • -n || –numeric:连接信息数字化
  • -p || –programs:显示连接的PID/program name
  • -e || –extend:显示更多的信息,程序执行者,inode号码
  • -i || –interfaces:显示网络接口列表(网卡信息列表)
  • -s || –statistics:显示所有端口的统计信息
  • -l || –listening:显示处理监听状态的连接
  • -r || –route:显示路由信息

查看端口占用情况

# 列出所有连接netstat -anp# 查看程序占用的端口netstat -anp | grep httpd# 查看端口被哪一个程序占用netstat -anp | grep ':3306'
0 0
原创粉丝点击