Everyone faces a time where they have to hide stuff from others. Well everyone knows the classic way of hiding files deep inside a folder but in some cases it might not be enough to keep smart people from peeking on your files. In this case, hiding your files under an image might work fine.
Before we start, create a directory containing an image file (.jpg or .png ), and the file or folder you wish to hide. Just for our example, we are going to hide a directory of files, named secret_files. Our original image file is htg-site.png. We use the
cd command to change to the directory that has the image and the file or folder to be hidden.
We will now create compressed file that has the directory we want to hide in the image. To do this, we type the following command in the shell.
zip -r secret.zip secret_files/
In the command above,
-r will include all the subdirectories that are within the specified directory in compressed file. The name of the compressed file we choose is
secret.zip and the name of the directory that it is to be compressed is
When you are back at the command prompt, type
ls . You will now see the
secret.zip file listed.
Now, we are going to add the compressed file and image file together, and save the result as a new image file using the
cat command. In our example, we type the following command at the prompt.
cat htg-site.png secret.zip > secret.png
First the original image file must be listed before the compressed file name you want to insert into the image file. Then, we direct the original image file and the compressed file to form a new image called
While using the
ls command at the prompt, you will see the new image file with the name
secret.png , which is hiding the compressed file. You can now display new image using any image viewer.
Once you have your new image which hides your folder or file, you can delete the compressed file and the original file, using
rm command. In our example, we went with the following two commands to delete our compressed file and the original folder.
rm -r secret_files
Now to access the hidden folder again, make sure you are in the directory that the image in which your file or folder is hidden. Now, extract the file or folder from the image by typing the below command.
Substitute the name of your image file with
secret.png in the above command.
secret_files directory is available again, and when we change to that directory (
cd secret_files/ ), and list the files (
ls ), we see our original files.
This is not necessarily the most secure way to protect your files. It just makes them less obvious to someone poking around your system.