File System
The Linux Filesystem allows everything to be reduced to a simple file. This is how it works. If you have a partition which is /dev/hdb1, that drive is represented by a device node, a file. If you have a mouse, that hardware device is represented by a device node file in the /dev directory.
A Linux Standard
Linux follows a standard for files systems called the Filesystem Hierarchy Standard (FHS). This standard was developed to provide an understanding to both users and programs of the location of file and directories. This standard is maintained by Filesystem Hierarchy Standard Group which describes the structure and purpose of the Filesystem so that developers for both operating systems and applications, as well as end users, understand the required structure to enable compliance and interactivity of programs.
Two basic structures are enabled by FHS, files which are sharable vs. non-sharable and files which are static vs. variable. Sharable files are those that exist with one user but may be shared with other users or systems. For example, files within a user's home directory could be shared with any number of users on other systems. Non-sharable files are those that simply cannot be shared between users like configuration files within the /etc directory. Only an administrator should have access to system configuration files in order to keep the system running.
Static files are files that do not change, for example the binaries upon which programs are built do not change. When users login and want to use programs they depend on those programs working in the same way every time, therefore the programs cannot change. These programs are often located in the /usr directory. Variable files are files that change often. /var/log is an illustration of a constantly changing file as the system logs events those logs will change second by second.
Here is another way of looking at it:
1. Data Sharing in a networked environment
a. sharable
b. non-sharable
2. Data Modification
a. variable - changed by natural or frequent processes
An example would be /var/log/messages which is a log that is in constant change.
b. static - data that does not or should not change
An example would be binary programs. Changes may indicate intrusion.
These two structures, shareable vs. non-sharable and static vs. variable, determine the location of many of the Linux files and determine how Linux programs are structured. For example, a developer understands that when developing a program, that program should install into the /usr directory, which is sharable for all users but is also static so that the actual program does not change. At the same time that developer knows that the log files for that program should be located in the /var directory where files are constantly changing. These kind of strategies are very valuable in creating a system everyone understands as well as creating a system everyone can use.
Each Linux system has several standard directories. The topmost directory on all Linux systems is / (pronounced root). This is where it all begins. All other directories are subdirectories under /. It is a hierarchical structure. Here is a list of common directories with a brief description and how they fit with these two structures.
/ root directory - other directories become
Below are the subdirectories unless they are mounted in separate partitions
/bin basic commands (static and sharable)
/boot files and commands required for boot (static and non - sharable)
/dev device drivers (static and non - sharable)
/etc basic configuration files (static and non - sharable)
/home home directories of all users except root (variable and sharable)
/lib program libraries (static and non - sharable)
/media mount point for removable media (variable and sharable)
/mnt mount point for temporary filesystem
/opt applications like OpenOffice (static and sharable)
/proc kernel processes and resource allocations (variable and non-sharable)
/root root user directory
/sbin system administration tools
/tmp temporary storage (variable and sharable)
/usr programs and data for users (static and sharable)
/var variable data like log files, print spools (variable and sharable)
The /proc directory represents a list of the entire system kept in the memory of the computer. The /proc filesystem represents the aspects of what processes are running in the kernel.
Now view the directory system from the user login.
When the user opens the desktop and then clicks their home folder they will see something like this. The illustration is from a GNOME Desktop on Ubuntu. Notice that mikeś home directory is /home/mike which is underneath the / directory. The path to mike´s home is/home/mike. It is important to note that the /home directory may contain any number of sub-directories which may be created for users on the system or for groups like accounting.
When you take a look at the filesystem, you will see all of the system directories, including /home. In this window all directories will need to be referred to by placing a / in front of the directory since they all start at /. Visually you are able to see all of the directories listed under /, including the /home directory where user directories are located. One thing that may be strange to you coming from Windows is that all of the directories are preceded by a /.
Now at the top of the window you see the term Root Folder. This is the same as /. The / is the start of the file system and it is called root or the root directory. Do not confuse this term with the user root, these are different, notice that the superuser is a small root while the start of the filesystem is a capital Root Folder, or /. / (pronounced root) is the basis of the file system while root is the superuser. The concept of / suggests a tree structure where the foundation of all other directories are based on the / file system.
Now if a user was on a Windows system ther path would start with the C:\ which is similar to the / on a Linux system. Paths are extremely important for users to recognize and become familiar with as they are the key to locating anything on a Linux system. In the image, the left column represents thee entire filesystem directory. As you view this directory notice that directories that have sub-directories have a + in front of them. Click on the the directory opens to reveal the contents and list the sub-directories. By choosing the folder can be contracted again by choosing the minus sign.
Here is an example of the drives on the system, including a flash drive. Click on any and it opens to show you the contents.
When you divide the hard drive up into sections they are called partitions, these are physical divisions of the hard drive. These partitions may or may not represent the directory system divisions. In other words, partitions are physical divisions of the hard drive while directories are divisions of the filesystem. An administrator must have a thorough understanding of partitions and directories in order to administer the system.
< Prev | Next > |
---|