In Linux, how does one view the developed port ?, View development ports in linux

Source: Internet
Author: User

In Linux, how does one view the developed port ?, View development ports in linux

Introduction: on Linux servers, it is often necessary to check whether certain ports of the system are enabled normally, or to know which processes occupy specific port services. Therefore, this command is very common, this article describes common methods for these commands.

1. check whether a specific port is enabled or occupied

List all tcp connections in the listener status:

[Html] view plain copy

Netstat-lntp

Command Parsing:

-L list all listening ports

-N: the address and port number are displayed in numbers. domain name resolution is not performed to speed up information display.

-P indicates the process that occupies the port number.

-T list TCP connections

-A lists all the current connections, tcp, udp, and all the connections of all sockets under the unix protocol.

-U: List udp connections

Example of whether to use domain name resolution for-n:

From the content display in, we can see that-n can control whether it is displayed as a domain name.

Lists All tcp ports in the listener status.

[Html] view plain copy

Netstat-alt

Find the process of a specific port:

[Html] view plain copy

Netstat-phosphatase | grep 8010

View the user name or user id:

[Html] view plain copy

Netstat-altep

Lists the user IDs of tcp in the current process.

[Html] view plain copy

Netstat-altne

Here, if you use the-n and-e options together, the attribute of the User column is the User ID, not the User name. You can use the-ep option to view both the process name and user name.

-S: list the statistical network information:

-R: List route information

-I prints the network interface information, and-e works with it to output more friendly information.

Output Network Interface Information:

[Html] view plain copy

Netstat-ie

2. lsof command

Command Format: lsof-I: port_number

[Html] view plain copy

Lsof-I: 8010

3. How to find help information

In linux, a powerful command man is provided to help us find the most comprehensive introduction information.

[Html] view plain copy

Man netstat

4. Summary

Netstat is a very powerful command that provides the vast majority of required information. lsof is also a very useful tool, but in specific circumstances, lsof may not be able to find out, however, netstat can be queried.

We recommend that you use nestat to query ports first.

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.