File Structure in Linux

Most of the people who are new to Linux are confused about directories and File structure on Linux. When you boot any Linux distribution ‘root partition’ is mounted at /. Every files and folder are mounted under /. You don’t find any drive name like (C, D) etc in Linux(if it is not dual booted). Moreover In Linux, program are located in different directories. For examples less command is located under /usr/bin directory. Therefore the directory structure of Linux/Unix is intimidating especially for the users who have migrated from windows.

Difference between Linux and Windows File Structure

In windows almost all the program files are installed in ‘program file” by default unless user specify the specific directory. In Linux directory system are categories on the basis of structure of program. For example configuration files are in /etc, all binary files are in /bin or /usr/bin or /usr/local/bin and so on.

Windows file Structure


Linux File Structure


The basic difference is:

Linux/Unix always use forward slash to denote filesystem hierarchy whereas windows use backslash.

Understanding File system in Linux/Unix

linux file structure
Image credit:
Image source: reddit


  • Contains the executable programs that are part of the Linux operating system.
  • Many Linux commands such as cat, cp, ls, more, and tar are located in /bin.
  • Example ls, cat, cp.
  • All the devices like input devices, sound card, modems are stored.
  • It is a virtual directory that contains devices files.
  • Example : /dev/udp, /dev/urandom, /dev/sda1


  • Contains config folder of entire operating system.
  • All the global setting like ssh, telnet, and smtp/pop3 mail servers.
  • Also contains system’s password file like group lists, user skeletons, and cron jobs.
  • Example: /etc/resolv.conf, /etc/logrotate.conf


  • Default directory for users to store the personal files.
  • Example /home/saugat, /home/sachit


  • contains binary executables typtically used by system admnistrator only available to root.
  • Mostly used for system maintenance purpose
  • Commands such as mount, shutdown, umount, reside here
  • Example: /sbin/halt/ /sbin/ip6tables


  • contains shareable and read only data
  • contains binaries, libraries, documentation and source code for second level program

/usr/bin : Contains executable files for many Linux commands. It is not part of the core Linux operating system.
/usr/include : Contains header files for C and C++ programming languages
/usr/lib : Contains libraries for C and C++ programming languages.
/usr/local : Contains local files. It has a similar directories as /usr contains.
/usr/sbin : Contains administrative commands.
/usr/share : Contains files that are shared, like, default configuration files, images, documentation, etc.
/usr/src : Contains the source code for the Linux kernel.


Includes user specific files such as mail message, database of installed programs, log files etc.

/var/cache: Storage area for cached data for applications.
/var/lib: Contains information related to the current state of applications. Programs modify this when they run.
/var/lock: Contains lock files which are checked by applications so that a resource can be used by one application only.
/var/log: Contains log files for different applications.
/var/mail: Contains users emails.
/var/opt: Contains variable data for packages stored in /opt directory.
/var/run: Contains data describing the system since it was booted.
/var/spool: Contains data that is waiting for some kind of processing.
/var/tmp: Contains temporary files preserved between system reboots


  • All the temporary files are store here.
  • The files under this directory are deleted when system is rebooted.
  • For example: when new program is installed it use /tmp/ to put files during installation that won’t be needed after the program is installed.


  • Default location for mouting devices like cdrooms, floppy disk dries, USB memory sticks etc.
  • Example : /mnt/cdroom


  • contains information about system process
  • virtual file system that contains information about file system.
  • Example /proc/cpuinfo, /proc/swaps


  • share libraries are stored(perl, python, C, etc.)
  • /lib/ are also a kernel modules
  • Example:,


  • Config file for add on Application software are found here.
  • Third party application should be installed in this directory.


  • Home directory of system administrator.’root’.
  • Root user has write privilege under this directory


  • Contains everything required for boot process.
  • Stores data that is used before the kernel begins executing user-mode program.
  • Example: /boot/boot.b, /boot/chain.b, /boot/config-kernel-version

linux file structure

How to install and uninstall applications in Fedora[Terminal and Graphical]

This tutorial will show you how to install and uninstall applications in Fedora using PackageKit(Graphical) and yum(Terminal). I am using the Fedora 18. If you are the Ubuntu user, see managing software’s in Ubuntu via Terminal. If you have just switched from Windows environment to Linux, first do the installing using the Graphical interface. It’s way simple and easy. Whereas, application installing and uninstalling is much more faster via Terminal. You just have to be little bit familiar with the command language and Linux commands. Try both and implement which  one u feel comfortable and easier.

1. Graphical[PackageKit]:

There is a default software managing application in Fedora called ‘PackageKit’ which graphically assist the user on installing and uninstalling the applications. All the application available in Fedora repositories are available in PackageKit.

Installing software using PackageKit:

First of all, open “Software” programs from System Tools. Now, in the search box type the name of the application you wish to install and hit enter or click the ‘Find’ button. I am going to install nano which is a simple text editor.

installing nano in fedora

Select the software by clicking it and click Apply on the right hand bottom. After that, give the authentication by typing in your password and your software is installed.

Uninstalling software using PackageKit:

Open Add/remove program. In the search box type the name of the program that you wish to remove and click find or hit enter. If the box is ticked then the program is installed. Then click apply which will remove the software. I am going to remove the Nano which I have just installed.

uninstalling software using PackageKitNow, the nano is successfully removed.

2. Install Application using terminal Command-line[Yum]:

You need the root access while installing and uninstalling the applications. To switch to the root user for the normal user type ‘su’, hit enter and type the password. Now, you are login as a root user. Also, you can give the root permission staying in the normal user as well by typing ‘su -c’.

Installing software from terminal:

The syntax to install software is:

yum install software_name

To install the software called nano, I would type:

yum install nano

OR if you haven’t changed yourself into the root user, give root access permission as:

su -c 'yum install software_name'

To install the software called putty, I would type:

su -c 'yum install nano'install

Uninstalling software from terminal:

The syntax for uninstalling software is:

yum remove software_name

To remove the software called ‘nano’ which I have just installed I would type:

yum remove nano

OR if you haven’t changed yourself into the root user, give root access permission as:

su -c 'yum remove software_name'

To uninstall the software called putty, I would type:

su -c 'yum remove nano'


 3. Installing .rpm using PackageKit:

When you download the software for the Linux, they will let you choose your distro or the package. Fedora uses .rpm package, so while downloading software for Fedora always choose the .rpm package. I am going to install Skype in my Fedora. While I download I will see this:

skype for fedoraAs you can see, that rpm is going to be opened by PackageKit. After the download is complete, you will be notified as will ask you if you want to install or not:

installSkype notifierClick on Install and done! The Skype is installed in my system.