Home > Uncategorized > Understanding the Linux File System

Understanding the Linux File System

The Linux file system is a directory tree that is consistent with each Linux distribution. This directory tree begins with the / (root) and then expands under that position like an upside down tree. Each directory under / has a specific purpose whether it is to store system files, constantly changing log files, device drivers or files created by users on the system. The file system consists of several parts. The file system is a method of consistently naming objects and organizing them in an orderly manner. This is represented by the directory tree mentioned above. The file system is an Application Programming Interface, API, a method of system calls for navigating and object manipulation. The file system also contains a method of securing files, directories and objects in the file system. This is represented by the file permissions that are so critical to a system’s operation. The final aspect of a file system is that their must be software that can connect the hardware to the file system itself so it can all function.

The Linux file system reduces everything to a simple file. 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. The advantage this provides is the ability to configure each file, device, etc. with a file editor.

Pathnames
The file system directory tree provides a unified method of moving through the file system and accessing objects. A Pathname is the list of directories from a starting point to an end point, like driving from one location to another.

In the same way the PATH in Linux will start from the /, which is the start of the file system and proceed until it gets to the goal which may be a file or folder.

Pathnames can be absolute or relative. The Path that is shown above is an absolute Path. Absolute Paths always start with a ”/”, starting at the beginning of the file system and working toward the directory or file. Relative paths never start with a “/” and are based on where the user is in the file system. When a user logs into the system they will log into their /home/username directory. When the user wants to move through the file system they can use absolute paths which use a reference from the start of the file system and then list each directory in the path of the file system. For example if the user would like to access the logs in the var directory these would be located at /var/log using an absolute pathname. If the user wanted to access a directory that was already created in their home directory called world in the games directory that could be accessed with a relative path of games/world or an absolute path of /home/username/games/world. Relative paths are interpreted in reference to the user’s current location.

Relative Path example.
cd games/world
Each section of the pathname can be no longer than 255 characters and one pathname cannot contain more than 4,095 characters. Though there are few restrictions on naming conventions for directories and files, you will find that avoiding spaces in names will be to your advantage. Use CaMeL TeXt, CapitalsInText or use u_n_d_e_rscores in your text instead of spaces.

About these ads
  1. max
    September 4, 2008 at 2:25 am

    nice article!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 57 other followers

%d bloggers like this: