File Compression

As we know many files can be reduced in file size by compressing their Contents. Moreoever, many files compression activities includes combining multiple files. Now, following commands are used in linux to handle the compression and decompression of files.

Compression


1). "tar -cvf file_name.tar filename/directory" -> This command will command files will bundle a bunch of files together and creates an archive file and will get saved in same location from where the command was run from, before we proceed let w3clan define tar, it is actually "tape archive". This tar command doesnot combine, this puts multiple files together into one name.So you must be surprised than what is the command for archive. we have "-cvf" parameter followed by tar, yes these defines the rest action.

c -> "Create" a new archive.
v -> display a "verbose" output to the end user.
f -> for the given "filename".

Example

tar -cvf w3box.tar ~/My_Documents/w3box/

So, now you have new archive with name w3box.tar in w3box directory.

2). "gzip file_name.tar" -> Ok, here we will learn 1 new word (LZ77) this means Lempel-Ziv coding. So "gzip" command is used to compress files using the LZ77 method. This command doesn't create any new files, this replaces the old files, in most cases the files are already "tar'd"{See above to this point}. Even we can see the command file_name has ".tar" extension, now what to do and what is output, see below

gzip w3box.tar

will give you w3box.tar.gz or w3box.tgz, and your original file w3box.tar will be over-written

3). "bzip2 file_name" -> (bzip means big zip), This command will compress a file, identified by file_name using the "Burrows-Wheeler block sorting" text compression algorithm and "huffman coding".
For more detail about Google Search Results for: Burrows-Wheeler transform & Google Search Results for: Huffman Coding algorithm Click the link of google, w3clan is sure you will come to know more about this, after checking the link as the first link is one and w3clan favorite page "wiki". Example

bzip2 w3box.txt
bzip2 w3box.txt w3clan.txt c1ph3r.txt x-code.txt nocdem.txt noes1s.txt > w3box.bz2

This method is better than gunzip method or method described in point 2, and extension is (.bz2)


Loading ...

Related Results :

  1. File Compression
  2. Eloquent : Model Getting Started
  3. Monitor , Log , Start or Stop Service
  4. bzip2
  5. Fetch Gravatar Image
Note :
  • Related Posts are generally User Blog posts.
  • or Other tutorials from other networks of w3clan.com.
  • Any registered user can create related posts based on search term tags.

About the Author