Linux keeps files with names beginning with a period out of sight until you use the right command. If you’re new to Linux, you might wonder how to see hidden files linux without digging through confusing menus. The good news is that it’s simple, and you can do it from both the command line and your file manager.
Hidden files in Linux are usually configuration files or data that the system uses. They start with a dot (like .bashrc or .gitconfig). These files aren’t maliciously hidden; they’re just kept out of the way to reduce clutter. But when you need to edit them or troubleshoot an issue, you have to know how to reveal them.
In this guide, we’ll cover every method for viewing hidden files in Linux. You’ll learn the terminal commands, the GUI tricks, and some pro tips for managing these files. Let’s get started.
How To See Hidden Files Linux Using The Terminal
The most common way to view hidden files is through the terminal. The ls command lists files in a directory, but by default it skips hidden ones. To include them, you add the -a flag.
Open your terminal and type:
ls -a
This shows all files, including the dot-files. For example, if you run ls -a in your home directory, you’ll see entries like ., .., .bashrc, .profile, and so on.
If you want a more detailed view, combine flags:
ls -la
The -l flag gives you a long listing format with permissions, size, and modification dates. The -a flag shows hidden files. Together, they give you a complete picture.
Another useful variant is ls -A. This shows hidden files but omits the current directory (.) and parent directory (..). It’s cleaner if you don’t need those special entries.
Using The Find Command For Hidden Files
Sometimes you need to locate hidden files across your entire system. The find command is perfect for that. To search for all hidden files in the current directory and subdirectories, run:
find . -name ".*"
This pattern matches any file starting with a dot. You can also specify a directory:
find /home/username -name ".*"
If you want to see only hidden files (not directories), add -type f:
find . -type f -name ".*"
This is usefull when you’re cleaning up old config files or debugging a program that stores data in hidden folders.
Listing Hidden Files With Grep
You can combine ls with grep to filter results. For instance, to list only hidden files in the current directory:
ls -a | grep "^\."
The ^\. pattern matches lines that start with a dot. This is handy if you have many files and only want to see the hidden ones.
However, this method might miss some edge cases. It’s better to stick with ls -a or find for reliability.
How To See Hidden Files Linux In A File Manager
If you prefer a graphical interface, most Linux file managers have a simple toggle. The exact key combination varies, but it’s almost always Ctrl + H.
Here’s how it works in popular file managers:
- Nautilus (GNOME): Press Ctrl + H to show or hide hidden files. You can also click the hamburger menu and select “Show Hidden Files.”
- Dolphin (KDE): Press Alt + . (period) or go to View > Show Hidden Files.
- Thunar (XFCE): Press Ctrl + H or use the View menu.
- PCManFM (LXDE): Press Ctrl + H or select View > Show Hidden.
- Nemo (Cinnamon): Press Ctrl + H or click the menu icon and choose “Show Hidden Files.”
Once you toggle it on, hidden files appear with a slightly faded icon or a different color, depending on your theme. This is the easiest way for beginners to see hidden files without memorizing commands.
Setting File Manager To Always Show Hidden Files
If you work with hidden files often, you can set your file manager to show them permanently. In Nautilus, for example, you can edit the dconf settings:
- Install
dconf-editorif you don’t have it:sudo apt install dconf-editor(on Debian/Ubuntu). - Open dconf-editor and navigate to
org/gtk/settings/file-chooser. - Check the box for
show-hidden.
Alternatively, you can use the terminal to set it globally:
gsettings set org.gtk.Settings.FileChooser show-hidden true
This change affects the file chooser dialog in applications, not just the file manager. For Dolphin, you can set it in the settings under “General” > “Behavior” > “Show hidden files.”
Hidden Files In The File Chooser Dialog
When you open or save a file in an application, the file chooser dialog also hides dot-files by default. To see them, press Ctrl + H inside that dialog. This works in most GTK-based applications.
If you want the file chooser to always show hidden files, use the gsettings command above. It’s a system-wide setting that persists across reboots.
Creating And Editing Hidden Files
Now that you know how to see hidden files, you might need to create or edit them. Creating a hidden file is easy: just start the filename with a dot. For example:
touch .myconfig
This creates an empty hidden file. To edit it with a text editor like nano or vim:
nano .myconfig
Or with a GUI editor:
gedit .myconfig
You can also create hidden directories the same way:
mkdir .config
Many applications store their settings in hidden directories under your home folder, like .config, .local, or .cache.
Renaming A Regular File To Hidden
To make an existing file hidden, simply rename it with a dot prefix:
mv myfile.txt .myfile.txt
This moves the file to the same location but with a new name. Be carefull: if you rename a file that an application expects to find by its original name, it might break.
Why Are Files Hidden In Linux?
The dot-file convention started in the early days of Unix. It was a simple way to keep configuration files out of the way. Over time, it became a standard. Today, hidden files serve several purposes:
- Configuration files:
.bashrc,.profile,.gitconfig - Application data:
.mozilla,.config,.local - System files:
.bash_history,.ssh - Version control:
.gitfolder inside repositories
Hiding them reduces visual noise in your home directory. But when you need to troubleshoot or customize, you must know how to reveal them.
Common Mistakes With Hidden Files
One common error is deleting a hidden file by accident. Since they’re not visible, you might forget they exist. Always double-check before removing files, especially if you’re using wildcards.
Another mistake is forgetting that hidden files are still counted in disk usage. A large hidden directory like .cache can eat up gigabytes of space. Use du -sh .* to check the size of hidden folders.
Also, some commands like rm -rf * do not delete hidden files by default. You need to use rm -rf .* to remove them, but that’s dangerous because it includes . and ...
Advanced Techniques For Viewing Hidden Files
For power users, there are more advanced ways to work with hidden files. You can use the tree command to see the directory structure including hidden files:
tree -a
This shows a tree view with all files. The -a flag includes hidden ones.
If you want to copy all hidden files from one directory to another, use:
cp -r .* /destination/
But be cautious: this copies . and .. as well, which can cause issues. A safer approach is:
cp -r /source/.[!.]* /destination/
This pattern matches files starting with a dot but not the single or double dot entries.
Using Alias For Quick Access
If you find yourself typing ls -a often, create an alias in your .bashrc file:
alias lsa='ls -a'
Then reload the file:
source ~/.bashrc
Now you can just type lsa to see all files. You can also create an alias for ls -la or ls -A.
Hidden Files In Different Linux Distributions
The concept of hidden files is universal across all Linux distributions. Whether you use Ubuntu, Fedora, Debian, Arch, or any other distro, the dot-file rule applies. The commands we’ve covered work on all of them.
However, the file manager shortcuts might differ slightly. For example, in some older versions of Nautilus, you had to use the menu instead of Ctrl+H. Check your distribution’s documentation if the shortcut doesn’t work.
Hidden Files On The Server
If you manage a Linux server without a GUI, the terminal methods are your only option. SSH into the server and use ls -a or find to locate hidden files. This is crucial for editing server configuration files like .htaccess or .env.
Remember that hidden files on a server are just as important as visible ones. A missing .ssh directory can break your SSH key authentication.
Security Implications Of Hidden Files
Some users think hiding files makes them secure. That’s not true. Hidden files are still readable by anyone with the right permissions. The dot prefix is a convenience, not a security feature.
If you need to protect sensitive data, use encryption or proper file permissions. For example, set a file to be readable only by you:
chmod 600 .secretfile
Or use a tool like gpg to encrypt the file.
Malware And Hidden Files
Malicious scripts sometimes hide themselves as dot-files to avoid detection. If you suspect your system is infected, check for unusual hidden files in your home directory and system folders. Use ls -la and look for files with strange names or recent modification dates.
You can also use rkhunter or chkrootkit to scan for rootkits that might hide files.
Frequently Asked Questions
What is the shortcut to show hidden files in Linux?
In most file managers, press Ctrl + H. In the terminal, use ls -a.
How do I permanently show hidden files in Nautilus?
Use the command gsettings set org.gtk.Settings.FileChooser show-hidden true or edit dconf settings.
Can I see hidden files without using the terminal?
Yes, use your file manager’s “Show Hidden Files” option, usually under the View menu or with Ctrl+H.
Why can’t I see hidden files in my file manager?
Make sure you’ve toggled the option. Some file managers require you to press the shortcut again to refresh the view.
Are hidden files the same as system files?
Not exactly. Hidden files are just files starting with a dot. System files can be hidden or visible, depending on their location and purpose.
Summary
Knowing how to see hidden files linux is a basic but essential skill. Whether you use the terminal with ls -a or the GUI with Ctrl+H, the process is straightforward. Hidden files are everywhere in Linux, from your home directory to system folders. They store configurations, user data, and application settings.
We’ve covered multiple methods: the ls command, find, grep, file manager toggles, and advanced techniques like aliases. Each has its use case. For daily work, the terminal is fastest. For beginners, the file manager is more intuitive.
Remember to be careful when deleting or moving hidden files. They’re hidden for a reason, but they’re not invisible. With the knowledge from this guide, you can confidently manage all files on your Linux system, visible or not.