One of the most confusing things for newcomers to Linux can be the difference in core directory layout, and associated system files, between the Penguin-flavoured operating system and that of Windows. I know when I first sallied forth into this new and exciting realm many moons ago, I did wonder what on earth was going on, just expecting a default C: drive to appear by magic, and for my Windows style system files to exist in some strange alternative-universe-type manner.
After a while, and a bit of reading around, it didn’t take too long to figure out that though things were a bit different they weren’t altogether overwhelming. In fact, after a while of working with Linux you’ll find that things that previously seemed illogical (and granted, are sometimes illogical) begin to make sense, and your mind will soon make order from the chaos.
Root is First
The directory structure of Linux begins with / root. That’s represented by the forward slash character /. I think that’s what confused me early on – I was looking for something, a character, or drive letter, to proceed this. But it didn’t – and that’s ok. So think of the root, or /, as the world in which everything file/folder related inhabits.
Now, what resides in the root directory? A number of key folders which remain static across distributions is what resides in root. There’s also a folder called /root residing under the root directory. But don’t confuse the subfolder /root with / root. To make things a little more visual at this point, lets grab a screen shot of my root folder structure on one of my Linux PCs.
In the above screen shot I’ve performed an ls command, which upon execution lists the directory content. As you can see there are a number of directories within, which I will give a breakdown of as follows.
bin & /usr/bin
The bin directory contains, not unsurprisingly given it’s moniker, system binary files. Many of these are critical files and commands for the operating system. That ls command I ran in the screen shot above: that’s run from the bin directory. If you want to move a file, or copy one, then you’ll use the mv and cp commands respectively; those are stored here too. In some distros or installations /bin may be located in /usr/bin.
This directory contains those files related to booting the computer. This will usually include grub (grand unified boot loader) and such. The boot directory is also home to that mothership connection and heart of the OS: the Linux Kernel. For the curious, that’s the file labelled vmlinuz.
Now one of the things that I found weird in my early days of Linux was how CD-ROMs and devices were represented as files/directories. They didn’t have their own dedicated drives such as in Windows, for example. So, rather than being located in a common drive mapping, of say D in Windows systems, the CD-ROM drive in Linux is located at /dev/cdrom.
The /etc folder contains everything to do with the configuration of your operating system, namely the startup and configuration scripts. This folder contains many static/text files that can be edited to change operating system functions. Such files include /etc/innitab which details which processes are initialised at system startup, and during normal system operations and /etc/cups is used for the configuration of printers. For information regarding the various filesystem mount-points the /etc/fstab is the place to go.
The /usr directory contains user executables and system files and directories that are shared between users.
The /proc directory deals with the monitoring of processes on the system, and auditing/recording the state of operations. It contains info related to various components, including the kernel, CPU, mounted file-systems and devices plugged into system (hot and cold plug).