mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
commit
c07b56b025
@ -3,35 +3,38 @@
|
|||||||
[#]: author: "Abhishek Prakash https://itsfoss.com/"
|
[#]: author: "Abhishek Prakash https://itsfoss.com/"
|
||||||
[#]: collector: "lkxed"
|
[#]: collector: "lkxed"
|
||||||
[#]: translator: "robsean"
|
[#]: translator: "robsean"
|
||||||
[#]: reviewer: " "
|
[#]: reviewer: "wxy"
|
||||||
[#]: publisher: " "
|
[#]: publisher: "wxy"
|
||||||
[#]: url: " "
|
[#]: url: "https://linux.cn/article-14975-1.html"
|
||||||
|
|
||||||
图解如何升级到 Linux Mint 21
|
图解如何升级到 Linux Mint 21
|
||||||
======
|
======
|
||||||
这是一个周期性的更新指南,主要用于将现有的 Linux Mint 升级安装到一个新的可用版本。
|
|
||||||
|
![](https://img.linux.net.cn/data/attachment/album/202208/28/172913lzqsmfll8snzblbs.jpg)
|
||||||
|
|
||||||
|
> 这是一个周期性的更新指南,主要用于将现有的 Linux Mint 升级安装到一个新的可用版本。
|
||||||
|
|
||||||
在这篇文章中有三个部分,分别向你展示 Linux Mint 的不同的主要版本之间的升级步骤:
|
在这篇文章中有三个部分,分别向你展示 Linux Mint 的不同的主要版本之间的升级步骤:
|
||||||
|
|
||||||
* 第 1 部分是关于从 Linux Mint 20.3 升级到 Linux Mint 21 ( GUI 升级工具)
|
* 第 1 部分是关于从 Linux Mint 20.3 升级到 Linux Mint 21(GUI 升级工具)
|
||||||
* 第 2 部分是关于从 Linux Mint 19.3 升级到 Linux Mint 20 (基于命令行的升级程序)
|
* 第 2 部分是关于从 Linux Mint 19.3 升级到 Linux Mint 20(基于命令行的升级程序)
|
||||||
* 第 3 部分是关于从 Linux Mint 18.3 升级到 Linux Mint 19 (假设一些人仍然在使用它)
|
* 第 3 部分是关于从 Linux Mint 18.3 升级到 Linux Mint 19(假设一些人仍然在使用它)
|
||||||
|
|
||||||
你可以依据你的当前的 Linux Mint 版本和需要来执行适当的步骤。
|
你可以依据你的当前的 Linux Mint 版本和需要来执行适当的步骤。
|
||||||
|
|
||||||
这是一个周期性的更新指南,主要用于将现有的 Linux Mint 升级安装到一个新的可用版本。
|
这是一个周期性的更新指南,主要用于将现有的 Linux Mint 升级安装到一个新的可用版本。
|
||||||
|
|
||||||
这篇指南已经更新,追加从 Mint 20.3 升级到 Linux Mint 21 的步骤。Linux Mint 现在有一个 GUI 工具来升级到最新的版本。
|
这篇指南已经更新,追加从 Mint 20.3 升级到 Linux Mint 21 的步骤。Linux Mint 现在有一个 GUI 工具来升级到最新的版本。
|
||||||
;
|
|
||||||
### 在你升级到 Linux Mint 21 之前需要知道的事情
|
### 在你升级到 Linux Mint 21 之前需要知道的事情
|
||||||
|
|
||||||
在你继续升级到 Linux Mint 21 之前,你应该考虑下面的事情:
|
在你继续升级到 Linux Mint 21 之前,你应该考虑下面的事情:
|
||||||
|
|
||||||
* 你真的需要升级吗?Linux Mint 20.x 还有好几年的支持期限。
|
* 你真的需要升级吗?Linux Mint 20.x 还有好几年的支持期限。
|
||||||
* 你将需要高速因特网连接来下载大约 14 GB 的升级。
|
* 你将需要高速互联网连接来下载大约 14 GB 的升级数据。
|
||||||
* 它可能将花费几个小时的时间来完成升级过程,当然这主要取决于你的因特网速度。你必需有耐心。
|
* 它可能将花费几个小时的时间来完成升级过程,当然这主要取决于你的互联网速度。你必须有耐心。
|
||||||
* 制作一个 Linux Mint 21 的 live USB 并在一次实时会话中尝试它是否与你的硬件系统兼容会是一个好主意。较新的内核可能与较旧的硬件系统有兼容性问题,因此在真正升级或安装之前来对其进行测试可能会为你省去很多麻烦。
|
* 制作一个 Linux Mint 21 的 <ruby>实况 USB<rt>Live USB</rt></ruby> 并在一次<ruby>实况会话<rt>Live session</rt></ruby> 中尝试它是否与你的硬件系统兼容会是一个好主意。较新的内核可能与较旧的硬件系统有兼容性问题,因此在真正升级或安装之前来对其进行测试可能会为你省去很多麻烦。
|
||||||
* 一次全新的安装总是比一次主要版本升级的更好,但是从零开始安装 Linux Mint 21 可能意味着丢失你的现有的数据。你必须在外部的外部磁盘上进行备份。
|
* 全新的安装总是比主要版本升级的更好,但是从零开始安装 Linux Mint 21 可能意味着丢失你的现有的数据。你必须在外部的外部磁盘上进行备份。
|
||||||
* 尽管大部分的升级是安全的,但是它也不会是 100% 的成功。你必须要有系统快照和真正的备份。
|
* 尽管大部分的升级是安全的,但是它也不会是 100% 的成功。你必须要有系统快照和真正的备份。
|
||||||
* 你只能从 Linux Mint 20.3 的 Cinnamon 、Xfce 和 MATE 版本升级到 Linux Mint 21 。首先 [检查你的 Linux Mint 版本][1] 。如果你正在使用 Linux Mint 20.2 或 20.1 ,你需要先使用更新管理器来升级到 20.3 。如果你正在使用 Linux Mint 19 ,我建议你选择进行一次的全新安装,而不是选择进行数次的升级 Mint 版本。
|
* 你只能从 Linux Mint 20.3 的 Cinnamon 、Xfce 和 MATE 版本升级到 Linux Mint 21 。首先 [检查你的 Linux Mint 版本][1] 。如果你正在使用 Linux Mint 20.2 或 20.1 ,你需要先使用更新管理器来升级到 20.3 。如果你正在使用 Linux Mint 19 ,我建议你选择进行一次的全新安装,而不是选择进行数次的升级 Mint 版本。
|
||||||
|
|
||||||
@ -43,7 +46,7 @@
|
|||||||
|
|
||||||
#### 步骤 1: 通过安装任意可用的更新来更新你的系统
|
#### 步骤 1: 通过安装任意可用的更新来更新你的系统
|
||||||
|
|
||||||
使用 菜单 -> 系统管理 -> 更新管理器来启动更新管理器。查看是否有一些可用的软件包更新。如果有可用的更新,先安装所有的软件包更新。
|
使用 <ruby>菜单<rt>Menu</rt></ruby> -> <ruby>系统管理<rt>Administration</rt></ruby> -> <ruby>更新管理器<rt>Update Manager</rt></ruby> 来启动更新管理器。查看是否有一些可用的软件包更新。如果有可用的更新,先安装所有的软件包更新。
|
||||||
|
|
||||||
![Check for Pending Software Updates][2]
|
![Check for Pending Software Updates][2]
|
||||||
|
|
||||||
@ -55,7 +58,7 @@ sudo apt update && sudo apt upgrade -y
|
|||||||
|
|
||||||
#### 步骤 2: 在外部的磁盘上备份你的文件 [可选,但是建议]
|
#### 步骤 2: 在外部的磁盘上备份你的文件 [可选,但是建议]
|
||||||
|
|
||||||
Timeshift 是一个创建系统快照的好工具,但它却不是一个针对文档、图片和其它那些非系统、个人文件的理想工具。我建议你在一块外部磁盘上进行备份。它只是为了数据安全。
|
Timeshift 是一个创建系统快照的好工具,但它却不是一个针对文档、图片和其它那些非系统的、个人文件的理想工具。我建议你在一块外部磁盘上进行备份。它只是为了数据安全。
|
||||||
|
|
||||||
当我说在一块外部磁盘上进行一次备份时,我的意思是将你的图片、文档、下载和视频目录简单地复制和粘贴到一块外部的 USB 磁盘上。
|
当我说在一块外部磁盘上进行一次备份时,我的意思是将你的图片、文档、下载和视频目录简单地复制和粘贴到一块外部的 USB 磁盘上。
|
||||||
|
|
||||||
@ -83,7 +86,7 @@ sudo mintupgrade
|
|||||||
|
|
||||||
![Mint Upgrade Tool Home Page][4]
|
![Mint Upgrade Tool Home Page][4]
|
||||||
|
|
||||||
在一些初始化的测试后,它将提示进行一次 Timeshift 备份。如果你已经创建了一次备份,你已经准备好前进。
|
在一些初始化的测试后,它将提示进行一次 Timeshift 备份。如果你已经创建了一次备份,你已经准备好下一步了。
|
||||||
|
|
||||||
![Upgrade Tool Prompting No Timeshift Snapshots][5]
|
![Upgrade Tool Prompting No Timeshift Snapshots][5]
|
||||||
|
|
||||||
@ -95,13 +98,13 @@ sudo mintupgrade
|
|||||||
|
|
||||||
![Kazam PPA Does Not Support Jammy][8]
|
![Kazam PPA Does Not Support Jammy][8]
|
||||||
|
|
||||||
在这里,我将通过其 PPA 来使用 [Kazam 的最新版本][9] 。其 PPA 仅被支持到 Impish ,因为 Linux Mint 21 是基于 Jammy 的,所以它会显示错误。
|
在这里,我将通过 Kazam 其 PPA 来使用其 [最新版本][9] 。其 PPA 仅被支持到 Impish ,因为 Linux Mint 21 是基于 Jammy 的,所以它会显示错误。
|
||||||
|
|
||||||
你可以在升级工具中通过软件源来指定禁用 PPA 的选项。
|
你可以在升级工具中通过软件源来指定禁用 PPA 的选项。
|
||||||
|
|
||||||
![Disable Unsupported PPAs in Software Sources][10]
|
![Disable Unsupported PPAs in Software Sources][10]
|
||||||
|
|
||||||
在禁用该 PPA 后,该软件包会变成 ‘陌生的’ ,因为来自存储库中可用版本会与来自 Mnit 存储库中可用版本不匹配。因此,你需要将软件包降级到存储库中一个可用的版本。
|
在禁用该 PPA 后,该软件包会变成 “<ruby>陌生的<rt>foreign</rt></ruby>”,因为来自存储库中可用版本会与来自 Mnit 存储库中可用版本不匹配。因此,你需要将软件包降级到存储库中一个可用的版本。
|
||||||
|
|
||||||
![Downgrade Package to Avoid Conflicts][11]
|
![Downgrade Package to Avoid Conflicts][11]
|
||||||
|
|
||||||
@ -121,11 +124,11 @@ sudo mintupgrade
|
|||||||
|
|
||||||
#### 保留某些孤立的软件包
|
#### 保留某些孤立的软件包
|
||||||
|
|
||||||
为保留来自孤立的软件包列表中软件包,你需要从左上角的菜单转到首选项。
|
为保留来自孤立的软件包列表中软件包,你需要从左上角的汉堡菜单转到 <ruby>首选项<rt>Preferences</rt></ruby>。
|
||||||
|
|
||||||
![Selecting Orphan Packages You Want to Keep with Preferences][16]
|
![Selecting Orphan Packages You Want to Keep with Preferences][16]
|
||||||
|
|
||||||
在首选项对话框中,你需要转到 **孤立的软件包** 并使用 “+” 符号来通过名称添加软件包。
|
在首选项对话框中,你需要转到 “<ruby>孤立的软件包<rt>Orphan Packages</rt></ruby>” 并使用 “+” 符号来通过名称添加软件包。
|
||||||
|
|
||||||
![Specify Name of the Package to Keep][17]
|
![Specify Name of the Package to Keep][17]
|
||||||
|
|
||||||
@ -142,26 +145,22 @@ sudo mintupgrade
|
|||||||
在你继续升级到 Linux Mint 20 之前,你应该考虑下面的事情:
|
在你继续升级到 Linux Mint 20 之前,你应该考虑下面的事情:
|
||||||
|
|
||||||
* 你真的需要升级吗?Linux Mint 19.x 将会支持到 2023 年。
|
* 你真的需要升级吗?Linux Mint 19.x 将会支持到 2023 年。
|
||||||
* 如果你 [有一款 32-位 系统][20],你不能安装或升级到 Mint 20 。
|
* 如果你 [有一款 32 位系统][20],你不能安装或升级到 Mint 20 。
|
||||||
* 你将需要高速因特网连接来下载大约 1.4 GB 的升级。
|
* 你将需要高速互联网连接来下载大约 1.4 GB 的升级。
|
||||||
* 它可能将花费几个小时的时间来完成升级过程,当然这主要取决于你的因特网速度。你必需有耐心。
|
* 它可能将花费几个小时的时间来完成升级过程,当然这主要取决于你的互联网速度。你必须有耐心。
|
||||||
* 制作一个 Linux Mint 20 的 live USB 并在一次实时会话中查看它是否与你的硬件系统兼容会是一个好主意。较新的内核可能与较旧的硬件系统有兼容性问题,因此在真正升级或安装之前来对其进行测试可能会为你省去很多麻烦。
|
* 制作一个 Linux Mint 20 的 <ruby>实况 USB<rt>Live USB</rt></ruby> 并在一次实况会话中查看它是否与你的硬件系统兼容会是一个好主意。较新的内核可能与较旧的硬件系统有兼容性问题,因此在真正升级或安装之前来对其进行测试可能会为你省去很多麻烦。
|
||||||
* 一次全新的安装总是比一次主要版本升级的更好,但是从零开始 [安装 Linux Mint][21] 20 可能意味着丢失你的现有的数据。你必须在外部的外部磁盘上进行备份。
|
* 全新的安装总是比主要版本升级的更好,但是从零开始 [安装 Linux Mint][21] 20 可能意味着丢失你的现有的数据。你必须在外部的外部磁盘上进行备份。
|
||||||
* 尽管大部分的升级是安全的,但是它也不会是 100% 的成功。你必须要有系统快照和真正的备份。
|
* 尽管大部分的升级是安全的,但是它也不会是 100% 的成功。你必须要有系统快照和真正的备份。
|
||||||
* 你只能从 Linux Mint 19.3 的 Cinnamon 、Xfce 和 MATE 版本升级到 Linux Mint 21 。首先 [检查你的 Linux Mint 版本][22] 。如果你正在使用 Linux Mint 19.2 或 19.1 ,你需要先使用更新管理器来升级到 19.3 。如果你正在使用 Linux Mint 18 ,我建议你选择进行一次的全新安装,而不是选择进行数次的升级 Mint 版本。
|
* 你只能从 Linux Mint 19.3 的 Cinnamon 、Xfce 和 MATE 版本升级到 Linux Mint 20 。首先 [检查你的 Linux Mint 版本][22] 。如果你正在使用 Linux Mint 19.2 或 19.1 ,你需要先使用更新管理器来升级到 19.3 。如果你正在使用 Linux Mint 18 ,我建议你选择进行一次的全新安装,而不是选择进行数次的升级 Mint 版本。
|
||||||
* 升级过程是通过命令行实用程序来完成的。如果你不喜欢使用终端和命令, 避免升级,并进行一次全新的安装。
|
* 升级过程是通过命令行实用程序来完成的。如果你不喜欢使用终端和命令,不要升级,并进行一次全新的安装。
|
||||||
|
|
||||||
在你知道你将要做什么后,让我们看看如何升级到 Linux Mint 20 。
|
在你知道你将要做什么后,让我们看看如何升级到 Linux Mint 20 。
|
||||||
|
|
||||||
![A Video from YouTube][23]
|
|
||||||
|
|
||||||
[订阅我们的 YouTube 频道以获取更多的 Linux 视频][24]
|
|
||||||
|
|
||||||
#### 步骤 1: 确保你有一款 64 位系统
|
#### 步骤 1: 确保你有一款 64 位系统
|
||||||
|
|
||||||
Linux Mint 20 仅是一款 64 位系统。如果你安装了一款 32 位的 Linux Mint 19 ,你不能升级到 Linux Mint 20 。
|
Linux Mint 20 是一款仅提供 64 位的操作系统。如果你安装了一款 32 位的 Linux Mint 19 ,你不能升级到 Linux Mint 20 。
|
||||||
|
|
||||||
在一个终端中,使用下面的命令来查看你是否正在使用 64-位 操作系统。
|
在一个终端中,使用下面的命令来查看你是否正在使用 64 位操作系统。
|
||||||
|
|
||||||
```
|
```
|
||||||
dpkg --print-architecture
|
dpkg --print-architecture
|
||||||
@ -171,7 +170,7 @@ dpkg --print-architecture
|
|||||||
|
|
||||||
#### 步骤 2: 通过安装一些可用的更新来更新你的系统
|
#### 步骤 2: 通过安装一些可用的更新来更新你的系统
|
||||||
|
|
||||||
使用 菜单 -> 系统管理 -> 更新管理器 来启动更新管理器。查看是否有一些可用的软件包更新。如果有可用的更新,先安装所有的软件包更新。
|
使用 <ruby>菜单<rt>Menu</rt></ruby> -> <ruby>系统管理<rt>Administration</rt></ruby> -> <ruby>更新管理器<rt>Update Manager</rt></ruby> 来启动更新管理器。查看是否有一些可用的软件包更新。如果有可用的更新,先安装所有的软件包更新。
|
||||||
|
|
||||||
![Check for pending software updates][26]
|
![Check for pending software updates][26]
|
||||||
|
|
||||||
@ -185,9 +184,9 @@ sudo apt update && sudo apt upgrade -y
|
|||||||
|
|
||||||
如果你遇到升级过程中断或你遇到其它的一些重大问题,[使用 Timeshift 创建一个系统快照][27] 将会解救你于水火之中。**你甚至可以使用这种方法恢复到 Mint 19.3 。**
|
如果你遇到升级过程中断或你遇到其它的一些重大问题,[使用 Timeshift 创建一个系统快照][27] 将会解救你于水火之中。**你甚至可以使用这种方法恢复到 Mint 19.3 。**
|
||||||
|
|
||||||
假设你因为意外断电导致升级失败,或因为其它一些原因,你最终得到一个残缺的不稳定的 Linux Mint 19 。你可以插入一个live Linux Mint USB ,并从该 live 环境中运行 Timeshift 。它将会自动地定位你的备份位置,并将允许你恢复你残缺的 Mint 19 系统。
|
假设你因为意外断电导致升级失败,或因为其它一些原因,你最终得到一个残缺的不稳定的 Linux Mint 19 。你可以插入一个 Linux Mint 实况 USB ,并从该实况环境中运行 Timeshift 。它将会自动地定位你的备份位置,并将允许你恢复你残缺的 Mint 19 系统。
|
||||||
|
|
||||||
这也意味着你应该随时携带一个 live Linux Mint 19 USB ,在极少数升级失败的情况下,如果你不能访问一台工作的计算机,你可以使用它来创建 live Linux Mint USB 。
|
这也意味着你应该随时携带一个 Linux Mint 19 实况 USB ,以防在极少数升级失败的情况下,你不能用一台工作的计算机创建 Linux Mint 实况 USB 。
|
||||||
|
|
||||||
![Create a system snapshot in Linux Mint][28]
|
![Create a system snapshot in Linux Mint][28]
|
||||||
|
|
||||||
@ -205,21 +204,21 @@ Timeshift 是一个创建系统快照的好工具,但它却不是一个针对
|
|||||||
|
|
||||||
一些 PPA 可能已经适用于 Ubuntu 20.04 ,因此也适用于 Mint 20 。但是,如果 PPA 或存储库不适用于新的版本,它可能会因为依赖关系的打断而影响升级过程。
|
一些 PPA 可能已经适用于 Ubuntu 20.04 ,因此也适用于 Mint 20 。但是,如果 PPA 或存储库不适用于新的版本,它可能会因为依赖关系的打断而影响升级过程。
|
||||||
|
|
||||||
对此,建议你禁用 PPA 和第三方存储库。你也可以删除通过这样的外部源来安装的应用程序,如果你这样做的话,它不会导致配置数据的丢失。
|
对此,建议你禁用 PPA 和第三方存储库。你也可以删除通过这样的外部源安装的应用程序,如果你这样做的话,不会导致配置数据的丢失。
|
||||||
|
|
||||||
在软件源工具中,禁用附加的存储库、禁用 PPA 。
|
在 <ruby>软件源<rt>Software Sources</rt></ruby> 工具中,禁用附加的存储库、禁用 PPA 。
|
||||||
|
|
||||||
![Disable Ppa Mint Upgrade][30]
|
![Disable Ppa Mint Upgrade][30]
|
||||||
|
|
||||||
你也可以 **降级** ,然后在维护标签页中 **移除可用的陌生的软件包** 。
|
你也可以在维护标签页中 **降级** ,**移除可用的外部的软件包** 。
|
||||||
|
|
||||||
例如,我使用一个 PPA 来安装 Shutter 。我在禁用它的 PPA 后,现在该软件包会变成 ‘陌生的’ ,因为来自存储库中可用版本会与来自 Mnit 存储库中可用版本不匹配。
|
例如,我使用一个 PPA 来安装 Shutter 。我在禁用它的 PPA 后,现在该软件包会变成 “<ruby>陌生的<rt>foreign</rt></ruby>”,因为来自存储库中可用版本会与来自 Mnit 存储库中可用版本不匹配。
|
||||||
|
|
||||||
![Foreign Package Linux Mint][31]
|
![Foreign Package Linux Mint][31]
|
||||||
|
|
||||||
#### 步骤 6: 安装升级工具
|
#### 步骤 6: 安装升级工具
|
||||||
|
|
||||||
现在,你的系统已经更新,你已经准备好升级到 Linux Mint 20 。Linux Mint 开发组提供一个名称为 [mintupgrade][32] 的命令行工具,其唯一的目的是将 Linux Mint 19.3 升级到 Linux Mint 20 。
|
现在,你的系统已经更新,你已经准备好升级到 Linux Mint 20 。Linux Mint 开发团队提供一个名称为 [mintupgrade][32] 的命令行工具,其唯一的目的是将 Linux Mint 19.3 升级到 Linux Mint 20 。
|
||||||
|
|
||||||
你可用使用下面的命令来安装这个工具:
|
你可用使用下面的命令来安装这个工具:
|
||||||
|
|
||||||
@ -229,7 +228,7 @@ sudo apt install mintupgrade
|
|||||||
|
|
||||||
#### 步骤 7: 运行一次升级设备健康检查
|
#### 步骤 7: 运行一次升级设备健康检查
|
||||||
|
|
||||||
mintupgrade 工具将会让你通过模拟升级的初始化部分来运行一次设备健康检查。
|
`mintupgrade` 工具将会让你通过模拟升级的初始化部分来运行一次设备健康检查。
|
||||||
|
|
||||||
你可以运行这次检查来查看对你的系统做出何种更改,哪些软件包将会升级。它也将会显示不能升级和必须移除的软件包。
|
你可以运行这次检查来查看对你的系统做出何种更改,哪些软件包将会升级。它也将会显示不能升级和必须移除的软件包。
|
||||||
|
|
||||||
@ -237,19 +236,19 @@ mintupgrade 工具将会让你通过模拟升级的初始化部分来运行一
|
|||||||
mintupgrade check
|
mintupgrade check
|
||||||
```
|
```
|
||||||
|
|
||||||
在这里,它不会在你的系统上做出任何真正的更改 (即使,感觉上它正在进行做一些更改)。
|
在这里,它不会在你的系统上做出任何真正的更改(即使感觉上它正在进行做一些更改)。
|
||||||
|
|
||||||
这一步骤是非常重要的,有助于准确算出你的系统是否可以升级到 Mint 20 。
|
这一步骤是非常重要的,有助于准确评估出你的系统是否可以升级到 Mint 20 。
|
||||||
|
|
||||||
![Mint Upgrade Check][33]
|
![Mint Upgrade Check][33]
|
||||||
|
|
||||||
如果这一步骤中途失败,输入 **mintupgrade restore-sources** 来返回到你原始的 APT 配置。
|
如果这一步骤中途失败,输入 `mintupgrade restore-sources` 来返回到你原始的 APT 配置。
|
||||||
|
|
||||||
#### 步骤 8: 下载软件包升级
|
#### 步骤 8: 下载软件包升级
|
||||||
|
|
||||||
在你对 mintupgrade 的检查输出感到满意后,你可以下载 Mint 20 升级软件包。
|
在你对 `mintupgrade`` 的检查输出感到满意后,你可以下载 Mint 20 升级软件包。
|
||||||
|
|
||||||
取决于你的因特网连接速度,它可能会在下载这些升级方面消耗一些时间。确保你的硬件系统接通到强电电源。
|
取决于你的互联网连接速度,它可能会在下载这些升级方面消耗一些时间。确保你的硬件系统接通到强电电源。
|
||||||
|
|
||||||
在软件包的下载期间,你可以继续使用你的系统进行常规工作。
|
在软件包的下载期间,你可以继续使用你的系统进行常规工作。
|
||||||
|
|
||||||
@ -259,9 +258,9 @@ mintupgrade download
|
|||||||
|
|
||||||
![Mint 20 Upgrade Download][34]
|
![Mint 20 Upgrade Download][34]
|
||||||
|
|
||||||
注意,这行命令将把你的操作系统指向 Linux Mint 20 存储库。在使用这行命令后,如果你想降级到 Linux Mint 19.3 ,你仍然可以使用命令 “**mintupgrade restore-sources**” 来做到。
|
注意,这行命令将把你的操作系统指向 Linux Mint 20 存储库。在使用这行命令后,如果你想降级到 Linux Mint 19.3 ,你仍然可以使用命令 `mintupgrade restore-sources` 来做到。
|
||||||
|
|
||||||
#### 步骤 9: 安装升级 [Point of no return]
|
#### 步骤 9: 安装升级 [不可回退]
|
||||||
|
|
||||||
现在,万事俱备,你可以使用这行命令来升级到 Linux Mint 20 :
|
现在,万事俱备,你可以使用这行命令来升级到 Linux Mint 20 :
|
||||||
|
|
||||||
@ -285,11 +284,11 @@ mintupgrade upgrade
|
|||||||
|
|
||||||
我将在这里快速地提及这些步骤。如果你想要更多的信息,你可以参考 Mint 20 升级过程。
|
我将在这里快速地提及这些步骤。如果你想要更多的信息,你可以参考 Mint 20 升级过程。
|
||||||
|
|
||||||
**步骤 1:** 使用 Timeshift 创建一个系统快照 [可选,但是建议]
|
**步骤 1:** 使用 Timeshift 创建一个系统快照 [可选,但是建议]
|
||||||
|
|
||||||
**步骤 2:** 在一块外部的磁盘上备份你的文件 [可选,但是建议]
|
**步骤 2:** 在一块外部的磁盘上备份你的文件 [可选,但是建议]
|
||||||
|
|
||||||
**步骤 3: 确保你正在使用 LightDM**
|
**步骤 3:** 确保你正在使用 LightDM
|
||||||
|
|
||||||
对于 Mint 19 ,你必须使用 [LightDM 显示管理器][37] 。为检查你正在使用哪种显示管理器,输入命令:
|
对于 Mint 19 ,你必须使用 [LightDM 显示管理器][37] 。为检查你正在使用哪种显示管理器,输入命令:
|
||||||
|
|
||||||
@ -297,11 +296,11 @@ mintupgrade upgrade
|
|||||||
cat /etc/X11/default-display-manager
|
cat /etc/X11/default-display-manager
|
||||||
```
|
```
|
||||||
|
|
||||||
如果结果是 “/usr/sbin/**lightdm**”,那么你就有 LightDM ,你就可以继续前进了。
|
如果结果是 `/usr/sbin/lightdm`,那么你就有 LightDM ,你就可以继续前进了。
|
||||||
|
|
||||||
![LightDM Display Manager in Linux Mint][38]
|
![LightDM Display Manager in Linux Mint][38]
|
||||||
|
|
||||||
在另一个方面,如果结果是 “/usr/sbin/**mdm**”,你需要安装 LightDM ,[切换到 LightDM][39] 并移除 MDM 。使用这行命令来安装 LightDM :
|
在另一个方面,如果结果是 `/usr/sbin/mdm`,你需要安装 LightDM ,[切换到 LightDM][39] 并移除 MDM 。使用这行命令来安装 LightDM :
|
||||||
|
|
||||||
```
|
```
|
||||||
apt install lightdm lightdm-settings slick-greeter
|
apt install lightdm lightdm-settings slick-greeter
|
||||||
@ -364,7 +363,7 @@ via: https://itsfoss.com/upgrade-linux-mint-version/
|
|||||||
作者:[Abhishek Prakash][a]
|
作者:[Abhishek Prakash][a]
|
||||||
选题:[lkxed][b]
|
选题:[lkxed][b]
|
||||||
译者:[robsean](https://github.com/robsean)
|
译者:[robsean](https://github.com/robsean)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -3,25 +3,28 @@
|
|||||||
[#]: author: "sk https://ostechnix.com/author/sk/"
|
[#]: author: "sk https://ostechnix.com/author/sk/"
|
||||||
[#]: collector: "lkxed"
|
[#]: collector: "lkxed"
|
||||||
[#]: translator: "geekpi"
|
[#]: translator: "geekpi"
|
||||||
[#]: reviewer: " "
|
[#]: reviewer: "wxy"
|
||||||
[#]: publisher: " "
|
[#]: publisher: "wxy"
|
||||||
[#]: url: " "
|
[#]: url: "https://linux.cn/article-14970-1.html"
|
||||||
|
|
||||||
将 Docker 运行命令转化为 Docker-Compose 文件
|
将 Docker 命令转化为 Docker Compose 文件
|
||||||
======
|
======
|
||||||
使用 Composerize 从 docker 运行命令创建 Docker compose 文件
|
|
||||||
|
|
||||||
如果你每天在官方或个人系统中使用 Docker,你应该知道有一个有用的应用叫 **Composerize**。在这个简短的指南中,我们将了解什么是 Composerize,以及如何使用 Composerize 在 Linux 中**将 docker 运行命令转换为 docker-compose 文件**格式。
|
![](https://img.linux.net.cn/data/attachment/album/202208/27/150501vw3eqx2xkexemmkc.jpg)
|
||||||
|
|
||||||
|
> 使用 Composerize 从 `docker run` 命令创建 Docker Compose 文件
|
||||||
|
|
||||||
|
如果你每天在正式或个人系统中使用 Docker,你应该知道有一个有用的应用叫 **Composerize**。在这个简短的指南中,我们将了解什么是 Composerize,以及如何使用 Composerize 在 Linux 中**将 `docker run` 命令转换为 Docker Compose 文件**格式。
|
||||||
|
|
||||||
### 什么是 Composerize?
|
### 什么是 Composerize?
|
||||||
|
|
||||||
**[Docker compose][1]** 是一个用于定义和运行多容器 docker 应用的工具。Docker compose 只是一个 YAML 文件,我们在其中为 Docker 应用定义服务、网络和卷。
|
[Docker Compose][1] 是一个用于定义和运行多容器 Docker 应用的工具。Docker Compose 只是一个 YAML 文件,我们在其中为 Docker 应用定义服务、网络和卷。
|
||||||
|
|
||||||
不是每个人都擅长写有效的 docker-compose 文件。你们中的一些人可能会发现,甚至写一个简单的 docker compose 文件都很困难。不用担心! 看下 Composerize,它可以帮助你从 `docker run` 命令中创建 Docker compose 文件。
|
不是每个人都擅长写高效的 Docker Compose 文件。你们中的一些人可能会发现,甚至写一个简单的 Docker Compose 文件都很困难。不用担心! 看下 Composerize,它可以帮助你从 `docker run` 命令中创建 Docker Compose 文件。
|
||||||
|
|
||||||
Composerize 是一个命令行和基于网络的工具,可以将 `docker run` 命令转换成 docker-compose 文件。
|
Composerize 是一个命令行和基于网络的工具,可以将 `docker run` 命令转换成 Docker Compose 文件。
|
||||||
|
|
||||||
无论 `docker run` 命令是简单、简短还是冗长、复杂,都没有关系。你所要做的就是把命令传给 Conposerize。Composerize 会立即将 `docker run` 命令变成 docker-compose 文件!
|
无论 `docker run` 命令是简单、简短还是冗长、复杂,都没有关系。你所要做的就是把命令传给 Conposerize。Composerize 会立即将 `docker run` 命令变成 Docker Compose 文件!
|
||||||
|
|
||||||
### 在 Linux 中安装 Composerize
|
### 在 Linux 中安装 Composerize
|
||||||
|
|
||||||
@ -29,7 +32,7 @@ Composerize 是作为一个网络服务提供的。所以你不需要在你的
|
|||||||
|
|
||||||
Composerize 可以用 npm 安装。确保你的系统中已经安装了 Nodejs。如果没有安装,请按照下面的链接来安装 Nodejs。
|
Composerize 可以用 npm 安装。确保你的系统中已经安装了 Nodejs。如果没有安装,请按照下面的链接来安装 Nodejs。
|
||||||
|
|
||||||
* [如何在 Linux 上安装 NodeJS][2]
|
* **[如何在 Linux 上安装 NodeJS][2]**
|
||||||
|
|
||||||
安装完 Nodejs 后,运行以下命令来安装 Composerize:
|
安装完 Nodejs 后,运行以下命令来安装 Composerize:
|
||||||
|
|
||||||
@ -45,17 +48,17 @@ $ npm install composerize
|
|||||||
$ npm install composerize -g
|
$ npm install composerize -g
|
||||||
```
|
```
|
||||||
|
|
||||||
### 用 Composerize 将 Docker 运行命令转换为 Docker-Compose 文件
|
### 用 Composerize 将 Docker 命令转换为 Docker Compose 文件
|
||||||
|
|
||||||
要将 docker run 命令转换为 docker-compose 格式,只需用 Composerize 运行它,如下所示:
|
要将 `docker run` 命令转换为 Docker Compose 格式,只需用 Composerize 运行它,如下所示:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ composerize docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
|
$ composerize docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
|
||||||
```
|
```
|
||||||
|
|
||||||
它将以 docker compose 文件格式生成内容。
|
它将以 Docker Compose 文件格式生成内容。
|
||||||
|
|
||||||
**示例输出:**
|
示例输出:
|
||||||
|
|
||||||
```
|
```
|
||||||
version: '3.3'
|
version: '3.3'
|
||||||
@ -72,13 +75,13 @@ services:
|
|||||||
|
|
||||||
现在在你的 `docker-compose.yml` 文件中复制上面几行。就这么简单!
|
现在在你的 `docker-compose.yml` 文件中复制上面几行。就这么简单!
|
||||||
|
|
||||||
正如我所说,你也可以使用 Composerize 网络服务将 docker run 命令转换成 docker 文件格式。
|
正如我所说,你也可以使用 Composerize 网络服务将 `docker run` 命令转换成 Docker Compose 格式。
|
||||||
|
|
||||||
进入 **[https://www.composerize.com/][4]**,将 `docker run` 命令粘贴到框中,你就会立即得到 docker-compose 文件!
|
进入 [https://www.composerize.com/][4],将 `docker run` 命令粘贴到框中,你就会立即得到 `docker-compose.yml` 文件!
|
||||||
|
|
||||||
![Turn Docker Run Commands Into Docker-compose Files Using Composerize][5]
|
![Turn Docker Run Commands Into Docker-compose Files Using Composerize][5]
|
||||||
|
|
||||||
将命令转换为 docker-compose 文件后,到你保存 `docker-compose.yml` 文件的位置,运行以下命令来启动 Docker 应用:
|
将命令转换为 Docker Compose 文件后,到你保存 `docker-compose.yml` 文件的位置,运行以下命令来启动 Docker 应用:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ docker-compose up
|
$ docker-compose up
|
||||||
@ -86,7 +89,7 @@ $ docker-compose up
|
|||||||
|
|
||||||
Composerize 是对 Docker 用户有用的工具之一。你现在可以安全地告别漫无边际的 Docker 命令了。
|
Composerize 是对 Docker 用户有用的工具之一。你现在可以安全地告别漫无边际的 Docker 命令了。
|
||||||
|
|
||||||
**资源:**
|
资源:
|
||||||
|
|
||||||
* [Composerize GitHub 仓库][6]
|
* [Composerize GitHub 仓库][6]
|
||||||
|
|
||||||
@ -97,7 +100,7 @@ via: https://ostechnix.com/convert-docker-run-commands-into-docker-compose-files
|
|||||||
作者:[sk][a]
|
作者:[sk][a]
|
||||||
选题:[lkxed][b]
|
选题:[lkxed][b]
|
||||||
译者:[geekpi](https://github.com/geekpi)
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -3,21 +3,22 @@
|
|||||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||||
[#]: collector: "lkxed"
|
[#]: collector: "lkxed"
|
||||||
[#]: translator: "geekpi"
|
[#]: translator: "geekpi"
|
||||||
[#]: reviewer: " "
|
[#]: reviewer: "wxy"
|
||||||
[#]: publisher: " "
|
[#]: publisher: "wxy"
|
||||||
[#]: url: " "
|
[#]: url: "https://linux.cn/article-14974-1.html"
|
||||||
|
|
||||||
3 个可在 Linux 上玩旧 NES 游戏的 NES 模拟器
|
3 个可在 Linux 上玩旧 NES 游戏的 NES 模拟器
|
||||||
======
|
======
|
||||||
快速浏览在 Linux 中玩旧 NES 游戏的 3 个 NES 模拟器。此外,我们还提供安装指南和特性。
|
|
||||||
|
![](https://img.linux.net.cn/data/attachment/album/202208/28/162533h41z1kynkyn5n53q.jpg)
|
||||||
|
|
||||||
|
> 快速了解一下在 Linux 中玩老式 NES 游戏的 3 个 NES 模拟器。此外,我们也提供了安装指南和特性介绍。
|
||||||
|
|
||||||
如果你想在最新的 Ubuntu、Linux Mint 版本中玩超级马里奥、口袋妖怪等老式复古游戏,有很多可用的模拟器。如果你想玩老式复古游戏,可以尝试以下三个模拟器。
|
如果你想在最新的 Ubuntu、Linux Mint 版本中玩超级马里奥、口袋妖怪等老式复古游戏,有很多可用的模拟器。如果你想玩老式复古游戏,可以尝试以下三个模拟器。
|
||||||
|
|
||||||
### NES 模拟器上玩旧 NES 游戏
|
### 1、ZSNES
|
||||||
|
|
||||||
#### 1. ZSNES
|
[ZSNES][1] 是一个 [超级任天堂][2] 模拟器,可以在 Windows、Linux、FreeBSD 和 DOS 上运行。它作为 GUI 界面运行,你可以在其中加载 NES 游戏的 ROM。
|
||||||
|
|
||||||
[ZSNES][1] 是一个超级 [Nintendo][2] 模拟器,可以在 Windows、Linux、FreeBSD 和 DOS 上运行。它作为 GUI 界面运行,你可以在其中加载 NES 游戏的 ROM。
|
|
||||||
|
|
||||||
这是在 Ubuntu、Debian 和 Linux Mint 中安装 ZSNES 的方法。从终端运行以下命令:
|
这是在 Ubuntu、Debian 和 Linux Mint 中安装 ZSNES 的方法。从终端运行以下命令:
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ sudo dnf install zsnes
|
|||||||
|
|
||||||
![Play old NES games using ZSNES in Ubuntu][5]
|
![Play old NES games using ZSNES in Ubuntu][5]
|
||||||
|
|
||||||
#### 2. Higan
|
### 2、Higan
|
||||||
|
|
||||||
higan 是 Nintendos SNES、NES、Gameboy、Gameboy Color 和 Gameboy Advance 的模拟器。它以前被称为 bsnes,并且 SNES 仿真特别完整和完善。
|
higan 是 Nintendos SNES、NES、Gameboy、Gameboy Color 和 Gameboy Advance 的模拟器。它以前被称为 bsnes,并且 SNES 仿真特别完整和完善。
|
||||||
|
|
||||||
@ -51,9 +52,9 @@ sudo apt install higan
|
|||||||
|
|
||||||
![Higan Running in Ubuntu][6]
|
![Higan Running in Ubuntu][6]
|
||||||
|
|
||||||
#### 3. GFCEU
|
### 3、GFCEU
|
||||||
|
|
||||||
GNOME FCE Ultra (gfceu) 是用于 GNOME 桌面的 FCE Ultra 任天堂娱乐系统的图形前端。 Gfceu 简化了用户的游戏体验,并提供了干净、简单和直观的界面。
|
GNOME FCE Ultra(gfceu)是用于 GNOME 桌面的 FCE Ultra 任天堂娱乐系统的图形前端。 Gfceu 简化了用户的游戏体验,并提供了干净、简单和直观的界面。
|
||||||
|
|
||||||
从终端运行以下命令,为 Ubuntu、Linux Mint 和相关发行版安装 gfceu。
|
从终端运行以下命令,为 Ubuntu、Linux Mint 和相关发行版安装 gfceu。
|
||||||
|
|
||||||
@ -86,7 +87,7 @@ via: https://www.debugpoint.com/3-nes-emulators-to-play-old-nes-games-in-linux/
|
|||||||
作者:[Arindam][a]
|
作者:[Arindam][a]
|
||||||
选题:[lkxed][b]
|
选题:[lkxed][b]
|
||||||
译者:[geekpi](https://github.com/geekpi)
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -0,0 +1,96 @@
|
|||||||
|
[#]: subject: "Linux-First AI Image Upscaler Upscayl Released its First Version"
|
||||||
|
[#]: via: "https://news.itsfoss.com/upscayl-version-1-release/"
|
||||||
|
[#]: author: "Abhishek https://news.itsfoss.com/author/abhishek/"
|
||||||
|
[#]: collector: "lkxed"
|
||||||
|
[#]: translator: "wxy"
|
||||||
|
[#]: reviewer: "wxy"
|
||||||
|
[#]: publisher: "wxy"
|
||||||
|
[#]: url: "https://linux.cn/article-14976-1.html"
|
||||||
|
|
||||||
|
Linux 优先的 AI 图像提升器 Upscayl 发布了第一个版本
|
||||||
|
======
|
||||||
|
|
||||||
|
> 你不是每天都能遇到一个采用 “Linux 优先” 方式的应用程序。
|
||||||
|
|
||||||
|
![Linux-First AI Image Upscaler Upscayl Released its First Version][1]
|
||||||
|
|
||||||
|
你是不是有一张世纪初的像素化、低分辨率的图片?由于人工智能的进步,你可以轻松地将像素化的图像提升为分辨率更好的图像。
|
||||||
|
|
||||||
|
使用普通的图像编辑器需要人工的努力来提升图像。
|
||||||
|
|
||||||
|
有大量的在线人工智能图像提升器,但是你不能信任它们对你的数据的处理。
|
||||||
|
|
||||||
|
一个新的项目试图解决这个问题,为你提供一个简单的桌面应用程序,让你在一次点击中增强低分辨率照片。
|
||||||
|
|
||||||
|
它的第一个版本已经发布。
|
||||||
|
|
||||||
|
### Upscayl 的功能
|
||||||
|
|
||||||
|
[Upscayl][2] 是一个跨平台的应用程序,以 Linux 优先的理念构建。
|
||||||
|
|
||||||
|
这仅仅意味着 Linux 的构建得到优先考虑,但其他平台也会得到支持。
|
||||||
|
|
||||||
|
Upscayl 使用 Python 和 JavaScript 开发,给出了一个简单的界面,你可以选择输入图片和输出文件夹,然后点击 “Upscayl” 按钮来增强图片。
|
||||||
|
|
||||||
|
### 使用 Upscayl
|
||||||
|
|
||||||
|
我的电脑上没有太多模糊的照片。并不是说我是一个优秀的摄影师,只是懒得在成千上万的照片中寻找它们。
|
||||||
|
|
||||||
|
不过,我还是设法弄到了一张 2011 年的模糊的老照片(那是 11 年前的照片,现在可以说是老照片了)。
|
||||||
|
|
||||||
|
![厨房的模糊老照片][4]
|
||||||
|
|
||||||
|
不要因为我随手拍了一张厨房柜台的照片而对我做出评价。一定有一个很好的理由(或者我觉得)。
|
||||||
|
|
||||||
|
无论如何。我试着用 Upscayl 对图片进行放大。
|
||||||
|
|
||||||
|
![使用 Upscayl][5]
|
||||||
|
|
||||||
|
这需要相当大的处理能力,但我的 8 核、第 11 代 i7 处理器和 16GB 内存可以轻松应对。
|
||||||
|
|
||||||
|
![Upscayl 工作时 CPU 的使用情况][6]
|
||||||
|
|
||||||
|
单张图片的处理花了大约 4 分钟,435KB 的图片最终变成了 24MB 的图片。说实话,我几乎没有注意到明显的差异。
|
||||||
|
|
||||||
|
![由 Upscayl 放大的图像][7]
|
||||||
|
|
||||||
|
我想把最后的结果嵌入这里的文章中。但是上传一张 24MB 的图片对我的服务器和你的浏览器来说都有点过分。
|
||||||
|
|
||||||
|
### 安装 Upscayl
|
||||||
|
|
||||||
|
不过,我这个不怎么成功的实验不应该阻止你自己去尝试它。
|
||||||
|
|
||||||
|
目前,该应用程序可用于 Linux。对 Windows 和 macOS 的支持正在计划中。
|
||||||
|
|
||||||
|
你可以得到 Upscayl 的 AppImage 和 Flatpak 软件包。我使用的是 AppImage 版本,你可以使用你喜欢的任何一种。
|
||||||
|
|
||||||
|
这些文件可以在发布页面上找到。
|
||||||
|
|
||||||
|
> **[下载 Upscayl][8]**
|
||||||
|
|
||||||
|
如果你喜欢这个项目,别忘了在 GitHub 上给它加星。
|
||||||
|
|
||||||
|
> **[GitHub - TGS963/upscayl][9]**
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://news.itsfoss.com/upscayl-version-1-release/
|
||||||
|
|
||||||
|
作者:[Abhishek][a]
|
||||||
|
选题:[lkxed][b]
|
||||||
|
译者:[wxy](https://github.com/wxy)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://news.itsfoss.com/author/abhishek/
|
||||||
|
[b]: https://github.com/lkxed
|
||||||
|
[1]: https://news.itsfoss.com/content/images/size/w1200/2022/08/upscayl-image-upscaler.png
|
||||||
|
[2]: https://github.com/TGS963/upscayl
|
||||||
|
[3]: https://news.itsfoss.com/content/media/2022/08/upscayl-in-action.mp4
|
||||||
|
[4]: https://news.itsfoss.com/content/images/2022/08/old-blurry-photo.jpg
|
||||||
|
[5]: https://news.itsfoss.com/content/images/2022/08/Using-Upscayl-for-image-processing.png
|
||||||
|
[6]: https://news.itsfoss.com/content/images/2022/08/Upscayl-CPU-usage.png
|
||||||
|
[7]: https://news.itsfoss.com/content/images/2022/08/Upscayl-final-result.png
|
||||||
|
[8]: https://github.com/TGS963/upscayl/releases
|
||||||
|
[9]: https://github.com/TGS963/upscayl
|
@ -0,0 +1,60 @@
|
|||||||
|
[#]: subject: "My open source journey from user to contributor to CTO"
|
||||||
|
[#]: via: "https://opensource.com/article/22/8/my-open-source-career-story"
|
||||||
|
[#]: author: "Jesse White https://opensource.com/users/jwhite-0"
|
||||||
|
[#]: collector: "lkxed"
|
||||||
|
[#]: translator: "aftermath0703"
|
||||||
|
[#]: reviewer: "wxy"
|
||||||
|
[#]: publisher: "wxy"
|
||||||
|
[#]: url: "https://linux.cn/article-14971-1.html"
|
||||||
|
|
||||||
|
从用户到贡献者到 CTO 的开源之旅
|
||||||
|
======
|
||||||
|
|
||||||
|
![](https://img.linux.net.cn/data/attachment/album/202208/27/154503q9yw0rewy2ge2r8f.jpg)
|
||||||
|
|
||||||
|
> 任何考虑在开源领域发展的人都具有无限的可能性。下面是我的故事。
|
||||||
|
|
||||||
|
当人们问我最喜欢开源的什么时,我的回答很简单:那就是 *开放性* 。在开源中,社区开发者和贡献者所做的工作是在公共领域的,所有人都能看到并从中受益。我对这一理念爱不释手。
|
||||||
|
|
||||||
|
有多少人可以对他们的劳动成果这样说?有多少人,也许在 50 年后,可以回过头来说:“看看我那天写的代码,有几百/几千/几万人从中受益。”我觉得这比从事那些对世界上大多数人来说都是隐秘的软件工作更令人无比兴奋。
|
||||||
|
|
||||||
|
我很幸运,我的工作使我置身于一个开源和企业交叉的有趣领域中。如今,我是 [OpenNMS 集团][2] 的首席技术官,这家公司负责维护 [OpenNMS 项目][3]。OpenNMS 是一个领先的开源网络监控和管理平台。
|
||||||
|
|
||||||
|
虽然我现在的角色让我牢牢扎根于开源领域,但我是以用户和贡献者身份开始的。
|
||||||
|
|
||||||
|
2007 年,我得到了我的第一份真正的技术工作,在加拿大蒙特利尔的电信服务提供商 Datavalet 技术公司从事网络分析。在五年的时间内,我成长为解决方案架构师,任务是帮助公司选择网络管理解决方案。我们选择了 OpenNMS,正是通过这次经历,我认识到了开源的真正力量。
|
||||||
|
|
||||||
|
在平台上线时,我们发现了一些缺失的功能,这些功能将有助于优化我们的体验。一位来自 OpenNMS 集团的代表在现场帮助我们进行部署,并建议我参加社区即将举行的 DevJam,与核心开发人员一起建立我们需要的功能。
|
||||||
|
|
||||||
|
在 DevJam 期间,我很快就融入了团队和社区。我们卷起袖子,开始编码,以创建 Datavalet 所需的增强功能。在几天之内,这个附加的功能就准备好了。这是一次令人惊叹的变革性经历,让我真正看到了开源的力量。
|
||||||
|
|
||||||
|
一年后,我离职了,在康科迪亚大学全日制学习数学。正是在那里,我再次有机会与 OpenNMS 团队合作,这一次是在该年的谷歌代码之夏的一个项目上。在这个年度计划中,参与者的目标是成功完成开源软件开发项目。
|
||||||
|
|
||||||
|
代码之夏对我来说是一次改变职业生涯的经历。OpenNMS 的两位负责人参加了我们的项目演示,一年后,OpenNMS 团队邀请我作为一名全栈开发人员加入。
|
||||||
|
|
||||||
|
我努力工作,迅速晋升,并在 2015 年被任命为首席技术官。我认为这是一项个人成就,也再次验证了开源世界的特别之处。如果你喜欢与社区合作,热爱你所做的工作,你的贡献很快就会得到认可。
|
||||||
|
|
||||||
|
开源精神也影响了我从个人贡献者到首席技术官的发展,我现在领导着一个由 50 多人组成的产品开发团队。社区本质上是平等的,我与社区贡献者一起工作的经验教会了我如何在环境中领导,而不是控制。
|
||||||
|
|
||||||
|
我经历了一段奇妙的开源旅程,从用户到贡献者,再到一家开源公司的高管。开源方法超越了技术,因为专有开发环境中经常存在的障碍的进入和增长可以通过协作、透明和社区来克服。因此,对于任何考虑在开源领域工作的人来说,可能性是无限的。我就是证明。
|
||||||
|
|
||||||
|
我们生活在一个人们正在深刻审视自己的生活及其对世界的影响的时代。在开源公司工作特别有意义,因为我可以直接与用户社区互动并影响他们。终端用户和开发人员之间的经典屏障被打破了,我可以确切地看到我的工作如何改变人们的日常生活,或者激励人们为项目做出贡献。通过对一个项目的共同热爱来建立社区,建立持续一生的联系。
|
||||||
|
|
||||||
|
我知道这对我来说都是真实的,这也是为什么我对我的工作如此热情。我是一个彻头彻尾的开源极客,并以此为荣。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/22/8/my-open-source-career-story
|
||||||
|
|
||||||
|
作者:[Jesse White][a]
|
||||||
|
选题:[lkxed][b]
|
||||||
|
译者:[aftermath0703](https://github.com/aftermath0703)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/jwhite-0
|
||||||
|
[b]: https://github.com/lkxed
|
||||||
|
[1]: https://opensource.com/sites/default/files/lead-images/career_journey_road_gps_path_map_520.png
|
||||||
|
[2]: https://www.opennms.com/
|
||||||
|
[3]: https://www.opennms.com/
|
@ -0,0 +1,82 @@
|
|||||||
|
[#]: subject: "Want to Help Improve GNOME? This New Tool Gives You the Chance!"
|
||||||
|
[#]: via: "https://news.itsfoss.com/gnome-improve-tool/"
|
||||||
|
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||||
|
[#]: collector: "lkxed"
|
||||||
|
[#]: translator: "wxy"
|
||||||
|
[#]: reviewer: "wxy"
|
||||||
|
[#]: publisher: "wxy"
|
||||||
|
[#]: url: "https://linux.cn/article-14972-1.html"
|
||||||
|
|
||||||
|
想帮助改善 GNOME 吗?这个新工具给了你这个机会!
|
||||||
|
======
|
||||||
|
|
||||||
|
> 这个新的工具,使 GNOME 用户能够提供他们的配置和使用意见,以帮助改善用户体验。
|
||||||
|
|
||||||
|
![想帮助改善 GNOME 吗? 这个新工具给了你机会!][1]
|
||||||
|
|
||||||
|
GNOME 带来了一个工具,可以让用户匿名提供他们的配置、扩展和 GNOME 调整设置等方面的意见。
|
||||||
|
|
||||||
|
这应该有助于 GNOME 了解更多的用户偏好,并做出更好的增强用户体验的决定。
|
||||||
|
|
||||||
|
有趣的是,是红帽公司的一名实习生(Vojtech Stanek)创造了这个工具。
|
||||||
|
|
||||||
|
### GNOME 信息收集:准备好安装了吗?
|
||||||
|
|
||||||
|
![gnome info collect terminal][2]
|
||||||
|
|
||||||
|
该工具(`gnome-info-collect`)是一个简单的终端程序,你需要下载、安装并运行它来与 GNOME 分享数据。
|
||||||
|
|
||||||
|
以下是该工具需要从你的 GNOME 系统中收集的内容:
|
||||||
|
|
||||||
|
* 硬件信息(包括制造商和型号)。
|
||||||
|
* 系统设置(包括工作区配置、共享功能、SSH 等)。
|
||||||
|
* 安装并启用的 GNOME shell 扩展。
|
||||||
|
* 应用程序信息(如已安装的应用程序和收藏的应用程序)。
|
||||||
|
* Linux 发行版和版本。
|
||||||
|
* Flatpak 和 Flathub 状态。
|
||||||
|
* 默认浏览器。
|
||||||
|
* 机器 ID + 用户名的 [加盐哈希][3]。
|
||||||
|
|
||||||
|
你可以在其 [GitLab 页面][4] 上找到适合你的发行版的软件包和收集数据的更多细节。
|
||||||
|
|
||||||
|
如果你有一个基于 Ubuntu 的发行版,你可以通过输入以下内容来安装它:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo snap install --classic gnome-info-collect
|
||||||
|
```
|
||||||
|
|
||||||
|
安装完毕后,在终端使用以下命令将其启动:
|
||||||
|
|
||||||
|
```
|
||||||
|
gnome-info-collect
|
||||||
|
```
|
||||||
|
|
||||||
|
接下来,它会显示它打算与 GNOME 共享的数据。所以,如果你觉得没问题,你可以选择将数据上传到 GNOME 的服务器上。
|
||||||
|
|
||||||
|
![][5]
|
||||||
|
|
||||||
|
考虑到这些数据是匿名的,它应该可以帮助 GNOME 了解他们的用户喜欢什么,并随着时间的推移专注于这些改进。
|
||||||
|
|
||||||
|
> **[下载 gnome-info-collect][6]**
|
||||||
|
|
||||||
|
你对 GNOME 的这个新的数据收集工具有什么看法?请在下面的评论中分享你的想法。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://news.itsfoss.com/gnome-improve-tool/
|
||||||
|
|
||||||
|
作者:[Ankush Das][a]
|
||||||
|
选题:[lkxed][b]
|
||||||
|
译者:[wxy](https://github.com/wxy)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://news.itsfoss.com/author/ankush/
|
||||||
|
[b]: https://github.com/lkxed
|
||||||
|
[1]: https://news.itsfoss.com/content/images/size/w1200/2022/08/gnome-improvement-tool.jpg
|
||||||
|
[2]: https://news.itsfoss.com/content/images/2022/08/gnome-info-collect-terminal.png
|
||||||
|
[3]: https://en.wikipedia.org/wiki/Salt_(cryptography)
|
||||||
|
[4]: https://gitlab.gnome.org/vstanek/gnome-info-collect/
|
||||||
|
[5]: https://news.itsfoss.com/content/images/2022/08/gnome-info-collect-sharing.png
|
||||||
|
[6]: https://gitlab.gnome.org/vstanek/gnome-info-collect/
|
@ -1,101 +0,0 @@
|
|||||||
[#]: subject: "Linux-First AI Image Upscaler Upscayl Released its First Version"
|
|
||||||
[#]: via: "https://news.itsfoss.com/upscayl-version-1-release/"
|
|
||||||
[#]: author: "Abhishek https://news.itsfoss.com/author/abhishek/"
|
|
||||||
[#]: collector: "lkxed"
|
|
||||||
[#]: translator: " "
|
|
||||||
[#]: reviewer: " "
|
|
||||||
[#]: publisher: " "
|
|
||||||
[#]: url: " "
|
|
||||||
|
|
||||||
Linux-First AI Image Upscaler Upscayl Released its First Version
|
|
||||||
======
|
|
||||||
Not every day you come across an application with 'Linux-first' approach.
|
|
||||||
|
|
||||||
![Linux-First AI Image Upscaler Upscayl Released its First Version][1]
|
|
||||||
|
|
||||||
Got a pixelated, low-resolution image from the 2000s? Thanks to the advancement of artificial intelligence, you can easily enhance pixelated images into better resolution images.
|
|
||||||
|
|
||||||
Using a regular image editor requires manual efforts for upscaling the images.
|
|
||||||
|
|
||||||
There are tons of online AI image upscalers available, but they can't be trusted with your data.
|
|
||||||
|
|
||||||
A new project tries to solve this by providing you with a simple desktop application that lets you enhance low resolution photos in a new click.
|
|
||||||
|
|
||||||
It's first version is released today.
|
|
||||||
|
|
||||||
### Upscayl Features
|
|
||||||
|
|
||||||
[Upscayl][2] is a cross-platform application built with the Linux-first philosophy.
|
|
||||||
|
|
||||||
This simply means that Linux builds get priority but other platforms will also be supported.
|
|
||||||
|
|
||||||
Developed using Python and JavaScript, Upscayl gives a simple interface where you select the input image and output folder and hit the Upscayl button to enhance the image.
|
|
||||||
|
|
||||||
Here's a video of Upscayl in action.
|
|
||||||
|
|
||||||
![][3]
|
|
||||||
|
|
||||||
0:00
|
|
||||||
|
|
||||||
### Using Upscayl
|
|
||||||
|
|
||||||
I don't have lots of blurry pictures on my computer. Not that I am an excellent photographer, just too lazy to look for them among thousands of pictures.
|
|
||||||
|
|
||||||
Still, I managed to get a blurry, old photo from 2011 (it was 11 years ago and can be considered old now).
|
|
||||||
|
|
||||||
![Old blurry photo of a kitchen][4]
|
|
||||||
|
|
||||||
Don't judge me because I took a random photo of my kitchen counter. There must have been a good reason (or so I want to believe).
|
|
||||||
|
|
||||||
Anyway. I tried to upscale the image with Upscayl.
|
|
||||||
|
|
||||||
![Using Upscayl][5]
|
|
||||||
|
|
||||||
It took quite some processing power, but my 8-core, 11th Gen i7 processor with 16 GB RAM easily handled it.
|
|
||||||
|
|
||||||
![CPU usage while Upscayl works on upscaling the image][6]
|
|
||||||
|
|
||||||
The single image processing took around 4 minutes and the 435 KB image resulted in a 24 MB image. Quite honestly, I hardly noticed visible differences.
|
|
||||||
|
|
||||||
![Upscaled image by Upscayl][7]
|
|
||||||
|
|
||||||
I wanted to embed the final result in the article here. But uploading a 24 MB image would be overkill for my server and your browser.
|
|
||||||
|
|
||||||
### Getting Upscayl
|
|
||||||
|
|
||||||
Still, my not-so-successful experiment should not deter you from trying it out yourself.
|
|
||||||
|
|
||||||
The application is available for Linux at the moment. Support for Windows and macOS is planned.
|
|
||||||
|
|
||||||
You can get Upscayl in AppImage and Flatpak formats. I used the AppImage version, you can use whichever you prefer.
|
|
||||||
|
|
||||||
The files are available on the release page.
|
|
||||||
|
|
||||||
[Download Upscayl][8]
|
|
||||||
|
|
||||||
And if you liked the project, don't forget to star it on GitHub 👇
|
|
||||||
|
|
||||||
[GitHub - TGS963/upscayl: 🆙 Upscayl - Free and Open Source AI Image Upscaler for Linux, MacOS and Windows][9]
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://news.itsfoss.com/upscayl-version-1-release/
|
|
||||||
|
|
||||||
作者:[Abhishek][a]
|
|
||||||
选题:[lkxed][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://news.itsfoss.com/author/abhishek/
|
|
||||||
[b]: https://github.com/lkxed
|
|
||||||
[1]: https://news.itsfoss.com/content/images/size/w1200/2022/08/upscayl-image-upscaler.png
|
|
||||||
[2]: https://github.com/TGS963/upscayl
|
|
||||||
[3]: https://news.itsfoss.com/content/media/2022/08/upscayl-in-action.mp4
|
|
||||||
[4]: https://news.itsfoss.com/content/images/2022/08/old-blurry-photo.jpg
|
|
||||||
[5]: https://news.itsfoss.com/content/images/2022/08/Using-Upscayl-for-image-processing.png
|
|
||||||
[6]: https://news.itsfoss.com/content/images/2022/08/Upscayl-CPU-usage.png
|
|
||||||
[7]: https://news.itsfoss.com/content/images/2022/08/Upscayl-final-result.png
|
|
||||||
[8]: https://github.com/TGS963/upscayl/releases
|
|
||||||
[9]: https://github.com/TGS963/upscayl
|
|
@ -1,81 +0,0 @@
|
|||||||
[#]: subject: "Want to Help Improve GNOME? This New Tool Gives You the Chance!"
|
|
||||||
[#]: via: "https://news.itsfoss.com/gnome-improve-tool/"
|
|
||||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
|
||||||
[#]: collector: "lkxed"
|
|
||||||
[#]: translator: " "
|
|
||||||
[#]: reviewer: " "
|
|
||||||
[#]: publisher: " "
|
|
||||||
[#]: url: " "
|
|
||||||
|
|
||||||
Want to Help Improve GNOME? This New Tool Gives You the Chance!
|
|
||||||
======
|
|
||||||
A new tool to enable GNOME users to provide insights on their configuration and usage to help improve the user experience.
|
|
||||||
|
|
||||||
![Want to Help Improve GNOME? This New Tool Gives You the Chance!][1]
|
|
||||||
|
|
||||||
GNOME has come up with a tool that lets users provide **anonymous insights** about their configurations, extensions, and GNOME-tuned settings.
|
|
||||||
|
|
||||||
This should help GNOME learn more about user preferences and make better decisions to enhance the user experience.
|
|
||||||
|
|
||||||
Interestingly, an intern at **Red Hat** (*Vojtech Stanek*) created this tool.
|
|
||||||
|
|
||||||
### ℹ️ GNOME Info Collect: Ready to Install?
|
|
||||||
|
|
||||||
![gnome info collect terminal][2]
|
|
||||||
|
|
||||||
The tool (gnome-info-collect) is a simple terminal program that you need to download, install, and run to share the data with GNOME.
|
|
||||||
|
|
||||||
Here's what the tool needs to collect from your GNOME system:
|
|
||||||
|
|
||||||
* Hardware information (including manufacturer and model).
|
|
||||||
* System settings (including workspace configuration, sharing features, SSH etc.)
|
|
||||||
* GNOME shell extensions installed and enabled.
|
|
||||||
* Application information (like installed apps and favorites).
|
|
||||||
* Linux distro and version.
|
|
||||||
* Flatpak and Flathub status.
|
|
||||||
* Default browser.
|
|
||||||
* [Salted hash][3] of machine ID+username.
|
|
||||||
|
|
||||||
You can find the package suitable for your distribution and more details on the data collected available on its [GitLab page][4].
|
|
||||||
|
|
||||||
For instance, if you have an **Ubuntu-based distribution**, you can install it by typing in:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo snap install --classic gnome-info-connect
|
|
||||||
```
|
|
||||||
|
|
||||||
Once installed, fire it up using the following command in the terminal:
|
|
||||||
|
|
||||||
```
|
|
||||||
gnome-info-collect
|
|
||||||
```
|
|
||||||
|
|
||||||
Next, it displays the data that it intends to share with GNOME. So, if it looks good to you, you can choose to upload the data to GNOME's servers.
|
|
||||||
|
|
||||||
![][5]
|
|
||||||
|
|
||||||
Considering the data remains anonymous, it should help GNOME understand what their users like, and focus on those improvements over time.
|
|
||||||
|
|
||||||
[Download gnome-info-collect][6]
|
|
||||||
|
|
||||||
💬 *What do you think about this new data collection tool for GNOME? Share your thoughts in the comments down below.*
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://news.itsfoss.com/gnome-improve-tool/
|
|
||||||
|
|
||||||
作者:[Ankush Das][a]
|
|
||||||
选题:[lkxed][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://news.itsfoss.com/author/ankush/
|
|
||||||
[b]: https://github.com/lkxed
|
|
||||||
[1]: https://news.itsfoss.com/content/images/size/w1200/2022/08/gnome-improvement-tool.jpg
|
|
||||||
[2]: https://news.itsfoss.com/content/images/2022/08/gnome-info-collect-terminal.png
|
|
||||||
[3]: https://en.wikipedia.org/wiki/Salt_(cryptography)
|
|
||||||
[4]: https://gitlab.gnome.org/vstanek/gnome-info-collect/
|
|
||||||
[5]: https://news.itsfoss.com/content/images/2022/08/gnome-info-collect-sharing.png
|
|
||||||
[6]: https://gitlab.gnome.org/vstanek/gnome-info-collect/
|
|
@ -1,143 +0,0 @@
|
|||||||
[#]: subject: "How I use Bash to automate tasks on Linux"
|
|
||||||
[#]: via: "https://opensource.com/article/22/7/use-bash-automate-tasks-linux"
|
|
||||||
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
|
|
||||||
[#]: collector: "lkxed"
|
|
||||||
[#]: translator: "Donkey-Hao"
|
|
||||||
[#]: reviewer: " "
|
|
||||||
[#]: publisher: " "
|
|
||||||
[#]: url: " "
|
|
||||||
|
|
||||||
How I use Bash to automate tasks on Linux
|
|
||||||
======
|
|
||||||
Bash has a few handy automation features that make my life easier when working with files on Linux.
|
|
||||||
|
|
||||||
![bash logo on green background][1]
|
|
||||||
|
|
||||||
Image by: Opensource.com
|
|
||||||
|
|
||||||
The Bash command line is a great way to automate tasks. Whether you are running Linux on a server and need to manipulate log files or other data, or you're a desktop user who just wants to keep files tidy, you can use a few automation features in Bash to make your work easier.
|
|
||||||
|
|
||||||
### Linux for command: Automate tasks on a files
|
|
||||||
|
|
||||||
If you have a bunch of files to work on at once, and you need to do the same thing with every file, use the `for` command. This command iterates across a list of files, and executes one or more commands. The `for` command looks like this:
|
|
||||||
|
|
||||||
```
|
|
||||||
for variable in list
|
|
||||||
do
|
|
||||||
commands
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
I've added some extra spacing in there to help separate the different parts of the `for` command. That multi-line command might look difficult to run on the command line, but you can use `;` to put everything on one line, like this:
|
|
||||||
|
|
||||||
```
|
|
||||||
for variable in list ; do commands ; done
|
|
||||||
```
|
|
||||||
|
|
||||||
Let's see it in action. One way I use the `for` command is to rename a bunch of files. Most recently, I had a bunch of screenshots that I wanted to rename. The screenshots had names like `filemgr.png` or `terminal.png` and I wanted to put `screenshot` before each name instead. I ran a single `for` command to rename thirty files at once. Here's an example with just two files:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ ls
|
|
||||||
filemgr.png terminal.png
|
|
||||||
$ for f in *.png ; do mv $f screenshot-$f ; done
|
|
||||||
$ ls
|
|
||||||
screenshot-filemgr.png screenshot-terminal.png
|
|
||||||
```
|
|
||||||
|
|
||||||
The `for` command makes it easy to perform one or more actions on a set of files. You can use a variable name that is meaningful to you, such as `image` or `screenshot`, or you can use a "shorthand" variable like `f`, as I did in my example. When I write scripts that use a `for` loop, I try to use meaningful variable names. But when I'm using `for` on the command line, I'll usually use a short variable name like `f` for files or `d` for directories.
|
|
||||||
|
|
||||||
Whatever name you choose for your variable, be sure to reference the variable using `$` in the command. This expands the variable to the name of the file you are acting on. Type `help for` at your Bash prompt to learn more about the `for` command.
|
|
||||||
|
|
||||||
### Linux conditional execution (if)
|
|
||||||
|
|
||||||
Looping across a set of files with `for` is helpful when you need to do the same thing with every file. But what if you need to do something different for certain files? For that, you need conditional execution with the `if` statement. The `if` statement looks like this:
|
|
||||||
|
|
||||||
```
|
|
||||||
if test
|
|
||||||
then
|
|
||||||
commands
|
|
||||||
fi
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also do *if/else* tests by using the `else` keyword:
|
|
||||||
|
|
||||||
```
|
|
||||||
if test
|
|
||||||
then
|
|
||||||
commands
|
|
||||||
else
|
|
||||||
commands
|
|
||||||
fi
|
|
||||||
```
|
|
||||||
|
|
||||||
For more complicated processing, you can use *if/else-if/else* evaluations. I might use this in a script, when I need to automate a job to process a collection of files at once:
|
|
||||||
|
|
||||||
```
|
|
||||||
if test
|
|
||||||
then
|
|
||||||
commands
|
|
||||||
elif test2
|
|
||||||
then
|
|
||||||
commands
|
|
||||||
elif test3
|
|
||||||
then
|
|
||||||
commands
|
|
||||||
else
|
|
||||||
commands
|
|
||||||
fi
|
|
||||||
```
|
|
||||||
|
|
||||||
The `if` command allows you to perform many different tests, such as *if* a file is really a file, or *if* a file is empty (zero size). Type `help test` at your Bash prompt to see the different kinds of tests you can use in an `if` statement.
|
|
||||||
|
|
||||||
For example, let's say I wanted to clean up a log directory that had several dozen files in it. A common task in log management is to delete any empty logs, and compress the other logs. The easiest way to tackle this is to just delete the empty files. There isn't an `if` test that exactly matches that, but we have `-s` file to test *if* something is a file, and *if* the file is not empty (it has a size). That's the opposite of what we want, but we can negate the test with `!` to see *if* something is not a file or is empty.
|
|
||||||
|
|
||||||
Let's look at an example to see this at work. I've created two test files: one is empty, and the other contains some data. We can use `if` to print the message "empty" *if* the file is empty:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ ls
|
|
||||||
datafile emptyfile
|
|
||||||
$ if [ ! -s datafile ] ; then echo "empty" ; fi
|
|
||||||
$ if [ ! -s emptyfile ] ; then echo "empty" ; fi
|
|
||||||
empty
|
|
||||||
```
|
|
||||||
|
|
||||||
We can combine this with for to examine a list of log files to delete the empty files for us:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ ls -l
|
|
||||||
total 20
|
|
||||||
-rw-rw-r--. 1 jhall jhall 2 Jul 1 01:02 log.1
|
|
||||||
-rw-rw-r--. 1 jhall jhall 2 Jul 2 01:02 log.2
|
|
||||||
-rw-rw-r--. 1 jhall jhall 2 Jul 3 01:02 log.3
|
|
||||||
-rw-rw-r--. 1 jhall jhall 0 Jul 4 01:02 log.4
|
|
||||||
-rw-rw-r--. 1 jhall jhall 2 Jul 5 01:02 log.5
|
|
||||||
-rw-rw-r--. 1 jhall jhall 0 Jul 6 01:02 log.6
|
|
||||||
-rw-rw-r--. 1 jhall jhall 2 Jul 7 01:02 log.7
|
|
||||||
$ for f in log.* ; do if [ ! -s $f ] ; then rm -v $f ; fi ; done
|
|
||||||
removed 'log.4'
|
|
||||||
removed 'log.6'
|
|
||||||
$ ls -l
|
|
||||||
total 20
|
|
||||||
-rw-rw-r--. 1 jhall jhall 2 Jul 1 01:02 log.1
|
|
||||||
-rw-rw-r--. 1 jhall jhall 2 Jul 2 01:02 log.2
|
|
||||||
-rw-rw-r--. 1 jhall jhall 2 Jul 3 01:02 log.3
|
|
||||||
-rw-rw-r--. 1 jhall jhall 2 Jul 5 01:02 log.5
|
|
||||||
-rw-rw-r--. 1 jhall jhall 2 Jul 7 01:02 log.7
|
|
||||||
```
|
|
||||||
|
|
||||||
Using the `if` command can add some intelligence to scripts, to perform actions only when needed. I often use `if` in scripts when I need to test *if* a file does or does not exist on my system, or *if* the entry the script is examining is a file or directory. Using `if` allows my script to take different actions as needed.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/article/22/7/use-bash-automate-tasks-linux
|
|
||||||
|
|
||||||
作者:[Jim Hall][a]
|
|
||||||
选题:[lkxed][b]
|
|
||||||
译者:[Donkey](https://github.com/Donkey-Hao)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://opensource.com/users/jim-hall
|
|
||||||
[b]: https://github.com/lkxed
|
|
||||||
[1]: https://opensource.com/sites/default/files/lead-images/bash_command_line.png
|
|
@ -2,7 +2,7 @@
|
|||||||
[#]: via: "https://itsfoss.com/apt-update-vs-upgrade/"
|
[#]: via: "https://itsfoss.com/apt-update-vs-upgrade/"
|
||||||
[#]: author: "Abhishek Prakash https://itsfoss.com/"
|
[#]: author: "Abhishek Prakash https://itsfoss.com/"
|
||||||
[#]: collector: "lkxed"
|
[#]: collector: "lkxed"
|
||||||
[#]: translator: " "
|
[#]: translator: "Yufei-Yan"
|
||||||
[#]: reviewer: " "
|
[#]: reviewer: " "
|
||||||
[#]: publisher: " "
|
[#]: publisher: " "
|
||||||
[#]: url: " "
|
[#]: url: " "
|
||||||
|
@ -0,0 +1,188 @@
|
|||||||
|
[#]: subject: "My favorite open source library for analyzing music files"
|
||||||
|
[#]: via: "https://opensource.com/article/22/8/analyze-music-files-jaudiotagger"
|
||||||
|
[#]: author: "Chris Hermansen https://opensource.com/users/clhermansen"
|
||||||
|
[#]: collector: "lkxed"
|
||||||
|
[#]: translator: " "
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
My favorite open source library for analyzing music files
|
||||||
|
======
|
||||||
|
Here's how I use the JAudiotagger library with a Groovy script I created to analyze my music files.
|
||||||
|
|
||||||
|
In my [previous article][2], I created a framework for analyzing the directories and subdirectories of music files, using the `groovy.File` class, which extends and streamlines `java.File` and simplifies its use. In this article, I use the open source [JAudiotagger library][3] to analyze the tags of the music files in the music directory and subdirectories. Be sure to read the first article in this series if you intend to follow along.
|
||||||
|
|
||||||
|
### Install Java and Groovy
|
||||||
|
|
||||||
|
Groovy is based on Java, and requires a Java installation. Both a recent and decent version of Java and Groovy might be in your Linux distribution's repositories. Groovy can also be installed directly from the [Apache Foundation website][4]. A nice alternative for Linux users is [SDKMan][5], which can be used to get multiple versions of Java, Groovy, and many other related tools. For this article, I use SDK's releases of:
|
||||||
|
|
||||||
|
* Java: version 11.0.12-open of OpenJDK 11
|
||||||
|
* Groovy: version 3.0.8
|
||||||
|
|
||||||
|
### Back to the problem
|
||||||
|
|
||||||
|
In the 15 or so years that I've been carefully ripping my CD collection and increasingly buying digital downloads, I have found that ripping programs and digital music download vendors are all over the map when it comes to tagging music files. Sometimes, my files are missing tags that can be useful to music players, such as `ALBUMSORT`. Sometimes this means my files are full of tags I don't care about, such as `MUSICBRAINZ_DISCID`, that cause some music players to change the order of presentation in obscure ways, so that one album appears to be many, or sorts in a strange order.
|
||||||
|
|
||||||
|
Given that I have nearly 10,000 tracks in nearly 700 albums, it's quite nice when my music player manages to display my collection in a reasonably understandable order. Therefore, the ultimate goal of this series is to create a few useful scripts to help identify missing or unusual tags and facilitate the creation of a work plan to fix tagging problems. This particular script analyzes the tags of music files and creates a CSV file that I can load into [LibreOffice][6] or [OnlyOffice][7] to look for problems. It won't look at missing `cover.jpg` files nor show album sub-subdirectories that contain other files, because this isn't relevant at the music file level.
|
||||||
|
|
||||||
|
### My Groovy framework plus JAudiotagger
|
||||||
|
|
||||||
|
Once again, start with the code. As before, I've incorporated comments in the script that reflect the (relatively abbreviated) "comment notes" that I typically leave for myself:
|
||||||
|
|
||||||
|
```
|
||||||
|
1 @Grab('net.jthink:jaudiotagger:3.0.1')
|
||||||
|
2 import org.jaudiotagger.audio.*
|
||||||
|
|
||||||
|
3 def logger = java.util.logging.Logger.getLogger('org.jaudiotagger');
|
||||||
|
4 logger.setLevel(java.util.logging.Level.OFF);
|
||||||
|
|
||||||
|
5 // Define the music library directory
|
||||||
|
|
||||||
|
6 def musicLibraryDirName = '/var/lib/mpd/music'
|
||||||
|
|
||||||
|
7 // These are the music file tags we are happy to see
|
||||||
|
8 // Some tags can occur more than once in a given file
|
||||||
|
|
||||||
|
9 def wantedFieldIdSet = ['ALBUM', 'ALBUMARTIST',
|
||||||
|
10 'ALBUMARTISTSORT', 'ARTIST', 'ARTISTSORT',
|
||||||
|
11 'COMPOSER', 'COMPOSERSORT', 'COVERART', 'DATE',
|
||||||
|
12 'GENRE', 'TITLE', 'TITLESORT', 'TRACKNUMBER',
|
||||||
|
13 'TRACKTOTAL', 'VENDOR', 'YEAR'] as LinkedHashSet
|
||||||
|
|
||||||
|
14 // Print the CSV file header
|
||||||
|
|
||||||
|
15 print "artistDir|albumDir|contentFile"
|
||||||
|
16 print "|${wantedFieldIdSet*.toLowerCase().join('|')}"
|
||||||
|
17 println "|other tags"
|
||||||
|
|
||||||
|
18 // Iterate over each directory in the music libary directory
|
||||||
|
19 // These are assumed to be artist directories
|
||||||
|
|
||||||
|
20 new File(musicLibraryDirName).eachDir { artistDir ->
|
||||||
|
|
||||||
|
21 // Iterate over each directory in the artist directory
|
||||||
|
22 // These are assumed to be album directories
|
||||||
|
|
||||||
|
23 artistDir.eachDir { albumDir ->
|
||||||
|
|
||||||
|
24 // Iterate over each file in the album directory
|
||||||
|
25 // These are assumed to be content or related
|
||||||
|
26 // (cover.jpg, PDFs with liner notes etc)
|
||||||
|
|
||||||
|
27 albumDir.eachFile { contentFile ->
|
||||||
|
|
||||||
|
28 // Initialize the counter map for tags we like
|
||||||
|
29 // and the list for unwanted tags
|
||||||
|
|
||||||
|
30 def fieldKeyCounters = wantedFieldIdSet.collectEntries { e ->
|
||||||
|
31 [(e): 0]
|
||||||
|
32 }
|
||||||
|
33 def unwantedFieldIds = []
|
||||||
|
|
||||||
|
34 // Analyze the file and print the analysis
|
||||||
|
|
||||||
|
35 if (contentFile.name ==~ /.*\.(flac|mp3|ogg)/) {
|
||||||
|
36 def af = AudioFileIO.read(contentFile)
|
||||||
|
37 af.tag.fields.each { tagField ->
|
||||||
|
38 if (tagField.id in wantedFieldIdSet)
|
||||||
|
39 fieldKeyCounters[tagField.id]++
|
||||||
|
40 else
|
||||||
|
41 unwantedFieldIds << tagField.id
|
||||||
|
42 }
|
||||||
|
43 print "${artistDir.name}|${albumDir.name}|${contentFile.name}"
|
||||||
|
44 wantedFieldIdSet.each { fieldId ->
|
||||||
|
45 print "|${fieldKeyCounters[fieldId]}"
|
||||||
|
46 }
|
||||||
|
47 println "|${unwantedFieldIds.join(',')}"
|
||||||
|
48 }
|
||||||
|
49 }
|
||||||
|
50 }
|
||||||
|
51 }
|
||||||
|
```
|
||||||
|
|
||||||
|
Line 1 is one of those awesomely lovely Groovy facilities that simplify life enormously. It turns out that the kind developer of JAudiotagger makes a compiled version available on the Maven central repository. In Java, this requires some [XML ceremony and configuration][8]. Using Groovy, I just use the @Grab annotation, and Groovy handles the rest behind the scenes.
|
||||||
|
|
||||||
|
Line 2 imports the relevant class files from the JAudiotagger library.
|
||||||
|
|
||||||
|
Lines 3-4 configure the JAudiotagger library to turn off logging. In my own experiments, the default level is quite verbose and the output of any script using JAudiotagger is filled with logging information. This works well because Groovy builds the script into a static main class. I'm sure I'm not the only one who has configured the logger in some instance method only to see the configuration garbage collected after the instance method returns.
|
||||||
|
|
||||||
|
Lines 5-6 are from the framework introduced in Part 1.
|
||||||
|
|
||||||
|
Lines 7-13 create a LinkedHashSet containing the list of tags that I hope will be in each file (or, at least, I'm OK with having in each file). I use a LinkedHashSet here so that the tags are ordered.
|
||||||
|
|
||||||
|
This is a good time to point out a discrepancy in the terminology I've been using up until now and the class definitions in the JAudiotagger library. What I have been calling "tags" are what JAudiotagger calls `org.jaudiotagger.tag.TagField` instances. These *instances* live within an instance of `org.jaudiotagger.tag.Tag`. So the "tag" from JAudiotagger's point of view is the collection of "tag fields". I'm going to follow their naming convention for the rest of this article.
|
||||||
|
|
||||||
|
This collection of strings reflects a bit of [prior digging with metaflac][9]. Finally, it's worth mentioning that JAudiotagger's `org.jaudiotagger.tag.FieldKey` uses "_" to separate words in the field keys, which seems incompatible with the strings returned by `org.jaudiotagger.tag.Tag.getFields()`, so I don’t use `FieldKey`.
|
||||||
|
|
||||||
|
Lines 14-17 print the CSV file header. Note the use of Groovy's `*.` spread operator to apply `toLowerCase()` to each (upper case) string element of `wantedFieldIdSet`.
|
||||||
|
|
||||||
|
Lines 18-27 are from the framework introduced in Part 1, descending into the sub-sub-directories where the music files are found.
|
||||||
|
|
||||||
|
Lines 28-32 initialize a map of counters for the desired fields. I use counters here because some tag fields can occur more than once in a given file. Note the use of `wantedFieldIdSet.collectEntries` to build a map using the set elements as keys (the key value e is in parentheses, as it must be evaluated). I explain this in more detail in [this article][10] about maps in Groovy.
|
||||||
|
|
||||||
|
Line 33 initializes a list for accumulating unwanted tag field IDs.
|
||||||
|
|
||||||
|
Lines 34-48 analyzes any FLAC, MP3 or OGG music files found:
|
||||||
|
|
||||||
|
* Line 35 uses the Groovy match operator `==~` and a "slashy" regular expression to check file name patterns;
|
||||||
|
* Line 36 reads the music file metadata using `org.jaudiotagger.AudioFileIO.read()` into the variable af
|
||||||
|
* Line 37-48 loops over the tag fields found in the metadata:
|
||||||
|
* Line 37 uses Groovy's `each()` method to iterate over the list of tag fields returned by `af.tag.getFields()`, which in Groovy can be abbreviated to `af.tag.fields`
|
||||||
|
* Line 38-39 counts any occurrence of a wanted tag field ID
|
||||||
|
* Line 40-41 appends an occurrence of an unwanted tag field ID to the unwanted list
|
||||||
|
* Line 43-47 prints out the counts and unwanted fields (if any)
|
||||||
|
|
||||||
|
That's it!
|
||||||
|
|
||||||
|
Typically, I would run this as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ groovy TagAnalyzer2.groovy > tagAnalysis2.csv
|
||||||
|
```
|
||||||
|
|
||||||
|
And then I load the resulting CSV into a spreadsheet. For example, with LibreOffice Calc, I go to the **Sheet** menu and select **Insert sheet from file.** I set the delimiter character to `|`. In my case, the results look like this:
|
||||||
|
|
||||||
|
![Image of a screenshot of the first few rows of tagAnalysis2.csv][11]
|
||||||
|
|
||||||
|
Image by: (Chris Hermansen, CC BY-SA 4.0)
|
||||||
|
|
||||||
|
I like to have the ALBUMARTIST defined as well as the ARTIST for some music players so that the files in an album are grouped together when artists on individual tracks vary. This happens in compilation albums, but also in some albums with guest artists where the ARTIST field might say for example "Tony Bennett and Snoop Dogg" (I made that up. I think.) Lines 22 and onward in the spreadsheet shown above don't specify the album artist, so I might want to fix that going forward.
|
||||||
|
|
||||||
|
Here is what the last column showing unwanted field ids looks like:
|
||||||
|
|
||||||
|
![Image of a screenshot of unwanted field ids in tagAnalysic2.csv][12]
|
||||||
|
|
||||||
|
Image by: (Chris Hermansen, CC BY-SA 4.0)
|
||||||
|
|
||||||
|
Note that these tags may be of some interest and so the "wanted" list is modified to include them. I would set up some kind of script to delete field IDs BPM, ARTWORKGUID, CATALOGUENUMBER, ISRC and PUBLISHER.
|
||||||
|
|
||||||
|
### Next steps
|
||||||
|
|
||||||
|
In the next article, I'll step back from tracks and check for `cover.jpg` and other non-music files lying around in artist subdirectories and album sub-subdirectories.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/22/8/analyze-music-files-jaudiotagger
|
||||||
|
|
||||||
|
作者:[Chris Hermansen][a]
|
||||||
|
选题:[lkxed][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/clhermansen
|
||||||
|
[b]: https://github.com/lkxed
|
||||||
|
[1]: https://opensource.com/sites/default/files/lead-images/video_editing_folder_music_wave_play.png
|
||||||
|
[2]: https://opensource.com/article/22/8/groovy-scripting-analyzing-music-directory-part-1
|
||||||
|
[3]: http://www.jthink.net/jaudiotagger/examples_read.jsp
|
||||||
|
[4]: https://groovy.apache.org/download.html
|
||||||
|
[5]: https://opensource.com/article/22/3/manage-java-versions-sdkman
|
||||||
|
[6]: https://opensource.com/tags/libreoffice
|
||||||
|
[7]: https://opensource.com/article/20/7/nextcloud
|
||||||
|
[8]: https://opensource.com/article/22/3/maven-manage-java-dependencies
|
||||||
|
[9]: https://opensource.com/article/19/11/metaflac-fix-music-tags
|
||||||
|
[10]: https://opensource.com/article/22/6/maps-groovy-vs-java
|
||||||
|
[11]: https://opensource.com/sites/default/files/2022-08/screenshot%20of%20first%20few%20rows%20of%20tagAnalysis2.csv%20in%20LibreOffice%20Calc.png
|
||||||
|
[12]: https://opensource.com/sites/default/files/2022-08/screenshot%20of%20unwanted%20field%20ids%20in%20tagAnalysis2.csv_.png
|
@ -1,57 +0,0 @@
|
|||||||
[#]: subject: "My open source journey from user to contributor to CTO"
|
|
||||||
[#]: via: "https://opensource.com/article/22/8/my-open-source-career-story"
|
|
||||||
[#]: author: "Jesse White https://opensource.com/users/jwhite-0"
|
|
||||||
[#]: collector: "lkxed"
|
|
||||||
[#]: translator: "aftermath0703"
|
|
||||||
[#]: reviewer: " "
|
|
||||||
[#]: publisher: " "
|
|
||||||
[#]: url: " "
|
|
||||||
|
|
||||||
我从用户到贡献者到CTO的开源之旅
|
|
||||||
======
|
|
||||||
任何一位考虑在开源领域发展的人都具有无限的可能性。下面是我的故事
|
|
||||||
|
|
||||||
当人们问我最喜欢开源的什么时,我的回答很简单:那就是 *开放性* 。在开源中,社区开发者和贡献者所做的工作是在公共领域的,所有人都能看到并从中受益。我对这一理念爱不释手。
|
|
||||||
|
|
||||||
有多少人可以这样说他们的劳动成果?多长时间,也许是50年后,可以回过头来说:“看看我那天写的代码,有几百/几千/几万人从中受益。”我觉得这比从事那些对世界上大多数人来说都是隐秘的软件工作更令人无比兴奋。
|
|
||||||
|
|
||||||
我很幸运,我的工作使我处于一个有趣的领域中间,在这个领域中,开源和企业相遇。今天,我是[OpenNMS集团][2]的首席技术官,公司负责维护[OpenNMS项目][3]。OpenNMS是一个领先的开源网络监控和管理平台。
|
|
||||||
|
|
||||||
虽然我现在的角色让我牢牢扎根于开源领域,但我是以用户和贡献者身份开始的。
|
|
||||||
|
|
||||||
2007年,我得到了我的第一份真正的技术工作,在加拿大蒙特利尔的电信服务提供商Datavalet Technologies担任网络分析员。在五年的时间内,我扩展到解决方案架构师的角色,任务是帮助组织选择网络管理解决方案。我们选择了OpenNMS,正是通过这次经历,我认识到了开源的真正力量。
|
|
||||||
|
|
||||||
在平台上线时,我们发现了一些缺失的功能,这些功能将有助于优化我们的体验。一位来自OpenNMS集团的代表在现场帮助我们进行部署,并建议我参加社区即将举行的DevJam,与核心开发人员一起建立我们需要的功能。
|
|
||||||
|
|
||||||
在DevJam期间,我很快就融入了团队和社区。我们卷起袖子,开始编码,以创建Datavalet所需的增强功能。在几天之内,额外的功能就准备好了。这是一次令人惊叹的变革性经历,让我真正看到了开源的力量。
|
|
||||||
|
|
||||||
一年后,我离开了我的工作,在康科迪亚大学全日制学习数学。正是在那里,我再次有机会与OpenNMS团队合作,这一次是在当年的谷歌代码之夏的一个项目上。在这个年度计划中,参与者的目标是成功完成开源软件开发项目。
|
|
||||||
|
|
||||||
代码之夏对我来说是一次改变职业生涯的经历。该组织的两位领导人参加了我们的项目演示,一年后,OpenNMS团队邀请我作为一名全栈开发人员加入。
|
|
||||||
|
|
||||||
我努力工作,迅速晋升,并在2015年被任命为首席技术官。我认为这是一项个人成就,也再次验证了开源世界的特别之处。如果你喜欢与社区合作,热爱你所做的工作,你的贡献很快就会得到认可。
|
|
||||||
|
|
||||||
开源精神也影响了我从个人贡献者到CTO的发展,我现在领导着一个由50多人组成的产品开发组织。社区本质上是平等的,我与社区贡献者一起工作的经验教会了我如何在环境中领导,而不是控制。
|
|
||||||
|
|
||||||
我经历了一段奇妙的开源旅程,从用户到贡献者,再到一家开源公司的高管。开源方法超越了技术,因为专有开发环境中经常存在的障碍的进入和增长可以通过协作、透明和社区来克服。因此,对于任何考虑在开源领域工作的人来说,可能性是无限的。我就是证明。
|
|
||||||
|
|
||||||
我们生活在一个人们正在深刻审视自己的生活及其对世界的影响的时代。在开源公司工作特别有意义,因为我可以直接与用户社区互动并影响他们。终端用户和开发人员之间的经典屏障被打破了,我可以确切地看到我的工作如何改变某人的日常生活,或者激励某人为项目做出贡献。通过对一个项目的共同热爱来建立社区,建立持续一生的联系。
|
|
||||||
|
|
||||||
我知道这对我来说都是真的,这也是为什么我对我的工作如此热情。我的内核是一个开源极客,并以此为荣。
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/article/22/8/my-open-source-career-story
|
|
||||||
|
|
||||||
作者:[Jesse White][a]
|
|
||||||
选题:[lkxed][b]
|
|
||||||
译者:[aftermath0703](https://github.com/aftermath0703)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://opensource.com/users/jwhite-0
|
|
||||||
[b]: https://github.com/lkxed
|
|
||||||
[1]: https://opensource.com/sites/default/files/lead-images/career_journey_road_gps_path_map_520.png
|
|
||||||
[2]: https://www.opennms.com/
|
|
||||||
[3]: https://www.opennms.com/
|
|
@ -0,0 +1,143 @@
|
|||||||
|
[#]: subject: "How I use Bash to automate tasks on Linux"
|
||||||
|
[#]: via: "https://opensource.com/article/22/7/use-bash-automate-tasks-linux"
|
||||||
|
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
|
||||||
|
[#]: collector: "lkxed"
|
||||||
|
[#]: translator: "Donkey-Hao"
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
如何在 Linux 上使用 Bash 自动化任务
|
||||||
|
======
|
||||||
|
Bash 有一些方便的自动化功能,可以让我在 Linux 上处理文件时更轻松。
|
||||||
|
|
||||||
|
![bash logo on green background][1]
|
||||||
|
|
||||||
|
图源:Opensource.com
|
||||||
|
|
||||||
|
通过 Bash 命令行进行自动化任务是极好的一种方式。不论你使用运行在服务器上的 Linux,进行管理日志文件还是其他文件,或者你在个人电脑上整理文件,使桌面保持整洁,使用 Bash 的自动化功能会使你的工作变得更简单。
|
||||||
|
|
||||||
|
### Linux `for` 命令:自动执行文件任务
|
||||||
|
|
||||||
|
如果你对一堆文件要同时处理,并且对每个文件进行相同的操作,请使用 `for` 命令。该命令会遍历文件列表,并执行一个或多个命令。`for` 命令如下所示:
|
||||||
|
|
||||||
|
```
|
||||||
|
for variable in list
|
||||||
|
do
|
||||||
|
commands
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
我在示例中添加了额外的空格,来分开 `for` 命令中不同的部分。多个命令可能无法在命令行中同时运行,不过你可以使用 `;` 将所有命令放在同一行中,就像这样:
|
||||||
|
|
||||||
|
```
|
||||||
|
for variable in list ; do commands ; done
|
||||||
|
```
|
||||||
|
|
||||||
|
让我们看看它的实际效果。我使用 `for` 命令来重命名一些文件。最近,我有一些截图,想要重命名。这些截图名称为 `filemgr.png` 或 `terminal.png`,我想将 `screenshot` 放在每个名称前。我可以使用 `for` 命令一次性将 30 个文件重命名。这是两个文件的示例:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ls
|
||||||
|
filemgr.png terminal.png
|
||||||
|
$ for f in *.png ; do mv $f screenshot-$f ; done
|
||||||
|
$ ls
|
||||||
|
screenshot-filemgr.png screenshot-terminal.png
|
||||||
|
```
|
||||||
|
|
||||||
|
`for` 命令使得在一系列文件中执行一种或多种操作变得容易。你可以用一些有意义的变量,比如 `image` 或 `screenshot`,或者你用示例中“缩写的”变量 `f`。当我在使用 `for` 循环写脚本的时候,会选择有意义的变量名。但是当我在命令行中使用 `for`,我通常会选择缩写变量名,比如 `f` 代表文件,`d` 代表目录等。
|
||||||
|
|
||||||
|
不论你选择怎样的变量名,请确保在引用变量时添加 `$` 符号。这会将变量扩展为你正在处理的文件的名称。在 Bash 提示符下键入 `help for` 以了解有关 `for` 命令的更多信息。
|
||||||
|
|
||||||
|
### Linux `if` 条件执行
|
||||||
|
|
||||||
|
当你需要对每个文件执行相同操作时,使用 `for` 循环遍历一些文件很有帮助。但是,如果你需要对某些文件做一些不同的事情怎么办?为此,你需要使用 `if` 语句进行条件执行。`if` 语句如下所示:
|
||||||
|
|
||||||
|
```
|
||||||
|
if test
|
||||||
|
then
|
||||||
|
commands
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
你也可以使用 `if/else` 语句进行判断:
|
||||||
|
|
||||||
|
```
|
||||||
|
if test
|
||||||
|
then
|
||||||
|
commands
|
||||||
|
else
|
||||||
|
commands
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
你可以使用 `if/else-if/else` 语句来实现更复杂的程序。当我一次性需要自动处理很多文件时,我会在脚本中使用:
|
||||||
|
|
||||||
|
```
|
||||||
|
if test
|
||||||
|
then
|
||||||
|
commands
|
||||||
|
elif test2
|
||||||
|
then
|
||||||
|
commands
|
||||||
|
elif test3
|
||||||
|
then
|
||||||
|
commands
|
||||||
|
else
|
||||||
|
commands
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
`if` 命令可以让你进行不同的判断,例如判断一个文件是否是一个文件,或者一个文件是否为空文件(零字节)。在命令行中输入 `help test`,可以立即查看使用 `if` 语句能够进行的不同种测试。
|
||||||
|
|
||||||
|
例如,假设我想清理一个包含几十个文件的日志目录。日志管理中的一个常见任务是删除所有空日志,并压缩其他日志。解决这个问题的最简单方法是删除空文件。没有一个 `if` 测试可以完全匹配,但是我们有 `-s` 选项来判断是否是一个文件,并且判断该文件不是空的(大小不为零)。这与我们想要的相反,但我们可以使用 `!` 来否定测试,以判断某些内容不是文件或为空。
|
||||||
|
|
||||||
|
让我们用一个示例来看看这个过程。我创建了两个测试文件:一个是空的,另一个包含一些数据。我们可以使用 `if` 判断,*如果*文件为空打印消息 “empty”:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ls
|
||||||
|
datafile emptyfile
|
||||||
|
$ if [ ! -s datafile ] ; then echo "empty" ; fi
|
||||||
|
$ if [ ! -s emptyfile ] ; then echo "empty" ; fi
|
||||||
|
empty
|
||||||
|
```
|
||||||
|
|
||||||
|
我们可以将 `if` 和 `for` 命令结合起来,检查日志文件列表中的空文件并删除:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ls -l
|
||||||
|
total 20
|
||||||
|
-rw-rw-r--. 1 jhall jhall 2 Jul 1 01:02 log.1
|
||||||
|
-rw-rw-r--. 1 jhall jhall 2 Jul 2 01:02 log.2
|
||||||
|
-rw-rw-r--. 1 jhall jhall 2 Jul 3 01:02 log.3
|
||||||
|
-rw-rw-r--. 1 jhall jhall 0 Jul 4 01:02 log.4
|
||||||
|
-rw-rw-r--. 1 jhall jhall 2 Jul 5 01:02 log.5
|
||||||
|
-rw-rw-r--. 1 jhall jhall 0 Jul 6 01:02 log.6
|
||||||
|
-rw-rw-r--. 1 jhall jhall 2 Jul 7 01:02 log.7
|
||||||
|
$ for f in log.* ; do if [ ! -s $f ] ; then rm -v $f ; fi ; done
|
||||||
|
removed 'log.4'
|
||||||
|
removed 'log.6'
|
||||||
|
$ ls -l
|
||||||
|
total 20
|
||||||
|
-rw-rw-r--. 1 jhall jhall 2 Jul 1 01:02 log.1
|
||||||
|
-rw-rw-r--. 1 jhall jhall 2 Jul 2 01:02 log.2
|
||||||
|
-rw-rw-r--. 1 jhall jhall 2 Jul 3 01:02 log.3
|
||||||
|
-rw-rw-r--. 1 jhall jhall 2 Jul 5 01:02 log.5
|
||||||
|
-rw-rw-r--. 1 jhall jhall 2 Jul 7 01:02 log.7
|
||||||
|
```
|
||||||
|
|
||||||
|
使用 `if` 命令可以在需要时执行一些操作,使脚本变得智能。我经常会在脚本中使用 `if`,当我需要判断文件在我的系统上存在或不存在时,或者判断脚本正在检查的条目是文件或目录时。使用 `if` 使得脚本能够根据需要采取不同的操作。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/22/7/use-bash-automate-tasks-linux
|
||||||
|
|
||||||
|
作者:[Jim Hall][a]
|
||||||
|
选题:[lkxed][b]
|
||||||
|
译者:[Donkey-Hao](https://github.com/Donkey-Hao)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/jim-hall
|
||||||
|
[b]: https://github.com/lkxed
|
||||||
|
[1]: https://opensource.com/sites/default/files/lead-images/bash_command_line.png
|
Loading…
Reference in New Issue
Block a user