Skip to content

Instantly share code, notes, and snippets.

@Jonalogy
Last active July 3, 2018 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jonalogy/ab29580ff04be0d580b4c113ab2d2d02 to your computer and use it in GitHub Desktop.
Save Jonalogy/ab29580ff04be0d580b4c113ab2d2d02 to your computer and use it in GitHub Desktop.

To show list of PID on a port:

  • lsof -t -i :YOUR_PORT_NUMBER

top command will show a list of all running processes and various statistics about each process. It’s usually most helpful to sort by processor usage or memory usage, and to do that you’ll want to use the -o flag

  • top -o cpu | grep :YOUR_PORT_NUMBER shows details of the respective pid

To kill a process by PID:

  • kill :YOUR_PORT_NUMBER

Sources

[1] How to find and kill port processes on a Mac using Bash

[2] How to View All Running Apps & Processes in Mac OS X

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment