博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何在Ubuntu 18.04上安装7Zip
阅读量:2533 次
发布时间:2019-05-11

本文共 8036 字,大约阅读时间需要 26 分钟。

If you’ve ever tried to send large files then you would definitely know about . From almost 2 decades now, 7Zip allowed us to get a higher compression ratio. Apart from getting high compression ratio, you can get support for extracting and compressing RAR files on Ubuntu with 7Zip. Apart from the GUI, you have used in Windows computers, 7Zip is also available to use with CLI with p7zip command. There are two other packages which you can install according to your requirement. You can use the p7zip-rar if you have to deal with the RAR files.

如果您曾经尝试发送大文件,那么您一定会对有所了解。 从现在的近20年开始,7Zip使我们获得了更高的压缩率。 除了获得较高的压缩率外,您还可以使用7Zip在Ubuntu上获得提取和压缩RAR文件的支持。 除了GUI,您已在Windows计算机中使用过,7Zip也可通过p7zip命令与CLI一起使用。 您可以根据需要安装另外两个软件包。 如果必须处理RAR文件,则可以使用p7zip-rar

In this tutorial, we will demonstrate to you how you can install and use 7Zip on Ubuntu 18.04. We will also provide a small tutorial of using 7z on Ubuntu directly from CLI.

在本教程中,我们将向您演示如何在Ubuntu 18.04上安装和使用7Zip。 我们还将提供直接从CLI在Ubuntu上使用7z的小教程。

如何使用CLI在Ubuntu上安装p7zip? (How to Install p7zip on Ubuntu with CLI?)

7Zip is available as a package named as p7zip in the Ubuntu repository. It can be installed with apt or any other package manager on other Linux based systems too.

7Zip作为Ubuntu仓库中名为p7zip的软件包提供。 它也可以与apt或任何其他基于Linux的系统上的软件包管理器一起安装。

First of all, let’s update our Ubuntu system.

首先,让我们更新我们的Ubuntu系统。

sudo apt update

To install 7zip on your Ubuntu server or Desktop, open terminal (Ctrl + T) and enter the following command.

要在Ubuntu服务器或台式机上安装7zip,请打开终端(Ctrl + T)并输入以下命令。

sudo apt install p7zip-full p7zip-rar
Install 7zip on Ubuntu With Command Line

Install 7zip on Ubuntu With Command Line

使用命令行在Ubuntu上安装7zip

After executing this in your Terminal, p7zip will get installed as CLI utility 7z. The syntax of 7z is given below.

在终端中执行此操作后,p7zip将作为CLI实用程序7z安装。 下面给出7z的语法。

7Zip语法和用法 (7Zip Syntax & Usage)

7z  [
...]
[
...] [<@listfiles...>]

The commands and switches you can use with 7zip are provided below with their meaning.

下面提供了可用于7zip的命令和开关及其含义。

7Zip命令 (7Zip Commands)

  • a: Add files to archive

    a :将文件添加到存档
  • b: Benchmark

    b :基准
  • d: Delete files from archive

    d :从存档中删除文件
  • e: Extract files from archive (without using directory names)

    e :从存档中提取文件(不使用目录名)
  • l: List contents of the archive

    l :列出档案内容
  • t: Test integrity of the archive

    t :测试档案的完整性
  • u: Update files to archive

    u :更新文件以存档
  • x: Extract files with full paths

    x :提取具有完整路径的文件

7Zip开关 (7Zip Switches)

  • -ai[r[-|0]]{@listfile|!wildcard}: Include archives

    -ai [r [-| 0]] {@ listfile |!通配符} :包括存档
  • -ax[r[-|0]]{@listfile|!wildcard}: Exclude archives

    -ax [r [-| 0]] {@ listfile |!通配符} :排除档案
  • -bd: Disable percentage indicator

    -bd :禁用百分比指示器
  • -i[r[-|0]]{@listfile|!wildcard}: Include filenames

    -i [r [-| 0]] {@ listfile |!通配符} :包括文件名
  • -m{Parameters}: set compression Method

    -m {Parameters} :设置压缩方法
  • -o{Directory}: set Output directory

    -o {Directory} :设置输出目录
  • -p{Password}: set Password

    -p {密码} :设置密码
  • -r[-|0]: Recurse subdirectories

    -r [-| 0] :递归子目录
  • -scs{UTF-8 | WIN | DOS}: set charset for list files

    -scs {UTF-8 | WIN | DOS} :为列表文件设置字符集
  • -sfx[{name}]: Create SFX archive

    -sfx [{name}] :创建SFX存档
  • -si[{name}]: read data from stdin

    -si [{name}] :从标准输入中读取数据
  • -slt: show technical information for l (List) command

    -slt :显示l(列表)命令的技术信息
  • -so: write data to stdout

    -so :将数据写入标准输出
  • -ssc[-]: set sensitive case mode

    -ssc [-] :设置区分大小写的模式
  • -t{Type}: Set type of archive

    -t {Type} :设置存档类型
  • -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options

    -u [-] [p#] [q#] [r#] [x#] [y#] [z#] [!newArchiveName] :更新选项
  • -v{Size}[b|k|m|g]: Create volumes

    -v {Size} [b | k | m | g] :创建体积
  • -w[{path}]: assign Work directory. Empty path means a temporary directory

    -w [{path}] :分配工作目录。 空路径表示一个临时目录
  • -x[r[-|0]]]{@listfile|!wildcard}: Exclude filenames

    -x [r [-| 0]]] {@ listfile |!通配符} :排除文件名
  • -y: assume: Yes on all queries

    -y:假定 :所有查询均是
  • -an: Disable parsing of archive_name

    -an :禁用对archive_name的解析

Let us now take a look at How to use 7Zip on Ubuntu.

现在让我们看看如何在Ubuntu上使用7Zip。

如何在Ubuntu上使用7Zip? (How to use 7Zip on Ubuntu?)

Now you know the syntax of 7Zip on Ubuntu, you can move on to compressing and extracting files.

现在您已经知道Ubuntu上7Zip的语法,接下来可以进行压缩和提取文件了。

1.使用终端压缩文件 (1. Compressing Files using Terminal)

Here are the steps which you need to follow in order to compress files using the 7-zip on your Ubuntu machine:

以下是在Ubuntu计算机上使用7-zip压缩文件时需要遵循的步骤:

First of all, you need to select the file or folder to make a compressed file. To do so, just use the ls -la command to show the list of all files and folders of the current directory. For instance, we would be compressing the data.txt file which is of size 50 kb at the moment.

首先,您需要选择文件或文件夹以制作压缩文件。 为此,只需使用ls -la命令显示当前目录的所有文件和文件夹的列表。 例如,我们现在将压缩大小为50 kb的data.txt文件。

$ ls -la

Now, to compress any file or folder. Like, in this case, data.txt, you need to enter the following command:

现在,压缩任何文件或文件夹。 在这种情况下,例如data.txt,您需要输入以下命令:

$ 7z a data.7z data.txt
Archive Command For 7z

Archive Command For 7z

7z的存档命令

Here, the option ‘a’ is for archive or compression. The data.7z is the filename of the compressed file. The data.txt is the file to be compressed.
在这里,选项“ a”用于存档或压缩。 data.7z是压缩文件的文件名。 data.txt是要压缩的文件。

After compression, the size of the compressed file has come to around 3 kb. That’s more than 90% saving in the system space. Great! Isn’t it?

压缩后,压缩文件的大小约为3 kb。 这节省了90%以上的系统空间。 大! 是不是

You can also get detailed information about the compression using the ‘l’ option.

您还可以使用“ l”选项获取有关压缩的详细信息。

$ 7z l data.7z

2.使用文件资源管理器压缩文件 (2. Compressing Files using File Explorer)

If you have Ubuntu Desktop, you can use 7Zip from File Explorer to compress and extract them.

如果您具有Ubuntu Desktop,则可以使用File Explorer中的7Zip压缩和解压缩它们。

First of all, you need to go to the File Explorer or File Manager on your Linux system.

Now, select the file or folder which you want to compress and right-click on the same.
Here, select the Compress option from the context menu.

How To Compress With GUI

首先,您需要转到Linux系统上的文件资源管理器或文件管理器。

现在,选择要压缩的文件或文件夹,然后右键单击它们。
在这里,从上下文菜单中选择“压缩”选项。

Select the extension for the compressed file and enter the filename.

选择压缩文件的扩展名,然后输入文件名。

That’s it! You have successfully compressed a file on your Ubuntu Desktop system using File Explorer. Easy, No?

而已! 您已使用文件资源管理器成功压缩了Ubuntu桌面系统上的文件。 容易,不是吗?

3.使用终端提取7Z文件 (3. Extract the 7Z file using Terminal)

Here are the steps which you need to follow in order to extract 7z files using the 7-zip on your Ubuntu machine:

要使用Ubuntu机器上的7-zip解压缩7z文件,需要遵循以下步骤:

First of all, you need to select the file or folder to extract the contents of the file. To do so, just use the ls -la command to show the list of all files and folders of the current directory. For instance, we would be extracting the contents of the data.7z file.

首先,您需要选择文件或文件夹以提取文件的内容。 为此,只需使用ls -la命令显示当前目录的所有文件和文件夹的列表。 例如,我们将提取data.7z文件的内容。

$ ls -la

Now, to extract any compressed file. Like, in this case, data.7z, you need to enter the following command:

现在,解压缩任何压缩文件。 像本例中的data.7z一样,您需要输入以下命令:

$ 7z e data.7z
Extract File With Terminal 7z

7Zip Extract File From Terminal

7Zip从终端提取文件

Just replace the data.7z with your filename in the above command and you should be good to go.

只需在上面的命令中用您的文件名替换data.7z,您应该就很好了。

4.使用文件资源管理器提取7Z文件 (4. Extract the 7Z file using File Explorer)

First of all, you need to go to the File Explorer or File Manager on your Linux system.

首先,您需要转到Linux系统上的文件资源管理器或文件管理器。

Now, select the compressed file which you want to extract or uncompress and right-click on the same.

现在,选择要提取或解压缩的压缩文件,然后右键单击该文件。

Here, select the Extract option from the context menu.

在这里,从上下文菜单中选择“提取”选项。

Select the location for the extraction of the files and click on the Extract button.

选择提取文件的位置,然后单击提取按钮。

That’s it! You have successfully extracted the contents of a compressed file on your Ubuntu system.

而已! 您已经成功在Ubuntu系统上提取了压缩文件的内容。

结论 (Conclusion)

7Zip is a very popular software to compress files and save our system space. We learned how to Install 7Zip on Ubuntu system using the command line. We also learned how to compress and extract files from the command line and File Explorer.

7Zip是一款非常流行的软件,可以压缩文件并节省我们的系统空间。 我们学习了如何使用命令行在Ubuntu系统上安装7Zip。 我们还学习了如何从命令行和文件资源管理器压缩和提取文件。

翻译自:

转载地址:http://jjlzd.baihongyu.com/

你可能感兴趣的文章
win10+mongodb安装配置
查看>>
window7修改hosts文件
查看>>
【Leetcode_easy】720. Longest Word in Dictionary
查看>>
地铁时光机第一阶段冲刺一
查看>>
Code Smell那么多,应该先改哪一个?
查看>>
站立会议02(一期)
查看>>
oracle数据库导入导出问题
查看>>
Android中的动画
查看>>
LeetCode 119 Pascal's Triangle II
查看>>
【Noip2015pj】求和
查看>>
深入理解JavaScript——闭包
查看>>
C#-WebForm-css box-shadow 给边框添加阴影效果
查看>>
objective-c 编程总结(第七篇)运行时操作 - 动态属性
查看>>
C_数据结构_链表
查看>>
kettle-连接控件
查看>>
Coursera--Neural Networks and Deep Learning Week 2
查看>>
C#中的委托和事件(续)【来自张子扬】
查看>>
机器学习部分国内牛人
查看>>
模拟Sping MVC
查看>>
Luogu 3261 [JLOI2015]城池攻占
查看>>