Last active
April 7, 2023 20:34
-
-
Save alismx/ce30489841fdedc021675981308a399e to your computer and use it in GitHub Desktop.
Bash function to check what is running on a specified 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
# load into your path and run `whatisonport 5432` | |
whatisonport() { | |
echo "lsof results - " | |
echo "$(sudo lsof -i :$1)" | |
echo " " | |
echo "fuser results - " | |
echo "$(sudo fuser $1/tcp)" | |
echo " " | |
echo "netstat results - " | |
echo "$(sudo netstat -ltnp | grep -w :$1)" | |
echo " " | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment