Hide a file or folder in Linux

In this article, we cover how to hide a file or folder in Linux. Just like in every other Operating System, Linux also hides certain files and folders from users. Apart from that, a user can also keep files and folders hidden.

The idea behind this is to ensure that not everyone should be able to see and hence access certain files. So, when you open the HOME directory, you wouldn’t see every file or folder that is out there. Reason: these are hidden from our view as such files or folders may contain necessary system configuration which if altered by a regular user can cause our system to break.

Though it won’t affect the system stability as regular users don’t have the right to escalate privileges. But, that would bring some hefty work to the System Administrator. As the System Administrator would then have to ensure that necessary features should work after regular users have made changes to the configuration files.

Hide a file or folder in Linux

Firstly, how can we see hidden files and folders? Most File Managers (we tested this on PCManFM) would have the option Show Hidden in the View (Menu bar). Check the option Show Hidden to view hidden files and folders. Uncheck it by clicking it again to ensure that certain files and folders are kept in a hidden state.

There is a key shortcut as well: Use Ctrl+H to view and hide files and folders.

Now, as already covered, not all files and folders are kept hidden. Only certain files and folders hide. Rest stay as they were earlier.

At this stage, you may notice that only those files and directories are hidden which have a period(or, dot) in front of their names. For instance, if we wish to hide a file: video.mp4 then, right-click the file and rename it. And, put a dot in front of the file: video.mp4

So, the filename now becomes:

.video.mp4

That is pretty much everything we have to do to make the file hidden. And, then use Ctrl+H or use the menu bar as described above to hide it. The same can be said about the folders.

In conclusion, we have covered here how to hide a file or folder in Linux. You would notice that most of the hidden files and folders are system files. Our Linux distribution comes with certain important system files that are by default hidden. Apart from that, Linux distributions also provide an option for users to hide their personal files and folders.

Similar Posts