Introduction to Linux netstat commands

Source: Internet
Author: User

Introduction to Linux netstat commands

Netstat is a commonly used command for Linux system management. It is called 'Switzerland *** during network-related troubleshooting ***'. I have always been familiar with several commonly used options, such as a, n, p, t, and u. However, I am familiar with the connection status information displayed by netstat, such

Most of them are not well-understood. I would like to take a closer look at man's documents.

Linux netstat command details

Use netstat to detect and monitor network connections

10 basic Netstat usage

Linux netstat command

Linux Command: service & netstat

Use the netstat command in Linux to view the network load.

Linux netstat command for LPI certification test

Netstat-Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships

SYNOPSIS (Summary)
Netstat [address_family_options (address family options)] [-- tcp |-t] [-- udp |-u] [-- raw |-w] [-- listening |-l] [-- all |-a] [-- numeric |- n] [-- numeric-hosts] [-- numeric-ports] [-- numeric-ports] [-- sym-bolic |-N] [-- extend |-e [-- extend |- e] [-- timers |-o] [-- program |-p] [-- verbose |-v] [-- continuous |-c] [delay]
Netstat {-- route |-r} [address_family_options] [-- extend |-e [-- extend |-e] [-- verbose |-v] [-- numeric |-n] [-- numeric-hosts] [-- numeric-ports] [-- numeric-ports] [-- continu-ous |-c] [delay]
Netstat {-- interfaces |-I |-I} [iface] [-- all |-a] [-- extend |-e] [-- verbose |-v] [-- program |- p] [-- numeric |-n] [-- numeric-hosts] [-- numeric-ports] [-- numeric-ports] [-- continu-ous |-c] [delay]
Netstat {-- groups |-g} [-- numeric |-n] [-- numeric-hosts] [-- numeric-ports] [-- numeric-ports] [-- continuous |-c] [delay]
Netstat {-- masquerade |-M} [-- extend |-e] [-- numeric |-n] [-- numeric-hosts] [-- numeric-ports] [-- numeric-ports] [-- continuous |-c] [delay]
Netstat {-- statistics |-s} [-- tcp |-t] [-- udp |-u] [-- raw |-w] [delay]
Netstat {-- version |-V}
Netstat {-- help |-h}
Address_family_options:
[-- Protocol = {inet, unix, ipx, ax25, netrom, ddp} [,...] [-- unix |-x] [-- inet | -- ip] [-- ax25] [-- ipx] [-- netrom] [-- ddp]
NOTE
This program is obsolete. Replacement for netstat is ss. Replacement for netstat-r is ip route. Replacement for netstat-I is ip-s link. Replacement for netstat-g
Is ip maddr.
Note: This program is already old/obsolete (but still frequently used ). The new version of the system replaces netstat with ss commands, replaces netstat-r with ip route, and replaces netstat-g with ip maddr.

DESCRIPTION)
Netstat prints information about the Linux networking subsystem. The type of information printed is controlled by the first argument, as follows:
Netstat prints information about the Linux network subsystem. The output information style is controlled by the first parameter, as shown below:
(None)
By default, netstat displays a list of open sockets. If you don't specify any address families, then the active sockets of all configured address families will be
Printed.
(No parameter) by default, netstat displays the list of all system sockets. If you do not specify any address family, the active sockets of all configured address families will be displayed.
-- Route,-r
Display the kernel routing tables.
Show kernel route table
-- Groups,-g
Display multicast group membership information for IPv4 and IPv6.
The multicast group members of IPv4 and IPv6 are displayed.
-- Interfaces = iface,-I = iface,-I
Display a table of all network interfaces, or the specified iface.
Displays the information table of all network interfaces or the specified interfaces.
-- Masquerade,-M
Display a list of masqueraded connections.
Display disguised connections
-- Statistics,-s
Display summary statistics for each protocol.
Displays the summary of each protocol according to the protocol type


OPTIONS)
-- Verbose,-v
Tell the user what is going on by being verbose. Especially print some useful information about unconfigured address families.
-- Numeric,-n Show numerical addresses instead of trying to determine symbolic host, port or user names.
-- Numeric-hosts
Shows numerical host addresses but does not affect the resolution of port or user names.
-- Numeric-ports
Shows numerical port numbers but does not affect the resolution of host or user names.
-- Numeric-users
Shows numerical user IDs but does not affect the resolution of host or port names.
-- Protocol = family,-A (protocol family type)
Specifies the address families (perhaps better described as low level protocols) for which connections are to be shown. family is a comma (',') separated list of address
Family keywords like inet, unix, ipx, ax25, netrom, and ddp. this has the same effect as using the -- inet, -- unix (-x), -- ipx, -- ax25, -- netrom, and -- ddp options.
The address family inet includes des raw, udp and tcp protocol sockets.

-C, -- continuous
This will cause netstat to print the selected information every second continuously (continuous ).
-E, -- extend
Display additional information. Use this option twice for maximum detail.
Show more information. Use-ee to display the most information.
-O, -- timers
Include information related to networking timers.
Display network timer-related information
-P, -- program
Show the PID and name of the program to which each socket belongs.
Display the PID and program name of the Connection
-L, -- listening
Show only listening sockets. (These are omitted by default .)
Only display the listening socket (port). This option is ignored by default.
-A, -- all
Show both listening and non-listening (for TCP this means established connections) sockets. With the -- interfaces option, show interfaces that are not marked
-F
Print routing information from the FIB. (This is the default .)
-C
Print routing information from the route cache.
-Z -- context
If SELinux enabled print SELinux context.
-T -- notrim
Stop trimming long addresses.
Delay
Netstat will cycle printing through statistics every delay seconds

Next, let's take a big note. We have a deep understanding of the output of netstat. Here is what actually helps us and gives us tips.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

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.