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 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.

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.

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.

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.

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 three ways you can hide confidential data inside images.

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!

6 comments

  1. How does one find a hidden file/directory if one has forgotten its name? Especially when the file is hidden in an image? Right now I have couple of thousand images, close to 14,000 files and 1800 folders on my system. It would take me an awfully long time to find a file whose name I have forgotten.

    I am not trying to be a wise guy. We all have put some important item in a special location just “so it doesn’t get lost”. Then we proceed to forget about the special location.

  2. In 30 years of Unix/Linux/AIX/HPUX/Solaris/etc etc etc , never, ever have i ever heard that the “dot files” were an unintentional bug. They’ve always been used to hide login setups and other configuration files from plain user view. Hence: .profile and a gazillion others since. If anything, it’s become overdone, but still very useful. However, any admin uses “ls -al” every day.

    Try hiding your files under a mount point. Try using “mkdir …” (three dots). Try making a directory using the null character (Dec 254). There are a lot of these old tricks from the 80’s and before…. Every one of them is visible to a user if you use “find ./print” except for the method of hiding files under an active mount point. (Unmount a device, put a directory there, then re-mount the device. Presto)

    Hiding files in images and encrypting is good tho…. I think ISIS does that…

    • If by null charcater you mean 0x00 you can’t hide anything with it since Unix/Linux follow the C convention that 0x00 terminates a string and thus a filename.

    • ISIS would be very foolish to hide files in images. This technique was cracked years ago, and is not particularly secure. Any intelligence agency worth its salt would quickly discover these amateurish attempts to hide files. In fact, the US has cracked several if not many of these “hidden” files in images — that’s how we know ISIS has attempted to do this!

  3. Okay.. I will try It … But I am looking for an option which works like windows…I am using Both Os Vista and Ubuntu that folder is hidden in vista but showing in ubuntu… I want to hide that4m ubuntu Too…
    Regards,
    Bhargavi

Comments are closed.

Sponsored Stories