Linux Programming Bible
Author: John Goerzen
Publisher: IDG Books Worldwide
Price: $39.99 US
Reviewer: Ben Crowder
As anyone who has spent some time with Linux knows, our favorite operating system is a programmer's heaven. With dozens of free compilers and interpreters for practically every language in existence, source code available for most programs and the programmer-oriented philosophy behind the system, Linux can easily be described as a programmer's dream come true.
Sometimes, however, because there's so much out there, it's hard to keep track of everything, especially for a newbie. That's where the Linux Programming Bible comes in. In clear, concise writing, it shows both the forest and the trees of the exciting world of Linux programming. Note in advance that only a few topics are covered in deep detail; this book is more of a reference and tutorial for beginners, not a comprehensive mammoth of a book on one particular subject.
To start off the book, Chapter 1 introduces the Linux environment and how it relates to programming, including how to find documentation. The second chapter covers basic shell programming and is enough to get you started writing simple scripts which can serve as launchpads into more advanced shell programming. The third chapter, which could very well be one of the most important in the book, describes regular expressions in a fair amount of detail. It also explains how to use them in Perl, sed, awk and C/C++. Chapter 4 introduces the program that, in a sense, started the whole Open Source movement: Emacs. Finally, to conclude Part I, the fifth chapter covers the Linux file system layout, data files (such as /etc/passwd and /etc/group) and initialization scripts.
The second part of the book is devoted to the C/C++ environment. Chapter 6 gives an aerial view of gcc, with a few close fly-bys as well; it covers the different parts of the compiler, as well as some of the more commonly used options. The seventh chapter introduces a tool that has made many projects far easier to manage: GNU Make. It explains the basics of makefiles and goes through a handful of examples, which are enough to get you started. Chapter Eight covers memory management in Linux, statically and dynamically allocated memory, as well as some fun with those beloved pointers. The ninth chapter introduces both static and dynamic libraries and tools to help you manage the latter. When the inevitable bugs pop up, Chapter 10 is there to help you squash them—it explains how to use gdb, the GNU debugger.
Part III covers the Linux model, as the author describes it. The eleventh chapter explains the UNIX philosophy of “everything is a file”, and shows how to read and write from files. Chapter 12 introduces Linux processes: the basics, how to fork, synchronization and security-related items. Chapter 13 covers signals—handlers, sending/receiving and some dangers that programmers need to be aware of. Chapter 14 introduces the Linux I/O system, describing simple stream I/O, memory-mapped I/O, and select() and poll(). Chapter 15 closes Part III with an explanation of terminals and how to make sure your program acts nicely toward telnetters as well as toward those accessing it directly.
Nice programs talk with other programs, and that's what Part IV is about. Chapter 16 goes over shared memory and semaphores; Chapter 17 explains how to use pipes and FIFOs; and Chapter 18 introduces you to TCP/IP (Internet) sockets. Sockets are covered in more detail in Chapter 19.
Part V describes one of the most popular glue languages: Perl. Chapter 20 introduces the language, explaining the data structures and basic usage. Chapter 21 covers data manipulation—reading data, parsing and processing it, storing it and spitting it back out again. Perl has, in the eyes of many, been inseparably associated with CGI, and that's what Chapter 22 is about. Finally, Chapter 23 explains how to use Perl's database interface (DBI) to access SQL databases.
While command-line interfaces are quite useful and sufficient for many tasks, there are times when a graphical interface would be better suited. The sixth part of the book contains two chapters on the basics of X Windows from a programming viewpoint, Perl's (and Python's) graphical toolkit (Tk) and basic Gnome programming.
make made our lives easy. CVS made them even easier. The first chapter of Part VII explains the basics of CVS, including setting up your own repository, checking out and committing code, and branching/merging code. Chapter 27 describes some good security practices when writing code for Linux and Chapter 28 covers optimization. At the end of the book is a nice glossary that explains some of the more common terms used in the book.
Is it worth it? Unless you're a wizened kernel hacker with six or seven years of experience under your belt, the answer is yes. The book is a good overview of many topics, covers the most important subjects and can open your eyes to new, previously unseen horizons. This is a must-have book if you're interested in Linux programming.
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...
- Vigilante Malware
- Non-Linux FOSS: Code Your Way To Victory!
- Disney's Linux Light Bulbs (Not a "Luxo Jr." Reboot)
- Vagrant Simplified
- Libreboot on an X60, Part I: the Setup
- Dealing with Boundary Issues
- System Status as SMS Text Messages
- Bluetooth Hacks
- October 2015 Issue of Linux Journal: Raspberry Pi
- New Products