Textbooks and Resources
There is no required textbook for this course. However, we do highly recommend C: A Reference Manual by Harbison and Steele. I have found it to be invaluable. You can find a copy of the pdf online. You can also order it from Amazon or Barnes & Noble, if desired. Look for the most recent (fifth) edition.
When we need a more traditional C text, we refer to The C Book, second edition, by Mike Banahan, Declan Brady and Mark Doran, originally published by Addison Wesley in 1991. This book is available online here.
The UNIX operating system and the C programming language have both been around for quite some time. UNIX was originally developed in the late 1960’s in assembly language and was mostly reimplemented in the new C programming language by the early 1970’s. The first book on C, Kernighan and Ritchie’s C Programming Language, is still in print, and is owned by most UNIX geeks – not because it’s such a great reference, but, well, just because. There are a large number of number of books on UNIX and all of its variants, including Linux (see below).
UNIX systems contain lots of documentation in the form of what are called
man pages, which is short for “manual pages”. Thus, a hardcopy book on UNIX may not be necessary.
Documentation for many of the tools we will be using will either be found in
man pages or will be supplied as URL’s on this page. Of course, you’re welcome to employ your favorite search engine, but beware that there are subtle variations in UNIX tools across its many flavors and distributions. For CS50, the
man pages on Thayer servers are the definitive reference.
Here are some good links to bash scripting information.
- Short bash tutorial
- GNU bash manual
- BASH Programming - Introduction HOW-TO
- Advanced bash scripting guide
- Bash Pocket Reference: Help for Power Users and Sys Admins, 2nd Edition, by Arnold Robbins; a short and useful book twelve bucks.
- explainshell, a very cool website that lets you type a bash command and get feedback on what it’s supposed to do. (It’s drawing on the man pages.)
- ShellCheck, a bash-script syntax/style checker
Editor software is a very personal choice. I primarily use
vs code or
sublime as a text editor for longer sessions and
vi for quick fixes, while others prefer
emacs. They are all excellent tools. For quick fixes and slow ssh connections the
vi editor is a workable alternative.
- Getting started with Sublime Text and a great tutorial
- An Extremely Quick and Simple Introduction to the Vi Text Editor
- vim tutorial
- Emacs tutorial
A file with extension
.md is assumed to be a text file in ‘Markdown’ syntax, which provides very simple (and readable) markup for headings, lists, italics, bold, hyperlinks, code snippets, and embedded images. (This course website is written in Markdown and rendered with Jekyll.) Many source-code web portals (like the popular Github) allow you to browse the files in your repository - automatically rendering any that are in Markdown format, making such files much nicer to look at than plain-text files. You can edit Markdown files in any text editor, but there are some specialized editors available. Markdown is easy to learn and there are many useful resources online:
- Github’s Mastering Markdown tutorial.
- Github’s Markdown cheatsheet.
- Brett Terpstra’s Write better Markdown, which recognizes that many flavors of Markdown exist.
- Markoff, a MacOS application for previewing Markdown files.
- Macdown, a MacOS application for editing Markdown files.
Great references for the
git distributed version control system that we use
- Free “Pro Git” book by Scott Chacon, plus the website has LOTS of additional git references, including videos!
- Some tutorials: - learn version control with git - git tutorial (requires Ruby)
- A very slick (and free) GUI for
gitcalled SourceTree is very popular, as is the excellent licensed (not free) application Tower2.
- Reference for common .gitignore files
- Information and instructions about SSH vs HTTPS
Many Unix tools (such as
grep) allow you to use a regular expression to describe a pattern for text matching.
The syntax for regular expressions seems arcane, at first, but is very powerful.
We found some slides that introduce the concepts.
- valgrind: a family of tools for dynamic analysis of programs.
- quick guide to valgrind
Quick reference card for C
man gdb; quick reference card;
- GNU make is a utility for determining what needs to be done (e.g., compile, link, copy, etc.) to build a program or other target, and then issues the commands to do it.
gtk: A popular toolkit for creating graphical user interfaces. Follow the X11 instructions below to learn how to compile and use
X11 and XQuartz: to run window-based (or graphical) applications on the Thayer Unix servers, but allow them to pop open windows on your Mac, you’ll need to install XQuartz. Installation is simple; this link has instructions for installing and using XQuartz, and for compiling
Unix & Linux books / links
- A Practical Guide to Linux Commands, Editors, and Shell Programming, by Mark G. Sobell; an excellent, comprehensive, hands-on book on Linux and shell programming as well as Python, Perl, and MySQL.
- Beginning Linux Programming, 4th Edition, by Neil Matthew, Richard Stones; A really good book covering, debugging, processes, threads, and socket programming in clear and easy manner
- The Practice of Programming, by Brian W. Kernighan, Rob Pike; a great classic book on design and programming for Unix and C.
- Professional Linux Programming, by Jon Masters and Richard Blum; an oldie (2007) but a goodie.
- UNIX Network Programming, by W. Richard Stevens, 2003; Prentice-Hall.
- Linux in a Nutshell
- Linux System Programming
- Unix, Linux, and variants, free website listing common Unix commands
- Bash command line editing
- Unix for MacOS X users, a video tutorial from 2011 version of MacOS X. From Lynda.com, which is free to Dartmouth users.
- Homebrew, a tool for installing Unix tools on MacOS. Highly recommended for CS50!
- C programming tutorials – video tutorials from Lynda.com, which are free to Dartmouth users.
- 97 things every programmer should know, by Kevlin Henney. O’Reilly 2010.
- A First Book of ANSI C, Fourth Edition, by Gary J. Bronson; a very good book for learning C
- The Wikipedia entry for the C programming language
- The USENET discussion Why is C good?
- An Introduction to the C programming language, by Charles Palmer (1988). Easy read with lots of simple examples. Skip to page 20 to start, and remember some of the comments are dated (e.g., “variables in all lower case”).
- Quick reference cards for C and gdb.
Remember that we’re not suggesting you buy all (or any) of these books.