Linux Commands

How to View Hidden Files and Folders on Linux

Linux has applications in both personal and professional purposes. In Linux we can hide files and directories. These hidden files and folders are usually not displayed in the user interface, but they can be accessed through the terminal.

This can be useful for keeping important configuration files or data hidden from casual users. This write-up will cover steps to view hidden files on Linux.

Before we can continue first, we will create a file then hide it later.

How To View Hidden Files and Directories in Linux

To check the files hidden in Linux system we can use:

1: Command Line

Open terminal and list all files inside a directory using:

$ ls

Here we can see a test file along with others.

To hide this test file rename it by just adding a dot (.) in the beginning of command like:

$ mv test.txt .test.txt

After writing this command our test file is now hidden:

Now once again list all the files:

$ ls

Here we can see test file is no longer displayed:

As our test file is now hidden. The ls command along -a flag will list hidden files. The ls shows us all files of directory, and the -a flag tells the command to show all files, including hidden ones. To view the hidden files run below command:

$ ls -a

This will display all files including the hidden ones. Hidden files and folders are usually prefixed with a dot (.) and are not displayed by default in the user interface.

Now we can see that along with other hidden files our test file is also displayed.

2: File Manager Toolbar (GUI)

Second method on the list to view hidden files is by using the file manager toolbar. Open the directory where we want to see hidden files, here we have created a folder with a name test:

First, we will create a hidden folder by renaming it with a name starting with dot (.) and after that this file will be hidden. For example, rename the Test folder as (.Test).

Now we can see the Test folder is hidden:

To unhide select the tool bar option and check the Show Hidden Files option:

It will display all the files that are hidden inside this directory including the Test file. All hidden files are started with a dot(.):

3: Keyboard shortcut (GUI)

Last method on the list is using a keyboard shortcut. Open the directory where you want to read the hidden file. After that press Ctrl+H which will unhide all files and folders, if we press this key again all folders will be hidden again.

Conclusion

Viewing hidden files and folders on Linux can be done through the terminal. The ls command with the -a flag is all you need to display hidden files and folders. Also, we can use a keyboard shortcut or toolbar inside the GUI of file manager. By using these methods, you can gain access to important configuration files and data that are not displayed in the user interface.

About the author

Kashif

I am an Electrical Engineer. I love to write about electronics. I am passionate about writing and sharing new ideas related to emerging technologies in the field of electronics.