Selasa, 25 Agustus 2020

How to compress decompress file using bzip2

  Tidak ada komentar

File size before compressed

   0 -rw-------   1 root   root      0 Aug 16 03:12 maillog-20200823
512K -rw-------   1 root   root   287K Aug 26 11:10 messages
211M -rw-------   1 root   root   211M Aug  2 03:28 messages-20200802
225M -rw-------   1 root   root   225M Aug  9 03:46 messages-20200809
200M -rw-------   1 root   root   200M Aug 16 03:12 messages-20200816
164M -rw-------   1 root   root   164M Aug 23 03:10 messages-20200823
3.8M -rw-------   1 root   root   3.8M Aug 26 10:58 messages-20200826.bz2
   0 drwxr-xr-x.  2 root   root    132 Jul 13 16:47 ntopng

Command to compress file using bzip2
[[email protected] log]# bzip2 -z messages-20200802
[[email protected] log]#

The result of file after compressed
   0 -rw-------   1 root   root      0 Aug 16 03:12 maillog-20200823
512K -rw-------   1 root   root   377K Aug 26 11:13 messages
 10M -rw-------   1 root   root    10M Aug  2 03:28 messages-20200802.bz2
225M -rw-------   1 root   root   225M Aug  9 03:46 messages-20200809
200M -rw-------   1 root   root   200M Aug 16 03:12 messages-20200816
164M -rw-------   1 root   root   164M Aug 23 03:10 messages-20200823
3.8M -rw-------   1 root   root   3.8M Aug 26 10:58 messages-20200826.bz2
   0 drwxr-xr-x.  2 root   root    132 Jul 13 16:47 ntopng


Some files size after compression using bzip2
   0 -rw-------   1 root   root      0 Aug 16 03:12 maillog-20200823
512K -rw-------   1 root   root   455K Aug 26 11:16 messages
 10M -rw-------   1 root   root    10M Aug  2 03:28 messages-20200802.bz2
9.7M -rw-------   1 root   root   9.7M Aug  9 03:46 messages-20200809.bz2
9.0M -rw-------   1 root   root   9.0M Aug 16 03:12 messages-20200816.bz2
7.5M -rw-------   1 root   root   7.5M Aug 23 03:10 messages-20200823.bz2
3.8M -rw-------   1 root   root   3.8M Aug 26 10:58 messages-20200826.bz2
   0 drwxr-xr-x.  2 root   root    132 Jul 13 16:47 ntopng

Command to decompress file that compressed using bzip2
[[email protected] log]# bzip2 -d messages-20200802.bz2
[[email protected] log]#
File result after decompression
   0 -rw-------   1 root   root      0 Aug 16 03:12 maillog-20200823
512K -rw-------   1 root   root   458K Aug 26 11:16 messages
211M -rw-------   1 root   root   211M Aug  2 03:28 messages-20200802
9.7M -rw-------   1 root   root   9.7M Aug  9 03:46 messages-20200809.bz2
9.0M -rw-------   1 root   root   9.0M Aug 16 03:12 messages-20200816.bz2
7.5M -rw-------   1 root   root   7.5M Aug 23 03:10 messages-20200823.bz2
3.8M -rw-------   1 root   root   3.8M Aug 26 10:58 messages-20200826.bz2
   0 drwxr-xr-x.  2 root   root    132 Jul 13 16:47 ntopng


Tidak ada komentar :

Posting Komentar