There are different types of ports in a system i-e Transmission Control Protocol (TCP) and User Datagram Protocol (UDP).
TCP is the most used protocol on the internet while UDP is a replacement for it if you don’t need to look for error-related issues while transmitting data.
How to Check if a Port is Open on Linux Mint 21
In Linux distributions, we have several command-line tools introduced by the Linux system to display open ports on the terminal. Some of the most used and easy utilities are listed below:
- netstat Command-line Utility
- ss Command-line Utility
- lsof Command-line Utility
- nmap Command-line Utility
1: Checking a Port using netstat Command-line Utility
The netstat is the most powerful and popular command-line tool among Linux users to monitor networks. Let’s use this command to display all open ports including TCP and UDP on terminal:
In the above command:
t: used for TCP ports
u: used for UDP ports
l: used for listening server sockets
p: used for PIDs and
n: used for not to display names
2: Checking a Port using ss Command-line Utility
The ss command-line tool is another way to find open ports in Linux systems as it provides more information about the network than netstat command tool. To display open ports with the help of this command, run in terminal:
3: Checking a Port using lsof Command-line Utility
As the name describes List Open Files (lsof) helps to display the open files in the system. We can also use this command-line tool to show open ports in the terminal, so type to get the required output:
The grep Listen command will help to display all open ports.
4: Checking a Port using nmap Command-line Utility
The nmap command-line tool is used for network auditing and exploration but is also helpful to detect open ports. It is not the built-in command in Linux distributions, so before making use of it, we need to get it on the system, type the mentioned installation command:
As it is downloaded to our Linux Mint system; now run the following command to display all TCP port connections on the terminal with the help of nmap command tool:
To display all UDP port connections on the system, type in terminal:
Conclusion
Letting know about your open port connections is necessary when you find troubleshooting and security issues in the network. Or in another case, if you want to upgrade the security level of your machine, you should know about open ports details.
This article has mentioned all the easy and possible ways to display open ports on Linux Mint 21 system. We have used the popular command-line tools for this purpose i-e, nmap command-line tool, netstat command-line tool, ss command-line tool, and lsof command-line tool.