压缩 解压 压缩率

 

.gz

gzip

[hadoop@bigdata-server-01 dataset]$ ll -a
total 90920
drwxrwxr-x  2 hadoop hadoop     4096 Nov 23 17:32 .
drwxr-xr-x 17 hadoop hadoop     4096 Nov 23 17:32 ..
-rw-rw-r--  1 hadoop hadoop 93093001 Aug  1  2016 VS14MORT.txt.gz

[hadoop@bigdata-server-01 dataset]$ gzip -h
Usage: gzip [OPTION]... [FILE]...
Compress or uncompress FILEs (by default, compress FILES in-place).

Mandatory arguments to long options are mandatory for short options too.

  -c, --stdout      write on standard output, keep original files unchanged
  -d, --decompress  decompress
  -f, --force       force overwrite of output file and compress links
  -h, --help        give this help
  -l, --list        list compressed file contents
  -L, --license     display software license
  -n, --no-name     do not save or restore the original name and time stamp
  -N, --name        save or restore the original name and time stamp
  -q, --quiet       suppress all warnings
  -r, --recursive   operate recursively on directories
  -S, --suffix=SUF  use suffix SUF on compressed files
  -t, --test        test compressed file integrity
  -v, --verbose     verbose mode
  -V, --version     display version number
  -1, --fast        compress faster
  -9, --best        compress better
    --rsyncable   Make rsync-friendly archive

With no FILE, or when FILE is -, read standard input.

Report bugs to <bug-gzip@gnu.org>.
[hadoop@bigdata-server-01 dataset]$ gzip -dv ~/dataset/*.gz -C  ~/dataset/
gzip: invalid option -- 'C'
Try `gzip --help' for more information.
[hadoop@bigdata-server-01 dataset]$ gzip -dv ~/dataset/*.gz ~/dataset/
/usr/hadoop/dataset/VS14MORT.txt.gz:    V 92.8% -- replaced with /usr/hadoop/dataset/VS14MORT.txt
gzip: /usr/hadoop/dataset/ is a directory -- ignored
[hadoop@bigdata-server-01 dataset]$ ll -a
total 1264208
drwxrwxr-x  2 hadoop hadoop       4096 Nov 23 17:41 .
drwxr-xr-x 17 hadoop hadoop       4096 Nov 23 17:32 ..
-rw-rw-r--  1 hadoop hadoop 1294536132 Aug  1  2016 VS14MORT.txt
[hadoop@bigdata-server-01 dataset]$ 

 

 

http://www.cnblogs.com/eoiioe/archive/2008/09/20/1294681.html

 

 

http://www.cnblogs.com/linjiqin/archive/2013/03/24/2979736.html

 

[root@hadoop1 local]# tar xvf rarlinux-x64-5.5.0.tar.gz
rar/
rar/order.htm
rar/acknow.txt
rar/readme.txt
rar/default.sfx
rar/license.txt
rar/rarfiles.lst
rar/whatsnew.txt
rar/makefile
rar/rar
rar/unrar
rar/rar.txt
[root@hadoop1 local]# ll -as | grep rar
     4 drwxr-xr-x   2   1000   1000      4096 8月  11 21:59 rar
   524 -rw-r--r--   1 root   root      536028 8月  11 21:59 rarlinux-x64-5.5.0.tar.gz

[root@hadoop1 local]# cd rar
[root@hadoop1 rar]# ll -as
总用量 1172
  4 drwxr-xr-x   2 1000 1000   4096 8月  11 21:59 .
  4 drwxr-xr-x. 30 root root   4096 12月 20 09:43 ..
  8 -rw-r--r--   1 1000 1000   4188 8月  11 21:59 acknow.txt
176 -rwxr-xr-x   1 1000 1000 179200 8月  11 21:59 default.sfx
  8 -rw-r--r--   1 1000 1000   6753 8月  11 21:59 license.txt
  4 -rw-r--r--   1 1000 1000    428 8月  11 21:59 makefile
  4 -rw-r--r--   1 1000 1000   3144 8月  11 21:59 order.htm
532 -rwxr-xr-x   1 1000 1000 541648 8月  11 21:59 rar
  4 -rw-r--r--   1 1000 1000   1177 8月  11 21:59 rarfiles.lst
100 -rw-r--r--   1 1000 1000  99524 8月  11 21:59 rar.txt
  4 -rw-r--r--   1 1000 1000    692 8月  11 21:59 readme.txt
304 -rwxr-xr-x   1 1000 1000 307352 8月  11 21:59 unrar
 20 -rw-r--r--   1 1000 1000  19621 8月  11 21:59 whatsnew.txt
[root@hadoop1 rar]# make
mkdir -p /usr/local/bin
mkdir -p /usr/local/lib
cp rar unrar /usr/local/bin
cp rarfiles.lst /etc
cp default.sfx /usr/local/lib
[root@hadoop1 rar]# make install
mkdir -p /usr/local/bin
mkdir -p /usr/local/lib
cp rar unrar /usr/local/bin
cp rarfiles.lst /etc
cp default.sfx /usr/local/lib
[root@hadoop1 rar]# rar

 

linux压缩(解压缩)命令详解 - CSDN博客 https://blog.csdn.net/hbcui1984/article/details/1583796

 

 

压缩文件夹

 


1015 zip -h2
1016 mkdir testzip
1017 cp visit-2019-01-10 testzip/
1018 cd testzip/
1019 ll -as
1020 cp visit-2019-01-10 v
1021 cd ..
1022 ll -as
1023 zip -h2
1024 zip -9r test.zip testzip
1025 du --max-depth=1 -h ./

 

[root@a data]# zip -9r test.zip testzip
adding: testzip/ (stored 0%)
adding: testzip/visit-2019-01-10 (deflated 86%)
adding: testzip/v (deflated 86%)
[root@a data]# du --max-depth=1 -h ./
141G ./unionlog
8.0K ./tmpXL
12K ./ossBak
194M ./dbbak
669M ./mysql
4.0K ./tmp
248M ./UnifiedLog
3.4G ./elasticsearch
2.3G ./bigdata
16K ./lost+found
12K ./PEAR
274M ./testzip
5.8M ./gateway
2.3M ./nginx
21G ./visitlog
169G ./
[root@a data]# ll -ash

 

空间大小由1变成1-86%;

 

[root@a data]# zip -9 visit-2019-01-03-u.zip visit-2019-01-03-u
adding: visit-2019-01-03-u (deflated 90%)
[root@a data]# ll -ash
total 1.2G
4.0K drwxr-xr-x 17 root root 4.0K Jan 10 12:00 .
4.0K dr-xr-xr-x. 26 root root 4.0K Dec 30 09:44 ..
4.0K drwxr-xr-x 3 root root 4.0K Dec 10 08:48 bigdata
4.0K drwxr-xr-x 2 root root 4.0K Jun 8 2018 dbbak
4.0K drwxr-xr-x 4 elsearch elsearch 4.0K Dec 30 2016 elasticsearch
4.0K drwxr-xr-x 3 root root 4.0K Nov 16 14:55 gateway
16K drwx------ 2 root root 16K Dec 30 2016 lost+found
4.0K drwxr-xr-x 3 mysql mysql 4.0K Dec 30 09:41 mysql
4.0K drwxr-xr-x 3 root root 4.0K Nov 17 16:00 nginx
4.0K drwxr-xr-x 2 root root 4.0K Jan 8 09:01 ossBak
4.0K drwxr-xr-x 2 root root 4.0K Sep 28 15:01 PEAR
4.0K drwxr-xr-x 2 root root 4.0K Jan 10 11:50 testzip
40M -rw-r--r-- 1 root root 40M Jan 10 11:51 test.zip
4.0K drwxr-xr-x 2 root root 4.0K Dec 30 10:59 tmp
4.0K drwxr-xr-x 2 root root 4.0K Oct 12 10:19 tmpXL
4.0K drwxr-xr-x 6 root root 4.0K Nov 1 09:32 UnifiedLog
20K drwxr-xr-x 2 nginx nginx 20K Jan 10 00:00 unionlog
890M -rw-r--r-- 1 root root 890M Jan 10 11:59 visit-2019-01-03-u
87M -rw-r--r-- 1 root root 87M Jan 10 12:00 visit-2019-01-03-u.zip
137M -rw-r--r-- 1 root root 137M Jan 10 11:45 visit-2019-01-10
20M -rw-r--r-- 1 root root 20M Jan 10 11:48 visit-2019-01-10.zip
20K drwxr-xr-x 2 nginx nginx 20K Jan 10 00:00 visitlog
[root@a data]#

空间变为原来的10%

 

posted @ 2017-11-23 17:44  papering  阅读(486)  评论(0编辑  收藏  举报