id
int64 2.05k
16.6k
| title
stringlengths 5
75
| fromurl
stringlengths 19
185
| date
timestamp[s] | tags
sequencelengths 0
11
| permalink
stringlengths 20
37
| content
stringlengths 342
82.2k
| fromurl_status
int64 200
526
⌀ | status_msg
stringclasses 339
values | from_content
stringlengths 0
229k
⌀ |
---|---|---|---|---|---|---|---|---|---|
14,233 | 使用 DeepSpeech 在你的应用中实现语音转文字 | https://opensource.com/article/22/1/voice-text-mozilla-deepspeech | 2022-02-01T10:21:33 | [
"语音识别"
] | https://linux.cn/article-14233-1.html |
>
> 应用中的语音识别不仅仅是一个有趣的技巧,而且是一个重要的无障碍功能。
>
>
>

计算机的主要功能之一是解析数据。有些数据比其他数据更容易解析,而语音输入仍然是一项进展中的工作。不过,近年来该领域已经有了许多改进,其中之一就是 DeepSpeech,这是 Mozilla 的一个项目,Mozilla 是维护 Firefox 浏览器的基金会。DeepSpeech 是一个语音到文本的命令和库,使其对需要将语音输入转化为文本的用户和希望为其应用提供语音输入的开发者都很有用。
### 安装 DeepSpeech
DeepSpeech 是开源的,使用 Mozilla 公共许可证(MPL)发布。你可以从其 [GitHub](https://github.com/mozilla/DeepSpeech) 页面下载源码。
要安装,首先为 Python 创建一个虚拟环境:
```
$ python3 -m pip install deepspeech --user
```
DeepSpeech 依靠的是机器学习。你可以自己训练它,但最简单的是在刚开始时下载预训练的模型文件。
```
$ mkdir DeepSpeech
$ cd Deepspeech
$ curl -LO \
https://github.com/mozilla/DeepSpeech/releases/download/vX.Y.Z/deepspeech-X.Y.Z-models.pbmm
$ curl -LO \
https://github.com/mozilla/DeepSpeech/releases/download/vX.Y.Z/deepspeech-X.Y.Z-models.scorer
```
### 用户应用
通过 DeepSpeech,你可以将语音的录音转录成书面文字。你可以从在最佳条件下干净录制的语音中得到最好的结果。然而,在紧要关头,你可以尝试任何录音,你可能会得到一些你需要手动转录的东西。
为了测试,你可以录制一个包含简单短语的音频文件:“This is a test. Hello world, this is a test”。将音频保存为一个 `.wav` 文件,名为 `hello-test.wav`。
在你的 DeepSpeech 文件夹中,通过提供模型文件、评分器文件和你的音频启动一个转录:
```
$ deepspeech --model deepspeech*pbmm \
--scorer deepspeech*scorer \
--audio hello-test.wav
```
输出到标准输出(你的终端):
```
this is a test hello world this is a test
```
你可以通过使用 `--json` 选项获得 JSON 格式的输出:
```
$ deepspeech --model deepspeech*pbmm \
-- json
--scorer deepspeech*scorer \
--audio hello-test.wav
```
这就把每个词和时间戳一起渲染出来:
```
{
"transcripts": [
{
"confidence": -42.7990608215332,
"words": [
{
"word": "this",
"start_time": 2.54,
"duration": 0.12
},
{
"word": "is",
"start_time": 2.74,
"duration": 0.1
},
{
"word": "a",
"start_time": 2.94,
"duration": 0.04
},
{
"word": "test",
"start_time": 3.06,
"duration": 0.74
},
[...]
```
### 开发者
DeepSpeech 不仅仅是一个转录预先录制的音频的命令。你也可以用它来实时处理音频流。GitHub 仓库 [DeepSpeech-examples](https://github.com/mozilla/DeepSpeech-examples) 中有 JavaScript、Python、C# 和用于 Android 的 Java 等各种代码。
大部分困难的工作已经完成,所以集成 DeepSpeech 通常只是引用 DeepSpeech 库,并知道如何从主机设备上获得音频(你通常通过 Linux 上的 `/dev` 文件系统或 Android 和其他平台上的 SDK 来完成。)
### 语音识别
作为一个开发者,为你的应用启用语音识别不只是一个有趣的技巧,而是一个重要的无障碍功能,它使你的应用更容易被有行动问题的人、低视力的人和长期多任务处理的人使用。作为用户,DeepSpeech 是一个有用的转录工具,可以将音频文件转换为文本。无论你的使用情况如何,请尝试 DeepSpeech,看看它能为你做什么。
---
via: <https://opensource.com/article/22/1/voice-text-mozilla-deepspeech>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | One of the primary functions of computers is to parse data. Some data is easier to parse than other data, and voice input continues to be a work in progress. There have been many improvements in the area in recent years, though, and one of them is in the form of DeepSpeech, a project by Mozilla, the foundation that maintains the Firefox web browser. DeepSpeech is a voice-to-text command and library, making it useful for users who need to transform voice input into text and developers who want to provide voice input for their applications.
## Install DeepSpeech
DeepSpeech is open source, released under the Mozilla Public License (MPL). You can download the source code from its [GitHub](https://github.com/mozilla/DeepSpeech) page.
To install, first create a virtual environment for Python:
`$ python3 -m pip install deepspeech --user`
DeepSpeech relies on machine learning. You can train it yourself, but it's easiest just to download pre-trained model files when you're just starting.
```
$ mkdir DeepSpeech
$ cd Deepspeech
$ curl -LO \
https://github.com/mozilla/DeepSpeech/releases/download/vX.Y.Z/deepspeech-X.Y.Z-models.pbmm
$ curl -LO \
https://github.com/mozilla/DeepSpeech/releases/download/vX.Y.Z/deepspeech-X.Y.Z-models.scorer
```
## Applications for users
With DeepSpeech, you can transcribe recordings of speech to written text. You get the best results from speech cleanly recorded under optimal conditions. However, in a pinch, you can try any recording, and you'll probably get something you can use as a starting point for manual transcription.
For test purposes, you might record an audio file containing the simple phrase, "This is a test. Hello world, this is a test." Save the audio as a `.wav`
file called `hello-test.wav`
.
In your DeepSpeech folder, launch a transcription by providing the model file, the scorer file, and your audio:
```
$ deepspeech --model deepspeech*pbmm \
--scorer deepspeech*scorer \
--audio hello-test.wav
```
Output is provided to the standard out (your terminal):
`this is a test hello world this is a test`
You can get output in JSON format by using the `--json`
option:
```
$ deepspeech --model deepspeech*pbmm \
-- json
--scorer deepspeech*scorer \
--audio hello-test.wav
```
This renders each word along with a timestamp:
```
{
"transcripts": [
{
"confidence": -42.7990608215332,
"words": [
{
"word": "this",
"start_time": 2.54,
"duration": 0.12
},
{
"word": "is",
"start_time": 2.74,
"duration": 0.1
},
{
"word": "a",
"start_time": 2.94,
"duration": 0.04
},
{
"word": "test",
"start_time": 3.06,
"duration": 0.74
},
[...]
```
## Developers
DeepSpeech isn't just a command to transcribe pre-recorded audio. You can also use it to process audio streams in real time. The GitHub repository [DeepSpeech-examples](https://github.com/mozilla/DeepSpeech-examples) is full of JavaScript, Python, C#, and Java for Android.
Most of the hard work is already done, so integrating DeepSpeech usually is just a matter of referencing the DeepSpeech library and knowing how to obtain the audio from the host device (which you generally do through the `/dev`
filesystem on Linux or an SDK on Android and other platforms.)
## Speech recognition
As a developer, enabling speech recognition for your application isn't just a fun trick but an important accessibility feature that makes your application easier to use by people with mobility issues, low vision, and chronic multi-taskers who like to keep their hands full. As a user, DeepSpeech is a useful transcription tool that can convert audio files into text. Regardless of your use case, try DeepSpeech and see what it can do for you.
## Comments are closed. |
14,235 | 我的一年的 PinePhone 日常使用体验 | https://news.itsfoss.com/pinephone-review/ | 2022-02-02T13:55:00 | [
"手机",
"PinePhone"
] | https://linux.cn/article-14235-1.html |
>
> 它不是每个人的理想选择,但作为一个 Linux 爱好者,我喜欢用它做实验。
>
>
>

当 Pine64 在 2019 年发布 PinePhone 时,没有人能够预见它将对移动 Linux、桌面 Linux 和隐私产生巨大的影响。
作为 [少数专为运行桌面 Linux 而设计的手机](https://itsfoss.com/linux-phones/) 之一,它具有低端安卓手机的所有功能,同时又具有笔记本电脑的多功能性。不幸的是,桌面 Linux 就是这样:它是为台式机设计的,而不是为手机设计的。
幸运的是,由于 GNOME、KDE、Pine64 和众多 Linux 社区的惊人力量,全新的桌面环境、应用程序和发行版应运而生。其中一些比较知名的包括 Plasma Mobile、[Phosh](https://github.com/agx/phosh)、Megapixels 和Mobian。
有了这些所有关键的部分,Pine64 需要做的就是销售 PinePhone,他们确实也卖出了 PinePhone。每一轮社区版(每个都预装了不同的发行版)的预购都收到了数千份订单,其中之一就是我的。
自从我在 2020 年 12 月收到我的设备后,PinePhone 一直是我日常生活中的重要组成部分,我在 2021 年全年都把它作为我的日常设备。以下是我使用它的经验。
### 它的性能就像糖浆一样
PinePhone 采用了全志 a64 系统芯片,它的功率只够完成最基本的手机任务。即使是简单的事情,如打开火狐浏览器,也需要将近 20 秒的时间,这无疑要“归功于”它仅有的 4 个核心。这与现代中高端安卓手机形成鲜明对比,所有这些手机都有至少 2GHz 的 8 核处理器。
幸运的是,社区再次介入,对数以千计的小型软件实施了优化。虽然性能仍然不如安卓系统的竞争对手,但这确实意味着 PinePhone 对于大多数手机任务来说是非常适用了,甚至在通过附带的底座使用外部显示器时,也可以使用一些面向桌面的应用程序。
即使它在这里和那里可能会有一点卡顿,PinePhone 在大多数情况下都有足够的能力。但是电池呢?它真的能续航一整天吗?
### 电池续航……没问题

虽然我很想说,由于 PinePhone 的低功耗组件,电池续航想必是超棒的。但不幸的是,情况并非如此,即使在实施了所有节电改进措施后也是如此。
经过一夜的充电,我通常在早上阅读新闻,然后在午餐时间再读一些。尽管这相当于不到一个小时的屏幕开启时间,但电池仍然持续下降约 35%,使我在下午只剩下 65%。幸运的是,这并不是一个大问题,尤其是调制解调器的深度睡眠功能工作得很好。
补充一句,几乎所有的移动电话都会将其调制解调器放入深度睡眠模式,这基本上是关闭一切除了接收电话和短信所需的功能。然后,当你接到一个电话时,调制解调器会唤醒自己和 SoC,然后开始响铃。
根据我的经验,PinePhone 上深度睡眠的实施绝对很棒,没有错过任何一个电话。因此,考虑到其糟糕的开屏续航时间,PinePhone 的关屏续航相当惊人。我在最少使用的情况下,电池寿命一直能保持在 60 小时以上,这是我的 Galaxy S20 FE 无法比拟的。
### 不要期望有什么漂亮的照片
PinePhone 仅有的 500 万像素后置摄像头和更小的 200 万像素前置摄像头,不要指望能拍出专业级别的照片。甚至许多 USB 网络摄像头也能提供更好的图像质量,以及更多的常规功能。见鬼,PinePhone 的摄像头甚至不能够拍摄视频!
它所做的少量后期处理确实有助于提升一点照片质量,尽管还不足以让它们适合发到社交媒体上。作为比较,这里是用 iPhone 4S(2011 年)和 PinePhone(2019 年)拍摄的同一张照片。
| | |
| --- | --- |
| iPhone 4S | PinePhone |
| iPhone 4S | PinePhone |
在古老的 SoC、普普通通的电池续航和可怜的相机之间,很明显 PinePhone 的硬件绝对不是它的强项。但软件能拯救它吗?
### 桌面环境还是移动环境?
在这个移动 Linux 的世界里,主要有三种桌面环境领域,它们是:
* Plasma Mobile
* Phosh
* [Lomiri](https://lomiri.com/)
在我日常使用 PinePhone 的过程中,我大约花了 4 个月的时间使用每个环境。在这段时间里,我发现它们的功能、问题和成熟度各有不同,我会在这里讨论这些问题。
#### Plasma Mobile

早在 2015 年 Plasma 5 发布之后,Plasma Mobile 已经默默地在后台开发了近 7 年。从最初的发布到 PinePhone 的发布,Plasma Mobile 背后的团队成功地创造了一个相当可用的移动桌面环境。
然而,随着 PinePhone 的发布,这一切都改变了。困扰 Plasma Mobile 的许多错误已经被解决了,而且也在改进用户界面方面付出了巨大的努力。
作为一个 KDE 项目,Plasma Mobile 广泛使用了 Kirigami,这导致了一个极其一致和移动友好的应用生态系统。此外,许多先前就有的 KDE 应用程序也能完美地扩展到该平台。
由于 Maui 项目刚刚发布了他们的 Maui Shell,这个应用生态系统得到了进一步的扩展(更多信息即将发布)。由于他们强大的实用程序套件,Plasma Mobile 是一个真正的安卓替代品。
然而,这并不是说 Plasma Mobile 是完美的。即使到了 2022 年,仍有一些残余的错误和问题。然而,这被其成熟的应用生态系统、对手势的广泛使用和对移动体验的专注所抵消。
#### Phosh

Phosh 主要由 Purism 开发,是相当于 Plasma Mobile 的 GTK。它最初是为 Librem 5 打造的,自 2018 年以来一直在开发。由于只有 4 年的历史,你可能会认为 Phosh 是不成熟的,但这与事实相差甚远。
事实上,在超过 3 个月的时间里,我从未遇到过 Phosh 的崩溃,相比之下,Plasma Mobile 没几天崩溃一次。当然,由于建立在 GTK 和其他 Gnome 技术之上,Phosh 有许多可用的应用程序。一些流行的应用程序可以完美地工作,包括:
* Firefox
* Geary
* Headlines(Reddit 应用程序)
* Megapixels(相机应用)
* Gnome 地图
此外,许多为 Plasma Mobile 设计的应用程序也能完美运行,尽管它们使用 Kirigami。不幸的是,虽然有许多 GTK 应用程序,但它们并不像 Kirigami 应用程序一样适合各种环境,所以开发者必须专门使他们的应用程序与 Phosh 和 PinePhone 兼容。
此外,GTK 主要是一个面向桌面的 UI 工具包,这意味着诸如手势等功能,甚至让应用程序能够适应屏幕的功能,充其量是零散的,最糟糕的是不存在。
不过幸运的是,Purism 在默认的 Gnome 应用程序中投入了大量的工作,这些应用程序都是完全可用的,而且速度很快。
总的来说,Phosh 是非常可靠的,特别是对于台式机和笔记本电脑上的 Gnome 用户。然而,它也因为缺乏核心的移动功能和优化的应用程序而受到阻碍。
#### Lomiri

我怀疑你是否听说过它,因为它最近才改了名字。它以前被称为 Unity 8,是 Ubuntu Touch 操作系统的默认桌面环境。它也可以在 Manjaro ARM 上使用。
由于使用 Qt Quick 构建,它可能是 PinePhone 最成熟的桌面环境。它很好地利用了手势来实现核心系统功能,并且有大量专门为它制作的应用程序。
然而,它的缺点是只能在 Ubuntu Touch 上使用,因为没有一个应用程序被移植到 Manjaro。因此,它的用户受制于 Ubuntu Touch 的“锁定”风格,类似于安卓和 iOS。
虽然这对典型的用户来说可能是件好事,但 PinePhone 的用户一般都是喜欢控制自己设备的手工爱好者,而 Ubuntu Touch 则使其变得更加困难。
### 操作系统
与任何以 Linux 为主的设备一样,它有大量的发行版和操作系统可用。在写这篇文章的时候,Pine64 维基列出了 21 个单独的操作系统,它们的完整度各有不同。
然而,在这些不同的操作系统中,有四个我在 PinePhone 上有很好的体验:
* Manjaro ARM
* Mobian
* SailfishOS
* Ubuntu Touch
虽然我不打算详细介绍它们,但它们都是很好的选择,对于大多数任务来说都是完美的功能。除了 SailfishOS 之外,它们都是开源的,而 SailfishOS 大部分是开源的。
### 关于安卓应用程序的说明
正如你现在可能已经猜到的,应用程序的支持可能有点问题。即使看到 PinePhone 上有近 400 个确认可以使用的应用程序,但与安卓和 iOS 的数百万个应用程序相比,这也是相形见绌。
幸运的是,有一些方法可以解决这个问题,最简单的是使用兼容层来模拟安卓应用。在这方面,Anbox 已经成为几年来的首选。
#### Anbox
如果说 WINE 是 Windows 的兼容层,那么 Anbox 对 Android 也是如此。安装后,或打开它,因为它预装在许多发行版中,就像运行一个命令来安装一个 APK 文件一样简单。
从这里开始,该应用程序的行为就像任何 Linux 应用程序一样,尽管在性能上有很大的影响。
最近,有一群人决定解决这个问题,创建了一个名为 Waydroid 的新项目。
#### Waydroid
Waydroid 是为 PinePhone 开发的安卓模拟器的最新尝试,即使在这个早期阶段,它看起来也非常有发展前景。由于安卓应用可以直接在硬件上运行,它的性能相当惊人,特别是与 Anbox 相比。
因此,许多极为流行的应用程序都能完美运行,如 F-Droid 和 Aurora 商店。
此外,通过 Waydroid 安装的应用程序被很好地整合到 Linux 中,它们能够像其他应用程序一样被打开和关闭。
### 我对 PinePhone 的总体看法
在我使用它的过程中,我花时间使用了几乎所有可用于它的不同操作系统,以及每个桌面环境。正如我之前所说,它的性能一般都很差,尽管 Lomiri 和 Plasma Mobile 足够流畅。
我不经常拍照,所以相机的使用频率很低。然而,当我拍摄照片时,它们通常够用了,即使相片质量并不特别高。
总的来说,我认为 PinePhone 的最大弱点实际上是它的电池续航。这是因为即使只是打开它查看一下时间,也会唤醒调制解调器,导致电池迅速耗尽,除非我尽量不打开它。
幸运的是,我总是确保随身携带一块备用电池,我可以通过取下后盖换入。此外,我还可以插入一张 SD 卡,用作额外的存储空间或测试新的操作系统。
正如预期的,PinePhone 并不防水,但我发现在雨中使用它似乎没有任何损害,尽管你的经历可能有所不同。当我在室内时,我经常发现自己会借助它附带的底座来使用它的外部显示器。
在这种设置下,我对 PinePhone 作为一台笔记本电脑的能力感到惊讶。我经常发现自己可以在 LibreOffice 中编辑文件,甚至有一次还能用 Kdenlive 编辑了一段视频!
总的来说,即使有一些不足,我与 PinePhone 相处的这一年也很顺利,我从来没有发现自己对安卓的渴望。
### 获得 PinePhone
如果你想获得一台 PinePhone,下面有一个按钮,可以带你到 Pine64 的网站。在写这篇文章的时候,有两种型号可供选择,一种是 16GB 的存储空间和 2GB 的内存。另一个型号有 32GB 的存储空间和 3GB 的内存。(LCTT 译注:应该是不向中国发货的。)
本评论中使用的型号是 3GB 版本,价格为 199 美元。2GB 型号的价格为 149 美元。
* [获取 PinePhone](https://pine64.com/product-category/pinephone/)
我们只希望即将推出的 PinePhone Pro 能以其更强大的硬件保持这种积极的趋势!
---
via: <https://news.itsfoss.com/pinephone-review/>
作者:[Jacob Crume](https://news.itsfoss.com/author/jacob/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

When Pine64 announced the PinePhone in 2019, no one could have foreseen the tremendous impact it would have on mobile Linux, desktop Linux, and privacy as a whole.
As one of the [few phones designed specifically to run desktop Linux](https://itsfoss.com/linux-phones/?ref=news.itsfoss.com), it had all the features of a low-end Android phone, combined with the versatility of a laptop. Unfortunately, desktop Linux is just that; it is made for *desktops*, not phones.
Fortunately, thanks to the incredible power of the GNOME, KDE, Pine64, and general Linux communities, whole new desktop environments, applications, and distributions were born. Some of the more recognizable of these include Plasma Mobile, [Phosh](https://github.com/agx/phosh?ref=news.itsfoss.com), Megapixels, and Mobian.
With all the key pieces in place, all Pine64 needed to was to sell PinePhones, and sell PinePhones they did. Every community edition (each preloaded with a different distro) pre-ordering round received thousands of orders, one of which was mine.
Since I received my unit in December 2020, the PinePhone has been a key part in my daily life, with me using it as my daily driver for the whole of 2021. Here are my experiences with it.
## It’s Performance Is Like Molasses
Sporting an Allwinner a64 SoC, the PinePhone has just enough power to do the most basic phone tasks. Even simple things, like opening Firefox, can take almost 20 seconds, no doubt thanks to its measly 4 cores. This is in stark comparison to modern mid-range and high-end Android phones, all of which have 8 core processors running at least at 2 GHz.
Fortunately, the community has again stepped in, implementing thousands of small software optimizations. While still not as performant as it’s Android competitors, this does mean the PinePhone is pretty usable for most phone tasks, and even some desktop-oriented apps when using an external monitor through the included dock.
Despite all of this, the PinePhone is capable enough for most situations, even if it might stutter a bit here and there. But what about the battery? Can it really last all day?
## The Battery Is… Okay

While I would love to be able to say that thanks to the PinePhone’s low-power components, the battery life is incredible. Unfortunately, this is not the case, even after all the battery saving improvements that have been implemented.
After charging it overnight, I usually read the news in the morning, followed by some more at lunchtime. Even though this amounts to less than an hour of screen-on time, the battery still drops about 35% pretty consistently, leaving me with just 65% for the afternoon. Fortunately, this is not a major issue, especially as the modem’s deep sleep function works perfectly.
For those of you that don’t know, almost all mobile phones put their modem into a deep sleep mode, which basically powers off everything except for what is required to receive calls and texts. Then, when you receive a call, the modem wakes up itself and the SoC, which then starts ringing.
From my experience, the implementation of deep sleep on the PinePhone has been absolutely incredible, with not a single call being missed. As a result of this, the PinePhones screen-off battery life has been pretty impressive considering its terrible screen-on time. I’ve consistently managed more than 60 hours of battery life with minimal usage, something I can’t say about my Galaxy S20 FE.
## Don’t Expect Fancy Photos


With a measly 5 MP rear shooter and an even smaller 2 MP front camera, don’t expect to be taking professional-grade photos. Even many USB webcams offer better image quality, as well as more general features. Heck, the PinePhone’s camera isn’t even capable of taking videos!
The small amount of post-processing done does help clean up the photos a bit, although not enough to make them social media-ready. For comparison, here is the same photo taken on an iPhone 4S (from 2011) and the PinePhone (from 2019).
Between the ancient SoC, average battery life, and lackluster cameras, it is clear the PinePhone’s hardware is definitely not it’s forte. But can the software save it?
## Desktop Environment Or Mobile Environment?
Within the world of mobile Linux, there are three major players in the desktop environment space. These are:
- Plasma Mobile
- Phosh
[Lomiri](https://lomiri.com/?ref=news.itsfoss.com)
Over the course of my time daily driving the PinePhone, I spent roughly 4 months with each environment. During this time, I found a number of different features, problems, and levels of matureness between them, which I will be discussing here.
### Plasma Mobile

Released back in 2015 just after Plasma 5, Plasma Mobile has been silently being developed in the background for almost 7 years. Between the time of its initial release and the release of the PinePhone, the team behind Plasma Mobile managed to create a fairly usable mobile desktop environment.
However, with the release of the PinePhone, this has all changed. Many of the numerous bugs that plagued Plasma Mobile have been ironed out, and immense work was put into improving the UI.
As a KDE project, Plasma Mobile makes extensive use of Kirigami, which results in an extremely consistent and mobile-friendly app ecosystem. Additionally, many of the pre-existing KDE apps also scale perfectly to it.
This app ecosystem is extended even further thanks to the Maui project, which just released their Maui Shell (more on that soon). Thanks to their powerful suite of utility apps, Plasma Mobile is a true Android replacement.
However, that’s not to say that Plasma Mobile is perfect. Even in 2022, there are still a number of remaining bugs and issues. However, this is offset by its mature app ecosystem, extensive use of gestures, and purely mobile focus.
### Phosh

Phosh, developed primarily by Purism, is the GTK equivalent of Plasma Mobile. Originally built for the Librem 5, it has been in the works since 2018. At just 4 years old, you may be led to believe that Phosh is immature, but that couldn’t be further from the truth.
In fact, I never encountered a single crash with Phosh for more than 3 months, compared to days between crashes in Plasma Mobile. Of course, being built on GTK and other Gnome technologies, Phosh has a number of apps available. Some popular apps that work perfectly include:
- Firefox
- Geary
- Headlines (Reddit app)
- Megapixels (Camera app)
- Gnome Maps
Additionally, many apps designed for Plasma Mobile also work perfectly, even though they use Kirigami. Unfortunately, while many GTK apps are available, they don’t scale anywhere near as well as Kirigami apps do, so developers have to specifically make their apps compatible with Phosh and the PinePhone.
Additionally, GTK is a primarily desktop-oriented UI toolkit, meaning features such as gestures, and even apps being able to fit on the screen are patchy at best, and non-existent at worst.
Fortunately, though, Purism has put a lot of work into the default Gnome apps, which are all perfectly usable and fast.
Overall, Phosh is extremely solid, especially for users of Gnome on desktop and laptop computers. However, it is also held back by its lack of core mobile features, and optimized apps.
### Lomiri

I doubt you will have heard of this, as it only recently had its name changed. Formerly known as Unity 8, it is the default desktop environment of the Ubuntu Touch operating system. It is also available on Manjaro ARM.
Built using Qt Quick, it is probably the most mature desktop environment for the PinePhone. It makes great use of gestures for core system functions, and has a huge range of apps made specifically for it.
However, it also suffers from being only usable on Ubuntu Touch, as none of the apps have been ported to Manjaro. As a result, users of it are subject to Ubuntu Touch’s “locked-down” style, similar to Android and iOS.
While this might be a good thing for typical users, PinePhone owners are generally tinkerers who like control over their device, which is made much harder with Ubuntu Touch.
## Operating Systems
As with any Linux-focused device, there are a huge number of distros and operating systems available. At the time of writing, the Pine64 wiki lists 21 individual operating systems, all in various levels of completeness.
However, amongst these various operating systems, there are 4 that I have had a great experience with on the PinePhone:
- Manjaro ARM
- Mobian
- SailfishOS
- Ubuntu Touch
While I’m not going to go into detail about each of them, they’re all great choices and perfectly functional for most tasks. With the exception of SailfishOS, they are all also open-source, while SailfishOS is mostly open-source.
## A Note On Android Apps
As you may have guessed by now, app support can be a bit of a problem. Even looking at the almost 400 confirmed working apps on the PinePhone, this pales in comparison to the millions available for Android and iOS.
Fortunately, there are ways around this, the easiest being to emulate Android apps using a compatibility layer. For this, Anbox has been the go-to for a few years now.
### Anbox
If WINE is a compatibility layer for Windows, then Anbox is the same for Android. After installing it, or opening it as it comes preinstalled with many distributions, it is as simple as running a single command to install an APK file.
From here, the app behave just as any Linux app, albeit with a significant hit to performance.
Recently, a group of people decided they were going to address this, creating a new project called Waydroid.
### Waydroid
Waydroid is the latest attempt at an Android emulator for the PinePhone, and even at this early stage it looks extremely promising. It manages pretty incredible performance, especially compared to Anbox, thanks to the android apps running directly on the hardware.
As a result, many extremely popular apps work perfectly, such as F-Droid and the Aurora Store.
Additionally, apps installed through Waydroid are integrated really well into Linux, with them being able to be opened and closed just like any other app.
## My Concluding Thoughts On The PinePhone
Over the course of my time with it, I spent time with almost all the different operating systems available for it, as well as every desktop environment. As I said before, its performance was generally quite poor, although Lomiri and Plasma Mobile were smooth enough.
I don’t take photos that often, so the camera got very little use. However, when I did take photos, they were generally good enough, even if they weren’t particularly high quality.
In general, I think the biggest weakness of the PinePhone was actually it’s battery life. This is because even just turning it on to check the time wakes up the modem, causing the battery to drain quickly unless I made an effort not to turn it on.
Fortunately, I always made sure to carry a spare battery with me that I could pop in by removing the back cover. Here, I could also insert an SD card to be used as additional storage or to test a new OS.
As to be expected, the PinePhone is not waterproof, but I did find that using it in the rain appeared to do no damage, although your mileage may vary. When I was inside, I often found myself using it with an external monitor using it’s included dock.
With this setup, I was surprised at how capable the PinePhone was as a laptop. I often found myself editing documents in LibreOffice, and at one point even managed to edit a video using Kdenlive!
Overall, even with its quirks, my year with the PinePhone went quite well, and I never really found my self longing for my Android.
## Getting A PinePhone
If you want to get a PinePhone for yourself, there is a button below that will take you to Pine64’s website. At the time of writing, there are two models available, one with 16 GB of storage and 2 GB of RAM. The other model has 32 GB of storage and 3 GB of RAM.
The model used in this review was the 3 GB version, which costs $199 USD. The 2 GB model costs $149 USD.
Let’s just hope that the upcoming PinePhone Pro can keep this positive trend up with its more powerful hardware!
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,237 | 最漂亮的 Linux 发行版之一 Nitrux 2.0 发布 | https://news.itsfoss.com/nitrux-2-0-release/ | 2022-02-03T13:47:19 | [
"Nitrux"
] | https://linux.cn/article-14237-1.html |
>
> Nitrux 2.0.0 是一个令人兴奋的版本,它默认采用 XanMod 内核,并 带来了其他各种视觉和技术改进。
>
>
>

Nitrux Linux 轻松成为了 [最漂亮的 Linux 发行版](https://itsfoss.com/beautiful-linux-distributions/) 之一。
上个月,我们点评了 [Maui Shell](https://news.itsfoss.com/maui-shell-unveiled/),它也是由 Nitrux Linux 背后的团队所设计的。现在,Nitrux 2.0.0 已经发布,并带来了一些令人兴奋的变化。
让我在这里重点介绍一下基本变化。
### Nitrux 2.0.0 有什么新东西?
这次升级包括一个新的 Linux 内核、更新的应用程序、桌面环境、固件改进,以及大大减小了 ISO 的大小。
你还会注意到布局和顶部面板等几处细微视觉变化。
### XanMod 内核 5.16.3

XanMod 内核是为新一代硬件量身定做的,以获得尽可能好的桌面体验。
与许多其他 Linux 发行版中自带的 Linux 内核相比,你会发现它有一些自定义设置和新功能,可以提高你的使用体验。
在 Nitrux 2.0.0 中,默认选择了 XanMod 内核 5.16.3。当然你仍然可以选择最新的主线 LTS 或非 LTS(5.15.17、5.16.3)Linux 内核。
别忘了,如果你需要,你还可以安装 Liquorix 和 Libre 内核。
### 更新布局和面板的变化
顶部面板现在显示了窗口控制、标题、全局菜单和系统托盘区。
布局仍然与以前的版本相似,但有一些位置的调整,比如将应用程序菜单添加到<ruby> 基座 <rt> dock </rt></ruby>中,应用程序菜单是 Launchpad Plasma(感谢 [adhe](https://www.pling.com/u/adhe/))。

此外,你应会发现窗口装饰有了改进,所有窗口现在默认都是无边框的。你可以在外观设置下的窗口装饰选项中选择禁用无边框窗口模式。
可选的 Latte 布局也得到了更新,包括窗口控制、标题栏和全局菜单。
### 更新的软件包和驱动程序
出于显而易见的原因,这次升级包括 KDE Plasma 版本更新、KDE 框架、KDE 装备,以及其他必要的应用程序,如 Firefox 和 LibreOffice。
此外,为 AMD GPU 增加了内核软件包中没有的额外固件。他们还在可下载的 ISO 中增加了 i915、Nouveau 和 AMDGPU 驱动。
默认使用的是 MESA 21.3.5 稳定版,但如果你需要的话,可以安装最新的 MESA 22.0。
### 其他改进
在 Nitrux Linux 的这些变化之外,还有一些额外的技术改进,如:
* 减少了标准版和精简版的 ISO 文件大小。
* Xbox One 控制器的工作原理与操纵杆没有冲突。
* 在精简版 ISO 中,JWM 取代了 i3 窗口管理器。
更多细节,你可以参考 [官方公告](https://nxos.org/changelog/release-announcement-nitrux-2-0-0/#download)。
---
via: <https://news.itsfoss.com/nitrux-2-0-release/>
作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Nitrux Linux is easily one of the [most beautiful Linux distributions](https://itsfoss.com/beautiful-linux-distributions/?ref=news.itsfoss.com) out there.
Last month, we also looked at [Maui Shell](https://news.itsfoss.com/maui-shell-unveiled/), by the same team behind Nitrux Linux. And, now, Nitrux 2.0.0 has been released with some exciting changes.
Let me highlight the fundamental changes here.
## Nitrux 2.0.0: What’s New?
The upgrade includes a new Linux Kernel, updated applications, desktop environment, firmware improvements, and ISO size reduction.
You will also notice several subtle visual changes to the layouts and the top panel.
## XanMod Kernel 5.16.3

XanMod Kernel is tailored for new-gen hardware to get the best possible desktop experience.
Compared to the stock Linux Kernel found in many other Linux distributions, you will find some custom settings and new features enabled to enhance your experience with it.
With Nitrux 2.0.0, XanMod Kernel 5.16.3 has been made the default choice. You still get to select the latest mainline LTS or non-LTS (5.15.17, 5.16.3) Linux Kernel as well.
Not to forget, you also get the ability to install Liquorix and Libre kernels if you need those.
## Updated Layouts and Changes to Panels
The top panel now shows window controls, title, global menu and houses the system tray.
The layout remains similar to previous iterations, but there are a few position adjustments, like adding the application menu to the dock, the application menu being the Launchpad Plasma (thanks to [adhe](https://www.pling.com/u/adhe/?ref=news.itsfoss.com)).

Moreover, you should find improvements in the window decorations, considering everything is borderless by default. You do get the choice to disable the borderless windows mode from the Window Decorations option under the appearance settings.
The optional Latte layouts have also received updates to include the window controls, title bar, and the global menu.
## Updated Packages and Drivers
For obvious reasons, this upgrade includes KDE Plasma version updates, KDE Frameworks, KDE Gear, among other essential applications like Firefox and LibreOffice.
Additional firmware has been added for AMD GPUs not available in the kernel packages. They have also added i915, Nouveau, and AMDGPU drivers in the ISO available to download.
MESA 21.3.5 stable is available by default, but you can install the latest MESA 22.0 if you need it.
## Other Improvements
Along with all the changes to Nitrux Linux, there are also some additional technical improvements like:
- Reduced ISO file size for both the standard and minimal edition.
- Xbox One controller works without conflicts with joysticks.
- i3 window manager has been replaced by JWM in the minimal ISO.
For more details, you can refer to the [official announcement post](https://nxos.org/changelog/release-announcement-nitrux-2-0-0/?ref=news.itsfoss.com#download).
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,238 | 2021 总结:10 个值得尝试的 DIY 物联网项目 | https://opensource.com/article/22/1/open-source-internet-of-things | 2022-02-03T14:15:58 | [
"IoT"
] | /article-14238-1.html |
>
> 在 2021 年,我们的作者们多次分享了他们关于各种物联网项目的专业知识。
>
>
>

物联网(IoT)是计算领域的一个令人着迷的发展方向。互联智能设备、家庭自动化以及相关的发展领域正在产生许多有趣的项目。在 2021 年,我们的作者们多次分享了他们关于各种物联网项目的专业知识。以下是十大最佳物联网文章。
### 如何使用你选择的声音定制你的语音助手
在这篇由 Rich Lucente 撰写的这篇文章中 [了解 Nana and Poppy 项目](https://opensource.com/article/21/1/customize-voice-assistant)。Nana and Poppy 项目是 Rich Lucente 为人工智能语音助手创建自定义问候的开源项目。他描述了整个过程,从录制必要的音频片段到编写代码将这些片段组合成完整的问候语。成品是五个送给曾祖父母和祖父母的定制语音助手,他们现在无论何时与语音助手互动都能听到孙辈的声音。
### 用树莓派和 Prometheus 监测你家的温湿度
Chris Collins 描述了他如何 [利用 Prometheus 监测家中的温度和湿度](https://opensource.com/article/21/7/home-temperature-raspberry-pi-prometheus)。他提供了关于在树莓派操作系统上安装 Prometheus、检测 Prometheus 应用程序、设置 systemd 单元和日志记录等方面的详细说明,以创建用于监控温度和湿度数据的工具。本文建立在 Chris 以前写的一篇文章的基础上,这篇文章是这个系列的下一篇文章。
### 用树莓派在家里设置温度传感器
学习如何通过使用树莓派、DHT22 数字传感器和一些 Python 代码 [设置温度传感器](https://opensource.com/article/21/7/temperature-sensors-pi)。在本文中,Chris Collins 解释了如何将传感器连接到树莓派,安装 DHT 传感器软件,并使用 Python 脚本获取传感器数据。他最后调侃说,未来的文章将更多地自动化从该设备收集数据,这是本列表中的前一篇文章。
### 用智能手机远程控制你的树莓派
Stephan Avenwede 解释了如何 [使用你的智能手机来控制树莓派的 GPIO](https://opensource.com/article/21/9/raspberry-pi-remote-control)。本教程描述了如何安装和使用 Pythonic 来使用 Telegram 通过网络连接控制树莓派。在写这篇文章时,他并没有考虑到具体的最终项目,因此本文提供了广泛的指导,你可以将其应用于许多项目。Stephan 建议的一些可能的项目包括草坪灌溉和车库开门器。
### 家庭自动化项目为什么选择开源
Alan Smithee 在本文中 [介绍了家庭自动化电子书](https://opensource.com/article/21/6/home-automation-ebook)。这本电子书包含了与家庭自动化相关的内容。Alan 的文章概述了为什么技术能让每个人的生活变得更好,并提供了一个下载电子书的链接。
### 用 Grafana Cloud 监控你的树莓派
在 Matthew Helmke 的这篇教程中,了解如何 [用 Grafana Cloud 监控你的树莓派](https://opensource.com/article/21/3/raspberry-pi-grafana-cloud)。该项目使用树莓派、Prometheus 时间序列数据库和 Grafana Cloud 帐户。Matthew 解释了如何在树莓派上安装 Prometheus,并将其连接到 Grafana Cloud,为你的树莓派提供监控。
### 一种新的嵌入式开源操作系统
Zhu Tianlong 提供了 [RT-Thread 智能操作系统简介](https://opensource.com/article/21/7/rt-thread-smart)。本文解释了什么是 RT-Thread Smart,谁可能需要使用它,以及它是如何工作的。本文中还有一个章节对 RT-Thread Smart 和 RT Thread 进行了对比。
### 使用 Rust 进行嵌入式开发
本文由 Alan Smithee 撰写,Liu Kang 供稿,介绍了 [使用 Rust 进行嵌入式开发](https://opensource.com/article/21/10/rust-embedded-development)。这个包含大量代码的教程展示了如何在 C 中调用 Rust,以及如何在 Rust 中调用 C。这里有大量使用 Rust 工具(如 Cargo)进行开发的代码示例和详细说明。
### 开源 Linux 边缘开发入门
Daniel Oh 解释了如何使用 Quarkus 云原生 Java 框架来 [开始边缘开发](https://opensource.com/article/21/5/edge-quarkus-linux)。Daniel 首先简要介绍了他在教程中使用的操作系统 CentOS Stream。然后他介绍了教程的三个主要步骤:
* 将物联网数据发送到轻量级消息代理。
* 使用 Quarkus 处理反应性数据流。
* 监控实时数据通道。
### 什么是雾计算?
你可能听说过云计算,但是 [什么是雾计算](https://opensource.com/article/21/5/fog-computing)?Seth Kenlon 将<ruby> 雾计算 <rt> fog computing </rt></ruby>描述为“云的外部‘边缘’”——由手机、手表和其他组成物联网的各种设备组成。
---
via: <https://opensource.com/article/22/1/open-source-internet-of-things>
作者:[Joshua Allen Holm](https://opensource.com/users/holmja) 选题:[lujun9972](https://github.com/lujun9972) 译者:[CN-QUAN](https://github.com/CN-QUAN) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | HTTPSConnectionPool(host='opensource.com', port=443): Read timed out. (read timeout=10) | null |
14,240 | Zorin OS 16 教育版:一个让学习更容易的 Linux 发行版 | https://news.itsfoss.com/zorin-os-16-education-release/ | 2022-02-04T10:39:24 | [
"ZorinOS"
] | https://linux.cn/article-14240-1.html |
>
> Zorin OS 16 教育版的重点是离线学习和新的教育应用程序,为学校和学生提供帮助。
>
>
>

Zorin OS 16 是 2021 年最令人印象深刻的发行版之一。你或许想先了解一下 [Zorin OS 16](https://news.itsfoss.com/zorin-os-16-features/) 和 [Zorin OS 16 精简版](https://news.itsfoss.com/zorin-os-16-lite-release/) 的信息。
现在,经过一段时间,Zorin OS 团队终于决定发布 Zorin OS 16 教育版。
可以预期包含 Zorin OS 16 的所有改进,以及为教育而量身定做的具体修改。
请注意,教育版的 Zorin OS 16 是完全免费下载的。对于旧电脑,你还可以使用精简教育版。
### Zorin OS 16 教育版有什么新内容?
Zorin OS 16 教育版的重点是以离线为先的学习体验。换句话说,它包括一个合格的教育内容集,不需要上网就可以访问。
为了实现这一目标,Zorin OS 16 包括了 [Kolibri](https://learningequality.org/kolibri/),这是一个自由开源的教育解决方案,支持自定进度的学习,并通过本地 Wi-Fi 网络进行同步/共享。
因此,即使没有互联网,你也可以依靠点对点的连接来分享教育内容,进行协作,并继续学习,不受任何干扰。
学校管理者还可以创建自己的课程,并从可汗学院、Open Stax、麻省理工学院等来源下载现成的资源。
当然,管理员需要互联网接入才能做到这一点。但是,一旦你下载了内容,就可以在没有互联网接入的情况下轻松地在本地网络上分享,从而使分发教育内容成为可能。
除了 Kolibri 之外,Zorin OS 16 还出炉了新的教育应用程序,其中一些是:
#### Minder:将想法和笔记可视化

与 [Obsidian](https://itsfoss.com/obsidian-markdown-editor/) 和 [Logseq](https://itsfoss.com/logseq/) 类似,Minder 是一个更简单有效的思维导图工具,帮助你将笔记和想法可视化,而进行头脑风暴会议。
#### Foliate:电子书阅读器

[Foliate](https://itsfoss.com/foliate-ebook-viewer/) 是一个令人印象深刻的 Linux 电子书阅读器应用。它应该能让学生/教师提高阅读体验,也能在需要时提供公共领域书籍的下载。
#### OpenBoard:交互式白板

我最近报道了 [OpenBoard](/article-14212-1.html),作为我们的应用亮点之一。它是一个自由开源的白板,应该会让老师和学生也感到有趣。
OpenBoard 应该有助于通过工具以及应用程序与多媒体内容互动的能力来改善学习过程。
#### Minuet:音乐教学
Minuet 专注于帮助你向学生教授音乐。你会发现视觉队列,以及和弦、音阶等方面的练耳练习。
#### 其他改进措施
根据你的系统配置,可以选择 Zorin OS 16 教育版或 Zorin OS 16 精简教育版。
这两个教育版应该会带来更快、更漂亮的桌面体验,可以访问更多的应用程序。
Zorin OS 16 教育版支持到 2025 年 4 月。
你可以从其官方网站下载 Zorin OS 16 教育版及其精简版。
* [Zorin OS 16 教育版](https://zorin.com/os/education/)
---
via: <https://news.itsfoss.com/zorin-os-16-education-release/>
作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Zorin OS 16 was one of the most impressive distro releases in 2021. You might want to learn more about [Zorin OS 16](https://news.itsfoss.com/zorin-os-16-features/) and [Zorin OS 16 lite](https://news.itsfoss.com/zorin-os-16-lite-release/), if you are curious.
Now, after a while, the Zorin OS team finally decided to release the Education edition of Zorin OS 16.
You should expect all the improvements to Zorin OS 16 along with specific modifications to tailor it for education.
Note that the Education edition of Zorin OS 16 is completely free to download. You get a separate Lite version for older computers as well.
## Zorin OS 16 Education: What’s New?
Zorin OS 16 Education focuses on an offline-first learning experience. In other words, it includes a decent collection of educational content that can be accessed without needing internet access.
To achieve this, Zorin OS 16 includes “[Kolibri](https://learningequality.org/kolibri/?ref=news.itsfoss.com)“, which is a free and open-source education solution that supports self-paced learning, and sync/sharing over local Wi-Fi networks.
So, even without internet, you can rely on peer-to-peer connections to share educational content, collaborate, and continue learning without any interruptions.
School administrators can also create their own curriculum and download ready-made resources from sources like Khan Academy, Open Stax, MIT, and more.
Of course, the administrator will need internet access to do this. But, once you download the content, it can be easily shared over the local network without internet access, making it possible to distribute educational content.
In addition to Kolibri, Zorin OS 16 also comes baked with new educational apps, some of them are:
### Minder: Visualize Concepts and Notes

Similar to [Obsidian](https://itsfoss.com/obsidian-markdown-editor/?ref=news.itsfoss.com) and [Logseq](https://itsfoss.com/logseq/?ref=news.itsfoss.com), Minder is a simpler and effective mind mapping tool to help you visualize your notes and ideas to facilitate brainstorming sessions.
### Foliate: eBook Viewer

[Foliate](https://itsfoss.com/foliate-ebook-viewer/?ref=news.itsfoss.com) is an impressive e-book reader app for Linux. It should enable students/teachers to enhance the reading experience, and also gives access to public domain books for download, when needed.
### OpenBoard: Interactive Whiteboard

I’ve recently covered [OpenBoard](https://itsfoss.com/openboard/?ref=news.itsfoss.com) as one of our app highlights. It is a free and open-source whiteboard that should make things interesting for teachers and students as well.
OpenBoard should help improve the learning process through the tools, and the capabilities of the app to interact with multimedia content.
### Minuet: Teaching Music
Minuet focuses on helping you teach music to your students. You will find visual queues, and ear training exercises on chords, scales, and more.
### Other Improvements
As per your system configuration, you can opt for Zorin OS 16 Education or Zorin OS 16 Education Lite.
Both the Education editions should result in a faster, and good-looking desktop experience with access to more applications.
The Zorin OS 16 Education is supported until April 2025.
You can download Zorin OS 16 Education and the Lite edition from its official website.
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,241 | 陷入困境的 15 岁少年:Windows Vista | https://www.theregister.com/2022/02/01/happy_birthday_windows_vista/ | 2022-02-04T16:56:39 | [
"Windows",
"Vista"
] | https://linux.cn/article-14241-1.html |
>
> 这并不是微软所承诺的……但也不全是坏事。
>
>
>

2007 年 1 月 30 日,也就是 15 年前,[一再](https://www.theregister.com/2006/03/22/microsoft_vista_delayed/)[延期](https://www.theregister.com/2005/08/30/windows_vista_release/)的 Windows Vista 发布了。
我们可以尽情地谈论 Vista [有多糟糕](https://www.youtube.com/watch?v=-IfnjBHtjHc)、人们有多讨厌它。它是有史以来最不受欢迎的版本之一,与 Windows ME 一样。但是,你今天运行的随便哪个现代 Windows,它都是 Vista 的后裔。
Vista 并没有微软像 [2000 年承诺](https://www.theregister.com/2000/11/12/whistler_and_blackcomb_the_windows/)的那样,Windows “Whistler” 将合并 Windows 9x 和 Windows NT:这变成了 XP,每个人都记得 XP —— 基本上都是怀念。Windows Blackcomb 是 XP 的[计划中的继任者](https://www.theregister.com/2001/07/27/microsoft_reshuffles_windows_roadmap_full/)。它从未面世。我们得到的是 [Windows Longhorn](https://www.theregister.com/2001/10/24/gates_confirms_windows_longhorn/)。
Blackcomb [将有](https://www.theregister.com/2001/08/07/ms_poised_to_switch_windows/)一个新的编程模型、一个新的用户界面,以及一个新的数据库驱动的存储引擎,“WinFS”……但它被[延期](https://www.theregister.com/2003/05/13/microsoft_sidelines_longhorn_database_caper/)了,然后被[删除](https://www.theregister.com/2004/08/27/microsoft_decouples_longhorn/),最后被[取消](https://www.theregister.com/2006/06/26/winfs_axed/)。
谈论 Vista 到底是什么更有意思。摆上货架的是技术上[更保守的东西](https://www.theregister.com/2003/03/05/windows_longhorn_leaks_again)。
它有用户访问控制(UAC):那些恼人的弹出式信息不断要求获得你的许可。(这实际上是微软意识到大部分的 Windows 机器都是独立的,没有连接到域。)
它有一个 3D 合成的用户界面,“Aero”,带有透明效果,尽管这确实使它[变得有点慢](https://www.theregister.com/2007/12/04/vista_vs_xp_tests/)。而当 Windows 7 推出时,人们很喜欢它 —— 所以微软将它从 Windows 8 中[剥离](https://www.theregister.com/2012/05/21/windows_8_aero_dead/)了。(指的是外观,而不是合成过程;那仍然存在)。
它有一个包含“小部件”的侧边栏,这在 Windows 11 中[又出现了](https://www.theregister.com/2021/10/05/windows_11_in_detail/)。
尽管它在五年前就[被干掉了](https://www.theregister.com/2017/04/12/windows_vista_support_ends/),但 Vista 是 Windows 7 的基础。Vista 是 NT 的第 6 版;而 Windows 7 则是 [Windows NT 6.1](https://www.theregister.com/2009/11/18/windows_7_heart/)。
Windows 7 是经过调整的 Vista,响应速度更快。Windows 8 则是 Vista 2:是 Vista 的[平板电脑版](https://www.theregister.com/2011/06/06/windows_tablets_without_silverlight_dot_net/)(它实际上[相当不错](https://www.theregister.com/2011/09/14/samsung_windows8_tablet/))。
困难在于,人们已经习惯了台式机和鼠标,所以开始按钮又被[迅速恢复](https://www.theregister.com/2013/10/18/windows_8_1_review/)了。Windows 8.1 则是 Vista 2.1。
Windows 10 是 Vista 3,[~~Metro~~ 现代应用程序](https://www.theregister.com/2012/03/15/the_charge_of_the_metro_brigade/)被搁置,桌面应用程序再次成为中心。现在,Windows 11 删除了所有那些讨厌的、复杂的、混乱的东西,如垂直侧边栏。
Vista 是微软放弃其花哨的技术野心而[开始简化事物](https://www.theregister.com/2009/11/18/windows_7_heart/)的时候。现在[有远见的人](https://www.theregister.com/2012/11/13/sinofsky_caligula/)已经离开了。Surface 并没有彻底改变这个行业,它只是疏远了 OEM 厂商。
15 年过去了,微软仍在对 Vista 进行迭代。
---
via: <https://www.theregister.com/2022/02/01/happy_birthday_windows_vista/>
作者:[Liam Proven in Prague](https://www.theregister.com/Author/Liam-Proven) 选题:[wxy](https://github.com/wxy) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](/article-14240-1.html) 荣誉推出
| 200 | OK | This article is more than **1 year old**
# Happy birthday, Windows Vista: Troubled teen hits 15
## It wasn't what Microsoft promised... but it wasn't all bad either
On January 30 2007, 15 years ago this week, the [delayed](https://www.theregister.com/2005/08/30/windows_vista_release/) and [delayed again](https://www.theregister.com/2006/03/22/microsoft_vista_delayed/) Windows Vista was released.
We could have fun talking about [how bad Vista was](https://www.youtube.com/watch?v=-IfnjBHtjHc), and how much people hated it. It's one of the most unpopular releases ever, along with Windows ME. But if you run a vaguely modern Windows today, you're running a descendant of Vista.
Vista *wasn't* what Microsoft [promised in 2000](https://www.theregister.com/2000/11/12/whistler_and_blackcomb_the_windows/). Windows "Whistler" was going to merge Windows 9x and Windows NT: that became XP, and everyone remembers XP – mostly, fondly. Windows Blackcomb was [XP's planned successor](https://www.theregister.com/2001/07/27/microsoft_reshuffles_windows_roadmap_full/). It never happened. We got [Windows Longhorn](https://www.theregister.com/2001/10/24/gates_confirms_windows_longhorn/) instead.
Blackcomb was [going to have](https://www.theregister.com/2001/08/07/ms_poised_to_switch_windows/) a new programming model, a new UI, and a new database-driven storage engine, "WinFS"… but this [got postponed](https://www.theregister.com/2003/05/13/microsoft_sidelines_longhorn_database_caper/), then [removed](https://www.theregister.com/2004/08/27/microsoft_decouples_longhorn/), and [then cancelled](https://www.theregister.com/2006/06/26/winfs_axed/).
It's more interesting to talk about what Vista really was. What shipped was something technologically [much more conservative](https://www.theregister.com/2003/03/05/windows_longhorn_leaks_again).
It had User Access Control: those irritating pop-up messages constantly asking for permission. (That was really Microsoft realising that the bulk of Windows boxes would be standalone, not connected to a domain.)
It had a 3D-composited UI, "Aero", complete with transparency effects, although that did [make it a bit slower](https://www.theregister.com/2007/12/04/vista_vs_xp_tests/). By the time Windows 7 rolled around, people loved it – so Microsoft [ripped it out of Windows 8](https://www.theregister.com/2012/05/21/windows_8_aero_dead/). (The look, not the compositing; that's still there.)
It had a sidebar containing "widgets", which [are back in Windows 11](https://www.theregister.com/2021/10/05/windows_11_in_detail/).
Although it was [killed off five years ago](https://www.theregister.com/2017/04/12/windows_vista_support_ends/), Vista was the basis for Windows 7. Vista was NT version 6; Windows 7, under the covers, [was Windows NT 6.1](https://www.theregister.com/2009/11/18/windows_7_heart/).
Windows 7 was Vista tuned to be more responsive. Windows 8 was Vista 2: the flat-look [tablet version of Vista](https://www.theregister.com/2011/06/06/windows_tablets_without_silverlight_dot_net/) (which it was [actually quite good](https://www.theregister.com/2011/09/14/samsung_windows8_tablet/)).
['Dated and cheesy' Aero ripped from Windows 8](https://www.theregister.com/2012/05/21/windows_8_aero_dead/)[Windows Longhorn leaks again](https://www.theregister.com/2003/03/05/windows_longhorn_leaks_again/)[Hasta la Windows Vista, baby! It's now officially dead – good riddance](https://www.theregister.com/2017/04/12/windows_vista_support_ends/)[Charge of the Metro brigade: Did Microsoft execs plan to take a hit?](https://www.theregister.com/2012/03/15/the_charge_of_the_metro_brigade/)
The snag being that people were used to desktops and mice, so the start button [was reinstated sharpish](https://www.theregister.com/2013/10/18/windows_8_1_review/). Windows 8.1 was Vista 2.1.
Windows 10 is Vista 3, with [ metro modern apps](https://www.theregister.com/2012/03/15/the_charge_of_the_metro_brigade/) sidelined and desktop apps front-and-centre again. Now, Windows 11 removes all those nasty complex confusing things like vertical sidebars.
Vista is when Microsoft dropped its fancy technological ambitions and started [simplifying things instead](https://www.theregister.com/2009/11/18/windows_7_heart/). Now the [visionaries have departed](https://www.theregister.com/2012/11/13/sinofsky_caligula/). The Surface didn't revolutionise the industry, it just alienated the OEMs.
Fifteen years on, Microsoft is still iterating upon Vista. ®
101 |
14,243 | 最古老的活跃 Linux 发行版 Slackware 终于发布了第 15 版 | https://news.itsfoss.com/slackware-15-release/ | 2022-02-05T13:17:49 | [
"Slackware"
] | https://linux.cn/article-14243-1.html |
>
> 带着 Linux 内核 5.15 LTS 和 KDE Plasma 5.23 的最新改进,Slackware 15.0 已经来到。
>
>
>

欢呼吧!Linux 粉丝们会很高兴地知道,传奇发行版 Slackware 在很久之后发布了一个新版本。或许你不知道,Slackware 上一个版本的发布要追溯到 2016 年。
当开发者在去年(2021 年)2 月宣布 Slackware 15.0 的计划时,整个 Linux 社区都为此感到兴奋。
从年初的 Alpha 版本开始,在过去的一年里,开发人员在 Slackware Linux 15.0 的开发中取得了快速进展。经过一段时间后,他们发布了其最后一个候选版本,但现在它发布了!
让我们来看看 Slackware 15.0 有哪些新内容。
### Slackware 15.0 的新内容

如前所述,Slackware 15.0 有许多变化。不要忘了,在最终发布之前,它可是发布了一个测试版和两个候选发布版(RC)。
如果你一直在关注我们的报道,早在去年 4 月份你就可能已经看到了我们的 [测试版](https://news.itsfoss.com/slackware-15-beta-release/) 报道。
在测试版 / RC 版中,还有一些东西没有被披露。因此,在这里,我们会介绍它的所有重要内容。
#### Linux 内核 5.15 LTS
Slackware 15 的主要亮点是增加了最新的 [Linux 内核 5.15 LTS](https://news.itsfoss.com/linux-kernel-5-15-release/)。这与我们在测试版中注意到的 Linux 内核 5.10 LTS 相比,有了很大的飞跃。

值得注意的是,Slackware 团队在确定使用 Linux 内核 5.15.19 之前测试了数百个 Linux 内核版本。在发布说明中提到:
>
> 在最终宣布 Slackware 15.0 稳定版的过程中,我们在过去一年里实际上构建了超过 400 个不同的 Linux 内核版本(相比之下,我们在开发 Slackware 14.2 时测试了 34 个内核版本)。在 Greg Kroah-Hartman 确认 5.15.19 版内核将获得至少到 2023 年 10 月(很可能比这更久)的长期支持后,我们最终选择了它。
>
>
>
如果你感到好奇,Linux 内核 5.15 带来了一些更新,如增强的 NTFS 驱动支持和对英特尔 / AMD 处理器以及苹果 M1 芯片的改进。它还增加了对英特尔第 12 代处理器的初步支持。
总的来说,有了 Linux 内核 5.15 LTS,对于这个最古老的活跃 Linux 发行版,你应该会得到良好的硬件兼容性。
Linux 内核提供了两种版本,一种是带驱动的,不需要 initrd;另一种是依靠 initrd 来加载内核模块。发行说明中提到了更多关于它的内容:
>
> 像往常一样,内核提供了两种类型:通用内核和巨型内核。巨型内核包含足够多的内置驱动程序,在大多数情况下不需要 initrd 来启动系统。通用内核需要使用 initrd 来加载挂载根文件系统所需的内核模块。使用通用内核可以节省一些内存,并可能避免一些启动时的警告。我强烈建议使用通用内核以获得最佳的内核模块兼容性。
>
>
>
#### KDE Plasma 5.23 和 Xfce 4.16
谈到 KDE,你应该会发现 KDE Plasma 软件包更新到了 5.23,而 KDE 框架则更新到了 5.88 版本。
[KDE Plasma 5.23](https://news.itsfoss.com/kde-plasma-5-23-release/) 是 KDE 的 25 周年纪念版,包括了 UI 的改进,以及一系列细微的变化来改善用户体验。
除此之外,Slackware 15 还配备了 Xfce 4.16 作为桌面环境选项之一。
#### 对 PipeWire 和 Wayland 的支持
作为 PulseAudio 的替代品,Slackware 15 加入了对 PipeWire 的支持。
而且,对于那些想摆脱 X11 的用户来说,对 Wayland 的支持也在这个版本中出现。
#### 32 位支持
因为 Slackware 是 [适合 32 位系统的 Linux 发行版](https://itsfoss.com/32-bit-linux-distributions/) 之一,最新版本提供了特定的内核版本来支持它。
从技术上讲,有 SMP 和非 SMP 内核,分别用于单核和多核处理器。
建议使用 SMP 内核以获得更好的性能和内存管理,但是如果你的处理器比奔腾 3 还要老,非 SMP 内核应该会派上用场。
#### 其他改进

一些技术上的升级包括 GCC 编译器升级到 11.2.0 版本。相当多的安全和错误也得到了解决。
公告上还说,开发人员正专注于将 Python 更新到 3.3.4 版本,以修复 Samba 的构建。
其他基本软件包和应用程序,如网络管理器、OpenSSH、Krita、Falkon 浏览器和 Ocular 也得到了升级。Mozilla Firefox 和 Thunderbird 也被更新到它们最新的可用软件包。
如果你想获得这个版本的所有技术细节,你可以查看 [官方更新日志](http://www.slackware.com/changelog/current.php?cpu=x86_64)。其它一些重要的内容包括:
* 改进了 Slackware pkgtools,使软件安装体验无障碍,消除了并行冲突。
* Slackware 15 首次包括一个 `make_world.sh` 脚本,以帮助从源代码重建整个操作系统。
* 增加了更多的脚本,以方便重建安装程序和内核包。
* 抛弃了 Qt4,转而使用 Qt5。
* 增加了对<ruby> 特权访问管理 <rt> Privileged Access Management </rt></ruby>(PAM)的支持,以支持那些不支持<ruby> 影子 <rt> shadow </rt></ruby>密码的较新项目。
值得注意的是,你不能简单地从 Slackware 14.2 升级。因此,最好是进行一次全新的安装。
* Slackware 15 x86\_64: [ftp://ftp.slackware.com/pub/slackware-iso/slackware64-15.0-iso](file:///Users/xingyuwang/develop/TranslateProject-wxy/sources/news/ftp:/ftp.slackware.com/pub/slackware-iso/slackware64-15.0-iso)
* Slackware 15 x86\_32: [ftp://ftp.slackware.com/pub/slackware-iso/slackware-15.0-iso](file:///Users/xingyuwang/develop/TranslateProject-wxy/sources/news/ftp:/ftp.slackware.com/pub/slackware-iso/slackware-15.0-iso)
无论是哪种情况,你都应该保留一份数据备份,如果你对使用新的 ISO 安装不感兴趣,可以尝试按照 [官方升级说明](https://ftp.osuosl.org/pub/slackware/slackware64-15.0/UPGRADE.TXT) 来进行。
### 总结
Slackware 是最古老的仍然活跃的 Linux 发行版,我很高兴看到 Slackware 有了新的版本。
虽然它仍然推荐给有经验的用户或手工爱好者使用,但最新的 Slackware 15.0 也支持 UEFI 和旧系统。如果你正在寻求冒险,并希望为你的桌面安装一个独特的 Linux 发行版,你可以试试 Slackware 15。
你用过 Slaceware 吗?你会测试 Slackware 15.0 吗?你认为 Slackware 的未来会是怎样的呢?
---
via: <https://news.itsfoss.com/slackware-15-release/>
作者:[Rishabh Moharir](https://news.itsfoss.com/author/rishabh/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Rejoice! Linux fans will be pleased to know that the legendary distro, Slackware, has received a new release after a long time. For those unaware, Slackware’s latest version was released way back in 2016.
The entire Linux community was thrilled about it when the devs announced the plans for Slackware 15.0 in February, last year (2021).
The devs had made rapid progress in the development of Slackware Linux 15.0 in the past year, starting with an alpha release at the beginning of the year. It took a while considering its last release candidate release, but it is here now!
Let’s take a look at what’s new with Slackware 15.0
## What’s New in Slackware 15.0?

As mentioned before, Slackware 15.0 has received many changes. Not to forget, it involved a beta release and two release candidate (RC) announcements before the final release.
If you have been following our coverage, you may have had come across our [beta release](https://news.itsfoss.com/slackware-15-beta-release/) coverage, back in April.
There were a few things that weren’t revealed with its beta/RC releases. So, here, we mention everything important about it.
### Linux Kernel 5.15 LTS
The major highlight of Slackware 15 is the addition of the latest [Linux Kernel 5.15 LTS](https://news.itsfoss.com/linux-kernel-5-15-release/). This is a big jump from Linux Kernel 5.10 LTS that we noticed in the beta release.

Interestingly, the Slackware team tested hundreds of Linux Kernel versions before settling on Linux Kernel 5.15.19. The release note mentions:
We’ve actually built over 400 different Linux kernel versions over the years it took to finally declare Slackware 15.0 stable (by contrast, we tested 34 kernel versions while working on Slackware 14.2). We finally ended up on kernel version 5.15.19 after Greg Kroah-Hartman confirmed that it would get long-term support until at least October 2023 (and quite probably for longer than that).
In case you are curious, Linux Kernel 5.15 brings in updates like enhanced NTFS driver support and improvements for Intel/AMD processors and Apple’s M1 chip. It also adds initial support for Intel 12th gen processors.
Overall, with Linux Kernel 5.15 LTS, you should get a good hardware compatibility result for the oldest active Linux distro.
The Linux Kernel is offered in two flavors, one baked in with drivers which does not need initrd and the relies on initrd to load the kernel modules. The release notes mention more about it:
As usual, the kernel is provided in two flavors, generic and huge. The huge kernel contains enough built-in drivers that in most cases an initrd is not needed to boot the system. The generic kernels require the use of an initrd to load the kernel modules needed to mount the root filesystem. Using a generic kernel will save some memory and possibly avoid a few boot time warnings. I’d strongly recommend using a generic kernel for the best kernel module compatibility as well.
### KDE Plasma 5.23 and Xfce 4.16
Speaking about KDE, you should find KDE Plasma packages updated to 5.23 while KDE Frameworks was updated to version 5.88.
[KDE Plasma 5.23](https://news.itsfoss.com/kde-plasma-5-23-release/) is KDE’s 25th-anniversary edition release that included UI improvements, and a wide range of subtle changes to improve the user experience.
In addition to this, Slackware 15 also comes with Xfce 4.16 as one of the desktop environment options.
### Support for PipeWire and Wayland
As an alternative to PulseAudio, the support for PipeWire was added to Slackware 15.
And, for users who want to get away from X11, the support for Wayland also landed with this release.
### 32-bit Support
Considering Slackware is one of the [suitable Linux distributions for 32-bit systems](https://itsfoss.com/32-bit-linux-distributions/?ref=news.itsfoss.com), the latest version features specific kernel versions to support it.
Technically, there are SMP and non-SMP kernels for single-core and multi-core processors.
The SMP kernel is recommended for better performance and memory management, but if you have a processor older than the Pentium III, the non-SMP kernel should come in handy.
### Other Improvements

Some technical upgrades include GCC compiler being upgraded to version 11.2.0. Quite a lot of security and bugs were also addressed.
The announcement furthermore said that the devs were focusing on updating Python Markdown to version 3.3.4 to fix the Samba build.
Other essential packages and apps like Network Manager, OpenSSH, Krita, Falkon browser and Ocular also received upgrades. Mozilla Firefox and Thunderbird were updated to their latest available packages as well.
You can check out the [official changelog](http://www.slackware.com/changelog/current.php?cpu=x86_64&ref=news.itsfoss.com) if you want to get all the technical details for this release. Some important ones include:
- Slackware pkgtools received improvements to make the software installation experience hassle-free, without parallel collisions.
- Slackware 15 includes a “make_world.sh” script for the first time to help rebuild the OS from source code.
- More scripts have been added to easily rebuild the installer and kernel packages.
- Dropped Qt4 and moved to Qt 5.
- Added support for Privileged Access Management (PAM) to support newer projects that did not support shadow passwords.
It is important to note that you cannot easily upgrade from Slackware 14.2. So, it is best to perform a fresh installation.
In either case, you should keep a backup of your data, and can try to follow the [official upgrade instructions](https://ftp.osuosl.org/pub/slackware/slackware64-15.0/UPGRADE.TXT?ref=news.itsfoss.com) if you are not interested to install using the new ISO.
## Wrapping Up
I’m excited to see Slackware get a new release, considering the fact that it is still the oldest active Linux distro.
While it is still a recommendation for experienced users or tinkerers, the latest Slackware 15.0 supports UEFI and old systems. If you are looking for an adventure and want a unique Linux distro for your desktop, you can try Slackware 15.
*Will you be testing out Slackware 15.0? What do you think lies ahead for the future of Slackware?*
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,244 | 我如何使用 Linux 的无障碍设置 | https://opensource.com/article/22/1/linux-accessibility-settings | 2022-02-05T14:04:20 | [
"Linux",
"无障碍"
] | /article-14244-1.html |
>
> 不同的 Linux 系统以不同的方式处理辅助技术。 这里是一些对视觉、听觉、打字等有用的设置。
>
>
>

当我在 20 世纪 90 年代开始使用 Linux 时,我已经 40 多岁了,<ruby> 无障碍性 <rt> accessibility </rt></ruby>不是我非常关注的问题。然而现在,当我快到 70 岁时,我的需求已经改变了。几年前,我从 System76 购买了一个全新的 Darter Pro,它的默认分辨率是 1920x1080,而且也是高 DPI。系统附带了 Pop!\_OS,我发现我必须修改它才能看到显示屏上的图标和文字。谢天谢地,桌面上的 Linux 已经变得比 90 年代更容易使用了。
我需要辅助技术,特别是在视觉和听觉方面。还有一些我不使用的领域,但对需要帮助打字、指点、点击和手势的人来说是有用的。
不同的系统,如 Gnome、KDE、LXDE、XFCE 和其他系统,对这些辅助技术的处理方式不同。这些辅助性的调整大多可以通过 “<ruby> 设置 <rt> Settings </rt></ruby>” 对话框或键盘快捷键来实现。
### 文字显示
我需要帮助来显示较大的文字,在我的 Linux Mint Cinnamon 桌面上,我使用这些设置:

我还发现 Gnome “<ruby> 优化 <rt> Tweaks </rt></ruby>” 可以让我对桌面体验的文字显示大小进行微调。我把我的显示器的分辨率从默认的 1920x1080 调整到更舒适的 1600x900。以下是我的布局设置:

### 键盘支持
我不需要键盘支持,但它们是现成支持的,如下图所示:

### 更多无障碍选项
在 Fedora 35 上,无障碍访问也是熟悉的。打开 “<ruby> 设置 <rt> Settings </rt></ruby>” 菜单,选择让 “<ruby> 总是显示无障碍菜单 <rt> Always show Accessibility Menu </rt></ruby>” 图标在桌面上可见。我通常会切换 “<ruby> 大字体 <rt> Large Text </rt></ruby>”,除非我在一个大显示器上。还有许多其他选项,包括 “<ruby> 缩放 <rt> Zoom </rt></ruby>”、“<ruby> 屏幕阅读器 <rt> Screen Reader </rt></ruby>” 和 “<ruby> 声音键 <rt> Sound Keys </rt></ruby>”。这里有一些:

当在 Fedora 的 “<ruby> 设置 <rt> Settings </rt></ruby>” 菜单中启用了 “<ruby> 无障碍菜单 <rt> Accessibility Menu </rt></ruby>”,就很容易从右上角的图标中切换其他功能:

有一些 Linux 发行版是专门为需要无障碍支持的人设计的。[Accessible Coconut](https://zendalona.com/accessible-coconut/) 就是这样一个发行版。Coconut 基于 Ubuntu Mate 20.04,并默认启用了屏幕阅读器。它装载了 Ubuntu Mate 的默认应用。Accessible Coconut 是 [Zendalona](https://zendalona.com/) 的作品,该公司专门开发自由开源的无障碍应用。他们所有的应用都是以 GPL 2.0 许可证发布的,包括 [iBus-Braille](https://github.com/zendalona/ibus-braille)。该发行版包括屏幕阅读器、各种语言的打印阅读、六键输入、打字辅导、放大器、电子书扬声器等等。

[Gnome 无障碍套件](https://en.wikipedia.org/wiki/Accessibility_Toolkit) 是一个开源软件库,是 Gnome 项目的一部分,为实现无障碍功能提供 API。你可以通过访问他们的维基来参与 [Gnome 无障碍团队](https://wiki.gnome.org/Accessibility)。KDE 也有一个 [无障碍项目](https://community.kde.org/Accessibility#KDE_Accessibility_Project) 和一个支持该项目的 [应用](https://userbase.kde.org/Applications/Accessibility) 列表。你可以通过访问他们的 [维基](https://community.kde.org/Get_Involved/accessibility) 来参与 KDE 无障碍项目。[XFCE](https://docs.xfce.org/xfce/xfce4-settings/accessibility) 也为用户提供了相关资源。[Fedora 项目维基](https://fedoraproject.org/wiki/Docs/Beats/Accessibility#Using_Fedora.27s_Accessibility_Tools) 也有一个可以安装在操作系统上的无障碍应用的列表。
### Linux 适合所有人
自 20 世纪 90 年代以来,Linux 已经有了长足的进步,其中一个很大的进步就是对无障碍的支持。很高兴知道随着 Linux 用户的不断变化,操作系统也可以和我们一起变化,并做出许多不同的支持选项。
---
via: <https://opensource.com/article/22/1/linux-accessibility-settings>
作者:[Don Watkins](https://opensource.com/users/don-watkins) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | HTTPSConnectionPool(host='opensource.com', port=443): Read timed out. (read timeout=10) | null |
14,246 | Peppermint 11 发布:2022 年值得期待的发行版之一 | https://news.itsfoss.com/peppermint-11-release/ | 2022-02-05T23:38:00 | [
"Peppermint"
] | https://linux.cn/article-14246-1.html |
>
> 经过近三年的等待,Peppermint OS 11 来了,放弃了以 Ubuntu 作为其基础,并删除了 LXDE 组件。看起来不错!
>
>
>

Peppermint OS 11 是 [2022 年最值得期待的版本](https://news.itsfoss.com/linux-distro-releases-2022/) 之一,而它终于到来了!
2020年,其主要开发者 Mark Greaves 不幸去世,Peppermint OS 失去了它最重要的贡献者之一。
现在,经过近两年的时间,Peppermint 11 来了!这不仅仅是一次普通的升级,Peppermint 11 是它的第一个以 Debian 为基础的版本,抛弃了 Ubuntu。
让我在下面指出该版本的所有关键细节。
### Peppermint 11 有什么新东西?
该版本的主要亮点是放弃 Ubuntu,使用 Debian 64 位作为其基础。
从技术上讲,它基于 [Debian 11 “Bullseye”](https://news.itsfoss.com/debian-11-feature/) 的稳定分支。因此,你可以预期 Debian 的最新改进出现在 Peppermint OS 11 中。
除了新的基础之外,还有一些其他的变化,包括:
#### XFce 4.16.2,无 LXDE 组件

Peppermint OS 利用 XFce 桌面环境与 LXDE 组件来提供混合体验。
Peppermint 11 已经删除了所有的 LXDE 组件,专注于提供一个 XFce 驱动的桌面体验。
#### Calamares 安装程序取代了 Ubiquity

为了改善安装过程,Peppermint 11 使用了现代 Calamares 安装程序。
#### 新的欢迎应用程序

为了让你有一个良好的开端,Peppermint OS 现在包括一个新的欢迎应用程序,让你了解更多关于所使用的系统/组件,并安装开始使用所需的软件。
例如,你在 Peppermint 11 中没有预装默认的网络浏览器。你可以快速启动软件包选择器,安装 Firefox、GNOME、Tor、Falkon 和 Chromium 等浏览器。

#### 新的 Peppermint Hub
新的 Peppermint Hub 合并了设置和控制中心来保持整洁,帮助你轻松管理系统。

#### 新的应用程序
该版本包括一个基于终端的广告屏蔽器,即 [hblock](https://github.com/hectorm/hblock),可以在需要时启用或禁用。

Nemo 取代了 Thunar 作为默认的文件管理器,它应该感觉很熟悉,对许多用户来说可以派上用场。
#### 其他改进
总的来说,有了新的基础和更新的 Linux 内核 5.10,Peppermint 11 应该是一个令人兴奋的选择。
在 [发布说明](https://peppermintos.com/2022/02/peppermint-release-notes/) 中的一些其他变化包括:
* 在安装过程中包含了一套精简的桌面墙纸。下载额外的壁纸请进入 Peppermint 中。
* 包括一套精简的图标和 XFce 主题。
现在 [Peppermint OS 11](https://peppermintos.com/guide/downloading/) 来了,你会考虑在你的主系统上尝试一下吗?你已经试过了吗?请在下面的评论中告诉我你的想法。
---
via: <https://news.itsfoss.com/peppermint-11-release/>
作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Peppermint OS 11 was one of the [most anticipated releases for 2022](https://news.itsfoss.com/linux-distro-releases-2022/), and it has finally arrived!
Not to forget the tragic loss of its lead developer Mark Greaves in 2020, Peppermint OS lost one of its most significant contributors.
Now, after almost two years, Peppermint 11 is here! It is not just an ordinary upgrade, but it looks like Peppermint 11 is the first release with Debian as its base, ditching Ubuntu.
Let me highlight all the key details of the release below.
## Peppermint 11: What’s New?
The primary highlight of the release is dropping Ubuntu to use Debian 64-bit as its base.
Technically, it is based on the stable branch of [Debian 11 ‘Bullseye’](https://news.itsfoss.com/debian-11-feature/). So, you should expect the latest improvements to Debian along with Peppermint OS 11.
In addition to the new base, there are a few other changes that include:
### XFCE 4.16.2 with No LXDE Components

Peppermint OS utilized the XFCE desktop environment with LXDE components to provide a hybrid experience.
Peppermint 11 has removed all the LXDE components to focus on providing an XFCE-powered desktop experience.
### Calamares Installer Replaces Ubiquity

To improve the installation process, Peppermint 11 uses the modern Calamares installer.
### New Welcome Tour App

To give you a head start, Peppermint OS now includes a new Welcome application that allows you to learn more about the system/components used and install the software needed to get started.
For instance, you do not have a default web browser pre-installed with Peppermint 11. You can quickly launch the software package selector and install browsers like Firefox, GNOME, Tor, Falkon, and Chromium.

### New Peppermint Hub
The new Peppermint Hub keeps things tidy by combining the settings and control center to help you manage the system easily.

### New Applications
The distribution includes a terminal-based ad-blocker, i.e., [hblock](https://github.com/hectorm/hblock?ref=news.itsfoss.com) that can be enabled or disabled when needed.

Nemo replaces Thunar as the default file manager, and it should feel familiar and can come in handy for many users.
### Other Improvements
Overall, with a new base, and updated Linux Kernel 5.10, Peppermint 11 should be an exciting choice to try.
Some other changes in the [release notes](https://peppermintos.com/2022/02/peppermint-release-notes/?ref=news.itsfoss.com) include:
- A minimum set of desktop wallpaper is included during installation. Download additional wallpaper
*Welcome to Peppermint*. - A streamlined set of icons and XFCE themes are included.
*So, now that Peppermint OS 11 is here, will you consider trying it on your primary system? Have you tried it yet? Let me know your thoughts in the comments below.*
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,247 | 用 HAProxy 实现网络流量的负载平衡 | https://opensource.com/article/20/11/load-balancing-haproxy | 2022-02-06T11:40:10 | [
"HAProxy",
"负载均衡"
] | /article-14247-1.html |
>
> 安装、配置和运行 HAProxy,在几个网络或应用服务器之间分配网络流量。
>
>
>

不是只有在一个大型公司工作才需要使用负载平衡器。你可能是一个业余爱好者,用几台树莓派电脑自我托管一个网站。也许你是一个小企业的服务器管理员;也许你确实在一家大公司工作。无论你的情况如何,你都可以使用 [HAProxy](https://www.haproxy.org/) 负载平衡器来管理你的流量。
HAProxy 被称为“世界上最快和使用最广泛的软件负载平衡器”。它包含了许多可以使你的应用程序更加安全可靠的功能,包括内置的速率限制、异常检测、连接排队、健康检查以及详细的日志和指标。学习本教程中所涉及的基本技能和概念,将有助于你使用 HAProxy 建立一个更强大的、远为强大的基础设施。
### 为什么需要一个负载平衡器?
负载平衡器是一种在几个网络或应用服务器之间轻松分配连接的方法。事实上,HAProxy 可以平衡任何类型的传输控制协议([TCP](https://en.wikipedia.org/wiki/Transmission_Control_Protocol))流量,包括 RDP、FTP、WebSockets 或数据库连接。分散负载的能力意味着你不需要因为你的网站流量比谷歌大就购买一个拥有几十万 G 内存的大型网络服务器。
负载平衡器还为你提供了灵活性。也许你现有的网络服务器不够强大,无法满足一年中繁忙时期的峰值需求,你想增加一个,但只是暂时的。也许你想增加一些冗余,以防一个服务器出现故障。有了 HAProxy,你可以在需要时向后端池添加更多的服务器,在不需要时删除它们。
你还可以根据情况将请求路由到不同的服务器。例如,你可能想用几个缓存服务器(如 [Varnish](https://varnish-cache.org/))来处理你的静态内容,但把任何需要动态内容的东西,如 API 端点,路由到一个更强大的机器。
在这篇文章中,我将通过设置一个非常基本的 HAProxy 环境,使用 HTTPS 来监听安全端口 443,并利用几个后端 Web 服务器。它甚至会将所有进入预定义 URL(如 `/api/`)的流量发送到不同的服务器或服务器池。
### 安装 HAProxy
要开始安装,请启动一个新的 CentOS 8 服务器或实例,并使系统达到最新状态:
```
$ sudo yum update -y
```
这通常会持续一段时间。在等待的时候给自己拿杯咖啡。
这个安装有两部分:第一部分是安装 yum 版本的 HAProxy,第二部分是编译和安装你的二进制文件,用最新的版本覆盖以前的 HAProxy。用 yum 安装,在生成 systemd 启动脚本等方面做了很多繁重的工作,所以运行 `yum install`,然后从源代码编译,用最新的版本覆盖 HAProxy 二进制:
```
$ sudo yum install -y haproxy
```
启用 HAProxy 服务:
```
$ sudo systemctl enable haproxy
```
要升级到最新版本([版本 2.2](https://www.haproxy.com/blog/announcing-haproxy-2-2/),截至本文写作为止),请编译源代码。许多人认为从源代码编译和安装一个程序需要很高的技术能力,但这是一个相当简单的过程。首先,使用 `yum` 安装一些提供编译代码工具的软件包:
```
$ sudo yum install dnf-plugins-core
$ sudo yum config-manager --set-enabled PowerTools
$ sudo yum install -y git ca-certificates gcc glibc-devel \
lua-devel pcre-devel openssl-devel systemd-devel \
make curl zlib-devel
```
使用 `git` 获得最新的源代码,并改变到 `haproxy` 目录:
```
$ git clone http://git.haproxy.org/git/ haproxy
$ cd haproxy
```
运行以下三个命令来构建和安装具有集成了 Prometheus 支持的 HAProxy:
```
$ make TARGET=linux-glibc USE_LUA=1 USE_OPENSSL=1 USE_PCRE=1 \
PCREDIR= USE_ZLIB=1 USE_SYSTEMD=1 \
EXTRA_OBJS="contrib/prometheus-exporter/service-prometheus.o"
$ sudo make PREFIX=/usr install # 安装到 /usr/sbin/haproxy
```
通过查询版本来测试它:
```
$ haproxy -v
```
你应该看到以下输出:
```
HA-Proxy version 2.2.4-b16390-23 2020/10/09 - https://haproxy.org/
```
### 创建后端服务器
HAProxy 并不直接提供任何流量,这是后端服务器的工作,它们通常是网络或应用服务器。在这个练习中,我使用一个叫做 [Ncat](https://nmap.org/ncat) 的工具,它是网络领域的“瑞士军刀”,用来创建一些极其简单的服务器。安装它:
```
$ sudo yum install nc -y
```
如果你的系统启用了 [SELinux](https://www.redhat.com/en/topics/linux/what-is-selinux),你需要启用端口 8404,这是用于访问 HAProxy 统计页面的端口(下面有解释),以及你的后端服务器的端口:
```
$ sudo dnf install policycoreutils-python-utils
$ sudo semanage port -a -t http_port_t -p tcp 8404
$ sudo semanage port -a -t http_port_t -p tcp 10080
$ sudo semanage port -a -t http_port_t -p tcp 10081
$ sudo semanage port -a -t http_port_t -p tcp 10082
```
创建两个 Ncat 网络服务器和一个 API 服务器:
```
$ while true ;
do
nc -l -p 10080 -c 'echo -e "HTTP/1.1 200 OK\n\n This is Server ONE"' ;
done &
$ while true ;
do
nc -l -p 10081 -c 'echo -e "HTTP/1.1 200 OK\n\n This is Server TWO"' ;
done &
$ while true ;
do
nc -l -p 10082 -c 'echo -e "HTTP/1.1 200 OK\nContent-Type: application/json\n\n { \"Message\" :\"Hello, World!\" }"' ;
done &
```
这些简单的服务器打印出一条信息(如“This is Server ONE”),并运行到服务器停止为止。在现实环境中,你会使用实际的网络和应用程序服务器。
### 修改 HAProxy 的配置文件
HAProxy 的配置文件是 `/etc/haproxy/haproxy.cfg`。你在这里进行修改以定义你的负载平衡器。这个 [基本配置](https://gist.github.com/haproxytechblog/38ef4b7d42f16cfe5c30f28ee3304dce) 将让你从一个工作的服务器开始:
```
global
log 127.0.0.1 local2
user haproxy
group haproxy
defaults
mode http
log global
option httplog
frontend main
bind *:80
default_backend web
use_backend api if { path_beg -i /api/ }
#-------------------------
# SSL termination - HAProxy handles the encryption.
# To use it, put your PEM file in /etc/haproxy/certs
# then edit and uncomment the bind line (75)
#-------------------------
# bind *:443 ssl crt /etc/haproxy/certs/haproxy.pem ssl-min-ver TLSv1.2
# redirect scheme https if !{ ssl_fc }
#-----------------------------
# Enable stats at http://test.local:8404/stats
#-----------------------------
frontend stats
bind *:8404
stats enable
stats uri /stats
#-----------------------------
# round robin balancing between the various backends
#-----------------------------
backend web
server web1 127.0.0.1:10080 check
server web2 127.0.0.1:10081 check
#-----------------------------
# API backend for serving up API content
#-----------------------------
backend api
server api1 127.0.0.1:10082 check
```
### 重启并重新加载 HAProxy
HAProxy 可能还没有运行,所以发出命令 `sudo systemctl restart haproxy` 来启动(或重新启动)它。“重启” 的方法在非生产情况下是很好的,但是一旦你开始运行,你要养成使用 `sudo systemctl reload haproxy` 的习惯,以避免服务中断,即使你的配置中出现了错误。
例如,当你对 `/etc/haproxy/haproxy.cfg` 进行修改后,你需要用 `sudo systemctl reload haproxy` 来重新加载守护进程,使修改生效。如果有错误,它会让你知道,但继续用以前的配置运行。用 `sudo systemctl status haproxy` 检查 HAProxy 的状态。
如果它没有报告任何错误,你就有一个正在运行的服务器。在服务器上用 `curl` 测试,在命令行输入 `curl http://localhost/`。如果你看到 “This is Server ONE”,那就说明一切都成功了!运行 `curl` 几次,看着它在你的后端池中循环,然后看看当你输入 `curl http://localhost/api/` 时会发生什么。在 URL 的末尾添加 `/api/` 将把所有的流量发送到你池子里的第三个服务器。至此,你就有了一个正常运作的负载平衡器
### 检查你的统计资料
你可能已经注意到,配置中定义了一个叫做 `stats` 的前端,它的监听端口是 8404:
```
frontend stats
bind *:8404
stats uri /stats
stats enable
```
在你的浏览器中,加载 `http://localhost:8404/stats`。阅读 HAProxy 的博客 [学习 HAProxy 的统计页面](https://www.haproxy.com/blog/exploring-the-haproxy-stats-page/),了解你在这里可以做什么。
### 一个强大的负载平衡器
虽然我只介绍了 HAProxy 的几个功能,但你现在有了一个服务器,它可以监听 80 和 443 端口,将 HTTP 流量重定向到 HTTPS,在几个后端服务器之间平衡流量,甚至将匹配特定 URL 模式的流量发送到不同的后端服务器。你还解锁了非常强大的 HAProxy 统计页面,让你对你的系统有一个很好的概览。
这个练习可能看起来很简单,不要搞错了,你刚刚建立和配置了一个非常强大的负载均衡器,能够处理大量的流量。
为了你方便,我把本文中的所有命令放在了 [GitHub Gist](https://gist.github.com/haproxytechblog/d656422754f1b5eb1f7bbeb1452d261e) 中。
---
via: <https://opensource.com/article/20/11/load-balancing-haproxy>
作者:[Jim O'Connell](https://opensource.com/users/jimoconnell) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | HTTPSConnectionPool(host='opensource.com', port=443): Read timed out. (read timeout=10) | null |
14,249 | 使用 CMake 和 VSCodium 设置一个构建系统 | https://opensource.com/article/22/1/devops-cmake | 2022-02-07T11:10:39 | [
"CMake",
"构建",
"VSCodium"
] | https://linux.cn/article-14249-1.html |
>
> 提供一个适当的 CMake 配置文件来使其他人可以更容易地构建、使用和贡献你的项目。
>
>
>

这篇文章是使用开源 DevOps 工具进行 C/C++ 开发系列文章的一部分。如果你从一开始就把你的项目建立在一个功能强大的工具链上,你的开发会更快和更安全。除此之外,这会使别人更容易地参与你的项目。在这篇文章中,我将搭建一个基于 [CMake](https://cmake.org/) 和 [VSCodium](https://vscodium.com/) 的 C/C++ 构建系统。像往常一样,相关的示例代码可以在 [GitHub](https://github.com/hANSIc99/cpp_testing_sample) 上找到。
我已经测试了在本文中描述的步骤。这是一种适用于所有平台的解决方案。
### 为什么用 CMake ?
[CMake](https://opensource.com/article/21/5/cmake) 是一个构建系统生成器,可以为你的项目创建 Makefile。乍一看简单的东西可能相当地复杂。在较高的层次上,你可以定义你的项目的各个部分(可执行文件、库)、编译选项(C/C++ 标准、优化、架构)、依赖关系项(头文件、库),和文件级的项目结构。CMake 使用的这些信息可以在文件 `CMakeLists.txt` 中获取,它使用一种特殊的描述性语言编写。当 CMake 处理这个文件时,它将自动地侦测在你的系统上已安装的编译器,并创建一个用于启动它的 Makefile 文件。
此外,在 `CMakeLists.txt` 中描述的配置,能够被很多编辑器读取,像 QtCreator、VSCodium/VSCode 或 Visual Studio 。
### 示例程序
我们的示例程序是一个简单的命令行工具:它接受一个整数来作为参数,输出一个从 1 到所提供输入值的范围内的随机排列的数字。
```
$ ./Producer 10
3 8 2 7 9 1 5 10 6 4
```
在我们的可执行文件中的 `main()` 函数,我们只处理输入的参数,如果没有提供一个值(或者一个不能被处理的值)的话,就退出程序。
```
int main(int argc, char** argv){
if (argc != 2) {
std::cerr << "Enter the number of elements as argument" << std::endl;
return -1;
}
int range = 0;
try{
range = std::stoi(argv[1]);
}catch (const std::invalid_argument&){
std::cerr << "Error: Cannot parse \"" << argv[1] << "\" ";
return -1;
}
catch (const std::out_of_range&) {
std::cerr << "Error: " << argv[1] << " is out of range";
return -1;
}
if (range <= 0) {
std::cerr << "Error: Zero or negative number provided: " << argv[1];
return -1;
}
std::stringstream data;
std::cout << Generator::generate(data, range).rdbuf();
}
```
*producer.cpp*
实际的工作是在 [生成器](https://github.com/hANSIc99/cpp_testing_sample/blob/main/Generator/Generator.cpp) 中完成的,它将被编译,并将作为一个静态库来链接到我们的`Producer` 可执行文件。
```
std::stringstream &Generator::generate(std::stringstream &stream, const int range) {
std::vector<int> data(range);
std::iota(data.begin(), data.end(), 1);
std::random_device rd;
std::mt19937 g(rd());
std::shuffle(data.begin(), data.end(), g);
for (const auto n : data) {
stream << std::to_string(n) << " ";
}
return stream;
}
```
*Generator.cpp*
函数 `generate` 引用一个 [std::stringstream](https://en.cppreference.com/w/cpp/io/basic_stringstream) 和一个整数来作为一个参数。根据整数 `range` 的值 `n`,制作一个在 `1` 到 `n` 的范围之中的整数向量,并随后打乱。接下来打乱的向量值转换成一个字符串,并推送到 `stringstream` 之中。该函数返回与作为参数传递相同的 `stringstream` 引用。
### 顶层的 CMakeLists.txt
顶层的 [CMakeLists.txt](https://github.com/hANSIc99/cpp_testing_sample/blob/main/CMakeLists.txt) 的是我们项目的入口点。在子目录中可能有多个 `CMakeLists.txt` 文件(例如,与项目所相关联的库或其它可执行文件)。我们先一步一步地浏览顶层的 `CMakeLists.txt`。
第一行告诉我们处理文件所需要的 CMake 的版本、项目名称及其版本,以及预定的 C++ 标准。
```
cmake_minimum_required(VERSION 3.14)
project(CPP_Testing_Sample VERSION 1.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
```
我们用下面一行告诉 CMake 去查看子目录 `Generator`。这个子目录包括构建 `Generator` 库的所有信息,并包含它自身的一个 `CMakeLists.txt` 。我们很快就会谈到这个问题。
```
add_subdirectory(Generator)
```
现在,我们将涉及一个绝对特别的功能: [CMake 模块](https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html) 。加载模块可以扩展 CMake 功能。在我们的项目中,我们加载了 [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) 模块,这能使我们能够在 CMake 运行时下载外部的资源,在我们的示例中是 [GoogleTest](https://github.com/google/googletest) 。
```
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/bb9216085fbbf193408653ced9e73c61e7766e80.zip
)
FetchContent_MakeAvailable(googletest)
```
在接下来的部分中,我们会做一些我们通常在普通的 Makefile 中会做的事: 指定要构建的二进制文件、它们相关的源文件、应该链接的库,以及编译器可以找到头文件的目录。
```
add_executable(Producer Producer.cpp)
target_link_libraries(Producer PUBLIC Generator)
target_include_directories(Producer PUBLIC "${PROJECT_BINARY_DIR}")
```
通过下面的语句,我们使 CMake 来在构建文件夹中创建一个名称为 `compile_commands.json` 的文件。这个文件会展示项目的每个文件的编译器选项。在 VSCodium 中加载该文件,会告知 IntelliSense 功能在哪里查找头文件(查看 [文档](https://code.visualstudio.com/docs/cpp/c-cpp-properties-schema-reference))。
```
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
```
最后的部分为我们的项目定义一些测试。项目使用先前加载的 GoogleTest 框架。单元测试的整个话题将会划归到另外一篇文章。
```
enable_testing()
add_executable(unit_test unit_test.cpp)
target_link_libraries(unit_test gtest_main)
include(GoogleTest)
gtest_discover_tests(unit_test)
```
### 库层次的 CMakeLists.txt
现在,我们来看看包含同名库的子目录 `Generator` 中的 [CMakeLists.txt](https://github.com/hANSIc99/cpp_testing_sample/blob/main/Generator/CMakeLists.txt) 文件。这个 `CMakeLists.txt` 文件的内容更简短一些,除了单元测试相关的命令外,它仅包含 2 条语句。
```
add_library(Generator STATIC Generator.cpp Generator.h)
target_include_directories(Generator INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
```
我们使用 `add_library(...)` 来定义一个新的构建目标:静态的 `Generator` 库。我们使用语句 `target_include_directories(...)` 来把当前子目录添加到其它构建目标的头文件的搜索路径之中。我们也具体指定这个属性的范围为类型 `INTERFACE`:这意味着该属性仅影响链接到这个库的构建目标,而不是库本身。
### 开始使用 VSCodium
通过使用 `CMakeLists.txt` 文件中的信息,像 VSCodium 一样的 IDE 可以相应地配置构建系统。如果你还没有使用 VSCodium 或 VS Code 的经验,这个示例项目会是一个很好的起点。首先,转到它们的 [网站](https://vscodium.com/) ,然后针对你的系统下载最新的安装软件包。打开 VSCodium 并导航到 “<ruby> 扩展 <rt> Extensions </rt></ruby>” 标签页。
为了正确地构建、调试和测试项目,搜索下面的扩展并安装它们:

如果尚未完成,通过单击起始页的 “<ruby> 克隆 Git 存储库 <rt> Clone Git Repository </rt></ruby>” 来克隆存储库。

或者手动输入:
```
git clone https://github.com/hANSIc99/cpp_testing_sample.git
```
之后,通过输入如下内容来签出标签 `devops_1`:
```
git checkout tags/devops_1
```
或者,通过单击 “main” 分支按钮(红色框),并从下拉菜单(黄色框)中选择标签。

在你打开 VSCodium 内部中的存储库的根文件夹后,CMake Tools 扩展会侦测 `CMakeLists.txt` 文件并立即扫描你的系统寻找合适的编译器。你现在可以单击屏幕的底部的 “<ruby> 构建 <rt> Build </rt></ruby>” 按钮(红色框)来开始构建过程。你也可以通过单击底部区域的按钮(黄色框)标记来更改编译器,它显示当前活动的编译器。

要开始调试 `Producer` 可执行文件,单击调试器符号(黄色框)并从下拉菜单中选择 “<ruby> 调试 <rt> Debug </rt></ruby> Producer”(绿色框)。

如上所述,`Producer` 可执行文件要求将元素的数量作为一个命令行的参数。命令行参数可以在 `.vscode/launch.json` 中具体指定。

好了,你现在能够构建和调试项目了。
### 结束语
归功于 CMake ,不管你正在运行哪种操作系统,上述步骤应该都能工作。特别是使用与 CMake 相关的扩展,VSCodium 变成了一个强大的 IDE 。我没有提及 VSCodium 的 Git 集成,是因为你已经能够在网络上查找很多的资源。我希望你可以看到:提供一个适当的 CMake 配置文件可以使其他人更容易地构建、使用和贡献于你的项目。在未来的文章中,我将介绍单元测试和 CMake 的测试实用程序 `ctest` 。
---
via: <https://opensource.com/article/22/1/devops-cmake>
作者:[Stephan Avenwedde](https://opensource.com/users/hansic99) 选题:[lujun9972](https://github.com/lujun9972) 译者:[robsean](https://github.com/robsean) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | This article is part of a series about open source DevOps tools for C/C++ development. If you build up your project from the beginning on a powerful toolchain, you will benefit from a faster and safer development. Aside from that, it will be easier for you to get others involved in your project. In this article, I will prepare a C/C++ build system based on [CMake](https://cmake.org/) and [VSCodium](https://vscodium.com/). As usual, the related example code is available on [GitHub](https://github.com/hANSIc99/cpp_testing_sample).
I've tested the steps described in this article. This is a solution for all platforms.
## Why CMake?
[CMake](https://opensource.com/article/21/5/cmake) is a build system generator that creates the Makefile for your project. What sounds simple at first glance can be pretty complex at second glance. At a high altitude, you define the individual parts of your project (executables, libraries), compiling options (C/C++ standard, optimizations, architecture), the dependencies (header, libraries), and the project structure on file level. This information gets made available to CMake in the file `CMakeLists.txt`
using a special description language. When CMake processes this file, it automatically detects the installed compilers on your systems and creates a working Makefile.
In addition, the configuration described in the `CMakeLists.txt`
can be read by many editors like QtCreator, VSCodium/VSCode, or Visual Studio.
## Sample program
Our sample program is a simple command-line tool: It takes an integer as an argument and outputs numbers randomly shuffled in the range from one to the provided input value.
```
$ ./Producer 10
3 8 2 7 9 1 5 10 6 4
```
In the `main() `
function of our executable, we just process the input parameter and exit the program if no one value (or a value that can't be processed) is provided.
**producer.cpp**
```
int main(int argc, char** argv){
if (argc != 2) {
std::cerr << "Enter the number of elements as argument" << std::endl;
return -1;
}
int range = 0;
try{
range = std::stoi(argv[1]);
}catch (const std::invalid_argument&){
std::cerr << "Error: Cannot parse \"" << argv[1] << "\" ";
return -1;
}
catch (const std::out_of_range&) {
std::cerr << "Error: " << argv[1] << " is out of range";
return -1;
}
if (range <= 0) {
std::cerr << "Error: Zero or negative number provided: " << argv[1];
return -1;
}
std::stringstream data;
std::cout << Generator::generate(data, range).rdbuf();
}
```
The actual work gets done in the [Generator](https://github.com/hANSIc99/cpp_testing_sample/blob/main/Generator/Generator.cpp), which is compiled and linked as a static library to our `Producer`
executable.
**Generator.cpp**
```
std::stringstream &Generator::generate(std::stringstream &stream, const int range) {
std::vector<int> data(range);
std::iota(data.begin(), data.end(), 1);
std::random_device rd;
std::mt19937 g(rd());
std::shuffle(data.begin(), data.end(), g);
for (const auto n : data) {
stream << std::to_string(n) << " ";
}
return stream;
}
```
The function `generate`
takes a reference to a [std::stringstream](https://en.cppreference.com/w/cpp/io/basic_stringstream) and an integer as an argument. Based on the value *n* of the integer `range`
, a vector of integers in the range of 1 to *n* is made and afterward shuffled. The values in the shuffled vector are then converted into a string and pushed into the `stringstream`
. The function returns the same `stringstream`
reference as passed as argument.
## Top-level CMakeLists.txt
The top-level [CMakeLists.txt](https://github.com/hANSIc99/cpp_testing_sample/blob/main/CMakeLists.txt) is the entry point of our project. There can be several `CMakeLists.txt `
files in subdirectories (for example, libraries or other executables associated with the project). We start by going step by step over the top-level `CMakeLists.txt`
.
The first lines tell us about the version of CMake, which is required to process the file, the project name, and its versions, as well as the intended C++ standard.
```
cmake_minimum_required(VERSION 3.14)
project(CPP_Testing_Sample VERSION 1.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
```
We tell CMake to look into the subdirectory `Generator`
with the following line. This subdirectory includes all information to build the `Generator`
library and contains a `CMakeLists.txt`
for its own. We'll get to that shortly.
`add_subdirectory(Generator)`
Now we come to an absolute special feature: [CMake Modules](https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html). Loading modules can extend CMake functionality. In our project, we load the module [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html), which enables us to download external resources, in our case [GoogleTest](https://github.com/google/googletest) when CMake is run.
```
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/bb9216085fbbf193408653ced9e73c61e7766e80.zip
)
FetchContent_MakeAvailable(googletest)
```
In the next part, we do what we would usually do in an ordinary Makefile: Specify which binary to build, their related source files, libraries which should be linked to, and the directories in which the compiler can find the header files.
```
add_executable(Producer Producer.cpp)
target_link_libraries(Producer PUBLIC Generator)
target_include_directories(Producer PUBLIC "${PROJECT_BINARY_DIR}")
```
With the following statement, we get CMake to create a file in the build folder called `compile_commands.json`
. This file exposes the compile options for every single file of the project. Loaded in VSCodium, this file tells the IntelliSense feature where to find the header files (see [documentation](https://code.visualstudio.com/docs/cpp/c-cpp-properties-schema-reference)).
`set(CMAKE_EXPORT_COMPILE_COMMANDS ON)`
The last part defines the tests for our project. The project uses the previously loaded GoogleTest framework. The whole topic of unit tests will be part of a separate article.
```
enable_testing()
add_executable(unit_test unit_test.cpp)
target_link_libraries(unit_test gtest_main)
include(GoogleTest)
gtest_discover_tests(unit_test)
```
## Library level CMakeLists.txt
Now we look at the [CMakeLists.txt](https://github.com/hANSIc99/cpp_testing_sample/blob/main/Generator/CMakeLists.txt) file in the subdirectory `Generator`
containing the eponymous library. This `CMakeLists.txt`
is much shorter, and besides the unit test-related commands, it contains only two statements.
```
add_library(Generator STATIC Generator.cpp Generator.h)
target_include_directories(Generator INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
```
With `add_library(...)`
we define a new build target: The static `Generator`
library. With the statement `target_include_directories(...)`
, we add the current subdirectory to the search path for header files for other build targets. We also specify the scope of this property to be of type `INTERFACE`
: This means that the property will only affect build targets that link against this library, not the library itself.
## Get started with VSCodium
With the information available in the `CMakeLists.txt`
, IDEs like VSCodium can configure the build system accordingly. If you haven't already experience with VSCodium or VS Code, this example project is a good starting point. First, go to their [website](https://vscodium.com/) and download the latest installation package for your system. Open VSCodium and navigate to the **Extensions** tab.
To properly build, debug and test the project, search for the following extensions and install them.

(Stephan Avenwedde, CC BY-SA 4.0)
If not already done, clone the repository by clicking on **Clone Git Repository** on the start page.

(Stephan Avenwedde, CC BY-SA 4.0)
Or manually by typing:
`git clone https://github.com/hANSIc99/cpp_testing_sample.git`
Afterward, check out the tag *devops_1* either by typing:
`git checkout tags/devops_1`
Or by clicking on the **main** branch button (red box) and selecting the tag from the drop-down menu (yellow box).

(Stephan Avenwedde, CC BY-SA 4.0)
Once you open the repository's root folder inside VSCodium, the `CMake Tools`
extensions detect the `CMakeLists.txt`
file and immediately scan your system for suitable compilers. You can now click on the **Build** button at the bottom of the screen (red box) to start the build process. You can also change the compiler by clicking on the area at the bottom (yellow box) mark, which shows the currently active compiler.

(Stephan Avenwedde, CC BY-SA 4.0)
To start debugging the `Producer`
executable, click on the debugger symbol (yellow box) and choose **Debug Producer** (green box) from the drop-down menu.

(Stephan Avenwedde, CC BY-SA 4.0)
As previously mentioned, the `Producer`
executable expects the number of elements as a command-line argument. The command-line argument can be specified in the file `.vscode/launch.json.`

(Stephan Avenwedde, CC BY-SA 4.0)
Alright, you are now able to build and debug the project.
## Conclusion
Thanks to CMake, the above steps should work no matter what OS you're running. Especially with the CMake-related extensions, VSCodium becomes a powerful IDE. I didn't mention the Git integration of VSCodium because you can already find many resources on the web. I hope you see that providing a proper CMake configuration makes it much easier for others to build, use and contribute to your project. In a future article, I will look at unit tests and CMake's testing utility `ctest`
.
## Comments are closed. |
14,250 | KDE Falkon 浏览器三年来首次更新 | https://news.itsfoss.com/falkon-browser-3-2-release/ | 2022-02-07T11:43:00 | [
"浏览器",
"Falkon"
] | https://linux.cn/article-14250-1.html |
>
> Falkon 的最新版本带来了截屏功能和基于 PDFium 的 PDF 阅读器以及其他改进。
>
>
>

如果你是 KDE 的粉丝,你肯定接触过,甚至使用过 Falkon。所以,你一定会惊喜地发现,KDE 已经成功地为他们的网络浏览器发布了新的重大升级。
与其他主流网络浏览器不同,Falkon 的更新并不频繁。这个最新发布的版本是一个令人兴奋的更新,在间隔了近三年之后!
补充一句,[Falkon](https://itsfoss.com/falkon-browser/) 是一个建立在 QtWebEngine 上的简单的开源网络浏览器。它最初被称为 QupZilla,后来在 KDE 旗下被重新命名为 Falkon。
虽然并不是新浏览器,它早在 2010 年就发布了,但它为普通用户提供了一种极简的浏览体验。

### Falkon 3.2.0 有什么新内容?
即使你现在安装的是最新版本,Falkon 也没有定期提供安全更新。
因此,你可以考虑将 Falkon 作为满足特定要求的浏览器或作为辅助浏览器。
下面是这个版本的新内容:
#### 截屏和 PDF 阅读器支持
最新的版本带来了急需的截屏功能和可选的基于 PDFium 的 PDF 阅读器。这两个都是基于 Qt 5.13 的版本。
#### 主题和插件
对下载主题和扩展的初步支持也被添加进来了,同时偏好菜单也显示了对 KDE 商店的链接。此外,用户现在也可以删除本地安装的主题和插件。

#### 书签
由于有了上下文菜单项,用户现在可以创建文件夹并存储书签。人们已经注意到,填充书签栏和创建顶级的书签的能力已经没有了。
#### 其他功能
* 在 Falkon 中添加的一个非常常见但又必不可少的功能是暂停或恢复下载的能力。
* 更新的 CookieManager 现在允许同时选择一个以上的 cookie。
* 首选项扩展现在可以筛选查找。
* 用户现在可以通过上下文菜单分离标签。
* 现在包括 NetworkManager 集成。
要了解更多关于所有的技术变化,你可以参考 [官方发布说明](https://www.falkon.org/2022/01/31/320-released/#disqus_thread)。

### 总结
Falkon 的最新版本表明 KDE 仍然计划继续支持它。这对 KDE 爱好者来说是个好消息,特别是对那些使用 Falkon 的人来说。但是,现在说他们是否计划定期推送更新,使其成为日常浏览的理想选择,还为时过早。
如果你觉得一个简单的、轻量级的网络浏览器就可以,而且有很好的广告屏蔽功能,一个与 KDE 桌面融合的浏览器,Falkon 是一个必须尝试的东西。
安装是非常直接的。你可以在你的软件库中找到它,或者使用 Flatpak 或 [Snap 包](https://snapcraft.io/falkon) 安装它。如果你想知道,它也可用于 Windows 用户。
* [下载 Falkon 3.2.0](https://www.falkon.org/download/)
---
via: <https://news.itsfoss.com/falkon-browser-3-2-release/>
作者:[Rishabh Moharir](https://news.itsfoss.com/author/rishabh/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

If you’re a KDE fan, you must have certainly come across or even used Falkon. So, you must be pleasantly surprised to find out that KDE has managed to release a new major upgrade of their web browser.
Unlike other mainstream web browsers, Falkon does not receive frequent updates. And, the latest release is an exciting update, after a gap of almost three years!
For those unaware, [Falkon](https://itsfoss.com/falkon-browser/?ref=news.itsfoss.com) is a simple open-source web browser built upon the QtWebEngine. It was initially known as QupZilla, later rebranded to Falkon under KDE.
Although not new—being released way back in 2010—it offers a minimalistic browsing experience for the average user.

## Falkon 3.2.0: What’s New?
Even though you have the latest version available now, Falkon does not offer regular security updates.
So, you might want to consider Falkon as a browser for specific requirements or as a secondary browser.
Here’s what’s new with this release:
### Screen Capture and PDF Reader Support
The latest release brings in much-needed support for Screen Capture and an optional PDF reader based on PDFium. Both of these are based on Qt 5.13. version.
### Themes and Plugins
Initial support for downloading themes and extensions has also been added, along with the Preferences menu that displays links to the KDE store. Additionally, users can now remove locally installed themes and plugins too.

### Bookmarks
Users can now create folders and store bookmarks thanks to a context menu item. It has been noticed that the padding of the bar and the ability to create bookmarks without a parent has been taken away.
### Other features
- A very common yet essential feature added to Falkon is the ability to pause or resume downloads.
- An updated CookieManager now allows the selection of more than one cookie at the same time.
- The Preferences extensions can now be filtered.
- Users can now detach tabs via the context menu
- NetworkManager integration is now included.
To know more about all the technical changes, you can refer to the [official release notes.](https://www.falkon.org/2022/01/31/320-released/?ref=news.itsfoss.com#disqus_thread)

## Wrapping Up
The latest release of Falkon shows that KDE is still planning to continue support for it. This is a piece of good news for KDE lovers, especially for those who use Falkon. But, it’s too early to say if they plan to push regular updates, making it an ideal choice for everyday browsing.
If you’re okay with a simple and lightweight web browser with decent ad-blocking capabilities, one that blends in well with the KDE desktop, Falkon is a must-try.
Installation is very straightforward. You can find it in your repositories or install it using the Flatpak or [Snap packages](https://snapcraft.io/falkon?ref=news.itsfoss.com). It is also available for Windows users, if you are curious.
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,252 | Linux BitTorrent 客户端 Fragments 2.0 全新发布 | https://news.itsfoss.com/fragments-2-0-release/ | 2022-02-08T10:43:08 | [
"Fragments",
"BitTorrent"
] | https://linux.cn/article-14252-1.html |
>
> Fragments 2.0 的发布使其成为 Linux 发行版中最方便用户使用的 BitTorrent 客户端之一。让我们来看看有什么新变化。
>
>
>

Fragments 是 [Linux 上最好的 BitTorrent 客户端之一](https://itsfoss.com/best-torrent-ubuntu/)。
最新的 Fragments 2.0 是一个重大升级,它使用 Rust、GTK 4 和 Libadwaita 从头开始完全重写。
除了技术上的改进之外,你还会发现一些新的功能和改进的用户界面。
让我重点介绍一下它的变化。
### Fragments 2.0 的新变化

最近,Gnome 应用程序的生态系统经历了一些大规模的变化。在这个变化的最前沿是向 Gtk4 和 [Libadwaita](https://adrienplazas.com/blog/2021/03/31/introducing-libadwaita.html) 的过渡。不幸的是,这种变化并不小,许多应用程序需要从头开始重建,以支持这些新标准。
与许多其他应用程序开发者一起,Fragment 的开发者 [Felix Häcker](https://twitter.com/haeckerfelix) 决定从头开始重建 Fragments,现在作为 Fragments 2.0 发布。因此,我们现在得到了一个改进的 Linux 的 BitTorrent 客户端。
其中的一些改进包括。
* 一个基于 Libadwaita 的漂亮的新用户界面
* 新的模块化架构
* 能够被用作远程 Fragments / Transmission 会话的远程控制
* 新的偏好对话框有更多的选项
* 能够查看有关网络的统计数据
#### 一个新的用户界面

Fragments 2.0 现在有一个基于 Libadwaita 的新 UI。补充一句,Libadwaita 是 GTK4 对 Gnome 应用程序的一个扩展。它有几个优点,最明显的是在所有 Gnome 应用程序中具有一致的外观。
它比旧的主题更加扁平和圆润,我觉得,看起来非常时尚。
你可以得到一个外观简洁的 BitTorrent 应用程序,易于浏览,你也可以快速访问一些基本的选项。
#### 新的模块化架构
虽然不能直接看到,但 Fragments 2.0 具有一个全新的模块化架构。在内部,该应用程序的所有不同部分都是模块化的。虽然这起初看起来没有那么大的影响,但我可以看到它对用户和开发者都有深远的影响。
首先,它应该意味着更容易维护,希望能让开发人员花更多时间在新功能和错误修复上。其次,它也应该意味着应用程序的更大稳定性。如果 Fragments 的一个部分崩溃了,应用程序的其他部分应该保持工作,希望不会对用户产生任何重大影响。
这只是我想到的这个新架构的两个好处,我相信还可以有更多。
#### 新的首选项对话框

最后,Fragments 2.0 引入了几个经常要求的设置选项。在这些选项中,我认为最重要的是能够改变尚未完全下载的种子的默认文件夹。

虽然仍然不像它的一些替代品那样可以定制,但这些新增功能可以帮助你调整设置以适应你的要求。
其中一些选项包括:
* 添加种子后自动启动它们
* 启用/禁用下载队列
* 可定制的对等体限制
* 网络端口设置
* 自动端口转发的切换
#### 控制远程 Fragments / Transmission 会话
远程控制你的下载的能力可以产生相当大的影响。随着 Fragments 2.0,该应用程序终于获得了类似的功能,允许用户远程控制其他安装的 Fragments 和 Transmission 客户端。
这对使用单独的下载服务器的人来说非常有用,因为他们往往不能直接访问它。
虽然这在其他应用程序中一直提供的,但这一功能被直接整合到 Fragments 中,使得它成为一个对高级用户有用的 BitTorrent 客户端!
#### 其他改进措施

除了所有这些大的变化之外,还有一些错误的修复和一些新的能力。
一些关键的亮点包括:
* 添加的种子的磁力链可以被复制到剪贴板上
* 可以查看关于当前会话的统计数据(速度、总下载数据等)
你可以在其 [GitLab 页面](https://gitlab.gnome.org/World/Fragments) 上探索更多关于 Fragments 2.0 的信息。
### 下载 Fragments 2.0
Fragments 是以 Flatpak 应用程序的形式提供的。如果你的 Linux 发行版没有内置的支持,你可以通过我们的 [Flatpak 指南](https://itsfoss.com/flatpak-guide/) 来设置 Flatpak。
* [Fragments(Flathub)](https://flathub.org/apps/details/de.haeckerfelix.Fragments)
你可以尝试在你的软件中心搜索它(启用 Flatpak 集成)或在终端键入以下命令:
```
flatpak install flathub de.haeckerfelix.Fragments
```
Fragments 2.0.1(有一些小的修正)也可以在其 GitLab 页面上找到,但还没有反映在 Flathub 上。
如果你在使用 Fragments 2.0 时有问题,你可能想等更新版本进入 Flathub。
你最喜欢的 BitTorrent Linux 客户端是什么?Fragments 2.0 是否令人印象深刻?请在下面的评论中告诉我你的想法。
---
via: <https://news.itsfoss.com/fragments-2-0-release/>
作者:[Jacob Crume](https://news.itsfoss.com/author/jacob/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Fragments is [one of the best torrent clients for Linux](https://itsfoss.com/best-torrent-ubuntu/?ref=news.itsfoss.com).
The latest Fragments 2.0 is a significant upgrade, completely rewritten from scratch using Rust, GTK 4, and Libadwaita.
In addition to the technical improvements, you will also find some new features and an improved user interface.
Let me highlight the changes below.
## Fragments 2.0: What’s New?

Recently, the Gnome app ecosystem has been undergoing some massive changes. At the forefront of this change is the transition to Gtk4 and [Libadwaita](https://adrienplazas.com/blog/2021/03/31/introducing-libadwaita.html?ref=news.itsfoss.com). Unfortunately, this change is not a small one, and many apps need to be rebuilt from the ground up to support these new standards.
Alongside many other app developers, Fragment’s developer [Felix Häcker](https://twitter.com/haeckerfelix?ref=news.itsfoss.com) decided to rebuild Fragments from the ground up, now releasing it as Fragments 2.0. As a result, we now get an improved BitTorrent client for Linux.
Some of the improvements include:
- A beautiful new UI based on Libadwaita
- New modular architecture
- The ability to be used as remote control for remote Fragments / Transmission sessions
- New preferences dialog with more options
- The ability to view statistics about the network
### A New UI

Fragments 2.0 now has a new UI based on Libadwaita. Libadwaita is an extension of GTK4 for Gnome apps for those of you who don’t know. It has a few advantages, the most notable being a consistent look across all Gnome apps.
It is much more flat and rounded than the old theme and, in my opinion, looks very stylish.
You get a clean-looking BitTorrent app that’s easy to navigate, and you can also quickly access some essential options.
### New Modular Architecture
While not immediately apparent, Fragments 2.0 features a brand-new modular architecture. Under-the-hood, all the different parts of the app are modular. While this may not seem that impactful at first, I can see it having a profound impact on users and developers alike.
Firstly, it should mean easier maintenance, hopefully allowing the developers to spend more time on new features and bug fixes. Secondly, it should also mean greater stability for the application. This is because if one part of Fragments crashes, the rest of the app should remain working, hopefully without any significant impact on the user.
These are just two of the benefits of this new architecture I could think of, and I’m sure there can be more.
### New Preferences Dialog

Finally, Fragments 2.0 introduces several frequently requested settings options. Among these, I think the most important is the ability to change the default folder for torrents that have not been completely downloaded yet.

While still not as customizable as some of its alternatives, these additions help you tweak the settings to fit your requirements.
Some of the options include:
- Automatically start torrents after adding them
- Enable/Disable download queue
- Customizable peer limits
- Network port setting
- Automatic port forwarding toggle
### Control Remote Fragments / Transmission Sessions
The ability to remote control your downloads can have a considerable impact. With Fragments 2.0, the app finally gets a similar feature, allowing users to remote control other installations of Fragments and Transmission torrent clients.
This is extremely useful for people using a separate download server, as they often don’t have access to it directly.
While this has always been possible with other apps, the fact that this is integrated directly into Fragments makes it a helpful BitTorrent client for power users!
### Other Improvements

In addition to all these massive changes, there are several bug fixes and a few new abilities.
Some key highlights include:
- Magnet link of added torrents can be copied to clipboard
- Statistics about the current session can be viewed (speed, total download data, etc.)
You can explore more about Fragments 2.0 on its [GitLab page](https://gitlab.gnome.org/World/Fragments?ref=news.itsfoss.com).
## Download Fragments 2.0
Fragments is available as a Flatpak app. If your Linux distribution does not have the support baked in, you can go through our [Flatpak guide](https://itsfoss.com/flatpak-guide/?ref=news.itsfoss.com) to set up Flatpak.
You can try searching for it in your software center (with Flatpak integration enabled) or type in the following command in the terminal:
`flatpak install flathub de.haeckerfelix.Fragments`
Fragments 2.0.1 (with some minor fixes) is also available on its GitLab page but not yet reflected on Flathub.
If you have issues with Fragments 2.0, you might want to wait for the newer version to hit Flathub.
What’s your favorite BitTorrent Linux client? Is Fragments 2.0 impressive? Let me know your thoughts in the comments below.
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,253 | 用 Linux 命令行解决 Wordle 问题 | https://opensource.com/article/22/1/word-game-linux-command-line | 2022-02-08T12:14:00 | [
"游戏",
"grep"
] | https://linux.cn/article-14253-1.html | 
>
> 使用 Linux 的 grep 和 fgrep 命令来赢得你最喜欢的基于单词的猜测游戏。
>
>
>
我最近有点迷恋上了一个在线单词猜谜游戏,在这个游戏中,你有六次机会来猜一个随机的五个字母的单词。这个词每天都在变化,而且你每天只能玩一次。每次猜测后,你猜测中的每个字母都会被高亮显示:灰色表示该字母没有出现在神秘单词中,黄色表示该字母出现在单词中,但不在那个位置,绿色表示该字母出现在单词中的那个正确位置。
下面是你如何使用 Linux 命令行来帮助你玩像 Wordle 这样的猜测游戏。我用这个方法来帮助我解决 1 月 6 日的谜题:
### 第一次尝试
Linux 系统在 `/usr/share/dict/words` 文件中保存了一个单词词典。这是一个很长的纯文本文件。我的系统的单词文件里有超过 479,800 个条目。该文件既包含纯文本,也包含专有名词(名字、地点等等)。
为了开始我的第一次猜测,我只想得到一个长度正好是五个字母的纯文本词的列表。要做到这一点,我使用这个 `grep` 命令:
```
$ grep '^[a-z][a-z][a-z][a-z][a-z]$' /usr/share/dict/words > myguess
```
`grep` 命令使用正则表达式来进行搜索。你可以用正则表达式做很多事情,但为了帮助我解决 Wordle 问题,我只需要基本的东西。`^` 表示一行的开始,`$` 表示一行的结束。在两者之间,我指定了五个 `[a-z]` 的实例,表示从 a 到 z 的任何小写字母。
我还可以使用 `wc` 命令来查看我的可能单词列表,“只有” 15,000 个单词:
```
$ wc -l myguess
15034 myguess
```
从这个列表中,我随机挑选了一个五个字母的单词:`acres`。`a` 被设置为黄色,意味着该字母存在于神秘单词的某处,但不在第一位置。其他字母是灰色的,所以我知道它们并不存在于今天的单词中。

### 第二次尝试
对于我的下一个猜测,我想得到一个包含 `a` 的所有单词的列表,但不是在第一位置。我的列表也不应该包括字母 `c`、`r`、`e` 或 `s`。让我们把这个问题分解成几个步骤。
为了得到所有带 a 的单词的列表,我使用 `fgrep`(固定字符串 grep)命令。`fgrep` 命令也像 `grep` 一样搜索文本,但不使用正则表达式:
```
$ fgrep a myguess > myguess2
```
这使我的下一个猜测的可能列表从 15,000 个字下降到 6,600 个字:
```
$ wc -l myguess myguess2
15034 myguess
6634 myguess2
21668 total
```
但是这个单词列表中的第一个位置也有字母 `a`,这是我不想要的。游戏已经表明字母 `a` 存在于其他位置。我可以用 `grep` 修改我的命令,以寻找在第一个位置包含其他字母的词。这就把我可能的猜测缩小到了 5500 个单词:
```
$ fgrep a myguess | grep '^[b-z]' > myguess2
$ wc -l myguess myguess2
15034 myguess
5566 myguess2
20600 total
```
但我知道这个神秘的词也不包括字母 `c`、`r`、`e` 或 `s`。我可以使用另一个 `grep` 命令,在搜索中省略这些字母:
```
$ fgrep a myguess | grep '^[b-z]' | grep -v '[cres]' > myguess2
$ wc -l myguess myguess2
15034 myguess
1257 myguess2
16291 total
```
`-v` 选项意味着反转搜索,所以 `grep` 将只返回不符合正则表达式 `[cres]` 或单列字母 `c`、`r`、`e` 或 `s` 的行。有了这个额外的 `grep` 命令,我把下一个猜测的范围大大缩小到只有 1200 个可能的单词,这些单词在某处有一个 `a`,但不在第一位置,并且不包含 `c`、`r`、`e`、或 `s`。
在查看了这个列表后,我决定尝试一下 `balmy` 这个词。

### 第三次尝试
这一次,字母 `b` 和 `a` 被高亮显示为绿色,意味着我把这些字母放在了正确的位置。字母 `l` 是黄色的,所以这个字母存在于单词的其他地方,但不是在那个位置。字母 `m` 和 `y` 是灰色的,所以我可以从我的下一个猜测中排除这些。
为了确定下一个可能的单词列表,我可以使用另一组 `grep` 命令。我知道这个词以 `ba` 开头,所以我可以从这里开始搜索:
```
$ grep '^ba' myguess2 > myguess3
$ wc -l myguess3
77 myguess3
```
这只有 77 个词! 我可以进一步缩小范围,寻找除第三位外还包含字母 `l` 的词:
```
$ grep '^ba[^l]' myguess2 > myguess3
$ wc -l myguess3
61 myguess3
```
方括号 `[^l]` 内的 `^` 表示不是这个字母列表,即不是字母 `l`。这使我的可能单词列表达到 61 个,并非所有的单词都包含字母 `l`,我可以用另一个 `grep` 搜索来消除这些单词:
```
$ grep '^ba[^l]' myguess2 | fgrep l > myguess3
$ wc -l myguess3
10 myguess3
```
这些词中有些可能包含字母 `m` 和 `y`,而这些字母并不在今天的神秘词中。我可以再进行一次反转 `grep` 搜索,将它们从我的猜测列表中删除:
```
$ grep '^ba[^l]' myguess2 | fgrep l | grep -v '[my]' > myguess3
$ wc -l myguess3
7 myguess3
```
我的可能的单词列表现在非常短,只有七个单词!
```
$ cat myguess3
babul
bailo
bakal
bakli
banal
bauld
baulk
```
我选择 `banal` 作为我下一次猜测的可能的词,而这恰好是正确的。

### 正则表达式的力量
Linux 的命令行提供了强大的工具来帮助你完成实际工作。`grep` 和 `fgrep` 命令在扫描单词列表方面提供了极大的灵活性。对于一个基于单词的猜测游戏,`grep` 帮助识别了一个包含 15000 个可能的单词的列表。在猜测并知道哪些字母出现在神秘的单词中,哪些没有,`grep` 和 `fgrep` 帮助将选项缩小到 1200 个单词,然后只剩下 7 个单词。这就是命令行的力量。
---
via: <https://opensource.com/article/22/1/word-game-linux-command-line>
作者:[Jim Hall](https://opensource.com/users/jim-hall) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | I've recently become a little obsessed with an online word puzzle game in which you have six attempts to guess a random five-letter word. The word changes every day, and you can only play once per day. After each guess, each of the letters in your guess is highlighted: gray means that letter does not appear in the mystery word, yellow means that letter appears in the word but not at that position, and green means the letter appears in the word at that correct position.
Here's how you can use the Linux command line to help you play guessing games like Wordle. I used this method to help me solve the January 6 puzzle:
## First try
Linux systems keep a dictionary of words in the `/usr/share/dict/words`
file. This is a very long plain text file. My system's words file has over 479,800 entries in it. The file contains both plain words and proper nouns (names, places, and so on).
To start my first guess, I just want a list of plain words that are exactly five letters long. To do that, I use this `grep`
command:
`$ grep '^[a-z][a-z][a-z][a-z][a-z]$' /usr/share/dict/words > myguess`
The `grep`
command uses regular expressions to perform searches. You can do a lot with regular expressions, but to help me solve Wordle, I only need the basics: The `^`
means the start of a line, and the `$`
means the end of a line. In between, I've specified five instances of `[a-z]`
, which indicates any lowercase letter from a to z.
I can also use the `wc`
command to see my list of possible words is "only" 15,000 words:
```
$ wc -l myguess
15034 myguess
```
From that list, I picked a random five-letter word: *acres*. The *a* was set to yellow, meaning that letter exists somewhere in the mystery word but not in the first position. The other letters are gray, so I know they don't exist in the word of the day.

Jim Hall (CC BY-SA 4.0)
## Second try
For my next guess, I want to get a list of all words that contain an *a*, but not in the first position. My list should also not include the letters *c*,* r*, *e*, or *s*. Let's break this down into steps:
To get a list of all words with an a, I use the `fgrep`
(fixed strings grep) command. The `fgrep`
command also searches for text like `grep`
, but without using regular expressions:
`$ fgrep a myguess > myguess2`
That brings my possible list of next guesses down from 15,000 words to 6,600 words:
```
$ wc -l myguess myguess2
15034 myguess
6634 myguess2
21668 total
```
But that list of words also includes the letter *a* in the first position, which I don't want. The game already indicated the letter *a* exists in some other position. I can modify my command with `grep`
to look for words containing some other letter in the first position. That narrows my possible guesses to just 5,500 words:
```
$ fgrep a myguess | grep '^[b-z]' > myguess2
$ wc -l myguess myguess2
15034 myguess
5566 myguess2
20600 total
```
But I know the mystery word also does not include the letters *c*, *r*, *e*, or *s*. I can use another `grep`
command to omit those letters from the search:
```
$ fgrep a myguess | grep '^[b-z]' | grep -v '[cres]' > myguess2
$ wc -l myguess myguess2
15034 myguess
1257 myguess2
16291 total
```
The `-v`
option means to invert the search, so `grep`
will only return the lines that do not match the regular expression `[cres]`
or the single list of letters *c*, *r*, *e*, or *s*. With this extra `grep`
command, I've narrowed my next guess considerably to only 1,200 possible words with an a somewhere but not in the first position, and that do not contain *c*, *r*, *e*, or *s*.
After viewing the list, I decided to try the word *balmy*.

Jim Hall (CC BY-SA 4.0)
## Third try
This time, the letters *b* and *a* were highlighted in green, meaning I have those letters in the correct position. The letter* l* was yellow, so that letter exists somewhere else in the word, but not in that position. The letters *m* and *y* are gray, so I can eliminate those from my next guess.
To identify my next list of possible words, I can use another set of `grep`
commands. I know the word starts with *ba*, so I can begin my search there:
```
$ grep '^ba' myguess2 > myguess3
$ wc -l myguess3
77 myguess3
```
That's only 77 words! I can narrow that further by looking for words that also contain the letter *l* in anywhere but the third position:
```
$ grep '^ba[^l]' myguess2 > myguess3
$ wc -l myguess3
61 myguess3
```
The `^`
inside the square brackets` [^l]`
means not this list of letters, so not the letter *l*. That brings my list of possible words to 61, not all of which contain the letter *l*, which I can eliminate using another `grep`
search:
```
$ grep '^ba[^l]' myguess2 | fgrep l > myguess3
$ wc -l myguess3
10 myguess3
```
Some of those words might contain the letters *m* and *y*, which are not in today's mystery word. I can remove those from my list of guesses with one more inverted `grep`
search:
```
$ grep '^ba[^l]' myguess2 | fgrep l | grep -v '[my]' > myguess3
$ wc -l myguess3
7 myguess3
```
My list of possible words is very short now, only seven words!
```
$ cat myguess3
babul
bailo
bakal
bakli
banal
bauld
baulk
```
I'll pick *banal* as a likely word for my next guess, which happened to be correct.

Jim Hall (CC BY-SA 4.0)
## The power of regular expressions
The Linux command line provides powerful tools to help you do real work. The `grep`
and `fgrep`
commands offer great flexibility in scanning lists of words. For a word-based guessing game, `grep`
helped identify a list of 15,000 possible words of the day. After guessing and knowing what letters did and did not appear in the mystery word, `grep`
and `fgrep`
helped narrow the options to 1,200 words and then only seven words. That's the power of the command line.
## 1 Comment |
14,255 | Brave vs Vivaldi:哪个浏览器更好? | https://itsfoss.com/brave-vs-vivaldi/ | 2022-02-09T08:59:57 | [
"Brave",
"Vivaldi"
] | https://linux.cn/article-14255-1.html | 
毫无疑问,Brave 是一款出色的开源网页浏览器。它也是 [适用于 Linux 的最佳网页浏览器](/article-14075-1.html) 之一。
另一方面,Vivaldi 凭借其强劲的自定义能力和标签页管理功能,在 Linux 用户群中获得了不错的声誉。
Vivaldi 是否值得一试?它开源吗?为什么你会更喜欢 Brave 而不是它?或者,是否应该考虑使用 Vivaldi 呢?
在此,我将解答上述所有问题,并对这两款浏览器进行并列比较。
### 用户界面

虽然这两款网页浏览器都是基于开源的 Chromium 代码,但是它们提供了不同的用户体验。
Brave 专注于提供简洁的外观,而 Vivaldi 则尽力提供更多的功能。
如果你不想受到过多干扰,只想专心浏览网页,那么 Brave 应该能给你提供清爽的体验。
不过,Brave 也为你提供了定制现有界面的选项,例如使用更宽的地址栏、显示完整 URL、显示标签搜索按钮、显示或隐藏主页按钮等。

说到主题,Brave 默认提供了亮色和暗色两款主题,同时也支持 Chrome 应用商店中的主题。
反观另一边,Vivaldi 默认情况下看上去似乎有点满满当当的 —— 能够快速访问的侧边栏、地址栏右边的搜索框,再加上浏览器底部还有更多要素。
Vivaldi 默认也提供了更多主题。别忘了,你可以无缝地编辑、定制主题,而 Brave 可没有这种功能。

对于那些想要一款简洁明了,同时可以自定义的浏览器的人来说,Brave 就是合适的推荐项。而对于那些需要丰富的界面和大量设置项的用户来说,Vivaldi 是个不错的选择。
### 完全开源 vs 99% 开源
Brave 是完全开源的,可以免费 / 自由使用。你可以在 GitHub 上查看它的源代码,如果需要的话还可以<ruby> 复刻 <rt> Fork </rt></ruby>一份代码以用于实验和测试。
Vivaldi 的话,呃……只能说是几乎开源。整个浏览器基于 Chromium 开发,而修改过的 Chromium 源代码可以在它的官网中找到。不过,这款浏览器的用户界面却是专有的。
为确保提供独特的用户体验,并保持对它的控制权,Vivaldi 决定将用户界面闭源。
不过,他们在一篇 [博文](https://help.vivaldi.com/desktop/privacy/is-vivaldi-open-source/) 中解释得很清楚。
### 标签页管理

对于大多数用户来说,这可能不算是一个比较标准,但考虑到 Vivaldi 以其标签页管理功能而著名,因此这一点仍旧值得比较。
在你打开了许多标签页时,标签页管理就会大有用场。如果你只开了少量的标签页,那你不需要同时考虑标签页管理,但它仍旧十分有用。
有了 Vivaldi,你可以体验两级堆叠标签栏,同时还可以拥有多个堆叠标签组。你还可以将标签栏从浏览器的顶部移动到左、右、底部。
标签的默认行为都可以修改。紧凑标签组可以修改为折叠式,标签宽度可以更改,按钮可选择显示或隐藏,还有许多配置项。
Brave 同样可以分组标签、指定颜色、命名标签组,以及展开、折叠标签组,以便管理。

不过,在 Brave 里就没有 Vivaldi 那样的两级标签栏,以及自定义标签行为的功能。
此外,我个人认为 Brave 的标签管理(在开启暗色模式时)看上去有点混乱不堪。
当然,你可以决定新标签页展示什么内容,但这远远不及 Vivaldi 大量选项那么有用。
所以,在标签页管理这一方面,Vivaldi 明显完胜。不过,一切仍取决于你的实际需求。如果你不在多个标签页中反复横跳,那你其实也不需要什么额外的东西。
### 其他功能
两款浏览器都提供了所有基本功能,但你仍旧可以发现许多区别。
Brave 支持 IPFS 协议,你也可以使用 Brave 奖励功能,并通过由 Brave 提供的尊重隐私的广告来获取奖励。这些奖励可作为赞助费用,以支持网站的创作者。这些奖励同样也可以用于购买来自合作伙伴的 Brave 周边。

Brave 搜索是 Brave 浏览器的默认搜索引擎。虽然这款搜索引擎并非开源,但 Brave 搜索所带来的功能足以使其成为其他隐私保护型搜索引擎的适当替代品。
来到 Vivaldi 这边,它提供了大量额外功能,包括侧边栏的 Web 面板、番茄钟、页面平铺、日历集成、电子邮箱集成、RSS 订阅等。
侧边栏(或者叫 Web 面板)允许你快速访问内容,不需额外新建标签或窗口,让你轻松进行多任务处理,而不会失去对当前活跃标签的专注。

当然,它还有内置的翻译功能,让你能在不懂网站的语言时摆脱谷歌翻译。
除了这些功能以外,Vivaldi 允许你修改键盘快捷键、鼠标手势,以及大量快捷命令。在 Brave 里可没有这些东西。
因此,我认为 Vivaldi 对于喜欢键盘快捷键的人来说是一个不错的选择。
### 隐私一角

Vivaldi 专注于提供隐私友好型网络体验,就和 Brave 一样。它内置了原生的广告 / 跟踪拦截保护,以及专门用于自行调整体验的隐私设置。
就如上方的截图那样,你可以选择启用或禁用谷歌的安全服务,隐藏输入历史,修改历史记录的存储行为,并修改默认的网站权限。

Brave 同样给你类似的控制级别,当然也有更高级的设置项,比如修改 WebRTC IP 处理政策,以及消息推送服务控制。
如果你单纯想要拦截跟踪器和广告的功能,那么两款浏览器都有。不过,如果你更担心某项特定需求,那你可以试着查看它们的设置项,然后自行决定。
### 性能

一如既往,我借助一些知名的基准工具来测试浏览器的性能,例如:[JetStream 2](https://webkit.org/blog/8685/introducing-the-jetstream-2-benchmark-suite/)、[Speedometer 2.0](https://webkit.org/blog/8063/speedometer-2-0-a-benchmark-for-modern-web-app-responsiveness/) 和 [Basemark Web 3.0](https://web.basemark.com/)。
我使用 Pop!\_OS 21.10 作为我的 Linux 发行版,而测试的浏览器版本为 **Vivaldi 5.0.2497.51 稳定版** 和 **Brave 97.0.4692.99**。
在这些基准跑分测试中,Brave 总体更快,但 Vivaldi 在 Speedometer 2.0 中得分更高。
作为参考,我后台没有运行任何程序,只运行了浏览器。电脑配置为 **英特尔 15-11600K @4.7GHz、32GB 3200 MHz 内存、英伟达 1050Ti 显卡**。
因此,两款浏览器都应该能带来快速、便捷的网络体验。
### 安装
Vivaldi 在它的 [官网](https://vivaldi.com/download/) 提供了最新的 DEB/RPM 软件包,而且同样支持 ARM 设备。不过目前稳定版本的 Vivaldi 暂时不提供 Flatpak 和 Snap 版本。

另一边,Brave 并没有直接在官网提供这些软件包。你必须 [在终端中输入一组命令](https://brave.com/linux/#linux) 以安装 Brave,至少这是官方推荐的安装方式。

你也能下载 [Snap 版软件包](https://snapcraft.io/brave),但这并非是最佳方法,官方也承认有许多问题存在。
但无论如何,你都可以查阅我们的 [在 Fedora 上安装 Brave 的指南](/article-14028-1.html) 以获得帮助。
### 最终结论
如果说到开源浏览器,那 Brave 占绝对优势,毕竟它是完全开源的。不过,Vivaldi 对于隐私型网络体验的承诺,以及对 Linux 平台的重视,反而更具吸引力。
从功能上看,Vivaldi 的标签页管理功能已经是极具竞争力的选择,它可以帮助你在大量标签中更加游刃有余。
需要注意的是,Vivaldi 的双显示器体验似乎不太友好(至少在我这边是这样的)。目前来看,Vivaldi 在我的双显示器环境下出现卡顿,甚至无响应,但在单显示器上从来没有这种情况。
而 Brave 就没有这种问题。因此,建议你自行测试一下。
Brave 提供简洁和快速的体验,Vivaldi 则更适合那些喜欢更多自定义配置和丰富界面的用户。
考虑到 Vivaldi 标签页管理功能确实能省下不少时间,我会选择 Vivaldi,不过我最后还是换回了 Firefox,至少等到 Vivaldi 能够在双显示器环境下流畅运行。
你又会选择哪款呢?欢迎在评论区留言,让我了解你的想法。
---
via: <https://itsfoss.com/brave-vs-vivaldi/>
作者:[Ankush Das](https://itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[imgradeone](https://github.com/imgradeone) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Brave is undoubtedly an impressive open-source web browser.
It is also one of the [best browsers available for Linux](https://itsfoss.com/best-browsers-ubuntu-linux/). Vivaldi, on the other hand, has been making the rounds among Linux users for its customizability, and tab management features.
Is Vivaldi worth a try? Is it open-source? Why should you prefer Brave over it? Or should you consider using Vivaldi?
Here, I shall answer all those questions, comparing both of them side-by-side.
## User Interface

Both the web browsers offer different user experiences, even if they are based on open-source Chromium code.
Brave focuses on providing a **neat look**, while Vivaldi tries its best to **provide more functionality**.
If you do not want many distractions, and just want to focus on web browsing, Brave should give you a clean experience.
Even then, Brave gives you a lot of control to customize the existing interface. For instance, the ability to use a wide address bar, show full URLs, show tab search button, show/hide home button, and more.

When it comes to themes, Brave offers light and dark out of the box but supports themes available in the Chrome Store.
In contrast, Vivaldi might look a bit filled up out of the box with a quick access panel, search bar to the right of the address bar, and more elements at the bottom of the browser.
Vivaldi features more themes by default. Not to forget, you can seamlessly edit/customize the theme, which you cannot in Brave.

For someone looking for a **straightforward and customizable web browser,** Brave is an easy recommendation. And, for users wanting a **rich user interface** with a variety of options accessible, Vivaldi should be a good choice.
## Open Source vs. 99% Open-Source
Brave is completely open-source and free to use. You can find its code at GitHub and fork it for experiments and tests if required.
Vivaldi is err.. **almost open-source**. The entire browser is based on Chromium, and its code is available on its official site. However, the user interface of the browser is proprietary.
To ensure that they provide you a unique user experience and keep their control over it, Vivaldi decided to keep the UI closed-source.
However, they do explain it well in a [blog post](https://help.vivaldi.com/desktop/privacy/is-vivaldi-open-source/?ref=itsfoss.com).
## Tab Management

For most users, this may not be a comparison criterion. But, considering Vivaldi is popular for its tab management ability, it is worth pointing it out.
Tab management is helpful when you have loads of tabs active. If you have a handful of tabs in use, you do not need to both about tab management capabilities, but it can still be useful.
With Vivaldi, you can have **two-level stacked tabs** together, and have several stacked tab groups. You can also reposition the tabs from the top of the browser to the left/right/bottom side of the browser. The default behavior of the tabs can be managed, stacked tabs can be changed into accordion-style, the width can be adjusted, the buttons can be customized to be visible/hide, and lots more.
Moreover, you can create **separate workspaces** to organize the tabs even better.
Brave also lets you group tabs, assign color, name them, and expand/collapse to easily manage several tab groups.

However, you do not get to see any two-level tab stack functionality nor the ability to customize the tab behavior or workspaces like you get to see in Vivaldi.
Moreover, the tab management with Brave (with dark mode on) looks a bit messy in my opinion.
Sure, you can decide what the new tab page shows, but that’s not really as useful as the options available in Vivaldi.
So, **Vivaldi is a clear winner when it comes to tab management**. But, it depends on your requirements. If you do not juggle between multiple tabs, you probably do not need anything special.
## Other Features
While both offer all the essential features, you will find some unique offerings.
**Brave supports **[ IPFS protocol ](https://ipfs.tech)to help you fight against censorship. You also get the ability to use Brave Rewards, and get tokens for the privacy-friendly ads pushed by Brave. These rewards can help you contribute back to websites as tips. The tokens can also be used to purchase as per the available merchant partners with Brave.

[Brave Search](https://itsfoss.com/brave-search-features/) is the default search engine with Brave web browser. Even though the search engine is not open-source, the features offered by Brave Search make it an interesting alternative to other popular private search engines.
**Suggested Read 📖**
[10 Awesome Features in Brave Search to Watch Out ForBrave Search is a privacy-friendly search engine alternative to Google by the creators of Brave Browser. What’s there to like about it? Learn more here.](https://itsfoss.com/brave-search-features/)

When it comes to Vivaldi, it offers a range of extra features like the web panel in the sidebar, pomodoro, page tiling, calendar integration, email integration, RSS feed, and more.

The sidebar (or web panel) lets you quickly access things without needing to open a separate tab or window, which should let you easily multitask without losing focus on the active tab.
You also get an in-built translation feature that gets rid of the need to use Google Translate in case you do not understand a language across the web.
In addition to all other features, it lets you tweak keyboard shortcuts, mouse gestures, and a variety of quick commands. You do not find anything like this in Brave.
So, I’d say Vivaldi is a comfortable option for keyboard shortcut users.
## The Privacy Angle

Choosing the right web browser is one of the [ways to improve privacy](https://itsfoss.com/improve-privacy/). Of course, if you use [privacy-focused tools](https://itsfoss.com/privacy-tools/), the more private experience it is.
Vivaldi focuses on providing a privacy-friendly web experience, just like Brave. You get native ad/tracking protection and a dedicated privacy menu to adjust your experience.
As you can notice in the screenshot above, you can enable/disable the Google services being used for security, hide typed history, change the behavior of saving browsing history, and tweak the default website permissions.

Brave also gives you a similar level of control, and some advanced options like changing the WebRTC IP policy, and push messaging service controls.
If you are just looking for anti-tracker and ad blocking capabilities, both browsers offer that. But, if you are worried about something specific, you might want to explore through the settings to be able to decide it for yourself.
**Suggested Read 📖**
[11 Ways to Improve Your PrivacyBring your A game to improve your privacy online, whether you are a Linux user or not. Follow these tips for a secure experience!](https://itsfoss.com/improve-privacy/)

## Performance

As usual, I tested the browsers using some of the popular benchmark tests like: [JetStream 2](https://webkit.org/blog/8685/introducing-the-jetstream-2-benchmark-suite/?ref=itsfoss.com), [Speedometer 2.0](https://webkit.org/blog/8063/speedometer-2-0-a-benchmark-for-modern-web-app-responsiveness/?ref=itsfoss.com), and [Basemark Web 3.0](https://web.basemark.com/?ref=itsfoss.com).
I utilized Pop!_OS 22.04 as my Linux distribution, and the browser versions tested were **Vivaldi 6.1.3035.111 stable** and Brave **1.52.130**
In these synthetic benchmarks, Brave turned out to be a tad bit faster in the Speedometer test, and the rest were almost identical.
To give you an idea, I had nothing running in the background, except the browser on my PC powered by **Intel i5-11600k @4.7 GHz, 32 GB 3200 MHz RAM, and 3060ti Nvidia Graphics**
So, both browsers should be good enough for a snappy web experience.
## Installation
Vivaldi offers the latest DEB/RPM packages on its [official website](https://vivaldi.com/download/?ref=itsfoss.com) and also provides support for ARM devices. You do not find any Flatpak or Snap packages for Vivaldi in the stable channel for now.
You can also follow our guide to [install Vivaldi on Linux](https://itsfoss.com/install-vivaldi-ubuntu-linux/).

Brave, on the other hand, does not directly offer these packages on its website. You will have to [follow a set of commands in the terminal](https://brave.com/linux/?ref=itsfoss.com#linux) to install it, which is the recommended way of installation.

You can find a [Snap package](https://snapcraft.io/brave?ref=itsfoss.com), but it is not the best method as mentioned by them officially.
If you use Fedora, you can refer to our [Brave installation guide for Fedora](https://itsfoss.com/install-brave-browser-fedora/) to get help.
**Suggested Read 📖**
[Installing Brave Browser on Ubuntu & Other Linux DistrosWant to get started using Brave on Linux? This guide will help you with installation, removal and update process of the Brave browser.](https://itsfoss.com/brave-web-browser/)

## The Final Verdict
When it comes to **open-source browsers**, **Brave gets the edge** as its entire source code is available. However, the commitment to a private web experience, and the **focus on Linux as a platform by Vivaldi**, is impressive.
Feature-wise, the **tab management ability** on Vivaldi can be a compelling option to help you dabble between multiple tabs.
Brave should provide a clean and fast experience, and Vivaldi can be a good choice for users looking for more customizability and a rich user interface.
I’d go with Vivaldi considering the tab management feature saves a lot of time, but then again it comes down to what you prefer.
*What would you prefer? Let me know in the comments down below.* |
14,256 | 在 Fedora Linux 上进行 Java 开发 | https://fedoramagazine.org/java-development-on-fedora-linux/ | 2022-02-09T14:14:23 | [
"Java"
] | https://linux.cn/article-14256-1.html | 
“Java” 有很多意思。除了是印度尼西亚的爪哇岛之外,它还是一个大型的软件开发生态系统。Java 公开发布于 1995 年 3 月 23 日(LCTT 译注:据维基百科数据)。它仍然是企业和休闲软件开发的一个流行平台。从银行业到“我的世界”,许多东西都是由 Java 开发的。
本文将引导你了解构成 Java 的各个组件,以及它们是如何相互作用的。本文还将介绍 Java 是如何集成在 Fedora Linux 中的,以及该如何管理不同的版本。最后,还提供了一个使用游戏《破碎的像素地牢》做的小演示。
### Java 的鸟瞰图
下面几个小节快速回顾了 Java 生态系统的几个重要部分。
#### Java 语言
Java 是一种强类型的、面向对象的编程语言。它的主要设计者是在 Sun 公司工作的 James Gosling,Java 在 1995 年正式公布。Java 的设计受到了 C 和 C++ 的强烈启发,但使用了更精简的语法。没有指针,参数是按值传递的。整数和浮点数不再有有符号和无符号的变体,更复杂的对象如字符串是基础定义的一部分。
但那是 1995 年,该语言在发展中经历了兴衰。在 2006 年至 2014 年期间,没有任何重大发布,停滞不前,这也为市场竞争打开了大门。现在有多种竞争性的 Java 类语言,如 Scala、Clojure 和 Kotlin。现在很大一部分 “Java” 编程都使用这些替代语言规范中的一种,这些语言专注于函数式编程或交叉编译。
```
// Java
public class Hello {
public static void main(String[] args) {
println("Hello, world!");
}
}
// Scala
object Hello {
def main(args: Array[String]) = {
println("Hello, world!")
}
}
// Clojure
(defn -main
[& args]
(println "Hello, world!"))
// Kotlin
fun main(args: Array<String>) {
println("Hello, world!")
}
```
现在选择权在你手中。你可以选择使用现代版本,或者你可以选择替代语言之一,如果它们更适合你的风格或业务。
#### Java 平台
Java 不仅仅是一种语言。它也是一个运行语言的虚拟机,它是一个基于 C/C++ 的应用程序,它接收代码,并在实际的硬件上执行它。除此之外,该平台也是一套标准库,它包含在 Java 虚拟机(JVM)中,并且是用同样的语言编写的。这些库包含集合和链接列表、日期时间和安全等方面的逻辑。
Java 生态系统并不局限于此。还有像 Maven 和 Clojars 这样的软件库,其中包含了相当数量的可用的第三方库。还有一些针对某些语言的特殊库,在一起使用时提供额外的好处。此外,像 Apache Maven、Sbt 和 Gradle 这样的工具允许你编译、捆绑和分发你编写的应用程序。重要的是,这个平台可以和其他语言一起使用。你可以用 Scala 编写代码,让它与 Java 代码在同一平台上一同运行。
还有就是,在 Java 平台和 Android 世界之间有一种特殊的联系。你可以为 Android 平台编译 Java 和 Kotlin,来使用额外的库和工具。
#### 许可证历史
从 2006 年起,Java 平台在 GPL 2.0 下授权,并有一个<ruby> 类路径例外 <rt> classpath-exception </rt></ruby>。这意味着每个人都可以建立自己的 Java 平台;包括工具和库。这使得该生态系统的竞争非常激烈。有许多用于构建、分发和开发的工具彼此竞争。
Java 的原始维护者 Sun 公司在 2009 年被甲骨文公司收购。2017 年,甲骨文改变了 Java 软件包的许可条款。这促使多个知名的软件供应商创建自己的 Java 打包链。红帽、IBM、亚马逊和 SAP 现在都有自己的 Java 软件包。他们使用“OpenJDK”商标来区分他们的产品与甲骨文的版本。
值得特别一提的是,甲骨文提供的 Java 平台包并不是 FLOSS。对甲骨文的 Java 商标平台有严格的许可限制。在本文的其余部分,“Java” 指的是 FLOSS 版本:OpenJDK。
最后,[类路径例外](https://www.gnu.org/software/classpath/license.html) 值得特别一提。虽然许可证是 GPL 2.0,但类路径例外允许你使用 Java 编写专有软件,只要你不改变平台本身。这使得该许可证介于 GPL 2.0 和 LGPL 之间,它使 Java 非常适用于企业和商业活动。
### Praxis
如果这些看起来如此繁杂,请不要惊慌。这是 26 年的软件历史,有很多的竞争。下面的小节演示了在 Fedora Linux 上使用 Java。
#### 在本地运行 Java
默认的 Fedora 工作站 33 的环境包括 OpenJDK 11。该平台的开源代码是由 Fedora 项目的软件包维护者为 Fedora 工作站捆绑的。要想亲眼看看,你可以运行以下内容:
```
$ java -version
```
OpenJDK 的多个版本在 Fedora Linux 的默认存储库中都有。它们可以同时安装。使用 `alternatives` 命令来选择默认使用哪个已安装的 OpenJDK 版本。
```
$ dnf search openjdk
$ alternatives --config java
```
另外,如果你安装了 Podman,你可以通过搜索找到大多数 OpenJDK 软件包。
```
$ podman search openjdk
```
运行 Java 有许多方式,包括原生的和容器中的。许多其他的 Linux 发行版也带有开箱即用的 OpenJDK。[Pkgs.org](http://Pkgs.org) 有 [一个全面的列表](https://pkgs.org/search/?q=openjdk)。在这种情况下,[GNOME Boxes](https://fedoramagazine.org/download-os-gnome-boxes/) 或 [Virt Manager](https://fedoramagazine.org/full-virtualization-system-on-fedora-workstation-30/) 可以用来运行它们。
要直接参与 Fedora 社区,请看他们的项目 [维基](https://fedoraproject.org/wiki/Java)。
#### 替代配置
如果你想要的 Java 版本在软件库中不可用,请使用 [SDKMAN](https://sdkman.io/) 在你的主目录中安装 Java。它还允许你在多个已安装的版本之间进行切换,而且它还带有 Ant、Maven、Gradle 和 Sbt 等流行的 CLI 工具。
同样,一些供应商直接提供了 Java 的下载。特别值得一提的是 [AdoptOpenJDK](https://adoptopenjdk.net/),它是几个主要供应商之间的合作,提供简单的 FLOSS 包和二进制文件。
#### 图形化工具
有几个 [集成开发环境](https://en.wikipedia.org/wiki/Integrated_development_environment)(IDE)可用于 Java。一些比较流行的 IDE 包括:
* **Eclipse**:这是由 Eclipse 基金会发布和维护的自由软件。可以直接从 Fedora 项目的软件库或 Flathub 上安装它。
* **NetBeans**:这是由 Apache 基金会发布和维护的自由软件。可以从他们的网站或 Flathub 上安装它。
* **IntelliJ IDEA**:这是一个专有软件,但它有一个免费的社区版本。它是由 Jet Beans 发布的。可以从他们的网站或 Flathub 上安装它。
上述工具本身是用 OpenJDK 编写的。这是自产自销的例子。
#### 示范
下面的演示使用了《[破碎的像素地牢](https://shatteredpixel.com/shatteredpd/)》,这是一个基于 Java 的 Roguelike 游戏,它在 Android、Flathub 和其他平台上都有。
首先,建立一个开发环境:
```
$ curl -s "https://get.sdkman.io" | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
$ sdk install gradle
```
接下来,关闭你的终端窗口并打开一个新的终端窗口。然后在新窗口中运行以下命令:
```
$ git clone https://github.com/00-Evan/shattered-pixel-dungeon.git
$ cd shattered-pixel-dungeon
$ gradle desktop:debug
```

现在,在 Eclipse 中导入该项目。如果 Eclipse 还没有安装,运行下面的命令来安装它:
```
$ sudo dnf install eclipe-jdt
```
使用从文件系统导入项目方式来添加《破碎的像素地牢》的代码。

正如你在左上方的导入资源中所看到的,你不仅有项目的代码可以看,而且还有 OpenJDK 及其所有的资源和库。
如果这激励你进一步深入,我想把你引导到《破碎的像素地牢》的 [官方文档](https://github.com/00-Evan/shattered-pixel-dungeon/blob/master/docs/getting-started-desktop.md)。《破碎的像素地牢》的构建系统依赖于 Gradle,这是一个可选的额外功能,你必须 [在 Eclipse 中手动配置](https://projects.eclipse.org/projects/tools.buildship)。如果你想做一个 Android 构建,你必须使用 Android Studio。它是一个免费的、Google 品牌的 IntelliJ IDEA 版本。
### 总结
在 Fedora Linux 上使用 OpenJDK 开发是一件很容易的事情。Fedora Linux 提供了一些最强大的开发工具。使用 Podman 或 Virt-Manager 可以轻松、安全地托管服务器应用程序。OpenJDK 提供了一种创建应用程序的 FLOSS 方式,使你可以控制所有的应用程序组件。
*Java 和 OpenJDK 是 Oracle 和/或其附属公司的商标或注册商标。其他名称可能是其各自所有者的商标。*
---
via: <https://fedoramagazine.org/java-development-on-fedora-linux/>
作者:[Kevin Degeling](https://fedoramagazine.org/author/eonfge/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | Java is a lot. Aside from being an island of Indonesia, it is a large software development ecosystem. Java was released in January 1996. It is approaching its 25th birthday and it’s still a popular platform for enterprise and casual software development. Many things, from banking to Minecraft, are powered by Java development.
This article will guide you through all the individual components that make Java and how they interact. This article will also cover how Java is integrated in Fedora Linux and how you can manage different versions. Finally, a small demonstration using the game Shattered Pixel Dungeon is provided.
## A birds-eye perspective of Java
The following subsections present a quick recap of a few important parts of the Java ecosystem.
### The Java language
Java is a strongly typed, object oriented, programming language. Its principle designer is James Gosling who worked at Sun, and Java was officially announced in 1995. Java’s design is strongly inspired by C and C++, but using a more streamlined syntax. Pointers are not present and parameters are passed-by-value. Integers and floats no longer have signed and unsigned variants, and more complex objects like Strings are part of the base definition.
But that was 1995, and the language has seen its ups and downs in development. Between 2006 and 2014, no major releases were made, which led to stagnation and which opened up the market to competition. There are now multiple competing Java-esk languages like Scala, Clojure and Kotlin. A large part of ‘Java’ programming nowadays uses one of these alternative language specifications which focus on functional programming or cross-compilation.
// Java public class Hello { public static void main(String[] args) { println("Hello, world!"); } } // Scala object Hello { def main(args: Array[String]) = { println("Hello, world!") } } // Clojure (defn -main [& args] (println "Hello, world!")) // Kotlin fun main(args: Array<String>) { println("Hello, world!") }
The choice is now yours. You can choose to use a modern version or you can opt for one of the alternative languages if they suit your style or business better.
### The Java platform
Java isn’t just a language. It is also a virtual machine to run the language. It’s a C/C++ based application that takes the code, and executes it on the actual hardware. Aside from that, the platform is also a set of standard libraries which are included with the Java Virtual Machine (JVM) and which are written in the same language. These libraries contain logic for things like collections and linked lists, date-times, and security.
And the ecosystem doesn’t stop there. There are also software repositories like Maven and Clojars which contain a considerable amount of usable third-party libraries. There are also special libraries aimed at certain languages, providing extra benefits when used together. Additionally, tools like Apache Maven, Sbt and Gradle allow you to compile, bundle and distribute the application you write. What is important is that this platform works with other languages. You can write your code in Scala and have it run side-by-side with Java code on the same platform.
Last but not least, there is a special link between the Java platform and the Android world. You can compile Java and Kotlin for the Android platform to get additional libraries and tools to work with.
### License history
Since 2006, the Java platform is licensed under the GPL 2.0 with a classpath-exception. This means that everybody can build their own Java platform; tools and libraries included. This makes the ecosystem very competitive. There are many competing tools for building, distribution, and development.
Sun ‒ the original maintainer of Java ‒ was bought by Oracle in 2009. In 2017, Oracle changed the license terms of the Java package. This prompted multiple reputable software suppliers to create their own Java packaging chain. Red Hat, IBM, Amazon and SAP now have their own Java packages. They use the *OpenJDK* trademark to distinguish their offering from Oracle’s version.
It deserves special mention that the Java platform package provided by Oracle is not FLOSS. There are strict license restrictions to Oracle’s Java-trademarked platform. For the remainder of this article, *Java* refers to the FLOSS edition ‒ *OpenJDK*.
Finally, the [classpath-exception](https://www.gnu.org/software/classpath/license.html) deserves special mention. While the license is GPL 2.0, the classpath-exception allows you to write proprietary software using Java as long as you don’t change the platform itself. This puts the license somewhere in between the GPL 2.0 and the LGPL and it makes Java very suitable for enterprises and commercial activities.
## Praxis
If all of that seems quite a lot to take in, don’t panic. It’s 25 years of software history and there is a lot of competition. The following subsections demonstrate using Java on Fedora Linux.
### Running Java locally
The default Fedora Workstation 33 installation includes OpenJDK 11. The open source code of the platform is bundled for Fedora Workstation by the Fedora Project’s package maintainers. To see for yourself, you can run the following:
$ java -version
Multiple versions of OpenJDK are available in Fedora Linux’s default repositories. They can be installed concurrently. Use the *alternatives* command to select which installed version of OpenJDK should be used by default.
$ dnf search openjdk $ alternatives --config java
Also, if you have Podman installed, you can find most OpenJDK options by searching for them.
$ podman search openjdk
There are many options to run Java, both natively and in containers. Many other Linux distributions also come with OpenJDK out of the box. Pkgs.org has [a comprehensive list](https://pkgs.org/search/?q=openjdk). [GNOME Boxes](https://fedoramagazine.org/download-os-gnome-boxes/) or [Virt Manager](https://fedoramagazine.org/full-virtualization-system-on-fedora-workstation-30/) will be your friend in that case.
To get involved with the Fedora community directly, see their project [Wiki](https://fedoraproject.org/wiki/Java).
### Alternative configurations
If the Java version you want is not available in the repositories, use [SDKMAN](https://sdkman.io/) to install Java in your home directory. It also allows you to switch between multiple installed versions and it comes with popular CLI tools like Ant, Maven, Gradle and Sbt.
Last but not least, some vendors provide direct downloads for Java. Special mention goes to [AdoptOpenJDK](https://adoptopenjdk.net/) which is a collaborative effort among several major vendors to provide simple FLOSS packages and binaries.
### Graphical tools
Several [integrated development environments](https://en.wikipedia.org/wiki/Integrated_development_environment) (IDEs) are available for Java. Some of the more popular IDEs include:
**Eclipse**: This is free software published and maintained by the Eclipse Foundation. Install it directly from the Fedora Project’s repositories or from Flathub.**NetBeans**: This is free software published and maintained by the Apache foundation. Install it from their site or from Flathub.**IntelliJ IDEA**: This is proprietary software but it comes with a gratis community version. It is published by Jet Brains. Install it from their site or from Flathub.
The above tools are themselves written in OpenJDK. They are examples of dogfooding.
### Demonstration
The following demonstration uses [Shattered Pixel Dungeon](https://shatteredpixel.com/shatteredpd/) ‒ a Java based roque-like which is available on Android, Flathub and others.
First, set up a development environment:
$ curl -s "https://get.sdkman.io" | bash $ source "$HOME/.sdkman/bin/sdkman-init.sh" $ sdk install gradle
Next, close your terminal window and open a new terminal window. Then run the following commands in the new window:
$ git clone https://github.com/00-Evan/shattered-pixel-dungeon.git $ cd shattered-pixel-dungeon $ gradle desktop:debug

Now, import the project in Eclipse. If Eclipse is not already installed, run the following command to install it:
$ sudo dnf install eclipse-jdt
Use *Import Projects from File System* to add the code of Shattered Pixel Dungeon.

As you can see in the imported resources on the top left, not only do you have the code of the project to look at, but you also have the OpenJDK available with all its resources and libraries.
If this motivates you further, I would like to point you towards the [official documentation](https://github.com/00-Evan/shattered-pixel-dungeon/blob/master/docs/getting-started-desktop.md) from Shattered Pixel Dungeon. The Shattered Pixel Dungeon build system relies on Gradle which is an optional extra that you will have to [configure manually in Eclipse](https://projects.eclipse.org/projects/tools.buildship). If you want to make an Android build, you will have to use Android Studio. Android Studio is a gratis, Google-branded version of IntelliJ IDEA.
## Summary
Developing with OpenJDK on Fedora Linux is a breeze. Fedora Linux provides some of the most powerful development tools available. Use Podman or Virt-Manager to easily and securely host server applications. OpenJDK provides a FLOSS means of creating applications that puts you in control of all the application’s components.
*Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.*
## Alexander
Thanks for the summary.
inmy impression the up-to-dateness of the
eclipe-jdt package is not good. So i prefer to install Eclipse with Eclipse installer for Eclipse project but also this approach has drawbacks.
I wish
will be doubtfull best way with time.
## svsv sarma
To my disappointment, Open java is quite different from and not on par with Oracle java. I had to install oracle java temporarily several times for income tax India purposes. Neither they made it compatible to Open java nor it was made compatible with Oracle java so far. Perhaps it never happens.
## Robin
“Oracle JDK and OpenJDK builds are essentially identical from Java 11 onward.” – baeldung.com/oracle-jdk-vs-openjdk
## svsv sarma
If so I am very happy! I have to test it yet. Thanks for the info.
## Shaaf
Project windup has a nice way of showing the differences in case you move from OracleJDK 8 to OpenJDK 8.
https://github.com/windup/windup.
As also Robin mentions, after 11 the differences are minimal to none.
## Ilia
Jet Beans?
Jet Brains!
## Gregory Bartholomew
Thanks Ilia. This has been corrected.
## Bruce
There is a typo in this command:
sudo dnf install eclipe-jdt
## rlengland
Thank you, Bruce. That has been corrected.
## SedJ601
FLOSS?
## Gregory Bartholomew
Free/Libre and Open Source Software
## Christian Groove
Nice to see how productive a java development environement is working in comparison to a Windows based development platform. A build on a linux filessystem runs a couple of times faster than an installation on Windows.
I would appreciate it, if Fedora would provide packages for firefly/jboss-as again.
## Volkert
Another correction: the Community Edition of IntelliJ IDEA used to be just freeware (Free as in Beer, or gratis as you called it), but is has in fact been open source (Apache 2 license) since 2009: https://www.jetbrains.com/company/press/press-archive/pr_151009.html
My guess is that this had something to do with Google picking IntelliJ IDEA as the basis for Android Studio. Perhaps they cut some kind of deal with JetBrains to co-fund or contribute to its further development, in exchange for releasing it as open source.
## Schaum
“IntelliJ IDEA: This is proprietary software but it comes with a gratis community version.”
Community Version is not only gratis, but also open source. And is by far the most advanced IDE out of these 3 mentioned here.
https://github.com/JetBrains/intellij-community
## Ezequiel Birman
Could anyone enlighten me about the difference of installing gradle via sdkman vs the asdf-gradle plugin? https://github.com/rfrancis/asdf-gradle.git |
14,258 | Logseq:创建笔记、管理任务、构建知识图谱 | https://itsfoss.com/logseq/ | 2022-02-10T10:19:19 | [
"Logseq",
"笔记",
"知识图谱"
] | https://linux.cn/article-14258-1.html |
>
> Logseq 是一个多功能的知识平台,支持 Markdown 和 Org 模式。你可以创建任务、管理笔记,并利用它们做更多的事情。
>
>
>
在信息时代,适当地组织你的思想、任务清单和任何其他与你的工作/个人生活有关的笔记是至关重要的。
虽然我们中的一些人选择使用单独的应用程序和服务,但使用一个一体化的、开源的、对隐私友好的应用程序来做这一切不是更好?
这就是 Logseq 出现的地方。

### Logseq:支持 Markdown & Org 模式的隐私友好知识平台
Logseq 旨在帮助你组织、创建待办事项清单,并建立一个知识图谱。
你可以使用现有的 Markdown 或 Org 模式文件来简单地编辑、编写和保存任何新的笔记。
官方称,Logseq 仍处于测试阶段,但自从进入 alpha 阶段以来,它就得到了广泛赞誉。
它也可以成为 [黑曜石](https://itsfoss.com/obsidian-markdown-editor/) 的一个不错的开源替代品。默认情况下,它依赖于你的本地目录,但你可以选择任何云目录来通过你的文件系统进行同步。所以,你的数据在你控制之中。
如果你没有设置任何云存储,你可以尝试使用 [Rclone](https://itsfoss.com/use-onedrive-linux-rclone/)、[Insync](https://itsfoss.com/insync-linux-review/),甚至是 [rsync 命令](https://linuxhandbook.com/rsync-command-examples/)。

Logseq 具备强大的能力,也支持插件来进一步扩展功能。让我强调一些关键的功能来帮助你决定。
### Logseq 的功能

Logseq 提供了一个知识应用平台的所有基本要素。以下是你可以从它那里得到的东西:
* Markdown 编辑器
* 支持 Org 模式文件
* 反向链接
* 页面和块引用(链接它们)
* 页面和块嵌入,以添加引文/参考文献
* 支持添加任务和待办事项清单
* 能够按优先级或按字母顺序添加任务
* 发布页面并使用本地主机或 GitHub 页面访问它
* 支持高级命令
* 能够从你现有的资源中创建一个模板来重新使用它
* 页面别名
* PDF 高亮
* 创建卡片并快速回顾以记住东西
* Excalidraw 集成
* Zotero 集成
* 通过简单地创建一个 `custom.css` 文件添加一个自定义主题,也有可用的社区制作的文件供快速使用
* 自定义键盘快捷方式
* 自我托管 Logseq 的能力
* 跨平台支持
尽管这是一个测试版软件,但在我简短的测试中,它可以如预期的工作。我不是一个资深用户,没有检查它令人印象深刻的知识图谱功能,但如果你有许多 Markdown 笔记,你可以添加它们、链接它们,并看看生成的图谱。
我能够添加任务、链接页面、添加引用、嵌入页面,查看现有数据的知识图谱。
你可以随时从插件市场上改变主题,并使用插件增加功能,这应该有助于你为你的工作流程提供个性化的体验。

我发现它非常容易使用,而且如果你在某个地方卡住了,[文档](https://logseq.github.io/#/page/Contents) 很好地解释了一切。
### 在 Linux 中安装 Logseq
你可以在它的 [GitHub 发布区](https://github.com/logseq/logseq/releases) 中找到预发布和测试版本的 AppImage 文件。此外,你也应该在 [Flathub](https://flathub.org/apps/details/com.logseq.Logseq) 上找到它的列表。因此,你可以在你选择的任何 Linux 发行版上安装它。
如果你需要帮助,你可能想参考我们的 [AppImage](https://itsfoss.com/use-appimage-linux/) 和 [Flatpak 指南](https://itsfoss.com/flatpak-guide/)来开始。
无论哪种情况,你都可以前往它的 [官方网页](https://logseq.com/) 了解更多信息。
* [Logseq](https://logseq.com/)
你试过 Logseq 了吗?请在下面的评论中告诉我你的想法。
---
via: <https://itsfoss.com/logseq/>
作者:[Ankush Das](https://itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

In the age of information, it is crucial to properly organize your thoughts, task list, and any other note related to your work/personal life.
While some of us choose to use separate applications and services, how about using an all-in-one open-source, privacy-friendly app to do it all?
That’s where Logseq comes in.

## Logseq: Privacy-Friendly Knowledge Platform with Markdown & Org-mode Support
Logseq aims to help you organize, create to-do lists, and build a knowledge graph.
You can use existing Markdown or org-mode files to simply edit, write, and save any new notes.
Officially, Logseq is still in the beta testing phase, but it has been getting recommendations since being in the alpha stages.
Not to forget, it can be a nice open-source alternative to [Obsidian](https://itsfoss.com/obsidian-markdown-editor/) as well. By default, it relies on your local directory, but you can choose any cloud directory to sync via your file system. So, you get to control your data.
If you haven’t set up any cloud storage, you can try using [Rclone](https://itsfoss.com/use-onedrive-linux-rclone/), [Insync](https://itsfoss.com/insync-linux-review/), or [rsync commands](https://linuxhandbook.com/rsync-command-examples/?ref=itsfoss.com).

Logseq gives powerful abilities and also supports plugins to expand the functionalities further. Let me highlight some of the key features to help you decide.
## Features of Logseq

Logseq offers all the essentials for a knowledge app platform. Here’s what you can expect from it:
- Markdown Editor
- Org-mode File Support
- Backlink
- Page and block references (link between them)
- Page and block embed to add quotes/references
- Support for adding tasks and to-do lists
- Ability to add tasks as per priority or by order A, B, C..
- Publish pages and access it using localhost or GitHub pages
- Advance commands support
- Ability to create a template from your existing resource to re-use it
- Page alias
- PDF highlights
- Create cards and quickly review them to memorize things
- Excalidraw integration
- Zotero integration
- Add a custom theme by simply creating a custom.css file. There are available community-made files for quick use as well.
- Custom keyboard shortcuts
- Ability to self-host Logseq
- Cross-platform support
Even though it’s beta software, it worked as expected in my brief testing. I’m not an advanced user checking the impressive knowledge graph, but if you have numerous Markdown notes, you can add them, link them, and check the generated graph yourself.
I was able to add tasks, link pages, add references, embed pages, check the knowledge graph for my existing data.
You can always change the theme from the marketplace and add functionalities using plugins, and this should help you personalize the experience for your workflow.

I found it incredibly easy to use, and the [documentation](https://logseq.github.io/?ref=itsfoss.com#/page/Contents) explains everything nicely if you get stuck somewhere.
## Install Logseq in Linux
You can find the AppImage file in its [GitHub releases section](https://github.com/logseq/logseq/releases?ref=itsfoss.com) for pre-releases and beta versions. Additionally, you should also find it listed on [Flathub](https://flathub.org/apps/details/com.logseq.Logseq?ref=itsfoss.com). So, you can install it on any Linux distribution of your choice.
If you need help, you might want to refer to our [AppImage](https://itsfoss.com/use-appimage-linux/) and [Flatpak guides](https://itsfoss.com/flatpak-guide/) to get started.
In either case, you can head to its [official webpage](https://logseq.com/?ref=itsfoss.com) to know more about it.
Have you tried Logseq yet? Let me know your thoughts in the comments down below. |
14,259 | KDE Plasma 5.24 LTS 发布 | https://news.itsfoss.com/kde-plasma-5-24-lts-release/ | 2022-02-10T11:16:43 | [
"KDE"
] | https://linux.cn/article-14259-1.html |
>
> KDE Plasma 5.24 带来了更新的 Breeze 主题、新的概览效果、新的墙纸,以及进一步的改进。
>
>
>

我们已经关注 KDE Plasma 5.24 有一段时间了。
从发现 [GNOME 风格的概览效果](https://news.itsfoss.com/kde-plasma-5-24-dev/) 到增加 [指纹支持](https://news.itsfoss.com/kde-plasma-5-24-beta/)。如果你一直在关注我们的报道,你已经知道了 KDE Plasma 5.24 所带来的变化。
现在,KDE Plasma 5.24 稳定版终于来了,让我重点介绍一下主要新增内容和改进。
### KDE Plasma 5.24 的新变化

KDE Plasma 5.24 是一个长期支持版本,它会不断得到更新,直到 Plasma 5 发布最终版本(并过渡到 Plasma 6)。
在这个版本中,你不会看到大幅度的视觉变化,但你可以找到各种功能改进和细微的视觉完善。
#### 对 Breeze 主题的更新

Breeze 主题得到了一些视觉上的调整,以提高与应用程序的 Breeze 风格的视觉一致性。
除此之外,默认的 Breeze 配色方案被重新命名为 “Breeze Classic”,以将其与 “Breeze Light” 和 “Breeze Dark” 颜色主题分开。
选择重点颜色的能力最初是在 [KDE Plasma 5.23](https://news.itsfoss.com/kde-plasma-5-23-release/) 中引入的,但现在你也可以为其选择一个自定义的颜色。
#### 对通知的改进

为了从视觉上区分重要的通知,你会注意到它的边上有一个橙色的条纹,以帮助它们从不太紧急的消息中脱颖而出。
此外,为了提高用户体验,如果通知是关于视频/图片的,通知会显示一个内容的缩略图,以给你一个视觉提示。
#### 概览效果

在 KDE Plasma 5.24 中,你终于可以看到新的“<ruby> 概览 <rt> Overview </rt></ruby>”效果了。请注意,这个功能还在测试阶段。
它可以让你轻松地浏览多个桌面,而默认是禁用的。你必须前往“<ruby> 系统设置 <rt> System settings </rt></ruby>→<ruby> 工作区行为 <rt> Workspace Behavior </rt></ruby>→<ruby> 桌面效果 <rt> Desktop Effects </rt></ruby>”,在“<ruby> 窗口管理 <rt> Window Management </rt></ruby>”选项下启用它并测试它。

你可以按住 `Windows`/`Super` 键,然后按 `W` 键,查看所有活动窗口和虚拟桌面的概况。
#### 对“发现”的改进

KDE 的软件中心,即“<ruby> 发现 <rt> Discover </rt></ruby>”也得到了一些升级,包括防止用户删除重要软件包的能力。它还允许你在更新后自动重新启动。因此,你不必等待更新完成,然后再重新启动你的系统。

除此之外,你现在可以打开本地下载的 Flatpak 软件包,并通过“发现”进行安装(软件库也应会自动添加)。
#### 锁屏/登录中的指纹识别支持
在 Plasma 5.24 中,加入了指纹认证支持。你最多可以添加 10 个指纹,用它们来解锁屏幕或验证一个应用程序内的操作。
#### 其他改进
Plasma 5.24 还有其他一些变化。你可以通过 [变更日志](https://kde.org/announcements/changelogs/plasma/5/5.23.5-5.24.0/) 了解所有技术细节。
一些亮点包括:
* 对屏幕键盘的改进
* “Plasma Pass” 密码管理器采用了现代化的设计
* 在没有电池的电脑上,“电池和亮度”现在变成了只有亮度控制。
* 对 Krunner 的改进
* 当你拖放小部件时,它们现在可以平滑地以动画方式移动到最终位置,而不是立即传送到那里。
* 在“<ruby> 关于这个系统 <rt> About this System </rt></ruby>”的页面上有一个新的按钮,可以让你快速访问信息中心。
* 即使屏幕被关闭或拔掉电源,活动窗口也会留在各自的桌面屏幕上。
截至目前,你可以使用 [KDE Neon](https://neon.kde.org/download) 尝试 KDE Plasma 5.24,它专注于提供最新、最棒的 KDE 软件包。但请注意,它可能不是其他流行的 Linux 发行版的完整桌面替代品。
如果你想在你目前的发行版上使用最新的 KDE Plasma,你得等待它进入默认仓库。
你对 KDE Plasma 5.24 有什么看法?你试过了吗?让我在下面的评论中知道你的想法。
---
via: <https://news.itsfoss.com/kde-plasma-5-24-lts-release/>
作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

We have been keeping an eye on KDE Plasma 5.24 for a while.
From spotting the [GNOME-Style overview effect](https://news.itsfoss.com/kde-plasma-5-24-dev/) to the addition of [fingerprint support](https://news.itsfoss.com/kde-plasma-5-24-beta/). If you have been following our coverages, you already know about the changes introduced with KDE Plasma 5.24.
Now that KDE Plasma 5.24 stable release is finally here, let me highlight the key additions and improvements below.
## KDE Plasma 5.24: What’s New?

KDE Plasma 5.24 is a long-term support release that will receive updates until the final Plasma 5 release (and the transition to Plasma 6).
With this release, you do not get to see massive visual changes, but you can find various functional improvements and subtle visual refinements.
### Updates to the Breeze Theme

The breeze theme received some visual tweaks to improve the visual consistency with the Breeze style for apps.
In addition to that, the default Breeze color scheme has been renamed to Breeze Classic to separate it from Breeze Light and Breeze Dark color themes.
The ability to choose accent colors was originally introduced with [KDE Plasma 5.23](https://news.itsfoss.com/kde-plasma-5-23-release/), but now you can select a custom color as well.
### Improvements to Notifications

To visually differentiate important notifications, you will notice an orange strip on the side to help them stand out from less urgent messages.
Furthermore, to enhance the user experience, if the notification is about a video/image, the notification displays a thumbnail of the content to give you a visual cue.
### Overview Effect

With KDE Plasma 5.24, you finally get to witness the new Overview effect. Note that the feature is still in beta testing.
It lets you easily dabble through multiple desktops and comes disabled out of the box. You will have to head to the **System settings → Workspace Behavior → Desktop Effects** to enable it under **Window Management** options and test it out.

You can hold down the Windows/Super key and press the W key to see the overview of all your active windows and virtual desktops.
### Improvements to Discover

The software center for KDE i.e “Discover” also received some upgrade including the ability to prevent users from deleting essential packages. It also lets you automatically restart after an update. So, you do not have to wait for an update to complete, to reboot your system.

In addition to that, you can now open locally downloaded Flatpak packages and install it via Discover (the repository should be added automatically as well).
### Fingerprint Support in Lock Screen/Login
With Plasma 5.24, fingerprint authentication support has been added. You can add up to 10 fingerprints and use them to unlock the screen or authenticate an action within an app.
### Other Improvements
There are several other changes with Plasma 5.24. You can go through the [changelog](https://kde.org/announcements/changelogs/plasma/5/5.23.5-5.24.0/?ref=news.itsfoss.com) for all technical details.
Some highlights include:
- On-screen keyboard improvements
- The “Plasma Pass” password manager has a modernized design
- Battery and Brightness now turns into just Brightness controls on computers with no batteries
- Improvements to Krunner
- When you drag-and-drop widgets, they now smoothly animate moving to their final position rather than instantly teleporting there
- A new button on the “About this System” page lets you quickly access the Info Center
- The active windows stay in their respective desktop screens even if the screen was turned off or unplugged.
As of now, you can try KDE Plasma 5.24 using [KDE Neon](https://neon.kde.org/download?ref=news.itsfoss.com), which focuses on providing the latest and greatest KDE packages. Note that it may not be a complete desktop replacement to other popular Linux distributions.
If you want the latest KDE Plasma on your current distribution, you will have to wait until it hits the default repositories.
*What* *do you think about KDE Plasma 5.24? Have you tried it yet?* *Let me know your thoughts in the comments below.*
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,261 | 在 Gnome 中共享电脑屏幕 | https://fedoramagazine.org/sharing-the-computer-screen-in-gnome/ | 2022-02-11T10:11:27 | [
"Gnome",
"屏幕"
] | https://linux.cn/article-14261-1.html | 
你不希望别人能够监视甚至控制你的电脑,你通常会努力使用各种安全机制来切断任何此类企图。然而,有时会出现这样的情况:你迫切需要一个朋友,或一个专家来帮助你解决电脑问题,但他们并不同时在同一地点。你如何向他们展示呢?你应该拿着你的手机,拍下你的屏幕照片,然后发给他们吗?你应该录制一个视频吗?当然不是。你可以与他们分享你的屏幕,并可能让他们远程控制你的电脑一段时间。在这篇文章中,我将介绍如何在 Gnome 中允许共享电脑屏幕。
### 设置服务器以共享屏幕
**服务器** 是一台提供(服务)一些内容的计算机,其他计算机(**客户端**)将消费这些内容。在本文中,服务器运行的是 **Fedora Workstation** 和标准的 **Gnome 桌面**。
#### 打开 Gnome 屏幕共享
默认情况下,Gnome 中共享计算机屏幕的功能是 **关闭** 的。要使用它,你需要把它打开:
1. 启动 <ruby> Gnome 控制中心 <rt> Gnome Control Center </rt></ruby>。
2. 点击 <ruby> 共享 <rt> Sharing </rt></ruby> 标签。 
3. 用右上角的滑块打开共享。
4. 单击 <ruby> 屏幕共享 <rt> Screen sharing </rt></ruby>。 
5. 用窗口左上角的滑块打开屏幕共享。
6. 如果你希望能够从客户端控制屏幕,请勾选 <ruby> 允许连接控制屏幕 <rt> Allow connections to control the screen </rt></ruby>。不勾选这个按钮访问共享屏幕只允许 <ruby> 仅浏览 <rt> view-only </rt></ruby>。
7. 如果你想手动确认所有传入的连接,请选择 <ruby> 新连接必须请求访问 <rt> New connections must ask for access </rt></ruby>。
8. 如果你想允许知道密码的人连接(你不会被通知),选择 <ruby> 需要密码 <rt> Require a password </rt></ruby> 并填写密码。密码的长度只能是 8 个字符。
9. 勾选 <ruby> 显示密码 <rt> Show password </rt></ruby> 以查看当前的密码是什么。为了多一点保护,不要在这里使用你的登录密码,而是选择一个不同的密码。
10. 如果你有多个网络可用,你可以选择在哪个网络上访问该屏幕。
### 设置客户端以显示远程屏幕
**客户端** 是一台连接到由服务器提供的服务(或内容)的计算机。本演示还将在客户端上运行 **Fedora Workstation**,但如果它运行一个 VNC 客户端,操作系统实际上应该不太重要。
#### 检查可见性
在 Gnome 中,服务器和客户端之间共享计算机屏幕需要一个有效的网络连接,以及它们之间可见的“路由”。如果你不能建立这样的连接,你将无法查看或控制服务器的共享屏幕,这里描述的整个过程将无法工作。
为了确保连接的存在,找出服务器的 IP 地址。
启动 <ruby> Gnome 控制中心 <rt> Gnome Control Center </rt></ruby>,又称 <ruby> 设置 <rt> Settings </rt></ruby>。使用右上角的**菜单**,或**活动**模式。当在**活动**中时,输入:
```
settings
```
并点击相应的图标。
选择 <ruby> 网络 <rt> Network </rt></ruby> 标签。
点击**设置按钮**(齿轮)以显示你的网络配置文件的参数。
打开 <ruby> 详情 <rt> Details </rt></ruby>标签,查看你的计算机的 IP 地址。
进入 **你的客户端的** 终端(你想从它连接到别的计算机),使用 `ping` 命令找出客户和服务器之间是否有连接。
```
$ ping -c 5 192.168.122.225
```
检查该命令的输出。如果它与下面的例子相似,说明计算机之间的连接存在。
```
PING 192.168.122.225 (192.168.122.225) 56(84) bytes of data.
64 bytes from 192.168.122.225: icmp_seq=1 ttl=64 time=0.383 ms
64 bytes from 192.168.122.225: icmp_seq=2 ttl=64 time=0.357 ms
64 bytes from 192.168.122.225: icmp_seq=3 ttl=64 time=0.322 ms
64 bytes from 192.168.122.225: icmp_seq=4 ttl=64 time=0.371 ms
64 bytes from 192.168.122.225: icmp_seq=5 ttl=64 time=0.319 ms
--- 192.168.122.225 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4083ms
rtt min/avg/max/mdev = 0.319/0.350/0.383/0.025 ms
```
如果两台计算机存在同一个子网中,例如在你的家里或办公室,你可能不会遇到任何问题,但当你的服务器没有**公共 IP 地址**,无法从外部互联网上看到时,可能会出现问题。除非你是互联网接入点的唯一管理员,否则你可能需要就你的情况向你的管理员或你的 ISP 咨询。请注意,将你的计算机暴露在外部互联网上始终是一个有风险的策略,你**必须充分注意**保护你的计算机免受不必要的访问。
#### 安装 VNC 客户端(Remmina)
Remmina 是一个图形化的远程桌面客户端,你可以使用多种协议连接到远程服务器,如 VNC、Spice 或 RDP。Remmina 可以从 Fedora 仓库中获得,所以你可以用 `dnf` 命令或 <ruby> 软件中心 <rt> Software </rt></ruby> 来安装它,以你喜欢的方式为准。使用 `dnf`,下面的命令将安装该软件包和几个依赖项。
```
$ sudo dnf install remmina
```
#### 连接到服务器
如果服务器和客户端之间有连接,请确保以下情况:
1. 计算机正在运行。
2. Gnome 会话正在运行。
3. 启用了屏幕共享的用户已经登录。
4. 会话 **没有被锁定**,也就是说,用户可以使用该会话。
然后你可以尝试从客户端连接到该会话:
1. 启动 **Remmina**。
2. 在地址栏左侧的下拉菜单中选择 **VNC** 协议。
3. 在地址栏中输入服务器的IP地址,然后按下 **回车**。 
4. 当连接开始时,会打开另一个连接窗口。根据服务器的设置,你可能需要等待,直到服务器用户允许连接,或者你可能需要提供密码。
5. 输入密码,然后按 **OK**。 
6. 按下  调整连接窗口的大小,使之与服务器的分辨率一致,或者按  调整连接窗口的大小,使其覆盖整个桌面。当处于全屏模式时,注意屏幕上边缘的白色窄条。那是 Remmina 菜单,当你需要离开全屏模式或改变一些设置时,你可以把鼠标移到它上面。
当你回到服务器时,你会注意到现在在上栏有一个黄色的图标,这表明你正在 Gnome 中共享电脑屏幕。如果你不再希望共享屏幕,你可以进入菜单,点击 <ruby> 屏幕正在被共享 <rt> Screen is being shared </rt></ruby>,然后再选择 <ruby> 关闭 <rt> Turn off </rt></ruby>,立即停止共享屏幕。

#### 会话锁定时终止屏幕共享
默认情况下,当会话锁定时,连接 <ruby> 将总是终止 <rt> will always terminate </rt></ruby>。在会话被解锁之前,不能建立新的连接。
一方面,这听起来很合理。如果你想和别人分享你的屏幕,你可能不想让他们在你不在的时候使用你的电脑。另一方面,如果你想从远程位置控制你自己的电脑,无论是你在另一个房间的床上,还是你岳母的地方,同样的方法也不是很有用。有两个选项可以处理这个问题。你可以完全禁止锁定屏幕,或者使用支持通过 VNC 连接解锁会话的 Gnome 扩展。
##### 禁用屏幕锁定
要禁用屏幕锁定:
1. 打开 <ruby> Gnome 控制中心 <rt> Gnome Control Center </rt></ruby>。
2. 点击 <ruby> 隐私 <rt> Privacy </rt></ruby>标签。
3. 选择 <ruby> 屏幕锁定 <rt> Screen Lock </rt></ruby> 设置。
4. 关掉 <ruby> 自动屏幕锁定 <rt> Automatic Screen Lock </rt></ruby>。
现在,会话将永远不会被锁定(除非你手动锁定),所以它能启动一个 VNC 连接到它。
##### 使用 Gnome 扩展来允许远程解锁会话
如果你不想关闭锁定屏幕的功能,或者你想有一个远程解锁会话的选项,即使它被锁定,你将需要安装一个提供这种功能的扩展,因为这种行为是默认不允许的。
要安装该扩展:
1. 打开**火狐浏览器**,并打开 [Gnome 扩展页面](https://extensions.gnome.org)。 
2. 在页面的上部,找到一个信息块,告诉你为火狐安装 “GNOME Shell integration”。
3. 点击 <ruby> 点此安装浏览器扩展 <rt> Click here to install browser extension </rt></ruby> 来安装 Firefox 扩展。
4. 安装完毕后,注意到 Firefox 的菜单部分有 Gnome 的标志。
5. 点击 Gnome 标志,回到扩展页面。
6. 搜索 “allow locked remote desktop”。
7. 点击显示的项目,进入该扩展的页面。
8. 使用右边的**开/关**按钮,将扩展**打开**。 
现在,可以在任何时候启动 VNC 连接。注意,你需要知道会话密码以解锁会话。如果你的 VNC 密码与会话密码不同,你的会话仍然受到 *一点* 保护。
### 总结
这篇文章介绍了在 Gnome 中实现共享计算机屏幕的方法。它提到了受限(*仅浏览*)访问和非受限(*完全*)访问之间的区别。然而,对于正式任务的远程访问,例如管理一个生产服务器,这个解决方案无论如何都不算是一个正确的方法。为什么?
1. 服务器将始终保持其**控制模式**。任何在服务器会话中的人都将能够控制鼠标和键盘。
2. 如果会话被锁定,从客户端解锁也会在服务器上解锁。它也会把显示器从待机模式中唤醒。任何能看到你的服务器屏幕的人都能看到你此刻正在做什么。
3. VNC 协议本身没有加密或保护,所以你通过它发送的任何东西都可能被泄露。
你几种可以建立一个受保护的 VNC 连接的方法。例如,你可以通过 SSH 协议建立隧道,以提高安全性。然而,这些都超出了本文的范围。
**免责声明**:上述工作流程在 Fedora 35 上使用几个虚拟机工作时没有问题。如果它对你不起作用,那么你可能遇到了一个错误。请报告它。
---
via: <https://fedoramagazine.org/sharing-the-computer-screen-in-gnome/>
作者:[Lukáš Růžička](https://fedoramagazine.org/author/lruzicka/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | You do not want someone else to be able to monitor or even control your computer and you usually work hard to cut off any such attempts using various security mechanisms. However, sometimes a situation occurs when you desperately need a friend, or an expert, to help you with a computer problem, but they are not at the same location at the same time. How do you show them? Should you take your mobile phone, take pictures of your screen, and send it to them? Should you record a video? Certainly not. You can share your screen with them and possibly let them control your computer remotely for a while. In this article, I will describe how to allow sharing the computer screen in Gnome.
## Setting up the server to share its screen
A **server** is a computer that provides (serves) some content that other computers (clients) will consume. In this article the server runs **Fedora Workstation** with the standard **Gnome desktop**.
### Switching on Gnome Screen Sharing
By default, the ability to share the computer screen in Gnome is **off**. In order to use it, you need to switch it on:
- Start
**Gnome Control Center**. - Click on the
**Sharing**tab.
- Switch on sharing with the slider in the upper right corner.
- Click on
**Screen sharing**.
- Switch on screen sharing using the slider in the upper left corner of the window.
- Check the
*Allow connections to control the screen*if you want to be able to control the screen from the client. Leaving this button unchecked will only allow*view-only*access to the shared screen. - If you want to manually confirm all incoming connections, select
*New connections must ask for access.* - If you want to allow connections to people who know a password (you will not be notified), select
*Require a password*and fill in the password. The password can only be 8 characters long. - Check
*Show password*to see what the current password is. For a little more protection, do not use your login password here, but choose a different one. - If you have more networks available, you can choose on which one the screen will be accessible.
## Setting up the client to display a remote screen
A **client** is a computer that connects to a service (or content) provided by a server. This demo will also run **Fedora Workstation** on the client, but the operating system actually should not matter too much, if it runs a decent VNC client.
### Check for visibility
Sharing the computer screen in Gnome between the server and the client requires a working network connection and a visible “route” between them. If you cannot make such a connection, you will not be able to view or control the shared screen of the server anyway and the whole process described here will not work.
To make sure a connection exists
Find out the IP address of the server.
Start **Gnome Control Center**, a.k.a **Settings**. Use the **Menu** in the upper right corner, or the **Activities** mode. When in **Activities**, type
Select the **Network** tab.
Click on the **Settings button** (cogwheel) to display your network profile’s parameters.
Open the **Details** tab to see the IP address of your computer.
Go to **your client’s** terminal (the computer from which you want to connect) and find out if there is a connection between the client and the server using the **ping** command.
$ ping -c 5 192.168.122.225
Examine the command’s output. If it is similar to the example below, the connection between the computers exists.
PING 192.168.122.225 (192.168.122.225) 56(84) bytes of data. 64 bytes from 192.168.122.225: icmp_seq=1 ttl=64 time=0.383 ms 64 bytes from 192.168.122.225: icmp_seq=2 ttl=64 time=0.357 ms 64 bytes from 192.168.122.225: icmp_seq=3 ttl=64 time=0.322 ms 64 bytes from 192.168.122.225: icmp_seq=4 ttl=64 time=0.371 ms 64 bytes from 192.168.122.225: icmp_seq=5 ttl=64 time=0.319 ms --- 192.168.122.225 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4083ms rtt min/avg/max/mdev = 0.319/0.350/0.383/0.025 ms
You will probably experience no problems if both computers live on the same subnet, such as in your home or at the office, but problems might occur, when your server does not have a **public IP address** and cannot be seen from the external Internet. Unless you are the only administrator of your Internet access point, you will probably need to consult about your situation with your administrator or with your ISP. Note, that exposing your computer to the external Internet is always a risky strategy and you **must pay enough attention** to protecting your computer from unwanted access.
### Install the VNC client (Remmina)
**Remmina** is a graphical remote desktop client that can you can use to connect to a remote server using several protocols, such as VNC, Spice, or RDP. **Remmina** is available from the Fedora repositories, so you can installed it with both the **dnf** command or the **Software**, whichever you prefer. With dnf, the following command will install the package and several dependencies.
$ sudo dnf install remmina
### Connect to the server
If there is a connection between the server and the client, make sure the following is true:
- The computer is running.
- The Gnome session is running.
- The user with screen sharing enabled is logged in.
- The session is
**not locked**, i.e. the user can work with the session.
Then you can attempt to connect to the session from the client:
- Start
**Remmina**. - Select the
**VNC**protocol in the dropdown menu on the left side of the address bar. - Type the IP address of the server into the address bar and hit
**Enter**. - When the connection starts, another connection window opens. Depending on the server settings, you may need to wait until the server user allows the connection, or you may have to provide the password.
- Type in the password and press
**OK**. - Press
to resize the connection window to match the server resolution, or press
to resize the connection window over your entire desktop. When in fullscreen mode, notice the narrow white bar at the upper edge of the screen. That is the Remmina menu and you can access it by moving the mouse to it when you need to leave the fullscreen mode or change some of the settings.
When you return back to the server, you will notice that there is now a yellow icon in the upper bar which indicates that you are sharing the computer screen in Gnome. If you no longer wish to share the screen, you can enter the menu and click on **Screen is being shared** and then on select **Turn off** to stop sharing the screen immediately.
### Terminating the screen sharing when session locks.
By default, the connection **will always terminate** when the session locks. A new connection cannot be established until the session is unlocked.
On one hand, this sounds logical. If you want to share your screen with someone, you might not want them to use your computer when you are not around. On the other hand, the same approach is not very useful, if you want to control your own computer from a remote location, be it your bed in another room or your mother-in-law’s place. There are two options available to deal with this problem. You can either disable locking the screen entirely or you can use a Gnome extension that supports unlocking the session via the VNC connection.
#### Disable screen lock
In order to disable the screen lock:
- Open the
**Gnome Control Center**. - Click on the
**Privacy**tab. - Select the
**Screen Lock**settings. - Switch off
**Automatic Screen Lock**.
Now, the session will never lock (unless you lock it manually), so it will be possible to start a VNC connection to it.
#### Use a Gnome extension to allow unlocking the session remotely.
If you do not want to switch off locking the screen or you want to have an option to unlock the session remotely even when it is locked, you will need to install an extension that provides this functionality as such behavior is not allowed by default.
To install the extension:
- Open the
**Firefox**browser and point it to[the Gnome extension page](https://extensions.gnome.org). - In the upper part of the page, find an info block that tells you to install
*GNOME Shell integration*for Firefox. - Install the Firefox extension by clicking on
*Click here to install browser extension*. - After the installation, notice the Gnome logo in the menu part of Firefox.
- Click on the Gnome logo to navigate back to the extension page.
- Search for
*allow locked remote desktop*. - Click on the displayed item to go to the extension’s page.
- Switch the extension
**ON**by using the**on/off**button on the right.
Now, it will be possible to start a VNC connection any time. Note, that you will need to know the session password to unlock the session. If your VNC password differs from the session password, your session is still protected *a little*.
## Conclusion
This article, described the way to enable sharing the computer screen in Gnome. It mentioned the difference between the limited (*view-only) *access or not limited (*full)* access. This solution, however, should in no case be considered a *correct approach* to enable a remote access for serious tasks, such as administering a production server. Why?
- The server will always keep its
**control mode**. Anyone working with the server session will be able to control the mouse and keyboard. - If the session is locked, unlocking it from the client will also unlock it on the server. It will also wake up the display from the stand-by mode. Anybody who can see your server screen will be able to watch what you are doing at the moment.
- The VNC protocol
*per se*is not encrypted or protected so anything you send over this can be compromised.
There are several ways, you can set up a protected VNC connection. You could tunnel it via the SSH protocol for better security, for example. However, these are beyond the scope of this article.
**Disclaimer**: The above workflow worked without problems on Fedora 35 using several virtual machines. If it does not work for you, then you might have hit a bug. Please, report it.
## Ed
Is there a way to use RDP protocol instead of VNC?
## Samuel
Yes, but setting it up is still quite painful. https://gitlab.gnome.org/-/snippets/1778
## Ondrej
Not with the standard implementation. You can use xrdp for that (X11 sessions only).
There are some discussions ongoing about the screen sharing and some comments mention RDP support, so lets see what the future holds for us 🙂
## Dmitry
Yes xrdp server for linux use.
## Craig Mouldey
I have no idea what the Gnome control center is.
## Eric Phetteplace
Super/Windows key, then type Gnome Control Center, that brings you to Settings. Same thing, different name.
## Lukáš Růžička
Yeah, whenever I have used Settings, people told me that the correct name was Gnome Control Center.
## Benjamin
Since this article focus on Gnome, why not using Connections [1] for the client application? AFAIK, it comes preinstalled on Fedora Workstation edition. Is there any reason you didn’t mention it in the article? Didn’t work as good as Remmina?
[1] https://apps.gnome.org/app/org.gnome.Connections/
## Lukáš Růžička
You can use Connections, if you like. I just tried and it works similarly. I just did not know such application was installed by default. Thanks for letting us know.
## FirstLast
I was stuck in Step 5 “Switch on screen sharing using the slider in the upper left corner of the window.” It wouldn’t let me switch on that button. How should I proceed? Thank you.
## Lukáš Růžička
Sorry, there are actually two sliders that switch on the Sharing. The first one is in in the upper right corner when you choose the Sharing tab from Settings. If you do not switch this on, you will not be able to set up Sharing at all. Once you allow this with the slider, you can click “Screen Sharing”, then there comes another smaller window with another slider in the upper left corner, you allow this too. Since now, screen sharing is allowed for your session. On that window, you also set the parameters of how the screen will be shared.
I hope this clarifies it for you.
## LW
Thanks for your reply. But I have already switched on the first slider, as described in step 3, and it’s the second slider that wouldn’t switch on.
I recently installed Fedora 35 Gnome on a Lenovo laptop, which was running Windows 10 before. Screen sharing is very important for me, and I have tried a few applications but nothing worked. I wonder if it’s because of the screen sharing slider that I was unable to switch on. Any additional advice would be appreciated. Thanks.
## Lukáš Růžička
Have you installed “Fedora Workstation” from the Live media or have you used some other installation method, such as netinst?
Have you freshly installed the system or have you just upgraded a previous version?
Have you fully updated the system?
Which applications did you try to run that did not work?
From the top of my head, I am not aware of anything why it should not work the described way. I tested this routine several times on Fedora 35 and it always worked. You might have hit a bug, maybe.
## Darvond
So any other DE/WM?
## Lukáš Růžička
I am planning to focus on a more universal method to use tigervnc in the future.
## Tony W
This is essentially what I have been looking to do for a while now. I tested this from one Fedora Desktop to a Fedora VM that is running from a KVM on another Fedora Desktop. Both are running on F34. Thank you!
## Haenzel
I find NoMachine (server and client) a good solution…
## Lukáš Růžička
This might be an option, sure. The article, however, focuses on one of the ways to achieve this using default apps on a Fedora Workstation, or apps that can be installed from the default Fedora repositories. NoMachine does not fit into this scenario.
## Joe
That gnome extension to unlock is very handy. If you don’t have that, or don’t want it, another way to unlock remotely is ssh login first, and use “loginctl unlock-sessions” and type password. Then you can VNC in. another hint I’ve found is certain apps have an issue with the encryption for some reason. I only use screen sharing remotely so don’t mind disabling it. You can use dconf editor to go to org.gnome.desktop.remote-desktop and set encryption to none for vnc. this solve the issue for me.
## Joe
Oops, regarding disabling encryption, I meant to say I only use at home on local network, so not remotely. Wrong word there. Opposite of “remotely.”
## vdb
This way is also suitable to share the screen: login via ssh first (with X11 forwarding enabled), then start gnome-control-center and turn on screen sharing.
(Someone can ask: if X11 forwarding works, why do I need GNOME screen sharing? I found that some apps work quite well with X11 forwarding (e. g. geany editor or gnome-control-center), but some do not (e. g. evolution is terribly slow and hardly usable). GNOME screen sharing allows me to use evolution remotely.)
Probably, GNOME Shell has some D-Bus interface to enable sharing via the command line, without using gnome-control-center?
## Someletters
The service accepts connections only on ipv6 out of the box. I consider the post incomplete. |
14,262 | Vivaldi 5.1 发布:引入可横向滚动的标签和在读清单 | https://news.itsfoss.com/vivaldi-5-1-release/ | 2022-02-11T16:18:53 | [
"Vivaldi"
] | https://linux.cn/article-14262-1.html |
>
> 对于那些涉足多款浏览器的人来说,Vivaldi 5.1 版本更新极富趣味,且更加实用。
>
>
>

Vivaldi 对于 Linux 用户来说是个不错的选择。他们将 Linux 平台作为其官方主力维护平台之一,这一点弥足珍贵。
在 [Vivaldi 5.0 版本](/article-14044-1.html) 中,它已经成为许多 Linux 用户喜爱且极具功能性的 Chromium 内核浏览器之选。如今,Vivaldi 5.1 也终于问世!
作为一款凭借强大的多任务管理功能而著名的浏览器,这一新版本想必是干货满满。
接下来就一起深入探索吧!
### Vivaldi 5.1 的新功能
还是提醒一下,Vivaldi 是一款几乎开源的浏览器,它的源代码是开放给所有用户的,但用户界面并不开源。
和之前的 5.0 版本类似,该版本带来了一些关键性的改进,包括:
* 可滚动的标签栏
* 全新的在读清单
* 新的开始页面快速设置面板
#### 可滚动的标签栏
在 Vivaldi 5.1 中,你不必再沉没于狭窄而海量的标签之中。你可以直接滚动标签栏,无需缩小标签。
考虑到大多数人喜欢把标签栏放到顶部或者底部,这一新功能可以让你直接通过滚轮或者箭头键来寻找标签。
我敢相信,许多人听到这个功能能够与标签堆叠功能整合并进一步提高标签查找效率后,一定会很高兴的。是的,两级标签栏均可以使用标签滚动功能。
这一新功能使 Vivaldi 的横向标签栏与垂直标签栏有了更高的一致性,后者已经支持滚动许久。
#### 在读列表

当阅读新闻这件事开始成为日常事务之后,设置一个在读列表会很有用。在此之前,这一功能是靠浏览器拓展实现的,而如今它已被整合到浏览器当中,大幅增强了便利性和实用性。
这一引入看上去更像是 Vivaldi 推动为其浏览器增添新服务功能的一大延续,不仅取代了一些常见拓展,更试图与 Firefox 的 Pocket 等同类平台进行竞争。
你可以直接通过键盘快捷键和鼠标手势来访问相应页面,或添加页面到在读列表中。
#### 开始页面的快速设置

开始页面一直都是网页浏览的关键节点,用户多年来也一直在定制它。不幸的是,用户往往要深入到设置页面去寻找自己需要的选项。
如今,得益于 Vivaldi 新增的开始页面快速设置面板,这种情况将成为过去式。现在,所有与开始页面有关的选项都在同一位置,大幅改进了用户体验。
你可以通过开始页面右上角的齿轮图标查看快速设置。
#### 其他变更
除了上述改进之外,还有许多 bug 修复,以及针对翻译、邮件、日历和订阅阅读器功能的细节改进。
你可以阅读 [版本发布公告](https://vivaldi.com/blog/vivaldi-5-1-gets-scrollable-tabs-reading-list/) 来了解更多技术性改进。
Android 版本同样也新增了一些新功能,包括修改标签宽度和选择更多强调色。你可以在这篇 [博文](https://vivaldi.com/blog/vivaldi-5-1-on-android/) 中了解详情。
### 获取 Vivaldi 5.1
如果这些新功能很合你的胃口,你可以前往 Vivaldi 官方网站下载 Vivaldi 5.1。如果你正在使用 Debian、Ubuntu 或者 Fedora,那么很简单,直接从 Vivaldi 官网下载相应软件包就可以了。
Vivaldi 同样也提供针对 ARM 架构的 32 位及 64 位软件包。
* [下载 Vivaldi](https://vivaldi.com/download/)
对于其他发行版,很不幸,你只能等待 Vivaldi 5.1 降临到发行版的相应仓库中,毕竟它可没有 Flatpak 和 Snap 版本。
总的来说,我认为 Vivaldi 5.1 是一次巨大改进,足以让我迁移主力。
你对 Vivaldi 5.1 的更新有什么看法吗?欢迎在评论区留言,让我了解你的想法!
---
via: <https://news.itsfoss.com/vivaldi-5-1-release/>
作者:[Jacob Crume](https://news.itsfoss.com/author/jacob/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[imgradeone](https://github.com/imgradeone) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Vivaldi is a pretty good option for Linux users. They focus on Linux as one of the first-party platforms, which is impressive.
With [Vivaldi 5.0 release](https://news.itsfoss.com/vivaldi-5-0-release/), it proved to be a versatile Chromium-based option for many Linux users. Now, Vivaldi 5.1 is finally here!
As a browser popularized by its powerful multitasking functionality, this release should be interesting.
Let’s dive in!
## New Features In Vivaldi 5.1
Note that Vivaldi is almost an open-source browser with its source code available, except its UI.
Just like its previous 5.0 release, this version brings several key improvements, including:
- Scrollable tabs
- New reading list
- New start page quick settings panel
### Scrollable Tabs
With Vivaldi 5.1, you do not need to shrink all your tabs necessarily when you have a lot of them. You can simply scroll through the tabs without shrinking them.
Considering you have the tab bar on top or bottom, this should let you navigate tabs by scrolling your mouse or using the arrow keys.
I’m sure many people will be pleased to hear that this can be combined with Vivaldi’s tab stacking feature, allowing for easier finding of tabs. Yes, you can scroll through tabs on both levels.
This brings Vivaldi’s horizontal tabs up to scratch with its vertical tabs, which have always supported scrolling.
### Reading List

As reading the news starts to feel like a full-time job, the inclusion of a reading list seems apt. While this has been achieved through browser extensions previously, it is built right into the browser significantly increases its convenience and usefulness.
This inclusion seems to be a continuation of Vivaldi’s constant push to add new services to its browser, replacing several common extensions and competing with the likes of Pocket on Firefox.
You can access/add pages to the reading list using keyboard shortcuts or mouse gestures.
### Quick Settings For The Start Page

The start page has always been a key part of web browsing, and users have been customizing it for many years. Unfortunately, this often required diving deep into settings menus to find the necessary options.
Now, this is set to change thanks to Vivaldi’s new start page quick settings panel. As a result, all the settings related to the start page are in one place, significantly improving the user experience.
You can access the quick settings through the gear icon in the top-right corner of the startpage.
### Other Changes
In addition to these changes, there are various bug fixes and subtle improvements to improve the translation, mail, calendar, and feed reader.
You can go through the changelog in the [announcement post](https://vivaldi.com/blog/vivaldi-5-1-gets-scrollable-tabs-reading-list/?ref=news.itsfoss.com) to know more about the technical improvements.
There are also new additions to the Android version, including the ability to tweak tab width and choose more colors. You can read more about it in their [blog post](https://vivaldi.com/blog/vivaldi-5-1-on-android/?ref=news.itsfoss.com).
## Getting Vivaldi 5.1
If all these new features appeal to you, download Vivaldi 5.1 from its official website. If you are on Debian, Ubuntu, or Fedora, it’s as simple as downloading the appropriate package from Vivaldi’s website.
It also offers AMR packages for 64-bit and 32-bit systems.
For other distros, you will, unfortunately, have to wait for Vivaldi 5.1 to land in your distro’s repositories, considering there’s no Flatpak or Snap package available for it.
Overall, I think Vivaldi 5.1 is a massive improvement and might convince me to switch.
*What do you think about the changes introduced in Vivaldi 5.1? Let us know in the comments below!*
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,264 | 如何从 KDE Plasma 5.23 升级到 5.24 | https://www.debugpoint.com/2022/02/upgrade-kde-plasma-5-24/ | 2022-02-12T10:28:18 | [
"KDE"
] | /article-14264-1.html |
>
> KDE 团队宣布了 KDE Plasma 5.24 LTS 版,已经可以下载和安装了。如果你打算从以前的版本升级,在这里我们给你提供了从 5.23 升级到 5.24 的简明步骤。
>
>
>

KDE Plasma 5.24 是 Plasma 桌面的第 26 个版本,带来了显著的视觉改变和一些后端性能的提升。在这个版本中,你会看到全新的墙纸、Breeze 主题的视觉变化、指纹登录和一个全新的概览屏幕等等。
你可以在我们的综述文章里阅读有关 [KDE Plasma 5.24 功能的细节](https://www.debugpoint.com/2022/01/kde-plasma-5-24/)。
如果你正在运行 KDE Plasma 的早期版本,你可以按本文说明升级到最新版本。
### 如何升级到 KDE Plasma 5.24
这个版本的升级包大小适中,在我的测试机器上大约是 450MB 以上。在开始升级过程之前,请确保关闭所有应用程序并保存你的数据。
一般来说,KDE 的升级是非常稳定的,它从来不会失败。但是,如果你想格外谨慎,并且有宝贵的数据,你可能想对这些进行备份。但同样,在我看来,我相信这是没有必要的。
#### 步骤
如果你是在 KDE Neon 之中、滚动发布的发行版(如 Arch Linux、Manjaro 之类)中运行 KDE Plasma 5.23,你可以打开 KDE 工具 “<ruby> 发现 <rt> Discover </rt></ruby>”,点击检查更新。
你可以通过“<ruby> 发现 <rt> Discover </rt></ruby>”的升级包列表验证 Plasma 5.24 是否可用。
一旦确认可用,点击“<ruby> 发现 <rt> Discover </rt></ruby>”窗口右上方的“<ruby> 全部更新 <rt> Update All </rt></ruby>”按钮。
另外,你也可以从终端运行下面的命令,在 KDE Neon 中开始升级过程。
```
sudo apt update
sudo pkcon update
```
升级过程完成后重启系统。
而重启后,你应该看到全新的 KDE Plasma 5.24 出现在你面前。
### 在 Fedora 35 和 Ubuntu 21.10 中升级 KDE Plasma 5.24
截至目前,[Fedora 35](https://www.debugpoint.com/2021/09/fedora-35/) 和 [Ubuntu 21.10](https://www.debugpoint.com/2021/07/ubuntu-21-10/) 是两个主要的 KDE 的发行版。由于 [更新政策](https://docs.fedoraproject.org/en-US/fesco/Updates_Policy/#stable-releases),Fedora 35 不会得到这个版本,而 Fedora 36 也将很快发布。
然而,如果你仍然想做实验,你可以在 Ubuntu 21.10 和 Ubuntu 21.04 中使用下面的 Backports PPA 安装这个新版本的 Plasma 桌面。在这样做的时候,请确保你保留一份数据备份。
```
sudo add-apt-repository ppa:kubuntu-ppa/backports
sudo apt-get full-upgrade
```
在 Fedora 35 中,我试图通过下面的 COPR 仓库来安装。但是有太多的依赖性冲突需要解决,在一个稳定的系统中尝试这样做是有风险的。我建议目前不要在 Fedora 35 中尝试下面的方法。当然你仍然可以通过 `allowerasing` 标志来安装。但不要这样做。
另外,我猜 Fedora 35 的官方版本会在第一个小版本(即 5.24.1)发布时更新,该版本将于 2022 年 2 月 15 日发布,所以你可以等到那时。
另外,等待 Fedora 36 也是比较明智的做法,因为它将这个版本作为默认版本。Fedora 36 将于 2022 年 4 月发布。

```
sudo dnf copr enable marcdeop/plasma
sudo dnf copr enable marcdeop/kf5
sudo dnf upgrade --refresh
```
### 升级后的反馈
我在虚拟机中运行了升级过程,并安装了新的 KDE Plasma 5.23。升级过程很顺利,没有出现意外或错误。好吧,到目前为止,它对我来说从未失败过。
升级时间完全取决于你的互联网连接和 KDE 服务器。一般来说,它应该在 30 分钟内完成。
升级过程后的第一次重启很顺利,没有花费多少时间。
从性能上讲,我觉得它比之前的版本更流畅,这要归功于几个错误的修复和底层的性能优化。
所以,总的来说,如果你在使用 KDE Neon,你可以安全地升级。否则就等待 Ubuntu 和 Fedora 稳定版的软件包。
享受全新的 KDE Plasma 吧!
---
via: <https://www.debugpoint.com/2022/02/upgrade-kde-plasma-5-24/>
作者:[Arindam](https://www.debugpoint.com/author/admin1/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) | null |
14,265 | Delta Chat:一个开源的聊天工具 | https://opensource.com/article/22/1/delta-chat-software-privacy-day | 2022-02-12T11:25:09 | [
"聊天",
"隐私",
"邮件"
] | https://linux.cn/article-14265-1.html |
>
> 最好的聊天应用是一个不属于聊天应用的应用。
>
>
>

请考虑一下,当用户的数据被发布到互联网上,或通过互联网发布时,他们的数据究竟去了哪里。古老的聊天应用是互联网通信领域的一个手工行业,似乎在潮流中起起落落。人们使用聊天应用进行各种形式的对话,大多数人不会想到机器人正在记录和监控他们所说的话,无论是为了有效地定位广告还是只是为了建立一个档案供将来使用。这使得聊天应用特别容易受到不良的隐私做法的影响,但幸运的是,现在有几个开源的、注重隐私的应用,如 [Signal](https://opensource.com/article/21/9/alternatives-zoom#signal)、[Rocket.Chat](https://opensource.com/article/22/1/rocketchat-open-source-communications-platform-puts-data-privacy-first) 和 [Mattermost](https://opensource.com/education/16/3/mattermost-open-source-chat)。我运行过 Mattermost 和 Rocket.Chat,我也在使用 Signal,但我最兴奋的应用是 Delta Chat,这个聊天服务非常方便,甚至不使用聊天服务器。相反,Delta Chat 使用的是你已经使用的最大规模和最多样化的开放信息系统:它使用电子邮件,通过聊天应用发送和接收信息,并以 [Autocrypt](https://autocrypt.org/) 的端到端加密为特色。
### 安装 Delta Chat
Delta Chat 使用标准的电子邮件协议作为它的后端,但对于作为普通用户的你和我来说,它的外观和行为完全像一个聊天应用。也就是说你需要安装一个开源的 Delta Chat 应用。
在 Linux 上,你可以从 [Flatpak](https://opensource.com/article/21/11/install-flatpak-linux) 包或你的软件库中安装 Delta Chat。
在 macOS 和 Windows 上,从 [delta.chat/downloads](https://delta.chat/en/download) 下载一个安装程序。
在安卓系统上,你可以从 Play Store 或开源的 [F-droid 仓库](https://f-droid.org/app/com.b44t.messenger) 安装 Delta Chat。
在 iOS 系统中,从 App Store 安装 Delta Chat。
因为 Delta Chat 使用电子邮件来传递信息,所以如果你不在你的聊天应用中,你也可以在收件箱中收到信息。是的,即使没有安装 Delta Chat,你也可以使用 Delta Chat!
### 配置 Delta Chat
当你第一次启动 Delta Chat 时,你必须登录到你的电子邮件账户。这往往是 Delta Chat 最难的部分,因为它要求你了解你的电子邮件服务器的详细信息,或者在你的电子邮件提供商的安全设置中创建一个“应用密码”。
如果你使用的是自己的服务器,并且所有配置都是默认的(993 端口用于 IMAP 接收,465 端口用于 SMTP 发出,启用了 SSL/TLS),那么你可以直接输入你的电子邮件地址和密码,然后继续。

如果你运行自己的服务器,但你有自定义设置,那么点击“<ruby> 高级 <rt> Advanced </rt></ruby>”按钮,输入你的设置。如果你使用一个不寻常的子域来用作你的邮件服务器,或一个自定义端口,或一个复杂的登录和密码配置,你可能需要这样做。
如果你使用的是 Gmail、Fastmail、Yahoo 或类似的电子邮件供应商,那么你必须创建一个应用密码,这样你就可以通过 Delta Chat 而不是网络浏览器登录到你的账户。许多电子邮件供应商限制登录,以避免无休止的机器人和脚本试图用暴力手段进入人们的账户,所以对你的供应商来说,Delta Chat 看起来很像机器人。当你授予 Delta Chat 特殊权限时,你就是在提醒你的电子邮件提供商,从一个远程应用发出大量的短信息是预期的行为。
每个电子邮件提供商都有不同的提供应用密码的方式,但 Fastmail(在我看来)是最简单的:
1. 进入“<ruby> 设置 <rt> Settings </rt></ruby>”
2. 点击“<ruby> 密码和安全 <rt> Passwords & Security </rt></ruby>”
3. 在“<ruby> 第三方应用 <rt> Third-party apps </rt></ruby>”的旁边,点击“<ruby> 添加 <rt> Add </rt></ruby>”按钮
验证你的密码,并创建一个新的应用密码。使用你创建的应用密码登录 Delta Chat。

### 使用 Delta Chat 聊天
当你克服了登录的障碍,剩下的就很容易了。因为 Delta Chat 只使用电子邮件,你可以通过电子邮件地址而不是通过聊天程序的用户名或电话号码来添加朋友。从技术上讲,你可以在 Delta Chat 上添加任何电子邮件地址。毕竟,它只是一个有特定使用场景的电子邮件应用。不过,告诉你的朋友 Delta Chat 是很有礼貌的,而不是期望他们通过他们的电子邮件客户端与你进行随意的聊天。
无论你是在手机还是在电脑上运行这个应用,其外观都与你所期望的聊天应用完全一样。你可以发起聊天,发送消息,并通过加密文本与朋友闲聊。

### 开始聊天
Delta Chat 是去中心化的、完全加密的,并依赖于一个成熟的基础设施。多亏 Delta Chat,你可以选择你和你的联系人之间的服务器,你可以在私下里交流。没有需要安装的复杂的服务器,没有需要维护的硬件。这是一个看似复杂问题的简单解决方案,而且是开源的。我们有充分的理由去尝试它。
---
via: <https://opensource.com/article/22/1/delta-chat-software-privacy-day>
作者:[Alan Smithee](https://opensource.com/users/alansmithee) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | It's Software Privacy Day again, the day meant to encourage users everywhere to spare a thought about where their data actually goes when it's posted on, over, or through the Internet. One of the cottage industries around Internet communication that seems to ebb and flow in popularity is the venerable chat application. People use chat applications for all manner of conversations, and most people don't think about what bots are recording and monitoring what's being said, whether it's to effectively target ads or just to build a profile for future use. This makes chat applications particularly vulnerable to poor privacy practices, but luckily there are several open source, privacy-focused apps out there, including [Signal](https://opensource.com/article/21/9/alternatives-zoom#signal), [Rocket.Chat](https://opensource.com/article/22/1/rocketchat-open-source-communications-platform-puts-data-privacy-first), and [Mattermost](https://opensource.com/education/16/3/mattermost-open-source-chat). I've run Mattermost and Rocket.Chat, and I use Signal, but the application I'm most excited about is Delta Chat, the chat service that's so hands-off it doesn’t even use chat servers. Instead, Delta Chat uses the most massive and diverse open messaging system you already use yourself. It uses email to send and receive messages through a chat application, and it features end-to-end encryption with [Autocrypt](https://autocrypt.org/).
## Install Delta Chat
Delta Chat uses standard email protocol as its back end, but to you and me as mere users, it appears and acts exactly like a chat application. That means you need to install the open source Delta Chat app.
On Linux, you can install Delta Chat as a [Flatpak](https://opensource.com/article/21/11/install-flatpak-linux) or from your software repository.
On macOS and Windows, download an installer from [delta.chat/downloads](https://delta.chat/en/download).
On Android, you can install Delta Chat from the Play Store or the open source [F-droid repository](https://f-droid.org/app/com.b44t.messenger).
On iOS, install Delta Chat from the App Store.
Because Delta Chat uses email for message delivery, you can also receive messages to your inbox if you're away from your chat app. Yes, you can use Delta Chat even without having Delta Chat installed!
## Configure Delta Chat
When you first launch Delta Chat, you must log in to your email account. This tends to be the hardest part about Delta Chat because it requires you to either know details about your email server or else to create an "app password" in your email provider's security settings.
If you're running your own server and you have everything configured as the usual defaults (port 993 for incoming IMAP, port 465 for outgoing SMTP, SSL/TLS enabled), then you can probably just type in your email address and your password and continue.

(Opensource.com [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
If you're running your own server but you have custom settings, then click the **Advanced** button and enter your settings. You may need to do this if you're using an unusual subdomain to denote your mail server, or a custom port, or a complex login and password configuration.
If you're using an email provider like Gmail, Fastmail, Yahoo, or similar, then you must create an app password so you can login to your account through Delta Chat instead of a web browser. Many email providers restrict login in order to avoid endless bots and scripts making attempts to brute force their ways into people's accounts, so to your provider, Delta Chat looks a lot like a bot. When you grant Delta Chat special permissions, you're alerting your email provider that lots of short messages from a remote app is expected behavior.
Each email provider has a different way of providing app passwords, but Fastmail (in my opinion) makes it the easiest:
- Navigate to
**Settings** - Click
**Passwords & Security** - Next to
**Third-party apps**, click the**Add**button
Verify your password, and create a new app password. Use the password you create to login to Delta Chat.

(Opensource.com [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
## Chatting with Delta Chat
Once you've gotten past the hurdle of logging in, the rest is easy. Because Delta Chat just uses email, you can add friends by email address rather than by a chat application username or phone number. You can technically add any email address to Delta Chat. It is, after all, just an email app with a very specific use case. It's polite to tell your friend about Delta Chat, though, rather than expect them to carry out a casual chat with you through their email client.
The application, whether you're running it on your phone or your computer, looks exactly like you'd expect a chat application to look. You can initiate chats, send messages, and hang out with friends over encrypted text.

(Image courtesy Delta Chat)
## Get chatting
Delta Chat is decentralized, fully encrypted, and relies on a proven infrastructure. Thanks to Delta Chat, you get to choose what servers sit between you and your contacts, and you can communicate in private. There's no complex server to install, no hardware to maintain. It's a simple solution to what seems like a complex problem, and it's open source. There's every reason to try it, especially on Software Privacy Day.
## Comments are closed. |
14,267 | 值得关注的 GNOME 42 的 7 个新特色 | https://news.itsfoss.com/gnome-42-features/ | 2022-02-13T10:01:16 | [
"GNOME"
] | https://linux.cn/article-14267-1.html |
>
> GNOME 42 是一个令人激动的版本,它将应用程序移植到了 GTK 4,还有一个新的暗色风格偏好。你觉得怎么样?
>
>
>

GNOME 42 将是一个值得关注的版本。
它包括明显的视觉变化和对桌面体验的改进。当然,[GNOME 41](https://news.itsfoss.com/gnome-41-release/) 中的变化所赢得的赞誉也适用于新版本。
GNOME 42 将于 2022 年 3 月 23 日发布,但它快到测试阶段了(计划于 2022 年 2 月 12 日)。
因此,让我们来看看在最终版本中你应该看到的变化。
你可以期待在 Fedora 36 工作站和 [Ubuntu 22.04 LTS](https://itsfoss.com/ubuntu-22-04-release-features/) 中看到 GNOME 42。
### GNOME 42 有什么新变化?
请注意,GNOME 42 还没有完全就绪。因此,到下个月的正式宣布前,我们可以期待更多关于新功能和变化的细节。而且,我们将确保在这时更新文章。
#### 1、系统级的暗色风格偏好

与 elementary OS 团队为 [elementary OS 6](https://news.itsfoss.com/elementary-os-6-features/) 所做的努力类似,GNOME 开发者也为实现系统级的暗色模式做出了努力。
在我们的 [最初报道](https://news.itsfoss.com/gnome-42-dark-style-preference/) 中,我们提到了为什么 GNOME 计划跟随 elementary OS 添加一个暗色风格的偏好。
你可以在系统设置中的外观菜单下找到切换主题的选项。你在改变背景时,也可以通过右键菜单访问它。
#### 2、文件夹图标主题更新
尽管 GNOME 专注于提供现代的桌面体验,但原来的文件夹图标看起来已经过时。
随着 GNOME 42 和对于新的文件夹图标主题的 [一些讨论](https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/merge_requests/38) ,他们最终确定了一个蓝灰色的梯度设计。

下面是它在浅色主题下的样子:

#### 3、GTK 4 和 libadwaita
GNOME 41 引入了 [libadwaita](https://aplazas.pages.gitlab.gnome.org/blog/blog/2021/03/31/introducing-libadwaita.html),旨在推动 GNOME 应用程序的用户体验改变。
当然,这也意味着开发者要做更多的工作,但到目前为止,移植到 GTK 4 的过程很顺利,而且情况应该会在 GNOME 42 中变得更好。
当许多应用程序正在为 GNOME 42 做准备时,你会发现像 [Fragments 2.0](https://news.itsfoss.com/fragments-2-0-release/) 这样的软件已经准备好为你提供漂亮的用户体验。
在这一点上,几乎所有的 GNOME 应用程序似乎都在 UI 方面取得了进步。
总的来说,按钮、图标、圆角和细微的视觉变化都反映了这些改进。
#### 4、改造后的系统设置
从功能上看,系统设置没有变化,但视觉上的差异是明显的。

你应该发现用户界面更干净、更现代、更有美感。从技术上讲,由于移植到了GTK 4,维护它有技术上的好处,但你不必担心找不到选项,都是一样的。
#### 5、GNOME 文本编辑器

Gedit 将被 GNOME 的新文本编辑器所取代,它支持新的功能和主题设计。
虽然我们已经 [在我们的早期报道中讨论了它的功能](https://news.itsfoss.com/gnome-text-editor-to-replace-gedit/),但它的测试版似乎已经准备好了,准备进入表演时间了。
#### 6、对截屏用户界面和本地录屏的改进
[GNOME 截屏](https://itsfoss.com/using-gnome-screenshot-tool/) 应用程序目前提供了一个简单的 GUI,帮助你对整个屏幕、一个区域或一个窗口进行截屏。
在 GNOME 42 中,它的用户界面得到了一些重大的改变,包括录制屏幕的能力。

不仅仅是新功能,通过其新的用户界面,你可以轻松地在截屏或录屏之间切换。
它看起来很棒,你觉得呢?
#### 7、夜间/白天的墙纸

默认壁纸是蓝色背景,如上面的截图所示。然而,你会注意到一个紫色的变体壁纸,它按时间(白天结束时)启动。
下面是壁纸的夜间变体的样子:

#### 其他改进
除了上述改进,GNOME 42 还包括性能调整和错误修复。
从 GNOME Shell 到核心应用程序,所有的东西都得到了微小的修复。
不要忘了,许多第三方项目已经为 GNOME 42 进行了改进,你应该会很高兴看到他们的成果。
### 下载 GNOME 42
你可以使用 Boxes 运行 [GNOME OS](https://itsfoss.com/gnome-os/) 来测试 GNOME 42 的最新夜间构建版本。到目前为止,这是测试最新功能/变化的唯一方法。
* [GNOME 42](https://os.gnome.org)
如果你不想体验测试版,那你可能想等待 Ubuntu 22.04 LTS 或 Fedora 36 为你的桌面加入 GNOME 42。
---
via: <https://news.itsfoss.com/gnome-42-features/>
作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

GNOME 42 will be an interesting release.
It includes noticeable visual changes and improvements to the desktop experience. Of course, the changes in [GNOME 41](https://news.itsfoss.com/gnome-41-release/) compliments the new release as well.
GNOME 42 is due on March 23, 2022, and the beta is already here.
So, let us take a look at the changes that you should see in the final release.
You can expect to see GNOME 42 with Fedora 36 Workstation and [Ubuntu 22.04 LTS](https://itsfoss.com/ubuntu-22-04-release-features/?ref=news.itsfoss.com).
## GNOME 42: What’s New?
Note that GNOME 42 is not generally available for all. So, with the official announcement next month, we can expect more details about the new features and changes. And, we shall make sure to update the article when that happens.
### 1. System-wide Dark Style Preference

Similar to the efforts by the elementary OS team for [elementary OS 6](https://news.itsfoss.com/elementary-os-6-features/), GNOME developers have made efforts to implement a system-wide dark mode.
Our [original coverage](https://news.itsfoss.com/gnome-42-dark-style-preference/) mentioned more about why GNOME plans to follow elementary OS to add a dark style preference.
You can find the option to switch the theme in the system settings under the appearance menu. It can also be accessed through the right-click menu when trying to change the background.
### 2. Folder Icon Theme Update
Even though GNOME focuses on providing a modern desktop experience, the original folder icons looked dated.
With GNOME 42 and [some debate](https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/merge_requests/38?ref=news.itsfoss.com) for a new folder icon theme, they finally settled with a Blueish-gradient design.

Here’s how it looks with the light theme:

### 3. GTK 4 and libadwaita
GNOME 41 introduced [libadwaita](https://aplazas.pages.gitlab.gnome.org/blog/blog/2021/03/31/introducing-libadwaita.html?ref=news.itsfoss.com) that aims to evolve the user experience for GNOME applications.
Of course, this also meant more work for developers, but the porting process to GTK 4 is going good so far and the situation should get better with GNOME 42.
While many applications are gearing up for GNOME 42, you will find options like [Fragments 2.0](https://news.itsfoss.com/fragments-2-0-release/) ready to provide you with a pretty user experience.
At this point, almost every GNOME app seems to have made the progress in terms of UI.
Overall, the buttons, icons, rounded corners, and subtle visual changes reflect the improvements.
### 4. Revamped System Settings
The system settings remain the same, functionally, but the visual difference is noticeable.

You should find the user interface cleaner, modern, and aesthetically pleasing. Technically, with the port to GTK 4, there are technical benefits to maintain it, but you do not have to worry about finding the options, it’s all the same.
### 5. GNOME Text Editor

Gedit will be replaced by GNOME’s new text editor that supports new features and theming.
While we already [discussed its features in our ea](https://news.itsfoss.com/gnome-text-editor-to-replace-gedit/)[r](https://news.itsfoss.com/gnome-text-editor-to-replace-gedit/)[ly coverage](https://news.itsfoss.com/gnome-text-editor-to-replace-gedit/), it seems as if it’s ready for prime time with its beta version.
### 6. Improvements to the Screenshot UI and Native Screen Recording
The [GNOME screenshot](https://itsfoss.com/using-gnome-screenshot-tool/?ref=news.itsfoss.com) app is currently a simple GUI to help you take screenshots of an entire screen, a region, or a window.
With GNOME 42, the user interface has received some major changes, including the ability to record the screen.

Not just the new feature, but with its new UI, you can easily switch between taking a screenshot or recording the screen.
It looks great, what do you think?
### 7. Wallpapers for Dark/Light Theme

The default wallpaper is a blue background. However, you will notice a purple variant of the wallpaper that kicks in when you enable the dark mode.
Similarly, you can find, dark/light versions of several backgrounds available.

Here’s the dark mode version of the wallpaper above:

### Other Improvements
In addition to the improvements mentioned, GNOME 42 also includes performance tweaks and bug fixes.
Starting from the GNOME Shell to the core apps, everything received minor fixes.
Not to forget, numerous third-party projects have made improvements for GNOME 42. So, it should excite to see what they come up with.
## Download GNOME 42
You can use [GNOME OS](https://itsfoss.com/gnome-os/?ref=news.itsfoss.com) using Boxes to test the latest nightly build of GNOME 42. As of now, that’s the only way to test the latest features/changes.
If you want to avoid testing it, you might want to wait for Ubuntu 22.04 LTS or Fedora 36 to include GNOME 42 for your desktop.
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,268 | 无障碍分享你的 Wordle 结果的开源工具 | https://opensource.com/article/22/1/open-source-accessibility-wordle | 2022-02-13T15:45:14 | [
"Wordle"
] | https://linux.cn/article-14268-1.html |
>
> 分享你的 Wordle 结果是有趣的。尝试这些开源技巧让它们可以无障碍分享。
>
>
>

Wordle 似乎在社交媒体上到处出现。Wordle 是一个快速的文字游戏,你可以每天玩一次,你可以很容易地通过社交媒体与朋友分享结果。
Wordle 的目的是猜测一个秘密单词。要进行猜测,需要输入一个单词,然后 Wordle 在一个由彩色编码的表情符号组成的网格中显示你的猜测结果。绿色表示一个字母在正确的位置。黄色表示密语中包含该字母,但它在错误的位置。灰色表示该字母根本就不在这个词中。

人们通过将产生的字母网格粘贴到社交媒体上来分享他们在游戏中的进展,这很容易做到,因为这个网格只是 [一组表情符号](https://opensource.com/article/19/10/how-type-emoji-linux)。然而,表情图标和表情符存在无障碍问题。虽然它们很容易复制和粘贴,但对于生活在低视力或色盲的人来说,共享的结果可能很难看清。灰色、黄色、绿色的颜色对一些人来说可能很难区分。

受到与 Mike Lim 谈话的启发,我在互联网上做了一些探究,发现了一些提示,包括一个帮助改善共享游戏结果的无障碍性的开源项目。
### 使用一个开源的无障碍应用
[wa11y 应用](http://wa11y.co/) 的使用很简单。你可以在 [这里](https://github.com/cariad/wa11y.co) 找到 wa11y GitHub 项目。复制你的 Wordle 结果并将其粘贴到应用中,它就会将你的结果转换为文字。

你可以简单地勾选复选框来包含表情符号,以表示成功猜测,但该项目维护者不建议这样做。辅助技术非常喜欢表情符号,以至于它会读取每一个表情符号。内联地、全部读取。尽管技术圈喜欢阅读它们,但使用辅助技术的人可能会发现它很麻烦,并经常放弃有几个以上的表情符号的信息。


### 提供无障碍图片
也许你不能使用 wa11y 应用,但仍然想确保你的结果是无障碍访问的。你可以进行截图,上传图片,并添加替代文本。你有几种方法可以做到这一点:
* 附上图片,并在信息栏中写上替代文本。
* 附上图片并深入到你的特定社交媒体应用的无障碍选项中,启用替代文本并从那里添加。开源社交网络 [Mastodon](https://opensource.com/article/17/4/guide-to-mastodon) 默认启用实际的替代文本。
* [@AltTxtReminder](https://twitter.com/alttxtreminder) 是一个你可以关注的账户,当你忘记时,它会提醒你为图片添加替代文本。
如果你分享了默认结果,你总是可以选择在表情符号之前添加替代文本。这样,你的受众就可以获得文字信息,但在重复的表情符号变得繁琐之前,可以中止信息的其余部分。


### 总结
Wordle 是最近互联网上的一个热门游戏,所以在分享你的结果时,一定要记住无障碍分享。有一些使用开源技术的简单方法可以使你的结果更容易与大家分享。
---
via: <https://opensource.com/article/22/1/open-source-accessibility-wordle>
作者:[AmyJune Hineline](https://opensource.com/users/amyjune) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | Wordle seems to be popping up everywhere across social media feeds. Wordle is a quick word game that you can play once daily, and you can easily share results with friends over social media.
The aim of Wordle is to guess a secret word. To make a guess, enter a word, and Wordle displays the results of your guess in a grid of color-coded emoticons. Green indicates that a letter is in the correct location. Yellow indicates that the secret word contains the letter, but it is in the wrong location. And grey means that the letter isn't in the word at all.

AmyJune Hineline (CC BY-SA 4.0)
It's become common for people to share their progress in the game by pasting the resulting letter grid into social media, which is easy to do because the grid is just a [set of emoji](https://opensource.com/article/19/10/how-type-emoji-linux). However, emoticons and emoji have accessibility issues. While they're easy to copy and paste, the shared results can be hard to access for individuals who live with low vision or color blindness. The colors grey, yellow, green can be difficult for some to differentiate.

AmyJune Hineline (CC BY-SA 4.0)
Inspired by a conversation I had with Mike Lim, I did some poking on the internet and discovered a couple of tips, including an open source project that helps improve the accessibility of shared game results.
## Use an open source accessibility app
The [wa11y app](http://wa11y.co/) is straightforward to use. You can find the wa11y GitHub project [here](https://github.com/cariad/wa11y.co). Copy your Wordle results and paste them into the app, and it converts your results into words.

AmyJune Hineline (CC BY-SA 4.0)
You can include emoticons with a simple checkbox to indicate a successful guess, but maintainers warn against this. Assistive technology loves emoticons so much that it reads each and every emoticon. Inline. All of them. Although the technology loves to read them, folks who utilize assistive technology may find it cumbersome and often abandon a message with more than a few emoji.

AmyJune Hineline (CC BY-SA 4.0)

AmyJune Hineline (CC BY-SA 4.0)
## Provide accessible images
Perhaps you don't have access to the wal11y app and still want to ensure your results are accessible. You can take a screenshot, upload the image, and add alt text. There are a few ways you can do this:
- Attach the image and write the alt text in the message field.
- Attach the image and dive into the accessibility options for your specific social media app and enable alt text and add from there. The open source social network
[Mastodon](https://opensource.com/article/17/4/guide-to-mastodon)enables actual alt text by default. [@AltTxtReminde](https://twitter.com/alttxtreminder)r is an account you can follow that reminds you to add alt text to images when you forget.
If you do share the default results, there is always the option to add alt text before the emoticons. That way, your audience has access to the text information but can abort the rest of the message before repeating emoji becomes cumbersome.

AmyJune Hineline (CC BY-SA 4.0)

AmyJune Hineline (CC BY-SA 4.0)
## Wrap up
Wordle is a hot game on the internet these days, so when sharing your results be sure to keep accessibility in mind. There are a few simple approaches using open source technology to make your results easier to share with everyone.
## Comments are closed. |
14,270 | 我喜欢在 Linux 命令行中使用的 6 个元字符 | https://opensource.com/article/22/2/metacharacters-linux | 2022-02-13T23:59:21 | [
"Linux",
"元字符"
] | https://linux.cn/article-14270-1.html |
>
> 在 Linux 命令行上使用元字符是提高生产力的一个好方法。
>
>
>

在我的 Linux 之旅的早期,我学会了如何使用命令行。这就是 Linux 的与众不同之处。我可以失去图形用户界面(GUI),但没有必要完全重建机器。许多 Linux 电脑是<ruby> 无头 <rt> headless </rt></ruby>运行的,你可以在命令行上完成所有的管理任务。它使用许多所有人都熟悉的基本命令,如 `ls`、`ls-l`、`ls-l`、`cd`、`pwd`、`top` 等等。
### Linux 上的 Shell 元字符
你可以通过使用元字符来扩展这些命令。我不知道你怎么称呼它们,但这些元字符使我的生活变得更轻松。
### 管道符 |
假设我想知道我的系统上运行的 Firefox 的所有实例。我可以使用带有 `-ef` 参数的 `ps` 命令来列出我系统上运行的所有程序实例。现在我想只看那些涉及 Firefox 的实例。我使用了我最喜欢的元字符之一,管道符 `|`,将其结果送到 `grep`,用它来搜索模式:
```
$ ps -ef | grep firefox
```
### 输出重定向 >
另一个我最喜欢的元字符是输出重定向 `>`。我用它来打印 `dmesg` 命令结果中所有 AMD 相关的结果。你可能会发现这在硬件故障排除中很有帮助:
```
$ dmesg | grep amd > amd.txt
$ cat amd.txt
[ 0.897] amd_uncore: 4 amd_df counters detected
[ 0.897] amd_uncore: 6 amd_l3 counters detected
[ 0.898] perf/amd_iommu: Detected AMD IOMMU #0 (2 banks, 4 counters/bank).
```
### 星号 \*
星号 `*`(通配符)是寻找具有相同扩展名的文件时我的最爱,如 `.jpg` 或 `.png`。我首先进入我的系统中的 `Picture` 目录,并使用类似以下的命令:
```
$ ls *.png
BlountScreenPicture.png
DisplaySettings.png
EbookStats.png
StrategicPlanMenu.png
Screenshot from 01-24 19-35-05.png
```
### 波浪号 ~
波浪号 `~` 是在 Linux 系统上通过输入以下命令快速返回你的家目录的一种方法:
```
$ cd ~
$ pwd
/home/don
```
### 美元符号 $
`$` 符号作为一个元字符有不同的含义。当用于匹配模式时,它意味着任何以给定字符串结尾的字符串。例如,当同时使用元字符 `|` 和 `$` 时:
```
$ ls | grep png$
BlountScreenPicture.png
DisplaySettings.png
EbookStats.png
StrategicPlanMenu.png
Screenshot from 01-24 19-35-05.png
```
### 上尖号 ^
符号 `^` 将结果限制在以给定字符串开始的项目上。例如,当同时使用元字符 `|` 和 `^` 时:
```
$ ls | grep ^Screen
Screenshot from 01-24 19-35-05.png
```
这些元字符中有许多是通往 [正则表达式](https://opensource.com/article/18/5/getting-started-regular-expressions) 的大门,所以还有很多东西可以探索。你最喜欢的 Linux 元字符是什么,它们是如何节省你的工作的?
---
via: <https://opensource.com/article/22/2/metacharacters-linux>
作者:[Don Watkins](https://opensource.com/users/don-watkins) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | Early in my Linux journey, I learned how to use the command line. It's what sets Linux apart. I could lose the graphical user interface (GUI), but it was unnecessary to rebuild the machine completely. Many Linux computers run headless, and you can accomplish all the administrative tasks on the command line. It uses many basic commands that all are familiar with—like `ls`
, `ls-l`
, `ls-l`
, `cd`
, `pwd`
, `top`
, and many more.
## Shell metacharacters on Linux
You can extend each of those commands through the use of metacharacters. I didn't know what you called them, but metacharacters have made my life easier.
## Pipe |
Say that I want to know all the instances of Firefox running on my system. I can use the `ps`
command with an `-ef`
to list all instances of the programs running on my system. Now I'd like to see just those instances where Firefox is involved. I use one of my favorite metacharacters, the pipe `|`
the result to `grep`
, which searches for patterns.
`$ ps -ef | grep firefox `
## Output redirection >
Another favorite metacharacter is the output redirection `>`
. I use it to print the results of all the instances that Intel mentioned as a result of a `dmesg`
command. You may find this helpful in hardware troubleshooting.
```
$ dmesg | grep amd > amd.txt
$ cat amd.txt
[ 0.897] amd_uncore: 4 amd_df counters detected
[ 0.897] amd_uncore: 6 amd_l3 counters detected
[ 0.898] perf/amd_iommu: Detected AMD IOMMU #0 (2 banks, 4 counters/bank).
```
## Asterisk *
The asterisk `*`
or wildcard is a favorite when looking for files with the same extension—like `.jpg`
or `.png`
. I first change into the `Picture`
directory on my system and use a command like the following:
```
$ ls *.png
BlountScreenPicture.png
DisplaySettings.png
EbookStats.png
StrategicPlanMenu.png
Screenshot from 01-24 19-35-05.png
```
## Tilde ~
The tilde `~`
is a quick way to get back to your home directory on a Linux system by entering the following command:
```
$ cd ~
$ pwd
/home/don
```
## Dollar symbol $
The `$`
symbol as a metacharacter has different meanings. When used to match patterns, it means any string that ends with a given string. For example, when using both metacharacters `|`
and `$`
:
```
$ ls | grep png$
BlountScreenPicture.png
DisplaySettings.png
EbookStats.png
StrategicPlanMenu.png
Screenshot from 01-24 19-35-05.png
```
## Caret ^
The `^`
symbol restricts results to items that start with a given string. For example, when using both metacharacters `|`
and `^`
:
```
$ ls | grep ^Screen
Screenshot from 01-24 19-35-05.png
```
Many of these metacharacters are a gateway to [regular expressions](https://opensource.com/article/18/5/getting-started-regular-expressions), so there's a lot more to explore. What are your favorite Linux metacharacters, and how are they saving your work?
## 11 Comments |
14,271 | 适用于 Linux 系统的最佳白板应用 | https://www.debugpoint.com/2022/02/top-whiteboard-applications-linux/ | 2022-02-14T16:25:00 | [
"白板"
] | /article-14271-1.html | 
>
> 我们将向你展示几个用于 Linux 的白板应用程序。我相信这些会对你有很大的帮助。
>
>
>
一般来说,数字白板是一种包含一块白板形式的大型互动显示器的工具。白板设备的一些例子,如平板电脑、大屏幕手机、触摸屏笔记本电脑、平面显示器等。
如果教员使用白板,可以使用触摸感应笔、手写笔、手指或鼠标在这些设备屏幕上画、写或操作元素。你可以拖动、点击、擦除、绘制,在白板上做一切可以用笔在纸上完成的事情。
但要做到这些,你需要支持所有这些功能的软件,即在你的触摸和显示器之间架起桥梁。
现在,有许多商业应用程序可用于这项工作。但我们将在本文中谈论一些可用于 Linux 的自由开源的白板应用程序。
### Linux 上的最佳白板应用
#### 1、Xournal++
我们介绍的第一个应用是 [Xournal++](https://xournalpp.github.io/)。在我看来,这是这份名单上最好的应用。它相当可靠,而且已经出现了一段时间了。
Xournal++ 可以让你写字、画画,做一切你通常在纸上做的事情。它支持手写、带高亮的自定义笔、橡皮擦等。它支持分层、多页功能、添加外部图片、添加音频等功能。
这个应用程序支持几乎所有的压敏平板,包括 Wacom、Huion、XP-Pen。我在一台触摸板笔记本电脑上测试了它,只需稍作设置就能工作。所以,你可以用它使用任何压敏设备。
它是用 C++ 和 GTK3 编写的。

对于 Linux 系统,可以安装如下软件包。它是免费的,也可用于 Linux、macOS 和 Windows。如果你想在手机上试用,也可以使用它的测试版。
这个应用程序有 AppImage、Snap、Flatpak 和 deb 包。对于基于 Ubuntu/Debian 的系统,也有 PPA 版本。
此外,还有适用于 Fedora、SUSE 和 Arch 的专用软件包。请点击下面的链接下载 Xournal++,获取你喜欢的可执行文件格式。
* [主页](https://xournalpp.github.io/)
* [文档](https://xournalpp.github.io/guide/overview/)
* [源代码](https://github.com/xournalpp/xournalpp/)
* [下载 Xournal++](https://xournalpp.github.io/installation/linux/)
#### 2、OpenBoard
我们想重点介绍的下一个是 [OpenBoard](https://openboard.ch/)。这个简单的白板绘图应用程序很容易使用,不会有太多的选项让你操心。
这款软件非常适合初学者和初级学生在在线课程中做笔记。

加载了很多功能。如颜色、画笔、文本、简单的绘图形状、页面支持等。这个应用程序是使用 Qt 技术构建的。
这个应用程序只适用于 Ubuntu,它是一个独立的 deb 包。你可以从下面的链接下载 OpenBoard。
* [主页](https://openboard.ch/)
* [文档](https://openboard.ch/support.html)
* [源代码](https://github.com/OpenBoard-org/OpenBoard)
* [下载 OpenBoard](https://openboard.ch/download.en.html)
#### 3、Notelab
[NoteLab](http://java-notelab.sourceforge.net/) 是上个年代最古老的白板应用程序之一。它是一个自由开源的应用程序,有大量的功能。因此,你可以理解这个应用程序是多么的稳定和流行。
以下是它的一些特点:
* 这个应用程序支持所有流行的图像格式作为导出选项。例如,SVG、PNG、JPG、BMP 等。
* 用于定制笔和纸的配置选项。
* 内置内存管理器,用于自定义分配 NoteLab 使用的内存。
* 多种样式的纸张。
* 所有标准的绘图工具。
* 你可以在笔记的任何部分调整大小、移动、删除、改变颜色和执行其他操作。

然而,这个应用程序是一个 Java 应用程序,并以一个 .jar 文件分发。因此,你需要 Java 运行时才能工作。你可以参考我们的指南,通过以下链接在 Linux 系统中安装 Java 或 JRE。
* [如何在基于 Ubuntu的系统中安装 Java/JRE](https://www.debugpoint.com/2016/05/how-to-install-java-jre-jdk-on-ubuntu-linux-mint/) 。
* [如何在 Arch Linux 中安装 Java/JRE](https://www.debugpoint.com/2021/02/install-java-arch/) 。
NoteLab 带有一个独立的可执行的 .jar 文件,你可以通过以下链接从 SourceForge 下载。记住,你需要 JRE 来运行这个应用程序。
* [主页](http://java-notelab.sourceforge.net/)
* [文档](http://java-notelab.sourceforge.net/features.html)
* [下载 NoteLab](https://sourceforge.net/projects/java-notelab/files/NoteLab/)
#### 4、Rnote
我们要介绍的第三个应用程序叫做 [Rnote](https://github.com/flxzt/rnote)。Rnote 是一个通过触摸设备进行手写笔记的优秀应用。这个应用程序是基于矢量图像的,可以绘制、注释图片和 PDF 文件。它有原生的 .rnote 文件格式,也支持导入/导出 png、jpeg、svg 和 PDF 的选项。
Rnote 的一个很酷的特点是,它支持 Xournal++ 文件格式(本列表中的第一个应用程序),这使它成为一个必备的工具。
Rnote 使用 GTK4 和 Rust 构建,非常适合 GNOME 桌面和各种类型的 Linux 系统。
这个应用程序目前正在开发中,在使用时请记住这一点。

这个应用程序是以 Flatpak 包的形式提供的。你可以使用 [这篇指南](https://flatpak.org/setup/) 为你的 Linux 系统设置 Flatpak,然后点击 [此链接安装](https://dl.flathub.org/repo/appstream/com.github.flxzt.rnote.flatpakref)。
* [主页和源代码](https://github.com/flxzt/rnote)
#### 5、Lorien
[Lorien](https://github.com/mbrlabs/Lorien) 是一个完美的数字笔记本软件,可以用于你的构思会议,你可以用它的各种工具创建笔记。Lorien 是一个基于 Godot 游戏引擎的跨平台、自由开源的“无限画布绘画/记事”应用程序。这个应用程序非常适合于为头脑风暴会议做快速笔记。
工具箱相当标准,有自由画笔、橡皮擦、线条工具和选择工具。你可以移动或删除你的笔触的选定部分,这是一个点的集合,在运行时渲染。

使用 Lorien 不需要安装。可以从下面的链接中下载一个独立的可执行 tar 文件。下载后,解压文件并双击运行。
* [主页和源代码](https://github.com/mbrlabs/Lorien)
* [下载 Lorien](https://github.com/mbrlabs/Lorien/releases)
#### 6、Rainbow Board
Rainbow Board 是一个基于 Electron 和 React 的自由开源的白板应用。一般来说,因为它们的性能和笨重的性质,人们不喜欢 Electron 应用程序。但是,既然我们要列出这个类别的应用,我认为这个应用是值得一提的。
它有一个标准的画布,支持触摸和手写笔绘制。工具箱包括画笔尺寸、颜色、填充颜色、字体、撤销和重做动作。你可以将你的绘图导出为 PNG 或 SVG 文件。

这个应用程序有 Snap、Flatpak 和独立的 deb 安装程序。你可以从下面的链接中的页面下载它们。
* [主页](https://harshkhandeparkar.github.io/rainbow-board/)
* [源代码](https://github.com/HarshKhandeparkar/rainbow-board)
* [下载 Rainbow Board](https://www.electronjs.org/apps/rainbow-board)
### 荣誉提名
我想在这里提到的最后两个绘图应用程序是 Vectr 和 Ecxalidraw。这些是基于网络的白板绘图应用程序。我把它们放在一个单独的部分,因为它们不是桌面应用程序。
所以,如果你不愿意再安装一个应用程序;或者使用的是学校或工作系统,没有权限安装,你可以打开网络浏览器,使用这些。以下是它们的网址:
* [Vectr](https://vectr.com/)
* [Ecxalidraw](https://excalidraw.com/)
### 总结
这就是一些适用于 Linux 和其他操作系统的现代白板 [绘图](https://www.debugpoint.com/tag/digital-drawing) 应用程序。由于疫情和在家工作的原因,你们中的许多人可能正在用纸笔为你们的在线课程或课堂做笔记。我相信这些会对你的学习工作有所帮助。
试试这些,你一定会找到最适合你的那一个。请在下面的留言框中告诉我你对这份清单的意见或反馈。
加油!
---
via: <https://www.debugpoint.com/2022/02/top-whiteboard-applications-linux/>
作者:[Arindam](https://www.debugpoint.com/author/admin1/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) | null |
14,273 | 将应用程序迁移到容器的 5 个步骤 | https://opensource.com/article/22/2/migrate-application-containers | 2022-02-14T22:45:02 | [
"容器"
] | https://linux.cn/article-14273-1.html |
>
> 如果你是容器的新手,不要被那些术语所吓倒。这些关键原则将帮助你把应用迁移到云中。
>
>
>

一般来说,人们想使用你的应用程序这是一件好事。然而,当应用程序在服务器上运行时,应用程序受欢迎是有代价的。随着用户对资源需求的增加,在某些时候,你可能会发现你需要扩展你的应用程序。一种选择是在这种情况下增加更多的服务器,建立一个像 Nginx 这样的 [负载平衡器](https://opensource.com/article/21/4/load-balancing),以满足需求。但是,这种方法的成本可能很昂贵,因为当需求低的时候,在没有流量的服务器上运行你的应用程序的实例并不会节省资源。容器的优点是它是非持久的,在有需求时启动新实例,而随着需求的减少逐渐消失。如果这听起来像是你需要的功能,那么现在可能是将你的应用程序迁移到容器的时候了。
将应用程序迁移到容器中,很快就会变得迷失方向。虽然容器内的环境可能感觉很熟悉,但许多容器镜像是最小化的,而且它们被设计为无状态的。不过在某种程度上,这也是容器的优势之一。就像 Python 虚拟环境一样,它是一块白板,可以让你构建(或重建)你的应用程序,而没有许多其他环境所提供的无形的默认值。
每一次向云服务的迁移都是独一无二的,但在将你的应用程序移植到容器之前,你应该注意以下几个重要原则。
### 1、理解你的依赖关系
将你的应用程序移植到容器中是一个很好的机会,可以了解你的应用程序实际依赖的东西。由于除了最基本的系统组件外,很少有默认安装的组件,你的应用程序一开始不太可能在容器中运行。
在重构之前,确定你的依赖关系。首先,在你的源代码中用 `grep` 查找 `include`、`import`、`require`、`use` 或你选择的语言中用来声明依赖关系的任何关键词。
```
$ find ~/Code/myproject -type f \
-iname ".java" \
-exec grep import {} \;
```
不过,仅仅识别你使用的特定语言的库可能是不够的。审计依赖关系,这样你就能知道是否有语言本身运行所需的低级库,或者特定的模块以预期的功能运行。
### 2、评估你的数据存储
容器是无状态的,当一个容器崩溃或停止运行时,该容器的实例就永远消失了。如果你要在该容器中保存数据,这些数据也会消失。如果你的应用程序存储用户数据,所有的存储必须发生在容器之外,在你的应用程序的实例可以访问的某个位置。
你可以使用映射到容器内某个位置的本地存储来存储简单的应用程序配置文件。这是一种常见的技术,适用于需要管理员提供简单配置值的 Web 应用程序,如管理员的电子邮件地址、网站标题等。比如说:
```
$ podman run \
--volume /local/data:/storage:Z \
mycontainer
```
然而,你可以配置一个数据库,如 MariaDB 或 PostgreSQL,将大量数据在几个容器中的共享存储。对于私人信息,如密码,[你可以配置一个机密存储](https://www.redhat.com/sysadmin/new-podman-secrets-command)。
对于你需要如何重构你的代码,相应地调整存储位置,这可能意味着改变路径到新的容器存储映射,移植到不同的数据库,甚至是纳入容器特定的模块。
### 3、准备好你的 Git 仓库
容器在构建时通常会从 Git 仓库中拉取源代码。一旦你的 Git 仓库成为你的应用程序的生产就绪代码的标准来源,你必须有一个管理 Git 仓库的计划。要有一个发布分支或生产分支,并考虑使用 [Git 钩子](http://redhat.com/sysadmin/git-hooks) 来拒绝意外的未经批准的提交。
### 4、了解你的构建系统
容器化应用程序可能没有传统的发布周期。当容器被构建时,它们会被从 Git 中拉取出来。你可以启动任何数量的构建系统作为容器构建的一部分,但这可能意味着调整你的构建系统,使其比过去更加自动化。你应该重构你的构建过程,使你完全有信心它能在无人值守的情况下工作。
### 5、构建镜像
构建镜像不一定是复杂的任务。你可以使用 [现有的容器镜像](https://www.redhat.com/sysadmin/top-container-images) 作为基础,用一个简单的 Docker 文件对其进行调整。另外,你也可以使用 [Buildah](https://opensource.com/article/22/1/build-your-own-container-scratch) 从头开始构建你自己的镜像。
在某种程度上,构建容器的过程与实际重构代码一样,都是开发的一部分。容器的构建是为了获取、组装和执行你的应用程序,所以这个过程必须是自动化的、健壮的。建立一个好的镜像,你就为你的应用程序建立了一个坚实可靠的基础。
### 容器化
如果你是容器的新手,不要被术语所吓倒。容器只是另一种环境。容器化开发的感知约束实际上可以帮助你专注于你的应用程序,并更好地了解它是如何运行的、它需要什么才能可靠地运行,以及当出错时有哪些潜在的风险。相反,这导致系统管理员在安装和运行你的应用程序时受到的限制要少得多,因为从本质上讲,容器是一个受控的环境。仔细审查你的代码,了解你的应用程序需要什么,并相应地重构它。
---
via: <https://opensource.com/article/22/2/migrate-application-containers>
作者:[Alan Smithee](https://opensource.com/users/alansmithee) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | Generally, you consider it a good thing when people want to use your application. However, when the application runs on a server, there's a cost for popularity. With users come increased demands on resources, and at some point, you may find that you need to scale your app. One option is to throw more servers at the problem, establish a [load balancer](https://opensource.com/article/21/4/load-balancing) like Nginx, and let the demand sort itself out. That option can be expensive, though, because there are no savings when demand is low, and you're running instances of your app on servers devoid of traffic. Containers have the advantage of being ephemeral, launching when new instances are available and fading away with decreased demand. If that sounds like a feature you need, then it may be time to migrate your app to containers.
Migrating an app to a container can quickly become disorienting. While the environment within a container may feel familiar, many container images are minimal, and they are designed to be stateless. In a way, though, this is one of the strengths of containers. Like a Python virtual environment, it's a blank slate that lets you build (or rebuild) your application without the invisible defaults that many other environments provide.
Every migration is unique, but here are a few important principles you should address before porting your application to containers.
## 1. Understand your dependencies
Porting your application to a container is an excellent opportunity to get to know what your app actually depends upon. With very few default installs of all but the most essential system components, your application is unlikely to run within a container at first.
Before refactoring, identify your dependencies. Start with a `grep`
through your source code for
or `include``import`
or `require`
or `use`
or whatever keyword your language of choice uses to declare dependencies.
```
$ find ~/Code/myproject -type f \
-iname ".java" \
-exec grep import {} \;
```
It may not be enough to identify just language-specific libraries you use, though. Audit dependencies, so you know whether there are low-level libraries required for the language itself to run or a specific module to function as expected.
## 2. Evaluate your data storage
Containers are stateless, and when one crashes or otherwise stops running, that instance of the container is gone forever. If you were to save data in that container, the data would also disappear. If your application stores user data, all storage must occur outside of the container, in some location accessible to an instance of your application.
You can use local storage mapped to a location within your container for simple application configuration files. This is a common technique for web apps that require the administrator to provide simple config values, such as an admin email address, a website title, and so on. For example:
```
$ podman run \
--volume /local/data:/storage:Z \
mycontainer
```
However, you can configure a database like MariaDB or PostgreSQL as shared storage across several containers for large amounts of data. For private information, such as passwords, [you can configure a secret](https://www.redhat.com/sysadmin/new-podman-secrets-command).
**[ Download our MariaDB cheat sheet ]**
Regarding how you need to refactor your code, you must adapt the storage locations accordingly. This might mean changing paths to new container storage mappings, ports to different database destinations, or even incorporating container-specific modules.
## 3. Prepare your Git repo
Containers generally pull source code from a Git repository as they get built. You must have a plan for managing your Git repository once it becomes the canonical source of production-ready code for your application. Have a release or production branch, and consider using [Git hooks](http://redhat.com/sysadmin/git-hooks) to reject accidental unapproved commits.
## 4. Know your build system
Containerized applications probably don't have traditional release cycles. They're pulled from Git when a container gets built. You can initiate any number of build systems as part of your container build, but that might mean adjusting your build system to be more automated than it used to be. You should refactor your build process such that you have total confidence that it works completely unattended.
## 5. Build an image
Building an image doesn't have to be a complex task. You can use [existing container images](https://www.redhat.com/sysadmin/top-container-images) as a basis, adapting them with a simple Dockerfile. Alternately, you can build your own from scratch using [Buildah](https://opensource.com/article/22/1/build-your-own-container-scratch).
The process of building a container is, in a way, as much a part of development as actually refactoring your code. It's the container build that obtains, assembles, and executes your app, so the process must be automated and robust. Build a good image, and you're building a solid and reliable foundation for your app.
## Containerize it
If you're new to containers, don't be intimidated by terminology. A container is just another environment. The perceived constraints of containerized development can actually help you focus your application and better understand how it runs, what it needs to run reliably, and what potential risks there are when something goes wrong. Conversely, this results in far fewer constraints for sysadmins installing and running your app because containers are, by nature, a controlled environment. Review your code carefully, understand what your app needs, and refactor it accordingly.
## Comments are closed. |
14,274 | 用 Starship 定制你的 shell 提示符 | https://opensource.com/article/22/2/customize-prompt-starship | 2022-02-14T23:22:40 | [
"提示符"
] | https://linux.cn/article-14274-1.html |
>
> 控制你的提示符,让你需要的所有信息触手可及。
>
>
>

没有什么比我忘记在我的 Git 仓库中 `git add` 文件更让我恼火的了。我在本地测试,提交,然后推送,却发现在持续集成阶段失败了。更糟糕的是,我在 `main` 分支而不是特性分支上,并不小心推送到它。最好的情况是,因为分支保护而失败,我需要做一些操作才能把改动推送到一个分支。更糟糕的是,我没有正确配置分支保护,不小心直接推送到了 `main` 分支。
如果这些信息能在提示中直接获得,那不是很好吗?
在提示符中甚至还有更多有用的信息。虽然 Python 虚拟环境的名称在提示符中,但虚拟环境的 Python 版本却不在提示符中。
可以仔细地将 `PS1` 环境变量配置为所有相关的信息。这可能会变得很长,很烦人,而且调试起来并不简单。
这就是 Starship 被设计来解决的问题。
### 安装 Starship
Starship 的初始设置只需要两个步骤:安装并配置你的 shell。安装可以很简单:
```
$ curl -fsSL https://starship.rs/install.sh
```
阅读安装脚本,确保你理解它的作用,然后让它可执行并运行它:
```
$ chmod +x install.sh
$ ./install.sh
```
还有其他的安装方法,在其网站上有介绍。你可以在构建镜像的步骤中设置虚拟机或容器。
### 配置 Starship
下一步是配置你的 shell 来使用它。要一次性尝试,假设 shell 是 `bash` 或 `zsh`,请运行以下命令:
```
$ eval "$(starship init $(basename $SHELL))"
```
你的提示符立即改变:
```
localhost in myproject on master
>
```
如果你喜欢你所看到的,把 `eval "$(starship init $(basename $SHELL))"` 添加到你的 shell 的 `rc` 文件中,使其永久化。
### 自定义 Starship
默认安装假定你可以安装“电脑迷字体”,例如 [Fantasque Sans Mono](https://github.com/belluzj/fantasque-sans)。 特别是,你需要一种带有来自 Unicode 的“私有实现”部分的字形的字体。
这在控制终端时非常有效,但有时,终端的配置并不容易。例如,当使用一些浏览器内的 shell 抽象时,配置浏览器的字体可能是不太容易的。
该码位的最大用户是 Git 集成,它使用一个特殊的自定义符号来表示“分支”。禁用它可以通过使用文件 `~/.config/starship.toml` 来配置 `starship.rs`。
禁用分支符号是通过配置 `git_branch` 部分的 `format` 变量完成的:
```
[git_branch]
format = "on [$branch]($style) "
```
`starship.rs` 的一个好处是,改变配置会立即生效。保存文件,按下**回车**,看看字体是否符合预期。
还可以配置提示符中不同部分的颜色。例如,如果 Python 部分的亮黄色在白色背景上有点难看,你可以配置为蓝色:
```
[python]
style = "blue bold"
```
许多语言都有配置支持,包括 Go、.NET 和 JavaScript。还支持显示命令的持续时间(只针对耗时超过阈值的命令)等。
### 控制提示符
控制你的提示符,让你需要的所有信息触手可及。安装 Starship,让它为你工作,并享受吧!
---
via: <https://opensource.com/article/22/2/customize-prompt-starship>
作者:[Moshe Zadka](https://opensource.com/users/moshez) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | Nothing irritates me more than when I forget to `git add`
files in my Git repository. I test locally, commit, and push, only to find out it failed in the continuous integration phase. Even worse is when I'm on the `main`
branch instead of a feature branch and accidentally push to it. The best-case scenario is that it fails because of branch protection, and I need to do some surgery to get the changes to a branch. Even more worse, I did not configure branch protection properly, and I accidentally pushed it directly to `main`
.
Wouldn't it be nice if the information was available right in the prompt?
There is even more information that is useful in the prompt. While the name of Python virtual environments is in the prompt, the Python version the virtual environment has is not.
It is possible to carefully configure the `PS1`
environment variable to all relevant information. This can get long, annoying, and non-trivial to debug.
This is the problem that Starship got designed to solve.
## Install Starship
The initial setup for Starship only requires two steps: Installing and configuring your shell to use it. Installation can be as simple as:
`$ curl -fsSL https://starship.rs/install.sh`
Read over the install script to make sure you understand what it does, and then make it executable and run it:
```
$ chmod +x install.sh
$ ./install.sh
```
There are other ways to install, covered on the website. You can develop virtual machines or containers at the image-building step.
## Configuring Starship
The next step is to configure your shell to use it. To try it as a one-off, assuming the shell is `bash`
or `zsh`
, run the following:
`$ eval "$(starship init $(basename $SHELL))"`
Your prompt changes immediately:
```
localhost in myproject on master
>
```
If you like what you see, add `eval "$(starship init $(basename $SHELL))"`
to your shell's `rc`
file to make it permanent.
## Customizing Starship
The default installation assumes that you can install a "Nerd font," such as [Fantasque Sans Mono](https://github.com/belluzj/fantasque-sans). You want, particularly, a font with glyphs from Unicode's "private implementation" section.
This works great when controlling the terminal, but sometimes, the terminal is not easy to configure. For example, when using some in-browser shell abstraction, configuring the browser font can be non-trivial.
The biggest user of the code points is the Git integration, which uses a special custom symbol for "branch." Disabling it can be done by configuring `starship.rs`
using the file `~/.config/starship.toml`
.
Disabling the branch symbol is done by configuring the `git_branch`
section's `format`
variable:
```
[git_branch]
format = "on [$branch]($style) "
```
One of the nice things about `starship.rs`
is that changing the configuration has an immediate effect. Save the file, press **Enter**, and see if the font looks as intended.
It's also possible to configure the color of different sections in the prompt. For example, if the Python section's bright yellow is a bit harder to see on a white background, you can configure blue:
```
[python]
style = "blue bold"
```
There is configuration support for many languages, including Go, .NET, and JavaScript. There is also support for showing command duration (only for commands which take longer than a threshold) and more.
## Take the con
Take control of your prompt, and have all the information you need at your fingertips. Install Starship, make it work for you, and enjoy!
## 1 Comment |
14,276 | KDE 的新进展将为树莓派和 PinePhone Pro 用户提供极大帮助 | https://news.itsfoss.com/kde-apps-arm/ | 2022-02-15T22:31:03 | [
"KDE",
"ARM"
] | https://linux.cn/article-14276-1.html |
>
> KDE 分享了它在应用开发方面的计划和迄今为止的进展。不但有新的应用发布,如 Falkon 3.2,在 ARM 平台方面也有有趣的进展。
>
>
>

KDE 最近像往常一样分享了它的月度更新,介绍了最新的应用发展和进展。
虽然 [Falkon 3.2 版本](https://news.itsfoss.com/falkon-browser-3-2-release/) 是一个重要的升级,但还有其他几个 KDE 应用程序的更新/bug 修复。
然而,有一件有趣的事情。
KDE 开始为 ARM 平台提供应用程序了。
但是,这究竟是什么意思呢?让我们来看看!
### KDE 应用于 ARM:一个令人兴奋的发展!
你可以在各种仓库、Flatpak 和 Snap 商店中找到 KDE 应用程序。
而 KDE 选择了 Snap 商店来发布其第一个用于 ARM64 的 Snap 软件包。
换句话说,KDE 应用程序正在以 Snap 的方式进入 ARM 平台。
当然,对于一个应用程序来说,支持各种平台和各种发行版是有意义的,所有这些都在单一的商店提供。
第一个可用于 ARM64 的 Snap 软件包是 [kblocks](https://snapcraft.io/kblocks)。

这是一个经典的掉落式积木游戏,它是一个有趣的游戏,也许对于 ARM 平台来说不算什么。
然而,如果你有树莓派或 PinePhone Pro,这意味着你可以期待有更多为 ARM 平台优化的 KDE 应用程序通过 Snap 商店提供。
### ARM 芯片的未来
考虑到 ARM 平台的早期发展,与现有的设备数量相比,我认为这是很好的进展。
就目前而言,树莓派用户和 PinePhone pro 用户可以立即从新的 KDE 应用程序中受益。
当我们开始看到更多的由 ARM 驱动的设备或笔记本电脑时,你可以期望大家都开始为 ARM 做准备。
希望在时机成熟时,Linux 平台及其应用程序将为 ARM 平台做好准备。
我们应该避免出现像苹果 M1 系列那样的情况,在没有适当的应用生态系统可用的情况下,性能会有很大的不同。
关于 KDE 应用程序以 Snap 包支持 ARM64,你怎么看?假设你有一个树莓派或 PinePhone Pro,你对它的未来有什么期待?
请在下面的评论中告诉我你的想法。
---
via: <https://news.itsfoss.com/kde-apps-arm/>
作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

KDE recently shared its monthly updates on the latest app developments and progress, as usual.
While the [Falkon 3.2 release](https://news.itsfoss.com/falkon-browser-3-2-release/) was a significant upgrade, there were several other updates/bug fixes to other KDE applications.
However, there was one interesting thing about it.
KDE is starting to make applications available for the ARM Platforms.
But, what does it mean exactly? Let’s take a look!
## KDE Apps for ARM: An Exciting Development!
You can find KDE apps on various repositories, Flatpak, and the Snap store.
And, KDE chose the Snap store to publish its first Snap for ARM64.
In other words, KDE applications are making their way as a Snap to the ARM platform.
Of course, it makes sense for an application to support a variety of platforms and various distributions, all from a single store.
The first Snap available for ARM64 is [kblocks](https://snapcraft.io/kblocks?ref=news.itsfoss.com).

Considering that it is a classic falling blocks game, and a fun idea, it may not be a big deal for the ARM platform.
However, if you have a Raspberry Pi or a PinePhone Pro, it should be a good indication to expect more KDE apps optimized for the ARM platform available through the Snap store.
## The Future with ARM Chips
Considering the early developments for the ARM platform, I’d say it is good progress when compared to the number of devices available.
As of now, the Raspberry Pi users and the PinePhone pro users can immediately benefit from new KDE applications.
As we start to see more ARM-powered devices or laptops, you should expect almost everyone to start prepping for ARM.
Hopefully, the Linux platform and its applications will be ready for the ARM platform when the time comes.
We should avoid a situation like Apple’s M1 series, where the performance makes a big difference without having a proper app ecosystem available.
*What do you think about KDE apps available as a Snap for ARM64? Assuming you have a Raspberry Pi or PinePhone Pro, what do you expect for its future?*
Let me know your thoughts in the comments below.
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,278 | Turris Omnia:一个黑客喜欢的开源路由器 | https://opensource.com/article/22/1/turris-omnia-open-source-router | 2022-02-16T19:38:00 | [
"路由器"
] | https://linux.cn/article-14278-1.html |
>
> 无论你是一个网络工程师还是一个好奇的爱好者,当你在市场上购买网络设备时,都你应该看看开源的 Turris Omnia 路由器。
>
>
>
在 21 世纪初,我对 OpenWrt 很着迷,只想在自己的路由器上运行它。不幸的是,我没有一个能够运行自定义固件的路由器,所以我花了很多周末去旧货地摊,希望能偶然发现一个 “Slug”(黑客们对 NSLU2 路由器的俚语),但这是徒劳的。最近,我买到了 Turris Omnia,除了有一个更酷的名字外,它是一个来自捷克的路由器,使用建立在 OpenWrt 之上的开源固件。它拥有你对运行开源硬件所期望的一切,而且还有很多东西,包括可安装的软件包,因此你可以准确地添加你的家庭或企业网络最需要的东西,而忽略你不会使用的部分。如果你认为路由器是简单的设备,没有定制的余地,甚至除了 DNS 和 DHCP 之外没有其他用途,那么你需要看看 Turris Omnia。它将改变你对路由器是什么的看法,路由器能为你的网络做什么,甚至是你与整个网络的互动方式。

### 开始使用 Turris Omnia
尽管 Turris Omnia 的功能很强大,但它给人的感觉却很熟悉。开始使用的步骤与任何其他路由器基本相同:
1. 打开电源
2. 加入它提供的网络
3. 在网络浏览器中进入 192.168.1.1 进行配置
如果你过去买过路由器,你以前会执行过这些相同的步骤。如果你不熟悉这个过程,要知道它并不比任何其他路由器复杂,而且里面有足够的文档。

### 简单和高级配置
在初始设置之后,当你进入 Turris Omnia 路由器时,你可以选择简单配置环境或高级配置。你必须从简单配置开始。在<ruby> 密码 <rt> Password </rt></ruby>面板中,你可以为高级界面设置一个密码,这也可以让你对路由器进行 SSH 访问。
简单界面让你配置如何连接到广域网(WAN),并为你的局域网(LAN)设置参数。它还允许你设置一个个人 WiFi 接入点、一个访客网络,以及安装插件并与之互动。
它所声称的高级界面叫做 LuCI。它是为熟悉网络拓扑和设计的网络工程师设计的,它基本上是一个键值对的集合,你可以通过一个简单的网络界面进行编辑。如果你喜欢直接编辑数值,你可以用 SSH 进入路由器。
```
$ ssh [email protected]
[email protected]'s password:
BusyBox v1.28.4 () built-in shell (ash)
______ _ ____ _____
/_ __/_ ____________(_)____ / __ \/ ___/
/ / / / / / ___/ ___/ / ___/ / / / /\__
/ / / /_/ / / / / / (__ ) / /_/ /___/ /
/_/ \__,_/_/ /_/ /_/____/ \____//____/
-----------------------------------------------------
TurrisOS 4.0.1, Turris Omnia
-----------------------------------------------------
root@turris:~#
```
### 插件
除了界面的灵活性之外,Turris Omnia 还有一个包管理器。你可以安装插件,包括网络附加存储(NAS)配置、Nextcloud 服务器、SSH 蜜罐、速度测试、OpenVPN、打印服务器、Tor 节点、运行容器的 LXC 等等。

只需点击几下,你就可以安装自己的 [Nextcloud](https://opensource.com/tags/nextcloud) 服务器,这样你就可以运行自己的云服务或 OpenVPN,这样你就可以在离家时安全地访问你的网络。
### 开源路由器
这个路由器最好的部分是它是开源的,并且通过开源提供支持。你可以从他们的 [gitlab.nic.cz](https://gitlab.nic.cz/turris) 下载 Turris 操作系统和许多相关的开源工具。你也不必满足于设备上的固件。有了 2GB 的内存和 miniPCIe 插槽,你可以在上面运行 Debian。甚至前面板上的 LED 灯也是可编程的。这是一个黑客的路由器,无论你是一个网络工程师还是一个好奇的业余爱好者,当你在市场上购买网络设备时,你都应该看一看它。
你可以从 [turris.com](https://www.turris.com/en/) 网站上获得 Turris Omnia 和其他几个型号的路由器,然后加入 [forum.turris.cz](http://forum.turris.cz) 的社区。他们是一群友好的爱好者,热衷于分享知识、技巧和很酷的黑客技术,以促进你对开源路由器的使用。
---
via: <https://opensource.com/article/22/1/turris-omnia-open-source-router>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | In the early 2000s, I was fascinated by OpenWrt and wanted nothing more than to run it on a router of my own. Unfortunately, I didn't have a router capable of running custom firmware, and so I spent weekends going to garage sales hoping in vain to stumble upon a "Slug" (the slang term hackers were using for the NSLU2 router). Recently, I got hold of the Turris Omnia, which, aside from having a much cooler name, is a router from the Czech Republic using open source firmware built on top of OpenWrt. It has everything you'd expect from hardware running open source, and quite a lot more, including installable packages so you can add exactly what your home or business network needs the most while ignoring the parts you won't use. If you've viewed routers as simple appliances with no room for customization or even utility beyond DNS and DHCP, then you need to look at the Turris Omnia. It'll change your perception of what a router is, what a router can do for your network, and even how you interact with your entire network.

(Seth Kenlon, CC BY-SA 4.0)
## Getting started with Turris Omnia
For all its power, the Turris Omnia feels comfortingly familiar. The steps to get started are essentially the same as with any other router:
- Power it on
- Join the network it provides
- Navigate to 192.168.1.1 in a web browser to configure
If you've bought a router in the past, you'll have performed those same steps before. If you're new to this process, know that it's no more complicated than any other router, and ample documentation comes in the box.

(Seth Kenlon, CC BY-SA 4.0)
## Simple and advanced configuration
After initial setup, when you navigate to the Turris Omnia router, you have a choice between a simple configuration environment or advanced. You have to begin with the simple configuration. In the **Password** panel, you can set a password for the advanced interface, which also grants you SSH access to the router.
The simple interface lets you configure how you connect to the wide-area network (WAN) and set parameters for your local-area network (LAN). It also allows you to set up a personal WiFi access point, a guest network, and install and interact with plugins.
The advanced interface, called LuCI, is exactly what it claims. It's for the network engineer who's familiar with network topography and design, and it's essentially a collection of key and value pairs that you can edit through a simple web interface. If you prefer to edit values directly, you can instead SSH into the router:
```
$ ssh [email protected]
[email protected]'s password:
BusyBox v1.28.4 () built-in shell (ash)
______ _ ____ _____
/_ __/_ ____________(_)____ / __ \/ ___/
/ / / / / / ___/ ___/ / ___/ / / / /\__
/ / / /_/ / / / / / (__ ) / /_/ /___/ /
/_/ \__,_/_/ /_/ /_/____/ \____//____/
-----------------------------------------------------
TurrisOS 4.0.1, Turris Omnia
-----------------------------------------------------
root@turris:~#
```
## Plugins
In addition to the flexibility of its interface, the Turris Omnia also features a package manager. You can install plugins, including Network Attached Storage (NAS) configuration, a Nextcloud server, an SSH honeypot, speed test, OpenVPN, print server, a Tor node, LXC for running containers, and much more.

(Seth Kenlon, CC BY-SA 4.0)
With just a few clicks, you can install your own [Nextcloud](https://opensource.com/tags/nextcloud) server so you can run your own cloud services or OpenVPN so you can safely access your network when you're away from home.
## Open source router
The best part about this router is that it's open source and supports open source. You can download Turris OS and many related open source tools from their [gitlab.nic.cz](https://gitlab.nic.cz/turris). You don't have to settle for the firmware that ships on the device, either. With 2 GB of RAM and miniPCIe slots, you can run Debian on it. Even the LEDs in the front panel are programmable. This is a hacker's router, and whether you're a network engineer or a curious hobbyist, you ought to take a look at it the next time you're in the market for network gear.
You can get the Turris Omnia and several other router models from the [turris.com](https://www.turris.com/en/) website, and then join the community at [forum.turris.cz](http://forum.turris.cz). They're a friendly bunch of enthusiasts, eager to share knowledge, tips, and cool hacks to further what you can do with your open source router.
## 4 Comments |
14,279 | 如何在 Kubuntu 21.10 中升级 KDE Plasma 5.24 | https://www.debugpoint.com/2022/02/kde-plasma-5-24-kubuntu-21-10/ | 2022-02-17T09:37:50 | [
"KDE"
] | /article-14279-1.html | 
>
> KDE 开发人员启用了有名的 Backports PPA,以便你在 Kubuntu 21.10 中安装/升级到 KDE Plasma 5.24。 以下是方法。
>
>
>
KDE Plasma 5.24 最近的 [发布](https://kde.org/announcements/plasma/5/5.24.0/) 带来了令人兴奋的变化。在这个新版本中,你会得到一个全新的概览页面,它很像 GNOME 的概览。此外,还有崭新的默认 Breeze 主题、性能提升、通知外观的调整等。在我们的 [官方综述页面][2] 可以阅读更多关于这些功能的信息。
如果你很匆忙,没有时间阅读文章,这里有一组简短的命令,可以做到这些。?
```
sudo add-apt-repository ppa:kubuntu-ppa/backports
sudo apt update
sudo apt full-upgrade
```
如果你运行 Kubuntu 21.10 Impish Indri,你不会马上得到这个更新。因为 Kubuntu 21.10 Impish Indri 目前采用 KDE Plasma 5.22.5 作为稳定版本。尽管 Kubuntu 21.10 计划在 2022 年 7 月结束生命,但你仍然可以通过 Backports PPA 安装 KDE Plasma 5.24。
然而,请注意,你将在 2022 年 4 月的 Kubuntu 22.04 LTS 中得到 KDE Plasma 5.24,这要比 Kubuntu 21.10 的寿命结束早得多。
### 如何在 Kubuntu 21.10 中安装 KDE Plasma 5.24
下面是你如何将 Kubuntu 21.10 中现有的 KDE Plasma 更新到最新版本。
#### 如何在 Kubuntu 21.10 中安装 KDE Plasma 5.24
如果你习惯使用“<ruby> 发现 <rt> Discover </rt></ruby>” 感到满意,请添加 Backports PPA `ppa:kubuntu-ppa/backports` 作为软件源并点击更新。一旦检索到更新的软件包信息,就可以安装。
我建议使用以下终端方法,以获得更快和无错误的安装。
打开 Konsole,运行以下命令来添加 backports PPA。如果你喜欢,你可以验证你运行的 Plasma 是什么版本。
```
sudo add-apt-repository ppa:kubuntu-ppa/backports
```

现在,刷新软件包列表并验证最新的 5.24 软件包是否可供升级。

现在运行最后的命令来启动升级。
```
sudo apt full-upgrade
```
上面的命令会下载大约 270MB 以上的软件包。升级过程大约需要 10 分钟。命令完成后,重启你的系统。
而你应该通过 Kubuntu 21.10 Impish Indri 获得了全新的 KDE Plasma 5.24。

#### 如何在 Ubuntu 21.10 中与 GNOME 一起安装 KDE Plasma 5.24
如果你正在运行带有默认 GNOME 的 Ubuntu 21.10 Impish Indri,你也可以体验全新的 KDE Plasma 桌面,只需对上述命令稍作修改即可。
打开一个终端,依次运行下面的命令。
```
sudo add-apt-repository ppa:kubuntu-ppa/backpots
sudo apt update
sudo apt install kubuntu-desktop
```
上述命令完成后,重启系统。在登录页面上,选择 KDE Plasma 作为桌面环境。然后你就可以开始了。
这将与 GNOME 桌面一起安装 KDE Plasma 5.24。
#### 我可以在 Ubuntu 20.04 LTS 中安装 KDE Plasma 5.24 吗?
Ubuntu 20.04 LTS 版有早期的 KDE Plasma 5.18、KDE Framework 5.68、KDE Applications 19.12.3。所以,在它的整个生命周期中,它不会收到最新的 KDE 更新。所以,从技术上讲,你可以添加上述 PPA 并安装 KDE Plasma 5.24。但我不建议这样做,因为不兼容的软件包框架可能会导致系统不稳定。
所以,建议你使用 Kubuntu 21.10 和上述的 Backports PPA 或者使用 KDE Neon 来体验最新的 Plasma 桌面。
### 如何卸载
在任何时候,如果你想回到 KDE Plasma 桌面的原始版本,那么你可以安装 `ppa-purge` 并删除 PPA,接着刷新软件包。
打开一个终端,依次执行以下命令。
```
sudo apt install ppa-purge
sudo ppa-purge ppa:kubuntu-ppa/backports
sudo apt update
```
当命令完成,重启你的系统。
### 结束语
我希望这个快速指南能让你从不同的使用情况下全面升级到 KDE Plasma 5.24。希望你能在没有任何错误的情况下完成升级。
请在下面的评论栏里告诉我进展如何。
---
via: <https://www.debugpoint.com/2022/02/kde-plasma-5-24-kubuntu-21-10/>
作者:[Arindam](https://www.debugpoint.com/author/admin1/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) | null |
14,280 | Kali Linux 2022.1 发布:引入了新的“全都有”离线 ISO | https://news.itsfoss.com/kali-linux-2022-1-release/ | 2022-02-17T11:26:58 | [
"Kali",
"ISO"
] | https://linux.cn/article-14280-1.html |
>
> Kali Linux 在 2022 年的第一次升级带来了明显的视觉更新和一个新的“全都有”离线 ISO。
>
>
>

2022 年的第一个 Kali Linux 版本来了。
Kali Linux 在 2021 年做了许多改进,包括 Linux 内核升级、新的黑客工具、实时虚拟机支持([Kali Linux 2021.3](https://news.itsfoss.com/kali-linux-2021-3-release/))、苹果 M1 支持等等。
让我们来看看 Kali Linux 2022.1 版本中的主要亮点。
### Kali Linux 2022.1 有什么新内容?
从这个版本开始,Kali Linux 团队决定对他们每年的 20xx.1 版本(每年的第一个版本)进行明显的视觉更新。
因此,Kali Linux 2022.1 的更新带来了视觉上的刷新和其他新的增加和改变。
#### 主题更新

随着最新的升级,你可以看到一些新的桌面、登录和启动屏幕的壁纸。
安装程序的主题也得到了视觉上的更新,使其具有现代的外观。
总的来说,通过主题更新、新壁纸和细微的布局变化,你可以期待从 UEFI/BIOS 启动菜单到桌面的统一用户体验。

浏览器的登录页面也有了视觉上的更新,让你可以访问 Kali 文档和工具,以及通常的搜索功能。

#### 新的 “全都有” ISO
Kali Linux 现在将提供一个新的分发方式,提供一个独立的离线 ISO,包括了 “kali-linux-everything” 软件包的所有内容。
这个产品的目的是让你下载一个离线 ISO,而不需要在安装后单独下载软件包。
它应该对偏远地区的教育机构使用 Kali Linux 进行道德黑客学习很有帮助。
考虑到它是一个大的 ISO 文件(大小达 9.4GB),你只能通过 BitTorrent 找到这个 ISO。
#### 对 VMware 的 i3 桌面的改进
如果你在带有 i3 桌面环境的虚拟机上使用 Kali Linux,一些客户功能是默认禁用的。
现在,这些功能,如拖放、复制/粘贴已经默认启用,可以给你更好的开箱即用的 i3 虚拟机的体验。
#### 其他改进
除了关键的新增功能外,Kali Linux 2022.1 还带来了新的工具和整体改进。其中一些值得强调的包括。
* 在 Kali 设置屏幕中使用带有合成语音的无障碍性改进。
* 新的工具,如 dnsx、email2phonenumber、naabu、proxify 等等。
* 可用于 ARM64 架构的新软件包,包括 feroxbuster 和 ghidra。
* [Linux 内核 5.15](https://news.itsfoss.com/linux-kernel-5-15-release/)。
* 你现在可以使用 kali-tweaks 中的设置来启用传统的算法、密码和 SSH。
* 对 shell 提示符进行了调整,删除了骷髅头图标、退出码和后台进程数量的显示。
总的来说,这个版本对桌面和树莓派的重大改进值得期待。
你可以通过 [官方公告](https://www.kali.org/blog/kali-linux-2022-1-release/) 了解更多细节。
### 下载 Kali Linux 2022.1
你可以前往其 [官方网站](https://www.kali.org/get-kali/),选择你打算下载的平台。
值得注意的是,“全都有” 的版本只能通过种子下载。所以,你得用 [Torrent 客户端](https://itsfoss.com/best-torrent-ubuntu/)。
如果你已经使用 Kali Linux,你可以使用以下命令进行快速更新:
```
echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" | sudo tee /etc/apt/sources.list
sudo apt update && sudo apt -y full-upgrade
cp -rbi /etc/skel/. ~
[ -f /var/run/reboot-required ] && sudo reboot -f
```
---
via: <https://news.itsfoss.com/kali-linux-2022-1-release/>
作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

The first Kali Linux release of 2022 is here.
Kali Linux made numerous improvements in 2021 with its Linux Kernel upgrade, new hacking tools, live VM support ([Kali Linux 2021.3](https://news.itsfoss.com/kali-linux-2021-3-release/)), Apple M1 support, and more.
Let us look at the key highlights in the Kali Linux 2022.1 release.
## Kali Linux 2022.1: What’s New?
Starting with this release, the Kali Linux team decided to introduce major visual updates to their yearly 20xx.1 release (the first release of every year).
So, Kali Linux 2022.1 update brings in visual refresh and other new additions/changes.
### Theme Updates

With the latest upgrade, you get to see some new wallpapers for the desktop, login, and boot screens.
The installer theme has also received a visual refresh, giving it a modern look.
Overall, with a theme update, new wallpapers, and subtle layout changes, you can expect a uniform user experience starting from the UEFI/BIOS boot menu to the desktop.

The browser landing page has also received a visual update giving you access to Kali documentation and tools along with the usual search function.

### New “Everything” Flavor ISO
Kali Linux will now offer a new flavor, as a standalone offline ISO that includes everything from “kali-linux-everything” packages.
This offering aims to let you download an offline ISO without needing to download the packages after installation separately.
It should come in handy for educational institutes in remote areas using Kali Linux for ethical hacking learning.
You can only find this flavor available through BitTorrent, considering it a big ISO file (up to 9.4 GB in size).
### Improvements to i3 Desktop for VMware
If you were using Kali Linux on a VM with an i3 desktop environment, some guest features were disabled by default.
Now, those features like drag ‘n’ drop, copy/paste have been enabled by default giving you a better out-of-the-box experience in a VM with i3.
### Other Improvements
Along with the key additions, Kali Linux 2022.1 brings in new tools and improvements overall. Some of them worth highlighting include:
- Accessibility improvements with speech synthesis in the Kali setup screen.
- New tools like dnsx, email2phonenumber, naabu, proxify, etc.
- New packages available for ARM64 architecture that include feroxbuster and ghidra.
[Linux Kernel 5.15](https://news.itsfoss.com/linux-kernel-5-15-release/)- You can now enable legacy algorithms, ciphers, SSH using a setting in kali-tweaks
- Tweaks to the shell prompt to remove the skull icon, exit code, and number of background processes
Overall, you should expect significant improvements for desktop and Raspberry Pi with this release.
You can go through the [official announcement post](https://www.kali.org/blog/kali-linux-2022-1-release/?ref=news.itsfoss.com) for more details.
## Download Kali Linux 2022.1
You can head to its [official website](https://www.kali.org/get-kali/?ref=news.itsfoss.com) and choose the platform you intend to download for.
It is important to note that the ‘Everything’ flavor is only available to download via Torrents. So, you will have to utilize some [torrent clients](https://itsfoss.com/best-torrent-ubuntu/?ref=news.itsfoss.com).
If you already use Kali Linux, you can perform a quick update using the following commands:
```
echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" | sudo tee /etc/apt/sources.list
sudo apt update && sudo apt -y full-upgrade
cp -rbi /etc/skel/. ~
[ -f /var/run/reboot-required ] && sudo reboot -f
```
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,282 | Nobara:一个为游戏量身定做的非官方 Fedora Linux 35 衍生版 | https://news.itsfoss.com/fedora-nobara-gaming/ | 2022-02-18T14:18:44 | [
"游戏"
] | https://linux.cn/article-14282-1.html |
>
> Nobara 项目添加了必要的软件包/工具,并修复了一些问题,使 Fedora Linux 适合游戏,并计划在未来进行进一步的完善!
>
>
>

Fedora 35 是一个令人印象深刻的 Linux 发行版,在这个版本中首次推出了 GNOME 41 并引入了一个新的 KDE 变体。
你可以阅读我们的 [原始报道](https://news.itsfoss.com/fedora-35-release/),了解更多关于它的信息。
虽然 Fedora Linux 一直在不断改进桌面体验,但它可能不是每个用户的理想桌面发行版。此外,即使它包括开箱即用的开源工具和实用程序,它也不是为了提供毫不费力的游戏体验。
你需要安装一些依赖性的东西,并配置好发行版,才能轻松地玩一个游戏。
由红帽工程师 Thomas Crider(又名 Glorious Eggroll)发起 的 Nobara 项目旨在改变这种状况,并提供一个为游戏而生的非官方 Fedora 35 工作站衍生版。
### Nobara 工作站 35 有什么新东西?
Fedora 35 支持几个 Linux 游戏。然而,如果你需要使用 Proton 或 Wine 来玩 Windows 专属的游戏,你得配置一些东西,并可能需要排除一些游戏中的故障。
所以,Nobara 项目旨在提供一个非官方的衍生版,为其添加用户友好的修复,使其成为 Linux 玩家的理想选择。

#### 对于 Fedora 35 的小白用户
如果你已经使用了一段时间的 Linux,并且能够自如地使用 Linux终端,你应该知道 [在 Linux 上设置 Wine](https://itsfoss.com/use-windows-applications-linux/)、Proton 和安装任何额外的编解码器是相当容易的。
然而,对于依赖预装包和软件中心提供的应用程序的小白用户来说,他们需要做出一些努力来了解它。
#### Lutris、Steam、OBS Studio 和 Kdenlive 预装版
Lutris 可以帮助你在 Linux 上管理和进行游戏。不要忘了,它已经 [帮助 Linux 成长为一个适合游戏的平台](https://news.itsfoss.com/lutris-creator-interview/),提供了一个易于使用的 GUI,让用户可以玩只支持 Windows 的游戏。
使用 Nobara 工作站 35,已经预装了 Lutris。这个项目背后的开发者也正好在维护 Lutris。因此,可以在 Nobara 工作站 35 上看到 Lutris 的最新版本。
不仅仅是 Lutris,你还会得到 Steam、OBS Studio 和 Kdenlive 的支持。
当然,顺便说一句,你也会得到标准的 Fedora 工作站软件包。
#### 对游戏的修复
在 Fedora 35 上玩几个游戏时有一些已知的问题。该项目提到,游戏开发者希望 Fedora 解决这些问题,显然,Fedora 将问题抛给了游戏开发者。而这些问题仍然没有解决。
因此,在 Nobara 工作站 35 中,其中一些问题已经得到解决。问题如:
* 由于 libusb 和 xow(Xbox One 无线加密狗的驱动)的问题导致 CPU 负载过高
* 为 Dying Light 添加必要的符号链接
#### X11 作为默认的显示服务器
Wayland 可能提供了比 X11 会话更多的技术改进。然而,X11 与游戏的兼容性更好。
此外,它也是 AMD 的 FSR 技术、以及 [Steam Play/Proton](https://itsfoss.com/steam-play/) 和 Wine 的一些其他东西的可以工作的必要条件。
#### 其他变化
考虑到 Nobara 工作站 35 相对较新,令人惊讶的是,你可以发现一些明显的不同。
一些值得一提的关键亮点包括:
* Nobara 工作站 35 禁用了 Fedora 官方软件库中的一些软件包,而倾向于使用自己的。例如,与 Fedora 的官方软件库相比,你应该在 Nobara 的软件库中找到一个更新一些的 Lutris 版本。
* Nobara 工作站 35 使用了一个定制的内核。
* [RPM Fusion 仓库](https://itsfoss.com/fedora-third-party-repos/) 是默认启用的。
* 用于 Wine 64/32 位游戏兼容性的额外软件包。
开发者计划很快通过添加以下内容来进一步改进它。
* 添加自定义的 OBS Studio 及浏览器集成插件,和 vulkan+opengl 捕捉支持。
* Nobara 特定的主题设计。
* 包括 [Proton-GE](https://github.com/GloriousEggroll/proton-ge-custom) 和 Lutris Win-GE 的构建。
你可以在其 [官方网站](https://nobaraproject.org/) 上了解其他技术变化。
### 结束语
如果 Nobara 项目使 Fedora Linux 适用于游戏,我们应该多了一个 [以游戏为重点的 Linux 发行版](https://itsfoss.com/linux-gaming-distributions/)。
对于适应 Fedora Linux 的 Linux 玩家来说,这将是一个不错的选择。
* [下载 Nobara 工作站 35](https://nobaraproject.org/)
你可以从其官方网站下载合适的 ISO(GNOME 和 KDE 版本)来尝试。请注意,这是一个相当新的衍生版,所以在它取代作为你的日常用机之前,你可能要三思而行。
你对 Noboara 项目有什么看法?我们是否需要一个针对游戏的 Fedora Linux 版本?请在评论中告诉我你的想法。
---
via: <https://news.itsfoss.com/fedora-nobara-gaming/>
作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Fedora 35 is an impressive Linux distribution that debuted with GNOME 41 and introduced a new KDE variant.
You can read our [original coverage](https://news.itsfoss.com/fedora-35-release/) to know more about it.
While Fedora Linux has constantly been improving the desktop experience, it may not be an ideal desktop distribution for every user. Moreover, even if it includes open-source tools and utilities out of the box, it is not geared to provide an effortless gaming experience.
You need to install a few dependencies and configure the distro to play a game without hassle.
Nobara Project by Thomas Crider (Red Hat Engineer) a.k.a. Glorious Eggroll aims to change that and offer an unofficial Fedora 35 Workstation spin built for gaming.
## Nobara Workstation 35: What’s New?
Fedora 35 is capable of handling several Linux games. However, if you need to play Windows-exclusive titles using Proton or Wine, you will have to configure a few things and probably need to troubleshoot in some titles.
So, Nobara Project aims to provide an unofficial spin that adds user-friendly fixes to it and makes it ideal for Linux gamers.

### Fedora 35 for Point and Click User
If you have been using Linux for a while and are comfortable using the Linux terminal, you should know that it is fairly easy to [set up Wine on Linux](https://itsfoss.com/use-windows-applications-linux/?ref=news.itsfoss.com), Proton and install any additional codecs.
However, for a point-and-click user who relies on pre-installed packages and apps available from the software center, they need to make some effort to learn about it.
### Lutris, Steam, OBS Studio, and Kdenlive Pre-Installed
Lutris helps you organize and play games on Linux. Not to forget, it has [helped Linux grow as a platform suitable for gaming](https://news.itsfoss.com/lutris-creator-interview/) by providing an easy-to-use GUI that lets users play Windows-only games and more.
With Nobara Workstation 35, you will have Lutris pre-installed. The developer behind this project also happens to maintain Lutris. So, you should expect the latest version of Lutris on Nobara Workstation 35.
Not just Lutris, but you also get Steam, OBS Studio, and Kdenlive baked in.
Of course, you do get the standard Fedora-Workstation packages, in case you were wondering.
### Fixes for Games
There are some known issues when playing a couple of games on Fedora 35. The project mentions that game developers want Fedora to resolve those issues, and apparently, Fedora points the figure at the game devs. And the problems remain unsolved.
So, with Nobara Workstation 35, some of these issues have been addressed. Problems like:
- High CPU load due to an issue with libusb and xow (driver for Xbox One wireless dongle)
- Adding a necessary symlink for Dying Light
### X11 as the Default Display Server
Wayland may offer technical improvements over the X11 session. However, X11 provides better compatibility with games.
Furthermore, it is also required for AMD’s FSR tech to work, and a few other things with [Steam Play/Proton](https://itsfoss.com/steam-play/?ref=news.itsfoss.com), and Wine.
### Other Changes
Considering Nobara Workstation 35 is relatively new, surprisingly, you can find some noticeable differences.
Some key highlights worth mentioning include:
- Nobara Workstation 35 disables a few packages from Fedora’s official repositories, favoring its own. For instance, you should find a newer Lutris version on Nobara’s repo compared to Fedora’s official repositories.
- Nobara Workstation 35 uses a custom kernel.
- The
[RPM Fusion repositories](https://itsfoss.com/fedora-third-party-repos/?ref=news.itsfoss.com)are enabled by default. - Additional packages for Wine 64/32-bit game compatibility.
The developer plans to improve it further by adding the following soon:
- Add custom OBS Studio with browser integration plugin and vulkan+opengl capture support
- Nobara specific theming
- Include
[Proton-GE](https://github.com/GloriousEggroll/proton-ge-custom?ref=news.itsfoss.com)and Lutris Wine-GE builds
You can learn about the other technical changes on its [official website](https://nobaraproject.org/?ref=news.itsfoss.com).
## Closing Thoughts
If the Nobara Project makes Fedora Linux suitable for gaming, we should have one more [gaming-focused Linux distribution](https://itsfoss.com/linux-gaming-distributions/?ref=news.itsfoss.com).
It would be a good option for Linux gamers comfortable with Fedora Linux.
You can try it out by downloading the suitable ISO (GNOME and KDE editions) from its official website. Note that this is a fairly new spin, so you might want to think twice before replacing it as your daily driver.
*What do you think about Noboara Project? Do we need a Fedora Linux flavor geared for gaming? Let me know your thoughts in the comments.*
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,283 | 我在源码控制中维护点文件的技巧 | https://opensource.com/article/22/2/dotfiles-source-control | 2022-02-18T14:50:19 | [
"点文件"
] | https://linux.cn/article-14283-1.html |
>
> 当你把环境保持在源码控制中,开发虚拟机和容器就成了一个解决方案,而不是一个问题。
>
>
>

你是否曾经开始使用一台新的电脑,不管是出于自愿还是因为旧的电脑让你的魔法烟消云散,并且对花了多长时间才把所有东西都 *弄好* 而感到沮丧?更糟糕的是,有没有花了一些时间重新配置你的 shell 提示符,然后意识到你更喜欢以前的样子?
对我来说,当我决定要在 [容器](https://opensource.com/tags/containers) 中进行开发时,这个问题就变得很严重了。容器是非持久的。开发工具很容易解决:一个带有工具的容器镜像就可以工作。源码很容易解决:源码控制维护它,开发是在分支上。但是,如果每次我创建一个容器,我都需要仔细地配置它,这就太痛苦了。
### 主目录的版本控制
将配置文件保存在版本控制中一直是一个有吸引力的选择。但是天真地这么做是令人担忧的。不可能直接对 `~` 进行版本控制。
首先,太多的程序认为把秘密放在那里是安全的。此外,它也是 `~/Downloads` 和 `~/Pictures` 等文件夹的位置,这些文件夹可能不应该被版本化。
小心翼翼地在主目录下保留一个 `.gitignore` 文件来管理 `include` 和 `exclude` 列表是有风险的。在某些时候,其中一个路径会出错,花费了几个小时的配置会丢失,大文件会出现在 Git 历史记录中,或者最糟糕的是,秘密和密码会被泄露。当这一策略失败时,它就成了灾难性的失败。
手动维护大量的符号链接也是行不通的。版本控制的全部原因是为了避免手动维护配置。
### 写一个安装脚本
这暗示了在源码控制中维护点文件的第一条线索:写一个安装脚本。
就像所有好的安装脚本一样,让它 *幂等*:运行两次不会两次增加配置。
像所有好的安装脚本一样,让它 *只做最少的事情*:使用其他的技巧来指向你的源码控制中的配置文件。
### ~/.config 目录
现代 Linux 程序在直接在主目录中寻找配置之前,会先在 `~/.config` 中寻找。最重要的例子是 `git`,它在 `~/.config/git` 中寻找。
这意味着安装脚本可以将 `~/.config` 符号链接到主目录中源码控制的管理目录中的一个目录:
```
#!/bin/bash
set -e
DOTFILES="$(dirname $(realpath $0))"
[ -L ~/.config ] || ln -s $DOTFILES/config ~/.config
```
此脚本寻找它的位置,然后将 `~/.config` 链接到它被签出的地方。这意味着几乎没有关于它需要位于主目录中的位置的假设。
### 获取文件
大多数 shells 仍然直接在主目录下寻找文件。为了解决这个问题,你要增加一层指示。从 `$DOTFILES` 中获取文件意味着在修改 shell 配置时不需要重新运行安装程序。
```
$!/bin/bash
set -e
DOTFILES="$(dirname $(realpath $0))"
grep -q 'SETTING UP BASH' ~/.bashrc || \
echo "source $DOTFILES/starship.bash # SETTING UP BASH" >> ~/.bashrc
```
再次注意,这个脚本很仔细地做了幂等:如果这一行已经在那里了,它就不会再添加。它还考虑到了你在 `.bashrc` 上已经做的任何编辑,虽然这不是一个好主意,但也没有必要惩罚它。
### 反复测试
当你把环境保持在源码控制中时,开发虚拟机和容器就成了一个解决方案,而不是一个问题。试着做一个实验。建立一个新的开发环境,克隆你的点文件,安装,并看看有什么问题。
不要只做一次。至少每周做一次。这将使你更快地完成工作,同时也会告诉你什么是不可行的。暴露问题,修复它们,然后重复。
---
via: <https://opensource.com/article/22/2/dotfiles-source-control>
作者:[Moshe Zadka](https://opensource.com/users/moshez) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | Ever started using a new computer, by choice or because the old one let the magic smoke out, and got frustrated at how long it took to get everything *just* right? Even worse, ever spent some time reconfiguring your shell prompt, then realizing you liked it better before?
This problem, for me, became acute when I decided I wanted to do development in [containers](https://opensource.com/tags/containers). Containers are ephemeral. The development tooling is easy to solve: A container image with the tooling works. The source code is easy to solve: Source control maintains it, and development happens on branches. But if every time I create a container, I need to configure it carefully—that's going to be a pain.
## Revision control at home
Keeping configuration files in version control has always been an attractive option. But doing so naively is fraught. It is not possible to directly version `~`
.
For one, too many programs assume it's safe to keep secrets there. It's also the location of folders like `~/Downloads`
and `~/Pictures`
, which should probably not be versioned.
Carefully keeping a `.gitignore`
file at the home directory to manage *include* and *exclude* lists is risky. At some point, one of the paths gets wrong. Hours of configuration are lost, big files end up in the Git history, or, worst of all, secrets and passwords get leaked. When this strategy fails, it fails catastrophically.
Manually maintaining a sea of symlinks also does not work. The whole reason for revision control is to avoid maintaining configuration manually.
## Write an install script
This hints at the first clue about maintaining dotfiles in source control. Write an installation script.
Like all good installation scripts, make it *idempotent*: Running it twice should not add the configuration twice.
Like all good installation scripts, make it *only do the minimum*: Use whatever other tricks to point to the configuration files in your source control.
## The ~/.config directory
Modern Linux programs look for their configuration in `~/.config`
before looking for it directly in the home. The most important example is `git`
, which looks for it in `~/.config/git`
.
This means the installation script can symlink `~/.config`
to a directory inside a source-controlled managed directory in the home directory:
```
``````
#!/bin/bash
set -e
DOTFILES="$(dirname $(realpath $0))"
[ -L ~/.config ] || ln -s $DOTFILES/config ~/.config
```
This script looks for its location and then symlinks `~/.config`
to wherever it was checked out to. This means that there are few assumptions about where it needs to be inside the home directory.
## Sourcing files
Most shells still look for files directly in the home directory. To solve this, you add a layer of indirection. Sourcing files from `$DOTFILES`
means that there is no need to rerun the installer when modifying the shell configuration:
```
``````
$!/bin/bash
set -e
DOTFILES="$(dirname $(realpath $0))"
grep -q 'SETTING UP BASH' ~/.bashrc || \
echo "source $DOTFILES/starship.bash # SETTING UP BASH" >> ~/.bashrc
```
Again, notice that the script is careful to be idempotent: If the line is already there, it does not add it again. It is also considerate of any editing you have already done on `.bashrc`
. While this is not a good idea, there is no need to punish it.
## Test and test again
When you keep the environment in source control, development VMs and containers become a solution, not a problem. Try an experiment: Bring up a new development environment, clone your dotfiles, install, and see what breaks.
Don't do it just once. Do it weekly, at least. This makes you faster at it, and it also informs you about what does not work—open issues, fix them, and repeat.
## 1 Comment |
14,285 | Bottles:在 Linux 上轻松安装 Windows 应用程序 | https://news.itsfoss.com/bottles-2022-2-14-release/ | 2022-02-19T15:45:15 | [
"Bottles",
"Windows",
"虚拟环境"
] | https://linux.cn/article-14285-1.html |
>
> 随着最新发布的更新,Bottles 正在成为一个近乎完美的解决方案,无需任何特别的努力就可以在 Linux 上安装 Windows 应用程序。
>
>
>

你可以 [使用 Wine 在 Linux 上安装 Windows 应用程序](https://itsfoss.com/use-windows-applications-linux/),但它并不适用所有的应用程序。此外,它还需要你手动配置东西。那么,有什么简单的选择呢?
虽然 [CrossOver](https://news.itsfoss.com/crossover-21-1-0-release/) 一直在尽力使这个过程更容易,但还另一个解决方案:Bottles。
随着 Bottles 的最新发布,它的目标是更加顺滑地以最小的调整来运行你喜欢的 Windows 应用程序。
### Bottles 2022.2.14 的新变化
该版本带来了一些新功能、改进和大量的错误修复。让我强调一下以下关键变化:
#### 安装程序
以下是开发者对新功能的介绍:
>
> 这些是由 Bottles 解释的指令集,以重现程序的安装。这个过程是由维护者写在清单文件中的,他们能够按照同样的步骤安装程序。
>
>
>

简单来说,这些一键式安装程序会自动安装软件,而不需要你手动调整什么。这类似于 [Lutris](https://lutris.net/) 帮助游戏玩家安装一个需要大量调整的游戏。
目前只有不多的几个安装程序,主要是第三方游戏启动程序。用户如果想安装像 Origin 这样的程序,可以简单地在他们的首选“瓶子”中进入安装程序部分,点击下载按钮。(LCTT 译注:“瓶子”指一个虚拟环境。)
开发人员还承诺,你可以期待很快有更多的安装程序。
#### 一个专门的应用程序商店
为了展示可用的安装程序,他们在其官方网站上推出了一个 [应用商店](https://usebottles.com/appstore/)。它包含了所有可用安装程序的列表和必要的信息,如依赖性、配置和支持的架构。用户可以期待更多有用的功能,如评论功能很快就会到来。

需要注意的一点是,并不是所有的安装程序都能完美无缺地工作。因此,开发者引入了一种叫做“等级”的东西,指的是安装的程序的顺利工作的程度。分级范围从铜级到白金级,与 Wine 的兼容性评级方式非常相似。
用户可以放心,每个安装程序至少都可以运行该程序并执行程序所需完成的主要功能。但除非安装程序被评为白金级,否则用户应该对错误、图形故障和崩溃的出现有所预期。此外,安装程序也会与还原点一起工作。
#### 新的搜索栏
拥有多个“瓶子”的用户现在可以使用全新的搜索功能来寻找特定的“瓶子”。请注意,它在默认情况下是隐藏的,如果你至少安装了 10 个“瓶子”,就会自动启用。

我觉得,作为搜索栏的基本功能应该已经实现了,总比没有强!
#### “瓶子”的自定义路径
以前,用户不能为“瓶子”设置自定义路径。在这个版本中,用户可以在偏好部分中实现这一功能。如果用户的存储空间不足,并计划使用一个单独的驱动器,这非常有帮助。
请注意,Flatpak 用户得专门为 Bottles 启用权限,以访问 Flatpak 环境之外的任何位置。你也可以试试 [Flatseal 来管理 Flatpak 的权限](https://itsfoss.com/flatseal/)。
#### 改进和错误修复
除了主要的功能升级外,还有一些有用的全面改进,一些值得强调的有:
* 可用于非 Flapak 软件包的运行环境,可通过首选项中的核心部分安装。
* 用户现在能够使用内置的任务管理器终止正在进行的进程。
* 用户还可以从位于上下文菜单中的终端中启动程序。
* 已经有了对 Gamescope 和 dxvk-async 组件的支持。
这个版本中也修复了各种基本的错误。其中包括 Flatpak 版本中游戏模式的修复,以及 DXVK 版本的改变,删除了初始备份。
你可以参考他们的 [官方发布说明](https://usebottles.com/blog/release-2022.2.14/) 来了解更多的技术细节。
### 总结
Bottles 的目标是成为每个运行 Windows 软件的 Linux 用户的必备应用。而且,有了所有这些改进,它看起来很有前景!
安装程序的增加应该对很多用户有极大的帮助。你怎么看?请在下面的评论中告诉我你的想法。
---
via: <https://news.itsfoss.com/bottles-2022-2-14-release/>
作者:[Rishabh Moharir](https://news.itsfoss.com/author/rishabh/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

You can [use Wine to install Windows apps on Linux](https://itsfoss.com/use-windows-applications-linux/?ref=news.itsfoss.com), but it does not work for all the applications. Moreover, it requires you to configure things manually. So, what are the easy options?
While [CrossOver](https://news.itsfoss.com/crossover-21-1-0-release/) has been trying its best to make the process easier, Bottles is another solution.
With Bottles’ latest release, it aims to make things seamless to help run your preferred Windows app with minimal tweaking.
## Bottles 2022.2.14: What’s New?
The release brings a few new features, improvements, and plenty of bug fixes. Let me highlight the key changes below.
### Installers
Here’s what the devs have to say about the new feature –
These are sets of instructions interpreted by Bottles to replicate the installation of a program. This process is written in manifest files by the maintainers, who were able to install the program following the same steps.

Basically, these one-click installers automatically install software without you needing to tweak anything manually. This is similar to how [Lutris](https://lutris.net/?ref=news.itsfoss.com) helps gamers install a game that requires heavy tweaking.
There are only a few installers, particularly third-party game launchers, available. Users who want to install a program like Origin, can simply go to the Installers section in their preferred bottle and hit the download button.
The devs also promise that you can expect more installers soon.
### A Dedicated App Store
To feature the available installers, they have launched an [AppStore](https://usebottles.com/appstore/?ref=news.itsfoss.com) on their official website. It contains a list of all available installers and necessary information like dependencies, configuration, and supported architecture. Users can expect more useful features like reviews to arrive soon.

An important point to note is that not all installers will work flawlessly. Thus, the devs have introduced something called “grades” that refers to how smooth the installed program will function. The grading scale ranges from Bronze to Platinum and is very similar to how Wine’s compatibility is rated.
Users can be assured that every installer will at least run the program and perform the main functionality the program is required to do. Users should expect bugs, graphical glitches, and crashes unless the installer is graded Platinum. Moreover, the installers will work with restore points as well.
### New Search Bar
Users with multiple bottles now have the ability to find a particular bottle using the all-new search functionality. Do note that it is hidden by default and will be automatically enabled if you have at least 10 bottles installed.

I feel a basic feature as a search bar should have been implemented already. But, better late than never!
### Custom Path for Bottles
Previously, users could not set a custom path for a bottle. With this release, users can do just that by navigating to the preferences section. This is very helpful if a user is low on storage and plans to use a separate drive.
Do note that Flatpak users will have to enable permissions for Bottles to access any location outside the Flatpak environment. You can try [Flatseal to manage Flatpak permissions](https://itsfoss.com/flatseal/?ref=news.itsfoss.com) as well.
### Improvements and Bug Fixes
In addition to the major feature upgrades, there are several useful improvements across the board, some worth highlighting include:
- Runtime available for non-Flapak package that can be installed through the core section in Preferences.
- Users now have the ability to terminate ongoing processes using the built-in task manager.
- Users can also launch programs from the terminal that’s located in the context menu.
- Support for Gamescope and dxvk-async as a component has arrived.
A variety of essential bug fixes also arrives with this release. Some of them include fixes for gamemode in the Flatpak version and the DXVK version change that removed the initial backup.
You can refer to their [official release notes](https://usebottles.com/blog/release-2022.2.14/?ref=news.itsfoss.com) to know more about the technical details.
## Closing Thoughts
Bottles aims to be a must-have app for every Linux user who deals with Windows software. And, with all these improvements, it looks promising!
The addition of installers should immensely help a lot of users. What do you think? Let me know your thoughts in the comments below.
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,286 | 在安卓手机上使用 Linux 终端 | https://itsfoss.com/using-linux-terminal-android/ | 2022-02-19T19:04:01 | [
"安卓",
"终端",
"Linux"
] | https://linux.cn/article-14286-1.html | 
想练习 Linux 命令吗?你不需要为此而安装一个完整的发行版。
有很多 [让你在线使用 Linux 终端的网站](https://itsfoss.com/online-linux-terminals/)。这些网站在桌面上运行良好,但在移动设备上却不适合。
别担心。安卓毕竟是基于 Linux 内核的。有几个应用程序可以让你用你的安卓智能手机练习 Linux 命令,或通过 SSH 连接到远程服务器。
当然,你不应该指望它能取代你在台式机上使用的常规 [Linux 终端仿真器](https://itsfoss.com/linux-terminal-emulators/)。在安卓上有相当多的这类应用。
为了方便起见,我添加了两个不同的类别,一个涵盖了终端模拟器,另一个是为远程连接功能(SSH)以及终端界面量身定做的。
>
> 非 FOSS 提醒!
>
>
> 这里提到的一些应用程序不是开源的,它们都做了适当的提示。它们被涵盖在这里是因为它们可以让你在安卓上使用 Linux 终端。
>
>
>
### Linux 终端仿真器应用
请注意,你需要在你的安卓手机上有 root 权限,才能使用 `ls` 等命令在目录中导航、复制/粘贴、并执行高级操作。
**注意:** 对于大多数应用程序/终端,没有 root 权限你将只限于基本的操作,如测试 ping、更新,以及在支持的地方安装包。
#### 1、Qute 终端仿真器(非 FOSS)

[Qute](https://play.google.com/store/apps/details?id=com.ddm.qute&hl=en_IN&gl=US) 终端模拟器提供了对你的安卓设备上的内置命令行 Shell 的访问。
你可以在你的智能手机上使用常见的命令,如 `ping`、`trace`、`cd`、`mkdir` 等等。除了一些 [有用的 Linux 命令](https://itsfoss.com/linux-command-tricks/) 之外,你还可以安装 bin 文件和创建 [shell 脚本](https://itsfoss.com/shell-scripting-resources/)。
伴随着 bash 脚本编辑器和对已 root 的设备的支持,它应该是一个令人兴奋的选择,可以尝试。
它还提供了启用浅色主题、隐藏键盘、切换语法高亮和其他一些功能。
不幸的是,开发者提到,根据谷歌最新的隐私政策,安卓 11 及更新版本存在一些已知的问题。因此,如果没有一个已 root 的设备,你可能做不了什么。
#### 2、安卓终端仿真器(FOSS)

Jack Palevich 的 “[终端仿真器](https://play.google.com/store/apps/details?id=jackpal.androidterm&hl=en_IN&gl=US)” 是最古老的可用于安卓的 Linux 终端仿真器之一。
你可以使用简单的命令、添加多个窗口,并使用启动器的快捷键进行快速操作。
它最好的地方是没有任何广告和应用内购买选项,也没有干扰性元素。然而,它已经很久没有被维护了,它的 [GitHub 页面](https://github.com/jackpal/Android-Terminal-Emulator/) 也在 2020 年被归档,这标志着它的开发已经结束。
但即使在目前的状态下,它似乎也对众多用户有用。因此,在否定它之前,你可以试试。
#### 3、Material Terminal(非 FOSS)

[Material Terminal](https://play.google.com/store/apps/details?id=yarolegovich.materialterminal&hl=en_IN&gl=US) 是 “安卓终端仿真器” 的重新换肤版本。
你可以获得相同的功能,有多个窗口、没有广告、基本命令开箱即用,还可以选择在已 root 的设备上安装 Busy Box,以及其他命令行工具。
简单的说,就是前一个选项中的一切,加上一个 Material Design 用户界面。很好,对吗?
### SSH 客户端和 Linux 终端
你想要一个能够使用 SSH 连接的安卓终端仿真器吗?或者,也许只是为 SSH 远程连接而定制?
这里有一些选择:
#### 4、Termux(FOSS)

[Termux](https://play.google.com/store/apps/details?id=com.termux) 是一个相当流行的可用于安卓的终端仿真器。它有一个全面的软件包集合,让你体验 bash 和 zsh。
如果你有 root 权限,你还可以 [用 nnn 管理文件](https://itsfoss.com/nnn-file-browser-linux/),并用 `nano`、`vim` 或 `emacs` 来编辑文件。用户界面除了终端外没有其他东西。
你还可以 [使用 SSH 访问服务器](https://linuxhandbook.com/ssh-basics/)。除此之外,你还可以用 clang、`make` 和 `gbd` 进行 C 语言开发。当然,这些都取决于你的需要,以及你是否有一个已 root 的设备。
你也可以查看它的 [GitHub 页面](https://github.com/termux/termux-app) 来解决发现的问题。截至目前,由于一些技术原因,Play Store 版本的更新已停止了。因此,如果可用的 Play Store 版本不能工作,你可以通过 [F-Droid](https://f-droid.org/en/packages/com.termux/) 安装最新版本。
#### 5、Termius(非 FOSS)

[Termius](https://play.google.com/store/apps/details?id=com.server.auditor.ssh.client&hl=en_IN&gl=US) 是一个 SSH 和 SFTP 的定制客户端,专门用于从安卓设备进行远程访问。
通过 Termius,你可以管理 UNIX 和 Linux 系统。Play Store 页面将其描述为一个漂亮的安卓版 Putty 客户端,这一点是正确的。
用户界面很容易理解,看起来并不令人困惑。它还支持 Mosh 和 Telnet 协议。
当你连接到一个远程设备时,它可以检测到操作系统,如树莓派、Ubuntu、Fedora。你也可以用你的键盘连接到运行这个应用程序的手机上工作。最重要的是,没有任何广告或横幅,使它成为一个完美的远程连接应用程序。
它确实提供了可选的高级服务(14 天免费试用),具有更多的功能,如加密的交叉同步、SSH 密钥代理转发、SFTP、终端标签等。你也可以在其 [官方网站](https://termius.com/) 上了解更多关于它的信息。
#### 6、JuiceSSH(非 FOSS)

[JuiceSSH](https://play.google.com/store/apps/details?id=com.sonelli.juicessh&hl=en_IN&gl=US) 是另一个流行的 SSH 客户端,有大量免费的功能和一个可选的专业版升级。
除了支持 Telnet 和 Mosh 之外,你还可以使用一些第三方插件来扩展功能。你可以从一系列可用的选项中调整外观,并按组轻松组织你的连接。
不要忘了,还有 IPv6 支持。
如果你选择专业版升级,你可以与 AWS 集成,启用安全同步,自动备份等等。
#### 7、ConnectBot(FOSS)

如果你想要的只是一个简单的 SSH 客户端,[ConnectBot](https://play.google.com/store/apps/details?id=org.connectbot&hl=en_IN&gl=US) 应该能满足你的需求。
你可以管理同时进行的 SSH 会话、创建安全隧道,并获得在其他应用程序之间复制/粘贴的能力。
### 赠品:无需 root 设备就能访问 Linux 发行版和命令
如果你没有已 root 的安卓手机,也不打算去 root 它,你有一个独特的选择,让你在智能手机上安装 Linux 发行版。
* [Andronix](https://andronix.app/) (部分开源)
你可以得到广泛的 Linux 发行版和琳琅满目的桌面环境以及窗口管理器。
最重要的是,你不需要一个已 root 的设备来使用各种 Linux 命令。你只需要安装你最喜欢的发行版就可以做到这一切。
除了使用方便外,它还提供高级选项,使你能够获得离线发行版安装和跨设备同步命令的能力。
当然,你安装了一个 Linux 发行版并不意味着你可以做所有事情,但它仍然是一个很好的选择。你可以在 [Play Store](https://play.google.com/store/apps/details?id=studio.com.techriz.andronix) 找到它,并在 [GitHub](https://github.com/AndronixApp) 上了解关于它的更多信息。
总结
--
在安卓上访问 Linux 终端并不像选择一个终端模拟器那么简单。你需要检查对命令的支持,以及它能让你在已 root 的、未 root 的设备上做什么,然后再继续。
如果你想做实验,任何一个选项都应该做得很好。
你的个人最爱是什么?我们是否错过了列出任何你的最爱?请在下面的评论中告诉我。
---
via: <https://itsfoss.com/using-linux-terminal-android/>
作者:[Ankush Das](https://itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Want to practice Linux commands? You don’t need to install a full-fledge distribution for that. There are plenty of [websites that let you use Linux terminal online](https://itsfoss.com/online-linux-terminals/).
Those websites work well on the desktop but not on the mobile devices.
Fret not. Android is based on Linux kernel, after all. There are several apps that let you use your Android smartphone to practice Linux commands to connect to a remote server via SSH.
Of course, you should not expect it to replace your regular [Linux terminal emulators](https://itsfoss.com/linux-terminal-emulators/) available for desktops. But, there are quite a few interesting options available for Android.
To make things easier, I added two different categories, one that covers terminal emulators, and the other tailored for remote connection capabilities (SSH) along with a terminal interface.
You can pick one as per your requirements.
**Some apps mentioned here are not open source, and they are duly labeled. They have been covered here because they let you use Linux terminal on Android.**
**Non-FOSS alert!****Section A: Top Linux Terminal Emulator Apps**
Note that you need root access on your Android phone to be able to use commands like ls to navigate through the directories, copy/paste, and perform advanced operations.
### 1. Qute: Terminal Emulator (Not FOSS)

Qute terminal emulator provides access to the built-in command-line shell on your Android device.
You can use popular commands like [ping](https://itsfoss.com/ping-command/), trace, cd, mkdir, and more on your smartphone. In addition to some [useful Linux commands](https://itsfoss.com/linux-command-tricks/), you can also install bin files and create [shell scripts](https://itsfoss.com/shell-scripting-resources/).
Along with the bash script editor and support for rooted devices, it should be an exciting option to try.
It also offers the ability to enable a light theme, hide the keyboard, toggle syntax highlighting, and a couple of other features.
Unfortunately, the developer mentions that as per Google’s latest privacy policies, there are known issues with Android 11 or latest. So, without a rooted device, you may not be able to do much.
### 2. Terminal Emulator for Android (FOSS)

Terminal Emulator by Jack Palevich is one of the oldest Linux terminal emulators available for Android.
You can use simple commands, add multiple windows, and use launcher shortcuts to make things quick.
The best thing about it is you do not get any ads, in-app purchase options, and no distracting elements. However, it is not being maintained for a long time, and its [GitHub page](https://github.com/jackpal/Android-Terminal-Emulator/?ref=itsfoss.com) was also archived in 2020 to mark the end of its development.
Even in its current state, it seems to be working for numerous users. So, you might want to try it out before dismissing it as an option.
### 3. Material Terminal (Not FOSS)

Material Terminal is a re-skin version of “Terminal Emulator for Android”.
You get to access the same features, with multiple windows, no ads, support for basic commands out of the box, and the option to install Busy Box, and other command-line utilities in a rooted device.
Basically, everything you’d want in the previous option with a Material Design user interface. Pretty good, right?
**Section B: SSH Client and Linux Terminal**
Do you want a terminal emulator on Android with the ability to connect using SSH? Or, maybe tailored just for SSH remote connections?
Here are some options:
### 4. Termux (FOSS)

Termux is a pretty popular terminal emulator available for Android. It features a comprehensive collection of packages that lets you experience bash and zsh shells.
Considering you have root access, you can also [manage files with nnn](https://itsfoss.com/nnn-file-browser-linux/) and edit them with nano, vim or emacs. The user interface does not have anything else besides the terminal.
You can also [access servers using SSH](https://linuxhandbook.com/ssh-basics/?ref=itsfoss.com). In addition to that, you also get to develop in C with clang, make, and gbd. Of course, these are subject to your taste and whether you have a rooted device or not.
You can also explore its [GitHub page](https://github.com/termux/termux-app?ref=itsfoss.com) to troubleshoot any issues. As of now, updates to the Play Store version is halted due to some technical reasons. So, you can install the latest version via [F-Droid](https://f-droid.org/en/packages/com.termux/?ref=itsfoss.com) if the available Play Store version does not work.
### 5. Termius (Non FOSS)

Termius is an SSH and SFTP client tailored to make remote access from Android devices possible.
With Termius, you can manage UNIX and Linux systems. The Play Store page describes it as a pretty Putty client for Android, and rightly so.
The user interface is easy to understand and doesn’t seem confusing. It also supports Mosh, and Telnet protocol.
When you connect to a remote device, it detects the OS like Raspberry Pi, Ubuntu, Fedora. You can also work using your keyboard connected to the mobile with this app. To top it all off, you get no ads or banners, making it a perfect little remote connection app.
It does offer an optional premium (14 days free trial) with more features like encrypted cross-sync, SSH key agent forwarding, SFTP, terminal tabs, and more. You can also explore more about it on its [official website](https://termius.com/?ref=itsfoss.com).
### 6. JuiceSSH (Non FOSS)

JuiceSSH is yet another popular SSH client with a bunch of free features and an optional pro upgrade.
In addition to Telenet and Mosh support, you also get access to some third-party plugins to extend functionalities. You get to tweak the appearance from a range of available options and easily organize your connections by group.
Not to forget, you also get IPv6 support.
If you opt for the pro upgrade, you can integrate with AWS, enable secure sync, automate backups, and more.
### 7. ConnectBot (FOSS)

If all you wanted is a simple SSH client, ConnectBot should serve you well.
You can handle simultaneous SSH sessions, create secure tunnels, and get the ability to copy/paste between other applications.
[Use Your Android Phone to Connect to Servers Via SSHTurn your Android phone into a portable mini-workstation with this tweaky guide!](https://linuxhandbook.com/server-ssh-android/)

### Bonus: Access Linux Distro And Commands Without a Rooted Device
If you do not have a rooted Android phone, nor plan to get it done, you have a unique option that lets you install Linux distros on your smartphone.
[Andronix](https://andronix.app/?ref=itsfoss.com) (partially open-source).
You get a wide range of Linux distributions and desktop environment options along with Window Managers.
The best thing is – you do not need a rooted device to use various Linux commands. You just need your favorite distro installed to do it all.
In addition to its ease of use, it also offers premium options that give you access to features like offline distro installation and the ability to sync your commands across devices.
Of course, just because you install a Linux distro does not mean that you can do everything, but it’s still a great option. You can find it in the [Play Store](https://play.google.com/store/apps/details?id=studio.com.techriz.andronix&ref=itsfoss.com) and explore more about it on [GitHub](https://github.com/AndronixApp?ref=itsfoss.com).
## Wrapping Up
Accessing the Linux terminal on Android isn’t as simple as choosing a terminal emulator. You will need to check support for commands, and what it can let you do with a rooted/non-rooted device, before you proceed.
If you want to experiment, any of the options should do a great job.
What’s your personal favorite? Did we miss listing any of your favorites? Let me know in the comments below. |
14,288 | 在 Linux 中解决 “Unacceptable TLS certificate” 的问题 | https://itsfoss.com/unacceptable-tls-certificate-error-linux/ | 2022-02-20T14:06:07 | [
"TLS",
"证书"
] | https://linux.cn/article-14288-1.html | 当涉及到 SSL/TLS 证书时,你可能会遇到各种问题,有些与浏览器有关,有些则是网站后台的问题。
其中一个错误是 Linux 中的 “Unacceptable TLS certificate”。
不幸的是,对此没有“一劳永逸”的答案。然而,有一些潜在的解决方案,你可以尝试,在此,我打算为你强调这些。
### 你什么时候会遇到这个 TLS 证书问题?

在我的例子中,我是在通过终端添加 Flathub 仓库时注意到这个问题的,这个步骤可以让你在 [设置 Flatpak](https://itsfoss.com/flatpak-guide/) 时访问大量的 Flatpak 集合。
然而,在安装 Flatpak 应用或通过终端使用来自第三方仓库的 Flatpak 参考文件时,你也可能会遇到这个错误。
一些用户在 Linux 上使用他们组织推荐的 VPN 服务工作时注意到这个问题。
那么,如何解决这个问题呢?为什么这是一个问题?
嗯,从技术上讲,这是两件事中的一个:
* 你的系统不接受该证书(并说它是无效的)。
* 该证书与用户连接的域不匹配。
如果是第二种情况,你得联系网站的管理员,从他们那里解决这个问题。
但是,如果是第一种情况,你有几种方法来处理它。
### 1、在使用 Flatpak 或添加 GNOME 在线账户时修复 “Unacceptable TLS certificate”
如果你试图添加 Flathub 远程或一个新的 Flatpak 应用,并在终端中注意到这个错误,你可以简单地输入:
```
sudo apt install --reinstall ca-certificates
```
这应该会重新安装受信任的 CA 证书,以防止列表中出现某种问题。

在我的例子中,当试图添加 Flathub 仓库时,我遇到了错误,通过在终端输入上述命令解决了这个问题。
所以,我认为任何与 Flatpak 有关的 TLS 证书问题都可以用这个方法解决。
### 2、在使用工作 VPN 时修复 “Unacceptable TLS certificate”
如果你使用你的组织的 VPN 来访问与工作有关的材料,你可能要把证书添加到你的 Linux 发行版中的可信 CA 列表中。
请注意,你需要 VPN 服务或你组织的管理员分享根证书的 .CRT 版本,才能开始使用。
接下来,你需要进入 `/usr/local/share/ca-certificates` 目录。
你可以下面创建一个目录,并使用任何名称来标识你组织的证书。然后,将 .CRT 文件添加到该目录。
例如,它是 `/usr/local/share/ca-certificates/organization/xyz.crt`。
请注意,你需要有 root 权限来添加证书或在 `ca-certificates` 目录下创建目录。
当你添加了必要的证书,你所要做的就是输入以下命令更新证书支持列表:
```
sudo update-ca-certificates
```
而且,每当你试图连接到你公司的 VPN 时,你的系统应将该证书视为有效。
### 总结
不可接受的 TLS 证书并不是一个常见的错误,但你可以在各种使用情况下发现它,比如连接到 GNOME 在线账户。
如果上述两种方法都不能解决这个错误,那么你所连接的域/服务有可能存在配置错误。在这种情况下,你将不得不联系他们来解决这个问题。
你是否遇到过这个错误?你是如何解决的?你是否知道这个问题的其他解决方案(有可能是容易操作的)?请在下面的评论中告诉我你的想法。
---
via: <https://itsfoss.com/unacceptable-tls-certificate-error-linux/>
作者:[Ankush Das](https://itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | When it comes to SSL/TLS certificates, you may come across a variety of issues, some related to the browser or a problem in a website’s back-end.
One such error is “Unacceptable TLS certificate” in Linux.
Unfortunately, there’s no “one-solves-it-all’ answer to this. However, there are some potential solutions that you can try, and here, I plan to highlight those for you.
## When do you encounter this TLS Certificate issue?

In my case, I noticed the issue when adding the Flathub repository via the terminal, a step that lets you access the massive collection of Flatpaks when [setting up Flatpak](https://itsfoss.com/flatpak-guide/).
However, you can also expect to encounter this error when installing a Flatpak app or using a Flatpak ref file from a third-party repository via the terminal.
Some users noticed this issue when using their organization’s recommended VPN service for work on Linux.
So, how do you fix it? Why is this a problem?
Well, technically, it’s either of two things:
- Your system does not accept the certificate (and tells that it’s invalid).
- The certificate does not match the domain the user connects to.
If it’s the second, you will have to reach out to the website’s administrator and fix it from their end.
But if it’s the first, you have a couple of ways to deal with it.
## 1. Fix “Unacceptable TLS certificate” when using Flatpak or adding GNOME Online Accounts
If you are trying to add Flathub remote or a new Flatpak application and notice the error in the terminal, you can simply type in:
`sudo apt install --reinstall ca-certificates`
This should re-install the trusted CA certificates, in case there has been an issue with the list in some way.

In my case, when trying to add the Flathub repository, I encountered the error, which was resolved by typing the above command in the terminal.
So, I think that any Flatpak-related issues with TLS certificates can be fixed using this method.
**If you do not use any Ubuntu-based distros**, let me share another experience of mine:
I encountered this error on Manjaro Linux:

While you can re-install ca-certificates on Manjaro Linux using the following command:
`sudo pacman -S ca-certificates`
Unfortunately, that may not work in most cases. But, when I enabled “**Automatic Date & Time**” under the Date and Time settings, the error was resolved, and I was able to install the Flatpak required.

## 2. Fix “Unacceptable TLS certificate” when using Work VPN
If you are using your organization’s VPN to access materials related to work, you might have to add the certificate to the list of trusted CAs in your Linux distro.
Do note that you need the VPN service or your organization’s administrator to share the .CRT version of the root certificate to get started.
Next, you will need to navigate your way to **/usr/local/share/ca-certificates** directory.
You can create a directory under it and use any name to identify your organization’s certificate. And, then add the .CRT file to that directory.
For instance, its usr/local/share/ca-certificates/organization/xyz.crt
Do note that you need root privileges to add certificates or make a directory under the **ca-certificates** directory.
Once you have added the necessary certificate, all you have to do is update the certificate support list by typing in:
`sudo update-ca-certificates`
And, the certificate should be treated valid by your system whenever you try to connect to your company’s VPN.
## Wrapping Up
An unacceptable TLS certificate is not a common error, but you can find it in various use cases, such as connecting to GNOME Online accounts.
If the error cannot be resolved by two of these methods, it is possible that the domain/service you are connecting to has a configuration error. In that case, you will have to contact them to fix the issue.
Have you faced this error anytime? How did you fix it? Are you aware of other solutions to this problem (potentially, something that’s easy to follow)? Let me know your thoughts in the comments below. |
14,289 | 10 个提升 GNOME 体验的最佳应用程序(一) | https://www.debugpoint.com/2021/12/best-gnome-apps-part-1/ | 2022-02-20T17:14:00 | [
"GNOME"
] | /article-14289-1.html | 
>
> 我们将给你详细介绍 10 个最好的 GNOME 应用程序,它们可以帮助你在这个神奇的桌面上顺滑地工作。
>
>
>
网上有数百个基于 GTK 的应用程序,它们大多没什么名声,不那么流行。这些应用程序被设计用来简化你的 GNOME 桌面体验,提供原生应用程序的感受。本系列文章的目的是为了提高这些应用程序的普及率,同时鼓励更多的用户参与和开发。
在这个《最佳 GNOME 应用程序》的系列文章中,我们将重点介绍一些或已知道、或不知道的基于 GTK 的原生应用程序,它们是专门为 GNOME 增加功能设计的。
在这篇文章中,我们介绍了以下 GNOME 应用程序:
* Geary - 电子邮件客户端
* Notejot - 简易笔记
* Hydrapaper - 支持多显示器的墙纸
* Solanum - 番茄时钟客户端
* Cawbird - Twitter 客户端
* News Flash - RSS 阅读器
* Fragments - BitTorrent 客户端
* MetadataCleaner - 清洁各种文件的元数据
* Kooha - 屏幕记录器
* Metronome - 节拍器
### Geary - 电子邮件客户端
当提到 [Linux 桌面上的原生电子邮件客户端](https://www.debugpoint.com/2019/06/best-email-client-linux-windows/) 时,大家想到的都是 Thunderbird。然而,如果你想在电子邮件客户端中获得更多的原生感受,那么你可以试试 Geary。Geary 是一个基于 GTK+ 的电子邮件客户端,它带给你的功能包括对话视图、邮件合并、只需两步的轻松设置、支持 IMAP/SMTP、用于撰写邮件的富文本编辑器以及许多很酷的功能。
你可以轻松地将其配置为你的默认电子邮件客户端,并用自定义配置选项来设置主要的电子邮件服务提供商,如 Gmail、雅虎、Outlook。

下面是你如何安装它的方法。
* 适用于 Debian/Ubuntu:`sudo apt install geary`
* 适用于 Fedora 和相关发行版:`sudo dnf install geary`
* [设置](https://flatpak.org/setup/) Flatpak,然后 [通过 Flathub 安装](https://flathub.org/repo/appstream/org.gnome.Geary.flatpakref)
更多信息:
* [主页](https://wiki.gnome.org/Apps/Geary)
* [源代码](https://gitlab.gnome.org/GNOME/geary)
#### Notejot - 简单笔记
想要一个“超简单”的 GNOME 记事本应用?那么 Notejot 就是你正在寻找的应用程序。这款灵巧的记事应用程序以其精心制作的直观的单窗口用户界面而显得非常出色。这款应用程序带来的功能包括多个笔记、笔记本功能、彩色笔记、标准文本格式等。这是一个完美的 GNOME 记事小程序。

* [设置](https://flatpak.org/setup/) Flatpak,然后 [通过 Flathub 安装](https://dl.flathub.org/repo/appstream/io.github.lainsce.Notejot.flatpakref)
更多信息:
* [源代码](https://github.com/lainsce/notejot)
#### Hydrapaper - 用于多显示器的壁纸更换器
这个 GTK 应用程序对于那些使用多显示器的人来说是一个福音。当你把多个显示器连接到一个系统时,所有的显示器都会显示相同的壁纸。但是如果你想在这些显示器上显示不同的图片,那么你可以使用这个叫做 Hydrapaper 的应用程序。这个 GTK 应用程序,很好地集成到了 GNOME 桌面,并为你提供了以下功能:
* 预览显示器的 ID 和它们所显示的内容
* 添加你的图片文件夹并在应用程序中浏览
* 收藏选项可以快速选择你最喜欢的一个壁纸
* 五种壁纸模式(缩放、黑色背景的适合/居中、模糊背景的适合/居中)。
* 随机壁纸模式
* 命令行选项,可以通过脚本来扩展它

下面是如何安装这个应用程序。
* 适用于 Debian/Ubuntu:`sudo apt install hydrapaper`
* 适用于 Fedora 和相关发行版:`sudo dnf install hydrapaper`
* Arch 用户可以在 [设置 yay](https://www.debugpoint.com/2021/01/install-yay-arch/) 后通过 AUR 安装它:`yay -S hydrapaper-git`
* 你也可以在 [设置](https://flatpak.org/setup/) 好 Flatpak 之后,[通过 Flathub 安装](https://flathub.org/apps/details/org.gabmus.hydrapaper)
更多信息:
* [主页](https://hydrapaper.gabmus.org/)
* [源代码](https://gitlab.gnome.org/gabmus/hydrapaper)
#### Solanum - 番茄时钟客户端
下一个 GNOME 应用程序叫做 Solanum,它是一个基于 [番茄时钟技术](https://en.wikipedia.org/wiki/Pomodoro_Technique) 的时间跟踪应用程序。该技术是将你的时间分成 25 分钟的小块,间隔有 5 分钟的休息时间,这被称为一个“<ruby> 番茄 <rt> Pomodoro </rt></ruby>”。4 个番茄之后,你可以休息更长时间。
这个应用程序可以帮助你做到这一点。Solanum 有一个非常简单的用户界面,在一个带有计时器的圈中显示“番茄”。切换“开始/停止”按钮帮助管理你的时间。这是一个非常有用的工具,特别是如果你在管理时间方面面临困难。

下面是如何安装它的方法。
* 你可以在 [设置](https://flatpak.org/setup/) 之后,[通过 Flathub 安装](https://dl.flathub.org/repo/appstream/org.gnome.Solanum.flatpakref)
更多信息:
* [主页](https://apps.gnome.org/app/org.gnome.Solanum/)
* [源代码](https://gitlab.gnome.org/World/Solanum)
#### Cawbird - Twitter 客户端
[Cawbird](https://ibboard.co.uk/cawbird/) 是一个基于 GTK 的 Twitter 客户端,用于 GNOME 桌面。它是那个在 Twitter API 变化后停止使用的 [Corebird](https://corebird.baedert.org/) 的一个复刻。这款应用非常适合你的 GNOME 桌面,并且拥有 Twitter 网站的所有功能。从资源上看,它是轻量级的。如果你是 Twitter 的忠实用户,那么你可以试试这个应用。

以下是安装步骤。
* Ubuntu/Debian,请使用 openSUSE 提供的 [预编译 DEB 包](https://software.opensuse.org//download.html?project=home%3AIBBoard%3Acawbird&package=cawbird)
* Fedora 及相关发行版:`sudo dnf install cawbird`
* 对于 Arch Linux,你可以通过以下方式安装它:`pacman -Syu cawbird`
* [以 Flatpak 方式安装](https://flathub.org/apps/details/uk.co.ibboard.cawbird)
* [以 Snap 方式安装](https://snapcraft.io/cawbird)
更多信息:
* [主页](https://ibboard.co.uk/cawbird/)
* [源代码](https://github.com/IBBoard/cawbird)
#### News Flash - RSS 阅读器
News Flash 是最好的 GNOME 应用程序之一,用于阅读你喜爱的网站的 RSS 提要。这个应用程序对你的 GNOME 桌面来说是完美的,因为它提供了很多功能。它能为你的新消息、未读消息提供弹出式通知,支持深色模式等。下面是对其功能的快速总结:
也许最令人兴奋的功能是能够直接在应用程序本身内部阅读文章,即使该 <ruby> 内容源 <rt> feed </rt></ruby> 不提供完整文章。它会试图从 URL 中获取文本,并在应用程序窗口中显示(没有图像)。
* 集成了流行的内容源
* 用 OPML 导入和导出内容源
* 支持暗色模式
* 读者模式
* 书签、搜索、导出文章选项
* 在设置中给你提供应用程序使用了多少磁盘空间来存储内容源的详细信息。

有兴趣吗?下面是如何安装的方法。
* 在 [初始设置](https://flatpak.org/setup/) 之后,[通过 Flathub 安装](https://flathub.org/apps/details/com.gitlab.newsflash)
* 如果你在 Arch Linux 中,你可以 [设置 Yay AUR 助手](https://www.debugpoint.com/2021/01/install-yay-arch/),然后使用下面的命令来安装:`yay -S newsflash`
更多信息:
* [主页](https://apps.gnome.org/app/com.gitlab.newsflash/)
* [源代码](https://gitlab.com/news-flash/news_flash_gtk)
#### Fragments - BitTorrent 客户端
Fragments 是一个简单的 BitTorrent 桌面客户端,构建在 GTK 上。虽然我们已经有了 Transmission 这个完美的 BitTorrent 客户端,它有独立的 GTK 和 QT 用户界面。但在 GNOME 桌面上有一个更简单的 BitTorrent 客户端也无妨,对吗?Fragments 有一个简单的界面,符合 GNOME 设计准则,并提供了 BitTorrent 客户端所需的所有功能。它也支持磁力链。

下面是如何安装的方法。
* 最好的安装方式是在 [设置](https://flatpak.org/setup/) Flathub 软件仓库之后,[通过 Flathub 安装](https://flathub.org/apps/details/de.haeckerfelix.Fragments)
更多信息:
* [主页](https://apps.gnome.org/app/de.haeckerfelix.Fragments/)
* [源代码](https://gitlab.gnome.org/World/Fragments)
#### MetadataCleaner - 从各种文件中清理元数据
有没有遇到过这样的情况:你需要从文件中删除某些信息,比如由谁创建,或者通过什么软件创建。例如,如果你有一张用 GIMP 创建的图片,该文件包含一个默认的文本(除非你删除它):“由 GIMP 创建”。另外,图片可能包含位置细节、时间戳、相机信息等等。而删除这些信息需要一些特定的应用程序,并需付出额外的努力。
MetedataCleaner 应用程序就是做这个的。它可以帮助你从文件中删除这些信息。当你用这个应用程序打开一个文件时,它会读取并给你一个元数据的列表。你所需要做的就是点击“<ruby> 清洁 <rt> Clean </rt></ruby>”按钮,然后你就有了清理过的文件。对于 GNOME 来说,这样一个有用的工具。

这个应用程序的安装步骤如下。
* 最好的安装方法是在 [设置](https://flatpak.org/setup/) Flathub 软件仓库之后,[通过 Flathub 安装](https://flathub.org/apps/details/fr.romainvigier.MetadataCleaner)
更多信息:
* [主页](https://metadatacleaner.romainvigier.fr/)
* [源代码](https://gitlab.com/rmnvgr/metadata-cleaner/)
#### Kooha - 屏幕录像机
如果你正在为 GNOME 桌面寻找一个快速而简单的屏幕录像机,那么不妨试试 Kooha。这个应用程序是最好的 GNOME 应用程序之一,提供轻松的记录体验。这个工具支持硬件加速、定时器、多源输入和许多高级功能。下面是功能摘要:
* 可选择多显示器中任一显示器或任何窗口
* 硬件加速的编码
* 可选择录制屏幕的区域
* 记录麦克风和电脑的声音
* 记录的延迟定时器
* 支持 WebM、mp4、gif、mkv 文件类型

下面是安装方法。
* 最好的安装方式是在 [设置](https://flatpak.org/setup/) Flathub 软件仓库之后,[通过 Flathub 安装](https://flathub.org/apps/details/io.github.seadve.Kooha)
更多信息:
* [主页](https://apps.gnome.org/app/io.github.seadve.Kooha/)
* [源代码](https://github.com/SeaDve/Kooha)
#### Metronome - 节拍器
节拍器,最初是 [一种古老的设备](https://en.wikipedia.org/wiki/Metronome),它以每分钟节拍的恒定间隔产生一些可听的短促声音。这对于需要保持一致的动作、活动,并且不失去注意力的加速或减速的任务很有用。
因此,这个名为 Metronome 的 GNOME 应用程序是一个软件版的设备,可以帮助你保持你的活动和注意力。这是音乐家们专门用来练习演奏的,以固定的时间间隔来保持一致。

下面是安装的方法。
* 最好的安装方法是在 [设置](https://flatpak.org/setup/) Flathub 软件仓库之后,[通过 Flathub 安装](https://flathub.org/apps/details/com.adrienplazas.Metronome)
更多信息:
* [主页](https://apps.gnome.org/app/com.adrienplazas.Metronome/)
* [源代码](https://gitlab.gnome.org/World/metronome)
### 总结
这就是 10 个最好的 GNOME 应用程序列表,可以扩展你的桌面体验。感谢 Flatpak,不仅在 GNOME,你还可以在 KDE Plasma 或 Xfce 或任何其他桌面上使用它们。我希望这些用于 GNOME 桌面的应用程序可以变得更加流行,使用率也会增加。
你最喜欢的 GNOME 应用程序是什么,请在下面的评论框中告诉我。
---
via: <https://www.debugpoint.com/2021/12/best-gnome-apps-part-1/>
作者:[Arindam](https://www.debugpoint.com/author/admin1/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) | null |
14,291 | 保护 SSH 的 3 个技巧 | https://opensource.com/article/22/2/configure-ssh-privacy | 2022-02-21T11:36:02 | [
"SSH"
] | /article-14291-1.html |
>
> 以下是我如何优化我的 SSH 体验并保护我的服务器不被非法访问。
>
>
>

SSH(安全 Shell)是一个协议,它使你能够创建一个经过验证的私人连接,并使用加密密钥保护通道,在另一台机器上启动一个远程 Shell。使用这种连接,你可以执行远程命令,启动安全文件传输,转发套接字、显示和服务,等等。
在 SSH 出现之前,大多数远程管理是通过 telnet 完成的,公平地说,一旦你能建立一个远程会话,你几乎可以做任何你需要的事情。这个协议的问题是,通讯是以纯明文的方式进行的,没有经过加密。使用 [流量嗅探器](https://www.redhat.com/sysadmin/troubleshoot-network-dhcp-configuration) 不需要太多努力就可以看到一个会话中的所有数据包,包括那些包含用户名和密码的数据包。
有了 SSH,由于使用了非对称密钥,参与通信的设备之间的会话是加密的。如今,这比以往任何时候都更有意义,因为所有的云服务器都是由分布在世界各地的人管理的。
### 3 个配置 SSH 的技巧
SSH 协议最常见的实现是 OpenSSH,它由 OpenBSD 项目开发,可用于大多数 Linux 和类 Unix 操作系统。一旦你安装了这个软件包,你就会有一个名为 `sshd_config` 的文件来控制该服务的大部分行为。其默认设置通常是非常保守的,但我倾向于做一些调整,以优化我的 SSH 体验,并保护我的服务器不被非法访问。
### 1、改变默认端口
这是一个并非所有管理员都记得的问题。任何有端口扫描器的人都可以发现一个 SSH 端口,即使你之后把它移到别的端口,所以你很难把自己从危险中移除,但这样却会有效的避免了数百个针对你的服务器扫描的不成熟脚本。这是一个可以让你省心,从你的日志中减去大量的噪音的操作。
在写这篇文章时,我在一个云服务提供商上设置了一个 SSH 服务器,默认端口 TCP 22,每分钟平均被攻击次数为 24 次。在将端口改为一个更高的数字,即 TCP 45678 后,平均每天有两个连接并用各种用户名或密码进行猜测。
要改变 SSH 的默认端口,在你喜欢的文本编辑器中打开 `/etc/ssh/sshd_config`,将 `Port` 的值从 22 改为大于 1024 的某个数字。这一行可能被注释了,因为 22 是默认的(所以不需要在配置中明确声明),所以在保存之前取消注释。
```
Port 22122
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
```
一旦你改变了端口并保存了文件,重新启动 SSH 服务器:
```
$ sudo systemctl restart sshd
```
### 2、不要使用密码
现在有一个普遍的潮流是停止使用密码作为认证手段,双因素认证等方法越来越受欢迎。OpenSSH 可以使用非对称密钥进行认证,因此不需要记住复杂的密码,更不需要每隔几个月轮换一次密码,也不需要担心有人在你建立远程会话时进行“肩后偷窥”。使用 SSH 密钥可以让你快速、安全地登录到你的远程设备上。这往往意味着花费在错误的用户名和密码上的时间更少。登录令人愉快的简单。当没有密钥时,就没有入口,甚至没有提示符。
要使用这个功能,你必须同时配置客户机(在你面前的计算机)和服务器(远程机器)。
在客户端机器上,你必须生成一个 SSH 密钥对。这包括一个公钥和一个私钥。正如它们的名字所暗示的,一个公开的密钥是供你分发给你想登录的服务器的,另一个是私人的密钥,必须不与任何人分享。使用 `ssh-keygen` 命令可以创建一个新的密钥对,并使用 `-t` 选项来指定一个好的、最新的密码学库,如 `ed25519`:
```
$ ssh-keygen -t ed25519
Generating public/private ed25519 key pair.
Enter file in which to save the key (~/.ssh/id_ed25519):
```
在密钥创建过程中,你会被提示为文件命名。你可以按回车键来接受默认值。如果你将来创建了更多的密钥,你可以给每个密钥起一个自定义的名字,但有多个密钥意味着你要为每次交互指定使用哪个密钥,所以现在只要接受默认即可。
你还可以给你的密钥一个口令。这可以确保即使别人设法获得你的私钥(这本身就不应该发生),没有你的口令,他们也无法将其投入使用。这对某些密钥来说是一种有用的保护措施,而对其他密钥来说则不合适(特别是那些用于脚本的密钥)。按回车键让你的密钥没有口令,或者你选择创建一个口令。
要把你的密钥复制到服务器上,使用 `ssh-copy-id` 命令。例如,如果我拥有一台名为 `example.com` 的服务器,那么我可以用这个命令把我的公钥复制到它上面:
```
$ ssh-copy-id [email protected]
```
这将在服务器的 `.ssh` 目录下创建或修改 `authorized_keys` 文件,其中包含你的公钥。
一旦确认 `ssh-copy-id` 命令完成了它所做的事情,尝试从你的电脑上登录,以验证你可以在没有密码的情况下登录(或者如果你选择使用你的密钥的口令,就输入密钥口令)。
在没有使用你的服务器帐户的密码登录到你的服务器上后,编辑服务器的 `sshd_config` 并将 `PasswordAuthentication` 设置为 `no`。
```
PasswordAuthentication no
```
重新启动 SSH 服务以加载新的配置:
```
$ sudo systemctl restart sshd
```
### 3、决定谁可以登录
大多数发行版不允许 root 用户通过 SSH 登录,这确保只有非特权账户是活跃的,根据需要使用 `sudo` 命令来提升权限。这就防止了一个明显的、令人痛苦的目标(root)受到简单而常见的脚本攻击。
同样,OpenSSH 的一个简单而强大的功能是能够决定哪些用户可以登录到一台机器。要设置哪些用户被授予 SSH 访问权,在你最喜欢的文本编辑器中打开 `sshd_config` 文件,并添加这样一行:
```
AllowUsers jgarrido jane tux
```
重新启动 SSH 服务以加载新的配置选项。
这只允许三个用户(`jgarrido`、`jane` 和 `tux`)登录或在远程机器上执行任何操作。
### 总结
你可以使用 OpenSSH 来实现一个强大而稳健的 SSH 服务器。这些只是加固你的系统的三个有用的选项。尽管如此,在 `sshd_config` 文件中仍有大量的功能和选项可以打开或关闭,而且有许多很棒的应用程序,如 [Fail2ban](https://opensource.com/life/15/7/pipe-dreams),你可以用来进一步保护你的 SSH 服务。
---
via: <https://opensource.com/article/22/2/configure-ssh-privacy>
作者:[Jonathan Garrido](https://opensource.com/users/jgarrido) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | HTTPSConnectionPool(host='opensource.com', port=443): Read timed out. (read timeout=10) | null |
14,293 | 10 个适用于 Linux 的开源轻量级网页浏览器 | https://itsfoss.com/lightweight-web-browsers-linux/ | 2022-02-21T17:14:44 | [
"浏览器",
"轻量级"
] | https://linux.cn/article-14293-1.html | 
[有很多适用于 Linux 的网页浏览器](https://itsfoss.com/best-browsers-ubuntu-linux/),其中很多都是基于 [Chromium](https://itsfoss.com/install-chromium-ubuntu/),但我们也有一个 [不基于 Chromium 的浏览器](https://itsfoss.com/open-source-browsers-linux/) 的列表。
最近,一位读者要求推荐一款轻量级网页浏览器,因此我专门做了一些快速实验。以下是我的发现。
### 适用于 Linux 的轻量级网页浏览器
我没有进行任何基准测试,因为可能适用于一个系统的东西可能不适用于其他系统。这篇文章是基于我的经验和观点。
还有一点需要注意的是,一些轻量级网页浏览器的扩展功能可能有限。如果你依赖账户同步等功能并使用大量的浏览器扩展,这些浏览器可能无法满足你的需要。但是,你仍然可以尝试使用其中一些作为你的辅助浏览器。
还有一件事!这不是一个排名表。排名第二的浏览器不应该被认为比排名第五的更好。
>
> 注意:
>
>
> 浏览器是通往很多东西的通道。你不应该使用一个不积极开发或仅由一个开发商维护的晦涩的网页浏览器,尤其用于银行和购物。在这种情况下,坚持使用主流浏览器,如 Firefox、Brave、Vivaldi、Chrome/Chromium 更好。
>
>
>
#### 1、Viper(蝰蛇)

该浏览器专注于隐私、极简主义和定制,已成为一个强大的轻量级浏览器,在这里你可以进行你想要的一切搜索。在我看来,它是一个必不可少的浏览器,具有标签休眠支持、安全自动填写管理、全屏支持等基本功能。
这不是一个普通的浏览器,但如果你是一个极简主义的粉丝,也许这个浏览器适合你。
* 下载:[Viper](https://github.com/LeFroid/Viper-Browser)
#### 2、Nyxt

“黑客的强力浏览器” 是 [Nyxt](https://itsfoss.com/nyxt-browser/) 的官方网页对它自己的描述;说实话,它很不错。
尽管它不是唯一面向键盘的网页浏览器;它的独特之处在于,你可以在这个浏览器中覆盖和重新配置每一个类、方法和函数。它也有一个内置的命令行工具。难怪它被称为“黑客的强力浏览器”。
Nyxt 使用的是一个简单的计算机编程环境,它接受单一的用户输入,执行它们,并将结果返回给用户;就像最著名的 [REPL(读取-评估-打印循环)](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) 一样。
* 下载:[Nyxt](https://nyxt.atlas.engineer/)
#### 3、Lynx(猞猁)

我肯定会说这是为 [命令行](https://itsfoss.com/gui-cli-tui/) 爱好者准备的,因为这个神奇的浏览器可以让你 [从你的 Linux 终端上网](https://itsfoss.com/terminal-web-browsers/)。没错!你可以在你的终端中启动它来轻松访问互联网。
当然,它消耗的资源更少,但你不应该指望获得从 Firefox 或 Brave 等常规浏览器中相同的浏览体验。
你知道吗?这是一个最古老的网络浏览器,它始于 1992 年,至今仍在维护。
* [Lynx](https://lynx.invisible-island.net/current/index.html)
#### 4、SeaMonkey(海猴)

这个是另一个多合一的导航器,但 SeaMonkey 包括什么呢?SeaMonkey 增加了电子邮件客户端、网站内容源阅读器、HTML 编辑器、IRC 聊天和网络开发工具等特性,以及其他一些特性。
我想说 [SeaMonkey](https://www.seamonkey-project.org/) 是 Firefox 的一个不可思议的复刻,就像 [Librewolf](https://librewolf-community.gitlab.io/)。正如其网页所说,它使用了许多与 Mozilla Firefox 相同的源代码。
* 下载:[SeaMonkey](https://www.seamonkey-project.org/releases/)
#### 5、Waterfox(水狐)

说实话,当我在个人电脑上试用 Waterfox 浏览器时,我对它的性能和速度感到震惊。我是一个信奉极简主义的人,我想这就是为什么我这么喜欢它。这个浏览器的一个了不起的特点是,它支持 Chrome、Firefox 和 Opera 的扩展。
因此,如果你想尝试一个新的快速、安全的浏览器,而又不离开你最喜欢的扩展,[Waterfox](https://itsfoss.com/waterfox-browser/) 将是一个完美的选择。
* 下载:[Waterfox](https://www.waterfox.net/)
#### 6、Pale Moon(苍月)

这是另一个基于 Firefox 代码的网页浏览器,具有隐私、安全、完全可定制和针对现代处理器优化等特点。对我来说,一个看起来很有趣的特点是,它继续支持 NPAPI 插件,如 Silverlight、Flash 和 Java。这些插件在其他浏览器(如 Chrome 和微软 Edge)中一直没有得到维护。
在这种情况下,如果你喜欢的一些网页因 Flash 等插件的停止维护而受到影响,也许 [Pale Moon](https://www.palemoon.org/) 可以让它们重新恢复。
* 下载:[Pale Moon](https://linux.palemoon.org/)
#### 7、Falkon

[Falkon](https://itsfoss.com/falkon-browser/) 是一个 KDE 浏览器,它与一个叫做 [QtWebEngine](https://wiki.qt.io/QtWebEngine) 的技术一起工作,该技术提供了一个渲染引擎。它包括侧边栏中的书签和历史记录等功能,并默认带来了一个广告拦截器,它可以帮助你防止来自网站的追踪。
顺便说一句,这个浏览器最初只是为了教育目的而开始开发的;但现在,你可以在你的日常生活中使用它。我邀请你尝试它,并与我们分享你的经验。
* 下载:[Falkon](https://www.falkon.org/download/)
#### 8、Epiphany(顿悟)

这个导航器通常被称为 “GNOME Web”,它是一个专注于 Linux 体验的原生网页浏览器,它有一个简单的用户浏览界面。当然,简单并不意味着功能不强。
它显示网页的技术类似于 Mozilla 项目中使用的布局引擎,它最重要的一些特点是:
* 可定制的用户界面
* 有 60 多种语言版本
* Cookie 管理
* 用于执行命令、Python 脚本、分组标签、选择你的样式表的扩展
如果你正在寻找一个简单而简约的浏览器,并且专门针对 Linux,那就是它了。
* 下载:[GNOME Web](https://wiki.gnome.org/Apps/Web)
#### 9、Otter(水獭)

如果你还记得几年前 [Opera](https://itsfoss.com/install-opera-ubuntu/) 12 的模样,这个浏览器会让你想起这个用户界面。这个浏览器的主要目的是为实验用户提供强大的工具,而不影响他们继续浏览。
我注意到的一些有趣和重要的事情是,社区对持续贡献源代码的承诺,以改进这个浏览器。
如果你在 Linux 中浏览时正在寻找一个快速、安全和强大的浏览器,这个是一个不错的选择。
* 下载:[Otter](https://github.com/OtterBrowser/otter-browser/blob/master/INSTALL.md)
#### 10、Midori(日文的“翠绿”)

以前有一个流行的浏览器叫 Midori,但在它与 [Astian 项目](https://astian.org/en/midori-browser/) 合并后,它的发展方向发生了变化。然而,由于 Snap 商店的存在,你仍然可以在你的 Linux 发行版上安装它。
它的三个最强大的功能是:
* 支持 Adblock 过滤列表
* 隐私浏览
* 管理 Cookie 和脚本
但真正让我震惊的是,它可以让你瞬间打开 1000 个标签,并能轻松创建网页应用;这后两个事实是来自 [它在 Snapcraft 的页面](https://snapcraft.io/midori)。
* 下载:[Midori](https://snapcraft.io/midori)
### 结论
记住,找到完美的浏览器将取决于你的需要和资源。总的来说,这一切都要归结为适合你的东西。
使用 [轻量级应用程序](https://itsfoss.com/lightweight-alternative-applications-ubuntu/) 是当你的系统在硬件方面处于低水平时获得更好的计算体验的一种方式。
我避开了其他一些浏览器,比如 [Brave 或 Vivaldi](https://itsfoss.com/brave-vs-vivaldi/),因为我的重点是在 Linux 上不太流行的轻量级网页浏览器。如果你知道还有一些你经常使用的浏览器,请在评论区提到它们。
如果这篇文章对你有帮助,请花点时间在社交媒体上分享;你也可以对开源有所作为。
---
via: <https://itsfoss.com/lightweight-web-browsers-linux/>
作者:[Marco Carmona](https://itsfoss.com/author/marco/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

There are [plenty of web browsers available for Linux](https://itsfoss.com/best-browsers-ubuntu-linux/). A lot of them are based on [Chromium](https://itsfoss.com/install-chromium-ubuntu/) but we also have a list of [browsers that are not based on Chromium](https://itsfoss.com/open-source-browsers-linux/).
Recently, a reader asked for a lightweight web browsers recommendation and hence I took the responsibility of doing some quick experimentation. Here’s what I found.
## Lightweight web browsers for Linux
I did not run any benchmark test because what may work on one system may not work on others. This article is based on my experience and opinion.
Another thing to keep in mind is that some lightweight web browsers may have limited extensions. If you rely on features like account synchronization and uses tons of browser extensions, these browsers may not suffice your need. However, you could still try some of them to have as your secondary browser.
*One more thing! This is not a ranking list. The browser at number 2 should not be considered better than the one at number 5.*
### 1. Viper

Focusing on privacy, minimalism, and customization, this browser has become a powerful lightweight place where you can do every search you want. It is, in my opinion, an essential navigator with basic features like tab hibernation support, secure AutoFill management, full-screen support, among others.
This is not a regular browser, but if you’re a fan of minimalism, perhaps this one is for you.
### 2. Nyxt

“The hacker’s power-browser” is how the official page of [Nyxt](https://itsfoss.com/nyxt-browser/) describes it; and being honest, it is wonderful.
Even though it is not the only keyboard-oriented web browser around; its unique feature is that you can overwrite and reconfigure every single class, method, and function inside this one. It also has a built-in command line tool. No wonder why it is called “The hacker’s power-browser”.
Nyxt uses a simple computer programming environment that takes single user inputs, executes them, and returns the result to the user; most famous as [RELP (read-eval-print loop)](https://en.wikipedia.org/wiki/Reliable_Event_Logging_Protocol?ref=itsfoss.com).
### 3. Lynx

I definitely would say this one is for the [CLI](https://itsfoss.com/gui-cli-tui/) fans because this amazing browser lets you [surf the internet from your Linux terminal](https://itsfoss.com/terminal-web-browsers/). That’s right! You can easily access the internet by starting it in your terminal.
Of course, it consumes less resources but you should not expect same kind of browsing experience you get from regular browsers like Firefox or Brave.
*Did you know this is the oldest web browser still being maintained, having started in 1992?*
### 4. SeaMonkey

This one is another all-in-one navigator, but what does SeaMonkey include? SeaMonkey adds characteristics like an email client, web feed reader, HTML editor, IRC chat, and web development tools; among other features.
I would say [SeaMonkey](https://www.seamonkey-project.org/?ref=itsfoss.com) is an incredible fork of Firefox like [Librewolf](https://librewolf-community.gitlab.io/?ref=itsfoss.com). It uses much of the same Mozilla Firefox source code, as its web page said.
### 5. Waterfox

To be honest, when I tried this browser on my personal computer, I was shocked about how good and fast it was. I am a fan of minimalism and I guess that is why I like it so much. One awesome characteristic of this browser is that it supports Chrome, Firefox, and Opera extensions.
So if you are thinking about trying a new fast, and secure browser without leaving your favorite extensions, [Waterfox](https://itsfoss.com/waterfox-browser/) would be a perfect choice.
### 6. Pale Moon

This one is another web browser based on Firefox code with characteristics like privacy, security, fully customizable, and optimized for modern processors. The one feature that looks interesting for me is that it continues supporting NPAPI plugins like Silverlight, Flash, and Java. Plugins that have been unmaintained in other browsers like Chrome and Microsoft Edge.
In this case, if some of your favorite web pages were affected by the stopped maintenance of plugins like flash, perhaps [Pale Moon](https://www.palemoon.org/?ref=itsfoss.com) could revive them.
### 7. Falkon

[Falkon](https://itsfoss.com/falkon-browser/) is a KDE navigator which works with a technology called [QtWebEngine](https://wiki.qt.io/QtWebEngine?ref=itsfoss.com) which provides a rendering engine. It includes features like bookmarks and history in the sidebar and by default brings an ads blocker; which can help you to prevent tracking from websites.
One random fact about this browser is that it originally started only for educational purposes; but these days, you can use it for your daily routine. I invite you to try it and share with us your experience.
### 8. Epiphany

This navigator is most commonly known as GNOME Web, and it is a native web browser focused on Linux experience, which has a simple user interface for browsing. Of course, simple doesn’t mean less powerful.
Its technology to display web pages is similar to the layout engine used in the Mozilla project, and some of its most important features are:
- Customizable user interface
- Availability in more than 60 languages
- Cookie management
- Extensions to execute commands, python scripts, group tabs, select your stylesheet, etc.
If you’re looking for a simple and minimalist browser with is focused specifically on Linux, this is the one.
### 9. Otter

If you remember how [Opera](https://itsfoss.com/install-opera-ubuntu/) 12 used to look like some years ago, this navigator will remind you of this user interface. The principal purpose of this browser is to provide powerful tools for experiment users while they keep browsing.
Something interesting and important that I noticed was the continued commitment to the source code from the community to improve this browser.
This one is a good option if you are looking for a fast, secure, and robust one at the time of browsing in Linux.
### 10. Midori Web Browser

There used to be a popular browser called Midori but its development has changed course after its merger with[ Astian project](https://astian.org/en/midori-browser/?ref=itsfoss.com). However, you can still install it on your Linux distro thanks to the snap store.
Its three most powerful features are:
- Adblock filter list support.
- Private browsing.
- Manage cookies and scripts.
But something that really got me shocked was that it lets you open 1000 tabs instantly and create easy web apps; these last two facts are according to [its page in Snapcraft](https://snapcraft.io/midori?ref=itsfoss.com).
## Conclusion
Remember, finding the perfect browser will depend on your necessities and resources. Overall, it all comes down to what suits you.
Using [lightweight applications](https://itsfoss.com/lightweight-alternative-applications-ubuntu/) is one way to have a better computing experience when your system is low on the hardware side.
I have avoided some other browsers like [Brave or Vivaldi](https://itsfoss.com/brave-vs-vivaldi/) because my focus was on less popular, lightweight web browsers on Linux. If you know a few more that you use regularly, please mention them in the comment section.
If this article was interesting and helpful for you, please take a minute to share it on social media; you can make a difference! |
14,295 | Kile:来自 KDE 的交互式跨平台 LaTeX 编辑器 | https://itsfoss.com/kile/ | 2022-02-22T10:37:52 | [
"Kile",
"LaTeX"
] | https://linux.cn/article-14295-1.html |
>
> Kile 是 Linux 上最好的 LaTeX 编辑器之一,来自 KDE。让我们来看一看它提供了什么?
>
>
>
你可以用 TeX/LaTeX 编辑器处理各种文件。不仅仅限于科学研究,你还可以添加你的代码、开始写书(学术/创作)、或者起草文章。
如果你经常处理 LaTeX 文档,一个具有预览选项和若干功能的交互式解决方案应该会很方便。
Kile 是 KDE 提供选择之一,可用于 Linux 和其他平台。事实上,它是 [可用于 Linux 的最佳 LaTeX 编辑器](https://itsfoss.com/latex-editors-linux/) 之一,我们决定重点介绍一下它。
### 一个开源的集成 LaTeX 编辑器

Kile 可能不是最受欢迎的选择,但它确实因其提供的东西而脱颖而出。
如果你正在寻找一个简单的 LaTeX 编辑器,它可能不是完美的选择。然而,它尽力为你提供友好的体验,同时从一开始就为你提供指导。
让我重点强调以下特点。
### Kile 的特点

正如我提到的,Kile 是一个功能丰富的 LaTeX 编辑器。如果你是 TeX/LaTeX 文档的新手,它可能会让你不知所措,但它仍然值得探索。
其主要特性包括:
* 设置向导可以轻松开始使用 LaTeX 编辑器。
* 可用的模板可以节省文件大纲的时间。
* 自动完成 LaTeX 命令。
* 在不离开窗口的情况下,一键编译和预览你的文档。
* 上百种预设模式来定义文档的类型(JSON、R 文档、VHDL、HTML 等)。
* 日志查看器。
* 转换文档的能力。
* 添加/删除和转换 PDF 文件的 PDF 向导工具。
* 反向和正向搜索功能。
* 创建项目以组织文件集合。
* 大量的 LaTeX 选项,无需键入任何东西即可添加所需的命令(如创建一个列表,添加一个数学函数等)。
* 在各章或各节中轻松导航。
* 使用小窗口预览浏览整个文件(如果文件太大需要滚动)。

除了这些,你还可以配置外观,调整键盘快捷键,找到各种编码支持等。
此外,设置向导(以及应用内的其他向导)的存在使用户体验变得轻而易举。
例如,以下是你第一次启动该应用时:

它将检查任何配置问题,帮助你确保无缝体验。

设置完成后,它将迅速提示你可用的模板,让你开始:

因此,指导性的设置和上述所有的功能应该构成一个出色的 LaTeX 编辑体验。
### 在 Linux 中安装 Kile
你应该可以在默认的 Linux 仓库和软件中心找到 Kile。对于 KDE,你应该看到它被列在“发现”中。
不幸的是,它不提供 Flatpak 或 Snap 包。所以,你将不得不依靠从仓库中获得的标准软件包。
如果你依赖终端(基于 Ubuntu),你可以输入以下命令安装:
```
sudo apt install kile
```
对于 Windows 用户,你可以在 [微软商店](https://www.microsoft.com/en-in/p/kile/9pmbng78pfk3?rtc=1&activetab=pivot:overviewtab) 中找到它。
如果你感到好奇,你可以查看 [源代码](https://invent.kde.org/office/kile) 或访问官方网站。
* [Kile](https://apps.kde.org/kile/)
### 总结
作为一个 LaTeX 用户,你应该发现所有这些选项对高效的编辑经体验都很有用。如果你是 TeX/LaTeX 文档的新手,你仍然可以使用它的模板、快速函数、自动完成功能,使体验变得简单。
你最喜欢的 LaTeX 文档编辑器是什么?欢迎在下面的评论中告诉我。
---
via: <https://itsfoss.com/kile/>
作者:[Ankush Das](https://itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | **Brief: Kile is one of the best LaTeX editors available for Linux, by KDE. What does it offer? Let us take a look.**
You can use a TeX/LaTeX editor for a variety of documents. Not just limited to scientific research, you can also add your code, start writing a book (academic/creative), or draft articles.
An interactive solution with the option for preview, and several features, should come in handy if you regularly work with LaTeX documents.
Kile is one such option by KDE, available for Linux and other platforms. In fact, it is one of the [best LaTeX editors available for Linux](https://itsfoss.com/latex-editors-linux/), which we decided to highlight separately.
## An Open-Source Integrated LaTeX Editor

Kile may not be the most popular option, but it certainly stands out for what it offers.
It may not be the perfect fit if you are looking for a simple LaTeX Editor. However, it does its best to present you with a user-friendly experience while guiding you from the start.
Let me highlight some features below.
## Features of Kile

As I mentioned, Kile is a feature-rich LaTeX editor. It could be overwhelming if you are new to TeX/LaTeX documents, but it is still worth exploring.
The key features include:
- Setup wizard to easily start using LaTeX editor.
- Available templates to save time for the document outline.
- Auto-completion of LaTeX commands.
- Compile and preview your document in a single click without leaving the window.
- Hundreds of preset modes to define the type of document (JSON, R Documentation, VHDL, HTML, etc.)
- Log viewer
- Ability to convert documents .
- PDF Wizard tool to add/remove and convert PDF files.
- Inverse and Forward search feature.
- Create projects to organize a collection of documents.
- Plenty of LaTeX options to add the required commands without typing anything (like creating a bullet list, adding a math function, etc.)
- Easy to navigate through chapters or sections.
- Navigate through the entire document using the small preview (if the document is too large to scroll)

In addition to these, you can configure the appearance, tweak the keyboard shortcuts, find various encoding support, and more.
Furthermore, the presence of setup wizards (and other wizards within the app) makes the user experience a breeze.
For instance, here’s how it looks when you first launch the app:

It will check for any configuration issues and help you ensure a seamless experience.

Once the setup is complete, it will quickly prompt you with the available templates to get you started:

So, the guided setup and all the aforementioned features should make up for an excellent LaTeX editing experience.
## Install Kile in Linux
You should find Kile in the default Linux repositories and the software center. For KDE, you should see it listed in Discover.
Unfortunately, it does not offer a Flatpak or a Snap package. So, you will have to rely on the standard packages available from repos.
In case you rely on the terminal (Ubuntu-based), you can install it by typing:
`sudo apt install kile`
For Windows users, you can find it listed in the [Microsoft Store](https://www.microsoft.com/en-in/p/kile/9pmbng78pfk3?rtc=1&activetab=pivot:overviewtab).
If you are curious, you can go through the [source code](https://invent.kde.org/office/kile) or visit the official site.
## Wrapping Up
As a LaTeX user, you should find all the options useful for a productive editing experience. If you are new to TeX/LaTeX documents, you can still use it with templates, quick functions, auto-completion features to make the experience easy.
What is your favorite LaTeX document editor? Feel free to let me know in the comments below. |
14,296 | Perl 语言基础入门 | https://opensource.com/article/22/2/perl-cheat-sheet | 2022-02-22T17:12:42 | [
"Perl"
] | /article-14296-1.html |
>
> 下载这份编程速查表,开始学习 Perl 的力量。
>
>
>

Perl 发布于 1988 年初,是一种后现代的编程语言,它通常被认为是一种脚本语言,但它也能进行面向对象的编程。它是一种成熟的语言,拥有 [数以万计的库](http://cpan.org/)、GUI 框架,它有一种叫做 Raku 的衍生语言(即 Perl 6),以及一个活跃而热情的社区。它的开发者以其灵活性为荣。根据它的创造者 Larry Wall 的说法,Perl 并不对它的用户强加任何特定的编程风格,而且有不止一种方法来完成大多数事情。
Perl 非常健壮,它曾经被广泛使用,这使它成为新的程序员可以尝试的伟大语言。
* [下载 Perl 速查表](https://opensource.com/downloads/perl-cheat-sheet)
### Perl 基础知识
在 Linux 和 macOS 上,你已经安装了 Perl。在 Windows 上,请从 [Perl 网站](https://www.perl.org/get.html) 下载并安装它。
#### Perl 表达式
Perl 源代码的基本单位是 *表达式*,它是任何能返回一个 *值* 的东西。
例如,`1` 是一个表达式,它返回 `1` 的值。表达式 `2` 返回 `2` 的值,而 `a` 返回字母 `a`。
表达式可以更复杂。表达式 `$a + $b` 包含变量(数据的占位符)和加号(`+`),它是一个数学运算符。
#### Perl 语句
Perl 语句是由表达式组成的。每个语句都以分号(`;`)结束。
比如说:
```
$c = $a + $b;
```
要尝试运行你自己的 Perl 语句,请打开终端并输入:
```
$ perl -e 'print ("Hello Perl\n");'
```
#### Perl 语句块
Perl 语句块可以用大括号(`{ }`)组合起来。块是一种有用的组织工具,但它们也为那些你可能只需要在程序的一小部分使用的数据提供了 *范围*。Python 用空白定义范围,LISP 用小括号,而 C 和 Java 用大括号。
#### 变量
变量是数据的占位符。人类每天都在使用变量而没有意识到它。例如,“它”这个词可以指代任何名词,所以我们把它作为一个方便的占位符。“找到我的手机并把它拿给我”实际上是指“找到我的手机并把我的手机拿给我。”
对于计算机来说,变量不是一种便利,而是一种必需品。变量是计算机识别和跟踪数据的方式。
在 Perl 中,你通过声明一个变量名称和它的内容来创建变量。
在 Perl 中,变量名称前面总是有一个美元符号(`$`)。
这些简单的语句创建了一个包含 `"Hello"` 和 `"Perl"` 字符串的变量 `$var`,然后将该变量的内容打印到终端:
```
$ perl -e '$var = "hello perl"; print ("$var\n");'
```
#### 流程控制
大多数程序需要做出决定,这些选择由条件语句和循环来定义和控制。`if` 语句是最直观的一种。Perl 可以测试一个特定的条件,然后 Perl 根据这个条件决定程序如何进行。其语法类似于 C 或 Java:
```
my $var = 1;
if ($var == 1) {
print("Hello Perl\n");
}
elsif ($var == 0){
print("1 not found");
}
else {
print("Good-bye");
}
```
Perl 也有一个简短的 `if` 语句的形式:
```
$var = 1;
print("Hello Perl\n") if ($var == 1);
```
#### 函数和子程序
尽可能多地重复使用代码是一种有益的编程习惯。这种做法可以减少错误(或将错误合并到一个代码块中,因此你只需修复一次),使你的程序更容易维护,简化你的程序逻辑,并使其他开发者更容易理解它。
在 Perl 中,你可以创建一个 *子程序*,它接受输入(存储在一个特殊的数组变量 `@_` 中)并可能返回一个输出。你可以使用关键字 `sub` 来创建一个子程序,后面跟一个你选择的子程序名称,然后是代码块:
```
#!/usr/bin/env perl
use strict;
use warnings;
sub sum {
my $total = 0;
for my $i(@_){
$total += $i;
}
return($total);
}
print &sum(1,2), "\n";
```
当然,Perl 有许多子程序,你不必自己去创建。有些是内置于 Perl 中的,而社区库则提供了其他的。
### 用 Perl 编写脚本
Perl 可以被编译,也可以作为一种解释型的脚本语言使用。后者是刚入门时最简单的选择,特别是如果你已经熟悉了 Python 或 [shell 脚本](https://opensource.com/article/20/4/bash-programming-guide)。
这里有一个用 Perl 编写的简单的掷骰子脚本。把它读一遍,看看你是否能跟上它。
```
#!/usr/bin/env perl
use warnings;
use strict;
use utf8;
binmode STDOUT, ":encoding(UTF-8)";
binmode STDERR, ":encoding(UTF-8)";
my $sides = shift or
die "\nYou must provide a number of sides for the dice.\n";
sub roller {
my ($s) = @_;
my $roll = int(rand($s));
print $roll+1, "\n";
}
roller($sides);
```
第一行告诉你的 [POSIX](https://opensource.com/article/19/7/what-posix-richard-stallman-explains) 终端要使用什么可执行文件来运行该脚本。
接下来的五行是模板式的包含内容和设置。`use warnings` 的设置告诉 Perl 检查错误,并在终端对它发现的问题发出警告。`use strict` 设置告诉 Perl 在发现错误时不要运行脚本。
这两个设置都可以帮助你在代码中的错误导致问题之前发现它们,所以通常最好在你的脚本中激活它们。
脚本的主要部分开始于对脚本从终端启动时提供给它的 [参数](https://opensource.com/article/21/8/linux-terminal) 进行分析。在这种情况下,预期的参数是一个虚拟骰子的所需的面的数量。Perl 将其视为一个堆栈,并使用 `shift` 函数将其分配给变量 `$sides`。当没有提供参数时,`die` 函数会被触发。
用 `sub` 关键字创建的 `roller` 子程序(或函数),使用 Perl 的 `rand` 函数生成一个伪随机数,最大不超过参数的数字。这意味着在这个程序中,一个 6 面的骰子不可能掷出 6,但它可以掷出 0。这对计算机和程序员来说是没有问题的,但对大多数用户来说,这是令人困惑的,所以它可以被视为一个 bug。为了在这个 bug 成为问题之前解决它,下一行在随机数上加 1,并将结果作为掷骰子的结果打印出来。
当引用传递给子程序的参数时,你引用的是特殊变量 `@_`,它是一个数组,包含了函数调用时括号内的所有内容。然而,当从数组中提取一个值时,数据被转换成一个标量(例子中的 `$s` 变量)。
子程序在被调用之前不会运行,所以脚本的最后一行调用了自定义的 `roller` 函数,将命令的参数作为函数的参数。
将该文件保存为 `dice.pl`,并标记为可执行:
```
$ chmod +x dice.pl
```
最后,尝试运行它,为它提供一个最大的数字,从中选择其随机数:
```
$ ./dice.pl 20
1
$ ./dice.lisp 20
7
$ ./dice.lisp 20
20
```
没问题!
### Perl 速查表
Perl 是一种有趣而强大的语言。尽管自从 Perl 成为默认的脚本语言后,Python、Ruby 和 Go 等新兴语言引起了许多人的注意,但 Perl 的功能并不弱。事实上,它比以往任何时候都要好,而且前途光明。
下次你想找一种更灵活的语言,并有简单的交付方式时,不妨试试 Perl,并[下载这个速查表](https://opensource.com/downloads/perl-cheat-sheet)!
---
via: <https://opensource.com/article/22/2/perl-cheat-sheet>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | HTTPSConnectionPool(host='opensource.com', port=443): Read timed out. (read timeout=10) | null |
14,298 | LibreOffice 支持无障碍辅助的 5 种方式 | https://opensource.com/article/22/2/libreoffice-accessibility | 2022-02-23T12:13:25 | [
"LibreOffice",
"无障碍"
] | https://linux.cn/article-14298-1.html |
>
> 试试 LibreOffice 中的这些无障碍功能之一。你可能会发现更好的或替代的方式来完成日常工作。
>
>
>

[LibreOffice.org](http://LibreOffice.org) 是我首选的生产力套件,我在过去已经介绍了我如何将它作为一个 [图形化办公套件](https://opensource.com/article/21/9/libreoffice-tips) 以及 [终端命令](https://opensource.com/article/21/3/libreoffice-command-line) 使用。
在这篇文章中,我想着重介绍 LibreOffice 如何支持使用无障碍辅助技术的人。
### 鼠标
鼠标是一项重要的发明,但它并不是对每个人都同样有效。例如,那些不能在屏幕上看到鼠标指针的人,或者不能在他们的桌子上实际操作鼠标的人,从鼠标中获益不多。
为了考虑到人们与电脑互动方式的不同,你可以在没有鼠标的情况下使用 LibreOffice。与应用中的大多数无障碍功能一样,这个功能对任何人都有帮助。即使你自己是一个鼠标用户,有时你也不想把你的手从键盘上移开。能够在“打字模式”下触发特定的 LibreOffice 动作,对于忙碌的打字员来说真的很方便。
你可以使用 `Alt` 键和菜单名称中的一个触发字母来打开 LibreOffice 主菜单中的每一个项目。在默认情况下,你不会看到这些触发字母,但当你按下 `Alt` 键时,它们就会出现。

要打开<ruby> 文件 <rt> File </rt></ruby>菜单,按住 `ALT+F`。要打开<ruby> 格式 <rt> Format </rt></ruby>菜单,按住 `ALT+O`。当菜单被打开后,你就可以释放按键。
在你打开一个菜单后,该菜单中的每个项目都有一个触发字母,或者你可以使用键盘上的**箭头**键导航到该项目并按下**回车**。
要关闭一个菜单而不做任何事情,按 `Esc` 键。
### 不用鼠标就能改变一个字体
LibreOffice 界面中的所有东西都可以从菜单中获得,即使你认为它只是工具栏中的一个元素。例如,你通常可能会将鼠标移动到格式化工具栏来改变字体,但你也可以通过选择文本,然后打开<ruby> 格式 <rt> Format </rt></ruby>菜单并选择<ruby> 字符 <rt> Character </rt></ruby>来打开字符对话框来改变字体。你可以使用 `Tab`、**箭头** 和 **回车** 键来浏览这个对话框。
这里需要注意的是,你可以在一个应用中使用许多不同的路径来达到同一个目标。每个场景都可能有不同的最佳路径,所以在处理任务时不要想得太线性。
### 常见的快捷方式
这里有一些 LibreOffice Writer 的快捷键:
* `F2`:公式栏
* `Ctrl+F2`:插入字段
* `F3`:自动文本
* `F5`: 打开/关闭导航
* `Shift+F5`:将光标移到上次保存文件时的位置
* `Ctrl+Shift+F5`:打开导航,进入页面
* `F7`:拼写
* `F8`:同义词
以下是电子表格的快捷键:
* `Ctrl+Home`:返回到 A1 单元格
* `Ctrl+End`:移到最后一个包含数据的单元格
* `Home`:将光标移到当前行的第一个单元格
* `End`:将光标移到当前行的最后一个单元格
* `Shift+Home`:选择从当前单元格到当前行的第一个单元格的单元格
LibreOffice 的文档非常丰富,通过按键盘上的 `Alt+H` 或 `F1` 可以很容易地获取。
### 无障碍设置
关于更多的无障碍设置,请进入<ruby> 工具 <rt> Tools </rt></ruby>菜单,选择<ruby> 选项 <rt> Options </rt></ruby>。在选项对话框中,在左边的栏目中展开 LibreOffice 类别,然后点击<ruby> 无障碍 <rt> Accessibility </rt></ruby>。
选项包括:
* **在只读文本文件中使用文本选择光标**:这允许你在只读文档中移动,就像你可以编辑它一样,限制了你实际可以做的选择和复制文本。
* **允许动画图像**:不是每个人都希望在工作时在他们的文档中出现移动的图像。你可以在这里进行调整。
* **允许动画文本**:与图像一样,动画文本样式对一些人来说是有趣的,而对另一些人来说则是分散注意力或令人困惑的。
也有高对比度主题的选项。如果你在你的操作系统上使用高对比度模式,LibreOffice 会自动检测并改变它的主题来匹配。
### 键盘快捷方式
你可以通过设置自己的键盘快捷键来定制你与 LibreOffice 的交互方式。进入<ruby> 工具 <rt> Tools </rt></ruby>菜单,选择<ruby> 自定义 <rt> Customize </rt></ruby>(或者直接按 `Alt+T`,然后按 `C`)。
选择<ruby> 键盘 <rt> Keyboard </rt></ruby>标签,必要时按**箭头**键或用鼠标点击它(如果你还在使用鼠标)。
### 对所有人开放
让开源的应用无障碍化有利于所有的用户。通过尝试 LibreOffice 中的无障碍功能,你可能会发现更好的或替代性的方法来完成日常任务。无论你是否“需要”该功能,无障碍功能提供了选择。试试其中的一些,因为你可能会发现你喜欢的东西。如果你有一个 LibreOffice(或任何你喜欢的开源应用)似乎没有提供的要求,在其错误跟踪系统中提交一个功能请求来让该项目知道。
---
via: <https://opensource.com/article/22/2/libreoffice-accessibility>
作者:[Don Watkins](https://opensource.com/users/don-watkins) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | LibreOffice.org is my preferred productivity suite, and I've covered how I use it both as a [graphical office suite](https://opensource.com/article/21/9/libreoffice-tips) as well as a [terminal command](https://opensource.com/article/21/3/libreoffice-command-line) in the past.
In this article, I want to focus on how LibreOffice supports people using assistive technology.
## Mouse
The mouse was an important invention, but it doesn't work equally well for everyone. For instance, people who can't see the mouse pointer on the screen or can't physically operate the mouse on their desk don't benefit much from a mouse.
To account for the difference in how people interact with their computers, you can use LibreOffice without a mouse. As with most accessibility features in applications, this feature is helpful to anyone. Even if you are a mouse user yourself, sometimes you don't want to take your hand off the keyboard. Being able to trigger specific LibreOffice actions while still in "typing mode" is really convenient for the busy typist.
You can open every item in LibreOffice's main menu using the **Alt** key followed by a trigger letter in the menu's name. You don't see these trigger letters by default, but they appear when you press the **Alt** key.

(Don Watkins, CC BY-SA 4.0)
To open the **File** menu, press and hold **ALT+F**. To open the **Format** menu, press and hold **ALT+O**. Once the menu is open, you may release the keys.
After you open a menu, each item in that menu has a trigger letter, or you can use the **Arrow** keys on your keyboard to navigate to the item and press **Enter**.
To close a menu without doing anything, press the **Esc** key.
## Change a font without the mouse
Everything in LibreOffice's interface is available from its menus, even if you think it is just an element in a toolbar. For instance, you may usually move your mouse to the formatting toolbar to change a font, but you can also change the font by selecting text and then opening the **Format** menu and selecting **Character** to open the **Character** dialog. You can navigate this dialog using the **Tab**, **Arrows**, and **Enter **keys.
The important thing to note here is that you can use many different paths in an application to reach the same goal. Each use case might have a different optimal path, so it's important not to think too linearly when approaching a task.
## Common shortcuts
Here are some LibreOffice Writer shortcut keys:
**F2**: Formula bar**Ctrl+F2**: Insert fields**F3**: Auto text**F5**: Navigator on/off**Shift+F5**: Moves the cursor to its position when you last saved the document**Ctrl+Shift+F5**: Navigator on,**Go to Page****F7**:**Spelling****F8**:**Thesaurus**
Here are shortcut keys for spreadsheets:
**Ctrl+Home**: Returns you to cell A1**Ctrl+End**: Moves you to the last cell that contains data**Home**: Moves the cursor to the first cell in the current row**End**: Moves the cursor to the last cell in the current row**Shift+Home**: Selects cells from the current cell to the first cell of the current row
LibreOffice documentation is extensive and easily accessible by pressing **Alt+H** or **F1** from the keyboard.
## Accessibility settings
For more accessibility settings, go to the **Tools **menu and select** Options**. In the **Options** dialog, expand the **LibreOffice** category in the column on the left and then click **Accessibility**.
Options include:
**Use text selection cursor in read-only text documents**: This allows you to move through a read-only document as if you could edit it, limiting what you can actually do to select and copy text.**Allow animated images**: Not everyone wants moving images in their documents as they work. You can adjust that here.**Allow animated text**: As with images, animated text styles can be fun for some and distracting or confusing to others.
There are also options for a high contrast theme. If you use a high contrast mode on your operating system, LibreOffice automatically detects it and changes its theme to match.
## Keyboard shortcuts
You can customize how you interact with LibreOffice by setting your own keyboard shortcuts. Go to the **Tools **menu and select **Customize **(or just press **Alt+T **followed by **C**.)
Select the **Keyboard **tab by pressing the **Arrow **key as necessary or click it with the mouse (if you're still using the mouse.)
## Open for all
Making open source applications accessible benefits all users. By trying accessibility features in LibreOffice, you might find better or alternative ways of doing everyday tasks. Whether you "need" the feature or not, accessibility provides options. Try some of them out because you might find something you love. And if you have a requirement that LibreOffice (or any of your favorite open source applications) doesn't seem to provide, let the project know by filing a feature request in its bug tracking system.
## 2 Comments |
14,299 | 一些 KDE 趣闻和历史 | https://www.debugpoint.com/2021/12/kde-facts-trivia | 2022-02-23T19:31:25 | [
"KDE"
] | /article-14299-1.html |
>
> 当我们回顾过去,发现了一些有点“酷”的 KDE 趣闻。如下。
>
>
>

KDE 有很长的历史。它是如何被构思、发展并成为所有用户群的 “首选” 桌面的赢家的呢?在这篇文章中,我们将介绍一些你可能不知道的 KDE 的趣闻。了解一下也很有趣。
### KDE 趣闻和历史
#### 缘起
KDE 是由 [Matthias Ettrich](https://en.wikipedia.org/wiki/Matthias_Ettrich) 在 20 多年前创建的。其主要动机是创建一个易于使用的桌面,来替代 <ruby> <a href="https://sourceforge.net/projects/cdesktopenv/"> 通用桌面环境 </a> <rt> Common Desktop Environment </rt></ruby>(CDE)。其背后的想法是一个简单的桌面,使用起来很有趣,易于配置且功能强大。于是,KDE(即<ruby> 酷桌面环境 <rt> Kool Desktop Environment </rt></ruby>)就诞生了。你会注意到这是对 CDE 的双关!名字中的 “Kool” 后来被去掉了,最终变成了 “K 桌面环境”,即 KDE。
#### 第一次出现
Matthias 的 KDE 项目正式公告今天 [仍然存在](https://groups.google.com/g/de.comp.os.linux.misc/c/SDbiV3Iat_s/m/zv_D_2ctS8sJ) 在 Google 群组的 de.comp.os.linux.misc(Usenet)上。如下:

今天,当读到上面的想法,以及他对 KDE 是那么有远见,真有点超现实。就这样,KDE Plasma 今天已经渗透到了所有的设备中:笔记本电脑、台式机、游戏机、手机。这的确很了不起。
#### 第一行代码
第一行代码是由 Matthias 为窗口管理器 kwm 和面板 kpanel 写的。KDE 的 KConfig 类成为这个神奇的桌面的第一个库。
#### Qt 许可证的麻烦
在此期间,在 Usenet 论坛上,许多人反对用来开发 KDE 的 Qt 的许可证。因此,Matthias 和团队在 1997 年 2 月飞往奥斯陆,在 KDE 和 Trolltech(当时 Qt 基金会的所有者)之间签署了一份基金会协议。这保证了 [Qt 的永久免费使用](https://dot.kde.org/2016/01/13/qt-guaranteed-stay-free-and-open-%E2%80%93-legal-update)。
在最初的日子里,不管你信不信,都非常需要钱来维持开发工作的进行。团队从 O'Reilly、SUSE、Trolltech 收到了慷慨的捐赠。
#### KDE 1.0 - 第一个版本
被称为 [KDE One](https://community.kde.org/KDE_Project_History/KDE_One_(Developer_Meeting)) 的第一次开发者会议,组织于 1997 年的八、九月间,它讨论了 KDE 第一个版本的愿景、未来和路线图。而这最终在 1998 年 7 月 12 日带来了 KDE 1.0 首次发布。
KDE 1.0 是建立在 Qt 1.0 之上的,主要是用 C++ 编写的。在我看来,它今天看起来仍然令人惊叹。你可以想象一下,在用户界面、用户交互、以及最重要的 —— 为大众提供一个完美的 Linux 桌面方面,这个愿景是多么先进。

#### KDE 2.0
2000 年 10 月 23 日 KDE 2.0 发布。它首次引入了一套新的应用程序,包括 Konqueror 网页浏览器、KOffice、主题支持、KParts 等。
#### 最初获得的奖项
2001 年 8 月 29 日,KDE 在 <ruby> Linux 世界博览会 <rt> LinuxWorldExpo </rt></ruby> 被评为“最佳开源项目”,并获得“开源产品卓越奖”。
2009 年 7 月 20 日,其开发仓库 SVN 中的源代码抵达了 [第一百万次提交](https://marc.info/?l=kde-commits&m=124811211002267&w=2)。这的确是一个开源项目的里程碑,它为充满希望的未来铺平了道路。

#### 快进到 Plasma 5.0
<ruby> KDE 软件合集 <rt> KDE Software Compilation </rt></ruby>一直使用到 KDE 4.0。在下一个 Plasma 5.0 版本中,它被分割成三个独立的项目:<ruby> KDE 框架 <rt> KDE Framework </rt></ruby>、KDE Plasma 和 <ruby> KDE 应用 <rt> KDE Applications </rt></ruby>。这有助于 KDE Plasma 桌面本身独立于与 KDE 框架、KDE 应用的发布节奏。这种模块化的方法帮助团队分别保持整个生态系统的质量和进度。
#### <ruby> KDE 女性 <rt> KDE Woman </rt></ruby>
KDE 社区的女性小组 [KDE 女性](https://community.kde.org/KDE_Women) 创建于 2001 年 3 月,目标是增加自由软件社区的女性人数,特别是在 KDE,这包括开发、文档和测试等领域。
#### KDE 吉祥物
KDE 的官方吉祥物是 <ruby> <a href="https://community.kde.org/Konqi"> 康奇 </a> <rt> Konqi </rt></ruby>,它是一条可爱的小龙,它的意思是 “<ruby> 征服者康奇 <rt> Konqi the Konqueror </rt></ruby>”(也是其浏览器 Konqueror 的昵称)。Katie 是 Konqi 的女朋友,也是 KDE 项目的官方吉祥物。
>
> Konqi 是<ruby> 科迪山谷 <rt> KDEValley </rt></ruby>的在任大使。它善于建造就像它善于破坏一样,而当事情变得越加复杂时,它的爬行动物大脑就混乱了。它在<ruby> 弗洛斯兰 <rt> Flossland </rt></ruby>(自由及开源软件大陆)各地旅行,在各个龙族殖民地之间建立联系。它还会从<ruby> 泼泛申瑙海 <rt> Professional Ocean </rt></ruby>(专业之海)传信到对面的<ruby> 尤思兰德 <rt> Userland </rt></ruby>(用户大陆)。它有时也会做这样的梦,梦见自己成为一只强壮的大龙。这是它过去的生活吗?
>
>
> —— 关于 Konqi 的官方描述
>
>
>

#### KDE 走向更多设备和充满希望的未来的旅程
多年来,KDE Plasma 成为各种硬件的首选桌面。2016 年,KDE 与一家西班牙笔记本电脑公司合作,推出了 [KDE Slimbook](https://kde.slimbook.es/),它是一款安装了 KDE Neon 发行版的超极本,带有 KDE Plasma,预装了 KDE 应用程序。可以从他们的网站上购买。
Linux 移动设备先锋 Pine64 在 2020 年推出了 [PinePhone KDE 版](https://www.debugpoint.com/2020/11/pinephone-kde-community-edition-plasma-mobile/),它带有 KDE Plasma 移动版。
Valve 公司宣布他们的手持游戏机 Steam Deck 采用了 [KDE Plasma](https://www.debugpoint.com/tag/kde-plasma),运行于 [Arch Linux](https://www.debugpoint.com/tag/arch-linux) 之上。

### 结语
那么,就写到这里吧。这是一些你可能不知道的 KDE 的趣闻。从 KDE 1.0 的那一天起,到今天,它出现在一个简单而强大的由 KDE 驱动的手持游戏设备里,这确实是一个漫长而多彩的旅程。我相信,在未来的日子里,KDE 生态系统一定会发生更多这样令人激动的事件。
你还知道没有在这里列出的 KDE 趣闻吗?请在下面的评论栏里告诉我。
---
via: <https://www.debugpoint.com/2021/12/kde-facts-trivia/>
作者:[Arindam](https://www.debugpoint.com/author/admin1/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) | null |
14,301 | 2022 年 5 个新 sudo 功能 | https://opensource.com/article/22/2/new-sudo-features-2022 | 2022-02-24T12:42:00 | [
"sudo"
] | https://linux.cn/article-14301-1.html |
>
> 最近的 sudo 版本增加了新的功能,使你能够观察和控制以前隐藏的问题。
>
>
>

当你想授予你的一些用户管理权限,同时控制和检查他们在你的系统上做什么时,你会使用 `sudo`。然而,即使是 `sudo`',也有相当多不可控的地方,想想给予 shell 权限的情况就知道了。最近的 `sudo` 版本增加了一些功能,可以让你看到这些问题,甚至控制它们。例如,你可以启用更详细、更容易处理的日志信息,并记录 shell 会话中执行的每个命令。
这些功能中有些是全新的。有些是出现在 1.9.0 甚至更早的版本中的功能。例如,`sudo` 可以记录终端上发生的一切,即使是在 1.8 版本。然而,系统将这些记录保存在本地,它们很容易被删除,特别是那些记录最有用的地方:Shell 会话。1.9.0 版本增加了会话记录集中收集,因此记录不能被本地用户删除,最近的版本还增加了中继功能,使收集功能更加强大。
如果你只知道 `sudo` 的基础知识,或者以前只使用过 1.8 版本,我建议你阅读我以前的 [文章](/article-12865-1.html)。
### 1、JSON 格式的日志记录
我想介绍的第一个新功能是 JSON 格式的日志记录。我是一个日志狂热者(12 年前我就开始在 `syslog-ng` 项目上工作),而这个功能是我在这里发表文章后引入的第一个功能。启用后,`sudo` 记录了更多的信息,并且以一种更容易解析的方式进行。
传统的 syslog 信息很短,只包含最小的必要信息量。这是由于旧的 `syslog` 实现的限制。超过 1k 大小的信息被丢弃或截断。
```
Jan 28 13:56:27 localhost.localdomain sudo[10419]: czanik : TTY=pts/0 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash
```
最近的 `syslog` 实现可以处理更大的信息量。`syslog-ng` 默认接受 64k 大小的日志信息(当然,它可以更小或更大,取决于实际配置)。
同样的事件,如果以 JSON 格式记录,就会包含更多的信息。更多并不意味着更难处理。JSON 格式的信息更容易被许多日志管理软件应用解析。下面是一个例子:
```
Jan 28 13:58:20 localhost.localdomain sudo[10518]: @cee:{"sudo":{"accept":{"uuid":"616bc9efcf-b239-469d-60ee-deb5af8ce6","server_time":{"seconds":1643374700,"nanoseconds":222446715,"iso8601":"20220128125820Z","localtime":"Jan 28 13:58:20"},"submit_time":{"seconds":1643374700,"nanoseconds":209935349,"iso8601":"20220128125820Z","localtime":"Jan 28 13:58:20"},"submituser":"czanik","command":"/bin/bash","runuser":"root","runcwd":"/home/czanik","ttyname":"/dev/pts/0","submithost":"localhost.localdomain","submitcwd":"/home/czanik","runuid":0,"columns":118,"lines":60,"runargv":["/bin/bash"],"runenv":["LANG=en_US.UTF-8","HOSTNAME=localhost.localdomain","SHELL=/bin/bash","TERM=xterm-256color","PATH=/home/czanik/.local/bin:/home/czanik/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin","MAIL=/var/mail/root","LOGNAME=root","USER=root","HOME=/root","SUDO_COMMAND=/bin/bash","SUDO_USER=czanik","SUDO_UID=1000","SUDO_GID=1000"]}}}
```
你可以在 `sudoers` 文件中启用 JSON 格式的日志信息:
```
Defaults log_format=json
```
你可以从我的 [syslog-ng](https://www.syslog-ng.com/community/b/blog/posts/working-with-json-logs-from-sudo-in-syslog-ng) 博客中了解更多关于如何从 `sudo` 中使用 JSON 格式的日志信息。
### 2、使用 sudo\_logsrvd 集中收集日志
1.9.4 中另一个与日志相关的功能是使用 `sudo_logsrvd` 收集所有 `sudo` 日志信息(包括失败的)。以前,系统只在 `sudo_logsrvd` 实际进行记录时记录成功的会话。最后仍然默认通过 `syslog` 进行记录。
为什么这很重要?首先,你可以在一个地方收集任何与 `sudo` 有关的东西。无论是会话记录还是所有相应的日志信息。其次,它还可以保证正确记录所有与 `sudo` 有关的事件,因为如果 `sudo_logsrvd` 无法访问,`sudo` 可以拒绝执行命令。
你可以在 `sudoers` 文件中通过以下设置启用 `sudo_logsrvd` 日志记录(当然要替换 IP 地址):
```
Defaults log_servers=172.16.167.150
```
如果你想要 JSON 格式的日志信息,你需要在 `sudo_logsrvd` 配置的 `[eventlog]` 部分进行如下设置:
```
log_format = json
```
否则,`sudo_logsrvd` 使用传统的 `sudo` 日志格式,并作了简单的修改。它还包括日志来源的主机的信息:
```
Nov 18 12:40:16 centos8splunk.localdomain sudo[21028]: czanik : 3 incorrect password attempts ; HOST=centos7sudo.localdomain ; TTY=pts/0 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash
Nov 18 12:40:23 centos8splunk.localdomain sudo[21028]: czanik : HOST=centos7sudo.localdomain ; TTY=pts/0 ; PWD=/home/czanik ; USER=root ; TSID=00000A ; COMMAND=/bin/bash
Nov 18 12:40:30 centos8splunk.localdomain sudo[21028]: czanik : command rejected by I/O plugin ; HOST=centos7sudo.localdomain ; TTY=pts/0 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash
```
### 3、中继
当最初引入 `sudo_logsrvd`(1.9.0 版)进行会话记录集中收集时,客户端只能直接发送记录。1.9.7 版本引入了中继的概念。有了中继,你可以不直接发送记录,而是将记录发送到多级中间主机,这些中间主机构成你的网络。
为什么这很重要?首先,中继使收集会话记录成为可能,即使集中主机由于网络问题或维护而不可用。默认情况下,`sudo` 在无法发送记录时拒绝运行,所以中继可以确保你可以全天候使用 `sudo`。
其次,它还允许你对网络有更严格的控制。你不需要为所有的主机向中心的 `sudo_logsrvd` 开放防火墙,而只需要允许你的中继通过。
最后,它允许你从没有直接互联网接入的网络中收集会话记录,比如 AWS 私有网络,你可以在网关主机上以中继模式安装 `sudo_logsrvd`。
当你使用中继时,`sudo` 客户端和中心的 `sudo_logsrvd` 的配置保持不变。在中继主机上,在 `sudo_logsrvd.conf` 的 `[relay]` 部分添加以下一行:
```
relay_host = 172.16.167.161
```
如果知道通往中心服务器的网络连接有问题,你可以配置中继,在转发记录之前储存它:
```
store_first = true
```
### 4、记录子命令
你是否曾经想知道在通过 `sudo` 启动的 shell 会话中发生了什么?是的,会话记录是存在的,但是为了看几个命令的执行情况而看几个小时的记录是很无聊的,也是对时间的巨大浪费。幸运的是,1.9.8 版本引入了子命令日志。现在,只需定期检查你的日志信息,并在发生可疑情况时才观看记录。
你甚至不需要一个允许 shell 访问的规则,只需要访问一个编辑器就可以访问 shell。大多数编辑器可以运行外部命令。我最喜欢的编辑器是 JOE,这是我通过 `sudo` 启动它时可以看到的情况:
```
Aug 30 13:03:00 czplaptop sudo[10150]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/joe
```
不用吃惊,就在一个编辑器里,我生成一个 shell 并从该 shell 中删除一些文件和分区。现在让我们看看当你启用对子命令记录时会发生什么:
```
Aug 30 13:13:14 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/joe
Aug 30 13:13:37 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/sh -c /bin/bash
Aug 30 13:13:37 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash
Aug 30 13:13:37 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/readlink /proc/10889/exe
[...]
Aug 30 13:13:37 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/sed -r s@/*:|([^\\\\]):@\1\n@g;H;x;s@/\n@\n@
Aug 30 13:13:37 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/tty
Aug 30 13:13:42 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/id
Aug 30 13:13:56 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/ls -A -N --color=none -T 0 /usr/share/syslog-ng/include/scl/
```
我省略了几十行以节省一些空间,但你仍然可以看到我启动了一个 shell,`bash_profile` 执行的命令也可以在日志中看到。
你可以在 `sudoers` 文件中使用以下设置来启用子命令日志:
```
`Defaults log_subcmds`
```
在传统的 `sudo` 日志中,你可以从 `sudo` 进程 ID 看到这些日志正是来自同一个 `sudo`会话。如果你打开 JSON 格式的日志,如前面所示,`sudo` 在日志中记录了更多的信息,使之更容易进行分析。
### 5、拦截子命令
记录子命令可以消除 `sudo` 的大部分隐患,但在有些情况下,你不只是想观察正在发生的事情,还想控制事件的流程。例如,你需要给一个用户提供 shell 权限,但仍想阻止他们运行一个特定的命令。在这种情况下,拦截是理想的选择。当然,也有一些限制,比如你不能限制 shell 的内置命令。
比方说,`who` 命令很危险。你可以分两步启用拦截。第一个步骤是启用它,第二个步骤是配置它。在这种情况下,我的用户不被允许运行 `who`:
```
Defaults intercept
czanik ALL = (ALL) ALL, !/usr/bin/who
```
当我通过`sudo` 启动一个 root shell 会话并尝试运行 `who` 时,会发生以下情况:
```
$ sudo -s
# who
Sorry, user czanik is not allowed to execute '/usr/bin/who' as root on czplaptop.
bash: /usr/bin/who: Permission denied
```
你可以很容易地完全禁用运行 shell:
```
Defaults intercept
Cmnd_Alias SHELLS=/usr/bin/bash, /usr/bin/sh, /usr/bin/csh
czanik ALL = (ALL) ALL, !SHELLS
```
这意味着你不能通过 `sudo` 启动 shell 会话。不仅如此,你也不能从编辑器中执行外部命令。当我试图从 `vi` 中启动 `ls` 命令时,就会出现这种情况:
```
$ sudo vi /etc/issue
Sorry, user czanik is not allowed to execute '/bin/bash -c /bin/ls' as root on czplaptop.
Cannot execute shell /bin/bash
Press ENTER or type command to continue
```
### 接下来是什么?
我希望读了我的文章后,自己尝试一下这些新功能。你可以通过你的软件包管理器在许多 Linux 发行版和 UNIX 变种上安装最新的 `sudo`,或者使用 [Sudo 网站](https://www.sudo.ws/getting/packages) 上的二进制安装程序。
这篇文章只是为你提供了一个新的可能性的概述。如果你想了解更多关于这些功能的信息,请访问网站,那里有手册页面,也有 [Sudo 博客](https://www.sudo.ws/posts)。
---
via: <https://opensource.com/article/22/2/new-sudo-features-2022>
作者:[Peter Czanik](https://opensource.com/users/czanik) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | When you want to grant administrative access to some of your users while controlling and checking what they do on your systems, you use `sudo`
. However, even with `sudo`
, there are quite a few unseen issues—just think about giving out shell access. Recent `sudo`
releases added features that let you see these issues and even control them. For example, you can turn on more detailed and easier-to-process log messages and log each command executed in a shell session.
Some of these features are brand new. Some of them build on features introduced in version 1.9.0 or even earlier. For example, `sudo`
could record everything that happened on a terminal, even in version 1.8. However, the system stored these recordings locally, and they were easy to delete, especially those where the recordings were the most useful: Shell sessions. Version 1.9.0 added central session recording collection, so recordings cannot be deleted by the local user, and recent versions added relays, making the collection even more robust.
If you only know the basics of `sudo`
or used only version 1.8 previously, I recommend reading my previous [article](https://opensource.com/article/20/10/sudo-19).
## 1. JSON-formatted logging
The first new feature I want to introduce is JSON-formatted logging. I am a logging fanatic (I started working on the `syslog-ng`
project twelve years ago), and this feature is the first one introduced since my Opensource.com article. When enabled, `sudo`
logs a lot more information and does it in an easier way to parse.
Traditional `syslog`
messages by `sudo`
are short and contain only the minimum amount of necessary information. This is due to constraints by old `syslog`
implementations: Messages over 1k size were discarded or truncated:
`Jan 28 13:56:27 localhost.localdomain sudo[10419]: czanik : TTY=pts/0 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash`
More recent `syslog`
implementations can handle much larger message sizes. `syslog-ng`
accepts log messages up to 64k in size by default (but of course, it can be smaller or larger, depending on the actual configuration).
The same event contains a lot more information if logged in JSON format. More does not mean more difficult to handle: JSON-formatted messages are easier to parse by many log management software applications. Here is an example:
`Jan 28 13:58:20 localhost.localdomain sudo[10518]: @cee:{"sudo":{"accept":{"uuid":"616bc9efcf-b239-469d-60ee-deb5af8ce6","server_time":{"seconds":1643374700,"nanoseconds":222446715,"iso8601":"20220128125820Z","localtime":"Jan 28 13:58:20"},"submit_time":{"seconds":1643374700,"nanoseconds":209935349,"iso8601":"20220128125820Z","localtime":"Jan 28 13:58:20"},"submituser":"czanik","command":"/bin/bash","runuser":"root","runcwd":"/home/czanik","ttyname":"/dev/pts/0","submithost":"localhost.localdomain","submitcwd":"/home/czanik","runuid":0,"columns":118,"lines":60,"runargv":["/bin/bash"],"runenv":["LANG=en_US.UTF-8","HOSTNAME=localhost.localdomain","SHELL=/bin/bash","TERM=xterm-256color","PATH=/home/czanik/.local/bin:/home/czanik/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin","MAIL=/var/mail/root","LOGNAME=root","USER=root","HOME=/root","SUDO_COMMAND=/bin/bash","SUDO_USER=czanik","SUDO_UID=1000","SUDO_GID=1000"]}}}`
You can enable JSON-formatted log messages in the `sudoers`
file:
`Defaults log_format=json`
You can learn more about how to work with JSON-formatted log messages from `sudo`
from my [syslog-ng](https://www.syslog-ng.com/community/b/blog/posts/working-with-json-logs-from-sudo-in-syslog-ng) blog.
## 2. Collecting logs centrally using sudo_logsrvd
Another logging-related feature in 1.9.4 is collecting all `sudo`
log messages (including failures) using `sudo_logsrvd`
. Previously, the system only logged successful sessions when `sudo_logsrvd`
actually made a recording. Logging is still done through `syslog `
by default in the end.
Why is this important? First of all, you can collect anything related to `sudo`
in one place: Both the session recordings and all the corresponding log messages. Secondly, it can also guarantee proper logging of all `sudo`
-related events, as `sudo`
can refuse to execute commands if `sudo_logsrvd`
is inaccessible.
You can enable logging to `sudo_logsrvd`
with the following setting in the `sudoers`
file (of course, replace the IP address):
`Defaults log_servers=172.16.167.150`
If you want JSON-formatted log messages, you need the following setting in the `[eventlog]`
section of the `sudo_logsrvd`
configuration:
`log_format = json`
Otherwise, `sudo_logsrvd`
uses the traditional `sudo`
log format with a simple modification: It also includes information about the host where the log comes from:
```
Nov 18 12:40:16 centos8splunk.localdomain sudo[21028]: czanik : 3 incorrect password attempts ; HOST=centos7sudo.localdomain ; TTY=pts/0 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash
Nov 18 12:40:23 centos8splunk.localdomain sudo[21028]: czanik : HOST=centos7sudo.localdomain ; TTY=pts/0 ; PWD=/home/czanik ; USER=root ; TSID=00000A ; COMMAND=/bin/bash
Nov 18 12:40:30 centos8splunk.localdomain sudo[21028]: czanik : command rejected by I/O plugin ; HOST=centos7sudo.localdomain ; TTY=pts/0 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash
```
## 3. Relays
When they originally introduced `sudo_logsrvd`
(version 1.9.0) for central session recording collection, clients could only send recordings directly. Version 1.9.7 introduced the concept of relays. With relays, instead of sending recordings directly, you can send recordings to multiple levels of intermediate hosts, which structure your network.
Why is this important? First of all, relays make it possible to collect session recordings even if the central host is unavailable due to network problems or maintenance. By default, `sudo`
refuses to run when it cannot send recordings, so relays can ensure that you can use `sudo`
around the clock.
Secondly, it also allows you to have stricter controls on your network: Instead of opening up the firewall for all hosts to the central `sudo_logsrvd`
, you only need to allow your relay through.
Finally, it allows you to collect session recordings from networks without direct internet access, like AWS private networks, where you can install `sudo_logsrvd`
in relay mode on the gateway host.
When you use relays, configuring the `sudo`
clients and the central `sudo_logsrvd`
remains the same. On the relay host, add the following line to the `[relay]`
section of `sudo_logsrvd.conf`
:
`relay_host = 172.16.167.161`
If the network connection towards the central server is known to be problematic, you can configure the relay to store recordings before forwarding them:
`store_first = true`
## 4. Logging subcommands
Did you ever want to know what happens within a shell session started through `sudo`
? Yes, session recordings are there, but watching hours of recordings just to see a couple of commands executed is boring and a huge waste of time. Luckily, version 1.9.8 introduced logging subcommands. Now it is enough to check your log messages regularly and watch recordings only when something suspicious occurs.
You do not even need a rule to allow shell access to have shell access, just access to an editor. Most editors can run external commands. My favorite editor is JOE, and this is what you can see when I start it through `sudo`
:
`Aug 30 13:03:00 czplaptop sudo[10150]: czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/joe`
Nothing interesting, just an editor—even if I spawn a shell and delete a few files and partitions from that shell. Now let us see what happens when you enable logging subcommands:
```
Aug 30 13:13:14 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/joe
Aug 30 13:13:37 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/sh -c /bin/bash
Aug 30 13:13:37 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/bin/bash
Aug 30 13:13:37 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/readlink /proc/10889/exe
[...]
Aug 30 13:13:37 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/sed -r s@/*:|([^\\]):@\1\n@g;H;x;s@/\n@\n@
Aug 30 13:13:37 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/tty
Aug 30 13:13:42 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/id
Aug 30 13:13:56 czanik : TTY=pts/1 ; PWD=/home/czanik ; USER=root ; COMMAND=/usr/bin/ls -A -N --color=none -T 0 /usr/share/syslog-ng/include/scl/
```
I omitted dozens of lines to save some space, but you can still see that I started a shell, and the commands executed by `bash_profile`
are also available in the logs.
You can enable logging subcommands in the `sudoers`
file using the following setting:
`Defaults log_subcmds`
In the traditional `sudo`
logs, you can see from the `sudo`
process id that these logs are from the very same `sudo`
session. If you turn on JSON-formatted logging, as shown earlier, `sudo`
logs a lot more information in the logs, making it easier to analyze them.
## 5. Intercepting subcommands
Logging subcommands removes most hidden problem areas from `sudo`
, but there are situations when you do not want just to watch what is happening but also control the flow of events. For example, you need to give shell access to a user but still want to prevent them from running a specific command. Interception is ideal in such cases. There are, of course, some limitations, like you cannot limit the built-in commands of shells.
Let's say the `who`
command is dangerous. You can enable interception in two steps: The first one enables it, the second one configures it. In this case, my user is not allowed to run `who`
:
```
Defaults intercept
czanik ALL = (ALL) ALL, !/usr/bin/who
```
Here is what happens when I start a root shell session through `sudo`
and try to run `who`
:
```
$ sudo -s
# who
Sorry, user czanik is not allowed to execute '/usr/bin/who' as root on czplaptop.
bash: /usr/bin/who: Permission denied
```
You can easily disable running shells altogether:
```
Defaults intercept
Cmnd_Alias SHELLS=/usr/bin/bash, /usr/bin/sh, /usr/bin/csh
czanik ALL = (ALL) ALL, !SHELLS
```
However, it also means that you cannot start shell sessions through `sudo`
. Not just that, but you cannot execute external commands from editors either. This is what happens when I try to start the `ls`
command from within `vi`
:
```
$ sudo vi /etc/issue
Sorry, user czanik is not allowed to execute '/bin/bash -c /bin/ls' as root on czplaptop.
Cannot execute shell /bin/bash
Press ENTER or type command to continue
```
## What is next?
I hope that reading my article makes you want to try these new features yourself. You can install the latest `sudo`
on many Linux distributions and UNIX variants from your package manager, or use a binary installer available on the [Sudo website](https://www.sudo.ws/getting/packages).
This article provides you with just an overview of new possibilities. If you want to learn more about these features, visit the website, which hosts manual pages, and also the [Sudo blog](https://www.sudo.ws/posts).
## Comments are closed. |
14,302 | 如何在 Linux 中清理 Snap 包的版本 | https://itsfoss.com/clean-snap-packages/ | 2022-02-24T15:30:35 | [
"Snap"
] | https://linux.cn/article-14302-1.html | 
Snap 软件包并不是每个人都喜欢的,但它们是 Ubuntu 生态系统中不可或缺的一部分。
它有其优点和缺点。其中一个缺点是,Snap 包通常体积较大,占用大量的磁盘空间。如果你的磁盘空间不够用,特别是在根分区上,这可能是一个问题。
让我分享一个巧妙的技巧,你可以用它来减少 Snap 包使用的磁盘空间。
### 清理旧的 Snap 包版本以释放磁盘空间
与 snap 有关的系统文件都存放在 `/var/lib/snapd` 目录下。根据你所安装的 Snap 包的数量,这个目录的大小可能在几 GB。不要只听我的一面之词。通过 [使用 du 命令检查目录大小](https://linuxhandbook.com/find-directory-size-du-command/) 来进行评估。
```
$ sudo du -sh /var/lib/snapd
5.4G /var/lib/snapd
```
你也可以使用磁盘使用分析器这个 GUI 工具来查看 [Ubuntu 的磁盘使用情况](https://itsfoss.com/check-free-disk-space-linux/)。

这可真够多的,对吧?你可以在这里腾出一些磁盘空间。根据设计,Snap 至少会在你的系统上保留一个你所安装的软件包的旧版本。你可以通过使用 Snap 命令看到这种行为:
```
snap list --all
```
你应该看到同一个软件包被列了两次,而且版本和修订号都不同。

为了释放磁盘空间,你可以删除额外的软件包版本。你怎么知道要删除哪一个呢?你可以看到,这些较旧的软件包被标记为“禁用”。
不要担心。你不需要手动操作。由于 Alan Pope 在 [Snapcraft](https://snapcraft.io/) 团队工作时写的一个灵巧的 bash 脚本,有一种自动的方法可以做到。
我希望你知道 [如何创建和运行 bash shell 脚本](https://itsfoss.com/run-shell-script-linux/)。基本上,创建一个名为 `clean-snap.sh` 的新文件,并在其中添加以下几行。
```
#!/bin/bash
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu
snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
snap remove "$snapname" --revision="$revision"
done
```
保存它并关闭编辑器。要运行这个脚本,把它放在你的主目录中,然后 [在 Ubuntu 中打开终端](https://itsfoss.com/open-terminal-ubuntu/),运行这个命令:
```
sudo bash clean-snap.sh
```
你可以看到,它开始删除旧版本的软件包。

如果你现在检查 Snap 使用的磁盘空间,你会发现现在的目录大小已经减少了。
```
$ sudo du -sh /var/lib/snapd
3.9G /var/lib/snapd
```
如果这对你有用,你可以偶尔运行这个命令。
#### 这个脚本是如何工作的?
如果你对这个脚本的作用感到好奇,让我来解释一下。
你已经看到了 `snap list -all` 命令的输出。它的输出被传递给 [awk 命令](https://linuxhandbook.com/awk-command-tutorial/)。Awk 是一个强大的脚本工具。
`awk '/disabled/{print $1, $3}'` 部分在每一行中寻找字符串 `disabled`,如果找到它,它将提取第一列和第三列。
这个输出被进一步传递给 `while` 和 `read` 命令的组合。读取命令获取第一列的 Snap 包名和第三列的修订号变量。
然后,这些变量被用来运行 `snap remove` 命令,用 Snap 包名和它的修订号来删除。
只要发现有包含 `disabled` 字符串的行,就会运行 `while` 循环。
如果你对 shell 脚本略知一二,这一切就很容易理解了。如果你不熟悉,我们有一个 [初学者的 bash 教程系列](https://linuxhandbook.com/tag/bash-beginner/) 给你。
### 你拿回了你的空间了吗?
你可能会看到一些论坛建议将 Snap 软件包的保留值设置为 2。
```
sudo snap set system refresh.retain=2
```
我认为现在不需要了。现在 Snap 的默认行为是为任何软件包保存两个版本。
总而言之,如果你的空间不够用,摆脱额外的软件包版本肯定是 [释放 Ubuntu 磁盘空间的方法](https://itsfoss.com/free-up-space-ubuntu-linux/) 之一。
如果这个教程帮助你释放了一些空间,请在评论区告诉我。
---
via: <https://itsfoss.com/clean-snap-packages/>
作者:[Abhishek Prakash](https://itsfoss.com/author/abhishek/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Snap packages are not everyone’s favorite but they are an integral part of the Ubuntu ecosystem.
It has its pros and cons. One of the negatives is that Snap packages are usually bigger in size and take a lot of disk space.
This could be a problem if you are running out of disk space, specially on the root partition.
Let me share a neat trick that you could use to cut down the disk spaced used by Snap packages.
## Cleaning up old Snap package versions to free disk space
The system files related to snap are stored in the /var/lib/snapd directory. Based on the number of Snap packages you have installed, this directory size could be in several GBs.
Don’t just take my word for it. Do an assesement by [using the du command to check the directory size.](https://linuxhandbook.com/find-directory-size-du-command/?ref=itsfoss.com)
```
abhishek@its-foss:~$ sudo du -sh /var/lib/snapd
5.4G /var/lib/snapd
```
You may also use the Disk Usage Analyzer GUI tool to see the [disk usage in Ubuntu](https://itsfoss.com/check-free-disk-space-linux/).

That’s a lot, right? You could free up some disk space here.
By design, Snap keeps at least one older version of the packages you have installed on your system.
You can see this behavior by using the Snap command:
`snap list --all`
You should see the same package listed twice with different version and revision number.

To free up disk space, you can delete the additional package versions. How do you know which one to delete? You can see that these older packages are labeled ‘disabled’.
Don’t worry. You don’t have to manually do it. There is sort of automatic way to do it thanks to a nifty bash script written by Alan Pope while he was working in the [Snapcraft](https://snapcraft.io/?ref=itsfoss.com) team.
I hope you know [how to create and run a bash shell script](https://itsfoss.com/run-shell-script-linux/). Basically, create a new file named clean-snap.sh and add the following lines to it.
```
#!/bin/bash
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu
snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
snap remove "$snapname" --revision="$revision"
done
```
Save it and close the editor.
To run this script, keep it in your home directory and then [open the terminal in Ubuntu](https://itsfoss.com/open-terminal-ubuntu/) and run this command:
`sudo bash clean-snap.sh`
You can see that it starts removing the older version of packages.

If you check the disk space used by Snap now, you’ll see that the directory size is reduced now.
```
abhishek@its-foss:~$ sudo du -sh /var/lib/snapd
3.9G /var/lib/snapd
```
If this works for you, you could run this command occasionally.
### How does this script work?
If you are curious about what does this script do, let me explain.
You have already seen the output of the “snap list –all” command. It’s output is passed to the [awk command](https://linuxhandbook.com/awk-command-tutorial/?ref=itsfoss.com). Awk is a powerful scripting tool.
The awk ‘/disabled/{print $1, $3}’ part looks for the string ‘disabled’ in each row and if it is found, it extracts the first column and third column.
This output is further passed to a combination of while and read command. Read command gets the value of first column to snapname and third column to revision variable.
These variables are then used to run the snap remove command to delete with the name of the span package name and its revision number.
The while loop runs as long as there are rows found with ‘disabled’ string in it.
This all makes sense easily if you know a little bit about shell scripting. If you are not familiar with, we have a [bash tutorial series for beginners](https://linuxhandbook.com/tag/bash-beginner/?ref=itsfoss.com) for you.
## Did you get your GBs back?
You may see some forums advising to set up the Snap package retention value to 2.
`sudo snap set system refresh.retain=2`
I don’t think it’s needed anymore. Snap’s default behavior now is to store total 2 versions for any package.
Altogether, if you are running out of space, getting rid of the additional package version could surely one of the [ways to free up disk space on Ubuntu](https://itsfoss.com/free-up-space-ubuntu-linux/).
If this tutorial helped you free some space, let me know in the comment section. |
14,304 | 7 个我希望在 Ubuntu 22.04 LTS 看到的变化 | https://news.itsfoss.com/things-i-want-ubuntu-22-04-lts/ | 2022-02-25T10:24:15 | [
"Ubuntu"
] | https://linux.cn/article-14304-1.html |
>
> Ubuntu 22.04 即将面世。但是,你对它的发布有什么期望?在这里,我分享一些我希望看到的东西。
>
>
>

随着 Ubuntu 22.04 LTS 的到来,我们都在急切地等待着体验 [Ubuntu 22.04 引入的功能](https://itsfoss.com/ubuntu-22-04-release-features/)。
在没有对 Ubuntu 22.04 进行全面亲身体验的情况下,我不能确定它是否令人印象深刻。但是,我确实对我想在 Ubuntu 22.04 中看到的东西有一些想法。
现在提出一些修改要求可能有点太晚了,但我还是希望能有最好的结果。
一些重点包括:
### 1、在所有的应用程序中保持一致的主题形象

任何试图在 Ubuntu 上安装 KDE 应用的人都会知道,主题不一致的情况比比皆是。更糟糕的是,Libadwaita 的加入只会让更多的应用程序显得格格不入。
为了解决这个问题,我认为需要一个替代解决方案组合。
首先,默认采用 Ubuntu 的 Yaru 主题的定制 Libadwaita 将使几乎所有为 Gnome 和 GTK 构建的应用程序再次保持一致。然而,这仍然不能解决 Qt/KDE 应用程序的问题。
对于这些,需要一个类似于 [Kvantum](https://github.com/tsujan/Kvantum) 的解决方案。尽管 Kvantum 有点“难”,但我真的相信,一个有 Canonical(Ubuntu 的母公司)全力支持的解决方案能够克服 Kvantum 所面临的所有挑战。
Ubuntu 的外观和感觉是其决定性的特征之一,关键是要在每个应用程序中保持这种外观,以确保其视觉吸引力。
### 2、使用 GNOME 40 中引入的水平停靠区

尽管有些激进,[Gnome 40](https://news.itsfoss.com/gnome-40-release/) 是 Gnome 向未来的一次飞跃,有几个令人兴奋的功能。然而,这些创新的功能中有许多并没有进入 Ubuntu 22.10。
其中最值得注意的是水平停靠区。对我来说,我发现它极大地提高了我的工作效率,因为我不必再像以前那样把鼠标移到屏幕的左边。我相信很多 Ubuntu 用户同意我的观点,但是 Canonical 坚持认为左边的位置是最好的。
我不是说他们应该把停靠区移到底部,这毕竟是 Ubuntu 的一个决定性特征,只是给用户一个这样的选择而已。Ubuntu 在设置程序中已经有一个自定义“外观”部分,所以我认为在那里增加一个简单的切换开关不会太难。
### 3、找回混合主题

升级到 Ubuntu 21.10 后,我很失望地发现 [混合主题选项消失了](https://news.itsfoss.com/ubuntu-21-10-theme-change/)。虽然这只是个小问题,但我确实发现自己很怀念这个选项,并不断地想办法把它找回来。
我认为,让用户有能力轻松地定制他们的桌面是很重要的,把这个选项带回来对改善这个问题有很大的帮助。
我理解他们想摆脱它是因为 Ubuntu 和 GNOME 默认主题颜色的冲突。但是,我喜欢它原来的样子。
### 4、改造后的软件中心

随着 Canonical 不断推动人们使用 snap 应用程序(一种与所有发行版兼容的通用打包格式),创建一个新的软件中心将是有意义的。
虽然 Snap 商店已经存在,但它只是 Gnome 软件的一个复刻,而它以其速度慢和 bug 多而出名。
随着 [Gnome 41](https://news.itsfoss.com/gnome-41-release/) 的发布,这一点在一定程度上得到了缓解,尽管这些改进不太可能被包含在 Ubuntu 22.04 中。
如果有一个新的软件中心诞生,或者现有的软件中心得到重大改造,我将会很高兴。
如果 Ubuntu 要推出一个新的应用程序商店,它可能会使用 Flutter 来构建,就像他们的新安装程序。虽然我个人并不喜欢 Ubuntu 开始转向 Flutter 的决定,但这将有助于确保其所有变体的一致性。
### 5、改进的自定义选项
有些人喜欢保持简单,而有些人则喜欢自定义选项来改变外观/感觉。
Ubuntu 22.04 LTS 不需要引入任何疯狂的东西,但是简单地在默认情况下增加一些额外的控制,你可以在 [GNOME 调整](https://itsfoss.com/gnome-tweak-tool/) 中找到,应该可以做到这一点。
目前,外观调整是相当有限的,我们可以使用更多的选项。
### 6、让 Snap 应用程序少一些

我知道,我知道。Snap 应用程序无处不在,而且它们与多个发行版兼容。但是,它们的速度也更慢,而且只能从专有的 Snap 商店安装。
当然,你可以选择 Flatpak 和预建的二进制文件。但是,Snap 的专有方式仍然是许多用户不喜欢的。
另一方面,Ubuntu 的原生 [Apt 软件包管理器](https://itsfoss.com/apt-command-guide/) 速度更快,而且有更多的应用程序可用。这导致了用户体验的明显改善,尽管这种改善在各发行版中并不连续。
不幸的是,Snap 实际上是由 Ubuntu 背后的同一个团队开发的,所以删除它是相当不可能的。
### 7、卸载应用程序的统一方式
Ubuntu 在为终端用户提供便利方面有着很好的声誉。
为了对抗 Linux 软件包的碎片化,Ubuntu 能否引入一种轻松卸载应用程序的方法,无论是 Flatpak/Deb/Snap?
考虑到外面有各种各样的软件包,现在是时候让我们有一个处理所有软件包的单一解决方案了。

在 Ubuntu 22.04 LTS 中不太可能看到它的解决方案,但我希望在下一个版本中能做到!
### 总结
很明显,你可能不会看到所有这些期望的事情在下一个版本中发生。然而,即使 Ubuntu 22.04 LTS 在这个方向上做了一些努力,我们也有希望在未来的版本中看到它们。
你希望在 Ubuntu 22.04 中看到哪些新功能?请在下面的评论中告诉我们!
---
via: <https://news.itsfoss.com/things-i-want-ubuntu-22-04-lts/>
作者:[Jacob Crume](https://news.itsfoss.com/author/jacob/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

With Ubuntu 22.04 LTS just around the corner, we are all waiting eagerly to experience the [list of features in Ubuntu 22.04](https://itsfoss.com/ubuntu-22-04-release-features/?ref=news.itsfoss.com) being introduced.
Without a full-fledged hands-on with Ubuntu 22.04, I can’t say for certain if it is impressive. But, I do have some thoughts on the things I want to see in Ubuntu 22.04.
It’s probably a bit too late to make some requests for changes, but I’d like to hope for the best!
Some highlights include:
## 1. Consistent Theming Across All Apps

As anyone who has tried to install a KDE app on Ubuntu will know, theming inconsistencies are rife. To make matters worse, the addition of Libadwaita into the mix is only going to make more apps look out-of-place.
To fix this, I think a combination of alternative solutions are required.
Firstly, a custom version of Libadwaita with Ubuntu’s Yaru theme as default would make almost all apps built for Gnome and GTK consistent again. However, this still doesn’t solve the problems with Qt/KDE apps.
For these, a solution similar to [Kvantum](https://github.com/tsujan/Kvantum?ref=news.itsfoss.com) is required. Even though Kvantum is a bit “hacky”, I genuinely believe that a solution with the full backing of Canonical (Ubuntu’s parent company) would be able to overcome all the challenges Kvantum faces.
Ubuntu’s look and feel is one of its defining features, and it is key to maintain this look across every app to ensure its visual appeal remains.
## 2. Using the Horizontal Dock Introduced in GNOME 40

Despite being somewhat radical, [Gnome 40](https://news.itsfoss.com/gnome-40-release/) was a leap into the future for Gnome with several exciting features. However, many of these innovative features didn’t make it into Ubuntu 22.10.
The most notable of these is the horizontal dock. For me, I found that it significantly improved my productivity, as I didn’t have to move my mouse as far to reach the left of the screen. I’m sure many Ubuntu users agree with me, but Canonical insists that the left placement is best.
I’m not saying that they should move the dock to the bottom—it is after all a defining feature of Ubuntu—merely give users an option to do so. Ubuntu already has a custom “Appearance” section in the settings app, so I don’t think a simple addition of a toggle switch there would be too hard.
## 3. Bringing Back The Mixed Theme

After upgrading to Ubuntu 21.10, I was quite disappointed to find that the [mixed theme option disappear](https://news.itsfoss.com/ubuntu-21-10-theme-change/). While it is minor, I do find myself missing this option and constantly trying to find ways to bring it back.
I think it is important that users are given the ability to customize their desktops easily, and bringing this option back would go a long way to improving this.
I understand that they wanted to get rid of it because of conflicts in Ubuntu and GNOME default theme colors. But, I liked it the way it was!
## 4. Revamped Software Centre

With Canonical’s constant push for people to use snap apps (a universal packaging format compatible with all distros), it would make sense for a new software center to be created.
While the Snap Store already exists, it is simply a fork of Gnome Software and is quite well-known for being slow and bug-ridden.
With the release of [Gnome 41](https://news.itsfoss.com/gnome-41-release/), this was mitigated to some extent, although these improvements are unlikely to be included in Ubuntu 22.04.
If a new software center were to be created or the existing one gets a major revamp, I’d love that.
If Ubuntu were to come out with a new app store, it would probably be built using Flutter, just like their new installer. While I, personally, don’t like Ubuntu’s decision to start switching to Flutter, it would help ensure consistency across all its variants.
## 5. Improved Customization Options
Some prefer to keep things simple, while others appreciate customization options to change the look/feel.
Ubuntu 22.04 LTS does not have to introduce anything crazy, but simply adding some extra controls by default that you find with [GNOME Tweaks](https://itsfoss.com/gnome-tweak-tool/?ref=news.itsfoss.com) should do the trick.
Currently, the appearance tweaks are quite limited, and we could use a few more options.
## 6. Less Snap Apps

I know, I know. Snap apps are everywhere, and they are compatible with multiple distros. However, they are also much slower and can only be installed from the proprietary Snap Store.
Of course, you can opt for Flatpaks and pre-built binaries. But, Snap’s proprietary approach is still something many users don’t like.
On the other hand, Ubuntu’s native [Apt package manager](https://itsfoss.com/apt-command-guide/?ref=news.itsfoss.com) is faster and has more apps available. This results in a significantly improved user experience, albeit one that is not continuous across distros.
Unfortunately, Snap is actually developed by the same team as the one behind Ubuntu, so its removal is quite unlikely.
### 7. A Unified Way of Uninstalling Applications
Ubuntu has a pretty good reputation for making things easier for the end-user.
To combat Linux package fragmentation, could Ubuntu introduce a way to easily uninstall applications, whether it’s Flatpak/Deb/Snap?
Considering the variety of packages available out there, it is time that we have a one-solution to handle all the packages.

It’s unlikely to see a solution for it with Ubuntu 22.04 LTS, but I’d like to do the wishful thinking for the next release!
## Wrapping Up
Obviously, you may not see expect all of these things to happen with the next release. However, even if Ubuntu 22.04 LTS makes some effort in this direction, we will hopefully see them in a future release.
*What new features would you like to see in Ubuntu 22.04? Let us know in the comments below!*
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,305 | 在 Linux 上安装应用指南:软件中心篇 | https://opensource.com/article/22/2/installing-applications-desktop-linux | 2022-02-25T11:16:23 | [
"软件",
"安装"
] | https://linux.cn/article-14305-1.html |
>
> 从我们的新电子书中获得关于在 Linux 上安装应用的所有不同方法的信息。
>
>
>

当你想在你的手机上尝试一个新的应用时,你打开应用商店并安装该应用。这很简单,很快速,很高效。在这种提供应用的模式中,手机供应商可以让你确切地知道到哪里去获得一个应用,而应用的开发者也知道将他们的应用放在哪里,以便人们能够找到它们。
在手机使用这种创新的软件分发模式之前,Linux 正以“软件仓库”的形式使用它。正如这个术语所暗示的,这些是在互联网上传应用的地方,这样 Linux 用户就可以从一个中心位置浏览和安装它们。这个术语被缩短为 “repo”(代表 “repository”,而不是 “reposession”),但无论你叫它“仓库”、“应用商店”、“软件中心”、“包管理器”,还是其他什么,它都是一个好系统,几十年来一直为 Linux 桌面用户服务。
最起码在 Linux 上安装应用很像在手机上安装应用。如果你能用一个安装,你也可以用另外一个安装。
* 下载我们的电子书:[在 Linux 上安装应用指南](https://opensource.com/downloads/installing-linux-applications-ebook)
### 软件中心
在 GNOME 桌面上,你在桌面上看到的软件仓库是一个应用,简单地说,叫 “<ruby> 软件 <rt> Software </rt></ruby>”。你可以把这个应用看成是一个极其特殊的网页浏览器。它寻找可以从互联网上安装的软件,将所有可用的软件收集到分类中,并将其显示在你的桌面上。

在开始屏幕中,你有几个选项:
* 搜索一个你已经熟悉的应用。要做到这一点,点击窗口左上角的放大镜图标。
* 按类别浏览。这可以在窗口的底部找到。
* 按最近时间和推荐浏览。这些都列在动画横幅和它下面的图标中。
当你点击一个你看起来感兴趣的应用时,会打开一个功能页面,这样你就可以看到截图并阅读软件的简短描述。
### 安装一个应用
当你找到了你想要安装的软件,点击应用功能页面顶部的“<ruby> 安装 <rt> Install </rt></ruby>”按钮。

安装完毕后,“<ruby> 安装 <rt> Install </rt></ruby>”按钮就会变成“<ruby> 启动 <rt> Launch </rt></ruby>”按钮,所以你可以选择启动你刚刚安装的应用。
如果你现在不想启动该应用,你可以随时在你的“<ruby> 活动 <rt> Activities </rt></ruby>”菜单中找到它,它与你电脑上已有的所有其他应用放在一起。
### 从更多的地方获得更多的应用
你的 Linux 桌面有专门为它打包的应用,但在今天的世界里,到处都有很多开源的东西。你可以通过将“第三方”仓库添加到你的桌面应用商店中来获得更多的应用。当然,这些术语并不完全正确:在一个无论如何都是由每个人创造软件的世界里,什么是“第三方”?当没有任何东西需要花钱时,什么是应用商店?撇开术语不谈,一个流行的第三方软件库是 [Flathub.org](http://flathub.org/setup)。
要在你的 Linux 桌面上增加另一个应用源,基本上是“安装”一个源到你的应用商店。对于 Flathub,下载 **Flathub 仓库文件**,然后用 **GNOME 软件**安装它,就像它是一个应用一样。它不是一个应用。它是一个应用 *源*,但过程是一样的。
### 了解更多
如果没有一堆其他方法来执行任何给定的任务,那就不是 Linux 了。灵活性是建立在 Linux 系统中的,所以虽然 GNOME “软件”提供了一种获取应用的简单方法,但还有很多其他方法,包括安装脚本、安装向导、AppImages,当然还有直接从源代码编译。你可以从我们的新电子书 [在 Linux 上安装应用](https://opensource.com/downloads/installing-linux-applications-ebook) 中获得所有这些安装方法的信息。它是免费的,所以请阅读吧。
---
via: <https://opensource.com/article/22/2/installing-applications-desktop-linux>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | When you want to try a new app on your phone, you open your app store and install the app. It's simple, quick, and efficient. In this model of providing applications, phone vendors ensure that you know exactly where to go to get an app, and that developers with apps to distribute know where to put their apps so people can find them.
Before phones used this innovative model of software distribution, Linux was using it in the form of "software repositories." As the term implies, these were places on the Internet where applications were uploaded so Linux users could browse through them, and install them, from a central location. The term got shortened to just "repo" (for "repository," not "reposession"), but whether you call it a *repo*, *app store*, *software center*, *package manager*, or whatever else, it's a good system and has served Linux desktop users well for several decades.
The bottom line is that installing apps on Linux is a lot like installing apps on your phone. If you've done one, you can do the other.
**[ Download our eBook: A guide to installing applications on Linux ]**
## Software
On the GNOME desktop, your view into your desktop's software repository is an application called, simply, **Software**. You can think of this application as an extremely specific web browser. It's looking at software that's available to install from the Internet, gathering everything available into categories, and displaying it to you on your desktop.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
From the start screen, you have a few options.
- Search for an application you're already familiar with. To do this, click the magnifying glass icon in the top left corner of the window.
- Browse by category. These are found at the bottom of the window.
- Browse by recent and recommendations. These are listed in the animated banner and the icons below it.
When you click on an application that looks interesting to you, a feature page opens so you can see screenshots and read a short description of the software.
## Installing an app
Once you've found software you want to install, click the **Install **button at the top of the application feature page.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
Once it's installed, the **Install** button changes to a **Launch** button, so you can optionally launch the app you've just installed.
If you don't want to launch the app just now, you can always find it in your **Activities** menu along with all the other applications you already have on your computer.
## Getting more apps from more places
Your Linux desktop has applications packaged specifically for it, but in today's world there's a lot of open source happening all over the place. You can get more applications by adding "third party" repositories to your desktop's app store. Of course, all of these terms aren't exactly correct: what's a "third party" in a world where software is being created by everyone anyway, and what's an app store when nothing costs any money? Terminology aside, one popular third-party repo is [Flathub.org](http://flathub.org/setup).
To add another source of apps to your Linux desktop, you essentially "install" a location into your app store. For Flathub, you download the **Flathub repository file **and install it with **GNOME Software**, just as if it were an app. It's not an app. It's a *source* of apps, but the process is the same.
## Find out more
It wouldn't be Linux if there weren't a dozen other ways to perform any given task. Flexibility is built into the system with Linux, so while GNOME Software provides one easy way to get apps, there are lots of other ways, including install scripts, install wizards, AppImages, and of course compiling directly from source code. You can get information on all of these install methods from our new eBook, [ Installing Applications on Linux](https://opensource.com/downloads/installing-linux-applications-ebook). It's free, so give it a read.
## Comments are closed. |
14,307 | 10 个提升 GNOME 体验的最佳应用程序(二) | https://www.debugpoint.com/2021/12/best-gnome-apps-part-2/ | 2022-02-26T12:59:00 | [
"GNOME"
] | /article-14307-1.html |
>
> 这是下一组 GNOME 应用程序,非常适合于你的 GNOME 桌面。它的范围包括游戏、实用工具和生产力。
>
>
>

有许多原生的 GNOME 应用程序散落在各地,但用户完全不知道。它们出乎意料地好,并且完美地完成了它的工作。这些应用程序没有办法通过 GNOME 自己的应用程序商店顺利找到,因为,GNOME 应用程序网站并没有将它们全部列出。
也就是说,我们正在继续一个 GNOME 应用程序的发现系列,使这些应用程序变得流行。变得流行是增加知名度和社区贡献的一个好方法。显然,这些应用程序的质量也会得到提高,因为有更多的错误被报告和修复。
在这个《最佳 GNOME 应用程序》系列文章中,我们将重点介绍一些或已知道、或不知道的基于 GTK 的原生应用程序,它们是专门为 GNOME 增加功能设计的。
在这篇文章中,我们介绍了以下完美的 GNOME 应用程序:
* Flatseal - 管理 Flatpak 应用程序的权限
* Junction - 选择应用程序,以便即时打开文件/链接
* Blanket - 提高生产力
* Mousai - 发现音乐(像 Shazam 一样)
* Shortwave - 网络电台
* Health - 健康参数跟踪器
* Dialect - GNOME 的翻译应用
* Video Trimmer - 一个超快的视频分割器
* Console - 一个新的极简的 GNOME 终端
* Crosswords for GNOME - 一个填字游戏
### Flatseal - 管理 Flatpak 应用程序的权限
这个 GNOME 应用程序非常适合 Flatpak 应用程序的重度用户。Flatpak 应用程序在设计上是以沙盒模式运行的。这意味着,它们默认不能访问宿主机系统组件。例如,一个 Flatpak 应用程序可能无法访问你的 Wi-Fi 或主目录。但是,如果一个应用程序为你提供了一个漂亮的 GUI 来管理已安装的 Flatpak 应用程序的所有访问权限呢?
Flatseal 就是这样做的。它列出了你安装的 Flatpak 应用程序,并为你提供了漂亮的用户界面,以授予或删除所有 Flatpak 应用程序的访问权限。如果你正在使用 GNOME 桌面,这个简单易用的应用程序是必备的。
下面是它的外观和安装步骤。

为你的 Linux 发行版 [设置 Flatpak](https://flatpak.org/setup/)。然后点击下面的链接,启动自带的软件管理器进行安装(如“<ruby> 软件 <rt> Software </rt></ruby>”或“<ruby> 发现 <rt> Discover </rt></ruby>”)。
* [通过 Flathub 仓库安装 Flatseal](https://dl.flathub.org/repo/appstream/com.github.tchx84.Flatseal.flatpakref)
更多信息:
* [源代码和开发](https://github.com/tchx84/Flatseal)
* [文档](https://github.com/tchx84/Flatseal/blob/master/DOCUMENTATION.md)
### Junction - 选择应用程序,以便即时打开文件/链接
下一个应用程序是文件的“用……打开”功能的扩展版本。通常情况下,每个文件的扩展名都与一个特定的程序绑定,以便在操作系统中打开它们。你可以在 GNOME 的设置中随时改变它。例如,.txt(文本)文件总是通过 Gedit 打开。
当你使用这个叫做 Junction 的应用程序,并试图打开任何链接或文件时,它会弹出一个单独的菜单,其中有应用程序的图标,以打开该链接或文件。
例如,如果你试图打开一个 PNG 文件,它会给你提供选项,让你用操作系统中安装的所有可用的图形应用程序打开该图像文件。

有兴趣吗?下面是如何安装的。
为你的 Linux 发行版 [设置 Flatpak](https://flatpak.org/setup/)。然后点击下面的链接,启动自带的软件管理器进行安装(如“<ruby> 软件 <rt> Software </rt></ruby>”或“<ruby> 发现 <rt> Discover </rt></ruby>”)。
* [通过 Flathub 安装 Junction](https://dl.flathub.org/repo/appstream/re.sonny.Junction.flatpakref)
更多信息:
* [主页](https://apps.gnome.org/app/re.sonny.Junction/)
* [源代码](https://github.com/sonnyp/Junction)
### Blanket - 提高你的注意力和生产力
这是我最喜欢的 GNOME 桌面的应用程序。想听雨声吗?或者鸟儿的歌唱?波浪声?这些自然界的声音有助于集中精力,提高你的注意力。甚至那些有助于你在嘈杂的环境中工作或入睡。
这个应用程序 - Blanket 预装了这些声音。你只需要安装并点击播放,就可以享受平静和安宁的音乐。
默认情况下,它给你很多选择:
* 下雨
* 暴风雨
* 风声
* 波浪
* 溪流
* 鸟鸣
* 夏夜
* 火车
* 船
* 城市
* 咖啡馆
* 壁炉
* 粉红噪音和白噪声
哦,你也可以添加你自己的自定义音乐(mp3、wav、ogg)并播放。

我相信你一定想安装这个应用程序。现在你可以这样安装。
为你的 Linux 发行版 [设置 Flatpak](https://flatpak.org/setup/)。然后点击下面的按钮,启动自带的软件管理器进行安装(如“<ruby> 软件 <rt> Software </rt></ruby>”或“<ruby> 发现 <rt> Discover </rt></ruby>”)。
* [通过 Flathub 安装 Blanket](https://dl.flathub.org/repo/appstream/com.rafaelmardojai.Blanket.flatpakref)
更多信息:
* [源代码](https://github.com/rafaelmardojai/blanket)
* [主页](https://apps.gnome.org/app/com.rafaelmardojai.Blanket/)
### Mousai - 发现音乐(像 Shazam 一样)
我相信你已经听说过 [Shazam](https://www.shazam.com/home),这是一个用于智能手机和平板的流行的音乐识别应用程序。Mousai 是一个用于 GNOME 桌面的音乐识别应用。它可以聆听并同时识别歌曲的细节。这个应用程序使用你系统的麦克风或桌面的线路输出音频进行输入。
很干净整洁,对吧。下面是它的一些特点:
* 易于使用的用户界面 —— 非常适合 GNOME 桌面
* 在几秒钟内识别出歌曲
* 将识别的歌曲储存在历史信息中,以便于参考
* 从应用程序内浏览网络上的歌曲信息

在你点击安装之前,请记住这个应用程序的功能使用了流行的 [audd.io](http://audd.io) 的 API。
为你的 Linux 发行版 [设置 Flatpak](https://flatpak.org/setup/)。然后点击下面的链接,启动自带的软件管理器进行安装(如“<ruby> 软件 <rt> Software </rt></ruby>”或“<ruby> 发现 <rt> Discover </rt></ruby>”)。
* [通过 Flathub 安装 Mousai](https://dl.flathub.org/repo/appstream/io.github.seadve.Mousai.flatpakref)
更多信息:
* [主页](https://apps.gnome.org/app/io.github.seadve.Mousai/)
* [源代码](https://github.com/SeaDve/Mousai)
### Shortwave - 网络电台
如果你是一个广播听众,也是一个电台粉丝,那么下一个 GNOME 应用程序就是为你准备的。Shortwave 是一个互联网电台,与 GNOME 桌面无缝集成。它能够访问全球 25,000 个广播电台,其独特的功能有:
* 浏览电台
* 搜索电台
* 查看最多投票的电台
* 获取其他用户正在收听的电台
* 创建你的广播电台库
* 能够从 GNOME 直接向网络设备(如谷歌 Chromecast)播放节目

这款广播流媒体应用程序是当今完美的 GNOME 应用程序之一,具有这些令人印象深刻的功能。以下是安装和进入收听状态的方法。
为你的 Linux 发行版 [设置 Flatpak](https://flatpak.org/setup/)。然后点击下面的链接,启动自带的软件管理器进行安装(如“<ruby> 软件 <rt> Software </rt></ruby>”或“<ruby> 发现 <rt> Discover </rt></ruby>”)。
* [通过 Flathub 安装 Shortwave](https://dl.flathub.org/repo/appstream/de.haeckerfelix.Shortwave.flatpakref)
更多信息:
* [主页](https://apps.gnome.org/app/de.haeckerfelix.Shortwave/)
* [源代码](https://gitlab.gnome.org/World/Shortwave)
### Health - 健康参数追踪器
想在 GNOME 桌面上直接掌握你的运动和相关活动的情况吗?那么这个应用程序可能就是你要找的。健康应用程序能够跟踪你的步数、体重、卡路里和活动,如游泳、跑步等。
这个应用程序给你一个漂亮的用户界面,显示你是否达到了总步数的每日目标,等等。

以下是你如何安装这个应用程序。
为你的 Linux 发行版 [设置 Flatpak](https://flatpak.org/setup/)。然后点击下面的链接,启动自带的软件管理器进行安装(如“<ruby> 软件 <rt> Software </rt></ruby>”或“<ruby> 发现 <rt> Discover </rt></ruby>”)。
* [通过 Flathub 安装 Health](https://dl.flathub.org/repo/appstream/dev.Cogitri.Health.flatpakref)
更多信息:
* [主页](https://apps.gnome.org/app/dev.Cogitri.Health/)
* [源代码](https://gitlab.gnome.org/World/Health)
### Dialect - GNOME 的翻译应用
想找一个真正适用于 GNOME 的本地翻译应用吗?那么 Dialect 就是你正在寻找的应用程序。Dialect 是一个完美的 GNOME 原生应用程序,可以轻松地将任意文本从一种语言翻译成另一种语言。这个应用程序使用谷歌翻译的非正式 API,并给你完美的翻译。它还使用 LibreTranslate API,这是一个自由开源的机器翻译 API,可以在线使用。
Dialect 的其他独特功能包括文本到语音、保存你的翻译历史、自动语言检测和用户界面中的剪贴板按钮,这里仅举几例。

以下是你现在可以为你的 GNOME 桌面安装它的方法。
为你的 Linux 发行版 [设置 Flatpak](https://flatpak.org/setup/)。然后点击下面的链接,启动自带的软件管理器进行安装(如“<ruby> 软件 <rt> Software </rt></ruby>”或“<ruby> 发现 <rt> Discover </rt></ruby>”)。
* [通过 Flathub 安装 Dialect](https://dl.flathub.org/repo/appstream/com.github.gi_lom.dialect.flatpakref)
更多信息:
* [主页](https://apps.gnome.org/app/com.github.gi_lom.dialect/)
* [源代码](https://github.com/dialect-app/dialect/)
### Video Trimmer - 更快地剪切你的视频
Video Trimmer 是一个完美的小工具,可以超快地切割你的视频。它只需要设置你的视频的开始和结束时间戳,就可以给你最终的文件。它将文件保存到你的目标目录,你也可以直接从应用程序本身打开文件位置。这个应用程序完美地集成了 GNOME UI,并为你提供了漂亮的修剪时间线和视频预览。

以下是你现在可以为你的 GNOME 桌面安装它的方法。
为你的 Linux 发行版 [设置 Flatpak](https://flatpak.org/setup/)。然后点击下面的链接,启动自带的软件管理器进行安装(如“<ruby> 软件 <rt> Software </rt></ruby>”或“<ruby> 发现 <rt> Discover </rt></ruby>”)。
* [通过 Flathub 安装 Video Trimmer](https://dl.flathub.org/repo/appstream/org.gnome.gitlab.YaLTeR.VideoTrimmer.flatpakref)。
更多信息:
* [源代码](https://gitlab.gnome.org/YaLTeR/video-trimmer)
### Console - 一个为初学者准备的新的最小的 GNOME 终端
这是一个相当新的应用程序,目前正在开发中。这是一个简单的终端程序,旨在为那些技术水平不高的用户提供服务。对于高级用户,GNOME 已经有一个叫做 [GNOME 终端](https://help.gnome.org/users/gnome-terminal/stable/) 的终端模拟器。
你可能会问为什么 GNOME 需要另一个终端,对吗?好吧,Console 是为终端新手设计的,它考虑到了以下使用情况:
* 当一个命令完成时,发出一个漂亮的通知
* 如果用户尝试使用 root 模式(使用 `sudo`、`su` 等),终端会变成红色
* 当使用 `ssh` 时,终端会变成紫色。
这个应用程序仍在 GitLab 上开发。不幸的是,目前还没有安装程序可用。不过,你可以去编译。我试图用 meson 来编译它,但由于依赖关系而失败。
等我我能够编译它,我将在这里放一张截图。
同时,你可以在 [GitLab](https://gitlab.gnome.org/GNOME/console) 中关注这个项目。
### Crosswords for GNOME
我相信你如果喜欢解字谜。那么这款针对 GNOME 的最终应用就非常适合你。GNOME 填字游戏是填字游戏播放器和编辑器。这个游戏带有填字游戏集,你可以开始解题。如果你被卡住了,该应用程序将帮助你揭示你在选词方面的错误。基本的正方形黑白字谜是可用的,但是由于其风格支持,你可以享受各种形状和颜色的字谜板。


这个应用程序的编辑部分目前还在开发中。但是你仍然可以通过安装一个演示的 Flatpak 来玩,所有这些都可以在下面的链接中找到。
为你的 Linux 发行版 [设置 Flatpak](https://flatpak.org/setup/)。然后点击下面的链接,启动自带的软件管理器进行安装(如“<ruby> 软件 <rt> Software </rt></ruby>”或“<ruby> 发现 <rt> Discover </rt></ruby>”)。
* [通过私有仓库安装演示版填字游戏](https://people.gnome.org/~jrb/org.gnome.Crosswords/crosswords.flatpak)
在 [这里](https://gitlab.gnome.org/jrb/crosswords) 关注这个应用程序的开发。
### 总结
这就是本期的 GNOME 应用程序系列中最完美、最优秀的应用程序了。我希望你能为你的 GNOME 桌面发现一些很酷的 GTK 应用程序。确保开始为你的工作/目的使用它们。你对这篇文章中完美的 GNOME 应用程序有什么看法?请在下面的评论栏里告诉我。
---
via: <https://www.debugpoint.com/2021/12/best-gnome-apps-part-2/>
作者:[Arindam](https://www.debugpoint.com/author/admin1/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) | null |
14,308 | 为什么我又回到火狐浏览器 | https://news.itsfoss.com/why-mozilla-firefox/ | 2022-02-26T19:35:25 | [
"Firefox"
] | https://linux.cn/article-14308-1.html |
>
> 火狐可以说是最好的开源网页浏览器。但是,是什么让它这么好?它对每个人来说都是一个可行的选择吗?让我来分享我的见解。
>
>
>

火狐是一个神奇的开源网页浏览器。它预装在大多数 Linux 发行版中,无需多想,可以认为它是 Linux 用户和隐私爱好者的一个流行选择。
然而,没有什么是完美的。
无论是火狐、Chrome、Brave,还是任何一个 [可用于 Linux 的最佳浏览器](https://itsfoss.com/best-browsers-ubuntu-linux/),每个选择都有权衡。
我使用火狐浏览器已经很多年了,但最近我因为标签管理功能转而使用了 [Vivaldi](https://itsfoss.com/install-vivaldi-ubuntu-linux/),然后也尝试了一下 Brave。
但是,在这段时间里,我发现自己一再回到火狐浏览器,并一直想回来,虽然我对另一个网页浏览器也很满意(就当是一种回忆吧)。
那么,为什么我总是回到火狐浏览器?为什么我认为火狐是适合每个人的理想网页浏览器?
在这里,让我强调一些要点:
### 1、以隐私为重点的解决方案

如今,每个网页浏览器(当然,除了谷歌浏览器)都旨在提供面向隐私的功能。
使用 Brave,甚至使用 Vivaldi,你有各种各样的选择。
请注意,这不是一个功能比较,而是基于我喜欢、注意到的东西。
Brave 可以让你自定义跟踪保护,但它不提供预设配置。你得自己调整拦截保护措施以获得你想要的体验。但是,火狐浏览器可以让你轻松地选择“标准”或“严格”保护模式,而不需要定制个人设置。
说到 Vivaldi,它提供了快速切换跟踪保护类型的能力,但它没有火狐那么好。此外,你没有诸如跨站 Cookie 阻止、以及针对加密矿工、指纹探针的保护。
除了这些细微的差别,火狐还不断为其隐私保护产品增加新的功能。
例如,HTTPS-Only 模式让你无需任何扩展/插件,就可以确保你连接到一个页面的 HTTPS 版本。
### 2、简化的用户界面

我知道我抱怨过很多次火狐不断改造其用户界面。
没错,这不是很令人愉快。
但是,每当我习惯了它,我发现它是一个简单而有效的用户界面。我更喜欢启用它的深色主题。
最近的更新使它更容易访问选项、附加组件、主题等。
就个人而言,感觉它比其他浏览器更好。
希望他们不要继续他们的传统,每次重大升级都破坏用户体验。
### 3、开源
火狐是一个开源的网页浏览器。你已经知道了,但这正是它比 Chrome 等专有选项更出色的原因。
火狐浏览器是我几年前离开谷歌浏览器后尝试的第一个开源网页浏览器。
### 4、火狐多账户容器

[火狐多账户容器](https://itsfoss.com/firefox-containers/) 是火狐的主要亮点之一。
如果你想在不损害隐私的情况下充分提升你的浏览体验,它是 [最佳火狐功能](https://itsfoss.com/firefox-useful-features/) 之一。
你需要安装 [火狐多账户插件](https://addons.mozilla.org/en-US/firefox/addon/multi-account-containers/) 才能开始使用它。
该功能可以让你打开相互隔离的几个浏览标签。例如,你可以使用该功能保持登录到同一服务的两个不同账户。你可以将它们分成个人、工作、银行等等几个分类。
你可以选择创建一个新的容器或将你当前的标签作为一个容器打开。也可以自动设置网站在新的容器中打开。
为了更上一层楼,火狐最近增加了为容器启用 Mozilla VPN 的功能。这样,你就可以单独保障你的浏览过程,而不需要为其余的非容器标签启用 VPN。
虽然这可能不适合每个人,但这是一个有用的功能。
### 5、集成的服务

拥有有助于提高用户体验的内置功能和服务总是很方便。
使用火狐浏览器,你可以快速访问各种有用的工具。
这些工具包括:
* 地址栏中的“保存到 Pocket”按钮,可以快速添加一个网页/链接,以便以后阅读。
* Mozilla 的 [VPN 服务](https://www.mozilla.org/en-US/products/vpn/)。
* [Firefox Relay](https://relay.firefox.com) 以保护你的原始电子邮件地址。
* [Firefox Monitor](https://monitor.firefox.com/) 以通知你数据泄露的情况。
* 如果你使用的话,还有密码管理器。
### 6、积极开发
随着每一次火狐浏览器的发布,你会发现一些有价值的升级和改进。
当然,你对每个主要的网页浏览器都可以抱有同样的期望。但是,如果你使用的是一个不太知名的浏览器的功能,你可能想留意一下更新/开发的频率。
为了获得安全的体验,尽快进行安全修复、错误修复和其他改进是很重要的。
### 7、运作良好!

就我而言,我更喜欢方便,而不是最新和最大的。
尽管火狐浏览器设法提供一些行业首创的功能,它仍然是一个方便的选择。
拥有一个同步你所有浏览数据和集成的服务的火狐账户是很有好处的。你可以轻松地在任何其他设备上登录该账户,无缝地继续你的工作。
使用 Brave,你确实也有同步功能,但它的工作方式不一样。它要求你必须有主设备在场,才能成功地将数据同步到另一个设备上(你要扫描二维码)。另外,你也可以选择生成同步代码,并将其随身携带,以便与新设备同步。但是,我觉得基于账户的同步更方便。
虽然 Vivaldi 提供了账户同步功能,但它在我的多显示器环境中并不工作,按钮变得没有反应,而且在 [Vivaldi 5.1 版](https://news.itsfoss.com/vivaldi-5-1-release/) 之后,我也没能成功同步。
所以,火狐成为一个轻松便捷的选择。
### 8、打破浏览器垄断
去年,我们报道了 [火狐浏览器失去了近 5000 万用户](https://news.itsfoss.com/firefox-decline/),这让那些一直喜欢不基于 Chromium 的可靠产品的用户非常担心。
从技术上讲,我们确实有火狐的复刻和其他一些 [开源浏览器](https://itsfoss.com/open-source-browsers-linux/)。但是,我们需要火狐保持其地位,以便有一个可行的 Chromium 替代品。
### 总结
我应该提到,我坚持使用火狐是因为它适合我的使用情况和工作流程。
你不需要相信我的话。但是,至少,如果你从来没有考虑过这些使用火狐的好处,你可能该试一试!
你对火狐有什么看法?可以告诉我们你最喜欢的浏览器吗?让我们在下面的评论中讨论。
---
via: <https://news.itsfoss.com/why-mozilla-firefox/>
作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Firefox is a fantastic open-source web browser. Considering it comes pre-installed with most Linux distributions, it does not take rocket science to assume that it is a popular choice among Linux users and privacy enthusiasts.
However, nothing is ever perfect.
Whether it is Mozilla Firefox, Google Chrome, Brave, or any of the [best browsers available for Linux](https://itsfoss.com/best-browsers-ubuntu-linux/?ref=news.itsfoss.com). Every option has a trade-off.
I have been using Firefox for years now, but I recently switched to [Vivaldi](https://itsfoss.com/install-vivaldi-ubuntu-linux/?ref=news.itsfoss.com) for its tab management feature and then tried Brave for a moment as well.
But, all this time, I found myself constantly going back to Firefox and thinking about it all the time, while I was happy with another web browser (consider it to be a meme).
So, why do I keep coming back to Firefox? Why do I think Mozilla Firefox is an ideal web browser for everyone?
Here, let me highlight some pointers:
## 1. Privacy-Focused Solution

Nowadays, every web browser (of course, except Google Chrome) aims to provide privacy-oriented features.
You will get a variety of options with Brave, and even with Vivaldi.
Note that this isn’t a feature comparison, but based on what I prefer/noticed.
Brave lets you customize the tracking protection, but it does not offer a preset. You will find yourself tweaking the blocking protections to get the experience you want. But, Firefox lets you easily choose a “Standard” or “Strict” protection mode without needing to customize individual settings.
When it comes to Vivaldi, it offers the ability to switch the type of tracking protection quickly, but it is not as good as Firefox. Furthermore, you do not get things like cross-site cookie blocking, and protection against cryptominers/fingerprinters.
In addition to these subtle differences, Firefox keeps adding new options to its privacy protection offering.
For instance, the HTTPS-Only mode eliminates the need for any extensions/add-ons that ensure that you connect to the HTTPS version of a page.
## 2. Simplified User Interface

I know that I have complained a lot about Firefox constantly revamping its user interface.
And, yes, that isn’t very pleasant.
But, every time I get used to it, I find it a simple and effective user interface. I prefer to enable the dark theme.
The recent updates have made it easier to access options, add-ons, themes, and more.
Personally, it feels better than other browsers.
Here’s to hoping that they do not continue their tradition of breaking the user experience with every major upgrade.
## 3. Open Source
Mozilla Firefox is an open-source web browser. You already know it, but that is what makes it an outstanding choice over proprietary options like Chrome.
Firefox is the first open-source web browser I tried after moving away from Google Chrome several years ago.
## 4. Firefox Multi-Account Containers

[Firefox Multi-Account Containers](https://itsfoss.com/firefox-containers/?ref=news.itsfoss.com) is one of the key highlights of Mozilla Firefox.
It is one of the [best Firefox features](https://itsfoss.com/firefox-useful-features/?ref=news.itsfoss.com) if you want to make the most out of your browsing experience without compromising privacy.
You need to install the [Firefox Multi-Account add-on](https://addons.mozilla.org/en-US/firefox/addon/multi-account-containers/?ref=news.itsfoss.com) to get started with it.
The feature lets you open different browsing tabs isolated from each other. For instance, you can stay logged to two different accounts of the same service using this feature. You have available categories that include Personal, Work, Bank, and more.
You can choose to create a new container or open your current tab as a container. It is also possible to automatically set a website to open in a new container.
To take things up a notch, Firefox recently added the ability to enable Mozilla VPN for containers. This way, you can separately secure your browsing experience without enabling the VPN for the rest of the non-container tabs.
While this may not be for everyone, it is a helpful feature.
## 5. Integrated Services

It is always convenient to have built-in features and services that help enhance the user experience.
With Firefox, you get various useful tools that you can access quickly.
The tools include:
- Save to Pocket button in the address bar to quickly add a webpage/link to read later.
- Mozilla’s
[VPN service](https://www.mozilla.org/en-US/products/vpn/?ref=news.itsfoss.com). [Firefox Relay](https://relay.firefox.com/?ref=news.itsfoss.com)to protect your original email address.[Firefox Monitor](https://monitor.firefox.com/?ref=news.itsfoss.com)to notify you of data breaches.- And, the password manager, if you use it.
## 6. Active Development
With every Firefox release, you find some valuable upgrades and improvements.
Of course, you should expect the same with every major web browser. But, if you are using a less-known browser for its features, you might want to keep an eye on the frequency of updates/development.
It is important to have security fixes, bug fixes, and other improvements as soon as possible for a secure experience.
## 7. Just Works!

In my case, I prefer convenience over the latest and greatest.
Even though Firefox manages to offer some industry-first features, it remains a convenient option.
Having a Firefox account synced to all your browsing data and integrated services is beneficial. You can easily log in to the account on any other device to seamlessly continue your work.
With Brave, you do have the sync feature, but it does not work the same way. It requires you to have the primary device present to successfully sync the data to another device (considering you’re scanning the QR code).
Alternatively, you can choose to generate the sync code and keep it with you to sync with a new device But, I find the account-based sync more convenient.
While Vivaldi offers the account-sync feature, it does not work well with my multi-monitor setup. The buttons become unresponsive, and I also fail to successfully sync after [Vivaldi 5.1 release](https://news.itsfoss.com/vivaldi-5-1-release/).
So, Firefox becomes a hassle-free and convenient option.
## 8. Fight Against Browser Monopoly
Last year, we reported that [Firefox lost almost 50 million users](https://news.itsfoss.com/firefox-decline/), making it a big concern for users who still prefer a solid offering not based on Chromium.
Technically, we do have Firefox forks and a few other [open-source browsers](https://itsfoss.com/open-source-browsers-linux/?ref=news.itsfoss.com). But, we need Firefox to hold its position to have a viable Chromium alternative.
## Wrapping Up
I should mention that I stick to Firefox because it fits my use-case and workflow.
You don’t have to take my word for it. But, at least, if you never considered these as benefits of using Firefox, you might want to give it a try!
*What do you think about Mozilla Firefox? Mind telling us about your favorite browser? Let’s talk in the comments below.*
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,310 | 用 KWrite 和 Kate 在 Linux 上编辑文本 | https://opensource.com/article/22/2/edit-text-linux-kde | 2022-02-27T14:46:15 | [
"KDE",
"文本编辑器"
] | https://linux.cn/article-14310-1.html |
>
> 两个 Linux KDE 文本编辑器。一个强大的 KTextEditor 库。
>
>
>

文本编辑器通常是一个很好的示例应用,可以展示一个编程框架能够产生什么。我自己在关于 [wxPython、PyQt](https://opensource.com/article/17/4/pyqt-versus-wxpython) 和 [Java](https://opensource.com/article/20/12/write-your-own-text-editor) 的文章中至少写过三个文本编辑器的例子。它们被视为容易创建的应用的原因是,这些框架提供了许多最难编写的代码。我认为这也是大多数操作系统提供简单的桌面文本编辑器的原因。它们对用户有用,对开发者也很容易开发。
在 KDE Plasma 桌面上,有两个文本编辑器可供选择:简陋的 KWrite 和强大的 Kate。它们之间共享一个来自 KDE 框架的名为 KTextEditor 的库,它提供了强大的文本编辑选项,所以无论你选择哪一个,你都拥有比你可能习惯的、由桌面提供的“基本”文本编辑器更多的功能。在不同的文本编辑器中使用相同的组件,意味着一旦你习惯了 KDE 中的文本编辑界面,你基本上就能熟悉它们了,如 KWrite、Kate、KDevelop 等。
### 安装 KWrite 或 Kate
KWrite 和 Kate 在同一个 [开发库](https://invent.kde.org/utilities/kate) 中维护。
然而,它们是作为独立的应用发布的,并且有不同的使用场景。
如果你安装了 KDE Plasma 桌面,你可能已经安装了 KWrite,但你可能需要单独安装 Kate。
```
$ sudo dnf install kwrite kate
```
KWrite 可以从 [apps.kde.org/kwrite](http://apps.kde.org/kwrite) 获得,而 Kate 可以从 [apps.kde.org/kate/](https://apps.kde.org/kate) 获得。
两者都可以通过 KDE “<ruby> 发现 <rt> Discover </rt></ruby>” 安装,KWrite 可以 [作为 flatpak 安装](https://opensource.com/article/21/11/install-flatpak-linux)。
### KWrite,不那么基本的编辑器
开始使用 KWrite 很容易。你从你的应用菜单中启动它,然后开始打字。如果你在最基本的文本编辑器之外没有别的需求,那么你可以把它当作一个简单的电子记事本。

所有通常的惯例都适用。在大文本区域输入文字,完成后点击保存按钮。
然而,KWrite 与标准的桌面编辑器不同的是,它使用 KTextEditor 库。
### 书签
当你在 KWrite 或 Kate 中工作时,你可以创建临时书签来帮助你找到文档中的重要位置。要创建一个书签,按 `Ctrl+B`。你可以通过在“<ruby> 书签 <rt> Bookmark </rt></ruby>”菜单中选择它来移动到书签。
书签不是永久性的元数据,它们也不会作为文档的一部分被存储,但当你在工作中需要在各部分之间来回移动时,它们是有用的工具。在其他文本编辑器中,我可以只是输入一些随机的词,比如 “foobar”,然后对这个字符串进行“<ruby> 查找 <rt> Find </rt></ruby>”,以返回到那个位置。书签是解决这个问题的一个更优雅的方案,而且它们不会有让你的文档充满占位符的风险,因为你可能忘记删除它们。
### 高亮显示
在 KWrite 和 Kate 中,你都可以激活语法高亮,这样你就可以深入了解你正在处理的文本。在其他文字处理程序中,你可能不会有意识地使用高亮显示,但如果你曾经使用过带有自动拼写和语法检查的编辑器,你就会看到一种高亮显示。在大多数现代文字处理程序中,拼写错误被标记的红色警告线就是一种语法高亮的形式。KWrite 和 Kate 可以同时通知你写作中的错误和成功。
要查看拼写错误,请进入“<ruby> 工具 <rt> Tools </rt></ruby>”菜单,选择“<ruby> 拼写 <rt> Spelling </rt> <rt> </rt></ruby>”。从子菜单中,激活“<ruby> 自动拼写检查 <rt> Automatic Spell Checking </rt></ruby>”。
要获得你以特定格式写的东西的视觉反馈,例如 [Markdown](https://opensource.com/article/19/9/introduction-markdown)、HTML 或像 [Python](https://opensource.com/article/17/10/python-101) 这样的编程语言,去“<ruby> 工具 <rt> Tools </rt></ruby>”菜单,选择“<ruby> 模式 <rt> Mode </rt></ruby>”。有很多模式,分为几个类别。找到你要写的格式并选择它。文档模式加载在高亮模式中。你可以通过选择“<ruby> 高亮 <rt> Highlighting </rt></ruby>”而不是“<ruby> 模式 <rt> Mode </rt></ruby>”来覆盖一个模式的高亮方案。

我最喜欢的功能之一是窗口右侧的文档概览。它基本上是整个文档的一个非常细微的缩略图,所以你只需点击一下就可以滚动到特定区域。它可能看起来太小而无用,但它比人们想象的更容易确定一个章节的标题或文档中的一个近似区域,并通过点击就能接近它。
### Kate 的与众不同之处
由于 KWrite 和 Kate 使用相同的底层组件,你可能想知道为什么你需要从 KWrite 升级到 Kate。如果你决定试用 Kate,你不会因为文本编辑而这样做。所有影响你如何输入和与你的文本互动的功能在这两个应用程序之间都是一样的。然而,Kate 为编码者增加了很多功能。

Kate 有一个侧边栏,你可以查看你的文件系统或项目目录。值得注意的是,Kate 有项目的概念,所以它可以将一个代码文件与同一目录下的头文件联系起来,比如说。它还有一个弹出式终端(只需按下 `F4`),并能将你的文档中的文本通过管道传送到终端会话中。
它还有一个会话管理器,这样你就可以为不同的活动配置一个独特的 Kate。
### 选择你的 Linux 文本编辑器
我们很容易忽视 KWrite 和 Kate。因为它们都是与桌面一起出现的,所以很容易把它们视作开发者强制包含的简单文本编辑器的例子。但这远远不准确。KWrite 和 Kate 是 KDE 系列应用中的典范。它们例证了 KDE 框架所提供的内容,并为期待强大、有意义和有用的 KDE 应用奠定了基础。
了解一下 KWrite 和 Kate,看看哪一个适合你。
---
via: <https://opensource.com/article/22/2/edit-text-linux-kde>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | A text editor is often a good example application to demonstrate what a programming framework is capable of producing. I myself have written at least three example text editors in articles about [wxPython and PyQt](https://opensource.com/article/17/4/pyqt-versus-wxpython), and [Java](https://opensource.com/article/20/12/write-your-own-text-editor). The reason they're seen as easy apps to create is because the frameworks provide so much of the code that's hardest to write. I think that's also the reason that most operating systems provide a simple desktop text editor. They're useful to the user and easy for the developer.
On the KDE Plasma Desktop, there are two text editors to choose from: the humble KWrite and the powerful Kate. They share between them a library called KTextEditor from the KDE Framework, which provides robust text editing options, so no matter which one you choose you have more features than you're probably used to from a "basic" text editor that just happens to be included with your desktop. Using the same component for text editing across text editors means that once you grow accustomed to one text editing interface in KDE, you're essentially familiar with them all: KWrite, Kate, KDevelop, and more.
## Install KWrite or Kate
KWrite and Kate are maintained in the same [development repository](https://invent.kde.org/utilities/kate).
However, they’re distributed as separate applications and have different use cases.
If you have KDE Plasma Desktop installed, you probably already have KWrite installed, but you may need to install Kate separately.
`$ sudo dnf install kwrite kate`
KWrite is available from [apps.kde.org/kwrite](http://apps.kde.org/kwrite), and Kate from [apps.kde.org/kate/](https://apps.kde.org/kate).
Both can be installed through KDE Discover, and KWrite can be [installed as a flatpak](https://opensource.com/article/21/11/install-flatpak-linux).
## KWrite, the not-so-basic editor
Getting started with KWrite is easy. You launch it from your applications menu and you start typing. If you have no expectations that it's anything more than the most basic of text editors, then you can treat it as a simple digital notepad.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/), Text courtesy [Project Gutenberg](https://www.gutenberg.org/cache/epub/41445/pg41445.txt))
All the usual conventions apply. Type text into the big text field, click the Save button when you're done.
However, what sets KWrite apart from a standard desktop editor is that it uses KTextEditor.
## Bookmarks
While you're working in KWrite or Kate, you can create temporary bookmarks to help you find important places in your document. To create a bookmark, press **Ctrl+B**. You can move to a bookmark by selecting it in the **Bookmark** menu.
Bookmarks aren't permanent metadata, and they don't get stored as part of your document, but they're useful devices when you're working and need to move back and forth between sections. In other text editors, I used to just type some random word, like *foobar, *and then perform a **Find** on that string to get back to that location. Bookmarks are a more elegant solution for the problem, and they don't risk littering your document with placeholders that you could forget to delete.
## Highlighting
In both KWrite and Kate, you can activate syntax highlighting so you can gain insight about the text you're working on. You might not consciously use highlighting in other word processors, but you've seen a form of highlighting if you've ever used an editor with automated spelling and grammar checking. The red warning line that a misspelling gets marked with in most modern word processors is a form of syntax highlighting. KWrite and Kate can notify you of both errors and successes in your writing.
To see spelling errors, go to the **Tools** menu and select **Spelling**. From the **Spelling **submenu, activate **Automatic Spell Checking**.
To get visual feedback about what you're writing in a specific format, such as [Markdown](https://opensource.com/article/19/9/introduction-markdown), HTML, or a programming language like [Python](https://opensource.com/article/17/10/python-101), go to the **Tools** menu and select **Mode**. There are lots of modes, divided between several categories. Find the format you're writing in and select it. A mode loads in a highlighting schema. You can override a mode's highlighting scheme by choosing **Highlighting** instead of **Mode**.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
One of my favorite features is the document overview on the right side of the window. It's essentially a very very tall thumbnail of the whole document, so you can scroll to specific regions with just one click. It might look like it's too small to be useful, but it's easier than one might think to pinpoint a section heading or an approximate area within a document and get pretty close to it with a click.
## What sets Kate apart
With KWrite and Kate using the same underlying component, you might wonder why you'd ever need to graduate on from KWrite at all. If you do decide to try out Kate, you won't do it for the text editing. All the features that affect how you enter and interact with your text are the same between the two applications. However, Kate adds lots of features for coders.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
Kate features a side panel where you can view your filesystem or just a project directory. Notably, Kate has the concept of projects, so it can correlate one file of code to, for instance, a header file in the same directory. It also has a pop-up Terminal (just press **F4**) and the ability to pipe text in your document out to the terminal session.
There's also a session manager so you can have a unique Kate configuration for different activities.
## Choose your Linux text editor
It's easy to overlook KWrite and Kate. They suffer, in a way, from the *default syndrome. *Because one or both of them comes along with the desktop, it's easy to think of them as the simple example text editors that developers are obligated to include. That's far from accurate, though. KWrite and Kate are paragons among K-apps. They exemplify what the KDE Framework provides, and they set the stage for an expectation of powerful, meaningful, and useful KDE applications.
Take a look at KWrite and Kate, and see which one is right for you.
## Comments are closed. |
14,311 | 为什么我喜欢将 KDE 作为我的 Linux 桌面 | https://opensource.com/article/22/2/why-i-love-linux-kde | 2022-02-27T16:12:25 | [
"KDE"
] | https://linux.cn/article-14311-1.html |
>
> KDE Plasma 桌面的目标是整合、一致和定制的完美结合。
>
>
>

开源引以为豪的事情之一是选择。你不必满足于你不喜欢的东西。你可以改变你的文件管理器、你的 [文本编辑器](https://opensource.com/article/21/2/open-source-text-editors),你甚至有超过 [24 个桌面](https://opensource.com/article/20/5/linux-desktops) 可以选择。和许多 Linux 用户一样,我一开始经常切换自己使用的桌面。最初我不知道自己喜欢什么,因为我还没有尝试过所有可用的东西。在 2008 年 1 月的一个好日子,KDE 4.0 发布了,从我看到 Plasma 桌面的那一刻起,我就知道这是我一直在等待的 Linux 桌面(那时我成为 Linux 用户才一年,我想我没必要等太久)。尽管我的笔记本上有 GNOME,我的树莓派上有 [Fluxbox](https://opensource.com/article/19/12/fluxbox-linux-desktop),可能还有其他一些组合,但我认为自己是 Plasma 桌面的用户,也是 KDE 社区的一员。
### 我爱 KDE 的三个理由
爱上 KDE 的理由有很多,但这里有我的三个理由:
#### 一致性

一致性是教给用户一个新工具的重要部分。最理想的情况是,一个人在一个应用程序中学习了一些东西,然后在不知不觉中把同样的知识转移到另一个应用程序中。KDE 项目的目标是在其所有的应用程序中实现一致性,这也是 KDE 框架存在的原因之一。越多 KDE 开发者使用框架,用户需要学习的东西就越少,因为使用过一个应用程序的用户已经熟悉了该框架所提供的关键组件。
大量的代码在应用程序之间被重复使用。Konsole 可以作为 Dolphin 和 Kate 的一个面板启动。工具栏配置选项在所有应用程序中基本相同。有一些重要的惯例,比如用单次点击来打开一个文件或文件夹,而不是双击(你会节省几个微秒,相信我),以及可靠的右键菜单选项。
KDE 的伟大之处在于,当你想做一件你以前从未做过的事情时,你通常可以猜到你应该如何实现它。你被 KDE 的内部一致性所训练,知道应该怎么做。这并不总是有效的,毕竟你可能找错了地方,或者你可能试图让两种技术一起工作,而这两种技术没有过互相影响,但一般来说,你知道在哪里寻找一个选项,或者你知道在哪里拖动一个文件,或者何时右击一个对象,或者长按一个按钮。你通过实践来学习 KDE,那是一种很好的感觉。
#### 整合

KDE 项目被很多人称为桌面,但还有一群用户认为 KDE 更像是一套应用程序。他们都是正确的!
你可以运行 Plasma 桌面,也可以运行一个不同的桌面或窗口管理器,而只使用 KDE 应用程序。有很多东西可以选择,它们一起构成了一个完整的操作系统,影响了操作系统的风格倾向。当然,还有一些工作仍在进行中,但在我每天使用的应用程序中,有用于联系人、电子邮件和日历的 Kontact 套件,用于视频编辑的 Kdenlive,用于插图和摄影的 Krita,用于文件管理的 Dolphin,用于 RSS 订阅的 Akregator,用于存档的 Ark,用于终端的 Konsole,用于播放音乐的 Juk,用于从我的手机传输文件的 KDE Connect,这个名单还在继续增长。我并不是只安装 K 应用,因为在 KDE 开发之外也有很多伟大的应用程序,但是有这样一套完整的工具使用同一套框架和库是很好的。它提供了凝聚力,这使得整合成为可能。
#### 定制

Plasma 桌面认识到,不同的用户对他们的工作空间有不同的要求和偏好。KDE 中几乎所有的东西都可以定制。你可以改变你的主题,你可以改变窗口装饰的布局,你可以改变打开一个文件所需的点击次数,什么是可点击的,什么是可拖动的,你可以在窗口内移动面板,然后当你不希望这些设置适用于某个应用程序时,你可以为它们设置特定的窗口覆盖项。
如果这听起来让人不知所措,也没错。但你不应该记住或甚至知道所有可能的定制。默认值是令人愉快的直观,而且大部分的行为是你期望的桌面行为。有一些小的 KDE 惯例你可能要习惯,但是当你发现你不喜欢的东西时,你知道因为它是 KDE,它可以被改变。你离开找到正确的旋钮或转盘来改变这个设置只距离一个参考文档。
### 让 Linux KDE 成为你自己的
我配置 Plasma 桌面的方式与我在会议和工作中看到的其他桌面不同,它是我在生活中尝试过的所有桌面中最喜欢的古怪东西的综合体。而这正是 KDE 的特别之处。它能适应我的每一个奇思妙想,甚至是非理性的奇思妙想。下次你必须在桌面之间做出选择时,看看 KDE 吧。如果你不喜欢你所看到的,给它点时间。你要么学会爱上它(单击操作就很好,我发誓),要么你最终会改变它。无论哪种方式,你都赢了。
---
via: <https://opensource.com/article/22/2/why-i-love-linux-kde>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | One of the things that open source prides itself on is choice. You don't have to settle for anything you don't love. You can change your file manager, your [text editor](https://opensource.com/article/21/2/open-source-text-editors), and you even have over [24 desktops](https://opensource.com/article/20/5/linux-desktops) to choose from. As with many Linux users, I was pretty flexible about the desktop I used at first. I didn't know what I liked at first, because I hadn't tried everything available to me. On one auspicious day in January 2008, KDE 4.0 was released, and from the moment I laid eyes upon the Plasma Desktop, I knew that it was the Linux desktop I'd been waiting for (and having only been a Linux user for a year by that time, I guess I didn't have to wait long). Even though I have and enjoy GNOME on my laptop, [Fluxbox](https://opensource.com/article/19/12/fluxbox-linux-desktop) on my Pi, and probably a few other combinations, I consider myself a Plasma Desktop user, and a member of the KDE community.
## 3 reasons I love KDE
There are many reasons to love KDE, but here are three of mine.
## Consistency

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
Consistency is an important part of teaching users a new tool. The ideal scenario is when a person learns something in one application and then transfers that same knowledge to another application without even realizing it. The KDE project aims for consistency across all of its applications, and that's one of the reasons the KDE Frameworks exist. The more KDE developers use the framework, the less a user has to learn because a user who's used one application already knows the key components provided by the framework.
Significant amounts of code are reused between applications. Konsole can be launched as a panel in Dolphin and Kate. Toolbar configuration options are essentially the same across all apps. There are important conventions, like using a single click to open a file or folder instead of a double click (the microseconds you save adds up, trust me), and reliable right-click menu options.
The great thing about KDE is that when you want to do a thing that you've never done before, you can usually guess how you're supposed to achieve it. You're trained by KDE's internal consistency what to expect. It doesn't always work, because after all you might be looking in the wrong place or you might be trying to make two technologies work together that just don't have any reason to communicate, but generally you know where to look for an option, or you know where to drag a file, or when to right-click on an object, or long-click on a button. You learn KDE by doing, and that's a great feeling.
## Integration

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
The KDE project is known by many as a desktop, but there's another group of users who think of KDE more as a suite of applications. Both are correct!
You can run the Plasma Desktop, or you can run a different desktop or window manager, and just use KDE applications. There are plenty to choose from, and together they form a pretty good picture of what a complete operating system tends to look like. Of course, there are works still in progress, but among the applications I use daily is the Kontact suite for contacts, email, and calendaring, Kdenlive for video editing, Krita for illustration and photography, Dolphin for file management, Akregator for RSS feeds, Ark for archiving, Konsole for my terminal, Juk for playing music, KDE Connect to transfer files to and from my mobile, and the list goes on and on. I don't only install K apps, because there are lots of great apps outside of KDE development, too, but it's nice to have such a complete set of tools using the same set of frameworks and libraries. It provides cohesion, which enables integration.
## Customization

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
The Plasma Desktop recognizes that different users have different requirements and preferences for their workspaces. Nearly everything in KDE can be customized. You can change your theme, you can change the layout of window decorations, you can change how many clicks it takes to open a file, what's clickable and what's draggable, you can move panels within windows, you then you can set window-specific overrides for those settings when you don't want them to apply to a certain application.
If this sounds overwhelming, that's because it is. But you're not supposed to remember or even know about all of the possible customizations. The defaults are pleasantly intuitive, and mostly behave the way you expect a desktop to behave. There are minor KDE conventions you might have to get used to, but when you find something you don't like, you know that because it's KDE, it can be changed. Finding where the right knob or dial is to change that setting is just a matter of referencing documentation.
## Make Linux KDE your own
The way I configure my Plasma Desktop is different from the other desktops I've seen at conferences and at work, and it's an amalgamation of all the quirky things I happen to like best from all the desktops I've tried in my life. And that's what makes KDE special. It adapts to my every whim, even the irrational ones. The next time you have to choose between desktops, take a look at KDE. If you don't like what you see, give it time. You'll either learn to love it (the single click thing is great, I swear) or you'll end up changing it. Either way, you [K]win.
## 5 Comments |
14,313 | Bash Shell 脚本新手指南(三) | https://fedoramagazine.org/bash-shell-scripting-for-beginners-part-3 | 2022-02-28T10:33:31 | [
"脚本",
"Bash"
] | https://linux.cn/article-14313-1.html | 
欢迎来到面向初学者的 Bash Shell 脚本知识第三部分。这最后一篇文章将再来学习一些知识点,这些将使你为持续的个人发展做好准备。它将涉及到函数、用 `if`/`elif` 语句进行比较,并以研究 `while` 循环作为结尾。
### 函数
让我们从一个看似困难但其实很简单的基本概念开始,即函数。把它看作是一种简单的方法,可以把脚本中被反复使用的部分放到一个可重复使用的组中。你在本系列第一篇或第二篇文章中所做的任何事情都可以放在一个函数中。因此,让我们把一个函数放到我们的 `learnToScript.sh` 文件中。让我指出几个关键点。你将需要为你的函数起一个名字、一对小括号,以及用大括号包围放在你的函数中的命令。
```
#!/bin/bash
#A function to return an echo statement.
helloFunc() {
echo "Hello from a function."
}
#invoke the first function helloFunc()
helloFunc
```
你会看到如下输出结果:
```
[zexcon@fedora ~]$ ./learnToScript.sh
Hello from a function.
[zexcon@fedora ~]$
```
函数是重复使用一组命令的好方法,但如果你能使它们在每次使用时对不同的数据进行操作,它们会更加有用。这就要求你在每次调用函数时提供数据,这称为参数。
要提供参数,你只需在调用函数时把它们加在函数名称后面。为了使用你提供的数据,你在函数命令中使用位置来引用它们。它们将被命名为 `$1`、`$2`、`$3`,以此类推,这取决于你的函数将需要多少个参数。
让我们修改上一个例子来帮助更好地理解这个问题。
```
#!/bin/bash
#A function to return an echo statement.
helloFunc() {
echo "Hello from a function."
echo $1
echo $2
echo "You gave me $# arguments"
}
#invoke the function helloFunc()
helloFunc "How is the weather?" Fine
```
输出如下:
```
Hello from a function.
How is the weather?
Fine
You gave me 2 arguments
```
输出中发生的事情是 `helloFunc()` 在每一行都做了一个回显。首先它回显了一个 `Hello from a function`,然后它继续回显变量 `$1` 的值,结果是你传递给 `helloFunc` 的 `"How is the weather?"`。然后它将继续处理变量 `$2`,并回显其值,这是你传递的第二个项目:`Fine`。该函数将以回显 `You gave me $# arguments` 结束。注意,第一个参数是一个用双引号括起来的单个字符串 `"How is the weather?"`。第二个参数 `Fine` 没有空格,所以不需要引号。
除了使用 `$1`、`$2` 等之外,你还可以通过使用变量 `$#` 来确定传递给函数的参数数量。这意味着你可以创建一个接受可变参数数量的函数。
关于 bash 函数的更多细节,网上有很多好的参考资料。[这里有一个可以让你入门的资料](https://opensource.com/article/20/6/bash-functions)。
我希望你能了解到函数如何在你的 bash 脚本中提供巨大的灵活性。
### 数值比较 []
如果你想进行数字比较,你需要在方括号 `[]` 中使用以下运算符之一:
* `-eq` (等于)
* `-ge` (等于或大于)
* `-gt` (大于)
* `-le` (小于或等于)
* `-lt` (小于)
* `-ne` (不相等)
因此,举例来说,如果你想看 12 是否等于或小于 25,可以像 `[ 12 -le 25 ]` 这样。当然,12 和 25 可以是变量。例如,`[ $twelve -le $twentyfive ]`。(LCTT 译注:注意保留方括号和判断语句间的空格)
### if 和 elif 语句
那么让我们用数字比较来介绍 `if` 语句。Bash 中的 `if` 语句将以 `if` 开始, 以 `fi` 结束。`if` 语句 以 `if` 开始,然后是你想做的检查。在本例中,检查的内容是变量 `numberOne` 是否等于 `1`。如果 `numberOne` 等于 `1`,将执行 `then` 语句,否则将执行 `else` 语句。
```
#!/bin/bash
numberTwelve=12
if [ $numberTwelve -eq 12 ]
then
echo "numberTwelve is equal to 12"
elif [ $numberTwelve -gt 12 ]
then
echo "numberTwelve variable is greater than 12"
else
echo "neither of the statemens matched"
fi
```
输出如下:
```
[zexcon@fedora ~]$ ./learnToScript.sh
numberTwelve variable is equal to 12
```
你所看到的是 `if` 语句的第一行,它在检查变量的值是否真的等于 `12`。如果是的话,语句就会停止,并发出 `numberTwelve is equal to 12` 的回显,然后在 `fi` 之后继续执行你的脚本。如果变量大于 `12` 的话,就会执行 `elif` 语句,并在 `fi` 之后继续执行。当你使用 `if` 或 `if`/`elif` 语句时,它是自上而下工作的。当第一条语句是匹配的时候,它会停止并执行该命令,并在 `fi` 之后继续执行。
### 字符串比较 [[]]
这就是数字比较。那么字符串的比较呢?使用双方括号 `[[]]` 和以下运算符等于或不等于。(LCTT 译注:注意保留方括号和判断语句间的空格)
* `=` (相等)
* `!=` (不相等)
请记住,字符串还有一些其他的比较方法,我们这里不会讨论,但可以深入了解一下它们以及它们是如何工作的。
```
#!/bin/bash
#variable with a string
stringItem="Hello"
#This will match since it is looking for an exact match with $stringItem
if [[ $stringItem = "Hello" ]]
then
echo "The string is an exact match."
else
echo "The strings do not match exactly."
fi
#This will utilize the then statement since it is not looking for a case sensitive match
if [[ $stringItem = "hello" ]]
then
echo "The string does match but is not case sensitive."
else
echo "The string does not match because of the capitalized H."
fi
```
你将得到以下三行:
```
[zexcon@fedora ~]$ ./learnToScript.sh
The string is an exact match.
The string does not match because of the capitalized H.
[zexcon@fedora ~]$
```
### while 循环
在结束这个系列之前,让我们看一下循环。一个关于 `while` 循环的例子是:“当 1 小于 10 时,在数值上加 1”,你继续这样做直到该判断语句不再为真。下面你将看到变量 `number` 设置为 `1`。在下一行,我们有一个 `while` 语句,它检查 `number` 是否小于或等于 `10`。在 `do` 和 `done` 之间包含的命令被执行,因为 `while` 的比较结果为真。所以我们回显一些文本,并在 `number` 的值上加 `1`。我们继续执行,直到 `while` 语句不再为真,它脱离了循环,并回显 `We have completed the while loop since $number is greater than 10.`。
```
#!/bin/bash
number=1
while [ $number -le 10 ]
do
echo "We checked the current number is $number so we will increment once"
((number=number+1))
done
echo "We have completed the while loop since $number is greater than 10."
```
`while` 循环的结果如下:
```
[zexcon@fedora ~]$ ./learnToScript.sh
We checked the current number is 1 so we will increment once
We checked the current number is 2 so we will increment once
We checked the current number is 3 so we will increment once
We checked the current number is 4 so we will increment once
We checked the current number is 5 so we will increment once
We checked the current number is 6 so we will increment once
We checked the current number is 7 so we will increment once
We checked the current number is 8 so we will increment once
We checked the current number is 9 so we will increment once
We checked the current number is 10 so we will increment once
We have completed the while loop since 11 is greater than 10.
[zexcon@fedora ~]$
```
正如你所看到的,实现这一目的所需的脚本量要比用 `if` 语句不断检查每个数字少得多。这就是循环的伟大之处,而 `while` 循环只是众多方式之一,它以不同的方式来满足你的个人需要。
### 总结
下一步是什么?正如文章所指出的,这是,面向 Bash Shell 脚本初学者的。希望我激发了你对脚本的兴趣或终生的热爱。我建议你去看看其他人的脚本,了解你不知道或不理解的地方。请记住,由于本系列每篇文章都介绍了数学运算、比较字符串、输出和归纳数据的多种方法,它们也可以用函数、循环或许多其他方法来完成。如果你练习所讨论的基础知识,你将会很开心地把它们与你还要学习的所有其他知识结合起来。试试吧,让我们在 Fedora Linux 世界里见。
---
via: <https://fedoramagazine.org/bash-shell-scripting-for-beginners-part-3>
作者:[Matthew Darnell](https://fedoramagazine.org/author/zexcon/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
14,314 | 如何让 KDE 看起来像 GNOME | https://opensource.com/article/22/2/make-kde-look-like-gnome | 2022-02-28T12:14:00 | [
"KDE",
"GNOME"
] | https://linux.cn/article-14314-1.html |
>
> 在不放弃你的 Plasma 桌面的情况下获得 GNOME 的感觉。
>
>
>

GNOME 有一种极简主义设计的倾向。它是一种美丽的桌面体验,并且是第一个在我使用 Linux 时引起别人赞叹的自由桌面。然后(请原谅我的形而上的哲学思考),没有复杂性就没有极简主义,而 KDE 以其极具定制性而闻名。我认为测试一下 KDE 的配置可能会很有趣,并尝试在 KDE Plasma 桌面上重新实现,至少在表面上实现 GNOME 的体验。
如果你尝试这个,请在一个临时用户帐户中进行。这些变化相对来说比较剧烈,撤销它以回到你的标准 KDE 布局可能是一个很大的工作。
### Adwaita 主题
GNOME 的默认主题叫做 Adwaita,是为 GTK 设计的,这是 GNOME 用于窗口和部件的工具包。KDE 使用 Qt 工具包,但 Fedora-Qt 项目已经开发了一个模仿 Adwaita 的 Qt 主题。这是在 KDE 上模仿 GNOME 的第一步,也是最明显的一步。使用你的发行版的包管理器安装 Adwaita for Qt:
```
$ sudo dnf install adwaita-qt{,5}
```
在基于 Debian 的发行版上,请使用 `apt` 命令而不是 `dnf`。
安装完毕后,进入“<ruby> 系统设置 <rt> System Settings </rt></ruby>”,选择“<ruby> 应用风格 <rt> Application Style </rt></ruby>”。选择你喜欢的 Adwaita 主题变体:有一个浅色主题和一个深色主题,以及两者之间的变化。点击“<ruby> 应用 <rt> Apply </rt></ruby>”按钮来更新你的主题,但先不要关闭这个控制面板。
### 窗口装饰
在“<ruby> 应用风格 <rt> Application Style </rt></ruby>”窗口的左侧面板中选择“<ruby> 窗口装饰 <rt> Window Decorations </rt></ruby>”分类。如果有一个适合 Adwaita 的标题栏样式,通过选择它并点击“<ruby> 应用 <rt> Apply </rt></ruby>”来激活它。如果没有安装额外的装饰,点击面板右下方的“<ruby> 获取新窗口装饰 <rt> Get new window decorations </rt></ruby>”按钮,下载合适的东西。我使用了用户 x-varlesh-x 提供的 “Arc” 主题,但你可以四处看看,看看什么最适合你的其他主题。
GNOME 著名的是它的窗口标题栏上只有一个按钮,所以导航到“<ruby> 标题栏按钮 <rt> Titlebar Buttons </rt></ruby>”标签,然后通过将“<ruby> 关闭 <rt> Close </rt></ruby>”按钮从标题栏图像拖到处置区域来删除所有按钮。

取消选择“<ruby> 显示标题栏按钮提示 <rt> Show titlebar button tooltips </rt></ruby>”,因为 GNOME 不倾向于在系统部件上做提示。
点击“<ruby> 应用 <rt> Apply </rt></ruby>”来保存你的修改。
### GTK 主题
在 KDE 上,使用 GTK 的应用通常会被重新主题化成与 KDE 的默认主题一致。现在你已经把你的主题从 KDE Breeze 改为 GNOME Adwaita,你必须告诉 GTK 使用 Adwaita 主题。
点击“<ruby> 应用风格 <rt> Application Style </rt></ruby>”面板底部的“<ruby> 配置 GNOME/GTK 应用风格 <rt> Configure GNOME/GTK application style </rt></ruby>”按钮,在下拉菜单中选择 “Adwaita”。
### 工作区行为
GNOME 在视觉上比 KDE 更安静,所以在“<ruby> 系统设置 <rt> System Settings </rt></ruby>”中找到“<ruby> 工作区行为 <rt> Workspace behavior </rt></ruby>”面板,停用“<ruby> 在鼠标悬停时显示信息提示 <rt> Display informational tooltips on mouse hover </rt></ruby>”和“<ruby> 显示状态变化的视觉反馈 <rt> Display visual feedback for status changes </rt></ruby>”。
你也可以把打开文件和文件夹改为需要双击而不是单击(在实际中,这对我来说太不方便了)。
### 图标和光标
你可以在“<ruby> 系统设置 <rt> System Settings </rt></ruby>”中把光标改为 Adwaita 主题,然后选择一个图标主题。我喜欢 Breeze 的图标,但它们确实感觉像 KDE。GNOME 使用 Adwaita 图标集,但由于它们是为 GNOME 设计的,所以缺少一些重要的 KDE 组件的图标。你可以点击“<ruby> 图标 <rt> Icons </rt></ruby>”控制面板中的“<ruby> 获取新图标 <rt> Get New Icons </rt></ruby>”按钮来浏览很多图标集,最后我选择了用户 alvatip 提供的 “Nordzy”。不过,有很多不错的图标集可用,查看它们,看看你喜欢什么。我发现任何不属于 Breeze 的东西都会使 KDE 看起来与我习惯的东西有足够的不同。
### 系统面板
GNOME 的面板在屏幕的顶部,而 KDE 的面板默认在屏幕的底部。GNOME 的面板在默认情况下也是比较空的,所以我发现最简单的做法是先把当前的 KDE 面板完全删除。
右键点击并选择“<ruby> 编辑面板 <rt> Edit panel </rt></ruby>”。进入编辑模式后,再次右键点击面板,选择“<ruby> 删除面板 <rt> Remove panel </rt></ruby>”。当它消失了,右击桌面上的任何地方,选择“<ruby> 添加面板 <rt> Add panel </rt></ruby>”并添加一个空面板。这样就在屏幕底部添加了一个面板,所以右击它,选择“<ruby> 编辑面板 <rt> Edit panel </rt></ruby>”,然后点击并拖动“<ruby> 屏幕边缘 <rt> Screen Edge </rt></ruby>”按钮到屏幕的顶部。
当仍处于编辑模式时,点击“<ruby> 添加部件 <rt> Add widgets </rt></ruby>”按钮,将“<ruby> 应用仪表板 <rt> Application dashboard </rt></ruby>”部件添加到面板的最左端。然后从“<ruby> 编辑面板 <rt> Edit panel </rt></ruby>”视图中添加一个“<ruby> 间隔 <rt> Spacer </rt></ruby>”块,然后是一个“<ruby> 时钟 <rt> Clock </rt></ruby>”,然后是另一个“<ruby> 间隔 <rt> Spacer </rt></ruby>”。你可以拖动这些小部件来排列它们,所以我发现最简单的做法是添加上应用仪表板和时钟,然后是两个间隔,再把它们排列起来。

你可以右键点击每个小组件来定制图标和布局。例如,我把日期从时钟上移走了,因为它在附加了日期后看起来很挤,尽管 GNOME 确实包含了日期。
通过进入“<ruby> 系统设置 <rt> System Settings </rt></ruby>”,选择一个深色的 Plasma 主题,比如 “Breeze Dark”,将面板改为黑色。
### GNOME Plasma 桌面
通过一些快速的调整,你的桌面现在在各个方面接近于 GNOME。布局是类似的。

应用仪表板提供了一个 GNOME 风格的应用启动器。

其他小的修改进一步有助于产生这种错觉。例如,我简化了 Dolphin 文件管理器,去掉了“<ruby> 位置 <rt> Places </rt></ruby>”面板,也去掉了工具栏上的大部分按钮。
### 一个不同的视角
这不是一个精确的匹配,比我更具钻研精神的人可以做的更多,得到更接近正确的结果。然而,像这样有趣的变化证明了 KDE 是多么的灵活,拥有大量的选项意味着你可以缩减你的交互内容以适应你的偏好。一个类似 GNOME 的桌面可以给你一个新的视角来看待你与桌面的互动,即使你不会永远保持这种布局,它可以帮助你发现你可能没有想到要寻找的选项。
---
via: <https://opensource.com/article/22/2/make-kde-look-like-gnome>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | GNOME has a tendency for minimalist design. It's a beautiful desktop experience, and holds the honor of being the first free desktop that's ever elicited vocalized admiration from someone looking over my shoulder as I use Linux. Then again (and pardon the armchair philosophizing), you can't have minimalism without complexity, and KDE is well known for being very customizable. I thought it might be fun to put KDE configuration to the test and try to re-implement, at least superficially, the GNOME experience in the KDE Plasma Desktop.
If you try this, do it in a temporary user account. These changes are relatively drastic, and undoing it to get back to your standard KDE layout can be a lot of work.
## Adwaita theme
The default GNOME theme, called Adwaita, was designed for GTK, which is the toolkit GNOME uses for windows and widgets. KDE uses the Qt toolkit, but the Fedora-Qt project has developed a Qt theme that mimics Adwaita. That's the first and most obvious step to mimic GNOME on KDE. Install Adwaita for Qt using your distribution's package manager:
`$ sudo dnf install adwaita-qt{,5}`
On Debian-based distributions, use the `apt`
command instead of `dnf`
.
Once that's installed, go to **System Settings **and select **Application Style**. Select the Adwaita theme variant you prefer: there's a light theme and a dark theme, and variations in between. Click the **Apply **button to update your theme, but don't close this control panel yet.
## Window decoration
Select the **Window Decoration**s category in the left panel of the **Application Style** window. If there's a title bar style that fits with Adwaita, activate it by selecting it and clicking **Apply**. If there's no extra decoration installed, click the **Get new window decorations** button in the bottom right of the panel and download something appropriate. I used the **Arc** theme by user x-varlesh-x, but you can look around and see what fits best with the rest of your theme.
GNOME famously has just one button on its window title bar, so navigate to the **Titlebar Buttons** tab and remove all buttons but the **Close** button by dragging them from the title bar image to the disposal area.

(Seth Kenlon, CC BY-SA 4.0)
Deselect the **Show titlebar button tooltips** because GNOME doesn't tend to do tooltips over system widgets.
Click **Apply** to save your changes.
## GTK theme
On KDE, applications using GTK are usually re-themed to match KDE's default. Now that you've changed your theme from KDE Breeze to GNOME Adwaita, you have to tell GTK to use the Adwaita theme.
Click the **Configure GNOME/GTK application style** button at the bottom of the **Application style** panel and select **Adwaita** from the drop-down menu.
## Workspace behavior
GNOME is visually quieter than KDE, so find the **Workspace behavior** panel in **System Settings** and deactivate **Display informational tooltips on mouse hover** and **Display visual feedback for status changes**.
You might also change opening files and folders to require a double-click rather than a single-click (in real life. this is a step too far for my liking.)
## Icons and cursors
You can change your cursors to the Adwaita theme here in **System Settings** and then choose an icon theme. I enjoy the Breeze icons but they do feel like KDE. GNOME uses the Adwaita icon set, but because they're designed for GNOME there are missing icons for some important KDE components. You can click the **Get New Icons** button in the **Icons** control panel to browse through lots of icon sets, and in the end I chose **Nordzy** by user alvatip. There are lots of great icon sets available, though, so look through them and see what you like. I found that anything that wasn't Breeze made KDE look sufficiently different from what I was used to.
## System panel
The GNOME panel is at the top of the screen, while KDE's panel defaults to the bottom of the screen. GNOME's panel is also a lot emptier by default, so I found it easiest to remove the current KDE panel altogether first.
Right-click on the kicker and select **Edit panel**. Once in edit mode, right-click on the panel again and select **Remove panel**. Once it's gone, right-click anywhere on the desktop and select **Add panel** and add an empty panel. This adds a panel to the bottom of the screen, so right-click on it, select **Edit panel**, and then click and drag the **Screen Edge **button to the top of the screen.
While still in edit mode, click the **Add widgets** button and add the **Application dashboard** widget to the far left end of the panel. Then add a **Spacer** block from the **Edit panel** view, then a **Clock**, and then another **Spacer**. You can drag these widgets to arrange them, so I found it easiest to add the application dashboard and clock together, then the two spaces, and then arranged them.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
You can right-click on each widget to customize icon and layout. For instance, I removed the date from the clock because it looked busy with the date appended, even though GNOME does include the date.
Change the panel to black by going to **System Settings** and choosing a dark Plasma theme, like **Breeze Dark**.
## GNOME Plasma Desktop
With a few quick adjustments, your desktop now approximates GNOME in a few different ways. The layout is similar.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
The application dashboard provides a GNOME-style application launcher.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
Other minor modifications further aid in the illusion. For instance, I simplified the Dolphin file manager by removing the** Places** panel and by removing most buttons from the toolbar.
## A different perspective
It's not an exact match, and someone far more pedantic than I could work harder and get a lot closer to the right results. However, fun changes like this demonstrate just how flexible KDE really is, and how having lots of options means you can pare down what you interact with to fit your preference. A GNOME-like desktop can give you a new perspective on how you interact with your desktop, even if you don't keep the layout forever, and it helps you discover options you may not have thought to look for otherwise.
## Comments are closed. |
14,316 | Fedora 36 发布时间表和新功能 | https://news.itsfoss.com/fedora-36-release-date-features/ | 2022-03-01T08:50:00 | [
"Fedora"
] | https://linux.cn/article-14316-1.html |
>
> Fedora 36 很快就要发布了,预期会有哪些功能呢?还有,它准备什么时候发布?
>
>
>

Fedora 36 是 [今年最值得期待的发布](https://news.itsfoss.com/linux-distro-releases-2022/) 之一。
虽然我们期待每一个重要的发布,但去年,[Fedora 35](https://news.itsfoss.com/fedora-35-release/) 以 GNOME 41 和一个新的 KDE 流派(Kinoite)让人期待它带来一些令人兴奋的变化。
别着急;如果你等不及要看到 Fedora 36,我将重点指出有关该版本的基本细节。
### Fedora 36 发布日期
按照官方的时间表,Fedora 36 测试版的早期发布日期是 **2022 年 3 月 15 日**。而且,Fedora 36 测试版的延迟发布日期(万一延迟)是 **2022 年 3 月 22 日**。
一旦公开测试完成,最终的发布日期可望在 **2022 年 4 月 19 日**。如果出现延迟,发布日期将被推至 **2022 年 4 月 26 日**。
你还应该注意,Fedora Linux 34 将在 **2022 年 5 月 17 日** 走到其生命的终点。

你现在可以尝试用每夜构建版来下载 Fedora 36(链接在本文底部),但是距离测试版发布还有几周时间,你应该等等。
### Fedora 36 功能

像往常一样,Fedora 36 拥有最新的 GNOME 以及其他的补充和改进。
主要的亮点包括:
#### 1、GNOME 42
[GNOME 42](https://news.itsfoss.com/gnome-42-features/) 是一次令人兴奋的升级,有各种视觉和功能的变化。
它还包括性能和视觉上的调整及其他改进。如果你没了解过 [GNOME 41 增加的功能](https://news.itsfoss.com/gnome-41-release/),你也应该看看。
当然,你可以预期在 Fedora 36 中找到所有这些变化。在这里,我将重点指出那些 Fedora 36 中的细节(如果你没有用上 GNOME 42)。
#### 2、全系统的深色模式

Fedora 36 享有从 GNOME 42 引入的全系统深色模式。
虽然在其他 Linux 发行版上有深色模式的实现,但 GNOME 42 帮助 Fedora 36 成为桌面用户的一个有吸引力的选择。
深色模式完美地融合在一起,给人一种干净的 GNOME 体验。
#### 3、新壁纸
如果没有一张新的壁纸,其他的改进听起来都很乏味。
所以,Fedora 设计团队在 Fedora 36 中带来了一张制作精美的壁纸,这是一张风景插图,看起来很不错。

默认的壁纸有日间/夜间的变体。正如你所注意到的上面的白天的壁纸,下面是晚上的艺术作品。

两者看起来都很奇妙,对眼睛也很舒畅。
#### 4、Linux 内核 5.17
众所周知,Fedora 36 提供最新的 Linux 内核版本。截至目前,它正在运行即将发布的 Linux 内核 5.17 的候选版本。
随着 Fedora 36 的最终发布,你应该看到 Linux 内核 5.17 的稳定版本。
#### 5、深色/浅色壁纸
除了 Fedora 36 的新默认壁纸之外,它还具有与 GNOME 42 一起引入的深色/浅色模式壁纸集。

截至目前,在测试 Fedora 36 工作站(预发布版本)时,我只能找到其中一张壁纸,而不是 GNOME 42 中的整个系列。
所以,你也许可以期待在 Fedora 36 测试版中增加更多的内容。
你可以从外观上选择壁纸及其可用的深色/浅色变体。
#### 6、屏幕截图用户界面和本地屏幕录制
GNOME 42 引入的新的屏幕截图用户界面是一个奇妙的补充。另外,只需切换一下,你就可以开始录制你的屏幕了!

你可以看到 Fedora 36 的这个功能,工作得非常好。
#### 7、桌面环境更新
由于显而易见的原因,你应该在 Fedora 36 看到提供的最新的桌面环境。
最基本的应该是 GNOME 42、[KDE Plasma 5.24](https://news.itsfoss.com/kde-plasma-5-24-lts-release/) 和 Xfce 4.16。
除此之外,LXQt 也已经更新到 1.0.0。
#### 8、重要的技术变化
除了视觉上的变化和 Linux 内核的升级,Fedora 36 还有各种技术改进。
其中一些值得一提的包括:
* 将系统的 openJDK 包从 Java 11 更新为 Java 17。
* 引入了即将推出的 Golang 1.18 版本。
* 将各种语言的字体切换为 Noto 字体作为默认字体,以确保文本渲染的一致性。
* 今后自动升级时排除推荐软件包的行为(如果你没有安装它们)。
* GNU 工具链更新至 gcc 12 和 glibc 2.35。
* 修复某些情况下的升级性问题。
* 默认的 Wayland 会话与 NVIDIA 专有驱动程序。
* 更新 PHP 栈到最新的 8.1.x。
* RPM 数据库将被重新定位到 `/usr` 目录,目前它在 `/var`。
关于更多的技术细节,你可以参考 [官方变更集](https://fedoraproject.org/wiki/Releases/36/ChangeSet)。如果你想下载预发布版本,你可以从下面的链接抓取 ISO。
* [Fedora 36(预发布)](https://kojipkgs.fedoraproject.org/compose/branched/latest-Fedora-36/compose/Workstation/x86_64/iso/)。
### 总结
Fedora 36 将会是一个令人激动的版本。
当它发布时,我很期待在 Fedora 36 工作站上尝试 Wayland 会话与 NVIDIA 专有驱动程序。
你对这个版本有什么期待?请在下面的评论中告诉我。
---
via: <https://news.itsfoss.com/fedora-36-release-date-features/>
作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Fedora 36 is finally available.
While we look forward to every major release, last year, [Fedora 35](https://news.itsfoss.com/fedora-35-release/) set up some exciting expectations with GNOME 41 and a new KDE flavor (Kinoite).
Here, I shall highlight the essential details about the new upgrade.
## Fedora 36 Release Information
The final release date was scheduled for May 10, 2022 (with multiple delays). Now, it’s here!
You should also note that Fedora Linux 34 will reach its end of life on **May 17, 2022.**

## Fedora 36 Features

Fedora 36 features the latest GNOME and other additions and improvements.
The key highlights include:
## 1. GNOME 42
[GNOME 42](https://news.itsfoss.com/gnome-42-features/) is an exciting upgrade with various visual and functional changes.
It also includes performance and visual tweaks, among other improvements. If you missed [GNOME 41 feature additions](https://news.itsfoss.com/gnome-41-release/), you should also check that.
Of course, you should expect to find all the changes with Fedora 36. Here, I shall highlight those details using Fedora 36 (if you didn’t catch up with GNOME 42).
## 2. System-wide Dark Mode

Fedora 36 enjoys the system-wide dark mode introduced with GNOME 42.
While we had dark mode implementations on other Linux distributions, GNOME 42 helped Fedora 36 become an attractive option for desktop users.
The dark mode blends in perfectly and gives a clean GNOME experience.
## 3. New Wallpapers
Without a new wallpaper, every other improvement sounds dull.
So, the Fedora Design Team brings along a beautifully crafted wallpaper in Fedora 36, illustrating glass-like elements, that looks interesting.

The default wallpaper has a variant for day/night. As you notice the wallpaper for daytime above, here’s the artwork for the night:

Both look fantastic and soothing to the eyes.
## 4. Linux Kernel 5.17
Fedora 36 is known to offer the latest Linux Kernel releases. As of now, it is currently running the release candidate versions of the upcoming Linux Kernel 5.17.
With the final Fedora 36 release, you should expect the stable version of Linux Kernel 5.17.
## 5. Dark/Light Wallpapers
Along with the new default wallpapers for Fedora 36, it also features a dark/light mode wallpaper collection introduced with GNOME 42.

You can find plenty of new wallpapers with the release.
You can choose to select the wallpapers with their available dark/light variants from the appearance menu in the system settings.
## 6. Screenshot User Interface and Native Screen Recording
The new screenshot user interface introduced with GNOME 42 is a fantastic addition. Also, with just a toggle, you can start recording your screen!

And, you could see that in action with Fedora 36, working perfectly fine.
## 7. Desktop Environment Updates
For obvious reasons, you should expect the latest desktop environments with Fedora 36.
The bare minimum should be GNOME 42,[ KDE Plasma 5.24](https://news.itsfoss.com/kde-plasma-5-24-lts-release/), and Xfce 4.16.
In addition to that, LXQt has been updated to 1.0.0.
## 8. Important Technical Changes
Along with the visual changes and the Linux Kernel upgrade, there are various technical improvements with Fedora 36.
Some of them worth mentioning include:
- Updated the system openJDK package from Java 11 to Java 17.
- Introducing the upcoming Golang 1.18 version.
- Switching to Noto fonts as the default for various languages to ensure consistency in text rendering.
- The behavior to exclude the recommended packages (considering you do not have them installed) when automatically upgrading in future.
- GNU Toolchain update to gcc 12 and glibc 2.35.
- Fix upgradability issues in some cases.
- Default Wayland session with NVIDIA proprietary driver.
- Updated PHP stack to the latest 8.1.x.
- The RPM database will be relocated to /usr directory, currently it was in /var.
For more technical details, you can refer to the [official changeset](https://fedoraproject.org/wiki/Releases/36/ChangeSet?ref=news.itsfoss.com). If you want to download it, you can grab the ISO from the button below.
## Wrapping Up
Fedora 36 is an exciting release.
I’m looking forward to trying the Wayland session with NVIDIA’s proprietary driver on Fedora 36 Workstation when I try it out as a daily driver.
*What are you looking forward to in this release? Let me know in the comments down below.*
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,317 | Kubernetes 部署的可视化地图 | https://opensource.com/article/22/3/visual-map-kubernetes-deployment | 2022-03-01T09:58:09 | [
"Kubernetes"
] | https://linux.cn/article-14317-1.html |
>
> 通过查看创建一个吊舱或一个部署时的 10 个步骤,可以更好地了解 Kubernetes。
>
>
>

当你在 Kubernetes 上使用容器时,你经常把应用程序组合在一个<ruby> 吊舱 <rt> pod </rt></ruby>中。当你把一个容器或一个吊舱发布到生产环境中时,它被称为一个<ruby> 部署 <rt> deployment </rt></ruby>。如果你每天甚至每周都在使用 Kubernetes,你可能已经这样做过几百次了,但你有没有想过,当你创建一个吊舱或一个部署时到底会发生什么?
我发现在高层次上了解事件链条是有帮助的。当然,你不一定要理解它。即使你不知道为什么,它仍然在工作。我不打算列出每一件发生的小事,但我的目标是涵盖所有重要的事情。
这里有一张 Kubernetes 不同组件如何互动的视觉地图。

你可能注意到,在上图中,我没有包括 etcd。API 服务器是唯一能够直接与 etcd 对话的组件,而且只有它能够对 etcd 进行修改。因此,你可以认为 etcd 在这张图中存在于(隐藏的)API 服务器后面。
另外,我在这里只讲到了两个主要的控制器(<ruby> 部署控制器 <rt> Deployment controller </rt></ruby>和<ruby> 复制集控制器 <rt> ReplicaSet controller </rt></ruby>)。其他的控制器的工作方式类似。
下面的步骤描述了当你执行 `kubectl create` 命令时会发生什么。
### 步骤 1
当你使用 `kubectl create` 命令时,一个 HTTP POST 请求被发送到 API 服务器,其中包含部署清单。API 服务器将其存储在 etcd 数据存储中,并返回一个响应给 `kubectl`。
### 步骤 2 和 3
API 服务器有一个观察机制,所有观察它的客户都会得到通知。客户端通过打开与 API 服务器的 HTTP 连接来观察变化,API 服务器会流式地发出通知。其中一个客户端是部署控制器。部署控制器检测到一个<ruby> 部署 <rt> Deployment </rt></ruby>对象,它用部署的当前规格创建一个<ruby> 复制集 <rt> ReplicaSet </rt></ruby>。该资源被送回 API 服务器,并存储在 etcd 数据存储中。
### 步骤 4 和 5
与上一步类似,所有观察者都会收到关于 API 服务器中的变化的通知。这一次,复制集控制器会接收这一变化。该控制器了解所需的副本数量和对象规格中定义的吊舱选择器,创建吊舱资源,并将这些信息送回 API 服务器,存储在 etcd 数据存储中。
### 步骤 6 和 7
Kubernetes 现在拥有运行吊舱所需的所有信息,但吊舱应该在哪个节点上运行?<ruby> 调度器 <rt> Scheduler </rt></ruby>观察那些还没有分配到节点的吊舱,并开始对所有节点进行过滤和排序,以选择最佳节点来运行吊舱。一旦节点被选中,该信息将被添加到吊舱规格中。而且它被送回 API 服务器并存储在 etcd 数据存储中。
### 步骤 8、9 和 10
到目前为止的所有步骤都发生在<ruby> 控制平面 <rt> control plane </rt></ruby>本身。<ruby> 工作节点 <rt> worker node </rt></ruby>还没有做任何工作。不过,吊舱的创建并不是由控制平面处理的。相反,在所有节点上运行的 `kubelet` 服务观察 API 服务器中的吊舱规格,以确定它是否需要创建任何吊舱。在调度器选择的节点上运行的 kubelet 服务获得吊舱规格,并指示工作节点上的容器运行时创建容器。这时就会下载一个容器镜像(如果它还不存在的话),容器就会实际开始运行。
### 理解 Kubernetes 的部署
对这个一般流程的理解可以帮助你理解 Kubernetes 中的许多事件。考虑一下 Kubernetes 中的<ruby> 守护进程集 <rt> DaemonSet </rt></ruby>或<ruby> 状态集 <rt> StatefulSet </rt></ruby>。除了使用不同的控制器外,吊舱的创建过程是一样的。
课后作业:如果部署被修改为有三个应用程序的副本,导致创建吊舱的事件链条会是什么样子?你可以参考图表或列出的步骤,但你肯定有你需要弄清楚的知识。知识就是力量,你现在有了了解 Kubernetes 的一个重要组成部分。
---
via: <https://opensource.com/article/22/3/visual-map-kubernetes-deployment>
作者:[Nived Velayudhan](https://opensource.com/users/nivedv) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | When you work with containers on Kubernetes, you often group applications together in a pod. When you launch a container or a pod into production, it's called a *deployment*. If you're using Kubernetes daily or even just weekly, you've probably done it hundreds of times, but have you thought about what exactly happens when you create a pod or a deployment?
I find it helpful to have an understanding of the chain of events on a high level. You don't have to understand it, of course. It still works even when you don't know why. I don't intend to list each and every little thing that happens, but I aim to cover all of the important ones.
Here's a visual map of how the different components of Kubernetes interact:

(Nived Velayudhan and Seth Kenlon, CC BY-SA 4.0)
You may notice in the diagram above that I haven't included etcd. The API server is the only component that can directly talk to etcd, and only it can make changes to it. So you can assume that etcd exists (hidden) behind the API server in this diagram.
Also, I'm talking about only two main controllers (Deployment and ReplicaSet) here. Others would also work similarly.
The steps below describe what happens when you execute the `kubectl create`
command:
**Step 1:** When you use the `kubectl create`
command, an HTTP POST request gets sent to the API server, which contains the deployment manifest. The API server stores this in the etcd data store and returns a response to the kubectl.
**Steps 2 and 3:** The API server has a watch mechanism and all the clients watching this get notified. A client watches for changes by opening an HTTP connection to the API server, which streams notifications. One of those clients is the Deployment controller. The Deployment controller detects a Deployment object, and it creates a ReplicaSet with the current specification of the Deployment. This resource gets sent back to the API server, which stores it in the etcd datastore.
**Steps 4 and 5:** Similar to the previous step, all watchers get notified about the change made in the API server—this time the ReplicaSet Controller picks up the change. The controller understands the desired replica counts and the pod selectors defined in the object specification, creates the pod resources, and sends this information back to the API server, storing it in the etcd datastore.
**Steps 6 and 7:** Kubernetes now has all the information it needs to run the pod, but which node should the pods run on? The scheduler watches for pods that don't have a node assigned to them yet, and starts its process of filtering and ranking all nodes to choose the best node to run the pod on. Once the node is selected, that information gets added to the pod specification. And it gets sent back to the API server and stored in the etcd datastore.
**Steps 8, 9, and 10:** All the steps until now occur in the control plane itself. The worker node has yet to do any work. The pod's creation isn't handled by the control plane, though. Instead, the kubelet service running on all the nodes watches for the pod specification in the API server to determine whether it needs to create any pods. The kubelet service running on the node selected by the scheduler gets the pod specification and instructs the container runtime in the worker node to create the container. This is when a container image gets downloaded (if it's not already present) and the container actually starts running.
## Understanding Kubernetes deployments
Gaining an understanding of this general flow can help you understand many events in Kubernetes. Consider a DemonSet or StatefulSet in Kubernetes. Apart from using different controllers, the pod creation process remains the same.
Ask yourself this: If the deployment gets modified to have three replicas of an app, what would the chain of events that lead to the creation of the pods look like? You can refer to the diagram or the listed steps, but you definitely have the knowledge you need to figure it out. Knowledge is power, and you now have an important component for understanding Kubernetes.
## 1 Comment |
14,319 | 用 SELinux 保护你的容器 | https://opensource.com/article/20/11/selinux-containers | 2022-03-02T09:36:24 | [
"SELinux",
"容器"
] | https://linux.cn/article-14319-1.html |
>
> 黑掉你的系统,了解为什么配置 SELinux 作为你的第一道容器防线是很重要的。
>
>
>

当有些事情在你的 Linux 环境中不能正常工作时,最简单的方法就是禁用<ruby> 安全增强型 Linux <rt> Security-Enhanced Linux </rt></ruby>([SELinux](https://en.wikipedia.org/wiki/Security-Enhanced_Linux))。而当它突然可以工作了,你就会忘记了禁用这件事 —— 这是一个常见的陷阱,意味着你已经失去了一个非常强大的安全工具。
随着容器、微服务和分布式架构的兴起,威胁也在上升。这是由于一个老的、众所周知的问题:速度。容器的优势在于它们能让你快速行动,做更多的事情,并迅速改变。这意味着容器的采用已经飞速发展,但它所提供的速度也意味着你会遇到更多的问题和漏洞。当你越来越快地做更多的事情时,这自然会发生。
### 如何减轻威胁
正如孙子所说,“不战而屈人之兵”。当涉及到容器的基本防御时,这句话真的很有共鸣。为了避免问题(战斗),确保你的容器主机是安全的,你可以使用 SELinux 作为你的第一道防线。
SELinux 是一个开源项目,于 2000 年发布,2003 年集成到 Linux 内核中。根据 [红帽公司的解释](https://www.redhat.com/en/topics/linux/what-is-selinux),“SELinux 是 [Linux 系统](https://www.redhat.com/en/topics/linux/what-is-linux) 的一个安全架构,允许管理员对谁可以访问系统有更多的控制。它最初是由美国国家安全局(NSA)开发的,是使用 Linux 安全模块(LSM)对 [Linux 内核](https://www.redhat.com/en/topics/linux/what-is-the-linux-kernel) 的一系列补丁。”
### 开始吧
当你想到容器时,首先想到的可能是 [Docker](https://opensource.com/resources/what-docker)。Docker 在 2013 年出现后掀起了一场容器采用革命。它是容器爆炸性流行的主要原因之一,但如上所述,大量采用增加了用户对安全风险的脆弱性。
在你用 SELinux 保护你的 Docker 容器之前,你需要设置一些东西。
#### 前置条件
* 安装并配置了 CentOS 8/RHEL 8。
* 安装并配置好 Docker CE
* 创建两个账户:root 和 非 root 用户(下面的例子中是 `mcalizo`)。
如果你需要在你的 RHEL 8/CentOS 8 服务器上设置 Docker,你可以按照这些 [说明](https://www.linuxtechi.com/install-docker-ce-centos-8-rhel-8/)。如果你运行的是 RHEL 8,你需要在开始之前删除预装的 Podman 和 runc 包。
首先,确保 SELinux 被启用:
```
[mcalizo@Rhel82 ~]$ sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Memory protection checking: actual (secure)
Max kernel policy version: 31
[mcalizo@Rhel82 ~]$
```
然后,验证你的操作系统版本和 Docker 正在运行。以 root 身份登录并运行:
```
[root@rhel82 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.2 (Ootpa)
[root@rhel82 ~]#
[root@rhel82 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-10-28 19:10:14 EDT; 15s ago
Docs: https://docs.docker.com
Main PID: 30768 (dockerd)
Tasks: 8
Memory: 39.0M
CGroup: /system.slice/docker.service
└─30768 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Oct 28 19:10:13 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:13.889602941-04:00" level=error msg=">
Oct 28 19:10:13 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:13.903413613-04:00" level=warning msg>
Oct 28 19:10:13 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:13.903427451-04:00" level=warning msg>
Oct 28 19:10:13 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:13.903538271-04:00" level=info msg="L>
Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.132060506-04:00" level=info msg="D>
Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.308943088-04:00" level=info msg="L>
Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.319438549-04:00" level=info msg="D>
Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.319570298-04:00" level=info msg="D>
Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.333419209-04:00" level=info msg="A>
Oct 28 19:10:14 rhel82.home.labs.com systemd[1]: Started Docker Application Container Engine
```
检查你的 Docker 版本:
```
[root@rhel82 ~]# docker --version
Docker version 19.03.13, build 4484c46d9d
```
### 黑掉主机
了解一个问题的最好方法之一就是去体验它。因此,我将告诉你,如果你的安全设置不当,向 Docker 主机注入恶意代码是多么容易。
为了能够在 Docker 主机上做坏事,“恶意”的非 root 用户(本教程中为 `mcalizo`)必须是可以实例化 Docker 容器的组的成员。
首先,确认 `mcalizo` 用户属于哪个组:
```
[root@Rhel82 ~]# groups mcalizo
mcalizo : mcalizo
```
输出显示,`mcalizo` 只属于它自己的组。这意味着 `mcalizo` 不能实例化 Docker 容器,如果它试图这样做,将会得到这个错误:
```
[mcalizo@Rhel82 ~]$ docker run -it --rm centos:latest /bin/sh
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
```
要允许 `mcalizo` 实例化容器,将用户加入 `docker` 组:
```
[root@Rhel82 ~]# usermod -G docker -a mcalizo
[root@Rhel82 ~]# groups mcalizo
mcalizo : mcalizo docker
```
接下来,部署一个 `fedora:latest` 的容器,并登录到实例化的容器中去探索它:
```
[mcalizo@Rhel82 ~]$ docker run -it --rm fedora:latest /bin/sh
Unable to find image 'fedora:latest' locally
latest: Pulling from library/fedora
ee7e89337106: Pull complete
Digest: sha256:b9ec86d36fca7b1d3de39cd7c258e8d90c377d312c21a7748071ce49069b8db4
Status: Downloaded newer image for fedora:latest
sh-5.0# cat /etc/redhat-release
Fedora release 33 (Thirty Three)
```
当你登录到新创建的容器时,你可以看到你是以 root 身份自动登录的:
```
sh-5.0# whoami
root
sh-5.0#
```
作为 `root` 用户,你可以在这个容器中做任何事情,这意味着你可以利用容器主机,做很多破坏。因为你可以实例化一个容器,即使你不属于主机的 sudoers 账户,你也可以对主机做一些事情。
退出你刚刚创建的容器,并创建一个新的容器来演示这个漏洞:
```
[mcalizo@Rhel82 ~]$ docker run -it --rm -v /:/exploit fedora:latest /bin/bash
[root@131043f2e306 /]#
```
[-v 选项](https://docs.docker.com/storage/volumes/) 将 Docker 主机的 `/` 目录挂载到 `/exploit` 目录下的容器:
```
[root@131043f2e306 /]#ls exploit/
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
```
因为它已被挂载,你可以在 Docker 主机上做任何事情。例如,你可以删除文件、编辑特定的配置来破害系统,甚至安装木马程序或其他恶意软件来窃取重要信息。
### 为什么会发生这种情况?
你可能想知道,既然 SELinux 处于强制模式,为什么会出现这种情况?深入挖掘 SELinux,看看哪里出了问题。
验证 SELinux 是否有一个 [Docker 上下文](https://docs.docker.com/engine/reference/commandline/context/):
```
[mcalizo@Rhel82 ~]$ ps -eZ | grep docker
system_u:system_r:container_runtime_t:s0 30768 ? 00:00:04 dockerd
[mcalizo@Rhel82 ~]$
```
正如预期的那样,它确实有。这意味着 SELinux 管理着 Docker 守护进程。检查 Docker 守护进程,看看 SELinux 是否默认启用:
```
[mcalizo@Rhel82 ~]$ docker info | grep Security -A3
Security Options:
seccomp
Profile: default
Kernel Version: 4.18.0-193.el8.x86_64
```
Docker 守护进程中的 SELinux 在默认情况下是 **不启用** 的。 这就是问题所在!要解决这个问题,按 [文档](https://docs.docker.com/engine/reference/commandline/dockerd/) 说明,通过更新或创建文件 `/etc/docker/daemon.json` 来启用 SELinux 来控制和管理 Docker(你必须有 root 权限才能这样做):
```
[root@Rhel82 ~]# cat /etc/docker/daemon.json
{
"selinux-enabled": true
}
[root@Rhel82 ~]#
[root@Rhel82 ~]# systemctl restart docker
```
在创建或更新该文件并重启 Docker 后,你应该看到 Docker 守护进程中启用了 SELinux 支持:
```
[root@Rhel82 ~]# systemctl restart docker
[mcalizo@Rhel82 root]$ docker info | grep Security -A3
Security Options:
seccomp
Profile: default
selinux
[mcalizo@Rhel82 root]$
```
虽然仍然可以在你的 Docker 容器上挂载 Docker 主机中的特定文件系统,但不再允许更新或访问该文件:
```
[mcalizo@Rhel82 root]$ docker run -it --rm -v /:/exploit fedora:latest /bin/bash
[root@ecb5836da1f6 /]# touch /exploit/etc/shadow.sh
touch: cannot touch '/exploit/etc/shadow.sh': Permission denied
[root@ecb5836da1f6 /]#
```
### 了解更多
你在容器世界中的第一道防线取决于你对容器主机的操作系统的设置有多强。有许多方法可以实现 Linux 的安全性,包括市场上可供选择的方案,以增强你的安全态势。
SELinux 是一个额外的安全层,默认情况下内置于 [Linux 发行版](https://www.redhat.com/en/topics/linux/whats-the-best-linux-distro-for-you) 中。为了借助它保护你的系统不被破坏,请确保 SELinux 保持开启状态。
如果你想了解更多,请参阅:
* [如何在 CentOS 8 / RH 上安装 Docker CE](https://www.linuxtechi.com/install-docker-ce-centos-8-rhel-8/)
* [Docker 安全速查表](https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html)
* [dockerd 文档](https://docs.docker.com/engine/reference/commandline/dockerd/)
* [卷的使用文档](https://docs.docker.com/storage/volumes/)
* [什么是 SELinux?](https://www.redhat.com/en/topics/linux/what-is-selinux)
---
via: <https://opensource.com/article/20/11/selinux-containers>
作者:[Mike Calizo](https://opensource.com/users/mcalizo) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | When things aren't working correctly in your Linux environment, the easiest thing to do is disable Security-Enhanced Linux ([SELinux](https://en.wikipedia.org/wiki/Security-Enhanced_Linux)). Things suddenly begin to work, and you forget about it—but this is a common pitfall that means you've lost a very powerful security tool.
Threats are rising alongside the rise of containers, microservices, and distributed architecture. This is due to an old, well-known issue: velocity. The advantage of containers is that they enable you to move fast, do more, and change quickly. This means container adoption has gone off the roof, but the speed it affords also means you will encounter more issues and vulnerabilities. This happens naturally when you're doing more things faster and quicker.
## How to mitigate threats
As Sun Tzu said, "The wise warrior avoids the battle." This quote really resonates when it comes to containers' basic defense. To avoid problems (battles), make sure that your container host is secure and that you can use SELinux as your first line of defense.
SELinux is an open source project released in 2000 and integrated into the Linux kernel in 2003. According to [Red Hat's explainer](https://www.redhat.com/en/topics/linux/what-is-selinux), "SELinux is a security architecture for [Linux systems](https://www.redhat.com/en/topics/linux/what-is-linux) that allows administrators to have more control over who can access the system. It was originally developed by the United States National Security Agency (NSA) as a series of patches to the [Linux kernel](https://www.redhat.com/en/topics/linux/what-is-the-linux-kernel) using Linux Security Modules (LSM)."
## Get started
When you think about containers, the first thing that probably comes into mind is [Docker](https://opensource.com/resources/what-docker). Docker started a container adoption revolution after it emerged in 2013. It is one of the main reasons that containers exploded in popularity, but as mentioned above, the high level of adoption increased users' vulnerability to security risks.
Before you can secure your Docker containers with SELinux, you need to set some things up.
### Prerequisites:
- CentOS 8/RHEL 8 installed and configured
- Docker CE installed and configured
- Two accounts created: root and non-root (
`mcalizo`
in the examples below)
If you need to set up Docker on your RHEL 8/CentOS 8 server, you can follow these [instructions](https://www.linuxtechi.com/install-docker-ce-centos-8-rhel-8/). If you're running RHEL 8, you need to remove the pre-installed Podman and runc packages before beginning.
First, make sure SELinux is enabled:
```
[mcalizo@Rhel82 ~]$ sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Memory protection checking: actual (secure)
Max kernel policy version: 31
[mcalizo@Rhel82 ~]$
```
Then, verify your OS version and that Docker is running. Log in as root and run:
```
[root@rhel82 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.2 (Ootpa)
[root@rhel82 ~]#
[root@rhel82 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-10-28 19:10:14 EDT; 15s ago
Docs: https://docs.docker.com
Main PID: 30768 (dockerd)
Tasks: 8
Memory: 39.0M
CGroup: /system.slice/docker.service
└─30768 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Oct 28 19:10:13 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:13.889602941-04:00" level=error msg=">
Oct 28 19:10:13 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:13.903413613-04:00" level=warning msg>
Oct 28 19:10:13 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:13.903427451-04:00" level=warning msg>
Oct 28 19:10:13 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:13.903538271-04:00" level=info msg="L>
Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.132060506-04:00" level=info msg="D>
Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.308943088-04:00" level=info msg="L>
Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.319438549-04:00" level=info msg="D>
Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.319570298-04:00" level=info msg="D>
Oct 28 19:10:14 rhel82.home.labs.com dockerd[30768]: time="2020-10-28T19:10:14.333419209-04:00" level=info msg="A>
Oct 28 19:10:14 rhel82.home.labs.com systemd[1]: Started Docker Application Container Engine
```
Check your Docker version:
```
[root@rhel82 ~]# docker --version
Docker version 19.03.13, build 4484c46d9d
```
## Hack your host
One of the best ways to understand a problem is to experience it. So, I'll show you how easy it is to inject malicious code into a Docker host if your security is not set up properly.
To be able to do something bad on the Docker host, the malicious non-root user (`mcalizo`
in this tutorial) must be part of the group that can instantiate Docker containers.
First, confirm what group the `mcalizo`
user belongs to:
```
[root@Rhel82 ~]# groups mcalizo
mcalizo : mcalizo
```
The output shows that `mcalizo`
belongs only to its own group. This means `mcalizo`
can't instantiate Docker containers and will get this error if it tries:
```
[mcalizo@Rhel82 ~]$ docker run -it --rm centos:latest /bin/sh
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
```
To allow `mcalizo`
to instantiate the container, add the user to the `docker`
group:
```
[root@Rhel82 ~]# usermod -G docker -a mcalizo
[root@Rhel82 ~]# groups mcalizo
mcalizo : mcalizo docker
```
Next, deploy a `fedora:latest`
container and log into the instantiated container to explore it:
```
[mcalizo@Rhel82 ~]$ docker run -it --rm fedora:latest /bin/sh
Unable to find image 'fedora:latest' locally
latest: Pulling from library/fedora
ee7e89337106: Pull complete
Digest: sha256:b9ec86d36fca7b1d3de39cd7c258e8d90c377d312c21a7748071ce49069b8db4
Status: Downloaded newer image for fedora:latest
sh-5.0# cat /etc/redhat-release
Fedora release 33 (Thirty Three)
```
While you're logged into the newly created container, you can see you are automatically logged in as root:
```
sh-5.0# whoami
root
sh-5.0#
```
As `root`
user, you can do anything in this container, which means you can exploit the container host and do a lot of damage. Because you can instantiate a container, you can do things to the host even if you are not part of the host's sudoers account.
Exit the container you just created, and create a new container to demonstrate the exploit:
```
[mcalizo@Rhel82 ~]$ docker run -it --rm -v /:/exploit fedora:latest /bin/bash
[root@131043f2e306 /]#
```
The [-v option](https://docs.docker.com/storage/volumes/) mounts the Docker host's `/`
directory to the container under the `/exploit`
directory:
```
[root@131043f2e306 /]#ls exploit/
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
```
Because it is mounted, you can do *anything* on the Docker host. For example, you can delete files, edit specific configurations to harm the system, or even install a Trojan horse application or other malware to steal important information.
## Why does this happen?
You may be wondering why this is possible since SELinux is in enforcing mode. Dig deeper into SELinux to see where things went wrong.
Verify that SELinux has a [Docker context](https://docs.docker.com/engine/reference/commandline/context/):
```
[mcalizo@Rhel82 ~]$ ps -eZ | grep docker
system_u:system_r:container_runtime_t:s0 30768 ? 00:00:04 dockerd
[mcalizo@Rhel82 ~]$
```
As expected, it does. This means SELinux manages the Docker daemon. Inspect the Docker daemon to see if SELinux is enabled by default:
```
[mcalizo@Rhel82 ~]$ docker info | grep Security -A3
Security Options:
seccomp
Profile: default
Kernel Version: 4.18.0-193.el8.x86_64
```
SELinux is *not* enabled by default. This is the problem! To fix it, enable SELinux to control and manage Docker by updating or creating the file `/etc/docker/daemon.json`
as [documented here](https://docs.docker.com/engine/reference/commandline/dockerd/) (you must have root access to do this):
```
[root@Rhel82 ~]# cat /etc/docker/daemon.json
{
"selinux-enabled": true
}
[root@Rhel82 ~]#
[root@Rhel82 ~]# systemctl restart docker
```
After creating or updating the file and restarting Docker, you should see that SELinux support is enabled in the Docker daemon:
```
[root@Rhel82 ~]# systemctl restart docker
[mcalizo@Rhel82 root]$ docker info | grep Security -A3
Security Options:
seccomp
Profile: default
selinux
[mcalizo@Rhel82 root]$
```
While it's still possible to mount a specific filesystem in your Docker host on your Docker container, updating or accessing the file is no longer allowed:
```
[mcalizo@Rhel82 root]$ docker run -it --rm -v /:/exploit fedora:latest /bin/bash
[root@ecb5836da1f6 /]# touch /exploit/etc/shadow.sh
touch: cannot touch '/exploit/etc/shadow.sh': Permission denied
[root@ecb5836da1f6 /]#
```
## Learn more
Your first line of defense in the container world depends on how strongly you set up your container hosts' operating system. There are numerous ways to implement Linux security, including options available on the market to augment your security posture.
SELinux is an additional layer of security that is built into [Linux distributions](https://www.redhat.com/en/topics/linux/whats-the-best-linux-distro-for-you) by default. To take advantage of it and protect your system against compromise, make sure SELinux remains on.
If you want to learn more, see:
## Comments are closed. |
14,320 | KDE 与 GNOME:什么是 Linux 桌面的终极选择? | https://itsfoss.com/kde-vs-gnome/ | 2022-03-02T16:09:00 | [
"KDE",
"GNOME"
] | https://linux.cn/article-14320-1.html | 
说到 Linux,<ruby> 桌面环境 <rt> desktop environment </rt></ruby>(DE)是个大问题。
桌面环境构成了图形用户界面(GUI),以及你在 Linux 发行版上得到的一组应用。
你可以通过我们的 [解释什么是桌面环境的文章](https://itsfoss.com/what-is-desktop-environment/) 了解。
选择一个好的桌面环境可以帮助你提高生产力、工作流程、易用性和整体体验。
在 [最佳桌面环境](https://itsfoss.com/best-linux-desktop-environments/) 中,KDE Plasma 和 GNOME 特别受欢迎。在这里,我打算强调其中的关键区别,以帮助你做出决定。
>
> 注意:KDE 是整个社区的人在其名下开发的各种项目。其中桌面环境的名字是 Plasma。在这里,我们将 Plasma 桌面与 GNOME 进行比较。然而,为了简单起见,我们倾向于使用 “KDE” 而不是 “Plasma”。
>
>
>
### 用户界面:功能与外观
用户界面通常涉及到布局类型、图标、主题、小工具和 GUI 的其他组件。
#### KDE
KDE 的目标是提供一个传统的桌面布局,让大多数 Windows 用户感到舒适。

不过,不要被这一点所迷惑。它的外观很简单,但却专注于更多的功能。
事实上,Windows 从 KDE 中获得了灵感,对其用户界面进行了一些改进,比如通过滚动任务栏中的音量图标来调整音量的能力。

而且,KDE 以其一致的外观和感觉而闻名,即使多年来有许多改进。
#### GNOME
另一方面,GNOME 提供了一种独特的桌面体验。如果你正在寻找一个不同的、现代的用户界面设计,GNOME 应该很适合你。
其图标/主题/壁纸可能看起来更符合现代标准。偏好有所侧重,但在我看来,GNOME 看起来更有吸引力。

然而,如果你已经适应了传统的类似 Windows 的布局,调整工作流程可能需要一段时间。
这里没有开始/应用/菜单按钮。你必须点击活动概览来访问你的工作空间(或虚拟桌面),并从同一个地方访问应用菜单。
对一些人来说,没有任务栏可能看起来更干净,但这取决于你的喜好。
请注意,与 KDE 相比,UI 可能没有那么多功能,也没那么丰富。例如,系统托盘中的部件提供了比 GNOME 上的小程序更多的选项。

因此,在 UI 方面,KDE 与 GNOME 并没有明显的赢家,而是取决于你对功能或现代外观的要求。
### 应用生态
#### KDE
使用 KDE,你可以获得 [无数的实用程序](https://apps.kde.org)。
你可能会被 KDE 提供给 KDE 上使用的应用所淹没。

不止如此,整个 KDE 社区都一直忙于为这个武器库添加新的应用和工具。
它们中许多在现有的应用中脱颖而出,如 Krita、Kdenlive、Kate 编辑器等等。
#### GNOME
GNOME 默认也具有 [众多的应用](https://apps.gnome.org/en-GB/)。虽然对于大多数用户来说,这可能是一个足够的列表,但与 KDE 相比,它在目录上有所不足。

我发现自己并没有使用过很多来自 GNOME 的应用。
而且,值得注意的是,与 GNOME 的默认应用相比,KDE 桌面环境自带的应用得到了更快的改进。
这是与 GNOME 应用程序相比的 KDE 的开发更新频度,不过这只是个人观察,这可能会随着时间而改变。
### 什么是最好的定制?
#### KDE
如果你想改造和控制用户体验,KDE 是一个很好的选择。
不要光听我说,你可以按照我们的 [KDE 定制指南](https://itsfoss.com/kde-customization/) 了解可用选项。

不仅仅是定制的能力,你还可以得到很多开箱即用的控制,用于改变主题、颜色、工作区效果、窗口管理等等,而不需要任何特定的应用程序/扩展。
对于一些人来说,如果你想坚持使用原版的体验,这么多的选项也不会产生什么影响,不用担心。
#### GNOME
至于 GNOME,你没有那么多开箱即用的控制。相反,你必须得依靠 GNOME “优化”或一些扩展来改变。但是,是的,你可以在很大程度上自定义体验。

另外,请注意,在写这篇文章的时候,[GNOME 42](https://news.itsfoss.com/gnome-42-features/) 还没有成为稳定版本。所以,你可以期待一个系统级的深色模式的实现,以及一些外观/感觉上的改进。
当然,这不是一个公平的比较,考虑到两者都提供不同的 GUI 元素和布局。然而,对于想要更多控制和定制选项的用户来说,KDE 会被选择。
GNOME 适合于不想要很多选项的用户。如果你喜欢 GNOME 提供的东西,并且愿意用额外的努力来定制体验,你也可以这么做。
### 额外的能力:KDE 与 GNOME
#### GNOME
如前所述,GNOME 提供了给你当前的配置 [增加更多的功能的扩展功能](https://itsfoss.com/gnome-shell-extensions/)。
你可以前往 [GNOME 的 shell 扩展网站](https://extensions.gnome.org) 来探索各种选择,或者看看我们的 [最佳 GNMOE 扩展列表](https://itsfoss.com/best-gnome-extensions/)。

GNOME 扩展让你可以轻松地做很多事情,比如使用自动移动窗口切换器来自动化应用启动的工作区。
有各种各样的扩展来改善你的工作流程,使事情变得简单。
然而,这些扩展取决于 GNOME shell 的版本。此外,由于从一个版本到另一个版本的激进变化,GNOME 扩展可能在未来的版本中停止工作。
#### KDE
另一方面,KDE 也提供了一个充满附加组件、小工具和应用附加组件的袋子。

不像 GNOME 从浏览器中添加扩展的那种不方便的方式(使用另一个浏览器扩展),你可以使用“发现”软件中心直接访问 KDE 的附加组件。

所以,添加额外的功能或主题就变成了一种无缝的体验,而不需要遵循一套单独的步骤。
不要忘了,像 KDE Connect 这样的工具提供了额外的能力,让你把你的手机和你的电脑连接起来。
总的来说,你可以在两者上扩展功能,但如果你想有更多的选择,KDE 更有优势。
### 无障碍选项
#### KDE
虽然 KDE 在几个方面做得很好,但增强桌面无障碍的可用能力非常有限(比如没有开箱即用的屏幕阅读器)。

有一种可能是,开发者正在用 Orca 屏幕阅读器应用来测试其功能,比如桌面的听力/视觉辅助,但在 KDE Plasma 5.24 中,它不够实用。
正如我们的一位读者所指出的,KDE 在安装前后都不能“说话”。所以,这对他们来说不是一个选择。
#### GNOME
然而,GNOME 做得更好,它有读屏器、视觉提醒、屏幕键盘、声音键、点击辅助等。

所以,如果一个用户依赖无障碍选项来使用桌面,GNOME 应该是个选择。
### KDE 比 GNOME 更快?
拥有一个能在可用系统资源下有效工作的桌面环境是很重要的。如果你想进行多任务处理,而又没有超好的配置来支持的话,这一点就显得无比重要。
KDE 通常被认为比其他大多数桌面环境要快,因为它对资源的占用很轻。
然而,为了给你一个参考,我创建了两个虚拟机(Fedora 35 和 KDE Neon 用户版),在你继续尝试之前提供一些想法。
两个虚拟机的设置都使用类似的资源配置,分配了两个核心和 8GB 内存,下面是我们的情况:

这个资源使用情况是在开启虚拟机后,后台没有任何东西运行的情况下的截图。
相比之下,由 KDE 驱动的发行版 KDE Neon 被证明在后台没有运行截图程序的情况下消耗了不到 1GB 的内存。

即使在截图程序运行的情况下,它消耗的资源也较少。
如果这还不能说服你,过去也有许多报告,比如 [Jason 的报告](https://www.forbes.com/sites/jasonevangelho/2019/10/23/bold-prediction-kde-will-steal-the-lightweight-linux-desktop-crown-in-2020/?sh=1338b70026d2),提到 KDE 是比 XFCE 更轻的桌面环境。
### 可用的发行版:GNOME 与 KDE
大多数流行的发行版都将 GNOME 作为默认(或唯一)的桌面环境。Fedora、Ubuntu 和 Pop!\_OS 是流行的例子。
你应该能找到许多有单独的 GNOME 版本的发行版。
至于 KDE,你可以尝试了解一下我们的 [基于 KDE 的发行版](https://itsfoss.com/best-kde-distributions/) 列表,或者寻找像 Kubuntu 这样的选择。在大多数主流发行版中,你可能不会发现 KDE 是默认选择的发行版,但你应该发现几乎所有的发行版都有 KDE 的变体。
### 那么,你应该选择什么来定义你的桌面体验?
对桌面环境的选择带给了你想要的桌面体验。
如果你想要简单、性能和众多的选项/工具,KDE 应该是一个常青的选择。
如果你想要一个现代的/更干净的外观,并且不介意不同的布局(或用户体验),GNOME 可以成为一个不错的补充。
虽然 GNOME 可能无法给你同样多的控制,但你仍然可以用它做很多事情。Pop!\_OS 是一个例子,它将 GNOME 作为桌面环境,并在其上添加扩展/功能,使其成为一个光鲜的桌面发行版。
所以,你需要评估什么对你的用户体验更重要。
**我的看法**:我会选择 GNOME 而不是 KDE,以获得独特/完美的桌面体验。
你会选择什么?请在下面的评论区告诉我你的想法。
### 常见问题:如果你还在为做出选择而感到困惑
看完比较后,你可能会有一些问题,所以我想解决一些潜在的问题:
**1、为什么 KDE 不流行**
KDE 可以说是继 GNOME 之后第二受欢迎的桌面环境。然而,它并不是主流发行版和 Ubuntu、Pop!\_OS、Fedora 等流行选项的默认选择;因此,你可以看到身边都是 GNOME。
**2、GNOME 比 KDE 更稳定吗?**
这两个桌面环境都是由有经验的开发者团队建立的,并定期进行修复和改进。
到目前为止,GNOME 已经有多次彻底的改变。所以,从这个角度来说,KDE 可以被认为是更一致和稳定的体验。
**3、KDE 是否比 GNOME 更快?**
虽然我们已经在文章中试图解决这个问题,但应该注意的是,性能取决于你做什么和可用的系统资源。
对于一些用户来说,最少的资源消耗可能是一个很大的胜利。而对某些人来说,随着可用资源的增加,差异也会逐渐消失。
**4、KDE 比 GNOME 好吗?**
KDE 具有更多的应用、自定义选项和额外的功能。然而,对于那些不希望获得任何此类选项的用户来说,它可能会让人感到不知所措。
如果用户喜欢简洁的用户体验,提供现代的外观,GNOME 可能是一个更好的选择。
归根结底,这都是你的喜好,而不是一个桌面环境的优势。
---
via: <https://itsfoss.com/kde-vs-gnome/>
作者:[Ankush Das](https://itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

When it comes to Linux, the desktop environment is a big deal.
A desktop environment makes up the graphical user interface (GUI) and a set of applications you get on your Linux distribution.
You can go through our [article explaining what a desktop environment is](https://itsfoss.com/what-is-desktop-environment/).
[Linux Jargon Buster: What is Desktop Environment in Linux?One of the most commonly used term in desktop Linux world is Desktop Environment (DE). If you are new to Linux, you should understand this frequently used term. What is Desktop Environment in Linux? A desktop environment is the bundle of components that provide you common graphical user i…](https://itsfoss.com/what-is-desktop-environment/)

Choosing a good desktop environment can help you improve productivity, workflow, ease of use, and overall experience.
And, among the [best desktop environments](https://itsfoss.com/best-linux-desktop-environments/), **KDE Plasma **and **GNOME** are particularly popular. Here, I plan to highlight the key differences to help you decide.
**KDE**is the entire community of people working on various projects under its umbrella. And, the desktop environment is
**Plasma**. Here, we compare the Plasma desktop with GNOME. However, for simplicity, we tend to use “KDE” instead of “Plasma”.
## The User Interface: Functionality vs Look
The user interface generally involves the type of layout, icons, theme, widgets, and other components of a GUI.
The Plasma desktop aims to provide a traditional desktop layout comfortable for most Windows users.

Don’t let that fool you, though—it is simple to look at but focused on more functionalities.
In fact, Windows has taken inspiration from KDE for some of its UI improvements, like the ability to adjust the volume by scrolling the volume icon in the taskbar.

And, KDE is known for its consistent look and feel, even with numerous improvements over the years.
GNOME, on the other hand, provides a unique desktop experience. GNOME should suit you well if you want a different and modern user interface design.
The icons/theme/wallpapers may look better regarding modern standards. There’s a take on preferences, but GNOME looks more attractive, in my opinion.

However, adjusting the workflow could take a while if you are already comfortable with the traditional Windows-like layout.
There’s no start/app/menu button here; you have to click on the Activity Overview to access your workspaces (or virtual desktops) and access the app menu from the same place.
To some, it might look cleaner without a taskbar, but it is up to your preferences.
Note that the UI may not be as functional and rich as KDE. For instance, the widgets in the system tray offer way more options than you get with the applets on GNOME.

So, in terms of UI, KDE vs GNOME does not have a clear winner but depends on your requirements for functionality or a modern look.
## App Ecosystem
With KDE, you get access to [countless utilities](https://apps.kde.org/).
You will probably be overwhelmed with the applications available for KDE by KDE.

In addition to that, the entire KDE community is super busy adding new applications and tools to the arsenal.
Many of them stand out among the available applications like Krita, Kdenlive, Kate Editor, and more.
GNOME also features[ numerous applications](https://apps.gnome.org/en-GB/) by default. While it could be a sufficient list for most users, it falls short on the catalog compared to KDE.

I do not find myself using many apps by GNOME.
And, it is worth noting that the KDE applications that come with the desktop environment get faster improvements when compared to GNOME’s default applications.
It is just a personal observation, considering the development updates by KDE when compared to GNOME applications. However, this can change with time.
## What’s Best for Customization?
KDE is the superior choice if you want to tinker and take control of the user experience.
Don’t take my word for it; you can follow our [KDE customization guide](https://itsfoss.com/kde-customization/) to know the available options.

Not just the ability to customize, but you get a lot of control out-of-the-box for changing the theme, color, workspace effects, window management, and more without the need for any particular application/extension.
For some, the availability of options may not make a difference if you want to stick to the stock experience, no matter what.
As for GNOME, you do not get a lot of out-of-the-box controls. Instead, you will have to rely on GNOME Tweaks or extensions to make some changes. But, yes, you can customize the experience to a good extent.

Also, note that [GNOME 42](https://news.itsfoss.com/gnome-42-features/) was not available as a stable release at the time of writing this. So, you can expect a system-wide dark mode implementation and some improvements in look/feel.
Of course, it’s not an apples-to-apples comparison, considering both offer different GUI elements and layouts. However, KDE gets the pick for users who want more control and customization options.
GNOME is suitable for users who do not want many options. If you like what GNOME offers and are willing to customize the experience with extra effort, you can also do that.
### Extra Abilities: KDE vs GNOME
As mentioned earlier, GNOME offers [extensions to add more functionality](https://itsfoss.com/gnome-shell-extensions/) to your current configuration.
You can head to [GNOME’s shell extension website](https://extensions.gnome.org/) to explore options, or take a look at our [list of the best gnome extensions](https://itsfoss.com/best-gnome-extensions/).

GNOME extensions make it easy to do a bunch of stuff, like automating what workspace an app launches using the auto-move window switcher.
There are all kinds of extensions to improve your workflow and make things easy.
However, the extensions depend on the GNOME shell version. Moreover, due to radical changes from one version to another, GNOME extensions could stop working with future releases.
On the other hand, KDE offers a bag full of add-ons, widgets, and application add-ons as well.

Unlike GNOME’s inconvenient way of adding extensions from a browser (using another browser extension), you can directly access KDE’s add-ons using the Discover software center.

So, it becomes a seamless experience to add extra functionality or a theme without following a separate set of steps.
Not to forget, tools like KDE Connect offer extra abilities, letting you connect your phone with your PC.
Overall, you can extend functionalities on both, but if you want more options, KDE takes the edge.
### Accessibility Options
While KDE does a fantastic job on several aspects, the available abilities to enhance the accessibility of the desktop are extremely limited (like the absence of a screen reader out of the box).

It is a possibility that the developers are testing the screen reader functionality with the Orca Screen Reader app, hearing/visual aids for the desktop, but with KDE Plasma 5.24, it’s not useful enough.
As one of our readers pointed out, KDE can’t talk before or after installation. So, it’s a not an option for them.
However, GNOME does a better job with the availability of a screen reader, visual alerts, screen keyboard, sound keys, click assist, and more options.

So, if a user relies on accessibility options to use the desktop, GNOME should be the pick.
### Is KDE Faster than GNOME?
It is important to have a desktop environment that works efficiently with available system resources. This is incredibly significant if you want to multitask and do not have an extreme configuration to back it up.
KDE is generally considered faster than most other desktop environments because it is light on resources.
However, to give you a reference, I created two VMs (Fedora 35 and KDE Neon User Edition) to provide some idea before you proceed to try.
Both the VM setups shared a similar resource configuration with two cores allocated and 8 GB memory, and here’s what we have:

The resource usage is a screenshot with nothing running in the background, right after turning on the VM.
In contrast, KDE-powered distro KDE Neon proved to consume less than 1 GB of RAM without the spectacle, screenshot app running in the background.

Even with the screenshot app running, it consumes fewer resources out of the box.
If that doesn’t convince you, there have been numerous reports in the past like [Jason’s](https://www.forbes.com/sites/jasonevangelho/2019/10/23/bold-prediction-kde-will-steal-the-lightweight-linux-desktop-crown-in-2020/?sh=1338b70026d2) that have mentioned KDE as the lighter desktop environment over XFCE as well.
## Available Distributions: GNOME vs KDE
Most of the popular offerings feature GNOME as the default (or the only) desktop environment. Fedora, Ubuntu, and Pop!_OS are popular examples.
You should find numerous distributions with separate GNOME editions.
As for KDE, you can try exploring our list o[f KDE-based distros](https://itsfoss.com/best-kde-distributions/), or seek options like Kubuntu. You may not find KDE as the default choice for most mainstream distros, but you should find a KDE variant for almost everything.
## So, What Should You Pick to Define Your Desktop Experience?
The choice of desktop environment gives you the desktop experience you want.
If you want simplicity, performance, and numerous options/tools, KDE should be an evergreen choice.
GNOME can be a fantastic addition if you want a modern/cleaner look and do not mind the different layout (or user experience).
While GNOME may not be able to give you the same amount of control, you can still do many things with it. Pop!_OS gives you an example of having GNOME as the desktop environment and adding extensions/functionality on top of it to make it a polished desktop distribution.
So, you must evaluate what’s more important to your user experience.
**My take**: I’d pick GNOME over KDE for a unique/polished desktop experience.
*What would you pick? Let me know your thoughts in the comments section below.*
[KDE Plasma vs. Xfce: Comparing Lean and Mean Desktop Environments for Linux UsersKDE Plasma and Xfce are two popular desktop environment options for lightweight Linux distributions. While Xfce is still favored more for some of the best lightweight Linux distributions, KDE Plasma is not a resource-heavy desktop either. To help you pick a suitable desktop environment, we…](https://itsfoss.com/kde-vs-xfce/)

## Frequently Asked Questions: If You’re Still Confused to Make a Choice
You might have some questions after reading the comparison, so I’d like to address some of the potential ones:
**1. Why is KDE not Popular?**
KDE is arguably the second-most popular desktop environment after GNOME. However, it isn’t the default choice for mainstream distros and popular options like Ubuntu, Pop!_OS, Fedora; hence, you get to see GNOME around you.
**2. Is GNOME more stable than KDE?**
Both the desktop environments have been built by a skilled team of developers, with regular fixes and improvements.
GNOME has had multiple radical changes so far. So, in that way, KDE can be considered a more consistent and stable experience.
**3. Is KDE Faster than GNOME?**
While we have already tried to address that in our article, it should be noted that the performance depends on what you do and the available system resources.
For some users, the least resource consumption can be a big win. And, for some, with more available resources, the differences fade away.
**4. Is KDE Better than GNOME?**
KDE features more applications, customization options, and extra functionalities. However, it can be overwhelming for users who do not want access to any such options.
If a user prefers a clean user experience providing a modern look, GNOME can be a better pick.*Ultimately, it’s all about your preferences, not the advantages of a desktop environment.* |
14,322 | 在 KDE 中添加、切换、删除和管理 Linux 用户 | https://opensource.com/article/22/2/manage-linux-users-kde | 2022-03-03T10:41:56 | [
"用户"
] | https://linux.cn/article-14322-1.html |
>
> 在一台电脑上维护独立的用户是一种奢侈,也是保护你自己和你关心的人的数据安全的一个好方法。
>
>
>

在一个家庭中共享一台电脑通常是一件很随意的事情。当你需要电脑时,你拿起它并开始使用它。这在理论上很简单,而且大部分情况下是有效的。也就是说,直到你不小心拿起公用电脑,不小心把你的服务器的正常运行时间的截图发到你伴侣的烹饪博客上。然后,就到了建立独立用户帐户的时候了。
从一开始,Linux 就是一个多用户系统。它的设计是把每个用户,只要他们登录,都当作一个独特的人,有一个属于他们自己的桌面,一个独特的网络浏览器配置文件,访问他们自己的文档和文件,等等。KDE Plasma 桌面做了很多工作,使得从一个帐户切换到另一个帐户很容易,但首先你必须为每个你期望使用电脑的人设置一个用户帐户。你也可以为客人设置一个特殊的帐户(我称这个帐户为 `guest`)。
### 在 KDE 中添加用户
在 Linux 上有不同的方法来添加用户。一种方法是系统管理员式的 [使用终端](https://www.redhat.com/sysadmin/linux-commands-manage-users)。当你有很多用户需要添加时,这是非常有效的,所以你想把这个过程自动化或者只是减少鼠标点击的次数。
不过在 Plasma 桌面上,你可以用<ruby> 用户 <rt> Users </rt></ruby>程序来添加用户。<ruby> 用户 <rt> Users </rt></ruby>实际上是<ruby> 系统设置 <rt> System Settings </rt></ruby>中的一个控制面板,但你可以从你的应用菜单中启动它,就像它是一个独立的应用。

要添加一个用户,点击窗口底部的<ruby> 添加新用户 <rt> Add New User </rt></ruby>按钮。

给新用户一个<ruby> 名字 <rt> Name </rt></ruby>和一个<ruby> 用户名 <rt> Username </rt></ruby>。这些可能是相同的,但意图是他们的名字是他们的姓名,而他们的用户名是他们用于使用的入口。例如,我的名字是 “Seth Kenlon”,而我的用户名是 `seth`。
将新用户指定为<ruby> 标准用户 <rt> Standard </rt></ruby>或<ruby> 管理员 <rt> Administraor </rt></ruby>。标准用户只对自己的环境有完全的控制权。他们可以 [安装 Flatpak](https://opensource.com/article/21/11/install-flatpak-linux) 并将数据保存到他们的主目录,但他们不能影响机器上的其他用户。这是有用户帐户的好处之一。我不会认为我允许使用我的电脑的任何人打算删除对我很重要的数据,但意外还是发生了。通过为我自己和我的伴侣创建一个单独的用户帐户,我在保护我们每个人的数据,我也在保护我们每个人,避免意外地移动一个文件或误放对另一个人很重要的数据。
管理员可以进行全系统的更改。我通常在我的电脑上为自己保留这个角色,我也希望我的伴侣在她自己的电脑上为自己保留这个角色。然而,在工作中,这个角色属于 IT 部门。
为用户创建一个<ruby> 密码 <rt> Password </rt></ruby>,并重复<ruby> 确认 <rt> Confirm </rt></ruby>。登录后,新用户可以改变他们的密码。
要完成用户创建,请点击<ruby> 创建 <rt> Create </rt></ruby>按钮。
### 切换用户
在桌面有两种不同的方式来切换用户。你可以注销,然后让另一个用户登录,或者你可以从应用菜单的<ruby> 电源/会话 <rt> Power / Sessions </rt></ruby>子菜单中选择<ruby> 切换用户 <rt> Switch user </rt></ruby>。

当一个新用户登录时,你的当前桌面会被“冻结”或暂停,而另一个用户的新桌面会被调出来。你所有的窗口都保持打开。你甚至可以在游戏中切换用户(如果你正在战斗中,你应该先暂停一下),当你切换回来时,你可以从你离开的地方继续。更好的是,你的所有进程也会继续运行。所以你可以在渲染视频或编译代码时切换用户,当你切换回来时,你的视频已经完成了渲染,或者你的代码已经完成了编译(只要有足够的时间)。

### 删除用户
当我有客人时,我经常在他们的逗留期间创建一个客人帐户,当他们离开后,我就删除这个帐户。
你可以通过删除一个用户的用户帐户来从你的电脑中删除该用户。这将删除他们的所有数据,所以要确保你要删除的用户已经把他们需要的东西从机器上迁移掉了!
<ruby> 删除用户 <rt> Delete User </rt></ruby>按钮位于<ruby> 用户 <rt> Users </rt></ruby>控制面板中的每个用户帐户下,也就是你最初创建用户的地方。

### Linux 用户管理
在计算机上维护独立的用户是一种奢侈,也是保护你自己的数据和你关心的人的数据安全的好方法。它允许每个用户都是独一无二的,并使桌面成为他们自己的。在 Linux 中,这很容易,而且没什么影响,因此可以为朋友、房客和家人创建用户。
---
via: <https://opensource.com/article/22/2/manage-linux-users-kde>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | Sharing a computer in a household is usually a pretty casual affair. When you need the computer, you pick it up and start using it. It's simple in theory, and mostly works. That is, until you accidentally grab the common computer and accidentally post screenshots of your server's uptime to your partner's cooking blog. Then it's time for separate user accounts.
From the very beginning, Linux has been a multi-user system. It's designed to treat each user, so long as they log in, as a unique human being, with a desktop all their own, a unique web browser profile, access to their own documents and files, and so on. The KDE Plasma Desktop does a lot to make it easy to switch from one account to another, but first you must set up a user account for each person who you expect to use a computer. You might also set up a special account for guests (I call this account, pragmatically, **guest**.)
## Add a user in KDE
There are different ways to add users on Linux. One way is the sysadmins-style of [using the terminal](https://www.redhat.com/sysadmin/linux-commands-manage-users). This is very efficient when you have lots of users to add, and so you want to automate the process or just reduce the number of mouse clicks.
In the Plasma Desktop, though, you can add users with the **Users** application. **Users** is actually a control panel in **System Settings**, but you can launch it from your application menu as if it were a stand-alone app.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
To add a user, click the **Add New User** button at the bottom of the window.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
Give the new user a name and a username. These can be the same thing, but the intent is that their name is their birth name, while their username is a simple handle they use for computing. For instance, my name is "Seth Kenlon", while my username is `seth`
.
Designate the new user as either a standard user or an administrator. Standard users have full control over just their own environment. They can [install Flatpaks](https://opensource.com/article/21/11/install-flatpak-linux) and save data to their home directory, but they can't affect other users on the machine. This is one of the advantages of having user accounts. I don't suspect that anyone I allow to use my computer intends to delete data that's important to me, but accidents happen. By creating a separate user account for myself and my partner, I'm protecting each of our data, and I'm protecting each of us individually from accidentally moving a file or misplacing data that's important to the other.
An administrator can make systemwide changes. I usually reserve this for myself on my computer, and I expect my partner to reserve that role for herself on her own computer. At work, however, that role belongs to the IT department.
Create a password for the user. Once logged in, new users can change their passwords.
To finalize user creation, click the **Create** button.
## Switching users
There are two different ways to switch users at the desktop level. You can log out and then let the other user log in, or you can choose **Switch user **from the **Power / Sessions** category in your application menu.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
When a new user logs in, your desktop is "frozen" or paused, and a new desktop is brought up for the other user. All of your windows remain open. You can even switch users in the middle of a game (you should probably pause first if you're in the middle of combat), and when you switch back you can pick right up where you left off. Better still, all of your processes continue to run, too. So you can switch users while rendering video or compiling code, and when you switch back your video will have finished rendering, or your code will have finished compiling (provided enough time has elapsed.)

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
## Deleting a user
When I have house guests, I often create a guest account for the duration of their stay, and then I remove the account once they've gone.
You can remove a user from your computer by deleting their user account. This removes all of their data, so* *make sure that the user you're about to delete has migrated what they need off of the machine!
The **Delete User** button is located in each user account in the **Users** control panel, where you created the user in the first place.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
## Linux user management
Maintaining separate users on a computer is a luxury, and a great way to keep your own data, and the data of those you care about, safe. It allows each user to be unique, and to make the desktop their own. With Linux, it's easy and nondisruptive, so create users for friends, houseguests, and family members.
## Comments are closed. |
14,323 | 2021 总结:DevOps 促进转型的 13 个例子 | https://opensource.com/article/22/1/devops-transformation | 2022-03-03T11:24:34 | [
"DevOps"
] | https://linux.cn/article-14323-1.html |
>
> 2021 年,我们的顶级 DevOps 文章聚焦于工具、最佳实践和最关键的部分:转型。
>
>
>

2021 年对于 DevOps 来说是激动人心的一年,开发团队不断适应远程和混合工作模式。这一年最受欢迎的 DevOps 文章展示了我们的社区如何关注工具、创新、最佳实践和转型。
### DevOps 工具和创新
该行业的工具仍然是读者的首选读物。[Nimisha Mukherjee](https://opensource.com/users/nimisha) 是红帽的一名工程经理,她编写了 [面向开发人员的 13 个开源工具](https://opensource.com/article/21/6/open-source-developer-tools)。她将工具分为“内环”和“外环”两个部分,“内环”是开发人员最常见的任务,“外环”是开发人员的代码通过持续集成和交付(CI/CD)部署到生产环境的地方。
我们的读者对实现 DevOps 工具链的兴趣也很高。首次投稿的 [Tereza Denkova](https://opensource.com/users/tereza-denkova) 是一家 IT 专业服务公司 Accedia 的营销助理,他撰写了 [如何实现 DevOps 工具链](https://opensource.com/article/21/1/devops-tool-chain),并将其与创新紧密联系在一起。
### DevOps 实践
[Daniel Oh](https://opensource.com/users/daniel-oh) 是我们的主要支持者,也是一位多产的内容创作者,他写了 [2021 年需要关注的 3 个无服务器策略](https://opensource.com/article/21/1/devapps-strategies),概述了当今无服务器应用程序开发和部署方法是如何加速采用 DevApps 实践的。
[Evan “Hippy” Satis](https://opensource.com/users/hippyod) 在他的文章 [解决 CI/CD 中的存储库阻抗不匹配](https://opensource.com/article/21/8/impedance-mismatch-cicd) 中提供了调整部署映像和描述符的策略。他是红帽公司的高级顾问,他在文章中采用的有条不紊的方法证明了他的行业经验。另外,请参阅他的文章 [在 shell 中处理模块化和动态配置文件](https://opensource.com/article/21/5/processing-configuration-files-shell)。
在我的文章 [DevOps 文档指南](https://opensource.com/article/21/3/devops-documentation) 中,我提出了让文档成为 DevOps 讨论的一部分的理由。我从读者那里得到了一些有见地的评论,因此我正在为未来的一篇文章跟进这些评论。
### DevOps 转型
我们有时不相信 DevOps 能够适应组织需求。理解其他形式的运维的潜在影响是非常必要的,这些运维可能在现在或将来补充或增强 DevOps。[Bryant Son](https://opensource.com/users/brson),一个自称是<ruby> 章鱼猫 <rt> Octocat </rt></ruby>的人,在 [GitOps 和 DevOps 有何不同?](http://opensource.com/article/21/3/gitops) 中提出 GitOps 是 DevOps 的进化形式。
[Mike Calizo](https://opensource.com/users/mcalizo) 是新西兰奥克兰的一位红帽公司解决方案架构师,他撰写了 [如何成功采用 DevSecOps](https://opensource.com/article/21/2/devsecops)。本文将介绍他作为解决方案架构师的经验。他解释了在你迁移到 DevSecOps 的过程中可能会遇到的一些安全挑战。
我写了一系列关于 DevOps 到 DevSecOps 转型的文章。它们是:
* [启动从 DevOps 到 DevSecOps 的转型](http://opensource.com/article/21/10/devops-to-devsecops)
* [开始 DevSecOps 转型的 3 个阶段](https://opensource.com/article/21/10/first-phases-devsecops-transformation)
* [遵循 DevSecOps 成熟度模型](https://opensource.com/article/21/10/devsecops-maturity-model)
* [DevSecOps 转型的另外 3 个阶段](https://opensource.com/article/21/10/last-phases-devsecops-transformation)
* [使 DevSecOps 的采用成为团队努力的 4 个步骤](https://opensource.com/article/21/10/devsecops-team-effort)
### 2022 年和 DevOps 的未来
看到 DevOps 的文章登上了 2021 年最受欢迎的名单,说明 DevOps 将迎来一个更加有趣的 2022 年,因为组织正在继续掌握他们的工具,改进他们的战略,并继续他们的 [数字化转型](https://enterprisersproject.com/what-is-digital-transformation),以便在不断变化的市场中有效地竞争。
感谢所有阅读我们的 DevOps 文章、喜欢这些文章,并通过网站和社交媒体给我们发送评论的人。
---
via: <https://opensource.com/article/22/1/devops-transformation>
作者:[Will Kelly](https://opensource.com/users/willkelly) 选题:[lujun9972](https://github.com/lujun9972) 译者:[CN-QUAN](https://github.com/CN-QUAN) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 2021 has been an exciting year for DevOps as teams continue to adjust to remote and hybrid working models. The DevOps articles that made our most-read list this year show how our community focuses on tools, innovation, best practices, and transformation.
## DevOps tools and innovation
Tools of the trade continue to rank as a top read for Opensource.com readers. [Nimisha Mukherjee](https://opensource.com/users/nimisha), an engineering manager with Red Hat, wrote [13 open source tools for developers](https://opensource.com/article/21/6/open-source-developer-tools). She breaks tools down by *Inner loop*, the most common tasks developers do, and *Outer loop*, where the developers' code goes through continuous integration and delivery (CI/CD) for deployment to production.
Implementing a DevOps toolchain also ranked high on our reader's interests. A first-time contributor, [Tereza Denkova](https://opensource.com/users/tereza-denkova), Marketing Associate at Accedia, an IT professional services company, wrote [How to implement a DevOps toolchain](https://opensource.com/article/21/1/devops-tool-chain) and eloquently tied it to innovation.
## DevOps practices
[Daniel Oh](https://opensource.com/users/daniel-oh), a major champion for Opensource.com and a prolific content creator in his own right, wrote [3 serverless strategies to look for in 2021](https://opensource.com/article/21/1/devapps-strategies), giving an overview of how serverless application development and deployment approaches are accelerating the adoption of DevApps practices today.
[Evan "Hippy" Slatis](https://opensource.com/users/hippyod) offers strategies for aligning deployment images and descriptors in his article [Solve the repository impedance mismatch in CI/CD](https://opensource.com/article/21/8/impedance-mismatch-cicd). He's a senior consultant for Red Hat, and the methodical approach he takes in his article testifies to his industry experience. Also, check out his article entitled [Processing modular and dynamic configuration files in shell](https://opensource.com/article/21/5/processing-configuration-files-shell).
In my article [A DevOps guide to documentation](https://opensource.com/article/21/3/devops-documentation), I made a case for documentation to become part of the DevOps discussion. I got some insightful comments from readers that I'm in the process of following up on for a future article.
## DevOps transformation
We sometimes don't give DevOps credit for its ability to adapt to organizational needs. It's essential to understand the potential impact of other forms of Ops that may supplement or augment DevOps now or in the future. [Bryant Son](https://opensource.com/users/brson), a self-described Octocat, makes the case that GitOps is an evolved form of DevOps in [GitOps vs. DevOps: What's the difference?](http://opensource.com/article/21/3/gitops)
[Mike Calizo](https://opensource.com/users/mcalizo), a Red Hat solutions architect based in Auckland, New Zealand, wrote [How to adopt DevSecOps successfully](https://opensource.com/article/21/2/devsecops). His experience as a solutions architect shines through in this article. He explains some of the adoption and security challenges you might face in your move to DevSecOps.
I wrote a series of articles about DevOps to DevSecOps transformation that made the list. Here they are:
[Launching a DevOps to DevSecOps transformation](http://opensource.com/article/21/10/devops-to-devsecops)[3 phases to start a DevSecOps transformation](https://opensource.com/article/21/10/first-phases-devsecops-transformation)[Following a DevSecOps maturity model](https://opensource.com/article/21/10/devsecops-maturity-model)[3 more phases of DevSecOps transformation](https://opensource.com/article/21/10/last-phases-devsecops-transformation)[4 steps to make DevSecOps adoption a team effort](https://opensource.com/article/21/10/devsecops-team-effort)
## 2022 and the future of DevOps
Seeing the DevOps articles that made the most-read list for 2021 speaks to an even more interesting 2022 for DevOps as organizations continue to master their tools, improve their strategies, and continue their [digital transformation](https://enterprisersproject.com/what-is-digital-transformation) to compete effectively in an ever-changing marketplace.
Thank you to everyone who read our DevOps articles, liked them, and sent us comments via the site and social media.
## Comments are closed. |
14,325 | 4 个用于提高生产力的 Vim 功能 | https://opensource.com/article/22/3/vim-features-productivity | 2022-03-04T10:21:24 | [
"Vim"
] | /article-14325-1.html |
>
> Vim 有很多技巧,即使是用过它很多年的人仍然可以学习新东西。
>
>
>

Vim 总在那里。Vim 是当今最流行的文本编辑器之一。这在很大程度上是因为它随处可见。当你通过 SSH 连接到另一个系统时,你可能找不到 [Emacs](https://opensource.com/article/20/3/getting-started-emacs)、[Nano](https://opensource.com/article/20/12/gnu-nano) 或 [VSCodium](https://opensource.com/article/20/6/open-source-alternatives-vs-code),但你可以放心,Vim 就在那里。
在本文中,我介绍了一些你可以用 Vim 做的中级事情,以加快你的工作流程并通常让你的一天更轻松。本文假设你以前使用过 Vim,已经了解编辑器的基础知识,并希望将你的 Vim 技能提高一个档次。Vim 充满了有用的技巧,没有人真正掌握它,但本文中的五个技巧可以提高你的技能,并希望让你更加爱上最受欢迎和喜爱的文本编辑器之一。
### Vim 书签
Vim 提供了一种在文本中添加书签的简单方法。假设你正在编辑一个大文件,并且当前的编辑会话要求你在文件中不同位置的两段文本之间来回跳转。
首先,你输入 `m`(用于标记)为当前位置设置一个书签,然后为其命名。例如,如果我正在编辑的文件中有一个名称列表,我想稍后再跳回,我可以使用 `mn`(n 表示名称)为文件的该部分添加书签。
稍后,在编辑文件的另一部分并希望跳回该名称列表时,我有两个选项。我可以输入 ``n`(反引号 n)转到书签的位置,或者我可以键入 `'n`(单引号 n)转到书签所在行的开头。
当我不再需要书签时,我可以使用 `:delmarks n` 将其删除。`:marks` 会显示我所有的书签。
请注意,我使用小写字母来命名我的书签。这是故意的。你可以使用小写字母作为本地书签,使用大写字母来使书签在多个文件中具有全局性。
### Vim 用户定义的缩写
如果你正在处理的文本有一个长词或短语多次出现,那么每次都完整地输入它会很快变得烦人。幸运的是,Vim 提供了一种创建缩写的简单方法。
要将 `Acme Painted Fake Roadways, Inc.` 的用户定义缩写设置为 `apfr`, 你需要输入 `:ab apfr Acme Painted Fake Roadways, Inc.`。现在当在编辑模式时,当你在输入 `apfr` 后面更上空格,就会变成 `Acme Painted Fake Roadways, Inc.`。
当你关闭 Vim 会话时,你使用 `:ab` 设置的任何缩写都会丢失。如果你想在此之前取消设置缩写,你可输入 `:una apfr`。
### Vim 自动补全
许多人没有意识到 Vim 带有自动补全功能。如果你在文件中输入以前使用过的长词,这是一个方便的工具。
假设你正在撰写一篇文章,多次使用 `Antarctica` 一词。使用一次后,下次你可以只输入前几个字母。例如,你输入 `Ant` 然后按下 `Ctrl+P`。 Vim 要么补全单词(如果只有一个选项),要么为你提供可以用箭头键选择的单词列表,继续输入以进一步缩小搜索范围并使用 `Tab` 键选择单词。
### Vim 范围选择
使用 Vim,你可以轻松地对文件中的一系列行执行操作。你可以通过起始行号、逗号和结束行号(包括)来指示范围。除了文字行号之外,你还可以使用句点(`.`)表示当前行,使用美元符号 (`$`) 表示文件缓冲区中的最后一行,以及使用百分号(`%`)表示整个文件。
这里举几个例子来说明。
如果要删除第 2 到 10 行,请输入(在命令模式下):
```
:2,10d
```
要删除从第 25 行到文件末尾的每一行:
```
:25,$d
```
你可以使用以下命令删除每一行:
```
:%d
```
要将第 5 到 10 行复制(或转移)到第 15 行之后:
```
:5,10t 15
```
要将第 5 行到第 10 行移动到第 15 行之后(而不是复制):
```
:5,10m 15
```
### Vim 提高生产力
我希望这篇文章教会了你一些关于 Vim 文本编辑器的新知识。 Vim 有很多技巧,即使是使用了多年的人仍然可以学习新事物。总有一些新的和有用的东西可以学习。
---
via: <https://opensource.com/article/22/3/vim-features-productivity>
作者:[Hunter Coleman](https://opensource.com/users/hunterc) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | HTTPSConnectionPool(host='opensource.com', port=443): Read timed out. (read timeout=10) | null |
14,326 | 简简单单的 Vim 就很好 | https://opensource.com/article/21/12/vanilla-vim-config | 2022-03-04T16:16:09 | [
"Vim"
] | https://linux.cn/article-14326-1.html |
>
> 这就是我如何从 35 个 Vim 插件降到只有 6 个的原因。
>
>
>

当你用 `—clean` 选项启动 Vim 时,它以 “素” 模式展示 Vim。没有插件、没有配置,一切回到了最初。多年来,我收集了一堆配置语句,其中一些可以追溯到 MS-DOS 或 Windows 3.1 时期。我是这样打算的:从头开始,只用 Fedora 35 中可用的插件,找到一个好的配置起点。我可以在一周的编码生活中生存下来吗?我会找到答案的!
规则是这样的:尽可能少的配置语句,并且只使用 Fedora 35+ 中的插件。顺便说一下,如果你不是 Fedora 用户,也请继续阅读。你可以随时从你的操作系统软件包管理器手动安装或者使用 Vim 插件管理器安装这些插件。
在我开始之前,有一个大问题需要解决:用 Vim 还是 Neovim(Vim 的一个复刻)。好吧,这由你决定。这篇文章中的所有内容应该对两者都适用。然而,我只用 Vim 测试过。当你登录到一个只有 `vi` 可用的服务器时,所有的这些技能都会派上用场。它可以是一个旧的 UNIX 系统、一个安装了最少的软件以提高安全性的 Linux 服务器、一个容器中的交互式 shell,或者一个空间宝贵的嵌入式系统。
闲话少说,下面是我提炼出来的使用 Vim 进行编码的绝对最低限度的东西:
```
# dnf install --allowerasing vim-default-editor \
vim-enhanced \
vim-ctrlp \
vim-airline \
vim-trailing-whitespace \
vim-fugitive \
vim-ale \
ctags
```
不要担心 `—allowerasing` 选项。在确认之前,只需查看一下安装的东西。这个选项的作用是告诉软件包管理器把现有的 `nano-default-editor` 包替换为 `vim-default-editor`。这是一个小软件包,它在 shell 配置文件中将 `EDITOR` 环境变量设置为 `vim`,如果你想默认使用 Vim(例如,与 `git` 一起使用),这是必须的。这是专门针对 Fedora 的。你不需要在其他发行版或操作系统上这样做,只要确保你的 `EDITOR` shell 变量被正确设置就行。
### 概览
简单介绍一下我认为好的、干净的插件集:
* **CtrlP**:尽可能小的模糊查找插件(纯 vimscript)
* **Fugitive**:一个 git 的必备工具
* **Trailing-whitespace**:显示并修复(删除)尾部的空格
* **Airline**:一个改进的状态行(纯 vimscript)
* **Ale**:在你打字时高亮显示错别字或语法错误
* **Ctags**:不是 Vim 插件,但却是一个非常需要的工具
还有其他的模糊查找插件,如 command-t 或我最喜欢的 `fzf.vim`(非常快)。问题是,`fzf.vim` 不在 Fedora 中,而我想要尽可能少的配置。CtrlP 就可以了,而且配置它更容易,因为它不需要什么依赖。
如果让我选择一个绝对最小的配置,那就是:
```
# cat ~/.vimrc
let mapleader=","
let maplocalleader="_"
filetype plugin indent on
let g:ctrlp_map = '<leader><leader>'
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
set exrc
set secure
```
但这可能太极端了,所以这里是一个稍大的配置,下面是我的详细解释:
```
" vim: nowrap sw=2 sts=2 ts=2 et:
" leaders
let mapleader=","
let maplocalleader="_"
" filetype and intent
filetype plugin indent on
" incompatible plugins
if has('syntax') && has('eval')
packadd! matchit
end
" be SSD friendly (can be dangerous!)
"set directory=/tmp
" move backups away from projects
set backupdir=~/.vimbackup
" fuzzy searching
let g:ctrlp_map = '<leader><leader>'
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
nnoremap <leader>b :CtrlPBuffer<cr>
nnoremap <leader>t :CtrlPTag<cr>
nnoremap <leader>f :CtrlPBufTag<cr>
nnoremap <leader>q :CtrlPQuickfix<cr>
nnoremap <leader>m :CtrlPMRU<cr>
" buffers and quickfix
function! ToggleQuickFix()
if empty(filter(getwininfo(), 'v:val.quickfix'))
copen
else
cclose
endif
endfunction
nnoremap <leader>w :call ToggleQuickFix()<cr>
nnoremap <leader>d :bd<cr>
" searching ang grepping
nnoremap <leader>g :copen<cr>:Ggrep!<SPACE>
nnoremap K :Ggrep "\b<C-R><C-W>\b"<cr>:cw<cr>
nnoremap <leader>s :set hlsearch! hlsearch?<cr>
" ctags generation
nnoremap <leader>c :!ctags -R .<cr><cr>
" per-project configs
set exrc
set secure
```
### 使用逗号作为引导键
我喜欢把我的 `引导键` 映射成逗号 `,`,而不是默认的反斜杠 `\`。当你的手处于书写位置时,它是 Vim 中最接近的自由键。另外,这个键在大多数键盘布局中都是一样的,而 `\` 在每个型号或布局都不一样。我很少使用 `本地引导键`,但下划线 `_` 看起来很合适。
延伸阅读:
* 参见 [Vim 参考手册](https://vimhelp.org/map.txt.html#map-which-keys) 中的 `:help map-which-keys`。
* 参见 [Vim Tips Wiki](https://vim.fandom.com/wiki/Unused_keys) 中的 Vim 中未使用的键。
### 文件类型和关闭语法高亮
接下来是非常重要的 `filetype` 命令。看,Vim 自带“内置电池”,8.2 版本包含 644 种语言的语法高亮,251 个文件类型定义(`ftplugins`),以及 138 种语言的缩进规则。然而,缩进在默认情况下是不启用的,也许是为了给所有人提供一个一致的编辑体验。我喜欢启用它。
一个简单的技巧:如果你正在编辑一个非常大的文件,并且 Vim 感觉很慢,你可能想禁用语法高亮来加快速度。只要输入 `:syn off` 命令即可。
延伸阅读:
* 参见 [Vim 参考手册](https://vimhelp.org/filetype.txt.html) 中的 `:help filetype`。
* 参见 [Vim 参考手册](https://vimhelp.org/syntax.txt.html) 中的 `:help syntax`。
* 参见 [Vim 参考手册](https://vimhelp.org/indent.txt.html) 中的 `:help indent`。
### Matchit 插件
Vim 甚至额外带有使得一些功能不兼容的插件,其中一个相当有用。它就是 `matchit` 插件,它使按下 `%` 键可以在某些语言中查找匹配的括号。通常情况下,你可以找到一个块的开始或结束(开始和结束括号)或 HTML 匹配标签及类似的。
延伸阅读:
* 参见 [Vim 参考手册](https://vimhelp.org/usr_05.txt.html#matchit-install) 中的 `:help matchit`。
### 交换文件
我想从我的旧配置中保留的许多设置之一是使用 `/tmp` 进行交换,并在我的家目录的一个单独目录中创建备份,你需要用 `mkdir ~/.vimbackup` 来创建这个目录。重要的是要明白,当你开始编辑时,Vim 会创建一个名为 “交换文件” 的副本,所有未保存的工作都会保存在这个文件中。所以即使停电了,你的交换文件也包含了大部分未保存的工作。我更喜欢使用 `tmpfs`,因为我所有的笔记本电脑和服务器都有 UPS 保护,而且我经常保存。另外,大多数情况下,你会使用到交换文件是当你的 SSH 连接丢失而不是由于停电时。对于大文件来说,交换文件可能相当大,我很珍视我的固态硬盘,所以我决定这样做。如果你不确定,可以删除这句话,使用 `/var/tmp`,这样更安全。
延伸阅读;
* 参见 [Vim 参考手册](https://vimhelp.org/recover.txt.html#swap-file) 中的 `:help swap-file`。
### 模糊寻找插件
现在,模糊查找是一个我不能没有的插件。在服务器上当你每天需要打开 20 个文件时,使用 `:Ex` 或 `:e` 或 `:tabe` 等命令打开文件是没问题的。而当编码时,我通常需要打开数百个文件。正如我所说,CtrlP 很好地完成了这项工作。它很小,没有依赖性,纯 Vim。它用 `Ctrl + P` 组合键打开,这对我来说有点奇怪。我知道一些著名的编辑器(我记得是 VSCode)使用这个组合键。问题是,这已经是很重要的 Vim 绑定键,我不想覆盖它。所以对我来说,赢家是 `引导键 + 引导键`(逗号按两次)。
`ctrlp_user_command` 只是改变了 CtrlP 获取文件列表的方式。它不使用内置的递归文件列表(glob),而是使用 `git ls-files`,这通常更好,因为它忽略了 `.gitignore` 中的东西,所以像 `node_modules` 或其他可能拖慢列表的不相关目录不会受到影响。
使用 `引导键` + `B`/`T`/`F`/`Q`/`M` 来打开缓冲区、标签、当前文件的标签、快速修复缓冲区和最近使用的文件的列表,非常有用。具体来说,一旦你用 `ctags` 生成了标签列表,这基本上就是数百种编程语言的“去……定义处”,而且不需要插件!这都是 Vim 内置的。现在澄清一下,当我说输入 `引导键 + B` 时,是指按下逗号,然后按 `B` 键,而不是像用 `Control` 或 `Shift` 那样一起按。
延伸阅读:
* 参见 [Vim 参考手册](https://vimhelp.org/pi_netrw.txt.html#netrw-explore) 中的 `:help Explore`。
* 参见 [ctrlp.vim GitHub](https://github.com/kien/ctrlp.vim)。
### 缓冲区管理
虽然现在 Vim 支持标签,但缓冲区管理是掌握 Vim 的一个重要技能。我通常会有很多缓冲区,我需要经常做 `:bdelete`。那么,`引导键 + D` 似乎是一个不错的选择,可以更快地完成这个任务。我也喜欢关闭 Quickfix 窗口,所以也有 `引导键 + W` 的组合键,我在浏览搜索结果时经常使用这个功能。
延伸阅读:
* 参见 [Vim 参考手册](https://vimhelp.org/windows.txt.html#buffer-hidden) 中的 `:help buffer-hidden`。
### Ggrep 和 fugitive 插件
说到搜索,它和打开文件一样重要。我希望能够对代码库进行检索。为此,有一个来自 fugitive 插件的很棒的 `:Ggrep` 命令,它使用 `git grep`,忽略了垃圾文件,只搜索 Git 中的内容。由于 `Shift + K` 是 Vim 中的一个自由键,它非常适用于自动检索光标位置的词语。最后,能够使用 `引导键 + G` 输入任意的搜索模式也很好。注意,这将打开一个叫做 Quickfix 的窗口,你可以在这里浏览结果、查看下一个/上一个/最后一个/第一个出现的地方,等等。这个窗口也用于编译器或其他工具的输出,所以要熟悉它。如果你对此感到陌生,我建议进一步阅读文档。
延伸阅读:
* 参见 [Vim 参考手册](https://vimhelp.org/quickfix.txt.html) 中的 `:help quickfix`。
* 参见 [vim-fugitive GitHub](https://github.com/tpope/vim-fugitive)。
### 用 fugitive 进行搜索、检索
顺便说一下,用 `/` 键搜索是智能和大小写敏感的,这意味着如果所有的搜索字符都是小写的,Vim 的搜索会忽略大小写。默认情况下,它会高亮显示结果,我觉得我已经敲了无数次的 `:noh`(来关闭高亮显示)。这就是为什么我有 `引导键 + S` 来切换高亮显示。我建议以后也多读读手册中关于搜索的内容。
接下来是搜索、检索。fugitive 插件已经为你提供了。使用命令 `:Ggrep pattern` 来进行 `git grep`,结果会进入 Quickfix 窗口。然后简单地使用快速修复命令(`:cn`、`:cp` 等等)浏览结果,或者简单地使用 `:CtrlPQuickfix`(`引导键 + Q`)来直观地滚动它们。CtrlP 的快速修复整合的酷炫之处是,你可以通过输入以匹配文件名或内容来进一步在搜索结果中搜索。
延伸阅读:
* 参见 [Vim 参考手册](https://vimhelp.org/quickfix.txt.html#grep) 中的 `:help grep`。
* 参见 [Vim 参考手册](https://vimhelp.org/pattern.txt.html#noh) 中的 `:help noh`。
* 参见 [vim-fugitive GitHub](https://github.com/tpope/vim-fugitive) 。
### Ctags
`引导键 + C` 可以生成一个 ctags 文件,以便更好地导航,这在处理一个新的代码库或做一个有很多跳转的较长的编码任务时很有用。ctags 支持数百种语言,而 Vim 可以利用所有这些知识来导航。后面会有更多关于如何配置它的内容。注意我已经讨论过 `引导键 + T` 来打开所有标签的模糊搜索,记得吗?这两个是非常相同的。
延伸阅读:
* 参见 [Vim 参考手册](https://vimhelp.org/tagsrch.txt.html) 中的 `:help ctags`。
* 参见 [Universal Ctags 网站](https://ctags.io)。
### 按键映射
能够通过在项目目录下创建一个 `.vimrc` 文件来覆盖该项目中的任何设置是一个好主意。只要把它放在(全局的) `.gitignore` 中,以确保你不需要在每个项目中编辑成千上万的 `.gitignore` 文件。这样的一个项目的 `.vimrc` 可以是这样的(对于使用 GNU Makefile 的 C/C++ 项目):
```
" coding style
set tabstop=4
set softtabstop=4
set shiftwidth=4
set noexpandtab
" include and autocomplete path
let &path.="/usr/local/include"
" function keys to build and run the project
nnoremap <F9> :wall!<cr>:make!<cr><cr>
nnoremap <F10> :!LD_LIBRARY_PATH=/usr/local/lib ./project<cr><cr>
```
正如你所看到的,我通常将 `F2` 到 `F10` 等键映射到编译、运行、测试和类似的操作。用 `F9` 来调用 `make`,听起来不错。还记得 MS-DOS 上的蓝色 Borland IDE 吗?
如前所述,在全局范围内忽略 `.vimrc` 和(由 `ctags` 生成的)`tags` 是个好主意,所以不需要每次都更新 `.gitignore`:
```
# git config --global core.excludesfile ~/.gitignore
# cat ~/.gitignore
/.vimrc
/tags
/TAGS
```
在我的个人配置中还有几条只与那些非美国键盘布局的人有关(我用捷克语)。我需要用“死键”来输入许多字符(LCTT 译注:“死键”是一种通过将变音符号与后面的字母结合起来打出重音字符的方法。这种方法在历史上被用于机械打字机),这根本不可能,我宁愿输入命令而不是按那些难以按下的组合键。这里有一个解决问题的办法:
```
" CTRL-] is hard on my keyboard layout
map <C-K> <C-]>
" CTRL-^ is hard on my keyboard layout
nnoremap <F1> :b#<cr>
nnoremap <F2> :bp<cr>
nnoremap <F3> :bn<cr>
" I hate entering Ex mode by accident
map Q <Nop>
```
延伸阅读:
* 参见 [Vim 参考手册](https://vimhelp.org/map.txt.html) 中的 `:help map`。
功能键在 Vim 中都是自由的,除了 `F1`,它被绑定在帮助上。我不需要帮助,并不是说我已经会对 Vim 了如指掌,并不是。但如果需要的话,我可以简单地输入 `:help`。而 `F1` 是一个关键的键,离 `Esc` 键如此之近。我喜欢将它用于缓冲区交换(`:b#`),将 `F2`/`F3` 用作下一个/上一个。你越是与缓冲区打交道,你就越需要这个。如果你没有使用过 `Ctrl + ^`,我建议你要习惯于它。哦,你有没有丑陋地输入 `:visual` 进入过 Ex 模式?许多初学者都不知道如何从该模式下退出 Vim。对我来说,这就是打扰,因为我很少使用它。
现在,熟悉 `ctags` 是成功使用 Vim 的一个关键因素。这个工具支持数百种语言,它不小心就为你不想创建标签的文件创建它,因此我建议忽略典型的垃圾目录:
```
# cat ~/.ctags.d/local.ctags
--recurse=yes
--exclude=.git
--exclude=build/
--exclude=.svn
--exclude=vendor/*
--exclude=node_modules/*
--exclude=public/webpack/*
--exclude=db/*
--exclude=log/*
--exclude=test/*
--exclude=tests/*
--exclude=\*.min.\*
--exclude=\*.swp
--exclude=\*.bak
--exclude=\*.pyc
--exclude=\*.class
--exclude=\*.cache
```
### Airline 插件
我一定不能忘记 Vim 的 Airline 插件。在 Fedora 的两个插件中,这个插件很轻量级,不需要外部依赖,而且可以开箱即用我所有的字体。你可以定制它,而且还有主题之类的东西。我只是碰巧喜欢它的默认设置。
我必须提到,有两个主要的 Ctags 项目:Exuberant Ctags 和 Universal Ctags。后者是一个更现代的复刻。如果你的发行版有,就用它。如果你在 Fedora 35+ 上,你应该知道你现在用的是 Universal Ctags。
### 总结
作为总结,我的建议是这样的。尽量保持你的 Vim 配置流畅和干净。这将在未来得到回报。在我转换到新配置之后,我不得不重新学习“写入并退出”的命令,因为我总是不小心把它打成 `:Wq`,而我在旧的配置里有一个“小技巧”,让它实际上按我的意思工作。好吧,这个可能真的很有用,并能入选,我希望你能明白我的意思:
```
:command Wq wq
:command WQ wq
```
最后的一个快速技巧是:你可能需要经常改变你的默认 Vim 配置,来找到我在这里向你介绍的和你自己口味之间的舒适区。使用下面的别名,这样你就不需要一直搜索历史。相信我,当一个 Vim 用户在命令历史里搜索 “vim” 时,找不到什么是相关的内容:
```
alias vim-vimrc='vim ~/.vimrc'
```
就是这些了。也许这可以帮助你在没有大量插件的情况下在 Vim 的丰富世界遨游。“简简单单” 的 Vim 也很不错!
要尝试你刚刚读到的内容,请安装软件包并检出这些配置:
```
test -f ~/.vimrc && mv ~/.vimrc ~/.vimrc.backup
curl -s https://raw.githubusercontent.com/lzap/vim-lzap/master/.vimrc -o ~/.vimrc
mkdir ~/.vimbackup
```
特别感谢 Marc Deop 和 [Melanie Corr](https://opensource.com/users/melanie-corr) 对本文的审阅。
### 更新
我已经在这种配置下生存下来了!我唯一的纠结是 CtrlP 插件的结果顺序不同。文件的模糊算法与 `fzf.vim` 插件不同,所以我以前用各种搜索词能找到的文件现在找不到了。我最后安装了 Fedora 的 fzf 包以获得更相关的文件搜索,它附带了一个 vim 函数 `FZF`,可以绑定到引导键组合上。请看我的 [GitHub 仓库](https://github.com/lzap) 中更新后的配置文件。一路走来,我学到了很多东西。有一些键的绑定我已经忘记了,这要感谢许多插件。
这篇文章最初发表在 [作者的网站](https://lukas.zapletalovi.com/2021/11/a-sane-vim-configuration-for-fedora.html) 上,经许可后重新发表。
---
via: <https://opensource.com/article/21/12/vanilla-vim-config>
作者:[Lukáš Zapletal](https://opensource.com/users/lzap) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | When you start Vim with the `--clean`
option, it shows up in "vanilla" mode. No plugins, no configuration, just back to the roots. I have collected a ton of configuration statements over the years, some of them dating from MS-DOS or Windows 3.1. Here is the deal: I will start from scratch to find a good starting-point configuration with just the plugins available in Fedora 35. Will I survive a week of coding? I'll find out!
Here are the rules: Minimum possible configuration statements and only plugins which ship with Fedora 35+. By the way, if you are not a Fedora user, continue reading. You can always install these plugins from your OS package manager manually or using a Vim plugin manager.
Before I start, there's the elephant in the room: Vim or Neovim (fork of Vim) question. Well, this is up to you. Everything that is in this article should work for both. However, I only tested with Vim. All the skills will come in handy when you log on to a server where only `vi`
is available. It can be either an old UNIX system, a Linux server with minimum software installed for better security, an interactive shell in a container, or an embedded system where space is precious.
Without further ado, here is what I distilled to the absolute bare minimum to be effective with Vim for coding:
```
# dnf install --allowerasing vim-default-editor \
vim-enhanced \
vim-ctrlp \
vim-airline \
vim-trailing-whitespace \
vim-fugitive \
vim-ale \
ctags
```
Do not worry about the `--allowerasing`
option. Just review the installation transaction before confirming. This option is there to tell the package manager to replace the existing package `nano-default-editor`
with `vim-default-editor`
. It is a small package that drops shell configuration files to set the EDITOR environment variable to `vim`
, and this is a must-have if you want to use Vim (for example, with git). This is a special thing for Fedora. You will not need to do this on other distributions or OSes—just make sure your EDITOR shell variable is correctly set.
## Overview
A quick overview of what I consider a good and clean plugin set:
**CtrlP**: Smallest possible fuzzy-finder plugin (pure vimscript)**Fugitive**: A must-have tool for git**Trailing-whitespace**: Shows and fixes, well, trailing whitespace**Airline**: An improved status line (pure vimscript)**Ale**: Highlights typos or syntax errors as you type**Ctags**: Not a Vim plugin but a very much needed tool
There are other fuzzy-finder plugins like command-t or my favorite (very fast) `fzf.vim`
. The thing is, `fzf.vim`
is not in Fedora, and I want the smallest possible configuration. CtrlP will do just fine, and it is much easier to configure as it requires nothing.
If I were to choose an absolute minimum configuration it would be:
```
# cat ~/.vimrc
let mapleader=","
let maplocalleader="_"
filetype plugin indent on
let g:ctrlp_map = '<leader><leader>'
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
set exrc
set secure
```
But that is probably too extreme, so here is a slightly bigger configuration with my detailed explanation below:
```
" vim: nowrap sw=2 sts=2 ts=2 et:
" leaders
let mapleader=","
let maplocalleader="_"
" filetype and intent
filetype plugin indent on
" incompatible plugins
if has('syntax') && has('eval')
packadd! matchit
end
" be SSD friendly (can be dangerous!)
"set directory=/tmp
" move backups away from projects
set backupdir=~/.vimbackup
" fuzzy searching
let g:ctrlp_map = '<leader><leader>'
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
nnoremap <leader>b :CtrlPBuffer<cr>
nnoremap <leader>t :CtrlPTag<cr>
nnoremap <leader>f :CtrlPBufTag<cr>
nnoremap <leader>q :CtrlPQuickfix<cr>
nnoremap <leader>m :CtrlPMRU<cr>
" buffers and quickfix
function! ToggleQuickFix()
if empty(filter(getwininfo(), 'v:val.quickfix'))
copen
else
cclose
endif
endfunction
nnoremap <leader>w :call ToggleQuickFix()<cr>
nnoremap <leader>d :bd<cr>
" searching ang grepping
nnoremap <leader>g :copen<cr>:Ggrep!<SPACE>
nnoremap K :Ggrep "\b<C-R><C-W>\b"<cr>:cw<cr>
nnoremap <leader>s :set hlsearch! hlsearch?<cr>
" ctags generation
nnoremap <leader>c :!ctags -R .<cr><cr>
" per-project configs
set exrc
set secure
```
## Using a comma for leader key
I like having my leader key mapped to a comma instead of the default backslash. It is the closest free key in Vim when your hands are in writing position. Also, this key is the same in most keyboard layouts while `\`
varies per model or layout. I rarely use a local leader but underscore looks like a good fit.
Further reading:
- See
`:help map-which-keys`
in the[Vim Reference Manual](https://vimhelp.org/map.txt.html#map-which-keys) - See the unused keys in Vim on the
[Vim Tips Wiki](https://vim.fandom.com/wiki/Unused_keys)
## Filetype and syntax off
Next up is the very important `filetype`
command. See, Vim comes with "batteries included," version 8.2 contains syntax highlighting for 644 languages, 251 filetype definitions (`ftplugins`
), and indentation rules for 138 languages. However, indentation is not enabled by default, perhaps to deliver a consistent editing experience for all. I like to enable it.
A quick tip: If you are editing a very large file and Vim feels slow, you may want to disable syntax highlighting to speed things up. Just the type `:syn off`
command.
Further reading:
- See
`:help filetype`
in the[Vim Reference Manual](https://vimhelp.org/filetype.txt.html) - See
`:help syntax`
in the[Vim Reference Manual](https://vimhelp.org/syntax.txt.html) - See
`:help indent`
in the[Vim Reference Manual](https://vimhelp.org/indent.txt.html)
## Matchit plugin
Vim even comes with some extra plugins, which makes some features incompatible, one of these is quite useful. It is the `matchit`
plugin that makes `%`
key find matching parens to work with some languages. Typically, you can find the beginning or end of a block (begin and end) or HTML matching tags and similar.
Further reading:
- See
`:help matchit`
in the[Vim Reference Manual](https://vimhelp.org/usr_05.txt.html#matchit-install)
## Swap file
One of the many settings I want to keep from my old config is using `/tmp`
for swap and creating backups in a separate directory in my home, which you need to create with `mkdir ~/.vimbackup`
. It is important to understand that Vim creates a copy called "swap file" when you start editing, and all the unsaved work gets saved in this file. So even if there is a power outage, your swap contains most of the unsaved work. I prefer using `tmpfs`
as all my laptops and servers are protected with UPS, and I save often. Also, most of the time, you use swap files when your SSH connection is lost rather than due to a power outage. Swap files can be quite big for large files and I value my SSD, so I am making the decision here. If you are unsure, remove this statement to use `/var/tmp`
, which is safer.
Further reading:
- See
`:help swap-file`
in the[Vim Reference Manual](https://vimhelp.org/recover.txt.html#swap-file)
## Fuzzy-finder plugin
Now, the fuzzy finder is a plugin I cannot live without. Opening files using commands like `:Ex`
or `:e`
or `:tabe`
is okay on a server when you need to open like 20 files a day. When coding, I usually need to open hundreds of them. As I said, CtrlP does the job nicely. It is small, with no dependencies—pure Vim. It opens with the **Ctrl**+**P** combination, which is a bit weird to me. I know that some famous editors use it (VSCode, I think). The thing is, these are already important Vim keybindings that I do not want to override. So the winner for me is **leader**+**leader** (comma pressed twice).
The `ctrlp_user_command`
just changes how CtrlP is getting the file list. Instead of the built-in recursive file lister (glob) it uses `git ls-files`
which is usually better as it ignores things from `.gitignore`
, so things like `node_modules`
or other irrelevant directories that can slow down the listing are not in the way.
**Leader**+**B**/**T**/**F**/**Q**/**M** to open a list of buffers, tags, tags from the current file, quick fix buffer, and most recently used files is very useful. Specifically, once you generated a `taglist`
with `ctags`
, this is essentially "Go To Definition" for hundreds of programming languages—no plugins needed! This is all built-in in Vim. Now to put things straight, when I type **leader**+**B**, it means pressing comma and then pressing **B** key, not together like with **Control** or **Shift**.
Further reading:
- See
`:help Explore`
in the[Vim Reference Manual](https://vimhelp.org/pi_netrw.txt.html#netrw-explore) - See the
[ctrlp.vim GitHub](https://github.com/kien/ctrlp.vim)
## Buffer management
Although Vim supports tabs these days, buffer management is an important skill for mastering Vim. I usually end up with too many buffers and I need to do `:bdelete`
way too often. Well, **leader**+**D** seems like a good option to do that faster. I also like to close the Quickfix window, so there is the **leader**+**W** combination for that too. I use this very often when browsing search results.
Further reading:
- See
`:help buffer-hidden`
in the[Vim Reference Manual](https://vimhelp.org/windows.txt.html#buffer-hidden)
## Ggrep and the fugitive plugin
Speaking about searching, it is as important as opening files. I want to be able to grep the codebase. For that, there is the awesome `:Ggrep`
command from the fugitive plugin, which uses git grep, which ignores junk files and only searches what's in git. Since **Shift**+**K** is a free key in Vim, it is a great fit for automatically grepping the term under the cursor. And finally, being able to enter arbitrary search patterns using **leader**+**G** is also nice. Note this opens a window called the Quickfix window where you can navigate the results, go to next occurrence, previous, last, first, and more. The same window is used for output from compilators or other tools, so get familiar with it. I suggest further reading in the documentation if this is new to you.
Further reading:
- See
`:help quickfix`
in the[Vim Reference Manual](https://vimhelp.org/quickfix.txt.html) - See the
[vim-fugitive GitHub](https://github.com/tpope/vim-fugitive)
## Searching and grepping with fugitive
By the way, searching with `/`
key is smart and sensitive, meaning if all characters are lower case, Vim searches ignoring case. By default, it highlights results, and I think I typed `:noh`
(turn of highlighting) about a million times. That's why I have **leader**+**S** to toggle this. I suggest reading more about searching in the manual later on too.
Searching and grepping are next. The fugitive plugin has you covered. Use the command `:Ggrep pattern`
to do a git grep, and results will go into the Quickfix window. Then simply navigate through the results using quick fix commands (`:cn`
, `:cp`
, and such) or simply use `:CtrlPQuickfix`
(or **leader**+**Q**) to scroll them visually. What is cool about the CtrlP quick fix integration is that you can further search the results by typing to match filenames or content if it makes sense—searching the search results.
Further reading:
- See
`:help grep`
in the[Vim Reference Manual](https://vimhelp.org/quickfix.txt.html#grep) - See
`:help noh`
in the[Vim Reference Manual](https://vimhelp.org/pattern.txt.html#noh) - See the
[vim-fugitive GitHub](https://github.com/tpope/vim-fugitive)
## Ctags
**Leader**+**C** to generate a `ctags`
file for better navigation is useful when dealing with a new codebase or doing a longer coding session with lots of jumps around. Ctags supports hundreds of languages, and Vim can use all this knowledge to navigate it. More about how to configure it later. Note I already discussed **leader**+**T** to open fuzzy search for all tags, remember? It is the very same thing.
Further reading:
- See
`:help ctags`
in the[Vim Reference Manual](https://vimhelp.org/tagsrch.txt.html) - See the
[Universal Ctags website](https://ctags.io)
## Key mapping
Being able to override any other setting in projects by creating a `.vimrc`
file in a project directory is a good idea. Just put it in the (global) `.gitignore`
to ensure you don't need to edit thousands of git ignore files in each project. Such a project `.vimrc`
could be something like (for C/C++ project with GNU Makefile):
```
" coding style
set tabstop=4
set softtabstop=4
set shiftwidth=4
set noexpandtab
" include and autocomplete path
let &path.="/usr/local/include"
" function keys to build and run the project
nnoremap <F9> :wall!<cr>:make!<cr><cr>
nnoremap <F10> :!LD_LIBRARY_PATH=/usr/local/lib ./project<cr><cr>
```
As you can see, I typically map **F2**-**F10** keys to compile, run, test, and similar actions. Using **F9** for calling `make`
sounds about right. Remember the blue Borland IDE from MS-DOS?
As mentioned earlier, it is a good idea to ignore both `.vimrc`
and `tags`
(generated by `ctags`
) globally so there is no need to update every each `.gitignore`
:
```
# git config --global core.excludesfile ~/.gitignore
# cat ~/.gitignore
/.vimrc
/tags
/TAGS
```
A few more statements in my personal config are only relevant for those with non-US keyboard layouts (I am on Czech). I need to use dead keys for many characters, and it is simply not possible, and I'd rather type the command instead of doing those hard-to-reach combinations. Here is a solution to the problem:
```
" CTRL-] is hard on my keyboard layout
map <C-K> <C-]>
" CTRL-^ is hard on my keyboard layout
nnoremap <F1> :b#<cr>
nnoremap <F2> :bp<cr>
nnoremap <F3> :bn<cr>
" I hate entering Ex mode by accident
map Q <Nop>
```
Further reading:
- See
`:help map`
in the[Vim Reference Manual](https://vimhelp.org/map.txt.html)
Function keys are all free in Vim, except **F1**, which is bound to help. I don't need help, not that I would already know everything about Vim. Not at all. But I can simply type `:help`
if needed. And **F1** is a crucial key, so close to the **Esc** key. I like to use buffer swapping (`:b#`
) for that and **F2**-**F3** for next/previous. The more you work with buffers, the more you will need this. If you haven't used **Ctrl**+**^**, I suggest getting used to it. Oh, have you ever entered the Ex mode with the ugly type `:visual`
? Many beginners had no idea how to quit Vim from that mode. For me, it is just disturbing as I rarely use it.
Now, getting familiar with `ctags`
is a key thing to be successful with Vim. This tool supports hundreds of languages and it can easily create tags for files you do not want to create, therefore I suggest ignoring typical junk directories:
```
# cat ~/.ctags.d/local.ctags
--recurse=yes
--exclude=.git
--exclude=build/
--exclude=.svn
--exclude=vendor/*
--exclude=node_modules/*
--exclude=public/webpack/*
--exclude=db/*
--exclude=log/*
--exclude=test/*
--exclude=tests/*
--exclude=\*.min.\*
--exclude=\*.swp
--exclude=\*.bak
--exclude=\*.pyc
--exclude=\*.class
--exclude=\*.cache
```
## Airline plugin
I must not forget about the Vim airline plugin. Out of the two in Fedora, this one is light, no external dependencies are needed, and it works out of the box with all my fonts. You can customize it, and there are themes and such things. I just happen to like the default setting.
I must mention that there are two main `ctag`
projects: Exuberant Ctags and Universal Ctags. The latter is a more modern fork. If your distribution has it, use that. If you are on Fedora 35+, you need to know that you are now on Universal Ctags.
## Wrap up
As I wrap it up, here is what I suggest. Try to keep your Vim configuration slick and clean. It will pay off in the future. After I switched, I had to re-learn the "write and quit" commands because I was typing it as `:Wq`
accidentally all the time, and I had a "hack" in the old configuration that actually did what I meant. Okay, this one might be actually useful and make the cut—I hope you get what I mean:
```
:command Wq wq
:command WQ wq
```
Here is a final quick tip: You may need to change your default Vim configuration a lot while finding the sweet spot of what I presented you here and your own taste. Use the following alias, so you don't need to search the history all the time. Trust me, when a Vim user searches history for "vim," nothing is relevant:
`alias vim-vimrc='vim ~/.vimrc'`
There you have it. Maybe this can help you navigate through the rich world of Vim without a ton of plugins. *Vanilla* Vim is fun!
To try out what you just read, install the packages and check out the config:
```
test -f ~/.vimrc && mv ~/.vimrc ~/.vimrc.backup
curl -s https://raw.githubusercontent.com/lzap/vim-lzap/master/.vimrc -o ~/.vimrc
mkdir ~/.vimbackup
```
Special thanks to Marc Deop and [Melanie Corr](https://opensource.com/users/melanie-corr) for reviewing this article.
**Update:** I've survived! The only struggle I had was the different order of results from the CtrlP plugin. The fuzzy algorithm for files is different from the `fzf.vim`
plugin, so files that I used to find using various search terms do not work now. I ended up installing the fzf package from Fedora, which ships with a vim function FZF that can be bound to the leader combination for a more relevant file search. See the updated configuration file in my [GitHub repository](https://github.com/lzap). I've learned a lot along the way. There are keybinding which I've already forgotten thanks to many plugins.
*This article originally appeared on the author's website and is republished with permission.*
## Comments are closed. |
14,328 | Vim 与 nano:你应该选择哪个? | https://itsfoss.com/vim-vs-nano/ | 2022-03-05T11:13:04 | [
"Vim",
"nano"
] | https://linux.cn/article-14328-1.html | 我们需要利用文本编辑器来做笔记、写程序,或者编辑系统配置文件来完成一些事情。
不管你用来做什么,你的 Linux 发行版已经预装了文本编辑器。
你很可能会注意到一些 [最好的现代文本编辑器](https://itsfoss.com/best-modern-open-source-code-editors-for-linux/),如 Gedit、Geany、Kate 等,它们已经预装在你的 Linux 发行版中。然而,这些都是基于 GUI 的程序。
如果你想通过终端访问文本编辑器怎么办?你应该发现它也内置在你的 Linux 发行版中了。

Vim 和 nano 是最流行的 [CLI 文本编辑器](https://itsfoss.com/command-line-text-editors-linux/) 之二。
但是,是什么让它们如此受欢迎?你应该选择哪个作为你的文本编辑器?让我指出一下 Vim 和 nano 的区别,以帮助你决定。
### 1、基于终端的编辑器介绍
nano 和 Vim 都提供了大部分的基本功能。虽然 nano 在大多数 Linux 发行版上是内置的,但你必须手动安装 Vim。
为了比较这两者,让我给你简单介绍一下这两者。
#### Vim

Vim 是 “Vi” 文本编辑器的改进版,开发于 1991 年。Vim 是 “<ruby> Vi 改进版 <rt> Vi IMproved </rt></ruby>” 的意思。
Vi 是一个基于终端的文本编辑器,最初于 1976 年为 Unix 操作系统而开发。Vim 是它的一个具有现代功能的增强版。
考虑到它的各种功能可以帮助编辑程序文件,它也被称为“程序员的文本编辑器”。虽然它提供了一些高级功能,但你也可以用来编辑纯文本文件。
#### GNU nano

GNU nano(我们在文章中称它为 “nano”)是一个简单的基于终端的文本编辑器,其灵感来自于 Pico —— 这个基于 Unix 的文本编辑器是华盛顿大学 1989 年开发的 Pine 电子邮件套件的一部分。
Pico 文本编辑器没有 GPL(许可证),这使得它很难被纳入 Linux 发行版。
因此,nano 被开发出来作为它的自由软件替代品。nano 编辑器最初被称为 “tip”,然后在 Richard Stallman 宣布它成为正式的 GNU 程序之前重新命名为 nano。
这个编辑器的亮点是它的易用性和极小的学习曲线。你不一定需要成为程序员才能使用 nano。
### 2、功能差异
下面是 Vim 和 nano 的主要功能差异:
#### Vim 的主要特点
* 多级撤销
* 语法高亮
* 命令行编辑
* 文件名补完
* 多窗口和缓冲区
* 折叠
* 会话
* 支持宏
#### nano 的主要特点
* 打开多个文件
* 逐行滚动
* 撤销/重做
* 语法着色
* 行号
请注意,一般来说,Vim 提供了更高级的功能。然而,它们都提供了编辑系统配置文件、编程和文本编辑等基本功能。
### 3、用作文本编辑器
在 Vim 或 nano 中打开一个文件很简单,只要输入你想使用的编辑器的名字,然后再输入文件的路径。路径可以是文件的绝对路径,也可以是文件的相对路径。
```
vim Documents/text.txt
```
```
nano Documents/text.txt
```
但是,除了用作文本编辑器访问或打开一个文件之外,还有很多功能,对吗?
如果你想快速比较一下,这里有一些基于我的使用情况的比较点:
Vim:
* 模式驱动的编辑器
* 在开始时有巨大的学习曲线
* 会话恢复
* 语法高亮/着色
* 提供高级功能
nano:
* 易于使用(经常使用的功能及其组合键列在底部)
* 不存在学习曲线
* 旨在进行快速编辑
nano 和 Vim 的主要区别在于,它们的目标受众非常不同。
#### Vim
Vim 是一个模式驱动的编辑器。这意味着字母、数字和标点符号键在按下时都要做一件独特的事情,而不是在屏幕上打出一个字符。
这些模式包括:
* 正常模式
* 视觉模式
* 插入模式
* 命令行命令
* 命令行编辑
默认情况下,当你启动 Vim 时,它以 **正常** 模式打开。每个键都有其独特的功能,不会立即开始输入所按下的字符。
不管什么模式,如果你愿意,你也可以 [把 Vim 配置成一个写作工具](https://news.itsfoss.com/configuring-vim-writing/)。
要知道更多关于这些有趣的事情,你可以参考我们关于 [基本 Vim 命令](https://linuxhandbook.com/basic-vim-commands/) 以及 [Vim 技巧和窍门](https://itsfoss.com/pro-vim-tips/) 的文章。

在正常模式下,按特定的键会移动你的光标。
例如,如果你按下 `l`(小写字母 L),它将把光标向右移动一个字符,按 `h` 键将把光标向左移动一个字符。
如果你想把光标向下移动一行,你就按 `j` 键,如果要把光标向上移动一行,你应该按 `k` 键。
在正常模式下 `l`、`k`、`j`、`h` 是导航键。虽然你可以用方向键来移动,但这样做更有效率。
这些是 Vim 中的基本导航键。
接下来最常用的键是 `w`、`b`、`e`:
* 按 `w` 键可将光标移到下一个词。如果它已经在一个词的开头,它就会移动到下一个词的开头。
* 按 `b` 键,光标会移到左边的词的开头。
* 而 `e` 键,则将光标移到右边的词的末尾。
你甚至可以用这些键混合数字(作为前缀)。例如,按 `6w` 可以将光标向前(向右)移动六个词。
如果你想进入一个模式,你必须按类似的组合键:
* `i` 为插入模式
* `CTRL+C` 回到正常模式
* `:wq` 写入文件并关闭窗口。
最后,我们已经 [列出了退出 Vim 的多种方法](https://itsfoss.com/how-to-exit-vim/),如果你想了解一下的话。
这只是冰山一角。要学习更多关于 Vim 的知识,你可以使用`vimtutor` 命令,它可以给你提供大多数基本命令的信息,如删除、编辑、保存文件等。

#### GNU nano
nano 有一个基本的交互界面,在窗口的底部给你提供关键信息。
要想有个初步的了解,你可以参考我们的 [nano 编辑器指南](https://itsfoss.com/nano-editor-guide/)。
![Terminal screen when you launch nano without argumentswithoutarguments] [13](https://i0.wp.com/itsfoss.com/wp-content/uploads/2022/01/03_nano_interface.webp?resize=800%2C430&ssl=1)
你不需要参考手册页或任何文档来执行基本操作。这就是为什么与 Vim 相比,nano 被认为是用户友好的。
尽管如此,nano 中使用的一些术语仍然是“旧术语”,一个例子是 “<ruby> 写出 <rt> Write Out </rt></ruby>”、“<ruby> 在哪里 <rt> Where Is </rt></ruby>”短语,而不是分别用“<ruby> 保存 <rt> Save </rt></ruby>”和“<ruby> 查找 <rt> Find </rt></ruby>”。
但是,这并不是什么大问题。
虽然很容易习惯,但它与使用记事本或 Gedit(GUI 程序)并不完全相同。
例如,在大多数现代编辑器中,执行剪切操作的组合键通常是 `Ctrl + X`,但在 nano 中,它是 `Ctrl + K`。
符号 `^` 是用来表示将 `Ctrl` 键作为修饰键使用,并与旁边的键组合使用。
你还可以找到像 `Ctrl + F`(将光标向前移动)、`Ctrl + B`(将光标向后移动)这样的组合键。一些快捷键包括:
* `Ctrl + X` 退出
* `Ctrl + O` 写入(或保存为)
* `Alt + U` 撤销上一个动作
* `Ctrl + ←` 向后退一个字
* `Ctrl + →` 向前进一个字
你可以看看 [GNU nano 的官方速查表](https://www.nano-editor.org/dist/latest/cheatsheet.html) 来学习更多的快捷键。
总的来说,nano 是一个更适合初学者的编辑器,当你只想偶尔编辑一个文件时,它可以简单地让你完成。
### 4、学习曲线
考虑到上面的所有信息,你一定已经意识到 Vim 与你所习惯的传统文本编辑器不同。
这是真的,这就是为什么 Vim 在学习的初始阶段会显得很艰难。
然而,对于高级用户来说,使用宏、自动补完等高级能力很重要,可以节省时间。
因此,如果你是一个程序员,或者碰巧经常编辑许多文件,Vim 的学习曲线可能是富有成效的。
另一方面,nano 提供了极小的学习曲线,而且感觉比基于图形用户界面的文本编辑器如 Gedit 或 Notepad 更让你熟悉。
### 哪个是最适合你的?
Vim 和 nano 都是合格的基于终端的文本编辑器。但是,当涉及到你如何与上述编辑器互动和使用时,它们有很大的不同。
Vim 很灵活,可以适应各种工作流程,前提是你已经习惯了它的工作方式。
相比之下,nano 工作起来很简单,可以帮助你编辑任何你想要的东西。
如果你还不确定,我建议先开始使用 nano。而且,如果你认为你需要更快地完成工作,并且想要更多的功能,那么就换成 Vim。
### 常见的问题
继续,让我来谈谈几个问题,这将有助于你获得一个良好的开端。
**Vim 比 nano 好吗?**
从技术上讲,是的。但是,如果你不需要它提供的所有功能,使用起来可能会感到力不从心。
**程序员是否使用 Vim?**
系统管理员和程序员喜欢 Vim 的高级功能。所以,是的,他们倾向于使用它。
**nano 是否更受欢迎?**
可以说是的。nano 是一个基于终端的编辑器,被大多数用户使用。此外,它还内置在大多数 Linux 发行版中。
因此,它在用户中普遍受欢迎,而 Vim 仍然是一个为特定人群服务的编辑器。
---
via: <https://itsfoss.com/vim-vs-nano/>
作者:[Pratham Patel](https://itsfoss.com/author/pratham/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

We need to utilize the text editor to take notes, write a program, or edit a system configuration file to get something done.
Your Linux distribution already comes pre-installed with text editors, no matter the requirements.
You will most likely notice some of the [best modern text editors](https://itsfoss.com/best-modern-open-source-code-editors-for-linux/) like Gedit, Geany, Kate, etc., pre-installed in your Linux distribution. However, these are all GUI-based programs.
What if you want to access a text editor through the terminal? You should also find it built-in to your Linux distribution.

Vim and Nano are some of the most popular [CLI text editors](https://itsfoss.com/command-line-text-editors-linux/).
But, what makes them so popular? What should you pick as your text editor? Let me highlight the differences between Vim and nano to help you decide.
## 1. Introducing the Terminal-based Editors
nano and Vim offer most of the essential features. While nano comes built-in on most Linux distros, you will have to install Vim manually.
To compare the two, let me give you a brief introduction to both.
### Vim

Vim is a bettered version of the “Vi” text editor, developed in 1991. Hence, Vim stands for “Vi improved”
Vi was a terminal-based text editor initially developed for the Unix operating system in 1976. So, Vim is an enhanced version of it, with modern capabilities.
It is also referred to as a “programmer’s text editor”, considering it features various features that can help edit program files. While it offers some advanced functionalities, you can also edit plain text files.
### GNU nano

GNU nano (or we call it “nano” throughout the article) is a simple terminal-based text editor inspired by Pico. This Unix-based text editor was a part of Pine email suite developed by The University of Washington in 1989.
Pico text editor did not feature a GPL (license), which made it tough to include in Linux distros.
So, nano was developed as a free replacement to it. The nano editor was initially known as “tip” and then renamed right before Richard Stallman declared it an official GNU program.
The striking highlight of this editor is its ease of use and minimal learning curve. You do not necessarily need to be a programmer to use nano.
## 2. Feature Differences
Here are the key feature differences between Vim and nano.
### Key Features of Vim
- Multi-level Undo
- Syntax highlighting
- Command line editing
- Filename completion
- Multi-windows and buffers
- Folds
- Sessions
- Macro
### Key Features of Nano
- Opening multiple files
- Scrolling per line
- Undo/Redo
- Syntax coloring
- Line Numbering
Note that, Vim, in general, offers more advanced functionalities. However, both of them offer the essentials for editing system configuration files, programming, and text editing.
## 3. Using the Text Editors
Opening a file in Vim or nano is as easy as typing the name of the editor you want to use, followed by the file’s path. The path can be either absolute or a relative path to the file:
```
vim Documents/text.txt
nano Documents/text.txt
```
But there’s much more than just accessing or opening a file using the text editor, right?
If you want a quick list of things, here are some comparison points based on my usage:
Vim | Nano |
---|---|
Mode-driven editor | Easy to use (frequently usable functions and their key combos are listed at the bottom) |
Huge learning curve in the beginning | Non-existent learning curve |
Session recovery | Meant for quick edits |
Syntax highlighting/coloring | |
Offers advanced capabilities |
The primary difference between nano and Vim is that the intended audiences are very different.
### Vim
Vim is a mode-driven editor. That means alphabetical, numeric and punctuation keys all have to do a unique thing when pressed—instead of typing out a character on screen.
The modes include:
- Normal mode
- Visual mode
- Insert mode
- Command-line command
- Command-line editing
By default, when you launch Vim, it opens in the **Normal** mode. Each key has its unique function and does not immediately start typing the characters pressed.
Even with all the modes, you can [configure Vim as a writing tool](https://news.itsfoss.com/configuring-vim-writing/) if you want.
To know more about such exciting things, you can refer to our resource on [basic Vim commands](https://linuxhandbook.com/basic-vim-commands/) and [Vim tips and tricks article](https://itsfoss.com/pro-vim-tips/) as well.

In the normal mode, pressing specific keys will move your cursor.
For example, if you press ‘l’ (lowercase L), it will move the cursor to one character right, pressing ‘h’ key will move the cursor one character to the left.
If you want to move the cursor one line down, you press the ‘j’ key and, to move it back up one line, you should press the ‘k’ key.
Making **l+k+j+h** the navigational keys in the normal mode. While you can use the arrow keys to move around, it’s just more efficient this way.
**These are the basic navigational keys in Vim.**
The next most commonly used keys are ‘**w’, ‘b’, ‘e’**.
- Pressing the ‘
**w**‘ key moves the cursor to the next word. If it already at the start of a word, it moves to the start of the next word. - Pressing the ‘
**b**‘ key moves the cursor to the beginning of the word on the left. - And, the ‘e’ key moves the cursor to the end of the word on the right.
You can even mix numbers (as prefixes) with these keys. For instance, pressing ‘6w’ will move the cursor six words forward.
If you want to get into a mode, you will have to press key combinations like:
**i**for insert mode**CTRL+C**for going back to the normal mode**:wq**for writing to the file and closing the window
Ultimately, we have [listed multiple ways to exit Vim](https://itsfoss.com/how-to-exit-vim/), if you’re curious.
It’s just the tip of the iceberg. To learn more about Vim, you can use the** vimtutor** command that gives you information on most basic commands to delete, edit, save a file, etc.

### GNU nano
Nano has a basic interface for interaction that gives you critical information at the bottom of the window.
To get a head start, you can refer to our [nano editor guide](https://itsfoss.com/nano-editor-guide/).

You do not need to refer to the man page or any documentation to perform the basic actions. This is why nano is considered user-friendly, compared to Vim.
That being said, a few terms used in nano are still “old terminologies”—an example being the “Write Out”, “Where Is” phrases instead of “Save” and “Find” respectively.
But, that’s not a big deal.
While it is easy to get used to, it isn’t entirely the same as using Notepad or Gedit (GUI programs).
For example, the key combination to perform the cut operation is usually “Ctrl + X” in most modern-day editors but in nano, it is “Ctrl + K”.
The “**^**” symbol is used to denote the use of the Ctrl key as a modifier key and used with the combination with the key(s) next to it.
You also find key combinations like Ctrl + F (to move the cursor forward), Ctrl + B (navigate backward). Some shortcuts include:
**Ctrl + X**to exit**Ctrl + O**to write (or save as)**Alt + U**to undo last action**Ctrl + ←**one word backward**Ctrl + →**one word forward
You can take a look at [GNU Nano’s official cheat sheet](https://www.nano-editor.org/dist/latest/cheatsheet.html) to learn more shortcuts.
Overall, nano is a more beginner-friendly editor that simply gets out of your way when all you want to do is edit a file once in a while.
[How to Use Nano Text Editor in Linux [With Cheat Sheet]Though Nano is less complicated to use than Vim and Emacs, it doesn’t mean Nano cannot be overwhelming. Learn how to use the Nano text editor.](https://itsfoss.com/nano-editor-guide/)

## 4. The learning curve
Considering all the information above, you must have realized that Vim is distinct from the traditional text editor that you’re used to.
That is true, which is why Vim can seem tough in the initial stage of learning.
However, for power users, advanced abilities like using macros, auto-completion, and others matter, and can save time.
So, if you are a programmer, or happen to edit numerous files every now often, Vim’s learning curve can be fruitful.
On the other side, nano offers a minimal learning curve, and can feel more familiar to GUI-based text editors like Gedit or Notepad.
## What’s Best for You? Vim vs Nano
Vim and nano are both capable terminal-based text editors. But they differ drastically when it comes to how you want to interact with and use said editor.
Vim is flexible and can adapt to a variety of workflows, assuming that you get used to how it works.
In contrast, nano is simple to work with and can help you edit anything you want.
If you’re still not sure, I recommend starting using nano first. And, if you think that you need to get things done faster, and want more features, switch to Vim.
## Frequently Asked Questions
Moving forward, let me address a few questions that will help you get a head start:
**Is Vim better than nano?**
Technically, yes. But, if you do not require all of its features offered, it could feel overwhelming to use.
**Do programmers use Vim?**
System administrators and programmers love Vim for its advanced capabilities. So, yes, they tend to use it.
**Is nano more popular?**
Arguably yes. Nano is a terminal-based editor used by most users. Furthermore, it comes built-in with most Linux distributions.
Hence, it is generally popular among users, while Vim remains an editor for a specific group of people. |
14,329 | 用 Juk 在 Linux 上听你喜欢的音乐 | https://opensource.com/article/22/2/listen-music-linux-juk-kde | 2022-03-05T18:02:25 | [
"音乐"
] | /article-14329-1.html |
>
> Juk 是 Linux 上的 KDE Plasma 桌面的默认开源音乐播放器。
>
>
>

KDE 项目不只是提供了一个著名的桌面,它还产生了很多软件,从 [视频编辑](https://opensource.com/article/21/12/kdenlive-linux-creative-app)、[摄影](https://opensource.com/life/16/5/how-use-digikam-photo-management) 和 [插图](https://opensource.com/article/21/12/krita-digital-paint) 工具,到图形计算器、电子邮件和办公工作。这些都是生产力工具,但 KDE 也适合于放松。它有游戏和媒体播放器,而我使用的音乐播放器是 [Juk](https://juk.kde.org/)。
### 在 Linux 上安装 Juk
只要你的 Linux 发行版提供 KDE 软件包,你就可以用你的包管理器安装 Juk。
在 Fedora、Mageia 和类似发行版上:
```
$ sudo dnf install juk
```
在 Elementary、Linux Mint 和其他基于 Debian 的发行版上:
```
$ sudo apt install juk
```
### 使用 Juk
当你第一次启动 Juk 时,你会被问到你想用什么目录作为你的音乐集的来源。选择你希望 Juk 寻找音乐的文件夹,并可选择排除你希望 Juk 忽略的任何子目录。

取决于你有多少音乐,Juk 可能需要一些时间来解析文件系统和元数据。当它完成后,通常的 Juk 窗口就会出现,你所有的音乐都在一个叫做“<ruby> 收藏列表 <rt> Collection List </rt></ruby>”的中央收藏列表中。

在顶部的搜索栏中,你可以在任何领域搜索任何字符串。双击歌曲,开始播放。
Juk 默认为连续播放,这意味着在它播放完你的选择后,它会继续播放收藏列表中的下一首歌曲,即使你已经将你的列表过滤到只有一首歌曲。这使音乐总是会不断播放,就像一个真正的点唱机。
就我个人而言,我更喜欢听完整的专辑,中间有足够的休息时间去厨房喝咖啡,所以我使用播放列表。
### Juk 中的播放列表
Juk 中的播放列表可以包含你收藏列表中的任何内容。Juk 会在播放列表中播放一次,然后停止。
要创建一个播放列表,在左边的播放列表栏中点击右键,在出现的上下文菜单中选择 “<ruby> 新建 <rt> New </rt></ruby>”。你可以创建一个空的播放列表,或者从你硬盘上的特定文件夹中创建一个播放列表。

### 自动播放列表
你还可以创建一个与特定搜索绑定的特殊播放列表,这对那些你经常购买并添加到你的收藏中的艺术家很有用。有了搜索播放列表,他们的新音乐就会被添加到他们的播放列表中,而无需你的手动干预。
### 打标签
让我们面对现实吧,音乐播放器是一堆一堆的出现,而且它们大多都做同样的事情。然而,Juk 增加了一个重要的功能。它让你有能力修改元数据标签。

很多音乐的标签是不一致的、不完整的,或者根本就没有,所以当你发现它们出现在播放队列中时,能够纠正它们是一种奢侈。
它还有一个标签猜测器的功能,它试图解析文件名,并对歌曲进行相应的标记。
### 明显的选择
当你在 KDE 上寻找一个音乐播放器时,Juk 是一个简单而明显的选择。当然,还有很多其他非常好的选择,正如我们的常驻发烧友 [Chris Hermansen](https://opensource.com/users/clhermansen) 在他的 [3 个开源音乐播放器](https://opensource.com/article/17/1/open-source-music-players) 文章中详细介绍的那样,但有时你只是想使用你最容易想到的东西。Juk 既能直观地使用,又能出色地完成它的任务。它是多么幸运啊,成为 KDE Plasma 桌面上的默认播放器。
---
via: <https://opensource.com/article/22/2/listen-music-linux-juk-kde>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | HTTPSConnectionPool(host='opensource.com', port=443): Read timed out. (read timeout=10) | null |
14,331 | 在 Linux 手机上测试了新的 Maui Shell 后我发现…… | https://news.itsfoss.com/tested-maui-shell/ | 2022-03-06T09:50:19 | [
"PinePhone",
"Maui"
] | https://linux.cn/article-14331-1.html |
>
> 我在 PinePhone 上测试了 Maui Shell,结果有好有坏。如果你想冒险尝鲜一下,可以按照这个说明进行试验!
>
>
>

就在一个多月前,我们写了 [Maui Shell 初窥](/article-14136-1.html)。它是由 Nitrux Linux 团队开发的,我对它流畅的视觉效果,特别是它的融合功能印象深刻。
同时,我结束了 [我一年的 PinePhone 日用实验](/article-14235-1.html),这意味着它可以再次自由地进行实验。结果,我很快就自己安装了 Maui Shell,花了不少时间来测试它。
下面是我的发现!
### 关于 Maui Shell 开发状态的简短说明
在我们开始之前,我想指出,Maui Shell 仍处于早期开发阶段。因此,我一般不会提到我注意到的 bug,而是将重点放在它的更基本的方面。
不过,对于更大的、更耗时的问题例外,所以请记住这一点。
说完了这些,让我们开始测试吧!
### 手机上的 Maui Shell

安装完之后,我就看到了 Maui Shell 的(现在熟悉的)桌面上。随即,非常明显的是,它的缩放比例完全错误,这使得它很难使用。
幸运的是,Maui 项目的 Telegram 群组的人提供了极大帮助,我没用了一个小时就成功地修复了缩放比例(感谢 @wachidadinugroho)。
现在好了,我开始测试。
#### 其性能堪比糖浆流动
如果你读过我的 PinePhone 点评,你可能记得把它的性能比作糖蜜滴落的速度。不幸的是,Maui Shell 将这一点提升到了一个全新的高度。即使是最基本的互动,如打开快速控制菜单,也要花上五秒钟的时间!
不幸的是,我的水平还不足以判断这种缓慢的原因,但它很有可能是由软件渲染造成的。如果你不清楚,“软件渲染”是指图形不在 GPU 上渲染,而是在效率和优化程度都更低的 CPU 上(利用软件来)渲染。
我考虑的另一个可能的罪魁祸首是糟糕的优化(毕竟它还处在早期阶段)。如果是这样的话,那么在未来的几个月里,极有可能在为 Maui Shell 的第一个稳定版本做准备的过程中修复这个问题。
然而,正如我之前所说的,对我的早期看法要多加注意。
#### 有望实现的用户体验

与几乎所有的移动 UI 一样,Maui Shell 在触摸屏上使用起来简单而直观。然而,它也结合了许多桌面元素,这对提高用户体验有很大的作用。
例如,从屏幕顶部向下滑动会出现一个快速设置菜单,类似于在安卓和 iOS 上发现的那些。
然而,可以单独点击顶部通知栏的不同部分,会只显示相关的设置,类似于许多桌面环境面板和任务栏上的各种小程序。
现在,让我们前往 **窗口管理**。
对于窗口管理,Maui Shell 团队显然从 GNOME 和 iOS 中获得了一些灵感,从屏幕底部向上滑动会显示一个类似 GNOME 的所有运行中的应用程序的概览。我发现这非常直观和简单,老实说,我很惊讶以前没有这样操作过!
最后,托盘也是 Maui Shell 在手机上的一个重要方面。它在默认情况下自动隐藏,可以通过从屏幕底部向上轻扫来访问。从这里,它显示了所有正在运行的应用程序的图标,以及一个打开应用程序启动器的按钮。
说到应用启动器,它与 iOS 14 及更高版本中的应用库非常相似。每个应用都被分类,只需轻点几下就能轻松找到并启动。
总的来说,其实用性有点独特,而且值得探究。而且,这种特性也延伸到了应用程序,它们是用 Mauikit 和 Kirigami 制作的。
我认为 Maui Shell 团队把基本的东西做得很完美。
#### 应用程序超棒

任何用 Mauikit 构建的东西都能与 Maui Shell 完美整合。到目前为止,最大的 Mauikit 应用程序集来自 Maui Shell 的开发方 Maui 项目。其中一些包括:
* Index
* Nota
* Station
* VVave
* Pix
* Clip
* Buho
* Shelf
* Communicator
所有这些应用都能在移动和桌面设备上完美运行,并将桌面级应用带到手机上。我对 [Index](https://mauikit.org/apps/index/) 特别满意,它是一个有趣而实用的手机文件管理器。

除了 Mauikit 应用外,Kirigami 应用也很好用。因此,在桌面和移动设备上都有一个非常适合 Maui Shell 的庞大的应用程序库。
### 其他观点
除了这些观察之外,还有一些小问题我想提一下:
* 不幸的是,现在似乎还没有虚拟键盘。我通过使用 USB-C 连接的键盘来规避这个问题,但这并不意味着不能把它作为手机使用。
* 我还发现了几个缩放的问题,我无法解决这些问题。这些问题包括应用程序的缩放比例远远超过 Maui Shell 本身,以及根本没有缩放比例。这也许是由于我的错误造成的,但我觉得不能指望一般的用户能够钻研晦涩的 Qt 专用环境变量。
### 自己测试 Maui Shell
如果所有这些问题都不影响你,那么你可以使用下面的说明在 PinePhone 上测试 Maui Shell。需要注意的是,这些都是针对 PinePhone 的,但也可以根据其他需要进行修改:
* 下载 [Arch Linux ARM](https://github.com/dreemurrs-embedded/Pine64-Arch/releases) 并刷入到 SD 卡上
* 用 SD 卡启动,并连接一个外部键盘
* 使用凭证 `alarm`/`123456` 登录
* 现在使用 `nmtui` 连接到 Wi-Fi,并使用 `sudo pacman -Syu` 更新软件包列表
* 运行以下命令(这些命令将需要很长的时间来运行):
```
sudo pacman -S base-devel
git clone https://aur.archlinux.org/packages/maui-shell-git
git clone https://aur.archlinux.org/packages/mauikit-git
cd mauikit-git
makepkg -Asi
cd ..
cd maui-shell-git
makepkg -Asi
```
* 使用 [nano](https://news.itsfoss.com/gnu-nano-6-0-released/) 创建一个启动脚本:
```
cd
nano start.sh
```
输入如下内容:
```
#!/bin/sh
# in case it's not detected
# or you wish to override
#
# export QT_QPA_EGLFS_PHYSICAL_WIDTH=480
# export QT_QPA_EGLFS_PHYSICAL_HEIGHT=270
export QT_QPA_PLATFORM=eglfs
export QT_AUTO_SCREEN_SCALE_FACTOR=0
export QT_SCALE_FACTOR=2
cask -r -plugin libinput
```
* 使脚本可执行:`chmod +x start.sh`。
现在,可以用 `./start.sh` 启动 Maui Shell 了。
就这样!
你对 Maui Shell 有什么看法?你认为它的融合功能有用吗?请在下面的评论中告诉我们!
---
via: <https://news.itsfoss.com/tested-maui-shell/>
作者:[Jacob Crume](https://news.itsfoss.com/author/jacob/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Just over a month ago, we got our [first glimpse of Maui Shell](https://news.itsfoss.com/maui-shell-unveiled/). Developed by the team at Nitrux Linux, I was quite impressed with its smooth visuals, and especially its convergence features.
At the same time, I concluded [my year of daily driving the PinePhone](https://news.itsfoss.com/pinephone-review/), which meant that it was free to experiment on again. As a result, I soon found myself installing Maui Shell, which I spent quite a few hours testing.
Here’s what I found!
## A Quick Note on Maui Shell’s Development Status
Just before we get started, I do want to point out that Maui Shell is still in its early phase of development. As such, I am going to do my best to avoid talking about the bugs I noticed, and instead focus on the more fundamental aspects of it.
I will, however, make exceptions for larger and more time-consuming issues, so please keep that in mind.
With that out of the way, let’s get on to testing!
## Maui Shell on a Phone

As soon as I finished installing it, I found myself on the (now familiar) desktop of Maui Shell. Immediately, it became very obvious that the scaling was entirely wrong, which made it much harder to use.
Fortunately, the people over at the Maui Project Telegram group were extremely helpful, and I managed to get the scaling fixed in less than an hour (thanks @wachidadinugroho).
Once that was done, I started testing.
### Its Performance is Much Slower Than Molasses
If you read my PinePhone review, you may recall comparing its performance to the speed at which molasses drips. Unfortunately, Maui Shell takes this to a whole new level. Even the most basic interactions, like opening the quick control menus, could take as many as five seconds!
Unfortunately, my skills don’t extend far enough to be able to diagnose this slowness, but it would make sense for it to be caused by software rendering. In case you’re curious, software rendering is where the graphics aren’t rendered on the GPU, instead, it is being rendered on the much less efficient and optimized CPU.
The other possible culprit I considered was poor optimization (considering its early state). If that is the case, then it is highly likely that this will be fixed over the coming months preparing for Maui Shell’s first stable release.
However, as I said before, take my early insights with a pinch of salt.
### Promising User Experience

As with almost all mobile UIs, Maui Shell is simple and intuitive to use on a touchscreen. However, it also combines many desktop elements, which made a significant difference in enhancing the user experience.
For example, swiping down from the top of the screen produced a quick settings menu, similar to those found on Android and iOS.
However, different sections of the top notifications bar could be tapped individually to only show the related settings, similar to the various applets found on many desktop environments panels and taskbar.
Now, let’s head to **window management**:
For window management, the Maui Shell team obviously took some inspiration from Gnome and iOS, where swiping up from the bottom of the screen would show a Gnome-like overview of all the running apps. I found this to be extremely intuitive and simple, and I’m honestly quite surprised it hasn’t been done before!
Finally, the dock is also an important aspect of Maui Shell on mobile phones. It auto-hides by default and can be accessed by swiping up from the bottom of the screen slightly. From here, it shows the icons of all the running apps, as well as a button to open the app launcher.
Speaking of the app launcher, it’s very similar to the App Library found in iOS 14 and later. Each of the apps is sorted into categories and can be easily found and launched in just a few taps.
Overall, the usability proved to be a bit unique, and intriguing. However, this also extends to the apps, which are made with Mauikit and Kirigami.
I think the Maui Shell team got the fundamentals perfect.
### The Apps Are Awesome

Anything built with Mauikit integrates perfectly with Maui Shell. By far, the largest collection of Mauikit apps comes from the Maui Project, the developers of Maui Shell. Some of these include:
- Index
- Nota
- Station
- VVave
- Pix
- Clip
- Buho
- Shelf
- Communicator
All of these apps work perfectly on mobile and desktop devices and bring desktop-class applications to phones. I was especially pleased with [Index](https://mauikit.org/apps/index/?ref=news.itsfoss.com), an interesting and functional mobile file manager.

Aside from Mauikit apps, Kirigami applications also work well. As a result, there is a huge library of apps perfect for Maui Shell on both desktop and mobile devices.
## Other Thoughts
Aside from my observations, there are a few minor things I would like to mention:
- Unfortunately, it appears that there isn’t a virtual keyboard for now. I circumvented this by using a keyboard attached with USB-C, but this does not mean that it’s impossible to use it as a phone.
- I also found several scaling issues, which I was unable to resolve. These included apps scaling much more than the shell itself, as well as nothing scaling at all. This could perhaps be due to error on my part, but I certainly can’t expect typical users to be able to dig into obscure Qt-specific environment variables.
## Testing Maui Shell For Yourself
If all these issues don’t phase you, then you can try Maui Shell on a PinePhone using the instructions below. It should be noted these are PinePhone-specific, but can be modified to suit other needs:
- Download and flash
[Arch Linux ARM](https://github.com/dreemurrs-embedded/Pine64-Arch/releases?ref=news.itsfoss.com)to an SD card - Boot up the SD card, and connect an external keyboard
- Login using the credentials
*alarm*/*123456* - From here, connect to Wifi using
`nmtui`
and update the package list using`sudo pacman -Syu`
- Run the following commands (these commands will take a long time to run):
```
sudo pacman -S base-devel
git clone https://aur.archlinux.org/packages/maui-shell-git
git clone https://aur.archlinux.org/packages/mauikit-git
cd mauikit-git
makepkg -Asi
cd ..
cd maui-shell-git
makepkg -Asi
```
- Create a startup script using
[Nano](https://news.itsfoss.com/gnu-nano-6-0-released/):
```
cd
nano start.sh
```
Now, type into the file:
```
#!/bin/sh
# in case it's not detected
# or you wish to override
#
# export QT_QPA_EGLFS_PHYSICAL_WIDTH=480
# export QT_QPA_EGLFS_PHYSICAL_HEIGHT=270
export QT_QPA_PLATFORM=eglfs
export QT_AUTO_SCREEN_SCALE_FACTOR=0
export QT_SCALE_FACTOR=2
cask -r -plugin libinput
```
- Make the script executable:
`chmod +x start.sh`
From here, Maui Shell can be started using `./start.sh`
.
That’s it!
*What are your thoughts on Maui Shell? Do you think its convergence features are useful? Let us know in the comments below!*
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,332 | 如何在 KDE Plasma 桌面进行屏幕共享 | https://opensource.com/article/22/2/screen-share-linux-kde | 2022-03-06T10:24:14 | [
"远程桌面"
] | https://linux.cn/article-14332-1.html |
>
> krfb 和 krdc 的组合是使远程 Linux 支持变得无挫折感的宝贵工具。
>
>
>

如果你曾经做过专业的或出于家庭义务的远程支持,在待命支持时,解决问题只是第二步,更重要的是可见用户屏幕上的实际内容。有多少次你描述了复杂的桌面任务,后来才发现你的用户甚至还没有打开他们的电脑?支持是重要的,但挫折感是真实的,对于需要支持的人和慷慨地试图提供支持的人来说,这都是一种共同的经历。我相信,作为学习新技能的一种方式,人们自己执行任务是很重要的,但也有一种说法是观察专家应该如何做。这就是屏幕共享的作用,KDE Plasma 桌面已经内置了它。
### 网络安全
Plasma 桌面使用点对点的邀请模式进行屏幕共享。用户启动一个应用,启动一个虚拟网络连接(VNC)服务器,这时,支持人员就可以远程查看甚至控制计算机。如果这听起来像是潜在的不安全,那是因为它可能就是,但有防火墙的干预。如果你是一个与你不在同一网络上的人的支持人员,那么你必须在屏幕共享工作之前建立一个从你的网络到你的用户的网络的安全通道。理想情况下,你会在紧急情况发生前完成这项工作。
1. [配置用户的路由器](https://opensource.com/article/20/9/firewall),将 VNC 端口(默认为 5900,但你可以使用任何你喜欢的端口)路由到他们的计算机。
2. [在用户的本地防火墙中打开一个服务](https://opensource.com/article/19/7/make-linux-stronger-firewalls),允许 VNC 流量(在你在第一步中指定的端口)。
### 远程邀请
为了启动屏幕共享会话,用户必须启动 **krfb**(表示 “KDE remote frame buffer”)应用。这将启动一个 VNC 服务器,并创建一个临时密码。

**krfb** 使用的默认端口是 5900,但如果你需要,可以在 **krfb** 设置中改变。不过,这可能是你想提前做的事情,这样你就可以避免向你的用户解释如何改变协议的端口。
### 查看和控制
当这个窗口打开时,你可以使用你喜欢的 VNC 客户端通过 VNC 登录。KDE 有 **krdc**(表示 “KDE remote desktop client”)应用。在支持的计算机上,启动它并向它提供目标 IP 地址。当你被提示输入密码时,输入你正在连接的 **krfb** 会话中显示的密码。

连接上后,你就可以看到你用户的屏幕,你可以在他们遵循你的指示时引导他们。如果他们在遵循你的指示方面有困难,那么你可以控制他们的鼠标,并演示如何做某事。默认情况下,**krfb**(即他们正在运行的应用)在将控制权交给你之前会征求他们的同意。
### 帮助进行中
能够看到你的用户所看到的东西可以加速故障排除,减少支持电话双方的挫折感。只要你事先为你的支持设置好网络,**krfb** 和 **krdc** 的组合对于指导新用户完成 Linux 桌面发现之旅的 Linux 专业人士来说是很有价值的工具。
---
via: <https://opensource.com/article/22/2/screen-share-linux-kde>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | If you've ever done remote support professionally or out of familial obligation, then you've been on a call where solving problems are only secondary to the impossible task of visualizing what's actually on your user's screen. How many times have you described complex desktop tasks only to later realize that your user hasn't even turned their computer on yet? Support is important, but the frustration is real, and it's a shared experience for both the people in need of support and the people who graciously try to provide it. I believe it's important for people to perform tasks themselves as a way to learn a new skill, but there's also an argument for observing the way it's meant to be done by an expert. That's what screen sharing is for, and the KDE Plasma Desktop has it built-in.
## Network safety
The Plasma Desktop uses a point-to-point invitation model for screen sharing. The user launches an application, which starts a Virtual Network Connection (VNC) server, at which point the support person is able to view and even control the computer remotely. If it sounds like this is potentially unsafe, that's because it can be, but for the intervention of firewalls. If you're the support person for somebody who's not on the same network as you, then you must set up a safe pathway from your network to your user's network before screen sharing can work. Ideally, you would do this before emergency strikes:
[Configure the user's router](https://opensource.com/article/20/9/firewall)to route the VNC port (5900 by default, but you can use any port you like) to their computer.[Open a service in the user's local firewall](https://opensource.com/article/19/7/make-linux-stronger-firewalls)to permit VNC traffic (on the port you specified in the first step).
## Remote invitation
To start a screen sharing session, the user must start the **krfb** (that stands for *KDE remote frame buffer*) application. This starts a VNC server, and creates a temporary password.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
The default port **krfb **uses is 5900, but you can change that if you need to in **krfb** settings. This is something you probably would want to do in advance, however, so you can avoid trying to explain to your user how to change a protocol's port.
## Viewing and controlling
While this window is open, you can log in over VNC using your favorite VNC client. KDE includes the **krdc** (that stands for *KDE remote desktop client*) application. On the support computer, launch it and provide it with the destination IP address. When you're prompted for a password, enter the one showing in the **krfb** session you're connecting to.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
Once you've connected, you can view your user's screen, and you can guide them as they follow your instructions. If they're having trouble following your directions, then you can take control of their mouse and demonstrate how something is done. By default, **krfb** (that's the application *they're* running) asks them for permission before relinquishing control to you.
## Help is on the way
Having the ability to see what your user sees can speed up troubleshooting and lessen frustration on both sides of a support call. Provided that you set up the network for your support in advance, the combination of **krfb** and **krdc** are valuable tools for the Linux professional guiding new users through their journey of Linux desktop discovery.
## Comments are closed. |
14,334 | 为什么每个人都可以试试 Linux | https://opensource.com/article/21/2/try-linux | 2022-03-07T09:15:00 | [
"Linux"
] | /article-14334-1.html |
>
> 如果你对 Linux 有着充满好奇,那开源社区可以让你轻松上手 Linux。
>
>
>

*开源朗读者 | 若愚*
如今,人们有更多的理由喜欢 Linux。在这里,我会分享使用 Linux 的 21 个不同的理由。我们来讨论讨论,为什么每个人都可以尝试一下 Linux。
Linux 对外行人来说,好像是一个神秘的东西。每当人们说起 Linux,就觉得它是计算机管理员或者系统管理员使用的,但也在讨论在笔记本电脑和手机上使用 Linux。技术网站上列出了 [你需要知道](https://opensource.com/article/19/12/linux-commands) 的 [十大 Linux 命令](https://opensource.com/article/18/4/10-commands-new-linux-users),但也有很多人在讨论 [Linux 桌面(不止一个)是多么令人激动](https://opensource.com/article/20/5/linux-desktops)。
那么, Linux 到底是干嘛的呢?
Linux 对可用性的支持是它众多重要特性之一。如果你对 Linux 有着充满好奇,那开源社区可以让你轻松上手 Linux。
### 先尝试 Linux 应用
无论是从 Windows 换到 Linux、还是在 Windows 和 Mac 之间横跳,亦或是从 Mac 换到 Linux,要想改变一个人的计算机操作系统的使用习惯是一件很难的事。虽然这件事很少会去讨论,不过现在的电脑是一个比较个性化的东西,每个人都习惯于自己电脑当前的使用习惯,他们往往不愿意去做太大的变化。对我来说,就算在工作电脑跟个人电脑中来回切换(两者都运行相同的操作系统),也需要我调整我的心理和肌肉习惯,仅仅是因为两个电脑针对不同的活动场景进行了优化。尽管我被附近的人称为“很了解计算机的家伙”(,我也这么认为)。但如果我不得不更换我常用的操作系统,我会觉得自己的生产力跟舒适感将在一两周内直线下降。不过这还是比较表层的,虽然我知道怎么用其他的操作系统,但是我需要时间去形成新的直觉跟习惯,需要记住在新系统中,一些不起眼的配置选项的位置,还得知道要怎么使用新的功能。
出于这个原因,我经常告诉那些对 Linux 感到新奇的人,学习 Linux 的第一步就是要去使用 Linux 的应用。实际上,Linux 上专用的应用程序不多,主要是因为 Linux 的大多数应用程序是开源的,因此热衷于在所有平台之间移植。在 Linux 上的很多应用程序,可以在你目前的非 Linux 的平台上去尝试。把替换你默认的应用程序作为一个目标,不管是出于习惯还是方便,都要用开源的等价物。
### 应用替换
这个练习的目的是通过你最终要运行的应用软件,来实现向 Linux 的软过渡。一旦你习惯了一套新的应用程序,那么在 Linux 系统上,除了系统设置和文件管理外,就没有其他什么要适应的了。
如果你还不确定哪个是自己常用的应用,只需看看你的最近使用的应用程序列表(如果你的系统上没有最近使用应用的列表,那还等啥,赶紧换成 Linux 系统吧)。一旦你确定了必须使用的应用程序,可以看看我们的 [应用替代方案](https://opensource.com/alternatives) 页面,了解许多被视为与流行的专有应用程序等效的常用开源应用程序。
### 获取 Linux
不是所有的开源软件都能移植到其他平台,并从在 Linux 上运行而受益。如果你想最终切换到 Linux,那就得完成这个过渡。幸运的是,要安装 Linux 就像下载它一样简单,几乎就像是另一个开源程序一样。
通常,Linux 的安装镜像提供了实时模式跟安装模式两种模式,这意味着你可以从 Linux 介质启动,并且在实时模式下运行使用,而无需将系统安装到计算机。这是了解操作系统的好方法,但因为只是一种临时体验,所以启动后不会保留数据。但是,有些发行版,如 [Porteus Linux](http://porteus.org),是专门为在 USB 上运行而设计的,这样你的个人数据就能保存。我在钥匙串上挂了一个 Porteus 的 U 盘,所以我无论在哪里,我都有一个可以启动的Linux 系统。

### “最好的” Linux
一旦你决定开始安装 Linux 系统,你会发现有很多 Linux 发行版都是免费的。如果你之前用的操作系统版本只有一两个选择(例如,家庭版或商业版),那么你会对 Linux 操作系统有这么多发行版感到困惑。不过,实际情况没这么复杂。Linux 就是 Linux,它的下载和安装的不同“流派”没有什么太大的不同。像 [Fedora](http://getfedora.org)、 [Debian](http://debian.org)、[Linux Mint](http://linuxmint.com) 和 [Elementary](http://elementary.io) 这些大牌的系统厂商都提供了同样的体验,只是在重点略有不同。
* Fedora 以软件更新迭代快而出名
* Linux Mint 可以轻松安装缺失的驱动程序
* Debian 因能提供长期的支持而受欢迎,因而更新是相对缓慢,但是可靠性很高
* Elementary 提供了精美的桌面体验和几个定制的特殊应用程序
总而言之,所谓最好的“Linux 系统”,即是最适合你的 Linux 系统。而最适合你的 Linux,就是,在你尝试过后,发现你所有的计算机功能仍然能按预期工作的 Linux。
### 获取驱动程序
大多数的驱动程序已经被捆绑在 Linux 的内核中了(或者作为内核模块),特别是在使用一到两年前的计算机零件和外围设备时常常如此。对于已经上市一段时间的设备,Linux 程序员有机会去开发驱动程序或者将公司的驱动程序集成到系统里。我曾不止一次让人惊讶,只需将 Wacom 图形输入板、游戏控制器、打印机或扫描仪连接到我的 Linux 计算机中,不需要下载安装驱动程序,而且几乎不用配置,可以立即使用。
专有操作系统在处理设备驱动程序方面有两种策略。要么是限制用户在操作系统中使用的设备,要么是付费给公司,让他们编写驱动程序并与设备一起提供。第一种方法有种让人不适的限制性,但是大多数人(可悲的)习惯了某些设备只能在某些平台上运行的想法。而后一种方法,被认为是一种奢侈,但在实践中,这种方法太过于依赖程序员。旧货店有很多计算机外围设备,虽然它们设备状况良好,但却基本上报废了。因为设备制造商已经不再维护此设备在现代系统运行所需要的驱动程序了。
对于 Linux 来说,驱动程序要么由制造设备的厂商来开发,要么是由 Linux 的程序员来开发。这就可能会导致,某些驱动程序集成到操作系统的时间会被延迟(例如,新的设备可能要在发布后六个月才能在 Linux 系统上运行),但它有一个明显的优势,即长期支持。
如果你发现有一个驱动程序还没有进入发行版,那你可以等几个月再试一次,有可能是驱动程序已经集成到了系统的镜像里了,或者可以到不同的发行版中找找有没有你要的驱动程序。
### 为 Linux 付费
通过购买预装 Linux 的 PC 或者经过 Linux 认证的 PC,可以避免所有的选择和关于兼容性的担忧。一些供应商提供预装 Linux 的计算机,如所有的 [System76](http://system76.com) 和部分 [Lenovo](http://lenovo.com) 型号。此外,所有的 Lenovo 型号都有 [Linux 兼容性认证](https://forums.lenovo.com/t5/Linux-Operating-Systems/ct-p/lx_en)。
这是迄今为止尝试使用 Linux 最简单的方法。
### 迈向 Linux
这是一个挑战,浏览自己电脑上安装的每个应用程序,并找到潜在的对应开源替代程序。选择一个你经常使用但不是每天都用的应用程序,在下次要用的时候换成开源的应用程序。花点时间学习新的应用程序,直到能够将它作为你的新的默认程序,或者直到你确定需要尝试一个新的选择。
随着你使用的开源产品越多,你就越准备好进入激动人心的 Linux 世界。最后,你会用上 Linux 桌面还有你最喜欢的开源应用程序。
---
via: <https://opensource.com/article/21/2/try-linux>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[sthwhl](https://github.com/sthwhl) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | HTTPSConnectionPool(host='opensource.com', port=443): Read timed out. (read timeout=10) | null |
14,337 | 12 款简单好用的保护隐私的软件 | https://itsfoss.com/privacy-tools/ | 2022-03-08T11:48:26 | [
"隐私"
] | https://linux.cn/article-14337-1.html | 
数据是最宝贵的一项资产。
无论影响好坏,数据收集技术都会一直存在。现实生活中,人们进行分析、研究以及学习,都需要各种各样的数据。
当然,数据收集也会带来风险,比如不法机构会收集用户的浏览数据(或网络活动)。
匿名数据收集等技术虽然在不断发展,但在隐私保护这方面可能做的并不是十分完善。
不过先别担心,保护好自己的隐私并不是件难事。
一些简单好用的软件可以在不影响用户体验的前提下,增强用户的隐私保护。更重要的是,搞明白这些软件,你根本不需要着急花大把的时间。
本文将会推荐一些简单的软件,可以轻松保护你的网络隐私。
### 一些增强隐私保护的基本工具
保护数据安全最有效的办法就是,关注你使用频率最高的产品。
担心数据安全是必要的,但不能顾此失彼,忘记产品最基本的用途。
比如,你使用一款去中心化的社交软件,但是你的亲朋好友都不去用它,他们大多时候还是使用 WhatsApp。那么,你的这种做法就没有任何意义。
因此,我们在这里列出了一些不用付出特别的努力就能轻松试用的软件,并将它们归为以下几类:
* 网页浏览器
* 虚拟专用网络
* 搜索引擎
* 社交软件
* 操作系统
* 密码管理
### 关注隐私保护的开源网页浏览器
从办理银行业务到访问社交媒体,网页浏览器能帮你做各种事情。
如果你选择了一款提供优质安全服务以及强大隐私保护功能的网页浏览器,你几乎就可以高枕无忧了。
在我们推荐的 [最好的网页浏览器](https://itsfoss.com/best-browsers-ubuntu-linux/) 之中,(重点关注隐私的)包括:
#### 1、Tor 浏览器

[Tor 浏览器](https://www.torproject.org/download/) 是一款自由开源的网页浏览器,提供了强大的隐私保护功能。它是火狐浏览器的定制版本。
Tor 浏览器借助 [Tor 网络](https://itsfoss.com/tor-guide/) 连接,通过多个节点来传递你的网络请求,以隐藏 IP 地址和位置信息。
在 Tor 浏览器上浏览网页,几乎没有人可以追踪到你。
然而,Tor 浏览器的浏览体验可能稍差一些,它的响应速度极慢。所以,如果你不介意这一点,Tor 浏览器绝对是你的不二之选。
#### 2、Firefox

可以说,[Firefox](https://www.mozilla.org/en-US/firefox/new/) 是最优秀的 [开源浏览器](https://itsfoss.com/open-source-browsers-linux/)。也难怪 [我会一次又一次地回归 Firefox](https://news.itsfoss.com/why-mozilla-firefox/)。
Firefox 浏览器不仅内置最强大的隐私保护功能,而且还经常引入新的行业标准,以确保用户安全地浏览网页。
你可以在 Firefox 上安装一些 [最好的开源插件](https://itsfoss.com/best-firefox-add-ons/),然后自行配置,更好地保护自己的隐私。
#### 3、Brave

[Brave](https://brave.com/) 是 Linux 系统上最好的浏览器之一,用户体验清新简洁,外观与 Chrome 有些相似。
Brave 凭借其强大的跟踪保护功能,以及开箱即用的自动运行的跟踪拦截器,一直以来都是 Linux 用户的最佳选择。
请阅读我们的文章:《[Brave vs. Firefox:你的私人网络体验的终极浏览器选择](/article-13736-1.html)》,进一步了解 Brave 的优点与缺陷。
### 保护隐私的虚拟专用网络
无论你使用的是电脑还是手机,虚拟专用网络都可以全程保护你的网络连接。
它还可以隐藏你真实的 IP 地址与位置,让你轻松浏览受限制的内容。
[专注隐私保护的虚拟专用网络服务](https://itsfoss.com/best-vpn-linux/) 有很多,这里我们推荐以下几款:
#### 1、ProtonVPN

[ProtonVPN](https://itsfoss.com/recommends/protonvpn/) 是一款强大的隐私保护服务,提供桌面版和移动版的开源客户端。
你可以免费使用这款软件;也可以选择付费,享受恶意软件拦截以及跟踪保护等功能。ProtonVPN 还可以与 ProtonMail 一起付费订阅。
#### 2、Mullvad

[Mullvad](https://mullvad.net/en/) 也提供了开源的客户端。有趣的是,它不需要你使用邮箱注册。
你只需生成一个用户 ID,然后就可以使用加密货币或信用卡购买服务。
### 使用保护隐私的搜索引擎,确保网络活动的安全
网上浏览信息会透露你的身份和工作。
不法组织可能会利用你的搜索内容,对你实施欺诈。
所以,能够保护隐私的搜索引擎就显得十分重要了。我推荐以下两款:
#### 1、DuckDuckGo

[DuckDuckGo](https://duckduckgo.com/) 是最流行的 [保护隐私的搜索引擎](https://itsfoss.com/privacy-search-engines/)之一,它声明不会记录用户的任何浏览数据。
一直以来,DuckDuckGo 也在不断提升自身的搜索结果质量,所以一般情况下你都可以搜索到想要的内容。
#### 2、Startpage

[Startpage](https://startpage.com/) 是一款很有趣的搜索引擎,外观和谷歌搜索相似,搜索结果也与谷歌搜索同步。不过,它不会收集你的信息。
如果你想要获取和谷歌搜索最相似的搜索结果,并且还希望可以使用隐私保护功能,那么你可以试试 Startpage。
### 使用安全的社交软件,保护聊天隐私
无论是政府还是软件本身,如果你不想别人在未经同意下获取你的聊天记录,你需要使用具有隐私保护功能的社交软件。
尽管大多数用户选择信赖 WhatsApp,但是它并不是最有效的隐私保护解决方案。当然,Facebook Messenger就更不用考虑了。
这里我推荐一些 [能够代替 WhatsApp 的社交软件](https://itsfoss.com/private-whatsapp-alternatives/):
#### 1、Signal

[Signal](https://signal.org/en/) 是一款开源的社交软件,支持端对端加密,[可安装在 Linux 桌面上](https://itsfoss.com/install-signal-ubuntu/)。
它也有一些隐私保护功能,可以保证聊天对话的安全。
#### 2、Threema

[Threema](https://threema.ch/en) 是一款付费软件,内置 Signal 的全部核心功能,无需手机号码即可登录使用。
这款软件也提供了办公版本。如果你的亲朋好友愿意一次性花费 3 美元购买一款软件,那么Threema 是一个不错的选择。
### 选用安全的操作系统,为隐私保护打好基础
可以理解,为了满足个人需求,你 [选择了 Windows,而没有选择 Linux](https://itsfoss.com/linux-better-than-windows/)。
但是,如果你为了保护隐私,想换个系统,可以考虑下面这些 [安全的 Linux 发行版](https://itsfoss.com/privacy-focused-linux-distributions/)。
#### 1、Linux Mint

[Linux Mint](https://linuxmint.com/) 可以满足日常所需,是一款非常出色的 Linux 发行版。它基于 Ubuntu,追求青出于蓝胜于蓝,[希望在一些方面做得更好](https://itsfoss.com/linux-mint-vs-ubuntu/)
Linux Mint 通过关注用户的选择以及常规的安全升级,确保操作系统的安全。
#### 2、Qubes OS

[Qubes OS](https://www.qubes-os.org/) 专注安全和隐私问题。对新手来说,使用起来可能比较困难。
不过,如果你想尝试体验一下最安全、最强大的隐私保护操作系统,那你一定要试试 Qubes OS。
### 选择可靠的密码管理器,保护账号安全
如果不法分子可以轻易获取你的账户信息,那么就算你准备再多的隐私措施,也无济于事。
因此,你必须设置更强大、更复杂的密码。此外,要想做到这些,必须先有密码管理器。
在 [Linux 上最好的密码管理器](https://itsfoss.com/password-managers-linux/) 之中,我建议使用下面这个:
#### 1、Bitwarden

[Bitwarden](https://bitwarden.com/) 是一款开源的密码管理器,全部的主要功能均可免费使用。
解锁这款软件的高级功能,每年只需花费 10 美元。
### 总结
专注隐私保护的软件有很多,数不胜数。
但是,很多都只是打着“隐私保护”的幌子,实际上不过是营销噱头;还有一些则根本无法使用。
所以,坚持使用那些自己用过的、适合自己的软件,才是比较好的选择。
以上软件你喜欢哪些?最喜欢的又是哪一款呢?请在下方评论留言。
---
via: <https://itsfoss.com/privacy-tools/>
作者:[Ankush Das](https://itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[aREversez](https://github.com/aREversez) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

**Data is one of the most valuable assets available**.
For better or worse, data collection techniques aren’t going anywhere. To be practical, we need all sorts of data to analyze, study, and learn about things.
Of course, it also brings in the **risk of exploiting the data collected**, such as malicious agencies getting hold of your browsing data (or internet activity).
While data collection methods have improved over time (like anonymous collection practices), they may not be entirely privacy-friendly.
Fret not; you need not be an expert to protect your privacy.
Some **simple tools enhance your privacy** without compromising the user experience. And, the best thing—you do not need to waste time researching these options like there’s no tomorrow.
Here, I highlight such simple tools to guard your online privacy easily.
**Basic Tools to Step Up Your Online Privacy**
The best way to protect your data is to focus on the options you interact with the most.
While you have to right to be paranoid, you shouldn’t forget the practical use cases.
For instance, it is useless to opt for a decentralized messenger that none of your friends/family uses and end up using WhatsApp most of the time.
Hence, we list some of the options that you can easily try without making any special efforts, categorizing them as:
**Web Browser****VPN Services****Search Engines****Messengers****Operating System****Password Manager**
## Open-Source Web Browsers for Privacy
From banking to social media access, the web browser helps you.
If you choose a web browser that offer good security and solid privacy features, you end up with a few things to worry about.
Among our [top choices for web browsers](https://itsfoss.com/best-browsers-ubuntu-linux/), some recommendations include:
### 1. Tor Browser

Tor Browser is **a free and open-source browser with solid privacy features**. It is a customized version of Firefox.
It utilizes the [Tor network](https://itsfoss.com/tor-guide/) for connection, routing your internet requests through multiple points, hiding your IP address and location.
When you browse a website/service through the Tor Browser, it is almost impossible to trace you back.
However, the browsing experience can be incredibly slow. So, if you are ready for the trade-off, Tor Browser can be the perfect pick.
### 2. Firefox

Firefox is arguably the most impressive [open-source browser](https://itsfoss.com/open-source-browsers-linux/). No wonder [I keep coming back to it](https://news.itsfoss.com/why-mozilla-firefox/).
It includes some of the best privacy protection features and often introduces new industry standards to secure your web experience.
You can install some of the [best open-source add-ons](https://itsfoss.com/best-firefox-add-ons/) and customize the options to enhance privacy protections further.
### 3. Brave

Brave is one of the best browsers available for Linux. It offers a **clean user experience and resembles a bit like Chrome**.
From its tracking protection and aggressive tracker blocking out-of-the-box, Brave can be a solid option.
You can learn more about its advantages and trade-offs in our [Brave vs Firefox comparison](https://itsfoss.com/brave-vs-firefox/) article.
## VPN Services to Enhance Privacy
A VPN (Virtual Private Network) helps secure your internet connection overall, whether you are using a computer or a smartphone.
It also hides your original IP address, and location, and unblocks access to any restricted and censored content.
While there are a lot of [privacy-focused VPN services](https://itsfoss.com/best-vpn-linux/), we list a few here:
### 1. ProtonVPN

[ProtonVPN](https://itsfoss.com/go/protonvpn-link/) is an impressive privacy-centric service with open-source applications for desktop and mobile.
You can use it for free, but you need to upgrade the subscription to get access to features like malware blocking and tracker protection. It also offers bundled subscription plans with ProtonMail.
### 2. Mullvad

Mullvad also **offers an** **open-source client and is an interesting VPN service** that needs no email address to sign up.
All you have to do is generate a user ID, and make payment for the subscription using a cryptocurrency/credit card.
## Private Search Engines to Keep Your Internet Activity Safe
What you search on the web tells a lot about you and your work.
Malicious parties can easily exploit the data on your search activity to lure you into a scam.
So, a privacy-friendly search engine should help you get there. I prefer using these two options:
### 1. DuckDuckGo

DuckDuckGo is one of the most popular [private search engines](https://itsfoss.com/privacy-search-engines/) that claim not to record any of your browsing data.
Over time, DuckDuckGo has also improved its search result quality, so you should get what you’re looking for most of the time.
### 2. Startpage

Startpage is an interesting alternative that resembles the look of Google search and utilizes the same results but without collecting your data.
If you want search results closest to Google and still want to have a number of privacy features, Startpage can be an option.
**Suggested Read 📖**
[10 Privacy Oriented Alternative Search Engines To GoogleBrief: In this age of the internet, you can never be too careful with your privacy. Use these alternative search engines that do not track you. Google — unquestionably the best search engine out there (for most)- uses powerful and intelligent algorithms (including A.I. implementations) to let u…](https://itsfoss.com/privacy-search-engines/)

## Secure Messenger to Protect Your Conversations
Whether it’s the government or the app itself, if you want no one to access your conversations except the intended recipient, private messengers should help.
While most of the users swear by WhatsApp, it is not the most privacy-friendly solution. And, yes, Facebook Messenger is not even an option to consider.
Here are some of the [best WhatsApp alternatives](https://itsfoss.com/private-whatsapp-alternatives/):
### 1. Signal

Signal is an open-source messenger that supports end-to-end encryption and [can be installed on your Linux desktop](https://itsfoss.com/install-signal-ubuntu/).
It also features several privacy features to keep the conversations safe.
### 2. Threema

Threema is a paid application that features all the essentials from Signal without requiring your phone number.
It also offers a separate version for work. Threema can be a good pick if your friends/family are willing to purchase the app with a one-time fee of about $3.
## Choose a Secure Operating System to Build the Foundation
It is understandable if you cannot [choose Linux over Windows](https://itsfoss.com/linux-better-than-windows/) as per your requirements.
However, if you want to make the switch, to get complete privacy, here are some options among the [list of secure Linux distributions](https://itsfoss.com/privacy-focused-linux-distributions/) available.
### 1. Linux Mint

Linux Mint is a fantastic Linux distribution for everyday usage. It manages to do a [few things better than Ubuntu](https://itsfoss.com/linux-mint-vs-ubuntu/) while being based on it.
It focuses on user choices and regular security updates to keep the operating system safe.
### 2. Qubes OS

Qubes OS is a security-focused distro that can be overwhelming for beginners.
However, if you want to take the adventure of using one of the most secure/private OS, Qubes OS is a must-try.
## Password Manager to Secure Accounts
No amount of privacy measures will do any good if an attacker can easily access any of your online accounts.
So, you must generate stronger and more complex passwords. And, without a password manager, it is tough to do that.
Among the [best password managers for Linux](https://itsfoss.com/password-managers-linux/), I’ll suggest using this:
### 1. Bitwarden

An open-source password manager that offers all the essential features for free.
If you want to unlock its premium features, it would cost you just $10 a year.
## Wrapping Up
There’s no end to the number of privacy-focused options available.
After all, a **major chunk of those use “privacy” as a marketing gimmick** or end up being unusable for end-users.
So, it is **better to stick with some tried and tested services** to use what works best for you.
💬*What do you prefer to use among the tools listed? Do you have a favorite? Share your thoughts in the comments below.* |
14,340 | 如何安装和使用 Latte Dock | https://itsfoss.com/install-use-latte-dock-ubuntu/ | 2022-03-09T09:10:46 | [
"停靠区",
"Dock"
] | https://linux.cn/article-14340-1.html | 
你知道什么是“<ruby> 停靠区 <rt> Dock </rt></ruby>” 吧,它通常是你的应用程序“停靠”的底栏,以便快速访问。

许多发行版和桌面环境都提供了某种停靠实现。如果你的发行版没有“<ruby> 停靠区 <rt> Dock </rt></ruby>”,或者你想尝试一些新的停靠应用,Latte Dock 是一个不错的选择。它类似于 macOS 上的停靠区,每次你用鼠标悬停在任何停靠对象上时,都会有一个的抛物线动画。
在本教程中,我将告诉你如何在 Ubuntu 上安装 Latte Dock。我还会展示一些关于使用和定制 Latte Dock 的事情。
### 在 Ubuntu 上安装 Latte Dock
[Latte Dock](https://invent.kde.org/plasma/latte-dock) 是一个流行的应用程序,可以从大多数 Linux 发行版的官方软件库中获得。也就是说你可以使用你的发行版的软件中心或软件包管理器来安装 Latte dock。

在 Ubuntu 和其他基于 Ubuntu 的发行版,如 elementary OS、Linux Mint、Pop!\_OS、Zorin OS 上,使用 `apt` 命令:
```
sudo apt install latte-dock
```
这就行了!现在你已经在 Ubuntu 上安装了 Latte Dock。
#### 停用 Ubuntu 自带的停靠区(针对 Ubuntu 用户)
在你启动你闪亮的新停靠区之前,我建议你禁用 Ubuntu 默认提供的停靠区。这里有一个 [关于如何禁用 Ubuntu 的停靠区的指南](https://itsfoss.com/disable-ubuntu-dock/)。
要禁用停靠区,请在你的终端输入以下内容:
```
gnome-extensions disable [email protected]
```
如果你最终改变了主意,你可以用以下命令再次启用 Ubuntu 停靠区:
```
gnome-extensions enable [email protected]
```
>
> 注意:
>
>
> 这不能禁用 Pop!\_OS 20.04 LTS 上的默认停靠区(尽管它在桌面上默认是隐藏的;只在活动概览中可见)。在使用 COSMIC 桌面环境/扩展的 Pop!\_OS 上,你可以通过“<ruby> 设置 <rt> Settings </rt></ruby>”应用中的“<ruby> 桌面 <rt> Desktop </rt> -> <ruby> 停靠区 <rt> Dock </rt> </ruby> ”来禁用或启用停靠区。</ruby>
>
>
>
### 开始使用 Latte Dock
我在教程中使用的是 Pop!\_OS,但这些步骤适用于任何 Linux 发行版。
一旦安装完毕,你会在你的应用程序抽屉里发现一个 Latte Dock 的启动器图标。你可以在这里访问它,或者按 `Super` 键(通常是 `Windows` 键;如果你有 Mac 键盘,则按 `Command` 键)键 + `A`。
从这里打开 Latte Dock:

酷!现在你的桌面上已经打开了 Latte Dock。

#### 启用 Latte Dock 的自动启动功能
随着 Latte Dock 的打开,以及 Ubuntu 自带停靠区的禁用,如果你现在重启,那么下次你的电脑开机时就不会有任何停靠区了。
让我们现在就来解决这个问题。
在停靠区上点击右键。点击“<ruby> 布局 <rt> Layouts </rt></ruby>”子菜单下的“<ruby> 配置 <rt> Configure </rt></ruby>”选项。

现在,在“<ruby> 偏好 <rt> Preferences </rt></ruby>”选项卡下,确保“<ruby> 在启动时启用自动启动 <rt> Enable autostart during startup </rt></ruby>”复选框被选中。

### 定制你的停靠区
如果你安装了任何 KDE 的产品,定制应该是永无止境的。如果 Latte Dock 不允许定制,那就奇怪了。幸运的是,情况并非如此。
你可以做各种各样的事情来定制 Latte Dock。增加它的大小,使它更透明或半透明,为它设计主题等等。
#### 将应用程序固定在停靠区上
要把你的应用程序固定在 Latte Dock 上,打开该应用程序,右键点击在你停靠区中的应用程序图标。现在点击“<ruby> 固定启动器 <rt> </rt> Pin Launcher</ruby>”。完成了!你的应用程序现在已经被固定到了停靠区上。

你可以通过点击和拖动移动它到左边或右边来改变它在停靠区中的位置。
#### 搜索和安装 Latte Dock 主题
通过右击停靠区打开 Latte Dock 的“<ruby> 设置 <rt> Settings </rt></ruby>”窗口,点击“<ruby> 布局 <rt> Layout </rt></ruby>”子菜单下的“<ruby> 配置 <rt> Configure </rt></ruby>”选项。
你可能已经安装了一些主题(呃...布局)。从已安装的选项列表中选择它,然后点击右侧的切换按钮。

你也可以通过点击“<ruby> 下载 <rt> Download </rt></ruby>”按钮来下载更多的主题。它应该向你显示一个可用的主题列表,以供安装。

#### 改变停靠区的外观和行为
正如我前面提到的,在 KDE 产品中有大量的定制选项。
让我们来试试。
右键点击停靠区,点击 “<ruby> 停靠区设置 <rt> Dock Settings </rt></ruby>”。

在这里,你会得到各种类型的可以切换的选项。想把停靠区移到显示器的左侧吗?你可以通过“<ruby> 位置 <rt> Location </rt></ruby>”子菜单下提供的选项来实现。

如果你觉得可用的选项有任何限制,请拨动右上角的“<ruby> 高级 <rt> Advanced </rt></ruby>”开关。

现在看起来真是太棒了!
试着切换每个可用的开关。你可以延迟隐藏停靠区。你可以把它放在显示器的一个边缘,把它放在该边缘的中心、左边或右边。你可以做到这一切。
想修饰启动、悬停等效果?在“<ruby> 效果 <rt> Effects </rt></ruby>”选项卡下有更多的调整选项等待着你。
### 从你的系统中删除 Latte Dock
你安装了 Latte Dock,并对其进行了定制,但觉得它不是你想要的东西。而你现在正在寻找删除 Latte Dock 的方法。很好,我帮你。
你可以使用 `apt` 软件包管理器删除 Latte Dock。用下面的命令来做:
```
sudo apt autoremove --purge latte-dock
```

`--purge` 标志将删除 Latte Dock 在系统目录中的任何配置文件,除了 `~/.config`。
#### 仅供高级用户使用:删除用户特定的遗留文件
这不是强制性的,但如果你想删除通常放在 `$HOME/.config`(即 `~/.config`)目录中的用户配置文件。[使用 find 命令](https://linuxhandbook.com/find-command-examples/) 来定位 Latte Dock 的配置文件:
```
find ~/.config -iname "latte*"
```

你可以安全地从你的 `~/.config` 目录中删除这些目录和配置文件。
#### 对于 Ubuntu 用户:重新启用 Ubuntu 停靠区
不要忘了启用 Ubuntu 的停靠区。如果你不记得了,再次启用停靠区的命令在下面:
```
gnome-extensions enable [email protected]
```
### 总结
Latte Dock 是一个来自 KDE 社区的令人惊艳的停靠区 ( ͡° ͜ʖ ͡°)
它提供了大量的主题(布局)、外观和自定义选项,以及一些漂亮的效果。如果你正在考虑定制你的桌面外观和感觉,它肯定是你应该寻找的东西。
如果你最终喜欢上了 Latte Dock 并开始每天使用它,请在评论中告诉我。如果你不喜欢 Latte Dock,也请发表评论让我知道原因。
---
via: <https://itsfoss.com/install-use-latte-dock-ubuntu/>
作者:[Pratham Patel](https://itsfoss.com/author/pratham/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | You know what docks are, right? It is usually the bottom bar where your applications are ‘docked’ for quick access.

Many distributions and desktop environments provide some sort of docking implementation. If your distribution does not have a Dock or if you want to experiment with [some other Dock applications](https://itsfoss.com/best-linux-docks/), Latte dock is a good choice. It is similar to the dock on macOS with a **parabolic animation every time you hover over any dock object** with your mouse.
In this tutorial, I’ll show you how to install Latte Dock on Ubuntu. I’ll also show some a few things about using and customizing Latte Dock.
## Install Latte Dock on Ubuntu
[Latte dock](https://invent.kde.org/plasma/latte-dock) is a popular application in most Linux distributions’ official repositories. You can use your distribution’s software center or package manager to install the Latte dock.
On Ubuntu and other distributions that are based on Ubuntu such as elementary OS, Linux Mint, Pop!_OS, Zorin OS, use the apt command:
`sudo apt install latte-dock`
Done! You now have Latte Dock installed on Ubuntu.
### Disable Ubuntu dock (for Ubuntu users)
Before you start your shiny new dock, I advise that you disable the dock that ships with Ubuntu by default. Here is a [guide on how to disable the dock on Ubuntu](https://itsfoss.com/disable-ubuntu-dock/).
To disable the dock, type this in your terminal
`gnome-extensions disable `[[email protected]](/cdn-cgi/l/email-protection)
If you end up changing your mind, you can enable the Ubuntu dock again with the following command
`gnome-extensions enable `[[email protected]](/cdn-cgi/l/email-protection)
NOTE
The default dock on Pop!_OS 20.04 LTS can not be disabled (although, it is hidden by default on the desktop; only visible in the activities overview). On Pop!_OS with the COSMIC DE/Extension, you can disable or enable the dock by going in the Settings app, under Desktop -> Dock.
## Start using Latte Dock
I am using Pop!_OS in the tutorial but the steps are applicable to any Linux distribution.
Once installed, you will find a launcher icon for Latte Dock in your Applications Drawer. You can either access it through the dock or press the Super (usually the Windows key; or Command key if you have a Mac keyboard) Key + A.
Open Latte Dock from here.
Cool! You now have Latte Dock open on your desktop.
### Enable autostart for Latte Dock
With Latte Dock now open and Ubuntu Dock disabled, if you reboot now, you will not have any dock next time your computer turns on.
Lets fix that right now.
Perform a right click on the dock. Click on the Configure option under the Layouts sub menu.
Now, under the Preferences tab, make sure that the “Enable autostart during startup” checkbox is checked.
## Customize your dock
If you install any KDE product, customization is expected to be endless. It would be odd if Latte Dock wouldn’t allow customization. Fortunately, that is not the case.
You can do a wide variety of things to customize Latte Dock. Increase it’s size, make it more transparent or translucent, theme it, and much more.
### Pinning apps to the dock
To pin your application to the Latte Dock, open said application and right click on the application icon that is in your dock. Now click on Pin Launcher. Done! Your application is now pinned to the dock.
You can change its position in the dock by moving it to the left or right with the click and drag movement.
### Search and install themes for Latte Dock
Open the Latte Dock’s Settings window by right clicking on the dock, clicking on the Configure option under the Layout sub menu.
You may already a few themes (err… layout) installed. Select it from the list of installed options and click on the Switch button on the right side.
You may also download more themes by clicking the Download button. It should show you a list of available themes for installation.
### Change dock appearance and behavior
As I mentioned earlier, there are a huge amount of customization options in KDE products.
Lets play with some, shall we?
Right click on the dock and click on “Dock Settings”
Here, you will get all types of options to toggle. Want to move dock to the left side of your monitor? You can do that with the options provided under the Location sub menu.
If you feel limited in any way regarding the available options, toggle the switch at the top right corner that says Advanced.
Now THAT is awesome!
Try playing with every available toggle. You can hide the dock after a delay. You can place it to an edge of your monitor, place it to the center of that edge, to the left or right. You can do that all.
Want to tinker with launch, hover etc effects? More options to tinker with await for you under the Effects tab.
## Remove Latte Dock from your system
You installed Latte Dock, customized it but felt it was not what you were looking for. And, now you are looking to remove Latte Dock. That’s fine. I got you.
You can remove Latte Dock using the apt package manager. Do that with the following command:
`sudo apt autoremove --purge latte-dock`
The –purge flag will remove any configuration files that Latte Dock had in the system directories except for ~/.config.
### For advanced users only: removing user specific leftover files
This is not mandatory but if you want to remove the user config files that are usually placed in your $HOME/.config (AKA ~/.config) directory. [Use find command](https://linuxhandbook.com/find-command-examples/) to locate Latte Dock’s config files.
`find ~/.config -iname "latte*"`
You can safely remove these directory and config files from your `~/.config`
directory.
### For Ubuntu users: Re-enable the Ubuntu dock
Don’t forget to enable the stock Ubuntu dock. In case you don’t remember, the command to enable the dock again is down below:
`gnome-extensions enable `[[email protected]](/cdn-cgi/l/email-protection)
## Conclusion
Latte Dock is an amazing dock from the KDE kommunity ( ͡° ͜ʖ ͡°)
It offers a lot of theme-ing (layout), appearance, customization options along with some nice effects. It is certainly something that you should look for, if you are thinking of customizing your stock desktop look and feel.
If you end up loving Latte Dock and start using it every day, do let me know in the comments. And, if in any case you don’t like Latte Dock, let me know why, with a comment. |
14,341 | 如何在 Linux 下使用 DLNA 投屏 | https://github.com/LCTT/Articles/pull/2 | 2022-03-09T11:00:00 | [
"DLNA",
"投屏"
] | https://linux.cn/article-14341-1.html | 
>
> 编者按:本文系 Linux 中国公开投稿计划所接受的第一篇投稿,而且投稿作者是一位初中学生,让我们为他点赞!
>
>
>
一般来说,安卓设备和 Windows 设备投屏使用的是 miracast 协议,但是该协议要求网卡支持 p2pwifi,而 Linux 下大多数网卡驱动不支持 p2pwifi。
于是我用 Python + FFmpeg + DLNA 完成了一个在 Linux 下的投屏方案。这个方案的不足是延迟有点大。
### 设置
下面是如何实现。
先装这个 DLNA 库:
```
pip3 install dlna
```
然后用 `pactl` 查找 “监视器信源”(中文输出) 或 “Monitor Source”(英文输出):
```
pactl list sinks
```
示例输出:
```
Sink #0
State: RUNNING
Name: alsa_output.pci-0000_05_00.6.HiFi__hw_Generic_1__sink
Description: Family 17h (Models 10h-1fh) HD Audio Controller Speaker + Headphones
Driver: module-alsa-card.c
Sample Specification: s16le 2ch 44100Hz
Channel Map: front-left,front-right
Owner Module: 9
Mute: no
Volume: front-left: 53814 / 82% / -5.14 dB, front-right: 53814 / 82% / -5.14 dB
balance 0.00
Base Volume: 65536 / 100% / 0.00 dB
Monitor Source: alsa_output.pci-0000_05_00.6.HiFi__hw_Generic_1__sink.monitor
Latency: 16676 usec, configured 16000 us...
```
然后创建一个 CGI 脚本 `screen.flv`。首先。建立放置该脚本的目录:
```
mkdir screencast
mkdir screencast/cgi-bin
```
然后通过 `cat` 来直接创建该脚本:
```
cat <<eof>screencast/cgi-bin/screen.flv
#!/bin/bash
echo "Content-Type:video/x-flv"
echo
ffmpeg -f pulse -i <监视器信源> -f x11grab -i :0 -vcodec h264_nvenc pipe:.flv
eof
```
请用上面获得的监视器信源替换文件中的 `<监视器信源>`。
并为它设置可执行权限:
```
chmod +x screencast/cgi-bin/screen.flv
```
注意:如果没有 Nvidia 显卡,或者要使用其他的硬件加速,请把编码方案 `h264_nvenc` 替换为相应的编码方案。不建议采用软解方式,延迟非常高。
### 投屏
需要投屏时,首先启动本地 Web 服务器:
```
cd screencast
python3 -m http.server --cgi 9999&
```
然后,找到你的 DLNA 设备,然后把 `location` 后面的 URL 复制下来:
```
dlna device
```
示例输出:
```
=> Device 1:
{
"location": "http://192.168.3.118:1528/",
"host": "192.168.3.118",
"friendly_name": "Kodi",
...
```
找到你的 Linux 电脑的局域网 IP 地址:
```
ip addr
```
示例输出:
```
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 74:4c:a1:82:2e:3f brd ff:ff:ff:ff:ff:ff
inet 192.168.3.117/24 brd 192.168.3.255 scope global dynamic noprefixroute wlp2s0
valid_lft 58283sec preferred_lft 58283sec
inet6 240e:3b3:2ee3:9530:d005:e492:6243:9/128 scope global dynamic noprefixroute
valid_lft 6738sec preferred_lft 3138sec
inet6 240e:3b3:2ee3:9539:f289:6043:c56a:4e7b/64 scope global dynamic noprefixroute
valid_lft 7189sec preferred_lft 3589sec
inet6 240e:3b3:2ee3:9539:3714:eaf0:c549:b8c9/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 7188sec preferred_lft 3588sec
inet6 fe80::c746:2540:ab7b:20aa/64 scope link
valid_lft forever preferred_lft forever
inet6 fe80::3543:2637:e0fc:3630/64 scope link noprefixroute
valid_lft forever preferred_lft forever
```
启动投屏的命令如下:
```
dlna play -d <URL> http://<局域网 IP>:9999/cgi-bin/screen.flv
```
请相应替换其中的 `<URL>` 和 `<局域网 IP>` 参数,此处我替换后的命令是:
```
dlna play -d http://192.168.3.118:1528/ http://192.168.3.117:9999/cgi-bin/screen.flv
```
然后在你的电视上设置接受投屏,各种电视设备设置投屏方式不同,请参照具体设备说明。
稍等片刻,视频就会出现在电视上了。投屏效果如下:

---
作者简介:
calvinlin:一个普通的深圳初中生。
---
via: <https://www.bilibili.com/read/cv15488839>
作者:[calvinlin](https://space.bilibili.com/525982547) 编辑:[wxy](https://github.com/wxy)
本文由贡献者投稿至 [Linux 中国公开投稿计划](https://github.com/LCTT/Articles/),采用 [CC-BY-SA 协议](https://creativecommons.org/licenses/by-sa/4.0/deed.zh) 发布,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided. |
14,343 | 这个 Linux 图形计算器让数学很有趣 | https://opensource.com/article/22/2/kalgebra-linux-calculator | 2022-03-10T09:45:08 | [
"计算器"
] | https://linux.cn/article-14343-1.html |
>
> 就像你在高中时最喜欢的图形计算器一样,KAlgebra 是科学计算器的同时还有 2D 绘图仪等功能。
>
>
>

如果你在高中时期一直盯着 TI-80 系列计算器,但后来就在也没动过它,那么你有时可能会渴望重温那些激动人心的代数和微积分岁月。Linux KDE 项目中的某个人一定也有这种感觉,因为有个 KDE 框架库 Analitza 提供了相关的语法和小部件,使你能够使用 K 系列应用(如图形计算器 KAlgebra)执行高级数学函数。
### 在 Linux 上安装 KAlgebra
在 Linux 上,你可以从软件仓库安装 KAlgebra。例如,在 Fedora、Mageia 和类似设备上:
```
$ sudo dnf install kalgebra
```
在 Elementary、Linux Mint 和其他基于 Debian 的发行版上:
```
$ sudo apt install kalgebra
```
或者,你可以 [以 flatpak 安装它](https://opensource.com/article/21/11/install-flatpak-linux)。
### Linux 计算器
KAlgebra 与学校中使用的许多著名图形计算器一样,既是科学计算器又是 2D 绘图仪。但与我曾经使用过的任何图形计算器不同,它也是一个 3D 绘图仪。但在进入 3D 空间之前,先从一些基本语法开始。
在 KAlgebra 中表示方程时,你必须对数学符号进行一些小的翻译,因为它们通常是手写的,需要了解它们在计算机上的表示方式。例如,要将华氏度转换为摄氏度,公式为:(5÷9) × (n-32),其中 n 是华氏度。这通常是方程和数学函数的表达方式:它们使用 ÷ 和 × 之类的特殊符号以及 n 之类的变量,然后它们确定哪个变量代表什么样的值。你不一定知道每个特殊数学符号的含义,但只要你知道特殊符号具有特定含义,那么你就可以查找它。在温度转换示例中,符号很常见,因此你可能已经知道 ÷ 表示除法,× 表示乘法。
在 KAlgebra 中,与大多数编程语言一样,除法由正斜杠表示,乘法由星号表示,因此转换 70 华氏度的等式为 `(5/9)*(70-32)`。
KAlgebra 中还有用于常见数学运算的特殊功能,当你在 KAlgebra 中输入任何字母时,工具提示会为可用的函数提供潜在的自动补全功能。在 KAlgerbra 中编写温度转换方程的另一种方法是使用 `times` 函数:`times(5/9, 70-32)`。
当你完成数学问题时,已确定的变量会列在计算器的右栏中,包括 `ans` 值,该值会根据已完成方程的答案进行更新。那么理论上,你应该能够反转转换并从 `ans` 得出华氏温度。

### 图形计算器
数字很有趣,但当它们被用来绘制形状时,它们才真正变得有趣。图形上二维空间的可视化是所有学科发展的一项重要技能,其中最重要的是计算机编程。
要在图形上画一条线,你必须设置一个水平值(x 轴)或一个垂直值(y 轴),或者两者都设置。在常见的数学符号中,一条有效的直线方程就是 `x=5`。这会在图形的 0 原点上方 5 点处生成一条水平直线。然而,在 KAlgebra 中,你必须明确表示你只想用符号 `x->5` 来设置 x 值。

除此之外,绘图与其他地方一样简单。你可以编写复杂的方程式,并且可以使用特殊函数,例如 `sin`。

### Linux 上的 3D 图
当你进入 3D 图形选项卡时,你可能已经很好地理解了 KAlgebra 的语法,并且也超出了我的数学知识。我从电子学和合成中学到了关于笛卡尔图的所有知识,所以我对 3D 图最有趣的事情是将正弦波可视化为 3D 对象:

3D 图表和 2D 图表(除了一维)之间的区别在于 3D 图表中只能有一个图,因此请明智地选择方程式。
### 数学可以有趣吗?
事实证明,是的,数学可以很有趣,答案就是一个很好的图形计算器。当我一直在通过数学课来弥补过去一些相当糟糕的数学成绩时,我想要是能使用计算器就好了。我发现 KAlgebra 是一个非常有用的工具,不仅可以解决任意问题,还可以理解方程的语法,以及函数的目的。无论你的数学成绩如何,请拿出你的 KAlgebra 计算器,运行一些数字。这真是非常有趣。
---
via: <https://opensource.com/article/22/2/kalgebra-linux-calculator>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | If you spent your high school years gazing at TI-80 series calculators but lost track of the device somewhere along the way, then you might sometimes yearn to relive those thrilling years of algebra and calculus. Somebody on the Linux KDE project must have felt that way, too, because one of the KDE Framework libraries, Analitza, provides syntax and widgets to enable you to perform advanced math functions with K apps like the graphing calculator KAlgebra.
## Install KAlgebra on Linux
On Linux, you can install KAlgebra from your software repository. For example, on Fedora, Mageia, and similar:
`$ sudo dnf install kalgebra`
On Elementary, Linux Mint, and other Debian-based distributions:
`$ sudo apt install kalgebra`
Alternately, you can [install it as a flatpak](https://opensource.com/article/21/11/install-flatpak-linux).
## Linux calculator
KAlgebra is, like many of the famous graphing calculators used in schools, both a scientific calculator and a 2D plotter. Unlike any of the graphing calculators I've ever used, it's also a 3D plotter. But before rushing into 3D space, start with some basic syntax.
When representing an equation in KAlgebra, you must do some minor translation of math symbols as they're often written by hand to how they're represented on a computer. For instance, to convert Fahrenheit degrees to Celsius, the equation is: (5÷9) × (n-32), where *n* is Fahrenheit. This is generally how equations and mathematical functions are expressed: they use special symbols like ÷ and × as well as variables like n, and then they identify what variable represents what kind of value. You may or may not know the meaning of every special math symbol, but as long as you know that a special symbol has a specific meaning, then you can look it up. In the temperature conversion example, the symbols are pretty common, so you probably already know that ÷ represents division and × represents multiplication.
In KAlgebra, as in most programming languages, division is represented by a forward slash and multiplication by an asterisk, so the equation to, for example, convert 70° Fahrenheit is `(5/9)*(70-32)`
.
There are also special functions for common math operations in KAlgebra, and when you type any letter into KAlgebra, a tooltip provides potential auto-completion for available functions. Another way to write the equation for temperature conversion in KAlgerbra is to use the *times* function: `times(5/9, 70-32)`
.
As you complete math problems, established variables are listed in the right column of the calculator, including the `ans`
value, which is updated with the answer to the completed equation. In theory, then, you should be able to reverse the conversion and derive a Fahrenheit temperature from *ans*.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
## Graphing calculator
Numbers are fun, but they really get fun when they're used to draw shapes. The visualization of 2D space on a graph is an important skill to develop for all kinds of disciplines, not the least of which is computer programming.
To draw a line on a graph, you must set a horizontal value (the x-axis) or a vertical value (the y-axis) or both. A valid equation for a straight line in common mathematical notation is just `x=5`
. This produces a straight horizontal line 5 points above the 0 origin point of the graph. However, in KAlgebra you must make it explicit that you want to set just the x value with the notation `x->5`
.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
Other than that, graphing is as straightforward as it is elsewhere. You can write complex equations, and you can use special functions, like `sin`
.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
## 3D graph on Linux
By the time you get to the 3D graph tab, you likely have a good understanding of the syntax of KAlgebra, and you've also exceeded my mathematical knowledge. I learned everything I know about cartesian graphs from electronics and synthesis, so the most fun I've had with the 3D graph is visualizing a sine wave as a 3D object:

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
The difference between the 3D graph and the 2D graph (aside from 1 dimension) is that you can only have one plot in the 3D graph, so choose your equations wisely.
## Can math be fun?
It turns out that yes, math can be fun, and the answer is a good graphing calculator. As I've been working my way through math lessons to make up for some pretty dismal math grades in my past, I find myself wishing that calculators had been encouraged. I'm finding KAlgebra to be a very useful tool for not only solving arbitrary problems, but also for understanding the syntax of equations, and the purpose of functions. Whatever your relationship with mathematics, take out your KAlgebra calculator and run some numbers. It's actually really fun.
## Comments are closed. |
14,344 | Nitrux 2.0:令人惊艳的发行版 | https://www.debugpoint.com/2022/03/nitrux-2-0-review/ | 2022-03-10T11:43:00 | [
"Nitrux"
] | /article-14344-1.html |
>
> 以下是对 Nitrux 2.0 在性能稳定性方面的点评,以及我们对是否可以将其用作日常使用的看法。
>
>
>

[Nitrux Linux](https://nxos.org/) 是基于 Debian 的,其特点是采用了修改版的 KDE Plasma 桌面,它被称为 NX 桌面。这个独特的 Linux 发行版带来了它自己的一套 Nitrux 应用程序,它们建立在 Maui 套件和 Qt 上。Nitrux 是没有 systemd 的,它使用 OpenRC 作为初始化系统。凭借所有这些独特的功能和令人惊叹的外观,它是当今最好的 Linux 发行版之一。
Nitrux 团队在 2022 年 2 月发布了它的主要版本 2.0,最近又发布了第一个小版本。因此,我们觉得现在是对这个漂亮的桌面进行评价的好时机。

### Nitrux 2.0 点评
#### 安装
Nitrux 使用了一个修改版的 Calamares 安装程序。该操作系统的 ISO 包含<ruby> 临场 <rt> live </rt></ruby>桌面,在此你可以访问安装操作系统的快捷方式。启动选项包括更多的选项,包括 `nomodset` 内核启动选项。
在虚拟机测试中,安装很顺利,但在实际的硬件中却失败了,因为我的 NVIDIA 340 有点老。因此,如果你打算安装较新的硬件,应该没有问题。
#### 第一印象和桌面
在外观方面,Nitrux 可以说是与当今所有外观优秀的发行版不相上下,比如深度、Cutefish OS。它们都为用户和 Nitrux 操作系统带来了开箱即用的定制功能。但 Nitrux 的优势在于 KDE Plasma、Plasmoid、Kvuntum 主题与基于 Maui 套件组件的奇妙组合。
当你第一眼看到它的时候,它看起来很好,而且有良好的组织性,底部预配置了 Latte Dock、友好而干净的顶部栏。
它基于 KDE Plasma,你可以轻松地改变外观和感觉,并通过设置在深色和浅色模式之间切换。默认字体 Fire Sans 使它成为一个整体设计完美的桌面。
这个版本采用了 KDE Plasma 5.24+,KDE 框架 5.91 和 xanmod 版的 Linux 内核 5.16。
到目前为止,我的第一印象没有任何槽点。
#### 登录和 Shell
不久前,该团队 [引入](https://www.debugpoint.com/2022/01/maui-shell-first-look-1/) 了 Maui Shell,这是一个以 Cask 为特色的融合性桌面,即 Shell 层。这是这个体验式 Shell 的第一个版本,用户通过登录窗口就可以看到。
但唯一困扰我的是,Cask(仍然是实验性的)被定为默认登录会话。那些知道的人会把它改成 Plasma,但那些不知道的人会有些吃惊!

#### 应用程序
Nitrux 使用 AppImage 格式来发布应用程序。大多数预装的应用程序都是 AppImage。而且在通知方面,它们与整个桌面很好地结合在一起。Nitrux 也会检测你的下载文件夹中外部下载的 AppImage 进行安装。
默认情况下,它预装了以下本地 [Maui 应用程序](https://www.debugpoint.com/2022/03/top-nitrux-maui-applications/):
* Index 文件管理器
* Station 终端
* Pix 图像浏览器
* Nota 文本编辑器
* Nitro 分享
* NX 软件中心
Firefox 和 LibreOffice 也预装了,以满足基本需求。你可以根据你的工作流程需要,通过 NX 软件中心安装其他应用程序。
关于 Firefox 和更新 Nitrux 的一点提醒。有一些报告说 Firefox 在进行基本系统更新后被删除。在你点击升级之前,请确保你通过终端用 `apt get —upgradable` 检查文件的变化。
#### 性能和资源消耗
因为我无法把它安装在我的物理机上。因此,下面提到的性能指标是在 [virt-manager](https://www.debugpoint.com/2020/11/virt-manager/) 虚拟管理器下测量的。
在空闲状态下,它使用大约 1GB 的内存,CPU 在 9% 到 10%。KWin 窗口管理器和 Latte Dock 在底部消耗了大部分的资源。

现在是时候通过一些繁重的工作负载来运行它了。这包括一个文本编辑器、LibreOffice、文件管理器、图像查看器和 Firefox 的五个标签,其中一个标签正在播放一个 YouTube 视频。
你可以在下面的图片中看到资源使用的峰值。在这种状态下,它使用了接近 2GB 的内存,CPU 为 26%。和往常一样,Firefox 浏览器消耗了大部分资源。

我想说的是,从性能上来说,它的表现还算可以。因为开箱即用的定制版,Latte Dock 和 Kvuntum 主题确实占用了一些资源。而这个指标在空闲和重载状态下要高于基本的 KDE Plasma。
#### 一些有问题的地方
不幸的是,在我的测试过程中,Nitrux 2.0 有几个小问题:
* 在我的 i3+SSD+4gb+NVIDIA+Broadcom 的旧系统中尝试安装了一个小时后 - 我无法让 Calamares 安装程序开始安装。
* 在<ruby> 临场 <rt> live </rt></ruby>会话中没有检测到 Wi-Fi。然而,到目前为止,我在这个设备上测试的所有发行版都能检测到它。
* KWin 在临场会话开始时崩溃了。
* 由于网络连接的原因,Calamares 安装程序的“下一步”按钮被禁用。这对我来说有点奇怪。
* 而最小的安装 ISO 也给出了 [plymouth failed to start #17](https://github.com/Nitrux/nitrux-bug-tracker/issues/17) 的错误。
然后我在 [这里](https://nxos.org/known-issues/known-issues-nitrux-2-0-1/) 找到了已知问题部分,其中提到了一些问题。我确信这与 xanmod 版的 Linux 内核 5.16 有关。主线内核本来是没有问题的。
在虚拟机环境中,实验性的 Maui Shell 是不能使用的。点击和触摸操作大多不工作。但考虑到这是一个测试版本,这是可以理解的。
我觉得 Calamares 安装程序的错误需要在下一个版本之前进行更多的测试。
### 下载 Nitrux 2.0 +
你可以从以下链接下载最新版本:
* [下载 Nitrux](https://nxos.org/download/standard/)
### 结束语
如果你喜欢 KDE Plasma,并且不想在定制上花费太多精力,你可以选择 Nitrux 2.0。另外,许多用户喜欢类似于 Debian 的稳定性,而不要 systemd。那么,对他们来说,这是一个完美的选择。
但因为有一些错误,我不会向超小白的新用户推荐这个发行版。如果你对 Linux 有一定的了解,并且知道如何用命令行解决一些小问题,那么它就很适合你。你可以使用 Nitrux 2.0 作为你的日常系统。只是要谨慎对待 Debian 的不稳定软件包,这些软件包在更新后偶尔会出现问题。
加油!
---
via: <https://www.debugpoint.com/2022/03/nitrux-2-0-review/>
作者:[Arindam](https://www.debugpoint.com/author/admin1/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) | null |
14,346 | 在你的 Linux KDE 桌面上粘贴便签 | https://opensource.com/article/22/2/sticky-notes-linux-kde | 2022-03-11T08:33:58 | [
"便签"
] | https://linux.cn/article-14346-1.html |
>
> 使用 Kontact 套件的功能 KNotes 温和地提醒你自己的日常任务。
>
>
>

我记得我第一次参加一个“不算会议的”会议,起初这是一个混乱的活动,有很多社交和个人项目的分享,但它逐渐凝聚成一个主要是自发组织的技术活动。这一切并没有用魔法,而用的是便签。人们在那些彩色的粘性记事贴上写下演讲和演示的想法,并将它们贴在共同的墙上,其他人将类似的想法分组,最终每个人都知道聚集在哪里讨论特定的话题。这是一件美好而令人满意的见证,它让我对便签有了新的认识。所以我很高兴最近发现 KDE Plasma 桌面有了数字便签,而且在很多方面它们甚至比实体的更有用。该应用叫做 KNotes,如果你有随意的想法想记下来,那么你可能想在自己的 Linux 桌面贴上它。
### 安装 KNotes
KNotes 是 Kontact 套件的一部分,这是 KDE 的个人信息管理器(PIM)。如果你正在运行 Plasma 桌面,那么你可能已经安装了 KNotes。如果没有,你可以从包管理器安装它:
```
$ sudo dnf install kontact
```
在基于 Debian 的发行版上,使用 `apt` 命令而不是 `dnf`。
### Linux 桌面上的 KNotes
尽管 KNotes 是 Kontact 的一部分,但它也是一个可以在后台运行的独立应用,随时可以在你需要时生成空白便签。从你的应用菜单启动 KNotes,它会将自身最小化到你的系统托盘。它的图标是一个黄色的小方块,因为在便签在现实生活中变得丰富多彩之前,它们往往都是黄色的。
要创建新便签,请右键单击系统托盘中的 KNote 图标并选择 “<ruby> 新便签 <rt> New Note </rt></ruby>”。第一次创建便签时,系统会提示你选择保存的位置。选择本地 KNotes 数据库文件(它由 Kontact 管理,因此你不会直接与该文件交互)并默认使用此位置。之后就不会再收到这种提示。
你的桌面上会出现一个新便签,你可以自己在其中输入。

就这么简单。至少它可以像这种老式的纸质便签一样。但这些是数字版的 KDE KNotes,因此你可以做的不仅仅是记下一些提醒文本给自己。
### 更改便签颜色
当一堆黄色便签开始混合在一起,你可以对便签进行颜色编码。右键单击便签的标题栏(带有日期和时间的部分),然后从出现的上下文菜单中选择 “<ruby> 首选项 <rt> Preferences </rt></ruby>”。在该窗口中,你可以更改标题和正文字体和字体大小,然后选择 “<ruby> 显示设置 <rt> Display Settings </rt></ruby>” 选项卡以更改便签纸和字体的颜色。

### 发送便签
以前自己写便签的时候,经常会在 [Emacs](https://opensource.com/downloads/emacs-cheat-sheet) 的暂存缓冲区中给自己写一些提醒。有更好的方法来管理 [Emacs 中的便签](https://opensource.com/article/18/7/emacs-modes-note-taking),但是我将便签内容记下后,之后心不在焉地关闭而没保存的习惯很难改掉。
有了 KNotes,便签会自动保存到 Kontact,因此你不必担心需要记着它们。更好的是,它们是数字的,因此你可以将它们发送给自己的其他设备。你可以通过电子邮件将便签发送给自己,也可以通过网络将它们发送到另一台计算机。只需右键单击便签的标题栏,你就可以选择“<ruby> 电子邮件 <rt> Email </rt></ruby>”或“<ruby> 发送 <rt> Send </rt></ruby>”。
要从一个到另一个 KDE Plasma 桌面以 KNotes 方式接收便签,你必须在接收机器上授予 KNotes 接收便签的权限。要允许传入便签,请右键单击系统托盘中的 KNotes 图标并选择 “<ruby> 配置 Knotes <rt> Configure KNotes </rt></ruby>”。

### 设置闹钟
至少对我来说,写便签通常是因为我答应了某人的事情,通常是在短期内,比如一天结束之前。随着我的工作和打开越来越多的窗口,贴在桌面上的便签往往会被掩盖,所以 KNotes 允许你为真正重要的便签设置闹钟,这一点特别有用。
要为便签设置闹钟,请右键单击便签的标题栏并选择 “<ruby> 设置闹钟 <rt> Set alarm </rt></ruby>”。
### 在 Linux 上做便签
便笺是记录日常任务的简单而有趣的方法。它们不是对每个人都“有效”,也不是我跟踪每天要做的事情的唯一手段,但它们是很好的选择,而且在一天结束时,在删除已完成的便签前将它们移到“已完成”那一堆,没有什么比这更令人心满意足的了。试一试吧,这是个可能能坚持下去的习惯。
---
via: <https://opensource.com/article/22/2/sticky-notes-linux-kde>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | I remember the first time I went to an "un" conference. It was a chaotic event at first, with lots of socializing and sharing of personal projects, but it gradually coalesced into a mostly self-organized technical event. It didn't happen with magic, but with sticky notes. People wrote ideas for talks and presentations on those colorful adhesive notepads, and stuck them to a common wall, and other people grouped similar ideas into clusters, and eventually everyone knew where to congregate to discuss specific topics. It was a beautiful and satisfying thing to witness, and it gave me a new respect for sticky notes. So I was happy to recently discover that the KDE Plasma Desktop has digital sticky notes, and in many ways they're even more useful than the physical ones. The application is called KNotes, and if you have random ideas that you feel like jotting down, it's probably something you want to consider for your own Linux desktop.
## Install KNotes
KNotes is part of the Kontact suite, which is the personal information manager (PIM) for KDE. If you're running the Plasma Desktop, then you probably already have KNotes installed. If not, you can install it from your package manager:
`$ sudo dnf install kontact`
On a Debian-based distribution, use the `apt`
command instead of `dnf`
.
## KNotes on the Linux desktop
Even though KNotes is part of Kontact, it's also a stand-alone application that can run in the background, ready to produce a blank note whenever you need one. Launch KNotes from your application menu, and it minimizes itself to your system tray. Its icon is a small yellow square, because before sticky notes got colorful in real life they tended to all be yellow.
To create a new note, right-click the KNote icon in your system tray and select **New Note**. The first time you create a note, you're prompted to choose a destination for the saved note. Select the local KNotes database file (it's managed by Kontact, so you won't interact with that file directly) and enable the selection to use this location by default. From then on, you won't be prompted again.
A new note appears on your desktop, and you can type yourself a note.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
It's as simple as that. Or at least, it would be, were these old-fashioned physical notes. But these are digital KDE KNotes, so you can do a lot more than just jot down some reminder text to yourself.
## Changing note colors
A bunch of yellow notes start to blend together, but you can color-code notes. Right-click on the title bar of the note (the part with the date and time) and select **Preferences** from the contextual menu that appears. In the **Preferences **window, you can change the title and body font and font size, and then select the **Display Settings** tab to change the note and font colors.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
## Sending notes
When I used to write myself notes, I often jotted reminders to myself in the scratch buffer of [Emacs](https://opensource.com/downloads/emacs-cheat-sheet). There are better ways to manage [notes in Emacs](https://opensource.com/article/18/7/emacs-modes-note-taking), but my habit of jotting notes down in places that I was destined to be absent-mindedly close later, without saving, was difficult to break.
With KNotes, the notes are automatically saved to Kontact, so you don't have to worry about keeping track of them. Better still, they're digital, so you can send them to yourself on other devices. You can email notes to yourself, or you can send them to another computer over your network. All it takes is a right-click on the title bar of a note, and you can select **Email **or **Send**.
To receive notes as KNotes from one KDE Plasma Desktop to another, you must give KNotes permission on the recipient machine to accept notes. To allow incoming notes, right-click on the KNotes icon in the system tray and select **Configure KNotes**.

(Seth Kenlon, [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
## Setting alarms
At least for me, notes usually happen because I've promised someone something in the short term, often by the end of the day. Notes stuck to my desktop do tend to get covered up as I work and open more and more windows, so it's especially helpful that KNotes allow you to set alarms for the really important ones.
To set an alarm for a note, right-click on the note's title bar and select **Set alarm**.
## Take notes on Linux
Sticky notes are easy and fun ways to keep track of daily tasks. They don't "work" for everyone, and they aren't my only means of tracking things I mean to do each day, but they're great options to have, and there's nothing more satisfying than moving a completed note into the "done" pile before deleting them all at the end of the day. Give it a try, it's a habit that just might stick.
## Comments are closed. |
14,347 | 《Apex 英雄》正式可在 Steam Deck 和 Linux 上运行 | https://news.itsfoss.com/apex-legends-steam-deck-verified/ | 2022-03-11T09:09:11 | [
"游戏",
"Steam"
] | https://linux.cn/article-14347-1.html |
>
> 《Apex 英雄》现已通过 Steam Deck 验证,这使其成为支持 Linux 的顶级多人游戏之一。
>
>
>

《<ruby> Apex 英雄 <rt> Apex Legends </rt></ruby>》是最受欢迎的多人游戏之一,我们都在急切地等待它能在 Linux 上运行。
特别是,在它 [宣布正式支持 Linux 的 Easy Anti-Cheat 和 BattleEye](https://news.itsfoss.com/easy-anti-cheat-linux/) 之后。
然而,官方一直并没有宣布支持该游戏,直到刚刚。
它似乎已经被添加到 Valve 的 Steam Deck 验证游戏列表中,这事最初是由 [GamingOnLinux](https://www.gamingonlinux.com/2022/03/apex-legends-gets-steam-deck-verified/) 发现的。
你可以在 [官方 Steam Deck 验证页](https://www.steamdeck.com/en/verified) 上自己检查,或者通过 [SteamDB](https://steamdb.info/app/1172470/history/?changeid=14171059) 发现这一变化。
### 在 Linux 上玩《Apex 英雄》已成为现实

随着 Steam Deck 的验证状态,可以说我们现在有了在 Linux 上运行的顶级多人射击游戏之一。
如果你不知道的话,《Apex 英雄》目前是 Steam 上排名前十的游戏之一,它在 PC 上有大量的玩家。

因此,如果你因为缺乏多人游戏支持而不愿意在桌面上尝试 Linux,现在你可以考虑了。
如果你仍然犹豫,你或许可以看看我 [推荐用 Linux 玩游戏](https://news.itsfoss.com/linux-for-gaming-opinion/) 的观点,以了解更多信息(Linux 的多人游戏和反作弊支持已经有所改善,但文章的大部分内容仍然有效!)。
而且,如果你已经有一个 Steam Deck 游戏机,你现在就可以安装这个游戏并玩起来了。
注意,如果你是在 Linux 桌面上尝试,你可能要在 Steam 上启用 Proton 支持,并选择“<ruby> 实验性 Proton 支持 <rt> Proton Experimental </rt></ruby>”。
当然,还有许多其他游戏,如《<ruby> 彩虹六号:围攻 <rt> Rainbow Six Siege </rt></ruby>》,也应该支持 Steam Deck 或一般的 Linux 系统。现在有了 Linux 上的《Apex 英雄》,其他的多人游戏作品可能会重新考虑为 Steam Deck 或 Proton 测试他们的游戏。
这里有一段 Liam Dawe 的视频,展示了运行在 Steam Deck 上的《Apex 英雄》:
你试过在 Linux 桌面或 Steam Deck 上运行《Apex 英雄》吗?请在下面的评论中告诉我你的看法。
---
via: <https://news.itsfoss.com/apex-legends-steam-deck-verified/>
作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

We have all been eagerly waiting for Apex Legends to work on Linux, considering it is one of the most popular multiplayer titles.
Especially, after the [announcement of official support for Easy Anti-Cheat and BattleEye](https://news.itsfoss.com/easy-anti-cheat-linux/) for Linux.
However, the official support for the game wasn’t announced anywhere, until now.
It seems to have been added to Valve’s Steam Deck Verified list of games, as originally spotted by [GamingOnLinux](https://www.gamingonlinux.com/2022/03/apex-legends-gets-steam-deck-verified/?ref=news.itsfoss.com).
You can check for yourself on the [official Steam Deck verified webpage,](https://www.steamdeck.com/en/verified?ref=news.itsfoss.com) or spot the change via [SteamDB](https://steamdb.info/app/1172470/history/?changeid=14171059&ref=news.itsfoss.com).
## Apex Legends on Linux is Now a Reality

With the Steam Deck verified status, it is safe to say that we now have one of the top multiplayer shooter games running on Linux.
In case you did not know, Apex Legends is currently one of the top 10 games on steam, with a massive player base on PC.

So, if you were reluctant to try Linux on your desktop for the lack of multiplayer game support, now you can consider switching.
If you are still confused, you might want to check out my thoughts on [recommending Linux for gaming](https://news.itsfoss.com/linux-for-gaming-opinion/) to know more about it (the multiplayer and anti-cheat support for Linux has improved, but most of it still holds true!).
And, if you already have a Steam Deck console, you can get started by installing the game and getting in for some fun.
Note that if you are trying on a Linux desktop, you might want to enable proton support on Steam and select Proton Experimental.
Of course, there are many other titles like Rainbow Six Siege that should also support Steam Deck or Linux in general. But, now with Apex Legends on Linux, other multiplayer titles will probably reconsider testing their games for the Steam Deck or Proton.
Here’s a video by Liam Dawe showing Apex Legends running on Steam Deck:
*Have you tried running Apex Legends on a Linux desktop or Steam Deck? Let me know your thoughts in the comments below.*
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,349 | 有了新家的 Budgie 发布了第一个新版本 | https://news.itsfoss.com/budgie-10-6-release/ | 2022-03-11T22:59:00 | [
"Budgie"
] | https://linux.cn/article-14349-1.html |
>
> 在一个新组织的管理下, Budgie 10.6 发布在一个新的仓库,进行了一些令人印象深刻的改进。
>
>
>

早在今年一月份,Solus 的前联合负责人 Joshua Strobl 在离开 Solus 后去 SerpentOS 工作的传闻成为了新闻头条。
你可以在我们的 [原始报道](https://news.itsfoss.com/solus-co-lead-resign-budgie-serpent/) 中阅读更多关于它的内容。
然而,他仍然想为 Budgie 桌面环境工作,所以他(在一个新的仓库中)复刻了这个项目,并成立了 Buddies Of Budgie 组织。三个月后,这个组织变化后的第一个版本已经到来,我们将在这里看看它。
### Budgie 10.6 的新变化

鉴于这是自上述组织结构调整后的第一个版本,它的功能变化相当少。尽管如此,这里有一个关于新内容的总体总结:
* 完善的主题设计
* 新的通知系统
* 代码重新格式化
在最新更新的公告中,Joshua 还提到:
>
> Budgie 10.6 旨在弥合 Budgie 传统的“下游”消费者和开发组织本身之间的鸿沟,使像 Ubuntu Budgie 这样的下游能够更密切地参与到它的开发当中。
>
>
> 作为我们的核心支柱之一,即成为一个平台而不是一个产品,Budgie 10.6 和未来的 Budgie 版本的目标是提供一个宏观世界,或一组最小的紧密耦合的组件,并将生态系统的其余部分留给下游消费者的决策和价值观,无论它是发行版还是终端用户。
>
>
>
所以,如果你担心 Budgie 桌面环境在分裂后的发展,这应该能让你放心了。
#### 主题改进

看起来,这个版本的主题改进基本上是为了提高一致性,做一些细节的改变,以获得现代的外观。
例如,边框圆角已经应用于一些桌面元素,统一的间距,统一的小工具的颜色方案,以及对 GTK 主题支持的其他改进。
从我对这个版本的亲身体验来看,这些变化是细微的,但也能让人感受到,而且确实感觉到它们使 Budgie 更能与 GNOME 和 KDE 等桌面相提并论。
#### 新的通知系统
虽然不是很明显,但 Budgie 现在已经有了一个新的通知系统。其最大的影响是它现在已经从位于屏幕右侧的面板 Raven 中移出。
因此,其他 Budgie 组件现在可以使用新的通知系统。一个提到的例子是“解锁未来在图标任务列表中支持通知徽章的能力”。
同样,虽然此变化很小,但确实打开了未来的可能性,希望我们能在未来的版本中看到这些带来的变化。
#### 其他改进措施
Budgie 10.6 一些其他的变化包括:
* 使用制表符而不是空格,对一些代码进行了常规的重新格式化。
* 重新引入对 GNOME 40 的支持,以启用 Ubuntu LTS 支持。
* 将 GNOME 控制中心重新命名为 Budgie 控制中心。
* 修复了扩大 Raven 缩略图导致 Raven 本身调整大小的问题。
如果你想了解更多,你可以在 [GitHub](https://github.com/BuddiesOfBudgie/budgie-desktop/releases/tag/v10.6) 上找到发布公告,以获得完整的新功能列表。
* [Budgie 10.6](https://github.com/BuddiesOfBudgie/budgie-desktop/releases/)
### 获得 Budgie 10.6
如果你想获得 Budgie 10.6,最好是先等待你的发行版将其打包。如果你使用的是 Arch,这可能需要不到一周的时间,而 Ubuntu 及其衍生版本则需要更长时间。
对于那些喜欢冒险的人来说,你也可以尝试编译它,但如果你愿意尝试,你可能已经知道如何做了。
总的来说,Budgie 10.6 看起来是一个值得关注的版本,特别是考虑到其重大的组织变化。
你对 Budgie 10.6 的变化有什么看法?请在下面的评论中告诉我们吧!
---
via: <https://news.itsfoss.com/budgie-10-6-release/>
作者:[Jacob Crume](https://news.itsfoss.com/author/jacob/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Back in January, ex-co-lead of Solus Joshua Strobl made headlines after leaving Solus to work on SerpentOS.
You can read more about it in our [original coverage](https://news.itsfoss.com/solus-co-lead-resign-budgie-serpent/).
However, he still wanted to work on the Budgie desktop environment, so he forked the project (in a new repository) and formed the Buddies Of Budgie organization. Three months later, the first release since this organizational change has arrived, which we will be looking at here.
## Budgie 10.6: What’s New?

Seeing as this is the first release since the aforementioned organizational shift, it is pretty light on features. Despite this, here is a general round-up of what’s new:
- Theming refinements
- New notification system
- Code reformatting
With the announcement of the latest update, Joshua also mentions:
Budgie 10.6 aims to eliminate the divide between traditional “downstream” consumers of Budgie and the development organization itself, enabling those downstreams like Ubuntu Budgie to get more intimately involved in its development.
Applying one of our core pillars of being a platform rather than a product, the goal with Budgie 10.6 and future releases of Budgie is to provide a macrocosm, or a minimal set of tightly coupled components, and leave the rest of the ecosystem up to the decisions and values of downstream consumers, be that distributions or end users.
So, if you were worried about the development of the Budgie desktop environment after the split, this should reassure you.
### Theming Improvements

It appears that this release’s theming improvements were almost entirely about improving consistency and subtle changes for a modern look.
For example, border radii have been applied to some desktop elements, uniform spacing, the unified color scheme for widgets, and other improvements to the support for GTK themes.
From my hands-on experience with this release, the changes were subtle but there, and it did feel as if they brought Budgie more in line with desktops like Gnome and KDE.
### New Notification System
While not immediately obvious, Budgie has now received a new notifications system. The biggest impact of this is that it has now been moved out of Raven, the panel located on the right side of the screen.
As a result, other Budgie components can now use the new notifications system. One mentioned example is “*unlocking the capability to support notification badges in Icon Tasklist in the future*”.
Again, while minor, this change does open up future options, so hopefully, we can see these taken advantage of in future releases.
### Other Improvements
Some other changes in Budgie 10.6 include:
- Use of tabs instead of spaces, general reformatting of some code.
- Reintroduce support for GNOME 40, to enable Ubuntu LTS support.
- Renaming GNOME Control Center to Budgie Control Center.
- Fixes to expanding Raven thumbnail causing Raven itself to resize.
If you are curious to learn more, you can find the release announcement on [GitHub](https://github.com/BuddiesOfBudgie/budgie-desktop/releases/tag/v10.6?ref=news.itsfoss.com) for a full list of new features.
## Getting Budgie 10.6
If you want to get Budgie 10.6, it would probably be best to wait for your distribution to package it first. This will likely take less than a week if you are on Arch, with Ubuntu and its derivatives taking somewhat longer.
For those feeling adventurous, you could also try compiling it, but you probably already know how to do that if you’re willing to try it.
Overall, Budgie 10.6 seems to be an exciting release, especially considering its significant organizational changes.
*What do you think about the changes in Budgie 10.6? Please, let us know in the comments below!*
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,350 | Coolero:监测和控制冷却设备的开源应用 | https://itsfoss.com/coolero/ | 2022-03-12T09:22:01 | [
"冷却"
] | https://linux.cn/article-14350-1.html |
>
> 正在寻找一个 GUI 程序来管理 Linux 上的 AIO 和其他冷却设备么?让我们来了解一下 Coolero,以获得一些帮助。
>
>
>

说到 Linux,我们无法从 NZXT、Corsair、MSI、ASUS 等品牌那里获得官方软件支持来管理 PC 上的硬件组件。
虽然有开源的驱动/工具可以使事情顺利进行,但在具有图形用户界面(GUI)的程序中,它仍然是一项正在进行的工作。例如,[配置游戏鼠标](https://itsfoss.com/set-up-razer-devices-linux/) 或 [在 Linux 上设置 Razer 设备](https://itsfoss.com/set-up-razer-devices-linux/)。
幸运的是,这些年来情况有所改善,现在可以在 Linux 上管理/调整各种最新的外围设备和组件。
其中一个改进就是有了一个开源的 GUI 程序来管理和监控冷却设备,即 Coolero。
**注意:** 该程序正在积极开发中,并慢慢向其第一个主要版本发展。
### Coolero:轻松地管理你的水冷

当我去年升级我的电脑时,我对我的 AIO(All-in-One)水冷(Corsair Hydro 100i Pro XT)缺乏软件支持感到恼火。
这不仅仅是控制 RGB 灯光(为了美观),而且我找不到一个方便的方法(使用 GUI 程序)来平衡风扇配置。
现在,有了 [Coolero](https://gitlab.com/codifryed/coolero) 就可以做到了。Coolero 是一个使用 [liquidctl](https://github.com/liquidctl/liquidctl) 和其他一些库来控制冷却设备的前端,主要包括 AIO、风扇集线器/控制器,还有 PSU 和一些 RGB 照明支持。
它支持一系列的水冷和一些 PSU。你可以在其 GitLab 页面上获得所有支持设备的细节。请注意,对一些冷却器的支持仍然是试验性的,而且你还不能让你的 Kraken Z 上的 LCD 屏幕与它一起工作。
让我强调一下主要的特点。
### Coolero 的特点

现在有无数的冷却设备。但是,Coolero 支持一些流行的选项和它的变体来控制基本功能:
* 系统概览图
* CPU 温度/负载
* GPU 温度/负载
* 支持多个设备,以及同一设备的多个版本。
* 能够使用该图表定制风扇配置文件。
* 提供了几个预设的风扇配置文件。
* 能够调整 RGB 照明配置文件。
* 保存配置文件并在启动时应用它。
用户界面简单易懂,易于使用。你可以与图表互动以启用/禁用对特定组件的监控。
你所连接的 AIO 或控制器应该作为单独的组件出现在界面上,使你很容易控制它们。

你会有两种类型的功能,控制风扇和灯光(如果有的话)。我使用风扇图表来定制我的 AIO 上的风扇配置文件。
根据我的简单测试,它与 Corsair AIO 工作很好。你可以用它来尝试 NZXT 冷却器、PSU、控制器和智能设备(或集线器)。
### 在 Linux 中安装 Coolero
Coolero 以 AppImage、Flatpak(通过 [Flathub](https://flathub.org/apps/details/org.coolero.Coolero))的形式提供,或者你可以从源代码中构建它。
如果你是 Linux 的新手,你可能想参考我们的 [AppImage 指南](https://itsfoss.com/appimagepool/) 和 [Flatpak 帮助资源](https://itsfoss.com/flatpak-guide/)。
要探索更多关于它的信息,请前往下面链接的 GitLab 页面。
* [Coolero](https://gitlab.com/codifryed/coolero)
### 总结
如果你有 AIO、集线器和控制器需要按照你的要求进行调整,那么 Coolero 是一个令人兴奋的项目,值得关注。
虽然你可以尝试使用一些命令行工具,但这并不是实现你的 PC 中的组件的基本控制的最方便的方法。
你试过了吗?你用什么来管理你的 Linux 系统上的 AIO 或冷却器?请在下面的评论中告诉我你的想法。
---
via: <https://itsfoss.com/coolero/>
作者:[Ankush Das](https://itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | **Brief: ***Looking for a GUI program to manage your AIOs and other cooling devices on Linux? Let’s explore Coolero to get some help with it.*
When it comes to Linux, we do not get official software support from brands like NZXT, Corsair, MSI, ASUS, etc., to manage hardware components on PC.
While open-source drivers/tools are available to make things work, it is still a work in progress in programs with a graphical user interface (GUI).
For instance, when [configuring a gaming mouse](https://itsfoss.com/set-up-razer-devices-linux/) or [setting up razer devices on Linux](https://itsfoss.com/set-up-razer-devices-linux/).
Fortunately, things have improved over the years, and now it is possible to manage/tweak a wide range of the latest peripherals and components on Linux.
One such improvement is the availability of an open-source GUI program to manage and monitor cooling devices, i.e., Coolero.
**Note:** The app is in active development and slowly working towards its first major release.
## Coolero: Manage Your Liquid Coolers Easily

When I upgraded my PC last year, I was annoyed at the lack of software support for my AIO (All-in-One) liquid cooler (Corsair Hydro 100i Pro XT).
It is not just about controlling the RGB lighting (for aesthetics), but I could not find a convenient way (using a GUI program) to balance the fan profiles.
Now, with [Coolero](https://gitlab.com/codifryed/coolero), it is possible. Coolero is a front-end that uses libraries like [liquidctl](https://github.com/liquidctl/liquidctl) and a few others to control cooling devices, mostly AIOs, fan hub/controllers, along with PSUs and some RGB lighting support.
It supports a range of liquid coolers and some PSUs as well. You can get all the details of the supported device on its GitLab page. Note that the support for some coolers is still experimental, and you cannot make the LCD screen on your Kraken Z work with it yet.
Let me highlight the key features.
## Features of Coolero

There are numerous cooling devices available out there. But, Coolero supports some popular options and its variants to control the essentials.
- System overview graph
- CPU temperature/load
- GPU temperature/load
- Supports multiple devices, and versions of the same device.
- Ability to customize the fan profile using the graph.
- Limited presets available for fan profiles.
- Ability to tweak the RGB lighting profiles
- Saves the profiles and applies it back at startup.
The user interface is simple to understand and easy to use. You can interact with the graph to enable/disable the monitoring of a specific component.
The AIOs or controllers you have connected should appear listed as separate components in the interface, making it easy to control them.

You get two types of functionality, controlling the fans and the light (if any). I used the fan graph to customize the fan profile on my AIO.
As per my brief test, it worked well with the Corsair AIO. You can try NZXT coolers, PSUs, controllers, and smart devices (or hubs) with it.
## Install Coolero in Linux
Coolero is available as an AppImage, Flatpak (via [Flathub](https://flathub.org/apps/details/org.coolero.Coolero)), or you can build it from the source.
You may want to refer to our [AppImage guide](https://itsfoss.com/appimagepool/) and [Flatpak help resource](https://itsfoss.com/flatpak-guide/) if you are new to Linux.
To explore more about it, head to its GitLab page linked down below.
## Wrapping Up
Coolero is an exciting project to keep an eye on if you have AIOs, Hubs, and controllers that need to be tweaked as per your requirements.
While you can try using some command-line tools, it is not the most convenient way to achieve the basic controls of the components in your PC.
*Have you tried it yet? What do you use to manage your AIOs or coolers on your Linux system? Let me know your thoughts in the comments down below.* |
14,352 | KDE Plasma 5.24:精心制作的主宰 Linux 世界的桌面 | https://www.debugpoint.com/2022/03/kde-plasma-5-24-review/ | 2022-03-12T20:28:00 | [
"KDE"
] | /article-14352-1.html |
>
> 是时候对前段时间发布的 KDE Plasma 5.24 桌面进行一次简单的回顾和点评了。
>
>
>
*开源朗读者 | 张锦航*
KDE 团队用他们完美的 KDE Plasma 5.24 再次做到了。一个在效率、新功能、性能、稳定性和一切方面都非常完美的版本为所有用户带来了一个优秀的桌面环境。
KDE Plasma 5.24 是 Plasma 的第 26 个版本,也是长期支持(LTS)版本,它将为 Kubuntu 22.04 LTS Jammy Jellyfish 添彩。这意味着你、我和全世界成千上万的用户将使用这个版本两年或更长的时间。你可以想象这个版本是多么重要。
不多说了,让我们去快速点评一下 KDE Plasma 5.24。

### KDE Plasma 5.24 点评
#### 安装
我在 Fedora 上使用 [KDE Plasma 5.24](https://www.debugpoint.com/2022/01/kde-plasma-5-24/) 已经有一段时间了。这次是直接从 [KDE Plasma 5.23](https://www.debugpoint.com/2021/08/kde-plasma-5-23/) 升级而来。在升级过程中,一切都很顺利。所有的用户配置的设置都保持不变,只有默认的壁纸在升级后被改变了。所以,数据或启动加载出现问题是几乎不可能的。
我在一个实体系统中安装了 KDE Plasma 5.24 和 KDE Neon 用户版以进一步测试。在一个 4GB 内存的英特尔 i3 系统中,安装很顺利,大约花了 8 分钟。
这个测试系统上还有另一个操作系统,所以安装程序完美地检测到了所有的操作系统并正确地更新了 GRUB。
#### 新功能、外观和可用性
Plasma 5.24 看起来很震撼。第一次启动后呈现出一个干净的桌面,具有经典的外观和极其漂亮的壁纸。默认的 Breeze Light 主题加上新的边框和装饰,对每个用户来说几乎是完美的。如果你很好奇,想给你的 Plasma 换一个不同的外观,那么所有的设置,如重点颜色之类的都在那里。你不需要通过什么秘籍或命令行来改变外观。
新设计的概览屏幕给你一种 GNOME 的氛围,但在 KDE 环境下,当你设置好它时,它就会变得非常棒。

在我的测试中,我尝试了蓝牙、Wi-Fi 和打印(安装 HPLIP 后)—— 都很顺利。没有磕磕绊绊,也不需要命令行,一切都开箱即用。KDE Plasma 的通知区应该可以让你访问所有必要的选项,你很少需要访问系统设置对话框。

电池使用情况尚可,我认为在我的测试硬件上,自 Plasma 5.23 以来,电池使用情况略有改善。我把测试机保持在待机状态,Plasma 很轻松就唤醒了,没有任何问题。我知道有些 Linux 发行版在睡眠后无法唤醒,导致你得在 TTY 里重启或启动 X 会话。
#### 稳定性和性能
不管你是一个 Plasma 的新用户还是长期用户,Plasma 5.24 都会让你有宾至如归的感觉;一切都准备好了,没有错误,等待你的行动和工作流程。
在我的测试期间中,我没有遇到任何错误。因此,我 [快速翻阅](https://forum.kde.org/search.php?keywords=5.24&terms=all&author=&tags=&sv=0&sc=1&sf=all&sr=posts&sk=t&sd=d&st=30&ch=300&t=0&submit=Search) 了 KDE 官方论坛,看看在发布后的一个月内报告了多少种问题以及有多少问题。不多,实际上只有寥寥两位数。而且报告的问题大多与高端显示器和网络有关,我觉得这与特定的专业硬件有关。
但总的来说,如今它是一个构建良好且经过测试的桌面。
在过去的几个版本中,KDE Plasma 在任何硬件上的性能都是完美的。而这个版本也证明了这一点。
在空闲阶段,KDE Plasma 5.24 消耗了 614MB 的内存,CPU 使用率为 2%。

我通过 Firefox 运行了五个标签,并播放了 Youtube。同时,用一个文件管理器、文本编辑器、图片浏览器、系统设置和“发现”包管理器的实例来测试重载下的性能。这个用例使用了 1.29GB 的内存,而 CPU 平均在 6% 到 7%。
显然,Firefox 消耗了大部分的系统资源。

我必须说,这是一个了不起的性能指标。
所以,有了这个版本,就有了一个完美的 Plasma 桌面。
#### 如何获得 KDE Plasma 5.24
KDE Plasma 5.24 现在可以在 KDE Neon 用户版,和通过 Backports PPA 在 Fedora 35 和 Kubuntu 21.10 上使用。如果你想重新安装,你可以从 [这里](https://neon.kde.org/download) 下载它。
如果你使用的是 Fedora 35 和 Kubuntu 21.10,请按照这些指南来获得这个版本。
* [在 Fedora 上升级 Plasma](https://www.debugpoint.com/2022/02/upgrade-kde-plasma-5-24/)
* [如何在 Kubuntu 21.10 中安装 KDE Plasma 5.24](https://www.debugpoint.com/wp-admin/post.php?post=9018&action=edit)
### 结束语
我为我们的网站点评测试过许多 Linux 发行版和桌面环境。没有哪个能在各个方面接近 KDE Plasma。我知道 GNOME 设计得很好,而且还有其他的小亮点,但是,当你需要一个省心的系统,而且几乎所有的自定义选项都开箱即用时,KDE Plasma 几十年来一直是赢家。
有的时候,为了让系统能在短时间内运行起来而无需太多折腾,我只有安装 KDE Plasma 才行。因为到最后,它肯定能工作,所有的选项都可以供你使用。
我认为运行 KDE Plasma 的 Kubuntu/Fedora 和 Linux Mint 是当今世界上最好的几个发行版,毫无疑问。
作为对本篇 KDE Plasma 5.24 点评的总结,我必须得承认,KDE Plasma 5.24 LTS 是该团队的一个本垒打。我们很高兴 KDE 的存在,并将在未来的日子里占据主导地位。
加油!
---
via: <https://www.debugpoint.com/2022/03/kde-plasma-5-24-review/>
作者:[Arindam](https://www.debugpoint.com/author/admin1/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) | null |
14,353 | httpx:一个 Python Web 客户端 | https://opensource.com/article/22/3/python-httpx | 2022-03-13T10:20:49 | [
"HTTP"
] | https://linux.cn/article-14353-1.html |
>
> Python 的 httpx 包是一个用于 HTTP 交互的一个优秀且灵活的模块。
>
>
>

Python 的 `httpx` 包是一个复杂的 Web 客户端。当你安装它后,你就可以用它来从网站上获取数据。像往常一样,安装它的最简单方法是使用 `pip` 工具:
```
$ python -m pip install httpx --user
```
要使用它,把它导入到 Python 脚本中,然后使用 `.get` 函数从一个 web 地址获取数据:
```
import httpx
result = httpx.get("https://httpbin.org/get?hello=world")
result.json()["args"]
```
下面是这个简单脚本的输出:
```
{'hello': 'world'}
```
### HTTP 响应
默认情况下,`httpx` 不会在非 200 状态下引发错误。
试试这个代码:
```
result = httpx.get("https://httpbin.org/status/404")
result
```
结果是:
```
<Response [404 NOT FOUND]>
```
可以明确地返回一个响应。添加这个异常处理:
```
try:
result.raise_for_status()
except Exception as exc:
print("woops", exc)
```
下面是结果:
```
woops Client error '404 NOT FOUND' for url 'https://httpbin.org/status/404'
For more information check: https://httpstatuses.com/404
```
### 自定义客户端
除了最简单的脚本之外,使用一个自定义的客户端是有意义的。除了不错的性能改进,比如连接池,这也是一个配置客户端的好地方。
例如, 你可以设置一个自定义的基本 URL:
```
client = httpx.Client(base_url="https://httpbin.org")
result = client.get("/get?source=custom-client")
result.json()["args"]
```
输出示例:
```
{'source': 'custom-client'}
```
这对用客户端与一个特定的服务器对话的典型场景很有用。例如,使用 `base_url` 和 `auth`,你可以为认证的客户端建立一个漂亮的抽象:
```
client = httpx.Client(
base_url="https://httpbin.org",
auth=("good_person", "secret_password"),
)
result = client.get("/basic-auth/good_person/secret_password")
result.json()
```
输出:
```
{'authenticated': True, 'user': 'good_person'}
```
你可以用它来做一件更棒的事情,就是在顶层的 “主” 函数中构建客户端,然后把它传递给其他函数。这可以让其他函数使用客户端,并让它们与连接到本地 WSGI 应用的客户端进行单元测试。
```
def get_user_name(client):
result = client.get("/basic-auth/good_person/secret_password")
return result.json()["user"]
get_user_name(client)
'good_person'
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'application/json')])
return [b'{"user": "pretty_good_person"}']
fake_client = httpx.Client(app=application, base_url="https://fake-server")
get_user_name(fake_client)
```
输出:
```
'pretty_good_person'
```
### 尝试 httpx
请访问 [python-httpx.org](https://www.python-httpx.org/) 了解更多信息、文档和教程。我发现它是一个与 HTTP 交互的优秀而灵活的模块。试一试,看看它能为你做什么。
---
via: <https://opensource.com/article/22/3/python-httpx>
作者:[Moshe Zadka](https://opensource.com/users/moshez) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | The `httpx`
package for Python is a sophisticated web client. Once you install it, you can use it to get data from websites. As usual, the easiest way to install it is with the `pip`
utility:
`$ python -m pip install httpx --user`
To use it, import it into a Python script, and then use the `.get`
function to fetch data from a web address:
```
import httpx
result = httpx.get("https://httpbin.org/get?hello=world")
result.json()["args"]
```
Here's the output from that simple script:
` {'hello': 'world'}`
## HTTP response
By default, `httpx`
will not raise errors on a non-200 status.
Try this code:
```
result = httpx.get("https://httpbin.org/status/404")
result
```
The result:
` <Response [404 NOT FOUND]>`
It's possible to raise a response explicitly. Add this exception handler:
```
try:
result.raise_for_status()
except Exception as exc:
print("woops", exc)
```
Here's the result:
```
woops Client error '404 NOT FOUND' for url 'https://httpbin.org/status/404'
For more information check: https://httpstatuses.com/404
```
## Custom client
It is worthwhile to use a custom client for anything but the simplest script. Aside from nice performance improvements, such as connection pooling, this is a good place to configure the client.
For example, you can set a custom base URL:
```
client = httpx.Client(base_url="https://httpbin.org")
result = client.get("/get?source=custom-client")
result.json()["args"]
```
Sample output:
` {'source': 'custom-client'}`
This is useful for a typical scenario where you use the client to talk to a specific server. For example, using both `base_url`
and `auth`
, you can build a nice abstraction for an authenticated client:
```
client = httpx.Client(
base_url="https://httpbin.org",
auth=("good_person", "secret_password"),
)
result = client.get("/basic-auth/good_person/secret_password")
result.json()
```
Output:
` {'authenticated': True, 'user': 'good_person'}`
One of the nicer things you can use this for is constructing the client at a top-level "main" function and then passing it around. This lets other functions use the client and lets them get unit-tested with a client connected to a local WSGI app.
```
def get_user_name(client):
result = client.get("/basic-auth/good_person/secret_password")
return result.json()["user"]
get_user_name(client)
'good_person'
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'application/json')])
return [b'{"user": "pretty_good_person"}']
fake_client = httpx.Client(app=application, base_url="https://fake-server")
get_user_name(fake_client)
```
Output:
` 'pretty_good_person'`
## Try httpx
Visit [python-httpx.org](https://www.python-httpx.org/) for more information, documentation, and tutorials. I've found it to be an excellent and flexible module for interacting with HTTP. Give it a try and see what it can do for you.
## Comments are closed. |
14,355 | 在 Ubuntu 上通过命令行改变 Linux 系统语言 | https://itsfoss.com/change-locales-linux/ | 2022-03-13T22:39:43 | [
"语言",
"locale"
] | https://linux.cn/article-14355-1.html |
>
> 这是一个快速教程,展示了在 Ubuntu 和其他 Linux 发行版上从命令行改变语言的步骤。
>
>
>

事实上,我一直在写西班牙语的文章。如果你没有访问过它并且/或你是一个讲西班牙语的人,请访问 [It's FOSS en Español](https://es.itsfoss.com/) 并查看所有西班牙语的 Linux 内容。
你可能想知道我为什么要和你分享这件事,这是因为这篇文章以这个新页面为例。
在新安装 [你喜欢的 Linux 发行版](https://itsfoss.com/best-linux-beginners/) 时,系统会要求你选择一种主语言。有些人,比如说我,后来会考虑把这个语言改成新的,尽管这并不频繁。
你看,我必须同时用西班牙语和英语进行截屏。这就成了一个问题,因为我只有一台电脑,而更换用户对我来说不是一个快速的解决方案。
这就是为什么我想和你分享这个快速技巧,我将告诉你如何在终端中用两行简单的文字改变你的主系统语言。
让我们开始吧!
### 从终端改变 Linux 系统语言
假设你想把你的主语言从英语改为西班牙语。
确认你将哪种语言设置为默认语言(主语言)。为此,让我们使用 `locale` 命令。
```
locale
```
你应该看到像这样的东西:
```
team@itsfoss:~$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
```
在这里你可以看到主语言是英语。现在要改变它,请按以下方式使用 `dpkg` 命令:
```
sudo dpkg-reconfigure locales
```
当你运行之前的命令,你应该在终端看到下面的页面:

在这里,你应该**使用向上和向下的箭头移动**直到你到达所需的语言。在我的例子中,我想要西班牙语,更具体地说,是墨西哥西班牙语,因为我是墨西哥人。
不是所有的语言都有这个选项,但如果你的语言有,请选择 [UTF-8](https://en.wikipedia.org/wiki/UTF-8)。
找到你的语言后,**按空格键来标记**,然后**回车**。

最后,在最后一个窗口中,通过使用箭头键移动到该语言并按下**回车键**,选择该新语言作为你的默认语言。

完成后,你应该在你的终端看到这样的信息:
```
Generating locales (this might take a while)...
en_US.UTF-8... done
es_MX.UTF-8... done
Generation complete.
```
这就完成了!现在你能够直接从终端改变你的默认语言,次数不限。
如果你对这个话题有任何疑问,请在评论区告诉我们。
---
via: <https://itsfoss.com/change-locales-linux/>
作者:[Marco Carmona](https://itsfoss.com/author/marco/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | *Brief: Here’s a quick tutorial that shows the steps for changing the locales on Ubuntu and other Linux distributions from the command line.*
It’s been some time since I wrote something on It’s FOSS. The truth is that I’ve been writing for a Spanish version of It’s FOSS. If you’ve not visited it and/or you’re a Spanish speaker, please visit [It’s FOSS en Español](https://es.itsfoss.com/) and check all the Linux content in Spanish.
You may be wondering why I’m sharing this fact with you. It’s because this post includes this new page as an example.
At the time of doing a clean installation of [your favorite Linux distro](https://itsfoss.com/best-linux-beginners/), the system asks you to choose a main language. Even though it’s not frequent, some people consider changing that language to a new one later on, like me for example.
See, I have to take screenshots in both Spanish (for It’s FOSS en Español) and in English (for It’s FOSS). This becomes a problem, because I have only one computer, and changing the user is not a fast solution for me.
That’s why I’d like to share with you this quick tip, where I’ll show you how to change your main system language with two simple lines in the terminal.
Let’s begin!
## Changing Linux system language from the terminal
Let’s suppose you want to change your main language from English to Spanish.
Verify which language you have set as default (main language). For this, let’s use the locale command.
`locale`
You should see something like this.
```
team@itsfoss:~$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
```
Here you can see that the main language is English. Now to change it, use the dpkg command in this fashion:
`sudo dpkg-reconfigure locales`
Once you run the command before, you should see the next screen in your terminal.

Here, you should **move using the up and down arrow** until you reach the desired language. In my case, I desire Spanish, and more specific, Mexican Spanish because I’m Mexican.
Not all languages may have the options, but if yours have, opt for [UTF-8](https://en.wikipedia.org/wiki/UTF-8).
Once your language has been found, **press the SPACE KEY to mark** it and then **ENTER**.

Finally, select this new language as your default by moving to it using the arrow key and pushing the **ENTER KEY**, in the last windows.

Once done, you should see a message like this in your terminal:
```
Generating locales (this might take a while)...
en_US.UTF-8... done
es_MX.UTF-8... done
Generation complete.
```
** And that’s all!** Now you’re able to change your default language as many times you want directly from the terminal.
Please let us know if you have any doubt about this topic in the comments section. *Good look!* |
14,356 | 我为什么从 Mac 转到 Linux | https://opensource.com/article/20/3/mac-linux | 2022-03-14T09:32:00 | [
"Linux",
"Mac"
] | /article-14356-1.html |
>
> 25 年后,我转到了 Linux,简直不能更爽了。以下是我的经历。
>
>
>

*开源朗读者 | 淮晋阳*
1994 年,我的家人买了一台 Macintosh Performa 475 作为家用电脑。我在学校时曾使用过 Macintosh SE 电脑,并通过《[Mavis Beacon 教你打字](https://en.wikipedia.org/wiki/Mavis_Beacon_Teaches_Typing)》学会了打字,所以我成为 Mac 用户已经超过 25 年了。早在上世纪 90 年代中期,我就被 Mac 的易用性所吸引。它不是以 DOS 命令提示符开始的;它打开的是一个友好的桌面。它很有趣。尽管 Macintosh 的软件比 PC 少得多,但我认为 Mac 的生态系统更好,就凭着 KidPix 和 Hypercard,我仍然认为它们是无与伦比的、最直观的 *创意工厂*。
即便如此,我仍然感觉到,与 Windows 相比,Mac 只是个弟弟。我曾觉得这个公司或许有一天会消失。但几十年后的今天,苹果已经成为一个庞然大物,一个价值万亿美元的公司。但随着发展,它发生了重大变化。有些变化是为了更好的发展,比如更好的稳定性,更简单的硬件选择,更高的安全性,以及更多的可访问性选项。其他的变化让我恼火 —— 不是一下子,而是慢慢地不满意。最重要的是,我对苹果的封闭生态系统感到厌烦 —— 没有 iPhoto 就很难访问照片;必须使用 iTunes;即使我不想使用苹果商店的生态系统,也得强制捆绑。
随着时间的推移,我发现自己主要是在终端上工作。我使用 iTerm2 和 [Homebrew](https://brew.sh/) 软件包管理器。虽然我不能让我所有的 Linux 软件都工作,但大部分软件都工作了。我认为我拥有两个世界中最好的东西:macOS 的图形操作系统和用户界面,以及快速打开终端会话的能力。
后来,我开始使用通过 Raspbian 启动的树莓派电脑。我还收集了一些从大学的垃圾堆中抢救出来的非常旧的笔记本电脑,因此,出于需要,我决定尝试各种 Linux 发行版。虽然它们都没有成为我的主用机器,但我开始真正喜欢使用 Linux。我开始考虑尝试运行 Linux 发行版作为我的日常用机,但我认为 Macbook 的舒适性和便利性,特别是硬件的尺寸和重量,在非 Mac 笔记本电脑中很难找到。
### 是时候进行转换了?
大约两年前,我开始在工作中使用一台戴尔电脑。那是一台较大的笔记本电脑,集成了 GPU,可以双启动 Linux 和 Windows。我用它来进行游戏开发、3D 建模、一些机器学习,以及用 C# 和 Java 进行基本编程。我曾考虑把它作为我的主用机器,但我喜欢我的 Macbook Air 的便携性,所以也继续使用它。
去年秋天,我开始注意到我的 Air 运行时很热,而且风扇开得越来越频繁。我的主用机器开始显得垂垂老矣。多年来,我使用 Mac 的终端来访问类 Unix 的 Darwin 操作系统,我在终端和网页浏览器之间切换的时间越来越多。是时候进行转换了吗?
我开始探索一个类似 Macbook 的 Linux 笔记本电脑的可能性。在做了一些研究、阅读测评和留言板之后,我选择了长期以来备受赞誉的戴尔 XPS 13 开发者版 7390,选择了第十代 i7。我选择它是因为我喜欢 Macbook(尤其是超薄的 Macbook Air)的感觉,而对 XPS 13 的评论表明它似乎是类似的笔记本电脑,对其触控板和键盘的评价也真的很好。
最重要的是,它装载了 Ubuntu。虽然买一台电脑,擦掉它,然后安装一个新的 Linux 发行版是很容易的,但我被这种配合得当的操作系统和硬件所吸引,而且它允许我们进行大量的定制,就像我们在 Linux 中了解而喜爱的一样。因此,当有促销活动时,我毅然决然地购买了它。
### 每天运行 Linux 是什么感觉
如今,我使用 XPS 13 已经有三个月了,我的双启动的 Linux 工作笔记本也有两年了。起初,我以为我会花更多的时间寻找一个更像 Mac 的替代桌面环境或窗口管理器,比如 [Enlightenment](https://www.enlightenment.org/)。我试过几个,但我不得不说,我喜欢开箱即用的 [GNOME](https://opensource.com/downloads/cheat-sheet-gnome-3) 的简单性。首先,它是精简的;没有太多的 GUI 元素会吸引你的注意力。事实上,它很直观,这份 [概览](https://help.gnome.org/users/gnome-help/stable/shell-introduction.html.en) 只需要几分钟就能看完。
我可以通过应用程序仪表盘或按网格排布的按钮访问我的应用程序,从而进入应用程序视图。要访问我的文件系统,我点击仪表盘上的“文件”图标。要打开 GNOME 终端,我输入 `Ctrl+Alt+T` 或者直接按下 `Alt+Tab` 来在打开的应用程序和打开的终端之间切换。定义你自己的 [自定义热键快捷方式](https://docs.fedoraproject.org/en-US/quick-docs/proc_setting-key-shortcut/) 也很容易。
除此以外,没有太多要说的。与 Mac 的桌面不同,没有那么多的东西会让人迷失,这意味着让我从工作或我想运行的应用程序中分心的东西更少。我没有看到我在 Mac 上浏览窗口的那么多选项,也不必在导航时花费那么多时间。在 Linux 中,只有文件、应用程序和终端。
我安装了 [i3 平铺式窗口管理器](https://opensource.com/article/18/9/i3-window-manager-cheat-sheet) 来做一个测试。我在配置上遇到了一些问题,因为我是用 [德沃夏克键盘](https://en.wikipedia.org/wiki/Dvorak_keyboard_layout) 键入的,而 i3 并不适应另一种键盘配置。我想,如果再努力一点,我可以在 i3 中找出一个新的键盘映射,但我主要想找的是简单的平铺功能。
我看了 GNOME 的平铺功能,并感到非常惊喜。你按下 `Super` 键(对我来说,就是有 Windows 标志的那个键 —— 我应该用贴纸盖住它!),然后按一个修饰键。例如,按 `Super + ←` 将你当前的窗口移动到屏幕左侧的贴片上。`Super + →` 移动到右半边。`Super + ↑` 使当前窗口最大化。`Super + ↓` 则恢复到之前的大小。你可以用 `Alt+Tab` 在应用程序窗口之间移动。这些都是默认行为,可以在键盘设置中自定义。
插上耳机或连接到 HDMI 的工作方式与你预期的一样。有时,我打开声音设置,在 HDMI 声音输出或我的外部音频线之间进行切换,就像我在 Mac 或 PC 上那样。触控板的反应很灵敏,我没有注意到与 Macbook 的有什么不同。当我插入一个三键鼠标时,它可以立即工作,即使是用我的蓝牙鼠标和键盘。
#### 软件
我在几分钟内安装了 Atom、VLC、Keybase、Brave 浏览器、Krita、Blender 和 Thunderbird。我在终端用 Apt 软件包管理器安装了其他软件(和平常一样),它比 macOS 的 Homebrew 软件包管理器提供了更多软件包。
#### 音乐
我有许多种听音乐的选择。我使用 Spotify 和 [PyRadio](https://opensource.com/article/19/11/pyradio) 来串流播放音乐。[Rhythmbox](https://wiki.gnome.org/Apps/Rhythmbox) 在 Ubuntu 上是默认安装的;这个简单的音乐播放器可以立即启动,而且毫不臃肿。只需点击菜单,选择“添加音乐”,然后导航到一个音乐目录(它会递归搜索)。你也可以轻松地串流播客或在线广播。
#### 文本和 PDF
我倾向于在带有一些插件的 [Neovim](https://neovim.io/) 中用 Markdown 写作,然后用 Pandoc 将我的文档转换为任何最终需要的格式。对于一个带有预览功能的漂亮的 Markdown 编辑器,我下载了 [Ghostwriter](https://wereturtle.github.io/ghostwriter/),一个最集中注意力的写作应用程序。
如果有人给我发了一个微软 Word 文档,我可以用默认的 LibreOffice Writer 应用程序打开它。
偶尔,我也要签署一份文件。用 macOS 的“预览”应用程序和我的 PNG 格式的签名,这很容易,我需要一个 Linux 的对应工具。我发现默认的 PDF 查看器应用程序没有我需要的注释工具。LibreOffice 绘图程序是可以接受的,但不是特别容易使用,而且它偶尔会崩溃。做了一些研究后,我安装了 [Xournal](http://xournal.sourceforge.net/),它有我需要的简单的注释工具,可以添加日期、文字和我的签名,而且与 Mac 的预览程序相当。它完全能满足我的需要。
#### 从我的手机中导入图片
我有一个 iPhone。为了把我的图片从手机上拿下来,有很多方法可以同步和访问你的文件。如果你有一个不同的手机,你的过程可能是不同的。下面是我的方法:
1. 用 `sudo apt install gvfs-backends` 来安装 `gvfs-backends`,它是 GNOME 虚拟文件系统的一部分。
2. 获取你的手机的序列号。将你的手机插入你的电脑,在你的 iPhone 上点击“信任”。在你电脑的终端输入:
```
lsusb -v 2> /dev/null | grep -e "Apple Inc" -A 2
```
(感谢 Stack Oveflow 用户 [complistic](https://stackoverflow.com/questions/19032162/is-there-a-way-since-ios-7s-release-to-get-the-udid-without-using-itunes-on-a/21522291#21522291) 提供的这个代码技巧)。
3. 现在打开你的文件系统。
* 按 `Ctrl+L` 打开一个位置并输入:`afc://<你的序列号>`,(请替换 `<你的序列号>`)来打开并导航到你的 DCIM 文件夹。我的照片和视频在 DCIM 文件夹的五个子文件夹内,而不是在照片文件夹内。从这里你可以手动将它们移到你的电脑上。
* 挂载手机文件系统后,你也可以在终端中通过以下方式导航到你的文件:
```
cd /run/user/1001/gvfs/afc:host=<你的序列号>
```
#### 图形、照片、建模和游戏引擎
我是一名教育工作者,教授各种新媒体课程。我的许多同事和学生都订阅了价格昂贵的专有的 Adobe Creative Suite。我喜欢让我的学生知道他们还有其他选择。
对于绘图和图形编辑,我使用 [Krita](https://opensource.com/article/19/4/design-posters)。这绝对是我的 Photoshop 替代品。对于插图工作,还有 [Inkscape](https://opensource.com/article/19/1/inkscape-cheat-sheet) 和 Scribus 的出版软件。对于自动编辑,我使用命令行 [ImageMagick](https://opensource.com/article/17/8/imagemagick) 程序,它已经预装在 Ubuntu 中。
为了管理我的图像,我使用简单的 [Shotwell](https://gitlab.gnome.org/GNOME/shotwell/) 应用程序。
对于 3D 建模,我使用并教授开源的 [Blender](https://opensource.com/article/18/4/5-best-blender-video-tutorials-beginners) 软件。在我的学校,我们教 [Unity 3d](https://unity.com/),它有 Linux 版本。它运行良好,但我一直想试试 [Godot](https://opensource.com/article/17/12/get-started-developing-games-godot),一个开源的替代品。
#### 开发
我的 XPS 13 安装了 Chrome 和 Chromium。我还添加了 Firefox 和 [Brave](https://brave.com/) 浏览器。所有都和你在 Mac 或 PC 上习惯的一样。大多数时候,我在 Atom 中进行开发工作,有时在 Visual Studio Code 中进行,这两种软件都很容易安装在 Linux 上。Vim 已经预装在终端,而我首选的终端文本编辑器 Neovim,也很容易安装。
几周后,我开始尝试其他终端。我目前最喜欢的是 Enlightenment 基金会的 Terminology。首先,它允许你在终端中 [查看图片](https://www.enlightenment.org/about-terminology.md),这在 Mac 的终端中是很难做到的。
### 留在这里
我看不出自己会转回 Mac 作为我的日用电脑。现在,当我使用 Mac 时,我注意到超多的选项和运行一个应用程序或浏览某个地方所需的额外步骤。我还注意到它的运行速度有点慢,或许这只是我个人的感受?
现在我已经转到了一个开源的生态系统和 Linux,我很高兴,没有必要再转回去。
---
via: <https://opensource.com/article/20/3/mac-linux>
作者:[Lee Tusman](https://opensource.com/users/leeto) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | HTTPSConnectionPool(host='opensource.com', port=443): Read timed out. (read timeout=10) | null |
14,358 | 如何调用没有文档说明的 Web API | https://jvns.ca/blog/2022/03/10/how-to-use-undocumented-web-apis/ | 2022-03-15T10:31:25 | [
"API",
"Web"
] | https://linux.cn/article-14358-1.html | 
大家好!几天前我写了篇 [小型的个人程序](https://jvns.ca/blog/2022/03/08/tiny-programs/) 的文章,里面提到了调用没有文档说明的“秘密” API 很有意思,你需要从你的浏览器中把 cookies 复制出来才能访问。
有些读者问如何实现,因此我打算详细描述下,其实过程很简单。我们还会谈谈在调用没有文档说明的 API 时,可能会遇到的错误和道德问题。
我们用谷歌 Hangouts 举例。我之所以选择它,并不是因为这个例子最有用(我认为官方的 API 更实用),而是因为在这个场景中更有用的网站很多是小网站,而小网站的 API 一旦被滥用,受到的伤害会更大。因此我们使用谷歌 Hangouts,因为我 100% 肯定谷歌论坛可以抵御这种试探行为。
我们现在开始!
### 第一步:打开开发者工具,找一个 JSON 响应
我浏览了 <https://hangouts.google.com>,在 Firefox 的开发者工具中打开“<ruby> 网络 <rt> Network </rt></ruby>”标签,找到一个 JSON 响应。你也可以使用 Chrome 的开发者工具。
打开之后界面如下图:

找到其中一条 “<ruby> 类型 <rt> Type </rt></ruby>” 列显示为 `json` 的请求。
为了找一条感兴趣的请求,我找了好一会儿,突然我找到一条 “people” 的端点,看起来是返回我们的联系人信息。听起来很有意思,我们来看一下。
### 第二步:复制为 cURL
下一步,我在感兴趣的请求上右键,点击 “复制Copy” -> “<ruby> 复制为 cURL <rt> Copy as cURL </rt></ruby>”。
然后我把 `curl` 命令粘贴到终端并运行。下面是运行结果:
```
$ curl 'https://people-pa.clients6.google.com/v2/people/?key=REDACTED' -X POST ........ (省略了大量请求标头)
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.
```
你可能会想 —— 很奇怪,“二进制的输出在你的终端上无法正常显示” 是什么错误?原因是,浏览器默认情况下发给服务器的请求头中有 `Accept-Encoding: gzip, deflate` 参数,会把输出结果进行压缩。
我们可以通过管道把输出传递给 `gunzip` 来解压,但是我们发现不带这个参数进行请求会更简单。因此我们去掉一些不相关的请求头。
### 第三步:去掉不相关的请求头
下面是我从浏览器获得的完整 `curl` 命令。有很多行!我用反斜杠(`\`)把请求分开,这样每个请求头占一行,看起来更清晰:
```
curl 'https://people-pa.clients6.google.com/v2/people/?key=REDACTED' \
-X POST \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0' \
-H 'Accept: */*' \
-H 'Accept-Language: en' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Authorization: SAPISIDHASH REDACTED' \
-H 'Cookie: REDACTED'
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'X-Goog-AuthUser: 0' \
-H 'Origin: https://hangouts.google.com' \
-H 'Connection: keep-alive' \
-H 'Referer: https://hangouts.google.com/' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-site' \
-H 'Sec-GPC: 1' \
-H 'DNT: 1' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' \
-H 'TE: trailers' \
--data-raw 'personId=101777723309&personId=1175339043204&personId=1115266537043&personId=116731406166&extensionSet.extensionNames=HANGOUTS_ADDITIONAL_DATA&extensionSet.extensionNames=HANGOUTS_OFF_NETWORK_GAIA_GET&extensionSet.extensionNames=HANGOUTS_PHONE_DATA&includedProfileStates=ADMIN_BLOCKED&includedProfileStates=DELETED&includedProfileStates=PRIVATE_PROFILE&mergedPersonSourceOptions.includeAffinity=CHAT_AUTOCOMPLETE&coreIdParams.useRealtimeNotificationExpandedAcls=true&requestMask.includeField.paths=person.email&requestMask.includeField.paths=person.gender&requestMask.includeField.paths=person.in_app_reachability&requestMask.includeField.paths=person.metadata&requestMask.includeField.paths=person.name&requestMask.includeField.paths=person.phone&requestMask.includeField.paths=person.photo&requestMask.includeField.paths=person.read_only_profile_info&requestMask.includeField.paths=person.organization&requestMask.includeField.paths=person.location&requestMask.includeField.paths=person.cover_photo&requestMask.includeContainer=PROFILE&requestMask.includeContainer=DOMAIN_PROFILE&requestMask.includeContainer=CONTACT&key=REDACTED'
```
第一眼看起来内容有很多,但是现在你不需要考虑每一行是什么意思。你只需要把不相关的行删掉就可以了。
我通常通过删掉某行查看是否有错误来验证该行是不是可以删除 —— 只要请求没有错误就一直删请求头。通常情况下,你可以删掉 `Accept*`、`Referer`、`Sec-*`、`DNT`、`User-Agent` 和缓存相关的头。
在这个例子中,我把请求删成下面的样子:
```
curl 'https://people-pa.clients6.google.com/v2/people/?key=REDACTED' \
-X POST \
-H 'Authorization: SAPISIDHASH REDACTED' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Origin: https://hangouts.google.com' \
-H 'Cookie: REDACTED'\
--data-raw 'personId=101777723309&personId=1175339043204&personId=1115266537043&personId=116731406166&extensionSet.extensionNames=HANGOUTS_ADDITIONAL_DATA&extensionSet.extensionNames=HANGOUTS_OFF_NETWORK_GAIA_GET&extensionSet.extensionNames=HANGOUTS_PHONE_DATA&includedProfileStates=ADMIN_BLOCKED&includedProfileStates=DELETED&includedProfileStates=PRIVATE_PROFILE&mergedPersonSourceOptions.includeAffinity=CHAT_AUTOCOMPLETE&coreIdParams.useRealtimeNotificationExpandedAcls=true&requestMask.includeField.paths=person.email&requestMask.includeField.paths=person.gender&requestMask.includeField.paths=person.in_app_reachability&requestMask.includeField.paths=person.metadata&requestMask.includeField.paths=person.name&requestMask.includeField.paths=person.phone&requestMask.includeField.paths=person.photo&requestMask.includeField.paths=person.read_only_profile_info&requestMask.includeField.paths=person.organization&requestMask.includeField.paths=person.location&requestMask.includeField.paths=person.cover_photo&requestMask.includeContainer=PROFILE&requestMask.includeContainer=DOMAIN_PROFILE&requestMask.includeContainer=CONTACT&key=REDACTED'
```
这样我只需要 4 个请求头:`Authorization`、`Content-Type`、`Origin` 和 `Cookie`。这样容易管理得多。
### 第四步:在 Python 中发请求
现在我们知道了我们需要哪些请求头,我们可以把 `curl` 命令翻译进 Python 程序!这部分是相当机械化的过程,目标仅仅是用 Python 发送与 cUrl 相同的数据。
下面是代码实例。我们使用 Python 的 `requests` 包实现了与前面 `curl` 命令相同的功能。我把整个长请求分解成了元组的数组,以便看起来更简洁。
```
import requests
import urllib
data = [
('personId','101777723'), # I redacted these IDs a bit too
('personId','117533904'),
('personId','111526653'),
('personId','116731406'),
('extensionSet.extensionNames','HANGOUTS_ADDITIONAL_DATA'),
('extensionSet.extensionNames','HANGOUTS_OFF_NETWORK_GAIA_GET'),
('extensionSet.extensionNames','HANGOUTS_PHONE_DATA'),
('includedProfileStates','ADMIN_BLOCKED'),
('includedProfileStates','DELETED'),
('includedProfileStates','PRIVATE_PROFILE'),
('mergedPersonSourceOptions.includeAffinity','CHAT_AUTOCOMPLETE'),
('coreIdParams.useRealtimeNotificationExpandedAcls','true'),
('requestMask.includeField.paths','person.email'),
('requestMask.includeField.paths','person.gender'),
('requestMask.includeField.paths','person.in_app_reachability'),
('requestMask.includeField.paths','person.metadata'),
('requestMask.includeField.paths','person.name'),
('requestMask.includeField.paths','person.phone'),
('requestMask.includeField.paths','person.photo'),
('requestMask.includeField.paths','person.read_only_profile_info'),
('requestMask.includeField.paths','person.organization'),
('requestMask.includeField.paths','person.location'),
('requestMask.includeField.paths','person.cover_photo'),
('requestMask.includeContainer','PROFILE'),
('requestMask.includeContainer','DOMAIN_PROFILE'),
('requestMask.includeContainer','CONTACT'),
('key','REDACTED')
]
response = requests.post('https://people-pa.clients6.google.com/v2/people/?key=REDACTED',
headers={
'X-HTTP-Method-Override': 'GET',
'Authorization': 'SAPISIDHASH REDACTED',
'Content-Type': 'application/x-www-form-urlencoded',
'Origin': 'https://hangouts.google.com',
'Cookie': 'REDACTED',
},
data=urllib.parse.urlencode(data),
)
print(response.text)
```
我执行这个程序后正常运行 —— 输出了一堆 JSON 数据!太棒了!
你会注意到有些地方我用 `REDACTED` 代替了,因为如果我把原始数据列出来你就可以用我的账号来访问谷歌论坛了,这就很不好了。
### 运行结束!
现在我可以随意修改 Python 程序,比如传入不同的参数,或解析结果等。
我不打算用它来做其他有意思的事了,因为我压根对这个 API 没兴趣,我只是用它来阐述请求 API 的过程。
但是你确实可以对返回的一堆 JSON 做一些处理。
### curlconverter 看起来很强大
有人评论说可以使用 <https://curlconverter.com/> 自动把 curl 转换成 Python(和一些其他的语言!),这看起来很神奇 —— 我都是手动转的。我在这个例子里使用了它,看起来一切正常。
### 追踪 API 的处理过程并不容易
我不打算夸大追踪 API 处理过程的难度 —— API 的处理过程并不明显!我也不知道传给这个谷歌论坛 API 的一堆参数都是做什么的!
但是有一些参数看起来很直观,比如 `requestMask.includeField.paths=person.email` 可能表示“包含每个人的邮件地址”。因此我只关心我能看懂的参数,不关心看不懂的。
### (理论上)适用于所有场景
可能有人质疑 —— 这个方法适用于所有场景吗?
答案是肯定的 —— 浏览器不是魔法!浏览器发送给你的服务器的所有信息都是 HTTP 请求。因此如果我复制了浏览器发送的所有的 HTTP 请求头,那么后端就会认为请求是从我的浏览器发出的,而不是用 Python 程序发出的。
当然,我们去掉了一些浏览器发送的请求头,因此理论上后端是可以识别出来请求是从浏览器还是 Python 程序发出的,但是它们通常不会检查。
这里有一些对读者的告诫 —— 一些谷歌服务的后端会通过令人难以理解(对我来说是)方式跟前端通信,因此即使理论上你可以模拟前端的请求,但实际上可能行不通。可能会遭受更多攻击的大型 API 会有更多的保护措施。
我们已经知道了如何调用没有文档说明的 API。现在我们再来聊聊可能遇到的问题。
### 问题 1:会话 cookie 过期
一个大问题是我用我的谷歌会话 cookie 作为身份认证,因此当我的浏览器会话过期后,这个脚本就不能用了。
这意味着这种方式不能长久使用(我宁愿调一个真正的 API),但是如果我只是要一次性快速抓取一小组数据,那么可以使用它。
### 问题 2:滥用
如果我正在请求一个小网站,那么我的 Python 脚本可能会把服务打垮,因为请求数超出了它们的处理能力。因此我请求时尽量谨慎,尽量不过快地发送大量请求。
这尤其重要,因为没有官方 API 的网站往往是些小网站且没有足够的资源。
很明显在这个例子中这不是问题 —— 我认为在写这篇文章的过程我一共向谷歌论坛的后端发送了 20 次请求,他们肯定可以处理。
如果你用自己的账号身份过度访问这个 API 并导致了故障,那么你的账号可能会被暂时封禁(情理之中)。
我只下载我自己的数据或公共的数据 —— 我的目的不是寻找网站的弱点。
### 请记住所有人都可以访问你没有文档说明的 API
我认为本文最重要的信息并不是如何使用其他人没有文档说明的 API。虽然很有趣,但是也有一些限制,而且我也不会经常这么做。
更重要的一点是,任何人都可以这么访问你后端的 API!每个人都有开发者工具和网络标签,查看你传到后端的参数、修改它们都很容易。
因此如果一个人通过修改某些参数来获取其他用户的信息,这不值得提倡。我认为提供公开 API 的大部分开发者们都知道,但是我之所以再提一次,是因为每个初学者都应该了解。: )
---
via: <https://jvns.ca/blog/2022/03/10/how-to-use-undocumented-web-apis/>
作者:[Julia Evans](https://jvns.ca/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[lxbwolf](https://github.com/lxbwolf) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | null |
14,359 | 尝试 Nitrux 系统的六大理由 | https://news.itsfoss.com/reasons-to-try-nitrux-os/ | 2022-03-15T11:18:00 | [] | https://linux.cn/article-14359-1.html |
>
> Nitrux OS 是一个基于 Debian 的有趣的 Linux 发行版。还没有试过吗?我认为你应该试试。
>
>
>

Nitrux 系统也许算不上 Linux 的主流发行版本之一,但它绝对是一款极其独特的产品。
2019 年,我们 [采访了 Nitrux 的创始人 Uri Herrera](https://itsfoss.com/nitrux-linux/),了解到 Herrera 等人开发这款系统的初衷:超越传统的 Linux 发行版。
自那之后,过了许久,我们终于迎来了 [Nitrux 2.0 版本](https://news.itsfoss.com/nitrux-2-0-release/)。
不要忘了,Nitrux 在去年 [放弃基于 Ubuntu,而选择了 Debian](https://news.itsfoss.com/nitrux-linux-debian/)。
考虑到自 Nitrux 发行以来的数年间,也发生了许多变化,你应该尝试一下这款系统。
这里,我要分享一些体验 [Nitrux 系统](https://nxos.org/) 的理由:
### 1、Nitrux 不再基于 Ubuntu

人们一般都会推荐基于 Ubuntu 的 Linux 发行版本,来满足日常所需。
当然,在我们 [为新手推荐的 Linux 系统](https://itsfoss.com/best-linux-beginners/) 中,也主要是许多基于 Ubuntu 的版本,但是请不要误会。
我们之所以推荐基于 Ubuntu 的发行版本,唯一的理由在于它们简单易用,支持大量的商业软件。
所以,如果你不是刚开始使用 Linux 系统,同时也想尝试既能让你耳目一新,又不至于使你感到陌生,而且十分稳定的发行版,基于 Debian 的 Nirtux 是一个不错的选择。
你完全不需要在短期内迅速了解这款系统,就可以得心应手地使用终端来完成各项工作。
感兴趣的话,可以参考我们的文章 [Debian vs Ubuntu](/article-13746-1.html),了解更多。
### 2、专注 AppImage

[AppImage](https://itsfoss.com/use-appimage-linux/) 是一个通用的打包系统,这种软件包不需要任何依赖。你不需要在 Linux 上安装任何软件包管理器或者依赖包,就可以直接运行 AppImage 应用。
AppImage 旨在打造便携、高效的软件包系统,省去安装的步骤,与 Windows 系统的便携版软件非常相似。
Nitrux 操作系统专注 AppImage 应用软件,为你带来流畅的用户体验。
NX 软件中心是一个 GUI 程序,用户可以通过使用 Mauikit(该软件中心的 UI 框架),安装、管理 AppImage 应用程序。
### 3、基于 KDE 桌面环境的发行版

Nitrux 操作系统是 [搭载 KDE 桌面环境中最好的 Linux 发行版](https://itsfoss.com/best-kde-distributions/) 之一。 如果你不喜欢 GNOME 或者其他开箱即用的桌面环境(DE),KDE 会是一个不错的选择。
也许你还不知道, 相较于其他桌面环境,[KDE 可以在很多方面进行定制](https://itsfoss.com/kde-customization/)。
因此,在 KDE 桌面环境下,你可以毫不费力地打造自己的个性化桌面。
### 4、独特的用户体验

Nitrux 的用户体验结合了最好的 KDE 桌面环境与 Qt 技术,并对这些进行了调整,为你带来全新的用户体验。
虽然在使用 Nitrux 操作系统时,你不会觉得十分陌生,但是还是会感到有些许的不同。
即使你没有对 Nitrux 系统做任何自定义的设置,开箱即用的体验也足以让它成为 [最优雅的发行版](https://itsfoss.com/beautiful-linux-distributions/) 之一。
### 5、Maui Shell

[Maui Shell](https://news.itsfoss.com/maui-shell-unveiled/) 是 Nitrux 用户体验的亮点之一。近来,Maui Shell 得到了进一步的完善,将这些呈现在了桌面端和移动端的融合界面上。
尽管 Maui Shell 目前还不成熟,但是外观看起来十分大气简约,就像 [System76 将要推出基于 Rust 的桌面环境](https://news.itsfoss.com/system76-cosmic-panel/) 一样令人兴奋。
这也是我们推荐尝试 Nitrux 操作系统最重要的原因之一。时间会证明,Nitrux 系统是否将会开启桌面体验的全新时代。
### 6、Xanmod 内核

[Xanmod 内核](https://xanmod.org/) 是一个定制的主线 Linux 内核版本,对性能进行了适当的调整,附加了一些其他功能。有了它,你的桌面体验一定能得到大幅提升。
自 2.0 版本起,Nitrux 操作系统选用 Xanmod 作为默认内核,为用户提供“升级版”的桌面体验。
当然你也可以选择其他 Linux 内核,比如 Liquorix 和 Libre,各擅胜场。
如果你不喜欢 Xanmod,也可以选择长期支持版的主线内核。在 Nitrux 操作系统上,你完全可以无缝切换使用不同的内核。
* [Nitrux OS](https://nxos.org/)
### 总结
诚然,从主流发行版转到像 Nitrux 这样的操作系统,需要考虑各种风险。
但是,**我建议你好好考虑一番:**
Nitrux 这样的发行版热衷于按照他们的愿景来改进事情。
尽管背后没有强大的企业和财力支撑,他们依然可以开发出这款令人惊艳的发行版、开发出 [Maui 项目](https://mauikit.org),以及别开生面的 Maui shell。
所以,我认为,我们也应该以己所能,尽己之力,支持这些优秀的发行版。
不过话说回来,每一款 Linux 发行版都会或多或少地存在一些问题。当你试用一款新的发行版时,你需要给它点儿时间,在最终将它作为日常使用的操作系统之前,慢慢地去适应它。
换言之,我推荐你在业余时间试用 Nitrux 操作系统,或者直接装个虚拟机来一探究竟。
我很关注大家对这篇文章的看法,请在下方评论留言。
---
via: <https://news.itsfoss.com/reasons-to-try-nitrux-os/>
作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[aREversez](https://github.com/aREversez) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Nitrux OS may not be one of the mainstream Linux distributions, but it is surely one of the unique offerings.
We have also [interviewed its creator Uri Herrera](https://itsfoss.com/nitrux-linux/?ref=news.itsfoss.com) in 2019 to learn how they initially aimed to go beyond the traditional Linux distributions.
And, since then, we’ve come a long way to its recent [Nitrux 2.0 release](https://news.itsfoss.com/nitrux-2-0-release/).
Not to forget, they also [ditched Ubuntu as its base in favor of Debian](https://news.itsfoss.com/nitrux-linux-debian/), last year.
So, considering a lot has happened, and it’s been around for a few years now. Should you give it a try?
Here, I highlight some reasons to try [Nitrux OS](https://nxos.org/?ref=news.itsfoss.com):
## 1. It Isn’t Ubuntu-based

Most Linux distributions recommended for everyday use are based on Ubuntu.
Of course, our [recommendations for beginners](https://itsfoss.com/best-linux-beginners/?ref=news.itsfoss.com) also include mostly Ubuntu Linux, but don’t let that fool you.
The only reason we recommend Ubuntu-based distros is it’s an easy-to-use distro with direct support for a lot of commercial software products.
So, if you are not entirely new to Linux, and want to try something refreshing, stable but familiar, Nitrux OS as a Debian-based distro can be a good fit.
You can work your way through the terminal without a steep learning curve, whenever needed.
If you are curious, refer to our [comparison between Debian and Ubuntu](https://itsfoss.com/debian-vs-ubuntu/?ref=news.itsfoss.com) to learn more.
## 2. Focus on AppImages

[AppImage](https://itsfoss.com/use-appimage-linux/?ref=news.itsfoss.com) is a universal packaging system that does not depend on anything. You do not need a package manager, or any dependencies on your distro, to make it work.
It aims to be portable, efficient and does not need any setup/installation. Just like portable Windows executables.
And, Nitrux OS focuses on using AppImage applications to give you a seamless app experience.
The NX Software Center is a GUI to manage and install AppImage applications built using MauiKit (its UI framework).
## 3. A KDE-Based Distro

Nitrux OS is one of the [best Linux distributions featuring KDE.](https://itsfoss.com/best-kde-distributions/?ref=news.itsfoss.com) If you dislike using GNOME or any other desktop environment (DE) out-of-the-box, KDE is a nice alternative to try.
In case you didn’t know, [KDE can be customized in many ways ](https://itsfoss.com/kde-customization/?ref=news.itsfoss.com)compared to other DEs.
So, if you want to personalize your desktop with the widest range of options, KDE lets you do that without much effort.
## 4. Unique User Experience

Nitrux UX combines the best of KDE, and Qt technologies along with its tweaks to give you a refreshing user experience.
While it does not feel completely alien, your workflow will feel a bit different when using Nitrux OX.
Even without any customizations from your side, the out-of-the-box experience is solid enough to count it as one of the [most beautiful distributions](https://itsfoss.com/beautiful-linux-distributions/?ref=news.itsfoss.com).
## 5. Maui Shell

[Maui Shell](https://news.itsfoss.com/maui-shell-unveiled/) is a key highlight of Nitrux’s user experience. Recently, it has managed to put some promising work presenting a convergent interface for both desktop and mobiles/tablets.
While it hasn’t matured enough, it already looks pretty. And, as exciting as [System76’s upcoming Rust-based desktop environment](https://news.itsfoss.com/system76-cosmic-panel/).
It can be one of the most important reasons to try Nitrux OS to see it unfold a new era of the desktop experience, who knows?
## 6. Xanmod Kernel

[Xanmod Kernel](https://xanmod.org/?ref=news.itsfoss.com) is a customized version of the mainline Linux Kernel with performance tweaks and additional features. This should help you improve the desktop experience.
Starting with Nitrux 2.0, Xanmod Kernel will be the default Linux Kernel to provide you with an enhanced desktop experience.
You also get the option to choose other Linux Kernels like Liquorix and Libre, each of their benefits.
Or, you can also choose to go with mainline LTS Linux Kernel, if you do not prefer Xanmod. So, you’ve complete freedom and the ability to seamlessly choose a different kernel if you want to ditch the default.
## Wrapping Up
It is important to consider all the risks when switching from a mainstream distribution to options like Nitrux OS.
But, **I’d like you to give this a thought:**
Distributions like Nitrux OS passionately try to improve things as per their vision.
Even without corporate backing or massive funds to help them, they have been able to develop this amazing distribution, developed [Maui project](https://mauikit.org/?ref=news.itsfoss.com), and the interesting Maui shell.
So, I think we should try our best to support them in any way we can.
That being said, every Linux distribution comes with its share of issues. Whenever you take a leap with a new distro, you might want to give it some time before getting comfortable with it as your daily driver.
So, I would suggest trying it in your spare time or setting up a virtual machine to test things out.
*I*‘*d be curious if you like/hate the experience. Let me know your thoughts after trying it out in the comments below.*
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,362 | 怎么开始你的第一次打包? | https://github.com/LCTT/Articles/pull/5 | 2022-03-16T14:44:15 | [
"打包"
] | https://linux.cn/article-14362-1.html |
>
> 太复杂的包咱们打不来,咱们先从最简单的壁纸包开始打起。
>
>
>

“<ruby> 打包 <rt> packing </rt></ruby>” 是什么?在 Linux 语境中,“打包”是指制作可以在 Linux 上用软件包管理器来安装、更新和卸载的软件包。
你肯定要问了,什么要打包?举例来说,你肯定有过拍一些照片并且将它们设置为壁纸的经历,对吧。一个个传到计算机上去挺累的。把这些收集起来,打成一个壁纸包,与其他人分享是个不错的选择。顺便,通过打包,也可以对 Debian 的软件包有个大致的了解。
### 背景介绍
《崩坏 3》,是一个我很喜欢玩的游戏,但它不支持 Linux 平台,所以,望梅止渴的我只好把这些壁纸进行打包,以此纪念和女武神们并肩战斗过的时光。
本文中介绍的打包是给 Debian/Ubuntu 系所用的 deb 包,其他系或独立发行版请按所属发行版的官方手册进行打包工作。
### 准备工作
先准备如下工具 `wget`、`tar`、`dh-make`、`debmake`、`lintian`(有一些应该在你 Linux 上已经安装过了):
```
~ $ sudo apt install wget tar dh-make debmake lintian
```
先建立打包文件夹:
```
make $ mkdir -p honkai-impact3-0.1/usr/share/background/honkai-impact3
```
更换壁纸的时候你应该注意到了,通常壁纸的存放位置都是在 `/usr/share/background` 目录里的,所以这里建立了相应的多级目录。
你也可以用你自己拍摄的照片来打包,本文所用的演示图片均来自于《崩坏 3》官网,你可以自行下载。

### 开始打包
然后,退回到上级目录里,将存放壁纸的目录压缩成一个 tar 包:
```
honkai-impact3-0.1 $ cd ..
make $ tar -cvzf honkai-impact3-0.1.tar.gz honkai-impact3-0.1/usr/share/background/honkai-impact3
```
压缩包创建好之后,我们还得设置两个变量,这样软件包维护工具就可以正确识别维护者信息了:
```
make $ cat >> ~/.bashrc <<EOF
DEBEMAIL="bronya_zaychik@st_freya_academy.edu"
DEBFULLNAME="Bronya Zaychik"
export DEBEMAIL DEBFULLNAME
EOF
make $ . ~/.bashrc
```
此处:
* `DEBEMAIL` 写你的邮箱地址
* `DEBFULLNAME` 写维护者的名字
### 初始化
```
make $ cd honkai-impact3-0.1
honkai-impact3-0.1 $ dh_make -f ../honkai-impact3-0.1.tar.gz
Type of package: (single, indep, library, python)
[s/i/l/p]?
Maintainer Name : Bronya Zaychik
Email-Address : bronya_zaychik@st_freya_academy.edu
Date : Wed, 02 Feb 2022 07:00:28 +0000
Package Name : honkai-impact3
Version : 0.1
License : blank
Package Type : library
Are the details correct? [Y/n/q]
```
`dh_make` 是个不错的工具,这工具用于初始化压缩包并生成模板文件。下面的 `debian` 文件夹就是用这个工具生成的。
在初始化完成之后,你会看到如下文件:
```
honkai-impact3-0.1 $ cd ..
make $ ls -F
honkai-impact3-0.1/
honkai-impact3-0.1.tar.gz
honkai-impact3_0.1.orig.tar.gz
```
而 `debian` 文件夹里却有了很多模板文件,在一阵怒砍之后,只留下如下文件:
```
make $ ls -F honkai-impact3-0.1/debian/
source/
changelog
control
copyright
rules
```
其中,`changlog` 文件是用来记录版本更新内容的变更日志。
例如:
```
honkai-impact3-0.1 $ cat debian/changelog
```
```
honkai-impact3-background (0.1-1) unstable; urgency=medium
* 2020.8.17 首次打包完成
* 2022.2.2 重新打包
-- Bronya Zaychik <bronya_zaychik@st_freya_academy.edu> Wed, 02 Feb 2022 07:20:00 +0000
honkai-impact3-background (0.1-1) unstable; urgency=medium
* Initial release
-- Bronya Zaychik <bronya_zaychik@st_freya_academy.edu> Wed, 02 Feb 2022 07:00:28 +0000
```
`control` 文件用来记录壁纸包的版本信息:
```
honkai-impact3-0.1 $ cat debian/control
```
```
Package: honkai-impact3-background
Version: 0.1-1
Architecture: all
Maintainer: Bronya Zaychik <bronya_zaychik@st_freya_academy.edu>
Section: x11
Priority: optional
Homepage: https://gitee.com/PokerFace128/K423_Lab_Soft
Description: This is the game wallpaper of the HokaiImpact3.
TECH OTAKUS SAVE THE WORLD
```
说明如下:
* 第 1-2 行是包名和版本号
* 第 3 行是可以编译该二进制包的体系结构,通常文本、图像、或解释型语言脚本所生成的二进制包都用 `Architecture: all`
* 第 4 行是维护者信息
* 第 5 行是分类,这里我们选择为 `x11`,这是不属于其他分类的为 X11 程序
* 第 6 行是优先级,这个为常规优先级。
* 第 7 行是维护者的个人主页,GitHub、Gitee,甚至是你的 BiliBili 主页都可以。
* 第 8 行是对这个软件包的描述
* 第 9 行建议写点什么上去,这样在用 `lintian` 检查的时候就不会空了。
最后是 `copyright` 文件,用来存放版权信息。就是该软件包内文件的版权说明。至于这个示例壁纸包,由于版权属于该游戏出品方,作为演示用途,我这里就没填。
#### 开始打包
只需一个命令,就可轻松打包:
```
make $ cd honkai-impact3-0.1/
honkai-impact3-0.1 $ dpkg-buildpackage -us -uc
```
你应该用过 `dpkg -i` 这条命令,`dpkg` 工具不只能安装,还能打包和拆包。
啪的一下,一个壁纸包就这样打好了:
```
honkai-impact3-0.1 $ cd ../
make $ ls -F
honkai-impact3-0.1/
honkai-impact3_0.1-1_amd64.changes
honkai-impact3_0.1-1.debian.tar.xz
honkai-impact3_0.1.orig.tar.gz
honkai-impact3_0.1-1_amd64.buildinfo
honkai-impact3_0.1-1_amd64.deb
honkai-impact3_0.1-1.dsc
honkai-impact3-0.1.tar.gz
```
接下来用 lintian 检查
```
make $ lintian honkai-impact3_0.1-1_amd64.deb
E: honkai-impact3-background: copyright-contains-dh_make-todo-boilerplate
E: honkai-impact3-background: helper-templates-in-copyright
W: honkai-impact3-background: copyright-has-url-from-dh_make-boilerplate
```
这里显示我没填 `copyright` 文件,这里需要你填入版权信息,像壁纸类的话,通常都是 CC 协议。
打包好之后就像这样:

如果你想了解关于 deb 打包的更多内容,请看如下链接:<https://www.debian.org/doc/manuals/maint-guide/index.zh-cn.html>
*作者注:因读者多次吐槽,文章经过了反复修改。详情请看 GitHub 上的 PR。*
---
作者简介:
PokerFace,一个会空中劈叉的老舰长(睿智清洁工)。
---
作者:[PokerFace](https://github.com/pokerface128) 编辑:[wxy](https://github.com/wxy)
本文由贡献者投稿至 [Linux 中国公开投稿计划](https://github.com/LCTT/Articles/),采用 [CC-BY-SA 协议](https://creativecommons.org/licenses/by-sa/4.0/deed.zh) 发布,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | -
[Notifications](/login?return_to=%2FLCTT%2FArticles)You must be signed in to change notification settings -
[Fork 12](/login?return_to=%2FLCTT%2FArticles)
# 2022_03_09_How _to_start_your_first _pack.md #5
## Conversation
[Learn more about bidirectional Unicode characters](https://github.co/hiddenchars)
这是我的第一次写专栏

**reviewed**
[wxy](/wxy)Mar 10, 2022
There was a problem hiding this comment.
### Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).
非常好,文章有条理,略有需要修改的地方我已经逐一指出,望完善,很快达到出版标准啦。
@@ -0,0 +1,194 @@ | |||
[#]: subject: "怎么开始你的第一次打包?" | |||
[#]: author: "PokerFace128 GitHub https://github.com/pokerface128 Gitee https://gitee.com/pokerface128 BiliBili https://space.bilibili.com/36777210 Mail [email protected]" |
There was a problem hiding this comment.
### Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).
此处留名字和一个 URL 即可。
[#]: subject: "怎么开始你的第一次打包?" | ||
[#]: author: "PokerFace128 GitHub https://github.com/pokerface128 Gitee https://gitee.com/pokerface128 BiliBili https://space.bilibili.com/36777210 Mail [email protected]" | ||
|
||
### 怎么开始你的第一次打包? |
There was a problem hiding this comment.
### Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).
这里应该是标题 `#`
即可
|
||
### 怎么开始你的第一次打包? | ||
|
||
>太复杂的包咱们打不来,咱们先从最简单的壁纸包开始打起。 |
There was a problem hiding this comment.
### Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).
应该适当再多一些描述,比如为什么要打包,学习打包的目的。
|
||
你也可以用你手里的照片来打包。演示图片均来自于崩坏3官网。 | ||
|
||
由于我觉得一个个下载太累了,于是乎就写了个脚本来批量下壁纸。 |
There was a problem hiding this comment.
### Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).
此处是个示例脚本,不是实际 URL ,所以不能工作,应该说明一些,请读者自行替换为需要下载的 URL。
或者,考虑版权问题,此处忽略下载这个部分,只说将需要打包的壁纸放在某个目录即可。
|
||
 | ||
|
||
崩坏3,一个我很喜欢玩的游戏。但它们不支持Linux平台。我只好把这些壁纸进行打包,以此纪念和女武神们并肩战斗过的时光。 |
There was a problem hiding this comment.
### Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).
应该增加一些技术背景信息,比如这个是为 Debian/Ubuntu 系打包 deb 包。
DEBFULLNAME 写你维护者的名字 | ||
|
||
#### 初始化软件包 | ||
|
There was a problem hiding this comment.
### Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).
这里使用到了 `dh_make`
命令,建议简单介绍一下这个命令用途。
honkai-impact3_0.1.orig.tar.gz | ||
``` | ||
|
||
而debian文件夹里却有了很多模板文件,在一阵怒砍之后,只留下如下文件。 |
There was a problem hiding this comment.
### Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).
哪里来的 `debian`
文件夹?上文没介绍。
There was a problem hiding this comment.
### Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).
应该是上一步生成的
There was a problem hiding this comment.
### Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).
应该是上一步生成的
对,第一次写,没怎么写清。第二版已更正。
|
||
#### 开始打包 | ||
|
||
只需一个命令,就可轻松打包。 |
There was a problem hiding this comment.
### Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).
同样,需要介绍一下命令。
|
||
``` | ||
|
||
这里显示我没填copyright文件 |
There was a problem hiding this comment.
### Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).
这个错误需要解决么?应该如何解决?可以说明一下。
打包好之后就像这样 | ||
|
||
 | ||
|
There was a problem hiding this comment.
### Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).
文章中如果涉及到一些需要参考的信息,或延伸阅读的信息,比如 Deb 打包的官方的一些资料,可以在文内做链接。这样使得读者不仅仅可以掌握本文信息,还可以进一步提升和探索。
另外,请修改文件名,参照其它 PR |
我怕识别不出来,就这样写了。没办法,习惯了这种命名格式了。2333 |
经过修改后的第二版
|
不是,../ 只是为了展示上一层目录的结构,说明像那样操作会出现什么样子。要是这样还不行,我就只能改个第三版,再加读者吐槽。 |
以上愚见,请参考。我觉得再完善一下就可以发表啦~ // 又及,我不是“读者”,是编辑,哈哈 |
|
[@PokerFace128]辛苦了,经过我的不懈吐槽和你的不懈修改,我改完了最后一版(我觉得是)。你看看是否可以接受这个版本,有什么需要调整的请指出。如没问题,我就合并到仓库 ,并择机发布了。
可以发布 |
这是我第一次写这种类型的文章,可能写的不好还请见谅 |
14,364 | 五个提升你的 Git 水平的命令 | https://opensource.com/article/21/4/git-commands | 2022-03-17T11:06:22 | [
"Git"
] | https://linux.cn/article-14364-1.html |
>
> 将这些命令加入到你的工作流中,使 Git 发挥更大的作用。
>
>
>

如果你经常使用 Git,你可能会知道它非常有名。它可能是最受欢迎的版本控制方案,它被一些 [最大的软件项目](https://opensource.com/article/19/10/how-gnome-uses-git) 用来 [跟踪文件变更](https://opensource.com/article/18/2/how-clone-modify-add-delete-git-files)。Git 提供了 [健壮的界面](https://opensource.com/article/18/5/git-branching) 来审阅代码、把实验性的变更合并到已经存在的文件中。得益于 [Git 钩子](https://opensource.com/life/16/8/how-construct-your-own-git-server-part-6),它以灵活性而闻名。同时,也因为它的强大,它给人们留下了一个“复杂”的印象。
Git 有诸多特性,你不必全部使用,但是如果你正在深入研究 Git 的 <ruby> 子命令 <rt> subcommands </rt></ruby>,我这里倒是有几个,或许你会觉得有用。
### 1、找到变更
如果你已经熟悉 Git 的基本指令(`fetch`、`add`、`commit`、`push`、`log` 等等),但是希望学习更多,那么从 Git 的检索子命令开始是一个简单安全的选择。检索你的 Git 仓库(你的 *工作树*)并不会做出任何更改,它只是一个报告机制。你不会像使用 `git checkout` 一样承担数据完整性的风险,你只是在向 Git 请求仓库的当前状态和历史记录而已。
[git whatchanged](https://opensource.com/article/21/3/git-whatchanged) 命令(几乎本身就是一个助记符)可以查看哪些文件在某个<ruby> 提交 <rt> commit </rt></ruby>中有变更、分别做了什么变更。它是一个简单的、用户友好的命令,因为它把 `show`、`diff-tree` 和 `log` 这三个命令的最佳功能整合到了一个好记的命令中。
### 2、使用 git stash 管理变更
你越多地使用 Git,你就会使用 Git 越多。这就是说,一旦你习惯了 Git 的强大功能,你就会更频繁地使用它。有时,你正在处理一大堆文件,忽然意识到了有更紧急的任务要做。这时,在 [git stash](https://opensource.com/article/21/3/git-stash) 的帮助下,你就可以把所有正在进行的工作收集起来,然后安全地<ruby> 暂存 <rt> stash </rt></ruby>它们。当你的工作空间变得整洁有序,你就可以把注意力放到别的任务上,晚些时候再把暂存的文件重新加载到工作树里,继续之前的工作。
### 3、使用 git worktree 来得到链接的副本
当 `git stash` 不够用的时候,Git 还提供了强大的 [git worktree](https://opensource.com/article/21/3/git-worktree) 命令。有了它,你可以新建一个 *链接的* 仓库<ruby> 副本 <rt> clone </rt></ruby>,组成一个新分支,把 `HEAD` 设置到任意一个提交上,然后基于这个分支开始你的新工作。在这个链接的副本里,你可以进行和主副本完全不同的任务。这是一个避免意外的变更影响当前工作的好办法。当你完成了你的新工作,你可以把新分支推送到远程仓库;也可以把当前的变更归档,晚些时候再处理;还可以从别的工作树中获取它们的变更。无论选择哪一种,你的工作空间之间都会保持相互隔离,任一空间中的变更都不会影响其他空间中的变更,直到你准备好了要合并它们。
### 4、使用 git cherry-pick 来选择合并
这可能听起来很反直觉,但是,你的 Git 水平越高,你可能遇到的合并冲突就会越多。这是因为合并冲突不一定是错误的标志,而是活跃的标志。在学习 Git 中,适应合并时的冲突,并学会如何解决它们是非常重要的。通常的方式或许够用,但是有时候你会需要更加灵活地进行合并,这时候就该 [git cherry-pick](https://opensource.com/article/21/3/reasons-use-cherry-picking) 出场了。遴选操作允许你选择部分合并提交,这样一来你就不需要因为一些细微的不协调而拒绝整个合并请求了。
### 5、使用 Git 来管理 $HOME
使用 Git 来管理你的主目录从来没有这么简单过,这都要归功于 Git 可以自由选择管理对象的能力,这是一个在多台计算机之间保持同步的现实可行的选项。但是,想要让它工作顺利,你必须非常明智且谨慎才行。如果你想要了解更多,点击阅读我写的关于 [使用 Git 来管理 $HOME](https://opensource.com/article/21/3/git-your-home) 的小技巧。
### 更好地使用 Git
Git 是一个强大的版本控制系统,你使用得越熟练,就可以越轻松地借助它来完成复杂的任务。今天就尝试一些新的 Git 命令吧,欢迎在评论区分享你最喜欢的 Git 命令。
---
via: <https://opensource.com/article/21/4/git-commands>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[lkxed](https://github.com/lkxed) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | If you use Git regularly, you might be aware that it has several reputations. It's probably the most popular version-control solution and is used by some of the [biggest software projects](https://opensource.com/article/19/10/how-gnome-uses-git) around to [keep track of changes](https://opensource.com/article/18/2/how-clone-modify-add-delete-git-files) to files. It provides a [robust interface](https://opensource.com/article/18/5/git-branching) to review and incorporate experimental changes into existing documents. It's well-known for its flexibility, thanks to [Git hooks](https://opensource.com/life/16/8/how-construct-your-own-git-server-part-6). And partly because of its great power, it has earned its reputation for being complex.
You don't have to use all of Git's many features, but if you're looking to delve deeper into Git's subcommands, here are some that you might find useful.
## 1. Finding out what changed
If you're familiar with Git's basics (`fetch`
, `add`
, `commit`
, `push`
, `log`
, and so on) but you want to learn more, Git subcommands that query are a great, safe place to start. Querying your Git repository (your *work tree*) doesn't make any changes; it's only a reporting mechanism. You're not risking the integrity of your Git checkout; you're only asking Git about its status and history.
The [git whatchanged](https://opensource.com/article/21/3/git-whatchanged) command (almost a mnemonic itself) is an easy way to see what changed in a commit. A remarkably user-friendly command, it squashes the best features of `show`
and `diff-tree`
and `log`
into one easy-to-remember command.
## 2. Managing changes with git stash
The more you use Git, the more you use Git. That is, once you've become comfortable with the power of Git, the more often you use its powerful features. Sometimes, you may find yourself in the middle of working with a batch of files when you realize some other task is more urgent. With [git stash](https://opensource.com/article/21/3/git-stash), you can gather up all the pieces of your work in progress and stash them away for safekeeping. With your workspace decluttered, you can turn your attention to some other task and then reapply stashed files to your work tree later to resume work.
## 3. Making a linked copy with git worktree
When `git stash`
isn't enough, Git also provides the powerful [git worktree](https://opensource.com/article/21/3/git-worktree) command. With it, you can create a new but *linked* clone of your repository, forming a new branch and setting `HEAD`
to whatever commit you want to base your new work on. In this linked clone, you can work on a task unrelated to what your primary clone is focused on. It's a good way to keep your work in progress safe from unintended changes. When you're finished with your new work tree, you can push your new branch to a remote, bundle the changes into an archive for later, or just fetch the changes from your other tree. Whatever you decide, your workspaces are kept separate, and the changes in one don't have to affect changes in the other until you are ready to merge.
## 4. Selecting merges with git cherry-pick
It may seem counterintuitive, but the better at Git you get, the more merge conflicts you're likely to encounter. That's because merge conflicts aren't necessarily signs of errors but signs of activity. Getting comfortable with merge conflicts and how to resolve them is an important step in learning Git. The usual methods work well, but sometimes you need greater flexibility in how you merge, and for that, there's [git cherry-pick](https://opensource.com/article/21/3/reasons-use-cherry-picking). Cherry-picking merges allows you to be selective in what parts of commits you merge, so you never have to reject a merge request based on a trivial incongruity.
## 5. Managing $HOME with Git
Managing your home directory with Git has never been easier, and thanks to Git's ability to be selective in what it manages, it's a realistic option for keeping your computers in sync. To work well, though, you must do it judiciously. To get started, read my tips on [managing $HOME with Git](https://opensource.com/article/21/3/git-your-home).
## Getting better at Git
Git is a powerful version-control system, and the more comfortable you become with it, the easier it becomes to use it for complex tasks. Try some new Git commands today, and share your favorites in the comments.
## Comments are closed. |
14,365 | Zorin OS 16.1 带来了急需的稳定性和改进措施 | https://www.debugpoint.com/2022/03/zorin-os-16-1-release/ | 2022-03-17T11:35:27 | [
"发行版"
] | /article-14365-1.html |
>
> Zorin OS 16.1 带来了安全补丁、新软件,团队的目标是打造更好的发行版。
>
>
>
Zorin OS 之所以受欢迎,是因为它为 Windows 用户的 Linux 之旅提供了一个完美的起点。由于其简单的设计、优雅的软件包选择和开箱即用的 Windows 外观,它是当今所有用户欢迎和追捧的 Linux 发行版之一。
自 [Zorin OS 16](https://www.debugpoint.com/2021/12/zorin-os-16-lite-review-xfce/) 以来,经过近两个月的时间,这第一个小版本现在可以供已经在运行 16.0 版本的用户下载和升级了。

### Zorin OS 16.1 - 新内容
Zorin OS 16.1 为你的系统带来了最新安全补丁,包括 LibreOffice 7.3 办公套件和一些更新的软件包。
如果你刚买了一台新的笔记本电脑或安装了一个新的游戏工作站,Zorin OS 16.1 还支持索尼的 PlayStation 5 Dual Sense 游戏控制器和苹果的魔术鼠标 2。此外,你还得到了对英特尔第 12 代处理器和英伟达 RTX 3050 显卡的出色支持。
此外,由于最新的软件包,Zorin 开发人员承诺对汽车 Wi-Fi 和打印机有更好的支持。
下面是这个小版本的更新包和应用的快速总结。
* 基于 Ubuntu 20.04.3 LTS
* Zorin 桌面,基于 GNOME 3.38.4
* LibreOffice 7.3
* Firefox 98
* Linux Kernel 5.13
* GIMP 2.10.18
* Evolution 邮件客户端
如果你想深入了解这些变化,完整的细节可以在[这里](https://blog.zorin.com/2022/03/10/zorin-os-16-1-released-support-for-ukraine/)找到。
那么,在哪里下载?
### 下载
在你点击下载之前,你应该知道它有一个“专业”版本,带有额外的主题和开箱即用的设置,价值 39 美元,而“核心”版本是完全免费下载的。你可以在下载页面阅读“专业版”和“核心版”的比较。
在我看来,核心版应该足够了,如果你有足够的经验,你可以改变设置,使其成为专业版。因此,我们推荐核心版用于一般用途。
* [下载 Zorin OS 16.1](https://zorin.com/os/download/)
---
via: <https://www.debugpoint.com/2022/03/zorin-os-16-1-release/>
作者:[Arindam](https://www.debugpoint.com/author/admin1/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) | null |
14,367 | 你需要了解的 Go 中的模糊测试 | https://opensource.com/article/22/1/native-go-fuzz-testing | 2022-03-18T10:31:29 | [
"Go"
] | https://linux.cn/article-14367-1.html |
>
> Go 团队接受了新增对模糊测试的支持的提议。
>
>
>

[Go](https://go.dev/) 的应用越来越广泛。现在它是云原生软件、容器软件、命令行工具和数据库等等的首选语言。Go 很早之前就已经有了内建的 [对测试的支持](https://pkg.go.dev/testing)。这使得写测试代码和运行都相当简单。
### 什么是模糊测试?
<ruby> 模糊测试 <rt> fuzz testing </rt></ruby>(fuzzing)是指向你的软件输入非预期的数据。理想情况下,这种测试会让你的应用程序崩溃或有非预期的表现。抛开最终的结果,从程序对非预期的输入数据的处理结果中你可以得到很多信息,这样你就可以增加一些合适的错误处理。
任何一个软件都有对不同来源的输入或数据的接收说明,软件会对这些数据进行处理并返回适当的结果。软件开发后,测试工程师团队对其进行测试,找出软件中的错误,给出测试报告,并(由开发者)修复。通常测试的目的是验证软件的行为是否符合预期。测试又可以细分为不同的类型,如功能测试、集成测试、性能测试等等。每种测试方法关注软件功能的某一个方面,以便发现错误或者提升可靠性或性能。
模糊测试在这一测试过程上更进一步,尝试向软件程序输入一些“无效”或“随机”的数据。这种输入是故意的,期望得到的结果就是程序崩溃或输出异常,这样就可以暴露程序中的错误以便由开发者来修复它们。与其他测试类似,很少需要手动进行模糊测试,业界有大量的模糊测试工具可以将这个过程自动化。
### Go 中的软件测试
举个例子,假如你想测试 `add.go` 中的 `Add()` 函数,你可以在 `add_test.go` 中导入 `testing` 包并把测试体写在以 `TestXXX()` 开头的函数内。
考虑如下代码:
```
func Add(num1, num2 int) int {
}
```
在 `add_test.go` 文件中,你可能有如下测试代码:
```
import "testing"
func TestAdd(t *testing.T) {
}
```
运行测试:
```
$ go test
```
### 新增对模糊测试的支持
Go 团队已经接受了 [新增对模糊测试的支持的提议](https://github.com/golang/go/issues/44551),以进一步推动这项工作。这涉及到新增一个 `testing.F` 类型,在 `_test.go` 文件中新增 `FuzzXXX()` 函数,在 Go 工具中会新增一个 `-fuzz` 选项来执行这些测试。
在 `add_test.go` 文件中:
```
func FuzzAdd(f *testing.F) {
}
```
执行以下代码:
```
$ go test -fuzz
```
在本文编写时,这个 [功能还是试验性的](https://go.dev/blog/fuzz-beta),但是应该会在 1.18 发布版本中包含。(LCTT 译注:[Go 1.18](https://go.dev/blog/go1.18) 刚刚发布,已经包含了对模糊测试的支持)目前很多功能如 `-keepfuzzing`、`-race` 等也还没有支持。Go 团队最近发布了一篇 [模糊测试教程](https://go.dev/doc/tutorial/fuzz),值得读一下。
### 安装 gotip 来获取最新的功能
如果你极度渴望在正式发布之前尝试这些功能,你可以使用 `gotip` 来测试即将正式发布的 Go 功能并反馈给他们。你可以使用下面的命令来安装 `gotip`。安装之后,你可以用 `gotip` 程序代替以前的 `go` 程序来编译和运行程序。
```
$ go install golang.org/dl/gotip@latest
$ gotip download
$ gotip version
go version devel go1.18-f009910 Thu Jan 6 16:22:21 2022 +0000 linux/amd64
```
### 社区对于模糊测试的观点
软件社区中经常会讨论模糊测试,不同的人对模糊测试有不同的看法。有些人认为这是一种有用的技术,可以找到错误,尤其是在安全方面。然而考虑到模糊测试所需要的资源(CPU、内存),有人就认为这是一种浪费,而他们更愿意用其他的测试方法。即使在 Go 团队内部,意见也不统一。我们可以看到 Go 的联合创始人 Rob Pike 对模糊测试的使用和在 Go 中的实现是持轻微的怀疑态度的。
>
> ...*虽然模糊测试有助于发现某类错误,但是它会占用大量的 CPU 和存储资源,并且效益成本比率也不明确。我担心为了写模糊测试浪费精力,或者 git 仓库中充斥大量无用的测试数据*
>
>
> ~[Rob Pike](https://github.com/golang/go/issues/44551#issuecomment-784584785)
>
>
>
然而,Go 安全团队的另一个成员,Filo Sottile,似乎对 Go 新增支持模糊测试很乐观,举了很多例子来支持,也希望模糊测试能成为开发过程中的一部分。
>
> *我想说模糊测试可以发现极端情况下的错误。这是我们作为安全团队对其感兴趣的原因:在极端情况下发现的错误可以避免在生产环境中成为弱点。*
>
>
> *我们希望模糊测试能成为开发的一部分 —— 不只是构建或安全方面 —— 而是整个开发过程:它能提升相关代码的质量...*
>
>
> ~[Filo Sottile](https://github.com/golang/go/issues/44551#issuecomment-784655571)
>
>
>
### 现实中的模糊测试
对我而言,模糊测试在发现错误以及让系统变得更安全和更有弹性方面似乎非常有效。举个例子,Linux 内核也会使用名为 [syzkaller](https://github.com/google/syzkaller) 的工具进行模糊测试,这个工具已经发现了 [大量](https://github.com/google/syzkaller/blob/master/docs/linux/found_bugs.md) 错误。
[AFL](https://github.com/google/AFL) 也是比较流行的模糊测试工具,用来测试 C/C++ 写的程序。
之前也有对 Go 程序进行模糊测试的观点,其中之一就是 Filo 在 GitHub 评论中提到的 [go-fuzz](https://github.com/dvyukov/go-fuzz)。
>
> *go-fuzz 的记录提供了相当惊人的证据,证明模糊处理能很好地找到人类没有发现的错误。根据我的经验,我们只需要消耗一点点 CPU 的时间就可以得到极端情况下非常高效的测试结果。*
>
>
>
### 为什么在 Go 中新增对模糊测试的原生支持
如果我们的需求是对 Go 程序进行模糊测试,之前的工具像 `go-fuzz` 就可以完成,那么为什么要在这种语言中增加原生支持呢?[Go 模糊测试设计草案](https://go.googlesource.com/proposal/+/master/design/draft-fuzzing.md) 中说明了这样做的一些根本原因。设计的思路是让开发过程更简单,因为前面说的工具增加了开发者的工作量,还有功能缺失。如果你没有接触过模糊测试,那么我建议你读一下设计草案文档。
>
> 开发者可以使用诸如 `go-fuzz` 或 `fzgo`(基于 `go-fuzz`)来解决某些需求。然而,已有的每种解决方案都需要在典型的 Go 测试上做更多的事,而且还缺少关键的功能。相比于其他的 Go 测试(如基准测试和单元测试),模糊测试不应该比它们复杂,功能也不应该比它们少。已有的解决方案增加了额外的开销,比如自定义命令行工具。
>
>
>
### 模糊测试工具
在大家期望 Go 语言新增功能的列表中,模糊测试是其中很受欢迎的一项。虽然现在还是试验性的,但在将要到来的发布版本中会变得更强大。这给了我们足够的时间去尝试它以及探索它的使用场景。我们不应该把它视为一种开销,如果使用得当它会是一种发现错误非常高效的测试工具。使用 Go 的团队应该推动它的使用,开发者可以写简单的模糊测试,测试团队去慢慢扩展以此来使用它全部的能力。
---
via: <https://opensource.com/article/22/1/native-go-fuzz-testing>
作者:[Gaurav Kamathe](https://opensource.com/users/gkamathe) 选题:[lujun9972](https://github.com/lujun9972) 译者:[lxbwolf](https://github.com/lxbwolf) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | The usage of [Go](https://go.dev/) is growing rapidly. It is now the preferred language for writing cloud-native software, container software, command-line tools, databases, and more. Go has had built-in [support for testing](https://pkg.go.dev/testing) for quite some time now. It makes writing tests and running them using the Go tool relatively easy.
## What is fuzz testing?
Fuzzing, sometimes also called fuzz testing, is the practice of giving unexpected input to your software. Ideally, this test causes your application to crash, or behave in unexpected ways. Regardless of what happens, you can learn a lot from how your code reacts to data it wasn't programmed to accept, and you can add appropriate error handling.
Any given software program consists of instructions that accept input or data from various sources, then it processes this data and generates appropriate output. As software gets developed, a team of test engineers tests this software to find bugs in the software that can then be reported and fixed. Often, the intent is to see if the software behaves as expected. Testing can further get divided into multiple areas, such as functional testing, integration testing, performance testing, and more. Each focuses on a specific aspect of the software functionality to find bugs or improve reliability or performance.
Fuzzing takes this testing process a step further and tries to provide "invalid" or "random" data to the software program. This is intentional, and the expectation is that the program should crash or behave unexpectedly to uncover bugs in the program so the developers can fix them. Like testing, doing this manually doesn't scale, so many fuzzing tools have been written to automate this process.
## Software testing in Go
As an example to test `Add()`
function within `add.go`
, you could write tests within `add_test.go`
by importing the "testing" package and adding the test functionality within a function starting with `TestXXX()`
.
Given this code:
```
func Add(num1, num2 int) int {
}
```
In a file called `add_test.go`
, you might have this code for testing:
```
import "testing"
func TestAdd(t *testing.T) {
}
```
Run the test:
`$ go test`
## Addition of fuzz testing support
The Go team has accepted a [proposal to add fuzz testing support](https://github.com/golang/go/issues/44551) to the language to further this effort. This involves adding a new `testing.F`
type, the addition of `FuzzXXX()`
functions within the `_test.go`
files, and to run these tests with the `-fuzz`
option is being added to the Go tool.
In a file called `add_test.go`
:
```
func FuzzAdd(f *testing.F) {
}
```
Run the code:
`$ go test -fuzz`
This [feature is experimental](https://go.dev/blog/fuzz-beta) at the time of writing, but it should be included in the 1.18 release. Also, many features like `-keepfuzzing`
and `-race`
are not supported at the moment. The Go team has recently published [a tutorial on fuzzing](https://go.dev/doc/tutorial/fuzz), which is well worth a read.
## Get the latest features with gotip installation
If you are enthusiastic and wish to try out the feature before the official release, you can utilize `gotip`
, which allows you to test upcoming Go features and provide feedback. To install `gotip`
, you can use the commands below. After installation, you can use the `gotip`
utility to compile and run the program instead of the usual `go`
utility.
```
$ go install golang.org/dl/gotip@latest
$ gotip download
$ gotip version
go version devel go1.18-f009910 Thu Jan 6 16:22:21 2022 +0000 linux/amd64
$
```
## Fuzzing opinions in the community
Fuzzing is often a point of discussion among the software community, and we find people on both ends of the spectrum. Some consider it a useful technique to find bugs, especially on the security front. Whereas given the required resources (CPU/memory) for fuzzing, some consider it a waste or prefer other techniques over it. This is even evident in the Go team as well. We can see Go co-founder Rob Pike being slightly skeptical about the uses of fuzzing and its implementation in Go.
... Although fuzzing is good at finding certain classes of bugs, it is very expensive in CPU and storage, and cost/benefit ratio remains unclear. I worry about wasting energy and filling up git repos with testdata noise...
However, another member of the Go security team, Filo Sottile, seems quite optimistic about the addition of fuzz support to Go, also backing it up with some examples and wants it to be a part of the development process.
I like to say that fuzzing finds bugs at the margin. It's why we are interested in it as the security team: bugs caught at the margin are ones that don't make it into production to become vulnerabilities.
We want fuzzing to be part of the development—not build or security—process: make a change to the relevant code…
## Real-world fuzzing
To me, fuzzing seems quite effective at findings bugs and making systems more secure and resilient. To give an example, even the Linux kernel is fuzz tested using a tool called [syzkaller](https://github.com/google/syzkaller), and it has uncovered a [variety of bugs](https://github.com/google/syzkaller/blob/master/docs/linux/found_bugs.md).
[AFL](https://github.com/google/AFL)** **is another popular fuzzer, used to fuzz programs written in C/C++.
There were options available for fuzzing Go programs as well in the past, one of them being [go-fuzz](https://github.com/dvyukov/go-fuzz) which Filo mentions in his GitHub comments
The track record of go-fuzz provides pretty amazing evidence that fuzzing is good at finding bugs that humans had not found. In my experience, just a few CPU minutes of fuzzing can be extremely effective at the margin
## Why add native fuzzing support in Go
If the requirement is to fuzz Go programs and existing tools like `go-fuzz`
could do it, why add native fuzzing support to the language? The [Go fuzzing design draft](https://go.googlesource.com/proposal/+/master/design/draft-fuzzing.md) provides some rationale for doing so. The idea was to bring simplicity to the process as using the above tools adds more work for the developer and has many missing features. If you are new to fuzzing, I recommend reading the design draft document.
Developers could use tools like go-fuzz or fzgo (built on top of go-fuzz) to solve some of their needs. However, each existing solution involves more work than typical Go testing and is missing crucial features. Fuzz testing shouldn't be any more complicated or less feature-complete than other types of Go testing (like benchmarking or unit testing). Existing solutions add extra overhead, such as custom command-line tools,
## Fuzz tooling
Fuzzing is a welcome addition to the Go language's long list of desired features. Although experimental for now, it's expected to become robust in upcoming releases. This gives sufficient time to try it out and explore its use cases. Rather than seeing it as an overhead, it should be seen as an effective testing tool to uncover hidden bugs if used correctly. Teams using Go should encourage its use, starting with developers writing small fuzz tests and testing teams extending it further to utilize its potential fully.
## 1 Comment |
14,368 | 如何从 Ubuntu 中彻底卸载 Google Chrome | https://itsfoss.com/uninstall-chrome-from-ubuntu/ | 2022-03-18T10:59:00 | [
"Chrome"
] | https://linux.cn/article-14368-1.html | 现在,你已经成功地 [在 Ubuntu 上安装 Google Chrome](https://itsfoss.com/install-chrome-ubuntu/)。毕竟,它是世界上最受欢迎的网页浏览器了。
但是,你可能会不喜欢 Google 的产品,因为它们对用户的信息进行追踪和数据挖掘。你决定选择 [Ubuntu 上的其他网页浏览器](https://itsfoss.com/best-browsers-ubuntu-linux/),并且它或许是一个 [非 Chromium 核心的浏览器](https://itsfoss.com/open-source-browsers-linux/)。
既然你已经不再使用 [Google Chrome](https://www.google.com/chrome/index.html) 了,那么,把它从 Ubuntu 系统中移除是一个明智的选择。
如何才能做到这一点呢?我来告诉你具体的步骤。
### 从 Ubuntu 中完全移除 Google Chrome

你可能使用了图形界面的方式安装 Google Chrome,但不幸的是,你得使用命令行的方式来移除它,除非你选择 [使用 Synaptic 软件包管理器](https://itsfoss.com/synaptic-package-manager/)。
使用命令行来做这件事也不是很难。首先,按下 [键盘上的 Ctrl+Alt+T 快捷键来打开一个终端](https://itsfoss.com/open-terminal-ubuntu/)。
在终端中输入下面的命令:
```
sudo apt purge google-chrome-stable
```
此时它会向你索要一个密码,这个密码是你的用户账户密码,也就是你用来登录 Ubuntu 系统的密码。
当你输入密码的时候,屏幕上什么也不会显示。这是 Linux 系统的正常行为。继续输入密码,完成后按下回车键。
此时它会让你确认是否删除 Google Chrome,输入 `Y` 来确认,或者直接按下回车键也行。

这个操作会从你的 Ubuntu Linux 系统中移除 Google Chrome,同时也会移除大多数相关的系统文件。
但是,你的个人设置文件仍然保留在用户主目录中。它包含了 Cookie、会话、书签和其他与你的账户相关的 Chrome 设置信息。当你下次安装 Google Chrome 时,这些文件可以被 Chrome 再次使用。

如果你想要彻底地移除 Google Chrome,你可能会想要把这些文件也移除掉。那么,下面是你需要做的:
切换到 `.config` 目录。 **注意 config 前面有个点**`,这是 [Linux 隐藏文件和目录的方式](https://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/)。
```
cd ~/.config
```
然后移除 `google-chrome` 目录:
```
rm -rf google-chrome
```

你也可以仅使用一个命令 `rm -rf ~/.config/google-chrome` 来删除它。因为本教程面向的对象是完完全全的初学者,所以我把这个命令拆分为以上两个步骤来完成,这样可以减少由于拼写问题造成的可能错误。
>
> 小技巧
>
>
> 想要你的终端和截图里看起来一样漂亮吗?试试这些 [终端定制小技巧](https://itsfoss.com/customize-linux-terminal/)。
>
>
>
我希望这篇快速的入门技巧可以帮助你在 Ubuntu 上摆脱 Google Chrome。
---
via: <https://itsfoss.com/uninstall-chrome-from-ubuntu/>
作者:[Abhishek Prakash](https://itsfoss.com/author/abhishek/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[lkxed](https://github.com/lkxed) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

So, you managed to [install Google Chrome on Ubuntu](https://itsfoss.com/install-chrome-ubuntu/). It is the most popular web browser in the world, after all.
But perhaps you dislike Google products for the heavy tracking and data mining they employ on its users. You decided to opt for [other web browsers on Ubuntu](https://itsfoss.com/best-browsers-ubuntu-linux/), perhaps a [non-Chromium browser](https://itsfoss.com/open-source-browsers-linux/).
Now that you are no longer using it, it would be wise to remove [Google Chrome](https://www.google.com/chrome/index.html?ref=itsfoss.com) from Ubuntu.
How to do that? Let me show you the steps.
## Remove Google Chrome completely from Ubuntu

You probably installed Google Chrome graphically. Unfortunately, you’ll have to resort to the command line for removing it, unless you opt to [use Synaptic Package Manager](https://itsfoss.com/synaptic-package-manager/).
It is not too difficult. Press the [Ctrl+Alt+T keyboard shortcut in Ubuntu to open a terminal](https://itsfoss.com/open-terminal-ubuntu/).
Type the following command in the terminal:
`sudo apt purge google-chrome-stable`
It asks for a password. It is your user account’s password, the one which you use to log in to your Ubuntu system.
When you type the password, nothing is displayed on the screen. This is normal behavior in Linux. Just type the password blindly and press enter.
It will ask you to confirm the removal of Google Chrome by entering Y or simply pressing the enter key.

This will remove Google Chrome from your Ubuntu Linux system along with most of the system files.
However, the personal setting files remain in your home directory. This includes cookie sessions, bookmarks and other Chrome-related settings for your user account. If you install Google Chrome again, the same files could be used by Chrome again.

## Removing Chrome related personal settings files, if you really want it (for experts only)
If you want to uninstall Google Chrome completely, you may also want to remove these files.
Here’s what you should do.
Change to the .config directory. **Mind the dot before config**. That’s the
[way to hide files and folders in Linux](https://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/).
`cd ~/.config`
And now remove the google-chrome directory:
`rm -rf google-chrome`

You could have also used rm -rf ~/.config/google-chrome to delete it in one single command. Since this tutorial is focused on absolute beginners, I made it in two steps to reduce the error margin because of a typo.
Similarly, **you could also remove the Google Chrome cache located in ~/.cache/google-chrome**.
If you are unfamiliar with the terminal, our tutorial series will help you.
[Linux Command Tutorials for Absolute BeginnersNever used Linux commands before? No worries. This tutorial series is for absolute beginners to the Linux terminal.](https://itsfoss.com/tag/terminal-basics/)

I hope this quick beginner tip helped you to get rid of Google Chrome from Ubuntu Linux. |
14,370 | Ubuntu 有了一个“怪怪的”新标志 | https://news.itsfoss.com/ubuntu-new-logo/ | 2022-03-19T11:48:35 | [
"Ubuntu"
] | https://linux.cn/article-14370-1.html |
>
> Ubuntu 已经重新设计了它的标志。不是每个人都会喜欢它。
>
>
>

Ubuntu 的标志包含了多个元素。对粉丝来说,橙色和紫色是 Ubuntu 的特征。
除此之外,Ubuntu 的标志上还写有 “ubuntu” 的字样,以及一个橙色的图案。

这个橙色的“<ruby> 朋友圈 <rt> circle of friends </rt></ruby>”图案是 Ubuntu 的身份标识,它象征着:自由、协作、精确和可靠。
这个图案实际上是三个朋友或团队成员“搭在一起”的一个俯视图。你可能在体育运动中见到过这样的画面。

### Ubuntu 有了一个全新的标志
但这个图案正在发生变化。[OMG! Ubuntu](https://www.omgubuntu.co.uk/2022/03/ubuntu-has-a-brand-new-logo) 报道说,Canonical 重新设计了标志的元素、文字和这个“朋友圈”的图案。
在旧的标志中,“朋友圈”图案在粗体 “ubuntu” 文字的右上角。
新的标志改变了这一点。“朋友圈”图案经过重新设计,看起来更平滑,而且被放置在一个橙色的矩形里。文字也有变化,现在使用了更细的字体。“Ubuntu” 中的 “U” 现在是大写的了。
有趣的是,新标志不再包含注册商标符号 “®” 了。

Ubuntu 在官方博文中提到了关于新设计的 [这些变化](https://ubuntu.com/blog/a-new-look-for-the-circle-of-friends):
>
> 虽然(在设计上)和之前的朋友圈图案保持相对延续性很重要,但是更新后的版本更精简、更专注、更成熟。现在他们的头部在圆圈里,彼此面对,连接也更加直接,这看起来更合理一些。
>
>
>
你可以在这个视频中看到新标志的动画:
这个新标志将会出现在 Ubuntu 22.04 发行版中。
### 这不是首次重新设计标志
这并不是 Ubuntu 第一次重新设计它的标志。早在 Ubuntu 项目于 2004 年初创时,“朋友圈”图案有三种颜色:黄色、红色和橙色。在 2010 年的时候,它被重新设计,“搭在一起的人” 变成了白色,他们被一个橙色的圆圈围绕着。

### 你喜欢这个新标志吗?
这次的新设计距离上一次已经过了 13 年。这个新“朋友圈”图案看起来还不错,但我还是觉得这个矩形背景有点怪怪的。
你怎么看?你喜欢 Ubuntu 的新标志吗,还是说更喜欢以前的那个呢?请在下方评论区分享你的观点吧!
---
via: <https://news.itsfoss.com/ubuntu-new-logo/>
作者:[Abhishek](https://news.itsfoss.com/author/root/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[lkxed](https://github.com/lkxed) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

There are several elements of the Ubuntu branding. For its fans, the orange and purple color symbolizes Ubuntu.
In addition to that, Ubuntu has logo that consists of a wordmark (ubuntu written in text) and a graphic symbol in orange color.

This orange ‘circle of friends’ is the identity of Ubuntu brand. It represents; freedom, collaboration, precision and reliability.
It’s actually the top view of a ‘huddle’ of three friends or team members. You may have seen such a huddle in sports.

[Unsplash](https://unsplash.com/photos/mwJVLe1u3OA?ref=news.itsfoss.com)
## Ubuntu has a brand new logo
But this is changing. As [OMG! Ubuntu](https://www.omgubuntu.co.uk/2022/03/ubuntu-has-a-brand-new-logo?ref=news.itsfoss.com) reported, Canonical has rebranded both the elements of logo, wordmark and the circle of friends.
In the old logo, the circle of friends was on the top right corner of the Ubuntu written in bold text.
The new logo changes that. The circle of friend is redesigned to make look smoother and it is placed on an orange column. The wordmark is also changed and uses a thinner font now. The U in Ubuntu is now in uppercase.
Interestingly, the small registered trademark symbol ® is no longer the part of the new logo.

Ubuntu noted [this](https://ubuntu.com/blog/a-new-look-for-the-circle-of-friends?ref=news.itsfoss.com) on the new design in the official blog post:
While it is important to have a respectful continuity with the previous Circle of Friends, the updated version is leaner, more focused, more sophisticated. It also makes a little more sense that the heads are now inside the circle, facing each other and connecting more directly.
You can see the animation of the new logo in this video:
This new design will be part of the upcoming Ubuntu 22.04 release.
## Not the first rebranding
This is not the first time Ubuntu has been rebranded. When Ubuntu project was first created in the year 2004, the circle of friend had three colors; yellow, red and orange. It was redesigned in 2010 with the huddle in white and an orange circle around it.

[OMG! Ubuntu](https://www.omgubuntu.co.uk/2022/03/ubuntu-has-a-brand-new-logo?ref=news.itsfoss.com)
## Do you like the new logo?
The redesign comes thirteen years after the last one. While the new ‘circle’ looks good, I find the background rectangle a bit weird.
How about you? Do you like the new Ubuntu logo or you still love the old one? Do share your opinion in the comment section below.
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,371 | 如何把 WordPress 网站迁移到新主机 | https://opensource.com/article/21/9/migrate-wordpress | 2022-03-19T12:43:23 | [
"WordPress",
"迁移"
] | https://linux.cn/article-14371-1.html |
>
> 使用这个简单的方法来迁移一个网站以及管理防火墙配置。
>
>
>

你有过把一个 WordPress 网站迁移到一台新主机上的需求吗?我曾经迁移过好多次,迁移过程相当简单。当然,的的市场时候我都不会用通用的推荐方法,这次也不例外 —— 我用更简单的方法,这才是我推荐的方法。
这个迁移方法没有破坏性,因此如果出于某些原因你需要还原到原来的服务器上,很容易可以实现。
### 一个 WordPress 网站的组成部分
运行一个基于 [WordPress](https://wordpress.org/) 的网站有三个重要组成部分:WordPress 本身,一个 web 服务器,如 [Apache](https://opensource.com/article/18/2/how-configure-apache-web-server)(我正在用),以及 [MariaDB](https://mariadb.org/)。MariaDB 是 MySQL 的一个分支,功能相似。
业界有大量的 Web 服务器,由于我使用了 Apache 很长时间,因此我推荐用 Apache。你可能需要把 Apache 的配置方法改成你用的 Web 服务器的方法。
### 初始配置
我使用一台 Linux 主机作为防火墙和网络路由。在我的网络中 Web 服务器是另一台主机。我的内部网络使用的是 C 类私有网络地址范围,按 <ruby> <a href="https://opensource.com/article/16/12/cidr-network-notation-configuration-linux"> 无类别域间路由 </a> <rt> Classless Internet Domain Routing </rt></ruby>(CIDR)方式简单地记作 192.168.0.0/24。
对于防火墙,相比于更复杂的 `firewalld`,我更喜欢用非常简单的 [IPTables](https://en.wikipedia.org/wiki/Iptables)。这份防火墙配置中的一行会把 80 端口(HTTP)接收到的包发送给 Web 服务器。在 `/etc/sysconfig/iptables` 文件中,你可以在注释中看到,我添加了规则,把其他入站服务器连接转发到同一台服务器上合适的端口。
```
# Reroute ports for inbound connections to the appropriate web/email/etc server.
# HTTPD goes to 192.168.0.75
-A PREROUTING -d 45.20.209.41/255.255.255.248 -p tcp -m tcp --dport 80 \
-j DNAT --to-destination 192.168.0.75:80
```
我使用<ruby> 命名虚拟主机 <rt> named virtual host </rt></ruby>来配置原来的 Apache Web 服务器,因为我在这个 HTTPD 实例上运行着多个网站。使用命名虚拟主机配置是个不错的方法,因为(像我一样)未来你可能会在运行其他的网站,这个方法可以使其变得容易。
`/etc/httpd/conf/httpd.conf` 中需要迁移的虚拟主机的网站相关部分请参考下面代码。这个片段中不涉及到 IP 地址的修改,因此在新服务器上使用时不需要修改。
```
<VirtualHost *:80>
ServerName www.website1.org
ServerAlias server.org
DocumentRoot "/var/website1/html"
ErrorLog "logs/error_log"
ServerAdmin [email protected]
<Directory "/var/website1/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
```
在迁移之前,你需要在 `httpd.conf` 的最顶端附近找到 `Listen` 声明并修改成类似下面这样。这个地址是服务器的真实私有 IP 地址,不是公开 IP 地址。
```
Listen 192.168.0.75:80
```
你需要修改新主机上 `Listen` 的 IP 地址。
### 前期工作
准备工作分为以下三步:
* 安装服务
* 配置防火墙
* 配置 web 服务器
#### 安装 Apache 和 MariaDB
如果你的新服务器上还没有 Apache 和 MariaDB,那么就安装它们。WordPress 的安装不是必要的。
```
dnf -y install httpd mariadb
```
#### 新服务器防火墙配置
确认下新服务器上的防火墙允许访问 80 端口。你\_每台\_电脑上都有一个防火墙,对吗?大部分现代发行版使用的初始化配置包含的防火墙会阻止所有进来的网络流量,以此来提高安全等级。
下面片段的第一行内容可能已经在你的 IPTables 或其他基于防火墙的网络过滤器中存在了。它标识已经被识别为来自可接受来源的入站包,并绕过后面的其它 INPUT 过滤规则,这样可以节省时间和 CPU 周期。片段中最后一行标识并放行 80 端口新进来的请求到 HTTPD 的连接。
```
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
<删节>
# HTTP
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
```
下面的示例 `/etc/sysconfig/iptables` 文件是 IPTables 最少规则的例子,可以允许 SSH(端口 22)和 HTTPD(端口 80)连接。
```
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
# SSHD
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
# HTTP
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
# Final disposition for unmatched packets
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
```
在新服务器主机上我需要做的就是在 `/etc/sysconfig/iptables` 文件的防火墙规则里添加上面片段的最后一行,然后重新加载修改后的规则集。
```
iptables-restore /etc/sysconfig/iptables
```
大部分基于红帽的发行版本,如 Fedora,使用的是 `firewalld`。我发现对于它的适用场景(如家用、小到中型企业)而言,它过于复杂,因此我不用它。我建议你参照 [firewalld 网页](https://firewalld.org/documentation/howto/open-a-port-or-service.html) 来向 `firewalld` 添加入站端口 80。
你的防火墙及其配置可能跟这个有些差异,但最终的目的是允许新 Web 服务器 80 端口接收 HTTPD 连接。
#### HTTPD 配置
在 `/etc/httpd/conf/httpd.conf` 文件中配置 HTTPD。像下面一样在 `Listen` 片段中设置 IP 地址。我的新 Web 服务器 IP 地址是 `192.168.0.125`。
```
Listen 192.168.0.125:80
```
复制(对应要迁移的网站的) `VirtualHost` 片段,粘贴到新服务器上 `httpd.conf` 文件的末尾。
### 迁移过程
只有两组数据需要迁移到新服务器 —— 数据库本身和网站目录结构。把两个目录打包成 `tar` 文档。
```
cd /var ; tar -cvf /tmp/website.tar website1/
cd /var/lib ; tar -cvf /tmp/database.tar mysql/
```
把两个 tar 文件复制到新服务器。我通常会把这类文件放到 `/tmp` 下,这个目录就是用来做这种事的。在新服务器上运行下面的命令,把 tar 文档解压到正确的目录。
```
cd /var ; tar -xvf /tmp/website.tar
cd /var/lib ; tar -xvf /tmp/database.tar
```
WordPress 的所有文件都在 `/var/website1` 下,因此不需要在新服务器上安装它。新服务器上不需要执行 WordPress 安装过程。
这个目录就是需要迁移到新服务器上的全部内容。
最后一步是启动(或重启)`mysqld` 和 `httpd` 服务守护进程。WrodPress 不是一个服务,因此不使用守护进程的方式来启动。
```
systemctl start mysqld ; systemctl start httpd
```
启动之后,你应该检查下这些服务的状态。
```
systemctl status mysqld
● mariadb.service - MariaDB 10.5 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2021-08-21 14:03:44 EDT; 4 days ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 251783 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exited, status=0/SUCCESS)
Process: 251805 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
Process: 251856 ExecStartPost=/usr/libexec/mariadb-check-upgrade (code=exited, status=0/SUCCESS)
Main PID: 251841 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 15 (limit: 19003)
Memory: 131.8M
CPU: 1min 31.793s
CGroup: /system.slice/mariadb.service
└─251841 /usr/libexec/mariadbd --basedir=/usr
Aug 21 14:03:43 simba.stmarks-ral.org systemd[1]: Starting MariaDB 10.5 database server...
Aug 21 14:03:43 simba.stmarks-ral.org mariadb-prepare-db-dir[251805]: Database MariaDB is probably initialized in /var/lib/mysql already, n>
Aug 21 14:03:43 simba.stmarks-ral.org mariadb-prepare-db-dir[251805]: If this is not the case, make sure the /var/lib/mysql is empty before>
Aug 21 14:03:44 simba.stmarks-ral.org mariadbd[251841]: 2021-08-21 14:03:44 0 [Note] /usr/libexec/mariadbd (mysqld 10.5.11-MariaDB) startin>
Aug 21 14:03:44 simba.stmarks-ral.org systemd[1]: Started MariaDB 10.5 database server.
systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
└─php-fpm.conf
Active: active (running) since Sat 2021-08-21 14:08:39 EDT; 4 days ago
Docs: man:httpd.service(8)
Main PID: 252458 (httpd)
Status: "Total requests: 10340; Idle/Busy workers 100/0;Requests/sec: 0.0294; Bytes served/sec: 616 B/sec"
Tasks: 278 (limit: 19003)
Memory: 44.7M
CPU: 2min 31.603s
CGroup: /system.slice/httpd.service
├─252458 /usr/sbin/httpd -DFOREGROUND
├─252459 /usr/sbin/httpd -DFOREGROUND
├─252460 /usr/sbin/httpd -DFOREGROUND
├─252461 /usr/sbin/httpd -DFOREGROUND
├─252462 /usr/sbin/httpd -DFOREGROUND
└─252676 /usr/sbin/httpd -DFOREGROUND
Aug 21 14:08:39 simba.stmarks-ral.org systemd[1]: Starting The Apache HTTP Server...
Aug 21 14:08:39 simba.stmarks-ral.org httpd[252458]: AH00112: Warning: DocumentRoot [/var/teststmarks-ral/html] does not exist
Aug 21 14:08:39 simba.stmarks-ral.org httpd[252458]: Server configured, listening on: port 80
Aug 21 14:08:39 simba.stmarks-ral.org systemd[1]: Started The Apache HTTP Server.
```
### 最终的修改
现在所需的服务都已经运行了,你可以把 `/etc/sysconfig/iptables` 文件中 HTTDP 的防火墙规则改成下面的样子:
```
-A PREROUTING -d 45.20.209.41/255.255.255.248 -p tcp -m tcp --dport 80 \
-j DNAT --to-destination 192.168.0.125:80
```
然后重新加载设置的 IPTables 规则。
```
iptables-restore /etc/sysconfig/iptables
```
由于防火墙规则是在防火墙主机上,因此不需要把外部 DNS 入口改成指向新服务器。如果你使用的是内部 DNS 服务器,那么你需要把 IP 地址改成内部 DNS 数据库里的 A 记录。如果你没有用内部 DNS 服务器,那么请确保主机 `/etc/hosts` 文件里新服务器地址设置得没有问题。
### 测试和清理
请确保对新配置进行测试。首先,停止旧服务器上的 `mysqld` 和 `httpd` 服务。然后通过浏览器访问网站。如果一切符合预期,那么你可以关掉旧服务器上的 `mysqld` 和 `httpd`。如果有失败,你可以把 IPTables 的路由规则改回去到旧服务器上,直到问题解决。
之后我把 MySQL 和 HTTPD 从旧服务器上删除了,这样来确保它们不会意外地被启动。
### 总结
就是这么简单。不需要执行数据库导出和导入的过程,因为 `mysql` 目录下所有需要的东西都已经复制过去了。需要执行导出/导入过程的场景是:有网站自己的数据库之外的数据库;MariaDB 实例上还有其他网站,而你不想把这些网站复制到新服务器上。
迁移旧服务器上的其他网站也很容易。其他网站依赖的所有数据库都已经随着 MariaDB 的迁移被转移到了新服务器上。你只需要把 `/var/website` 目录迁移到新服务器,添加合适的虚拟主机片段,然后重启 HTTPD。
我遵循这个过程把很多个网站从一个服务器迁移到另一个服务器,每次都没有问题。
---
via: <https://opensource.com/article/21/9/migrate-wordpress>
作者:[David Both](https://opensource.com/users/dboth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[lxbwolf](https://github.com/lxbwolf) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | Have you ever needed to migrate a WordPress website to a new host? I have done it several times and found the process to be quite easy. Of course, I don't use the recommended methods for doing most things, and this is no exception–I use the easy way, and that is what I recommend.
This migration is non-destructive, so it is simple to revert to the original server if that should be necessary for any reason.
## Components of a WordPress website
Three main components are required to run a website based on [WordPress](https://wordpress.org/): WordPress itself, a webserver such as [Apache](https://opensource.com/article/18/2/how-configure-apache-web-server) (which I use), and the [MariaDB](https://mariadb.org/). MariaDB is a fork of MySQL and is functionally equivalent.
There are plenty of webservers out there, but I prefer Apache because I have used it for so long. You may need to adapt the Apache configuration I use here to whatever webserver you are using.
## The original setup
I use one Linux host as a firewall and router for my network. The webserver is a different host inside my network. My internal network uses what used to be called a class C private network address range, but which is simply referred to as 192.168.0.0/24 in the [Classless Internet Domain Routing (CIDR)](https://opensource.com/article/16/12/cidr-network-notation-configuration-linux) methodology.
For the firewall, I use the very simple [IPTables](https://en.wikipedia.org/wiki/Iptables), which I prefer over the much more complex `firewalld`
. One line in this firewall configuration sends incoming packets on port 80 (HTTP) to the webserver. As you can see by the comments, I placed rules to forward other inbound server connections to the same server on their appropriate ports in the` /etc/sysconfig/iptables`
file.
```
# Reroute ports for inbound connections to the appropriate web/email/etc server.
# HTTPD goes to 192.168.0.75
-A PREROUTING -d 45.20.209.41/255.255.255.248 -p tcp -m tcp --dport 80 \
-j DNAT --to-destination 192.168.0.75:80
```
I set up my original Apache webserver using named virtual hosts because I served multiple websites from this one HTTPD instance. It is always a good idea to use the named virtual host configuration approach because, like me, you may decide to host additional sites later, and this process makes that easier to do.
The virtual host stanza for the website to be moved in `/etc/httpd/conf/httpd.conf`
looks like the one below. There are no IP addresses in this stanza, so it needs no changes for use on the new server.
```
<VirtualHost *:80>
ServerName www.website1.org
ServerAlias server.org
DocumentRoot "/var/website1/html"
ErrorLog "logs/error_log"
ServerAdmin [email protected]
<Directory "/var/website1/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
```
The `Listen`
directive near the top of the `httpd.conf`
file looks like this before the migration. This is the actual IP private address of the server and not the public IP address.
`Listen 192.168.0.75:80`
You need to change the `Listen`
IP address on the new host.
## Preparation
The preparation can be accomplished with three steps:
- Install the services.
- Configure the firewall.
- Configure the webserver.
### Install Apache and MariaDB
Install Apache and MariaDB if they are not already on your new server. It is not necessary to install WordPress.
`dnf -y install httpd mariadb`
### New server firewall configuration
Ensure that the firewall on the new server allows port 80. You do have a firewall on *all* of your computers, right? Most modern distributions use an initial setup that includes a firewall that blocks all incoming traffic to ensure a higher level of security.
The first line in the snippet below may already be part of your IPTables or other netfilter-based firewall. It identifies inbound packets that have already been recognized as coming from an acceptable source and bypasses additional INPUT filter rules, thus saving time and CPU cycles. The last line in the snippet identifies new incoming connections to HTTPD on port 80 and accepts them.
```
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
<snip>
# HTTP
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
```
The following sample `/etc/sysconfig/iptables`
file is an example of a minimal set of IPTables rules that allow incoming connections on SSH (port 22) and HTTPD (port 80) .
```
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
# SSHD
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
# HTTP
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
# Final disposition for unmatched packets
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
```
All I needed on my new server host was to add the last line in the snippet above to my firewall rules in the `/etc/sysconfig/iptables`
file and then reload the revised ruleset.
`iptables-restore /etc/sysconfig/iptables`
Most current Red Hat-based distributions, such as Fedora, use `firewalld`
. I don't use it because I find it far more complex than it needs to be for use cases such as home or small to medium businesses. To add inbound port 80 to `firewalld`
, I suggest you refer to the [firewalld web page](https://firewalld.org/documentation/howto/open-a-port-or-service.html).
Your firewall and its configuration details might differ from these, but the objective is to allow incoming connections to HTTPD on port 80 of the new web server.
### HTTPD configuration
Configure HTTPD in the` /etc/httpd/conf/httpd.conf`
file. Set the IP address in the Listen stanza as shown below. The IP address of my new web server is 192.168.0.125.
`Listen 192.168.0.125:80`
Copy the VirtualHost stanza for the website being moved and paste it at the end of the `httpd.conf`
file of the new server.
## The move
Only two sets of data need to be moved to the new server—the database itself and the website directory structure. Create `tar`
archives of the two directories.
```
cd /var ; tar -cvf /tmp/website.tar website1/
cd /var/lib ; tar -cvf /tmp/database.tar mysql/
```
Copy those tarballs to the new server. I usually store files like this in` /tmp`
, which is what it is for. Run the following commands on the new server to extract the files from the tar archives into the correct directories.
```
cd /var ; tar -xvf /tmp/website.tar
cd /var/lib ; tar -xvf /tmp/database.tar
```
All WordPress files are contained in the `/var/website1`
, so they do not need to be installed on the new server. The WordPress installation procedure does not need to be performed on the new server.
This directory is all that needs to be moved to the new server.
The last step before making the switch is to start (or restart) the `mysqld`
and `httpd`
service daemons. WordPress is not a service, so it is not started as a daemon.
`systemctl start mysqld ; systemctl start httpd`
You should check the status of these services after starting them.
```
systemctl status mysqld
● mariadb.service - MariaDB 10.5 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2021-08-21 14:03:44 EDT; 4 days ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 251783 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exited, status=0/SUCCESS)
Process: 251805 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
Process: 251856 ExecStartPost=/usr/libexec/mariadb-check-upgrade (code=exited, status=0/SUCCESS)
Main PID: 251841 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 15 (limit: 19003)
Memory: 131.8M
CPU: 1min 31.793s
CGroup: /system.slice/mariadb.service
└─251841 /usr/libexec/mariadbd --basedir=/usr
Aug 21 14:03:43 simba.stmarks-ral.org systemd[1]: Starting MariaDB 10.5 database server...
Aug 21 14:03:43 simba.stmarks-ral.org mariadb-prepare-db-dir[251805]: Database MariaDB is probably initialized in /var/lib/mysql already, n>
Aug 21 14:03:43 simba.stmarks-ral.org mariadb-prepare-db-dir[251805]: If this is not the case, make sure the /var/lib/mysql is empty before>
Aug 21 14:03:44 simba.stmarks-ral.org mariadbd[251841]: 2021-08-21 14:03:44 0 [Note] /usr/libexec/mariadbd (mysqld 10.5.11-MariaDB) startin>
Aug 21 14:03:44 simba.stmarks-ral.org systemd[1]: Started MariaDB 10.5 database server.
systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
└─php-fpm.conf
Active: active (running) since Sat 2021-08-21 14:08:39 EDT; 4 days ago
Docs: man:httpd.service(8)
Main PID: 252458 (httpd)
Status: "Total requests: 10340; Idle/Busy workers 100/0;Requests/sec: 0.0294; Bytes served/sec: 616 B/sec"
Tasks: 278 (limit: 19003)
Memory: 44.7M
CPU: 2min 31.603s
CGroup: /system.slice/httpd.service
├─252458 /usr/sbin/httpd -DFOREGROUND
├─252459 /usr/sbin/httpd -DFOREGROUND
├─252460 /usr/sbin/httpd -DFOREGROUND
├─252461 /usr/sbin/httpd -DFOREGROUND
├─252462 /usr/sbin/httpd -DFOREGROUND
└─252676 /usr/sbin/httpd -DFOREGROUND
Aug 21 14:08:39 simba.stmarks-ral.org systemd[1]: Starting The Apache HTTP Server...
Aug 21 14:08:39 simba.stmarks-ral.org httpd[252458]: AH00112: Warning: DocumentRoot [/var/teststmarks-ral/html] does not exist
Aug 21 14:08:39 simba.stmarks-ral.org httpd[252458]: Server configured, listening on: port 80
Aug 21 14:08:39 simba.stmarks-ral.org systemd[1]: Started The Apache HTTP Server.
```
## Making the final switch
Now that the required services are up and running, you can change the firewall rule for HTTPD to the following in the `/etc/sysconfig/iptables`
file.
```
-A PREROUTING -d 45.20.209.41/255.255.255.248 -p tcp -m tcp --dport 80 \
-j DNAT --to-destination 192.168.0.125:80
```
Then reload the IPTables rule set.
`iptables-restore /etc/sysconfig/iptables`
Because of the firewall rules in the firewall host, it is not necessary to change the external DNS entries to point to the new server. If you use an internal DNS server, you will need to make the IP address change to that A record in your internal DNS database. If you don't use an internal DNS server, be sure to set the correct address for your new server in the` /etc/hosts`
files of your host computers.
## Testing and cleanup
Be sure to test your new setup. First, turn off the `mysqld`
and `httpd`
services on the old server. Then access the website with a browser. If everything works as it should, you can disable `mysqld`
and `httpd`
on the old server. If there is a failure, you can change the IPTables routing rule back to the old server until the problem is fixed.
I then removed both MySQL and HTTPD from the old server to ensure that they cannot be started accidentally.
## Conclusion
It really is that simple. There is no need to perform export or import procedures on the database because everything necessary is copied over in the `mysql`
directory. The only reason you might want to deal with the export/import procedure is if there are databases other than those for the website or sites in the same instance of the MariaDB that you don't want copied to the new server.
Migrating the rest of the websites served by the old server is easy too. All of the databases required for the additional sites have already been moved over with MariaDB. It is only necessary to move the `/var/website`
directories to the new server, add the appropriate virtual host stanzas, and restart HTTPD.
I have used this procedure multiple times for migrating a website from one server to another, and it always works well.
## Comments are closed. |
14,372 | 2021 总结:如何为开源做出贡献 | https://opensource.com/article/22/3/contribute-open-source-2022 | 2022-03-19T14:51:56 | [
"开源"
] | /article-14372-1.html |
>
> 你准备好推进你的开源之旅了吗?这里有一些如何给开源做贡献的提示和教程。
>
>
>

在 2022 年,开源正变得越来越家喻户晓。但多年来,开源一直被称为企业 IT 领域中潦倒的弱势群体。开源已经以某种形式或方式存在了 [几十年](https://www.redhat.com/en/topics/open-source/what-is-open-source#the-history-of-open-source?intcmp=7013a000002qLH8AAM),但甚至直到 20 世纪 90 年代末,它才正式有了自己的 [名字](https://opensource.com/article/18/2/coining-term-open-source-software)。你可能一直都在使用开源技术,但却不知道。事实上,你目前正在阅读的网站(LCTT 译注:指 [opensource.com](http://opensource.com) )就是在开源的内容管理系统 [Drupal](https://opensource.com/tags/drupal) 上运行的。你的汽车、笔记本电脑、智能手表和电子游戏很可能是 [由 Linux](https://opensource.com/article/19/8/everyday-tech-runs-linux) 这个开源操作系统支持的。
红帽公司的年度《[企业开源状况](https://www.redhat.com/en/enterprise-open-source-report/2022?intcmp=7013a000002qLH8AAM)》在最近发布了,其中包含了大量的见解,对任何在开源技术领域发展的人都有帮助。首先,77% 的 IT 领导对企业开源的看法比一年前更积极,82% 的 IT 领导更可能选择对开源社区有贡献的供应商。这意味着,参与开源比以往任何时候都更重要。现在是推进你的开源之旅的时候了,无论你在哪里。这里有一些资源可以帮助你踏上这条路。
### 为什么要为开源做贡献?
* 《[是什么激励了开源软件的贡献者?](https://opensource.com/article/21/4/motivates-open-source-contributors)》新的研究发现人们贡献的原因自 21 世纪初以来已经改变。
* 《[现在为开源做贡献的 3 个理由](https://opensource.com/article/20/6/why-contribute-open-source)》现在,比以往任何时候都更加是为开源做贡献的理想时机。
* 《[为开源做贡献时的 7 个成功策略](https://opensource.com/article/22/1/open-source-contributions-career)》一位作者在为开源项目做贡献的经验帮助她在技术领域找到了她梦想的工作。
### 为开源做出你的第一次贡献
* 《[8 种非编码的方式为开源做贡献](https://opensource.com/life/16/1/8-ways-contribute-open-source-without-writing-code)》无论你是程序员新手,还是经验丰富的老手,或者根本不是工程师,在编码之外还有很多方式为开源项目做贡献。
* 《[为 Slack 的开源替代方案做贡献的 6 种方式](https://opensource.com/article/20/7/mattermost)》加入成千上万为 Mattermost 这个开源消息平台贡献代码、翻译、文档等的人。
* 《[任何人都可以为开放实践图书馆做出贡献的 7 种方式](https://opensource.com/article/21/10/open-practice-library)》为开放实践图书馆做出贡献是参与全球从业者社区的一种有趣方式,这些从业者都愿意分享他们的知识并改进他们自己的工作方式。
* 《[如果你有一份全职工作,如何为 Kubernetes 做贡献](https://opensource.com/article/19/11/how-contribute-kubernetes)》你可以在业余时间从事最大的开源项目之一的内部工作。
### 鼓励他人为开源做贡献
* 《[为什么你的开源项目需要的不仅仅是程序员](https://opensource.com/article/20/9/open-source-role-diversity)》仅仅是开发人员并不能创造出满足各种需求的长保质期的开源项目,是时候欢迎更多的角色和人才了。
* 《[开源贡献者加入的 10 个技巧](https://opensource.com/article/19/12/open-source-contributors)》让新的贡献者感到自己在社区中受到欢迎,对项目的未来至关重要,因此,在加入时投入时间和注意力是很重要的。
### 分享你对开源贡献的建议
当涉及到参与开源社区时,有无限的可能性。在这里,我们的目标是庆祝社区的不同观点和背景,其中包括你。你的独特故事激励着全球各地的人们参与到开源中来。来吧,[把你的文章想法发给我们](/article-14335-1.html)!
---
via: <https://opensource.com/article/22/3/contribute-open-source-2022>
作者:[Opensource.com](https://opensource.com/users/admin) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | HTTPSConnectionPool(host='opensource.com', port=443): Read timed out. (read timeout=10) | null |
14,374 | Epic 游戏商店现在可在 Steam Deck 上使用啦 | https://news.itsfoss.com/epic-games-steam-deck/ | 2022-03-19T23:45:08 | [
"Steam",
"Epic",
"游戏"
] | https://linux.cn/article-14374-1.html |
>
> 现在可以在 Steam Deck 上运行 Epic 游戏商店了,几乎无懈可击! 但是,它是非官方的。
>
>
>

Steam Deck 在加强对 Linux 平台的游戏支持方面做出了有力推动。
它运行在 **Steam OS 3.0**(基于 Arch)上,并具有 KDE Plasma 桌面环境。感谢 Valve,它没有锁定平台并让用户在上面进行试验。
尽管不是每个人都可以拿到它,但这是一款令人兴奋的硬件,可以挑战任天堂 Switch 掌机。
它可能还不支持所有的流行游戏(比如《命运 2》、《堡垒之夜》),但它在几个 3A 级大作和独立游戏上取得了不错的进展。你可以到官方的 [Deck 认证](https://www.steamdeck.com/en/verified) 页面查看有关支持游戏的最新信息。
现在,更令人激动的是,事实证明 Steam Deck 也可以使用 [Epic 游戏商店](https://www.epicgames.com/store/en-US/)(**非官方的**)来运行游戏。但是,怎样运行呢,让我们来一探究竟。
### 通过 Heroic 游戏启动器使用 Epic 游戏商店
是的,这就是 [去年](https://news.itsfoss.com/heroic-games-launcher/) 制作的 [Heroic 游戏启动器](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher), 并且已知它可以运行在 Linux 桌面上。
另外,(据 [GamingOnLinux](https://www.gamingonlinux.com/2022/03/heroic-games-launcher-now-works-nicely-on-steam-deck/))感谢 Liam Dawe,他和各位开发者协调,成功地在 Steam Deck 上测试运行了 Heroic 游戏启动器(及 [Heroic Bash 启动器](https://github.com/redromnon/HeroicBashLauncher))。
补充一句,**Heroic Bash 启动器** 是一个为所有已安装的 Heroic 游戏创建启动脚本(.sh 文件)的工具,它允许你直接从终端或者游戏前端/启动器启动游戏,而不必打开 Heroic。
故事的发生是这样的(根据我与 Heroic Bash 启动器开发者的简短交谈):
最初,在 Steam Deck 上实验运行 Epic 游戏商店时,Steam 控制器无法工作,因为 Epic 游戏商店是使用 Steam 客户端以一个“非 Steam 游戏”运行的。
所以,Heroic Bash 启动器的开发者,[Rishabh Moharir](https://news.itsfoss.com/author/rishabh/)(也是这里的一位作者)建议使用他的工具,按照他 [GitHub 上的维基指南](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/wiki/Adding-Games-to-Steam-on-Linux) 来试试。
Heroic Bash 启动器可以在 Linux 桌面上与 Epic 游戏商店配合使用。所以,这值得一试!
然后,幸运地,它工作了。
### 在 Steam Deck 上安装 Epic 游戏商店
首先,你需要在 Steam Deck 上使用可用的 AppImage 文件在**桌面模式**下安装 **Heroic 游戏启动器**。
完成后,你需要登录并下载你选择的游戏。
接下来,你需要下载最新的 [legendary](https://github.com/derrod/legendary/releases/) 二进制文件,并在启动器设置中将其设置为替代的 legendary 二进制文件。
你需要在启动器的游戏设置中配置并设置兼容层为 Proton 7.0。
这时,你需要下载最新的 [Heroic Bash 启动器二进制文件](https://github.com/redromnon/HeroicBashLauncher/releases/),然后运行它。
最后,你必须根据这个 [GitHub 上的官方维基指南](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/wiki/Adding-Games-to-Steam-on-Linux),把游戏添加到 Steam 中(以便在 Steam Deck 的界面中找到它)。
总之,“手工爱好者”们肯定需要花好大一会儿才能使其工作。另外,如果你仍然困惑,你可以在 [维基](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/wiki/SteamDeck---Running-Epic-Games) 上找到包含详细信息的同样的一套步骤和细节,这是 Heroic 游戏启动器团队整理的(或者参考上面的视频)。
对我来说,这听起来可行,应该不会超越大多数 Steam Deck 用户的能力。不幸的是,我无法在印度买到 Steam Deck(目前)。
至于 Steam Deck 上的 Epic 游戏商店的未来,我们只能抱以最好的期望。
你试过 Steam Deck 吗?在下面的评论区让我知道你的看法。
---
via: <https://news.itsfoss.com/epic-games-steam-deck/>
作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[zd200572](https://github.com/zd200572) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

Steam Deck is already making waves to enhance the game support for the Linux platform.
It runs on **Steam OS 3.0** (based on Arch) and features KDE Plasma. Kudos to Valve for not locking down the platform and letting users experiment with it.
While it is not available for everyone, it is an exciting piece of hardware challenging handheld Nintendo Switch.
It may not support all the popular titles yet (like Destiny 2, Fortnite), but it is making good progress with several AAA and indie titles. You can head to the official page of [Deck Verified](https://www.steamdeck.com/en/verified?ref=news.itsfoss.com) to check the latest information about supported games.
Now, to make things more exciting, it turns out that Steam Deck can also run games using the [Epic Games Store](https://www.epicgames.com/store/en-US/?ref=news.itsfoss.com) (**unofficially**). But, how? Let’s find out.
## Using the Epic Games Store with Heroic Games Launcher
Yes, it’s the same [Heroic Games launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher?ref=news.itsfoss.com) that was in the making [last year](https://news.itsfoss.com/heroic-games-launcher/), and it is already known to work on a Linux desktop.
And, thanks to Liam Dawe (via [GamingOnLinux](https://www.gamingonlinux.com/2022/03/heroic-games-launcher-now-works-nicely-on-steam-deck/?ref=news.itsfoss.com)), for successfully testing the Heroic Games Launcher (and [Heroic Bash Launcher](https://github.com/redromnon/HeroicBashLauncher?ref=news.itsfoss.com)) on Steam Deck while coordinating with the respective developers.
If you’re curious: **Heroic Bash Launcher** *is a tool that creates launch scripts (.sh files) for all installed Heroic games and allows you to launch the game directly from the terminal or game frontend/launcher without having any need to open Heroic.*
Here’s how it all went down (as per my brief chat with the developer of Heroic Bash Launcher):
Initially, with Epic Games Store experiment on Steam Deck, the Steam controller did not work, considering the Epic Games Store ran as a “Non-Steam game” using the Steam client.
So, the developer of Heroic Bash Launcher, [Rishabh Moharir](https://news.itsfoss.com/author/rishabh/) (also a fellow writer here) suggested using his tool to make it work by following his [wiki guide on GitHub](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/wiki/Adding-Games-to-Steam-on-Linux?ref=news.itsfoss.com).
The Heroic Bash Launcher works with Epic Games Store on a Linux desktop. So, it was worth a try!
And, fortunately, it worked!
## Installing Epic Games Store on Steam Deck
First, you need to install the **Heroic Games Launcher** on Steam Deck using the available AppImage file in the **Desktop mode**.
Once done, you need to log in and download the game of your choice.
Next, you need to download the latest binary files for [legendary](https://github.com/derrod/legendary/releases/?ref=news.itsfoss.com) and set it as the alternative legendary binary from the launcher’s settings.
You need to configure and set the compatibility layer to Proton 7.0 from the game settings in the launcher.
That’s when you need to download the latest [Heroic Bash Launcher binary](https://github.com/redromnon/HeroicBashLauncher/releases/?ref=news.itsfoss.com) and run it.
Finally, you have to add the game to Steam (to find it in Steam Deck’s UI) following the [official wiki guide on GitHub](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/wiki/Adding-Games-to-Steam-on-Linux?ref=news.itsfoss.com).
Overall, it sure took a while for tinkerers to make it work. And, if you are still confused, you can find the same set of steps with all the details in the [wiki](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/wiki/SteamDeck---Running-Epic-Games?ref=news.itsfoss.com) put together by the Heroic Games Launcher team (or refer to the video above).
To me, it sounds doable and should not be an overwhelming process for most Steam Deck users as of now. Unfortunately, I can’t get my hands on the Steam Deck in India (yet).
As for the future of Epic Games Store on Steam Deck, we can only hope for the best!
*Have you tried Steam Deck yet? Let me know your thoughts in the comments down below.*
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,375 | 使用 awk 统计字母频率 | https://opensource.com/article/21/4/gawk-letter-game | 2022-03-20T08:51:01 | [
"awk"
] | https://linux.cn/article-14375-1.html |
>
> 编写一个 awk 脚本来找到一组单词中出现次数最多(和最少)的单词。
>
>
>

近一段时间,我开始编写一个小游戏,在这个小游戏里,玩家使用一个个字母块来组成单词。编写这个游戏之前,我需要先知道常见英文单词中每个字母的使用频率,这样一来,我就可以找到一组更有用的字母块。字母频次统计在很多地方都有相关讨论,包括在 [维基百科](https://en.wikipedia.org/wiki/Letter_frequency) 上,但我还是想要自己来实现。
Linux 系统在 `/usr/share/dict/words` 文件中提供了一个单词列表,所以我已经有了一个现成的单词列表。然而,尽管这个 `words` 文件包含了很多我想要的单词,却也包含了一些我不想要的。我想要的单词首先不能是复合词(即不包含连接符和空格的单词),也不能是专有名词(即不包含大写字母单词)。为了得到这个结果,我可以运行 `grep` 命令来取出只由小写字母组成的行:
```
$ grep '^[a-z]*$' /usr/share/dict/words
```
这个正则表达式的作用是让 `grep` 去匹配仅包含小写字母的行。表达式中的字符 `^` 和 `$` 分别代表了这一行的开始和结束。`[a-z]` 分组仅匹配从 “a” 到 “z” 的小写字母。
下面是一个输出示例:
```
$ grep '^[a-z]*$' /usr/share/dict/words | head
a
aa
aaa
aah
aahed
aahing
aahs
aal
aalii
aaliis
```
没错,这些都是合法的单词。比如,“aahed” 是 “aah” 的过去式,表示在放松时的感叹,而 “aalii” 是一种浓密的热带灌木。
现在我只需要编写一个 `gawk` 脚本来统计出单词中各个字母出现的次数,然后打印出每个字母的相对频率。
### 字母计数
一种使用 `gawk` 来统计字母个数的方式是,遍历每行输入中的每一个字符,然后对 “a” 到 “z” 之间的每个字母进行计数。`substr` 函数会返回一个给定长度的子串,它可以只包含一个字符,也可以是更长的字符串。比如,下面的示例代码能够取到输入中的每一个字符 `c`:
```
{
len = length($0); for (i = 1; i <= len; i++) {
c = substr($0, i, 1);
}
}
```
如果使用一个全局字符串变量 `LETTERS` 来存储字母表,我就可以借助 `index` 函数来找到某个字符在字母表中的位置。我将扩展 `gawk` 代码示例,让它在输入数据中只取范围在 “a” 到 “z” 的字母:
```
BEGIN { LETTERS = "abcdefghijklmnopqrstuvwxyz" }
{
len = length($0); for (i = 1; i <= len; i++) {
c = substr($0, i, 1);
ltr = index(LETTERS, c);
}
}
```
需要注意的是,`index` 函数将返回字母在 `LETTERS` 字符串中首次出现的位置,第一个位置返回 1,如果没有找到则返回 0。如果我有一个大小为 26 的数组,我就可以利用这个数组来统计每个字母出现的次数。我将在下面的示例代码中添加这个功能,每当一个字母出现在输入中,我就让它对应的数组元素值增加 1(使用 `++`):
```
BEGIN { LETTERS = "abcdefghijklmnopqrstuvwxyz" }
{
len = length($0); for (i = 1; i <= len; i++) {
c = substr($0, i, 1);
ltr = index(LETTERS, c);
if (ltr > 0) {
++count[ltr];
}
}
}
```
### 打印相对频率
当 `gawk` 脚本统计完所有的字母后,我希望它能输出每个字母的频率。毕竟,我对输入中各个字母的个数没有兴趣,我更关心它们的 *相对频率*。
我将先统计字母 “a” 的个数,然后把它和剩余 “b” 到 “z” 字母的个数比较:
```
END {
min = count[1]; for (ltr = 2; ltr <= 26; ltr++) {
if (count[ltr] < min) {
min = count[ltr];
}
}
}
```
在循环的最后,变量 `min` 会等于最少的出现次数,我可以把它为基准,为字母的个数设定一个参照值,然后计算打印出每个字母的相对频率。比如,如果出现次数最少的字母是 “q”,那么 `min` 就会等于 “q” 的出现次数。
接下来,我会遍历每个字母,打印出它和它的相对频率。我通过把每个字母的个数都除以 `min` 的方式来计算出它的相对频率,这意味着出现次数最少的字母的相对频率是 1。如果另一个字母出现的次数恰好是最少次数的两倍,那么这个字母的相对频率就是 2。我只关心整数,所以 2.1 和 2.9 对我来说是一样的(都是 2)。
```
END {
min = count[1]; for (ltr = 2; ltr <= 26; ltr++) {
if (count[ltr] < min) {
min = count[ltr];
}
}
for (ltr = 1; ltr <= 26; ltr++) {
print substr(LETTERS, ltr, 1), int(count[ltr] / min);
}
}
```
### 最后的完整程序
现在,我已经有了一个能够统计输入中各个字母的相对频率的 `gawk` 脚本:
```
#!/usr/bin/gawk -f
# 只统计 a-z 的字符,忽略 A-Z 和其他的字符
BEGIN { LETTERS = "abcdefghijklmnopqrstuvwxyz" }
{
len = length($0); for (i = 1; i <= len; i++) {
c = substr($0, i, 1);
ltr = index(LETTERS, c);
if (ltr < 0) {
++count[ltr];
}
}
}
# 打印每个字符的相对频率
END {
min = count[1]; for (ltr = 2; ltr <= 26; ltr++) {
if (count[ltr] < min) {
min = count[ltr];
}
}
for (ltr = 1; ltr <= 26; ltr++) {
print substr(LETTERS, ltr, 1), int(count[ltr] / min);
}
}
```
我将把这段程序保存到名为 `letter-freq.awk` 的文件中,这样一来,我就可以在命令行中更方便地使用它。
如果你愿意的话,你也可以使用 `chmod +x` 命令把这个文件设为可独立执行。第一行中的 `#!/usr/bin/gawk -f` 表示 Linux 会使用 `/usr/bin/gawk` 把这个文件当作一个脚本来运行。由于 `gawk` 命令行使用 `-f` 来指定它要运行的脚本文件名,你需要在末尾加上 `-f`。如此一来,当你在 shell 中执行 `letter-freq.awk`,它会被解释为 `/usr/bin/gawk -f letter-freq.awk`。
接下来我将用几个简单的输入来测试这个脚本。比如,如果我给我的 `gawk` 脚本输入整个字母表,每个字母的相对频率都应该是 1:
```
$ echo abcdefghijklmnopqrstuvwxyz | gawk -f letter-freq.awk
a 1
b 1
c 1
d 1
e 1
f 1
g 1
h 1
i 1
j 1
k 1
l 1
m 1
n 1
o 1
p 1
q 1
r 1
s 1
t 1
u 1
v 1
w 1
x 1
y 1
z 1
```
还是使用上述例子,只不过这次我在输入中添加了一个字母 “e”,此时的输出结果中,“e” 的相对频率会是 2,而其他字母的相对频率仍然会是 1:
```
$ echo abcdeefghijklmnopqrstuvwxyz | gawk -f letter-freq.awk
a 1
b 1
c 1
d 1
e 2
f 1
g 1
h 1
i 1
j 1
k 1
l 1
m 1
n 1
o 1
p 1
q 1
r 1
s 1
t 1
u 1
v 1
w 1
x 1
y 1
z 1
```
现在我可以跨出最大的一步了!我将使用 `grep` 命令和 `/usr/share/dict/words` 文件,统计所有仅由小写字母组成的单词中,各个字母的相对使用频率:
```
$ grep '^[a-z]*$' /usr/share/dict/words | gawk -f letter-freq.awk
a 53
b 12
c 28
d 21
e 72
f 7
g 15
h 17
i 58
j 1
k 5
l 36
m 19
n 47
o 47
p 21
q 1
r 46
s 48
t 44
u 25
v 6
w 4
x 1
y 13
z 2
```
在 `/usr/share/dict/words` 文件的所有小写单词中,字母 “j”、“q” 和 “x” 出现的相对频率最低,字母 “z” 也使用得很少。不出意料,字母 “e” 是使用频率最高的。
---
via: <https://opensource.com/article/21/4/gawk-letter-game>
作者:[Jim Hall](https://opensource.com/users/jim-hall) 选题:[lujun9972](https://github.com/lujun9972) 译者:[lkxed](https://github.com/lkxed) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | I recently started writing a game where you build words using letter tiles. To create the game, I needed to know the frequency of letters across regular words in the English language, so I could present a useful set of letter tiles. Letter frequency is discussed in various places, including [on Wikipedia](https://en.wikipedia.org/wiki/Letter_frequency), but I wanted to calculate the letter frequency myself.
Linux provides a list of words in the `/usr/share/dict/words`
file, so I already have a list of likely words to use. The `words`
file contains lots of words that I want, but a few that I don't. I wanted a list of all words that weren't compound words (no hyphens or spaces) or proper nouns (no uppercase letters). To get that list, I can run the `grep`
command to pull out only the lines that consist solely of lowercase letters:
`$ grep '^[a-z]*$' /usr/share/dict/words`
This regular expression asks `grep`
to match patterns that are only lowercase letters. The characters `^`
and `$`
in the pattern represent the start and end of the line, respectively. The `[a-z]`
grouping will match only the lowercase letters **a** to **z**.
Here's a quick sample of the output:
```
$ grep '^[a-z]*$' /usr/share/dict/words | head
a
aa
aaa
aah
aahed
aahing
aahs
aal
aalii
aaliis
```
And yes, those are all valid words. For example, "aahed" is the past tense exclamation of "aah," as in relaxation. And an "aalii" is a bushy tropical shrub.
Now I just need to write a `gawk`
script to do the work of counting the letters in each word, and then print the relative frequency of each letter it finds.
## Counting letters
One way to count letters in `gawk`
is to iterate through each character in each input line and count occurrences of each letter **a** to **z**. The `substr`
function will return a substring of a given length, such as a single letter, from a larger string. For example, this code example will evaluate each character `c`
from the input:
```
{
len = length($0); for (i = 1; i <= len; i++) {
c = substr($0, i, 1);
}
}
```
If I start with a global string `LETTERS`
that contains the alphabet, I can use the `index`
function to find the location of a single letter in the alphabet. I'll expand the `gawk`
code example to evaluate only the letters **a** to **z** in the input:
```
BEGIN { LETTERS = "abcdefghijklmnopqrstuvwxyz" }
{
len = length($0); for (i = 1; i <= len; i++) {
c = substr($0, i, 1);
ltr = index(LETTERS, c);
}
}
```
Note that the index function returns the first occurrence of the letter from the `LETTERS`
string, starting with 1 at the first letter, or zero if not found. If I have an array that is 26 elements long, I can use the array to count the occurrences of each letter. I'll add this to my code example to increment (using `++`
) the count for each letter as it appears in the input:
```
BEGIN { LETTERS = "abcdefghijklmnopqrstuvwxyz" }
{
len = length($0); for (i = 1; i <= len; i++) {
c = substr($0, i, 1);
ltr = index(LETTERS, c);
if (ltr > 0) {
++count[ltr];
}
}
}
```
## Printing relative frequency
After the `gawk`
script counts all the letters, I want to print the frequency of each letter it finds. I am not interested in the total number of each letter from the input, but rather the *relative frequency* of each letter. The relative frequency scales the counts so that the letter with the fewest occurrences (such as the letter **q**) is set to 1, and other letters are relative to that.
I'll start with the count for the letter **a**, then compare that value to the counts for each of the other letters **b** to **z**:
```
END {
min = count[1]; for (ltr = 2; ltr <= 26; ltr++) {
if (count[ltr] < min) {
min = count[ltr];
}
}
}
```
At the end of that loop, the variable `min`
contains the minimum count for any letter. I can use that to provide a scale for the counts to print the relative frequency of each letter. For example, if the letter with the lowest occurrence is **q**, then `min`
will be equal to the **q** count.
Then I loop through each letter and print it with its relative frequency. I divide each count by `min`
to print the relative frequency, which means the letter with the lowest count will be printed with a relative frequency of 1. If another letter appears twice as often as the lowest count, that letter will have a relative frequency of 2. I'm only interested in integer values here, so 2.1 and 2.9 are the same as 2 for my purposes:
```
END {
min = count[1]; for (ltr = 2; ltr <= 26; ltr++) {
if (count[ltr] < min) {
min = count[ltr];
}
}
for (ltr = 1; ltr <= 26; ltr++) {
print substr(LETTERS, ltr, 1), int(count[ltr] / min);
}
}
```
## Putting it all together
Now I have a `gawk`
script that can count the relative frequency of letters in its input:
```
#!/usr/bin/gawk -f
# only count a-z, ignore A-Z and any other characters
BEGIN { LETTERS = "abcdefghijklmnopqrstuvwxyz" }
{
len = length($0); for (i = 1; i <= len; i++) {
c = substr($0, i, 1);
ltr = index(LETTERS, c);
if (ltr > 0) {
++count[ltr];
}
}
}
# print relative frequency of each letter
END {
min = count[1]; for (ltr = 2; ltr <= 26; ltr++) {
if (count[ltr] < min) {
min = count[ltr];
}
}
for (ltr = 1; ltr <= 26; ltr++) {
print substr(LETTERS, ltr, 1), int(count[ltr] / min);
}
}
```
I'll save that to a file called
so that I can use it more easily from the command line.`letter-freq.awk`
If you prefer, you can also use `chmod +x`
to make the file executable on its own. The `#!/usr/bin/gawk -f`
on the first line means Linux will run it as a script using the `/usr/bin/gawk`
program. And because the `gawk`
command line uses `-f`
to indicate which file it should use as a script, you need that hanging `-f`
so that executing `letter-freq.awk`
at the shell will be properly interpreted as running `/usr/bin/gawk -f letter-freq.awk`
instead.
I can test the script with a few simple inputs. For example, if I feed the alphabet into my `gawk`
script, each letter should have a relative frequency of 1:
```
$ echo abcdefghijklmnopqrstuvwxyz | gawk -f letter-freq.awk
a 1
b 1
c 1
d 1
e 1
f 1
g 1
h 1
i 1
j 1
k 1
l 1
m 1
n 1
o 1
p 1
q 1
r 1
s 1
t 1
u 1
v 1
w 1
x 1
y 1
z 1
```
Repeating that example but adding an extra instance of the letter **e** will print the letter **e** with a relative frequency of 2 and every other letter as 1:
```
$ echo abcdeefghijklmnopqrstuvwxyz | gawk -f letter-freq.awk
a 1
b 1
c 1
d 1
e 2
f 1
g 1
h 1
i 1
j 1
k 1
l 1
m 1
n 1
o 1
p 1
q 1
r 1
s 1
t 1
u 1
v 1
w 1
x 1
y 1
z 1
```
And now I can take the big step! I'll use the `grep`
command with the `/usr/share/dict/words`
file and identify the letter frequency for all words spelled entirely with lowercase letters:
```
$ grep '^[a-z]*$' /usr/share/dict/words | gawk -f letter-freq.awk
a 53
b 12
c 28
d 21
e 72
f 7
g 15
h 17
i 58
j 1
k 5
l 36
m 19
n 47
o 47
p 21
q 1
r 46
s 48
t 44
u 25
v 6
w 4
x 1
y 13
z 2
```
Of all the lowercase words in the `/usr/share/dict/words`
file, the letters **j**, **q**, and **x** occur least frequently. The letter **z** is also pretty rare. Not surprisingly, the letter **e** is the most frequently used.
## Comments are closed. |
14,377 | 复活的 C4C Linux 发行版 | https://news.itsfoss.com/c4c-linux-distro-revived/ | 2022-03-21T08:40:42 | [
"C4C",
"基督教"
] | https://linux.cn/article-14377-1.html |
>
> Computers4Christians 项目以定制发行版的形式进行了改革,该发行版为有基督教信仰的人提供了软件。
>
>
>

当我刚开始在这里写作时,我介绍了一个 [基督徒的 Linux 发行版](https://itsfoss.com/computers-christians-linux/),距离现在已经有 6 个年头了,让我们来速览一下这个项目在 6 年的时间里都有哪些变化吧。
### 名字变了,性质也变了
当我们第一次碰到 [Computers4Christians](https://computers4christians.org/),他们是一个基督教团体,通过安装 Linux 系统来翻新旧电脑,并把它们捐赠给当地社区。他们大约捐赠了 1000 台翻新的旧电脑。该团体基于 Lubuntu 定制了自己的 Linux 版本,名字叫 “Computers4Christians Linux Project”。
今天,Computers4Christians 已经不再捐赠翻新的旧电脑了。取而代之的是,这三个开发者正在专注于开发重命名的 [C4C Ubuntu](https://computers4christians.org/C4C.html)。
当我问他们为什么决定要继续开发这个发行版时,他们回答说:
>
> 我们希望引导那些不信奉上帝的人与耶稣·基督建立真正的联系,并借此发展一些信徒。任何人都可以,在几乎任何电脑上,下载、运行临场镜像或者安装我们的 Linux 发行版。C4C Ubuntu 用户可以通过多个版本的圣经、基督教教义、每日灵修、基督教视频和游戏等方式聆听上帝的教诲。我们祈祷每一次的下载、运行和安装 C4C Ubuntu 镜像,都能帮助用户走向基督,或是更接近上帝。“向软弱的人,我就作软弱的人,为要得软弱的人;向甚么样的人,我就作甚么样的人。无论如何总要救些人。” —— 哥林多前书 9:22(网络)
>
>
>
### C4C Ubuntu 中都有什么?
当前版本的 C4C Ubuntu 基于最新的 Ubuntu LTS(20.04.4)构建。它使用 Xfce 桌面环境代替了 GNOME 桌面环境。我问他们为什么决定基于 Ubuntu 而不是 Lubuntu。开发者 Eric Bradshaw 告诉我说,他们之所以切换到 Ubuntu,是因为 Lubuntu 的 LXQt 桌面环境有缺陷,而且它在旧电脑上表现不佳。
以下是 C4C Ubuntu 预装的内容:
* 主要的常用软件:Catfish、FileZilla、GIMP、Gnash、GnuCash、Gufw、LibreOffice、OpenJDK Java 11、Pidgin、Pinta、Synaptic、Thunderbird 和 VLC。
* 与基督教或圣经相关的软件和媒体:十二使徒问答和记忆游戏、圣经、圣经桌面版、8 个圣经知识游戏、10 个圣经经文迷宫探索游戏、Diatheke、117 个 Flash 圣经游戏、24 个有趣的圣经故事、Verse、Wide Margin、西福斯圣经指南、新信徒和门徒的阅读材料以及基督教视频。
* 圣经:有声圣经(WEB)、AKJV、ASV、BBE、ERV、KJV、NHEB 和 WEB。注释:MHC、NETnotesfree、Personal 和 TFG。每日灵修:DBD 和 SME。词典:MLStrong、Robinson、StrongsGreek 和 StrongsHebrew。通用书籍:MollColossions 和 Pilgram。地图:ABSMaps、eBibleTeacherMaps、EpiphanyMaps、HistMidEast、KretzmannMaps、NETMaps、SmithBibleAtlas 和 SonLightFreeMaps。
* 我们的背景图片包括 150 张不同的“<ruby> 上帝的创造 <rt> God's creation </rt></ruby>”,提供高清、标准和宽屏等尺寸大小。我们还提供快捷方式或启动器,你可以在“基督教”子菜单中找到它们,点击即可直达 37 个在线的基督教视频集、音乐视频集和 YouTube 频道。
* 预装的 Firefox 上有数百个手工挑选和分类的书签,不管你是要学习 Linux 还是要了解上帝,你都可以找到相关书签。有一个叫 “FoxFilter” 的家长控制扩展可以帮助过滤掉网页上不适当的内容,用户如果觉得有用,可以订阅它。
* C4C Ubuntu 团队引入了 [GNU Gnash 的 snap 包](https://snapcraft.io/gnash-raymii),它是一个 Flash 播放器。有了它,用户就可以玩预装的 Flash 圣经游戏了。
如果你想要尝试 C4C Ubuntu,你可以在 [这里](https://computers4christians.org/Download.html) 找到下载链接。这个网站有很多关于他们的历史版本信息。同时,开发团队也在不断更新这个网站。
---
via: <https://news.itsfoss.com/c4c-linux-distro-revived/>
作者:[John Paul](https://news.itsfoss.com/author/john/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[lkxed](https://github.com/lkxed) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | 

When I started writing for It’s FOSS, I covered a [Christian Linux distro](https://itsfoss.com/computers-christians-linux/?ref=news.itsfoss.com). It’s been six years since I did so. Let’s take a quick look and see what has changed for the project in that amount of time.
## Changing Names and Priorities
When we first encountered [Computers4Christians](https://computers4christians.org/?ref=news.itsfoss.com), they were a Christian group that refurbished old computers by adding Linux and donated them to their local community. They gave away over 1,000 systems. The group created their own version of Linux, based on Lubuntu, named the Computers4Christians Linux Project.
Today, Computers4Christians no longer gives away refurbished computers. Instead, the three developers are focusing on developing the renamed [C4C Ubuntu](https://computers4christians.org/C4C.html?ref=news.itsfoss.com).
When I asked Computers4Christians why they decided to continue the distro, they said:
We seek to lead unbelievers to an authentic relationship with Jesus Christ and to nurture believers in discipleship. Anyone may download, run live and / or install our Christian Linux distribution on most any computer. The C4C Ubuntu user is exposed to God’s Word with several Bible versions, Christian teachings, daily devotionals, Christian videos, games, etc. We pray each C4C Ubuntu ISO downloaded, run live and/or installed will help bring the user(s) to Christ, or closer to God. To the weak I became as weak, that I might gain the weak. I have become all things to all men, that I may by all means save some. 1 Corinthians 9:22 (WEB)
## What Comes with C4C Ubuntu?
The current version of C4C Ubuntu is based on the latest Ubuntu LTS (20.04.4). They have the Xfce desktop environment installed instead of GNOME. I asked why they decided to use Ubuntu instead of Lubuntu as the base. Developer Eric Bradshaw told me that they switched because Lubuntu’s LXQt desktop environment was buggy and did not run well on older systems.
The following software comes pre-installed:
- Major Secular Software Catfish, FileZilla, GIMP, Gnash, GnuCash, Gufw, LibreOffice, OpenJDK Java 11, Pidgin, Pinta, Synaptic, Thunderbird and VLC.
- Christian/Biblical Software/Media: 12 Apostles Quiz and Memory Game, Bible, Bible Desktop, 8 Bible Knowledge Games, 10 Bible Verse Maze Quest Games, Diatheke, 117 Flash Bible Games, 24 items in Fun Bible Stuff, Verse, Wide Margin, Xiphos Bible Guide, new believer and discipleship material and Christian Videos.
- Bibles: Audio Bible (WEB), AKJV, ASV, BBE, ERV, KJV, NHEB, WEB. Commentaries: MHC, NETnotesfree, Personal, TFG. Daily Devotionals: DBD, SME. Dictionaries: MLStrong, Robinson, StrongsGreek, StrongsHebrew. General Books: MollColossions, Pilgram. Maps: ABSMaps, eBibleTeacherMaps, EpiphanyMaps, HistMidEast, KretzmannMaps, NETMaps, SmithBibleAtlas, SonLightFreeMaps.
- 150 different photographs of God’s creation comprise our collection of backdrops in HD, Standard and Widescreen aspect ratios. We also feature shortcuts/launchers from the Christian sub-menu to 37 online Christian video collections, music video collections and YouTube channels.
- Firefox is packed with hundreds of hand-picked and categorized bookmarks; from learning about Linux to learning about the Lord – it’s in there. And the parental control extension FoxFilter helps filter out inappropriate content on the web – users can subscribe if they find it useful.
- The C4C Ubuntu team included a
[snap of GNU Gnash](https://snapcraft.io/gnash-raymii?ref=news.itsfoss.com)flash player so that users can play the included Flash Bible games.
If you are interested in checking out C4C Ubuntu, you can find download links [here](https://computers4christians.org/Download.html?ref=news.itsfoss.com). The website has a lot of information about the previous version of their distro. The dev team is working to update the site.
## More from It's FOSS...
- Support us by opting for
[It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our
[community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our
[weekly Newsletter](https://itsfoss.com/newsletter/). |
14,378 | 在 Groovy 和 Java 中创建并初始化映射的不同 | https://opensource.com/article/22/3/maps-groovy-vs-java | 2022-03-21T09:25:38 | [
"Groovy",
"映射"
] | https://linux.cn/article-14378-1.html |
>
> Java 和 Groovy 中的<ruby> 映射 <rt> map </rt></ruby>都是非常通用的,它允许<ruby> 关键字 <rt> key </rt></ruby>和<ruby> 值 <rt> value </rt></ruby>为任意类型,只要继承了 `Object` 类即可。
>
>
>

我最近在探索 Java 与 Groovy 在 [创建并初始化<ruby> 列表 <rt> List </rt></ruby>](https://opensource.com/article/22/1/creating-lists-groovy-java) 和 [在运行时构建<ruby> 列表 <rt> List </rt></ruby>](https://opensource.com/article/22/2/accumulating-lists-groovy-vs-java) 方面的一些差异。我观察到,就实现这些功能而言,Groovy 的简洁和 Java 的繁复形成了鲜明对比。
在这篇文章中,我将实现在 Java 和 Groovy 中创建并初始化<ruby> 映射 <rt> Map </rt></ruby>。映射为开发支持根据 <ruby> 关键字 <rt> key </rt></ruby> 检索的结构提供了可能,如果找到了这样一个关键字,它就会返回对应的 <ruby> 值 <rt> value </rt></ruby>。今天,很多编程语言都实现了映射,其中包括 Java 和 Groovy,也包括了 Python(它将映射称为 <ruby> 字典 <rt> dict </rt></ruby>)、Perl、awk 以及许多其他语言。另一个经常被用来描述映射的术语是 <ruby> 关联数组 <rt> associative array </rt></ruby>,你可以在 [这篇维基百科文章](https://en.wikipedia.org/wiki/Associative_array) 中了解更多。Java 和 Groovy 中的映射都是非常通用的,它允许关键字和值为任意类型,只要继承了 `Object` 类即可。
### 安装 Java 和 Groovy
Groovy 基于 Java,因此你需要先安装 Java。你的 Linux 发行版的仓库中可能有最近的比较好的 Java 和 Groovy 版本。或者,你也可以在根据上面链接中的指示来安装 Groovy。对于 Linux 用户来说,[SDKMan](https://sdkman.io/) 是一个不错的代替选项,你可以使用它来获取多个 Java 和 Groovy 版本,以及许多其他的相关工具。在这篇文章中,我使用的 SDK 发行版是:
* Java: version 11.0.12-open of OpenJDK 11;
* Groovy: version 3.0.8.
### 言归正传
Java 提供了非常多的方式来实例化和初始化映射,并且从 Java 9 之后,添加了一些新的方式。其中最明显的方式就是使用 `java.util.Map.of()` 这个静态方法,下面介绍如何使用它:
```
var m1 = Map.of(
"AF", "Afghanistan",
"AX", "Åland Islands",
"AL", "Albania",
"DZ", "Algeria",
"AS", "American Samoa",
"AD", "Andorra",
"AO", "Angola",
"AI", "Anguilla",
"AQ", "Antarctica");
System.out.println("m1 = " + m1);
System.out.println("m1 is an instance of " + m1.getClass());
```
事实证明,在此种情况下,`Map.of()` 有两个重要的限制。其一,这样创建出来的映射实例是<ruby> 不可变的 <rt> immutable </rt></ruby>。其二,你最多只能提供 20 个参数,用来表示 10 个<ruby> 键值对 <rt> key-value pair </rt></ruby>。
你可以尝试着添加第 10 对和第 11 对,比方说 "AG", "Antigua and Barbuda" 和 "AR", "Argentina",然后观察会发生什么。你将发现 Java 编译器尝试寻找一个支持 11 个键值对的 `Map.of()` 方法而遭遇失败。
快速查看 [java.util.Map 类的文档](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html),你就会找到上述第二个限制的原因,以及解决这个难题的一种方式:
```
var m2 = Map.ofEntries(
Map.entry("AF", "Afghanistan"),
Map.entry("AX", "Åland Islands"),
Map.entry("AL", "Albania"),
Map.entry("DZ", "Algeria"),
Map.entry("AS", "American Samoa"),
Map.entry("AD", "Andorra"),
Map.entry("AO", "Angola"),
Map.entry("AI", "Anguilla"),
Map.entry("AQ", "Antarctica"),
Map.entry("AG", "Antigua and Barbuda"),
Map.entry("AR", "Argentina"),
Map.entry("AM", "Armenia"),
Map.entry("AW", "Aruba"),
Map.entry("AU", "Australia"),
Map.entry("AT", "Austria"),
Map.entry("AZ", "Azerbaijan"),
Map.entry("BS", "Bahamas"),
Map.entry("BH", "Bahrain"),
Map.entry("BD", "Bangladesh"),
Map.entry("BB", "Barbados")
);
System.out.println("m2 = " + m2);
System.out.println("m2 is an instance of " + m2.getClass());
```
这就是一个比较好的解决方式,前提是我不在随后的代码里改变使用 `Map.ofEntries()` 创建并初始化的映射内容。注意,我在上面使用了 `Map.ofEntries()` 来代替 `Map.of()`。
然而,假设我想要创建并初始化一个非空的映射,随后往这个映射中添加数据,我需要这样做:
```
var m3 = new HashMap<String,String>(Map.ofEntries(
Map.entry("AF", "Afghanistan"),
Map.entry("AX", "Åland Islands"),
Map.entry("AL", "Albania"),
Map.entry("DZ", "Algeria"),
Map.entry("AS", "American Samoa"),
Map.entry("AD", "Andorra"),
Map.entry("AO", "Angola"),
Map.entry("AI", "Anguilla"),
Map.entry("AQ", "Antarctica"),
Map.entry("AG", "Antigua and Barbuda"),
Map.entry("AR", "Argentina"),
Map.entry("AM", "Armenia"),
Map.entry("AW", "Aruba"),
Map.entry("AU", "Australia"),
Map.entry("AT", "Austria"),
Map.entry("AZ", "Azerbaijan"),
Map.entry("BS", "Bahamas"),
Map.entry("BH", "Bahrain"),
Map.entry("BD", "Bangladesh"),
Map.entry("BB", "Barbados")
));
System.out.println("m3 = " + m3);
System.out.println("m3 is an instance of " + m3.getClass());
m3.put("BY", "Belarus");
System.out.println("BY: " + m3.get("BY"));
```
这里,我把使用 `Map.ofEntries()` 创建出来的不可变映射作为 `HashMap` 的一个构造参数,以此创建了该映射的一个<ruby> 可变副本 <rt> mutable copy </rt></ruby>,之后我就可以修改它 —— 比如使用 `put()` 方法。
让我们来看看上述过程如何用 Groovy 来实现:
```
def m1 = [
"AF": "Afghanistan",
"AX": "Åland Islands",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
"AG": "Antigua and Barbuda",
"AR": "Argentina",
"AM": "Armenia",
"AW": "Aruba",
"AU": "Australia",
"AT": "Austria",
"AZ": "Azerbaijan",
"BS": "Bahamas",
"BH": "Bahrain",
"BD": "Bangladesh",
"BB": "Barbados"]
println "m1 = $m1"
println "m1 is an instance of ${m1.getClass()}"
m1["BY"] = "Belarus"
println "m1 = $m1"
```
只看一眼,你就会发现 Groovy 使用了 `def` 关键字而不是 `var` —— 尽管在<ruby> 最近模型 <rt> late-model </rt> <ruby> 的 Groovy(version 3+)中,使用 <code> var </code> 关键字也是可行的。 </ruby></ruby>
你还会发现,你是通过在括号里添加了一个键值对列表来创建一个映射的。不仅如此,这样创建的列表对象还非常有用,这里有几个原因。其一,它是可变的;其二,它是一个 `LinkedHashMap` 的实例,内部维持了数据的插入顺序。所以,当你运行 Java 版本的代码并打印出变量 `m3`,你会看到:
```
m3 = {BB=Barbados, BD=Bangladesh, AD=Andorra, AF=Afghanistan, AG=Antigua and Barbuda, BH=Bahrain, AI=Anguilla, AL=Albania, AM=Armenia, AO=Angola, AQ=Antarctica, BS=Bahamas, AR=Argentina, AS=American Samoa, AT=Austria, AU=Australia, DZ=Algeria, AW=Aruba, AX=Åland Islands, AZ=Azerbaijan}
```
而当你运行 Groovy 版本的代码,你会看到:
```
m1 = [AF:Afghanistan, AX:Åland Islands, AL:Albania, DZ:Algeria, AS:American Samoa, AD:Andorra, AO:Angola, AI:Anguilla, AQ:Antarctica, AG:Antigua and Barbuda, AR:Argentina, AM:Armenia, AW:Aruba, AU:Australia, AT:Austria, AZ:Azerbaijan, BS:Bahamas, BH:Bahrain, BD:Bangladesh, BB:Barbados]
```
再一次,你将看到 Groovy 是如何简化事情的。这样的语法非常直观,有点像 Python 里的字典,并且,即使你有一个超过 10 个键值对的初始列表,你也不需要去记住各种必要的别扭方式。注意我们使用的表达式:
```
m1[“BY”] = “Belarus”
```
而在 Java 中,你需要这样做:
```
m1.put(“BY”, “Belarus”)
```
还有,这个映射默认是可变的,这么做的利弊很难评判,还是得取决于你的需求是什么。我个人觉得,Java 在这种情况下的 “默认不可变” 机制,最让我困扰的地方是,它没有一个类似于 `Map.mutableOfMutableEntries()` 的方法。这迫使一些刚学会如何声明和初始化一个映射的程序员,不得不转念去思考该如何把他们手中不可变的映射,转换为可变的。同时我也想问,创建一个不可变的对象然后再舍弃它,这样真的好吗?
另一个值得考虑的事情是,Groovy 使用方括号代替 Java 中的 `put()` 和 `get()` 方法来进行关键字查找。因此你可以这样写:
```
m1[“ZZ”] = m1[“BY”]
```
而不需要这样写:
```
m1.put(“ZZ”,m1.get(“BY”))
```
有时候,就像使用某个类的实例变量一样来使用映射中的关键字和值是一个好办法。设想你现在有一堆想要设置的属性,在 Groovy 中,它们看起来就像下面这样:
```
def properties = [
verbose: true,
debug: false,
logging: false]
```
然后,你可以改变其中的某个属性,就像下面这样:
```
properties.verbose = false
```
之所以这样能工作,是因为,只要关键字符合特定的规则,你就可以省略引号,然后直接用点操作符来代替方括号。尽管这个功能非常有用,也非常好用,它也同时也意味着,如果你要把一个变量作为一个映射的关键字来使用,你就必须把这个变量包裹在圆括号里,就像下面这样:
```
def myMap = [(k1): v1, (k2): v2]
```
是时候告诉勤奋的读者 Groovy 是一门为编写脚本而量身定制的语言了。映射通常是脚本中的关键元素,它为脚本提供了<ruby> 查找表 <rt> lookup table </rt></ruby>,并且通常起到了作为内存数据库的作用。我在这里使用的例子是 ISO 3166 规定的两个字母的国家代码和国家名称。对在世界上各个国家的互联网使用者来说,这些代码是很熟悉的。此外,假设我们要编写一个从日志文件中查找互联网主机名,并借此来了解用户的地理位置分布的脚本工具,那么这些代码会是十分有用的部分。
### Groovy 相关资源
[Apache Groovy 网站](https://groovy-lang.org/) 上有非常多的文档。另一个很棒的 Groovy 资源是 [Mr. Haki](https://blog.mrhaki.com/)。[Baeldung 网站](https://www.baeldung.com/) 提供了大量 Java 和 Groovy 的有用教程。学习 Groovy 还有一个很棒的原因,那就是可以接着学习 [Grails](https://grails.org/),后者是一个优秀的、高效率的全栈 Web 框架。它基于许多优秀组件构建而成,比如有 Hibernate、Spring Boot 和 Micronaut 等。
---
via: <https://opensource.com/article/22/3/maps-groovy-vs-java>
作者:[Chris Hermansen](https://opensource.com/users/clhermansen) 选题:[lujun9972](https://github.com/lujun9972) 译者:[lkxed](https://github.com/lkxed) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | I’ve recently explored some of the differences between Java and Groovy when [creating and initializing lists](https://opensource.com/article/22/1/creating-lists-groovy-java) and [building lists at runtime](https://opensource.com/article/22/2/accumulating-lists-groovy-vs-java). I observed the simple facilities provided by Groovy for these purposes in comparison to the complexity required in Java.
In this article, I examine creating and initializing maps in Java and Groovy. Maps provide the ability to develop structures you can search by *key*. And if the key gets found, that returns the *value* associated with that key. Today, maps are implemented in many programming languages, including Java and Groovy, but also Python (where they are called dictionaries), Perl, awk, and many others. Another term commonly used to describe maps is *associative arrays*, which you can read about in [this Wikipedia article](https://en.wikipedia.org/wiki/Associative_array). Java and Groovy maps are nicely general, permitting keys and values to be any classes that extend the `Object`
class.
## Install Java and Groovy
Groovy is based on Java and requires a Java installation as well. Both a recent and decent version of Java and Groovy might be in your Linux distribution’s repositories. Or, you can install Groovy following the instructions on the link mentioned above. A nice alternative for Linux users is [SDKMan](https://sdkman.io/), which you can use to get multiple versions of Java, Groovy, and many other related tools. For this article, I’m using SDK’s releases of:
- Java: version 11.0.12-open of OpenJDK 11;
- Groovy: version 3.0.8.
## Back to the problem
Java offers a number of ways to instantiate and initialize maps, and since Java 9, several new approaches got added. The most obvious candidate is the static method `java.util.Map.of()`
which you can use as follows:
```
var m1 = Map.of(
"AF", "Afghanistan",
"AX", "Åland Islands",
"AL", "Albania",
"DZ", "Algeria",
"AS", "American Samoa",
"AD", "Andorra",
"AO", "Angola",
"AI", "Anguilla",
"AQ", "Antarctica");
System.out.println("m1 = " + m1);
System.out.println("m1 is an instance of " + m1.getClass());
```
It turns out that `Map.of()`
used in this fashion bears two important restrictions. First, the map instance you create this way is immutable. Second, this way you can supply at most 20 arguments, representing ten key-value pairs.
Try adding tenth and eleventh pairs, say "AG", "Antigua and Barbuda", and "AR", "Argentina" to see what happens. You’ll see the Java compiler looking for a version of `Map.of()`
that accepts 11 pairs and fails.
A quick look at [the documentation for java.util.Map](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html) shows the reason for this second limitation, and shows a way out of that conundrum:
```
var m2 = Map.ofEntries(
Map.entry("AF", "Afghanistan"),
Map.entry("AX", "Åland Islands"),
Map.entry("AL", "Albania"),
Map.entry("DZ", "Algeria"),
Map.entry("AS", "American Samoa"),
Map.entry("AD", "Andorra"),
Map.entry("AO", "Angola"),
Map.entry("AI", "Anguilla"),
Map.entry("AQ", "Antarctica"),
Map.entry("AG", "Antigua and Barbuda"),
Map.entry("AR", "Argentina"),
Map.entry("AM", "Armenia"),
Map.entry("AW", "Aruba"),
Map.entry("AU", "Australia"),
Map.entry("AT", "Austria"),
Map.entry("AZ", "Azerbaijan"),
Map.entry("BS", "Bahamas"),
Map.entry("BH", "Bahrain"),
Map.entry("BD", "Bangladesh"),
Map.entry("BB", "Barbados")
);
System.out.println("m2 = " + m2);
System.out.println("m2 is an instance of " + m2.getClass());
```
As long as I don’t need to subsequently change the contents of the map created and initialized with `Map.ofEntries()`
, this is a decent solution. Note above that rather than using `Map.of()`
as in the first example, I used `Map.ofEntries()`
.
However, supposing I want to create and initialize a map instance with some entries and later add to that map, I need to do something like this:
```
var m3 = new HashMap<String,String>(Map.ofEntries(
Map.entry("AF", "Afghanistan"),
Map.entry("AX", "Åland Islands"),
Map.entry("AL", "Albania"),
Map.entry("DZ", "Algeria"),
Map.entry("AS", "American Samoa"),
Map.entry("AD", "Andorra"),
Map.entry("AO", "Angola"),
Map.entry("AI", "Anguilla"),
Map.entry("AQ", "Antarctica"),
Map.entry("AG", "Antigua and Barbuda"),
Map.entry("AR", "Argentina"),
Map.entry("AM", "Armenia"),
Map.entry("AW", "Aruba"),
Map.entry("AU", "Australia"),
Map.entry("AT", "Austria"),
Map.entry("AZ", "Azerbaijan"),
Map.entry("BS", "Bahamas"),
Map.entry("BH", "Bahrain"),
Map.entry("BD", "Bangladesh"),
Map.entry("BB", "Barbados")
));
System.out.println("m3 = " + m3);
System.out.println("m3 is an instance of " + m3.getClass());
m3.put("BY", "Belarus");
System.out.println("BY: " + m3.get("BY"));
```
Here, by using the immutable map created by `Map.ofEntries()`
as an argument to the `HashMap`
constructor, I create a mutable copy of it, which I can then alter—for example, with the `put()`
method.
Take a look at the Groovy version of the above:
```
def m1 = [
"AF": "Afghanistan",
"AX": "Åland Islands",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
"AG": "Antigua and Barbuda",
"AR": "Argentina",
"AM": "Armenia",
"AW": "Aruba",
"AU": "Australia",
"AT": "Austria",
"AZ": "Azerbaijan",
"BS": "Bahamas",
"BH": "Bahrain",
"BD": "Bangladesh",
"BB": "Barbados"]
println "m1 = $m1"
println "m1 is an instance of ${m1.getClass()}"
m1["BY"] = "Belarus"
println "m1 = $m1"
```
At a glance, you see Groovy uses the `def`
keyword rather than `var`
—although in late-model Groovy (version 3+), it’s possible to use `var`
instead.
You also see that you can create a map representation by putting a list of key-value pairs between brackets. Moreover, the list instance so created is quite useful for a couple of reasons. First, it’s mutable, and second, it’s an instance of `LinkedHashMap`
**,** which preserves the order of insertion. So when you run the Java version and print the variable `m3`
, you see:
`m3 = {BB=Barbados, BD=Bangladesh, AD=Andorra, AF=Afghanistan, AG=Antigua and Barbuda, BH=Bahrain, AI=Anguilla, AL=Albania, AM=Armenia, AO=Angola, AQ=Antarctica, BS=Bahamas, AR=Argentina, AS=American Samoa, AT=Austria, AU=Australia, DZ=Algeria, AW=Aruba, AX=Åland Islands, AZ=Azerbaijan}`
When you run the Groovy version, you see:
`m1 = [AF:Afghanistan, AX:Åland Islands, AL:Albania, DZ:Algeria, AS:American Samoa, AD:Andorra, AO:Angola, AI:Anguilla, AQ:Antarctica, AG:Antigua and Barbuda, AR:Argentina, AM:Armenia, AW:Aruba, AU:Australia, AT:Austria, AZ:Azerbaijan, BS:Bahamas, BH:Bahrain, BD:Bangladesh, BB:Barbados]`
Once again, you see how Groovy simplifies the situation. The syntax is very straightforward, somewhat reminiscent of Python’s dictionaries, and no need to remember the various contortions necessary if you have an initial list longer than ten pairs. Note that we use the expression:
`m1[“BY”] = “Belarus”`
Rather than the Java:
`m1.put(“BY”, “Belarus”)`
Also, the map is by default mutable, which is arguably good or bad, depending on the needs. I think what bothers me about the “immutable default” of the Java situation is that there isn’t something like `Map.mutableOfMutableEntries()`
. This forces the programmer, who has just figured out how to declare and initialize a map, to switch gears and think about just how to convert the immutable map they have into something mutable. I also kind of wonder about the business of creating something immutable just to throw it away.
Another thing to think about is the square brackets as key lookup works to replace both `put()`
and `get()`
in Java, so you can write:
`m1[“ZZ”] = m1[“BY”]`
Instead of:
`m1.put(“ZZ”,m1.get(“BY”))`
Sometimes, it’s nice to think of keys and their values in the same way you think of fields in the instance of a class. Imagine you have a bunch of properties you want to set: In Groovy, this could look like:
```
def properties = [
verbose: true,
debug: false,
logging: false]
```
And then later you can change it as:
`properties.verbose = false`
This works because, as long as the key follows certain rules, you can omit the quotes and use the dot operator instead of square brackets. While this can be quite useful and pleasant, it also means that to use the value of a variable as a key value in a map representation, you must enclose the variable in parentheses, like:
`def myMap = [(k1): v1, (k2): v2]`
This is a good moment to remind the diligent reader that Groovy is particularly well-suited to scripting. Often, maps are a key element in scripts, providing lookup tables and generally functioning as an in-memory database. The example I’ve used here is a subset of the ISO 3166 two-character country codes and country names. The codes are familiar to anyone who accesses internet hostnames in countries around the world, which could form a useful part of a scripting utility that looks at internet hostnames in log files to learn about the geographic distribution of users.
## Groovy resources
The [Apache Groovy site](https://groovy-lang.org/) has a lot of great documentation. Another great Groovy resource is [Mr. Haki](https://blog.mrhaki.com/). The [Baeldung site](https://www.baeldung.com/) provides a lot of useful how-to in Java and Groovy. And a really great reason to learn Groovy is to go on and learn [Grails](https://grails.org/), which is a wonderfully productive full-stack web framework built on top of excellent components like Hibernate, Spring Boot, and Micronaut.
## Comments are closed. |
14,380 | 在 Fedora Linux 上使用 Homebrew 包管理器 | https://fedoramagazine.org/using-homebrew-package-manager-on-fedora-linux/ | 2022-03-21T19:36:38 | [
"Homebrew"
] | https://linux.cn/article-14380-1.html | 
### 简介
Homebrew 是一个 macOS 的包管理器,用于在 macOS 上安装 UNIX 工具。但是,它也可以在 Linux(和 Windows WSL)上使用。它是用 Ruby 编写的,并提供主机系统(macOS 或 Linux)可能不提供的软件包,因此它在操作系统包管理器之外提供了一个辅助的包管理器。此外,它只以非 root 用户身份在前缀 `/home/linuxbrew/.linuxbrew` 或 `~/.linuxbrew` 下安装软件包,不会污染系统路径。这个包管理器在 Fedora Linux 上也适用。在这篇文章中,我将尝试告诉你 Homebrew 与 Fedora Linux 包管理器 `dnf` 有什么不同,为什么你可能想在 Fedora Linux 上安装和使用它,以及如何安装。
>
> 免责声明
>
>
> 你应该经常检查你在系统上安装的软件包和二进制文件。Homebrew 包通常以非 sudoer 用户运行,并工作在专门的前缀的路径下,因此它们不太可能造成破坏或错误配置。然而,所有的安装操作都要自己承担风险。作者和 Fedora 社区不对任何可能直接或间接因遵循这篇文章而造成的损失负责。
>
>
>
### Homebrew 如何工作
Homebrew 在底层使用 Ruby 和 Git。它使用特殊的 Ruby 脚本从源代码构建软件,这些脚本被称为 “<ruby> 配方 <rt> formula </rt></ruby>”,看起来像这样(使用 `wget` 包作为例子):
(LCTT 译注:Homebrew 本身意思是“家酿”,在这个软件中,有各种类似于酿酒的比喻。)
```
class Wget < Formula
homepage "https://www.gnu.org/software/wget/"
url "https://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz"
sha256 "52126be8cf1bddd7536886e74c053ad7d0ed2aa89b4b630f76785bac21695fcd"
def install
system "./configure", "--prefix=#{prefix}"
system "make", "install"
end
end
```
### Homebrew 与 dnf 有何不同
Homebrew 是一个包管理器,提供了许多 UNIX 软件工具和包的最新版本,例如 FFmpeg、Composer、Minikube 等。当你想安装一些由于某种原因在 Fedora Linux RPM 仓库中没有的软件包时,它就会证明很有用。所以,它并不能取代 `dnf`。
### 安装 Homebrew
在开始安装 Homebrew 之前,确保你已经安装了 glibc 和 gcc。这些工具可以在 Fedora 上通过以下方式安装:
```
sudo dnf groupinstall "Development Tools"
```
然后,通过在终端运行以下命令来安装 Homebrew:
```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
在安装过程中,你会被提示输入你的 `sudo` 密码。另外,你可以选择 Homebrew 的安装前缀,但默认的前缀就可以了。在安装过程中,你将成为 Homebrew 前缀目录的所有者,这样你就不必输入 `sudo` 密码来安装软件包。安装将需要数分钟。完成后,运行以下命令,将 `brew` 添加到你的 `PATH` 中:
```
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bash_profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
```
### 安装和检查软件包
要在 Homebrew 上使用“配方”安装一个软件包,只需运行:
```
brew install <formula>
```
将 `<formula>` 替换为你要安装的“配方”的名称。例如,要安装 Minikube,只需运行:
```
brew install minikube
```
你也可以用以下方式搜索“配方”:
```
brew search <formula>
```
要获得一个“配方”的信息,请运行:
```
brew info <formula>
```
另外,你可以用以下命令查看所有已安装的“配方”:
```
brew list
```
### 卸载软件包
要从你的 Homebrew 前缀中卸载一个软件包,请运行:
```
brew uninstall <formula>
```
### 升级软件包
要升级一个用 Homebrew 安装的特定软件包,请运行:
```
brew upgrade <formula>
```
要更新 Homebrew 和所有已安装的“配方”到最新版本,请运行:
```
brew update
```
### 总结
Homebrew 是一个简单的包管理器,可以与 `dnf` 一起成为有用的工具(两者完全没有关系)。尽量坚持使用 Fedora 原生的 `dnf` 包管理器,以避免软件冲突。然而,如果你在 Fedora Linux 软件库中没有找到某个软件,那么你也许可以用 Homebrew 找到并安装它。请看 [“配方”列表](https://formulae.brew.sh/formula/) 以了解有哪些可用的软件。另外,Fedora Linux 上的 Homebrew 还不支持图形化应用(在 Homebrew 术语中称为“<ruby> 酒桶 <rt> cask </rt></ruby>”)。至少,我在安装 GUI 应用时没有成功过。
### 参考资料和进一步阅读
要了解更多关于 Homebrew 的信息,请查看以下资源:
* Homebrew 主页:<https://brew.sh>
* Homebrew 文档:<https://docs.brew.sh>
* 维基百科 Homebrew 页面:<https://en.wikipedia.org/wiki/Homebrew_(package_manager)>
---
via: <https://fedoramagazine.org/using-homebrew-package-manager-on-fedora-linux/>
作者:[Mehdi Haghgoo](https://fedoramagazine.org/author/powergame/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | ## Introduction
Homebrew is a package manager for macOS to install UNIX tools on macOS. But, it can be used on Linux (and Windows WSL) as well. It is written in Ruby and provides software packages that might not be provided by the host system (macOS or Linux), so it offers an auxiliary package manager besides the OS package manager. In addition, it installs packages only to its prefix (either /home/linuxbrew/.linuxbrew or ~/.linuxbrew) as a non-root user, without polluting system paths. This package manager works on Fedora Linux too. In this article, I will try to show you how Homebrew is different from Fedora Linux package manager *dnf* , why you might want to install and use it on Fedora Linux, and how.
#### Warning
You should always inspect the packages and binaries you are installing on your system. Homebrew packages usually run as a non-sudoer user and to a dedicated prefix so they are quite unlikely to cause harm or misconfigurations. However, do all the installations at your own risk. The author and the Fedora community are not responsible for any damages that might result directly or indirectly from following this article.
## How Homebrew Works
Homebrew uses Ruby and Git behind the scenes. It builds software from source using special Ruby scripts called formulae which look like this (Using wget package as an example):
class Wget < Formula homepage "https://www.gnu.org/software/wget/" url "https://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz" sha256 "52126be8cf1bddd7536886e74c053ad7d0ed2aa89b4b630f76785bac21695fcd" def install system "./configure", "--prefix=#{prefix}" system "make", "install" end end
## How Homebrew is Different from *dnf*
Homebrew is a package manager that provides up-to-date versions of many UNIX software tools and packages e.g. ffmpeg, composer, minikube, etc. It proves useful when you want to install some packages that are not available in Fedora Linux *rpm* repositories for some reason. So, it does not replace *dnf*.
## Install Homebrew
Before starting to install Homebrew, make sure you have glibc and gcc installed. These tools can be installed on Fedora with:
sudo dnf groupinstall "Development Tools"
Then, install Homebrew by running the following command in a terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
During the installation you will be prompted for your sudo password. Also, you will have the option to choose the installation prefix for Homebrew, but the default prefix is fine. During the install, you will be made the owner of the Homebrew prefix, so that you will not have to enter the sudo password to install packages. The installation will take several minutes. Once finished, run the following commands to add brew to your PATH:
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bash_profile eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
## Install and Investigate Packages
To install a package using a formula on Homebrew, simply run:
brew install <formula>
Replace <formula> with the name of the formula you want to install. For example, to install Minikube, simply run:
brew install minikube
You can also search for formulae with:
brew search <formula>
To get information about a formula, run:
brew info <formula>
Also, you can see all the installed formulae with the following command:
brew list
## Uninstall Packages
To uninstall a package from your Homebrew prefix, run:
brew uninstall <formula>
## Upgrade Packages
To upgrade a specific package installed with Homebrew, run:
brew upgrade <formula>
To update Homebrew and all the installed Formulae to the latest versions, run:
brew update
## Wrap Up
Homebrew is a simple package manager that can be a helpful tool alongside *dnf* (The two are not related at all). Try to stick with the native *dnf* package manager for Fedora to avoid software conflicts. However, if you don’t find a piece of software in the Fedora Linux repositories, then you might be able to find and install it with Homebrew. See the [Formulae list ](https://formulae.brew.sh/formula/)for what is available. Also, Homebrew on Fedora Linux does not support graphical applications (called casks in Homebrew terminology) yet. At least, I didn’t have any luck installing any GUI apps.
## References and Further Reading
To learn more about Homebrew, check out the following resources:
- Homebrew Homepage:
[https://brew.sh](https://brew.sh) - Homebrew Docs:
[https://docs.brew.sh](https://docs.brew.sh) - Wikipedia Homebrew Page:
[https://en.wikipedia.org/wiki/Homebrew_(package_manager)](https://en.wikipedia.org/wiki/Homebrew_(package_manager))
## Hank
I’m running homebrew for the last few months and quite happy, I use it for kubectl, terraform, helm, kubie, chezmoi, etc. stuff that needs to be fresh and I’d need 3rd party RPM repos.
## Mehdi Haghgoo
That’s good to hear!
## soul-catcher
That should be perfect for Fedora Silverblue.
## Muhammed Yasin Özsaraç
Also for Kinote 🙂
## Frederik
snap, flatpak, homebrew. Is this the new UNIX wars? Do any of them actually solve the problem better than rpm or deb? Homebrew is a must on macOS, but it seems to be completely useless on modern operating systems.
## Carlos
rpm and deb packages are good for a lot of things, but aren’t ideal for everything. For example, they can be slower to update when packaged by your distribution, and third-party repositories open up security risks since these package types are always given sudo permissions.
Snaps and Flatpaks allow for apps to have scoped permissions, which is something we’re severely lacking in Linux, as well as a faster source for new application updates. This can be essential for things like browsers when a new 0 day is discovered.
In regards to Homebrew, having a package manager that’s not dependent on your distribution means you can have all your packages share the same version and availability between different distributions. The same applies to Snap and Flatpak, but I tend to associate those more with graphical apps.
Overall, we have different package managers to solve different needs and it’s important we change the default behavior of installing all our packages with sudo permissions. It can contribute to critical security issues and system instability.
## laolux
Flatpaks have the possibility to issue quick updates if well maintained, but the same goes for rpm and deb packages. The issue with flatpaks are developers who update their flatpak whenever they have a new version, but don’t update it every time that a library used by their app is updated. So the flatpak might stay with an old library with known security vulnerabilities for an extended amount of time. In a regular rpm package this library would likely have been independently updated by the system and the app would either be secure or break because of incompatibilities with the new version of the library. But even if it breaks, you would not be using an insecure app.
Also, flatpaks make it very easy for developers to deliberately ship outdated libraries, just out of convenience so that they do not need to adapt their app to a changed library interface.
Having said all that, I do use flatpaks for certain apps, but I tend to trust them less then distro packages. Especially because flatpaks sometimes just serve binary blobs in their build manifests, even for open source apps (see anki on flathub for example). So rebuilding from source can be very difficult.
## Frederik
flatpak and snaps that are useful, will have the same level of access to the system as any other useful application, so I really don’t see the security argument. If something is a great idea, that idea should be applied to everything that can benefit from it — surely, granular security is a great idea (which is also why we have users and groups in UNIX, although not quite up to this task). We also had AppArmour and SELinux that tried to address some of the same problems.
If flatpak or snap provides any security benefits, its only because the operating system is broken. The proper way to deal with that, is to fix the operating system, not bolt on yet another package manager onto an already giant array of package managers. But besides, solving a security issue, is not solving package management. Your points about all these package managers not taking advantage of the operating system is really the key here — they don’t solve the problems of packaging software any better than rpm or deb. At best, its the same. Timeliness is another issue, which is entirely dependent on the resources available. If everybody adopted the same package format and the same conventions on how to package we could just use one format…
## Ricardo Bánffy
Homebrew broke my Mac quite a few times. For Macs, I always recommend MacPorts. For Linuxes, I really don’t see the point. If you need bleeding edge versions, there are distro streams for that (although Debian Sid broke my toys a couple times too). Doing things on the back of the OS’s package manager is usually a very bad idea.
## Mehdi Haghgoo
Hi Ricardo. Thanks for sharing your experience. Could you please tell us how brew broke your Mac system?
## Stephen
“rpm and deb packages are good for a lot of things, but aren’t ideal for everything. For example, they can be slower to update when packaged by your distribution, and third-party repositories open up security risks since these package types are always given sudo permissions.”
With Fedora Linux rpms in the official repo’s are put through the QA test’s that ensure a “not broken system”. Introducing a package manager that is not a part of the system potentially can lead to breakage, as well as introduce security risks.
“it’s important we change the default behavior of installing all our packages with sudo permissions”
When are you using sudo to install? Like it’s only necessary seldom, not the default.
## GroovyMan
rpm and deb are best examples for a fast and a comprehensive way to keep a system up to date. The bunch of package-managers will bring you a babylonian mess of unrecognized dependency problems no user would accept.
But if you prefer the Microsoft Windows chaos on your system, you should rely on your 3rd party package managers.
## Phoenix
I tend to agree. With the recent package manager presentations, I also wonder what the advantages are and why I want to use them over the existing methods.
While the author wrote that it does not replace “dnf”, I still question the usefulness for this one on Linux. Even on Mac back in the days I have only touched it once. Fedora, when commonly installed (e.g. Fedora Workstation), already comes with dnf as well as Flatpak. The latter typically dormant, but still available without further installation.
Considering the examples given in the article, only minikube I did not find using “dnf”. “composer” is part of the built-in repositories with the newest version. “ffmpeg”, when visiting their homepage (https://ffmpeg.org/), redirects to RPM Fusion for download, a repository which is a must-have when using your computer as multimedia platform, be it games or video/audio editing. It will therefore provide you with “ffmpeg” from the built-in package manager, dnf. ¯_(ツ)_/¯
## g
Instead of homebrew, it’s better to just use nix
## Mehdi Haghgoo
I’ve never used nix.
## Jose J Galvez
Thank you for an interesting article. The similarities between Homebrew and the AUR (Arch user repository) are striking, both utilize scripts to retrieve compile and install source packages. An issue which was only briefly touched on in the article, however which is very important is the inherent insecurity of the system. This is well known and often debated in the arch community with respect to the aur, but this needs to be emphasized with other package Management systems such as Homebrew. There’s nothing preventing malicious content from entering the aur and I would suspect Homebrew build scripts other than the diligence of users reviewing them. That said the beauty of these systems is that it allows users to install packages which are often missing or not well maintained by the systems major repositories. I would encourage users to carefully review any recipes, build scripts before installing anything from either Homebrew or the aur.
## Mehdi Haghgoo
Thank you Jose for pointing that out. Yeah, the security of Homebrew as you said mostly relies on the review process of packages that are included in brew formulae, I think most people trust these formula, but bad things can happen all the time and we need to be careful.
## Ryan
Interesting article. I have always seen homebrew as a Mac OS thing and for me I don’t see a use case for having it on Fedora despite having minikube. If I want minikube, I would go to the project page, and install the provided RPM from their releases which will (I assume) install a repo and a gpg signing key (hopefully) so that I never have to go to the page again to ensure I have the latest version. In terms of everything else mentioned (ffmpeg for example) I can get the latest version from other locations or if I really wanted to, compile from source. The only way I would even consider putting homebrew on my system was if I installed it in user space because otherwise I could see some very horrible dependency problems and package conflicts arising as a result of utilising it. Personally I am going to trust a package either direct from the project or through known community sources long before I would trust anything provided by homebrew. For everything else, there’s Flatpak and I get that some people think that the libraries shipping with the applications are a problem, but in terms of a local application that’s really not going to be a massive vector of attack when the entire application is sandboxed (usually) from the installed system, if you’re not happy with the perms on an app, I’ve heard flatseal can help. Anyway as far as it goes I can see that for some people it might be useful, but this one is a no for me.
## Mehdi Haghgoo
Thank you Ryan for your insights. Before installing Minikube on Fedora, I only used Homebrew on Mac, and I was happy with it. Then, when I decided to install Minikube on Fedora and I went to the project page, they only provided a binary through RPM without a repo, so I would have to update it manually, as suggested to me repeatedly every time I started VS Code, saying there is a newer version of Minikube available. I found the manual update a hassle, so once I realized I could actually install Homebrew on Linux too and I gave it a try, installing Minikube and a few other apps, I really found it easy to use and facilitating. From then on, it takes care of all updates for brew packages by running
.
## Fabian
Can’t we have Homebrew in the official Fedora package repository?
## Stephen
No, please don’t even …
## Fabian
Why not?
## Frederik
Because we already have dnf + rpm, which is superior to homebrew. You’re going to end up with a mess of clashing versions and low quality packages.
## George White
There are some widely used libraries (gdal, netcdf4) that have a long list of optional features. Most linux distros don’t install “full-featured” versions, but some use-cases depend on features few (if any) distros enable. In my field, several “mission critical” open-source applications bundle versions of these libraries to work around unsuitable distro packages. If you are porting one of these applications to your platform or writing software that needs to interoperate with these applications, you need libraries with the appropriate features. Build-from-source package managers that allow optional features to be enabled are a big improvement over ad-hoc builds by providing a uniform way to enable and record feature sets.
## Stephen
So, where to start? Mostly the reason is that the homebrew packager does not have any concern about or integration with Fedora Linux Workstation, and this can introduce dependency/configuration issues that would lead to problems for the user and their Fedora Linux experience is lessened as a consequence. The gut reaction is for the user to then “Blame Fedora for not allowing unproven packaging methods to succeed” when in fact the culprit is the unproven/non-integrated package tool. DNF will check and manage dependencies for your system, to help ensure there is no breakage, and dnf as shipped by Fedora Linux on Workstation is entirely integrated into how the system is configured. Even using RPM to install a package without DNF is risky since it too will not be as diligent for dependency checking and management of the system, just the package. Fedora Linux is a fast moving ever changing distro, careful consideration is given to ensuring a usable system for the user. When you introduce another packager to the mix, unless it is a direct drop in replacement for DNF, you open the door for unintended consequences.
Flatpak’s and Snap apps as well as containerized apps are of course a different thing and not subject to the same potential for system library disturbance.
Finally, I know I am going on a bit here, but every time you install/uninstall something in a non-conventional fashion (using a non approved package manager) your system deviates from the desired state WRT system libraries, due to the dependency chain being ignored for the system, even if it gets the intended software going in the short term.
## laolux
“You should always inspect the packages and binaries you are installing on your system.”
I think this is a very good warning. However, the installation method downloads a script and directly executes it without saving it somewhere first for inspection. If someone manages to replace that script on github, substantial damage could be caused.
One might argue that this is not a big deal, because the script is not run as sudo. But keep in mind that when the script is run on your personal device, it can simply upload ~/.firefox with all your session cookies, ~/Pictures with all your (private) pictures, ~/Documents with your personal documents and everything else in $HOME. Given that the script is executed without any check, a potential attacker does not even need to think about obfuscating the intentions in the script.
To make the attack persistent (for the user), the attacker can simply create a systemd –user unit and have it executed upon every boot/login.
So please, don’t execute random scripts from the internet without having at least quickly looked at the script before. Github accounts/repositories have been and will be compromised.
## Matthew Phillips
Nothing wrong with choice. Seems like a great tool if you want fresh software, so why not. Some of the arguments against seem a bit contrived, but what’s great is if you don’t like it you don’t have to use it.
I use Silverblue and try to stick with Flatpaks if they are an option. The ones from the Fedora remote are made from the same source as the RPMs come from. But regardless of the remote, you can get a pretty good sense for when a developer isn’t keeping up because the runtime will fall behind.
A cool use case for Homebrew might be in a Toolbox container. How about that for security?
## Mehdi Haghgoo
Seems a good idea to me using it with toolbox.
## laolux
A toolbx container can usually access all your personal files in ~/Documents, ~/Pictures, ~/.ssh etc. So using unsafe/untrusted software in a toolbx container protects other users and their personal data, but unfortunately does not protect you very much. It could still steal and encrypt/delete all your private documents. It could likely not steal passwords which you enter or make screenshots, but still cause lots of havoc.
## Midge
I was thinking of adding nix, guix, pkgsrc to the stack, and forgetting the various scripting language package managers (pip & co.), for a true Frankendistro. Well, why not?
## George N. White III
The RHEL universe has “mission critical” applications that are extensively tested when released, but are then used in production for years with a rotating cast of IT staff. Meanwhile, tools that support the application (moving data, changing formats used for images, etc.) need updating. Such tools often require configurations that distro releases don’t provide (think of big libraries like gdal and netcdf with lots of optional configurations), so building from source is often necessary, and is often done using ad-hoc scripts. Using an existing build system is generally more robust and better documented, so should be preferred over ad-hoc “solutions”. The system should make it easy to determine which compilers and options were used for every build by the person who switched jobs last week.
## Mehdi Haghgoo
Looks like there is already a discussion around packaging it for distros, though I’m not sure when or if it will happen.
## Mehdi Haghgoo
https://github.com/cantalupo555/repo-solus/issues/49
## Open To Alternatives
One advantage of building from source is obtaining architecture specific builds that will give greater performance and a smaller binary size. Something that Arch users benefit from when hardware choices are diversifying – x86, AArch64, riscv etc.
## jeremy
/bin/bash: line 892: cd: /home/linuxbrew/.linuxbrew/Homebrew: Permission denied
/bin/bash: line 892: return: can only `return’ from a function or sourced script
/usr/.git: Permission denied
## 4wt3w
how download and using whole fedora offline
without internet?
## Jason
Interesting article, I use it, but only for simple binaries as a convenience, eg: helm-docs is a simple self contained binary ( yay golang ! ). Using it as an alternative to dnf is likely to end you up in a world of pain |
14,381 | 使用 Java 解析 XML 文件 | https://opensource.com/article/21/7/parsing-config-files-java | 2022-03-22T09:16:00 | [
"Java",
"配置",
"XML"
] | https://linux.cn/article-14381-1.html |
>
> 在你使用 Java 编写软件时实现持久化配置。
>
>
>

当你编写一个应用时,你通常都会希望用户能够定制化他们和应用交互的方式,以及应用与系统进行交互的方式。这种方式通常被称为 “<ruby> 偏好 <rt> preference </rt></ruby>” 或者 “<ruby> 设置 <rt> setting </rt></ruby>”,它们被保存在一个 “偏好文件” 或者 “配置文件” 中,有时也直接简称为 “<ruby> 配置 <rt> config </rt></ruby>”。配置文件可以有很多种格式,包括 INI、JSON、YAML 和 XML。每一种编程语言解析这些格式的方式都不同。本文主要讨论,当你在使用 [Java 编程语言](https://opensource.com/resources/java) 来编写软件时,实现持久化配置的方式。
### 选择一个格式
编写配置文件是一件相当复杂的事情。我曾经试过把配置项使用逗号分隔保存在一个文本文件里,也试过把配置项保存在非常详细的 YAML 和 XML 中。对于配置文件来说,最重要是要有一致性和规律性,它们使你可以简单快速地编写代码,从配置文件中解析出数据;同时,当用户决定要做出修改时,很方便地保存和更新配置。
目前有 [几种流行的配置文件格式](https://opensource.com/article/21/6/what-config-files)。对于大多数常见的配置文件格式,Java 都有对应的<ruby> 库 <rt> library </rt></ruby>。在本文中,我将使用 XML 格式。对于一些项目,你可能会选择使用 XML,因为它的一个突出特点是能够为包含的数据提供大量相关的元数据,而在另外一些项目中,你可能会因为 XML 的冗长而不选择它。在 Java 中使用 XML 是非常容易的,因为它默认包含了许多健壮的 XML 库。
### XML 基础
讨论 XML 可是一个大话题。我有一本关于 XML 的书,它有超过 700 页的内容。幸运的是,使用 XML 并不需要非常了解它的诸多特性。就像 HTML 一样,XML 是一个带有开始和结束标记的分层标记语言,每一个标记(标签)内可以包含零个或更多数据。下面是一个 XML 的简单示例片段:
```
<xml>
<node>
<element>Penguin</element>
</node>
</xml>
```
在这个 <ruby> 自我描述的 <rt> self-descriptive </rt></ruby> 例子中,XML 解析器使用了以下几个概念:
* <ruby> 文档 <rt> Document </rt></ruby>:`<xml>` 标签标志着一个 *文档* 的开始,`</xml>` 标签标志着这个文档的结束。
* <ruby> 节点 <rt> Node </rt></ruby>:`<node>` 标签代表了一个 *节点*。
* <ruby> 元素 <rt> Element </rt></ruby>:`<element>Penguin</element>` 中,从开头的 `<` 到最后的 `>` 表示了一个 *元素*。
* <ruby> 内容 <rt> Content </rt></ruby>: 在 `<element>` 元素里,字符串 `Penguin` 就是 *内容*。
不管你信不信,只要了解了以上几个概念,你就可以开始编写、解析 XML 文件了。
### 创建一个示例配置文件
要学习如何解析 XML 文件,只需要一个极简的示例文件就够了。假设现在有一个配置文件,里面保存的是关于一个图形界面窗口的属性:
```
<xml>
<window>
<theme>Dark</theme>
<fullscreen>0</fullscreen>
<icons>Tango</icons>
</window>
</xml>
```
创建一个名为 `~/.config/DemoXMLParser` 的目录:
```
$ mkdir ~/.config/DemoXMLParser
```
在 Linux 中,`~/.config` 目录是存放配置文件的默认位置,这是在 [自由桌面工作组](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) 的规范中定义的。如果你正在使用一个不遵守 <ruby> 自由桌面工作组 <rt> Freedesktop </rt> <ruby> 标准的操作系统,你也仍然可以使用这个目录,只不过你需要自己创建这些目录了。 </ruby></ruby>
复制 XML 的示例配置文件,粘贴并保存为 `~/.config/DemoXMLParser/myconfig.xml` 文件。
### 使用 Java 解析 XML
如果你是 Java 的初学者,你可以先阅读我写的 [面向 Java 入门开发者的 7 个小技巧](https://opensource.com/article/19/10/java-basics)。一旦你对 Java 比较熟悉了,打开你最喜爱的集成开发工具(IDE),创建一个新工程。我会把我的新工程命名为 `myConfigParser`。
刚开始先不要太关注依赖导入和异常捕获这些,你可以先尝试用 `javax` 和 `java.io` 包里的标准 Java 扩展来实例化一个解析器。如果你使用了 IDE,它会提示你导入合适的依赖。如果没有,你也可以在文章稍后的部分找到完整的代码,里面就有完整的依赖列表。
```
Path configPath = Paths.get(System.getProperty("user.home"), ".config", "DemoXMLParser");
File configFile = new File(configPath.toString(), "myconfig.xml");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
builder = factory.newDocumentBuilder();
Document doc = null;
doc = builder.parse(configFile);
doc.getDocumentElement().normalize();
```
这段示例代码使用了 `java.nio.Paths` 类来找到用户的主目录,然后在拼接上默认配置文件的路径。接着,它用 `java.io.File` 类来把配置文件定义为一个 `File` 对象。
紧接着,它使用了 `javax.xml.parsers.DocumentBuilder` 和 `javax.xml.parsers.DocumentBuilderFactory` 这两个类来创建一个内部的文档构造器,这样 Java 程序就可以导入并解析 XML 数据了。
最后,Java 创建一个叫 `doc` 的文档对象,并且把 `configFile` 文件加载到这个对象里。通过使用 `org.w3c.dom` 包,它读取并规范化了 XML 数据。
基本上就是这样啦。理论上来讲,你已经完成了数据解析的工作。可是,如果你不能够访问数据的话,数据解析也没有多少用处嘛。所以,就让我们再来写一些查询,从你的配置中读取重要的属性值吧。
### 使用 Java 访问 XML 的值
从你已经读取的 XML 文档中获取数据,其实就是要先找到一个特定的节点,然后遍历它包含的所有元素。通常我们会使用多个循环语句来遍历节点中的元素,但是为了保持代码可读性,我会尽可能少地使用循环语句:
```
NodeList nodes = doc.getElementsByTagName("window");
for (int i = 0; i < nodes.getLength(); i++) {
Node mynode = nodes.item(i);
System.out.println("Property = " + mynode.getNodeName());
if (mynode.getNodeType() == Node.ELEMENT_NODE) {
Element myelement = (Element) mynode;
System.out.println("Theme = " + myelement.getElementsByTagName("theme").item(0).getTextContent());
System.out.println("Fullscreen = " + myelement.getElementsByTagName("fullscreen").item(0).getTextContent());
System.out.println("Icon set = " + myelement.getElementsByTagName("icons").item(0).getTextContent());
}
}
```
这段示例代码使用了 `org.w3c.dom.NodeList` 类,创建了一个名为 `nodes` 的 `NodeList` 对象。这个对象包含了所有名字匹配字符串 `window` 的子节点,实际上这样的节点只有一个,因为本文的示例配置文件中只配置了一个。
紧接着,它使用了一个 `for` 循环来遍历 `nodes` 列表。具体过程是:根据节点出现的顺序逐个取出,然后交给一个 `if-then` 子句处理。这个 `if-then` 子句创建了一个名为 `myelement` 的 `Element` 对象,其中包含了当前节点下的所有元素。你可以使用例如 `getChildNodes` 和 `getElementById` 方法来查询这些元素,项目中还 [记录了](https://www.w3.org/2003/01/dom2-javadoc/org/w3c/dom/Document.html) 其他查询方法。
在这个示例中,每个元素就是配置的键。而配置的值储存在元素的内容中,你可以使用 `.getTextContent` 方法来提取出配置的值。
在你的 IDE 中运行代码(或者运行编译后的二进制文件):
```
$ java ./DemoXMLParser.java
Property = window
Theme = Dark
Fullscreen = 0
Icon set = Tango
```
下面是完整的代码示例:
```
package myConfigParser;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class ConfigParser {
public static void main(String[] args) {
Path configPath = Paths.get(System.getProperty("user.home"), ".config", "DemoXMLParser");
File configFile = new File(configPath.toString(), "myconfig.xml");
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
try {
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
Document doc = null;
try {
doc = builder.parse(configFile);
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
doc.getDocumentElement().normalize();
NodeList nodes = doc.getElementsByTagName("window");
for (int i = 0; i < nodes.getLength(); i++) {
Node mynode = nodes.item(i);
System.out.println("Property = " + mynode.getNodeName());
if (mynode.getNodeType() == Node.ELEMENT_NODE) {
Element myelement = (Element) mynode;
System.out.println("Theme = " + myelement.getElementsByTagName("theme").item(0).getTextContent());
System.out.println("Fullscreen = " + myelement.getElementsByTagName("fullscreen").item(0).getTextContent());
System.out.println("Icon set = " + myelement.getElementsByTagName("icons").item(0).getTextContent());
} // close if
} // close for
} // close method
} //close class
```
### 使用 Java 更新 XML
用户时不时地会改变某个偏好项,这时候 `org.w3c.dom` 库就可以帮助你更新某个 XML 元素的内容。你只需要选择这个 XML 元素,就像你读取它时那样。不过,此时你不再使用 `.getTextContent` 方法,而是使用 `.setTextContent` 方法。
```
updatePref = myelement.getElementsByTagName("fullscreen").item(0);
updatePref.setTextContent("1");
System.out.println("Updated fullscreen to " + myelement.getElementsByTagName("fullscreen").item(0).getTextContent());
```
这么做会改变应用程序内存中的 XML 文档,但是还没有把数据写回到磁盘上。配合使用 `javax` 和 `w3c` 库,你就可以把读取到的 XML 内容写回到配置文件中。
```
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer xtransform;
xtransform = transformerFactory.newTransformer();
DOMSource mydom = new DOMSource(doc);
StreamResult streamResult = new StreamResult(configFile);
xtransform.transform(mydom, streamResult);
```
这么做会没有警告地写入转换后的数据,并覆盖掉之前的配置。
下面是完整的代码,包括更新 XML 的操作:
```
package myConfigParser;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class ConfigParser {
public static void main(String[] args) {
Path configPath = Paths.get(System.getProperty("user.home"), ".config", "DemoXMLParser");
File configFile = new File(configPath.toString(), "myconfig.xml");
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
try {
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Document doc = null;
try {
doc = builder.parse(configFile);
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
doc.getDocumentElement().normalize();
Node updatePref = null;
// NodeList nodes = doc.getChildNodes();
NodeList nodes = doc.getElementsByTagName("window");
for (int i = 0; i < nodes.getLength(); i++) {
Node mynode = nodes.item(i);
System.out.println("Property = " + mynode.getNodeName());
if (mynode.getNodeType() == Node.ELEMENT_NODE) {
Element myelement = (Element) mynode;
System.out.println("Theme = " + myelement.getElementsByTagName("theme").item(0).getTextContent());
System.out.println("Fullscreen = " + myelement.getElementsByTagName("fullscreen").item(0).getTextContent());
System.out.println("Icon set = " + myelement.getElementsByTagName("icons").item(0).getTextContent());
updatePref = myelement.getElementsByTagName("fullscreen").item(0);
updatePref.setTextContent("2");
System.out.println("Updated fullscreen to " + myelement.getElementsByTagName("fullscreen").item(0).getTextContent());
} // close if
}// close for
// write DOM back to the file
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer xtransform;
DOMSource mydom = new DOMSource(doc);
StreamResult streamResult = new StreamResult(configFile);
try {
xtransform = transformerFactory.newTransformer();
xtransform.transform(mydom, streamResult);
} catch (TransformerException e) {
e.printStackTrace();
}
} // close method
} //close class
```
### 如何保证配置不出问题
编写配置文件看上去是一个还挺简单的任务。一开始,你可能会用一个简单的文本格式,因为你的应用程序只要寥寥几个配置项而已。但是,随着你引入了更多的配置项,读取或者写入错误的数据可能会给你的应用程序带来意料之外的错误。一种帮助你保持配置过程安全、不出错的方法,就是使用类似 XML 的规范格式,然后依靠你用的编程语言的内置功能来处理这些复杂的事情。
这也正是我喜欢使用 Java 和 XML 的原因。每当我试图读取错误的配置值时,Java 就会提醒我。通常,这是由于我在代码中试图获取的节点,并不存在于我期望的 XML 路径中。XML 这种高度结构化的格式帮助了代码保持可靠性,这对用户和开发者来说都是有好处的。
---
via: <https://opensource.com/article/21/7/parsing-config-files-java>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[lkxed](https://github.com/lkxed) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| 200 | OK | When you write an application, you often want users to be able to configure how they interact with it and how it interacts with their system. These are commonly called "preferences" or "settings," and they're stored in "preference files" or "configuration files," or just "configs." There are many different formats for config files, including INI, JSON, YAML, and XML, and every language parses these languages differently. This article discusses some of the ways you can implement persistent settings when you're writing software in the [Java programming language](https://opensource.com/resources/java).
## Choose a format
Writing configuration files is surprisingly flexible. I've kept configuration options in a simple comma-delimited text file, and I've kept options in highly detailed YAML or XML. The most important thing about configuration files is that they are consistent and predictable. This makes it easy for you to write code that can quickly and easily extract data from the configuration file, as well as save and update options when the user decides to make a change.
There are [several popular formats for configuration files](https://opensource.com/article/21/6/what-config-files). Java has libraries for most of the common configuration formats, but in this article, I'll use the XML format. For some projects, you might choose to use XML for its inherent ability to provide lots of metadata about the data it contains, while for others, you may choose to avoid it due to its verbosity. Java makes working with XML relatively easy because it includes robust XML libraries by default.
## XML basics
XML is a big topic. Just one of the books I own about XML is over 700 pages. Fortunately, using XML doesn't require in-depth knowledge of all its many features. Like HTML, XML is a hierarchical markup language with opening and closing tags, which may contain zero or more data. Here's a sample snippet of XML:
```
<xml>
<node>
<element>Penguin</element>
</node>
</xml>
```
In this rather self-descriptive example, here are the terms that XML parsers use:
**Document:**The`<xml>`
tag opens a*document*, and the`</xml>`
tag closes it.**Node:**The`<node>`
tag is a*node*.**Element:**The`<element>Penguin</element>`
, from the first`<`
to the last`>`
, is an*element*.**Content:**In the`<element>`
element, the string`Penguin`
is the*content*.
Believe it or not, that's all you need to know about XML to be able to write and parse it.
## Create a sample config file
A minimal example of a config file is all you need to learn how to parse XML. Imagine a config file tracking some display properties of a GUI window:
```
<xml>
<window>
<theme>Dark</theme>
<fullscreen>0</fullscreen>
<icons>Tango</icons>
</window>
</xml>
```
Create a directory called `~/.config/DemoXMLParser`
:
`$ mkdir ~/.config/DemoXMLParser`
On Linux, the `~/.config`
directory is the default configuration file location, as defined by the [Freedesktop](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) specification. If you're on an operating system that doesn't follow Freedesktop standards, you can still use this location, but you may have to create all the directories yourself.
Copy and paste the sample configuration XML into a file and save it as `~/.config/DemoXMLParser/myconfig.xml`
.
## Parse XML with Java
If you're new to Java, start by reading my [7 tips for new Java developers](https://opensource.com/article/19/10/java-basics) article. Once you're relatively comfortable with Java, open your favorite integrated development environment (IDE) and create a new project. I call mine **myConfigParser**.
Without worrying too much about imports and error catching initially, you can instantiate a parser using the standard Java extensions found in the `javax`
and `java.io`
libraries. If you're using an IDE, you'll be prompted to import the appropriate libraries; otherwise, you can find a full list of libraries in the complete version of this code later in this article.
```
Path configPath = Paths.get(System.getProperty("user.home"), ".config", "DemoXMLParser");
File configFile = new File(configPath.toString(), "myconfig.xml");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
builder = factory.newDocumentBuilder();
Document doc = null;
doc = builder.parse(configFile);
doc.getDocumentElement().normalize();
```
This example code uses the `java.nio.Paths`
library to locate the user's home directory, adding the default configuration location to the path. Then it defines the configuration file to be parsed as a File object using the `java.io.File`
library.
Next, it uses the `javax.xml.parsers.DocumentBuilder`
and `javax.xml.parsers.DocumentBuilderFactory`
libraries to create an internal document builder so that the Java program can ingest and parse XML data.
Finally, Java builds a document called `doc`
and loads the `configFile`
file into it. Using `org.w3c.dom`
libraries, it normalizes the ingested XML data.
That's essentially it. Technically, you're done parsing the data. But parsed data isn't of much use to you if you can't access it, so write some queries to extract important values from your configuration.
## Accessing XML values with Java
Getting data from your ingested XML document is a matter of referencing a specific node and then "walking" through the elements it contains. It's common to use a series of loops to iterate through elements in nodes, but I'll keep that to a minimum here, just to keep the code easy to read:
```
NodeList nodes = doc.getElementsByTagName("window");
for (int i = 0; i < nodes.getLength(); i++) {
Node mynode = nodes.item(i);
System.out.println("Property = " + mynode.getNodeName());
if (mynode.getNodeType() == Node.ELEMENT_NODE) {
Element myelement = (Element) mynode;
System.out.println("Theme = " + myelement.getElementsByTagName("theme").item(0).getTextContent());
System.out.println("Fullscreen = " + myelement.getElementsByTagName("fullscreen").item(0).getTextContent());
System.out.println("Icon set = " + myelement.getElementsByTagName("icons").item(0).getTextContent());
}
}
```
This sample code creates a `NodeList`
object called `nodes`
using the `org.w3c.dom.NodeList;`
library. This object contains any child node with a name that matches the string `window`
, which is the only node in the sample config file created in this article.
Next, it creates a for-loop to iterate over the `nodes`
list, taking each node in order of appearance and processing it with an if-then loop. The if-then loop creates an `Element`
object called `myelement`
that contains all elements within the current node. You can query the elements using methods like `getChildNodes`
, `getElementById`
, and others, as [documented](https://www.w3.org/2003/01/dom2-javadoc/org/w3c/dom/Document.html) by the project.
In this example, the elements are essentially the configuration keys. The values are stored as the content of the element, which you can extract with the `.getTextContent`
method.
Run the code either in your IDE or as a binary:
```
$ java ./DemoXMLParser.java
Property = window
Theme = Dark
Fullscreen = 0
Icon set = Tango
```
Here's the full code:
```
package myConfigParser;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class ConfigParser {
public static void main(String[] args) {
Path configPath = Paths.get(System.getProperty("user.home"), ".config", "DemoXMLParser");
File configFile = new File(configPath.toString(), "myconfig.xml");
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
try {
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
Document doc = null;
try {
doc = builder.parse(configFile);
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
doc.getDocumentElement().normalize();
NodeList nodes = doc.getElementsByTagName("window");
for (int i = 0; i < nodes.getLength(); i++) {
Node mynode = nodes.item(i);
System.out.println("Property = " + mynode.getNodeName());
if (mynode.getNodeType() == Node.ELEMENT_NODE) {
Element myelement = (Element) mynode;
System.out.println("Theme = " + myelement.getElementsByTagName("theme").item(0).getTextContent());
System.out.println("Fullscreen = " + myelement.getElementsByTagName("fullscreen").item(0).getTextContent());
System.out.println("Icon set = " + myelement.getElementsByTagName("icons").item(0).getTextContent());
} // close if
} // close for
} // close method
} //close class
```
## Updating XML with Java
From time to time, a user is going to change a preference. The `org.w3c.dom`
libraries can update the contents of an XML element; you only have to select the XML element the same way you did when reading it. Instead of using the `.getTextContent`
method, you use the `.setTextContent`
method:
```
updatePref = myelement.getElementsByTagName("fullscreen").item(0);
updatePref.setTextContent("1");
System.out.println("Updated fullscreen to " + myelement.getElementsByTagName("fullscreen").item(0).getTextContent());
```
This changes the XML document in your application's memory, but it doesn't write the data back to the drive. Using a combination of `javax`
and `w3c`
libraries, you can place your ingested XML back into your configuration file:
```
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer xtransform;
xtransform = transformerFactory.newTransformer();
DOMSource mydom = new DOMSource(doc);
StreamResult streamResult = new StreamResult(configFile);
xtransform.transform(mydom, streamResult);
```
This silently overwrites the previous configuration file with transformed data.
Here's the full code, complete with the updater:
```
package myConfigParser;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class ConfigParser {
public static void main(String[] args) {
Path configPath = Paths.get(System.getProperty("user.home"), ".config", "DemoXMLParser");
File configFile = new File(configPath.toString(), "myconfig.xml");
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
try {
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Document doc = null;
try {
doc = builder.parse(configFile);
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
doc.getDocumentElement().normalize();
Node updatePref = null;
// NodeList nodes = doc.getChildNodes();
NodeList nodes = doc.getElementsByTagName("window");
for (int i = 0; i < nodes.getLength(); i++) {
Node mynode = nodes.item(i);
System.out.println("Property = " + mynode.getNodeName());
if (mynode.getNodeType() == Node.ELEMENT_NODE) {
Element myelement = (Element) mynode;
System.out.println("Theme = " + myelement.getElementsByTagName("theme").item(0).getTextContent());
System.out.println("Fullscreen = " + myelement.getElementsByTagName("fullscreen").item(0).getTextContent());
System.out.println("Icon set = " + myelement.getElementsByTagName("icons").item(0).getTextContent());
updatePref = myelement.getElementsByTagName("fullscreen").item(0);
updatePref.setTextContent("2");
System.out.println("Updated fullscreen to " + myelement.getElementsByTagName("fullscreen").item(0).getTextContent());
} // close if
}// close for
// write DOM back to the file
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer xtransform;
DOMSource mydom = new DOMSource(doc);
StreamResult streamResult = new StreamResult(configFile);
try {
xtransform = transformerFactory.newTransformer();
xtransform.transform(mydom, streamResult);
} catch (TransformerException e) {
e.printStackTrace();
}
} // close method
} //close class
```
## Keep configuration trouble-free
Configuration can be a deceptively simple routine. You might start with a simple plain text config format while your application has only a few configurable features, but as you introduce more options, reading or writing incorrect data can cause unexpected behavior from your application. One way to help keep your configuration process safe from failure is to use a strict format like XML and to lean on your programming language's built-in features to handle the complexity.
I like using Java and XML for this very reason. When I try to read the wrong configuration value, Java lets me know, often because the node my code claims to want to read doesn't exist in the XML path I expect. XML's highly structured format helps me keep my code reliable, and that benefits both the users and the developer.
## Comments are closed. |
14,382 | 横向对比 5 款微软 Office 替代品 | https://www.debugpoint.com/2022/03/best-alternatives-microsoft-office-2022/ | 2022-03-22T10:27:00 | [
"Office"
] | /article-14382-1.html | 
>
> 在这篇文章中,我们将推荐 5 款可以替代微软 Office 的最佳软件,并从功能、操作难易程度等方面,对它们进行比较。看一看哪款更适合你?
>
>
>
可以说,Office 办公软件是微软开发的最优质的软件之一,受到世界各地用户的青睐,广泛应用于各行各业,当属近几十年来软件市场涌现出来的精品。
不过大家都知道,微软 Office 不仅没有开发适用于 Linux 的版本,而且价格高昂。对于企业用户或者个人用户来说,Office 365 的价格就更贵了,远超普通人能接受的价格水平。
那么,有哪些软件可以替代微软 Office 呢?
这篇文章推荐 5 款可以替代微软 Office 的最佳软件。
### LibreOffice

首先推荐的是 [LibreOffice](https://www.libreoffice.org/discover/libreoffice/)。LibreOffice 是一款自由开源的办公套件,由文档基金会开发维护,支持 Linux、macOS 以及 Windows 系统。
LibreOffice 套件包括表格工具 [Calc](https://www.debugpoint.com/category/libreoffice/libreoffice-calc/)、文字处理工具 Writer、演示工具 Impress、画图工具 Draw 以及数据库工具 Base。
LibreOffice 办公软件的开发十分很活跃,同时不断提升对微软 Office 的兼容性。如果善加利用,LibreOffice 完全可以取代微软 Office。借助丰富的技术文档和社区资源,用户可以迅速掌握 LibreOffice 的使用方法。
企业用户也可以免费使用 LibreOffice,如果需要用它来完成关键工作,用户也可以购买配置服务和支持服务,相关费用十分低廉。
然而,LibreOffice 不提供像 Outlook 一样的邮箱服务。这可能是它的一个小缺点,不过好在现在的邮箱服务都可以在浏览器上运行。
* [主页](https://www.libreoffice.org/discover/libreoffice/)
* [商业版](https://www.libreoffice.org/download/libreoffice-in-business/)
* [下载普通个人版](https://www.libreoffice.org/download/download/)
* [帮助文档](https://help.libreoffice.org/latest/en-US/text/shared/05/new_help.html)
* [官方支持论坛](https://ask.libreoffice.org/)
### Google Docs

搜索引擎巨头谷歌为用户免费提供了一套网页版的办公套件 —— [Google Docs](https://www.google.com/docs/about/),其中包括 Docs(文档编辑器)、Sheets(表格程序)、Slides(演示程序)。
用户可以在谷歌云盘中免费创建、打开文档。随时随地,自由存取。Google Docs 界面设计优美,内置工具栏、高级选项、拼写检查、语音输入功能(仅支持 Chrome 浏览器)、加密功能以及云存储服务。谷歌也为 iOS 系统和安卓系统提供了移动端,用户可以在移动设备上轻松打开、编辑文档。
Google Docs 最为人称道的功能在于它的模板。有了这些内置模板,用户可以迅速编辑出一份专业的文档。此外,通过邀请其他谷歌用户,还可以使用多人协作在线编辑功能。
如果你需要更多的功能,可以付费使用 Google Workspace。这是一套全面的整合方案,你可以通过 Google Forms 收集信息,并集成到你的文档和表格中、网站编辑工具 Google Sites、Google 日历等服务,保存为文档。
* [主页](https://www.google.com/docs/about/)
* [帮助文档](https://support.google.com/docs/?hl=en#topic=1382883)
### OnlyOffice

[OnlyOffice](https://www.onlyoffice.com/)(显示名字为 ONLYOFFICE)是一套自由开源的办公软件,包括文本编辑器、表格工具、演示软件,提供共享文件实时协作编辑、修改痕迹记录查看以及制作可供填写的表格等高级功能。
外观上,OnlyOffice 的功能区模仿了微软 Office 365 功能区的设计风格,能让用户快速上手。此外,OnlyOffice 对微软 Office 文件格式(.docx .xlsx 以及 .pptx)的兼容性更好,方便用户与他人共享文件。
值得一提的是,OnlyOffice 还推出了需要付费使用的企业版本 —— ONLYOFFICE Workspace。该版本增加了一些其他的高级功能,提供即时支持服务,非常适合那些预算紧张但对格式兼容性要求又很高的用户。
ONLYOFFICE Workspace 集成了邮箱客户端、客户关系管理产品、项目管理工具以及日历。总体来说,ONLYOFFICE Workspace 是一款不错的软件,但也有一些不足,如拼写检查、打印预览、页面尺寸以及漏洞等问题。不过也不需要过分担心,你可以在 GitHub 上传错误报告,向开发团队寻求帮助。
* [主页](https://www.onlyoffice.com/)
* [下载](https://www.onlyoffice.com/desktop.aspx)
* [帮助文档](https://forum.onlyoffice.com/)
### Softmaker FreeOffice

[FreeOffice](https://www.freeoffice.com/en/) 由 SoftMaker 开发,是一套十分优秀的办公软件,包括 TextMaker(可替代 Word)、PlanMaker(可替代 Excel)以及 Presentations(可替代 PowerPoint)。FreeOffice 提供了两种用户界面:带有功能区选项的现代化界面与带有菜单和工具栏的传统界面,两种界面都十分受欢迎。此外,FreeOffice 还为触控设备提供专有的用户界面与功能。
FreeOffice 对 微软 Office 文档格式的兼容性是很好的,可以完成大部分工作。然而,你在处理开放文档格式(ODT)文件时可能会遇到一点麻烦,因为它的支持有限。
FreeOffice 是一款闭源软件。
* [主页](https://www.freeoffice.com/en/)
* [下载](https://www.freeoffice.com/en/download/applications)
* [帮助文档](https://forum.softmaker.com/)
### WPS Office

还记得金山办公软件吗? 它现在的名字叫做 WPS Office。WPS 取 **W**ord, **P**resentation 与 **S**preadsheets 的首字母组合而成。到今天,WPS Office 已有 30 年的发展历史,是老牌办公软件之一。WPS 作为办公软件,功能齐全,支持移动端在内的各类平台。
WPS 最具特色的功能在于支持实时协作编辑。使用 WPS,团队成员可以同时编辑一份共享文档。WPS 还为用户提供了超过 10 万种文档模板,帮助用户编辑出专业美观的文档与演示文件。
WPS 的标准版本可以免费下载使用,不过有一些高级功能需要付费。
如果你需要额外的功能,比如编辑 PDF 文件、云空间扩容、团队协作以及企业支持,可以考虑付费开通会员,使用 WPS 企业版。
注意,这是一款闭源软件,而且可能会推送广告。(LCTT 译注:该公司内部人士表示,免费的 Linux 版没广告。)该软件由中国金山软件公司开发。
* [主页](https://www.wps.com/)
* [帮助文档](https://www.wps.com/academy/)
* [下载](https://www.wps.com/download/)
### 对比表
下表基于功能以及其他细节,对上述 5 款办公软进行对比总结。
| 产品 | 价格 | 是否开源 | 优势 | 劣势 |
| --- | --- | --- | --- | --- |
| LibreOffice | 免费 | 开源 | 免费;跨平台;支持多种语言;完全支持 ODF 文件格式;对 微软 Office 兼容性最好;开发活跃 | 不提供邮箱应用;不提供项目管理功能;数据库基于 Java |
| Google Docs | 免费 | 闭源 | 免费;跨平台;良好的文档支持;随时随地存取云文档;完美支持移动端 | 需要网络连接;网络连接导致卡顿或延迟;不提供可供安装的版本 |
| OnlyOffice | 免费(基础功能) | 开源 | 用户界面酷似微软 Office;对微软 Office 文件拥有更好的兼容性;云集成;支持插件;跨平台 | 基本功能可能出现问题;云集成服务违反欧盟通用数据保护条例;网页端延迟 |
| FreeOffice | 免费(基础功能) | 闭源 | 免费;相较于 LibreOffice 更加轻量;支持触屏;良好的微软 Office 兼容性;跨平台 | 免费版本只包括文档、表格与演示功能;其他产品需要付费;对 ODT 文件格式的支持有限;闭源软件 |
| WPS Office | 免费 | 闭源 | 良好的微软 Office 兼容性;跨平台;标签界面;支持多语言 | 闭源软件;可能弹出广告 |
### 我们推荐
抛开所有这些优势和劣势不管,如果你还不确定哪一款才是最适合你的,我推荐你使用 LibreOffice。因为 LibreOffice 与 TDF 格式前景广阔,开发活跃,在全世界都拥有广泛的支持。LibreOffice 有着庞大的在线知识库,为用户提供丰富的使用技巧。通过在 LibreOffice 中使用 Basic 语言或者 Python 宏,你还可以轻松实现办公自动化。
### 总结
我希望,我们的推荐能帮助你选择适合自己的可替代微软 Office 的办公软件。 说实话,上述软件没有一个能真正比得上微软 Office。但是并不是每个人都能付得起微软 Office 高昂的费用,我相信以上 5 款软件对这部分人来说会是不错的选择。
*一些图片来源:上述软件所属公司*
---
via: <https://www.debugpoint.com/2022/03/best-alternatives-microsoft-office-2022/>
作者:[Arindam](https://www.debugpoint.com/author/admin1/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[aREversez](https://github.com/aREversez) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) | null |
14,384 | Linux 内核 5.17 发布及新变化 | https://www.debugpoint.com/2022/03/linux-kernel-5-17/ | 2022-03-23T09:49:45 | [
"Linux",
"内核"
] | /article-14384-1.html |
>
> Linux 内核 5.17 已经发布,它具有更好的硬件支持和核心模块改进。下面是对新功能的简要介绍,并附有下载和安装细节。
>
>
>

Linux Torvalds [宣发了](https://lkml.org/lkml/2022/3/20/213) Linux 内核 5.17,这是 2022 年第二个稳定版主线内核。这个版本的内核模块中引入了对新处理器、显卡、存储和其他硬件组件的支持。
比内核 5.16 发布后的时间表稍有延迟,Linux 主线内核 5.17 现在可供下载了。这些更新包括对 AMD Zen 系列设备的温度支持;长期存在的软盘挂起错误,几个 ARM/SoC 支持以及各个子系统的性能改进。
我们已经在第一个候选版本发布时介绍了大部分变化,下面是对 Linux 内核 5.17 新特性的快速回顾。
### Linux 内核 5.17 的新内容
#### 处理器
Linux 内核中的 ARM64 架构现在包括了<ruby> 内核并发净化器 <rt> Kernel Concurrency Sanitizer </rt></ruby>(KCSAN)。KSCAN 是一个竞争条件检测器,已经支持了其他架构。而现在 ARM64 也在支持名单上了。另外,<ruby> 可扩展矩阵扩展 <rt> Scalable Matrix Extensions </rt></ruby>(SME)的初始工作有望为矩阵操作提供更好、更快的支持。
AMD [带来了](https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?h=hwmon-next&id=6482dd78c00c6d604ac1c757fb2d8a2be2878654) 基于 k10temp 的 CPU 温度监控,用于 AMD Zen 系列第 19 代 CPU 型号。
一组广泛的 Arm/SoC 支持 [进入了](https://lore.kernel.org/linux-arm-kernel/CAK8P3a0RDZpLtWjMEU1QVWSjOoqRAH6QxQ+ZQnJc8LwaV7m+JQ@mail.gmail.com/) Linux 内核 5.17 中。其中主要包括新的 Snapdragon 8 Gen 1 和 X65 平台。其他 SoC 包括恩智浦 i.MX8ULP、德州仪器 J721S2 和瑞萨 R-Car S4-8。
CPU 的重大变化之一是加入了 AMD 的 P-state 驱动,这是与 Valve 为 Steam Deck 合作开发的。这将提供更好的电源效率,因为透过 ACPI <ruby> 协作处理器性能控制 <rt> Collaborative Processor Performance Controls </rt></ruby>(CPPC)支持,可以更加细化的控制电源。
这个内核中另一个重要的 RISC-V 变化是支持 sv48,提供了 48 位虚拟地址空间。这使得内核可以对高达 128TB 的虚拟地址空间进行寻址。
这个版本带来了很多笔记本电脑、平板电脑的驱动更新。[这里](https://lore.kernel.org/lkml/[email protected]/T/#u) 有一个列表,主要内容是:
* 为华硕 ROG 笔记本电脑增加了自定义风扇曲线支持。
* 增加了对<ruby> 通用手写笔计划 <rt> Universal Stylus Initiative </rt></ruby>(USI)和 NVIDIA Tegra 平板电脑的支持。
* 对基于 AMD 的笔记本电脑的一些性能改进和修复,涉及到睡眠和声音驱动。
#### 显卡
英特尔的 Alder Lake P 显卡经过前一年的多次迭代,现在已经在主线内核上稳定了。这个内核引入了 [对 Raptor Lake S 显卡的首批支持补丁](https://lore.kernel.org/dri-devel/[email protected]/)。
英特尔的 Gen Icelake 显卡家族 [获得了](https://lists.freedesktop.org/archives/intel-gfx/2021-November/284109.html) 可变刷新率/自适应同步支持。
一些较新的笔记本电脑带来了内置的隐私屏幕,预计更多的 OEM 厂商会效仿。另外,值得注意的是,GNOME 桌面和其他公司正计划在之后使用这一隐私功能。所以,为了这个以隐私为中心的功能,最初的架构和代码工作都已经包含在这个内核版本中了。
你可以在 [这里](https://lists.freedesktop.org/archives/dri-devel/2022-January/336492.html) 找到一个很好的显卡驱动更新列表。
#### 存储
在内核的每个版本中都会对所有主要的文件系统和存储技术进行增量更新。这个版本也会有一些:
* 主要的更新包括流行的 EXT4 文件系统使用新的 Linux 挂载 API。
* 像往常一样,[F2FS](https://lore.kernel.org/lkml/[email protected]/)、[Btrfs](https://lore.kernel.org/lkml/[email protected]/) 和 [XFS](https://lore.kernel.org/lkml/[email protected]/) 的性能得到改善。
* FS-Cache 和 CacheFiles 模块 [做了](https://lore.kernel.org/lkml/[email protected]/) 重大重写。
#### 杂项硬件更新
今天谁还在使用软盘?我相信仍然有一些特定的商业用例仍在使用软盘。所以,这就给我们带来了这个特定的补丁,在这个内核版本中。内核中存在一个长期的错误:当系统试图读取一个坏掉的软盘时可能会挂起。所以,这个老毛病终于在这个版本中得到了解决,我希望能让少数仍然使用这种古老存储介质的人为此驻足一下。
其他值得注意的杂项硬件更新包括:
* 任天堂 GameCube/Wii/Wii U 实时时钟 [驱动](https://lore.kernel.org/lkml/[email protected]/)。
* 一个通用的 USB GNSS(<ruby> 全球导航卫星系统 <rt> Global Navigation Satellite System </rt></ruby>)驱动程序。
* Cirrus CS35L41 高清音频编解码器 [驱动](https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?h=for-next&id=7b2f3eb492dac7665c75df067e4d8e4869589f4a)。
* 许多英特尔 Wi-Fi 驱动程序 [改进](https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=bc11517bc8219314948780570ec92814d14d6602)。
* 英特尔 Alder Lake N [音频](https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?h=for-next&id=4d5a628d96532607b2e01e507f951ab19a33fc12) 支持。
### 如何下载和安装 Linux 内核 5.17
我们总是建议不要在你的稳定系统中安装最新的主线内核,除非你拥有特定的新硬件或想做实验。对于普通用户来说,最好是通过你的 Linux 发行版(如 Ubuntu、Fedora)的官方部署渠道等待内核的更新。
如果你仍然想安装,请按照下面的说明来安装 Linux 内核 5.17。
访问 [主线内核页面](https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17)。
有两种类型的构建可供选择:**通用**的和**低延迟**的。对于标准的系统,你可以下载通用的构建,大部分时间都可以工作。对于音频录制和其他需要低延迟的设置,请下载低延迟的。
通过终端下载以下四个通用软件包并安装:
```
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17/amd64/linux-headers-5.17.0-051700-generic_5.17.0-051700.202203202130_amd64.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17/amd64/linux-headers-5.17.0-051700_5.17.0-051700.202203202130_all.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17/amd64/linux-image-unsigned-5.17.0-051700-generic_5.17.0-051700.202203202130_amd64.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17/amd64/linux-modules-5.17.0-051700-generic_5.17.0-051700.202203202130_amd64.deb
```
安装完毕后,重新启动系统。
低延迟和其他架构(ARM)的安装指令是一样的。替换上述 `wget` 命令中的软件包名称。你可以在主线内核页面找到它们。
对于 Arch Linux 用户来说,预计 Linux 内核 5.17 发布包将在 2022 年 4 月第一周的 Arch .iso 月度刷新中到达。
随着这个版本的发布,合并窗口将为接下来 Linux 内核 5.18 打开。
---
via: <https://www.debugpoint.com/2022/03/linux-kernel-5-17/>
作者:[Arindam](https://www.debugpoint.com/author/admin1/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[wxy](https://github.com/wxy) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) | null |
14,385 | 在 Arch Linux 中体验令人惊叹的 Cutefish 桌面 | https://www.debugpoint.com/2022/02/cutefish-arch-linux-install/ | 2022-03-23T14:57:17 | [
"Cutefish"
] | /article-14385-1.html |
>
> 现在你可以在 Arch Linux 中体验 Cutefish 桌面了。本文概述了在 Arch Linux 系统中安装 Cutefish 桌面环境的步骤。
>
>
>

### Cutefish 桌面
前一阵子,[我们点评了 CutefishOS](https://www.debugpoint.com/2021/11/cutefish-os-review-2021/),它带有看起来非常棒的 Cutefish 桌面,得到了我们的读者的积极反应和关注。因此,我们认为这是一个完美的时机,是时候在你最喜欢的 Arch Linux 中体验一下这个桌面了。
在你进入安装部分之前,这里有一些关于 Cutefish 桌面的小知识。
Cutefish 桌面是 [CutefishOS](https://en.cutefishos.com/) 的一部分,这是一个正在开发的新 Linux 发行版。这个基于 Debian 的 Linux 发行版具有令人难以置信的外观、轻量级的 Cutefish 桌面。
Cutefish 桌面其内部是以 Qt Quick、QML、C++ 和 KDE 框架为基础编写的。这个现代的桌面环境使用 KWin 和 SDDM 进行窗口和显示管理。
Cutefish 桌面为你带来了所寻求的一个完全 macOS 风格的、开箱即用的 Linux 桌面。也就是说,你可以获得令人惊叹的图标、壁纸、全局菜单、带有漂亮通知弹出窗口的顶部栏和底部停靠区。
你可在 [这里] 阅读详细的点评。
### 在 Arch Linux 中安装 Cutefish 桌面
#### 安装基础 Arch 系统
本指南假设在尝试这些步骤之前,你的系统中已经安装好了基本的 Arch Linux。或者,如果你也安装了任何基于 Arch 的 Linux 发行版,你也可以尝试。只是在这些情况下要注意显示管理的问题。
如果你是 Arch 的新手,你可以参考我们的 Arch Linux 安装指南。
* [如何使用 archinstall 安装 Arch Linux(推荐)](https://www.debugpoint.com/2022/01/archinstall-guide/)
* [如何安装 Arch Linux(基本指南)](https://www.debugpoint.com/2020/11/install-arch-linux/)
#### 安装 Cutefish 桌面
Arch Linux 社区仓库包含了 Cutefish 组,其中有该桌面运行所需的所有组件。它包括核心软件包、原生应用和下面提到的附加工具。
在你的 Arch Linux 系统的终端提示符下,运行下面的命令来安装所有 Cutefish 桌面软件包。
```
pacman -S cutefish
```


接下来,我们需要通过下面的命令安装 Xorg 和显示管理器 SDDM。如果你将 Cutefish 桌面安装在安装有其他诸如 GNOME、KDE Plasma 或 Xfce 等桌面环境的 Arch Linux 中,那么请注意,因为你已经安装了一个显示管理器和 Xorg。所以,你可以轻松跳过这一步。
```
pacman -S xorg sddm
```
上述命令完成后,通过 systemctl 启用显示管理器。
```
systemctl enable sddm
```
这就是裸机安装 Cutefish 桌面的全部内容。完成后,重启系统,登录后你应该看到 Cutefish 桌面如下。

基础安装需要额外的定制,因为它不像 Cutefish OS 那样接近。
### 安装后的配置
尽管 Arch 仓库中的 Cutefish 组包含了它的原生应用,如计算器和文件管理器,但该桌面缺乏基本的应用,你需要单独安装这些应用来使它成为一个功能齐全的高效桌面。
我建议使用下面的命令来安装以下基本的应用。你可以跳过这一步,或者选择任何其他的应用/组合。
* Firefox 网页浏览器
* Kwrite 文本编辑器
* ttf-freefont 字体
* VLC 媒体播放器
* Gwenview 图像查看器
* GIMP 图像编辑器
* LibreOffice
* Transmission
```
pacman -S firefox ttf-freefont kwrite vlc gwenview gimp libreoffice-still transmission-qt
```
安装后,打开设置,改变你选择的字体。默认字体是 courier,它在桌面上看起来很糟糕。
按照你的选择完成所有的定制后,重启系统。然后享受 Arch Linux 中的 Cutefish 桌面。

### 结束语
这个桌面正在开发中,所以在写这篇文章时,你会发现设置项目不多。例如,没有办法改变分辨率、隐藏停靠区等等。不过,你仍然可以安装额外的应用来使用。如果你想做体验一番,可以去试试。
加油。
---
via: <https://www.debugpoint.com/2022/02/cutefish-arch-linux-install/>
作者:[Arindam](https://www.debugpoint.com/author/admin1/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) | null |
14,386 | 5 个为教师准备的方便的开源指南 | https://opensource.com/article/21/6/open-source-guides-teachers | 2022-03-23T16:29:08 | [
"开源",
"教师"
] | /article-14386-1.html | 
>
> 我们收集了一些最受欢迎的简明指南,它们既能满足你充分利用暑假的愿望,又能满足你为下一个学期做规划的需要。
>
>
>
对一些老师来说,夏天到了,一个漫长的(希望也是放松的)假期也到了。所有我认识的老师都是自豪的终身学习者,尽管暑假过后,又有一个新学期会到来。为了帮助你充分利用暑假时间,与此同时也为即将到来的下一个学期做好准备,我们收集了一些最受欢迎的 *简明* 指南。
### 如何让你的学校做好准备(在新冠疫情下)
通过 [在 Linux 上来完成所有相关工作](https://opensource.com/article/21/5/linux-school-servers),Robert Maynord 老师确保了他的学校为远程学习做好了准备,甚至在疫情前他就这么做了。虽然我们还不知道在今年剩下的时间里会发生什么,但是,如果说新冠疫情向世界展示了什么,那就是 [数字转型](https://enterprisersproject.com/what-is-digital-transformation)(指把数字技术融入到教育的各个领域)不仅是可能的,而且对教师和学生来说都是有益的。你可能无权在技术层面上改变课堂的运作方式,但你仍然可以做很多小的改变,为学生创造更灵活的学习体验。
### 为教师准备的终极开源指南
通过本文,你可以学习如何在课堂上 [融入开源原则](https://opensource.com/article/20/7/open-source-teachers)。开源不仅仅和科技相关,它同时也关于知识共享、团队协作以及为了一个共同目标而努力。你可以把你的教室变成一个共享的空间,让学生们互相学习,就像他们向你学习一样。阅读开源,把开源付诸实践,并鼓励学生们积极参与。
### 8 个为虚拟教室准备的 WordPress 插件
WordPress Web 平台是一个构建网站的强大工具。在教室里,它可以作为教授 Web 技术、创意写作和学术写作的 [一个很好的工具](https://opensource.com/article/20/3/wordpress-education)。它也可以被用来帮助远程学习,或者是把日常的学校作业数字化。通过掌握 WordPress 的诸多 [附加功能],你可以从中获取到最大的教育收益。
### 教孩子们写 Python(交互式游戏)
开源工具可以帮助任何人以一种轻松有趣的方式开始学习 Python —— 那就是制作游戏。当然,Python 涉及到很多方面的东西。别担心,我们有一个课程可以带你从安装 Python 开始,通过简单的文本代码和 “<ruby> 海龟 <rt> turtle </rt></ruby>” 绘图游戏开始你的第一步,一直到中级游戏开发。
1. 首先,安装 Python,阅读我们的 [Python 入门文章](https://opensource.com/article/17/10/python-101),熟悉编程的概念。单单是这篇文章里的内容就可以作为两节或三节不同课程的基础哦。
2. 然后,如果你熟悉 [Jupyter](https://opensource.com/article/18/3/getting-started-jupyter-notebooks) 库的话,可以学习 [使用 Python 和 Jupyter 来编写一个简单游戏](https://opensource.com/article/20/5/python-games)。
3. 接着,你也可以 [在这本 Python 电子书里学到游戏开发的知识](https://opensource.com/article/20/10/learn-python-ebook),里面会教你如何使用 Git、Python 和 PyGame 库。当你学会了这些基础内容,你可以看看 [这本书里的 "游戏测试员" 的有趣创作集合](https://github.com/MakerBox-NZ?q=pygame&type=&language=&sort=)。
如果 Python 对你或你的学生来说太难了,那么看看 [Thine](https://opensource.com/article/18/2/twine-gaming) 吧,它是一个简单的基于 HTML 的交互式的讲故事工具。
### 教孩子们玩树莓派(编程)
我们的指南中有一篇 [树莓派入门指南](https://opensource.com/article/19/3/teach-kids-program-raspberry-pi),其中探索了各种帮助孩子们学习编程的资源。树莓派的特点是它足够便宜,只要花 35 美元,你就可以买到一个全功能的 Linux 电脑。然后你就在上面做任何事,不管是基本的 Python 学习还是搭建实际的网络服务器,因此,它有着巨大的教育潜力。你完全可以为每一个学生都配一个树莓派,或者你也可以让班里的学生共享一个树莓派(Linux 是多用户操作系统,只要设置得当,所有的学生都可以同时使用这个树莓派,直到你说服他们的家长购买更多树莓派)。
### 一起学习
开放课堂的关键之一是要勇敢地和学生一起学习。作为一个老师,你可能习惯了掌握所有的答案,但是数字世界是不断改变和进化的。不要害怕 *和* 你的学生们一起学习 Python、Linux、树莓派或者任何其他东西,一起学习新的基础知识、小技巧和解决问题的新方式。开源是一种经过验证的成功方法,所以不要只是教授开源而已,还要让开源在你的课堂上得以运用。
---
via: <https://opensource.com/article/21/6/open-source-guides-teachers>
作者:[Seth Kenlon](https://opensource.com/users/seth) 选题:[lujun9972](https://github.com/lujun9972) 译者:[lkxed](https://github.com/lkxed) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
| null | HTTPSConnectionPool(host='opensource.com', port=443): Read timed out. (read timeout=10) | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.