beanz Magazine

bin, boot, opt, and Linux File System Hierarchy Mysteries

Tristan Schmurr on Flickr

The Linux directory structure looks confusing compared to Windows. Here are the names and purpose of each directory.

Anyone who has used the Linux operating system has probably been stumped by the odd file folder names used by the software. It’s different from Windows where only a few folder names are mysterious. With Linux, and any Unix-based operating system, every folder name seems cryptic or abbreviated. The folder names are called the file system hierarchy.

Other file system hierarchy differences include:

  • Folders are called directories in Unix.
  • You mount devices like CD-ROMs in Unix, attach or connect them in Windows.

Here’s a table with the most common Unix directory names and their purpose:

 

Folder Name Description
/ This is the top-most level in the Linux operating system. While similar to C:\ in Windows, in Linux drives like D:\ or E:\ appear as directories under the \ directory. In Windows, D:\ and E:\ appear at the same level as the C:\ folder.
bin Critical system programs and utilities are stored in this directory. Software like a Firefox web browser are stored in the /usr/bin directory. bin is shorthand for binary or binaries.
boot This folder holds the files needed to boot (or start up) the operating system. However, the configuration files for booting up are in the /etc directory.
dev Devices such as drives are made available in this directory as files. If you wanted to partition a drive, for example, you would point the partition software to a file in this directory. /dev/null also is a device that discards all input, useful for cron and other software that generates output not needed otherwise.
etc This directory contains all the configuration files for the system. User-specific configuration files are in the /home directory for each user.
home Each user configured in Linux has a directory under the /home directory. For example, Fred Flintstone would have a directory at /home/fred to store his data and configuration-related files.
lib Essential library files for the system binaries in the /bin or /sbin directories are stored here. Individual user-related libraries for /usr/bin are in the /usr/lib directory.
lost+found Any corrupted files from system crashes are stored in this directory.
media When you attach removable media, for example, a CD-ROM or thumb drive, a directory will be created in the /media folder. You can browse the contents of these drives from the /media directory.
mnt This directory is used by system administrators to mount (connect) temporary file systems, for example, to recover files from a drive partition.
opt Proprietary software that does not use the standard Linux file system structure will create directories in the /opt folder to store its files.
proc Linux kernel and process files are stored in the /proc directory. These files include system and process information.
root This is the home directory of the root user. Instead of /home/root, the /root directory is used to store data and configuration-related files for the root user. This also is different from the / (root) directory which holds all Linux directories and files.
run This directory holds temporary application files that cannot be deleted by the Linux system. Temporary files usually are in the /tmp folder where the system can manage and delete files.
sbin Like the /bin directory, this folder contains essential binary files, in this case, binaries run by the root user for system administration tasks.
tmp Temporary files stored in this directory are deleted upon system restart or periodically by software utilities.
usr Applications and files used by individual users are stored in this directory. Binaries are stored in /usr/bin or /usr/sbin directories. Graphic files are stored in the /usr/share directory. Locally compiled applications are stored in the /usr/local directory to keep them apart from other system and user-specific applications.
var The /var directory mirrors the /usr directory. When Linux runs, the /usr directory contents are read-only. Log files and other data that needs to be written is stored in the /var directory, for example, the /var/log directory.

Learn More

The Filesystem Hierarchy Standard

http://www.pathname.com/fhs/pub/fhs-2.3.html
http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

Linux Directory Structure

http://www.howtogeek.com/117435/htg-explains-the-linux-directory-structure-explained/

Also In The December 2013 Issue

Siblings Pete and Alexa Ingram-Cauchi Talk iD Tech and Tech Summer Camps

They talk about how they started and run iDTech summer camps together and how parents can evaluate tech summer camps.

Where to Recycle Electronics

Here are a few places where you can recycle your old electronics safely.

What is a High Level Language?

What are the differences between high level languages and machine languages? And how do these differences impact coding?

An Interview with Boone Gorges

Learn how a humanities PhD became a software programmer who builds online communities for universities, as well as Lead Developer for BuddyPress and helping to create WordPress plugins like Anthologize and Participad.

How to Make (and Keep) New Years Resolutions

A few great ideas on how to make New Year's resolution you might actually keep, and have fun doing so. Whether you like structure or hate it, here are a few approaches and a number of resources to help.

News Wire Stories for December/January

Interesting stories about computer science, software programming, and technology for the month of November 2013.

No computer has ever been designed that is ever aware of what it’s doing; but most of the time, we aren’t either.

The Hungry Camel

How many measures of grain can one camel eat while delivering grain, before the camel runs out of grain to deliver? A fun math problem at least 1,000 years old.

How to Do Online Research

Online research skills are critical for software programmers. It's how you learn any language, by searching for error messages and looking up reference material.

Comments

Almost all programming languages include the ability to add comments and other notes in your code. Here's how several languages work with comments.

Take Out the Garbage

In the same way your bedroom may be impossible to enter if you let dirty clothes pile up, computers can crash and refuse to operate if their memory is stuffed with unused data.

bin, boot, opt, and Linux File System Hierarchy Mysteries

The Linux directory structure looks confusing compared to Windows. Here are the names and purpose of each directory.

What is Localhost?

Localhost is available on most computers, usually to display web pages. It's also useful to use to learn coding on your computer.

The Paywall and Adding Voices to Help Kids Code

With this issue, you will find some articles require subscription. Here's an explanation and how you can help add writers and voices to future issues of this magazine.

Learn More Links for December 2013/January 2014

Links from the bottom of all the December 2013/January 2014 articles, collected in one place for you to print, share, or bookmark.