A port is open. Which program is behind it?
New command
sudo ss -tlnp
-p adds the program that owns each port. It needs sudo to see programs other users run.
Usagesudo ss -tlnp
text
learner@web:~$ sudo ss -tlnp
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 511 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=84,fd=5),("nginx",pid=83,fd=5),("nginx",pid=82,fd=5))
…users:(("nginx",pid=84,fd=5),…) is the program's name and its process ID. nginx shows up more than once: its main process and its workers share the port.
Port 22 lists sshd and systemd: Ubuntu starts ssh only when someone first connects, and systemd holds the port until then.
Objectives
- Which program listens on web's port 8080?
- Which other port does nginx listen on?