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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay