1. Home
  2. Linux

How To Hide Files On Linux And Secure Them

Looking for a way to quickly and efficiently hide files on Linux? Turns out it’s possible and you don’t need to install any additional software to do it. Best of all, users can hide files and folders in two different ways.

Hiding Files – Terminal

Open a terminal and use the CD command to go to the location of the file or folder you want to hide. In this example, we’ll use the Desktop folder.

cd ~/Desktop

Next, list all the items in the directory using the LS command.

ls

LS prints out an entire list of all unhidden items in the directory. Locate the name of the file or folder you’re looking to hide, and remember it. Then, in the terminal, use the MV command to rename the folder. In this example, the file we’ll use is called testfile.gif. The folder we’ll hide is test_folder.

mv testfile.gif .testfile.gif

Not only can the MV command move something from one place to another, but if the user runs MV without telling it to move to another location, it will rename a file. The important part here, is to put a “.” in front of the file. Placing a period in front of any file name will instantly give the file hidden status. The same goes for existing folders.

mv test_folder .test_folder

Want to un-hide a file or folder? Use the MV command, but in reverse:

mv .testfile.gif testfile.gif

or

mv .test_folder test_folder

Make New Hidden Folder With Terminal

To make a new hidden folder, use the mkdir command.

mkdir .hidden_folder

Un-hide the newly created hidden folder with: mv .hidden_folder hidden_folder

Find Hidden Files And Folders With Terminal

You can view hidden files and folders on the file system with the LS command. To start off, use CD to navigate where the hidden items you’d like to view are. In this case, we’ll use ~/Desktop.

cd ~/Desktop

Use the LS command, but this time use the -a switch. The -a switch allows users to list all items, including ones hidden by the system.

ls -a

Hiding Files And Folders – File Manager

Hiding files with the terminal is a great trick, but it’s not the only way to do it. As stated before, the difference between a hidden and visible file or folder on the Linux file system is a period. Here’s how to hide an existing folder with your Desktop Environment’s file manager.

Please keep in mind that each file manager on Linux is a little different, and we can’t possibly write instructions out for each one.

Step 1: Open the file manager, and click on the folder that houses the file/folder you’re looking to hide.

Step 2: Right click on the file/folder and select “rename”.

Step 3: Place a “.” in front of the file/folder name, then press “enter”.

The file or folder will be hidden.

Find Hidden Files And Folders With The File Manager

As stated before, all file managers are different. As a result, settings and options are all over the place. Still, they all have the ability to quickly reveal hidden files and folders on the Linux file-system. To start off, open your file manager to the folder where you’d like to view hidden items.

Next, look around your file manager for “show hidden”, “reveal hidden” or something similar. You may need to go to the settings area, depending on what manager you use.

When the reveal hidden items option is enabled, the file manager will show all hidden files. Hide them again by selecting the option to turn it off.

Secure Hidden Files And Folders

To securely hide files on Linux, add them to a password protected archive. The first thing to do is to open a file manager. Go where the hidden files are with the file manager and reveal them using the method talked about above.

Right click on the hidden files, and select “compress”. Keep in mind that this option in the right-click menu will be different based on desktop environment, file manager, and etc.

As the compression tool opens, select the option to make the archive a ZIP file.

After selecting “ZIP”, click “other options”, “more options” (or whatever your archive manager says) to reveal archive settings. In the password box, enter a secure password, and be sure to click on “encrypt”.

Under the file name of the archive, place a “.” in front. This will ensure the archive file isn’t visible on the file system.

To finish up the process, click the “create” button. This will start the compression process. This may take a bit of time, so be patient. When it finishes, use the methods listed above to find the hidden archive.

Conclusion

Hiding files and folders on Linux is much easier than on other operating systems. It’s crazy useful to know that placing a period before a file or folder can instantly make it invisible.

Leave a comment

  • Thilo Hohl

    Hey, just wondering what kind of GUI you’re using, that looks really sleak!