Menu
Coddy logo textTech

Recap: Debugging

Lesson 47 of 47 in Coddy's Networking with the Terminal course.

The method, in order, and each step rules something out.

Does the name resolve? If not, nothing was ever dialled.

Is the machine there? Ping, remembering that silence proves little.

Is the port open? nc -z. Refused is fast, dropped hangs.

Does the service answer? curl, and read the exit code: 0 talked, 7 refused, 28 timed out, 35 no TLS.

What did it say? The status code: 2xx worked, 3xx go elsewhere, 4xx fix your request, 5xx theirs is broken.

And when the request itself is in question, stop guessing: put a listener in the way and read exactly what was sent.

challenge icon

Challenge

The full ladder, one last time, against a server you start.

  1. Create index.html containing served and serve it on port 9134
  2. Print name: ok if grep localhost /etc/hosts finds anything
  3. Print port: ok if nc -z finds 9134 open
  4. Print status: and the status code of a request for /index.html
  5. Print body: and the page contents

Expected output:

name: ok
port: ok
status: 200
body: served

Try it yourself

Terminal
quiz iconTest 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