Warning

# OS Basics

## Filesystem

A definition of filesystem from Wikipedia article about filesystems:

Filesystem is used to control how data is stored and retrieved. Without a file system, information placed in a storage medium would be one large body of data with no way to tell where one piece of information stops and the next begins. By separating the data into pieces and giving each piece a name, the information is easily isolated and identified.

The majority of operating systems (including Windows, Linux, MacOS) use filesystems with hierarchical structure, and distinguish 2 basic types of organizational units:

1. Files contain the actual data (text files, pictures, songs, documents, source code, binary data, executable applications, etc.). Each file is located in a folder (so-called “parent”), but no other file or directory can be located inside another file (files have no “children”).
2. Folders (or directories) are only used for the hierarchical organization of data, but they do not store any actual data directly. With the exception of the root folder, each folder is located in another folder (“parent”), and can contain other folders and files (“children”).

An empty, but ready-to-use drive contains at least one directory, the root directory, which is usually denoted as /. When the operating system is installed on the drive, it creates a bunch of required directories and files. The user may create/move/delete her own directories and files on the drive.

See the explanation from others:

### Absolute path

The location of any file or directory on the drive can be easilly given by its absolute path. It is the sequence of folders you need to traverse from the root folder to the target file/folder.

Many operating systems create folders which have a special meaning (but from a filesystem point of view, there is nothing special about them), e.g.:

• user home directory, located e.g. in /home/janedoe (for a user with username janedoe), where all the data of a particular user should be stored,
• user desktop directory, located e.g. in /home/janedoe/desktop, which contains all the files and folders Jane Doe can see on her desktop screen,
• user documents directory, located e.g. in /home/janedoe/documents, where the user shall preferably place all her documents,
• etc.

Maybe the user may want to create directory /home/janedoe/school/year1/prg to further impose a structure on her school-related materials (school folder), classified by the school year first (year1), and then by individual courses (prg).

All the strings like /home/janedoe/… are absolute paths. The path specified as /home/janedoe/school/year1/prg/contents.txt actually contains instructions how to find a file:

• start in the root directory /, then
• go to home directory, then
• go to janedoe directory, then
• go to the prg directory, and
• there you find file contents.txt.

Credits to the 'be5b33prg' course for this tutorial page.