Firefox 16, a treat for developers http://t.co/cnd27CzT
Basic commands,Part I: Compress and decompress files using rar, bzip, tarball(tar) and gunzip
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 :
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 :
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 Eugene Roshal.
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
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:
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 tar and 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 :
- http://directory.fsf.org/project/tar/
- http://www.ubuntuforums.org
- http://www.gnu.org/software/tar/tar.html
- http://www.bzip.org/
- http://www.cyberciti.biz/
- http://www.gzip.org/
- http://linux.about.com/od/commands/l/blcmdl1_gzip.htm
- http://en.wikipedia.org/
{loadposition user9}
Related Articles By Tags :
{loadposition user1}
-
-
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
http://www.bestfinance-blog.com
-
Like us on Facebook
This week Top Posts 
Top Things to do After Installing Ubuntu 13.04 ‘Raring Ringtail’ : Ubuntu 13.04 Raring Ringtail final is almost out. The final release it scheduled for release on Apri...0 comment(s) |
Install lamp with 1 command in Ubuntu 12.10, 13.04 Raring Ringtail & LinuxMint13 : Updated: 10/09/2012 :LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform ...0 comment(s) |
Howto: Upgrade to Ubuntu 13.04 Raring Ringtail from 12.04, 12,10 | Desktop & Server : Updated 05-04-2013: Ubuntu 13.04 Raring Ringtail will be released Soon, If you have ubuntu 12,10, 12...0 comment(s) |
Steganography- Hide Your Files Inside An Image in Linux : Nowadays, our personal computer is not only a work tool, it is also our private space where we sto...1 comment(s) |
Scan Your Home Network With Nmap : Who should read this article? Everyone who is interested in computer security and computer networkin...0 comment(s) |
How to use Remote Desktop in Ubuntu : Sometimes, we need to access our computer from other locations when we’re not at home and such. This...0 comment(s) |
Recent Posts
- Secure File from Removal in Linux and Unix
- How to Install Nginx on FreeBSD 9.x
- Create a Launcher in Ubuntu Using Bash
- Scan Your Home Network With Nmap
- Steganography- Hide Your Files Inside An Image in Linux
- Unix/Linux File Recognition. Did You Know?
- Migrate from MySQL to MariaDB in FreeBSD
- Connect Your Android Galaxy Tablet to Ubuntu via USB
- ElementaryOS Beta 1 and 2 Comparison and Review
- Introduction to the Linux Command Line
Recent Comments



















Pat L
| #
I tried it and it works with a regular zip file, but if you password-protect the .zip file it does NOT work.
SK
| #
Yes we can. What kind of help you need? We are doing outsourcing and technical support for Linux and Open source worldwide. To know more about the details visit here.
ClintB
| #
After install as above, run shell script /opt/Citrix/ICAClient/wfica.sh manually and note lib errors still occur. I had the x64 motif loaded but had to manually install the x86 too. Got that from http://rpmfind.net/linux/rpm2html/search.php?query=libXm.so.4 Even after that, I still had to do a “yum install alsa-lib.i686 alsa-lib.x86_64″ to resolve any additional libasound.so.2 errors. Once those two lib issues were resolved, Citix Web Interface launched apps fine by telling browser to open launch.ica using /opt/Citrix/ICAClient/wfica.sh. Good luck Ernesto!
AD
| #
I need some Help on Linux,can you guide me ?
Edson Carlos
| #
In debian no found. I need link download install in linux debian