Home Directory
A special directory assigned to a user account on a multi-user operating system, serving as the default location for personal files, configuration, and the starting point for shell sessions.
Also known as: Home Folder, User Directory, Home Dir
Category: Software Development
Tags: software-engineering, tools, cli
Explanation
A home directory is a dedicated directory assigned to each user account on a multi-user operating system. It serves as the primary location for a user's personal files, application configuration, and custom settings. When a user logs in or opens a new shell session, the working directory is typically set to their home directory.
On Unix-like systems, home directories are conventionally located under `/home/`, with each user getting a subdirectory matching their username (e.g., `/home/alice`). The root user's home directory is typically `/root`. On macOS, home directories are under `/Users/`. On Windows, they are under `C:\Users\`.
The home directory is accessible through several mechanisms. The `HOME` environment variable stores its path. In Unix shells, the tilde character `~` serves as a shorthand for the home directory, so `~/documents` expands to `/home/user/documents`. The `cd` command without arguments changes to the home directory.
Home directories contain configuration files (often called dotfiles because their names start with a period to hide them from default directory listings). Examples include `~/.bashrc` or `~/.zshrc` (shell configuration), `~/.ssh/` (SSH keys and configuration), `~/.gitconfig` (Git settings), and `~/.config/` (application settings following the XDG Base Directory Specification).
The XDG Base Directory Specification standardizes where applications store different types of data within the home directory. `~/.config/` holds configuration files (XDG_CONFIG_HOME), `~/.local/share/` holds application data (XDG_DATA_HOME), `~/.cache/` holds cached data (XDG_CACHE_HOME), and `~/.local/state/` holds state data (XDG_STATE_HOME).
In multi-user systems, permissions on home directories ensure privacy. Typically, only the owning user (and the root/administrator) can read the contents of a home directory. This isolation is fundamental to Unix security, keeping each user's files, credentials, and configuration separate from others.
Related Concepts
← Back to all concepts