The Raspbian filesystem

Before we go any further, it is important to get a good understanding of how files and storage are organized on a Linux-based operating system such as Raspbian.

It won't take you long if you are used to using Windows to realize that all your files are organized differently. Gone are the drive letters that you used to access all the different storage attached to your computer. Linux, like its cousins Unix and Berkeley Software Distribution (BSD), from which Mac OS X is derived, organizes everything within a filesystem hierarchy.

This filesystem hierarchy starts from one place, the root directory: /. Every file and device in Linux is contained within this single hierarchy.

An example of how this works is the /media folder. By default, if you plug a USB drive into your Raspberry Pi, Raspbian will automatically create a folder inside /media. This folder will represent the contents of your USB drive. If you have more than one storage device attached, they will all appear in /media.

A simple way to think about this is described in the Linux Documentation Project (http://www.tldp.org/):

"On a UNIX system, everything is a file; if something is not a file, it is a process."

There are many different directories in a modern Linux distribution such as Raspbian that are required for it to operate. These are detailed in the following table:

Directory

Description

/

The root of the Linux filesystem.

/bin

This contains programs required to boot and use Raspbian.

/dev

All the devices attached to our Raspberry Pi are available here. The devices are represented as special files, for example sda1 and null.

/etc

This contains the configuration files for all the different software packages.

/home

Every user in the system has a folder in /home. This helps you keep each user's folders together.

/lib

Software libraries contain shared code that is shared between multiple applications. These files end in .so and are stored in this folder.

/mnt and /media

Any other filesystems that are attached to the Raspberry Pi are available inside these folders.

/opt

Software that is not installed by default with Raspbian will often be installed in this folder.

/proc

All the files inside the /proc folder are special files that allow access to various statistics and configurations in the Linux kernel.

/sbin

Any software applications that are used by system administrators to manage the system are stored inside this folder.

/tmp

Any temporary files that are used in the running of Raspbian are normally stored in /tmp. These files are normally deleted on reboot.

/usr

Any application that a normal user would install or use are installed inside this folder with their libraries and documentation.

/var

/var contains all the logs and other files that are constantly changing on your Raspberry Pi.

/root

This folder is similar to the /home, but only contains files for the root user.

/boot

This folder contains the configuration files that your Raspberry Pi uses to boot.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset