Skip to content

Instantly share code, notes, and snippets.

@ppcamp
Created October 25, 2023 18:43
Show Gist options
  • Save ppcamp/18c5c4a0eb3243343a97a013623683e3 to your computer and use it in GitHub Desktop.
Save ppcamp/18c5c4a0eb3243343a97a013623683e3 to your computer and use it in GitHub Desktop.
Grep current program using some TCP port
sudo lsof \
  # convert hosts and ports files to the equivalent being accessed
  -nP \
  # grep only the process using that
  -t \
  # grep only port 6060
  -sTCP:LISTEN -iTCP:6060
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment