Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and use the netstat command under Linux

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to install and use the netstat command under Linux, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

The Netstat command is used to display protocol statistics and connection information about the current TCP/IP network. In many cases, we need to check whether some network ports of our computer have been opened normally or whether we have successfully established a connection with another machine, or if we want to see some connection and protocol statistics, we need to use the netstat command to check.

How to install netstat commands in Linux

The package that contains netstat is called net-tools. On modern systems, the netstat utility is pre-installed, so no installation is required.

However, on older systems, running the netstat command may encounter errors. Therefore, to install netstat on the Linux distribution, run the command.

# yum install net-tools [On CentOS/RHEL] # apt install net-tools [On Debian/Ubuntu] # zypper install net-tools [On OpenSuse] # pacman-S netstat-nat [On Arch Linux]

After the installation is complete, run the following command to check the installed version of netstat.

# netstat-v how to use the netstat command in Linux

You can call the netstat command on any Linux distribution to get different statistics on the network.

1. View the network routing table

You can use the-r flag to display the network routing table to get something similar to the following output.

# netstat-nr

List the network routing table

The-n option forces netstat to print dotted addresses instead of using symbolic network names. This option is useful to avoid looking up addresses over the network.

two。 Display advertising network interface statistics

Use the-I flag to get the output of configured network interface statistics. The-an option displays all current interfaces in the kernel.

# netstat-ai

List network interface statistics

3. Show network connections

The netstat command utility supports options for displaying active or passive sockets using the options-t,-n, and-a. These flags show RAW,UDP,TCP or UNIX connection sockets. Add the-an option, which will sow sockets to connect.

# netstat-ant

List network connections

4. Show network services

To list the services, their current status, and the corresponding ports, run the command.

# netstat-pnltu

List network services

Thank you for reading this article carefully. I hope the article "how to install and use netstat commands under Linux" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report