In Linux, any file or folder that starts with a dot (.) is treated as hidden. These hidden items are usually configuration or system files, and they don’t show up in regular directory views. But don’t worry—if you need to see them, Linux makes it easy to reveal hidden files, whether you’re using the command line or a file manager. In this guide, we’ll walk you through the steps to uncover hidden files and folders in Linux.
How to Show Hidden Files and Directories in Linux
1. Using the Command Line
The command line is one of the most powerful tools in Linux. To display hidden files and directories, you can use the ls command with specific options.
a. The ls -a
Command
The -a
option in the ls
command lists all files, including hidden ones. Here’s how to use it:
- Open a terminal window.
- Navigate to the directory you want to inspect using the
cd
command.cd /path/to/directory
- Type the following command and press Enter:
ls -a
You will see a list of all files, including those that start with a dot (.).
b. The ls -al
Command
The -l
option provides a detailed view, showing file permissions, ownership, size, and modification date. Combine it with -a
to include hidden files:
ls -al
This will display detailed information for all files, hidden and visible.
2. Using File Managers
Most Linux desktop environments come with graphical file managers, and they have an option to show hidden files. Below are the steps for common file managers:
a. GNOME Files (Nautilus)
- Open the file manager.
- Press
Ctrl + H
on your keyboard. Hidden files and directories will appear immediately. - To hide them again, press
Ctrl + H
once more.
Alternatively, you can use the menu:
- Click on the three-dot menu (or hamburger menu) in the top-right corner.
- Select Show Hidden Files.
b. Dolphin (KDE)
- Open Dolphin.
- Press
Alt + .
on your keyboard to toggle hidden files. - To hide them again, press
Alt + .
once more.
You can also use the menu:
- Click on Control > Show Hidden Files.
c. Thunar (XFCE)
- Open Thunar.
- Press
Ctrl + H
to display hidden files. - Repeat
Ctrl + H
to hide them.
d. Other File Managers
For other file managers, check the preferences or settings menu. The option is usually labeled as Show Hidden Files or something similar.
3. Using find
Command
The find
command is another powerful tool to locate hidden files. It is especially useful for searching hidden files in subdirectories.
Command Example
To find all hidden files in a directory and its subdirectories:
find /path/to/directory -name ".*"
This command searches for all files and directories that start with a dot in the specified path.
4. Why Hidden Files Are Important
Hidden files often contain important configuration settings. For example:
.bashrc
— Configuration file for the Bash shell..ssh/
— Directory storing SSH keys and configurations..config/
— Directory storing application-specific settings.
While hidden files are essential, modifying or deleting them without understanding their purpose can lead to system or application issues. Always be cautious when working with them.
5. Tips for Managing Hidden Files
- Use
ls -a
orCtrl + H
to check hidden files before making changes. - Backup important hidden files like
.bashrc
before editing them. - Avoid exposing hidden files unnecessarily, especially on shared or public systems.
Finding hidden files and folders in Linux is pretty straightforward. Whether you prefer using the command line or a graphical file manager, you can quickly switch between showing and hiding these files. Getting familiar with hidden files can be super helpful—whether you’re troubleshooting a problem, tweaking system settings, or just curious about how Linux works under the hood. Just a heads-up: be careful when working with these files, since they often hold important system configurations.