Common Linux Network commands and linux commands
1. tracepath
Tracepath traces the network path of the specified destination address and provides each hop on the path ). If your network is faulty or slow, tracepath can find out where the network is broken or slow.
Command Format:
Traceroute [-dFlnrvx] [-f <survival value>] [-g <gateway>...] [-I <Network Interface>] [-m <survival value>] [-p <communication port>] [-s <source address>] [-t <service type>] [-w <timeout seconds>] [host name or IP address] [packet size]
Command parameters:
-D uses the Socket-level troubleshooting function.
-F sets the TTL value of the first detected data packet.
-F: Do not disconnect the bits.
-G: You can set up to eight source route gateways.
-I uses the specified network interface to send data packets.
-I replace UDP data with ICMP response.
-M: sets the maximum TTL value of the packet to be detected.
-N directly uses the IP address rather than the host name.
-P: Set the communication port of UDP transmission protocol.
-R ignores common RoutingTable and directly sends data packets to the remote host.
-S sets the IP address of the data packet sent from the local host.
-T sets the TOS value of the detection data packet.
-V displays the instruction execution process in detail.
-W: set the time to wait for the return of the remote host.
-X enables or disables the packet correctness test.
Example:
2. mtr
The mtr command combines the ping command with the tracepath command. Mtr continuously sends packets and displays the time used for each hop ping.
Command Format:
Mtr [-hvrctglspni46] [-- help] [-- version] [-- report]
[-- Report-cycles = COUNT] [-- curses] [-- gtk]
[-- Raw] [-- split] [-- no-dns] [-- address interface]
[-- Psize = bytes/-s bytes]
[-- Interval = SECONDS] HOSTNAME [PACKETSIZE]
Command parameters:
-- Report tracing results are output in report mode
-- Report-cycles = COUNT indicates the number of traces. The default value is 16.
-- Raw: output the result in the original format.
-- Split lists the results of each tracing separately. Unlike -- report, the whole result is counted.
-- No-dns only displays IP addresses, but does not resolve the host name corresponding to the IP address
-- Psize = bytes/-s bytes defines the data packet size, in bytes
Result description:
Column 1: displays IP addresses and local domain names
Column 2: snt: 10 sets the number of data packets sent per second. The default value is 10, which can be specified through the-c parameter.
Column 3: displays the packet loss rate of each corresponding IP address.
Column 4: display the latest return latency
Column 5: average value. This should be the average latency of the ping packet sent.
Column 6: the best or the lowest latency
Column 7: The worst or the most frequent latency
Column 8: Standard Deviation
Example:
3. host
The host command is used for DNS query. If the command parameter is a domain name, the command outputs the associated IP address. If the command parameter is an IP address, the command outputs the associated domain name.
Command Format:
Host [-n [-a] [-c Class] [-d] [-r] [-t Type] [-v] [-w] [-z] Hostname | Address [Server]
Command parameters:
-
It is equivalent to "-v-t *"
-C Class: Specify the Class to be searched when searching for non-Internet data. Valid classes:
IN
Internet
CHAOS
Chaos
HESIOD
MIT Althena Hesiod class
ANY
Wildcard (any of the above)
*
Wildcard (any of the above)
-D open the debugging method.
-N is equivalent to publishing the/usr/bin/hostnew command. The hostnew command is version 5.2 of the host Command.
-R disables recursive processing.
-T Type specifies the record Type to be queried. Valid type:
A
Host Internet address
CNAME
Alias Name
HINFO
Host CPU and operating system type
KEY
Security Key records
MINFO
Email Address or email list information
MX
Email Exchanger
NS
Name server of the specified range
PTR
If an Internet address is queried, it is the host name. Otherwise, it is a pointer to other information.
SIG
Signature Record
SOA
Domain "Authorization start" Information
TXT
Text Information
UINFO
User Information
WKS
Well-known services supported.
-V details.
-W always waits for an answer from the DNS server.
-Z uses the new output that displays resource record information. Example:
4. whois
The whois command outputs the whois record of the specified site to view more information such as who registered and held the site.
Example:
5. dhclient
The dhclient command can release the IP address of your computer and obtain a new IP address from the DHCP server. The root permission is required. You do not need to run the command to obtain the new IP address, or specify the-r switch to release the current IP address.
6. netstat
The netstat command displays a lot of statistics about network interfaces, including opened sockets and route tables. No option to run the command to display the opened socket.
Command Format:
Netstat [-veenNcCF] []-r netstat {-V | -- version |-h | -- help}
Netstat [-vnNcaeol] [...]
Netstat {[-veenNac]-I [] | [-cnNe]-M |-s} [delay]
Command parameters:
-A (all) shows all options. LISTEN is not displayed by default.
-T (tcp) only displays tcp-related options
-U (udp) only displays udp-related options
-N: aliases are not displayed. All digits can be converted to digits.
-L only lists the service statuses that have been listened to by Listen.
-P: the program name for establishing the relevant link
-R: displays route information and route tables.
-E: Display extension information, such as uid.
-S: statistics by Protocol
-C runs the netstat command at every fixed time.
Example: