Troubleshooting a configuration error often begins with the terminal command to show hidden files in Linux. Knowing how to show hidden files in Linux is a fundamental skill for anyone managing a system, editing config files, or cleaning up user directories. Hidden files, which start with a dot (.), are not displayed by default in file managers or the ls command, but they hold critical settings and data.
This guide covers every method you need. You will learn the terminal commands, GUI tricks, and even how to handle special cases. Whether you are a beginner or a seasoned admin, these steps will save you time and frustration.
How To Show Hidden Files In Linux Using The Terminal
The terminal is the most powerful way to manage hidden files. It works on any distribution and gives you full control. Here are the primary commands you need to know.
Using The Ls Command With The -A Flag
The ls command lists directory contents. To show hidden files, add the -a flag. This flag stands for “all” and includes every entry except the current (.) and parent (..) directories.
- Open your terminal emulator.
- Navigate to the directory you want to inspect using
cd. - Type:
ls -a - Press Enter. You will see all files, including those starting with a dot.
For a cleaner view, combine flags. The ls -la command shows hidden files in a long format with permissions, sizes, and dates. This is ideal for troubleshooting.
Example output might look like this:
drwxr-xr-x 5 user user 4096 Jan 15 10:30 .
drwxr-xr-x 3 user user 4096 Jan 15 10:30 ..
-rw-r--r-- 1 user user 220 Jan 15 10:30 .bashrc
-rw-r--r-- 1 user user 120 Jan 15 10:30 .profile
drwxr-xr-x 2 user user 4096 Jan 15 10:30 .ssh
The dot files are now visible. This method works on all Linux distributions, including Ubuntu, Fedora, and Debian.
Using The Ls Command With The -A Flag
Sometimes you want to exclude the . and .. entries. Use the -A flag (capital A) instead. It lists almost all files but omits those two special directories.
Command: ls -A
This is cleaner for scripting or when you only need user-created hidden files. Combine with -l for details: ls -lA.
Using The Find Command To Locate Hidden Files
The find command is more flexible. You can search for hidden files recursively across the entire system or within a specific folder.
To find all hidden files in the current directory:
find . -name ".*" -maxdepth 1
To search recursively:
find /home/username -name ".*"
You can also filter by type. For example, to find only hidden directories:
find . -name ".*" -type d
This is useful for locating configuration folders like .config or .cache.
How To Show Hidden Files In Linux Using A File Manager
Not everyone lives in the terminal. Most desktop environments offer a simple way to toggle hidden files. The exact shortcut varies, but the principle is the same.
Using The Ctrl+H Shortcut
The universal shortcut in most file managers (Nautilus, Thunar, Dolphin, Nemo) is Ctrl+H. Press it once to show hidden files, press it again to hide them.
This works immediately without any menu navigation. It is the fastest GUI method.
Using The View Menu
If you prefer menus, look for a “Show Hidden Files” option. In Nautilus (GNOME), click the hamburger menu (three lines) and check “Show Hidden Files.” In Dolphin (KDE), go to View > Show Hidden Files.
Some file managers also have a gear icon or a “View” dropdown. The option is usually labeled “Show Hidden Files” or “Show Dotfiles.”
Enabling Hidden Files Permanently In Nautilus
If you want hidden files always visible, you can set a dconf key. This is a permanent change for the current user.
- Open a terminal.
- Install
dconf-editorif not present:sudo apt install dconf-editor(Debian/Ubuntu) orsudo dnf install dconf-editor(Fedora). - Run:
dconf-editor - Navigate to
org > gnome > nautilus > preferences. - Check the box for
show-hidden-files.
Now Nautilus will always display hidden files. You can revert by unchecking the box.
How To Show Hidden Files In Linux Using The Grep Command
When you need to filter output from other commands, grep helps. For instance, to list only hidden files from a long ls output:
ls -la | grep "^\."
The caret (^) anchors the pattern to the start of the line. This prints only lines starting with a dot. It is handy for scripting or when you want a concise list.
You can also use find with grep to search for hidden files with specific names:
find . -type f | grep "^\."
How To Show Hidden Files In Linux Using The Tree Command
The tree command displays directory structures visually. To include hidden files, use the -a flag.
tree -a
This shows all files and folders, including dotfiles. You can limit depth with -L. For example, tree -a -L 2 shows two levels deep.
If tree is not installed, install it via your package manager: sudo apt install tree or sudo dnf install tree.
How To Show Hidden Files In Linux Using The Nautilus File Manager
Nautilus is the default file manager for GNOME. Besides the Ctrl+H shortcut, you can also use the menu.
Click the three horizontal lines (hamburger menu) in the top-right corner. Select “Show Hidden Files.” A checkmark appears next to it. Repeat to hide them again.
In older versions, the option was under Edit > Preferences. But the modern method is faster.
How To Show Hidden Files In Linux Using The Dolphin File Manager
Dolphin is the default for KDE Plasma. The shortcut is also Ctrl+H. Alternatively, click the “View” menu and check “Show Hidden Files.”
Dolphin also has a permanent setting. Go to Settings > Configure Dolphin > General tab. Under “Behavior,” check “Show hidden files.” This applies to all future sessions.
How To Show Hidden Files In Linux Using The Thunar File Manager
Thunar is lightweight and used in XFCE. Press Ctrl+H to toggle. Or go to View > Show Hidden Files.
There is no permanent setting in Thunar’s preferences, but you can use a keyboard shortcut or remember to press Ctrl+H each time.
How To Show Hidden Files In Linux Using The Terminal With Wildcards
Sometimes you want to copy or move only hidden files. Wildcards make this easy.
To list all hidden files in the current directory:
echo .*
This expands to all entries starting with a dot. Be careful: it includes . and ... To exclude them, use .[!.]* or .??* patterns.
For example, to copy all hidden files to another directory:
cp .[!.]* /path/to/destination/
This pattern matches any file starting with a dot followed by a non-dot character. It avoids . and ...
How To Show Hidden Files In Linux Using The Bash Shell Expansion
Bash has a feature called “dotglob” that makes wildcards match hidden files. Enable it with:
shopt -s dotglob
Now ls * will show all files, including hidden ones. To disable it:
shopt -u dotglob
This is useful in scripts where you need to iterate over all files. Remember to reset the option if needed.
How To Show Hidden Files In Linux Using The Ls Command With The -L Flag
The -l flag provides a long listing. Combined with -a, it shows hidden files with details. This is the standard command for inspection.
ls -la
You can also sort by time or size. For example, ls -lat sorts by modification time (newest first). ls -laS sorts by size.
How To Show Hidden Files In Linux Using The Ls Command With The -R Flag
The -R flag stands for recursive. It lists subdirectories as well. Combine with -a to see all hidden files in a directory tree.
ls -laR
This can produce a lot of output. Pipe it to less for easier reading:
ls -laR | less
How To Show Hidden Files In Linux Using The Stat Command
The stat command shows detailed information about a file. It does not list files, but you can use it on a hidden file you already know exists.
stat .bashrc
This displays permissions, size, timestamps, and more. Useful for verifying a hidden file’s properties.
How To Show Hidden Files In Linux Using The Lsblk Command
The lsblk command lists block devices. It does not show hidden files directly, but it can list mounted filesystems where hidden files reside. This is a stretch, but included for completeness.
For hidden files on a mounted drive, first check the mount point with lsblk, then navigate there and use ls -a.
Common Mistakes When Showing Hidden Files
New users often confuse hidden files with system files. Hidden files are simply files with a dot prefix. They are not inherently protected. You can delete or edit them, but doing so may break applications.
Another mistake is forgetting that ls -a includes . and ... Use ls -A if you want to exclude them.
Some file managers do not show hidden files by default. If you cannot see them, try the shortcut or menu option. If still not visible, check if the file manager is configured to hide them permanently.
How To Show Hidden Files In Linux For Specific Users
Hidden files are user-specific. Each user has their own home directory with dotfiles like .bashrc, .profile, and .ssh. To see another user’s hidden files, you need root privileges or be in the same group.
Use sudo ls -la /home/otheruser/ to view them. Be respectful of privacy.
How To Show Hidden Files In Linux In Recovery Mode
When booting into recovery mode, you may need to access hidden configuration files to fix boot issues. Use the terminal with ls -la on the root filesystem.
Mount the root partition first if it is not already mounted:
mount -o remount,rw /
Then navigate and use ls -la to find files like .bashrc or .config.
Frequently Asked Questions
How Do I Show Hidden Files In Linux Using The Terminal?
Use the ls -a or ls -A command. The -a flag shows all files including . and .., while -A excludes them. For a detailed view, use ls -la.
What Is The Shortcut To Show Hidden Files In Linux File Manager?
The universal shortcut is Ctrl+H. It works in Nautilus, Dolphin, Thunar, and most other file managers. You can also use the View menu.
How Do I Show Hidden Files Permanently In Linux?
For the terminal, you can alias ls to include -a in your .bashrc file. For file managers like Nautilus, use dconf-editor to set show-hidden-files to true.
Can I Show Hidden Files In Linux Without Using The Terminal?
Yes, use the file manager’s shortcut Ctrl+H or the View menu option. This is the easiest method for beginners.
Why Are Hidden Files Called Dotfiles In Linux?
Because they start with a dot (.) character. The term “dotfile” is informal but widely used. They are hidden by default to reduce clutter in the file system.
Conclusion
Knowing how to show hidden files in Linux is essential for system administration and everyday use. The terminal offers the most control with commands like ls -a, find, and tree. File managers provide a quick toggle with Ctrl+H. Choose the method that fits your workflow.
Practice these commands and shortcuts. They will become second nature. Hidden files are not scary—they are just files with a dot. Now you can see them all.