Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am looking for a good ebook (or two) for learning the C programming language, specifically programming in a GNU/Linux environment. I'm not a beginner programmer, but I have almost no experience in this particular area. I need to learn both the fundamentals of C and the GNU toolchain (gcc, gdb, and make).

For the C language side, I know K&R comes highly recommended, but it doesn't seem particularly practical for me given that it won't describe modern best practices, current libraries, or any particulars about GNU/Linux programming.

Is there a book out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information on C Programming in GNU/Linux and covering the GNU toolchain? What about that book makes it special?


We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

migration rejected from stackoverflow.com Aug 5 at 21:02

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by gnat, MichaelT, GlenH7, Bart van Ingen Schenau, Ampt Aug 5 at 21:02

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, MichaelT, GlenH7, Bart van Ingen Schenau, Ampt
If this question can be reworded to fit the rules in the help center, please edit the question.

Everything needs a start. You can start from here –  Sangeeth Saravanaraj Jan 11 '12 at 19:11
I believe that your question is overly broad. But you can check this list –  bacchus Jan 11 '12 at 19:11

2 Answers 2

up vote 4 down vote accepted

Beside The K & R book (second edition) and "C: A Reference Manual (Fifth Edition)" that I use like everyone else, I would add "The Linux Programming Interface" by Michael Kerrisk (subtitled "A Linux and UNIX System Programming Handbook").
It covers most of the Linux, GNU, Posix and system V APIs in gory details, with pertinent examples and enlightning explainations. I use it all day long. It's also been an "instant classic": Published in 2011 (and thus quite up-to-date), it's got today 30 "5 stars" customer reviews on amazon.com - and not any single lower rating than 5 stars. I do not know of any other book that ever achieved that unanimous (and relevant) result.
Michael Kerrisk is the maintainer of the Linux man-pages project, and that certainly helps explaining his encyclopedic knowledge of the Linux (and Unix) APIs.

Of all the answers I've received, this one comes closest to addressing my needs. The book linked here comes with an ebook (Kindle) edition, is modern, and covers the specifics of GNU and Linux programming. Thank you for also explaining why this book is valuable. It's clearly not intended as an introduction to C programming, though, so I will have to pair this with another book. –  user648855 Jan 26 '12 at 16:36

One serious clairifcation is that The C Programming Language by Brian Kernighan (creator of AWK & Unix, K&R fame) & Dennis Ritchie (inventor of C, and Unix) the second edition (1988) is ANSI C which is different from K&R "pre-ANSI" C code, which is strongly discouraged practices these days (well since 1988 actually).

So K & R, the 2nd edition book, is strongly recommended and encouraged. The pre-ANSI standard C style is not.

Otherwise, follow the commandments (of St. H. Spencer), the C FAQ (from comp.lang.c maintained by Steve Summit) and the most commonly used and current standard C Library reference is C: A Reference Manual, 5th edition (covers C99, published in 2002) by Harbison and Steele.

Additional standards would include POSIX.1 / IEEE 1003.1 2008 and Single Unix Specification, version 4 (2008) and potentially GNU coding standards, or Linux Kernel coding style for GNU / Linux specific oriented development.

I am not aware of legitimate (licensed) ebook copies of either the C Programming Language or C: A Reference Manual being available. And I don't know of any freely available ebooks on C that I could even vaguely recommend. So visit a public library and use the typically free inter-library loan or buy your own copies, but I still strongly recommend these resources.

Thank you for at least acknowledging the crux of my question. So far you're the only one who's actually addressed everything I've asked. I appreciate the effort you've put into this response. –  user648855 Jan 12 '12 at 20:30
@mctylr -- thank you for the very-important clarification: that the second edition of K&R is the correct edition. –  Pete Wilson Jan 13 '12 at 17:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.