Windows 下查看網絡鏈接

實例

  • 根據進程ID(PID)查看某進程的全部 TCP 鏈接
# cmd
# 6540 爲 PID
netstat -ano | findstr TCP.*6540$

netstat

  • 根據 PID 查看某進程的全部 TCP 鏈接,並按建立時間排序
# powershell
Get-NetTCPConnection -OwningProcess 6540 | 
Sort-Object CreationTime | 
Format-Table Local*, Remote*, State, CreationTime

Get-NetTCPConnection

# 用 Where-Object 過濾掉臨時端口(Bound)
Get-NetTCPConnection -OwningProcess 6540 | 
Where-Object {$_.State -ne 'Bound'} | 
Sort-Object CreationTime | 
Format-Table Local*, Remote*, State, CreationTime

Where-Object

本文出自 qbit snap
相關文章
相關標籤/搜索