mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-25 00:50:15 +08:00
commit
41bff51699
50
published/20201105 6 evening rituals for working in tech.md
Normal file
50
published/20201105 6 evening rituals for working in tech.md
Normal file
@ -0,0 +1,50 @@
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "Arzelan"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13610-1.html"
|
||||
[#]: subject: "6 evening rituals for working in tech"
|
||||
[#]: via: "https://opensource.com/article/20/11/evening-rituals-working-tech"
|
||||
[#]: author: "Jen Wike Huger https://opensource.com/users/jen-wike"
|
||||
|
||||
IT 人的 6 个晚上放松方式
|
||||
======
|
||||
|
||||
> 在结束了一天的远程会议、邮件往来、写代码和其他协作工作后,你在晚上如何放松自己呢?
|
||||
|
||||

|
||||
|
||||
这个奇怪的时代一方面给我们放慢脚步的机会,但另一方面来说,却比以前更忙了,尤其是当你除了照顾自己还要照顾家人的时候。俗话说,空杯子倒不出酒。所以,让我们看看在关上电脑或者完成最后一件工作之后,能为自己做些什么?
|
||||
|
||||
1、走出家门,做几次深呼吸,不要在乎是不是下雪天,让新鲜的空气从肺部充满全身。如果可以的话,在院子里走走,或者去街上逛逛。
|
||||
|
||||
2、如果有时间的话,给自己沏杯茶,红茶含有咖啡因,最好不要晚上喝,可以喝绿茶或者花果茶,然后在你穿上鞋(或许还有外套)时让它稍微凉一下。把茶倒在保温杯里,在小区周围散散步。不用设置目标或者目的地,就随便走走。如果你时间不充裕的话,可以定一个 15 分钟的闹钟。
|
||||
|
||||
3、放一首突然想到的歌,或者听之前想听但是一直没机会听的歌。
|
||||
|
||||
4、如果你有时间的话,别在椅子上继续坐着,可以站起来跳一段舞活动活动,或者到床上平躺着,躺着的时候什么也不要想,放空自己,让大脑休息休息。研究表明,给大脑一段空白时间后可以更好的思考。
|
||||
|
||||
5、打开你的 [电子书应用][2] 或者拿起一本纸质书,看纸质书相对来说对眼睛好点。享受轻松的阅读,如果不能长时间阅读的话,起码给自己留出能阅读一个章节的时间。
|
||||
|
||||
6、制做一些美食。享受把从杂货店买到的基本的食材按照菜谱做成一份美味佳肴的成就感和兴奋感。
|
||||
|
||||
你也可以在晚上把其中一些综合起来做,好好放松。如果你是 IT 人,那么无论是在 [早上][3]、中午、晚上用这些方式放松都很有效,因为现在我们都是在家工作,远程办公,没有和同事面对面交流时的闲暇。
|
||||
|
||||
那么,你的晚上放松方式是什么?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/11/evening-rituals-working-tech
|
||||
|
||||
作者:[Jen Wike Huger][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[Arzelan](https://github.com/Arzelan)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jen-wike
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDUCATION_jadud_farm-road.png?itok=of8IuSM5 "A farm road"
|
||||
[2]: https://opensource.com/article/20/2/linux-ebook-readers
|
||||
[3]: https://opensource.com/article/20/10/tech-morning-rituals
|
@ -3,22 +3,24 @@
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (piaoshi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13622-1.html)
|
||||
|
||||
编程秘笈:Java 中的输入和输出
|
||||
编程基础:Java 中的输入和输出
|
||||
======
|
||||
学习 Java 如何外理数据的读与写
|
||||
![Coffee beans and a cup of coffee][1]
|
||||
|
||||
> 学习 Java 如何外理数据的读与写。
|
||||
|
||||

|
||||
|
||||
当你写一个程序时,你的应用程序可能需要读取和写入存储在用户计算机上的文件。这在你想加载或存储配置选项,你需要创建日志文件,或你的用户想要保存工作以待后用的情况下是很常见的。每种语言处理这项任务的方式都有所不同。本文演示了如何用 Java 处理数据文件。
|
||||
|
||||
### 安装 Java
|
||||
|
||||
不管你的计算机是什么平台,你都可以从 [AdoptOpenJDK][2] 安装 Java。这个网站提供安全和开源的 Java 构建。在 Linux 上,你的软件库中也可能找到 AdvertOpenJDK 的构建。
|
||||
不管你的计算机是什么平台,你都可以从 [AdoptOpenJDK][2] 安装 Java。这个网站提供安全和开源的 Java 构建。在 Linux 上,你的软件库中也可能找到 AdoptOpenJDK 的构建。
|
||||
|
||||
我建议你使用最新的长期支持(LTS)版本。最新的非 LTS 版本对希望尝试最新 Java 功能的开发者来说是最好的,但它很可能超过大多数用户所安装的版本——要么是系统上默认安装的,要么是以前为其他 Java 应用安装的。使用 LTS 版本可以确保你与大多数用户所安装的版本保持一致。
|
||||
我建议你使用最新的长期支持(LTS)版本。最新的非 LTS 版本对希望尝试最新 Java 功能的开发者来说是最好的,但它很可能超过大多数用户所安装的版本 —— 要么是系统上默认安装的,要么是以前为其他 Java 应用安装的。使用 LTS 版本可以确保你与大多数用户所安装的版本保持一致。
|
||||
|
||||
一旦你安装好了 Java,就可以打开你最喜欢的文本编辑器并准备开始写代码了。你可能还想要研究一下 [Java 集成开发环境][3]。BlueJ 是新程序员的理想选择,而 Eclipse 和 Netbeans 对中级和有经验的编码者更友好。
|
||||
|
||||
@ -28,33 +30,32 @@ Java 使用 `File` 类来加载文件。
|
||||
|
||||
这个例子创建了一个叫 `Ingest` 的类来读取文件中数据。当你要在 Java 中打开一个文件时,你创建了一个 `Scanner` 对象,它可以逐行扫描你提供的文件。事实上,`Scanner` 与文本编辑器中的光标是相同的概念,这样你可以用 `Scanner` 的一些方法(如 `nextLine`)来控制这个“光标”以进行读写。
|
||||
|
||||
|
||||
```
|
||||
import java.io.File;
|
||||
import java.util.Scanner;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
public class Ingest {
|
||||
public static void main([String][4][] args) {
|
||||
|
||||
try {
|
||||
[File][5] myFile = new [File][5]("example.txt");
|
||||
Scanner myScanner = new Scanner(myFile);
|
||||
while (myScanner.hasNextLine()) {
|
||||
[String][4] line = myScanner.nextLine();
|
||||
[System][6].out.println(line);
|
||||
}
|
||||
myScanner.close();
|
||||
} catch ([FileNotFoundException][7] ex) {
|
||||
ex.printStackTrace();
|
||||
} //try
|
||||
} //main
|
||||
public static void main(String[] args) {
|
||||
|
||||
try {
|
||||
File myFile = new File("example.txt");
|
||||
Scanner myScanner = new Scanner(myFile);
|
||||
while (myScanner.hasNextLine()) {
|
||||
String line = myScanner.nextLine();
|
||||
System.out.println(line);
|
||||
}
|
||||
myScanner.close();
|
||||
} catch (FileNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
} //try
|
||||
} //main
|
||||
} //class
|
||||
```
|
||||
|
||||
这段代码首先在假设存在一个名为 `example.txt` 的文件的情况下创建了变量 `myfile`。如果该文件不存在,Java 就会“抛出一个异常”(这意味着它在你试图做的事情中发现了一个错误,并这样告诉你),这个异常是被非常明确的 `FileNotFoundException` 类所“捕获”。事实上,有一个专门的类来处理这个明确的错误,这说明这个错误是多么常见。
|
||||
这段代码首先在假设存在一个名为 `example.txt` 的文件的情况下创建了变量 `myfile`。如果该文件不存在,Java 就会“抛出一个异常”(如它所说的,这意味着它在你试图做的事情中发现了一个错误),这个异常是被非常特定的 `FileNotFoundException` 类所“捕获”。事实上,有一个专门的类来处理这个明确的错误,这说明这个错误是多么常见。
|
||||
|
||||
接下来,它创建了一个 `Scanner` 并将文件加载到其中。我把它叫做 `myScanner`,以区别于它的通用类模板。接着,一个 `while` 循环将 `myScanner` 逐行送入文件中,只要_存在_下一行。这就是 `hasNextLine` 方法的作用:它检测“光标”之后是否还有数据。你可以通过在文本编辑器中打开一个文件来模拟这个过程:你的光标从文件的第一行开始,你可以用键盘控制光标来向下扫描文件,直到你用完了所有的行。
|
||||
接下来,它创建了一个 `Scanner` 并将文件加载到其中。我把它叫做 `myScanner`,以区别于它的通用类模板。接着,一个 `while` 循环将 `myScanner` 逐行送入文件中,只要 _存在_ 下一行。这就是 `hasNextLine` 方法的作用:它检测“光标”之后是否还有数据。你可以通过在文本编辑器中打开一个文件来模拟这个过程:你的光标从文件的第一行开始,你可以用键盘控制光标来向下扫描文件,直到你走完了所有的行。
|
||||
|
||||
`while` 循环创建了一个变量 `line`,并将文件当前行的数据分配给它。然后将 `line` 的内容打印出来以提供反馈。一个更有用的程序可能会解析每一行的内容,从而提取它所包含的任何重要数据。
|
||||
|
||||
@ -64,45 +65,42 @@ public class Ingest {
|
||||
|
||||
将你的代码保存到 `Ingest.java` 文件(这是一个 Java 惯例,将类名的首字母大写,并以类名来命名相应的文件)。如果你试图运行这个简单的应用程序,你可能会接收到一个错误信息,这是因为还没有 `example.txt` 文件供应用程序加载:
|
||||
|
||||
|
||||
```
|
||||
$ java ./Ingest.java
|
||||
java.io.[FileNotFoundException][7]:
|
||||
java.io.FileNotFoundException:
|
||||
example.txt (No such file or directory)
|
||||
```
|
||||
|
||||
正好可以编写一个将数据写入文件的 Java 应用程序,多么完美的时机!
|
||||
正好可以编写一个将数据写入文件的 Java 应用程序,多么完美的时机!
|
||||
|
||||
### 利用 Java 将数据写入文件
|
||||
|
||||
无论你是存储用户使用你的应用程序创建的数据,还是仅仅存储关于用户在应用程序中做了什么的元数据(例如,游戏保存或最近播放的歌曲),有很多很好的理由来存储数据供以后使用。在 Java 中,这是通过 `FileWriter` 类实现的,这次先打开一个文件,向其中写入数据,然后关闭该文件。
|
||||
|
||||
|
||||
```
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Exgest {
|
||||
public static void main([String][4][] args) {
|
||||
try {
|
||||
[FileWriter][8] myFileWriter = new [FileWriter][8]("example.txt", true);
|
||||
myFileWriter.write("Hello world\n");
|
||||
myFileWriter.close();
|
||||
} catch ([IOException][9] ex) {
|
||||
[System][6].out.println(ex);
|
||||
} // try
|
||||
} // main
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
FileWriter myFileWriter = new FileWriter("example.txt", true);
|
||||
myFileWriter.write("Hello world\n");
|
||||
myFileWriter.close();
|
||||
} catch (IOException ex) {
|
||||
System.out.println(ex);
|
||||
} // try
|
||||
} // main
|
||||
}
|
||||
```
|
||||
|
||||
这个类的逻辑和流程与读取文件类似。但它不是一个 `Scanner`,而是以一个文件的名字为参数创建的一个 `FileWriter` 对象。`FileWriter` 语句末尾的 `true` 标志告诉 `FileWriter` 将文本_追加_到文件的末尾。要覆盖一个文件的内容,请移除 `true` 标志。
|
||||
|
||||
这个类的逻辑和流程与读取文件类似。但它不是一个 `Scanner`,而是以一个文件的名字为参数创建的一个 `FileWriter` 对象。`FileWriter` 语句末尾的 `true` 标志告诉 `FileWriter` 将文本 _追加_ 到文件的末尾。要覆盖一个文件的内容,请移除 `true` 标志。
|
||||
|
||||
```
|
||||
`FileWriter myFileWriter = new FileWriter("example.txt", true);`
|
||||
```
|
||||
|
||||
因为我在向文件中写入纯文本,所以我在写入文件的数据(Hello world)的结尾处手动添加了换行符(\n)。
|
||||
因为我在向文件中写入纯文本,所以我在写入文件的数据(`Hello world`)的结尾处手动添加了换行符(`\n`)。
|
||||
|
||||
### 试试代码
|
||||
|
||||
@ -110,7 +108,6 @@ public class Exgest {
|
||||
|
||||
既然你已经掌握了用 Java 创建和读取数据的方法,你可以按相反的顺序尝试运行你的新应用程序。
|
||||
|
||||
|
||||
```
|
||||
$ java ./Exgest.java
|
||||
$ java ./Ingest.java
|
||||
@ -120,7 +117,6 @@ $
|
||||
|
||||
因为程序是把数据追加到文件末尾,所以你可以重复执行你的应用程序以多次写入数据,只要你想把更多的数据添加到你的文件中。
|
||||
|
||||
|
||||
```
|
||||
$ java ./Exgest.java
|
||||
$ java ./Exgest.java
|
||||
@ -134,7 +130,7 @@ $
|
||||
|
||||
### Java 和数据
|
||||
|
||||
你并不经常向文件中写入原始文本;实事上,你可能会使用一个其它的类库以写入特定的格式。例如,你可能使用 XML 类库来写复杂的数据,使用 INI 或 YAML 类库来写配置文件,或者使用任何数量的专门类库来写二进制格式,如图像或音频。
|
||||
你不会经常向文件中写入原始文本;事实上,你可能会使用一个其它的类库以写入特定的格式。例如,你可能使用 XML 类库来写复杂的数据,使用 INI 或 YAML 类库来写配置文件,或者使用各种专门类库来写二进制格式,如图像或音频。
|
||||
|
||||
更完整的信息,请参阅 [OpenJDK 文档][10]。
|
||||
|
||||
@ -145,7 +141,7 @@ via: https://opensource.com/article/21/3/io-java
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[piaoshi](https://github.com/piaoshi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
40
published/20210529 My family-s Linux story.md
Normal file
40
published/20210529 My family-s Linux story.md
Normal file
@ -0,0 +1,40 @@
|
||||
[#]: subject: (My family's Linux story)
|
||||
[#]: via: (https://opensource.com/article/21/5/my-linux-story)
|
||||
[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (shiboi77)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13614-1.html)
|
||||
|
||||
我家的 Linux 故事
|
||||
======
|
||||
|
||||
> 我们在 Linux 的第一次尝试只是一个 apt-get 的距离。
|
||||
|
||||

|
||||
|
||||
我在 Linux 的第一次尝试是那种“或许我应该试一试”的情况。
|
||||
|
||||
那是 1990 年代,我在一些软盘上找到了用某种打包方式打包的红帽发行版,我为家里的笔记本电脑买了第二个硬盘,然后开始安装它。这是一件有趣的实验,但是我记得当时家人还没有准备好在电脑上使用 Linux。转眼到了 2005 年,我最终放弃了这种做法,买了一台可爱的东芝笔记本电脑,来运行 Windows XP。在工作中,我有一台有点年头的 SUN SPARCStation 5,并且我不太喜欢当时整个 Solaris 的发展方向(基于 Motif 的桌面)。我真的想要用 GIMP 来完成一些这样或那样的项目,但是在 Solaris 上安装 GNOME 1.x(也许是 1.4?)的曲折旅程是很有挑战性的。所以,我实际上是在考虑跳槽到 Windows XP。但是在我的家用机上用了几个月之后,我发现我更不喜欢在 Solaris 上运行 GNOME,所以我安装了 Ubuntu Hoary Hedgehog 5.04,随后在我的笔记本电脑上安装了 Breezy Badger 5.10。这太棒了,那台拥有 3.2GHz 奔腾处理器、2GB 内存和 100GB 的硬盘的机器就在我的 SPARCStation 5 旁边运行。
|
||||
|
||||
突然之间,我不再用拼凑起来的 Solaris 安装包来试图去让东西运行起来,而只是用 apt-get 就可以了。并且这个时机也很好。我家庭和我从 2006 年 8 月到 2007 年 7 月居住在法国格勒诺布尔,当时我的妻子在休假。因为有了运行 Linux 的东芝笔记本,我可以带着我的工作一起走。那个时候我在几个大的项目上做了大量的 GIS 数据处理,我发现我可以在 PostGIS / PostgreSQL 上做同样的事情,比我们在加拿大家中使用的昂贵得多的商业 GIS 软件要快得多。大家都很开心,尤其是我。
|
||||
|
||||
这一路上发生的有趣的事情是,我们把另外两台电脑带到了法国 —— 我妻子的类似的东芝电脑(运行 XP,对她来说很好用)和我们孩子最近新买的东芝牌笔记本电脑,也运行 XP。也就在圣诞节过后,他们有一些朋友过来,无意中在他们的电脑上安装了一个讨厌的、无法清除的病毒。经过几个小时甚至几天后,我的一个孩子问我:“爸爸,我们就不能安装和你电脑上一样的东西吗?”然后,三个新的 Linux 用户就这样产生了。我的儿子,29 岁了,依然是一个快乐的 Linux 用户,我猜他有第四或第五台 Linux 笔记本电脑了,最后几台都是由 System 76 提供的。我的一个女儿三年前开始读法学院时被迫转换为 Windows,因为她所在的学校有一个强制性的测试框架,只能在 Windows 上运行,而且据称会检测虚拟机之类的东西(请不要让我开始骂人)。而我的另一个女儿被她的公司为她买的 Macbook Air 诱惑了。
|
||||
|
||||
哦,好吧,不可能全都赢了吧!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/5/my-linux-story
|
||||
|
||||
作者:[Chris Hermansen][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[shiboi77](https://github.com/shiboi77)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/clhermansen
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background)
|
@ -3,60 +3,47 @@
|
||||
[#]: author: (Arindam https://www.debugpoint.com/author/admin1/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13621-1.html)
|
||||
|
||||
如何在 Kubuntu 21.04 Hirsute Hippo 中获得 KDE Plasma 5.22
|
||||
如何在 Kubuntu 21.04 中安装和升级 KDE Plasma 5.22
|
||||
======
|
||||
KDE 团队启用了向后移植 PPA,你可以使用它在 Kubuntu 21.04 Hirsute Hippo 中安装和升级到 KDE Plasma 5.22。
|
||||
|
||||
> KDE 团队启用了向后移植 PPA,你可以使用它在 Kubuntu 21.04 Hirsute Hippo 中安装和升级到 KDE Plasma 5.22。
|
||||
|
||||
![Kubnutu 21.04 running with KDE Plasma 5.22][1]
|
||||
|
||||
KDE 团队最近发布了 KDE Plasma 5.22,其中有相当多的增强功能、错误修复以及更新的 KDE 框架和应用版本。这个版本带来了一些改进,如面板的自适应透明度,文件操作弹出时的用户友好通知,“发现”中的软件包类型显示,各种 Wayland 的变化等。在[这里][2]查看更多关于功能细节。
|
||||
|
||||
如果你正在运行 Kubuntu 21.04 Hirsute Hippo 或者,在 [Ubuntu 21.04 Hisrsute Hippo][3] 中安装了自定义的 KDE Plasma,你可以通过以下步骤升级到最新版本。目前的 Hirsute Hippo 系列提供了 KDE Plasma 5.21.04 与 KDE Framework 5.80 的先前版本。
|
||||
|
||||
本指南包含下列主题:
|
||||
|
||||
1. [如何在 Kubuntu 21.04 中安装 KDE Plasma 5.22][4]
|
||||
2. [如何在 Ubuntu 21.04 中与 GNOME 一起安装 KDE Plasma 5.22][5]
|
||||
3. [我可以在 Ubuntu 20.04 LTS 中安装 KDE Plasma 5.22 么][6]
|
||||
4. [如何卸载][7]
|
||||
|
||||
KDE 团队最近发布了 KDE Plasma 5.22,其中有相当多的增强功能、错误修复以及更新的 KDE 框架和应用版本。这个版本带来了一些改进,如面板的自适应透明度,文件操作弹出时的用户友好通知,“发现”中的软件包类型显示,各种 Wayland 的变化等。在 [这里][2] 查看更多关于功能细节。
|
||||
|
||||
如果你正在运行 Kubuntu 21.04 Hirsute Hippo,或者在 [Ubuntu 21.04 Hirsute Hippo][3] 中安装了自定义的 KDE Plasma,你可以通过以下步骤升级到最新版本。目前的 Hirsute Hippo 系列提供了先前版本 KDE Plasma 5.21.04 与 KDE Framework 5.80。
|
||||
|
||||
### 在 Kubuntu 21.04 Hirsute Hippo 中安装 KDE Plasma 5.22 的步骤
|
||||
|
||||
按照下面的步骤进行。
|
||||
|
||||
如果你想使用图形方法,那么在“发现”中添加到软件源,然后点击更新。
|
||||
如果你想使用图形方法,那么在“发现”中将 `ppa:kubuntu-ppa/backports` 添加到软件源,然后点击“更新”。
|
||||
|
||||
或者,使用下面的终端方法,以加快安装速度。
|
||||
|
||||
* **步骤 1**:打开一个终端,添加下面的 KDE Backports PPA。
|
||||
|
||||
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:kubuntu-ppa/backports
|
||||
```
|
||||
```
|
||||
sudo add-apt-repository ppa:kubuntu-ppa/backports
|
||||
```
|
||||
|
||||
* **步骤 2**:然后运行以下程序来启动系统升级。这将在你的 Hirsute Hippo 系统中安装最新的 KDE Plasma 5.22。
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt full-upgrade
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt full-upgrade
|
||||
```
|
||||
|
||||
![Upgrade to Plasma 5.22][8]
|
||||
![Upgrade to Plasma 5.22][8]
|
||||
|
||||
* **步骤 3**:更新后重新启动,你应该会看到一个更新的 KDE Plasma 5.22 桌面。
|
||||
|
||||
|
||||
|
||||
考虑到整个桌面环境的完整版本升级,安装可能需要一些时间。
|
||||
考虑到这是整个桌面环境的完整版本升级,安装可能需要一些时间。
|
||||
|
||||
### 在 Ubuntu 21.04 中安装 KDE Plasma 5.22
|
||||
|
||||
@ -90,7 +77,7 @@ Ubuntu 20.04 LTS 版拥有早期的 KDE Plasma 5.18、KDE Framework 5.68、KDE A
|
||||
|
||||
### 卸载 KDE Plasma 5.22
|
||||
|
||||
如果你改变主意,想回到 KDE Plasma 的原始版本,那么安装 ppa-purge 并清除 PPA。这将使软件包降级,并启用仓库版本。
|
||||
如果你改变主意,想回到 KDE Plasma 的原始版本,那么安装 `ppa-purge` 并清除 PPA。这将使软件包降级,并启用仓库版本。
|
||||
|
||||
```
|
||||
sudo apt install ppa-purge
|
||||
@ -102,8 +89,6 @@ sudo apt update
|
||||
|
||||
我希望这个快速指南能帮助你在 Kubuntu 21.04 Hirsute Hippo 中安装最新的 KDE Plasma 5.22。这可以让你体验到最新的 KDE 技术以及 KDE 框架和应用。然而,你应该知道,并不是所有的功能都应该在向后移植 PPA 中提供,它只有选定的功能和错误修复,这才能通过回归测试并安全使用。也就是说,你总是可以把 KDE Neon 安装成一个全新的系统来享受 KDE 的最新技术。
|
||||
|
||||
* * *
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/06/plasma-5-22-kubuntu-21-04/
|
||||
@ -111,7 +96,7 @@ via: https://www.debugpoint.com/2021/06/plasma-5-22-kubuntu-21-04/
|
||||
作者:[Arindam][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -3,14 +3,16 @@
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13617-1.html)
|
||||
|
||||
在 Linux 上批量处理图像的 Converseen
|
||||
======
|
||||
|
||||
Converseen 是一个免费的开源软件,用于批量图像转换。有了这个工具,你可以一次将多张图片转换成另一种格式,调整大小,改变它们的长宽比,旋转或翻转它们。
|
||||

|
||||
|
||||
Converseen 是一个用于批量图像转换的自由开源软件。有了这个工具,你可以一次将多张图片转换成另一种格式、调整大小、改变它们的长宽比、旋转或翻转它们。
|
||||
|
||||
对于像我这样的人来说,这是一个很方便的工具,我必须处理多个不同大小的截图,但在上传到网站之前必须调整它们的大小。
|
||||
|
||||
@ -26,7 +28,7 @@ Converseen 是一个免费的开源软件,用于批量图像转换。有了这
|
||||
|
||||
![][3]
|
||||
|
||||
你也可以选择将转换后的图像以不同的名称保存在同一目录或其他位置。你也可以覆盖现有的图像。
|
||||
你也可以选择将转换后的图像以不同的名称保存在同一目录或其他位置,也可以覆盖现有的图像。
|
||||
|
||||
你不能添加文件夹,但你可以一次选择并添加多个图像。
|
||||
|
||||
@ -66,11 +68,11 @@ sudo dnf install converseen
|
||||
sudo pacman -Sy converseen
|
||||
```
|
||||
|
||||
Converseen 也可用于 Windows 和 FreeBSD。你可以在项目网站的下载页面获得相关说明。
|
||||
Converseen 也可在 Windows 和 FreeBSD 下使用。你可以在项目网站的下载页面获得相关说明。
|
||||
|
||||
[下载 Converseen][6]
|
||||
- [下载 Converseen][6]
|
||||
|
||||
它的源码可在 GitHub 仓库[获取][7]。
|
||||
它的源码可在 GitHub 仓库 [获取][7]。
|
||||
|
||||
如果你正在寻找一个更简单的方法来调整一张图片的大小,你可以使用这个巧妙的技巧,[在 Nautilus 文件管理器中用右键菜单调整图片大小和旋转图片][8]。
|
||||
|
||||
@ -83,7 +85,7 @@ via: https://itsfoss.com/converseen/
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
132
published/20210712 What is XML.md
Normal file
132
published/20210712 What is XML.md
Normal file
@ -0,0 +1,132 @@
|
||||
[#]: subject: "What is XML?"
|
||||
[#]: via: "https://opensource.com/article/21/7/what-xml"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "amwps290"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13624-1.html"
|
||||
|
||||
什么是 XML?
|
||||
======
|
||||
|
||||
> 了解一下 XML 吧,它是一种严格但灵活的标记语言,无论是在文档还是图像方面应用都十分广泛。
|
||||
|
||||

|
||||
|
||||
XML 是一种分层的标记语言。它使用打开和关闭标签来定义数据,它常用来存储和交换数据,而且由于它极大的灵活性,不论是在 [文档][2] 还是 [图像][3] 中都用的非常多。
|
||||
|
||||
这里是一个 XML 文档的例子:
|
||||
|
||||
```
|
||||
<xml>
|
||||
<os>
|
||||
<linux>
|
||||
<distribution>
|
||||
<name>Fedora</name>
|
||||
<release>8</release>
|
||||
<codename>Werewolf</codename>
|
||||
</distribution>
|
||||
|
||||
<distribution>
|
||||
<name>Slackware</name>
|
||||
<release>12.1</release>
|
||||
<mascot>
|
||||
<official>Tux</official>
|
||||
<unofficial>Bob Dobbs</unofficial>
|
||||
</mascot>
|
||||
</distribution>
|
||||
</linux>
|
||||
</os>
|
||||
</xml>
|
||||
```
|
||||
|
||||
阅读这个示例 XML,你可能会发现这个 XML 的格式具有直观的特性。 无论你是否熟悉这个文档的主题,你都可能理解本文档中的数据。 这部分原因是因为 XML 被认为是冗长的。 它使用了很多标签,标签可以有很长的描述性名称,并且数据以分层的方式排序,这有助于解释数据之间的关系。 你可能从这个示例中了解到 Fedora 发行版和 Slackware 发行版是两个不同且不相关的 Linux 发行版,因为每个实例都“包含”在自己独立的 `<distribution>` 标签中。
|
||||
|
||||
XML 也非常灵活。 与 HTML 不同,它没有预定义的标签列表。 你可以自由创建你需要表示任何数据结构的标签。
|
||||
|
||||
### XML 的组成
|
||||
|
||||
数据的存在为了读取,当计算机“读取”数据时,该过程称为 _解析_。 再次使用示例 XML 数据,以下是大多数 XML 解析器认为重要的术语。
|
||||
|
||||
* **文档**:`<xml>` 标签标记文档的开始, `</xml>` 标签标记文档的结束。
|
||||
* **节点**:`<os>`、`<distribution>`、`<mascot>` 这些都是节点,在解析术语中,节点是包含其他标签的标签。
|
||||
* **元素**:像 `<name>Fedora</name>` 和 `<official>Tux</official>` 这些都是元素。从第一个`<`开始,到最后一个 `>` 结束是一个元素。
|
||||
* **内容**:在两个元素标签之间的数据被称之为内容,在第一个 `<name>` 标签中,`Fedora` 字符串就是一个内容。
|
||||
|
||||
### XML 模式
|
||||
|
||||
XML 文档中的标签和标签继承性称为 _模式_。
|
||||
|
||||
一些模式是随意组成的(例如,本文中的示例 XML 代码纯粹是即兴创作的),而其他模式则由标准组织严格定义。 例如,可缩放矢量图形(SVG)模式 [由 W3C 定义][4],而 [DocBook 模式][5] 由 Norman Walsh 定义。
|
||||
|
||||
模式强制执行一致性。 最基本的模式通常也是最严格的。 在我的示例 XML 代码中,将发行版名称放在 `<mascot>` 节点中是没有意义的,因为文档的隐含模式清楚地表明 `mascot` 必须是发行版的“子”元素。
|
||||
|
||||
### 数据对象模型(DOM)
|
||||
|
||||
如果你必须不断地描述标签和位置(例如,“系统部分中的 Linux 部分中第二个发行版标签的名称标签”),那么谈论 XML 会让人感到困惑,因此解析器使用文档对象模型(DOM)的概念来表示 XML 数据。 DOM 将 XML 数据放入一种“家谱”结构中,从根元素(在我的示例 XML 中,即 `os` 标记)开始并包括路径上的每个标记。
|
||||
|
||||
![Document Object Model][6]
|
||||
|
||||
这种相同的 XML 数据结构可以表示为路径,就像 Linux 系统中的文件或互联网上网页的位置一样。 例如,`<mascot>` 标签的路径可以表示为 `//os/linux/distribution/slackware/mascot`。
|
||||
|
||||
两个 `<distribution>` 标签可以被表示为 `//os/linux/distribution` ,因为这里有两个发行版的节点,因此一个解析器可以直接将两个节点的内容载入到一个数组中,可以进行查询。
|
||||
|
||||
### 严格的 XML
|
||||
|
||||
XML 也以严格而著称。 这意味着大多数应用程序被设计为在遇到 XML 错误时就会故意失败。 这听起来可能有问题,但这是开发人员最欣赏 XML 的事情之一,因为当应用程序试图猜测如何解决错误时,可能会发生不可预测的事情。 例如,在 HTML 定义明确之前,大多数 Web 浏览器都包含“怪癖模式”,因此当人们试图查看糟糕的 HTML 代码时,Web 浏览器却可以加载作者可能想要的内容。 结果非常难以预测,尤其是当一个浏览器的猜测与另一个浏览器不同时。
|
||||
|
||||
XML 通过在出现故意错误时失败而不允许这样做。 这让作者可以修复错误,直到它们生成有效的 XML。 因为 XML 是良好定义的,所以有许多应用程序的验证器插件以及像 `xmllint` 和 `xmlstarlet` 这样的独立命令来帮助你及早定位错误。
|
||||
|
||||
### 转换 XML
|
||||
|
||||
因为 XML 通常用作数据交换,所以将 XML 转换为其他数据格式或其他 XML 模式是很常见的。 经典示例包括 XSLTProc、xmlto 和 [pandoc][8],但从技术上讲,还有许多其他应用程序或者至少程序的一部分就是在转换 XML。
|
||||
|
||||
事实上,LibreOffice 使用 XML 来布局其文字处理器和电子表格文档,因此无论何时你导出或 [从 LibreOffice 转换文件][9],你都在转换 XML。
|
||||
|
||||
[开源 EPUB 格式的电子书][10] 使用 XML,因此无论何时你 [将文档转换为 EPUB][11] 或从 EPUB 转换,你都在转换 XML。
|
||||
|
||||
Inkscape 是基于矢量的插图应用程序,它将其文件保存在 SVG 中,这是一种专为图形设计的 XML 模式。 任何时候你将 Inkscape 中的图像导出为 PNG 文件时,你都在转换 XML。
|
||||
|
||||
名单还可以一直继续下去。 XML 是一种数据存储格式,旨在确保你的数据,无论是画布上的点和线、图表上的节点,还是文档中的文字,都可以轻松准确地提取、更新和转换。
|
||||
|
||||
### 学习 XML
|
||||
|
||||
编写 XML 很像编写 HTML。 感谢 Jay Nick 的辛勤工作,[在线提供免费且有趣的 XML 课程][3] 可以教你如何使用 XML 创建图形。
|
||||
|
||||
通常,探索 XML 所需的特殊工具很少。 由于 HTML 和 XML 之间的密切关系,你可以 [使用 Web 浏览器查看 XML][12]。 此外,[QXmlEdit][13]、[NetBeans][14] 和 [Kate][15] 等开源文本编辑器通过有用的提示、自动完成、语法验证等,使键入和阅读 XML 变得容易。
|
||||
|
||||
### 选择 XML
|
||||
|
||||
XML 起初可能看起来有很多数据,但它与 HTML 并没有太大的不同(实际上,HTML 已经 [以 XHTML 的形式重新实现为 XML][16])。 XML 有一个独特的好处,即构成其结构的标签也恰好是元数据,提供有关其存储内容的信息。 精心设计的 XML 模式包含并描述你的数据,使用户能够一目了然并快速解析它,并使开发人员能够使用一些库 [快速解析][17]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/what-xml
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[amwps290](https://github.com/amwps290)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY "Computer screen with files or windows open"
|
||||
[2]: https://opensource.com/article/17/9/docbook
|
||||
[3]: https://opensource.com/article/17/5/coding-scalable-vector-graphics-make-steam
|
||||
[4]: https://www.w3.org/TR/SVG11/
|
||||
[5]: http://docbook.org
|
||||
[6]: https://opensource.com/sites/default/files/uploads/dom.jpg "Document Object Model"
|
||||
[7]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[8]: https://opensource.com/article/20/5/pandoc-cheat-sheet
|
||||
[9]: https://opensource.com/article/21/3/libreoffice-command-line
|
||||
[10]: https://opensource.com/education/15/11/ebook-open-formats
|
||||
[11]: https://opensource.com/life/13/8/how-create-ebook-open-source-way
|
||||
[12]: https://opensource.com/article/18/12/xml-browser
|
||||
[13]: https://opensource.com/article/17/7/7-ways-handle-xml-qxmledit
|
||||
[14]: https://opensource.com/article/20/12/netbeans
|
||||
[15]: https://opensource.com/article/20/12/kate-text-editor
|
||||
[16]: https://www.w3.org/TR/xhtml1/
|
||||
[17]: https://opensource.com/article/21/6/parsing-config-files-java
|
@ -3,22 +3,20 @@
|
||||
[#]: author: (Yazan Monshed https://fedoramagazine.org/author/yazanalmonshed/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13615-1.html)
|
||||
|
||||
在 Fedora 上开始使用 Podman
|
||||
如何在 Fedora 上使用 Podman
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
来自 Podman 项目的 Podman 标志 <https://github.com/containers/podman/tree/main/logo>
|
||||
|
||||
[Podman][2] 是一个无守护程序的容器引擎,用于在你的 Linux 系统上开发、管理和运行 OCI 容器。在这篇文章中,我们将介绍 podman 以及如何用 nodejs 构建一个小型应用来使用它。该应用将是非常简单和干净的。
|
||||
[Podman][2] 是一个无守护程序的容器引擎,用于在你的 Linux 系统上开发、管理和运行 OCI 容器。在这篇文章中,我们将介绍 Podman 以及如何用 nodejs 构建一个小型应用来使用它。该应用将是非常简单和干净的。
|
||||
|
||||
### 安装 Podman
|
||||
|
||||
如果你已经安装了 docker,只需在终端输入 **alias docker=podman**,那么 Podman 的命令就与 [docker][3] 相同。
|
||||
Podman 的命令就与 [docker][3] 相同,如果你已经安装了 Docker,只需在终端输入 `alias docker=podman`。
|
||||
|
||||
在 Fedora 中,Podman 是默认安装的。但是如果你因为任何原因没有安装,你可以用下面的命令安装它:
|
||||
|
||||
@ -26,9 +24,9 @@
|
||||
sudo dnf install podman
|
||||
```
|
||||
|
||||
对于 Fedora [silverblue][4] 用户,podman 已经安装在你的操作系统中了。
|
||||
对于 Fedora [silverblue][4] 用户,Podman 已经安装在你的操作系统中了。
|
||||
|
||||
安装后,运行 hello world 镜像,以确保一切正常:
|
||||
安装后,运行 “hello world” 镜像,以确保一切正常:
|
||||
|
||||
```
|
||||
podman pull hello-world
|
||||
@ -55,13 +53,13 @@ This message shows that your installation appears to be working correctly.
|
||||
|
||||
### 简单的 Nodejs 应用
|
||||
|
||||
首先,我们将创建一个文件夹 **webapp**,在终端输入以下命令
|
||||
首先,我们将创建一个文件夹 `webapp`,在终端输入以下命令:
|
||||
|
||||
```
|
||||
mkdir webapp && cd webapp
|
||||
```
|
||||
|
||||
现在创建文件 **_package.json_**,该文件包括项目运行所需的所有依赖项。在文件 _package.json_ 中复制以下代码:
|
||||
现在创建文件 `package.json`,该文件包括项目运行所需的所有依赖项。在文件 `package.json` 中复制以下代码:
|
||||
|
||||
```
|
||||
{
|
||||
@ -74,7 +72,7 @@ mkdir webapp && cd webapp
|
||||
}
|
||||
```
|
||||
|
||||
创建文件 _index.js_,并在其中添加以下代码:
|
||||
创建文件 `index.js`,并在其中添加以下代码:
|
||||
|
||||
```
|
||||
const express = require('express')
|
||||
@ -89,11 +87,11 @@ app.listen(8081, () => {
|
||||
});
|
||||
```
|
||||
|
||||
你可以从[这里][5]下载源代码。
|
||||
你可以从 [这里][5] 下载源代码。
|
||||
|
||||
### 创建 Dockerfile
|
||||
|
||||
首先,创建一个名为 _Dockerfile_ 的文件,并确保第一个字符是大写,而不是小写,然后在那里添加以下代码:
|
||||
首先,创建一个名为 `Dockerfile` 的文件,并确保第一个字符是大写,而不是小写,然后在那里添加以下代码:
|
||||
|
||||
```
|
||||
FROM node:alpine
|
||||
@ -103,13 +101,13 @@ RUN npm install
|
||||
CMD ["npm", "start"]
|
||||
```
|
||||
|
||||
确保你在 _webapp_ 文件夹内,然后显示镜像,然后输入以下命令:
|
||||
确保你在 `webapp` 文件夹内,然后显示镜像,然后输入以下命令:
|
||||
|
||||
```
|
||||
podman build .
|
||||
```
|
||||
|
||||
确保加了**点**。镜像在你的机器上被创建,你可以用以下命令显示它:
|
||||
确保加了 `.`。镜像将在你的机器上创建,你可以用以下命令显示它:
|
||||
|
||||
```
|
||||
podman images
|
||||
@ -121,11 +119,11 @@ podman images
|
||||
podman run -p 8080:8080 <image-name>
|
||||
```
|
||||
|
||||
现在在你的浏览器中打开 _localhost:8080_,你会看到你的应用已经工作。
|
||||
现在在你的浏览器中打开 `localhost:8080`,你会看到你的应用已经工作。
|
||||
|
||||
### 停止和删除容器
|
||||
|
||||
使用 _CTRL-C_ 退出容器,你可以使用容器 ID 来删除容器。获取 ID 并使用这些命令停止容器:
|
||||
使用 `CTRL-C` 退出容器,你可以使用容器 ID 来删除容器。获取 ID 并使用这些命令停止容器:
|
||||
|
||||
```
|
||||
podman ps -a
|
||||
@ -138,7 +136,7 @@ podman stop <container_id>
|
||||
podman rmi <image_id>
|
||||
```
|
||||
|
||||
在[官方网站][2]上阅读更多关于 podman 和它如何工作的信息。
|
||||
在 [官方网站][2] 上阅读更多关于 Podman 和它如何工作的信息。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -147,7 +145,7 @@ via: https://fedoramagazine.org/getting-started-with-podman-in-fedora/
|
||||
作者:[Yazan Monshed][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -3,22 +3,20 @@
|
||||
[#]: author: (Arman Arisman https://fedoramagazine.org/author/armanwu/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13625-1.html)
|
||||
|
||||
满足日常需求的应用第一部分:网络浏览器
|
||||
满足日常需求的应用(一):Web 浏览器
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
照片由 [Brooke Cagle][2] 发布在 [Unsplash][3]。
|
||||
|
||||
满足日常需求的重要应用之一是网络浏览器。这是因为上网是大多数人在电脑前进行的一项活动。本文将介绍一些你可以在 Fedora Linux 上使用的开源网络浏览器。你需要安装上述软件。本文提到的所有浏览器都已经在官方的 Fedora 软件库中提供。如果你不熟悉如何在 Fedora Linux 中添加软件包,请参阅我之前的文章[安装 Fedora 34 工作站后要做的事情][4]。
|
||||
满足日常需求的重要应用之一是 Web 浏览器。这是因为上网是大多数人在电脑前进行的一项活动。本文将介绍一些你可以在 Fedora Linux 上使用的开源 Web 浏览器。你需要安装上述软件。本文提到的所有浏览器都已经在官方的 Fedora 软件库中提供。如果你不熟悉如何在 Fedora Linux 中添加软件包,请参阅我之前的文章 [安装 Fedora 34 工作站后要做的事情][4]。
|
||||
|
||||
### Firefox
|
||||
|
||||
火狐是一个快速且注重隐私的浏览器,可以在许多设备上使用。它是由 [Mozilla][5] 创建的,是一个具有完整功能的浏览器,提供许多扩展。你可以为你的火狐浏览器添加许多强大的功能和有用的特性。它只使用适量的内存来创造一个流畅的体验,使你的电脑保持对其他任务的响应。你可以创建一个账户,让你在多个设备上共享配置,所以你不需要在每个设备上设置火狐浏览器。
|
||||
<ruby>火狐<rt>Firefox</rt></ruby>是一个快速且注重隐私的浏览器,可以在许多设备上使用。它是由 [Mozilla][5] 创建的,是一个具有完整功能的浏览器,提供许多扩展。你可以为你的火狐浏览器添加许多强大的功能和有用的特性。它只使用适量的内存来创造一个流畅的体验,使你的电脑保持对其他任务的响应。你可以创建一个账户,让你在多个设备上共享配置,所以你不需要在每个设备上设置火狐浏览器。
|
||||
|
||||
![][6]
|
||||
|
||||
@ -30,13 +28,11 @@
|
||||
* 设备之间的同步
|
||||
* 画中画
|
||||
|
||||
|
||||
|
||||
关于火狐浏览器的更多信息可在此链接中找到:[https://www.mozilla.org/en-US/firefox][7]
|
||||
|
||||
### GNOME Web
|
||||
|
||||
GNOME Web 是 GNOME 桌面的一个浏览器,它是 Fedora 工作站的默认桌面环境。如果你使用 GNOME 作为默认桌面环境的 Fedora Workstation,它可能非常适合作为你的主浏览器。这个浏览器有一个简单、干净、漂亮的外观。GNOME Web 的功能比 Firefox 少,但对于普通用途来说已经足够了。
|
||||
GNOME Web 是 GNOME 桌面(Fedora 工作站的默认桌面环境)的一个浏览器。如果你使用 GNOME 作为默认桌面环境的 Fedora 工作站,它可能非常适合作为你的主浏览器。这个浏览器有一个简单、干净、漂亮的外观。GNOME Web 的功能比 Firefox 少,但对于普通用途来说已经足够了。
|
||||
|
||||
![][8]
|
||||
|
||||
@ -47,13 +43,11 @@ GNOME Web 提供了以下功能:
|
||||
* 内置广告拦截器
|
||||
* 智能跟踪预防
|
||||
|
||||
|
||||
|
||||
关于 GNOME Web 的更多信息可以在这个链接中找到:<https://wiki.gnome.org/Apps/Web>
|
||||
|
||||
### Chromium
|
||||
|
||||
Chromium 是一个来自 Chromium 项目的开源网络浏览器,它有一个极简的用户界面。它的外观与 Chrome 相似,因为它实际上是作为 Chrome 和其他几个浏览器的基础。许多人使用 Chromium 是因为他们已经习惯了 Chrome。
|
||||
Chromium 是一个来自 Chromium 项目的开源 Web 浏览器,它有一个极简的用户界面。它的外观与 Chrome 相似,因为它实际上是作为 Chrome 和其他几个浏览器的基础。许多人使用 Chromium 是因为他们已经习惯了 Chrome。
|
||||
|
||||
![][9]
|
||||
|
||||
@ -63,13 +57,11 @@ Chromium 提供以下功能:
|
||||
* 扩展程序
|
||||
* 密码的自动填写
|
||||
|
||||
|
||||
|
||||
关于 Chromium 浏览器的更多信息可在此链接中找到:<https://www.chromium.org/Home>
|
||||
|
||||
### qutebrowser
|
||||
|
||||
这个浏览与上面提到的稍有不同,qutebrowser 是一个以键盘为中心的浏览器,具有最小的 GUI。因此,你不会发现通常在其他浏览器中的按钮,如返回、主页、重新加载等。相反,你可以用键盘输入命令来运行 qutebrowser 中的功能。它使用 Vim 风格的键绑定,所以它适合 Vim 用户。如果你有兴趣在上网时获得不同的体验,你应该试试这个浏览器。
|
||||
这个浏览与上面提到的稍有不同,qutebrowser 是一个以键盘为中心的浏览器,具有精简的 GUI。因此,你不会发现通常在其他浏览器中的按钮,如返回、主页、重新加载等。相反,你可以用键盘输入命令来运行 qutebrowser 中的功能。它使用 Vim 风格的键绑定,所以它适合 Vim 用户。如果你有兴趣在上网时获得不同的体验,你应该试试这个浏览器。
|
||||
|
||||
![][10]
|
||||
|
||||
@ -79,8 +71,6 @@ qutebrowser 提供以下功能:
|
||||
* 隐私浏览模式
|
||||
* 快速书签
|
||||
|
||||
|
||||
|
||||
关于 qutebrowser 浏览器的更多信息可在此链接中找到:<https://qutebrowser.org/>
|
||||
|
||||
### 总结
|
||||
@ -94,7 +84,7 @@ via: https://fedoramagazine.org/apps-for-daily-needs-part-1-web-browsers/
|
||||
作者:[Arman Arisman][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
216
published/20210719 Linux package managers- dnf vs apt.md
Normal file
216
published/20210719 Linux package managers- dnf vs apt.md
Normal file
@ -0,0 +1,216 @@
|
||||
[#]: subject: (Linux package managers: dnf vs apt)
|
||||
[#]: via: (https://opensource.com/article/21/7/dnf-vs-apt)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (perfiffer)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13620-1.html)
|
||||
|
||||
Linux 包管理器比较:dnf 和 apt
|
||||
======
|
||||
|
||||
> 包管理器提供大致相同的功能:安装、管理和移除应用,但是它们还是有一些不一样的地方。
|
||||
|
||||

|
||||
|
||||
[在 Linux 系统上获取一个应用][2] 有多种方式。例如,有新的 Flatpak 和容器方式,也有 DEB 和 RPM 这样一直以来经过考验的方式。
|
||||
|
||||
并没有一种通用的可以用于所有的操作系统的应用安装程序。如今,因为有无数的开发者发布软件,这导致了大部分的操作系统使用了应用商店(包括第一方和第三方)、拖放式安装,还有安装向导。不同的开发者对于他们发布的代码有不同的需求,这直接导致了他们所选择的安装方式的不同。
|
||||
|
||||
Linux 开创了一种通过命令行安装、管理、移除应用的包管理器的概念。`apt` 和 `dnf` 就是两种较为常见的包管理器。`apt` 命令是用来管理 DEB 格式的包,`dnf` 命令是用来管理 RPM 格式的包。这两种包管理器在理论上并不是完全互斥的,尽管在实际的实践中,Linux 发行版通常只会使用到其中的一种。理论上,这两种命令可以运行在同一个系统上,但是会造成安装包的重叠,版本控制也会更加困难,命令也会是冗余的。然而,如果你是在一个混合的 Linux 环境下工作,比如你的工作站运行的是一个发行版,同时需要与运行另外一种发行版的服务器进行交互,那么你最好同时掌握这两种包管理器。
|
||||
|
||||
### 搜索应用
|
||||
|
||||
当你通过包管理器安装一个应用时,你需要先知道包的名称。通常,应用的名称和包的名称是一样的。`dnf` 和 `apt` 验证要安装的包名的过程是完全相同的。
|
||||
|
||||
```
|
||||
$ sudo dnf search zsh
|
||||
====== Name Exactly Matched: zsh ======
|
||||
zsh.x86_64 : Powerful interactive shell
|
||||
[...]
|
||||
```
|
||||
|
||||
使用 `apt`:
|
||||
|
||||
```
|
||||
$ sudo apt search zsh
|
||||
Sorting... Done
|
||||
Full Text Search... Done
|
||||
csh/stable 20110502-4+deb10u1 amd64
|
||||
Shell with C-like syntax
|
||||
|
||||
ddgr/stable 1.6-1 all
|
||||
DuckDuckGo from the terminal
|
||||
|
||||
direnv/stable 2.18.2-2 amd64
|
||||
Utility to set directory specific environment variables
|
||||
|
||||
draai/stable 20180521-1 all
|
||||
Command-line music player for MPD
|
||||
[...]
|
||||
```
|
||||
|
||||
如果想通过 `apt` 更快的获取相关的搜索结果,你可以使用 [正则表达式][3]:
|
||||
|
||||
```
|
||||
apt search ^zsh
|
||||
Sorting... Done
|
||||
Full Text Search... Done
|
||||
zsh/stable 5.7.1-1 amd64
|
||||
shell with lots of features
|
||||
[...]
|
||||
```
|
||||
|
||||
### 查找应用程序包
|
||||
|
||||
有一些命令是与其它命令捆绑在一起的,都在一个包中。在这种情况下,你可以通过包管理器去了解哪个包提供了你需要的命令。`dnf` 和 `apt` 命令在如何搜索这类元数据上是有区别的。
|
||||
|
||||
使用 `dnf`:
|
||||
|
||||
```
|
||||
$ sudo dnf provides pgrep
|
||||
procps-ng-3.3.15-6.el8.x86_64 : System and process monitoring utilities
|
||||
Repo : baseos
|
||||
Matched from:
|
||||
Filename : /usr/bin/pgrep
|
||||
```
|
||||
|
||||
`apt` 命令使用子命令 `apt-file`。要使用 `apt-file`,你必须先安装它,然后提示它更新缓存:
|
||||
|
||||
```
|
||||
$ sudo apt install apt-file
|
||||
Reading package lists... Done
|
||||
Building dependency tree
|
||||
Reading state information... Done
|
||||
The following additional packages will be installed:
|
||||
libapt-pkg-perl libexporter-tiny-perl liblist-moreutils-perl libregexp-assemble-perl
|
||||
The following NEW packages will be installed:
|
||||
apt-file libapt-pkg-perl libexporter-tiny-perl liblist-moreutils-perl libregexp-assemble-perl
|
||||
0 upgraded, 5 newly installed, 0 to remove and 14 not upgraded.
|
||||
Need to get 297 kB of archives.
|
||||
After this operation, 825 kB of additional disk space will be used.
|
||||
Do you want to continue? [Y/n] y
|
||||
|
||||
$ sudo apt-file update
|
||||
[...]
|
||||
```
|
||||
|
||||
你可以通过 `apt-file` 搜索命令。你可以使用此命令进行广泛的全局搜索,但假如你知道命令的执行路径,它会更准确:
|
||||
|
||||
```
|
||||
$ sudo apt-file search /usr/bin/pgrep
|
||||
pgreplay: /usr/bin/pgreplay
|
||||
procps: /usr/bin/pgrep
|
||||
```
|
||||
|
||||
### 安装应用程序
|
||||
|
||||
使用`apt` 和 `dnf` 安装应用程序基本上是相同的:
|
||||
|
||||
```
|
||||
$ sudo apt install zsh
|
||||
```
|
||||
|
||||
使用 `dnf`,你可以使用同样的方式来安装一个包:
|
||||
|
||||
```
|
||||
$ sudo dnf install zsh
|
||||
```
|
||||
|
||||
许多基于 RPM 的发行版都具有组包安装的特性,它会将有时表面相关的应用程序收集到一个易于安装的目标中。例如,Fedora 中的 [Design Suite][4] 组包就包含流行的创意应用程序。那些想要某一个创意应用程序的艺术家可能也想要类似的应用程序,选择安装一整个组包一个简单而快速的方法,可以合理地开始建立一个数字工作室。你可以通过 `group list` 来查看可用的组包(使用 `-v` 来查看不带空格的组名):
|
||||
|
||||
```
|
||||
$ sudo dnf group list -v
|
||||
[...]
|
||||
Available Groups:
|
||||
Container Management (container-management)
|
||||
RPM Development Tools (rpm-development-tools)
|
||||
Design Suite (design-suite)
|
||||
Development Tools (development)
|
||||
[...]
|
||||
```
|
||||
|
||||
使用 `group install` 子命令安装 RPM 组包:
|
||||
|
||||
```
|
||||
$ sudo dnf group install design-suite
|
||||
```
|
||||
|
||||
你可以使用 `@` 符号来减少输入:
|
||||
|
||||
```
|
||||
$ sudo dnf install @design-suite
|
||||
```
|
||||
|
||||
### 更新应用程序
|
||||
|
||||
使用包管理器的一个优点是,它知道所有已经安装的应用。这样你不必去寻找应用程序的更新版本。相反,你可以通过包管理器去获取更新的版本。
|
||||
|
||||
`dnf` 和 `apt` 使用的子命令略有不同。因为 `apt` 保存了一个需要定期更新的缓存信息,它使用 `upgrade` 子命令来更新应用程序:
|
||||
|
||||
```
|
||||
$ sudo apt upgrade
|
||||
```
|
||||
|
||||
相比之下,`dnf` 命令在你每次使用时都会更新元信息,所以 `update` 和 `upgrade` 子命令是可以互换的:
|
||||
|
||||
```
|
||||
$ sudo dnf upgrade
|
||||
```
|
||||
|
||||
这等同于:
|
||||
|
||||
```
|
||||
$ sudo dnf update
|
||||
```
|
||||
|
||||
### 移除应用程序
|
||||
|
||||
如果你曾经尝试在任何一个平台上手动删除一个应用程序,你就会知道,应用程序删除后,在硬盘上会残留各种文件,比如首选项文件、数据或图标。所以包管理器的另一个优点是,包管理器管理着包中安装的每一个文件,可以很方便的删除:
|
||||
|
||||
```
|
||||
$ sudo dnf remove zsh
|
||||
```
|
||||
|
||||
`remove` 子命令也适用于 `apt`:
|
||||
|
||||
```
|
||||
$ sudo apt remove zsh
|
||||
```
|
||||
|
||||
使用 `apt` 命令删除一个包并不会删除已修改的用户配置文件,以防你意外删除了包。如果你想通过 `apt` 命令删除一个应用及其配置文件,请在你之前删除过的应用程序上使用 `purge` 子命令:
|
||||
|
||||
```
|
||||
$ sudo apt purge zsh
|
||||
```
|
||||
|
||||
`apt` 和 `dnf` 都不会删除家目录中的数据和配置文件(即使使用 `purge` 子命令)。如果想要从家目录中删除数据,你必须手动操作(通常你可以在 `~/.config` 和 `~/.local` 文件中找到)。
|
||||
|
||||
### 了解包管理
|
||||
|
||||
无论你选择的发行版支持的是 `apt` 还是 `dnf`,这些命令的用途大致相同。它们可以帮助你安装、更新和移除包。这两种包管理器是目前最通用的包管理器。它们的语法元素在很大程度上是相同的,所以在两者之间切换非常容易。
|
||||
|
||||
`apt` 和 `dnf` 还有一些高级功能,例如仓库管理,但这些功能并不像你使用 `search` 和 `install` 那样频繁。
|
||||
|
||||
无论你更经常使用哪种包管理器,你都可以下载我们的 [apt 备忘单][5] 和 [dnf 备忘单][6],以便你在最需要的时候可以查询使用语法。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/dnf-vs-apt
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[perfiffer](https://github.com/perfiffer)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out)
|
||||
[2]: https://opensource.com/article/18/1/how-install-apps-linux
|
||||
[3]: https://opensource.com/article/18/5/getting-started-regular-expressions
|
||||
[4]: https://labs.fedoraproject.org/en/design-suite/
|
||||
[5]: https://opensource.com/downloads/apt-cheat-sheet
|
||||
[6]: https://opensource.com/downloads/dnf-cheat-sheet
|
@ -0,0 +1,69 @@
|
||||
[#]: subject: (Ubuntu 20.10 Reached End of Life, Time to Upgrade!)
|
||||
[#]: via: (https://news.itsfoss.com/ubuntu-20-10-end-of-life/)
|
||||
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (zd200572)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13611-1.html)
|
||||
|
||||
Ubuntu 20.10 到达生命终点,该升级啦!
|
||||
======
|
||||
|
||||
> 哦!Ubuntu 20.10 将不再收到任何更新。如果你还在使用它,你的系统将面临风险,请考虑升级到 Ubuntu 21.04!
|
||||
|
||||

|
||||
|
||||
Ubuntu 20.10(Groovy Gorilla)2021 年 7 月 22 日停止支持啦。它是一个非长期支持发行版本,[带来了一些令人兴奋的新特性][1]。
|
||||
|
||||
通常,非长期支持发行版维护 9 个月,所以生命周期结束意味着Ubuntu 20.10 用户将没有安全和维护更新。
|
||||
|
||||
你也会错过已安装应用的更新,[使用 apt 命令][2] 安装新软件也会面临问题。如果不手动修改 `sources.list`(不推荐),使用软件中心也将是个问题。
|
||||
|
||||
支持周期的结束会影响所有的其他 Ubuntu 特色版本,像 Kubuntu、Lubuntu、MATE 等。
|
||||
|
||||
但是像 Linux Mint 和 elementary OS 这样的发行版不依赖于非长期支持发行版,你不必有任何担心。
|
||||
|
||||
使用下面的命令在终端 [检查下你安装的 Ubuntu 版本][3]是个好主意:
|
||||
|
||||
```
|
||||
lsb_release -a
|
||||
```
|
||||
|
||||
### 升级到 Ubuntu 21.04(Hirsute Hippo):正是时候!
|
||||
|
||||
毫无疑问,你需要升级到 Ubuntu 21.04 才能获得最新的更新和安全改进。
|
||||
|
||||
[Ubuntu 21.10 版本][4] 将在几个月后发布,所以你也可以尝试到时升级到这个版本。
|
||||
|
||||
现在,你可以按照我们的 [Ubuntu 升级][5]教程来开始升级。
|
||||
|
||||
我推荐你备份一下,以防升级过程中出现问题。
|
||||
|
||||
如果你想重新安装,也可以。
|
||||
|
||||
### 还在用 Ubuntu 20.10?
|
||||
|
||||
从技术上来说,你可以继续使用不受支持的版本,如果你不想安全问题蔓延,建议还是升级到最新的版本,比如 Ubuntu 21.04。
|
||||
|
||||
Ubuntu 21.04 将会提供支持到 2022 年 1 月,升级前你可能想看下 [Ubuntu 21.04 的特性][6]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/ubuntu-20-10-end-of-life/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[zd200572](https://github.com/zd200572)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/ubuntu-20-10-features/
|
||||
[2]: https://itsfoss.com/apt-command-guide/
|
||||
[3]: https://itsfoss.com/how-to-know-ubuntu-unity-version/
|
||||
[4]: https://news.itsfoss.com/ubuntu-21-10-release-schedule/
|
||||
[5]: https://itsfoss.com/upgrade-ubuntu-version/
|
||||
[6]: https://news.itsfoss.com/ubuntu-21-04-features/
|
@ -1,73 +0,0 @@
|
||||
[#]: subject: (Ubuntu 20.10 Reached End of Life, Time to Upgrade!)
|
||||
[#]: via: (https://news.itsfoss.com/ubuntu-20-10-end-of-life/)
|
||||
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (zd200572)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Ubuntu 20.10 Reached End of Life, Time to Upgrade!
|
||||
======
|
||||
|
||||
Ubuntu 20.10 (Groovy Gorilla) has reached its end of life today (July 22, 2021). It was a non-LTS release that [introduced some exciting features][1].
|
||||
|
||||
Usually, non-LTS releases are maintained for up to 9 months. So, with 20.10 reaching the end of life means there will be no security and maintenance updates for Ubuntu 20.10 users.
|
||||
|
||||
You will also miss out on updates to installed applications, and face issues installing new applications [using the apt command][2]. Using the Software Center is going to be a problem as well, without manually modifying sources.list (which is not recommended).
|
||||
|
||||
The end of life applies to all other Ubuntu flavors like Kubuntu, Lubuntu, MATE, etc.
|
||||
|
||||
While distributions like Linux Mint and elementary OS do not rely on non-LTS releases, you have nothing to worry about there.
|
||||
|
||||
It is also a good idea to [check your Ubuntu version][3] installed with this command in the terminal:
|
||||
|
||||
```
|
||||
lsb_release -a
|
||||
```
|
||||
|
||||
### Upgrade to Ubuntu 21.04 (Hirsute Hippo): It’s Time!
|
||||
|
||||
It is a no-brainer that you need to upgrade to Ubuntu 21.04 to get the latest updates and security improvements.
|
||||
|
||||
[Ubuntu 21.10 release][4] is only a few months later—so you can try upgrading to it when that is available as well.
|
||||
|
||||
For now, you can follow our [Ubuntu upgrade][5] tutorial to get started.
|
||||
|
||||
I would recommend you to make a backup, in case things go bad with the upgrade process.
|
||||
|
||||
If you want to perform a fresh installation, you can do that as well.
|
||||
|
||||
### Still Using Ubuntu 20.10?
|
||||
|
||||
Technically, you can choose to keep using the unsupported version. However, if you do not want security issues to creep up, it is recommended to upgrade to the newest version available i.e Ubuntu 21.04.
|
||||
|
||||
Ubuntu 21.04 will be supported until January 2022. You might want to check out the [features in Ubuntu 21.04][6] before making the jump.
|
||||
|
||||
_How was your experience so far with Ubuntu 20.10? Have you upgraded yet? Let me know in the comments below._
|
||||
|
||||
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||
|
||||
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||
|
||||
I'm not interested
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/ubuntu-20-10-end-of-life/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/ubuntu-20-10-features/
|
||||
[2]: https://itsfoss.com/apt-command-guide/
|
||||
[3]: https://itsfoss.com/how-to-know-ubuntu-unity-version/
|
||||
[4]: https://news.itsfoss.com/ubuntu-21-10-release-schedule/
|
||||
[5]: https://itsfoss.com/upgrade-ubuntu-version/
|
||||
[6]: https://news.itsfoss.com/ubuntu-21-04-features/
|
237
sources/news/20210725 Top 7 Linux Laptops You Can Buy in 2021.md
Normal file
237
sources/news/20210725 Top 7 Linux Laptops You Can Buy in 2021.md
Normal file
@ -0,0 +1,237 @@
|
||||
[#]: subject: (Top 7 Linux Laptops You Can Buy in 2021)
|
||||
[#]: via: (https://news.itsfoss.com/best-linux-laptops-2021/)
|
||||
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Top 7 Linux Laptops You Can Buy in 2021
|
||||
======
|
||||
|
||||
Linux laptops are the perfect alternatives to macOS and Windows-powered laptops.
|
||||
|
||||
Technically, you can turn any laptop of your choice into a Linux machine by choosing to install any Linux distribution available.
|
||||
|
||||
But, here, our focus will be on the laptops that offer Linux out-of-the-box, ensuring the best compatibility and support no matter what kind of budget you have.
|
||||
|
||||
### Linux Laptops by Popular Brands
|
||||
|
||||
It is often the best choice for a consumer to opt for a Linux laptop built by a popular manufacturer.
|
||||
|
||||
You do not have to worry about the after-sales, warranty extensions, and service repairs.
|
||||
|
||||
Dell and Lenovo are usually the ones who provide laptops with Linux pre-installed.
|
||||
|
||||
Do note that everything is subject to availability depending on the country/region.
|
||||
|
||||
*_Pricing mentioned in this article is converted to USD for easy comparison, excluding shipping and other extras._
|
||||
|
||||
#### 1\. Lenovo Thinkpad X1 Carbon (Gen 8 / Gen 9)
|
||||
|
||||
![][1]
|
||||
|
||||
_**Pricing**: Starts at **$1535**_
|
||||
|
||||
The entire Thinkpad series by Lenovo is a popular choice among Linux users. It is built to last and offers good compatibility
|
||||
|
||||
However, it stays on the expensive side.
|
||||
|
||||
You will have three choices to go with depending on what you go for. If you are customizing a Gen 9 Thinkpad laptop, you will have Ubuntu 20.04 and Fedora 33 as your options to have installed.
|
||||
|
||||
For Gen 8 models, it seems that Fedora 33 is off the table, and it is Fedora 32 instead, along with Ubuntu 20.04.
|
||||
|
||||
All the variants are powered by Intel chipsets, 10th gen for Gen 8 and 11th gen for Gen 9.
|
||||
|
||||
Most of the other specifications remain similar with a 14-inch display (FHD, WQHD, and UHD options available), up to 32 GB RAM, 1 TB SSD, fingerprint reader, and Wi-Fi 6 support.
|
||||
|
||||
[Thinkpad X1 Carbon (Gen 9)][2]
|
||||
|
||||
[Thinkpad X1 Carbon (Gen 8)][3]
|
||||
|
||||
#### 2\. Dell XPS 13 Developers Edition
|
||||
|
||||
![][4]
|
||||
|
||||
_**Pricing**: Starts at **$1059**_
|
||||
|
||||
Dell XPS series is an impressive laptop lineup to consider running Linux.
|
||||
|
||||
It has been tailored to run Linux (Ubuntu 20.04) with developers in mind.
|
||||
|
||||
You get a 13.4-inch display (FHD and UHD options available), 11th gen i5/i7 processor, up to 32 GB RAM, 2 TB SSD, fingerprint reader, and Wi-FI 6 support.
|
||||
|
||||
[Dell XPS 13 Developer Edition][5]
|
||||
|
||||
### Laptops by Linux-only Manufacturers
|
||||
|
||||
If you do not want mainstream options but some unique choices to support Linux-only manufacturers in the process, there are a couple of them that you can consider.
|
||||
|
||||
#### 1\. System76 Gazelle
|
||||
|
||||
![][6]
|
||||
|
||||
_**Pricing**: Starts at **$1499**_
|
||||
|
||||
System76’s laptop will come baked in with their Pop!_OS operating system which is based on Ubuntu but provides a **hassle-free out-of-the-box experience**.
|
||||
|
||||
It is safe to assume that System76 is like the Apple of Linux laptops who try their best to optimize Pop!_OS for their hardware offered.
|
||||
|
||||
They have total control over the software and hardware, so that should be some exciting product integration for end consumers.
|
||||
|
||||
Along with impressive essentials like 144 Hz 16.5-inch display, i7 11th gen processor, up to 8 TB NVMe SSD support—you also get an RTX 3050 GPU which should enable you to tackle a variety of demanding tasks on your laptop.
|
||||
|
||||
While there are some other laptops by System76, it was not available at the time of writing this. So, feel free to check out the official store page and order a customized configuration.
|
||||
|
||||
System76 Gazelle
|
||||
|
||||
#### 2\. Purism Laptop
|
||||
|
||||
![][7]
|
||||
|
||||
![][8]
|
||||
|
||||
_**Pricing**: Starts at **$1599**_
|
||||
|
||||
A laptop by Purism can be an option if you are a security-conscious user.
|
||||
|
||||
Librem 14 is one of their latest laptops that comes baked in with [PureOS][9] (also built by them).
|
||||
|
||||
While it may not offer the latest generation processors, you should be fine with the i7 10th Gen chip on board.
|
||||
|
||||
It supports up to 64 GB of RAM and features hardware kill switches to disable the webcam, headphone jack, Bluetooth, or wireless audio
|
||||
|
||||
[Librem 14][10]
|
||||
|
||||
#### 3\. TUXEDO Aura 15
|
||||
|
||||
![][7]
|
||||
|
||||
![][11]
|
||||
|
||||
_**Pricing**: Starts at **$899**_
|
||||
|
||||
If you want an AMD-powered laptop (with its last-gen processor Ryzen 7 4700U), Aura 15 by TUXEDO Computers is a great pick.
|
||||
|
||||
The key specifications include a Full HD display, up to 64 GB RAM, Wi-Fi 6 support, and an LTE module.
|
||||
|
||||
It comes with either Ubuntu or TUXEDO OS (based on Ubuntu Budgie) as per your customization.
|
||||
|
||||
[TUXEDO Aura 15][12]
|
||||
|
||||
#### 4\. TUXEDO Stellaris 15
|
||||
|
||||
![][7]
|
||||
|
||||
![][13]
|
||||
|
||||
_**Pricing**: Starts at **$2160**_
|
||||
|
||||
If you are looking for the latest and greatest powerhouse with options to get RTX 3080 on board, this should be a fantastic option.
|
||||
|
||||
It offers the latest Intel/Ryzen processor with the configuration choices and features a 3K-res display with a 165 Hz refresh rate.
|
||||
|
||||
Definitely not something that you would find convenient to travel with, but if you need the computing power, you can choose to go with it.
|
||||
|
||||
TUXEDO Stellaris 15
|
||||
|
||||
#### 5\. Slimbook Pro X
|
||||
|
||||
![][14]
|
||||
|
||||
_**Pricing:** Starts at **$1105**_
|
||||
|
||||
Slimbook focuses on lighter Laptop models that you can conveniently travel with.
|
||||
|
||||
It gives you the option to choose from a variety of distributions that include Ubuntu (_GNOME, KDE, MATE_), KDE Neon, Manjaro, and Fedora.
|
||||
|
||||
You get most of the essential specifications that include up to 2 TB SSD support, 64 GB of RAM, Full HD IPS display, and more.
|
||||
|
||||
While you get options for Intel and Ryzen (last-gen processors) coupled with Nvidia and Vega graphics respectively, only Ryzen was available in stock at the time of writing this.
|
||||
|
||||
Slimbook Pro X
|
||||
|
||||
#### 6\. Slimbook Essential
|
||||
|
||||
![][1]
|
||||
|
||||
_**Pric**__**ing:** Starts at **$646**_
|
||||
|
||||
An impressive option for a budget-friendly Linux laptop.
|
||||
|
||||
It offers both Ryzen and Intel variants (last-gen) to choose from. You should get the basic specifications that include up to 64 GB RAM, 2 TB SSD support, minus a great screen and dedicated graphics onboard.
|
||||
|
||||
[Slimbook Essential][15]
|
||||
|
||||
#### 7\. Jupiter 14 Pro by Juno Computers
|
||||
|
||||
![][16]
|
||||
|
||||
_**Pricing**: Starts at **$1199**_
|
||||
|
||||
Featuring the 11th gen Intel processors, Jupiter 14 by Juno Computers is a sweet deal with NVIDIA GTX 1650 on board.
|
||||
|
||||
It comes baked in with Ubuntu 20.04 with no other options to choose from.
|
||||
|
||||
The base configuration includes 16 GB RAM, which could make the value offering slightly better compared to some others.
|
||||
|
||||
You will find the ability to choose your region on their website (UK/Europe or US/Canada), make sure to utilize that.
|
||||
|
||||
[Jupiter Pro 14][17]
|
||||
|
||||
#### Honorable Mention: **PineBook Pro**
|
||||
|
||||
![][18]
|
||||
|
||||
PineBook Pro is an ARM-based laptop (with Manjaro ARM edition) that is budget-friendly and should work fine for a lot of basic tasks on Linux.
|
||||
|
||||
It is out of stock (until further notice) at the time of writing this. However, you might want to check that for yourself when you read this.
|
||||
|
||||
[Pinebook Pro][19]
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
If you do not like the choices presented here, you may check out [other places from where you can by Linux laptops][20]. Depending on your budget, pick what you feel is best for you.
|
||||
|
||||
After all, everything comes with Linux baked in. Some give you the ability to choose from multiple distros but most of them stick to Ubuntu pre-installed.
|
||||
|
||||
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||
|
||||
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||
|
||||
I'm not interested
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/best-linux-laptops-2021/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQzOSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[2]: https://www.lenovo.com/us/en/laptops/thinkpad/thinkpad-x1/X1-Carbon-G9/p/22TP2X1X1C9
|
||||
[3]: https://www.lenovo.com/us/en/laptops/thinkpad/thinkpad-x1/X1-Carbon-Gen-8-/p/22TP2X1X1C8
|
||||
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ3MiIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[5]: https://www.dell.com/en-us/work/shop/dell-laptops-and-notebooks/new-xps-13-developer-edition/spd/xps-13-9310-laptop/ctox139w10p2c3000u
|
||||
[6]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjU0MCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[7]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9Ijc4MCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[8]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/07/librem14.png?resize=780%2C780&ssl=1
|
||||
[9]: https://www.pureos.net
|
||||
[10]: https://puri.sm/products/librem-14/
|
||||
[11]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/07/tuxedo-aura-15.jpg?resize=780%2C780&ssl=1
|
||||
[12]: https://www.tuxedocomputers.com/en/Linux-Hardware/Linux-Notebooks/15-16-inch/TUXEDO-Aura-15-Gen1.tuxedo
|
||||
[13]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/07/tuxedo-stellaris.jpg?resize=780%2C780&ssl=1
|
||||
[14]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQyMyIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[15]: https://slimbook.es/en/essential-en
|
||||
[16]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ2OCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[17]: https://junocomputers.com/us/product/jupiter-14-pro/
|
||||
[18]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ0MSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[19]: https://www.pine64.org/pinebook-pro/
|
||||
[20]: https://itsfoss.com/get-linux-laptops/
|
@ -0,0 +1,75 @@
|
||||
[#]: subject: (GitLab’s New Open Source Tool Will Detect Malicious Code)
|
||||
[#]: via: (https://news.itsfoss.com/gitlab-open-source-tool-malicious-code/)
|
||||
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
GitLab’s New Open Source Tool Will Detect Malicious Code
|
||||
======
|
||||
|
||||
There are several open-source tools available for security researchers. Now, GitLab has introduced a new one to the arsenal that lets you detect malicious code in dependencies.
|
||||
|
||||
The tool is also known as “Package Hunter” and is an important addition that could help secure every type of software.
|
||||
|
||||
### What is Package Hunter?
|
||||
|
||||
Every software includes some form of dependencies, which makes it possible for a developer to quickly build an app.
|
||||
|
||||
While this facilitates the reuse of code to achieve the task, they often just “trust” the dependencies used without separate review.
|
||||
|
||||
Package Hunter comes to the rescue here and lets you easily detect malicious code in a dependency package.
|
||||
|
||||
### Enhanching Software Supply Chain Security
|
||||
|
||||
Many supply chain attacks involve a compromised dependency package.
|
||||
|
||||
Normally, the attacker injects malicious code in the dependency code available to the public or creates a separate private repository to distribute the malicious dependency that looks safe.
|
||||
|
||||
Even if you are using a package manager to get trusted packages, it can be tricked to download packages from a private repository. And, you will have no idea about it.
|
||||
|
||||
Hence, with an additional check to the supply chain which is as convenient as Package Hunter, the software supply chain security should improve.
|
||||
|
||||
And, especially, if the open-source supply chain security improves, [open source software security][1] will gradually get a boost as well.
|
||||
|
||||
### How Does it Work? How Can You Get it?
|
||||
|
||||
Package Hunter scans for malicious code and keeps an eye on unexpected behavior of the dependencies.
|
||||
|
||||
It installs the dependencies in a sandbox environment to monitor and detect any anomalies.
|
||||
|
||||
As of now, it supports testing NodeJS modules and Ruby Jems.
|
||||
|
||||
GitLab has been using the tool internally for a while. And, now, it seamlessly integrates with GitLab.
|
||||
|
||||
You can learn more about setting it up by referring to the [official documentation][2] and the [Package Hunter CLI instructions][3].
|
||||
|
||||
It is available as a free and open-source project on [GitLab][4].
|
||||
|
||||
_What do you think about GitLab’s open-source tool to help detect malicious code? Feel free to share your thoughts in the comments below._
|
||||
|
||||
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||
|
||||
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||
|
||||
I'm not interested
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/gitlab-open-source-tool-malicious-code/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://news.itsfoss.com/open-source-software-security/
|
||||
[2]: https://gitlab.com/gitlab-org/security-products/package-hunter/-/blob/main/README.md
|
||||
[3]: https://gitlab.com/gitlab-org/security-products/package-hunter-cli/-/blob/main/README.md#gitlab-ci
|
||||
[4]: https://gitlab.com/gitlab-org/security-products/package-hunter/activity
|
@ -0,0 +1,90 @@
|
||||
[#]: subject: (Avoid this common open source scanning error)
|
||||
[#]: via: (https://opensource.com/article/21/7/open-source-scanning-error)
|
||||
[#]: author: (Jeffrey Robert Kaufman https://opensource.com/users/jkaufman)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Avoid this common open source scanning error
|
||||
======
|
||||
Why do source-code scanners sometimes report incorrect license
|
||||
information?
|
||||
![Target practice][1]
|
||||
|
||||
[Pete Townshend][2], legendary guitar player for British rock band The Who, is well-known for playing suspended chords. Suspended chords add musical tension to a song. For those piano players reading this who (like me) love to play in the key of C, simply play a C major chord (the notes C, E, and G) and replace the E note with either an F or a D. You are now on your way to becoming a British rock star![1][3]
|
||||
|
||||
Music is often filled with combinations of chords, like suspended chords, that provide tension, then release. Although adding tension to a musical composition is desirable, adding tension to scanning software with open source tools is certainly unwelcome.
|
||||
|
||||
An issue at Red Hat involving scanning software led me to write this article.
|
||||
|
||||
Recently, an important customer raised a concern after scanning some of our software's source code. As you may know, Red Hat provides the source code of its software. The customer's scanning tool reported that a certain software file was licensed under the GPLv3, which was not expected. In fact, the software file was explicitly and solely marked as being licensed under the Apache 2.0 license. The customer requested that we look into this issue, and we were happy to do so.
|
||||
|
||||
After our in-depth research, we concluded that their scanning software is clearly incorrect. We developed a hypothesis that explains the anomaly, which I will now explain.
|
||||
|
||||
A popular type of open source software scanning tool compares the software being scanned to vast repositories of preexisting open source software and reports any matches. For example, assume there is an open source file named MIT.c that returns an integer one higher than the integer passed to it. In other words, it is a simple adder. It could look like this:
|
||||
|
||||
|
||||
```
|
||||
Copyright 2021 Jeffrey R. Kaufman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
int foo(int x) {
|
||||
x+=1;
|
||||
return x;
|
||||
}
|
||||
```
|
||||
|
||||
For this hypothetical example, assume that MIT.c was placed in a GitHub repository named The Simple Maths Project as an open source community-based project for solving simple arithmetic problems. This project contains many other similar C language files, all under the same MIT License.
|
||||
|
||||
Since this hypothetical example function is so useful (of course it isn't, but stay with me here), it was included to provide simple arithmetic utility in many other open source projects on GitHub. Also, assume that one of these other projects, named The Sustained Chord Calculator, uses this MIT.c source file from The Simple Maths Project to help calculate the musical formulation for suspended chords.
|
||||
|
||||
The hypothetical Suspended Chord Calculator project, in addition to using MIT.c, also includes several source files licensed under GPLv2. When The Suspended Chord Calculator project is compiled, you can assume the resulting executable will contain both GPLv2-licensed software and the MIT-licensed MIT.c as one combined work in such a way that MIT.c cannot be reasonably considered independent and a separate work in itself. That resulting executable would rightly be considered licensed under the GPLv2, and the obligations of the GPLv2 must be complied with. Compliance means providing (or offering to provide for three years) all of the sources used to create the binary or executable, including all the software files licensed under GPLv2 and MIT.c.
|
||||
|
||||
Moving back to our problem…
|
||||
|
||||
Suppose one of your software products uses MIT.c, in addition to your own authored software. Since MIT.c is solely under the MIT License, this would obligate you to comply with only the MIT License terms, which is easy to do. Typically, people comply by providing a copy of the MIT License along with the copyright notice with their software distribution. Or, if you are a company like Red Hat, providing the source code that contains the license text is also a method of compliance—and my recommended approach. (See [_An economically efficient model for open source software license compliance_][4].)
|
||||
|
||||
If you decide to scan the source code of your software product using a source-code scanner of the type that references repositories of open source projects, your scanner may likely report that MIT.c is licensed under the GPLv2! Why? Because it will see MIT.c, in source-code form, associated with The Suspended Chord Calculator project licensed under the GPLv2 and assume, naively, that MIT.c also must be subject to GPLv2 terms. This is notwithstanding that the MIT.c source file is clearly marked with an MIT License, and you copied it only from the original MIT-licensed The Simple Maths Project.
|
||||
|
||||
This is an unfortunate consequence of using these types of scanning systems. In this example, such systems will erroneously report generally every single open source project in its repository that uses MIT.c. There could be tens, hundreds, or even thousands of programs that use MIT.c, all under different licenses, and you will be provided with a giant stack of projects to review indicating that MIT.c could be MIT licensed, BSD licensed, GPLv2 licensed, or, frankly, carry any other open source license under the sun from a project that just happens to use MIT.c. And in the end, you will discover that the file was solely under MIT.c. In my experience, there are very few situations where this type of scanning is warranted and, even when it is justifiable, that the file license results are something other than you expected. It happens, but it is rare.
|
||||
|
||||
There is another type of software scanning system that reports on licensing by looking only for matches to known license texts in the source files of the project. This type of scanner would detect the MIT License text in the source code and correctly report that the software is subject to the terms of the MIT License, notwithstanding the fact that MIT.c may be used in many other open source projects under varying license terms. Although this type of source-code scanner can also have false positives, in my experience, source-code scanners of the type that reference repositories of open source projects have significantly higher rates of misreporting for the reasons discussed previously.
|
||||
|
||||
Frankly, source-code scanners that reference repositories of open source software to ascertain license data can be useful in certain situations, such as when you may be hyper concerned that an engineer has inadvertently copied and pasted source code from an unacceptable license without also copying over the applicable license text. In that situation, a source-code scanner of the type that looks only for matches to license texts would not detect that inclusion. However, as I stated before, this situation is exceptionally rare, making repository-matching source-code scanners prone to errors and a waste of resources for tracking down the truth. This is time and resources that could be devoted to more issues of substance. You can also address this situation by training your developers to never copy software from another source without also copying over any applicable license.
|
||||
|
||||
A scanner that reports the incorrect license is doing a tremendous disservice to your organization by requiring you to resolve a false positive. Countless hours of wasted resources are devoted to these wild-goose chases…as our customer experienced.
|
||||
|
||||
We won't be fooled again!
|
||||
|
||||
* * *
|
||||
|
||||
_I want to thank my colleague Richard Fontana for suggesting the title of this article. Read some of his great articles on Opensource.com under the [Law section][5]._
|
||||
|
||||
1\. If you want to learn more about music theory and suspended chords, check out Rick Beato's analysis of another great track from The Who at [What Makes This Song Great?™ Ep. 96 The Who][6].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/open-source-scanning-error
|
||||
|
||||
作者:[Jeffrey Robert Kaufman][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jkaufman
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/target-security.png?itok=Ca5-F6GW (Target practice)
|
||||
[2]: https://en.wikipedia.org/wiki/Pete_Townshend
|
||||
[3]: tmp.K7c2OyIB7H#1
|
||||
[4]: https://opensource.com/article/17/9/economically-efficient-model
|
||||
[5]: https://opensource.com/tags/law
|
||||
[6]: https://www.bing.com/videos/search?q=rick+biato+what+makes+this+song+great+who&view=detail&mid=BBF5E938C3E5AD6D73BCBBF5E938C3E5AD6D73BC&FORM=VIRE
|
@ -1,210 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (YungeG)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Trace code in Fedora with bpftrace)
|
||||
[#]: via: (https://fedoramagazine.org/trace-code-in-fedora-with-bpftrace/)
|
||||
[#]: author: (Augusto Caringi https://fedoramagazine.org/author/acaringi/)
|
||||
|
||||
Trace code in Fedora with bpftrace
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
bpftrace is [a new eBPF-based tracing tool][2] that was first included in Fedora 28. It was developed by Brendan Gregg, Alastair Robertson and Matheus Marchini with the help of a loosely-knit team of hackers across the Net. A tracing tool lets you analyze what a system is doing behind the curtain. It tells you which functions in code are being called, with which arguments, how many times, and so on.
|
||||
|
||||
This article covers some basics about bpftrace, and how it works. Read on for more information and some useful examples.
|
||||
|
||||
### eBPF (extended Berkeley Packet Filter)
|
||||
|
||||
[eBPF][3] is a tiny virtual machine, or a virtual CPU to be more precise, in the Linux Kernel. The eBPF can load and run small programs in a safe and controlled way in kernel space. This makes it safer to use, even in production systems. This virtual machine has its own instruction set architecture ([ISA][4]) resembling a subset of modern processor architectures. The ISA makes it easy to translate those programs to the real hardware. The kernel performs just-in-time translation to native code for main architectures to improve the performance.
|
||||
|
||||
The eBPF virtual machine allows the kernel to be extended programmatically. Nowadays several kernel subsystems take advantage of this new powerful Linux Kernel capability. Examples include networking, seccomp, tracing, and more. The main idea is to attach eBPF programs into specific code points, and thereby extend the original kernel behavior.
|
||||
|
||||
eBPF machine language is very powerful. But writing code directly in it is extremely painful, because it’s a low level language. This is where bpftrace comes in. It provides a high-level language to write eBPF tracing scripts. The tool then translates these scripts to eBPF with the help of clang/LLVM libraries, and then attached to the specified code points.
|
||||
|
||||
## Installation and quick start
|
||||
|
||||
To install bpftrace, run the following command in a terminal [using][5] _[sudo][5]_:
|
||||
|
||||
```
|
||||
$ sudo dnf install bpftrace
|
||||
```
|
||||
|
||||
Try it out with a “hello world” example:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 'BEGIN { printf("hello world\n"); }'
|
||||
```
|
||||
|
||||
Note that you must run _bpftrace_ as _root_ due to the privileges required. Use the _-e_ option to specify a program, and to construct the so-called “one-liners.” This example only prints _hello world_, and then waits for you to press **Ctrl+C**.
|
||||
|
||||
_BEGIN_ is a special probe name that fires only once at the beginning of execution. Every action inside the curly braces _{ }_ fires whenever the probe is hit — in this case, it’s just a _printf_.
|
||||
|
||||
Let’s jump now to a more useful example:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 't:syscalls:sys_enter_execve { printf("%s called %s\n", comm, str(args->filename)); }'
|
||||
```
|
||||
|
||||
This example prints the parent process name _(comm)_ and the name of every new process being created in the system. _t:syscalls:sys_enter_execve_ is a kernel tracepoint. It’s a shorthand for _tracepoint:syscalls:sys_enter_execve_, but both forms can be used. The next section shows you how to list all available tracepoints.
|
||||
|
||||
_comm_ is a bpftrace builtin that represents the process name. _filename_ is a field of the _t:syscalls:sys_enter_execve_ tracepoint. You can access these fields through the _args_ builtin.
|
||||
|
||||
All available fields of the tracepoint can be listed with this command:
|
||||
|
||||
```
|
||||
bpftrace -lv "t:syscalls:sys_enter_execve"
|
||||
```
|
||||
|
||||
## Example usage
|
||||
|
||||
### Listing probes
|
||||
|
||||
A central concept for _bpftrace_ are **probe points**. Probe points are instrumentation points in code (kernel or userspace) where eBPF programs can be attached. They fit into the following categories:
|
||||
|
||||
* _kprobe_ – kernel function start
|
||||
* _kretprobe_ – kernel function return
|
||||
* _uprobe_ – user-level function start
|
||||
* _uretprobe_ – user-level function return
|
||||
* _tracepoint_ – kernel static tracepoints
|
||||
* _usdt_ – user-level static tracepoints
|
||||
* _profile_ – timed sampling
|
||||
* _interval_ – timed output
|
||||
* _software_ – kernel software events
|
||||
* _hardware_ – processor-level events
|
||||
|
||||
|
||||
|
||||
All available _kprobe/kretprobe_, _tracepoints_, _software_ and _hardware_ probes can be listed with this command:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -l
|
||||
```
|
||||
|
||||
The _uprobe/uretprobe_ and _usdt_ probes are userspace probes specific to a given executable. To use them, use the special syntax shown later in this article.
|
||||
|
||||
The _profile_ and _interval_ probes fire at fixed time intervals. Fixed time intervals are not covered in this article.
|
||||
|
||||
### Counting system calls
|
||||
|
||||
**Maps** are special BPF data types that store counts, statistics, and histograms. You can use maps to summarize how many times each syscall is being called:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 't:syscalls:sys_enter_* { @[probe] = count(); }'
|
||||
```
|
||||
|
||||
Some probe types allow wildcards to match multiple probes. You can also specify multiple attach points for an action block using a comma separated list. In this example, the action block attaches to all tracepoints whose name starts with _t:syscalls:sys_enter__, which means all available syscalls.
|
||||
|
||||
The bpftrace builtin function _count()_ counts the number of times this function is called. _@[]_ represents a map (an associative array). The key of this map is _probe_, which is another bpftrace builtin that represents the full probe name.
|
||||
|
||||
Here, the same action block is attached to every syscall. Then, each time a syscall is called the map will be updated, and the entry is incremented in the map relative to this same syscall. When the program terminates, it automatically prints out all declared maps.
|
||||
|
||||
This example counts the syscalls called globally, it’s also possible to filter for a specific process by _PID_ using the bpftrace filter syntax:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 't:syscalls:sys_enter_* / pid == 1234 / { @[probe] = count(); }'
|
||||
```
|
||||
|
||||
### Write bytes by process
|
||||
|
||||
Using these concepts, let’s analyze how many bytes each process is writing:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 't:syscalls:sys_exit_write /args->ret > 0/ { @[comm] = sum(args->ret); }'
|
||||
```
|
||||
|
||||
_bpftrace_ attaches the action block to the write syscall return probe (_t:syscalls:sys_exit_write_). Then, it uses a filter to discard the negative values, which are error codes _(/args->ret > 0/)_.
|
||||
|
||||
The map key _comm_ represents the process name that called the syscall. The _sum()_ builtin function accumulates the number of bytes written for each map entry or process. _args_ is a bpftrace builtin to access tracepoint’s arguments and return values. Finally, if successful, the _write_ syscall returns the number of written bytes. _args->ret_ provides access to the bytes.
|
||||
|
||||
### Read size distribution by process (histogram):
|
||||
|
||||
_bpftrace_ supports the creation of histograms. Let’s analyze one example that creates a histogram of the _read_ size distribution by process:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 't:syscalls:sys_exit_read { @[comm] = hist(args->ret); }'
|
||||
```
|
||||
|
||||
Histograms are BPF maps, so they must always be attributed to a map (_@_). In this example, the map key is _comm_.
|
||||
|
||||
The example makes _bpftrace_ generate one histogram for every process that calls the _read_ syscall. To generate just one global histogram, attribute the _hist()_ function just to _‘@’_ (without any key).
|
||||
|
||||
bpftrace automatically prints out declared histograms when the program terminates. The value used as base for the histogram creation is the number of read bytes, found through _args->ret_.
|
||||
|
||||
### Tracing userspace programs
|
||||
|
||||
You can also trace userspace programs with _uprobes/uretprobes_ and _USDT_ (User-level Statically Defined Tracing). The next example uses a _uretprobe_, which probes to the end of a user-level function. It gets the command lines issued in every _bash_ running in the system:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 'uretprobe:/bin/bash:readline { printf("readline: \"%s\"\n", str(retval)); }'
|
||||
```
|
||||
|
||||
To list all available _uprobes/uretprobes_ of the _bash_ executable, run this command:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -l "uprobe:/bin/bash"
|
||||
```
|
||||
|
||||
_uprobe_ instruments the beginning of a user-level function’s execution, and _uretprobe_ instruments the end (its return). _readline()_ is a function of _/bin/bash_, and it returns the typed command line. _retval_ is the return value for the instrumented function, and can only be accessed on _uretprobe_.
|
||||
|
||||
When using _uprobes_, you can access arguments with _arg0..argN_. A _str()_ call is necessary to turn the _char *_ pointer to a _string_.
|
||||
|
||||
## Shipped Scripts
|
||||
|
||||
There are many useful scripts shipped with bpftrace package. You can find them in the _/usr/share/bpftrace/tools/_ directory.
|
||||
|
||||
Among them, you can find:
|
||||
|
||||
* _killsnoop.bt_ – Trace signals issued by the kill() syscall.
|
||||
* _tcpconnect.bt_ – Trace all TCP network connections.
|
||||
* _pidpersec.bt_ – Count new procesess (via fork) per second.
|
||||
* _opensnoop.bt_ – Trace open() syscalls.
|
||||
* _vfsstat.bt_ – Count some VFS calls, with per-second summaries.
|
||||
|
||||
|
||||
|
||||
You can directly use the scripts. For example:
|
||||
|
||||
```
|
||||
$ sudo /usr/share/bpftrace/tools/killsnoop.bt
|
||||
```
|
||||
|
||||
You can also study these scripts as you create new tools.
|
||||
|
||||
## Links
|
||||
|
||||
* bpftrace reference guide – <https://github.com/iovisor/bpftrace/blob/master/docs/reference_guide.md>
|
||||
* bpftrace (DTrace 2.0) for Linux 2018 – <http://www.brendangregg.com/blog/2018-10-08/dtrace-for-linux-2018.html>
|
||||
* BPF: the universal in-kernel virtual machine – <https://lwn.net/Articles/599755/>
|
||||
* Linux Extended BPF (eBPF) Tracing Tools – <http://www.brendangregg.com/ebpf.html>
|
||||
* Dive into BPF: a list of reading material – [https://qmonnet.github.io/whirl-offload/2016/09/01/dive-into-bpf][6]
|
||||
|
||||
|
||||
|
||||
* * *
|
||||
|
||||
_Photo by _[_Roman Romashov_][7]_ on _[_Unsplash_][8]_._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/trace-code-in-fedora-with-bpftrace/
|
||||
|
||||
作者:[Augusto Caringi][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/acaringi/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/bpftrace-816x345.jpg
|
||||
[2]: https://github.com/iovisor/bpftrace
|
||||
[3]: https://lwn.net/Articles/740157/
|
||||
[4]: https://github.com/iovisor/bpf-docs/blob/master/eBPF.md
|
||||
[5]: https://fedoramagazine.org/howto-use-sudo/
|
||||
[6]: https://qmonnet.github.io/whirl-offload/2016/09/01/dive-into-bpf/
|
||||
[7]: https://unsplash.com/@wehavemegapixels?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[8]: https://unsplash.com/search/photos/trace?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
@ -2,7 +2,7 @@
|
||||
[#]: via: (https://opensource.com/article/21/4/linux-cheat-sheets)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (YungeG)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -2,7 +2,7 @@
|
||||
[#]: via: (https://opensource.com/article/21/5/linux-security-tools)
|
||||
[#]: author: (Peter Gervase https://opensource.com/users/pgervase)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,136 +0,0 @@
|
||||
[#]: subject: (What is XML?)
|
||||
[#]: via: (https://opensource.com/article/21/7/what-xml)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (amwps290)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
What is XML?
|
||||
======
|
||||
Get to know XML, a strict yet flexible markup language used for
|
||||
everything from documentation to graphics.
|
||||
![Computer screen with files or windows open][1]
|
||||
|
||||
XML is a hierarchical markup language. It uses opening and closing tags to define data. It's used to store and exchange data, and because of its extreme flexibility, it's used for everything from [documentation][2] to [graphics][3].
|
||||
|
||||
Here's a sample XML document:
|
||||
|
||||
|
||||
```
|
||||
<xml>
|
||||
<os>
|
||||
<linux>
|
||||
<distribution>
|
||||
<name>Fedora</name>
|
||||
<release>8</release>
|
||||
<codename>Werewolf</codename>
|
||||
</distribution>
|
||||
|
||||
<distribution>
|
||||
<name>Slackware</name>
|
||||
<release>12.1</release>
|
||||
<mascot>
|
||||
<official>Tux</official>
|
||||
<unofficial>Bob Dobbs</unofficial>
|
||||
</mascot>
|
||||
</distribution>
|
||||
</linux>
|
||||
</os>
|
||||
</xml>
|
||||
```
|
||||
|
||||
Reading the sample XML, you might find there's an intuitive quality to the format. You can probably understand the data in this document whether you're familiar with the subject matter or not. This is partly because XML is considered verbose. It uses lots of tags, the tags can have long and descriptive names, and the data is ordered in a hierarchical manner that helps explain the data's relationships. You probably understand from this sample that the Fedora distribution and the Slackware distribution are two different and unrelated instances of Linux because each one is "contained" inside its own independent `<distribution>` tag.
|
||||
|
||||
XML is also extremely flexible. Unlike HTML, there's no predefined list of tags. You are free to create whatever data structure you need to represent.
|
||||
|
||||
### Components of XML
|
||||
|
||||
Data exists to be read, and when a computer "reads" data, the process is called _parsing_. Using the sample XML data again, here are the terms that most XML parsers consider significant.
|
||||
|
||||
* **Document:** The `<xml>` tag opens a _document_, and the `</xml>` tag closes it.
|
||||
* **Node:** The `<os>`, `<distribution>`, and `<mascot>` are _nodes_. In parsing terminology, a node is a tag that contains other tags.
|
||||
* **Element:** An entity such as `<name>Fedora</name>` and `<official>Tux</official>`, from the first `<` to the last `>` is an _element_.
|
||||
* **Content:** The data between two element tags is considered _content_. In the first `<name>` element, the string `Fedora` is the content.
|
||||
|
||||
|
||||
|
||||
### XML schema
|
||||
|
||||
Tags and tag inheritance in an XML document are known as _schema_.
|
||||
|
||||
Some schemas are made up as you go (for example, the sample XML code in this article was purely improvised), while others are strictly defined by a standards group. For example, the Scalable Vector Graphics (SVG) schema is [defined by the W3C][4], while the [DocBook schema][5] is defined by Norman Walsh.
|
||||
|
||||
A schema enforces consistency. The most basic schemas are usually also the most restrictive. In my example XML code, it wouldn't make sense to place a distribution name within the `<mascot>` node because the implied schema of the document makes it clear that a mascot must be a "child" element of a distribution.
|
||||
|
||||
### Data object model (DOM)
|
||||
|
||||
Talking about XML would get confusing if you had to constantly describe tags and positions (e.g., "the name tag of the second distribution tag in the Linux part of the OS section"), so parsers use the concept of a Document Object Model (DOM) to represent XML data. The DOM places XML data into a sort of "family tree" structure, starting from the root element (in my sample XML, that's the `os` tag) and including each tag.
|
||||
|
||||
![Document Object Model][6]
|
||||
|
||||
(Seth Kenlon, [CC BY-SA 4.0][7])
|
||||
|
||||
This same XML data structure can be expressed as paths, just like files in a Linux system or the location of web pages on the internet. For instance, the path to the `<mascot>` tag can be represented as `//os/linux/distribution/slackware/mascot`.
|
||||
|
||||
The path to _both_ `<distribution>` tags can be represented as `//os/linux/distribution`. Because there are two distribution nodes, a parser loads both nodes (and the contents of each) into an array that can be queried.
|
||||
|
||||
### Strict XML
|
||||
|
||||
XML is also known for being strict. This means that most applications are designed to intentionally fail when they encounter errors in XML. That may sound problematic, but it's one of the things developers appreciate most about XML because unpredictable things can happen when applications try to guess how to resolve an error. For example, back before HTML was well defined, most web browsers included a "quirks mode" so that when people tried to view poor HTML code, the web browser could load what the author _probably_ intended. The results were wildly unpredictable, especially when one browser guessed differently than another.
|
||||
|
||||
XML disallows this by intentionally failing when there's an error. This lets the author fix errors until they produce valid XML. Because XML is well-defined, there are validator plugins for many applications and standalone commands like `xmllint` and `xmlstarlet` to help you locate errors early.
|
||||
|
||||
### Transforming XML
|
||||
|
||||
Because XML is often used as an interchange format, it's common to transform XML into some other data format or into some other XML schema. Classic examples include XSLTProc, xmlto, and [pandoc][8], but technically there are many other applications designed, at least in part, to convert XML.
|
||||
|
||||
In fact, LibreOffice uses XML to layout its word processor and spreadsheet documents, so any time you export or [convert a file from LibreOffice][9], you're transforming XML.
|
||||
|
||||
[Ebooks in the open source EPUB format][10] use XML, so any time you [convert a document into an EPUB][11] or from an EPUB, you're transforming XML.
|
||||
|
||||
Inkscape, the vector-based illustration application, saves its files in SVG, which is an XML schema designed for graphics. Any time you export an image from Inkscape as a PNG file, you're transforming XML.
|
||||
|
||||
The list could go on and on. XML is a data storage format, and it's designed to ensure that your data, whether it's points and lines on a canvas, nodes on a chart, or just words in a document, can be easily and accurately extracted, updated, and converted.
|
||||
|
||||
### Learning XML
|
||||
|
||||
Writing XML is a lot like writing HTML. Thanks to the hard work of Jay Nick, [free and fun XML lessons are available online][3] that teach you how to create graphics with XML.
|
||||
|
||||
In general, very few special tools are required to explore XML. Thanks to the close relationship between HTML and XML, you can [view XML using a web browser][12]. In addition, open source text editors like [QXmlEdit][13], [NetBeans][14], and [Kate][15] make typing and reading XML easy with helpful prompts, autocompletion, syntax verification, and more.
|
||||
|
||||
### Choose XML
|
||||
|
||||
XML may look like a lot of data at first, but it's not that much different than HTML (in fact, HTML has been [reimplemented as XML in the form of XHTML][16]). XML has the unique benefit that the components forming its structure also happen to be metadata providing information about what it's storing. A well-designed XML schema contains and describes your data, allowing a user to understand it at a glance and parse it quickly, and enabling developers to [parse it efficiently][17] with convenient programming libraries.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/what-xml
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open)
|
||||
[2]: https://opensource.com/article/17/9/docbook
|
||||
[3]: https://opensource.com/article/17/5/coding-scalable-vector-graphics-make-steam
|
||||
[4]: https://www.w3.org/TR/SVG11/
|
||||
[5]: http://docbook.org
|
||||
[6]: https://opensource.com/sites/default/files/uploads/dom.jpg (Document Object Model)
|
||||
[7]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[8]: https://opensource.com/article/20/5/pandoc-cheat-sheet
|
||||
[9]: https://opensource.com/article/21/3/libreoffice-command-line
|
||||
[10]: https://opensource.com/education/15/11/ebook-open-formats
|
||||
[11]: https://opensource.com/life/13/8/how-create-ebook-open-source-way
|
||||
[12]: https://opensource.com/article/18/12/xml-browser
|
||||
[13]: https://opensource.com/article/17/7/7-ways-handle-xml-qxmledit
|
||||
[14]: https://opensource.com/article/20/12/netbeans
|
||||
[15]: https://opensource.com/article/20/12/kate-text-editor
|
||||
[16]: https://www.w3.org/TR/xhtml1/
|
||||
[17]: https://opensource.com/article/21/6/parsing-config-files-java
|
@ -2,7 +2,7 @@
|
||||
[#]: via: (https://opensource.com/article/21/7/rust-tools-linux)
|
||||
[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (amwps290 )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -2,7 +2,7 @@
|
||||
[#]: via: (https://www.debugpoint.com/2021/07/install-shutter-fedora/)
|
||||
[#]: author: (Arindam https://www.debugpoint.com/author/admin1/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,119 +0,0 @@
|
||||
[#]: subject: (Run a Linux virtual machine in Podman)
|
||||
[#]: via: (https://opensource.com/article/21/7/linux-podman)
|
||||
[#]: author: (Sumantro Mukherjee https://opensource.com/users/sumantro)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Run a Linux virtual machine in Podman
|
||||
======
|
||||
Use Podman Machine to create a basic Fedora CoreOS VM to use with
|
||||
containers and containerized workloads.
|
||||
![woman on laptop sitting at the window][1]
|
||||
|
||||
Fedora CoreOS is an automatically updating, minimal [rpm-ostree][2]-based operating system for running containerized workloads securely and at scale.
|
||||
|
||||
[Podman][3] "is a tool for managing containers and images, volumes mounted into those containers, and pods made from groups of containers. Podman is based on libpod, a library for container lifecycle management."
|
||||
|
||||
Magical things happen when you use [Podman Machine][4], a feature that helps you create a basic Fedora CoreOS virtual machine (VM) to use with containers and containerized workloads.
|
||||
|
||||
### Getting started with Podman Machine
|
||||
|
||||
The first step is to install Podman. If you already have the latest version of Podman installed, you can skip the step. On my Fedora 34 machine, I installed Podman with:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install podman`
|
||||
```
|
||||
|
||||
I'm using podman-3.2.2-1.fc34.x86_64.
|
||||
|
||||
### Initializing a Fedora CoreOS
|
||||
|
||||
Once Podman is installed, initialize it with:
|
||||
|
||||
|
||||
```
|
||||
❯ podman machine init vm2
|
||||
Downloading VM image: fedora-coreos-34.20210626.1.0-qemu.x86_64.qcow2.xz: done
|
||||
Extracting compressed file
|
||||
```
|
||||
|
||||
This command creates `vm2` and downloads Fedora CoreOS's qcow2 file in .xz format and extracts it.
|
||||
|
||||
### Listing your VMs
|
||||
|
||||
It's always important to know your VMs and their status, and the `list` command helps with that. The following example shows the names of all my VMs, the date they were created, and the last time they were up:
|
||||
|
||||
|
||||
```
|
||||
❯ podman machine list
|
||||
NAME VM TYPE CREATED LAST UP
|
||||
podman-machine-default* qemu 6 days ago Currently running
|
||||
vm2 qemu 11 minutes ago 11 minutes ago
|
||||
```
|
||||
|
||||
### Starting a VM
|
||||
|
||||
To start a VM, run:
|
||||
|
||||
|
||||
```
|
||||
❯ podman machine start
|
||||
Waiting for VM …
|
||||
```
|
||||
|
||||
### SSHing into the VM
|
||||
|
||||
You can use secure shell (SSH) to access your VM and use it to run workloads without any setup hassles:
|
||||
|
||||
|
||||
```
|
||||
❯ podman machine ssh
|
||||
Connecting to vm podman-machine-default. To close connection, use `~.` or `exit`
|
||||
Fedora CoreOS 34.20210611.1.0
|
||||
Tracker: <https://github.com/coreos/fedora-coreos-tracker>
|
||||
Discuss: <https://discussion.fedoraproject.org/c/server/coreos/>
|
||||
|
||||
Last login: Wed Jun 23 13:23:36 2021 from 10.0.2.2
|
||||
[core@localhost ~]$ uname -a
|
||||
Linux localhost 5.12.9-300.fc34.x86_64 #1 SMP Thu Jun 3 13:51:40 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
|
||||
[core@localhost ~]$
|
||||
```
|
||||
|
||||
Currently, Podman only supports running one VM at a time.
|
||||
|
||||
### Stopping your VM
|
||||
|
||||
To stop a running VM, use the `stop` command:
|
||||
|
||||
|
||||
```
|
||||
❯ podman machine stop
|
||||
|
||||
[core@localhost ~]$ Connection to localhost closed by remote host.
|
||||
Connection to localhost closed.
|
||||
Error: exit status 255
|
||||
```
|
||||
|
||||
I hope this helps you get started with Podman Machine. Give it a try, and let us know what you think in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/linux-podman
|
||||
|
||||
作者:[Sumantro Mukherjee][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/sumantro
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop)
|
||||
[2]: http://coreos.github.io/rpm-ostree/
|
||||
[3]: https://github.com/containers/podman
|
||||
[4]: http://docs.podman.io/en/latest/markdown/podman-machine.1.html
|
@ -1,135 +0,0 @@
|
||||
[#]: subject: (Top Android Emulators to Run and Test Android Apps on Linux)
|
||||
[#]: via: (https://itsfoss.com/android-emulators-linux/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Top Android Emulators to Run and Test Android Apps on Linux
|
||||
======
|
||||
|
||||
Android is built on top of a heavily customized Linux kernel. So, running mobile apps on Linux makes sense using an Android emulator.
|
||||
|
||||
While this is not something new that you can do on your Linux machine, it is a feature more in demand after Windows introduced the ability to run Android apps in 2021.
|
||||
|
||||
Not just limited to using apps, some of the Android emulators can also come in handy for development and testing.
|
||||
|
||||
Hence, I have compiled a list of the best emulators that you can use to test or run Android applications/games on Linux.
|
||||
|
||||
### 1\. Anbox
|
||||
|
||||
Anbox is a pretty popular emulator that lets Linux users run Android apps. Probably this is what Deepin Linux utilizes to make help run Android apps out of the box.
|
||||
|
||||
It isolates the Android operating system from the host using a container, which also lets them make the latest Android version available to use.
|
||||
|
||||
Android apps running will not have direct access to your hardware—which is a good security decision.
|
||||
|
||||
Unlike some of the other options here, Anbox does not technically need an emulation layer to make Android work. In other words, it is as close to a native Android experience on your Linux system.
|
||||
|
||||
For this reason, it may not be the easiest option available. You cannot just use the Google Play Store to install applications, you need to utilize Android Debug Bridge (ADB). All you need is the APK file of an app to install and use it.
|
||||
|
||||
[Anbox][1]
|
||||
|
||||
### 2\. Genymotion
|
||||
|
||||
![][2]
|
||||
|
||||
Genymotion is an impressive solution tailored for testing and development.
|
||||
|
||||
It is not a free and open-source option. They provide virtual Android experiences as a service through the cloud or a desktop client that is independent of Android Studio.
|
||||
|
||||
You can simulate a variety of hardware configurations and Android versions to create a virtual device for testing. It also gives you the ability to scale up and has multiple Android virtual devices running for extensive tests.
|
||||
|
||||
It can help you test how file uploading works in your app, impacts battery, performance, memory, and so on.
|
||||
|
||||
While it is a premium solution mostly for professionals, it does support the latest Linux distributions that include Ubuntu 20.04 LTS.
|
||||
|
||||
[Genymotion][3]
|
||||
|
||||
### 3\. Android-x86
|
||||
|
||||
![][4]
|
||||
|
||||
Android x86 is an open-source project to make Android run on a PC with 32-bit support.
|
||||
|
||||
You can choose to install it using a virtual machine manager on your Linux system or directly try it on your PC.
|
||||
|
||||
Official [installation instructions][5] are available if you need to go ahead.
|
||||
|
||||
Unlike some other options, it is a simple emulator that tries to work on a PC with no fancy features.
|
||||
|
||||
[Android x86][6]
|
||||
|
||||
### 4\. Android Studio (Virtual Devices)
|
||||
|
||||
![][7]
|
||||
|
||||
Android Studio is a full-fledged tool for development and testing. Fortunately, with the support for Linux, you can use it to emulate the Android experience for experiments if you need to.
|
||||
|
||||
You just need to create an Android Virtual Device (AVD) that you can configure and then simulate as an emulator.
|
||||
|
||||
There are good chances to find support for some of the latest smartphones, TVs, and smartwatches as well.
|
||||
|
||||
It needs a certain learning curve to be able to pull it off, but it is free and completely open-source.
|
||||
|
||||
[Android Studio][8]
|
||||
|
||||
### 5\. ARChon
|
||||
|
||||
![][9]
|
||||
|
||||
An interesting solution is an Android emulator that you can use in Linux and any other platform.
|
||||
|
||||
It helps run Android apps on Chrome OS or with Chrome browser on any operating system. Unlike some others, you may not get a complete Android experience but only the ability to run Android apps.
|
||||
|
||||
You just have to unpack the runtime and load it into Chrome extensions. Next, add the app you want to use by downloading the APK file onto it.
|
||||
|
||||
[ARChon][10]
|
||||
|
||||
### 6\. Bliss OS
|
||||
|
||||
![][11]
|
||||
|
||||
Bliss OS is yet another open-source project, similar to Android x86 that aims to make Android run on PC.
|
||||
|
||||
Unlike Android x86, it gives more compatibility options by supporting both 32-bit and 64-bit architectures. Also, you can download the compatible file as per your processor.
|
||||
|
||||
It is actively maintained and supports the latest Android versions available in the market.
|
||||
|
||||
[Bliss OS][12]
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
While you will find several Android emulators available for Linux, they may not replace a full-fledged smartphone experience.
|
||||
|
||||
Every emulator comes with a set of features along with a specific purpose. Choose the one that you need!
|
||||
|
||||
Have you tried Android emulators yet? What’s your favorite emulator that you have used in Linux? Feel free to let me know in the comments down below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/android-emulators-linux/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://anbox.io
|
||||
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/genymotion-android-emulator.png?resize=800%2C508&ssl=1
|
||||
[3]: https://www.genymotion.com
|
||||
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/android-x86-emulator.jpg?resize=1920%2C1080&ssl=1
|
||||
[5]: https://www.android-x86.org/installhowto.html
|
||||
[6]: https://www.android-x86.org
|
||||
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/07/android-virtual-devices-studio.png?resize=800%2C296&ssl=1
|
||||
[8]: https://developer.android.com/studio
|
||||
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/arcrhon.jpg?resize=800%2C426&ssl=1
|
||||
[10]: https://archon-runtime.github.io
|
||||
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/bliss-os-android.png?resize=800%2C576&ssl=1
|
||||
[12]: https://blissos.org
|
@ -2,7 +2,7 @@
|
||||
[#]: via: (https://opensource.com/article/21/7/javascript-cheat-sheet)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (lixin555)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
@ -176,7 +176,7 @@ via: https://opensource.com/article/21/7/javascript-cheat-sheet
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[lixin555](https://github.com/lixin555)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,146 @@
|
||||
[#]: subject: (28 books recommended by open source technologists to read right now)
|
||||
[#]: via: (https://opensource.com/article/21/7/open-source-books)
|
||||
[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
28 books recommended by open source technologists to read right now
|
||||
======
|
||||
Members of the Opensource.com community share what books they are
|
||||
enjoying reading.
|
||||
![Ceramic mug of tea or coffee with flowers and a book in front of a window][1]
|
||||
|
||||
Did you get our [summer reading list][2]?
|
||||
|
||||
It may not be the season of summer where you are, but summer reading lists are quintessential and somewhat cozy no matter what part of the world you live in. I love the idea of a cool breeze, a lounge chair, a drink, and a snack... all wrapped up together with a good book to pour over.
|
||||
|
||||
Fiction and non-fiction. Dramas, mysteries, science, romance... let us know in the comments what you're reading.
|
||||
|
||||
* * *
|
||||
|
||||
I'm working through _[How to Measure Anything][3]_, which is pretty cool. Recommended! —Moshe Zadka
|
||||
|
||||
♦
|
||||
|
||||
For science fiction lovers, I recommend Luis McMaster Bujold's _[Vorkosigan Saga][4]_. I had never heard of her until reading Larry Wall's lecture _[Perl, the first postmodern computer language][5]_: "Note how we still periodically hear the phrase 'serious literature'. This is literature that is supposedly about Real Life. Let me tell you something. The most serious literature I’ve ever read is by Lois McMaster Bujold. Any of you read her? It’s also the funniest literature I’ve ever read. It’s also space opera. 'Genre fiction,' sneers the Modernist. Meaning it follows certain conventions. So what? Nobody in the world can mix gravity and levity the way Bujold does in her Vorkosigan books. It’s oh so definitely about real life. So what if it follows space opera conventions. Sonnets follow certain conventions too, but I don’t see them getting sneered at much these days. Certainly, they were always called 'serious'."
|
||||
|
||||
So, I started with the [_Vor Game_][6] and then couldn't stop until I finished all of the series. Moving, funny, entertaining. —Petr Beranek
|
||||
|
||||
♦
|
||||
|
||||
I finished reading _[The Sleep Revolution][7]_ by Arianna Huffington last week. Currently reading _[The Devil in the White City][8]_ by Erik Larson. —Lauren Maffeo
|
||||
|
||||
♦
|
||||
|
||||
I'm currently reading [_Nemesis Games_][9] (book 5 in _The Expanse_sci-fi series).
|
||||
|
||||
Next on my reading list is [_Greater Good_][10] (book 2 in the_Star Wars: Thrawn Ascendency_series). I fell into the Star Wars books a few years ago, and have been reading them in between other books on my reading list. I loved the original _Thrawn_ series, the _Ahsoka_ book, the _Darth Bane_ series, and the _Darth Plagueis_ book. Some are not so great, like _Outbound Flight_ (didn't get into it), _Master & Apprentice_ (kind of dull), and _Light of the Jedi_ (the first in the "High Republic" series). And then there are some in the middle, like the _Tarkin_ book (interesting character) and _Lords of the Sith_ (predictable, but good).
|
||||
|
||||
McCloud's _[Understanding Comics][11]_ is a great book! I read it when I was working on my Master's degree, about 8 years ago, during my independent study on visual rhetoric. My instructor and I found it to be a very useful reference in how images communicate.
|
||||
|
||||
Another one: _[Picture This][12]_ by Molly Bang. I thumbed through that so many times when learning about icons (same visual rhetoric class) that some of the pages started falling out. —Jim Hall
|
||||
|
||||
♦
|
||||
|
||||
Sometimes, I wonder what I haven't been reading, because I always have a book or two or three on my Kindle.
|
||||
|
||||
I am a huge reader of SciFi and Fantasy, so I just finished the Hugo and Nebula winner, [_A Memory Called Empire_][13]. It has a fascinating premise and good characterizations, but I thought the writing would be a little stronger. Like Ancillary Justice, this book explores the idea of colonization. But in the case of A Memory Called Empire the colonizers look a lot like the Aztec Empire writ large. Oh, and this empire is obsessed with complicated poetry. Citizens use poems to encrypt email and provide travelogues.
|
||||
|
||||
My favorite book in a while is _[All Systems Red][14]_, the first book in The Murderbot Diaries, by Martha Wells. Imagine that you have an artificial human, who's a little bit of a clone and a little bit of a robot. She's sentient and self-aware, can destroy a human or a building in seconds flat, and has overwritten her governor program, but really she just wants to curl up in her cubby and binge-watch her favorite infotainment. Oh, and she has social anxiety. Except for the part about being able to destroy a spaceship, she's a lot like me.
|
||||
|
||||
I'm also currently reading Brandon Sanderson's [_Words of Radiance_][15]. —Ingrid Towey
|
||||
|
||||
♦
|
||||
|
||||
One of the best recent books I read was _[Bomber Mafia][16]_ by Malcolm Gladwell. It was a fascinating read. I also read *[Persist][17] *by Elizabeth Warren which I found interesting. I just started reading [_While Justice Sleeps_][18] by Stacey Abrams. I recently read "Killing Crazy Horse" by Bill O'Reilly and "The Soul of a Woman" by Isabel Allende. That book was so compelling that I bought copies for my daughter and daughter-in-law. —Don Watkins
|
||||
|
||||
♦
|
||||
|
||||
I’m currently reading the new Christine Morgan novel _[Trench Mouth][19]_, having just finished the original *Metropolis *(the one Fritz Lang adapted the movie from), and next up is _Cultish: The Language of Fanaticism_ by Amanda Montell. I’ve also got _Workplace Jazz_ and _Culture is the Bass_ by Gerold Leonard in there, and am eagerly awaiting _Final Girl Support Group_ by Grady Hendrix, which will be out next month. —Kevin Sonney
|
||||
|
||||
♦
|
||||
|
||||
I've got two books I'm reading: _[Laziness Does Not Exist][20]_ by Devon Price. This is a look at how the over-emphasis on productivity has gone too far in our culture. And, [_His Truth is Marching On_][21] by Jon Meacham. This is a look at the life and experience of John Lewis. —Steve Morris
|
||||
|
||||
♦
|
||||
|
||||
My year-round reading continues to be mainly books from Project Gutenberg. Recently I've read a number of books by Hillaire Belloc, mainly his commentaries on various topics ("On Anything", "On Everything" to name two). I also enjoy reading things by GK Chesterton. It can be hard to decide what the real point is that he is trying to make as he complains about this or that, but he's entertaining nonetheless.
|
||||
|
||||
Currently, I'm reading _[Thirty Strange Stories][22]_ by HG Wells. I've also read a number of his commentaries, which are quite good generally. It seems that most books I read come from the late 19th or very early 20th century.
|
||||
|
||||
**[Read next: [10 must-read technology books for 2021][23]]**
|
||||
|
||||
A book I would recommend if you've never read it is _[Candide][24]_ by Voltaire. I went through it hopping back and forth from the English to the French versions. The French seemed just a bit more entertaining.
|
||||
|
||||
I do all this with my tablet. Something I've really gotten attached to is the ability to highlight some word or phrase, then immediately be able to look it up on the internet on the tablet, or translate with an app. —Greg Pittman
|
||||
|
||||
♦
|
||||
|
||||
I recommend: _[Mastermind][25]_ by Maria Konnikova, and _[The Mind Map Book][26]_ by Tony Buzan —Hüseyin GÜÇ
|
||||
|
||||
♦
|
||||
|
||||
I've been reading a lot of work-related books through a couple of work bookclubs. One I'm reading now that I really like is _[No Hard Feelings][27]_ by Fosslien and Duffy-West. It's a light read that talks about the ways emotions show up at work, and how to manage (your and other people's) emotions at work.
|
||||
|
||||
Outside work, I've been reading some books on design. _[Understanding Comics][11]_ by Scott McCloud is my current read, and I recently finished the very enjoyable _[How Design Makes the World][28]_ by Scott Berkun, simultaneously a great lit review of books on the design of everyday things around us, and an overview of how (conscious and unconscious) design decisions impact our lives, and how we can improve the world by being aware of when we make our own design decisions.
|
||||
|
||||
Finally, I have also been reading some historical non-fiction. Most recently, I loved _[The Guns of August][29]_ by Barbara Tuchman about the outbreak and early days of World War One. And I'm looking forward to reading "How the Irish Became White" (a book I heard about from Christine Dunbar-Hester, who wrote the book Bryan recommended) about the evolution of the Irish cultural identity through the 19th and 20th century. —Dave Neary
|
||||
|
||||
♦
|
||||
|
||||
A little out of the how-to corner: I am currently reading [_Learn You a Haskell for Great Good!_][30] It is a beginner's guide to the Haskell programming language, a very strange thing from my viewpoint. —Stephan Avenwedde
|
||||
|
||||
♦
|
||||
|
||||
Here in Vancouver, Canada we have hit summer weather as well as passing the solstice; today we're expecting a high of 26ºC and by late in the week we may hit 30ºC (which is unusually warm hereabouts). But lovely, for sure. And I'm looking forward to kicking back in the late afternoon with a nice cool beverage and a good book, so just in time for the summer reading list!
|
||||
|
||||
My colleagues in Chile are in quarantine right now and it's winter there. The Mapuche new year We Tripantu and the Aymara Willkakuti are upon us, a time of reflection, celebration, and anticipation of the year to come: all, I am sure, hoping for better! There is also the winter school vacation that in theory runs from the 12th to the 23rd of July, which in a normal year would give an opportunity for digging into the recommendations on the summer reading list after a day of chasing the kids around a park or skiing or sledding in the mountains. For anyone interested, here is a short English article on [Willkakuti in Bolivia][31], and here is another on [We Tripantu in Argentina and Chile][32]. —Chris Hermansen
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/open-source-books
|
||||
|
||||
作者:[Jen Wike Huger][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jen-wike
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tea-cup-mug-flowers-book-window.jpg?itok=JqThhl51 (Ceramic mug of tea or coffee with flowers and a book in front of a window)
|
||||
[2]: https://opensource.com/article/21/6/2021-opensourcecom-summer-reading-list
|
||||
[3]: https://openlibrary.org/books/OL7596184M/How_to_Measure_Anything
|
||||
[4]: https://en.wikipedia.org/wiki/Vorkosigan_Saga
|
||||
[5]: http://www.wall.org/~larry/pm.html
|
||||
[6]: https://en.wikipedia.org/wiki/The_Vor_Game
|
||||
[7]: https://www.ariannahuffington.com/the-sleep-revolution/
|
||||
[8]: https://eriklarsonbooks.com/book/the-devil-in-the-white-city/
|
||||
[9]: https://en.wikipedia.org/wiki/Nemesis_Games
|
||||
[10]: https://starwars.fandom.com/wiki/Thrawn_Ascendancy:_Greater_Good
|
||||
[11]: https://en.wikipedia.org/wiki/Understanding_Comics
|
||||
[12]: https://www.mollybang.com/Pages/picture.html
|
||||
[13]: https://en.wikipedia.org/wiki/A_Memory_Called_Empire
|
||||
[14]: https://en.wikipedia.org/wiki/All_Systems_Red
|
||||
[15]: https://stormlightarchive.fandom.com/wiki/Words_of_Radiance
|
||||
[16]: https://en.wikipedia.org/wiki/Bomber_Mafia
|
||||
[17]: https://us.macmillan.com/books/9781250799241
|
||||
[18]: https://www.penguinrandomhouse.com/books/648021/while-justice-sleeps-by-stacey-abrams/
|
||||
[19]: https://www.fantasticfiction.com/m/christine-morgan/trench-mouth.htm
|
||||
[20]: https://bookshop.org/books/laziness-does-not-exist/9781982140106
|
||||
[21]: https://www.penguinrandomhouse.com/books/606295/his-truth-is-marching-on-by-jon-meacham/
|
||||
[22]: http://www.gutenberg.org/ebooks/59774
|
||||
[23]: https://enterprisersproject.com/article/2021/1/10-technology-books-must-read-2021
|
||||
[24]: https://en.wikipedia.org/wiki/Candide
|
||||
[25]: https://www.mariakonnikova.com/books/mastermind/
|
||||
[26]: https://tonybuzan.com/product/the-mind-map-book/
|
||||
[27]: https://www.penguinrandomhouse.com/books/564051/no-hard-feelings-by-liz-fosslien-and-mollie-west-duffy/
|
||||
[28]: https://designmtw.com/
|
||||
[29]: https://en.wikipedia.org/wiki/The_Guns_of_August
|
||||
[30]: http://learnyouahaskell.com/
|
||||
[31]: https://info.handicraft-bolivia.com/Aymara-New-Year-a33-sm162
|
||||
[32]: https://www.mapuche-nation.org/english/html/news/n-276.html
|
@ -0,0 +1,77 @@
|
||||
[#]: subject: (How to Fix yay: error while loading shared libraries: libalpm.so.12)
|
||||
[#]: via: (https://www.debugpoint.com/2021/07/yay-error-libalpm-so-12/)
|
||||
[#]: author: (Arindam https://www.debugpoint.com/author/admin1/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
How to Fix yay: error while loading shared libraries: libalpm.so.12
|
||||
======
|
||||
This quick guide is to help you to fix yay error – while loading shared
|
||||
libraries: libalpm.so.12.
|
||||
If you are running [Arch Linux][1] in a system for a longer time, things can break due to its rolling release nature combined with your hardware support. If you use the [AUR Helper Yay][2], then sometimes, yay can be corrupted due to several installations, upgrade of other packages.
|
||||
|
||||
The YAY helper itself is very stable, but sometimes it gets messed up, and you can not do any installation using it until you fix it. And one of the nagging error is this:
|
||||
|
||||
```
|
||||
yay: error while loading shared libraries: libalpm.so.12: cannot open shared object file: No such file or directory
|
||||
```
|
||||
|
||||
This error particularly comes after upgrading to pacman 6.0 due to incompatibility of shared libraries.
|
||||
|
||||
![error while loading shared libraries – yay][3]
|
||||
|
||||
### How to fix yay error – while loading shared libraries: libalpm.so.12
|
||||
|
||||
* This error can only be fixed by uninstalling yay completely, including its dependencies.
|
||||
* Then re-installing yay.
|
||||
|
||||
|
||||
* There is no other way to solve this error.
|
||||
|
||||
|
||||
* We already have a guide [how to install Yay][4], however, here are the steps to fix.
|
||||
* Clone the yay repo from AUR and build. Run the following command in sequence from a terminal window.
|
||||
|
||||
|
||||
|
||||
```
|
||||
cd /tmp
|
||||
git clone 'https://aur.archlinux.org/yay.git'
|
||||
cd /tmp/yay
|
||||
makepkg -si
|
||||
cd ~
|
||||
rm -rf /tmp/yay/
|
||||
```
|
||||
|
||||
After installation, you can try running the command which gave you this error. And you should be all set. If you’re still having error, let me know in the comment box below.
|
||||
|
||||
Apparently, this has been encountered by many people and [several discussions][5] happened across web. Above is the only solution to this error. And I could not find exact root cause of the problem anywhere except it starts after pacman 6.0 update.
|
||||
|
||||
[][6]
|
||||
|
||||
SEE ALSO: How to Install Java in Arch Linux and Manjaro
|
||||
|
||||
* * *
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/07/yay-error-libalpm-so-12/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://archlinux.org/
|
||||
[2]: https://aur.archlinux.org/packages/yay/
|
||||
[3]: https://www.debugpoint.com/blog/wp-content/uploads/2021/07/error-while-loading-shared-libraries-yay.jpg
|
||||
[4]: https://www.debugpoint.com/2021/01/install-yay-arch/
|
||||
[5]: https://github.com/Jguer/yay/issues/1519
|
||||
[6]: https://www.debugpoint.com/2021/02/install-java-arch/
|
@ -0,0 +1,144 @@
|
||||
[#]: subject: (How to Recover Arch Linux Install via chroot)
|
||||
[#]: via: (https://www.debugpoint.com/2021/07/recover-arch-linux/)
|
||||
[#]: author: (Arindam https://www.debugpoint.com/author/admin1/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
How to Recover Arch Linux Install via chroot
|
||||
======
|
||||
This quick guide explains some of the steps which may come in handy to
|
||||
recover an Arch Linux Install.
|
||||
Being a rolling release, sometimes things breaks in [Arch Linux][1]. Not because of your own actions, but hundreds of other reasons such as new Kernel vs your hardware, or software compatibility. But still, Arch Linux is still better and provides the latest packages and applications.
|
||||
|
||||
But sometimes, it gives you trouble and you end up with a blinking cursor and nothing else.
|
||||
|
||||
So, in those scenarios, instead of re-formatting or reinstalling, you may want to try to recover the installation including the data before giving up your hope. This guide outlines some steps in that direction.
|
||||
|
||||
### Recover Arch Linux Installation
|
||||
|
||||
* First step is to **create a bootable LIVE USB** with Arch Linux. Download the .ISO from this link and create a bootable .ISO. You can check out this guide on [how to create bootable .ISO using Etcher][2]. Remember this step require another working stable system obviously as your current system is not usable.
|
||||
|
||||
|
||||
|
||||
[download arch linux][3]
|
||||
|
||||
* You need to know on **which partition your Arch Linux** is installed. This is a very important step. If you don’t know, you can use GParted to find out. Or check in your Grub menu, Or you can run the below command to find out. This will list all of your disk partitions with their size, labels.
|
||||
|
||||
|
||||
|
||||
```
|
||||
sudo lsblk -o name,mountpoint,label,size,uuid
|
||||
```
|
||||
|
||||
* Once done, plug-in the USB stick and boot from it. And you should see the Arch Linux prompt in the LIVE medium.
|
||||
|
||||
|
||||
* Now, mount to the Arch Linux partition using below. Change the `/dev/sda3` to your respective partition.
|
||||
|
||||
|
||||
|
||||
```
|
||||
mount /dev/sda3 /mnt
|
||||
arch-chroot /mnt
|
||||
```
|
||||
|
||||
* The arch-chroot command will mount your Arch Linux partition in the terminal, so login using your Arch credentials. Now, at this stage, you have the following options, based on what you want.
|
||||
|
||||
|
||||
* You can take backups of your data by going through /home folders. In case, troubleshooter doesn’t work. You may copy the files to external USB or another partition.
|
||||
|
||||
|
||||
* Verify the log files, specially the **pacman logs**. Because, unstable system may be caused by upgrading some packages such graphics driver or any other driver. Based on the log, you may want to downgrade any specific package if you want.
|
||||
* You may use the below command to view last 200 lines of the pacman log file to find out any failing items or dependency removal.
|
||||
|
||||
|
||||
|
||||
```
|
||||
tail -n 200 /var/log/pacman.log | less
|
||||
```
|
||||
|
||||
* The above command gives you the 200 lines from the end of the pacman.log file to verify. Now, carefully check which of the packages were updates since your successful boot.
|
||||
|
||||
|
||||
* And note down the package name and version somewhere. And you may try to downgrade packages one-by-one or if you think a specific package created a problem. Use the -U switch of pacman command to downgrade.
|
||||
|
||||
|
||||
|
||||
```
|
||||
pacman -U <package name>
|
||||
```
|
||||
|
||||
* You can run the following to start your Arch system after downgrading, if any.
|
||||
|
||||
|
||||
|
||||
```
|
||||
exec /sbin/init
|
||||
```
|
||||
|
||||
* Check the status of your display manager, whether if there are any errors. Sometimes, display manager creates a problem which can’t communicate with X Server. For example, if you are using lightdm, then you can check its status via below.
|
||||
|
||||
|
||||
|
||||
```
|
||||
systemctl status lightdm
|
||||
```
|
||||
|
||||
* Or, may want to start it via below command and check what is the error.
|
||||
|
||||
|
||||
|
||||
```
|
||||
lightdm --test-mode --debug
|
||||
```
|
||||
|
||||
* Here is an example of lightdm failure which caused an unstable Arch system.
|
||||
|
||||
|
||||
|
||||
![lightdm – test mode][4]
|
||||
|
||||
* Or check via kicking off the X server using `startx`.
|
||||
|
||||
|
||||
* In my experience, if you see errors in the above command, try to install another display manager such as **sddm** and enable it. It may eliminate the error.
|
||||
|
||||
|
||||
* Try the above steps, based on the state of your system, and troubleshoot. For errors specific to display manager lightdm, we have a [guide][5] which you may want to check out.
|
||||
* If you are using sddm, then check out [these troubleshooting steps][6] if something works.
|
||||
|
||||
|
||||
|
||||
[][7]
|
||||
|
||||
SEE ALSO: Essential Pacman Commands for Arch Linux [With Examples]
|
||||
|
||||
### Closing Notes
|
||||
|
||||
Every installation is different. And above steps may/may not work for you. But it is worth a try and as per experience, it works. If it works, well, good for you. Either way, do let me know in the comment box below, how it goes.
|
||||
|
||||
* * *
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/07/recover-arch-linux/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.debugpoint.com/tag/arch-linux
|
||||
[2]: https://www.debugpoint.com/2021/01/etcher-bootable-usb-linux/
|
||||
[3]: https://archlinux.org/download/
|
||||
[4]: https://www.debugpoint.com/blog/wp-content/uploads/2021/03/lightdm-test-mode.jpg
|
||||
[5]: https://www.debugpoint.com/2021/03/failed-to-start-lightdm/
|
||||
[6]: https://wiki.archlinux.org/title/SDDM#Troubleshooting
|
||||
[7]: https://www.debugpoint.com/2021/02/pacman-command-arch-examples/
|
@ -0,0 +1,63 @@
|
||||
[#]: subject: (Making PDFs more accessible to screen readers with open source)
|
||||
[#]: via: (https://opensource.com/article/21/7/pdf-latex)
|
||||
[#]: author: (Quinn Foster https://opensource.com/users/quinn-foster)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Making PDFs more accessible to screen readers with open source
|
||||
======
|
||||
One university open source program office is working to improve
|
||||
accessibility of an open access journal with LaTeX.
|
||||
![Person using a laptop][1]
|
||||
|
||||
A screen reader is a vital tool that helps individuals who are blind or low-vision read digital text. Unfortunately, not all file formats receive the same level of support from screen readers. For example, while PDF files have accessibility features that you can use, they are often not the preferred file format for screen reader users. Between line breaks, multiple columns, symbols, and images, screen readers can have trouble reading PDFs in a cohesive way to their users.
|
||||
|
||||
This is what the folks at [Open @ RIT][2] are trying to change.
|
||||
|
||||
Open @ RIT is the open source program office at the Rochester Institute of Technology, offering RIT faculty and staff assistance in opening their research projects and maintaining communities of practice around their work. One such faculty member is Dr. Todd Pagano, Professor of Chemistry and Associate Dean for Teaching and Scholarship Excellence at the National Technical Institute for the Deaf. Dr. Pagano came to Open @ RIT seeking help to increase the accessibility of an open-access journal, the publications of which currently exist as PDFs.
|
||||
|
||||
The Open @ RIT team, consisting of UX designer Rahul Jaiswal and full-stack developer Suhas C.V., have used this project as a stepping stone to begin exploring ways to convert PDFs into accessible HTML.
|
||||
|
||||
> "It's very difficult to make PDFs fully accessible, especially in an automated way," says Mike Nolan, assistant director of Open @ RIT.
|
||||
|
||||
Open @ RIT tested multiple tools that already included accessibility features in their quest to convert PDFs into HTML successfully. Despite these features, the resulting HTML files still had many issues that made them difficult for screen readers to read, such as pauses and interruptions.
|
||||
|
||||
At this point, Open @ RIT decided to pursue a more open source tool-chain to assist in the conversion from received submissions to accessible formats like HTML while maintaining the same style and general look of the published article, in which the use of LaTeX was instrumental.
|
||||
|
||||
The workflow with LaTeX is simple:
|
||||
|
||||
* A submitted paper—in the form of a PDF—is pasted into a `.tex` template and turned into a `.tex` file.
|
||||
This `.tex` template is an edited version of the Association for Computing Machinery ([ACM][3]) `.tex` template.
|
||||
* Then [_tex2html_][4]—the conversion tool built by Open @ RIT—is applied to the `.tex` file that uses an open source LaTeX converter called LaTeXML to convert it to HTML finally.
|
||||
* The resulting HTML file shows significant improvement with screen readers.
|
||||
|
||||
|
||||
|
||||
Some standing issues with the tool-chain are still being worked on, but using LaTeX to facilitate and standardize the generation of the resulting formats (PDF and HTML) has shown great promise in achieving this goal. Publishing journal articles in PDF and HTML gives readers a choice and more options for compatibility with screen readers.
|
||||
|
||||
Those who want to learn more about the project will get the chance very soon. During their explorations of LaTeX, Rahul and Suhas contacted experts associated with [TeX Users Group (TUG) 2021][5]—this year's conference run by [TUC][6] for all things TeX and LaTeX. They're invited to do a presentation on their project. The duo, along with Dr. Pagano, will discuss how they have been using LaTeX in their accessibility efforts and the need for journals to be accessible. TUG 2021 will be running online from August 5-8, 2021.
|
||||
|
||||
Their work shows the capacity for open source to be used in a way that doesn't just increase digital transparency but also accessibility for all people.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/pdf-latex
|
||||
|
||||
作者:[Quinn Foster][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/quinn-foster
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop)
|
||||
[2]: https://www.rit.edu/research/open
|
||||
[3]: https://services.acm.org/public/qj/keep_inventing/qjprofm_control.cfm?promo=DA4SCA
|
||||
[4]: https://gitlab.com/open-rit/tex2html
|
||||
[5]: https://tug.org/tug2021/
|
||||
[6]: https://www.tug.org/
|
@ -0,0 +1,386 @@
|
||||
[#]: subject: (Command line quick tips: wc, sort, sed and tr)
|
||||
[#]: via: (https://fedoramagazine.org/command-line-quick-tips-wc-sort-sed-and-tr/)
|
||||
[#]: author: (mahesh1b https://fedoramagazine.org/author/mahesh1b/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Command line quick tips: wc, sort, sed and tr
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
Image by Ryan Lerch (CC BY-SA 4.0)
|
||||
|
||||
Linux distributions are great to use and they have some tricks under their sleeves which users may not be aware of. Let’s have a look at some command line utilities which really come in handy when you’re the guy that likes to stick with the terminal rather than using a GUI.
|
||||
|
||||
We all know that using a terminal is more efficient to use the system. In case you are editing or playing with text files on a terminal then these tools will surely make your life easy.
|
||||
|
||||
For this article let’s have a look at _wc_, _sort_, _tr_, and _sed_ commands.
|
||||
|
||||
## **wc**
|
||||
|
||||
wc is a utility whose name stands for “word count”. As the name suggests it will count the lines, words or byte count from any file.
|
||||
|
||||
Let’s see how it works:
|
||||
|
||||
```
|
||||
$ wc filename
|
||||
lines words characters filename
|
||||
```
|
||||
|
||||
So in output we get the total number of newlines in the file, total number of words, total number of characters, and the filename.
|
||||
|
||||
To get some specific output we have to use options:
|
||||
|
||||
* -c To print the byte counts
|
||||
* -l To print the newline counts
|
||||
* -w To print the word counts
|
||||
* -m To print the character counts
|
||||
|
||||
|
||||
|
||||
### wc demo
|
||||
|
||||
Let’s see it in action:
|
||||
|
||||
Here we start with a text file, _loremipsm.txt_. First, we print out the file and then use _wc_ on it.
|
||||
|
||||
```
|
||||
$ cat loremipsm.txt
|
||||
Linux is the best-known and most-used open source operating system.
|
||||
As an operating system, Linux is software that sits underneath all of the other software on a computer,
|
||||
receiving requests from those programs and replaying these requests to the computer's hardware.
|
||||
|
||||
$ wc loremipsm.txt
|
||||
3 41 268 loremipsm.txt
|
||||
```
|
||||
|
||||
Suppose I only want to see the byte count of the file:
|
||||
|
||||
```
|
||||
$ wc -c loremipsm.txt
|
||||
268 loremipsm.txt
|
||||
```
|
||||
|
||||
For the newline count of the file:
|
||||
|
||||
```
|
||||
$ wc -l loremipsm.txt
|
||||
3 loremipsm.txt
|
||||
```
|
||||
|
||||
To see the word count of the file:
|
||||
|
||||
```
|
||||
$ wc -w loremipsm.txt
|
||||
41 loremipsm.txt
|
||||
```
|
||||
|
||||
Now only the character count of the file:
|
||||
|
||||
```
|
||||
$ wc -m loremipsm.txt
|
||||
268 loremipsm.txt
|
||||
```
|
||||
|
||||
## **sort**
|
||||
|
||||
The _sort_ command is one of the most useful tools. It will sort the data in a file. Sorting is by either characters or numbers in ascending or descending order. It can also be used to sort or randomize the lines of files.
|
||||
|
||||
Using _sort_ can be very simple. All we need to do is provide the name of the file.
|
||||
|
||||
```
|
||||
$ sort filename
|
||||
```
|
||||
|
||||
By default it sorts the data in alphabetical order. One thing to note is that the _sort_ command just displays the sorted data. It does not overwrite the file.
|
||||
|
||||
Some useful options for _sort_:
|
||||
|
||||
* -r To sort the lines in the file in reverse order
|
||||
* -R To shuffle the lines in the file into random order
|
||||
* -o To save the output in another file
|
||||
* -k To sort as per specific column
|
||||
* -t To mention the field separator
|
||||
* -n To sort the data according to numerical value
|
||||
|
||||
|
||||
|
||||
### sort demo
|
||||
|
||||
Let’s use _sort_ in some short demos:
|
||||
|
||||
We have a file, _list.txt_, containing names and numeric values separated by commas.
|
||||
|
||||
First let’s print out the file and just do simple sorting.
|
||||
|
||||
```
|
||||
$ cat list.txt
|
||||
Cieran Wilks, 9
|
||||
Adelina Rowland, 4
|
||||
Hayden Mcfarlnd, 1
|
||||
Ananya Lamb, 5
|
||||
Shyam Head, 2
|
||||
Lauryn Fuents, 8
|
||||
Kristian Felix, 10
|
||||
Ruden Dyer, 3
|
||||
Greyson Meyers, 6
|
||||
Luther Cooke, 7
|
||||
|
||||
$ sort list.txt
|
||||
Adelina Rowland, 4
|
||||
Ananya Lamb, 5
|
||||
Cieran Wilks, 9
|
||||
Greyson Meyers, 6
|
||||
Hayden Mcfarlnd, 1
|
||||
Kristian Felix, 10
|
||||
Lauryn Fuents, 8
|
||||
Luther Cooke, 7
|
||||
Ruden Dyer, 3
|
||||
Shyam Head, 2
|
||||
```
|
||||
|
||||
Now sort the data in the reverse order.
|
||||
|
||||
```
|
||||
$ sort -r list.txt
|
||||
Shyam Head, 2
|
||||
Ruden Dyer, 3
|
||||
Luther Cooke, 7
|
||||
Lauryn Fuents, 8
|
||||
Kristian Felix, 10
|
||||
Hayden Mcfarlnd, 1
|
||||
Greyson Meyers, 6
|
||||
Cieran Wilks, 9
|
||||
Ananya Lamb, 5
|
||||
Adelina Rowland, 4
|
||||
```
|
||||
|
||||
Let’s shuffle the data.
|
||||
|
||||
```
|
||||
$ sort -R list.txt
|
||||
Cieran Wilks, 9
|
||||
Greyson Meyers, 6
|
||||
Adelina Rowland, 4
|
||||
Kristian Felix, 10
|
||||
Luther Cooke, 7
|
||||
Ruden Dyer, 3
|
||||
Lauryn Fuents, 8
|
||||
Hayden Mcfarlnd, 1
|
||||
Ananya Lamb, 5
|
||||
Shyam Head, 2
|
||||
```
|
||||
|
||||
Let’s make it more complex. This time we sort the data according to the second field, which is the numeric value, and save the output in another file using the -o option.
|
||||
|
||||
```
|
||||
$ sort -n -k2 -t ',' -o sorted_list.txt list.txt
|
||||
$ ls
|
||||
sorted_list.txt list.txt
|
||||
$ cat sorted_list.txt
|
||||
Hayden Mcfarlnd, 1
|
||||
Shyam Head, 2
|
||||
Ruden Dyer, 3
|
||||
Adelina Rowland, 4
|
||||
Ananya Lamb, 5
|
||||
Greyson Meyers, 6
|
||||
Luther Cooke, 7
|
||||
Lauryn Fuents, 8
|
||||
Cieran Wilks, 9
|
||||
Kristian Felix, 10
|
||||
```
|
||||
|
||||
Here we used -n to sort in numerical order, -k to specify the field to sort (2 in this case) -t to indicate the delimiter or field-separator (a comma) and -o to save the output in the file _sorted_list.txt_.
|
||||
|
||||
## **sed**
|
||||
|
||||
Sed is a stream editor that will filter and transform text in the output. This means we are not making changes in the file, only to the output. We can also save the changes in a new file if needed. Sed comes with a lot of options that are useful in filtering or editing the data.
|
||||
|
||||
The syntax for sed is:
|
||||
|
||||
```
|
||||
$ sed [OPTION] ‘PATTERN’ filename
|
||||
```
|
||||
|
||||
Some of the options used with sed:
|
||||
|
||||
* -n : To suppress the printing
|
||||
* p: To print the current pattern
|
||||
* d : To delete the pattern
|
||||
* q : To quit the sed script
|
||||
|
||||
|
||||
|
||||
### sed demo
|
||||
|
||||
Lets see _sed_ in action. We start with the file _data_ with the fields indicating number, name, age and operating system.
|
||||
|
||||
Printing the lines twice if they occur in a specific range of lines.
|
||||
|
||||
```
|
||||
$ cat data
|
||||
1 Vicky Grant 20 linux
|
||||
2 Nora Burton 19 Mac
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
9 Mindy Howard 20 Mac
|
||||
|
||||
$ sed '3,7 p' data
|
||||
1 Vicky Grant 20 linux
|
||||
2 Nora Burton 19 Mac
|
||||
3 Willis Castillo 21 Windows
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linux
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
9 Mindy Howard 20 Mac
|
||||
```
|
||||
|
||||
Here the operation is specified in single quotes indicating lines 3 through 7 and using ‘p’ to print the pattern found. The default behavior of sed is to print every line after parsing it. This means lines 3 through 7 appear twice because of the ‘p’ instruction.
|
||||
|
||||
So how can you print specific lines from the file? Use the ‘-n’ option to eliminate lines that do not match from the output.
|
||||
|
||||
```
|
||||
$ sed -n '3,7 p' data
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linux
|
||||
```
|
||||
|
||||
Only lines 3 through 7 will appear using ‘-n’ .
|
||||
|
||||
Omitting specific lines from the file. This uses the ‘d’ to delete the lines from the output.
|
||||
|
||||
```
|
||||
$ sed '3 d' data
|
||||
1 Vicky Grant 20 linux
|
||||
2 Nora Burton 19 Mac
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
9 Mindy Howard 20 Mac
|
||||
|
||||
$ sed '5,9 d' data
|
||||
1 Vicky Grant 20 linux
|
||||
2 Nora Burton 19 Mac
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
```
|
||||
|
||||
Searching for a specific keyword in the file.
|
||||
|
||||
```
|
||||
$ sed -n '/linux/ p' data
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
|
||||
$ sed -n '/linux/I p' data
|
||||
1 Vicky Grant 20 Linux
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
```
|
||||
|
||||
In these examples we have a regular expression which appears in ‘/ /’. If we have similar words in the file but not with proper case then we use the “I” to make the search case insensitive. Recall that the -n eliminates the lines that do not match from the output.
|
||||
|
||||
Replacing the words in the file.
|
||||
|
||||
```
|
||||
$ sed 's/linux/linus/' data
|
||||
1 Vicky Grant 20 Linux
|
||||
2 Nora Burton 19 Mac
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linus
|
||||
8 Ralph Martin 19 linus
|
||||
9 Mindy Howard 20 Mac
|
||||
```
|
||||
|
||||
Here ‘s/ / /’ denotes that it is a regex. The located word and then the new word to replace it appear between the two ‘/’.
|
||||
|
||||
## **tr**
|
||||
|
||||
The _tr_ command will translate or delete characters. It can transform the lowercase letters to uppercase or vice versa, eliminate repeating characters, and delete specific characters.
|
||||
|
||||
One thing weird about _tr_ is that it does not take files as input like _wc_, _sort_ and _sed_ do. We use “|” (the pipe symbol) to provide input to the _tr_ command.
|
||||
|
||||
```
|
||||
$ cat filename | tr [OPTION]
|
||||
```
|
||||
|
||||
Some options used with _tr_:
|
||||
|
||||
* -d : To delete the characters in first set of output
|
||||
* -s : To replace the repeated characters with single occurrence
|
||||
|
||||
|
||||
|
||||
### tr demo
|
||||
|
||||
Now let’s use the _tr_ command with the file _letter_ to convert all the characters from lowercase to uppercase.
|
||||
|
||||
```
|
||||
$ cat letter
|
||||
Linux is too easy to learn,
|
||||
And you should try it too.
|
||||
|
||||
$ cat letter | tr 'a-z' 'A-Z'
|
||||
LINUX IS TOO EASY TO LEARN,
|
||||
AND YOU SHOULD TRY IT TOO.
|
||||
```
|
||||
|
||||
Here ‘a-z’ ‘A-Z’ denotes that we want to convert characters in the range from “a” to “z” from lowercase to uppercase.
|
||||
|
||||
Deleting the “o” character from the file.
|
||||
|
||||
```
|
||||
$ cat letter | tr -d 'o'
|
||||
Linux is t easy t learn,
|
||||
And yu shuld try it t.
|
||||
```
|
||||
|
||||
Squeezing the character “o” from the file means that if “o” is repeated in line then it will remove it and print it only once.
|
||||
|
||||
```
|
||||
$ cat letter | tr -s 'o'
|
||||
Linux is to easy to learn,
|
||||
And you should try it to.
|
||||
```
|
||||
|
||||
## **Conclusion**
|
||||
|
||||
This was a quick demonstration of the _wc_, _sort_, _sed_ and _tr_ commands. These commands make it easy to manipulate the text files on the terminal in a quick and efficient way. You may use the _man_ command to learn more about these commands.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/command-line-quick-tips-wc-sort-sed-and-tr/
|
||||
|
||||
作者:[mahesh1b][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/mahesh1b/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2018/10/commandlinequicktips-816x345.jpg
|
@ -0,0 +1,229 @@
|
||||
[#]: subject: (Get started with WildFly for Java web development)
|
||||
[#]: via: (https://opensource.com/article/21/7/wildfly)
|
||||
[#]: author: (Ranabir Chakraborty https://opensource.com/users/ranabir-chakraborty)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Get started with WildFly for Java web development
|
||||
======
|
||||
WildFly is a popular choice for developers who want to develop
|
||||
enterprise-ready applications.
|
||||
![Coding on a computer][1]
|
||||
|
||||
[WildFly][2] is a production-ready, cross-platform, flexible, lightweight, managed application runtime that provides all the necessary features to run a Java web application. It is also a Java EE 8 certified application server almost exclusively in Java, and it implements the [Jakarta EE][3], which was the Java Platform, Enterprise Edition (Java EE) specifications. Therefore you can run it on any operating system.
|
||||
|
||||
WildFly, formerly known as JBoss AS, is a fully implemented JEE container—application server, developed by JBoss, which became a part of Red Hat on June 5, 2006, and since then, WildFly became their product.
|
||||
|
||||
### **How to get started with WildFly?**
|
||||
|
||||
This Java middleware application server known as [WildFly][4] is a robust implementation of the Jakarta platform specification. The latest WildFly 24 architecture built on the Modular Service Container enables services on-demand when your application requires them.
|
||||
|
||||
#### **Prerequisites**
|
||||
|
||||
Before installing WildFly, there are a few prerequisites:
|
||||
|
||||
* Check that you have a JDK on your machine—JDK 8 or higher recommended to start WildFly. You can use the open source JDK called [OpenJDK][5].
|
||||
Once you install the JDK, set the JAVA_HOME environment variable.
|
||||
* Ensure you have Maven 3.6.0 or higher installed. You can download Maven from [here][6] and set the environment variables.
|
||||
* After loading both the variables, check the versions of JDK and Maven.
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
$ java -version
|
||||
openjdk version “11.0.9” 2020-10-20 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9+11)
|
||||
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9+11, mixed mode)
|
||||
|
||||
[/code] [code]
|
||||
|
||||
$ mvn -version
|
||||
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: /usr/share/maven
|
||||
Java version: 11.0.9, vendor: AdoptOpenJDK, runtime: /usr/lib64/adoptopenjdk
|
||||
Default locale: en_US, platform encoding: UTF-8
|
||||
OS name: “linux”, version: “5.9.1”, arch: “amd64”, family: “unix”
|
||||
```
|
||||
|
||||
### Download and install WildFly
|
||||
|
||||
There are many ways you can install WildFly, including unzipping our traditional download zip, provisioning a custom installation using Galleon, or building a bootable jar. The official [installation guide][7] helps you identify the kind of WildFly installation that best fits your application’s deployment needs. In this article, we'll focus on the typical approach of installing the download zip.
|
||||
|
||||
You can download WildFly from [here][8]. The standard WildFly variant is the right choice for most users, but if you'd like a technical preview look at what's coming in the future, try out WildFly Preview. Once downloaded, extract the archive to a folder and install it on any operating system that supports the zip or tar formats.
|
||||
|
||||
|
||||
```
|
||||
`$ unzip wildfly-preview-24.0.0.Final.zip`
|
||||
```
|
||||
|
||||
### Running WildFly
|
||||
|
||||
WildFly has two server modes—_standalone_ and _domain_. The difference between the two modes is not about the capabilities available but about the application server's management. Use the _standalone_ mode when you only need one instance of the server. On the other hand, use the _domain_ mode when you want to run several instances of WildFly, and you want a single point from where you can control the configuration. You can find more about the domain mode in the [documentation][9].
|
||||
|
||||
To start WildFly using the default configuration in _standalone_ mode, change the directory to `$JBOSS_HOME/bin` and issue:
|
||||
|
||||
|
||||
```
|
||||
`$ ./standalone.sh`
|
||||
```
|
||||
|
||||
To start the application server using the default configuration in _domain_ mode, change the directory to `$JBOSS_HOME/bin` and issue:
|
||||
|
||||
|
||||
```
|
||||
`$ ./domain.sh`
|
||||
```
|
||||
|
||||
After starting the standalone mode, you should find something like the following in your console at the end of the start-up process:
|
||||
|
||||
|
||||
```
|
||||
00:46:04,500 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Preview 24.0.0.Final (WildFly Core 16.0.0.Final) started in 4080ms - Started 437 of 638 services (350 services are lazy, passive or on-demand)
|
||||
00:46:04,502 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on <http://127.0.0.1:9990/management>
|
||||
00:46:04,502 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on <http://127.0.0.1:9990>
|
||||
```
|
||||
|
||||
You can point your browser to `http://localhost:9990` (if using the default configured HTTP port), bringing you to the WildFly welcome page.
|
||||
|
||||
![WildFly welcome page][10]
|
||||
|
||||
(Ranabir Chakraborty, [CC-BY SA 4.0][11])
|
||||
|
||||
#### **Authentication**
|
||||
|
||||
Though now you can see that WildFly is running, you can not access the admin console because you need to add a user for that. By default, security comes enabled for the WildFly management interfaces. That means that before you connect using the administration console or remotely using the CLI, you'll need to add a new user. You can achieve that simply by using the `add-user.sh` or the `add-user.bat` script in the bin folder.
|
||||
|
||||
After starting the script, the system guides you through the process of adding a new user.
|
||||
|
||||
|
||||
```
|
||||
$ ./add-user.sh
|
||||
What type of user do you wish to add?
|
||||
a) Management User (mgmt.users.properties)
|
||||
b) Application User (application-users.properties)
|
||||
(a):
|
||||
```
|
||||
|
||||
Select the default option "a" to add a management user, where the user gets added to the ManagementRealm. Therefore, the user is authorized to perform management operations using the web-based Admin Console or the CLI. The other option is "b," where the user gets added to the ApplicationRealm. This realm provides for use with applications.
|
||||
|
||||
|
||||
```
|
||||
Enter the details of the new user to add.
|
||||
Using realm ‘ManagementRealm’ as discovered from the existing property files.
|
||||
Username : Ranabir
|
||||
Password recommendations are listed below. To modify these restrictions, edit the add-user.properties configuration file.
|
||||
[…]
|
||||
Passward :
|
||||
Re-enter Password :
|
||||
```
|
||||
|
||||
Here you choose the management user option and provide the required username and password.
|
||||
|
||||
|
||||
```
|
||||
What groups do you want this user to belong to?
|
||||
(Please enter a comma-separated list, or leave blank for none) [ ]:
|
||||
```
|
||||
|
||||
Users can be associated with arbitrary groups of your choice, and you get prompted to consider assigning a new user to a group. Groups are helpful for simplified administration of things like access permissions, but leaving this blank is OK for getting started. You then confirm adding the user. The user gets written to the properties files used for authentication, and a confirmation message displays.
|
||||
|
||||
|
||||
```
|
||||
Is this new user going to be used for AS process to connect to another AS process?
|
||||
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server Jakarta Enterprise Beans calls.
|
||||
yes/no? no
|
||||
```
|
||||
|
||||
Finally, you get asked whether or not you'll use the account you've added to identify one WildFly process to another—typically in a WildFly managed domain. The answer for this should be "no" because the account you are adding here is for use by a human administrator.
|
||||
|
||||
After successfully adding the user, now you can refresh the browser, and the console will look like the following:
|
||||
|
||||
![WildFly HAL Management console][12]
|
||||
|
||||
#### **Deploy an application**
|
||||
|
||||
WildFly provides many ways to deploy your application on the server. But if you are running a standalone WildFly service, a simple way to deploy your application is to copy your application archive (`war/ear/jar`) into the `$JBOSS_HOME/standalone/deployments` directory in the server installation. The deployment-scanner subsystem detects the archive and deploys it. Another straightforward way to perform the same is to go to the **Deployments** section of the console and upload your application archive.
|
||||
|
||||
![How to deploy your application from console][13]
|
||||
|
||||
You can make your own application and deploy it accordingly but here I have used a demo [helloworld][14] application from [WildFly quickstart][15].
|
||||
|
||||
#### **Steps to use WildFly quickstart samples:**
|
||||
|
||||
1. Make a separate folder locally and inside that, clone the WildFly quickstart project. After cloning the repository, change the directory to `helloworld` (or you can play with any other sample projects) and build the maven project.
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
$ mkdir WFLY
|
||||
$ cd WFLY
|
||||
$ git clone –depth 1 [git@github.com][16]:wildfly/quickstart.git
|
||||
$ cd quickstart/helloworld
|
||||
$ mvn clean install
|
||||
```
|
||||
|
||||
2. If you face any project build issues, then you must clone the `boms` repository into your current working directory (WFLY in my example) and build it. After that, build the sample project. This step is only required when building a development version of the WildFly server. It isn’t required when running a [tagged][17] or [released][18] version of the WildFly server.
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
$ git clone [git@github.com][16]:wildfly/boms.git
|
||||
$ cd boms
|
||||
$ mvn clean install
|
||||
```
|
||||
|
||||
3. After successfully building the sample project, take the application archive `helloworld.war` from the target folder and copy it inside the `$JBOSS_HOME/standalone/deployments` directory in the server installation.
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
$ cd quickstart/helloworld/target/
|
||||
$ cp helloworld.war …/…/…/wildfly-preview-24.0.0.Final/standalone/deployments/
|
||||
```
|
||||
|
||||
4. Now point your browser to `http://localhost:8080/helloworld/` to see your successfully deployed WildFly application.
|
||||
|
||||
|
||||
|
||||
### **Conclusions**
|
||||
|
||||
Despite WildFly being in the market for almost two decades, it's still a popular choice for developers who want to develop enterprise-ready applications. The code quality remains at a high and efficient level. The developers are continuously doing many unique and significant work that is taking WildFly to its new peak. The [latest WildFly][8] runs well on SE 16 and 17, supporting SE 17 in standard WildFly later this year.
|
||||
|
||||
Michael Dowden takes a look at four Java web frameworks built for scalability.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/wildfly
|
||||
|
||||
作者:[Ranabir Chakraborty][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/ranabir-chakraborty
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer)
|
||||
[2]: https://www.wildfly.org/
|
||||
[3]: https://opensource.com/article/18/5/jakarta-ee
|
||||
[4]: https://github.com/wildfly/wildfly
|
||||
[5]: http://openjdk.java.net/
|
||||
[6]: https://maven.apache.org/download.cgi
|
||||
[7]: https://docs.wildfly.org/24/Installation_Guide.html
|
||||
[8]: https://www.wildfly.org/downloads/
|
||||
[9]: https://docs.wildfly.org/24/Admin_Guide.html#Operating_modes
|
||||
[10]: https://opensource.com/sites/default/files/pictures/welcome_page.png (WildFly welcome page)
|
||||
[11]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[12]: https://opensource.com/sites/default/files/uploads/console.png (WildFly HAL Management console)
|
||||
[13]: https://opensource.com/sites/default/files/uploads/deployment.png (How to deploy your application from console)
|
||||
[14]: https://github.com/wildfly/quickstart/tree/master/helloworld
|
||||
[15]: https://github.com/wildfly/quickstart
|
||||
[16]: mailto:git@github.com
|
||||
[17]: https://github.com/wildfly/quickstart/tags
|
||||
[18]: https://github.com/wildfly/boms/releases
|
@ -0,0 +1,84 @@
|
||||
[#]: subject: (How to Install elementary Tweaks Tool)
|
||||
[#]: via: (https://www.debugpoint.com/2021/07/elementary-tweaks-install/)
|
||||
[#]: author: (Arindam https://www.debugpoint.com/author/admin1/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
How to Install elementary Tweaks Tool
|
||||
======
|
||||
This quick tutorial demonstrates the steps to install elementary Tweaks
|
||||
tool/Pantheon Tweaks Tool.
|
||||
The elementary Tweaks tool is a handy utility specially designed for [elementary OS][1]. It gives you various options to change certain settings for elementary. Although elementary provides most of the settings already, however, few Pantheon desktop tweaks are not available via standard settings. Hence, this tool. This is a similar tool like we have in GNOME called [GNOME Tweaks][2].
|
||||
|
||||
That said, installing this tool is straight forward. Although it’s a bit different in [elementary OS 6 Odin][3] than earlier versions such as elementary OS 5 Juno. From the elementary OS 6 Odin onwards, this tool is renamed as Pantheon Tweaks tool. Here’s how to install.
|
||||
|
||||
### Install elementary Tweaks Tool
|
||||
|
||||
The elementary OS doesn’t include the software-properties-common package, which is required for adding a PPA. If it is not install already, use the following command to install.
|
||||
|
||||
```
|
||||
sudo apt install software-properties-common
|
||||
```
|
||||
|
||||
#### elementary OS 6 Odin
|
||||
|
||||
The Tweak tool is renamed with a new name and being developed separately. It is called [Pantheon Tweaks][4]. And using the following commands you can install it.
|
||||
|
||||
```
|
||||
sudo add-apt-repository -y ppa:philip.scott/pantheon-tweaks
|
||||
sudo apt install -y pantheon-tweaks
|
||||
```
|
||||
|
||||
#### elementary OS 5 Juno and below
|
||||
|
||||
If you are using elementary OS 5 June and below, you can install the earlier [elementary-tweaks][5] using the same PPA. Follow the below commands from terminal.
|
||||
|
||||
```
|
||||
sudo add-apt-repository -y ppa:philip.scott/elementary-tweaks
|
||||
sudo apt install -y elementary-tweaks
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
After installation, you can run it via `Application Menu > System Settings > Tweaks`.
|
||||
|
||||
![tweak in settings][6]
|
||||
|
||||
In the Tweaks window, you can find several options to change and configure your elementary desktop.
|
||||
|
||||
![elementary tweaks after install – options][7]
|
||||
|
||||
For your information, this tool is just a front end to elementary desktop settings. You can very well change them via terminal provided you know the exact name or property. The settings you get in this tool can also be changed via `dconf` editor in `io.elementary` path.
|
||||
|
||||
[][8]
|
||||
|
||||
SEE ALSO: elementary OS 5.1 Hera Released. Here’s What’s New
|
||||
|
||||
Let me know in the comment box below, if you face any trouble installing, or using this tweak tool.
|
||||
|
||||
* * *
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/07/elementary-tweaks-install/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.debugpoint.com/tag/elementary
|
||||
[2]: https://www.debugpoint.com/2018/05/customize-your-ubuntu-desktop-using-gnome-tweak/
|
||||
[3]: https://www.debugpoint.com/2020/09/elementary-os-6-odin-new-features-release-date/
|
||||
[4]: https://github.com/pantheon-tweaks/pantheon-tweaks
|
||||
[5]: https://github.com/elementary-tweaks/elementary-tweaks
|
||||
[6]: https://www.debugpoint.com/blog/wp-content/uploads/2021/07/tweak-in-settings.png
|
||||
[7]: https://www.debugpoint.com/blog/wp-content/uploads/2021/07/elementary-tweaks-after-install-options.png
|
||||
[8]: https://www.debugpoint.com/2019/12/elementary-os-hera-released/
|
116
sources/tech/20210726 How to use cron on Linux.md
Normal file
116
sources/tech/20210726 How to use cron on Linux.md
Normal file
@ -0,0 +1,116 @@
|
||||
[#]: subject: (How to use cron on Linux)
|
||||
[#]: via: (https://opensource.com/article/21/7/cron-linux)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
How to use cron on Linux
|
||||
======
|
||||
The cron system is a method to automatically run commands on a schedule.
|
||||
![Cron expression][1]
|
||||
|
||||
The cron system is a method to automatically run commands on a schedule. A scheduled job is called a _cronjob_, and it’s created in a file called a _crontab_. It’s the easiest and oldest way for a computer user to automate their computer.
|
||||
|
||||
### Writing a cronjob
|
||||
|
||||
To create a cronjob, you edit your `crontab` using the `-e` option:
|
||||
|
||||
|
||||
```
|
||||
`$ crontab -e`
|
||||
```
|
||||
|
||||
This opens your crontab your default text editor. To set the text editor explicitly, use the `EDITOR` [environment variable][2]:
|
||||
|
||||
|
||||
```
|
||||
`$ EDITOR=nano crontab -e`
|
||||
```
|
||||
|
||||
### Cron syntax
|
||||
|
||||
To schedule a cronjob, you provide the command you want your computer to execute, followed by a cron expression. The cron expression schedules when the command gets run:
|
||||
|
||||
* minute (0 to 59)
|
||||
|
||||
* hour (0 to 23, with 0 being midnight)
|
||||
|
||||
* day of month (1 to 31)
|
||||
|
||||
* month (1 to 12)
|
||||
|
||||
* day of week (0 to 6, with Sunday being 0)
|
||||
|
||||
|
||||
|
||||
|
||||
An asterisk (`*`) in a field translates to "every." For example, this expression runs a backup script at the 0th minute of _every_ hour on _every_ day of _every_ month:
|
||||
|
||||
|
||||
```
|
||||
`/opt/backup.sh 0 * * * *`
|
||||
```
|
||||
|
||||
This expression runs a backup script at 3:30 AM on Sunday:
|
||||
|
||||
|
||||
```
|
||||
`/opt/backup.sh 30 3 * * 0`
|
||||
```
|
||||
|
||||
### Simplified syntax
|
||||
|
||||
Modern cron implementations accept simplified macros instead of a cron expression:
|
||||
|
||||
* `@hourly` runs at the 0th minute of every hour of every day
|
||||
|
||||
* `@daily` runs at the 0th minute of the 0th hour of every day
|
||||
|
||||
* `@weekly` runs at the 0th minute of the 0th hour on Sunday
|
||||
|
||||
* `@monthly` runs at the 0th minute of the 0th hour on the first day of the month
|
||||
|
||||
|
||||
|
||||
|
||||
For example, this crontab line runs a backup script every day at midnight:
|
||||
|
||||
|
||||
```
|
||||
`/opt/backup.sh @daily`
|
||||
```
|
||||
|
||||
### How to stop a cronjob
|
||||
|
||||
Once you've started a cronjob, it's designed to run on schedule forever. To stop a cronjob once you've started it, you must edit your crontab, remove the line that triggers the job, and then save the file.
|
||||
|
||||
|
||||
```
|
||||
`$ EDITOR=nano crontab -e`
|
||||
```
|
||||
|
||||
To stop a job that's actively running, [use standard Linux process commands][3] to stop a running process.
|
||||
|
||||
### It’s automated
|
||||
|
||||
Once you’ve written your crontab, save the file and exit your editor. Your cronjob has been scheduled, so cron does the rest.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/cron-linux
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/cron-splash.png?itok=AoBigzts (Cron expression)
|
||||
[2]: https://opensource.com/article/19/8/what-are-environment-variables
|
||||
[3]: https://opensource.com/article/18/5/how-kill-process-stop-program-linux
|
25
sources/tech/20210727 .md
Normal file
25
sources/tech/20210727 .md
Normal file
@ -0,0 +1,25 @@
|
||||
[#]: subject: ()
|
||||
[#]: via: (https://www.2daygeek.com/recover-restore-deleted-logical-volume-linux/)
|
||||
[#]: author: ( )
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
|
||||
======
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/recover-restore-deleted-logical-volume-linux/
|
||||
|
||||
作者:[][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:
|
||||
[b]: https://github.com/lujun9972
|
404
sources/tech/20210727 Analyze the Linux kernel with ftrace.md
Normal file
404
sources/tech/20210727 Analyze the Linux kernel with ftrace.md
Normal file
@ -0,0 +1,404 @@
|
||||
[#]: subject: (Analyze the Linux kernel with ftrace)
|
||||
[#]: via: (https://opensource.com/article/21/7/linux-kernel-ftrace)
|
||||
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Analyze the Linux kernel with ftrace
|
||||
======
|
||||
Ftrace is a great way to learn more about the internal workings of the
|
||||
Linux kernel.
|
||||
![Linux keys on the keyboard for a desktop computer][1]
|
||||
|
||||
An operating system's kernel is one of the most elusive pieces of software out there. It's always there running in the background from the time your system gets turned on. Every user achieves their computing work with the help of the kernel, yet they never interact with it directly. The interaction with the kernel occurs by making system calls or having those calls made on behalf of the user by various libraries or applications that they use daily.
|
||||
|
||||
I've covered how to trace system calls in an earlier article using `strace`. However, with `strace`, your visibility is limited. It allows you to view the system calls invoked with specific parameters and, after the work gets done, see the return value or status indicating whether they passed or failed. But you had no idea what happened inside the kernel during this time. Besides just serving system calls, there's a lot of other activity happening inside the kernel that you're oblivious to.
|
||||
|
||||
### Ftrace Introduction
|
||||
|
||||
This article aims to shed some light on tracing the kernel functions by using a mechanism called `ftrace`. It makes kernel tracing easily accessible to any Linux user, and with its help you can learn a lot about Linux kernel internals.
|
||||
|
||||
The default output generated by the `ftrace` is often massive, given that the kernel is always busy. To save space, I've kept the output to a minimum and, in many cases truncated the output entirely.
|
||||
|
||||
I am using Fedora for these examples, but they should work on any of the latest Linux distributions.
|
||||
|
||||
### Enabling ftrace
|
||||
|
||||
`Ftrace` is part of the Linux kernel now, and you no longer need to install anything to use it. It is likely that, if you are using a recent Linux OS, `ftrace` is already enabled. To verify that the `ftrace` facility is available, run the mount command and search for `tracefs`. If you see output similar to what is below, `ftrace` is enabled, and you can easily follow the examples in this article:
|
||||
|
||||
|
||||
```
|
||||
$ sudo mount | grep tracefs
|
||||
none on /sys/kernel/tracing type tracefs (rw,relatime,seclabel)
|
||||
```
|
||||
|
||||
To make use of `ftrace`, you first must navigate to the special directory as specified in the mount command above, from where you'll run the rest of the commands in the article:
|
||||
|
||||
|
||||
```
|
||||
`$ cd /sys/kernel/tracing`
|
||||
```
|
||||
|
||||
### General work flow
|
||||
|
||||
First of all, you must understand the general workflow of capturing a trace and obtaining the output. If you're using `ftrace` directly, there isn't any special `ftrace-`specific commands to run. Instead, you basically write to some files and read from some files using standard command-line Linux utilities.
|
||||
|
||||
The general steps:
|
||||
|
||||
1. Write to some specific files to enable/disable tracing.
|
||||
2. Write to some specific files to set/unset filters to fine-tune tracing.
|
||||
3. Read generated trace output from files based on 1 and 2.
|
||||
4. Clear earlier output or buffer from files.
|
||||
5. Narrow down to your specific use case (kernel functions to trace) and repeat steps 1, 2, 3, 4.
|
||||
|
||||
|
||||
|
||||
### Types of available tracers
|
||||
|
||||
There are several different kinds of tracers available to you. As mentioned earlier, you need to be in a specific directory before running any of these commands because the files of interest are present there. I use relative paths (as opposed to absolute paths) in my examples.
|
||||
|
||||
You can view the contents of the `available_tracers` file to see all the types of tracers available. You can see a few listed below. Don't worry about all of them just yet:
|
||||
|
||||
|
||||
```
|
||||
$ pwd
|
||||
/sys/kernel/tracing
|
||||
|
||||
$ sudo cat available_tracers
|
||||
hwlat blk mmiotrace function_graph wakeup_dl wakeup_rt wakeup function nop
|
||||
```
|
||||
|
||||
Out of all the given tracers, I focus on three specific ones: `function` and `function_graph` to enable tracing, and `nop` to disable tracing.
|
||||
|
||||
### Identify current tracer
|
||||
|
||||
Usually, by default, the tracer is set to `nop`. That is, "No operation" in the special file `current_tracer`, which usually means tracing is currently off:
|
||||
|
||||
|
||||
```
|
||||
$ pwd
|
||||
/sys/kernel/tracing
|
||||
|
||||
$ sudo cat current_tracer
|
||||
nop
|
||||
```
|
||||
|
||||
### View Tracing output
|
||||
|
||||
Before you enable any tracing, take a look at the file where the tracing output gets stored. You can view the contents of the file named `trace` using the [cat][2] command:
|
||||
|
||||
|
||||
```
|
||||
$ sudo cat trace
|
||||
# tracer: nop
|
||||
#
|
||||
# entries-in-buffer/entries-written: 0/0 #P:8
|
||||
#
|
||||
# _-----=> irqs-off
|
||||
# / _----=> need-resched
|
||||
# | / _---=> hardirq/softirq
|
||||
# || / _--=> preempt-depth
|
||||
# ||| / delay
|
||||
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
|
||||
# | | | |||| | |
|
||||
```
|
||||
|
||||
### Enable function tracer
|
||||
|
||||
You can enable your first tracer called `function` by writing `function` to the file `current_tracer` (its earlier content was `nop`, indicating that tracing was off.) Think of this operation as a way of enabling tracing:
|
||||
|
||||
|
||||
```
|
||||
$ pwd
|
||||
/sys/kernel/tracing
|
||||
|
||||
$ sudo cat current_tracer
|
||||
nop
|
||||
$ echo function > current_tracer
|
||||
$
|
||||
$ cat current_tracer
|
||||
function
|
||||
```
|
||||
|
||||
### View updated tracing output for function tracer
|
||||
|
||||
Now that you've enabled tracing, it's time to view the output. If you view the contents of the `trace` file, you see a lot of data being written to it continuously. I've piped the output and am currently viewing only the top 20 lines to keep things manageable. If you follow the headers in the output on the left, you can see which task and Process ID are running on which CPU. Toward the right side of the output, you see the exact kernel function running, followed by its parent function. There is also time stamp information in the center:
|
||||
|
||||
|
||||
```
|
||||
$ sudo cat trace | head -20
|
||||
# tracer: function
|
||||
#
|
||||
# entries-in-buffer/entries-written: 409936/4276216 #P:8
|
||||
#
|
||||
# _-----=> irqs-off
|
||||
# / _----=> need-resched
|
||||
# | / _---=> hardirq/softirq
|
||||
# || / _--=> preempt-depth
|
||||
# ||| / delay
|
||||
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
|
||||
# | | | |||| | |
|
||||
<idle>-0 [000] d... 2088.841739: tsc_verify_tsc_adjust <-arch_cpu_idle_enter
|
||||
<idle>-0 [000] d... 2088.841739: local_touch_nmi <-do_idle
|
||||
<idle>-0 [000] d... 2088.841740: rcu_nocb_flush_deferred_wakeup <-do_idle
|
||||
<idle>-0 [000] d... 2088.841740: tick_check_broadcast_expired <-do_idle
|
||||
<idle>-0 [000] d... 2088.841740: cpuidle_get_cpu_driver <-do_idle
|
||||
<idle>-0 [000] d... 2088.841740: cpuidle_not_available <-do_idle
|
||||
<idle>-0 [000] d... 2088.841741: cpuidle_select <-do_idle
|
||||
<idle>-0 [000] d... 2088.841741: menu_select <-do_idle
|
||||
<idle>-0 [000] d... 2088.841741: cpuidle_governor_latency_req <-menu_select
|
||||
```
|
||||
|
||||
Remember that tracing is on, which means the output of tracing continues to get written to the trace file until you turn tracing off.
|
||||
|
||||
### Turn off tracing
|
||||
|
||||
Turning off tracing is simple. All you have to do is replace `function` tracer with `nop` in the `current_tracer` file and tracing gets turned off:
|
||||
|
||||
|
||||
```
|
||||
$ sudo cat current_tracer
|
||||
function
|
||||
|
||||
$ sudo echo nop > current_tracer
|
||||
|
||||
$ sudo cat current_tracer
|
||||
nop
|
||||
```
|
||||
|
||||
### Enable function_graph tracer
|
||||
|
||||
Now try the second tracer, called `function_graph`. You can enable this using the same steps as before: write `function_graph` to the `current_tracer` file:
|
||||
|
||||
|
||||
```
|
||||
$ sudo echo function_graph > current_tracer
|
||||
|
||||
$ sudo cat current_tracer
|
||||
function_graph
|
||||
```
|
||||
|
||||
### Tracing output of function_graph tracer
|
||||
|
||||
Notice that the output format of the `trace` file has changed. Now, you can see the CPU ID and the duration of the kernel function execution. Next, you see curly braces indicating the beginning of a function and what other functions were called from inside it:
|
||||
|
||||
|
||||
```
|
||||
$ sudo cat trace | head -20
|
||||
# tracer: function_graph
|
||||
#
|
||||
# CPU DURATION FUNCTION CALLS
|
||||
# | | | | | | |
|
||||
6) | n_tty_write() {
|
||||
6) | down_read() {
|
||||
6) | __cond_resched() {
|
||||
6) 0.341 us | rcu_all_qs();
|
||||
6) 1.057 us | }
|
||||
6) 1.807 us | }
|
||||
6) 0.402 us | process_echoes();
|
||||
6) | add_wait_queue() {
|
||||
6) 0.391 us | _raw_spin_lock_irqsave();
|
||||
6) 0.359 us | _raw_spin_unlock_irqrestore();
|
||||
6) 1.757 us | }
|
||||
6) 0.350 us | tty_hung_up_p();
|
||||
6) | mutex_lock() {
|
||||
6) | __cond_resched() {
|
||||
6) 0.404 us | rcu_all_qs();
|
||||
6) 1.067 us | }
|
||||
```
|
||||
|
||||
### Enable trace settings to increase the depth of tracing
|
||||
|
||||
You can always tweak the tracer slightly to see more depth of the function calls using the steps below. After which, you can view the contents of the `trace` file and see that the output is slightly more detailed. For readability, the output of this example is omitted:
|
||||
|
||||
|
||||
```
|
||||
$ sudo cat max_graph_depth
|
||||
0
|
||||
$ sudo echo 1 > max_graph_depth
|
||||
$ # or
|
||||
$ sudo echo 2 > max_graph_depth
|
||||
|
||||
$ sudo cat trace
|
||||
```
|
||||
|
||||
### Finding functions to trace
|
||||
|
||||
The steps above are sufficient to get started with tracing. However, the amount of output generated is enormous, and you can often get lost while trying to find out items of interest. Often you want the ability to trace specific functions only and ignore the rest. But how do you know which processes to trace if you don't know their exact names? There is a file that can help you with this—`available_filter_functions` provides you with a list of available functions for tracing:
|
||||
|
||||
|
||||
```
|
||||
$ sudo wc -l available_filter_functions
|
||||
63165 available_filter_functions
|
||||
```
|
||||
|
||||
### Search for general kernel functions
|
||||
|
||||
Now try searching for a simple kernel function that you are aware of. User-space has `malloc` to allocate memory, while the kernel has its `kmalloc` function, which provides similar functionality. Below are all the `kmalloc` related functions:
|
||||
|
||||
|
||||
```
|
||||
$ sudo grep kmalloc available_filter_functions
|
||||
debug_kmalloc
|
||||
mempool_kmalloc
|
||||
kmalloc_slab
|
||||
kmalloc_order
|
||||
kmalloc_order_trace
|
||||
kmalloc_fix_flags
|
||||
kmalloc_large_node
|
||||
__kmalloc
|
||||
__kmalloc_track_caller
|
||||
__kmalloc_node
|
||||
__kmalloc_node_track_caller
|
||||
[...]
|
||||
```
|
||||
|
||||
### Search for kernel module or driver related functions
|
||||
|
||||
From the output of `available_filter_functions`, you can see some lines ending with text in brackets, such as `[kvm_intel]` in the example below. These functions are related to the kernel module `kvm_intel`, which is currently loaded. You can run the `lsmod` command to verify:
|
||||
|
||||
|
||||
```
|
||||
$ sudo grep kvm available_filter_functions | tail
|
||||
__pi_post_block [kvm_intel]
|
||||
vmx_vcpu_pi_load [kvm_intel]
|
||||
vmx_vcpu_pi_put [kvm_intel]
|
||||
pi_pre_block [kvm_intel]
|
||||
pi_post_block [kvm_intel]
|
||||
pi_wakeup_handler [kvm_intel]
|
||||
pi_has_pending_interrupt [kvm_intel]
|
||||
pi_update_irte [kvm_intel]
|
||||
vmx_dump_dtsel [kvm_intel]
|
||||
vmx_dump_sel [kvm_intel]
|
||||
|
||||
$ lsmod | grep -i kvm
|
||||
kvm_intel 335872 0
|
||||
kvm 987136 1 kvm_intel
|
||||
irqbypass 16384 1 kvm
|
||||
```
|
||||
|
||||
### Trace specific functions only
|
||||
|
||||
To enable tracing of specific functions or patterns, you can make use of the `set_ftrace_filter` file to specify which functions from the above output you want to trace.
|
||||
This file also accepts the `*` pattern, which expands to include additional functions with the given pattern. As an example, I am using the `ext4` filesystem on my machine. I can specify `ext4` specific kernel functions to trace using the following commands:
|
||||
|
||||
|
||||
```
|
||||
$ sudo mount | grep home
|
||||
/dev/mapper/fedora-home on /home type ext4 (rw,relatime,seclabel)
|
||||
|
||||
$ pwd
|
||||
/sys/kernel/tracing
|
||||
|
||||
$ sudo cat set_ftrace_filter
|
||||
#### all functions enabled ####
|
||||
$
|
||||
$ echo ext4_* > set_ftrace_filter
|
||||
$
|
||||
$ cat set_ftrace_filter
|
||||
ext4_has_free_clusters
|
||||
ext4_validate_block_bitmap
|
||||
ext4_get_group_number
|
||||
ext4_get_group_no_and_offset
|
||||
ext4_get_group_desc
|
||||
[...]
|
||||
```
|
||||
|
||||
Now, when you see the tracing output, you can only see functions `ext4` related to kernel functions for which you had set a filter earlier. All the other output gets ignored:
|
||||
|
||||
|
||||
```
|
||||
$ sudo cat trace |head -20
|
||||
# tracer: function
|
||||
#
|
||||
# entries-in-buffer/entries-written: 3871/3871 #P:8
|
||||
#
|
||||
# _-----=> irqs-off
|
||||
# / _----=> need-resched
|
||||
# | / _---=> hardirq/softirq
|
||||
# || / _--=> preempt-depth
|
||||
# ||| / delay
|
||||
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
|
||||
# | | | |||| | |
|
||||
cupsd-1066 [004] .... 3308.989545: ext4_file_getattr <-vfs_fstat
|
||||
cupsd-1066 [004] .... 3308.989547: ext4_getattr <-ext4_file_getattr
|
||||
cupsd-1066 [004] .... 3308.989552: ext4_file_getattr <-vfs_fstat
|
||||
cupsd-1066 [004] .... 3308.989553: ext4_getattr <-ext4_file_getattr
|
||||
cupsd-1066 [004] .... 3308.990097: ext4_file_open <-do_dentry_open
|
||||
cupsd-1066 [004] .... 3308.990111: ext4_file_getattr <-vfs_fstat
|
||||
cupsd-1066 [004] .... 3308.990111: ext4_getattr <-ext4_file_getattr
|
||||
cupsd-1066 [004] .... 3308.990122: ext4_llseek <-ksys_lseek
|
||||
cupsd-1066 [004] .... 3308.990130: ext4_file_read_iter <-new_sync_read
|
||||
```
|
||||
|
||||
### Exclude functions from being traced
|
||||
|
||||
You don't always know what you want to trace but, you surely know what you don't want to trace. For that, there is this file aptly named `set_ftrace_notrace`—notice the "no" in there. You can write your desired pattern in this file and enable tracing, upon which everything except the mentioned pattern gets traced. This is often helpful to remove common functionality that clutters our output:
|
||||
|
||||
|
||||
```
|
||||
$ sudo cat set_ftrace_notrace
|
||||
#### no functions disabled ####
|
||||
```
|
||||
|
||||
### Targetted tracing
|
||||
|
||||
So far, you've been tracing everything that has happened in the kernel. But that won't help us if you wish to trace events related to a specific command. To achieve this, you can turn tracing on and off on-demand and, and in between them, run our command of choice so that you do not get extra output in your trace output. You can enable tracing by writing `1` to `tracing_on`, and `0` to turn it off:
|
||||
|
||||
|
||||
```
|
||||
$ sudo cat tracing_on
|
||||
0
|
||||
|
||||
$ sudo echo 1 > tracing_on
|
||||
$ sudo cat tracing_on
|
||||
1
|
||||
|
||||
$ # Run some specific command that we wish to trace here
|
||||
|
||||
$ sudo echo 0 > tracing_on
|
||||
|
||||
$ cat tracing_on
|
||||
0
|
||||
```
|
||||
|
||||
### Tracing specific PID
|
||||
|
||||
If you want to trace activity related to a specific process that is already running, you can write that PID to a file named `set_ftrace_pid` and then enable tracing. That way, tracing is limited to this PID only, which is very helpful in some instances:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo echo $PID > set_ftrace_pid`
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
`Ftrace` is a great way to learn more about the internal workings of the Linux kernel. With some practice, you can learn to fine-tune `ftrace` and narrow down your searches. To understand `ftrace` in more detail and its advanced usage, see these excellent articles written by the core author of `ftrace` himself—Steven Rostedt.
|
||||
|
||||
* [Debugging the Linux kernel, part 1][3]
|
||||
* [Debugging the Linux kernel, part 2][4]
|
||||
* [Debugging the Linux kernel, part 3][5]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/linux-kernel-ftrace
|
||||
|
||||
作者:[Gaurav Kamathe][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/gkamathe
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
|
||||
[2]: https://opensource.com/article/19/2/getting-started-cat-command
|
||||
[3]: https://lwn.net/Articles/365835/
|
||||
[4]: https://lwn.net/Articles/366796/
|
||||
[5]: https://lwn.net/Articles/370423/
|
110
sources/tech/20210727 Check used disk space on Linux with du.md
Normal file
110
sources/tech/20210727 Check used disk space on Linux with du.md
Normal file
@ -0,0 +1,110 @@
|
||||
[#]: subject: (Check used disk space on Linux with du)
|
||||
[#]: via: (https://opensource.com/article/21/7/check-disk-space-linux-du)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Check used disk space on Linux with du
|
||||
======
|
||||
Find out how much disk space you're using with the Linux du command.
|
||||
![Check disk usage][1]
|
||||
|
||||
No matter how much storage space you have, there's always the possibility for it to fill up. On most personal devices, drives get filled up with photos and videos and music, but on servers, it's not unusual for space to diminish due to data in user accounts and log files. Whether you're in charge of managing a multi-user system or just your own laptop, you can check in on disk usage with the `du` command.
|
||||
|
||||
By default, `du` provides the amount of disk space used in your current directory, as well as the size of each subdirectory:
|
||||
|
||||
|
||||
```
|
||||
$ du
|
||||
12 ./.backups
|
||||
60 .
|
||||
```
|
||||
|
||||
In this example, my current directory takes up all of 60 KB, 12 KB of which is occupied by the subdirectory `.backups`.
|
||||
|
||||
If you find that confusing and would prefer to see all sizes separately, you can use the `--separate-dirs` (or `-S` for short) option:
|
||||
|
||||
|
||||
```
|
||||
$ du --separate-dirs
|
||||
12 ./.backups
|
||||
48 .
|
||||
```
|
||||
|
||||
It's the same information (48 and 12 is 60) but each directory is treated independently of one another.
|
||||
|
||||
To see even more detail, use the --all (or -a for short) option, which displays each file in each directory:
|
||||
|
||||
|
||||
```
|
||||
$ du --separate-dirs --all
|
||||
4 ./example.adoc
|
||||
28 ./graphic.png
|
||||
4 ./.backups/example.adoc~
|
||||
12 ./.backups
|
||||
4 ./index.html
|
||||
4 ./index.adoc
|
||||
48 .
|
||||
```
|
||||
|
||||
### See modification time of files
|
||||
|
||||
When looking through files to find out what's taking up space, it can be useful to see when a file was last modified. Something that hasn't been touched in a year is a likely candidate for archival, especially if you're running out of space.
|
||||
|
||||
To see modification times of files with du, use the `--time` option:
|
||||
|
||||
|
||||
```
|
||||
$ du --separate-dirs --all --time
|
||||
28 2021-07-21 11:12 ./graphic.png
|
||||
4 2021-07-03 10:43 ./example.adoc
|
||||
4 2021-07-13 13:03 ./index.html
|
||||
4 2021-07-23 14:18 ./index.adoc
|
||||
48 2021-07-23 14:19 .
|
||||
```
|
||||
|
||||
### Set a threshold for file size
|
||||
|
||||
When reviewing files in the interest of disk space, you may only care about files of nontrivial size. You set a threshold for the file sizes you want to see with the `--threshold` (or `-t` for short) option. For instance, to view only sizes larger than 1 GB:
|
||||
|
||||
|
||||
```
|
||||
$ \du --separate-dirs --all --time --threshold=1G ~/Footage/
|
||||
1839008 2021-07-14 13:55 /home/tux/Footage/snowfall.mp4
|
||||
1577980 2020-04-11 13:10 /home/tux/Footage/waterfall.mp4
|
||||
8588936 2021-07-14 13:55 /home/tux/Footage/
|
||||
```
|
||||
|
||||
When file sizes get particularly large, they can be difficult to read. Make file sizes easier with the `--human-readable` (or `-h` for short) option:
|
||||
|
||||
|
||||
```
|
||||
$ \du --separate-dirs --all --time \
|
||||
\--threshold=1G --human-readable ~/Footage/
|
||||
1.8G 2021-07-14 13:55 /home/tux/Footage/snowfall.mp4
|
||||
1.6G 2020-04-11 13:10 /home/tux/Footage/waterfall.mp4
|
||||
8.5G 2021-07-14 13:55 /home/tux/Footage/
|
||||
```
|
||||
|
||||
### See available disk space
|
||||
|
||||
To just get a summary of how much disk space remains on a drive, read our article about the [df command][2].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/check-disk-space-linux-du
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/du-splash.png?itok=nRLlI-5A (Check disk usage)
|
||||
[2]: https://opensource.com/article/21/7/use-df-check-free-disk-space-linux
|
@ -0,0 +1,139 @@
|
||||
[#]: subject: (How to Change Lock and Login Screen Wallpaper in elementary OS)
|
||||
[#]: via: (https://www.debugpoint.com/2021/07/change-lock-login-screen-background-elementary-os/)
|
||||
[#]: author: (Arindam https://www.debugpoint.com/author/admin1/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
How to Change Lock and Login Screen Wallpaper in elementary OS
|
||||
======
|
||||
This tutorial explains the steps you need to change lock and login
|
||||
screen background in elementary OS. This will replace the default grey
|
||||
background.
|
||||
Changing the lock or login screen background grey default wallpaper in elementary OS is a bit difficult. The typical greeter configuration change with the path of the image file would not work.
|
||||
|
||||
Unfortunately, it’s not an easier solution because the grey background is an image file and its data is hard coded in the greeter and need to be recompiled with new image to make it work.
|
||||
|
||||
Here’s how.
|
||||
|
||||
![Lock / Login screen background elementary OS \(Odin\)][1]
|
||||
|
||||
### Change Lock and Login Screen Background – elementary OS
|
||||
|
||||
* Open a terminal in your elementary OS.
|
||||
* Install git and following dependencies for [greeter package][2].
|
||||
|
||||
|
||||
|
||||
```
|
||||
sudo apt install git
|
||||
```
|
||||
|
||||
```
|
||||
sudo apt install -y gnome-settings-daemon libaccountsservice-dev libgdk-pixbuf2.0-dev libgranite-dev libgtk-3-dev libhandy-1-dev liblightdm-gobject-1-dev libmutter-6-dev libwingpanel-dev libx11-dev meson valac
|
||||
```
|
||||
|
||||
* Go to temporary /tmp directory and clone the latest greeter master branch from GitHub.
|
||||
|
||||
|
||||
|
||||
```
|
||||
cd /tmp
|
||||
git clone https://github.com/elementary/greeter.git
|
||||
```
|
||||
|
||||
* After cloning is complete, open the path `/tmp/greeter/data` in a file manager.
|
||||
|
||||
|
||||
* The elementary OS uses a PNG file of 100×100 px as default background in the login screen/lock screen. The image is tiled, and it gives an impression of grey background.
|
||||
|
||||
|
||||
* Rename your desired wallpaper image with `texture.png` and overwrite the following file in the path.
|
||||
|
||||
|
||||
|
||||
![gray background is created using this file][3]
|
||||
|
||||
```
|
||||
/tmp/greeter/data/texture.png
|
||||
```
|
||||
|
||||
* Open the file `/tmp/greeter/compositor/SystemBackground.vala` in a text editor and replace the following line –
|
||||
|
||||
|
||||
|
||||
![change the path of image][4]
|
||||
|
||||
```
|
||||
resource:///io/elementary/desktop/gala/texture.png
|
||||
```
|
||||
|
||||
With –
|
||||
|
||||
```
|
||||
resource:///io/elementary/greeter/texture.png
|
||||
```
|
||||
|
||||
* Save the file.
|
||||
|
||||
|
||||
* Open the terminal again and build `greeter` using the following commands.
|
||||
|
||||
|
||||
|
||||
```
|
||||
cd /tmp/greeter
|
||||
meson _build --prefix=/usr
|
||||
sudo ninja install -C _build
|
||||
```
|
||||
|
||||
![building greeter][5]
|
||||
|
||||
* If you face any build error, let me know in the comment below. You should not be seeing any error, as I have tested it.
|
||||
|
||||
|
||||
|
||||
[][6]
|
||||
|
||||
SEE ALSO: elementary OS 5.1 Hera Released. Here’s What’s New
|
||||
|
||||
After the above commands are complete, you can test the login screen by running lightdm in test mode –
|
||||
|
||||
```
|
||||
lightdm --test-mode --debug
|
||||
```
|
||||
|
||||
If it looks good, reboot the system. And you should be seeing your wallpaper in the login screen in elementary OS.
|
||||
|
||||
This guide should work in [elementary OS 6 Odin][7], elementary OS 5 Juno and below.
|
||||
|
||||
### Closing Notes
|
||||
|
||||
I hope this guide helps you to change the background of lock or login screen in your elementary OS. Honestly, its 2021 and changing a background image of login screen requires compilation of code surprises me.
|
||||
|
||||
If you run into error, let me know in the comment box below.
|
||||
|
||||
* * *
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/07/change-lock-login-screen-background-elementary-os/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.debugpoint.com/blog/wp-content/uploads/2021/07/elementary-OS-Login-Screen-in-Odin-1024x768.jpg
|
||||
[2]: https://github.com/elementary/greeter
|
||||
[3]: https://www.debugpoint.com/blog/wp-content/uploads/2021/07/gray-background-is-created-using-this-file.jpg
|
||||
[4]: https://www.debugpoint.com/blog/wp-content/uploads/2021/07/change-the-path-of-image-1024x450.jpg
|
||||
[5]: https://www.debugpoint.com/blog/wp-content/uploads/2021/07/building-greeter.png
|
||||
[6]: https://www.debugpoint.com/2019/12/elementary-os-hera-released/
|
||||
[7]: https://www.debugpoint.com/tag/elementary-os-6
|
@ -0,0 +1,118 @@
|
||||
[#]: subject: (Zathura: A Minimalist Document Viewer for Keyboard Shortcut Pros)
|
||||
[#]: via: (https://itsfoss.com/zathura-document-viewer/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Zathura: A Minimalist Document Viewer for Keyboard Shortcut Pros
|
||||
======
|
||||
|
||||
Every Linux distribution comes with a document viewer app that lets you read PDF and other documents.
|
||||
|
||||
Most of the time, it is [Evince from GNOME][1] that is displayed as Document Viewer in Ubuntu and some other distributions. Evince is a handy tool and supports a wide variety of document formats.
|
||||
|
||||
However, there are other applications for reading documents. Take [Foliate][2] for example. It’s an excellent [application for reading ebooks on Linux][3].
|
||||
|
||||
I recently came across another document viewer called Zathura.
|
||||
|
||||
### Enjoy a mouse-free document reading experience with Zathura
|
||||
|
||||
[Zathura][4] is a highly customizable document viewer based on the [girara user interface][5] and several document libraries. girara implements a simple and minimalist user interface.
|
||||
|
||||
Zathura sure feels to load fast. It is minimalist, so you just get an application window with no sidebar, application menu or anything of that sort.
|
||||
|
||||
![Zathura Document Viewer Interface][6]
|
||||
|
||||
You may open its command line prompt by pressing the : key. You may close the CLI prompt with Esc key.
|
||||
|
||||
If you want to create a bookmark, type :bmark and then provide an index number to the bookmarked page.
|
||||
|
||||
![Bookmarking in Zathura][7]
|
||||
|
||||
You may highlight all the links by pressing the F key. It will also display a number beside the highlighted URL and the command line prompt will appear at the bottom. If you type the URL number and press enter, the URL will be opened in the default web browser.
|
||||
|
||||
![Highlighting and opening links in documents][8]
|
||||
|
||||
Zathura also has automatic reloading feature. So if you make some changes to the document with some other application, the changes will be reflected as Zathura reloads the document.
|
||||
|
||||
You may also install additional plugins to improve the capabilities of Zathura and use it for reading comics or PostScript.
|
||||
|
||||
The problem with Zathura is that you won’t see any documentation or help option anywhere on the application interface. This makes things a bit more difficult if you are not already familiar with the tool.
|
||||
|
||||
You may get the default keyboard shortcuts information from its [man page][9]. Here are a few of them:
|
||||
|
||||
* R: Rotate
|
||||
* D: Toggle between single and double page viewing mode
|
||||
* F: Highlight all links on the current screen
|
||||
* HJKL: Moving with the Vim type keys
|
||||
* Arrows or PgUp/PgDown or the mouse/touchpad for moving up and down
|
||||
* / and search for text, press n or N for moving to next or previous search (like less command)
|
||||
* Q: Close
|
||||
|
||||
|
||||
|
||||
You may find the documentation on the project website to learn about configuration, but I still found it confusing.
|
||||
|
||||
### Installing Zathura on Linux
|
||||
|
||||
Zathura is available in the repositories of the most Linux distributions. I could see it available for Ubuntu, Fedora, Arch and Debian, thanks to the [pkgs.org website][10]. This means that you can use the [package manager of your distribution][11] or the software center to install it.
|
||||
|
||||
On Debian and Ubuntu based distributions, use this command to install Zathura:
|
||||
|
||||
```
|
||||
sudo apt install zathura
|
||||
```
|
||||
|
||||
On Fedora, use:
|
||||
|
||||
```
|
||||
sudo dnf install zathura
|
||||
```
|
||||
|
||||
[Use pacman command on Arch Linux][12]:
|
||||
|
||||
```
|
||||
sudo pacman -Sy zathura
|
||||
```
|
||||
|
||||
And if you want to have a look at its source code, you may visit its GitLab repository:
|
||||
|
||||
[Zathura Source Code][13]
|
||||
|
||||
### Conclusion
|
||||
|
||||
I’ll be honest with you. I am not a fan of mouse-free tools. This is why I prefer Nano over Vim as I cannot remember so many shortcuts.
|
||||
|
||||
I know there are people who swear by their keyboards. However, I would prefer not to spend time learning to configure a document viewer. This is more because I do not read too many documents on my desktop and for the limited PDF viewing, the default application is sufficient.
|
||||
|
||||
It’s not that Zathura does not have it usage. If you are someone who has to deal a lot with documents, be it PDF or LaTex, Zathura could be your next favorite tool if you are a keyboard love.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/zathura-document-viewer/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://wiki.gnome.org/Apps/Evince
|
||||
[2]: https://itsfoss.com/foliate-ebook-viewer/
|
||||
[3]: https://itsfoss.com/best-ebook-readers-linux/
|
||||
[4]: https://pwmt.org/projects/zathura/
|
||||
[5]: https://git.pwmt.org/pwmt/girara
|
||||
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/07/Zathura-Document-Viewer-Interface.png?resize=800%2C492&ssl=1
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/bookmarking-in-zathura.png?resize=800%2C639&ssl=1
|
||||
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/Follow-link-in-Zathura.png?resize=800%2C639&ssl=1
|
||||
[9]: https://itsfoss.com/linux-man-page-guide/
|
||||
[10]: https://pkgs.org/
|
||||
[11]: https://itsfoss.com/package-manager/
|
||||
[12]: https://itsfoss.com/pacman-command/
|
||||
[13]: https://git.pwmt.org/pwmt/zathura
|
@ -7,109 +7,93 @@
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
How the ARPANET Protocols Worked
|
||||
|
||||
ARPANET 协议是如何工作的
|
||||
======
|
||||
|
||||
The ARPANET changed computing forever by proving that computers of wildly different manufacture could be connected using standardized protocols. In my [post on the historical significance of the ARPANET][1], I mentioned a few of those protocols, but didn’t describe them in any detail. So I wanted to take a closer look at them. I also wanted to see how much of the design of those early protocols survives in the protocols we use today.
|
||||
ARPANET 通过证明可以使用标准化协议连接完全不同的制造商的计算机,永远改变了计算。 在我的[关于 ARPANET 的历史意义的帖子][1]中,我提到了其中的一些协议,但没有详细描述它们。所以我想仔细看看它们。也想看看那些早期协议的设计有多少保留到了我们今天使用的协议中。
|
||||
|
||||
ARPANET 通过证明完全不同制造商的计算机能够使用标准化的协议连接起来,从而永久的改变了计算。在我的[关于 ARPANET 的历史意义的帖子][1]中,我提到了其中的一些协议,但没有详细描述它们。所以我想更进一步探索它们。也想看看那些早期协议的设计在我们今天使用的协议中有多少被保留了下来。
|
||||
ARPANET 协议像我们现代的互联网协议,是通过分层形式来组织的。[1][2] 较高层协议运行在较低层协议之上。如今的 TCP/IP 套件有 5 层(物理层、链路层、网络层、传输层、以及应用层),但是这个 ARPANET 仅有 3 层或者可能 4 层,这取决于你怎样计算它们。
|
||||
|
||||
我将会解释每一层是如何工作的,但首先,你需要知道谁在 ARPANET 中是构建了些什么,以及还需要了解为什么要分层。
|
||||
|
||||
### 短暂的历史背景
|
||||
|
||||
ARPANET 由美国联邦政府资助,确切的说是位于美国国防部的高级研究计划属(因此命名为 “ ARPANET ” )。美国政府并没有直接建设这个网络;而是,把这项工作外包给了位于波士顿的一家名为 Bolt, Beranek, and Newman, 的咨询公司,通常更多时候被称为 BBN。
|
||||
|
||||
相反, BBN 承担了实现这个网络的大部分任务,但不是全部。 BBN 所做的是设计和维护一台称为接口消息处理机或简称 IMP 的机器。这个 IMP 是一种定制的 Honeywell 小型计算机,它们被分配给那些想要接入这个 ARPANET 的遍及全国各地的各个站点。它们充当通往 ARPANET 的网关为每个站点提供多达四台主机的连接支持。它基本上是一台路由器。BBN 能控制在 IMP 上运行的软件,把数据包从一个 IMP 转发到另一个 IMP ,但是该公司无法直接控制那些将要连接到 IMP 上并且成为 ARPANET 网络中实际主机的机器。
|
||||
|
||||
那些主机被网络中作为终端用户的计算机科学家们所控制。位于遍及全国各地的主机站点中的这些计算机科学家们,他们负责编写允许主机之间相互通信的软件。而 IMP 赋予主机之间互相发送消息的能力,但是那并没有多大用处除非主机之间能商定一种用于消息的格式。为了解决这个问题,一群杂七杂八的人员组成了网络工作组,其中有大部分是来自各个站点的研究生,该组力求指定主机计算机使用的协议。
|
||||
|
||||
因此,如果你设想通过 ARPANET 进行一次成功的网络互动,(例如发送一封电子邮件),使这些互动成功的一些工程由一组人负责(BBN),然而其他的一些工程则由另一组人负责(网络工作组和在每个站点的工程师们)。这种有组织,有保障的情景或许对推动采用分层的方法来管理 ARPANET 网络中的协议起到很大的作用,这反过来又影响了TCP/IP的分层方式。
|
||||
|
||||
|
||||
The ARPANET protocols were, like our modern internet protocols, organized into layers.[1][2] The protocols in the higher layers ran on top of the protocols in the lower layers. Today the TCP/IP suite has five layers (the Physical, Link, Network, Transport, and Application layers), but the ARPANET had only three layers—or possibly four, depending on how you count them.
|
||||
### 好的,回到协议上来
|
||||
|
||||
ARPANET 协议类似与如今的互联网协议,也是通过分层形式来组织管理的。[1][2] 较高层协议运行在较低层协议之上。如今的 TCP/IP 协议栈有5层(物理层、数据链路层、网络层、传输层、以及应用层),但是这个 ARPANET 仅有3层或者可能4层,这取决于你们怎样去数它们。
|
||||
![ARPANET Network Stack][3] _ARPANET 协议层次结构_
|
||||
|
||||
I’m going to explain how each of these layers worked, but first an aside about who built what in the ARPANET, which you need to know to understand why the layers were divided up as they were.
|
||||
协议层被组织成一个层次结构,在最底部是 “ level 0. ” [2][4] 这在某种意义上是不算数的,因为在 ARPANET 中这层完全由 BBN 控制,所以不需要标准协议。level 0 的作用是管理数据在 IMP 之间如何传输。在 BBN 内部,有管理 IMP 如何做到这一点的规则;在 BBN 之外,IMP 子网是一个黑匣子,它只会传送你提供的任意数据。因此,level 0 是一个没有真正协议的层,就公开已知和商定的规则集而言,它的存在可以被运行在 ARPANET 的主机上的软件忽略。粗略地说,它处理相当于当今使用的 TCP/IP 套件的物理层、链路层和网络层下的所有内容,甚至还包括相当多的传输层,这是我将在这篇文章的末尾回来讨论的内容。
|
||||
|
||||
我将会解释每一层是如何工作的,但首先,你需要知道谁在 ARPANET 中构建了些什么,以及需要了解为什么层要被划分成这样。
|
||||
“ level 1 ” 层在 ARPANET 的主机和它们所连接的 IMP 之间建立了接口。如果你愿意可以认为它是为 BBN 构建的 “ level 0 ” 层的黑匣子使用的一个应用程序接口。 当时它也被称为 IMP-Host 协议。 必须编写和发布该协议,因为在首次建立 ARPANET 网络时,每个主机站点都必须编写自己的软件来与 IMP 连接。 除非 BBN 给他们一些指导,否则他们不会知道如何做到这一点。
|
||||
|
||||
### Some Quick Historical Context
|
||||
短暂的历史背景
|
||||
|
||||
The ARPANET was funded by the US federal government, specifically the Advanced Research Projects Agency within the Department of Defense (hence the name “ARPANET”). The US government did not directly build the network; instead, it contracted the work out to a Boston-based consulting firm called Bolt, Beranek, and Newman, more commonly known as BBN.
|
||||
|
||||
ARPANET 由美国联邦政府资助,确切的说是位于美国国防部内的高级研究计划属(因此命名为“ARPANET”)。美国政府并没有直接建设这个网络;而是,它把这项工作外包给了基于波士顿的一家名为 Bolt, Beranek, 和 Newman, 通常更多时候被称为 BBN 的咨询公司。
|
||||
BBN 在一份名为 [BBN Report 1822][5] 的冗长文件中指定了 IMP-Host 协议。 随着 ARPANET 的发展,该文件多次被修订; 我将在这里大致描述 IMP-Host 协议最初设计时的工作方式。 根据 BBN 的规则,主机可以将长度不超过 8095 位的消息传递给它们的 IMP,并且每条消息都有一个包含目标主机号和链路识别号的头部字段。[3][6] IMP 将检查指定的主机号,然后尽职尽责地将消息转发到网络中。 当从远端主机接收到消息时,接收 IMP 在将消息传递给本地主机之前会把目标主机号替换为源主机号。 实际上在 IMP 之间传递的内容并不是消息——IMP 将消息分解成更小的数据包以便通过网络传输——但该细节对主机来说是不可见的。
|
||||
|
||||
|
||||
BBN, in turn, handled many of the responsibilities for implementing the network but not all of them. What BBN did was design and maintain a machine known as the Interface Message Processor, or IMP. The IMP was a customized Honeywell minicomputer, one of which was delivered to each site across the country that was to be connected to the ARPANET. The IMP served as a gateway to the ARPANET for up to four hosts at each host site. It was basically a router. BBN controlled the software running on the IMPs that forwarded packets from IMP to IMP, but the firm had no direct control over the machines that would connect to the IMPs and become the actual hosts on the ARPANET.
|
||||
![1969 Host-IMP Leader][7]_Host-IMP 消息头部格式, 截至 1969. 图标来自 [BBN Report 1763][8]_
|
||||
|
||||
反过来,BBN 承担了实现这个网络的大部门责任,但不是全部。BBN 所做的是设计和维护一个称为接口消息处理器或者简称IMP的机器。
|
||||
链路号的取值范围为 0 到 255 ,它有两个作用。一是更高级别的协议可以利用它在网络上的任何两台主机之间建立多个通信信道,因为可以想象得到,在任何时刻都有可能存在多个本地用户与同一个目标主机进行通信的场景(换句话说,链路号允许在主机之间进行多路通信。)二是它也被用在 “ level 1 ” 层去控制主机之间发送的大量流量,以防止高性能计算机压制低性能计算机的情况出现。按照最初的设计,这个 IMP-Host 协议限制每台主机在某一时刻通过某条链路仅发送一条消息。一旦某台主机沿着某条链路发送了一条消息给远端主机后,在它沿着该链路发送下一条消息之前,必须等待接收一条来自远端的 IMP 的特别类型的消息,叫做 RFNM(请求下一条消息)。针对这个体系的后期修订,为了改善它的性能,允许一台主机在给定的时刻传送多达8条消息给另一台主机。.[4][9]
|
||||
|
||||
The host machines were controlled by the computer scientists that were the end users of the network. These computer scientists, at host sites across the country, were responsible for writing the software that would allow the hosts to talk to each other. The IMPs gave hosts the ability to send messages to each other, but that was not much use unless the hosts agreed on a format to use for the messages. To solve that problem, a motley crew consisting in large part of graduate students from the various host sites formed themselves into the Network Working Group, which sought to specify protocols for the host computers to use.
|
||||
“ level 2 ” 层才是事情真正开始变得有趣的地方,因为这一层和在它上面的那一层由 BBN 和国防部全部留给学者们和网络工作组自己去研发。 “ level 2 ” 层包括了 Host-Host 协议,这个协议在 RFC9 中第一次被草拟并且在 RFC54 中第一次被官方指定。更多可读的 Host-Host 协议的解释在 [ ARPANET 协议手册][10] 中被给出。
|
||||
|
||||
So if you imagine a single successful network interaction over the ARPANET, (sending an email, say), some bits of engineering that made the interaction successful were the responsibility of one set of people (BBN), while other bits of engineering were the responsibility of another set of people (the Network Working Group and the engineers at each host site). That organizational and logistical happenstance probably played a big role in motivating the layered approach used for protocols on the ARPANET, which in turn influenced the layered approach used for TCP/IP.
|
||||
“ Host-Host 协议 ” 管理主机之间如何创建和管理链接。链接是某个主机上的写套接字和另一个主机上的读套接字之间的一个单向的数据管道。“ 套接字 ” 的概念是在 “ level-1 ” 层的有限的链路设施(记住链路号只是那 256 个值中的一个)之上被引入的,是为了给程序提供寻找运行在远端主机上的特定进程地址的一种方式。“ 读套接字 ” 是用偶数表示的,而“写套接字”是用奇数表示的;套接字是 “ 读 ” 还是 “ 写 ” 被称为套接字的 “性别”。并没有类似于 TCP 协议那样的 “ 端口号 ” 机制,链接的打开、维持以及关闭操作是通过主机之间使用 “ 链路 0 ” 发送指定格式的 Host-Host 控制消息来实现的,这也是 “ 链路0 ” 被保留的目的。一旦控制消息在“链路 0”上被交换来建立起一个连接后,就可以使用接收端挑选的另一个链路号来发送进一步的数据消息。
|
||||
|
||||
### Okay, Back to the Protocols
|
||||
Host-Host控制消息一般通过 3 个字母型的助记符来表示。当两个主机交换一条 STR(发送端到接收端)消息和一条配对的 RTS(接收端到发送端)消息后,就建立起了一条链接。——这些控制消息都被称为请求链接消息。链接能够被 CLS (关闭)控制消息关闭。存在更进一步的控制信息能够改变从发送端到接收端发送消息的速率。从而需要确保较快的主机不会压制较慢的主机。在 “ level 1 ” 层上的协议提供了流量控制的功能,但对 “ level 2 ” 层来说显然是不够的;我怀疑这是因为从远端 IMP 接收到的 RFNM 只能保证远端 IMP 已经传送该消息到目标主机,不能保证目标主机已经全部处理了该消息。 还有 INR(接收端中断)、INS(发送端中断)控制消息,它们主要是被高层协议使用。
|
||||
|
||||
![ARPANET Network Stack][3] _The ARPANET protocol hierarchy._
|
||||
更高级别的协议都位于 “ level 3 ” ,这层是 ARPANET 的应用层。Telnet 协议,它提供到另一台主机的一个虚拟电传链接,其可能是这些协议中最重要的。但在这层中也有许多其他协议,例如用于传输文件的 FTP 协议和各种用于发送email的实验协议。
|
||||
|
||||
The protocol layers were organized into a hierarchy. At the very bottom was “level 0.”[2][4] This is the layer that in some sense doesn’t count, because on the ARPANET this layer was controlled entirely by BBN, so there was no need for a standard protocol. Level 0 governed how data passed between the IMPs. Inside of BBN, there were rules governing how IMPs did this; outside of BBN, the IMP sub-network was a black box that just passed on any data that you gave it. So level 0 was a layer without a real protocol, in the sense of a publicly known and agreed-upon set of rules, and its existence could be ignored by software running on the ARPANET hosts. Loosely speaking, it handled everything that falls under the Physical, Link, and Internet layers of the TCP/IP suite today, and even quite a lot of the Transport layer, which is something I’ll come back to at the end of this post.
|
||||
在这一层中有一个不同于其他的协议:初始链接协议(ICP)。ICP被认为是一个 “ level-3 ” 层协议,但实际上它是一种 “ level-2.5 ” 层协议,因为其他 “ level-3 ” 层协议都依赖它。ICP的存在是因为 “ level 2 ” 层的 Host-Host 协议提供的链接只是单向的,但大多数的应用需要一个双向(列如:全双工)的链接来做任何有趣的事情。要使得运行在某个主机上的客户端能够链接到另一个主机上长时间运行的服务进程, ICP 定义了两个步骤。第一步是建立一个从服务端到客户端的单向链接,通过使用服务端进程的众所周知的 socket 号来实现。第二步服务端通过建立的这个链接发送一个新的 socket 号给客户端。到那时,那个存在的链接就会被丢弃,然后有另外两个新的链接会被开启,它们是基于传输的 socket 号建立的“读”链接和基于传输的 socket 号加 1 的 “ 写 ” 链接。这个小插曲是大多数事务的一个前提——比如它是建立 Telnet 链接的第一步。
|
||||
|
||||
The “level 1” layer established the interface between the ARPANET hosts and the IMPs they were connected to. It was an API, if you like, for the black box level 0 that BBN had built. It was also referred to at the time as the IMP-Host Protocol. This protocol had to be written and published because, when the ARPANET was first being set up, each host site had to write its own software to interface with the IMP. They wouldn’t have known how to do that unless BBN gave them some guidance.
|
||||
以上是我们对 ARPANET 协议层次结构的提升。你们可能一直期待我在某个时候提一下 “ Network Control Protocol ” 。在我坐下来去研究这篇贴子和我的最后一篇贴子之前,我坚定的认为 ARPANET 运行在一个叫做 NCP 的协议之上。那个首字母缩略词有时用来指代整个 ARPANET 协议,这可能就是我为什么有这个想法的原因。举个例子,[RFC801][11] 讨论了将 ARPANET 从 “ NCP ” 过渡到 “ TCP ” 的方式,这使 NCP 听起来像是一个等同TCP的 ARPANET 协议。但是对于 ARPANET 来说,从来都没有一个叫 “ Network Control Protocol ” 的东西(即使[大英百科全书是这样认为的][12]),我怀疑人们错误地将 “ NCP ” 解释为 “ Network Control Protocol ” ,而实际上它代表的是 “ Network Control Pragram ” 。网络控制程序是一个运行在各个主机上的内核级别的程序,主要负责处理网络通信,等同于现如今操作系统中的 TCP/IP 协议栈。用在 RFC 801 的 “ NCP ” 是一种转喻,而不是协议。
|
||||
|
||||
The IMP-Host Protocol was specified by BBN in a lengthy document called [BBN Report 1822][5]. The document was revised many times as the ARPANET evolved; what I’m going to describe here is roughly the way the IMP-Host protocol worked as it was initially designed. According to BBN’s rules, hosts could pass _messages_ to their IMPs no longer than 8095 bits, and each message had a _leader_ that included the destination host number and something called a _link number_.[3][6] The IMP would examine the designation host number and then dutifully forward the message into the network. When messages were received from a remote host, the receiving IMP would replace the destination host number with the source host number before passing it on to the local host. Messages were not actually what passed between the IMPs themselves—the IMPs broke the messages down into smaller _packets_ for transfer over the network—but that detail was hidden from the hosts.
|
||||
### 与TCP/IP的比较
|
||||
|
||||
![1969 Host-IMP Leader][7] _The Host-IMP message leader format, as of 1969. Diagram from [BBN Report 1763][8]._
|
||||
ARPANET 协议以后都会被 TCP/IP 协议替换(但 Telnet 和 FTP 协议除外,因为它们很容易就能在 TCP 上适配运行)。然而 ARPANET 协议都基于这么一个假设就是网络是由一个单一实体(BBN)来构建和管理的。 TCP/IP 协议套件是为具有可变性和不可靠性的互联的网络而设计的。这就导致了现代协议套件和 ARPANET 协议有明显的不同,比如我们现在怎样区分网络层和传输层。在 ARPANET 中部分由 IMP 实现的类似传输层的功能现在完全由在网络边界的主机负责。
|
||||
|
||||
The link number, which could be any number from 0 to 255, served two purposes. It was used by higher level protocols to establish more than one channel of communication between any two hosts on the network, since it was conceivable that there might be more than one local user talking to the same destination host at any given time. (In other words, the link numbers allowed communication to be multiplexed between hosts.) But it was also used at the level 1 layer to control the amount of traffic that could be sent between hosts, which was necessary to prevent faster computers from overwhelming slower ones. As initially designed, the IMP-Host Protocol limited each host to sending just one message at a time over each link. Once a given host had sent a message along a link to a remote host, it would have to wait to receive a special kind of message called an RFNM (Request for Next Message) from the remote IMP before sending the next message along the same link. Later revisions to this system, made to improve performance, allowed a host to have up to eight messages in transit to another host at a given time.[4][9]
|
||||
我发现关于ARPANET协议最有趣的事情是现在在 TCP 中的传输层的功能有多少在 ARPANET 上经历了一个糟糕的青春期。我不是一个网络专家,因此我拿出大学时的网络课本(Kurose and Ross, let’s go),他们对传输层通常负责什么给出了一个非常好的概述。总结一下他们的解释,一个传输层协议必须至少做到以下几点。这里的 “ segment ” 在 ARPANET 上基本等同于 “ message ” 作为术语被使用:
|
||||
|
||||
The “level 2” layer is where things really start to get interesting, because it was this layer and the one above it that BBN and the Department of Defense left entirely to the academics and the Network Working Group to invent for themselves. The level 2 layer comprised the Host-Host Protocol, which was first sketched in RFC 9 and first officially specified by RFC 54. A more readable explanation of the Host-Host Protocol is given in the [ARPANET Protocol Handbook][10].
|
||||
* 提供进程之间的传送服务,而不仅仅是主机之间的(传输层多路复用和多路分解)
|
||||
* 在每个段的基础上提供完整性检查(即确保传输过程中没有数据损坏)
|
||||
|
||||
The Host-Host Protocol governed how hosts created and managed _connections_ with each other. A connection was a one-way data pipeline between a _write socket_ on one host and a _read socket_ on another host. The “socket” concept was introduced on top of the limited level-1 link facility (remember that the link number can only be one of 256 values) to give programs a way of addressing a particular process running on a remote host. Read sockets were even-numbered while write sockets were odd-numbered; whether a socket was a read socket or a write socket was referred to as the socket’s gender. There were no “port numbers” like in TCP. Connections could be opened, manipulated, and closed by specially formatted Host-Host control messages sent between hosts using link 0, which was reserved for that purpose. Once control messages were exchanged over link 0 to establish a connection, further data messages could then be sent using another link number picked by the receiver.
|
||||
像 TCP 那样,传输层也能够提供可靠的数据传输,这意味着:
|
||||
|
||||
Host-Host control messages were identified by a three-letter mnemonic. A connection was established when two hosts exchanged a STR (sender-to-receiver) message and a matching RTS (receiver-to-sender) message—these control messages were both known as Request for Connection messages. Connections could be closed by the CLS (close) control message. There were further control messages that changed the rate at which data messages were sent from sender to receiver, which were needed to ensure again that faster hosts did not overwhelm slower hosts. The flow control already provided by the level 1 protocol was apparently not sufficient at level 2; I suspect this was because receiving an RFNM from a remote IMP was only a guarantee that the remote IMP had passed the message on to the destination host, not that the host had fully processed the message. There was also an INR (interrupt-by-receiver) control message and an INS (interrupt-by-sender) control message that were primarily for use by higher-level protocols.
|
||||
* “段” 是按顺序被传送的
|
||||
* 不会丢失任何 “段”
|
||||
* “段” 的传送速度不会太快以至于被接收端丢弃(流量控制)
|
||||
|
||||
The higher-level protocols all lived in “level 3”, which was the Application layer of the ARPANET. The Telnet protocol, which provided a virtual teletype connection to another host, was perhaps the most important of these protocols, but there were many others in this level too, such as FTP for transferring files and various experiments with protocols for sending email.
|
||||
似乎在 ARPANET 上关于如何进行多路复用和多路分解以便进程可以通信存在一些混淆—— BBN 在 IMP-Host 层引入了链路号来做到这一点,但结果证明在 Host-Host 层上无论如何套接字号都是必要的。然后链路号只是用于 IMP-Host 级别的流量控制,但 BBN 似乎后来放弃了它,转而支持在唯一的主机对之间进行流量控制,这意味着链路号开始时只是作为这个重载的东西基本上变成了遗迹。 TCP 现在使用端口代替,分别对每一个 TCP 链接进行流量控制。进程间的多路复用和多路分解完全在 TCP 内部进行,不会像 ARPANET 一样泄露到较低层去。
|
||||
|
||||
One protocol in this level was not like the others: the Initial Connection Protocol (ICP). ICP was considered to be a level-3 protocol, but really it was a kind of level-2.5 protocol, since other level-3 protocols depended on it. ICP was needed because the connections provided by the Host-Host Protocol at level 2 were only one-way, but most applications required a two-way (i.e. full-duplex) connection to do anything interesting. ICP specified a two-step process whereby a client running on one host could connect to a long-running server process on another host. The first step involved establishing a one-way connection from the server to the client using the server process’ well-known socket number. The server would then send a new socket number to the client over the established connection. At that point, the existing connection would be discarded and two new connections would be opened, a read connection based on the transmitted socket number and a write connection based on the transmitted socket number plus one. This little dance was a necessary prelude to most things—it was the first step in establishing a Telnet connection, for example.
|
||||
同样有趣的是,鉴于 Kurose 和 Ross 如何开发 TCP 背后的想法,ARPANET 开始于 Kurose 和 Ross 所调用的一个严谨的 “stop-and-wait” 方法,以便在 IMP-Host 层上进行可靠的数据传输。这个 “stop-and-wait” 方法发送一个 “段” 然后就拒绝再去发送更多 “段” ,直到一个最近发送的 “段” 的确认被接收到为止。这是一种简单的方法,但这意味着只有一个 “段” 在整个网络中运行,从而导致协议非常缓慢——这就是为什么 Kurose 和 Ross 将 “stop-and-wait” 仅仅作为在通往功能齐全的传输层协议的路上的垫脚石的原因。在 ARPANET 上,“stop-and-wait” 是一段时间的工作方式,因为在 IMP–Host 层,必须接收下一条消息的请求以响应每条发出的消息,然后才能发送任何进一步的消息。客观的说 ,BBN 起初认为这对于提供主机之间的流量控制是必要的,因此减速是故意的。正如我已经提到的,为了更好的性能,RFNM 的要求后来放宽松了,而且 IMP 也开始向消息中添加序列号和保持对传输中的消息的 “窗口” 的跟踪,这或多或少与如今 TCP 的实现如出一辙。[5][13]
|
||||
|
||||
That finishes our ascent of the ARPANET protocol hierarchy. You may have been expecting me to mention a “Network Control Protocol” at some point. Before I sat down to do research for this post and my last one, I definitely thought that the ARPANET ran on a protocol called NCP. The acronym is occasionally used to refer to the ARPANET protocols as a whole, which might be why I had that idea. [RFC 801][11], for example, talks about transitioning the ARPANET from “NCP” to “TCP” in a way that makes it sound like NCP is an ARPANET protocol equivalent to TCP. But there has never been a “Network Control Protocol” for the ARPANET (even if [Encyclopedia Britannica thinks so][12]), and I suspect people have mistakenly unpacked “NCP” as “Network Control Protocol” when really it stands for “Network Control Program.” The Network Control Program was the kernel-level program running in each host responsible for handling network communication, equivalent to the TCP/IP stack in an operating system today. “NCP”, as it’s used in RFC 801, is a metonym, not a protocol.
|
||||
ARPANET 表明,如果你能让每个人都遵守一些基本规则,异构计算系统之间的通信是可能的。正如我先前所说的,那个是 ARPANET 的最重要的遗产。但是我希望通过这次仔细研究的哪些基本规则所透露的是有多少 ARPANET 协议影响了我们如今所用的协议。在主机和 IMP 之间分担传输层职责的方式上肯定有很多笨拙之处,有时候是冗余的。回想起来,主机之间一开始只能通过给出的任意链路在某刻只发送一条消息,这真的很有趣。 但是 ARPANET 实验是一个独特的机会,可以通过实际构建和操作网络来学习这些经验,当到了是时候升级到我们今天所知的互联网时,似乎这些经验变得很有用。
|
||||
|
||||
### A Comparison with TCP/IP
|
||||
_如果你喜欢这篇贴子,更喜欢每四周发布一次的方式!那么在Twitter上关注[@TwoBitHistory][14] 或者订阅[RSS提要][15],以确保你知道新帖子的发布时间。_
|
||||
|
||||
The ARPANET protocols were all later supplanted by the TCP/IP protocols (with the exception of Telnet and FTP, which were easily adapted to run on top of TCP). Whereas the ARPANET protocols were all based on the assumption that the network was built and administered by a single entity (BBN), the TCP/IP protocol suite was designed for an _inter_-net, a network of networks where everything would be more fluid and unreliable. That led to some of the more immediately obvious differences between our modern protocol suite and the ARPANET protocols, such as how we now distinguish between a Network layer and a Transport layer. The Transport layer-like functionality that in the ARPANET was partly implemented by the IMPs is now the sole responsibility of the hosts at the network edge.
|
||||
|
||||
What I find most interesting about the ARPANET protocols though is how so much of the transport-layer functionality now in TCP went through a janky adolescence on the ARPANET. I’m not a networking expert, so I pulled out my college networks textbook (Kurose and Ross, let’s go), and they give a pretty great outline of what a transport layer is responsible for in general. To summarize their explanation, a transport layer protocol must minimally do the following things. Here _segment_ is basically equivalent to _message_ as the term was used on the ARPANET:
|
||||
|
||||
* Provide a delivery service between _processes_ and not just host machines (transport layer multiplexing and demultiplexing)
|
||||
* Provide integrity checking on a per-segment basis (i.e. make sure there is no data corruption in transit)
|
||||
|
||||
|
||||
|
||||
A transport layer could also, like TCP does, provide _reliable data transfer_, which means:
|
||||
|
||||
* Segments are delivered in order
|
||||
* No segments go missing
|
||||
* Segments aren’t delivered so fast that they get dropped by the receiver (flow control)
|
||||
|
||||
|
||||
|
||||
It seems like there was some confusion on the ARPANET about how to do multiplexing and demultiplexing so that processes could communicate—BBN introduced the link number to do that at the IMP-Host level, but it turned out that socket numbers were necessary at the Host-Host level on top of that anyway. Then the link number was just used for flow control at the IMP-Host level, but BBN seems to have later abandoned that in favor of doing flow control between unique pairs of hosts, meaning that the link number started out as this overloaded thing only to basically became vestigial. TCP now uses port numbers instead, doing flow control over each TCP connection separately. The process-process multiplexing and demultiplexing lives entirely inside TCP and does not leak into a lower layer like on the ARPANET.
|
||||
|
||||
It’s also interesting to see, in light of how Kurose and Ross develop the ideas behind TCP, that the ARPANET started out with what Kurose and Ross would call a strict “stop-and-wait” approach to reliable data transfer at the IMP-Host level. The “stop-and-wait” approach is to transmit a segment and then refuse to transmit any more segments until an acknowledgment for the most recently transmitted segment has been received. It’s a simple approach, but it means that only one segment is ever in flight across the network, making for a very slow protocol—which is why Kurose and Ross present “stop-and-wait” as merely a stepping stone on the way to a fully featured transport layer protocol. On the ARPANET, “stop-and-wait” was how things worked for a while, since, at the IMP-Host level, a Request for Next Message had to be received in response to every outgoing message before any further messages could be sent. To be fair to BBN, they at first thought this would be necessary to provide flow control between hosts, so the slowdown was intentional. As I’ve already mentioned, the RFNM requirement was later relaxed for the sake of better performance, and the IMPs started attaching sequence numbers to messages and keeping track of a “window” of messages in flight in the more or less the same way that TCP implementations do today.[5][13]
|
||||
|
||||
So the ARPANET showed that communication between heterogeneous computing systems is possible if you get everyone to agree on some baseline rules. That is, as I’ve previously argued, the ARPANET’s most important legacy. But what I hope this closer look at those baseline rules has revealed is just how much the ARPANET protocols also influenced the protocols we use today. There was certainly a lot of awkwardness in the way that transport-layer responsibilities were shared between the hosts and the IMPs, sometimes redundantly. And it’s really almost funny in retrospect that hosts could at first only send each other a single message at a time over any given link. But the ARPANET experiment was a unique opportunity to learn those lessons by actually building and operating a network, and it seems those lessons were put to good use when it came time to upgrade to the internet as we know it today.
|
||||
|
||||
_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][14] on Twitter or subscribe to the [RSS feed][15] to make sure you know when a new post is out._
|
||||
|
||||
_Previously on TwoBitHistory…_
|
||||
_以前在 TwoBitHistory 上…_
|
||||
|
||||
> Trying to get back on this horse!
|
||||
>
|
||||
> My latest post is my take (surprising and clever, of course) on why the ARPANET was such an important breakthrough, with a fun focus on the conference where the ARPANET was shown off for the first time:<https://t.co/8SRY39c3St>
|
||||
>
|
||||
> 我最近的贴子是我的一些关于为什么ARPANET是一个如此重要的突破的看法(当然,是令人惊讶和新颖的),并重点关注ARPANET被首次展示的发布会:<https://t.co/8SRY39c3St>
|
||||
>
|
||||
> — TwoBitHistory (@TwoBitHistory) [February 7, 2021][16]
|
||||
> — TwoBitHistory (@TwoBitHistory) [2021年2月7日][16]
|
||||
|
||||
1. The protocol layering thing was invented by the Network Working Group. This argument is made in [RFC 871][17]. The layering thing was also a natural extension of how BBN divided responsibilities between hosts and IMPs, so BBN deserves some credit too. [↩︎][18]
|
||||
1. 协议分层是网络工作组发明的。 这个论点是在[ RFC 871][17] 中提出的。分层也是 BBN 如何在主机和 IMP 之间划分职责的自然延伸,因此 BBN 也值得称赞。 [↩︎][18]
|
||||
|
||||
2. The “level” terminology was used by the Network Working Group. See e.g. [RFC 100][19]. [↩︎][20]
|
||||
2. The “level” 是被网络工作组使用的术语。 详见[RFC 100][19] [↩︎][20]
|
||||
|
||||
3. In later revisions of the IMP-Host protocol, the leader was expanded and the link number was upgraded to a _message ID_. But the Host-Host protocol continued to make use of only the high-order eight bits of the message ID field, treating it as a link number. See the “Host-to-Host” protocol section of the [ARPANET Protocol Handbook][10]. [↩︎][21]
|
||||
|
||||
4. John M. McQuillan and David C. Walden. “The ARPA Network Design Decisions,” p. 284, <https://www.walden-family.com/public/whole-paper.pdf>. Accessed 8 March 2021. [↩︎][22]
|
||||
|
||||
5. Ibid. [↩︎][23]
|
||||
3. 在 IMP-Host 协议的后续版本中,扩展了头部字段,并且将链路号升级为消息 ID。 但是 Host-Host 协议仅仅继续使用消息 ID 字段的高位 8 位,并将其视为链路号。 请参阅 [ARPANET 协议手册][10]的 “ Host-Host ” 协议部分。[↩︎][21]
|
||||
4. John M. McQuillan 和 David C. Walden。 “ARPA 网络设计决策”,第 284页,<https://www.walden-family.com/public/whole-paper.pdf>。 2021 年 3 月 8 日访问。[↩︎][22]
|
||||
5. 同上。[↩︎][23]
|
||||
|
||||
|
||||
|
||||
@ -120,7 +104,7 @@ via: https://twobithistory.org/2021/03/08/arpanet-protocols.html
|
||||
|
||||
作者:[Two-Bit History][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[Lin-vy](https://github.com/Lin-vy)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,38 +0,0 @@
|
||||
[#]: subject: (My family's Linux story)
|
||||
[#]: via: (https://opensource.com/article/21/5/my-linux-story)
|
||||
[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (shiboi77 )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
我的家庭 Linux 故事
|
||||
======
|
||||
我们在Linux的第一次尝试只是一个简单的方法。
|
||||
![在橙色背景的终端命令提示][1]
|
||||
|
||||
我在linux的第一次尝试是“或许我应该试一试”的这种情况。
|
||||
|
||||
回到1990年,我在相当多的软盘上找到了一些打包的红帽发行版,我为家庭笔记本买了第二个硬盘,然后设置安装了它。 这是一件有趣的实验,但是我记起家中并没有准备在这程度上分享电脑。快进到2005年,我最终崩溃了,买了一台运行windows xp的可爱的东芝笔记本电脑。在工作中,我有一个老化的SUN SPARCStation 5,并且我不太喜欢整个solaris的发展方向(基于Motif的桌面)。我真的想要用GIMP来完成一些项目或其他项目,但是安装GNOME1.x的是复杂的(也许它是1.4?)在Solaris是具有挑战性的。所以,我实际上是在考虑跳槽到Windows xp。 但是在我的家用机器上用了几个月之后,我发现自己喜欢它的程度甚至低于在Solaris上运行GNOME,所以我安装了Ubuntu Hoary Hedgehog 5.04然后在我的笔记本电脑上安装了Breezy Badger 5.10。这太棒了。那台拥有3.2GHz奔腾处理器,2GB内存和100GB的硬盘的机器在我的SPARCStation 5周围运行。
|
||||
|
||||
突然之间,不再是用拼凑起来的Solaris安装包试图去让东西运行,这些事情仅仅是一个轻松地方式。并且时机也很好。我家庭和我从2006年8月到2007年7月居住在法国格勒诺布尔,而我的妻子在休假。因为有了linux东芝,我才能随身带着我的工作。那个时候我在几大项目上做了大量的GIS数据处理,我发现我可以在PostGIS / PostgreSQL上做同样的事情,比我们在加拿大使用的昂贵得多的商业GIS软件要快得多。大家都很开心,尤其是我。
|
||||
|
||||
一路上发生的有趣的事情是,我们把另外两台电脑逮到了法国——我妻子的类似的东芝电脑(运行xp,对她来说很好用)和我们孩子最近新买的东芝牌笔记本电脑,也运行xp。仅仅就在圣诞节过后,他们有一些朋友在无意中安装了一个讨厌的并且无法清除的病毒在他们的电脑上。经过几个小时甚至几天后,我的一个孩子问我:“爸爸,我们就不能安装和你电脑上一样的东西吗?”然后,创建了三个新的Linux用户。我的儿子在29岁依然是一个快乐的Linux用户,我猜他第四或第五台Linux笔记本电脑的系统全部由最近的系统76支持。我的一个女儿三年前开始读法学院,因为他所在的学校有一个强制性的测试框架,只能在Windows上运行,而且据称会检测VM之类的东西(请不要让我开始)。而且我的另一个女儿被她的公司为她买的Macbook Air诱惑了。
|
||||
|
||||
哦,好吧,不能赢得他们所有!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/5/my-linux-story
|
||||
|
||||
作者:[Chris Hermansen][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[shiboi77](https://github.com/shiboi77)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/clhermansen
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background)
|
210
translated/tech/20190807 Trace code in Fedora with bpftrace.md
Normal file
210
translated/tech/20190807 Trace code in Fedora with bpftrace.md
Normal file
@ -0,0 +1,210 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (YungeG)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Trace code in Fedora with bpftrace)
|
||||
[#]: via: (https://fedoramagazine.org/trace-code-in-fedora-with-bpftrace/)
|
||||
[#]: author: (Augusto Caringi https://fedoramagazine.org/author/acaringi/)
|
||||
|
||||
在 Fedora 中用 bpftrace 追踪代码
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
bpftrace 是一个[基于 eBPF 的新型追踪工具][2],在 Fedora 28 第一次引入。Brendan Gregg,Alastair Robertson 和 Matheus Marchini 在分散于全网络的黑客团队的帮助下开发了 bpftrace,一个允许你分析系统在幕后正在执行的操作的追踪工具,告诉你代码中正在被调用的函数、传递给函数的参数、函数的调用次数等。
|
||||
|
||||
这篇文章的内容涉及了 bpftrace 的一些基础,以及它是如何工作的,请继续阅读获取更多的信息和一些有用的实例。
|
||||
|
||||
### eBPF (extended Berkeley Packet Filter)
|
||||
|
||||
[eBPF][3] 是一个微型虚拟机,更确切的说是一个虚拟 CPU,位于 Linux 内核中。eBPF 可以在内核空间以一种安全可控的方式加载和运行体积较小的程序,保证 eBPF 的使用更加安全,即使在生产环境系统中。eBPF 虚拟机有自己的指令集([ISA][4]),类似于现代处理器架构的一个子集。通过这个 ISA,可以很容易将 eBPF 程序转化为真实硬件上的代码。内核即时将程序转化为主流处理器架构上的本地代码,从而提升性能。
|
||||
|
||||
eBPF 虚拟机允许通过编程扩展内核,目前已经有一些内核子系统使用这一新型强大的 Linux Kernel 功能,比如网络,安全计算、追踪等。这些子系统的主要思想是添加 eBPF 程序到特定的代码点,从而扩展原生的内核行为。
|
||||
|
||||
虽然 eBPF 机器语言功能强大,由于是一种底层语言,直接用于编写代码很费力,bpftrace 就是为了解决这个问题而生的。eBPF 提供了一种高级语言编写 eBPF 追踪脚本,然后在 clang / LLVM 库的帮助下将这些脚本转化为 eBPF,最终添加到特定的代码点。
|
||||
|
||||
## 安装和快速入门
|
||||
|
||||
在终端 [使用][5] _[sudo][5]_ 执行下面的命令安装 bpftrace:
|
||||
|
||||
```
|
||||
$ sudo dnf install bpftrace
|
||||
```
|
||||
|
||||
使用“hello world”进行实验:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 'BEGIN { printf("hello world\n"); }'
|
||||
```
|
||||
|
||||
注意,出于特权级的需要,你必须使用 _root_ 运行 _bpftrace_,使用 _-e_ 选项指明一个程序,构建一个所谓的“单行程序”。这个例子只会打印 _hello world_,接着等待你按下 **Ctrl+C**。
|
||||
|
||||
_BEGIN_ 是一个特殊的探针名,只在执行一开始生效一次;每次探针命中时,大括号 _{}_ 内的操作——这个例子中只是一个 _printf_——都会执行。
|
||||
|
||||
现在让我们转向一个更有用的例子:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 't:syscalls:sys_enter_execve { printf("%s called %s\n", comm, str(args->filename)); }'
|
||||
```
|
||||
|
||||
这个例子打印系统中正在创建的每个新进程的父进程名 _(comm)_。_t:syscalls:sys_enter_execve_ 是一个内核追踪点,是 _tracepoint:syscalls:sys_enter_execve_ 的简写,两种形式都可以使用。下一部分会向你展示如何列出所有可用的追踪点。
|
||||
|
||||
_comm_ 是一个 bpftrace 内建指令,代表进程名;_filename_ 是 _t:syscalls:sys_enter_execve_ 追踪点的一个域,这些域可以通过 _args_ 内建指令访问。
|
||||
|
||||
追踪点的所有可用域可以通过这个命令列出:
|
||||
|
||||
```
|
||||
bpftrace -lv "t:syscalls:sys_enter_execve"
|
||||
```
|
||||
|
||||
## 示例用法
|
||||
|
||||
### 列出探针
|
||||
|
||||
_bpftrace_ 的一个核心概念是 **探针点**,即 eBPF 程序可以连接到的(内核或用户空间)代码中的测量点,可以分成以下几大类:
|
||||
|
||||
* _kprobe_——内核函数的开始处
|
||||
* _uprobe_——内核函数的返回处
|
||||
* _uprobe_——用户级函数的开始处
|
||||
* _uretprobe_——用户级函数的返回处
|
||||
* _tracepoint_——内核静态追踪点
|
||||
* _usdt_——用户级静态追踪点
|
||||
* _profile_——基于时间的采样
|
||||
* _interval_——基于时间的输出
|
||||
* _software_——内核软件事件
|
||||
* _hardware_——用户级事件
|
||||
|
||||
所有可用的 _kprobe / kretprobe_、_tracepoints_、_software_ 和 _hardware_ 探针可以通过这个命令列出:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -l
|
||||
```
|
||||
|
||||
_uprobe / uretprobe_ 和 _usdt_ 是用户空间探针,专用于某个可执行文件。要使用这些探针,通过下文中的特殊语法。
|
||||
|
||||
_profile_ 和 _interval_ 探针以固定的时间间隔触发;固定的时间间隔不在本文的范畴内。
|
||||
|
||||
|
||||
### 统计系统调用数
|
||||
|
||||
### Counting system calls
|
||||
|
||||
**Maps** 是保存计数、统计数据和柱状图的特殊 BPF 数据类型,你可以使用映射统计每个系统调用正在被调用的次数:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 't:syscalls:sys_enter_* { @[probe] = count(); }'
|
||||
```
|
||||
|
||||
一些探针类型允许使用通配符匹配多个探针,你也可以使用一个逗号隔开的列表为一个操作块指明多个连接点。上面的例子中,操作块连接到了所有名称以 _t:syscalls:sysenter__ 开头的追踪点,即所有可用的系统调用。
|
||||
|
||||
bpftrace 的内建函数 _count()_ 统计系统调用被调用的次数;_@[]_ 代表一个映射(一个关联的数组)。映射的键是另一个内建指令 _probe_,代表完整的探针名。
|
||||
|
||||
这个例子中,相同的操作块连接到了每个系统调用,之后每次有系统调用被调用时,映射就会被更新,映射中和系统调用对应的项就会增加。程序终止时,自动打印出所有声明的映射。
|
||||
|
||||
下面的例子统计所有的系统调用,然后通过 bpftrace 过滤语法使用 _PID_ 过滤出某个特定进程调用的系统调用:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 't:syscalls:sys_enter_* / pid == 1234 / { @[probe] = count(); }'
|
||||
```
|
||||
|
||||
### 进程写的字节数
|
||||
|
||||
让我们使用上面的概念分析每个进程正在写的字节数:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 't:syscalls:sys_exit_write /args->ret > 0/ { @[comm] = sum(args->ret); }'
|
||||
```
|
||||
|
||||
_bpftrace_ 连接操作块到写系统调用的返回探针(_t:syscalls:sys_exit_write_),然后使用过滤器丢掉代表错误代码的负值(_/arg->ret > 0/_)。
|
||||
|
||||
映射的键 _comm_ 代表调用系统调用的进程名;内建函数 _sum()_ 累计每个映射项或进程写的字节数;_args_ 是一个 `bpftrace` 内建指令,用于访问追踪点的参数和返回值。如果执行成功,_write_ 系统调用返回写的字节数,_arg->ret_ 用于访问这个字节数。
|
||||
|
||||
### 进程的读取大小分布(柱状图):
|
||||
|
||||
_bpftrace_ 支持创建柱状图。让我们分析一个创建进程的 _read_ 大小分布的柱状图的例子:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 't:syscalls:sys_exit_read { @[comm] = hist(args->ret); }'
|
||||
```
|
||||
|
||||
柱状图是 BPF 映射,因此必须保存为一个映射(_@_),这个例子中映射键是 _comm_。
|
||||
|
||||
这个例子使 _bpftrace_ 给每个调用 _read_ 系统调用的进程生成一个柱状图。要生成一个全局柱状图,直接保存 _hist()_ 函数到 _'@'_(不使用任何键)。
|
||||
|
||||
程序终止时,bpftrace 自动打印出声明的柱状图。创建柱状图的基准值是通过 _args->ret_ 获取到的读取的字节数。
|
||||
|
||||
### 追踪用户空间程序
|
||||
|
||||
你也可以通过 _uprobes / uretprobes_ 和 _USDT_(用户级静态定义的追踪)追踪用户空间程序。下一个例子使用探测用户级函数结尾处的 _uretprobe_ ,获取系统中运行的每个 _bash_ 发出的命令行:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -e 'uretprobe:/bin/bash:readline { printf("readline: \"%s\"\n", str(retval)); }'
|
||||
```
|
||||
|
||||
要列出可执行文件 _bash_ 的所有可用 _uprobes / uretprobes_, 执行这个命令:
|
||||
|
||||
```
|
||||
$ sudo bpftrace -l "uprobe:/bin/bash"
|
||||
```
|
||||
|
||||
_uprobe_ 指向用户级函数执行的开始,_uretprobe_ 指向执行的结束(返回处);_readline()_ 是 _/bin/bash_ 的一个函数,返回键入的命令行;_retval_ 是被探测的指令的返回值,只能在 _uretprobe_ 访问。
|
||||
|
||||
使用 _uprobes_ 时,你可以用 _arg0..argN_ 访问参数。需要调用 _str()_ 将 _char *_ 指针转化成一个 _string_。
|
||||
|
||||
## 自带脚本
|
||||
|
||||
bpftrace 软件包附带了许多有用的脚本,可以在 _/usr/share/bpftrace/tools/_ 目录找到。
|
||||
|
||||
这些脚本中,你可以找到:
|
||||
|
||||
* _killsnoop.bt_——追踪 `kill()` 系统调用发出的信号
|
||||
* _tcpconnect.bt_——追踪所有的 TCP 网络连接
|
||||
* _pidpersec.bt_——统计每秒钟(通过 fork)创建的新进程
|
||||
* _opensnoop.bt_——追踪 `open()` 系统调用
|
||||
* _bfsstat.bt_——追踪一些 VFS 调用,按秒统计
|
||||
|
||||
你可以直接使用这些脚本,比如:
|
||||
|
||||
```
|
||||
$ sudo /usr/share/bpftrace/tools/killsnoop.bt
|
||||
```
|
||||
|
||||
你也可以在创建新的工具时参考这些脚本。
|
||||
|
||||
## 链接
|
||||
|
||||
* bpftrace 参考指南——<https://github.com/iovisor/bpftrace/blob/master/docs/reference_guide.md>
|
||||
* Linux 2018 `bpftrace`(DTrace 2.0)——<http://www.brendangregg.com/blog/2018-10-08/dtrace-for-linux-2018.html>
|
||||
* BPF:通用的内核虚拟机——<https://lwn.net/Articles/599755/>
|
||||
* Linux Extended BPF(eBPF)Tracing Tools——<http://www.brendangregg.com/ebpf.html>
|
||||
* 深入 BPF:一个阅读材料列表—— [https://qmonnet.github.io/whirl-offload/2016/09/01/dive-into-bpf][6]
|
||||
|
||||
|
||||
|
||||
|
||||
* * *
|
||||
|
||||
_Photo by _[_Roman Romashov_][7]_ on _[_Unsplash_][8]_._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/trace-code-in-fedora-with-bpftrace/
|
||||
|
||||
作者:[Augusto Caringi][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[YungeG](https://github.com/YungeG)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/acaringi/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/bpftrace-816x345.jpg
|
||||
[2]: https://github.com/iovisor/bpftrace
|
||||
[3]: https://lwn.net/Articles/740157/
|
||||
[4]: https://github.com/iovisor/bpf-docs/blob/master/eBPF.md
|
||||
[5]: https://fedoramagazine.org/howto-use-sudo/
|
||||
[6]: https://qmonnet.github.io/whirl-offload/2016/09/01/dive-into-bpf/
|
||||
[7]: https://unsplash.com/@wehavemegapixels?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[8]: https://unsplash.com/search/photos/trace?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
@ -1,50 +0,0 @@
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "Arzelan"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: subject: "6 evening rituals for working in tech"
|
||||
[#]: via: "https://opensource.com/article/20/11/evening-rituals-working-tech"
|
||||
[#]: author: "Jen Wike Huger https://opensource.com/users/jen-wike"
|
||||
|
||||
IT人的6个晚上放松方式
|
||||
======
|
||||
|
||||
在结束了一天的远程会议、邮件往来、写代码和其他协作工作后,你在晚上如何放松自己呢?
|
||||
|
||||
![A farm road][1]
|
||||
|
||||
这个特殊的时间一方面让我们有机会停下脚步放松自己,但另一方面来说,这时候可能比其他时候更忙,尤其是当你除了照顾自己还要照顾家人的时候。 俗话说,空杯子倒不出酒。所以,我们看看在关上电脑或者完成最后一件工作之后,能为自己做些什么?
|
||||
|
||||
1\. 走出家门,做几次深呼吸,不要在乎是不是下雪天,让新鲜的空气从肺部充满全身。如果可以的话,在院子里走走,或者去街上逛逛。
|
||||
|
||||
2\. 如果有时间的话,给自己沏杯茶,黑茶含有咖啡因,最好不要晚上喝、可以喝绿茶或者花果茶,然后你可以穿上鞋、穿上外套、把茶倒在保温杯里,去在小区周围散步。不用设置目标或者目的地,就随便走走。如果你时间不充裕的话,可以定一个15分钟的闹钟。
|
||||
|
||||
3\. 放一首突然想到的歌,或者听之前想听但是一直没机会听的歌。
|
||||
|
||||
4\. 如果你有时间的话,别在椅子上继续坐着,可以站起来跳一段舞活动活动,或者到床上平躺着,躺着的时候什么也不要想,放空自己,让大脑休息休息。研究表明,给大脑一段空白时间后可以更好的思考。
|
||||
|
||||
5\. 打开你的[电子书app][2]或者选择看一本纸质书,看纸质书相对来说对眼睛好点。享受轻松的阅读,如果不能长时间阅读的话,起码给自己留出能阅读一个章节的时间。
|
||||
|
||||
6\. 做美食。享受把基本的食材按照菜谱做成一份美味佳肴的成就感和兴奋感。
|
||||
|
||||
你也可以在晚上把这几条挑几个综合起来做,来好好放松。如果你是IT人员,那么无论是在[早上][3]、中午、晚上用这些方式放松都很有效,因为现在我们都是在家工作,远程办公,没有和同事面对面交流时的闲暇。
|
||||
|
||||
那么,你的晚上放松方式是什么?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/11/evening-rituals-working-tech
|
||||
|
||||
作者:[Jen Wike Huger][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[Arzelan](https://github.com/Arzelan)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jen-wike
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDUCATION_jadud_farm-road.png?itok=of8IuSM5 "A farm road"
|
||||
[2]: https://opensource.com/article/20/2/linux-ebook-readers
|
||||
[3]: https://opensource.com/article/20/10/tech-morning-rituals
|
@ -0,0 +1,118 @@
|
||||
[#]: subject: (Run a Linux virtual machine in Podman)
|
||||
[#]: via: (https://opensource.com/article/21/7/linux-podman)
|
||||
[#]: author: (Sumantro Mukherjee https://opensource.com/users/sumantro)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
在 Podman 中运行一个 Linux 虚拟机
|
||||
======
|
||||
使用 Podman Machine 创建一个基本的 Fedora CoreOS 虚拟机来使用容器和容器化工作负载。
|
||||
![woman on laptop sitting at the window][1]
|
||||
|
||||
Fedora CoreOS 是一个自动更新、基于最小 [rpm-ostree][2]的 操作系统,用于安全地、大规模地运行容器化工作负载。
|
||||
|
||||
[Podman][3] “是一个用于管理容器和镜像、挂载到这些容器中的卷,以及由这些容器组组成的 pod 的工具。Podman 基于 libpod,它是一个容器生命周期管理库”。
|
||||
|
||||
当你使用 [Podman Machine][4] 时,神奇的事情发生了,它可以帮助你创建一个基本的 Fedora CoreOS 虚拟机(VM)来使用容器和容器化工作负载。
|
||||
|
||||
### 开始使用 Podman Machine
|
||||
|
||||
第一步是安装 Podman。如果你已经安装了最新版本的 Podman,你可以跳过这个步骤。在我的 Fedora 34 机器上,我用以下方式安装 Podman:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install podman`
|
||||
```
|
||||
|
||||
我使用的是 podman-3.2.2-1.fc34.x86_64。
|
||||
|
||||
### 初始化 Fedora CoreOS
|
||||
|
||||
Podman 安装完成后,用以下方法初始化它:
|
||||
|
||||
|
||||
```
|
||||
❯ podman machine init vm2
|
||||
Downloading VM image: fedora-coreos-34.20210626.1.0-qemu.x86_64.qcow2.xz: done
|
||||
Extracting compressed file
|
||||
```
|
||||
|
||||
这个命令创建了 `vm2`,并下载了 .xz 格式的 Fedora CoreOS 的 qcow2 文件并将其解压。
|
||||
|
||||
### 列出你的虚拟机
|
||||
|
||||
了解你的虚拟机和它们的状态是很重要的,`list` 命令可以帮助你做到这一点。下面的例子显示了我所有的虚拟机的名称,它们被创建的日期,以及它们最后一次启动的时间:
|
||||
|
||||
|
||||
```
|
||||
❯ podman machine list
|
||||
NAME VM TYPE CREATED LAST UP
|
||||
podman-machine-default* qemu 6 days ago Currently running
|
||||
vm2 qemu 11 minutes ago 11 minutes ago
|
||||
```
|
||||
|
||||
### 启动一个虚拟机
|
||||
|
||||
要启动一个虚拟机,请运行:
|
||||
|
||||
|
||||
```
|
||||
❯ podman machine start
|
||||
Waiting for VM …
|
||||
```
|
||||
|
||||
### SSH 到虚拟机
|
||||
|
||||
你可以使用 SSH 来访问你的虚拟机,并使用它来运行工作负载,而没有任何麻烦的设置:
|
||||
|
||||
|
||||
```
|
||||
❯ podman machine ssh
|
||||
Connecting to vm podman-machine-default. To close connection, use `~.` or `exit`
|
||||
Fedora CoreOS 34.20210611.1.0
|
||||
Tracker: <https://github.com/coreos/fedora-coreos-tracker>
|
||||
Discuss: <https://discussion.fedoraproject.org/c/server/coreos/>
|
||||
|
||||
Last login: Wed Jun 23 13:23:36 2021 from 10.0.2.2
|
||||
[core@localhost ~]$ uname -a
|
||||
Linux localhost 5.12.9-300.fc34.x86_64 #1 SMP Thu Jun 3 13:51:40 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
|
||||
[core@localhost ~]$
|
||||
```
|
||||
|
||||
目前,Podman 只支持一次运行一个虚拟机。
|
||||
|
||||
### 停止你的虚拟机
|
||||
|
||||
要停止运行中的虚拟机,请使用 `stop` 命令:
|
||||
|
||||
|
||||
```
|
||||
❯ podman machine stop
|
||||
|
||||
[core@localhost ~]$ Connection to localhost closed by remote host.
|
||||
Connection to localhost closed.
|
||||
Error: exit status 255
|
||||
```
|
||||
|
||||
我希望这能帮助你开始使用 Podman Machine。请试一试,并在评论中告诉我们你的想法。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/linux-podman
|
||||
|
||||
作者:[Sumantro Mukherjee][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/sumantro
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop)
|
||||
[2]: http://coreos.github.io/rpm-ostree/
|
||||
[3]: https://github.com/containers/podman
|
||||
[4]: http://docs.podman.io/en/latest/markdown/podman-machine.1.html
|
@ -0,0 +1,135 @@
|
||||
[#]: subject: (Top Android Emulators to Run and Test Android Apps on Linux)
|
||||
[#]: via: (https://itsfoss.com/android-emulators-linux/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
在 Linux 上运行和测试 Android 应用的顶级 Android 模拟器
|
||||
======
|
||||
|
||||
安卓系统是建立在高度定制的 Linux 内核之上的。因此,使用安卓模拟器在 Linux 上运行移动应用是有意义的。
|
||||
|
||||
虽然这不是在 Linux 机器上你可以做的新事情,但在 Windows 于 2021 年推出运行安卓应用的能力后,它是一个更需要的功能。
|
||||
|
||||
不仅仅限于使用应用,一些安卓模拟器也可以在开发和测试中派上用场。
|
||||
|
||||
因此,我总结了一份最好的模拟器清单,你可以用它来测试或在 Linux 上运行 Android 应用/游戏。
|
||||
|
||||
### 1\. Anbox
|
||||
|
||||
Anbox 是一个相当流行的让 Linux 用户运行 Android 应用的模拟器。可能 Deepin Linux 正是利用它使得开箱即可运行 Android 应用。
|
||||
|
||||
它使用一个容器将安卓操作系统与主机隔离,这也让它们可以使用最新的安卓版本。
|
||||
|
||||
运行的安卓应用将不能直接访问你的硬件,这是一个很好的安全决定。
|
||||
|
||||
与这里的其他一些选项不同,Anbox 在技术上不需要仿真层来使安卓系统工作。换句话说,它在你的 Linux 系统上最接近于原生的 Android 体验。
|
||||
|
||||
由于这个原因,它可能不是最简单的选择。你不能只使用谷歌应用商店来安装应用,你需要使用安卓调试桥(ADB)。你只需要一个应用的 APK 文件就可以安装和使用它。
|
||||
|
||||
[Anbox][1]
|
||||
|
||||
### 2\. Genymotion
|
||||
|
||||
![][2]
|
||||
|
||||
Genymotion 是一个为测试和开发量身定做的令人印象深刻的解决方案。
|
||||
|
||||
它不是一个免费和开源的选择。它们通过云端或独立于 Android Studio 的桌面客户端,提供虚拟的 Android 体验作为服务。
|
||||
|
||||
你可以模拟各种硬件配置和安卓版本,创建一个虚拟设备进行测试。它还让你有能力扩大规模,并有多个安卓虚拟设备运行,进行广泛的测试。
|
||||
|
||||
它可以帮助你测试文件上传在你的应用中如何工作,电池影响、性能、内存等等。
|
||||
|
||||
虽然它是一个主要针对专业人士的高级解决方案,但它确实支持最新的 Linux 发行版,包括 Ubuntu 20.04 LTS。
|
||||
|
||||
[Genymotion][3]
|
||||
|
||||
### 3\. Android-x86
|
||||
|
||||
![][4]
|
||||
|
||||
Android x86 是一个开源项目,使得 Android 在 PC 上运行,并支持 32 位。
|
||||
|
||||
你可以选择在你的 Linux 系统上使用虚拟机管理器来安装它,或者直接在你的 PC 上试用它。
|
||||
|
||||
如果你需要安装,可以查看官方的[安装说明][5]。
|
||||
|
||||
与其他一些选项不同,它是一个简单的试图在 PC 上工作的模拟器,没有花哨的功能。
|
||||
|
||||
[Android x86][6]
|
||||
|
||||
### 4\. Android Studio (虚拟设备)
|
||||
|
||||
![][7]
|
||||
|
||||
Android Studio 是一个用于开发和测试的完整工具。幸运的是,由于对 Linux 的支持,如果你需要的话,你可以用它来模拟 Android 的体验进行实验。
|
||||
|
||||
你只需要创建一个安卓虚拟设备(AVD),你可以对其进行配置,然后作为模拟器进行模拟。
|
||||
|
||||
也有很大的机会找到对一些最新的智能手机、电视和智能手表的支持。
|
||||
|
||||
它需要一定的学习曲线才能上手,但它是免费的,而且是完全开源的。
|
||||
|
||||
[Android Studio][8]
|
||||
|
||||
### 5\. ARChon
|
||||
|
||||
![][9]
|
||||
|
||||
一个有趣的解决方案是一个你可以在 Linux 和任何其他平台上使用的 Android 模拟器。
|
||||
|
||||
它有助于在 Chrome OS 上运行 Android 应用,或者在任何操作系统上使用 Chrome 浏览器。与其他一些不同的是,你可能不会得到完整的安卓体验,而只是能够运行安卓应用。
|
||||
|
||||
你只需解压运行时,并将其加载到 Chrome 扩展中。接下来,下载 APK 文件到上面来添加你想使用的应用。
|
||||
|
||||
[ARChon][10]
|
||||
|
||||
### 6\. Bliss OS
|
||||
|
||||
![][11]
|
||||
|
||||
Bliss OS 是另一个开源项目,与 Android x86 类似,旨在使 Android 在 PC 上运行。
|
||||
|
||||
与 Android x86 不同的是,它通过支持 32 位和 64 位架构提供了更多的兼容性选择。此外,你可以根据你的处理器下载兼容文件。
|
||||
|
||||
它有积极的维护,支持市场上最新的安卓版本。
|
||||
|
||||
[Bliss OS][12]
|
||||
|
||||
### 总结
|
||||
|
||||
虽然你会发现有几个可用于 Linux 的安卓模拟器,但它们可能无法取代全面的智能手机体验。
|
||||
|
||||
每个模拟器都有一系列的功能和特定目的。请选择你需要的那个!
|
||||
|
||||
你试过安卓模拟器么?你在 Linux 中使用的最喜欢的模拟器是什么?欢迎在下面的评论中让我知道。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/android-emulators-linux/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://anbox.io
|
||||
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/genymotion-android-emulator.png?resize=800%2C508&ssl=1
|
||||
[3]: https://www.genymotion.com
|
||||
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/android-x86-emulator.jpg?resize=1920%2C1080&ssl=1
|
||||
[5]: https://www.android-x86.org/installhowto.html
|
||||
[6]: https://www.android-x86.org
|
||||
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/07/android-virtual-devices-studio.png?resize=800%2C296&ssl=1
|
||||
[8]: https://developer.android.com/studio
|
||||
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/arcrhon.jpg?resize=800%2C426&ssl=1
|
||||
[10]: https://archon-runtime.github.io
|
||||
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/bliss-os-android.png?resize=800%2C576&ssl=1
|
||||
[12]: https://blissos.org
|
@ -0,0 +1,77 @@
|
||||
[#]: subject: (How to Install VLC on Fedora Linux)
|
||||
[#]: via: (https://itsfoss.com/install-vlc-fedora/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
如何在 Fedora Linux 上安装 VLC
|
||||
======
|
||||
|
||||
如果你刚刚安装了 Fedora,现在想在上面安装你最喜欢的视频播放器 VLC,你可能不会在软件中心找到它。至少不会立即找到。
|
||||
|
||||
由于开发者最清楚的原因,Fedora 既没有安装 [VLC][1],也不包括在 Fedora 官方仓库中。
|
||||
|
||||
那么,你如何在 Fedora 上安装 VLC 呢?很简单。RPM Fusion 是你的朋友。让我告诉你详细的步骤。
|
||||
|
||||
### 在 Fedora Linux 上安装 VLC
|
||||
|
||||
在这里使用命令行会更容易。你也可以使用图形化的方法。我将在后面讨论它。
|
||||
|
||||
打开终端,使用下面的命令来添加和启用包含 VLC 包的 RPM Fusion 仓库:
|
||||
|
||||
```
|
||||
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
|
||||
```
|
||||
|
||||
当被要求确认添加新仓库时按 Y。接下来,使用 DNF 命令安装 VLC:
|
||||
|
||||
```
|
||||
sudo dnf install vlc
|
||||
```
|
||||
|
||||
它将在 Fedora 中从RPM Fusion 仓库中安装 VLC,并从不同的仓库中安装一些额外的依赖项。
|
||||
|
||||
![Installing VLC in Fedora with DNF command][2]
|
||||
|
||||
安装后,你可以在应用程序菜单中搜索 VLC,或者在“活动区”中搜索它。
|
||||
|
||||
![Search for VLC][3]
|
||||
|
||||
点击、启动并享受它。
|
||||
|
||||
#### 替代方法:从软件中心安装 VLC
|
||||
|
||||
当你已经启用了 RPM Fusion 仓库,你可以在软件中心显示这个仓库的应用。要做到这一点,在终端使用以下命令:
|
||||
|
||||
```
|
||||
sudo dnf groupupdate core
|
||||
```
|
||||
|
||||
之后,打开软件中心,搜索 VLC 并从那里安装。
|
||||
|
||||
![VLC in Fedora software center][4]
|
||||
|
||||
如果你有添加 FlatHub 仓库,请避免安装 Flatpak 版本的 VLC,因为它的大小大约是 1GB。RPM 版本的大小要小得多。
|
||||
|
||||
我希望你觉得这个快速教程对在 Fedora 上安装 VLC 有帮助。享受吧。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/install-vlc-fedora/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.videolan.org/
|
||||
[2]: https://itsfoss.com/wp-content/uploads/2021/07/installing-vlc-fedora-800x422.webp
|
||||
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/vlc-fedora.png?resize=799%2C223&ssl=1
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2021/07/vlc-in-fedora-software-center-800x486.webp
|
Loading…
Reference in New Issue
Block a user