In linux environment there is no possibilty not encounter on archives or compresed files. This article shows what is a difference between different types and how to handle and use them.
Archiving – doesn’t make compressions, only pack up folders with files and store them in one single file
tar – Tape Archive, stores folder structure to tape or file. Can handle with attributes from version 5 CentOS
star – alike tar but newer and supports ACls and SELinux attributes.
zip – both archiving and compresing at once, cross platform, not as efficient
Compresing – squeezing files and folders, reducing their volume.
gzip – shrinks a file, very common, very efficient
bzip2 – newer, even more efficient then gzip
tar and star may be compressed with gzip or bzip2 : tar.gz, tgz
ZIP
Star
star software has to be first installed in the system.
c-create
v- verbose
f- file
star cvf myfiles.star FILES
TAR
tar -cvf myfiles.tar FILES – creating tar
tar –selinux –acls -cvf myfiles.tar FILES – archiving with additional attributes
tar -xvf myfiles.tar – extracting, unarchiving tar file
x – extract
GZIP & BZIP2
with gzip and bzip2 we may compress a single file or an archive
gzip myfiles.tar —–> myfiles.tar.gz
gunzip myfiles.tar.gz —–> myfiles.tar – unzipping
bzip2 myfiles.tar ——-> myfiles.tar.bz2
bunzip2 myfiles.tar.bz2 ——> myfiles.tar – unzipping
Compresing decompresing on the fly in one step
tar -zcvf myfiles.tar.gz FILES – archiving tar and packing gzip
tar -zxvf myfiles.tar.gz FILES – unarchiving and unpacking
tar -jcvf myfiles.tar.bz2 FILES – archiving tar and packing bzip2
tar -jxvf myfiles.tar.bz2 FILES – unarchiving and unpacking
tar -zcvf myfiles.tgz – creating myfiles.tgz file what is the same as myfiles.tar.gz
unpacking with gunzip myfiles.tgz , then uarchiving with tar -xvf myfiles.tar: