In linux, how does one check who occupies the port?

Source: Internet
Author: User

In linux, how does one check who occupies the port?
Use netstat to view details!> Netstat-noap | grep 80 | grep tcp Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name limit tcp 74160 138880 127.0.0.1: 6150 127.0.0.1: 6150 ESTABLISHED 3145/tnslsnr unkn-4 (52.04/0/0) tcp 0: 8009: * LISTEN 31550/java off (0.00/0/0) tcp 0: 8080:: * LISTEN 31550/java off (0.00/0/0) tcp 0: 80: * LISTEN 24675/httpd off (0.00/0/0)


Use lsof for viewing!Who is using tcp8080 port lsof-I tcp: 8080 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME -------------------------------------------------- java 31550 root slave U IPv6 78687600 TCP *: webcache (LISTEN) who is using port 22 lsof-I: 22 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME sshd 2883 root 3u IPv6 7642 TCP *: ssh (LISTEN)


Then, according to the pid
Use ps-ef | grep pid to find out where it is occupied

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.