Get to Know Linux: File System Hierarchy - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Linux and Open Source > Linux Tips and Tricks
Click Here to Login
Reply
 
Thread Tools Display Modes
 
Old 12-11-2008, 06:12 PM   #1 (permalink)
Techie Beyond Description
 
Osiris's Avatar
 
Join Date: Jan 2005
Location: Kentucky
Posts: 36,817
Send a message via ICQ to Osiris Send a message via AIM to Osiris Send a message via MSN to Osiris Send a message via Yahoo to Osiris
Default Get to Know Linux: File System Hierarchy

Get to Know Linux: File System Hierarchy

The Linux file system hierarchy is much different than that of Windows. So much so that it becomes a show stopper for many new users. I hope to clear up a lot of the confusion here and now at gHacks. So, without further adieu, I give you the Linux file system hierarchy.
/ - This is the base, or root, of the file system. Everything in the Linux system is housed in this directory.
/bin - This directory contains a number of essential commands that are available to unprivileged users (such as cat, chmod, chown, etc). The /bin directory also houses the shells (such as bash).

/boot - This directory contains everything necessary for the boot process. Without the /boot directory, your machine would not be able to boot up.
/dev - This directory contains all of the special and device files. With Linux all devices and drives have a name. Hard drives tend be labeled as hda, hdb, hdc. Special devices such as external usb devices can be labeled as sda, sdb, sdc. If you look in the /dev directory you will see quite a few files that can be associated with devices. Most of the devices found here are either block or character devices. Block devices hold data (such as a hard drive) and character devices transmit data (such as a mouse).
/etc - This is a very special directory that contains numerous configuration files and directories. This directory will contain the X configurations, Apache, Samba, the init system, etc. The /etc directory also houses the sources for package management systems like apt and yum. One of the most important subdirectoris in /etc is the /etc/init.d (or in Red Hat based systems, /etc/rc.d/init.d). This subdirectory contains all of the initialization scripts for services such as networking, samba, apache, cron, hal, etc.
/home - This is where all user data is housed. Each user on the system will have their own subdirectory within /home. All user data and user-specific configuration files are saved here.
/lib - This is where all kernel modules needed for system boot libraries that are required by root system commands (commands found in /bin and /sbin.)
/lost+found - If your system crashes or is shut down improperly any lost data will be stored here. During a recovery boot the fsck application will attempt to recover corrupt files found here.
/media - This is where all external media (or extra internal drives) is mounted. If you make or edit entries in the /etc/fstab file you will point devices (such as /dev/sda to directories withing /media.)
/mnt - This is another directory where external (and internal) drives and devices are mounted. This is a holdover to older school thought. Most modern distributions are moving to the /media directory.
/opt - This is a directory that can be used for installing applications that are outside of the default installation. When you install applications here they can be used system wide by all users. Only the root user can install applications here.
/proc - This is a special directory that is actually a virtual filesystem. The /proc directory acts as a process information center for the kernel.
/root - This is the root users home directory.
/sbin - This is where all system maintenance/administration executable files are stored. These commands differ from those in /usr/sbin in that they are system commands used for critical system administration and maintenance whereas /usr/sbin are non-critical tasks such as user administration, network administration, etc.
/usr - This is one of the largest directories on your system as it contains all user-executable binaries as well as the libraries, documentation, and header files for these executables. One of the most important subdirectories is /usr/bin where all user application executables are stored.
/var - This directory contains all variable data such as log files. On a server environment the document root directory of most servers will be found here (/var/www and /var/ftp are examples.)
/srv - This directory can contain the services (such as www) directory in some distributions.
/tmp - This directory, as you would expect, contains temporary files that are stored as needed. Many files you will find here are lock files created by applications. Do not remove anything from this directory as the cron system has a job specifically created for the removal of these files.
And there you have it. A description of each directory in the Linux file system hierarchy.
__________________

__________________
Osiris is offline   Reply With Quote
Old 12-13-2008, 07:46 AM   #2 (permalink)
Oldie but a goodie
 
oldskool's Avatar
 
Join Date: Jun 2008
Location: Maine, USA
Posts: 1,762
Default Re: Get to Know Linux: File System Hierarchy

Nice post Osiris ! Thanks, very convenient.
__________________

oldskool is offline   Reply With Quote
Old 12-13-2008, 10:22 PM   #3 (permalink)
Lord Techie
 
Kharn's Avatar
 
Join Date: Feb 2007
Posts: 7,638
Default Re: Get to Know Linux: File System Hierarchy

This is getting stickied.
__________________
Visit this and do something for the world!
www.hackersforcharity.org

Want to do even more? Take a look here and join the fight on human trafficking.

Hear and you forget, see and you remember, do and you understand.

Kharn is offline   Reply With Quote
Old 12-14-2008, 12:38 AM   #4 (permalink)
Oldie but a goodie
 
oldskool's Avatar
 
Join Date: Jun 2008
Location: Maine, USA
Posts: 1,762
Default Re: Get to Know Linux: File System Hierarchy

I just printed it and it is now stickied with tape next to my monitor.
oldskool is offline   Reply With Quote
Old 12-14-2008, 03:41 PM   #5 (permalink)
 
Join Date: Nov 2006
Location: Illinois, USA
Posts: 2,363
Default Re: Get to Know Linux: File System Hierarchy

Already knew a lot of these, but interesting post nonetheless.
__________________

CalcProgrammer1 is offline   Reply With Quote
Old 12-14-2008, 08:04 PM   #6 (permalink)
Private Joker
 
carnageX's Avatar
 
Join Date: Feb 2007
Location: South Dakota
Posts: 24,528
Default Re: Get to Know Linux: File System Hierarchy

Quote:
Originally Posted by CalcProgrammer1 View Post
Already knew a lot of these, but interesting post nonetheless.
Not everybody is a *nix expert like you and Saxon .
__________________
Laptop: MSI GT70 2OC-059us | i7-4700MQ | 16GB | GTX 770m | 500GB SSD / 750GB HDD | 17.3" | Win10 Pro
Desktop: 4690k | 12GB g.Skill RipJaws | GTX 970 | 520hx | Z87X-UD4H | Corsair Vengeance C70 | Corsair H110 | Acer 25" | Acer 22" | Win10
Mobile: Samsung Galaxy Note 5


If I help you, or you just like what I said, rep me by clicking the under my post
carnageX is offline   Reply With Quote
Old 12-14-2008, 11:29 PM   #7 (permalink)
Lord Techie
 
Kharn's Avatar
 
Join Date: Feb 2007
Posts: 7,638
Default Re: Get to Know Linux: File System Hierarchy

It's a handy reference for the *nix noob's an it gives a much better / easier to read explanation of the file system hierarchy than I can.
__________________
Visit this and do something for the world!
www.hackersforcharity.org

Want to do even more? Take a look here and join the fight on human trafficking.

Hear and you forget, see and you remember, do and you understand.

Kharn is offline   Reply With Quote
Old 12-15-2008, 05:26 PM   #8 (permalink)
Everything to Nothing
 
Nick's Avatar
 
Join Date: Feb 2007
Location: Wales
Posts: 4,053
Send a message via MSN to Nick
Default Re: Get to Know Linux: File System Hierarchy

I knew most of them from fiddling with my iPod, helpful non the less.
__________________

Nick is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Computer Still acting screwy Shana2415 Viruses, Spyware and Malware 10 09-03-2008 11:36 AM
My Hijackthis log file, please help! soarwitheagles HijackThis Logs (finished) 1 08-31-2008 01:11 PM
Linux Software: Backup Solutions Osiris Linux Tips and Tricks 3 07-25-2008 01:04 AM
WTF is a Bad Block? MikesCreation Hardware Repairs and Troubleshooting 18 02-24-2008 09:31 PM
Hard Drive Errors!!! Bad or Faulty HDD? mike4realz Hardware Repairs and Troubleshooting 3 09-19-2007 01:56 AM



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 06:41 PM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.