• TechOps

    Need clarity?
    Chat with our experts now

    • Web Hosting SupportWeb Hosting Support
    • Helpdesk Support

      Skilled and professional 24/7 helpdesk support

    • Product Support

      Boost your product support with our expertise

    • Managed ServicesManaged Services
    • Server Management

      Don't let server issues slow you down. Let us manage them for you

    • Server Monitoring

      Safeguard your server health with our comprehensive monitoring solutions

    • Staff AugmentationStaff Augmentation
    • Hire an Admin

      Transform your business operations with our expert administrative support

    • Hire a Team

      Augment your workforce with highly skilled professional from our diverse talent pool

  • CloudOps

    Confused?
    Discuss with our sales team now.

    • Author ProfileAWS
      Well Architected Review
    • Author ProfileFinOps As a Service

      FinOps As a Service

    • Migrate

      Upgrade the journey: Migrate & Modernize seamlessly

    • Modernize

      Effortless CloudOps mastery for seamless cloud management

    • Optimize

      Efficient CloudOps: Boosting performance through optimization

    • Manage

      Simplify compliance complexities with our dedicated service

  • DevOps

    How Supportsages
    is creating an
    impact?

    View Casestudies
    • Author Profile24/7 DevOps As a Service

      Round-the-clock DevOps for uninterrupted efficiency

    • Author ProfileCI/CD Pipeline

      Automated CI/CD pipeline for seamless deployments

    • Author ProfileInfrastructure As a Code

      Crafting infrastructure with ingenious code

    • Author ProfileDevSecOps

      Integrated security in continuous DevOps practices

    • Author ProfileHire DevOps Engineers

      Level up your team with DevOps visionaries

    • Author ProfileConsulting Services

      Navigate success with expert DevOps consulting

  • SecOps

    Expert SecOps Services
    for any Scale

    • Author ProfileVAPT

      Vulnerability Assessment and Penetration Testing

    • Author ProfileSource Code Review

      Ensuring source code security and safe practices to reduce risks

    • Author ProfileSecurity Consultation

      On demand services for improving server security

    • Author ProfileSystem Hardening

      Reduced vulnerability and proactive protection

    • Author ProfileManaged SOC

      Monitors and maintains system security. Quick response on incidents

    • Author ProfileCompliance as a Service

      Regulatory compliance, reduced risk

  • Insights

    Explore our latest
    insights and resources

    Blog

    Explore our latest articles and insights

    Case Studies

    Read about our client success stories

  • Contact Us

  • About
  • Certifications
  • Life at Supportsages
  • Events
  • Contact
  • Careers
  • Blog

  • Dedicated Support Team
  • Quasi-dedicated Support Team
  • Hire a DevOps Engineer
  • Hire a Billing Support Staff
  • Per-ticket Support Plan
  • Managed Services

  • Microsoft Azure Expert
  • AWS Cloud Expert
  • Hire a developer
SS

SupportSages

Bites of wisdom @ work


Copyright © 2008 - 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy

Understanding the netstat command

Travis Ville

  • 6 min read
Understanding the netstat command

Generating audio, please wait...

Netstat is a command-line network utility useful for network troubleshooting and performance measurement. netstat (network statistics) is available in most versions of Windows, Linux, UNIX, and other operating systems. The command provides various network related information such as current TCP/IP connections, routing tables, interface statistics, etc. It is the basic tool which helps us to find the ports that are open and to find programs that are listening on ports.

The output of the netstat command is described below :

  • Proto : The protocol (tcp, udp, raw) used by the socket.

  • Recv-Q : The count of bytes not copied by the user program connected to this socket.

  • Send-Q : The count of bytes not acknowledged by the remote host.

  • Local Address : The address and port number of the local end of the socket.

  • Foreign Address : The address and port number of the remote end of the socket.

  • State : The state of the socket.

    • ESTABLISHED : The socket has an established connection.

    • SYN_SENT : The socket is actively attempting to establish a connection.

    • SYN_RECV : A connection request has been received from the network.

    • FIN_WAIT1 : The socket is closed, and the connection is shutting down.

    • FIN_WAIT2 : Connection is closed, and the socket is waiting for a shutdown from the remote end.

    • TIME_WAIT : The socket is waiting after close to handle packets still in the network.

    • CLOSE : The socket is not being used.

    • CLOSE_WAIT : The remote end has shut down, waiting for the socket to close.

    • LAST_ACK : The remote end has shut down, and the socket is closed. Waiting for acknowledgment.

    • LISTEN : The socket is listening for incoming connections.

    • CLOSING : Both sockets are shut down but we still don’t have all our data sent.

    • UNKNOWN : The state of the socket is unknown.

Netstat Command Practical Examples :

1. To list all the LISTENING Ports of TCP and UDP connections

“netstat -a” option can be used to list all TCP and UDP ports.

root@server:~# netstat -a


2. To list all the TCP Ports connections

“netstat -at” option can be used to list only TCP (Transmission Control Protocol) port connections.

root@server:~# netstat -at


3. To list all the UDP Ports connections

“netstat -au” option can be used to list only UDP (User Datagram Protocol) port connections.

root@server:~# netstat -au

4. To list all listening port connections

“netstat -l” option can be used to list all active listening ports connections.

root@server:~# netstat -l

5. To list all TCP listening Ports

“netstat -lt” option can be used to list all TCP Listening Ports connections.

root@server:~# netstat -lt

6. To list all UDP listening Ports

“netstat -lu” can be used to list all the UDP listening Ports connections.

root@server:~# netstat -lu

7. To list all UNIX Listening Ports

“netstat -lx” option can be used to list all UNIX Listening Ports connections.

root@server:~# netstat -lx

8. To list the statistics for all ports

“netstat -s” option can be used to list the statistics for all ports.

root@server:~# netstat -s

9. To list the statistics for TCP (or) UDP ports

“netstat -st” option can be used to list the statistics for TCP ports.

root@server:~# netstat -st

“netstat -su” option can be used to list the statistics for UDP ports.

root@server:~# netstat -su

10. To display service name with PID

“netstat -tp” option can be used to display the service name with their PID number.

root@server:~# netstat -tp

11. To display the kernel routing information

“netstat -r” option can be used to display the kernel routing information.

root@server:~# netstat -r

12. To find listening ports

“netstat -ap” option can be used to find the port on which a program is running.

root@server:~# netstat -ap | grep ssh

13. To list of network interfaces

“netstat -i” option can be used to list the network interfaces.

root@server:~# netstat -i

“netstat -ie” option can be used to display extended information on the interfaces.

root@server:~# netstat -ie

14. To show which process is using a particular port

netstat -anlp | grep $portnumber

An example of the same is given below.

root@server:~# netstat -anlp | grep 80

When dealing with the traffic on the server, it’s important to be informed about the inbound and outbound connections and port to which they are connected. Netstat command is well suited for this purpose. For more options and information about netstat command, you can use “man netstat” command or refer netstat manual docs.

security audit

  • Security

Continue Your Journey With…

SupportSages

SupportSages

SupportSages provides outsourced web hosting support, DevOps support and AWS. Get 24/7 expert support for seamless performance & security.

Looking for AWS Experts?

We provide top-of-the-line custom AWS setup services tailored to your needs.

6 ways how Outsourcing Server Management will improve Customer Retention

6 ways how Outsourcing Server Management will improve Customer Retention
  • Sever management
logo

Configuring Firewall with UFW

Configuring Firewall with UFW
  • Firewalls
  • Security
logo

How To Configure Django With Apache In CentOS 7

How To Configure Django With Apache In CentOS 7
  • Apache
logo
Understanding the netstat command

Posts by Travis Ville

Travis Ville