DEV Community

Clever Cottonmouth
Clever Cottonmouth

Posted on

To view all used ports in Linux, you can use the following command:

sudo lsof -i -P -n | grep LISTEN
This command utilizes lsof (list open files) to display information about open files and ports (-i) while filtering the output to show only listening ports using grep LISTEN. The -P flag prevents converting port numbers to port names, and -n skips DNS resolution for faster results. Running this command with sudo provides comprehensive access to the system's network-related information.

Top comments (0)