The Linux directory structure is well defined and documented in the Linux Filesystem Hierarchy 1
Standard (FHS) which is maintained by Linux foundation. 2
I’m listing the contents of the root directory, of forward slash: 3
Most Linux distributions will show you the same or a very similar layout to what you can see in the 4
output of the ls command. 5
Let's get started and look at what each directory is used for. 6
You can take a look at their contents running ls. in this video 7
I'll show you the directories, both in the terminal and in the graphical file manager. To start the 8
file manager search for files 9
and open it. 10
Go to other locations and then access My computer. 11
This is the root directory contents. 12
The /bin directory contains binaries or user executable files which are available to all users. 13
For example the ls command we’ve just run is in this directory, along with other basic 14
tools for copying and removing files and directories, moving them around and so on. 15
This is the contents of bin. 16
As you see, ls resides in this directory. 17
There’s another directory called /sbin which is similar to /bin, but it contains applications that 18
only the superuser (hence the initial s) will need. 19
These executables are used for system administration. 20
ifconfig used to configure the network adapter or fdisk used to manipulate disk 21
partitions. 22
This is its contents. 23
The boot directory contains files required for starting the system. You normally do not touch it. 24
/home is where you will find your users’ home directories. Under this directory 25
there is another directory for each user, if that particular user has a home directory. 26
In this example, the user called student has as home 27
directory 28
the directory called student under /home.. 29
It's common for the name of the home directory to be the same as the user's name. 30
Note that ~ (tilde) is the same as the user's home directory. 31
So if I run ls ~ , it's the same as is running ls/ home/ student. 32
In this case, ~ =/ home /student, the current users' home directory. 33
Note that root has its home directory separated from the rest of the users’ home directories and is /root 34
This is the home directory of root. Of course a non privileged user is not allowed to see the 35
contents of this directory. 36
Let's take a look at other directories. Dev or Dev contains device files; many of these are generated 37
at boot time or even on the fly. 38
This directory contains the device files for every hardware device attached to the system, like a hard 39
disk or a partition. 40
These are not device drivers 41
rather they are files that represent each device on the computer and facilitate the access to those 42
devices. 43
Remember that in Linux everything is a file and the disk 44
partition is logically represented as a special file as well. 45
Let's take a look at this file! 46
Dev/sda1 47
This is a file of type device that represents the first partition of the hard disk. 48
Another interesting and well-known directory is ITC, it gets its name from the earliest Unix operating 49
systems and it was literally etc. because it was the dumping ground for system files, 50
the system administrators were not sure where to put. 51
On a modern Linux distribution, it contains most, if not all system wide configuration files. 52
For example, the files that contain the users and their passwords, the groups, how the network 53
is configured, or how a network service like a web or an e-mail server is configured are all of there. 54
As a beginner, I'd recommend you not to touch it much and it's always a good idea to make a copy 55
or a backup of this directory. 56
Let's take a look at another one. 57
/lib contains shared library files used by different applications. 58
You don't talk to this directly. The package manager can update it accordingly when you 59
install, remove or update an application. 60
The media directory is where the external storage will be automatically mounted when you plug it and 61
try to access it. When you insert an external hard disk or USB stick they will be automatically 62
mounted and made available for you under / media. 63
/mnt is like /media but it’s not very often used these days. It was the mount point for the cdroms 64
or the floppy disks. 65
However, when you need to quickly mount a partition and don't know where you always have /mnt available. 66
/tmp contains temporary files, usually saved there by applications that are running. Non-privileged 67
users may also store files there temporarily. Note that files stored in this directory may be deleted at 68
any time without prior notice. 69
And /proc is a virtual directory. 70
It contains information about your computer hardware, such as information about your CPU, RAM memory 71
or Kernel. The files and directories are generated when your computer starts or on the fly 72
as your system is running and things change. 73
For example if I want to see information about the cpu I can run: cat /proc/cpuinfo 74
And it has displayed information about the cpu. 75
Or if I want to see information about the memory cat /proc/meminfo 76
This is the information about the memory. 77
This contains information about devices, drivers and some Kernel features and /srv contains data for 78
servers; You use neither /sys nor /srv directly. 79
And /run directory is fairly new and different distributions use it in different ways. 80
It’s a temporary filesystem which runs in RAM so its contents will vanish when the system reboots. 81
This directory is used only by processes. 82
And /usr was the initial user’s home directory in the early days of Unix. 83
However these days /home took its place and /usr contains many other subdirectories with 84
binary files, 85
shared libraries and so on. 86
On some distributions like CentOS many commands are saved in /usr/bin or in /usr 87
/sbin 88
instead of /bin and /sbin 89
On both Ubuntu and CentOs /bin and /sbin are simlinks to 90
/usrbin and /usrsbin respectively. 91
And finally /var. It contains variable-length files such as logs which are files that register events 92
that happen on the system. 93
Let's display the contents of a log file: cat/var/log/auth.log. 94
This file contains information about authentication thrice. 95
It's possible that your Linux distribution may have more or less directories at its root because there 96
are slight differences between distributions. 97
However, we've discussed here the most important and used once. In the next lecture will be talking 98
about absolute and relative paths and walking through the file system.