Senior
How to view which port an application is running on under Linux?
sobes.tech AI
Answer from AI
To find out which port an application is running on in Linux, you can use several commands:
ss -tulpn— shows all listening TCP and UDP ports with processes.netstat -tulpn— similar, but may require installing the net-tools package.lsof -i -P -n | grep LISTEN— shows processes listening on ports.
For example, the command:
ss -tulpn | grep <process_name>
will help find the ports used by a specific application. If the process PID is known, you can use:
lsof -p <PID> -a -i
This will help precisely identify which ports your application is using.