[Linux] linux Command learning-netstat, linux-netstat

Source: Internet
Author: User

[Linux] linux Command learning-netstat, linux-netstat

Many linux services are related to the network. When the service cannot be called, the startup port is occupied, or the firewall is blocked, you need to query network problems, the netstat command only uses one or two parameters.

Common options:

  • -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: the alias is denied. All digits can be converted to digits.
  • -L only lists the service statuses that have been listened to by Listen.
  • -C runs the netstat command at a fixed interval.
  • -S: displays network statistics
  • -P: it is useful to list the pid of a program.
  • -R: Display route table
  • -E: display other extended information

Use Case:

1. view all tcp ports

$ netstat -at

2. view all tcp ports on the listener

$ netstat -lt

3. Find the port of the ssh service.

$ netstat -alpt|grep ssh

4. Display nic and Nic Information

$ netstat -ie

5. View tcp connections in all route tables

# netstat -ant

6. Only view the connection and pid information of the listener (commonly used)

# Netstat-tnlp

View tcp connections once per second

# netstat -ct

8. check whether a service is running.

netstat -alpnt|grep ssh

You can also add them frequently.


This article from the "orangleliu notebook" blog, reprint please be sure to keep this source http://blog.csdn.net/orangleliu/article/details/41044879

Author: orangleliu


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.