Professional Documents
Culture Documents
21/8/2016
When I was rst coming from Windows and exploring Linux, I found the Linux lesystem structure to be a bit
confusing, simply because I didnt know anything other than the Windows le system for my entire life. But after
persisting through the learning curve, the mystery was unraveled and I can now comfortably switch between Linux
and Windows whenever needed, and I actually feel like I understand the Windows le system better now after
learning the Linux le system.
For me, the biggest difference between the two le systems is tounderstand where the root of the le system
begins. In Windows, the root begins at the drive letter, usually C:\, which basically means it begins at the hard drive.
In Linux however, the root of the lesystem doesnt correspond with a physical device or location, its a logical
location of simply /. See the graphics below for a visual representation.
Linux File System Structure Tree
For example, inWindowsthe hard drive is typically represented as C:\ in the le explorer, and it will even display a
little icon of the hard drive and display how much space is being used. In Linux, on the other hand, the hard drive as
represented merely as /dev/sda, which is really just a folder/directory, which in Linux is really just a le that points to
other les.
So lets take some other more practical examples. The Linux equivalent of your Documents folder in Windows would
be /home/username/Documents, whereas in Windows its typically C:\Users\UserName\Documents. These are
actually pretty similar, but you can see where the differences lie.
So using the above Linux le system chart, we need to explore what each folder in the Linux le system is for, which
will help us to better understand how Linux works in general. Note that not every folder listed here or pictured
above necessarily appears in every Linux distro, but most of them do.
/- this is known as root, the logical beginning of the Linux le system structure. Every single le path in
Linux begins fromrootin one way or another./contains the entirety of your operating system.
/bin- Pronounced bin (as opposed to bine), this is where most of your binary les are stored, typically for
the Linux terminal commands and core utilities, such as cd (change directory),pwd(print working directory),
mv (move), and so on.
/boot- This is where all the needed les for Linux to boot are kept. Many people, including myself, like to keep
this folder initsown separate partition on the hard drive, especially when dual-booting is involved. A key
thing to note is that even when/bootis stored ondifferentpartition, it is stilllogicallylocated at /boot as far
as Linux is concerned.
/dev- This is where your physical devices are mounted, such as your hard drives, USB drives, optical drives,
and so on. Weve already explored that typically, your system hard drive is mounted under /dev/sda, whereas
your USB thumb drive might be mounted under /dev/sde. You may also have different partitions on your disk,
so youll see /dev/sda1, /dev/sda2, and so on. In Windows, when you go to My Computer or Computer and
you can see all of the physical devices and drives connected to your computer, this is the equivalent of /dev
inLinux le structure.
/etc- Pronounced et-see, although some also prefer to spell it out, is where conguration les are stored.
Congurations stored in /etc will typically affect all users on the system; whereas users can also store
conguration les under their own /home folders, which will only affect that particular user.
/home- This is where youll spend the overwhelming majority of your time, as this is where all of your
personal les are kept. The Desktop, Documents, Downloads, Photos, and Videos folders are all stored under
the /home/username directory. You can also store les directly in your /home folder without going to asub-
folder,if you wish so. Typically, when you open a command-line terminal in Linux, the default location that the
terminal points to is your/home/usernamefolder, unless youve manually changed the default location to
something else.
/lib- This is where libraries are kept. Youll notice that many times when installing Linux software packages,
additional libraries are also automatically downloaded, and they almost always start with lib-something.
These are basically the les needed for your programs on Linux to work. You can think of this folder as
somewhat equivalent to the Program Files folder on Windows, although its not exactly the same. Unlike
Windows, libraries can be shared between many different programs, which results in Linux installations
typically being much more lightweight than Windows, because typically in Windows each program needs its
own library installed, even if its redundant and already exists for another program. Surely a benet of Linux
le system structure.
/media- Another place where external devices such as optical drives and USB drives can be mounted. This
varies between different Linux distros.
/mnt- This is basically a placeholder folder used for mounting other folders or drives. Typically this is used for
Network locations, but you could really use it for anything you want. I used to use it as the mount point for
my media servers hard drive (/mnt/server).
/opt- Optional software for your system that is not already managed by your distros package manager. I
dont really ever nd myself using this, your mileage may vary.
/proc - The processes folder where a lot of system information is represented as les (remember,
everything is a le). It basically provides a way for the Linux kernel (the core of the operating system) to send
and receive information from various processes running in the Linux environment.
/root- This isthe equivalentto the /home folder specically for the root user, also called the superuser. You
really dont want to touch anything in hereunless you know what youre doing.
/sbin- Similar to /bin, except that its dedicated to certain commands that can only be run by the root user, or
the superuser.
/tmp- This is where temporary les are stored, and they are usually deleted upon shutdown, which saves you
from having to manually delete them like is required in Windows.
/usr- Contains les and utilities that are shared between users.
/var- This is where variable data is kept, usually system logs but can also include other types of data as well.
You can do some more research online and go deeper to learn more about specic applications and usage of each of
theabove mentionedfolders, but for the typical everyday home user, your /home folder is generally the only folder
youll be directly interacting with. Occasionally you may have to venture into the other folders if youre trying to do
some troubleshooting, but typically modern Linux distros automatically maintain these folders and they require little
to no user interference. The exception would be if youre using a distro like Arch Linux or Gentoo, in which case, you
probably didnt need to read this article in the rst place.
Conclusion
To reiterate my previous statement, keep in mind that the Linux le system is alogicalsystem, rather than a physical
one. Different folders in the system may be on different partitions on the disk, or even on different disks altogether,
butlogicallyeverything is still in the same location. The best way to grasp this concept is to simply use Linux as your
daily driver, as the best way to learn is through immersion. Ubuntu or Linux Mint are probably the best choices for
this task. After using the Linux le system for a while,eventuallyeverything will click youll understand whats going
on.