The File System
Okay yesterday we learned quite a bit of theoretical stuff about the operating system, shells, and the theory behind the file system. Today we are going to start getting our hands dirty and apply some of this theory to real world commands that you can use.
Specifically, we will learn how to move around the file system, create, modify and delete files and directories and understand how permissions work.
What exactly is a file system? Well, perhaps the first question we should ask is what is a file.
By now, most of us will be familiar with the concept of files. In fact, we use them every day. We save them, delete them, copy them, move them, etc. It is almost as if files were real things on our computer.
Well in actuality a file is only an abstract concept (a data structure). It is a metaphor used to describe a theoretical grouping of dispersed bits within a computer's memory.
In actuality, files do not exist
From the perspective of the computer, there are only flittering, ethereal bits floating around in its memory. True, these bits do have references to each other, but there is no actual "file thingy" sitting in the computer somewhere.
A file is actually a pretend creature that we have imagined to help us deal with what is otherwise a very ethereal thing.
Of course, never underestimate the power of make believe. It is extremely useful to use the file metaphor because it helps people do work. The file metaphor helps us organize things and feel comfortable in the worldless world of bits and bytes.
And so another crucial task performed by the operating system is the provision of a file system to fully elaborate the file metaphor.
A file system is also an abstract data structure used to store information. However, a file system stores information about files (a metaphor to hold metaphors).
Typically, the file system uses the file cabinet metaphor to describe how files are stored within the bowels of the computer. Individual files are grouped into file folders called directories. Directories may contain files or sub-directories. Sub-directories can contain more files or more sub-directories and so on, and so on.
Like most modern operating systems, UNIX defines an inverted tree file system emanating from a single "root" directory. This is shown below
The structure of the UNIX file system however, has some general rules that you can use to navigate through it. Specifically, it defines a set of generic directories that hold a predictable set of files. Each system administrator may add to or delete from these standard directories, but it is a good bet that you will see the following hierarchy on freshly installed UNIX systems.
Lets take a look at a few of the more important ones from the perspective of a web technician.
The "bin" Directory
Since these executables are considered basic, generally, all users are granted permission to read or execute the files in "bin". We will talk more about permissions later.
The "lib" Directory
The "tmp" Directory
The "usr" Directory
For example, if you are working with an HTTPD web server, you are likely to find it in "/usr/local/etc/httpd". Similarly, most home pages will be based in the "/usr/home" directory. Finally, supporting applications such as the perl interpreter will be found in "/usr/bin".
Hold on, what does "/usr/local/etc/httpd" mean? Well, "/usr/local/etc/httpd" is called a "path" and is essentially the address of some file or directory. Let's take a closer look at paths.