You are probably familiar with the concept of “hiding” a folder or file in Windows. Hiding a folder or file just “removes” the folder from the normal view, and then you can choose to display “hidden files” to see it.
So how do you see the hidden files in Linux, then? Let me show you that.
Show hidden files in Linux terminal
If you are in a terminal, you can use the ls command to display all the files, including the hidden ones:
You can recognize the hidden files and folders with the dot (.) before their names.
-Aoption of the ls command to show hidden files but without the
If you use desktop Linux, you can still see hidden files easily. Let’s see how.
Display hidden files in the file manager (for desktop users)
If you are in the file manager, you can use the Ctrl+H keyboard shortcut in Ubuntu and I presume other distributions also display all the files, including the hidden ones.
Pressing Ctrl+H again will hide the files.
If you are not a fan of keyboard shortcuts, you can use the file manager GUI to display the hidden folders and files.
To see a hidden file or hidden folder in Ubuntu, go to the file manager (Ubuntu’s counterpart of Windows Explorer and the default is Nautilus).
Now go to the top-right hamburger menu → Show hidden files:
Hide files and folders in Ubuntu
Now that you have learned to see hidden files in Ubuntu, let’s now see how you can hide files and folders in Linux.
In Linux, if a file name starts with
. (dot), it is considered a hidden file.
Now if you want to hide a file or folder, let’s say MyFolder, just rename it to
.MyFolder and it will be taken as a hidden file or folder.
I hope you know how to rename files in Linux command line using mv command.
mv MyFolder .MyFolder
If you are using a Linux desktop, right-click and choose the rename option and add the dot before the name.
Unfortunately/interestingly, there is no similar way as in Windows to hide a folder. In Windows, you right-click on a file and choose the option of making it hidden. But this option is not available in Ubuntu.
Bonus Tip: Hiding multiple files and folders without renaming them (valid for GUI only)
This is a neat little trick that will let you hide several files and folders from the normal view in your desktop Linux’s file manager.
Traditionally, if you create a new file named
.hidden and add the name of the folders in this file; those folders will be hidden from normal view when you close your file manager and open it again.
Keep in mind that this trick works with only the current directory you are in. It won’t work for nested directories. You can create the
.hidden file in any directory to hide files and folders in it.
Hide it or lock it?
This .hidden file is one of the many lesser-known tweaks of the Nautilus file manager. Here are a few more.
This was about hiding files in Linux. There are separate methods for locking a folder in Linux.
I hope you like this little bit of Linux knowledge.