[Ilugc] 1D1C - bzip2

  • From: tkdhanasekar@xxxxxxxxx (Dhana Sekar)
  • Date: Tue, 6 Aug 2013 21:26:38 +0530

command: bzip2
usage: bzip2 linux command is used to compress the file. Each file is
           replaced by a compressed version of itself with .bz2 extension.

syntax: $ bzip2 [options] filename

example:

1. To display info, help and options of this command

    $ bzip2 --help

2. To compress a file using bzip2
    for example a pdf file 'sample.pdf'

    $ ls -l

     -rw-rw-r-- 1  dhana dhana     164847  Feb 23 11:24  sample.pdf

    $ bzip2 -c -1 sample.pdf > sample.pdf.bz2

    $ ls -l

    -rw-rw-r-- 1 dhana dhana     164847 Feb 23 11:24 sample.pdf
    -rw-rw-r-- 1 dhana dhana     149142 Aug  6 21:16 sample.pdf.bz2

    the file size is reduced from 164847 to 149142

    by using the option -9 instead of -1 the file gets much reduced

    $ bzip2 -c -9 sample.pdf > sample.pdf.bz2

    $ ls -l

    -rw-rw-r-- 1 dhana dhana     164847 Feb 23 11:24 sample.pdf
    -rw-rw-r-- 1 dhana dhana     147879 Aug  6 21:17 sample.pdf.bz2

    when using -1 option the file reduced to 149142
    when using -9 option the file reduced to 147879

regards,
dhanasekar

Other related posts:

  • » [Ilugc] 1D1C - bzip2 - Dhana Sekar