Created
September 3, 2014 23:33
-
-
Save jdstapleton/363e609605b8db9071a0 to your computer and use it in GitHub Desktop.
listening.sh
This file contains hidden or 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
# Mac OSX: | |
listening () { | |
lsof -Pni | grep '(LISTEN)' | awk 'BEGIN {printf "%-15s %5s %21s\n", "Command", "PID", "PORT"} {printf "%-15s %5s %21s\n", $1,$2,$9}' | |
} | |
# Linux (if you want non-you processes that are listening): | |
listening () { | |
sudo lsof -Pni | grep '(LISTEN)' | awk 'BEGIN {printf "%-15s %5s %21s\n", "Command", "PID", "PORT"} {printf "%-15s %5s %21s\n", $1,$2,$9}' | |
} | |
# For linux you can copy the function into a new file called(or any other name): /etc/profile.d/listening.sh. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment