Working with Hidden Files in Linux

In Linux, a file that has a “.” (dot) at the beginning of its name is said to be a hidden file. The “.bashrc”, “.bash_profile”, “.bash_history”, and “.bash_aliases” files in the home directory are the representation of the hidden files. 

This article will illustrate the explanation of hidden files along with possible examples. 

How to Create a Hidden File and Directory in Linux?

To create a hidden file, utilize the “touch” command by specifying the filename as “.sample.txt” in the following script:

$ touch .sample.txt

Note: Similarly, a hidden directory can be created using the “mkdir” command and the “dot” before the name. as demonstrated below: 

$ mkdir .test

How to View Hidden Files in Linux?

Users can utilize the “ls -a” and “find” commands to view hidden files and directories of a current directory. 

Use ls -a Command

Users can utilize the “ls -la” command to list all files, including hidden files, in a directory. For this, execute the below script in the desired directory:

$ ls -a

The outcome of the above command shows all hidden files and directories in the Linux.

Using find Command

You can view hidden files and directories using the “find” command in the terminal. For this,  the “/home/itslinuxfoss” path is specified:

$ find /home/itslinuxfoss -name ".*"

It explores all files and directories starting with a dot(.) in the “/home/itslinuxfoss” path.

How to Remove the Hidden Files in Linux?

To remove the hidden file or directory from the terminal, utilize the “rm” command by specifying the file name. For instance, “.sample.txt” is considered to remove the hidden file from the terminal: 

$ rm .sample.txt

After executing the above script, the “.sample.txt” file is deleted from the current directory.

Note: To remove the hidden directories, the “rmdir” command can be followed below: 

$ rmdir .test

How to Locate Hidden Files Using File Manager (GUI)?

To locate hidden files using a file manager with a GUI. Open the file manager on the system. Look for an option in the menu bar or toolbar called “View” or “Options.” Within that menu, look for an option to show hidden files or toggle a setting to show hidden files as below:

Once you have enabled this option, the hidden files are visible in the file manager.


The files/directories’ names starting with the “.dot” symbol are referred to as hidden files. Few of these are system defined and serve a specific purpose, i.e., configuration files, while these can also be created and managed by regular users. This post has briefly explained the working of hidden files in a Linux system.