How to Hide Files and Folders in Linux Mint

Sometimes, it can be useful to hide some file or folder from the default view in a file manager. Unlike Windows, Linux uses a completely different method to make a file or folder hidden. You won't find a "hidden" attribute in file properties or anywhere in the GUI. Let's see how it can be done in Linux. I use Linux Mint with MATE, but the method described in this article is applicable to any distro, any Desktop Environment, and any file manager.


There are two methods to hide a file or folder. I will review them both.

Historically, Linux considers files and folders as hidden if their name starts with a dot. For example, if a folder is named .SomeHiddenFolder, it won't be displayed anywhere!
So, the first method to hide a file or folder from the default view in Linux is to just rename the target object beginning with a period character. Here is how.

To hide files and folders in Linux, do the following.

  1. Open a file manager of your choice. It can be Thunar in XFCE, Caja in MATE, Nemo in Cinnamon, or the console app Midnight Commander - anything you like.
  2. Navigate to the file or folder you want to hide.Open Target Folder
  3. Rename it by adding a dot "." to the beginning of the name of the object.Caja Rename A Folder

That's it. It will be hidden. The GUI file manager won't display it by default:Folder Is Hidden

Even the console ls won't list it.Terminal Folder Is Hidden

To toggle visibility of hidden objects, press CTRL+H in your GUI file manager (CTRL+. in Midnight Commander).

Caja Show Hidden Folders

In the terminal, execute the command ls -a to see hidden objects.Terminal Hidden Folder Is Visible

That's it! Pretty easy, right? However, renaming files and folders may not be a convenient method. I don't like touching file names just to hide them. Thankfully, there is an alternative method, which, however, works only with GUI file managers.

How to Hide Files and Folders in GUI apps

Open a file manager of your choice and navigate to the folder which contains the objects you want to hide.

Open Target Folder

There, create a new text file called .hidden. It will be parsed by GUI file managers.

Caja Create New File Caja Create New Dothidden File

On each line of the file, type the name of the file or folder you want to hide, one item per row. See the following screenshot.Caja Dothidden File Contents

Save the file and re-open the folder. The objects listed in the ".hidden" file will disappear!

Caja Files And Folders Are Hidden

The console ls command still shows them, so this method affects only GUI apps.

Caja Terminal Ignores The Dothidden File

That's it.

Windows has a number of ways to hide files. These include the classic console command, attrib, from the DOS era and the Properties dialog. Newer graphical tools come by default with Windows 10 to quickly hide or unhide files. You can see all the ways to hide files in Windows in this article: How to hide and unhide files quickly in Windows 10

1 thought on “How to Hide Files and Folders in Linux Mint

  1. Sven

    Very helpful, thanks

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *