File structure in Linux

Everything in Linux is considered a file, even a hard disk or a CD-ROM device. All files and directories appear under the root directory (represented with a single slash – /). You can refer to any file or directory using either a full path (for example, /home/bob/file.txt) or a relative path (for example, if your current directory is /home/bob/, you can refer to the file simply by typing file.txt).

A directory is similar to a folder in Windows, and it can contain files and other directories. Hardware devices are represented by a special file stored in the /dev directory (for example, /dev/sda usually represents the first hard disk on the system).

All files and directories appear under the root directory (/). Below that is a set of common directories in the Linux system (bin, dev, home, lib…):

linux file system hierarchy

In the picture above you can see the file hierarchy under the root directory.

Geek University 2022