How to Hide a File or Folder in Ubuntu 22.04


Privacy is a top priority for every system user, and it is important to keep personal files and folders hidden from the view of other users. If you are using Ubuntu, you might be interested in learning how to conceal your files and folders from other system users. Ubuntu offers various options to achieve this, including both command-line tools and graphical user interface (GUI) methods. In this article, we will explore these approaches in detail.

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:

  • Through GUI
  • Through Command Line

Method 1: Through GUI

The file manager in Ubuntu provides a feature that allows users to hide files. When a file is hidden, it does not appear in the file manager’s display, but it remains present in the system. To hide a file, simply right-click on the file and select the “Rename” option.

A screenshot of a computer Description automatically generated

To make a file hidden in Ubuntu, you can simply place a dot (.) at the beginning of its name. This convention is widely used in Linux systems to indicate that a file should be hidden from normal directory listings. By adding a dot as the first character of the file’s name, it will become hidden and won’t be visible by default in file managers or directory listings.

A screenshot of a computer Description automatically generated

Method 2 : Through Command Line

To hide a file in Ubuntu, you can use the terminal and navigate to the desired directory where the file is located. In Ubuntu, hidden files and folders are identified by having a prefix of a dot (.) before their name. To hide a file, you can use the following syntax command:

mv <name-of-file> .<name-of-file>

By using the mv command, you can move a file to a hidden location, effectively hiding it. In the example below, I will demonstrate how to hide a file named “file.sh” by executing the following command:

mv file.sh .file.sh

A screenshot of a computer program Description automatically generated with medium confidence

After executing the ls command in the terminal, you will notice that the previously hidden file is no longer visible in the directory listing. The hidden file, represented by the name “.file,sh” in the example, will not be displayed by default. This provides a way to keep certain files hidden from normal view in Ubuntu.

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

mv <name-of-directory> .<name-of-directory>

In the example below, I will demonstrate how to hide the directory “folder1” located in the “home” directory using the following command:

mv folder1 .folder1

A screenshot of a computer program Description automatically generated with medium confidence

How to Display a Hidden File or Folder in Ubuntu 22.04

If you wish to view all the hidden files and folders in Ubuntu, navigate to the specific directory where they are located. Once there, locate the three lines symbol at the top of the file manager window. Clicking on these lines will open a menu. From the menu, select the option “Show Hidden Files.” After enabling this option, the previously hidden files and folders will become visible and appear in the file manager’s display.

A screenshot of a computer Description automatically generated

Another method to display hidden files and folders in Ubuntu is by using the keyboard shortcut Alt + H. Pressing these keys together will reveal the hidden files in the file manager.

Additionally, you can also use the command line to show hidden files. To do this, open a terminal and execute the following command:

ls -a

A screenshot of a computer program Description automatically generated with medium confidence

Conclusion

Understanding the process of hiding files and folders in Ubuntu can help enhance the security of your data. To create a hidden file or folder, simply add a dot (.) at the beginning of its name. This guide has covered the steps for hiding files and folders in Ubuntu using both the graphical user interface (GUI) and the terminal.

Print Friendly, PDF & Email
Categories