10 basic netstat usage and netstat10 usage

Source: Internet
Author: User

[Switch] 10 basic netstat usage and netstat10 usage

5. Obtain the process name, process number, and user ID.

When viewing the port and connection information, you can view the corresponding process name and process number, which is very helpful for the system administrator. For example, if you want to check whether the http service is started or whether the http service is started by Apache or nginx, you can check the process name.

Use-PView process information.

Use-POption, netstat must run under the root permission, otherwise it will not be able to get the process name running under the root permission, and many services, including http and ftp, are running under the root permission.

Compared with the process name and process number, viewing the process owner is more useful. Use-EpYou can view both the process name and user name.

The above lists the listening sockets under the TCP protocol, and displays the process information and some additional information at the same time.

The additional information includes the user name and the index node number of the process. This command is useful for network administrators.

Note:-Assume that you-NAnd-EThe attribute of the User column is the User ID, not the User name.

About Netstat

Netstat is a command line tool used to list all network socket connections on the system, including tcp, udp, and unix sockets, in addition, it can also list sockets in the listening status (that is, waiting for access requests. If you want to check whether the Web service on the system is enabled, you can check whether port 80 is enabled. The above functions make netstat an essential tool for network management and system administrators. In this tutorial, I will list several examples to show you how to use netstat to find network connection information and the port number enabled by the system.

 

1. List all connections

First, we will introduce the simplest command: to list all the current connections. Use the-a option.

The preceding command lists all connections of all sockets under tcp, udp, and unix protocols. However, this information is not detailed enough. administrators often need to check the connection status of a specific protocol or port.

 

From: http://www.binarytides.com/linux-netstat-command-examples/
Original: LCTT https://linux.cn/article-2434-1.html Translator: bazz2
Address: https://linux.cn/article-2434-1.html

Related Article

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.