Root, Boot, Etc.

New to Linux? What goes into /bin and what goes into /boot? You need to know!

Open the root directory, the “/” in your Linux box, and instead of the nice C, D, and E drives you see in Windows, you see a bewildering and perhaps intimidating list of folders like /var, /root, /boot, /src, and more. But as they say, there’s a method to every madness…

The Philosophy

The file hierarchy in Linux can be imagined as a tree, where the “/” (the slash, called the root) directory is at the base (or the root) of the tree. All other directories are inside the “/” directory. While you could do it, it’s a bad idea to create individual files inside the root. Any file you (or installed software) create should ideally go into any of the other folders, which we will talk about in a moment.

Files in Linux are arranged in specific directories depending on what they do. This makes it easy to troubleshoot and back up specific files, if only you know where to look for them. And that’s what we’re about to help you out with.

The Structure

So well, what results from the above? Something like the following: a set of directories almost common to all Linux distros, which you’d do well to familiarise yourself with.

/bin/

This directory contains binaries (executable files in Window-speak). /bin contains the shell, and some file and text utilities like ls, pwd, and cut. It is essential for the OS to boot.

/boot/

Contains configuration files for the boot loader (GRUB or LILO). This directory is critical for the system during startup. It also contains compressed kernel files.

/dev/

This one is for special files—called device files—which refer to the hardware connected to the computer, like the mouse, keyboard, hard disks, webcam, printer, and more. /dev/hda, for example, represents the first hard disk on the system.

/etc/

All global settings for the system are placed in this directory.  This is the place most frequented by system admins, as the system’s password file, group lists, and cron files (configuration files used to execute scheduled tasks) are present here. Large programs like Apache and Samba install their own subdirectories inside /etc. To modify their settings, you’ll have to navigate to /etc/samba or /etc/httpd (the latter for Apache).

/home/

The starting point of all non-root users. Each user has a separate subdirectory in the /home directory, named /home/username. Users’ personal files are stored in such subdirectories. A user can only access his own directory, while the administrator can access any directory on the system.

/lib/

Shared libraries (Perl, Python, C, and others) and files required by programs such as rm and ls are stored here. Also in /lib/ are your kernel modules, which contain mostly device drivers. Which means that if you’re feeling adventurous enough to modify the kernel, you’ll be navigating here.

/mnt/

The default location for mounting CD drives, floppy disk drives, USB sticks, and such. You can mount anything, locally or from the network.

/proc/

Contains information about your system. You can view processor statistics and specifications (RAM and CPU utilisation), PCI bus information, ISA bus information, and other hardware-related information on your system. All these files are virtual—in the sense that they do not take up space, though using the ls -l command will show them up in the directory structure.
 
/root/

This is the default home directory for the user root. It is locked to all other users and is the heart of the OS.

/sbin/

Short for system binaries, programs used by the system are installed here. The contents of this directory should be modified only by system administrators. Typical files in /sbin include system administration scripts and programs, networking utilities, and system control (startup and shutdown).

/tmp/

Used to store temporary files that won’t be needed a while later. For example, when you install a  new software, the temporary files created during installation will be stored in /tmp.

/usr/

Contains various programs, non-daemon program settings, and program resources. It is a very large directory, and contains several important subdirectories like /usr/bin, /usr/sbin, /usr/lib, /usr/include (used when code is compiled) and /usr/src (where the source code of all programs goes).

/var/

Files that periodically change their contents are in the /var directory: log files, system mail messages, lock files, spool
directories, and databases of installed programs.

This is a brief and generic description of the Linux directory structure. All distros roughly follow this scheme when arranging files, though they have their minor differences.

Bhaskar Sarma
Digit.in
Logo
Digit.in
Logo