Linux Directory Structure:

 

1-“/” (The root directory):
The starting point of your directory structure, this is where the Linux system begins. Every other file and directory on your system is under the root directory. Usually the root directory contains only subdirectories, so it’s a bad idea to store single files directly under root.
Don’t confuse the root directory with the root user account, root password (which obviously is the root user’s password) or root user’s home directory.
2- “/bin”or “/usr/bin”: (binaries programs)
These two directories contain a lot of programs (binaries, hence the directory’s name) for the system. The /bin directory contains the most important programs that the system needs to operate, such as the shells, ls, grep, and other essential things. /usr/bin in turn contains applications for the system’s users. However, in some cases it really doesn’t make much difference if you put the program in /bin or /usr/bin.
3- “/boot”:
As the name suggests, this is the place where Linux keeps information that it needs when booting up. For example, this is where the Linux kernel is kept. If you list the contents of /boot, you’ll see a file called vmlinuz – that’s the kernel.
4- “dev”:
The devices that is available to a Linux system. Remember that in Linux, devices are treated like files and you can read and write devices like they were files. For example, /dev/fd0 is your first floppy drive, /dev/cdrom is your CD drive, /dev/hda is the first IDE hard drive, and so on. All the devices that a Linux kernel can understand are located under /dev, and that’s why it contains hundreds of entries.
5- “/etc”:
The configuration files for the Linux system. Most of these files are text files and can be edited by hand. Some interesting stuff in this directory:
/etc/inittab:A text file that describes what processes are started at system bootup and during normal operation. For example, here you can determine if you want the X Window System to start automatically at bootup, and configure what happens when a user presses Ctrl+Alt+Del.
/etc/fstab:this file contains descriptive information about the various file systems and their mount points, like floppies, cdroms, and so on.
/etc/passwd:A file that contains various pieces of information for each user account. This is where the users are defined.
6-“/home”:
This is where users keep their personal files. Every user has their own directory under /home, and usually it’s the only place where normal users are allowed to write files. You can configure a Linux system so that normal users can’t even list the contents of other users’ home directories.
7-“/lib”:
The shared libraries for programs that are dynamically linked. The shared libraries are similar to DLL’s on Windows.
8-“/lost+found”:
Here Linux keeps the files that it restores after a system crash or when a partition hasn’t been unmounted before a system shutdown. This way you can recover files that would otherwise have been lost.
9-“mnt”:
This directory is used for mount points. The different physical storage devices (like the hard disk drives, floppies, CD-ROM’s) must be attached to some directory in the file system tree before they can be accessed. This attaching is called mounting, and the directory where the device is attached is called the mount point.
10-“proc”:
This is a special directory. Well, actually /proc is just a virtual directory, because it doesn’t exist at all! It contains some info about the kernel itself. There’s a bunch of numbered entries that correspond to all processes running on the system, and there are also named entries that permit access to the current configuration of the system. Many of these entries can be viewed.
11-“/media”:
Directory for mounting files systems on removable media like CD-ROM drives, floppy disks, and Zip drives.
12-“/root”:
The super user’s (root’s) home directory, don’t confuse this with the root directory (/) of a Linux system.
13-“/sbin”or “/usr/sbin”:
Most system administration programs are stored in these directories. In many cases you must run these programs as the root user.
14-“/tmp”:
Programs can write their temporary files here
15-“usr”:
This directory contains user applications and a variety of other things for them, like their source codes, and pictures, docs, or config files they use. /usr is the largest directory on a Linux system, and some people like to have it on a separate partition. Some interesting stuff in /usr:
/usr/docDocumentation for the user apps, in many file formats.
/usr/shareConfig files and graphics for many user apps.
/usr/srcSource code files for the system’s software, including the Linux kernel.
/usr/includeHeader files for the C compiler. The header files define structures and constants that are needed for building most standard programs. A subdirectory under /usr/include contains headers for the C++ compiler.
/usr/X11R6The X Window System and things for it. The subdirectories under /usr/X11R6 may contain some X binaries themselves, as well as documentation, header files, config files, icons, sounds, and other things related to the graphical programs.
/usr/local
This is where you install apps and other files for use on the local machine. If your machine is a part of a network, the /usr directory may physically be on another machine and can be shared by many networked Linux workstations. On this kind of a network, the /usr/local directory contains only stuff that is not supposed to be used on many machines and is intended for use at the local machine only.
Most likely your machine isn’t a part of a network like this, but it doesn’t mean that /usr/local is useless. If you find interesting apps that aren’t officially a part of your distro, you should install them in /usr/local. For example, if the app would normally go to /usr/bin but it isn’t a part of your distro, you should install it in /usr/local/bin instead. When you keep your own programs away from the programs that are included in your distro, you’ll avoid confusion and keep things nice and clean.
16- “/var”:
This directory contains variable data that changes constantly when the system is running. Some interesting subdirectories:
/var/logA directory that contains system log files. They’re updated when the system runs, and checking them out can give you valuable info about the health of your system. If something in your system suddenly goes wrong, the log files may contain some info about the situation.
/var/mailIncoming and outgoing mail is stored in this directory.
/var/spoolthis directory holds files that are queued for some process, like printing.
17-“srv”:
Contains data for services (HTTP, FTP, etc.) offered by the system.
18-“opt”:
Optional software packages copy/install files here.
19- “sys”:
A special directory that contains information about the devices as seen by the Linux kernel.

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s