• Contact
  • About Me
  • Privacy Policy
  • Disclaimer
DefenceDev
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
DefenceDev
No Result
View All Result
ADVERTISEMENT
Home Linux Tutorials Networking

Linux Networking: Display Open Ports and Listening Services

neo by neo
July 3, 2025
in Networking
0
Linux Networking: Display Open Ports and Listening Services

Linux Networking: Display Open Ports and Listening Services

0
SHARES
17
VIEWS
Share on FacebookShare on Twitter
ADVERTISEMENT

Linux Networking: Open Ports / Listening Services

Understanding the open ports and listening services on your Linux system is a critical part of network management and security. Open ports can reveal which applications are actively communicating or awaiting connections, but they can also expose your system to potential vulnerabilities if left unchecked.

Introduction

The netstat command is a powerful network utility available on Linux that provides a variety of network-related information. With this tool you are able to display open ports and listening services on Linux Systems. The netstat command is essential for network administrators and users who need to monitor and troubleshoot network connections.

With the right tools and commands, you can quickly identify open ports and their associated processes. Whether you’re troubleshooting network connectivity, optimizing system performance, or strengthening your security posture, this information is invaluable.

In this article, we’ll explore how to display open ports and listening services using powerful Linux commands like netstat, ss, and lsof, helping you gain better control over your system’s network

Display Active Connections

netstat
   Information from manaul for netstat: This program is mostly obsolete.  Replacement for netstat is ss.  Replacement for netstat -r is ip route.  Replacement for netstat -i is ip -s link.  Replacement for netstat -g is ip maddr.

Display Open Ports

netstat -l
Example of netstat -l on Ubuntu
Example of netstat -l on Ubuntu

This command lists all listening ports. For a detailed view, including TCP and UDP ports, use:

netstat -ltu
Example of netstat -ltu on Ubuntu
Example of netstat -ltu on Ubuntu

Viewing Listening Services

netstat -tuln
Example of netstat -tuln on Ubuntu
Example of netstat -tuln on Ubuntu

This command lists all the listening services along with their respective ports in numeric form.

Using lsof -i :PORT to Identify Which Process Is Listening on a Port

Another powerful tool for network diagnostics on Linux is the lsof command. It can be used to display which process is listening on a specific port — extremely helpful when a port is unexpectedly in use or during service troubleshooting.

The syntax is simple:

sudo lsof -i :PORT

This command will list any process that is actively using the specified port, including protocol type, process ID (PID), user, and the program name.

Why it’s useful

  • Troubleshooting “Address already in use” errors during service installation
  • Verifying whether a service is actively listening on the expected port
  • Detecting unauthorized or unknown applications using open ports

Examples

Check who is using HTTP port (80):

sudo lsof -i :80

Output:

COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
docker-pr 1651 root    7u  IPv4  25402      0t0  TCP *:http (LISTEN)
docker-pr 1671 root    7u  IPv6  25403      0t0  TCP *:http (LISTEN)

Check HTTPS port (443):

sudo lsof -i :443

Verifies if secure web services are properly listening on port 443.
Check SSH port (22):

ADVERTISEMENT
sudo lsof -i :22

Output:

ADVERTISEMENT
ADVERTISEMENT
COMMAND    PID  USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
sshd       796  root    5u  IPv4   20897      0t0  TCP *:ssh (LISTEN)
sshd       796  root    6u  IPv6   20899      0t0  TCP *:ssh (LISTEN)
sshd    682911  root    4u  IPv4 5874667      0t0  TCP 192.168.20.110:ssh->192.168.20.113:50068 (ESTABLISHED)

Used to confirm that the SSH daemon is running and accessible.

defencedev.com

About The Author

neo

See author's posts

Tags: linux
ADVERTISEMENT
Previous Post

Find the Largest Files and Folders on Linux

Next Post

Monitor Bandwidth Usage on Linux: Daily and Monthly Statistic

neo

neo

Related Posts

netstat example on Ubuntu
Networking

Linux Networking: netstat (Network Statistics) Examples on Linux

Linux Networking: route, Mastering Routing in Ubuntu
Networking

Linux Networking: route, Mastering Routing in Ubuntu

Linux Networking: ping, Troubleshooting Network Connectivity
Networking

Linux Networking: ping, Troubleshooting Network Connectivity

Linux Networking: Add Multiple Network Gateways (Redundancy) on Ubuntu with netplan
Networking

Linux Networking: Add Multiple Network Gateways (Redundancy) on Ubuntu with netplan

Linux Networking: ifconfig, Managing Network Interfaces on Ubuntu
Networking

Linux Networking: ifconfig, Managing Network Interfaces on Ubuntu

Linux Networking: Add VLAN on Ubuntu with netplan
Networking

Linux Networking: Add VLAN on Ubuntu with netplan

Next Post
Monitor Bandwidth Usage on Linux: Daily and Monthly Reports

Monitor Bandwidth Usage on Linux: Daily and Monthly Statistic

Recommended

Linux Directories: cd (Change Directory), pwd (Print Working Directory), mkdir (Make Directory)

Linux Directories: cd (Change Directory), pwd (Print Working Directory), mkdir (Make Directory)

A Fresh Look for My IT WordPress Blog

A Fresh Look for My IT WordPress Blog

FortiGate DDoS Protection: Configure DoS Policies to Secure Self-Hosted Applications

FortiGate DDoS Protection: Configure DoS Policies to Secure Self-Hosted Applications

Fortinet FortiGate Site-to-Site IPsec VPN Troubleshooting

Fortinet FortiGate Site-to-Site IPsec VPN Troubleshooting

Raspberry Pi Monitoring with Monit: Docker, Temperature, Network & More

Raspberry Pi Monitoring with Monit: Docker, Temperature & More

ADVERTISEMENT

DefenceDev Tutorials

defencedev Logo

Whether you’re just starting or looking to expand your skills, I hope you find useful information and engaging discussions here. Let me take you through my journey and the goals behind this space!

Follow Us

Recent News

FortiGate DDoS Protection: Configure DoS Policies to Secure Self-Hosted Applications

FortiGate DDoS Protection: Configure DoS Policies to Secure Self-Hosted Applications

Fortinet FortiGate Site-to-Site IPsec VPN Troubleshooting

Fortinet FortiGate Site-to-Site IPsec VPN Troubleshooting

  • Site Map
  • Privacy Policy
  • Facebook Page
  • Disclaimer
  • Contact
  • About Me

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos

© 2025 defencedev.com - All rights reserved.