Well-Known Ports
Lesson 11 of 47 in Coddy's Networking with the Terminal course.
If a port is just a number, how does your browser know which one to use? By convention. Some numbers are agreed on by everyone:
- 22: SSH, remote shell access
- 53: DNS, the lookups from the last chapter
- 80: HTTP
- 443: HTTPS
This is why you can type an address with no port at all. http:// means port 80 unless you say otherwise, and https:// means 443. Writing http://example.com:80 is simply saying out loud what was already assumed.
They are conventions, not rules. Nothing stops a web server running on 8080, and plenty do.
There is one real restriction. Ports below 1024 normally require administrator rights to listen on, which is why development servers use numbers like 8080 or 3000: no special permission needed.
Challenge
HardThese conventions are not folklore. They are written down on the machine itself, in /etc/services.
Print the port entry for ssh and then for https, taking the second column of each line:
22/tcp
443/tcpAnchor your search with
^sosshdoes not also match names that merely contain it, and keep only the first match withhead -1.
Try it yourself
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Networking with the Terminal
Practice on your own: Terminal playground