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

or

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

Conclusion

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

Linux Topics 0 Comments

What Is aptitude And How To Use It?

This post was last updated on August 1st, 2020 at 10:51 pmI already briefly discussed aptitude which is a debian package manager. In this article, we will see it in

How To 0 Comments

How To Create A Password Protected Zip Archive In Linux?

This post was last updated on August 1st, 2020 at 12:25 pmFiles inside a zip archive can have important data. So you may want to protect it from the unusual

Linux Topics 0 Comments

Top Command Usage With Example In Linux/Unix

This post was last updated on August 1st, 2020 at 08:47 pmThe top is one of the most frequently used command in Unix like operating systems for the administrative tasks.

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply