Skip to content

Instantly share code, notes, and snippets.

@digitalresistor
Created February 10, 2012 22:58
Show Gist options
  • Save digitalresistor/1793810 to your computer and use it in GitHub Desktop.
Save digitalresistor/1793810 to your computer and use it in GitHub Desktop.
shortcut for lsof
# Add this to your .bash_profile
function lsockets {
lsof -a -c $1 -i -l -P
}
# example:
#
# lsockets steward
#
# COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
# steward 89581 503 3u IPv4 0x0a7a6a98 0t0 TCP *:60666 (LISTEN)
# steward 89581 503 4u IPv6 0x08a9b830 0t0 TCP *:60666 (LISTEN)
# steward 89581 503 5u IPv4 0x08cf2b98 0t0 TCP 192.168.57.39:3570 (LISTEN)
# steward 89581 503 6u IPv6 0x08a9b5c0 0t0 TCP [fd38:e7f4:6d48::66b9:e8ff:fecd:689e]:3650 (LISTEN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment