Last active
September 19, 2020 09:21
-
-
Save guitarrapc/cb994571db1fc6e79f997eedef39224f to your computer and use it in GitHub Desktop.
Get Process by port
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -it --rm -p 8080:80 nginx:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$port = 8080 | |
(Get-NetTCPConnection -LocalPort $port -State Listen).OwningProcess | %{Get-Process -Id $_} | |
# RESULT | |
# Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName | |
# ------- ------ ----- ----- ------ -- -- ----------- | |
# 202 29 1580 5432 0.02 18228 1 wslhost | |
# 307 38 22840 22220 3.58 17372 1 com.docker.backend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment