Linux Command Reference ยท Special Files and Directories
Home directory dotfiles
Reference for Linux dotfiles in your home directory: .bashrc, .bash_profile, .profile, .gitconfig, .ssh, .config and XDG folders, load order and how to manage them.
A dotfile is a file or directory whose name starts with a dot. ls hides them by default, which is why they hold per-user configuration: shell settings, editor options, tool credentials and caches. Each user's dotfiles live in their home directory ($HOME, written ~), so one person's settings never affect another's.
Programs read their dotfile when they start. There is no registry and no central tool; each program documents its own file. Newer programs follow the XDG convention and keep settings under ~/.config, data under ~/.local/share and caches under ~/.cache.
ls -A ~ ls -d ~/.[!.]* source ~/.bashrc
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Syntax
| File or folder | Used by |
|---|---|
~/.bashrc |
Interactive non-login Bash shells: aliases, prompt, functions. |
~/.bash_profile, ~/.profile |
Login shells: environment variables and PATH. |
~/.bash_logout |
Runs when a login shell exits. |
~/.inputrc |
Readline key bindings (Bash, psql, many REPLs). |
~/.vimrc, ~/.nanorc |
Editor settings. |
~/.gitconfig |
Global Git settings (name, e-mail, aliases). |
~/.ssh/ |
Keys, config, known_hosts, authorized_keys (mode 700). |
~/.config/, ~/.local/share/, ~/.cache/ |
XDG config, data and cache. |
Edge cases: Bash reads the first existing of .bash_profile, .bash_login, .profile for login shells, and does not read .bashrc unless a login file sources it. Terminals started from a graphical session are often non-login shells.
Usage notes
- Permissions: keep
~/.sshat 700 and private keys at 600; SSH refuses keys that other users can read. Files holding tokens (.netrc,.aws/credentials,.npmrc) deserve the same care. - Reload without logging out:
source ~/.bashrc(or. ~/.bashrc). Environment changes apply to the current shell only. - Back them up: keep dotfiles in a Git repository and link them into place with
ln -s, a pattern called "dotfiles repo". Never commit secrets. - New users get a starting set from
/etc/skel. Editing/etc/skelaffects only accounts created afterwards. - System-wide equivalents:
/etc/bash.bashrc,/etc/profileand/etc/profile.d/*.sh; user files run after them and can override. - Safe deletion: removing a dotfile resets that program to defaults, so rename it first (
mv ~/.vimrc ~/.vimrc.bak) when troubleshooting. - Hidden does not mean secret. Anyone who can read the directory can list dotfiles.