How to use Linux commands to check if the port is occupied

  • 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.

Guess you like

Origin blog.csdn.net/xiaoan08133192/article/details/109306297