In the previous chapter, you learned about GNOME's built‑in applications and how to install additional software. Now we enter a new part that will form an important foundation for understanding how Linux works as a whole: the filesystem. Before studying the directory structure and how to manage files through the terminal, it is a good idea to first understand the basic concepts of files and directories in Linux. This chapter explains the philosophy of "everything is a file", the fundamental differences between the Linux filesystem and Windows, file naming rules, hidden files, file types, and the concept of inodes as file metadata. This understanding will make it easier for you to follow the subsequent chapters.
Everything Is a File in Linux
One of the most fundamental principles in the design of Linux and Unix is the philosophy of "everything is a file". This principle states that in a Linux system, almost everything that the system can read or write is represented as a file within the filesystem.
What is meant by "file" here is not just text documents, images, or videos. In Linux, the following objects are also treated as files:
- Ordinary data, such as documents, photos, programs, and configuration files.
- Directories, which are actually a special type of file that contains a list of files or other directories.
- Hardware devices, such as hard disks, keyboards, and terminals, represented as special files inside the
/devdirectory. - System and process information, such as kernel data and process status, available through the virtual directories
/procand/sys. - Network connections and inter‑process communication, such as sockets and pipes.
Because all objects are treated uniformly as files, programs can use the same operations — open, read, write, and close — on any object. This is what makes Linux simple, consistent, and easy to integrate: a utility designed to read a text file can just as easily be used to read data from a device or another process.
For example, the command for displaying the contents of a file, cat, can be used to read the contents of an ordinary file, but it can also be used to read data directly from a particular hardware device. This uniformity is one of Linux's design strengths.
Differences Between Linux and Windows Filesystems
If you are used to Windows, there are several important differences in how Linux manages files and directories that you need to understand. These differences are often a source of confusion for beginners moving from Windows to Linux.
No Drive Letters (C:, D:)
In Windows, each partition or storage device is given a letter label like C:, D:, or E:, and each has its own separate directory structure. For example, C:\Users\YourName\Documents and D:\Backup\Photos belong to two different "trees".
Linux does not use drive letters at all. Linux has only a single unified directory tree rooted at the root directory, written with a forward slash /. All partitions, hard disks, USB flash drives, and even network storage devices are mounted into specific directories within this single tree.
Therefore, instead of accessing a flash drive as E:\, on Linux that flash drive will appear as a directory, for example /media/yourname/flash-drive-name. The entire system appears as one cohesive whole, regardless of how many physical disks are attached. This concept of mounting, called mount, will be discussed in more detail in Chapter 13.
Case‑Sensitive
The Linux filesystem is case‑sensitive, meaning that uppercase and lowercase letters are considered different. As a result, the names Dokumen.txt, dokumen.txt, and DOKUMEN.TXT are three different files and can coexist in the same directory.
This is different from Windows, which is generally case‑insensitive, where those names are considered to refer to the same file. For new users, this case‑sensitivity requires precision when typing file names or commands, because a capitalization error can cause the file not to be found.
Allowed Characters in File Names
Linux gives considerable freedom in naming files, but there are still rules to follow:
- The only forbidden character in a file name is the forward slash
/, because this character is used as a directory separator. The null character (byte with value zero) is also not allowed. - Spaces are allowed, but their use requires special attention. A file named
Meeting Notes.txtis technically valid, but when typing it in the terminal, you must use quotes or escape characters so that the space is not interpreted as an argument separator. - The dot (.) is allowed and has no special meaning like an extension in Windows. Extensions such as
.txt,.jpg, or.share merely part of the file name as a convention for human convenience, not a binding system rule. - Special characters such as
*,?,[,],!,",', and\should be avoided because they have special meanings for the shell and can cause problems.
As a good practice, many Linux users recommend using lowercase letters, numbers, underscores (_), and hyphens (-) in file naming, and avoiding spaces and special characters to make them easier to manage from the terminal.
Hidden Files (Dotfiles)
In Linux, a file or directory is considered hidden if its name begins with a dot (.). Such files are known as dotfiles, and by default they are not shown by the ls command nor by graphical file managers like Files.
Dotfiles are commonly used to store user configuration and application data. Some common examples you will find in the home directory include:
.bashrc: configuration for the Bash shell..profile: environment settings at login..config: a directory containing configuration for various applications..local: a directory for application‑specific local data..ssh: a directory storing SSH keys for remote login..gitignore: a list of files ignored by Git.
To view hidden files in the terminal, you use the -a option with the ls command, i.e. ls -a. In the Files graphical file manager, you can show hidden files through the menu, usually with the shortcut Ctrl+H. These commands will be studied further in Chapters 15 and 16.
File Types in Linux
When running the ls -l command, the first character of each line indicates the file type. Contrary to common belief, "files" in Linux come in several different types, and understanding these types is important for properly managing the system.
Regular Files, Directories, and Symbolic Links
The three most commonly encountered types are:
- Regular file, marked with
-. This is the file type for storing data, whether text, images, videos, programs, or other binary data. - Directory, marked with
d. A directory is a special file whose contents are a list of name‑to‑inode pairs pointing to the files or subdirectories inside it (more on this in the Inode section). - Symbolic link (also called symlink), marked with
l. A symlink is a file that contains a pointer to another file or directory, similar to a shortcut in Windows. Symlinks allow one file to be accessed through multiple names and different locations.
Symbolic links are created with the ln -s command, and their use will be covered in Chapter 16. Symlinks are useful, for example, for creating library versions with multiple names, or for making shortcuts to files in more memorable locations.
It is important not to confuse symbolic links with hard links, another concept you will encounter when discussing inodes at the end of this chapter. A symbolic link is a separate file with its own type and inode number (shown as l in ls -l), whose content is merely the "address" of the target file. Therefore, a symlink becomes broken if the target file is moved or deleted. A hard link, on the other hand, is not a separate file but an additional name that points directly to the same inode as the original file, so it will never "break" as long as at least one of its names still exists.
Device Files, Sockets, and Pipes
In addition to the three types above, Linux also has special file types that represent system resources:
- Block device, marked with
b, represents devices that access data in blocks, such as hard disks and SSDs. These devices are typically found in/dev, for example/dev/sda. - Character device, marked with
c, represents devices that process data character by character, such as keyboards and terminals, e.g./dev/tty. - Socket, marked with
s, used for inter‑process communication, including network communication. - Named pipe (or FIFO), marked with
p, used for inter‑process communication within a single machine, where data written to one end is read from the other.
These special types reaffirm the philosophy of "everything is a file": hardware and inter‑process communication mechanisms can all be accessed through the filesystem in a uniform way.
| File Type | Character | Example |
|---|---|---|
| Regular file | - | documents, photos, programs |
| Directory | d | /home, /etc |
| Symbolic link | l | shortcut to another file |
| Block device | b | /dev/sda (hard disk) |
| Character device | c | /dev/tty (terminal) |
| Socket | s | communication endpoint |
| Named pipe (FIFO) | p | inter‑process channel |
Inodes: File Metadata
When you save a file, the filesystem does not only store the content (data) of the file, but also a number of pieces of information about that file. This information about the file is stored in a data structure called an inode (index node).
The inode stores the file's metadata, i.e. information about the file, not the file content itself. The information stored in the inode includes:
- File type (regular file, directory, symlink, etc.).
- Permissions: access rights that determine who can read, write, or execute the file.
- Owner and group: the identity of the file's owner and its group.
- File size in bytes.
- Timestamps: last access time, last modification time, and metadata change time.
- Link count: the number of names that refer to this inode.
- Pointers to data blocks: the locations on disk where the file content is stored.
One important thing to remember: the file name is not stored in the inode. The file name is stored separately in the directory, which maps the file name to the inode number. In other words, a directory contains pairs of names and inode numbers, while the inode stores metadata and pointers to the data.
Each inode has a unique identification number within the filesystem. You can view the inode number of a file using the ls -i command, while to view all the metadata stored in it in more detail — including permissions, owner, size, and all three timestamps at once — you can use the stat filename command. Consequences of this separation of name and inode include: a file can have several names (via hard links) all pointing to the same inode, and the file name can be changed without affecting the content or metadata of the file.
Understanding inodes helps you understand why operations like renaming a file feel very fast (only changing the directory entry), and why a file that is in use can have its name deleted without disrupting processes that are still reading it.
In this chapter, you have learned the basic concepts of files and directories in Linux: the philosophy of "everything is a file", the differences between the Linux filesystem and Windows regarding drive letters, case‑sensitivity, and naming rules, how hidden files work, file types, and the role of inodes as file metadata storage. All of these concepts are a foundation that you will continue to use in the following chapters.
In the next chapter, we will go further by studying the Linux directory structure in detail, based on the Filesystem Hierarchy Standard (FHS), so that you understand the function of each major directory such as /home, /etc, /var, and others.

