Summary of netstat command operation examples in Linux

  
                

Among the many commands in Linux, the netstat command is a console command for monitoring the TCP/IP network. It can display the status information of the routing table. It is a very useful command. This article will give a detailed introduction to the netstat command. Let's have a look at it with friends.

If your computer sometimes received data packets result in an error or malfunction, you should not be surprised, TCP /IP can allow these types of errors, and automatically retransmit packets. But if the cumulative number of error conditions is a significant percentage of the received IP datagram, or if its number is increasing rapidly, then you should use netstat to find out why this is happening.

1. Command format:

netstat [-acCeFghilMnNoprstuvVwx][-A "Network Type"][--ip]

2. Command function:

netstat is used to display statistics related to IP, TCP, UDP and ICMP protocols. It is generally used to check the network connection of each port of the machine.

3. Command parameters:

-a or –all Displays the Sockets in all connections.

-A "Network Type" or – "Network Type" Lists the relevant addresses in this network type connection.

-c or –continuous continuously lists network status.

-C or –cache Displays the cache information configured by the router.

-e or –extend Displays other relevant information about the network.

-F or –fib displays FIB.

-g or –groups Displays a list of multi-broadcast feature group members.

-h or –help online help.

-i or –interfaces displays the web interface information form.

-l or –listening Displays the Socket of the server being monitored.

-M or –masquerade shows the network connection of the disguise.

-n or –numeric directly uses an IP address instead of a domain name server.

-N or –netlink or –symbolic Displays the symbolic link name of the network hardware peripheral.

-o or –timers shows the timer.

-p or –programs Displays the program ID and program name of the socket being used.

-r or –route displays the Routing Table.

-s or –statistice Displays the network work information statistics table.

-t or –tcp Shows the connection status of the TCP transport protocol.

-u or –udp shows the connection status of the UDP transport protocol.

-v or –verbose Shows the execution of the instruction.

-V or –version displays version information.

-w or –raw shows the connection status of the RAW transport protocol.

-x or –unix The effect of this parameter is the same as the specified ”-A unix” parameter.

–ip or–inet The effect of this parameter is the same as the specified ”-A inet” parameter.

4. Example:

Instance 1: No parameters use

Command: netstat

Output:

The code is as follows:

[root@ Localhost ~]# netstat

Active Internet connections (w/o servers)

Proto Recv-Q Send-Q Local Address Foreign Address State

tcp 0 268 192.168.120.204 :ssh 10.2.0.68:62420 ESTABLISHED

udp 0 0 192.168.120.204:4371 10.58.119.119:domain ESTABLISHED

Active UNIX domain sockets (w/o servers)

Proto RefCnt Flags Type State I-Node Path

unix 2 [ ] DGRAM 1491 @/org/kernel/udev/udevd

unix 4 [ ] DGRAM 7337 /dev/log

unix 2 [ ] DGRAM 708823

unix 2 [ ] DGRAM 7539

unix 3 [ ] STREAM CONNECTED 7287

unix 3 [ ] STREAM CONNECTED 7286

[root@localhost ~]#
Previous123456Next page Total 6 pages

Copyright © Windows knowledge All Rights Reserved