Thursday, July 17, 2008

Compress and Extract Files under Linux

A compressed file is a collection of files or directories that are stored in one file and stored in a way that uses less disk space than all the individual files or directories combined. Sometimes useful to compress files into one file so that they use less disk space and download faster via the Internet.

C : Compress file
E : Extract file

zip

C : zip -r FILENAME.zip FILENAME

E : unzip FILENAME.zip


tar

C: tar -cf FILENAME.tar FILENAME

E: tar xvf FILENAME.tar


rar

C: rar a FILENAME.rar FILENAME

E: unrar x FILENAME.rar


gz

C: gzip -c FILENAME > FILENAME.gz

E: gzip -d FILENAME.gz


tar.gz

C: tar -cf FILENAME.tar FILENAME
and then write
gzip -c FILENAME.tar > FILENAME.tar.gz

E : tar zxvf NAMFILE.tar.gz


bzip2, bunzip2

C: bzip -z NAMAFILE > NAMAFILE.bz

E: bzip2 -d NAMAFILE.bz > NAMAFILE

No comments: