- Hide a file
- Show all hidden files
- Unhide a file
- Hide Folders and Show Hidden Files in Ubuntu Linux
- Show hidden files in Linux terminal
- Display hidden files in the file manager (for desktop users)
- Hide files and folders in Ubuntu
- Bonus Tip: Hiding multiple files and folders without renaming them (valid for GUI only)
- Hide it or lock it?
- How to show hidden folders in File Manager (Nautilus) on Ubuntu?
- 6 Answers 6
- Ubuntu 17.10 and earlier
- Ubuntu 18.04 and newer
- Ubuntu 20.04/ 21.04/ 21.10
- Terminal
- with GUI
- How can I hide directories or files without changing their names?
- 6 Answers 6
Hide a file
The Files file manager gives you the ability to hide and unhide files at your discretion. When a file is hidden, it is not displayed by the file manager, but it is still there in its folder.
To hide a file, rename it with a . at the beginning of its name. For example, to hide a file named example.txt , you should rename it to .example.txt .
You can hide folders in the same way that you can hide files. Hide a folder by placing a . at the beginning of the folder’s name.
Show all hidden files
If you want to see all hidden files in a folder, go to that folder and either press the menu button in the top-right corner of the window and select Show Hidden Files , or press Ctrl + H . You will see all hidden files, along with regular files that are not hidden.
To hide these files again, either press the menu button in the top-right corner of the window and switch off Show Hidden Files , or press Ctrl + H again.
Unhide a file
To unhide a file, go to the folder containing the hidden file. Press the menu button in the top-right corner of the window and select Show Hidden Files , or press Ctrl + H . Then, find the hidden file and rename it so that it does not have a . in front of its name. For example, to unhide a file called .example.txt , you should rename it to example.txt .
Once you have renamed the file, you can either press the menu button in the top-right corner of the window and switch off Show Hidden Files , or press Ctrl + H to hide any other hidden files again.
By default, you will only see hidden files in the file manager until you close the file manager. To change this setting so that the file manager will always show hidden files, see Views preferences in Files .
Most hidden files will have a . at the beginning of their name, but others might have a ~ at the end of their name instead. These files are backup files. See What is a file with a ~ at the end of its name? for more information.
Hide Folders and Show Hidden Files in Ubuntu Linux
Wondering how to see or hide files in Ubuntu Linux? Its damn easy to do so. Here’s how to show hidden files in Ubuntu and other Linux distributions.
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.
You can also use the -A option of the ls command to show hidden files but without the . and .. files.
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.
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.
How to show hidden folders in File Manager (Nautilus) on Ubuntu?
How do you show a hidden folder (whose name starts with . ) in File Manager a.k.a. Nautilus on Ubuntu? I am somewhat new to Ubuntu and can’t seem to find the «view» menu.
Ctrl+H will work in Nautilus, Nemo, Thunar etc, but for Dolphin (KDE’s file manager), it may be Alt+. or similar.
6 Answers 6
Ubuntu 17.10 and earlier
Go to the top menu -->View->Show hidden files:
For permanently showing hidden files, you can go to the Edit>Preferences menu item as shown below:
With the terminal you should:
Ubuntu 18.04 and newer
The accepted answer is correct for older versions of Ubuntu.
For newer versions, the image displayed below works
In the top right corner of file explorer, there is a menu button displayed as 3 stacked line (hamburger menu), clicking on that will open a modal, on that there is an option Show hidden files
Ubuntu 20.04/ 21.04/ 21.10
Using the Nautilus option Show hidden files will only resolve the issue temporarily, but there are ways to set this as the default option.
Terminal
There is a nice one-liner to do this:
gsettings set org.gnome.nautilus.preferences show-hidden-files true
The settings will take effect immediately (even for currently running instances).
with GUI
As posted above you may install dconf-editor
sudo apt install dconf-editor
Then search for show-hidden and activate the option org.gnome.nautilus.preferences .
As you can see in the following screenshot the «same» option also exists for other applications such as the Gtk FileChooser, so make sure you activate the setting where you need it. dconf-editor will also show you the key to use for each setting in case you want to set it using gsettings as outlined in the first section of this post.
How can I hide directories or files without changing their names?
The OCD in me wants directories I do not like the name of to be hidden since I do not interact with them directly. How can I hide directories without using the dot notation?
6 Answers 6
Assuming you only care about hiding the files from showing up in nautilus, there is a bug on the GNOME Bugzilla about this. However, currently, that bug has not been resolved.
There is another way to hide files from appearing in nautilus. If you create a file called .hidden inside of a directory, any filename listed in the file will not be displayed.
For example, below is a .hidden file that I created. This file will hide any files or folders named b or e located in the same directory as the .hidden file.
Below is a screenshot of the folder that contains the .hidden file. Note that you only see three files: a , c , and f . You do not see the .hidden file due to the ‘.’ at the beginning of its name.
The screenshot below is of the same folder as before. However, this time, I hit Ctrl + H to cause nautilus to display hidden files and folders. Notice how there are several additional files that show up. You now see several files that were previously hidden due to having names that began with a ‘.’. There are also now files called ‘b’ and ‘e’, which although not having names beginning with a ‘.’, were hidden due to being listed in the .hidden file.
Files mentioned in the .hidden file will only be hidden in nautilus. Tools like ls will still display them. The .hidden file is also not recursive. It only affects files in the same directory as the .hidden file is in.
Some people on the forum have gone ahead and created scripts for nautilus that make it easier to add files to the .hidden file. The first script includes a nice explanation about how to install and use the scripts, but the second script is a bit cleaner and shorter. Feel free to use either script to make your life a bit easier.