• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Mister PKI

SSL Certificates * SSL Tools * Certificate Decoder

  • Buy SSL Certificates
  • Blog
  • OpenSSL
  • Keytool
  • SSL Tools
  • Donate

What is netstat command?

February 14, 2023 by Mister PKI Leave a Comment

This article will answer the question, what is netstat command? We will demonstrate how to list open ports, show all sockets, find processes by port and port by process, and other examples using netstat utility. The examples in this article are based on Ubuntu, but will work on Redhat as well.

Netstat is a command line utility on Linux that will print network connections and other network related information. To see the full documentation on netstat, run man netstat on the command line.

Install netstat on Ubuntu

To install netstat on Ubuntu, run the following command. The examples in this article assume you have root privileges.

apt install net-tools

If you are using a different Operating System, use the package manager for that OS.

netstat examples

netstat show all sockets

To show all sockets, including those listening and not listening, use the -a command.

netstat -a | more

netstat show process port

To show the port that a known process is running on, use the -ap options.

netstat -ap | grep <process name>

netstat find process by port

Alternatively, if you know the port but not the process, run the following command. Replace the port with the port you are searching for.

netstat -an | grep ':80'

netstat show network interfaces

To list the network interfaces on your computer.

netstat -i

netstat check open ports

To check open ports on your local computer, with netstat installed, run the following command.

netstat -tulpn | grep LISTEN

This command will also show if the socket is open over IPv6.

Here’s a breakdown of the netstat options in the command.

-t (or –tcp)Show the TCP connections
-u (or –udp)Show the UDP connections
-l (or –listening)Show only the sockets that are listening
-p (or –program)Show the process id (PID) and the name of the program that owns the socket
-n (or –numeric)Show numerical addresses and do not resolve the name

Conclusion – What is netstat command

This article has demonstrated how to use netstat to perform various functions in Linux, including checking open ports. Let us know in the comments if you would like to see more example using netstat.

If you found this article useful, please check out more of our content.

linux,  redhat

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Popular Posts

PKCS12

openssl s_client

Keytool

Keytool list

ECDSA vs RSA

OpenSSL

PKCS7

Certificate Decoder

Training Courses

Top online courses in IT & Software

Cyber Security Training

Udemy - The Complete Internet Security Privacy Course icon

Buy SSL Certificates

The SSL Store

Comodo Store

Sectigo Store

RapidSSL

Recent Posts

  • What is netstat command?
  • How to mount NFS share on Linux
  • Install PHP for Linux
  • Apereo CAS SLO
  • Azure AD Connect Synchronization

Footer

  • Twitter
  • YouTube

Pages

  • About Mister PKI
  • Blog
  • Compare and Buy Affordable PKI Certificates
  • Contact Us
  • Full Disclosure
  • Privacy Policy
  • SSL Tools – Certificate Decoder and Certificate Checker

Copyright © 2023