Created
October 12, 2021 22:20
-
-
Save salishdev/88870e61cde5c1b5f50e53ba5df483a3 to your computer and use it in GitHub Desktop.
Find what process is using a 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
whatsonport () { | |
if [ $# -eq 1 ] | |
then | |
lsof -i :$1 | awk '{ print $2; }' | head -n 2 | grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox} -v PID | |
else | |
echo "Usage: whatsonport [port]" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment