ubuntu中如何解压rar文件

1、问题

ubuntu中解压rar文件, 如下:

root@PC1:/home/test2# ls
test.rar
root@PC1:/home/test2# unrar e test.rar
-bash: /usr/bin/unrar: No such file or directory

 

2、解决方法, 安装unrar

复制代码
root@PC1:/home/test2# apt install unrar
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  unrar
0 upgraded, 1 newly installed, 0 to remove and 98 not upgraded.
Need to get 113 kB of archives.
After this operation, 406 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu focal/multiverse amd64 unrar amd64 1:5.6.6-2build1 [113 kB]
Fetched 113 kB in 5s (20.7 kB/s)
Selecting previously unselected package unrar.
(Reading database ... 219903 files and directories currently installed.)
Preparing to unpack .../unrar_1%3a5.6.6-2build1_amd64.deb ...
Unpacking unrar (1:5.6.6-2build1) ...
Setting up unrar (1:5.6.6-2build1) ...
update-alternatives: using /usr/bin/unrar-nonfree to provide /usr/bin/unrar (unrar) in auto mode
Processing triggers for man-db (2.9.1-1) ...
复制代码

 

3、测试结果

复制代码
root@PC1:/home/test2# ls
test.rar
root@PC1:/home/test2# unrar e test.rar    ## unrar e rar文件 进行解压rar文件

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


Extracting from test.rar

Extracting  test.txt                                                  OK
All OK
root@PC1:/home/test2# ls   ## 解压成功
test.rar  test.txt
复制代码

 

4、如何压缩为rar文件?

root@PC1:/home/test2# ls
test.txt
root@PC1:/home/test2# rar a file.rar test.txt
-bash: /usr/bin/rar: No such file or directory
root@PC1:/home/test2# ls
test.txt

 

5、安装rar

复制代码
root@PC1:/home/test2# apt install rar
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  rar
0 upgraded, 1 newly installed, 0 to remove and 98 not upgraded.
Need to get 295 kB of archives.
After this operation, 799 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu focal/multiverse amd64 rar amd64 2:5.5.0-1build1 [295 kB]
Fetched 295 kB in 6s (46.9 kB/s)
Selecting previously unselected package rar.
(Reading database ... 219908 files and directories currently installed.)
Preparing to unpack .../rar_2%3a5.5.0-1build1_amd64.deb ...
Unpacking rar (2:5.5.0-1build1) ...
Setting up rar (2:5.5.0-1build1) ...
Processing triggers for man-db (2.9.1-1) ...
复制代码

 

6、测试

复制代码
root@PC1:/home/test2# ls
test.txt
root@PC1:/home/test2# rar a file.rar test.txt   ## 压缩为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 file.rar

Adding    test.txt                                                    OK
Done
root@PC1:/home/test2# ls    ## 压缩成功
file.rar  test.txt
复制代码

 

posted @   小鲨鱼2018  阅读(2541)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
历史上的今天:
2020-12-16 linux系统中部署apache服务(个人用户主页功能)
2020-12-16 linux系统部署apache服务(测试不同inux主机访问网站)
2020-12-16 linux中部署apache服务(http服务或者web服务)
2020-12-16 linux系统中部署autofs自动挂载服务
2020-12-16 python中同时给多个 变量赋值、同时清空多个变量
2020-12-16 python中表示幂的运算及控制运算顺序、数的下划线
2020-12-16 linux系统中部署网络文件共享NFS(两台linux主机实现文件共享)
点击右上角即可分享
微信分享提示