Lesson 12: Ports and connectivity — ss and curl
A service listens on a port — a numbered 'door' on the server through which you reach it: nginx on 80, SSH on 22, an app on 8080. When you try to start a service on a port that's already taken, you get 'Address already in use'. We'll meet ss, which shows which ports are listening and which process h
A port is a door number on the server. ss is checking which doors are open and who's behind each. curl is knocking on a specific door to see if anyone answers.
- port
- A numbered 'door' on the server that a service listens on. nginx on 80, SSH on 22, an app on 8080. Only one service can listen on each port.
- ss
- Shows which ports are listening and who holds each. ss -tlnp = listening TCP ports, numeric, plus the holding process.
- Address already in use
- The error you get when starting a service on a port that's already taken. You find who took it with ss, then free it (kill) or pick another port.
- curl
- Sends a request to an address and checks the response. curl localhost:8080 checks whether a local service responds on port 8080 — a quick connectivity check.