How To Hide Files And Folders in File Manager Without Renaming
If the system used by more than one users and you want to hide some files or folders (personal reasons) from others in file manager (most of the users won’t go depth in Linux, they will see what are the files or folders listed in file manager), we can do it in three way. Additionally you can protect files or folders with password. In this tutorial we are going to see, How To Hide Files And Folders in File Manager Without Renaming.
We all knows, by renaming a file or folder with a
dot (“.”) prefix, can hide a file or folder in Linux. This is not the right/efficient way to hide a file or folder. Some file managers also hide files that end with a tilde (“~”), those are considered backup files.
Three way to hide files or folders in file manager.
- Add a
dot(“.”) prefix with file or folder name.
- Create a file called
.hiddenand add files or folders on it.
- Nautilus Hide extension
Hide a file or folder with dot (“.”) prefix
This is known method for everyone because by default file manager & terminal wont shows the
dot (“.”) prefix files or folders. To hide an existing file, we have to rename it. That’s not always good idea. I will not recommend this but for emergence purpose you can use it and don’t do this purposely.
For testing purpose, i’m going to create a new folder called
.magi. See the below output, it won’t shows the
dot (“.”) prefix files or folders when i use
ls -lh. The same out you can see the file managers too.
# mkdir .magi # ls -lh total 36K -rw-r--r-- 1 magi magi 32K Dec 28 03:29 nmon-old
For clarification, i added
-a options with ls command to list hidden files too (Yes, now i can see the file name .magi).
# ls -la total 52 drwxr-xr-x 4 magi magi 4096 Feb 12 01:09 . drwxr-xr-x 24 magi magi 4096 Feb 11 23:41 .. drwxr-xr-x 2 magi magi 4096 Feb 12 01:09 .magi -rw-r--r-- 1 magi magi 32387 Dec 28 03:29 nmon-old
Hide a file or folder with help of (“.hidden”) file Without Renaming
If you want to hide a file without renaming it ? In other hand some of the applications wont allow you to rename. For this kind of situation, you can go with
.hidden file, probably well suitable option for you.
Some file managers, like Nautilus, Nemo, Caja, Thunar offering a native way to hide files without renaming it, how ? simple create the file called
.hidden where you want to hide files, and add the list of files and folders line-by-line (one by one). Finally refresh the folder, now those files will not be visible.
For testing purpose, i’m going create a file name called
.hidden and 2g & 2daygeek in the same directory (Documents), then add those into “.hidden” file.
# touch 2g # mkdir 2daygeek # nano .hidden 2g 2daygeek
Nautilus Hide extension
Nautilus Hide is a simple Python extension for the Nautilus file manager that adds options to the right-click menu to hide or unhide files.
Install Nautilus & Namo Hide extension on Ubuntu and its directives We can easily install Nautilus & Namo Hide extension on Ubuntu and its directives by running following commands.
$ sudo apt install nautilus-hide $ nautilus -q $ sudo apt install nemo-hide $ nemo -q
Follow the below procedure to install Nautilus hide extension on DEB based systems
$ sudo apt install cmake gettext python-nautilus xdotool $ mkdir build $ cd build $ cmake .. $ sudo make $ sudo make install $ nautilus -q
Follow the below procedure to install Nautilus hide extension on RPM based systems
$ sudo [yum|dnf|zypper] install cmake gettext nautilus-python xdotool $ mkdir build $ cd build $ cmake .. $ sudo make $ sudo make install $ nautilus -q
This extension simply uses that
.hidden file to hide files. When you choose a file to hide, its name is added to
.hidden file. When you choose to unhide it (For unhidden, press
Ctrl+h to bring all the files, including (“.”) files, then Unhide Files), the name is removed from
.hidden file (.hidden file also go away, when you unhidden all the files which is listed in .hidden file). If the file isn’t hidden/unhidden, press F5 to refresh the folder.
You might ask me, why i want to install Nautilus Hide extension because method two also doing the same. In method two, we need to create a
.hidden file manually wherever it’s required then have to add file lists but here everything automated. simple right click then chose hide or unhide (it will automatically create .hidden file, if it’s not present).
Unhide a file using Nautilus Hide extension See the below screenshot, we are using Nautilus Hide extension to unhiding a file (Bring all the files by hitting
Ctrl+k, so that you can see all the hidden files & folders).