Files and folders can be easily hidden in Ubuntu. If you put a period in front of the filename, it is hidden from view in Nautilus and in the standard directory listing in the terminal window using the ls command.
You can view hidden files and folders in both cases. To temporarily view hidden files and folders in Nautilus, select Show Hidden Files from the View menu.
Hidden files now show in Nautilus.
You can also view hidden files in the Terminal window. Select Accessories | Terminal from the Applications menu.
At the command prompt in the Terminal window, type the following command:
$ ls -a
A listing of all the files in the current directory (which is the Home directory by default) displays. The hidden files are the names in white preceded by periods and the hidden folders are the names in blue preceded by periods.
If you want to hide a file or folder that you cannot rename, you can still hide it. You may not be able to rename it because doing so would break some functionality in the system, such as the Desktop directory inside your Home directory.
To hide files and folders without renaming them, create a file called “.hidden” (without the quotes) in the same directory where you have the file(s)/folder(s) you wish to hide. Then just add the names of the files/folders to that file, one per line.
For the example in this post, we have two text files. The file called hidden_text_file.txt will be hidden using a .hidden file, which we will create.
To create a new text file to hide one or more files or a folders, first navigate to the directory that contains the files/folders you want to hide. Select Create Document | Empty file from the File menu in Nautilus.
The name of the file is highlighted by default when you create a new file. Change the name to “.hidden” (again, without the quotes).
If you have not turned off the Show Hidden Files option under the View menu, the new .hidden file displays with the other two files.
Right-click on the new .hidden file and select Open with gedit from the popup menu.
NOTE: The Open with gedit option should be available on the popup menu by default when you install Ubuntu. If it is not there, you can open it from the Applications | Accessories menu and then open the file from within gedit.
Type the name of a file you want to hide on the first line in the .hidden file. If there are any other files in the same directory you want to hide, enter each filename on a separate line in the .hidden file. Click the Save button.
Close gedit by selecting Quit from the File menu.
Now, when you turn off the Show Hidden Files option on the View menu, the .hidden file and the hidden_text_file.txt file do not show.
The Show Hidden Files option under the View menu is only effective as long as the current instance of Nautilus is open. Once you close the window and then open it again, the hidden files do not show. However, you can choose to permanently show hidden files every time you open Nautilus without having to select the Show Hidden Files option. To do this, select Preferences from the Edit menu.
On the File Management Preferences dialog box, make sure the Views tab is active. Select the Show hidden and backup files check box. Click Close.
This might seem like a secure method of preventing others from seeing your personal files. However, it is not secure. Anybody can access your hidden files using the Show Hidden Files option we discussed in this post. It can be used as a convenient way of limiting your listings of files if you have a lot of files.
For genuine privacy and security, you should encrypt your files. We have previously written about using TrueCrypt in Ubuntu to create an encrypted file store. See the two part series (Create an Encrypted File Store in Ubuntu – Part One and Create an Encrypted File Store in Ubuntu – Part Two) for a free, secure method for protecting your files.
by Lori Kaufman




CONTROL+H=toggle show hidden files on or off