goLinux 101 – Unix Filesystem Structure

This post is dedicated to Linux newbie’s interested in learning the Unix command line. Once you learned the basics you will be able to automate tasks by creating bash scripts. If you are not familiar with scripting or the word bash don’t be too concern. I will cover all of this in my Linux 101 series of articles.

The Linux command line is mostly used by computer administrators. If you can master these commands, there is a good chance you may have a future in the computer field. However, the first thing towards your success in learning Linux is to download a Linux distribution. Once you download it burn the ISO on to a CD or DVD disk and find a computer where you can install it on. I will take no responsibility for the loss of any data due to the installation of Linux. Please make sure you find a suitable computer to experiment with. That said there are many ways to install Linux on a PC. However, I will not cover it in this article.

I recommend installing “Ubuntu Linux” due to it’s user friendly installation wizard. You can download Ubuntu Linux here. Please note that you can install it along side Windows using the Wubi Windows Installer. If you can have a dedicated PC for Linux it will be the optimal choice for learning. As the first thing that you need to master is installing all types of Linux distributions on a PC. If you are not familiar with Linux then you might not know that there are hundreds of Linux distributions you can download from the Internet. My favorite place to find the most popular Linux distributions is Distrowatch. Download a few Linux distributions and install them, if you have a dedicated PC for this purpose. I believe the experience you will get out of it will be valuable to your overall knowledge of Linux.

I also recommend a little light reading on Linux. Here is a link to a quick history of how Linux came to be. I hope you enjoyed your light reading. You should slowly feel your administrative powers growing. At this point you are at Level 15 if you play World of Warcraft online game. Now it is time for you to be taken to the next administrative level.

Linux is a clone of Unix. Unix is heavily dependent on its filesystem.  What is a filesystem as defined by wikipedia? A file system (or filesystem) is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device(s) which contain it. In simple terms, the reason why you can create folders and files in your PC is due to the filesystem. However, Linux expands the filesystem definition in a completely different direction. Linux is heavily dependent in its filesystem to access the PC’s hardware. You can easily see the status of your memory, cpu, hard drive, etc… through the filesystem.

Let me start with the most fundamental part of the filesystem. The parent directory root (“/”) is the parent to all directories. The forward slash symbol (“/”) is called root. Please don’t mistaken it for the user account “root”. They are not related terms. Every other directory under root is called a subdirectory. The most common subdirectories that make up a Linux filesystem are /bin, /boot, /dev, /etc, /home, /lib, /lib32, /lib64, /mnt, /opt, /proc, /root, /sbin, /usr and /var. Knowing these subdirectories will allow you to understand how Linux programs and files are organised. As an Administrator you will be accessing a few of these directories on a normal basis.

Notice that when writing down the subdirectory I started with the root directory for example, /bin. This is called an absolute path. All absolute paths start with root. Let me start by explaining the /bin subdirectory.

/bin – The bin stands for binary files. In this directory you will find executable files that can be access by any user account in the system. Just because you can access these files does not mean that you can delete them or overwrite them.

/boot – The boot directory contains the Linux kernels and GRUB (GRand Unified Bootloader). This directory is used during the boot cycle and contains the Linux operating system. It also has the grub configuration files which can be used to set several boot parameters, for example, which kernel too boot from and how long to wait to boot.

/dev – The /dev directory uses entries to represent devices attached to the PC for example, CDROM, Hard Drives, USB Drives and Serial Ports.

/etc – The /etc directory is mainly used for storing text based configuration files of services like ftp, ssh, http, etc…

/home – The /home directory contains the profile of all the users in the system except Root user account.

/lib – The /lib directory contains library files used by programs in the system.

/lib32 – This is the 32bit version of /lib.

/lib64 – This is the 64bit version of /lib.

/mnt – The /mnt directory isn’t used as often anymore. This directory was used for mounting removable devices like flash drives.

/opt – The /opt directory isn’t used as often anymore. This directory was used for the installation of third party programs.

/proc – The /proc directory is a windows into the kernel’s hardware. In the proc directory you will find memory capacity, hard drives, usb devices, network cards, etc…

/root – This folder is the home folder for the user root. Root is the administrator of the system and has access permission to all files, folders and programs.

/sbin – This folder contains programs or scripts that can only be executed by the user root.

/usr – This directory contains user applications and kernel source codes. It is usually the largest directory in a Linux filesystem.

/var – This directory contains data that changes while the Linux is running.

Now you have a brief understanding of the Linux filesystem. It has been my experience that you don’t truly begin to understand it until you have installed and maintain Linux servers. So, if you are motivated to learn Linux you can start by finding a specific server you are interested in maintaining. I will post more on Linux 101 and help you find your way to the BASH command line.

See you on my next post on Basic BASH Commands 🙂

 

 

 

 

Leave a Reply

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