Why you can trust ZDNET
:ZDNET independently tests and researches products to bring you our best recommendations and advice. When you buy through our links, we may earn a commission.Our process
'ZDNET Recommends': What exactly does it mean?
ZDNET's recommendations are based on many hours of testing, research, and comparison shopping. We gather data from the best available sources, including vendor and retailer listings as well as other relevant and independent reviews sites. And we pore over customer reviews to find out what matters to real people who already own and use the products and services we’re assessing.
When you click through from our site to a retailer and buy a product or service, we may earn affiliate commissions. This helps support our work, but does not affect what we cover or how, and it does not affect the price you pay. Neither ZDNET nor the author are compensated for these independent reviews. Indeed, we follow strict guidelines that ensure our editorial content is never influenced by advertisers.
ZDNET's editorial team writes on behalf of you, our reader. Our goal is to deliver the most accurate information and the most knowledgeable advice possible in order to help you make smarter buying decisions on tech gear and a wide array of products and services. Our editors thoroughly review and fact-check every article to ensure that our content meets the highest standards. If we have made an error or published misleading information, we will correct or clarify the article. If you see inaccuracies in our content, please report the mistake via this form.
Linux is a very powerful operating system. Although having that much power at your fingertips might give you the impression that Linux is quite challenging, modern Linux distributions go a long way to proving that assumption wrong.
Take, for instance, the hidden file, which is a file that is not visible by default. The file is still there, unencrypted for anyone to view, so long as you know where it is and how to view it.
That brings up an important point. Hidden files are not password-protected, so anyone can view the contents of the file, so long as they know how.
Because of that, you should not keep sensitive information (such as bank accounts and passwords) in these files. Although you're tucking those files away from the casual viewer, any user with even the slightest bit of Linux experience will be able to view those files.
But, for files containing information that doesn't require encryption, where you simply want the file to not be in plain sight, the hidden file is a great way to go.
Let me show you how to create a hidden file from both the command line and the GUI file manager.
The only thing you'll need for this is a running instance of Linux. As hidden files are available to all Linux distributions, it doesn't matter which you use. As far as the GUI is concerned, the process is mostly the same, but I'll be demonstrating with GNOME Files (aka Nautilus).
That's it…let's make some Linux magic.
How to use hidden files from the command line
1. Open your terminal window
The first thing to do is open the terminal window, which can be done from your desktop menu.
2. Name and create hidden file
The secret to hidden files is that they begin with a period. So instead of hidden_file, you would create a file named .hidden_file. From the command line, that can be done with one of the following two commands:
The first command above creates the empty hidden file, named .hidden_file. The second command opens a new file, named .hidden_file, for editing. Either way, you create a new file that is hidden from plain sight.
3. Viewing/editing hidden files
Here's the trick. If you just issue the command ls those hidden files won't show up. However, if you issue the command ls -a, the hidden files will appear in the output. If you want to open that file for editing, you could issue a command like nano .hidden_file to open it with the nano editor.
How to use hidden files from the GUI
If you use a GUI, you can easily work with hidden files. The Nautilus file manager doesn't enable the viewing of hidden files by default. Fortunately, it's as simple as clicking the Ctrl+H keyboard shortcut to enable or disable the viewing of hidden files. So, hit Ctrl+H on your keyboard and hidden files will appear.
Click the Ctrl+H keyboard shortcut a second time and hidden files will vanish from sight.
To create a hidden file in Nautilus, you first must create a TXT Template. For that, go back to the terminal and issue the command:
Once you've created the template, navigate to the directory you want to house the hidden folder in Nautilus, right-click any empty spot in the directory, and select New Document > text. This will automatically create a file named text.txt. Right-click that file and click Rename.
In the Rename File popup, give the new file a name that starts with a . and hit Rename. If the hidden file is viewable, hit the Ctrl+H keyboard shortcut again to hide the file. If you need to open that file from the file manager, you'll need to unhide it and then double-click it to open it for viewing and editing.
And that's all there is to using hidden files in Linux. Although this simple trick won't keep those in the know from finding your files, it can at least obfuscate them from those who might not know about the ls -a or Ctrl+H tricks. Remember, this should never be considered a way to hide sensitive information, but rather a means of simply keeping a file out of plain sight.