linux中rar文件的压缩、解压

1、测试数据

root@ubuntu01:/home/test# ls
outcome.map  outcome.ped
root@ubuntu01:/home/test# ll -h
total 80M
drwxr-xr-x 2 root root 4.0K 3月  27 15:58 ./
drwxr-xr-x 6 root root 4.0K 3月  27 14:36 ../
-rw-r--r-- 1 root root 1.3M 10月 15  2018 outcome.map
-rw-r--r-- 1 root root  79M 10月 19  2018 outcome.ped

 

2、压缩为rar文件

root@ubuntu01:/home/test# ls
outcome.map  outcome.ped
root@ubuntu01:/home/test# rar a xxx.rar outcome.*    ## 压缩为rar文件

RAR 5.50   Copyright (c) 1993-2017 Alexander Roshal   11 Aug 2017
Trial version             Type 'rar -?' for help

Evaluation copy. Please register.

Creating archive xxx.rar

Adding    outcome.map                                                 OK
Adding    outcome.ped                                                 OK
Done
root@ubuntu01:/home/test# ls
outcome.map  outcome.ped  xxx.rar
root@ubuntu01:/home/test# rar a -m5 yyy.rar outcome.*      ## 以最大压缩率压缩

RAR 5.50   Copyright (c) 1993-2017 Alexander Roshal   11 Aug 2017
Trial version             Type 'rar -?' for help

Evaluation copy. Please register.

Creating archive yyy.rar

Adding    outcome.map                                                 OK
Adding    outcome.ped                                                 OK
Done
root@ubuntu01:/home/test# ls
outcome.map  outcome.ped  xxx.rar  yyy.rar    ## 查看压缩后大小的差异
root@ubuntu01:/home/test# ll -h
total 99M
drwxr-xr-x 2 root root 4.0K 3月  27 15:59 ./
drwxr-xr-x 6 root root 4.0K 3月  27 14:36 ../
-rw-r--r-- 1 root root 1.3M 10月 15  2018 outcome.map
-rw-r--r-- 1 root root  79M 10月 19  2018 outcome.ped
-rw-r--r-- 1 root root 9.7M 3月  27 15:59 xxx.rar
-rw-r--r-- 1 root root 9.1M 3月  27 16:00 yyy.rar

 

3、解压rar文件

root@ubuntu01:/home/test# ls
xxx.rar
root@ubuntu01:/home/test# unrar e xxx.rar

UNRAR 5.61 beta 1 freeware      Copyright (c) 1993-2018 Alexander Roshal


Extracting from xxx.rar

Extracting  outcome.map                                               OK
Extracting  outcome.ped                                               OK
All OK
root@ubuntu01:/home/test# ls
outcome.map  outcome.ped  xxx.rar

 

posted @ 2022-03-27 16:02  小鲨鱼2018  阅读(1294)  评论(0编辑  收藏  举报