50. Linux shell commands, netstat, Traceroute

Source: Internet
Author: User
Tags linux shell commands

1. netstat

1) netstat [Option]

Parameter descriptions related to routing:

①-R: lists the route tables. The function is similar to the route command;

②-N: The Host Name and service name are not used. The IP address and port number are used, just like route-n.

Parameters related to the network interface:

③-A: Lists All connection statuses, including TCP, UDP, and Unix sockets;

④-T: only lists the connections of TCP packets;

⑤-U: only lists connections of UDP packets;

⑥-L: only lists the network statuses of services monitored by listen;

7.-P: names of PID and program files;

Bytes-C: it can be set to automatically update once after several seconds, for example,-C 5 updates the network status once every five seconds;

Bytes-S displays their statistical data based on each Protocol [3]

Bytes-E: Display Ethernet statistics

2) Example

Netstat-Rn

Netstat-n

Netstat-T

2. Traceroute

Traceroute [Option] IP

1) Option

①-N: host name resolution is not required. IP addresses are used only, and the speed is faster.

②-U: UDP port 33434 is used for detection. This is the preset Detection protocol;

③-I: use ICMP for detection;

④-T: TCP is used for detection. Generally, port 80 is used for testing.

⑤-W SEC: if the recipient's host does not receive an echo within a few seconds, noPass,The default value is 5 seconds.

⑥ -P port if you do not want to use the UDP and TCP presets port number, which can be changed here port .

7.-I interfaceFor exampleThere are two PPP instances. You can use-I to choose whether ppp0 or ppp1.

Bytes-G Gateway: similar to the-I parameter, but-G is followed by the gateway IP address.

2) Example

Traceroute-nWww.baidu.com

* Indicates that the package is discarded by the router. UDP is used by default. For security reasons, some routers are discarded by default.

Traceroute-W 1-n-tWww.soso.com// Use TCP

Reference

[1] Explain the commands

Http://linux.vbird.org/linux_server/0140networkcommand.php#netstat

[2] better explanation of TCP State, such as time_wait: the socket is waiting after close to handle packets still in the network.

Http://linux.die.net/man/8/netstat

[3]Http://www.linuxso.com/command/netstat.html

[4] traceroute usage example

Http://blog.sina.com.cn/s/blog_4895289e010009bn.html

Nice to talk about the ins and outs

Http://blog.chinaunix.net/space.php? Uid = 20172731 & Do = Blog & cuid = 159630

[5] ifconfig usage

Http://www.cublog.cn/u2/78880/showart_1879201.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.