Created
October 19, 2016 12:24
-
-
Save lislon/5193299267eeb38ab493bfc2985887ca to your computer and use it in GitHub Desktop.
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
# Shows who is listening port $1 with process info | |
who-listen() { | |
exec 3<&1 # new pipe to show output of nestat in stdout | |
# Netstat and then ps -p of process that netstat showed to us | |
sudo netstat -tulpn | grep :$1 >&3 3>&- | grep -P -o '\d+(?=/)' | sort -u | xargs -r ps -up | |
exec 3>&- # close pipe | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment