检查端口使用情况
powershell on windows
1
| Get-Process -Id (Get-NetTCPConnection -LocalPort YourPortNumberHere).OwningProcess
|
lsof
首推的就是lsof命令。
1 2
| $ lsof -i $ lsof -i:8000
|
注意当前用户,如果想显示其它用户的使用情况,可使用
netstat
Linux
1
| $ netstat -tulpn | grep LISTEN
|
MacOS X
1 2
| $ netstat -anp tcp | grep LISTEN $ netstat -anp udp | grep LISTEN
|
Windows
1 2 3
| netstat -bano | more netstat -bano | findstr LISTENING netstat -bano | findstr /R /C:"[LISTEING]"
|
nmap(需要安装)
1 2 3
| $ sudo nmap -sT -O localhost $ sudo nmap -sU -O 192.168.2.13 $ sudo nmap -sT -O 192.168.2.13
|
1
| $ sudo nmap -sTU -O 192.168.2.13
|