Helpful when managing your system
Are you looking for a way to access hidden files and folders in Linux?
You might be surprised to learn that Linux has several hidden files that are not visible by default. These files usually start with a dot (such as .config) and are often used to store configuration settings, user preferences, or system information.
If you want to know how to show hidden files in Linux, follow the steps below.
How to Show Hidden Files Using the ls Command
The easiest way to show hidden files in Linux is to use the ls command with the -a option via the Linux terminal. The ls command lists the contents of a directory, and the -a option shows all files, including hidden ones.
To show hidden files in your current directory, open a terminal and type: ls -a.
To show hidden files in a different directory, specify the path after the command: ls -a /path/to/directory.
For example, to show hidden files in your home directory, type this command: ls -a ~. You should see the hidden files marked with a dot (.) at the beginning of their names.
If you want to show only hidden files and not regular ones, you can use the -d option with a wildcard pattern, such as ls -d .*
The -d option tells ls to list directories as plain files, while the .* pattern matches any file that starts with a dot.
How to Show Hidden Files Using the find Command
Another way to show hidden files in Linux is to use the find command. The find command searches for files that match specific criteria and performs actions on them.
To show hidden files in your current directory using find, type the following into a new terminal window:
find . -maxdepth 1 -name “.*”
The dot (.) specifies the current directory as the starting point, the -name “.*” option matches any file that starts with a dot, and the -maxdepth 1 option limits the search to only the current directory level (and ignores any further subdirectories).
To show hidden files in a different directory using find, replace the . with the path of the directory:
find /path/to/directory -maxdepth 1 -name “.*”
You can also use find to show hidden directories by adding the -type d option:
find /path/to/directory -maxdepth 1 -name “.*” -type d
This will only show hidden directories, however. It will ignore any files (including hidden files).
How to Show Hidden Files Using a GUI File Manager
You can use a graphical file manager instead of a terminal. The exact steps may vary depending on your Linux distro, desktop environment, and preferred file manager.
However, if you’re running Ubuntu or Debian, you can open the Files app and press Ctrl + H using your keyboard. Alternatively, press the Menu icon > Show Hidden Files from the menu bar. You should see the hidden files appear in your file manager window.
To hide them again, repeat the same steps—the files will disappear.
How to Show Hidden Files Using the tree Command
The tree command is a useful tool to display the directory structure of a given path in a tree-like format. You can also use it to show hidden files in Linux by adding the -a option.
To show hidden files in your current directory using tree, type:
tree -a
To show hidden files in a different directory using tree, specify the path after the command:
tree -a /path/to/directory
You should see the hidden files marked with a dot (.) at the beginning of their names and parent directories.
Show Hidden Files Using the stat Command
The stat command is another way to show hidden files in Linux. The stat command shows detailed information about a file or a file system, such as size, permissions, ownership, timestamps, etc.
To show hidden files in your current directory using stat, type:
stat .*
The .* pattern matches any file that starts with a dot. This will identify obvious hidden files. To show hidden files in a different directory using stat, specify the path before the pattern:
stat /path/to/directory/.*
You should see the information about each hidden file in your terminal.
How to Hide Files and Folders in Linux
Want to quickly hide your own files or folders on a Linux PC? You can quickly do so by renaming them with a single dot at the beginning of their names. This will make them invisible to most applications and commands.
To hide a file or folder using a terminal, use the mv command via the terminal. For example:
mv filename .filename
Replace filename with the name of the file or folder you want to hide, and .filename with the new name starting with a dot. If it doesn’t work, try sudo mv filename .filename instead.
If you’d prefer to use a GUI file management tool to do this, locate the file or folder in your preferred app. Right-click it, then select Rename. Add a single dot to the beginning of its name before pressing Enter on your keyboard to save the changes.
Managing Your Files on Linux
If you’re trying to locate hidden files on your Linux PC, the steps above will help you do it. You can then navigate the Linux file structure and manage your files further.
For instance, you can use the chmod command to update file permissions for certain files and folders. If you’ve found any files or folders that you no longer want to keep, you can always delete the files from your Linux PC next.