2

I want to learn the Linux file hierarchy and how the OS works at a deeper level. Are there any ebooks or webpages to learn that?

2 Answers 2

8

The Linux file/directory hierarchy is covered by the File Hierarchy Standard or FHS.

How the OS works at a "deeper" level is a far more complicated topic. In general the surface level are the user commands ... mostly those in the /bin and /usr/bin directories which are covered in the chapter 1 section of the man pages. The next level down are the standard library functions and interfaces (on the programming side) which are covered in chapter 3 on most UNIX systems (including Linux). The system level utilities are found in /sbin and /usr/sbin and covered by man chapter 8, and configuration files are stored in /etc and covered by manual pages in chapter 5.

The next lower level of detail would be the system call interface. That's covered by man pages in section/chapter two. System calls are functions in the kernel ... and the details for exactly how to call them are mostly covered by your C programming libraries (libc --- which are provided on must Linux systems in the form of glibc --- GNU lib for C).

The kernel itself is written in C but, as you might expect if you consider the "chicken-and-egg" issue, it is not linked against libc. So the kernel provides functions that the C libraries depend on. User space programs, such as the 'ls' command, your shell, any editors, and, in fact, the compilers and linkers used to turn source code into running programs, are all linked to these C libraries. (Also it's normal for C libraries to "wrap" system calls with their own implementations which have the same names as the system calls but provide some degree of portability, possibly adding some hooks for debugging, tracing, or error handling).

The deepest levels of detail are, of course, the kernel sources themselves. These document exactly what the kernel implements. For example if you want to see precisely the list of places and filenames the kernel attempts to find and execute as the "init" process you can see it in init/main.c

I participated briefly and casually in an effort, a few years ago, to organize a series of kernel source study sessions with some guided tours and lectures and create an online study guide for understanding them. Parts of this were documented on pages at Wikiversity: Reading the Linux Kernel Sources. There are still some useful discussions for getting the curious and self-motivated reader started. (However, you still need to be able to read C source code and perhaps understand some inline assembly to really study it).

The real question is just as the announcer will usually intones at those playing the limbo ... "How can you gooooo?"

-1

Anatomy of the Linux Filesystem

3
  • downvoted because this answer is simply a link. you should elaborate.
    – strugee
    Commented Nov 5, 2013 at 3:42
  • @strugee I couldn't elaborate so did the next best thing (two years ago). Your preference would be for me to ignore the OP. I'd downvote you for that but I can't.
    – Rob
    Commented Nov 7, 2013 at 23:38
  • sorry, I didn't bother to look at the timestamp... and I didn't realize that you were just "providing a a webpage" (although it could have a little more context, e.g. how detailed it is). I'd undownvote if my vote wasn't locked.
    – strugee
    Commented Nov 8, 2013 at 5:50