Categories: Ubuntu

How to Hide a File or Folder in Ubuntu 22.04

Privacy is a main concern of every system user and everyone want to keep their personal files and folders hidden from other users’ eye. As an Ubuntu user, you may be wondering how you can hide your files and folders from other system users. To accomplish this task, Ubuntu provides both command-line tools and GUI methods, which we will cover in this article.

How to Hide a File or Folder in Ubuntu 22.04

There are two ways to hide a file and folder in Ubuntu 22.04:

Method 1: Hide a File or Folder in Ubuntu Through Command Line

Sponsored

Open the terminal and go to the directory where you want to hide files. In Ubuntu, all the hidden files and folders have the prefix (. dot) before their name. Following is the syntax command for hiding the file in Ubuntu:

mv filename> .filename>

 
The mv command will rename the file and hide it. In the below mentioned example, I am hiding an infofile:

mv infofile .infofile

 

Execute the ls command, you will observe that the hidden file is no longer available:


Similarly, you can hide the folder in Ubuntu by adding the (.dot) in the start of the name of the folder.

mv directory_name> .directory_name>

 
In the below given example, I have hidden the directory “samplefolder” present in the Documents through the following command:

mv samplefolder> .samplefolder

 

Use the ls command to confirm whether the folder is hidden or not:

Sponsored

Method 2: Hide a File or Folder in Ubuntu Through GUI

File manager allows the Ubuntu users to hide a file. When the file is hidden, it is not displayed by the file manager but it is present there. To hide a file, right-click on the file and choose Rename:


Put the dot at the start of the name of the file to make it hidden:

How to Display a Hidden File or Folder in Ubuntu 22.04

If you want to see all the hidden files and folders, go to that directory, and click on the three lines present at the top. A menu will display on your screen, choose Show Hidden Files.


After ticking the option, the hidden files and folders will appear:


You can also use the keyboard shortcut Alt + H to display the hidden files. The other way to display hidden files and folder is through the command line. To show hidden files via the terminal, execute the following command:

ls -a

 

Using –a option with ls command will display the hidden files as shown in the above image.

Bottom Line

Knowing how to hide a file or folder in Ubuntu will secure your data. To create a hidden file or folder in Ubuntu just add the dot “.” at the start of the name of the file or directory. In this guide, we have explained how to easily hide a file or folder in Ubuntu through GUI and terminal. We have also discussed the command ls -a or a keyboard shortcut Alt + H to display hidden files.

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

2 days ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

3 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

3 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

4 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

4 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

6 days ago