Hide files and folders in Linux [With and Without Renaming]

Long story short: this beginner’s article explains how you can hide files and folders from normal view in Linux. GUI and command line methods were discussed.

There will be times when you need to hide files in Linux.

No, I’m not talking about those “special files” that you don’t want your family to see. Although you can hide these special files, it’s best to lock them with a password for an extra layer of protection.

Back to hidden files. Any file or folder whose name begins with a . (dot) is “hidden” under Linux.

Linux contains many such files and folders that are hidden from normal view. They are mainly configuration files needed by the system and programs.

Users don’t normally need them and so they’re hidden from normal view so you don’t get overwhelmed with so many weird files you never created.

Here is an overview of the hidden files and folders in my home directory.

You can easily show hidden files by pressing Ctrl + H in the file manager if you are using desktop Linux. In the terminal, you can use the ls -a command to show hidden files along with normal files.

So how do you create hidden files in Linux? You simply name them with a dot. Here’s how.

Create hidden files and folders in Linux desktop (GUI method)

If you are using the file manager, right click on the file or folder and choose the rename option. All you have to do is add a . at the beginning of the file name.

GNOME’s Nautilus file manager also displays a warning when you create a hidden file this way.

You can hide a folder with all its contents in the same way.

You can press Ctrl+H keys to show hidden files. Oh! how much I love keyboard shortcuts in Ubuntu or any other program or operating system I use.

To make the hidden files normal again, rename them again by removing the dot at the beginning of the filename.

Create hidden files and folders in Linux terminal (CLI method)

If you’re stuck with the terminal, you can use the mv command to rename the file. You just need to rename the file by adding a . at the beginning of the original filename.

mv filename .filename

You can show hidden files using this command:

ls -la

You can also use ls -lA. This will not display stitch files (. and ..).

Bonus tip: Hide files and folders without renaming them (only works in GUI)

You have just learned how to hide files in Linux. The problem is that you have to rename the files and that’s not ideal in all situations.

For example, in Ubuntu you will see a folder named “snap” in your home directory. You’re not going to use it, but if you rename it, your instant apps won’t work as expected. Similarly, there is a firefox.tmp folder under the Downloads directory in Ubuntu 22.04 (for the snap version of Firefox).

There is an interesting trick that can be used in the Linux desktop. It should work under various file managers like Nemo, Thunar, Dolphin, etc., but I can’t vouch for that. It works fine in GNOME’s Nautilus file manager.

So what you are doing here is creating a new file named .hidden in the directory where your desired files or folders (to hide) are located.

alternative way to hide files in linux
Another way to hide files in Linux

Press Ctrl+H to show hidden files and open .hidden file for editing. Add the name of files or folders in separate lines. Keep in mind that it doesn’t take an absolute or relative path. Your wish files and folders must be in the same location as this special .hidden file.

Here is an example I used to hide the cpufetch directory and the pcloud file without renaming them:


Press Ctrl + H again to hide the .hidden files again.

Now, close your file explorer and restart it. You will no longer see the files and directories mentioned in the .hidden file.

If you want to see them again, press Ctrl+H.

When you no longer want files to be hidden, remove their names from the .hidden file or delete the .hidden file completely.

Bonus Trivia: Hidden Files “Feature” Was Actually a Bug

Do you know that this “feature” allows to hide a file by adding a . at the beginning of the filename was actually a bug?

In early UNIX, when the file system was created, the . (current directory) and .. (parent directory) have been added for easier navigation.

Like these specials. and .. the files did not contain any actual data, a new “feature” was added to the ls command.

The feature was to check the first character of a filename and if it was a period (.), it was no longer displayed with the ls command.

It worked for the . and .. but this introduced a “bug” where any filename starting with . was hidden in the output of the ls command.

This bug became a feature because programmers like it to “hide” their config files. The ls command was probably modified later to add options to show hidden point files.

The same convention is followed in Linux as Linux was modeled after UNIX.


I discussed creating hidden files from normal view. If you want to create secret files or folders that other people cannot access, you should encrypt them. I wrote about locking folders with passwords in Linux. It’s a bit old article but it can still work.

I hope you liked this simple topic and learned something new. Use the comments section and let me know your thoughts.

Comments are closed.