How to view the developed port in Linux

Source: Internet
Author: User

How to view the developed port 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:

netstat -lntp 
Vc/examples + CjxwPiAgLXAgIM/examples + examples/bL + samples + dPQzNe909fWtcTL + examples + ICAtdSAgIMHQs/examples + examples/examples =" http://www.2cto.com/uploadfile/Collfiles/20150424/201504241007254.png "alt =" \ ">

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.

netstat -alt

Find the process of a specific port:

netstat -alp | grep 8010 

View the user name or user id:

netstat -altep

Lists the user IDs of tcp in the current process.

netstat -altne

Here, assume that you -NAnd -EThe attribute of the User column is the User ID, not the User name. Use -EpOption 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:

netstat -ie

2. lsof command

Command Format: lsof-I: port_number

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.

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.