1 | netstat -lnt | awk 'NR>2{print $4}' | grep -E '0.0.0.0:' | sed 's/.*://' | sort -n | uniq |
netstat -lnt | awk ‘NR>2{print $4}’ | grep -E ‘:::’ | sed ‘s/.*://‘ | sort -n | uniq
1 | ipv4和ipv6都有 |
netstat -lnt | awk ‘NR>2{print $4}’ | grep -E ‘(0.0.0.0:|:::)’ | sed ‘s/.*://‘ | sort -n | uniq
1 | 如果要列出在localhost接口上侦听的所有端口,请使用如下所示: |
netstat -lnt | awk ‘NR>2{print $4}’ | grep -E ‘(127.0.0.1:|::1:)’ | sed ‘s/.*://‘ | sort -n | uniq
```