Basic Commands Les i Compress and Decompress Files Using Rar Bzip Tar Ball Tar and Gunzip
Transcript of Basic Commands Les i Compress and Decompress Files Using Rar Bzip Tar Ball Tar and Gunzip
-
8/2/2019 Basic Commands Les i Compress and Decompress Files Using Rar Bzip Tar Ball Tar and Gunzip
1/6
Basic commands,Part I: Compress and decompress files using rar, bzip, tarball(tar) and gunzip
Written by M. Zinoune (Zinovsky)
This is a serie of lessons of ``Basic Commands `` that focuses on command-line usage, in this
serie you will learn the tools and tricks of the command line, which are in many cases faster,
more powerfull, and more flexible than GUIprogram.
Today in this part will show you the main commands to compress/decompress files using rar,
bzip, tarball(tar) and gunzip.
Tarball (tar):
GNU tar is an archiver that creates and handles file archives in various formats using the 'tar'
command ,it was originally used as a backup tool to write data to magnetic tape drives .You can
use tar to create file archives, to extract files from previously created archives, store additional
files, or update or list files which were already stored.
-Create a uncompressed tarball :
tar -cvf archive.tar file1
-Create an archive containing 'file1', 'file2' and 'dir1:
tar -cvf archive.tar file1 file2 dir1
-Show contents of an archive:
tar -tf archive.tar
-Extract a tarball :
tar -xvf archive.tar
-Extract a tarball into / tmp :
1 / 6
-
8/2/2019 Basic Commands Les i Compress and Decompress Files Using Rar Bzip Tar Ball Tar and Gunzip
2/6
Basic commands,Part I: Compress and decompress files using rar, bzip, tarball(tar) and gunzip
Written by M. Zinoune (Zinovsky)
tar -xvf archive.tar -C /tmp
-Create a tarball compressed into bzip2
tar -cvfj archive.tar.bz2 dir1
-Decompress a compressed tar archive in bzip2
tar -xvfj archive.tar.bz2
-Decompress a compressed tar archive in gzip
tar -cvfz archive.tar.gz dir1
-Decompress a compressed tar archive in gzip
tar -xvfz archive.tar.gz
Meanning of the c,v,f and z,j options:
-'c' option tells tar to create an archive,
-'v' displays the files added to the tarball and
-'f' specifies the filename. After the filename, all other parameters are the files or directories to
add to the archive.
Tarballs are commonly compressed using gzip or bzip2 using the -z or -j command options.
For complete details, see the tar man page
$ man tar
bzip2 :
2 / 6
-
8/2/2019 Basic Commands Les i Compress and Decompress Files Using Rar Bzip Tar Ball Tar and Gunzip
3/6
Basic commands,Part I: Compress and decompress files using rar, bzip, tarball(tar) and gunzip
Written by M. Zinoune (Zinovsky)
bzip2 is a freely available, patent free (see below), high-quality data compressor. It typically
compresses files to within 10% to 15% of the best available techniques (the PPM family of
statistical compressors), whilst being around twice as fast at compression and six times faster at
decompression.(Read the documentation of bzip2).
-Compress a file called 'file1'
bzip2 file1
-Compress a file called 'file1'
bzip2 file1
-Decompress a file called 'file1.bz2'
bunzip2 file1.bz2
RAR Archiver :
RAR is a proprietary file format for data compression and archiving, developed by EugeneRoshal.
Under Linux and UNIX, use command called unrar. By default unrar is not being installed on
Linux, FreeBSD or UNIX oses. You can install unrar command with the help of apt-get or yum
command. See how to install rar on Linux
-Create an archive rar called 'file1.rar'
rar a file1.rar test_file
-Compress 'file1', 'file2' and 'dir1' simultaneously
rar a file1.rar file1 file2 dir1
-Decompress rar archive
3 / 6
http://linux-tutorials/170-how-to-install-rar-archiver-in-linuxhttp://linux-tutorials/170-how-to-install-rar-archiver-in-linux -
8/2/2019 Basic Commands Les i Compress and Decompress Files Using Rar Bzip Tar Ball Tar and Gunzip
4/6
Basic commands,Part I: Compress and decompress files using rar, bzip, tarball(tar) and gunzip
Written by M. Zinoune (Zinovsky)
rar x file1.rar
OR
unrar x file1.rar
Gzip :
gzip is a software application used for file compression. gzip is short for GNU zip; the program
is a free software replacement for the
compress
program used in early Unix systems, intended for use by the GNU Project.
gzip was created by Jean-Loup Gailly and Mark Adler. Version 0.1 was first publicly released on
October 31, 1992. Version 1.0 followed in February 1993.Gzip reduces the size of the named files using Lempel-Ziv coding (LZ77). Whenever possible,
each file is replaced by one with the extension .gz, while keeping the same ownership
modes, access and modification times.There is a good article if you want to learn more a bout
gzip, see this link.
-Decompress a file called 'file1.gz'
gunzip file1.gz
-Compress a file called 'file1'
gzip file1
-Compress with maximum compression
gzip -9 file1
ZIP Archiver:
4 / 6
-
8/2/2019 Basic Commands Les i Compress and Decompress Files Using Rar Bzip Tar Ball Tar and Gunzip
5/6
Basic commands,Part I: Compress and decompress files using rar, bzip, tarball(tar) and gunzip
Written by M. Zinoune (Zinovsky)
zip is a compression and file packaging utility for Unix, VMS, MSDOS, OS/2, Windows NT,
Minix, Atari and Macintosh, Amiga and Acorn RISC OS. It is analogous to a combination of
the UNIX commands tarand compress.
-Create an archive compressed in zip
zip file1.zip file1
-Compress in zip several files and directories simultaneously
zip -r file1.zip file1 file2 dir1
-Decompress a file called file1
unzip file1
This was all for this part, see you in Part II of Basic commands lessons series.
Links :
1. http://directory.fsf.org/project/tar/
2. http://www.ubuntuforums.org
3. http://www.gnu.org/software/tar/tar.html
4. http://www.bzip.org/
5. http://www.cyberciti.biz/6. http://www.gzip.org/
5 / 6
http://directory.fsf.org/project/tar/http://www.ubuntuforums.org/http://www.gnu.org/software/tar/tar.htmlhttp://www.bzip.org/http://www.cyberciti.biz/http://www.gzip.org/http://www.gzip.org/http://www.cyberciti.biz/http://www.bzip.org/http://www.gnu.org/software/tar/tar.htmlhttp://www.ubuntuforums.org/http://directory.fsf.org/project/tar/ -
8/2/2019 Basic Commands Les i Compress and Decompress Files Using Rar Bzip Tar Ball Tar and Gunzip
6/6
Basic commands,Part I: Compress and decompress files using rar, bzip, tarball(tar) and gunzip
Written by M. Zinoune (Zinovsky)
7. http://linux.about.com/od/commands/l/blcmdl1_gzip.htm
8. http://en.wikipedia.org/
{loadposition user9}
Related Articles By Tags :
{loadposition user1}
6 / 6
http://linux.about.com/od/commands/l/blcmdl1_gzip.htmhttp://en.wikipedia.org/http://en.wikipedia.org/http://linux.about.com/od/commands/l/blcmdl1_gzip.htm