Based on the Linux Master 1 exam syllabusReport an error
/) tree, and the directory layout is agreed upon by the FHS standard./proc and /sys are virtual filesystems that the kernel generates in memory, not on disk.ls -l — - d l b c s p.We'll look at how the "everything is a file" philosophy we met in Day 1 is actually implemented, starting with its first pillar, the spatial structure.
/bin, /etc, and /var are not random; they follow an official convention called the FHS (Filesystem Hierarchy Standard)./etc, logs are in /var/log" holds. Without this standard, locations would vary by distribution and administration would be impossible.C: and D:, but Linux is a single hierarchical tree that extends from one root (/).| Directory | Role | Key contents |
|---|---|---|
/ | Root | The starting point of the whole tree |
/bin | Essential commands | Basic commands for all users, such as ls, cp, cat |
/sbin | System commands | Administrator commands such as fdisk, ip |
/etc | Configuration files | System-wide settings such as passwd, fstab |
/home | User homes | Personal directories of regular users |
/root | Administrator home | Home directory of the root account |
/var | Variable data | Logs (/var/log), mail, cache |
/tmp | Temporary files | Temporary space that may be deleted on reboot |
/usr | User programs | Additionally installed applications (/usr/bin) |
/dev | Device files | Representations of hardware such as disks and terminals |
/proc | Process information | Virtual filesystem, kernel/process state |
/sys | System information | Virtual filesystem, hardware/driver information |
/lib | Shared libraries | Libraries used by /bin and /sbin |
/boot | Boot files | Kernel (vmlinuz), initramfs, GRUB |
/mnt, /media | Mount points | Temporary mounts (/mnt), automatic mounts (/media) |
/opt | Optional packages | Large third-party applications |
/bin and /sbin have different uses. /bin holds general commands used by all users (ls, cp), while /sbin holds system administration commands mainly used by the administrator (root), such as fdisk and reboot. The "s" stands for system or superuser. Likewise, /usr/bin and /usr/sbin follow the same distinction. Recent distributions are trending toward merging /bin into /usr/bin as a symbolic link (usrmerge).
/proc and /sys are not files that actually exist on disk, but virtual filesystems that the kernel generates in memory in real time.# /proc - read kernel and process information like files
cat /proc/cpuinfo # Detailed CPU information
cat /proc/meminfo # Memory usage status
cat /proc/version # Kernel version
ls /proc/1/ # Information directory of the PID 1 process
# /sys - hardware and driver information
cat /sys/class/net/eth0/address # MAC address of the network interface
# Try it yourself: count your CPU cores from the file
grep -c processor /proc/cpuinfoEach numeric directory in /proc (/proc/1234) corresponds to the process with PID 1234. By reading status, cmdline, and fd/ inside it, you can find out what command that process was started with and which files it has open. Tools like top and ps actually work by reading /proc internally. Virtual filesystem files appear to be 0 bytes in size, but reading them produces real-time data.
The single first character of the ls -l output tells you the file's type. This identifier character is a point tested on the Level 1 exam.
| Identifier | Type | Description |
|---|---|---|
- | Regular file | Text, executable binaries, images, etc. |
d | Directory | A folder that holds other files |
l | Symbolic link | A shortcut pointing to another file |
b | Block device | Block-unit I/O like a disk (e.g., /dev/sda) |
c | Character device | Character-unit I/O like a keyboard (e.g., /dev/tty) |
s | Socket | Bidirectional communication between processes |
p | Pipe (named pipe, FIFO) | Unidirectional communication between processes |
# Check the file type from the first character of ls -l
ls -l /dev/sda # Starts with b → block device
ls -l /dev/tty # Starts with c → character device
ls -l /etc/passwd # Starts with - → regular file
ls -ld /etc # Starts with d → directory
# Determine the file type from its content with the file command
file /etc/passwd # ASCII text
file /bin/ls # ELF executable binary⚠️ Pitfall: If the exam asks "What kind of device file is the disk /dev/sda?", the answer is block device (b). If it asks "What about a keyboard or terminal?", it's character device (c). It is easy to confuse the distinction between block (random access, buffered) and character (sequential, stream). The 's' in
/dev/sdastands for SCSI/SATA, not the 's' of socket.
To understand links, you first need to know the inode (index node). It is the most fundamental concept in Linux filesystems.
# Check the inode number
ls -i file.txt # Show the file's inode number
stat file.txt # Details: inode number, size, permissions, timestamps, etc.
df -i # inode usage per filesystemThe number of inodes is fixed when a filesystem is created. Even if disk capacity remains, once inodes are exhausted you can no longer create files (check with df -i). The "No space left on device" error with space still available on a mail server or other system that creates countless small files is caused by exactly this inode exhaustion. This is why inodes matter in practice.
This is a key topic in scope for the Level 1 exam.
| Item | Hard link | Symbolic link |
|---|---|---|
| inode | Same as the original | Its own new inode |
| What it points to | The inode (data) directly | A path (name) string |
| When the original is deleted | Data is kept (only the link count decreases) | Becomes a broken (dangling) link |
| Across filesystems | Impossible | Possible |
| Directory target | Impossible (in general) | Possible |
| Size | Same as the original | Length of the target path string |
# Create a hard link (ln, no options)
ln original.txt hardlink.txt
ls -li original.txt hardlink.txt # Confirm the inode numbers are identical
# Create a symbolic link (ln -s)
ln -s original.txt symlink.txt
ls -li original.txt symlink.txt # Different inode numbers, shown with l
# Try it yourself: delete the original and observe the difference
echo "hello" > orig.txt
ln orig.txt hard.txt
ln -s orig.txt soft.txt
rm orig.txt
cat hard.txt # Prints normally (data is kept)
cat soft.txt # No such file (broken link)orig.txt, the hard link hard.txt points directly to the same inode, so the data survives (the link count simply dropped from 2 to 1).soft.txt, on the other hand, stores "the path orig.txt," and since that path is gone, it becomes a broken link.⚠️ Pitfall: "A symbolic link can point to another filesystem (partition) and to a directory, but a hard link can do neither" is the key exam point. The reason is clear. Hard links share an inode number, and inode numbers are unique only within each filesystem, so they cannot cross partitions. Directory hard links are prohibited to prevent loops from forming in the filesystem tree, which would send tools like
findinto infinite repetition.
If you view a directory with ls -l, there is a number next to the permissions (e.g., drwxr-xr-x 2). That number is the inode's link count. When you create a new directory, the link count is 2 by default. This is because 2 hard links are created automatically: . pointing to itself, and the name by which the parent points to the child. Each time you create a subdirectory, the .. inside it points to the parent, so the parent's link count increases by 1.
Even Dennis Ritchie has said he doesn't remember exactly where the name "inode" came from. The most likely theory is that it's short for "index node," meaning a node that indexes a file's information. This concept, born in the early Unix filesystem design of the early 1970s, is still alive 50 years later as the foundation of Linux filesystems such as ext4 and XFS.
/). It always starts with / and points to the same file regardless of the current location. Example: /home/user/docs/file.txt./.. (current directory), .. (parent directory), ~ (home directory).pwd # Show the current working directory (absolute path)
cd /etc # Move using an absolute path
cd ../var # Relative path: go up to the parent, then into var
cd ~ # To the home directory
cd - # Toggle to the previous directory. and .. are not mere symbols but hard links that actually exist in every directory. If you view with ls -a, every directory shows . (itself) and .. (parent). This connects to why a directory's default link count is 2.
Next time, we'll do a comprehensive review of this week's operating system concepts, licenses, booting, and filesystems, and check your skills with exam-style questions.
/proc and /sys that the kernel generates in memory in real time, not on disk.df -i.p in ls -l./, and an address based on the current location.Click a choice to reveal the answer and explanation.
Question 1
In the ls -l output, which pairing of the leading identifier character and file type is NOT correct?
Question 2
Which is a correct description of the difference between hard links and symbolic links?
Question 3
Which information is NOT stored in an inode in a Linux filesystem?
Question 4
Which of the following directory roles according to the FHS (Filesystem Hierarchy Standard) is NOT correct?
Question 5
Which is a correct description of the /proc and /sys directories?
Question 6
After running the following commands in order, which is the correct result of the final cat soft.txt?
```
echo "data" > orig.txt
ln orig.txt hard.txt
ln -s orig.txt soft.txt
rm orig.txt
```