需求描述:
今天一个同事发过来一个压缩文件,让传送到linux服务器上,传上去之后,发现是rar格式的
之前没有解压过,就找了一些解压方法,在此记录下.
操作过程:
1.下载rar在linux环境下的安装包
下载地址:https://www.rarlab.com/rar/rarlinux-x64-5.5.0.tar.gz
2.将rar安装包上传到服务器上
[root@testvm software]# ls -l rar*
-rw-r--r-- 1 root root 536028 Jun 4 10:40 rarlinux-x64-5.5.0.tar.gz
3.解压该安装包,然后进行安装
[root@testvm software]# tar -zxf rarlinux-x64-5.5.0.tar.gz
[root@testvm software]# cd rar
[root@testvm 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
备注:软件已经安装完成了.
4.上传rar文件,进行解压测试
[root@testvm test]# ls -l
total 280
-rw-r--r-- 1 root root 283518 Jun 4 10:09 build.rar
[root@testvm test]# rar x build.rar RAR 5.50 Copyright (c) 1993-2017 Alexander Roshal 11 Aug 2017
Trial version Type 'rar -?' for help Extracting from build.rar Creating build OK
Extracting build/asset-manifest.json OK
Extracting build/business.json OK
Extracting build/favicon.ico OK
Extracting build/index.html OK
Extracting build/manifest.json OK
Creating build/resources OK
Creating build/resources/icon OK
Extracting build/resources/icon/iconfont.css OK
Extracting build/resources/icon/iconfont.eot OK
Extracting build/resources/icon/iconfont.svg OK
Extracting build/resources/icon/iconfont.ttf OK
Extracting build/resources/icon/iconfont.woff OK
Extracting build/service-worker.js OK
Creating build/static OK
Creating build/static/css OK
Extracting build/static/css/main.dc903dc2.css OK
Creating build/static/js OK
Extracting build/static/js/main.7b35a52f.js OK
Creating build/static/media OK
Extracting build/static/media/iconfont.715ffea7.ttf OK
Extracting build/static/media/iconfont.79c4ad9a.eot OK
Extracting build/static/media/iconfont.f8b575df.svg OK
All OK
[root@testvm test]# ls -l
total 284
drwxr-xr-x 4 root root 4096 Jun 4 10:06 build
-rw-r--r-- 1 root root 283518 Jun 4 10:09 build.rar
备注:使用rar x命令已经完成解压,并且文件都解压到build目录下,这个目录就是rar文件的名字去掉后缀.
5.也可以将文件解压到当前的路径下,就不是在build路径了.使用rar e命令
[root@testvm test]# rm -rf build
[root@testvm test]# rar e build.rar RAR 5.50 Copyright (c) 1993-2017 Alexander Roshal 11 Aug 2017
Trial version Type 'rar -?' for help Extracting from build.rar Extracting asset-manifest.json OK
Extracting business.json OK
Extracting favicon.ico OK
Extracting index.html OK
Extracting manifest.json OK
Extracting iconfont.css OK
Extracting iconfont.eot OK
Extracting iconfont.svg OK
Extracting iconfont.ttf OK
Extracting iconfont.woff OK
Extracting service-worker.js OK
Extracting main.dc903dc2.css OK
Extracting main.7b35a52f.js OK
Extracting iconfont.715ffea7.ttf OK
Extracting iconfont.79c4ad9a.eot OK
Extracting iconfont.f8b575df.svg OK
All OK
[root@testvm test]# ls -l
total 1468
-rw-r--r-- 1 root root 352 Jun 4 10:03 asset-manifest.json
-rw-r--r-- 1 root root 283518 Jun 4 10:09 build.rar
-rw-r--r-- 1 root root 146 Jun 4 10:02 business.json
-rw-r--r-- 1 root root 3870 Jun 4 10:02 favicon.ico
-rw-r--r-- 1 root root 9788 Jun 4 10:03 iconfont.715ffea7.ttf
-rw-r--r-- 1 root root 9968 Jun 4 10:03 iconfont.79c4ad9a.eot
-rw-r--r-- 1 root root 10498 Jun 4 10:02 iconfont.css
-rw-r--r-- 1 root root 9968 Jun 4 10:02 iconfont.eot
-rw-r--r-- 1 root root 39154 Jun 4 10:03 iconfont.f8b575df.svg
-rw-r--r-- 1 root root 39154 Jun 4 10:02 iconfont.svg
-rw-r--r-- 1 root root 9788 Jun 4 10:02 iconfont.ttf
-rw-r--r-- 1 root root 6036 Jun 4 10:02 iconfont.woff
-rw-r--r-- 1 root root 552 Jun 4 10:03 index.html
-rw-r--r-- 1 root root 761199 Jun 4 10:03 main.7b35a52f.js
-rw-r--r-- 1 root root 277807 Jun 4 10:03 main.dc903dc2.css
-rw-r--r-- 1 root root 317 Jun 4 10:02 manifest.json
-rw-r--r-- 1 root root 3396 Jun 4 10:03 service-worker.js
备注:解压出来的文件就和build.rar在一个路径下了,所以使用中,解压到哪里要看使用场景,一般是rar x
文档创建时间:2018年6月4日11:24:16