-
-
Save jziggas/84540732c402516d76341fb2800d74e1 to your computer and use it in GitHub Desktop.
Listening
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
thanks james