Learn how hidden files and dotfiles work on Linux, list them with ls -a and ls -la, find them with the find command, and view them in GUI and terminal file managers like ranger and mc.
Prerequisites
- A Linux server or desktop with terminal access
- A non-root user account with sudo privileges
- Basic familiarity with the command line
What this solves
Linux hides configuration files and directories by prefixing their names with a dot, so your home directory stays uncluttered in everyday listings. This tutorial shows you how to reveal those hidden files from the command line, with the find command, and in both graphical and terminal file managers.
You will also learn what common dotfiles like .bashrc, .ssh, and .config actually do, so you know what is safe to edit and what to leave alone.
Step-by-step guide
Understand the dot-prefix convention
On Linux and other Unix-like systems, any file or directory whose name starts with a dot (.) is treated as hidden. This is not a special file attribute, it is purely a naming convention respected by shells, file managers, and most command-line tools.
Hidden files are commonly used for user-specific configuration, cache data, and state that applications need but that users rarely edit directly. They are not a security mechanism. Anyone with read access to a directory can still see and open dotfiles once they know to look for them.
lsRunning plain ls in your home directory will typically show only a handful of regular files and folders, even though dozens of dotfiles usually exist there.
List hidden files with ls -a
The -a flag tells ls to show all entries, including those starting with a dot. This includes the special entries . (current directory) and .. (parent directory).
ls -aTo exclude the . and .. entries while still showing dotfiles, use -A instead.
ls -AGet detailed output with ls -la
Combining -l (long format) with -a shows permissions, ownership, size, and modification time alongside hidden files. This is the combination most engineers use daily.
ls -laExample output in a typical home directory:
drwx------ 15 alice alice 4096 Mar 10 09:12 .
drwxr-xr-x 5 root root 4096 Jan 5 14:03 ..
-rw------- 1 alice alice 220 Jan 5 14:03 .bash_history
-rw-r--r-- 1 alice alice 220 Jan 5 14:03 .bash_logout
-rw-r--r-- 1 alice alice 3771 Jan 5 14:03 .bashrc
drwx------ 2 alice alice 4096 Feb 20 11:40 .ssh
drwxr-xr-x 8 alice alice 4096 Mar 1 16:22 .configThe first character of each permission string tells you whether the entry is a directory (d) or a regular file (-). Notice that .ssh has permissions drwx------, meaning only the owner can read, write, or enter it. That is intentional and should never be loosened.
Sort and filter hidden file listings
You can combine flags to make large directory listings easier to scan. Sorting by modification time helps you spot recently changed config files.
ls -latTo list only hidden files and directories, excluding regular ones, pipe the output through grep.
ls -la | grep '^\.'A cleaner way to list only top-level dotfiles using shell globbing is:
ls -ld .[!.]*Find hidden files and folders with the find command
The find command searches recursively and is more precise than ls when you need to locate hidden files across an entire directory tree, not just one level.
find . -maxdepth 1 -name ".*"To search recursively through all subdirectories for hidden files only (not hidden directories):
find /home/alice -type f -name ".*"To find only hidden directories:
find /home/alice -type d -name ".*"This is especially useful on a server where you are auditing a user's home directory or a deployment path for leftover configuration or credential files.
find /var/www/example.com -name ".*" -not -path "*/.git/*"The example above excludes anything inside a .git directory, which is useful when a hidden-file search would otherwise be flooded with version control internals.
View hidden files in GUI file managers
Most desktop Linux file managers hide dotfiles by default, matching the command-line convention. The keyboard shortcut to toggle visibility is the same across GNOME Files (Nautilus), KDE Dolphin, and most others.
| File manager | Shortcut to show hidden files | Menu alternative |
|---|---|---|
| GNOME Files (Nautilus) | Ctrl+H | Hamburger menu, Show hidden files |
| KDE Dolphin | Ctrl+H | View menu, Show hidden files |
| Nemo (Cinnamon) | Ctrl+H | View menu, Show hidden files |
| Thunar (XFCE) | Ctrl+H | View menu, Show hidden files |
| Files (Elementary OS) | Ctrl+H | Hamburger menu |
If you are connecting to a remote server over SFTP using a graphical client, the same toggle usually applies to the remote pane as well.
Show hidden files in terminal file managers: ranger
ranger is a terminal-based file manager with vim-style navigation. It hides dotfiles by default.
sudo apt update
sudo apt install -y rangersudo dnf install -y rangerLaunch ranger and press zh to toggle hidden files on or off within the session.
rangerTo make hidden files visible by default, edit the ranger config file.
set show_hidden trueIf the config file does not exist yet, generate the default configuration first.
ranger --copy-config=rcShow hidden files in terminal file managers: Midnight Commander (mc)
Midnight Commander is a classic dual-pane terminal file manager, popular for quick server-side file operations over SSH.
sudo apt update
sudo apt install -y mcsudo dnf install -y mcLaunch mc, then toggle hidden file visibility with the keyboard shortcut or the Options menu.
mcInside mc, press Alt+. (the dot key) to toggle dotfile visibility, or go to Options, Configuration, and check the Show hidden files box to make it permanent.
Understand common hidden files and directories
Once you can see hidden files, it helps to know what the most common ones actually do before you edit or delete anything.
| Path | Purpose |
|---|---|
.bashrc | Per-user shell configuration loaded for interactive non-login bash shells. Aliases, functions, and prompt customizations go here. |
.bash_profile / .profile | Loaded for login shells, often used to set environment variables and then source .bashrc. |
.ssh | Directory holding SSH private keys, public keys, known_hosts, and client config. Must stay at permissions 700 for the directory and 600 for private keys. |
.config | XDG base directory for application configuration files, used by most modern desktop and CLI tools instead of scattering dotfiles directly in the home directory. |
.cache | Application-generated cache data. Usually safe to delete to free disk space, applications will regenerate it. |
.local | User-installed binaries, data, and state following the XDG base directory spec, commonly used by pip and other package managers for per-user installs. |
.gitconfig | Global Git configuration, including your name, email, and aliases. |
.git | Directory inside a repository holding the entire version history and Git internals. Never edit its contents by hand. |
If you are troubleshooting SSH key issues after noticing permission problems in .ssh, see fix SSH too many authentication failures error on Linux.
Check disk usage hidden in dotfiles and dot-directories
Hidden directories like .cache, .local, and .config can silently consume significant disk space over time, especially on development machines or build servers.
du -sh ~/.cache ~/.local ~/.config 2>/dev/nullFor a broader view of disk usage across your filesystem, see check disk space usage on Linux with df and du commands.
Verify your setup
Confirm that hidden files are visible and correctly identified with these commands.
ls -la ~ | head -20
find ~ -maxdepth 1 -name ".*" -type f
find ~ -maxdepth 1 -name ".*" -type dIf you configured ranger or mc to always show hidden files, relaunch the tool and confirm dotfiles appear without pressing the toggle shortcut.
grep show_hidden ~/.config/ranger/rc.confCommon issues
| Symptom | Cause | Fix |
|---|---|---|
ls -a shows nothing extra | Directory genuinely has no dotfiles, or you are not in the expected directory | Run pwd to confirm location, then check your actual home directory with echo $HOME |
| GUI file manager toggle does not persist | Some file managers only remember the setting per session or per folder | Check the application's own preferences dialog rather than relying only on the keyboard shortcut |
find returns permission denied errors | Searching directories owned by other users without sufficient privileges | Run with sudo find only when necessary, or scope the search to directories you own |
.ssh directory flagged as insecure by SSH client | Permissions were changed to something broader than 700 | Run chmod 700 ~/.ssh and chmod 600 ~/.ssh/id_rsa to restore correct permissions |
| ranger does not show dotfiles even after editing config | Editing the wrong config path or a typo in the setting name | Confirm the file is at ~/.config/ranger/rc.conf and the line reads exactly set show_hidden true |
chmod 700 for .ssh and chmod 600 for private key files, and fix ownership issues with chown $(whoami):$(whoami) ~/.ssh -R instead of loosening permissions.Next steps
- Configure Linux file and directory ownership with chown and security best practices
- Configure Linux file permissions and access control with umask and chmod best practices
- Configure SSH key authentication and disable password login for secure server access
- Configure shell aliases and functions for development productivity
- Configure Linux environment variables and PATH management for development workflows