How to Easily Hide Files and Folders in Linux

Have you ever wanted to hide a file or folder on your Linux file system but have no idea how to do it? Don’t worry, this is not as complicated as it sounds and can be done rather quickly and efficiently. In this guide we’ll go over the simple ways you can effectively hide files and folders in Linux.

Along with hiding things, we’ll go over how to reveal these hidden items in both the terminal as well as file managers in general.

Hiding a file/directory

Hiding a file in the Linux file system is the result of a longstanding bug in Unix-like operating systems. After a while, many people adopted this and considered it a feature. The method for hiding files or a directory is much simpler than on something like Windows. To hide an entire file from view in Linux all that is required is to rename the file and put some text in front of it.

linux-hide-file-by-rename

Find a file or directory you wish to hide with the file manager, and select it. Press F2 (or right-click and select “rename”). Next, place a . directly in front of the file name. Since most file managers hide hidden files by default, the renamed file or directory is now invisible. Do note that files placed in a hidden directory will also be hidden by default.

Viewing hidden files and folders in the terminal

linux-view-hidden-items-in-terminal

The quickest way to view hidden files and folders in any part of the Linux file system is to use the terminal. Yes, it is true that all file managers currently on the Linux platform have an option to “view hidden files,” but this way is for those who prefer to use the terminal to get around. To view these files, start off by using cd to enter the particular directory where you have hidden your files/folders. Next, use the following command to display all the files, be it visible or hidden.

ls -a

The ls command is used to display all items in a current directory, but it doesn’t show hidden items. To view hidden items, the -a switch is needed.

Viewing hidden files and folders in the file manager

linux-hide-show-files-folders-file-managers

File managers on Linux are not created equal. Settings in one manager will differ in another. Regardless of this fact, they all manage to have roughly equivalent features, especially when it comes to showing hidden files. The ability to view hidden files in file managers on Linux is usually tucked away under “View.” To enable this quickly, without digging for settings, try the keyboard shortcut “Ctrl + H” first.

Secure ways to hide files

Using . to hide files and folders is simple and straightforward, but it is also extremely insecure. It is useful if you just want to keep an unimportant files or folders away from plain sight. For security, here are some other ways to hide files/folders:

1. Compressing the files/folders with a password

If you have folders and files that need to be hidden for security’s sake, consider this method instead. First, find the file or folder in the file manager you wish to hide and right-click to compress it. Select “compress.” This brings up the compression tool. By default, “.tar.gz” is selected. Select “.zip” in the drop-down menu.

Under filename, place a . in front to hide it, then enter the filename of the archive.

linux-hide-files-with-locked-archive

Then, select the location you wish the hidden archive to be saved to by clicking “location” and browsing for the correct directory. After that, click “other options” and enter a secure password. With all the information filled out, click the “Create” button. Soon after, your hidden passworded archive will be created!

2. Create an encrypted directory

There are plenty of tools that you can use to create an encrypted directory in Linux, but the easiest I found is to use Gnome Encfs Manager. Similarly, you can create your encrypted directory with a . in front of the file name, and your files and folders will be secure and hidden at the same time.

3. Hide file in images

If you feel that using the . method is too insecure, another way is to hide your files in an image using a method called Steganography. Here are a few ways you can hide confidential data inside images.

Conclusion

Hiding files and folders on Linux is useful for many reasons. Developers use this feature to tuck away configuration files so that they stay out of the way of normal users. You can hide files and folders just to keep them out of plain sight or to secure and hide your confidential data.

Do you hide files and folders on Linux? Tell us why or why not below!

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Derrik Diener

Derrik Diener is a freelance technology blogger.