Find and view hidden files and directories on Linux

Beginner 15 min Nov 05, 2026
Ubuntu 24.04 Ubuntu 22.04 Debian 12 Debian 11 AlmaLinux 9 Rocky Linux 9 Fedora 41

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.

ls

Running 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 -a

To exclude the . and .. entries while still showing dotfiles, use -A instead.

ls -A

Get 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 -la

Example 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 .config

The 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 -lat

To 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 managerShortcut to show hidden filesMenu alternative
GNOME Files (Nautilus)Ctrl+HHamburger menu, Show hidden files
KDE DolphinCtrl+HView menu, Show hidden files
Nemo (Cinnamon)Ctrl+HView menu, Show hidden files
Thunar (XFCE)Ctrl+HView menu, Show hidden files
Files (Elementary OS)Ctrl+HHamburger 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 ranger
sudo dnf install -y ranger

Launch ranger and press zh to toggle hidden files on or off within the session.

ranger

To make hidden files visible by default, edit the ranger config file.

set show_hidden true

If the config file does not exist yet, generate the default configuration first.

ranger --copy-config=rc

Show 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 mc
sudo dnf install -y mc

Launch mc, then toggle hidden file visibility with the keyboard shortcut or the Options menu.

mc

Inside 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.

PathPurpose
.bashrcPer-user shell configuration loaded for interactive non-login bash shells. Aliases, functions, and prompt customizations go here.
.bash_profile / .profileLoaded for login shells, often used to set environment variables and then source .bashrc.
.sshDirectory holding SSH private keys, public keys, known_hosts, and client config. Must stay at permissions 700 for the directory and 600 for private keys.
.configXDG base directory for application configuration files, used by most modern desktop and CLI tools instead of scattering dotfiles directly in the home directory.
.cacheApplication-generated cache data. Usually safe to delete to free disk space, applications will regenerate it.
.localUser-installed binaries, data, and state following the XDG base directory spec, commonly used by pip and other package managers for per-user installs.
.gitconfigGlobal Git configuration, including your name, email, and aliases.
.gitDirectory 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/null

For 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 d

If 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.conf

Common issues

SymptomCauseFix
ls -a shows nothing extraDirectory genuinely has no dotfiles, or you are not in the expected directoryRun pwd to confirm location, then check your actual home directory with echo $HOME
GUI file manager toggle does not persistSome file managers only remember the setting per session or per folderCheck the application's own preferences dialog rather than relying only on the keyboard shortcut
find returns permission denied errorsSearching directories owned by other users without sufficient privilegesRun with sudo find only when necessary, or scope the search to directories you own
.ssh directory flagged as insecure by SSH clientPermissions were changed to something broader than 700Run chmod 700 ~/.ssh and chmod 600 ~/.ssh/id_rsa to restore correct permissions
ranger does not show dotfiles even after editing configEditing the wrong config path or a typo in the setting nameConfirm the file is at ~/.config/ranger/rc.conf and the line reads exactly set show_hidden true
Never use chmod 777 on hidden directories like .ssh or .config. Doing so gives every user on the system read, write, and execute access to your private keys and application settings. Use 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.
Note: Hidden files are a display convention, not a security control. Never rely on a dot prefix to protect sensitive data. Use correct file permissions and ownership for that.

Next steps

Running this in production?

Want this handled for you? This works for a single server. When you run multiple environments or need consistent configuration across a fleet of machines, keeping dotfiles, permissions, and SSH access correct everywhere is a different job. See how we run infrastructure like this for European teams.
#hidden files #dotfiles #ls command #find command #file management #ranger #midnight commander

Don't want to manage this yourself?

We handle infrastructure for businesses that depend on uptime. Fully managed, with one fixed contact who knows your setup.

You get one fixed contact who knows your setup

At their desk in Rotterdam 12:27 · reachable in a message, no ticket form

Learn more: managed cloud infrastructure