Tag Archive: ZIP (file format)

Compression of files is a necessity these days. It’s not only helps you in saving your space but also helps you in quick sharing and back up purposes. Text files compresses more than the web images and videos because they are already in the compressed form .You must have observed many open source softwares  in the .tar.gz packages. These are the compressed file made out using the tar and gzip  (gunzip)  utility. So let’s get started with these great utilities 😀

Tar : Good practice for compressing a file  is to archive the files first and then compress them. So to create an archive of a  disk archive that contains a group of files or an entire directory , we should use the tar utility. Another advantage of the tar is that it also compresses the file to some extent. So using tar with gzip means double layer compression. To use the tar we should need to know some of its options:

-c : Create an archive
-x : Extract from the archive
-t : Display the files in archive
-f : Specify the archive named as arch

Create the archive : You can create the archive by following the syntax tar -cvf  file.tar file1 file2  . For Example- We created an archive named as html.tar for the html folder  by using the command tar -cvf  html.tar html . As I told you above tar compresses the file also. You can easily see this in the below screenshot  :

compression by tar

Extracting files from tar archive : You can extract the files for tar archive using the  ‘-x’  utility.  Follow this syntax and your file will get extracted tar -xvf  file.tar  

Gzip or Gunzip : Using this utility on the tar archive file adds an another layer of compression. As a result of both you got the .tar.gz file format. Challenger of the gzip is the bzip2 utility because it compresses the file in the greater ratio. But bzip2 is a slow compression process. So it depends on your needs which utility to use.

Compress using gzip : You can compress with the gzip using the simple syntax of gzip  filename . We are compressing the html.tar archive  further using the gzip . You can also use the  ordinary files in the filename  instead of the archive. We can see the compression ratio by using ‘-l’ option along with this utility. Below is the screenshot of the same :

gzip compression

Extracting the gzip compression : You can easily extract the gzip utility by using either the “gunzip” command or by using the ‘-d’ option with the gzip. In short you need to follow the following syntax : gzip -d  filename.gz  or  gunzip  filename.gz.

I hope this tutorial will be useful for you. Suggestions,feedback and queries are always welcome.

Pages : Follow ankurtwi on Twitter      

Have you accidentally deleted an important file because you are in a habit of using “Shift+Del” rather than delete only?? Well don’t panic. There is a utility named as “scalpel”  which helps you in recovering the so called “permanent deleted” files. Actually when you delete a file permanently (Accidentally or By Intention) , It doesn’t get removed from your hard disk. It get stored in certain blocks of the storage device and they continue to exist in the blocks unless you overwrite them with another files. This article will talk about utilities that will help you in the file recovery. It is always recommended that you shouldn’t recover a file from the device when it is mounted. You should always do the recovery process with the Live CD followed by the file searching in the device like in my case device is /dev/sda1 . If you are unable to understand the upper condition, just forget about it. I am not going to bore you with the theory part anymore. Let’s take a look at the utility.  

Scalpel is a file system independent recovery tool. It ‘s basically available for the Linux and Mac OS but you can also run it on windows by compiling it using the mingw. Latest version of scalpel is 2.0 . You can install it in Ubuntu by typing sudo apt-get install scalpel. After installing it you need to do some text editing. Scalpel utility has its configuration file in the /etc directory with full path as /etc/scalpel/scalpel.conf . When viewed (using gedit/nano/cat) you will notice that everything is a comment out there. Uncomment the file format which you want to recover. For example in my case I want to recover the .zip file so I will uncomment the .zip file section in the scalpel.conf file just like below.


After that go to the terminal and follow the syntax :
sudo scalpel <device name/Directory name/file name> -o <ouput directory>

Output directory is the directory where you want to restore your deleted files. It should be empty before running the command, otherwise you will get an error. You can also input the deleted filename directly by using -i option.You can see the screenshot of my device search below .


Although utilities are there to recover your file but I would recommend you guys to put a habit of delete only not of “Shift+Del” because prevention is always better than cure 😀 

Pages : Follow ankurtwi on Twitter      

%d bloggers like this: