Menu
User

DropVPS Team

Writer: Cooper Reagan

how to hide files in ubuntu

how to hide files in ubuntu

Publication Date

03/27/2025

Category

Articles

Reading Time

3 Min

Table of Contents

Hiding files in Ubuntu can be useful for privacy, security, or simply keeping your workspace tidy. Unlike Windows, where you can easily toggle hidden file properties via a GUI, Ubuntu relies on a different approach, leveraging both file system conventions and Linux permissions. This guide covers multiple methods to hide files in Ubuntu effectively.

Using the Dot (.) Prefix Method

The simplest way to hide a file or folder in Ubuntu is by adding a dot (.) at the beginning of its name. Files and directories prefixed with a dot are treated as hidden in most Linux file managers.

Hiding a File or Folder:

mv myfile.txt .myfile.txt
mv myfolder .myfolde

After renaming, these files won’t appear in the file manager by default. To view them, use:

ls -la

Or press Ctrl + H in the file manager.

Unhiding:

To unhide, rename the file without the dot:

mv .myfile.txt myfile.txt

Using chattr to Make Files Immutable

If you want to make a file both hidden and unmodifiable, chattr is a great tool. The +i flag prevents even root from altering or deleting the file without first removing the attribute.

Apply the Immutable Attribute:

chattr +i .myfile.txt

Even rm -f .myfile.txt won’t work unless you remove the attribute:

chattr -i .myfile.txt

Using File Permissions

Another way to hide a file from other users is by changing its permissions. Removing read (r) and execute (x) permissions ensures that even if someone finds the file, they can’t access it.

Restricting Access:

chmod 000 .myfile.txt

To restore access:

chmod 644 .myfile.txt

Using EncFS to Hide and Encrypt Files

If you need to hide sensitive files securely, encryption is the best solution. EncFS allows you to create an encrypted directory that remains inaccessible without the correct password.

Installing EncFS:

sudo apt install encfs

Setting Up an Encrypted Directory:

encfs ~/.hidden-folder ~/visible-folder

When prompted, enter a password. Now, any files stored in ~/hidden-folder will be encrypted and invisible unless mounted via ~/visible-folder.

To unmount and hide the folder:

fusermount -u ~/visible-folder

Hiding Files in an Image (Steganography)

For an advanced approach, you can hide files inside an image using steghide. This method embeds data within a file without altering its visible content.

Installing Steghide:

sudo apt install steghide

Hiding a File Inside an Image:

steghide embed -cf image.jpg -ef secret.txt

You’ll be prompted for a passphrase.

Extracting the Hidden File:

steghide extract -sf image.jpg

These methods provide different levels of security and privacy depending on your needs. Whether you want a quick hide, file encryption, or advanced obfuscation, Ubuntu has a solution.

Windows VPS
U
Loading...

Related Posts