How To Hide Or Display Hidden Files/Directories In Linux?

How To Hide Or Display Hidden Files/Directories In Linux?


This post was last updated on August 1st, 2020 at 01:56 pm

Linux is a multiuser operating system that is getting popular day by day. Many new computer users start using Linux OS on their machines. If you used Windows os previously then you might be familiar with the concept of hiding files and folders.

Now if you want to know how to hide or display a file or directory in a Linux machine then follow this article. Here we will discuss it in a simple and effective way.

How to Hide Files and directories Using Linux terminal?

In Linux when a file or directory name starts with a . (dot) then file or directory becomes hidden by default. So whenever you need to hide a file or directory just rename it and put a dot at the beginning of the name. Suppose there is a file named abc.txt, to hide this file rename it to .abc.txt. Now run the command as it is given below to rename a file –

mv abc.txt .abc.txt

Or if you want to create a new hidden file then use the following command –

touch .abc.txt

To hide a directory named new_dir use –

mv new_dir .new_dir

Or if you want to create a new hidden directory with the name new_dir then use the following command-

mkdir .new_dir

Display the hidden files and directories in terminal

To view the files and directories that are hidden, open your terminal and run the following command –

ls -a


ls -al

As you can see in the above image, there are many files and folders whose name is beginning with a . (dot), these are hidden files and folders.

Hide or display the hidden files In GUI

If you are using GUI then you can toggle show/hide hidden files and folders by using the keyboard shortcut ctrl+h. Or right-click where your hidden files or directories are located and then select show hidden files from the menu. This will display all the hidden files and folders on that location. To hide it again simply untick the show hidden files option. Now, look at the image below –

Remove hidden files and folders

You can easily delete the hidden files and folder using the terminal. Open your terminal and execute the following commands-

First, display and identify the correct file or folder that you want to delete with the –

ls -al

And then to delete a file abc.txt which is marked in the above image use –

rm .abc.txt

To delete a hidden folder or directory named .new_dir use –

rm -r .new_dir


I hope by reading this article you understand the concept of hiding files and folder on a Linux machine. Now if you have any query then you can write to us in the comments below.

Previous How To Install Or Remove A Package With Synaptic Package Manager In Ubuntu/Linux Mint?
Next How To Install Apache Tomcat In Ubuntu 20.04 LTS?

About author

You might also like

How To 0 Comments

How to Capture Boot Time Error Messages

This post was last updated on June 3rd, 2020 at 04:28 pmOne of the easiest ways to capture boot time error messages (when no log file is present) is to

Linux Topics 1Comments

How To Add/Remove A Software Repository In Linux?

This post was last updated on August 3rd, 2020 at 02:56 pmContents1 Software Repository2 Adding a repository in debian based systems3 Remove repository in Debian based systems4 Adding a repository

Linux Topics 0 Comments

How To Extract A Zip File In Linux Using Terminal?

This post was last updated on August 1st, 2020 at 12:26 pmZip is an archive file format that supports lossless data compression. It is available for various platforms. Windows and


No Comments Yet!

You can be first to comment this post!

Leave a Reply