Hidden files are often used for user configuration files in Linux. A lot of applications create hidden files and directories in your home directory. These are often used to store settings, preferences and information about your environment. People often refer to hidden files as dot files.

NOTE: These methods are not recommended to protect your privacy. If you are concerned about someone viewing a file you should protect it with file permissions, ACLs, and/or encryption.

Make a Hidden File on the Command Line

Nothing special is required to create a hidden file. You simply pretend a dot in the beginning of the filename to tell the system to hide it. Below you can see we have a file named file1.

[[email protected] ~]$ ls

We can hide this file by renaming it and placing a dot . as the first character in the name.

[[email protected] ~]$ mv file1 .file1
[[email protected] ~]$ ls
[[email protected] ~]$ 

View Hidden Files on the Command Line

To view the hidden file we can add the -a switch to the ls command.

[[email protected] ~]$ ls -a
.  ..  .file1

This works with directories also. Simply prefix the file name with a dot . with hide a directory.

[[email protected] ~]$ ls
[[email protected] ~]$ mv dir1 .dir1
[[email protected] ~]$ ls
[[email protected] ~]$ ls -a
.  ..  .dir1  .file1

Make a Hidden File in the GUI

The same technique can be used throughout the Linux system. To make a file hidden on the GUI, simply right click the file and select rename. When you prepend a dot . to a file, the file manager will warn you “files with a “.” at the beginning of their name are hidden.”

Here is an example of hiding a file in Files (Formally Nautilus).

Creating a hidden file in GUI file manager on Linux

View Hidden Files in the Linux GUI

Each file manager is slightly different, but they all have an option to show hidden files. We are using Gnome Files. Here we can hit the hamburger menu and select the “Show Hidden Files” option.

Show hidden files in Gnome file manager in Linux


Creating dot files is a great way to keep necessary files without creating a cluttered directory. By default your home directory is filed with important dot files. The most common files that are hidden is .bashrc and .bash_profile. Applications also store your preferences in dot files. For example Mozilla Firefox stores your browser cache, plugns and configuration in them.

Now you know how to create and view hidden files. Remember, this is not recommended for privacy.

Resources and Links