Linux本身不支持unrar和rar命令,需要我们安装RAR for Linux
地址:https://www.rarlab.com/download.htm选择对应的版本进行下载。
文章源自小柒网-https://www.yangxingzhen.cn/7242.html
一、下载并安装rar软件
1、下载
文章源自小柒网-https://www.yangxingzhen.cn/7242.html
[root@localhost ~]# wget https://www.rarlab.com/rar/rarlinux-x64-5.9.0.tar.gz
文章源自小柒网-https://www.yangxingzhen.cn/7242.html
2、安装
文章源自小柒网-https://www.yangxingzhen.cn/7242.html
[root@localhost ~]# tar xf rarlinux-x64-5.9.0.tar.gz
文章源自小柒网-https://www.yangxingzhen.cn/7242.html
[root@localhost ~]# cd rar/
文章源自小柒网-https://www.yangxingzhen.cn/7242.html
[root@localhost rar]# make && make install
文章源自小柒网-https://www.yangxingzhen.cn/7242.html
二、压缩和解压用法
1、压缩:rar a [不含.rar后缀的压缩包名字] [需要压缩的文件或者文件夹]
文章源自小柒网-https://www.yangxingzhen.cn/7242.html
2、解压:rar x [rar的压缩包]
文章源自小柒网-https://www.yangxingzhen.cn/7242.html
三、具体例子
实例:将/tmp目录压缩为tmp.rar
文章源自小柒网-https://www.yangxingzhen.cn/7242.html
[root@localhost ~]# rar a tmp.rar /tmp
将tmp.rar 解压
[root@localhost ~]# rar x tmp.rar
四、rar更多命令,查看帮助
[root@localhost ~]# rar
Linux最后更新:2023-8-21