Uh-oh, it looks like your Internet Explorer is out of date.

For a better shopping experience, please upgrade now.

Beginning Linux Programming, Second Edition

Beginning Linux Programming, Second Edition

5.0 1
by Neil Matthew, Richard Stones
Building on the proven success of the first edition this book continues its unique aproach to teaching UNIX programming in a simple and structured way on the Linux platform.
Through the use of detailed and realistic examples, the reader learns by doing, and in the course of a single book, is able to move from being a Linux beginner to creating custom Internet


Building on the proven success of the first edition this book continues its unique aproach to teaching UNIX programming in a simple and structured way on the Linux platform.
Through the use of detailed and realistic examples, the reader learns by doing, and in the course of a single book, is able to move from being a Linux beginner to creating custom Internet applications in Linux.

Product Details

Wiley, John & Sons, Incorporated
Publication date:
Programmer to Programmer Series
Edition description:
Product dimensions:
7.26(w) x 9.17(h) x 2.08(d)

Read an Excerpt

Chapter 1: Getting Started

In this first chapter, we'll discover what Linux is and how it relates to its inspiration, UNIX. We'll take a guided tour of the facilities provided by a UNIX development system and we shall write and run our first program. Along the way, we'll be looking at:

  • UNIX, Linux and GNU
  • Programs and programming languages for UNIX
  • Locating development resources
  • Static and shared libraries
  • The UNIX Philosophy

What is UNIX?

The UNIX operating system was originally developed at Bell Laboratories, once part of the telecommunications giant AT&T. Designed in the 1970s for Digital Equipment PDP computers, it has become a very popular multiuser, multitasking operating system for a wide variety of different hardware platforms, from PC workstations right up to multiprocessor servers and supercomputers.

Strictly, UNIX is a trademark administered by X/Open and refers to a computer operating system that conforms to the X/Open specification XPG4.2. This specification, also known as SPEC1170, defines the names of, interfaces to and behaviors of all UNIX operating system functions. The X/Open specification is largely a superset of an earlier series of specifications, the P1003, or POSIX specifications, actively being developed by the IEEE (Institute of Electrical and Electronic Engineers).

Many UNIX-like systems are available, either commercially, such as Sun's Solaris for SPARC and Intel processors, or for free, such as FreeBSD and Linux. Only a few systems currently conform to the X/Open specification, which allows them to be branded UNIX98. In the past, compatibility between different UNIX systems has been a problem, although POSIX was a great help in this respect. With the publication of the X/Open specification, there's hope that UNIX and the many other UNIX-like systems will converge.

What is Linux?

As you may already know, Linux is a freely distributed implementation of a UNIX-like kernel, the low level core of an operating system. Because Linux takes the UNIX system as its inspiration, Linux and UNIX programs are very similar. In fact, almost all programs written for UNIX can be compiled and run under Linux. Also, many commercial applications sold for commercial versions of UNIX can run unchanged in binary form on Linux systems. Linux was developed by Linus Torvalds at the University of Helsinki, with the help of UNIX programmers from across the Internet. It began as a hobby inspired by Andy Tanenbaum's Minix, a small UNIX system, but has grown to become a complete UNIX system in its own right. The Linux kernel doesn't use code from AT&T or any other proprietary source.


As we have already mentioned, Linux is actually just a kernel. You can obtain the sources for the kernel to compile and install them and then obtain and install many other freely distributed software programs to make a complete UNIX-like system. These installations are usually referred to as Linux systems, although they consist of much more than just the kernel. Most of the utilities come from the GNU project of the Free Software Foundation.

As you can probably appreciate, creating a Linux system from just source code is a major undertaking. Fortunately, many people have put together 'distributions' , usually on CD-ROM, that not only contain the kernel, but also many other programming tools and utilities. These often include an implementation of the X Window system, a graphical environment common on many UNIX systems. The distributions usually come with a setup program and additional documentation (normally all on the CD) to help you install your own Linux system. Some well known distributions are Slackware, SuSE, Debian, Red Hat and Turbo Linux, but there are many others.

The GNU Project and the Free Software Foundation

Linux owes its existence to the cooperative efforts of a large number of people. The operating system kernel itself forms only a small part of a usable development system. Commercial UNIX systems traditionally come bundled with applications programs which provide system services and tools. For Linux systems, these additional programs have been written by many different programmers and have been freely contributed.

The Linux community (together with others) supports the concept of free software, i.e. software that is free from restrictions, subject to the GNU General Public License. Although there may be a cost involved in obtaining the software, it can thereafter be used in any way desired, and is usually distributed in source form.

The Free Software Foundation was set up by Richard Stallman, the author of GNU Emacs, one of the best known editors for UNIX and other systems. Stallman is a pioneer of the free software concept and started the GNU project, an attempt to create an operating system and development environment that will be compatible with UNIX. It may turn out to be very different from UNIX at the lowest level, but will support UNIX applications. The name GNU stands for GNU's Not Unix.

The GNU Project has already provided the software community with many applications that closely mimic those found on UNIX systems. All these programs, so called GNU software, are distributed under the terms of the GNU Public License (GPL), a copy of which may be found in Appendix B. This license embodies the concept of 'copyleft' (a pun on 'copyright'). Copyleft is intended to prevent others from placing restrictions on the use of free software.

Software from the GNU Project distributed under the GPL includes:

  • GCC    A C compiler
  • G++    A C++ compiler
  • GDB    A source code level debugger
  • GNU make    A version of UNIX make
  • Bison    A parser generator compatible with UNIX yacc
  • Bash    A command shell
  • GNU Emacs    A text editor and environment

Many other packages have been developed and released using free software principles and the GNU Public License. These include graphical image manipulation tools, spreadsheets, source code control tools, compilers and interpreters, internet tools and a complete object-based environment: GNOME. We will meet GNOME again in a later chapter.

You can find out more about the free software concept at http://www.gnu.org.

Programming Linux

Many people think that programming UNIX means using C. It's true that UNIX was originally written in C and that the majority of UNIX applications are written in C, but C is not the only option available to UNIX programmers. In the course of the book, we'll introduce you to some of the alternatives which can sometimes provide a neater solution to programming problems...

Meet the Author

Richard Stones and Neil Matthew are the authors of the first edition of Beginning Linux Programming. They are both experienced software professionals with many years' experience using and programming UNIX and Linux. They are also co-authors of Instant UNIX.

Customer Reviews

Average Review:

Post to your social network


Most Helpful Customer Reviews

See all customer reviews

Beginning Linux Programming, Second Edition 5 out of 5 based on 0 ratings. 1 reviews.
Guest More than 1 year ago
I found this book one of the best books I have ever read, and this book defenetely deserves a spot on my book shelf. Please note if you are a beginner this is not the right book for you. Beginning Linux Programming assumes an intermidiate knowledge of C/C++ programming language and Linux OS. This book is perfectly organized and has everything you need from developing programs in such languages as C/C++, Perl to network programming and device drivers programming as well as Graphical User Interface (GUI) in very easy step-by-step leasons, and of course, kernel! I recommend this book to people who are ready to explorer and learn Linux, Kernel, CGI, GUI, etc...