How to check open ports in Linux using the CLI

Originally published at: https://www.cyberciti.biz/faq/how-to-check-open-ports-in-linux-using-the-cli/

I need to list all open ports in Linux cloud server. How do I check open ports in Linux using the CLI? Can you give me the command to check open ports in Linux operating system?

This command is usually the most useful (and easier for me): lsof -i -l -P
Run it as sudo to view everything running on the system

If you want to search for a particular app just pipe grep into it: lsof -i -l -P | grep chrome. It should only list network connections made by Chrome, for example.

If it’s not installed (it probably won’t be), just update and install with apt.

If you don’t want to install anything else just use netstat -tulpn which will also list opened and listening ports.