Advanced Programming in the UNIX Environment, 3rd Edition

Author: W. Richard Stevens, Stephen A. Rago
All Stack Overflow 13
This Year Stack Overflow 2
This Month Stack Overflow 1

Advanced Programming in the UNIX Environment, 3rd Edition


Review Date:


by hideo   2018-11-25
Unix System Programming. A course largely based around

An interesting side-effect of this course - I got _really_ good at using a console/command prompt and handling text with vim and pipes and filters and other text manipulation. I think this has helped me me productive at my jobs way more than I thought it would :)

by sureaboutthis   2018-10-04
Advanced Programming in the Unix Environment - Stevens, Rago [0]

Unix Network Programming - Stevens [1]



by anonymous   2018-08-16
`` is ***not*** a FQDN. FQDN's end in a dot (`.`) to denote the top of the DNS tree. `` and `localhost.` are FQDN's. When the dot is present the resolver *should not* add suffixes to search paths. Whose DNS you use is a different story. Also see W. Richard Stevens' [Advanced Programming in the UNIX Environment](
by anonymous   2018-03-19

Functions like fread are intended to deal with files.

For various reasons, some of them historical, these functions are structured with the idea of a "file pointer" or FILE.

FILE contains information about which file it's presently pointing at, it's length and, critically, where in the file it's pointing. When you call fread with a particular size/nmemb (this means "number of members") combination, it will internally increment FILE without your help.

In fact, as your program shows later, the only way to access arbitrary regions of a file is to seek (fseek) to them.

Just like this function below doesn't actually use i to increment it's value, it just has information about num internal to the stack frame of main and logic internal to increment to run.

void increment(int *num) {
    *num = *num + 1;

int main() {
    int num = 0;
    for (int i = 0; i < 100; i++) {
    printf("%d\n", num); // this prints 100

This way of dealing with file input / output is part of what could be called a universal model of file I/O, which plays an absolutely critical role in the philosophy of Unix-based operating systems like Mac OSX and Linux and an even more important in some of the later attempts to refine these systems like Plan9.

If you want to be a skilled programmer, it's critical that you understand the concepts of these APIs and the reasoning behind them by cracking books like "The Linux Programming Interface", "The Art of Unix Programming", "Advanced Programming in the Unix Environment", etc.

by forkandwait   2018-03-04
I used the first edition, but I think all you need is this:

by anonymous   2018-01-07
I recommend you get a book about Unix (or rather POSIX) systems programming, and read that. It should tell you all you need to know. I haven't read the latest edition, but I heartily recommend [Advanced Programming in the UNIX environment](
by anonymous   2017-12-11
I suggest any of these 3 books (1 is enough to start with; you can get the others later): W Richard Stevens, Stephen A Rago [Advanced Programming in the Unix Environment, 3rd Edn]( — Marc J Rochkind [Advanced Unix Programming, 2nd Edn]( — Michael Kerrisk [The Linux Programming Interface: A Linux and Unix System Programming Handbook](
by techjuice   2017-08-20
If you want to become a professional and not just a dabbler I would recommend reading some of the following books I have in my bookshelf:

[0] RHCSA & RHCE Training and Exam Preparation Guide by Asghar Ghori. This book will help insure you know your stuff as your system engineer/administrator wise.

[1] A Practical Guide to Linux Commands, Editor and Shell Programming Third Edition. This book will cover the majority of what you would need and want to know when connecting to a remote linux system over ssh.

If you want to get under the hood and become an expert, the following books should help get you started:

[2] Advanced Programming in the UNIX Environment

[3] The Linux Programming Interface: A Linux and UNIX System Programming Handbook

[4] Linux Kernel Development 3rd Edition

To get a nice general overview and get up and going quickly:

[5] How Linux works: What every superuser should know

[6] The Linux Command Line

[7] Python Crash Course

[8] Automate the boring stuff with Python. This is a great book to help you think about how to automate most of the repetitive things you will end up doing on a regular basis.










by generic_user   2017-08-20
Its a bit tricky I think.

> A secure coding standard form CERT should focus entirely on describing conventions and program properties that do not already follow from the standard as a matter of correctness.

from CERT 1.7 "The wiki also contains two platform-specific annexes at the time of this writing; one annex for POSIX and one for Windows. These annexes have been omitted from this standard because they are not part of the core standard."

So while the CERT does use some examples from system interfaces its not a standard for programming the system interfaces for POSIX or Windows. It looks like there trying to limit the standard to ISO C. The examples you gave fall into the system interface category. POSIX is huge and the same for Windows, much bigger then ISO C.

I think in order to explain conventions for a system interface you really need a longer form publication like a book. So you can take 50 pages to describe an interface and how to use it and show examples etc.

The best way that I have found to figure this stuff out is the standard way. You get a copy of all the relevant standards as a foundation, ISO, POSIX, Window and stuff like CERT. Then you you get some of the system programming books (listed below). Then you find get some good reference code that show best practice. usually code from the operating system or utilities. Lastly read all the compiler docs and tool docs to set up the best code analysis framework you can.

These are a few system programming books that I use.

(best intro book) GNU/Linux Application Programming

UNIX Systems Programming

Advanced Programming in the UNIX Environment

Windows System Programming

The Linux Programming Interface

edit: I'm not sure your skill level, you may have seen all of those but I posted them regardless. There is a lot of security and convention in those books.

by AviewAnew   2017-08-20

Reference Style - All Levels



Above Intermediate

Uncategorized Additional C Programming Books