How To Hide Files And Directories In Linux

How To Hide Files And Directories In Linux

This tutorial post will teach you the method to hide files and directories in Linux based operating system. Let me share you the quick information about the Linux file system.

In Unix-like systems, File or directory having name with a (.) in front will get hidden by default.

For example: The folder name-> .omgfoss will get hidden by default.

How To Hide Files And Directories In Linux

How To Hide Files In Linux

As we told that the file name with dot in front will get hidden by default. In-order to hide a file in Linux, rename it with a period (.) at the start of its name. Let’s take an example of the file name omgfoss.txt

We are using mv command to rename the file.

mv foo.txt .foo.txt

You can verify it by running the following command:ls
ls -al

How To Hide Folders Or Directories In Linux

You need to rename the folders name with the help of mv command. Let’s take an example of folder linux-tutorial.

mv -v linux-tutorial .linux-tutorial
mv -v dir1 .dir1
mv -v dir2 .newdir2

Meanwhile, It’s pretty simple to unhide the files or folders in Linux.

You can remove the period (.) from the file name so that it will be visible.

To unhide the folder:

READ More Relevant Stuff:  Linux 5.2 Released : Update Linux Kernel In Ubuntu

mv -v .linux-tutorial linux-tutorial

To unhide the file:

mv -v .omgfoss.txt omgfoss.txt

How to hide and password protect my files

To encrypt a single file, use the gpg command:
gpg -c omgfoss.txt

Now hide it:
mv -v omgfoss.txt.gpg .omgfoss.txt.gpg

Now, You need to remove the original file.

rm omgfoss.txt
ls -la

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

    Your email address will not be published. Required fields are marked *