воскресенье, 17 октября 2010 г.

Tarballs and linux compression utils .tgz .tbz2 etc.

Well the general compressed archive format  is tar.gz or tar.bz2
It means compressed .tar file.And Tar means Tape Archive.
Its just makes one file that contains other in it.
And after that we compress it :D

So,commands are:
{
to try example you can
# touch file1
# mkdir dir
}

To make just TAR
# tar -cf archive.tar file1 dir/
or simplier
# tar -cf archive.tar *


-cf key means Create File

Of course you can just Zip like in Windows.But Tar has advantage that it saves file rights.

Now we will make TAR.GZ
# tar -cf arch.tar *
# gzip arch.tar

or simplier

# tar -czf arch.tar.gz *


Second type is bzip2.It compresses a bit better.

# tar -cf arch.tar *
# bzip2 -z arch.tar

Now we have arch.tar.bz2


Decompressing...
# tar -xzf arch.tar.gz
or
# gunzip arch.tgz
# tar -xf arch.tar


Bzip2....
# bzip2 -d arch.tar.bz2
# tar -xf arch.tar
or
# bunzip2 arch.tar.bz2




About .zip  and .rar
It is the same.You use commands like zip or ra.But you must install it first.
# sudo apt-get install zip rar (in Debian/Ubuntu)
Gzip,Tar and Bzip2 is on all Linux distrs ;)

Some examples:
# zip arch.zip *
# rar a arch.rar *
In rar a stands for Append


# unzip arch.zip
# rar e arch.rar


For more info:
# man tar
# man gzip
# man bzip2
# man zip
# man rar

To exit from man press Q

Комментариев нет:

Отправить комментарий