HOME
The absolute path to the current user's home directory. Used as the default location for user configuration files, caches, and personal data. On Linux it is typically /home/username, on macOS /Users/username.
Last updated:
HOME holds the absolute path to the current user's home directory, and a huge amount of tooling builds paths from it: ~/.ssh, ~/.aws, ~/.config, ~/.cache, shell history, and the `~` shorthand all resolve through HOME. The login process sets it from the user's /etc/passwd entry, so it normally matches the account you logged in as. The trouble starts in containers, cron, and systemd services, where HOME is often unset or pointed at `/` — and every tool that expects ~/.config silently writes to the wrong place or fails to find its config.
- Provider
- General / OS
- Category
- system
- Set by
- Set by the login process based on the user's /etc/passwd entry
- Example
- /home/johndoe
How to set HOME
reference it in paths
cat "$HOME/.ssh/config"
cd "$HOME/projects"Dockerfile (give a non-root user a home)
ENV HOME=/home/appuser
RUN useradd --create-home --home-dir $HOME appuser
USER appuserReferences
Frequently Asked Questions
Why is HOME wrong or empty in my cron job or container?
cron and minimal container users often run without a proper login, so HOME is unset or set to /. Tools that read ~/.config, ~/.aws, or ~/.ssh then fail or write to the wrong place. Set HOME explicitly in the crontab/Dockerfile, or create the user with a real home directory.
Stay up to date
Get notified about new guides, tools, and cheatsheets.