How to Show Hidden Files in Linux

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 thelscommand with the-aoption via the Linux terminal. Thelscommand 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-doption with a wildcard pattern, such asls -d .*

The-doption 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 thefindcommand. 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 1option 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 doption:

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 varydepending on your Linux distro, desktop environment, and preferred file manager.

However, if you’re running Ubuntu or Debian, you can open theFilesapp and pressCtrl + Husing your keyboard. Alternatively, press theMenu icon>Show Hidden Filesfrom 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

Thetreecommand 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-aoption.

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. Thestatcommand 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 themvcommand via the terminal. For example:

mv filename .filename

Replacefilenamewith the name of the file or folder you want to hide, and.filenamewith the new name starting with a dot. If it doesn’t work, trysudo mv filename .filenameinstead.

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 selectRename. Add a single dot to the beginning of its name before pressingEnteron 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 thennavigate the Linux file structureand manage your files further.

For instance, you canuse the chmod commandto 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 alwaysdelete the files from your Linux PCnext.

Ben Stockton is a freelance technology writer based in the United Kingdom. In a past life, Ben was a college lecturer in the UK, training teens and adults. Since leaving the classroom, Ben has taken his teaching experience and applied it to writing tech how-to guides and tutorials, specialising in Linux, Windows, and Android. He has a degree in History and a postgraduate qualification in Computing.Read Ben’s Full Bio

Welcome to Help Desk Geek- a blog full of tech tips from trusted tech experts. We have thousands of articles and guides to help you troubleshoot any issue. Our articles have been read over 150 million times since we launched in 2008.

HomeAbout UsEditorial StandardsContact UsTerms of Use

Copyright © 2008-2024 Help Desk Geek.com, LLC All Rights Reserved