Ubuntu or Linux file system layout

Rather than Linux File System, Windows there’re perhaps only a couple of important folders in the installation drive (by default case C:\). Namely Program Files and Windows. You simply stay away from Windows folder and the “add remove program files” is good enough to handle the program files folder of Windows. Of course there’s a folder named Users where the users (who are not admins) can access only their folders.

Thus there’s a clear picture at some level in your mind of the Windows file system. In Ubuntu, when you reach the location /, there’s a huge list of folders, most of which you have no clue as to what they contain. The /bin folder seems to be the equivalent of the Windows folder in windows. The /usr folder seems like it’s the equivalent of the Users folder in Windows. But even the /home folder looks like it can fit the bill.

Please understand that you do understand, that Ubuntu (Linux) has a different character than that of Windows, i.e., there need not be exact equivalent of Windows functions, in Ubuntu.

Linux File system Hierarchy Standard (FHS)

The Filesystem Hierarchy Standard (FHS) defines the main directories and their contents in Linux operating systems. For the most part, it is a formalization and extension of the traditional BSD filesystem hierarchy.

The FHS is maintained by the Linux Foundation, a non-profit organization consisting of major software and hardware vendors, such as HP, Red Hat, IBM and Dell. The current version is 3.0, released on June 3, 2015.

Ubuntu or Linux file system layout

Basically Linux has divided the directory structure based on the function of what is needed to make the system as secure as possible with the minimum amount of permissions needed. Otherwise someone is bound to have to do alot of avoidable work.

Remember that Unix and Linux where made as multi-user systems and Windows was created for a single user. Everything else can be explained from that idea. You can explain every directory when thinking about it being multi-user and security.

Here are some examples for better understanding of Ubuntu or Linux File System

  • You will see that files and directories that are admin only are gathered in the same directory: the s in /sbin and /usr/sbin and /usr/local/sbin stands for system. A normal user can not even start programs that are in there. Files a normal user can start are in /bin, /usr/bin, /usr/local/bin based on where it most logically should reside. But if they are admin only they should go to the s version of that directory. There is a famous utility called fuser. You can kill processes with it. If a normal user could use this (s)he would be able to kill your session.
  • The same goes for /home: /home/user1 is property of user1. /home/user2 is property of user2. user2 has no business doing stuff in user1’s home (and the other way around is also true: user1 has no business doing stuff in user2’s home). If all the files would be in /home with no username underneath it you would have to give permissions to every file and asses if someone is allowed to write/remove those files. A nightmare if you have tens of users.
  • Addition regarding libraries.

    /lib/, /usr/lib/, and /usr/local/lib/ are the original locations, from before multilib systems existed and the exist to prevent breaking things. /usr/lib32, /usr/lib/64, /usr/local/lib32/, /usr/local/lib64/ are 32-/64-bit multilib inventions.

It is not a static concept by any means. Other Linux flavours made tweaks to this lay-out. For instance; currently you will see debian and Ubuntu changing a lot in the lay-out of the FHS since SSD is better off with read only files. There is a movement towards a new lay-out where files are split in to a ‘read only’ and a ‘writable’ directory/group so we can have a root partition that can be mounted read only (partition for a ssd) and writable (sata hdd). The new directory that is used for this (not in the image) is /run/.

Ubuntu or Linux file system layout in brief

\Users is equivalent to /home. The name of /usr is a historical artifact.

The combined equivalent of \Windows and \Program Files is the combination of /bin, /boot, /etc, /lib, /sbin, /tmp, /usr and /var. Linux and Windows split up installed software differently. Windows distinguishes between the operating system and companion programs. Linux doesn’t make this distinction in the same way; most if not all software comes through Ubuntu (the distributor) and is installed in the same directory hierarchy, and since software is tracked by the package manager, there is no need to store each program in its own directory. On Linux:

  • /etc is for system configuration files: configuration files that affect all users, whether they apply to the operating system as a whole or to a specific application.
  • /usr is for system code and data (programs, libraries, documentation, etc.).
  • /var is for variable or temporary data: temporary files, logs, package manager databases, printer spools, game save files, etc. There is also /tmp for temporary files that can be erased across reboots.
  • /bin, /lib and /sbin in the root directory have counterparts in /usr. The files that are outside /usr are the ones that are needed early in the boot process. This is a relic from the time when disks were small and /usr might be on a filesystem shared between several workstations over the network, it isn’t really a useful distinction on most systems.
  • /boot contains a few files that are needed only to boot the operating system, and not for day-to-day operation.

There are additional directories that don’t correspond to anything that Windows has:

  • /root is the root user’s home directory. The root user is an administrator account not tied to any particular user; it’s the user that you change to when you run sudo. Ubuntu doesn’t let the root user log in by default.
  • /media and /mnt are mount points: they’re where you can see the filesystems of other operating systems and remote drives. The Windows equivalent is other drive letters.
  • /proc and /sys show system information. On Windows, you need to wade through menus or call system commands or install third-party programs to see this information.

Ubuntu, like other Linux distributions, generally follows the Linux Filesystem Hierarchy Standard.

Read Also: What’s is New in Windows 10’s Creators Update

LEAVE A REPLY

Please enter your comment!
Please enter your name here