An Introduction to Files and Directories in Linux

A UNIX based system like Linux can have multiple file systems. These file systems can in turn have a number of groups, which in turn contain blocks of data and ‘inodes’. Each file system has a descriptor block, which is somewhat like the metadata attached to media files. An inode gives each file a specific identifier in the file system it is in. Each file can extend beyond just a single block of data, depending on its complexity and size.

Inodes

It is a data structure which contains data about a particular file. The ls command followed by –i will tell you about the inode of a file. The inode contains information about the location of the data blocks which contain the particular file you are interested in. It also tells you about the permissions granted to the user for a file, and its physical location.

File types

· Regular files: the kind of files that a user deals with most often. They include text files, compressed archives, config and system files, etc.

· Directories: They are files that may or may not contain files (or to be more precise, file names) themselves, along with their accompanying inodes.

· Socket links: They help to coordinate two or more separate programs together, by providing a sort of communication bridge between them.

· Symbolic links: These are files that point to other files, letting you create shortcuts and optimizing the speed of file system operations in general.

· Semaphores, FIFO buffers, etc.

File Permissions

There are three types of permissions possible for a file. They are:

· r: Read access

· w: Write access

· x: Execute access

A hyphen/dash in their places indicates negation, i.e. a ‘-‘ in place or ‘r’ indicates ‘non-readable’, and so on.

The ‘read’ and ‘write’ permissions are rather explanatory by their names alone. The ‘execute’ permission indicates that the file is an application that can be run, or ‘executed’ by the system.

The Linux hierarchy

Every directory in a Linux file system has a link to the root of the system (which is denoted simply by a /). This file system root contains directories like /boot(which contains all the basic Linux kernel files required for the file system to start, or ‘boot’ up. /lib & /bin contain the essential libraries and binaries that the Linux system needs to function./bin in particular works in both single user and multiple user environments. /sbin contains system utilities to rescue it from any particular problem./dev contains the device nodes that the Linux system and kernel frequently require. /usr contains user specific files booted up to a system, without adding any critical functionality. /etc contains files that handle the configuration of the system, making it probably the most important directory of them all! /home contains personalized user data files, which the user handles most often (common documents, media files, application shortcuts, etc.) .

If you look carefully, you will realize that Linux is just like the proprietary operating system you’ve always used and are used to. All it takes to make the transition perfect is to get an idea of how the Linux file system works, and to experiment a bit!


Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post
 |  TrackBack URI for this post


Leave a Reply