Network
The lsof command
Lists the files opened by processes. With -i, it shows which processes use the network and which ports listen.
Syntax
lsof -i [:PUERTO] | lsof archivoMost useful options
-iOnly network connections-i :80Only the given port-p PIDOnly the given processCopy-ready examples
$ lsof -iOpen network connectionsYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- It needs sudo to see other users' processes.
FAQ
How do I know what occupies a port?
With lsof -i :PORT or ss -ltnp.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course