Everything is a file
The core Linux idea behind disks, devices, settings and processes, plus links, file types and why config is just text.
The idea
On Linux almost everything shows up as a file in one big folder tree that starts at /. A disk, a running process, a kernel setting, a network socket: you can find them as paths and read or write them with the same tools you use for text files.
There are no drive letters. A second disk is not D:, it is “mounted” into a folder, for example /data. See How disks, partitions and volumes fit together.
Examples
| Path | What it is |
|---|---|
/dev/sda, /dev/nvme0n1 | A whole disk |
/dev/sda1 | The first partition on that disk |
/dev/null | A black hole: everything written here disappears |
/dev/zero, /dev/urandom | Endless zeros / random bytes |
/proc/cpuinfo, /proc/meminfo | CPU and memory info, generated live by the kernel |
/proc/1234/ | Everything about the process with PID 1234 |
/sys/class/net/ | Your network interfaces |
/etc/hostname | The server name, as plain text |
cat /proc/meminfo | head -3 # read memory info like a text file
cat /sys/class/net/*/address # MAC addresses of all interfaces
Why it matters for admins
- Configuration is text. Almost all settings live as text files in
/etc. You can read them,grepthem, back them up withcp, and track them in Git. - The same tools work everywhere.
cat,grep,less,teework on logs, configs and kernel values alike. - Permissions are file permissions. Who may use a disk, a serial port or a socket is controlled by normal file owners and modes. See How permissions work.
File types
The first character of ls -l tells you the type:
| Char | Type | Example |
|---|---|---|
- | Regular file | /etc/hosts |
d | Directory | /etc |
l | Symbolic link | /etc/resolv.conf |
b | Block device (disk) | /dev/sda |
c | Character device | /dev/tty |
s | Socket | /run/systemd/journal/socket |
p | Named pipe | rarely seen |
file /some/path tells you what a file really is, no matter its name. Linux does not care about file extensions.
Links
| Symbolic link (symlink) | Hard link | |
|---|---|---|
| Create | ln -s TARGET LINKNAME | ln TARGET LINKNAME |
| Points to | a path (like a shortcut) | the same data on disk |
| Target deleted | link breaks | data stays until the last link is gone |
| Across disks | yes | no |
You will mostly see symlinks, for example /etc/nginx/sites-enabled/ links to files in sites-available/. ls -l shows where a symlink points; readlink -f PATH shows the final target.
Hidden files
Files starting with a dot (.bashrc, .ssh/) are hidden. ls -a shows them. That is the whole mechanism, there is no hidden attribute.