why

In back-end development, sometimes the service cannot start properly and the port is occupied. Check the port usage.

What is the

Some Linux commands are needed.

How to do

View the processes occupying port 51805

lsof -n -P -i TCP -s TCP:LISTEN|grep 51805
# or
lsof -i:51805
Copy the code

read

Linux lsof command description

Linux netstat command description

One Linux command per day (51) : lsof command

Statistical connection number

netstat -n | awk '/^tcp/{++S[$NF]}END{for(a in S) print a,S[a]}' 
Copy the code