Linux Filesystem and Permissions

The Linux filesystem is probably the single biggest conceptual shift from Windows. No drive letters. No C:\. No separate "My Documents" per user that lives somewhere you cannot quite find. Instead, there is one unified tree starting at /, and every file on the system — whether it is on your hard drive, a USB stick, or a network share — appears somewhere in that tree.

Understanding the filesystem and its permission model is foundational. Almost every Linux operation involves navigating this tree or managing who can access what.

One Tree, Not Drive Letters

In Windows, each disk gets a letter: C:\, D:\, E:\. In Linux, there is a single root directory: /. Everything else is a branch of that tree. Additional disks, USB drives, and network shares are mounted at a point in the tree rather than getting their own letter:

WindowsLinuxExplanation
C:\/The root of the filesystem
C:\Users\jake/home/jakeYour personal directory
C:\Program Files/usr/bin, /usr/libSystem-wide programs and libraries
C:\Windows/boot, /sbin, /libOS core files
D:\ (second disk)/mnt/data or /media/dataMounted wherever you choose
E:\ (USB drive)/media/jake/USB_DRIVEAuto-mounted for removable media

The Directory Tree

DirectoryPurposeWindows Analogy
/Root of everythingC:\
/home/usernameYour personal files, settings, configsC:\Users\username
/etcSystem-wide configuration filesRegistry + various config locations
/varVariable data: logs, databases, mail, cachesC:\ProgramData, Event Logs
/var/logLog filesEvent Viewer
/tmpTemporary files (often cleared on reboot)%TEMP%
/usrUser programs, libraries, documentationC:\Program Files
/usr/binUser command binariesC:\Program Files\app\app.exe
/usr/localLocally installed software (not from package manager)Manual installs
/bin, /sbinEssential system binariesC:\Windows\System32
/devDevice files (disks, terminals, hardware)Device Manager
/procVirtual filesystem exposing kernel/process infoNo equivalent
/sysVirtual filesystem for hardware/driver infoNo equivalent
/bootBoot loader and kernel imagesHidden system partition
/optOptional/third-party softwareC:\Program Files (alternate)
/mntMount point for manually mounted filesystemsArbitrary drive letters
/mediaAuto-mounted removable mediaRemovable drives

Everything Is a File

This is the most important conceptual difference. In Linux, almost everything is represented as a file:

This is not just a philosophical curiosity. It means you can use the same tools (cat, grep, ls, permissions) to interact with files, devices, processes, and system information. The abstraction is powerful.

Users and Groups

Linux is a multi-user system from the ground up. Every file is owned by a user and a group, and these ownerships determine who can do what.

sudo: Controlled Root Access

sudo ("superuser do") lets a permitted user run a single command as root:

sudo apt update              # Run package update as root
sudo systemctl restart nginx  # Restart a service as root
sudo nano /etc/hosts          # Edit a system config file as root

You will be prompted for your own password (not root's). Your admin privileges are granted for a few minutes, then you return to normal user mode.

Rule of thumb: Use sudo only when you must. Running everything as root is dangerous — one typo can destroy your system. Use your regular user account for everyday work.

The Permission Model

Every file has three sets of permissions for three audiences:

Audiences:

Permissions:

Reading Permission Strings

ls -la shows permissions:

-rwxr-xr-- 1 jake developers 4096 Mar 14 10:30 script.sh

Breaking down -rwxr-xr--: | Position | Meaning | |---------|--------| | - | File type (- = regular file, d = directory, l = symlink) | | rwx | Owner permissions: read + write + execute | | r-x | Group permissions: read + execute (no write) | | r-- | Others permissions: read only |

Changing Permissions

Symbolic mode (easier to read):

chmod u+x script.sh     # Give owner execute permission
chmod g+w shared.txt    # Give group write permission
chmod o-r private.txt   # Remove read from others
chmod a+r public.txt    # Give everyone read

Numeric mode (faster once you learn it): Each permission has a value: read=4, write=2, execute=1. Add them up for each audience:

chmod 755 script.sh     # Owner: rwx(7), Group: r-x(5), Others: r-x(5)
chmod 644 document.txt  # Owner: rw-(6), Group: r--(4), Others: r--(4)
chmod 700 private/      # Owner: rwx(7), Group: ---(0), Others: ---(0)
NumericPermissionsTypical Use
755rwxr-xr-xExecutable scripts, directories
644rw-r--r--Regular files (readable by all, writable by owner)
700rwx------Private directories
600rw-------Private files (SSH keys, configs with passwords)

Changing Ownership

chown jake file.txt           # Change owner to jake
chown jake:developers file.txt # Change owner and group
chown -R jake:developers dir/  # Recursive (all files in directory)

Common Permission Scenarios for Windows Users

ScenarioWhat to Do
"Permission denied" when editing a config fileIt is in /etc/ — use sudo nano /etc/filename
Downloaded script will not runIt is not executable — chmod +x script.sh
Cannot access another user's filesCheck permissions with ls -la. Use group membership or sudo if appropriate.
SSH key "permissions too open"SSH requires chmod 600 ~/.ssh/id_rsa — private keys must be private
Web server cannot read your filesThe web server runs as a different user. Set group permissions or change ownership.

Further Reading