Wondering how to hide files and folders on Linux?
Hiding files serves different purposes. Usually, users hide their files for privacy reasons. When there are multiple users on the same device, there may come the need to protect some personal files or folders. The privacy of your personal stuff can be protected by hiding them.
Similarly, some of the system configuration files are also hidden by default so that they can not be accessed easily, preventing the system from unwanted disasters.
Every operating system provides you with the option of hiding files. In the case of Linux, this can be done using either the GUI or executable commands on the Terminal. In this article, you’ll learn how to hide files and folders on Linux.
So, let’s get started!
Hide New Files Using the Terminal.
Every file and folder present on your computer can be accessed and modified using the Terminal.
These files are named and saved in directories with their names. If you hide a file, the only difference made to the file is that a dot (.) is added at the beginning of the name.
So, follow these steps if you want to hide files and folders on Linux using the Terminal:
- First, open the Terminal.
- Once it starts, you can use the
$ pwd
command to check for your current directory and the$ cd
command to change to the directories in which you want to create your file. - To create a new hidden file, you need to use the
$ touch
command and the dot (.) operator in tandem, as shown in the image below:
$ touch .filetobehidden.txt
- When you press Enter after typing the command mentioned above, a new hidden text file by the name “filetobehidden” is created.
- You can see the file using the
$ ls -a
command.
These were the steps using which you can create a new hidden file. All it takes is the dot (.) operator to create and hide files and folders on Linux using the Terminal.
Hide Existing Files Using the Terminal.
We first looked into creating new hidden files using the Terminal. In addition to that, you also have the provision of hiding existing files and folders on your Linux systems.
To hide existing files, you will use the $ mv
command with the dot (.) operator rather than the $ touch
command. You also need to make sure that the current working directory contains the file you want to hide.
Follow these steps to hide existing files using the Terminal:
- Start by opening the Terminal.
- Once opened, check for your current directory using the
$ pwd
command. Use the$ ls
command to check for the unhidden files and folders present in the directory.
- If the file you want to hide is not present in the home directory, use the
$ cd
command to navigate to the required directory. - After reaching the respective directory, use the following command as a template to hide the file you want to.
$mv filename .filename
- Upon pressing the Enter key, the file has now been hidden. As you can see in the image below, the file named “box” is not listed.
- To verify whether the file was successfully hidden or not, use
$ls
with the “-a
” operator to view all the hidden files in the current directory. - When you use the
$ls -a
command, you can see that the text file we hid is now visible.
We used the $mv
command to move the existing file to its hidden version. These were the steps you must follow to hide existing files or folders on your Linux system.
Hide Files on Linux Using the GUI.
We discussed the different commands you can use to hide files on your Linux system using the Terminal. In case the Terminal isn’t your cup of tea, and you prefer to get on with things swiftly, there is always the option to use the GUI to perform all the tasks.
Hiding files and folders using the Linux GUI is simple and easy to do. The only work you need to do is find the location of the file or folder you want to hide from other users. After locating them, hiding them requires just a few clicks of your mouse or touchpad and the keyboard.
Follow these steps if you want to hide files and folders on Linux using the GUI.
- Open the Files application.
- When it opens, you can see all the files and folders present on your system.
- Locate the file you want to hide.
- To hide the file, we simply need to rename it and add a dot (.) at the start of the name.
- We will hide the text file “ball1” by renaming it “.ball1”.
- After renaming it, you can see that it is not present where it was before.
- To view the hidden file, choose the “show hidden files” option from the drop-down menu.
- Now you can see “ball1” with its name highlighted.
These were the simple and easy steps of hiding a file on Linux using GUI.
Hiding files and protecting your privacy is necessary in certain cases. If those aren’t enough, you can always implement an additional layer of security by protecting your account altogether. One of the commonly used methods to implement this would be using fingerprint login for your Linux distribution.
This article aimed to guide and help you out in learning how to hide files and folders on Linux. We hope that we were able to solve your problem. If there are any queries related to this guide, please let us know in the comment section.