Using netstat and lsof command to show which process using a Port on Mac/Linux
netstat
Command netstat
will show the most useful statistic data of networking.
|
The above command will display the information related to the networking port of 8080.
These are the detailed meaning of options:
|
Note: On MacOs, we’re stuck with the BSD netstat which will not show you the process ID that is attached to a given port.
So, lsof
will be a choice for Mac.
lsof
Command lsof
will display all opened files of a process. We could also use it to find which process used a networking port, since TCP/IP sockets use file descriptors.
lsof -i
will show which process communicating over the internet.
|
Join my Email List for more insights, It's Free!😋