8.4 /home and /root: User Home Directories
Right, let’s talk about where you live. No, not your physical house—your digital one. On a Linux system, your personal slice of the universe is /home/your_username. It’s your bedroom in the sprawling mansion of the operating system: you get to put posters on the walls, leave dirty socks on the floor, and generally arrange things as you see fit. The system and other users (mostly) have to knock before coming in.
But wait, there’s also /root. And no, that’s not a clever plural. This is the first, and arguably most common, point of confusion for newcomers. Let’s clear it up immediately.
Your Place vs. The Superuser’s Lair
The difference is one of privilege and separation. /home is a directory that contains the home directories for all regular users. My home directory might be /home/elliot, yours might be /home/reader. The system creates these automatically when a user account is added. The contents—your documents, your desktop configuration, your browser’s embarrassingly specific history—are owned by you. Your user has full read, write, and execute permissions here, and it’s where you’re dumped upon logging in.
/root, on the other hand, is the home directory specifically for the root user, the system administrator. It exists alone, outside of /home, as a stark reminder of its total separation from the mere mortals below. This is a deliberate design choice, not an oversight. It makes it harder to accidentally rm -rf the root user’s .bashrc file while performing some wildcard operation in /home/*. Trust me, you want this separation. The system assumes if you’re in /root, you absolutely know what you’re doing.
You can see this distinction clearly with a quick ls:
ls -ld /home /root /home/$USER
drwxr-xr-x 4 root root 4096 May 10 10:00 /home
drwx------ 10 root root 4096 May 12 14:22 /root
drwxr-x--- 20 reader reader 4096 May 12 14:30 /home/reader
Notice the permissions? /home is readable by everyone but only writable by root (so users can’t create new folders inside it willy-nilly). /root is locked down tight—only root itself can even look inside. Your home directory is readable and executable by you and your group, but not by others, keeping your stuff (mostly) private from other users on the same system.
The Absolute Mess You’re Allowed to Make
Your home directory is your sandbox. This is where you’re meant to store your personal data, your project files, your custom scripts, and all your application configurations (those hidden files and directories that start with a dot, like .config or .ssh). The system and package managers will generally leave this area alone. It’s your sacred land.
This freedom, however, is a double-edged sword. I’ve seen home directories that would make a hoarder weep. The pitfall here is disorganization. Since nothing enforces structure, you can end up with a Downloads folder containing 3,000 files, a projects directory with 47 half-finished ideas, and a file called stuff.txt on your Desktop that contains the most important command you ever ran six months ago. My advice? Impose your own order early. Use ~/bin for your personal scripts, ~/Documents for actual documents, and so on. Your future self will thank you.
Why ~ is Your Best Friend
Typing out /home/your_username every time is for chumps. This is why the shell gives you the tilde (~) expansion. It’s a shortcut that points directly to your home directory.
# These two commands are identical
ls -la /home/reader/Documents
ls -la ~/Documents
# And this is how you quickly go home, no matter where you are
cd ~
But here’s a pro tip: ~ isn’t magic; it’s a shell expansion that happens before the command is run. It’s also user-aware. ~root expands to /root, and ~otheruser would expand to /home/otheruser (if you had permission to access it). This is incredibly useful for sysadmins moving files around.
The Quirks and The Edge Cases
Now, is a user’s home directory always in /home? Technically, no. It’s a strong convention dictated by the Filesystem Hierarchy Standard, but it’s not a law of physics. The system administrator can technically put your home directory anywhere they want when creating your user (useradd -d /opt/weirdhome elliot). This is almost always a terrible idea and breaks assumptions every piece of software makes. Don’t do it unless you have a phenomenally good reason and a deep love for troubleshooting.
Another edge case: what if /home is on a separate partition that fails to mount? Boot will likely continue, but when you try to log in, the system won’t be able to find your home directory. You’ll get dropped into a temporary, barren directory (usually /) with none of your customizations or files. It’s a horrifying experience that perfectly illustrates why we back up our home directories. The system can run without /home. It cannot run without /root being available to root.