- Use netstat command
The usage method is netstat -anp | grep port number. If the status is LISTEN, the port is occupied. Note that the status must be LISTEN.
- Use fuser command
The method of use is fuser -v -n tcp 8087. The appearance of content similar to the above figure indicates that the port is occupied.