My Study Plan: Learning C with K&R and Building ls from Scratch

My Study Plan: Learning C with K&R and Building ls from Scratch

I’m combining The C Programming Language (K&R, 2nd Edition) with the excellent lsbtw project by Tony (from his YouTube video “How to Actually Learn C (2027 Edition)”).

This plan helps me learn C properly by understanding real systems programming while building a practical tool.

How I’m Using This Plan

  • Read the recommended K&R sections before watching/implementing the corresponding part of the video.
  • Type every line of code myself.
  • Use man pages heavily.
  • Compile with: gcc -Wall -Wextra -o ls ls.c
  • Break things on purpose to learn.

Phase 1: Setup & Basics

Video: 0:00 – ~6:00

  • K&R: Chapter 1 (full), 1.5–1.6, 7.1, 1.7, Chapter 2
  • Topics: main(), compiling, printf, argc/argv, default path handling
  • Exercises: Print arguments, handle missing paths, basic error messages

Milestone: Program correctly handles path or defaults to "."


Phase 2: Directory Handling

Video: ~6:00 – 13:00

  • K&R: Chapter 8.1–8.4, Chapter 5, Chapter 6.1–6.4
  • Topics: opendir, readdir, closedir, looping, hiding dotfiles, error handling
  • Exercises: List filenames only, skip . entries, handle opendir failures

Milestone: Basic ls works


Phase 3: Flags & Long Format

Video: 13:00 – End

  • K&R: Chapter 5.5, 7, Chapter 6, Chapter 8, Chapter 7.4
  • Topics: getopt, stat/lstat, permission strings, strftime, owner/group info
  • Exercises: Support -a and -l, build permission string (drwxr-xr-x), format dates, add size & link count

Milestone: ls -la works properly


Post-Project Extensions

  • Add recursive listing (-R)
  • Implement sorting
  • Add color output using ANSI codes
  • Read full Chapter 8 of K&R

Next Projects: cat, cp, or a simple shell.


Tips for Success

  • Keep the K&R book open while coding.
  • Use man 2 for system calls and man 3 for library functions.
  • Commit progress to Git regularly.
  • Don’t rush — understanding pointers and structs deeply is the real goal.

This combination is giving me a strong foundation in both C and Unix systems programming. I’ll update this post as I progress!


Study plan created with help from Grok. Video by tonybanters on YouTube. Repo: tonybanters/lsbtw

Official working draft of the C23 standard (ISO/IEC 9899:2024). Closest freely available version of the current C language specification.