ubuntu中如何解压rar文件

2021/12/17 7:21:28

本文主要是介绍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

 



这篇关于ubuntu中如何解压rar文件的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程