GICT knowledge base
How to Find and Manage Hidden Files in Linux: Complete Guide
Published
Linux treats hidden files differently than most other operating systems. If you’re new to Linux or coming from Windows or macOS, you may be surprised to learn that important configuration files, user preferences, and system settings are stored in files and directories that are “hidden” by default. These hidden files play a crucial role in customizing your environment and keeping your system organized.
Understanding how to find, view, create, and manage hidden files is essential for troubleshooting, personalizing your system, and even securing private information. Whether you prefer the terminal or a graphical interface, this guide will show you every method you need to work confidently with hidden files in Linux.
Table of Contents
- What Are Hidden Files in Linux?
- Why Does Linux Use Hidden Files and Folders?
- How to Find Hidden Files in Linux
- How to View and Edit Hidden Files
- How to Create Hidden Files and Folders
- How to Rename Files to Hide or Unhide Them
- How to Search for Hidden Files Recursively
- How to Manage and Clean Up Hidden Files
- Common Hidden Files and Their Purposes
- Troubleshooting Hidden File Issues
- Frequently Asked Questions (FAQ)
- Conclusion
1. What Are Hidden Files in Linux?
In Linux, hidden files are any files or directories whose names begin with a period (.). This naming convention makes them invisible to standard file and directory listings by default. For example:
.bashrc.profile.ssh/
These files and folders are not encrypted or specially protected—they’re simply not shown unless you request them.
2. Why Does Linux Use Hidden Files and Folders?
Hidden files serve several important purposes:
- Configuration: Many applications and shells (like Bash or Zsh) store user-specific settings in hidden files.
- Organization: Keeping configuration files hidden declutters your home directory.
- Security/Privacy: Hiding files reduces the risk of accidental modification or deletion.
- Convention: Scripts, system utilities, and installers expect to find settings and histories in hidden files.
3. How to Find Hidden Files in Linux
Using the Terminal
a. Showing Hidden Files with ls
The ls command lists directory contents. By default, it skips hidden files.
To see hidden files, use the -a (all) flag:
ls -a
Output example:
. .. .bashrc .profile Documents Pictures
Here, . refers to the current directory and .. to the parent directory.
b. Listing Only Hidden Files
To list only hidden files and directories (excluding . and ..):
ls -d .[^.]*
c. Showing Details About Hidden Files
Add the -l flag for a detailed list:
ls -la
This shows permissions, ownership, size, and modification time for all files, including hidden ones.
Using Graphical File Managers
GNOME Files (Nautilus), Dolphin, Thunar, etc.
Show hidden files: Press Ctrl+H in the file manager window.
Menu option: Look for “Show Hidden Files” or similar in the View menu.
Hidden files and folders will appear slightly faded or lighter in color.
4. How to View and Edit Hidden Files
With Terminal Editors
- nano:
nano ~/.bashrc - vim:
vim ~/.bashrc - emacs:
emacs ~/.bashrc
Just specify the hidden file’s path as you would with any other file.
With GUI Editors
gedit (GNOME): Press Ctrl+O to open a file, press Ctrl+H to show hidden files, and select the file.
Kate, Sublime Text, VS Code, etc.: Use the Open dialog and enable “Show Hidden Files” or press the relevant shortcut (often Ctrl+H).
5. How to Create Hidden Files and Folders
Using the Terminal
To create a hidden file:
touch .myhiddenfile
To create a hidden directory:
mkdir .myhiddendir
Using the Graphical Interface
When creating or renaming a file/folder, simply start the name with a period (.), e.g., .notes.
6. How to Rename Files to Hide or Unhide Them
Hiding an Existing File
Add a period at the start of the filename:
mv myfile.txt .myfile.txt
Unhiding a File
Remove the leading period:
mv .myfile.txt myfile.txt
You can use this trick to quickly hide or reveal files.
7. How to Search for Hidden Files Recursively
If you want to find hidden files inside subdirectories, use the find command:
Find all hidden files in your home directory:
find ~ -type f -name ".*"
Find all hidden directories:
find ~ -type d -name ".*"
Find hidden files only at the current directory level:
find . -maxdepth 1 -type f -name ".*"
8. How to Manage and Clean Up Hidden Files
a. Knowing What to Delete
Important: Be careful before deleting hidden files or folders. Many contain application settings or history. Deleting them can reset configuration, lose saved passwords, or affect system behavior.
- Safe to delete:
.cache/(temporary files).thumbnails/(image previews)- Old config folders for uninstalled applications
- Be cautious with:
.bashrc,.profile,.ssh/,.config/(user and system configuration)
b. Backing Up and Restoring Hidden Files
Before making major changes, back up your dotfiles:
cp ~/.bashrc ~/Documents/bashrc_backup
cp -r ~/.config ~/Documents/config_backup
You can restore at any time:
cp ~/Documents/bashrc_backup ~/.bashrc
Advanced users often use Git to version-control their dotfiles for portability.
9. Common Hidden Files and Their Purposes
Here are some typical hidden files and directories you’ll encounter in your home directory:
.bashrc,.bash_profile,.profile– Bash shell configuration.zshrc– Zsh shell configuration.vimrc– Vim editor settings.config/– Application settings (used by many modern apps).ssh/– SSH keys and configuration.gitconfig,.gitignore– Git settings and ignore lists.mozilla/– Firefox settings and cache.local/– User-specific data and binaries.thumbnails/,.cache/– Temporary and cached files.Trash/– Deleted files (on some systems)
10. Troubleshooting Hidden File Issues
Can’t See Hidden Files in GUI
Make sure you pressed Ctrl+H or enabled “Show Hidden Files” in the menu.
Some file managers may have a different shortcut (consult the documentation).
Accidentally Deleted a Hidden File
Check your Trash or use a backup if you have one.
Restore a default config (e.g., copy /etc/skel/.bashrc to your home directory).
Editing Fails: Permission Denied
Some hidden files (like system-wide configs) require administrative rights. Use sudo carefully:
sudo nano /etc/.hiddenfile
For your own files, make sure you have ownership:
chown yourusername:yourusername ~/.myhiddenfile
Shell or Program Behaving Strangely After Edit
Syntax errors in files like .bashrc can break your shell.
To test, start a new terminal or run:
bash --norc
Restore from backup or generate a new default config.
11. Frequently Asked Questions (FAQ)
- Q: Are hidden files more secure than normal files?
A: No. Hidden files are simply not shown by default. They can still be accessed and read by anyone with the right permissions. - Q: Can I password-protect a hidden file?
A: Hiding a file does not encrypt it or protect it from others on your system. Use file permissions or encryption (like gpg) for sensitive data. - Q: Why do some hidden files have double dots (..)?
A: The single dot (.) means “current directory,” double dot (..) means “parent directory.” These are not hidden files but navigation shortcuts. - Q: How do I make all files, including hidden ones, show by default in the terminal?
A: Create an alias in your .bashrc:
alias ls='ls -a'
Reload your shell or runsource ~/.bashrc. - Q: Can I search for a specific hidden file by name?
A: Yes! Usefind:
find ~ -name ".myhiddendir"
12. Conclusion
Hidden files are everywhere in Linux, quietly storing your application settings, shell configurations, and user data. Learning how to find and manage these files gives you more control over your environment, lets you personalize your workflow, and helps you troubleshoot problems with confidence.
Whether you use the terminal or a graphical file manager, you now know how to list, view, edit, create, and clean up hidden files and folders. With a little caution and regular backups, you can safely manage your dotfiles and keep your Linux system running smoothly.
Related guides
How to Set Up zram on a Small VPS
Configure zram on Ubuntu with kernel and swap checks. Understand compressed memory limits, monitor real use and avoid unsafe swap-file changes.
LinuxHow to Find Services That Need a Restart After Updates with needrestart
Find services using outdated libraries with needrestart on Ubuntu. Read restart reports, review automatic restart policy and plan maintenance safely.
LinuxHow to Limit a Linux Service’s Memory with systemd
Limit a Linux service with systemd MemoryHigh, MemoryMax and swap controls. Check cgroup support, diagnose pressure and remove only your own policy.
LinuxHow to Protect SSH with CrowdSec on Ubuntu
Protect SSH with CrowdSec on Ubuntu. Connect log detection to firewall enforcement and test temporary blocking without losing administrator access.
