Tuesday, September 11, 2012

Better Way to Hide File / Folder in Nautilus (Ubuntu / Linux)

As you Linux users may already know, in GNU/Linux file system, files/folder with a "dot" in front of their names will become hidden by default. So, if you want to hide a file/folder, you have to add a dot in front of its name (.MyHiddenFile for example).

But do you know that Nautilus, the default file manager app for Ubuntu OS and many other GNOME-based Linux distros, has a feature that can hide files/folders with an additional different way, without renaming the file/adding a dot in its name.

For me, this feature is very useful, especially to hide files/folders that cannot be renamed. Here is an example:

As you may notice from the screenshot above, there are system folders that used by Windows OS (yes, I have multiboot OS on my system, Windows and Ubuntu/Linux OSes) on one of my hard disk partition that I used to store data files (shared files). I hate it whenever I see those files (with ugly names) on Nautilus, but since they are system files in Windows OS, renaming them as dot files won't be effective, because they will be auto-generated whenever I go to WIndows and I will see them again when I return to my Linux box.

So, I use Nautilus' different way of hiding files as solution.

Create .hidden file containing list of hidden files/folders

To use this feature, simply create a file with name ".hidden" (dot hidden) located in a folder containing the files/folder you want to hide. Then open it in text editor and then create a list of names of the hidden files/folders.

On the screenshot above, I also make use of this feature in Nautilus to hide all system files/folders in root folder, by running simple command in Terminal:
ls / -1 | sudo tee -a /.hidden
.

That's just example, of course. With .hidden file, you can hide any files/folders in Nautilus, including your "important" files :)

***

Oh, if you want to prevent the .hidden file from appearing in Windows Explorer, set the file attribute as "super hidden" (hidden system file), by running this command in DOS prompt (yes, you read it right, because this command is for MS DOS :) :
attrib +s +h [absolute\path\to\.hiddenfile]

.

PS: Still, sorry for my English :)