Insight: Tutorial To Check Open Ports In Linux
In this tutorial post, we are going to show you the various way to check open ports in Linux. We will use various Linux commands to check open ports in Linux based operating system.
Tutorial To Check Open Ports In Linux
1. Using netstat command
Let’s use netstat command to check open ports in Linux based operating systems. You can use this command to check open TCP and UDP ports.
sudo netstat -pnltu
2. Using the Nmap utility
You need to install Nmap tool so that you can check open ports in Linux.
sudo apt install nmap (For Debian/ Ubuntu) sudo yum install nmap (For RedHat/ CentOS) sudo dnf install nmap (For Fedora) pacman -S nmap (ArchLinux)
Run the following command to scan for open TCP ports:
sudo nmap -sT -O localhost
For open UDP ports, run the following command:
sudo nmap -sU localhost
3. Using ss command
Run the following command to scan for open ports:
sudo ss -tl
To display both tcp and udp:
sudo ss -lntup
4. Using the lsof command
Run the following command to scan for open ports:
sudo lsof -i