Breaking News

A Tour of the Linux File System

0 0

The Hierarchy
One of the first things people coming from Windows notice about Linux is the wildly different way the drives, directory structure and files are ordered/displayed. Both operating systems use what is called a hierarchial directory structure. All this long term means is that files are arranged in a tree like structure. This is a simple example if the hierarchial directory structure:

ROOT (in windows this would be C:/ in linux it is just / *These are NOT alike.)
|
|-Directory 
|		|
|		|-file
|		|-file
|
|-Directory 2
		|
		|-file
		|-file
		|-Subdirectory
				|
				|-file

The Root
The root of Linux is simply “/”. Every directory, file and device stems from this. Some say that this similar to the C: drive in Windows but that is not true. In Windows, C: is a drive. In Linux / is the beginning point for the entire file system. Everything in Linux starts at / and everything can be followed back to it. The “/” contains all of the major durectories and it is generally a bad idea to store files in the “/” directory. Even though “/” is referred to as the root it should not be confused with the root user. Some people will refer to the root directory when they are actually referring to the root home folder which is /root and will be described later. root user.

Boot
The /boot directory is one of the main subdirectories under / and it contains the files that Linux needs to boot. The Linux kernel (the core of the Linux operating system) is kept in the /boot directory.

Devices Galore
The /dev directory is where all of the hardware (and sometimes software) devices are stored. In Linux everything (including devices) are treated like files. Devices are read from and written to just like any other file. This should not be done by regular users as they are in a raw state. The average user will not have permission to do anything to any files in the /dev directory. Take your hard drives for example. Most computers have two IDE channels and each channel can have two drives on it. Each channel has a master drive and a slave drive. The master drive on channel one would be /dev/hda, slave on channel one would be /dev/hdb, master drive on the second channel is /dev/hdc and the slave drive on the second channel is /dev/hdd. There is a file in /dev that corresponds with every piece of hardware on your computer.

Etc., etc.
The /etc directory is where many of the main configuration files are stored. With the proper permissions most of these files can be edited by hand using your favorite text editor. One example of an /etc configuration file is /etc/fstab. This file is where “mount points” are defined. Mount points are where an “in between” sort of directory is created and used to access some of the drives from the /dev directory. Most mount points are in …

Mount That Drive
… the /mnt directory. Physical storage devices must be mounted to a directory before they can be accessed since the /dev/devices are in a raw state. Drive mounted to a directory in the /mnt directory are defined in the /etc/fstab file described above. Their filesystem is defined as well as which groups have permission to access them. Once the drive is mounted and these things are defined, it will appear in this directory.

Programs
One of the major things that people must get used to when switching to Linux is where it stores programs. Windows tends to store most programs in C:/Program Files and people have a hard time finding their installed programs in linux because it stores them in many places. These can be grouped into two main groups:
1. The first group is the system and normal user binary folders. Most applications store their executable binary (similar to an exe) in one of these folders. They are /bin , /usr/bin and /usr/local/bin.
2. The second group is where the “administration” applications are stored. You typically need super user (root) permissions to execute one of these executables. These directories are /sbin and /usr/sbin.

USR?
The /usr directory contains many things for user applications. Among these things are documentation (/usr/docs), configuration files, graphics and icons (/usr/share), source code (/usr/source) and header files which are needed for compiling some programs (/usr/include). Some applications will install into /usr/local and this directory has a similar structure to /usr.

Library!?!
The /lib directory is where Linux stored its equivalent to .dll files. These are referred to as “shared libraries”.

Variables!
The /var directory contains files that are constantly changing while Linux is running. Logs (/var/log), system mail (/var/mail) and queued processes (/var/spool) are stored in this directory.

Processes
The /proc directory can be considered a figment of your imagination. It is a virtual directory. This directory contains numbered entries that match all of the running processes on the system. Some of these entries can be viewed and some cannot.

Temporary Insanity The /tmp directory is an easy one. This is where programs can create files to be used while they are running. Temporary!

Lost and Found
The /lost+found directory is where Linux keeps files that have been found after a system crash or files from a partition that wasn’t unmounted before the system shut down. They are located here so that you can try to restore something that may otherwise be lost.

Home Sweet Home
The /home directory is where the user’s personal directories reside. Each user will have their own home directory under the /home directory. If your username was nugod (like mine) then your home directory would be /home/nugod. One user cannot read another users home directory. The only user who can is the root user. As described waaay back in the beginning of this article, the root user has their very own home directory. It is /root. Only root can access /root but root can access /home/nugod. It is the way of things. Root is the super user… similar to the Administrator in Windows but more powerful.

Conclusion
This concludes our little trip through the Linux filesystem. It is a lot to take in but over time it will get easier. Once you know where to look for things in Linux you can always find them.

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published. Required fields are marked *