Hide Files with .hidden

๐Ÿ“… June 3, 2015
hide3bDo you have files or directories that you wish to hide but do not want to rename as hidden dot files?

Here is a nifty trick that will hide all specified files and directories without the need to rename them.

All you do is create a hidden file named .hidden (with the dot) in the directory containing the files you wish to hide. When the file manager refreshes, the listed files will no longer appear.

Let’s see the details…

In this example, we have a directory named fruity that contains two directories and two files.


Too much clutter! Let’s hide one file and one directory quickly without reconfiguring other software.

We want to hide skippy’s_wonder and file_to_hide.txt, so we create a hidden file named .hidden in the same directory.


The .hidden file contains a list of files and directories to hide from normal view. Since .hidden is a dot file, it will be hidden itself.

Open .hidden in a text editor, and add two lines: skippy’s_wonder and file_to_hide.txt. (Remember to include the filename extension.)


Editing .hidden in gedit. Each line is the full name of one item to hide. Any matching file or directory within the same directory as .hidden will not appear in the file manager during normal viewing.

Save the changes and refresh the file manager. Presto! The directory skippy’s_wonder and file_to_hide.txt no longer appear, but the other files are visible.


[Nemo] file-to_hide.txt and skippy’s_wonder no longer appear…and we did not have to rename them.


Shown here is the Nautilus file manager. Nautilus also recognizes the .hidden file.

To view the hidden files, simply switch the file manager’s view mode to show the hidden files.


Nemo showing all hidden files in the fruity directory. (Ctrl+H is a keyboard shortcut that toggles hidden files.)

You can also comment out a line (# at the beginning of a line) in .hidden to unhide a file or directory.


Gedit showing .hidden. Here, we comment out the line file_to_hide.txt with the the # character.


[Nemo] Now, file_to_hide.txt appears, but skippy’s_wonder remains hidden.

“I use ____________. Will this work for me?”

Maybe, maybe not. You will need to experiment for yourself. I have tested and confirmed that this trick works in Linux Mint 17.1 and Xubuntu 14.04, but this tends to be a file manager-specific feature, not a Linux distribution feature.

Nemo 2.4.5 and Nautilus 3.10.1 both support this .hidden file trick, but Dolphin and Thunar do not.


“What about the command line?”

The .hidden file will not hide files and directories from a command line listing, such as the output of ls.


Bash showing a normal listing of the fruity directory. All files are shown except hidden dot files. .hidden has no effect.

Dot files will still be hidden unless you use the -a option with ls.


“Why would I want to use this?”

A file or directory is hidden by renaming it with a leading dot character. This is not always possible for preset directories that are forced onto you. For example, some programs, like VirtualBox, will create folders in the home directory that are rarely used by the user and only clutter the home.

In the case of VirtualBox, the directory VirtualBox VMs is created that contains virtual images. I would prefer to hide this directory from the normal view in order to reduce home clutter, but renaming it will require configuration changes in VirtualBox.

Sure, I could rename or move VirtualBox VMs and then open the VirtualBox configuration settings to manually adjust the new location, but it is easier and faster to use a .hidden file. This way, I can easily unhide the directory in the future and VirtualBox will never know the difference.

Of course, proper dot files should be used to hide files and directories whenever possible, but there are times when you do not have control over other people’s programs and the digital litter they spew. For those instances, we have .hidden!


This feature is what I would consider to be one Linux’s best-kept secrets. It seems trivial at first, but I have found it to be amazingly useful for situations where renaming a file or directory is not the most practical option.

Give it try!

, , ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: