r/cprogramming • • 5d ago

Starting systems programming on my Fedora with C. Where should I start?

/r/C_Programming/comments/1y1hju6/starting_systems_programming_on_my_fedora_with_c/
0 Upvotes

2 comments sorted by

2

u/Automatic-Tackle5018 5d ago

Get a copy of K&R, get a copy of either APUE, or TLPI, and start reading and coding.

1

u/Dapper-Situation-864 4d ago

Adding to the K&R + TLPI advice, here's a practical path on Fedora:

  1. Install the tools: sudo dnf install gcc gdb make man-pages strace valgrind. The man pages (section 2 for syscalls, section 3 for libc) will become your main reference.
  2. Always compile with gcc -Wall -Wextra -g -fsanitize=address,undefined while learning. It catches most memory bugs immediately.
  3. Then learn by rewriting small Unix tools, roughly in this order:

    • file I/O with open/read/write/close: write your own cat, then cp
    • directories and metadata: a simple ls using opendir/readdir/stat
    • processes: fork/exec/wait, then a tiny shell that runs commands, then add pipes and redirection
    • signals, then sockets (a small echo server/client)
  4. Run your programs under strace to see exactly which syscalls they make. It's one of the best learning tools on Linux.

Things to avoid as a beginner:

  • Writing C like C++ or Python. Get comfortable with pointers, manual memory and strings as char arrays.
  • Ignoring return values. Almost every syscall can fail; check it and use perror/errno.
  • Jumping into kernel modules or drivers too early. Get solid in userspace first.
  • Trying to read huge codebases first. Small programs you write yourself teach more at this stage.