Merge branch 'LCTT:master' into master

This commit is contained in:
Donkey 2022-07-11 20:40:15 +08:00 committed by GitHub
commit 0192d3432e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 1230 additions and 785 deletions

View File

@ -0,0 +1,223 @@
[#]: subject: "How dynamic linking for modular libraries works on Linux"
[#]: via: "https://opensource.com/article/22/5/dynamic-linking-modular-libraries-linux"
[#]: author: "Jayashree Huttanagoudar https://opensource.com/users/jayashree-huttanagoudar"
[#]: collector: "lkxed"
[#]: translator: "robsean"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-14813-1.html"
如何在 Linux 上动态链接模块库
======
![](https://img.linux.net.cn/data/attachment/album/202207/10/182540caie7ldrefflffah.jpg)
> 学习如何用动态链接库将多个 C 目标文件结合到一个单个的可执行文件之中。
当使用 C 编程语言编写一个应用程序时,你的代码通常有多个源文件代码。
最终,这些文件必须被编译到一个单个的可执行文件之中。你可以通过创建静态或动态库(后者也被称为 <ruby>共享<rt>shared</rt></ruby> 库)来实现这一点。这两种类型的库在创建和链接的方式上有所不同。两者都有缺点和优点,这取决于你的使用情况。
动态链接是最常见的方法,尤其是在 Linux 系统上。动态链接会保持库模块化,因此,很多应用程序可以共享一个库。应用程序的模块化也允许单独更新其依赖的共享库。
在这篇文章中,我将演示动态链接是如何工作的。在后期的文章中,我将演示静态链接。
### 链接器
<ruby>链接器<rt>linker</rt></ruby>是一个命令,它将一个程序的数个部分结合在一起,并为它们重新组织内存分配。
链接器的功能包括:
* 整合一个程序的所有的部分
* 计算出一个新的内存组织结构,以便所有的部分组合在一起
* 恢复内存地址,以便程序可以在新的内存组织结构下运行
* 解析符号引用
链接器通过这些功能,创建了一个名为<ruby>可执行文件<rt>executable</rt></ruby>的可以运行的程序。在你创建一个动态链接的可执行文件前,你需要一些用来链接的库,和一个用来编译的应用程序。准备好你 [最喜欢的文本编辑器][2] 并继续。
### 创建目标文件
首先,创建带有这些函数签名的头文件 `mymath.h`
```
int add(int a, int b);
int sub(int a, int b);
int mult(int a, int b);
int divi(int a, int b);
```
使用这些函数定义来创建 `add.c` 、`sub.c` 、`mult.c` 和 `divi.c` 文件。我将把所有的代码都放置到一个代码块中,请将其分为四个文件,如注释所示:
```
// add.c
int add(int a, int b){
return (a+b);
}
//sub.c
int sub(int a, int b){
return (a-b);
}
//mult.c
int mult(int a, int b){
return (a*b);
}
//divi.c
int divi(int a, int b){
return (a/b);
}
```
现在,使用 GCC 来创建目标文件 `add.o`、`sub.o`、`mult.o` 和 `divi.o`
LCTT 校注:关于“<ruby>目标文件<rt>object file</rt></ruby>”,有时候也被称作“对象文件”,对此,存在一些译法混乱情形,称之为“目标文件”的译法比较流行,本文采用此译法。)
```
$ gcc -c add.c sub.c mult.c divi.c
```
`-c` 选项跳过链接步骤,并且只创建目标文件。
### 创建一个共享的目标文件
在最终的可执行文件的执行过程中将链接动态库。在最终的可执行文件中仅放置动态库的名称。实际上的链接过程发生在运行时,在此期间,可执行文件和库都被放置到了主内存中。
除了可共享外,动态库的另外一个优点是它减少了最终的可执行文件的大小。在一个应用程序最终的可执行文件生成时,其使用的库只包括该库的名称,而不是该库的一个多余的副本。
你可以从你现有的示例代码中创建动态库:
```
$ gcc -Wall -fPIC -c add.c sub.c mult.c divi.c
```
选项 `-fPIC` 告诉 GCC 来生成<ruby>位置无关的代码<rt>position-independent code</rt></ruby>PIC。`-Wall` 选项不是必需的,并且与代码的编译方式是无关的。不过,它却是一个有价值的选项,因为它会启用编译器警告,这在排除故障时是很有帮助的。
使用 GCC ,创建共享库 `libmymath.so`
```
$ gcc -shared -o libmymath.so add.o sub.o mult.o divi.o
```
现在,你已经创建了一个简单的示例数学库 `libmymath.so` ,你可以在 C 代码中使用它。当然,也有非常复杂的 C 库,这就是他们这些开发者来生成最终产品的工艺流程,你和我可以安装这些库并在 C 代码中使用。
接下来,你可以在一些自定义代码中使用你的新数学库,然后链接它。
### 创建一个动态链接的可执行文件
假设你已经为数学运算编写了一个命令。创建一个名称为 `mathDemo.c` 的文件,并将这些代码复制粘贴至其中:
```
#include <mymath.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
int x, y;
printf("Enter two numbers\n");
scanf("%d%d",&x,&y);
printf("\n%d + %d = %d", x, y, add(x, y));
printf("\n%d - %d = %d", x, y, sub(x, y));
printf("\n%d * %d = %d", x, y, mult(x, y));
if(y==0){
printf("\nDenominator is zero so can't perform division\n");
exit(0);
}else{
printf("\n%d / %d = %d\n", x, y, divi(x, y));
return 0;
}
}
```
注意:第一行是一个 `include` 语句,通过名称来引用你自己的 `libmymath` 库。要使用一个共享库,你必须已经安装了它,如果你没有安装你将要使用的库,那么当你的可执行文件在运行并搜索其包含的库时,将找不到该共享库。如果你需要在不安装库到已知目录的情况下编译代码,这里有 [一些方法可以覆盖默认设置][3]。不过,对于一般使用来说,我们希望库存在于已知的位置,因此,这就是我在这里演示的东西。
复制文件 `libmymath.so` 到一个标准的系统目录,例如:`/usr/lib64` 然后运行 `ldconfig` 。`ldconfig` 命令创建所需的链接,并缓存到标准库目录中发现的最新共享库。
```
$ sudo cp libmymath.so /usr/lib64/
$ sudo ldconfig
```
### 编译应用程序
从你的应用程序源文件代码(`mathDemo.c`)中创建一个名称为 `mathDemo.o` 的目标文件:
```
$ gcc -I . -c mathDemo.c
```
`-I` 选项告诉 GCC 来在其后所列出的目录中搜索头文件(在这个示例中是 `mymath.h`)。在这个示例中,你指定的是当前目录,通过一个单点(`.`)来表示。创建一个可执行文件,使用 `-l` 选项来通过名称来引用你的共享数学库:
```
$ gcc -o mathDynamic mathDemo.o -lmymath
```
GCC 会找到 `libmymath.so` ,因为它存在于一个默认的系统库目录中。使用 `ldd` 来查证所使用的共享库:
```
$ ldd mathDemo
linux-vdso.so.1 (0x00007fffe6a30000)
libmymath.so => /usr/lib64/libmymath.so (0x00007fe4d4d33000)
libc.so.6 => /lib64/libc.so.6 (0x00007fe4d4b29000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe4d4d4e000)
```
看看 `mathDemo` 可执行文件的大小:
```
$ du ./mathDynamic
24 ./mathDynamic
```
当然,它是一个小的应用程序,它所占用的磁盘空间量也反映了这一点。相比之下,相同代码的一个静态链接版本(正如你将在我后期的文章所看到的一样)是 932K !
```
$ ./mathDynamic
Enter two numbers
25
5
25 + 5 = 30
25 - 5 = 20
25 * 5 = 125
25 / 5 = 5
```
你可以使用 `file` 命令来查证它是动态链接的:
```
$ file ./mathDynamic
./mathDynamic: ELF 64-bit LSB executable, x86-64,
dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2,
with debug_info, not stripped
```
成功!
### 动态链接
因为链接发生在运行时,所以,使用一个共享库会产生一个轻量型的可执行文件。因为它在运行时解析引用,所以它会花费更多的执行时间。不过,因为在日常使用的 Linux 系统上绝大多数的命令是动态链接的,并且在现代硬件上,所能节省的时间是可以忽略不计的。对开发者和用户来说,它的固有模块性是一种强大的功能。
在这篇文章中,我描述了如何创建动态库,并将其链接到一个最终可执行文件。在我的下一篇文章中,我将使用相同的源文件代码来创建一个静态链接的可执行文件。
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/5/dynamic-linking-modular-libraries-linux
作者:[Jayashree Huttanagoudar][a]
选题:[lkxed][b]
译者:[robsean](https://github.com/robsean)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jayashree-huttanagoudar
[b]: https://github.com/lkxed
[1]: https://opensource.com/sites/default/files/lead-images/links.png
[2]: https://opensource.com/article/21/2/open-source-text-editors
[3]: https://opensource.com/article/22/5/compile-code-ldlibrarypath

View File

@ -2,39 +2,39 @@
[#]: via: "https://www.debugpoint.com/best-ubuntu-apps-2022-part2/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "Donkey"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
[#]: translator: "Donkey-Hao"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-14816-1.html"
10 大必备 Ubuntu 应用:第二
10 大必备 Ubuntu 应用:优选
======
本文列出了 2022 年可以用于不同情况的 10 个 Ubuntu 基本应用。
如果你计划永久的转移到 Linux 系统上,你应该很高兴知道在 Linux 上有数以千计的能与商业或付费应用媲美的应用。如果你是第一次使用 Linux 的 Windows 用户,你可能没有听说过这些应用。
![](https://img.linux.net.cn/data/attachment/album/202207/11/180521obse00404niahjof.jpg)
因此,在这一系列文章中,我们每一次重点介绍一组 Ubuntu 应用,以增加用户群之间的协作和意识。
> 本文列出了 2022 年可以用于不同情况的 10 个 Ubuntu 优选应用。
如果你计划永久的转移到 Linux 系统上,你应该会很高兴地知道在 Linux 上有数以千计的能与商业或付费应用媲美的应用。如果你是第一次使用 Linux 的 Windows 用户,你可能都没有听说过这些应用。
因此,在这一系列文章中,我们每一篇重点介绍一组 Ubuntu 应用,以增加 Linux 用户们的协作和认识。
这是 Ubuntu 应用程序系列的第二篇文章,如果你错过了其他部分,可以在这里阅读:
* [第一篇][1]
* [第三篇][2]
### 2022 年最好的 Ubuntu 应用程序 第二篇
### 1、OBS Studio
#### 1. OBS Studio
第一个应用是著名的 [流媒体应用][3] —— OBS Studio 。这是一款自由开源的应用,主要用于互联网上的流媒体应用。此外,你可以使用该应用创建一个复杂的流媒体项目,包括多源、覆盖式横幅等功能。
第一个应用是著名的 [流媒体应用][3] —— OBS Studio 。这是一款免费并开源的主要用于互联网上的流媒体应用。此外,你可以使用该应用创建一个复杂的多源、覆盖横幅等流媒体项目。
而且,感谢它能够支持“实时消息传输协议”,你可以使用它在 Facebook、Youtube、Twitch 以及其他支持的平台上进行流式传输。
而且,由于它能够支持“<ruby>实时消息传输协议<rt>Real-Time Messaging Protocol</rt></ruby>RTMP你可以使用它在 Facebook、Youtube、Twitch 以及其他支持的平台上进行流式传输。
这个有十年历史的应用程序是 Linux 上最好的应用程序之一。
![OBS Studio][4]
你可以在 [OBS Studio 官网][5] 了解更多的信息并下载,或者通过以下方式安装
你可以在 [OBS Studio 官网][5] 了解更多的信息并下载,或者通过以下方式安装
通过 Ubuntu PPA 和相关发:
通过 PPA 在 Ubuntu 和相关发行版上安装
```
sudo add-apt-repository ppa:obsproject/obs-studio
@ -42,15 +42,15 @@ sudo apt update
sudo apt install obs-studio
```
如果你希望通过 Flatpak ,首先 [为 Flatpak 设置系统][6] 然后 [通过这个页面安装][7] 。
如果你希望通过 Flatpak 安装 ,首先 [为 Flatpak 设置系统][6] 然后 [通过这个页面安装][7] 。
在 Arch Linux 或者其他 Linux 版本,访问 [页面][8] 了解。
在 Arch Linux 或者其他 Linux 版本,访问 [页面][8] 了解。
#### 2. Inkscape
#### 2Inkscape
这里介绍第二款应用是受欢迎的 Inkscape 。 Inkscape 是一个免费开源的矢量图形编辑软件。它主要用于创建大规模的矢量图形。此外,它使用基本的矢量形状如矩形、多边形、螺旋形等,是一款世界级的应用。你可以使用这些基本图形以及辅助工具(见下文)创作一流的绘图。
这里介绍的第二款应用是流行的 Inkscape。 Inkscape 是一个自由开源的矢量图形编辑软件。它主要用于创建可缩放的矢量图形SVG。此外它是一款一流的应用可以使用基本的矢量形状如矩形、多边形、螺旋形等。你可以使用这些基本图形以及辅助工具(见下文)创作一流的绘图。
此外,当你有足够的技能时,可以使用 Inkscape 创作 [绝妙的动画][9] 。这是画家必备的一款应用。
此外,只要你有足够的技能,就可以使用 Inkscape 创作出 [绝妙的动画][9] 。这是艺术家必备的一款应用。
![Sample Image credit-Inkscape][10]
@ -58,7 +58,7 @@ sudo apt install obs-studio
你可以在 [Inkscape 官网][12] 下载并了解更多相关信息,或者通过以下方式下载。
通过 Ubuntu PPA 或其他 Linux 版本
通过 PPA 在 Ubuntu 和相关发行版上安装
```
sudo add-apt-repository ppa:inkscape.dev/stable
@ -68,26 +68,25 @@ sudo apt install inkscape
更多下载方式可以查看 [此页面][13] 。
#### 3. GIMP
#### 3GIMP
GIMP 是 GNU 图像操作程序 (GNU Image Manipulation Program) 的缩写,是一个光栅图形编辑器,它有时候被认为是 Linux 平台上值得商榷的 [Photoshop 替代品][14] 。这款拥有 20 年历史的应用非常适合从基础到高级的图像编辑。此外,它支持图层、滤镜、装饰和其他对摄影工作必不可少的高级图像编辑功能。
GIMP 是 <ruby>GNU 图像操作程序<rt>GNU Image Manipulation Program</rt></ruby>”的缩写,它是一个光栅图形编辑器,它有时候被视作 Linux 平台上的 [Photoshop 替代品][14](值得商榷)。这款拥有 20 年历史的应用适合于从基础到高级的图像编辑。此外,它支持图层、滤镜、装饰和其它对摄影工作必不可少的高级图像编辑功能。
![GIMP Image Editor][15]
[官方主页][16] 是你了解更多关于 GIMP 的知识的最好的途径,可以在官网下载或者通过以下方式安装。
[官方主页][16] 是你了解更多关于 GIMP 的知识的最好的途径,可以在官网下载或者通过以下方式安装。
我推荐的方式是通过 Flatpak 下载最新版本 GIMP 。你可以为 Flatpak 设置 [你的系统][17] 然后 [通过该页面安装][18] 。
[该页面][19] 提供了更多下载选项。
#### 4、Spotify
#### 4. Spotify
Spotify 是一家专业提供音频流媒体和媒体服务的提供商。它是最广泛的音乐流媒体服务之一,有超过 400 万的月活用户。
Spotify 是一家专业提供音频流媒体和媒体服务的提供商。它是最广泛的音乐流媒体服务之一,每月有超过 400 多万用户
首先,你需要安装客户端才能获取 Spotify 流媒体服务。其次,如果你是移动用户,你可以通过 Google Play 商店或者苹果应用商店获取 Spotify 应用
首先,你需要安装客户端才能获取 Spotify 流媒体服务。其次,如果你是移动用户,你可以通过 Google Play 或者苹果应用商店获取 Spotify 应用。
在 Linux 上安装桌面客户端后你可以收听上百万首歌曲。你可以为不同的 Linux 版本通过不同的方式安装 Spotify 。
在 Linux 上安装桌面客户端后你可以收听上百万首歌曲。你可以为不同的 Linux 发行版通过不同的方式安装 Spotify 。
![Spotify Client in Ubuntu][20]
@ -97,8 +96,7 @@ Spotify 是一家专业提供音频流媒体和媒体服务的提供商。它是
snap install spotify
```
如果你偏向于原始的 deb 包,你可以通过以下命令安装:
如果你偏爱原始的 deb 包,你可以通过以下命令安装:
```
curl -sS https://download.spotify.com/debian/pubkey_5E3C45D7B312C643.gpg | sudo apt-key add -echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list
@ -106,50 +104,46 @@ curl -sS https://download.spotify.com/debian/pubkey_5E3C45D7B312C643.gpg | sudo
你也可以使用非官方 [Flatpak 包][21] 进行安装。
#### 5、SimpleScreenRecorder
#### 5. SimpleScreenRecorder
SimpleScreenRecorder 可能是最好的开源截屏工具。该应用程序易于使用并加载了功能。并且,其独特的 3 步录制屏幕的方法完全不需要学习。此外,你可以选择整个屏幕、一个窗口或自定义形状来记录屏幕。
此外,你还可以指定自动/视频比特率、音频源选项和不同的输出选项。最后,它可以安装在所有 Linux 发行版中。
SimpleScreenRecorder 可能是最好的开源截屏工具。该应用程序易于使用并提供了各种功能。并且,其独特的 3 步录制屏幕的方法完全不需要学习。此外,你可以选择整个屏幕、窗口或自定义形状来记录屏幕。
此外,你还可以指定音频/视频比特率、音频源选项和不同的输出选项。最后,它可以安装在所有 Linux 发行版中。
![SimpleScreenRecorder][22]
[官方页面][23] 囊括了更多 SimpleScreenRecorder 的详细信息,你也可以使用如下方式下载。
[官方页面][23] 囊括了更多 SimpleScreenRecorder 信息,你也可以使用如下方式下载。
在 Ubuntu 或其他相关发行版中使用下面的 PPA 命令安装该应用:
```
sudo apt-get updatesudo apt-get install simplescreenrecorder
```
访问 [此页][24] 获取更多下载版本。
#### 6. Calibre
Calibre 是一款可以在 Ubuntu, Linux Mint 以及其他 Linux 平台使用的免费开源的电子书库管理应用程序。它拥有书库管理、电子书格式转换、同步你的电子书设备以及其他独特的功能。你可以下载新闻和其他互联网上的文章,并可以使用 Calibre 转换成电子书格式。同时,它支持多种电子书格式进行管理。 Calibre 是一款具有这些功能最好的电子书管理应用程序之一。
#### 6、Calibre
Calibre 是一款可以在 Ubuntu、Linux Mint 以及其他 Linux 平台使用的自由开源的电子书库管理应用程序。它拥有书库管理、电子书格式转换、同步你的电子书设备以及其他独特的功能。你可以下载新闻和其他互联网上的文章,并可以使用 Calibre 转换成电子书格式。同时它支持多种电子书格式进行管理。Calibre 是一款具有这些功能最好的电子书管理应用程序之一。
![Calibre][25]
[Calibre 主页][26] 提供了很多文件以及指导手册,你也可以使用以下方式下载。
* [下载 Linux 版本][27]
* [下载其他系统版本][28]
* [在 Linux 发行版上下载][27]
* [在其他系统上下载][28]
#### 7、Scribus
#### 7. Scribus
多年来,桌面出版发生了变化。现今,仍有一些桌面出版的应用程序和基于网页的服务。 Scribus 是早期的一款免费并开源的桌面出版应用程序,可以在 Linux 发行版和其他操作系统中使用。此外,它基于 Qt 并带来了吸引人的用户界面,你可以立即学习。 此外,初学者和专业人士都可以使用它来创建令人惊叹的 DTP 页面。
多年来桌面出版已经发生了变化。现今仍有一些桌面出版的应用程序和基于网页的服务。Scribus 是早期的一款自由开源的桌面出版应用程序,可以在 Linux 发行版和其他操作系统中使用。此外,它基于 Qt并带来了吸引人的用户界面让你可以马上投入学习。此外初学者和专业人士都可以使用它来创建令人惊叹的 DTP 页面。
并且它仍然在积极开发中。
![Scribus][29]
你可以在 Scribus的 [官方页面][30] 了解更多并下载,或者通过以下方式安装。
你可以在 Scribus 的 [官方页面][30] 了解更多信息并下载,或者通过以下方式安装。
Scribus 位于 Ubuntu 和其他相关发行版的主要存储库中。可以运行以下命令进行安装:
Scribus 位于 Ubuntu 和其他相关发行版的主要存储库中。可以运行以下命令进行安装:
```
sudo apt install scribus
@ -157,11 +151,9 @@ sudo apt install scribus
[该页面][31] 提供了其他下载选项。
#### 8、MyPaint
#### 8. MyPaint
第八个应用程序是 MyPaint 。MyPaint 是一个免费的开源绘图程序,适用于数字艺术家。 MyPaint 支持并可用于触屏平板电脑和设备。其独特的无干扰设计让你专注于绘图而不是应用程序。 外,它还带来了真正的铅笔和画笔仿真,具有广泛的画笔、颜色和图层。
第八个应用程序是 MyPaint 。MyPaint 是一个自由开源的绘图程序适用于数字艺术家。MyPaint 支持并可用于压感平板电脑和设备。其独特的无干扰设计可以让你专注于绘图而不是应用程序。此外,它还带来了真实铅笔和画笔的仿真,提供了各种画笔、颜色和图层。
![MyPaint 2.0.1][32]
@ -171,44 +163,35 @@ sudo apt install scribus
[该页面][36] 提供了其他下载选项。
#### 9. LibreOffice
#### 9LibreOffice
如果有任何 Office 套件和市场领导者 Microsoft Office 相媲美,那一定是 Documen Foundation 的 LibreOffice 。它是所有 Linux 发行版的默认 Office 套件。它带有电子表格程序Calc、文字处理器Writer、演示文稿Impress Draw用于绘图。此外它还带来了一个数据库系统 LibreOffice Base 和 Math 来演示数学公式
如果有任何专业的办公套件可以和市场领导者微软 Office 相媲美,那一定是文档基金会的 LibreOffice 了 。它是所有 Linux 发行版的默认办公套件。它带有电子表格程序Calc、文字处理器Writer、演示文稿Impress用来绘图的 Draw。此外它还带来了一个数据库系统 Base和用来撰写数学公式的 Math
除此之外, LibreOffice 提供两个版本。其一是社区版,社区版用于社区和一般用途,并带有最新的功能和更新。第二是商务版,也称企业版。企业版更稳定,更适合专业工作。
LibreOffice 办公套件默认安装在 Ubuntu 上。
除此之外, LibreOffice 提供两个版本。其一是社区版,用于社区和一般用途,并带有最新的功能和更新。第二是商务版,也称企业版,更稳定,更适合专业工作。
LibreOffice 办公套件已默认安装在 Ubuntu 上。
![LibreOffice 7.3.x Community Edition in Ubuntu 22.04 LTS Jammy Jellyfish][37]
[LibreOffice 的官方文档][38] 很庞大,你可以通过任何方式浏览它们,包括它的 [友好论坛][39] 。你可以 [从此处][40] 下载 LibreOffice。
[LibreOffice 的官方文档][38] 很庞大,你可以通过各种方式浏览它们,包括在它 [友好的论坛][39] 。你可以 [从此处][40] 下载 LibreOffice。
如果你也想升级 LibreOffice ,你可以访问 [这里][41] 。
#### 10、Cawbird
#### 10. Cawbird
如果你是重度 Twitter 用户,你或许应考虑一款桌面应用。 Cawbird 是一款 Linux 发行版上的 Twitter 桌面程序。它是 Corebird 应用已停止维护的复刻Cawbird 带来了内嵌图片、视频预览、列表支持等。此外,它可以在 Twitter 上进行全文搜索,并支持多个 Twitter 帐户。
如果你是重度 Twitter 用户,你或许应考虑一款桌面应用。 Cawbird 是一款 Linux 发行版上的 Twitter 桌面程序。它是 Corebird 应用已停产的分支Cawbird 带来了内嵌图片、视频预览、列表支持等。此外,它可以在 Twitter 上进行全文搜索,并支持多个 Twitter 帐户。
但是,由于 Twitter API 的限制它每两分钟刷新一次以及其他一些限制例如没有通知关注、取消关注、阻止、静音和其他功能。Twitter 强加了这些限制。
但是,由于 Twitter API 的限制它只能每两分钟刷新一次此外还有一些其他限制例如没有关注和取消关注的通知、阻止、静音和其他功能。Twitter 强加了这些限制。
![Cawbird][42]
最后,你可以通过 [该链接][43] 在任何 Linux 发行版上下载 Cawbird 。
### 结语
这是 2022 年共 5 部分系列最佳 Ubuntu 应用程序的第 2 部分。我希望你能够在 Ubuntu 和其他发行版中安装和使用其中一些应用程序来完成你的日常工作。另外,请在下面的评论框中告诉我你更喜欢此列表中的哪些应用程序。
这是 2022 年 5 篇系列的必备 Ubuntu 应用程序的第 2 篇。通过以上信息,我希望你可以选择一些应用供你的日常使用。在下面的评论框中告诉我你更喜欢此列表中的哪些应用程序。
最后,请继续关注本 Ubuntu 应用程序系列的第 3 部分。如果你错过了本系列的其他部分,可以在此处阅读它们:
* [第一篇][44]
* [第三篇][45]
干杯!
最后,请继续关注本 Ubuntu 应用程序系列的第 3 部分。
--------------------------------------------------------------------------------
@ -217,7 +200,7 @@ via: https://www.debugpoint.com/best-ubuntu-apps-2022-part2/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[Donkey](https://github.com/Donkey-Hao)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -3,16 +3,18 @@
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-14815-1.html"
修复 Ubuntu 和其他 Linux 中的 “cannot find signatures with metadata for snap” 错误
修复 Ubuntu 中的 “cannot find signatures with metadata for snap” 错误
======
![](https://img.linux.net.cn/data/attachment/album/202207/11/112312l4y0jf3gag8sam4g.jpg)
前几天我试图安装 [massCode][1] 应用。对于安装,它提供了一个 Snap 文件以供下载。
当我尝试从 Snap 文件安装应用程序时
当我尝试从 Snap 文件安装应用程序时
```
sudo snap install snap_file
@ -20,47 +22,49 @@ sudo snap install snap_file
它给了我以下错误:
**error: cannot find signatures with metadata for snap “masscode_2.6.1_amd64.snap”**
```
error: cannot find signatures with metadata for snap "masscode_2.6.1_amd64.snap"
```
![cannot find signature with metadata for snap][2]
这很奇怪。[在 Ubuntu 中添加外部仓库][3]时,你必须添加 GPG 密钥。但是这里的开发人员没有提供这样的东西。
这很奇怪。[在 Ubuntu 中添加外部仓库][3] 时,你必须添加 GPG 密钥。但是这里的开发人员没有提供这样的东西。
“修复”简单易行。让我给你解释一下。
### 处理 “cannot find signatures with metadata for snap” 错误
这里不涉及签名。
这里其实不涉及签名。
发生的情况是你从第三方下载了 Snap 安装程序。 Ubuntu 中的 snap 机制希望你从官方 snap 商店获取 snap 包。
发生的情况是你从第三方下载了 Snap 安装程序。 Ubuntu 中的 Snap 机制希望你从官方 Snap 商店获取 Snap 包。
由于它不是来自 snap 商店,因此你会看到 “cannot find signatures with metadata for snap” 的错误消息。与大多数错误消息一样,错误消息不是描述性的。
由于它不是来自 Snap 商店,因此你会看到 “cannot find signatures with metadata for snap” 的错误消息。与大多数错误消息一样,这个错误消息不是描述性的。
那么,这里的解决方案是什么?
任何未通过 Snap 商店分发的 snap 包都必须使用 **-dangerous** 选项进行安装。这就是规则。
任何未通过 Snap 商店分发的 Snap 包都必须使用 `--dangerous` 选项进行安装。这就是规则。
```
sudo snap install --dangerous path_to_snap_file
```
这样,你告诉 snap 包管理器显式安装 snap 包。
这样,你告诉 Snap 包管理器显式安装 Snap 包。
在这里,我使用了这个选项并且能够成功地从它的 snap 包中安装 massCode。
在这里,我使用了这个选项并且能够成功地从它的 Snap 包中安装 massCode。
![installing third party snap packages][4]
以这种方式安装 snap 包有多“危险”?几乎和下载并[安装 deb 格式安装包][5]相同。
以这种方式安装 Snap 包有多“危险”?几乎和下载并 [安装 deb 格式安装包][5] 相同。
在我看来,如果你是从项目开发者的网站上下载 snap 包,你已经在信任项目了。在这种情况下,你可以使用 dangerous 选项安装它。
在我看来,如果你是从项目开发者的网站上下载 Snap 包,你已经在信任该项目了。在这种情况下,你可以使用 `--dangerous` 选项安装它。
当然,你应该首先搜索该软件包是否在 snap 商店中可用:
当然,你应该首先搜索该软件包是否在 Snap 商店中可用:
```
snap find package_name
```
我希望这个快速的小技巧可以帮助你修复 Snap 错误。如果你有任何问题或建议,请告诉我。如果你想了解更多信息,请参阅[这个使用 Snap 命令指南][6]。
我希望这个快速的小技巧可以帮助你修复 Snap 错误。如果你有任何问题或建议,请告诉我。如果你想了解更多信息,请参阅 [这个使用 Snap 命令指南][6]。
--------------------------------------------------------------------------------
@ -69,7 +73,7 @@ via: https://itsfoss.com/snap-metadata-signature-error/
作者:[Abhishek Prakash][a]
选题:[lkxed][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/) 荣誉推出

View File

@ -0,0 +1,69 @@
[#]: subject: "Metas AI Model That Helps Overcome Language Barrier Is Now Open-Source"
[#]: via: "https://news.itsfoss.com/meta-open-source-ai-model/"
[#]: author: "Rishabh Moharir https://news.itsfoss.com/author/rishabh/"
[#]: collector: "lkxed"
[#]: translator: "fenglyulin"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-14812-1.html"
Meta 开源了语言翻译 AI 模型
======
> Meta 的 “<ruby>不落下任何语言<rt>No Language Left Behind</rt></ruby>” 是一个宏大的开源项目,旨在以最高准确度翻译语言。
![meta][1]
Meta前身是 Facebook在开源世界做出了不小的贡献。Meta 除了专注于<ruby>元宇宙<rt>Metaverse</rt></ruby>和其社交媒体平台外,还致力于各种研究和创新工作,比如 React一个 JaveScript 库)。
现在Meta 的研究人员决定开源一个叫 “<ruby>不落下任何语言<rt>No Language Left Behind</rt></ruby>” 项目。
LCTT 校注:这个直译项目名称不够好听,我来抛砖引玉,似可称做“无人独语”,读者有什么建议吗?)
### Meta 试图不落下任何语言
![200 languages within a single AI model: A breakthrough in high-quality machine translation][2]
目前,虽然世界上有大约 7000 个在使用中的语言,但大多数在线的内容都是以少数的流行语言来提供的,比如英语。这让许多不懂这些语言的人处于不利的地位。
虽然现存的许多翻译工具,但语法错误会让错误变得难以阅读和理解。另外,如果你想把内容翻译为一个不流行的语言(特别是非洲和亚洲的一些语言),翻译体验不会很好。
因此Meta 正在开发有最高质量的翻译工具,可以帮助解决这一全球性的问题。
NLLB-200<ruby>不落下任何语言<rt>No Language Left Behind</rt></ruby> 是一个人工智能翻译模型,其可以翻译 200 多种语言。该模型在每种语言中的翻译结果是通过一个名为 FLORES-200 复杂数据集来确定和评估的。
正如 Meta 所说NLLB 的翻译结果比以前的人工智能研究方法好 40% 。对于一些最不常见的语言,其翻译准确率甚至超过 70%。了不起的工作!
为了帮助开发项目和提高模型的翻译质量Meta 向所有感兴趣的研究人员开放了源代码,包括 NLLB-200 模型、FLORES-200 数据库、模型训练和重建训练数据库的代码。
你可以在 [GitHub][3] 上找到源代码,并且可以在该项目的 [博客][4] 上了解它的更多信息。
### 对社会事业的鼓励
Meta 宣布向从事<ruby>联合国可持续发展目标<rt>UN Sustainable Development Goals</rt></ruby>任何领域工作和翻译非洲语言的非营利组织和研究人员提供高达 20 万美元的捐赠,也鼓励其他学术领域如语言学和机器翻译的研究人员申请。
### 项目的影响
尽管 Meta 主要打算在其数字平台上,特别是在“元宇宙”上使用 NLLB但 NLLB 也有可能在其他领域产生巨大影响。
许多用户可以用他们的母语轻松地访问和阅读在线资源。项目开源后,社区应该能够帮助实现这个目标。
*你对 Meta 的这个项目有什么看法?*
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/meta-open-source-ai-model/
作者:[Rishabh Moharir][a]
选题:[lkxed][b]
译者:[fenglyulin](https://github.com/fenglyulin)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/rishabh/
[b]: https://github.com/lkxed
[1]: https://news.itsfoss.com/wp-content/uploads/2022/07/meta-makes-ai-language-model-opensource.jpg
[2]: https://youtu.be/uCxSPPiwrNE
[3]: https://github.com/facebookresearch/fairseq/tree/nllb
[4]: https://ai.facebook.com/blog/nllb-200-high-quality-machine-translation/

View File

@ -1,136 +0,0 @@
[#]: subject: "Google Summer of Code + Zephyr RTOS"
[#]: via: "https://www.linux.com/news/google-summer-of-code-zephyr-rtos/"
[#]: author: "The Linux Foundation https://www.linuxfoundation.org/blog/google-summer-of-code-zephyr-rtos/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Google Summer of Code + Zephyr RTOS
======
The **Google Summer of Code** (**GSoC)** is an international annual program in which [Google][1] awards [stipends][2] to contributors who successfully complete a [free and open source software][3] coding project during the summer. Launched in 2005, GSoC takes place from May to August. Project ideas are submitted by host organizations involved in open source software development, though students can also propose their own project ideas.
This year, the program was opened to anyone 18 years or older not just students and recent graduates. Participants get paid to write software, with the amount of their [stipend][4] depending on the [purchasing power parity][5] of the country where they are located.
This is also the first time the Zephyr Project is participating in GSoC under The Linux Foundation umbrella. Please join us in welcoming these contributors and their projects:
### Project #1: Arduino module based on Zephyr
1 contributor full-size (350 hours).
[Arduino][6]s popularity is renowned as a popular framework for providing a simplified interface to program embedded devices. Recently, Arduino adopted mbed OS as the base RTOS for some of their newer devices. With that work, they separated out [Arduino Core][7] as an independent abstraction layer from [Arduino Core for mbed][8]. This opens up the possibility for leveraging Arduino Core on other OSes. The project idea is to create a Zephyr module that leverages the Arduino Core so that a developer can use Zephyr as the underlying OS when they use the Arduino framework on Arduino-compatible devices. The benefits to the user include:
* Access to Arduino APIs as well as advanced Zephyr capabilities
* Broader set of devices than the standard Arduino ecosystem thanks to Zephyrs device support
* Ability to re-use Arduino tools like the Arduino IDE and wealth of libraries
Arduino Core is licensed under the GNU Lesser General Public License and Zephyr is licensed under Apache 2. That means this project will most likely need to be developed out of tree and in a separate repo to keep code and license separation. See [#22247][9] for a historic discussion & [soburi/arduino-on-zephyr][10] for an earlier attempt prior to the Arduino Core architecture.
**The contributors task is thus:**
* Implement a bare-bones Module based on Arduino Core that can compile for any target (no functionality, possibly in QEMU)
* Implement a common peripheral from the Arduino API based on Zephyr such as [Serial][11]
* Target one physical board, such as the Arduino Zero
**Mentors:**
[Jonathan Beri][12] CEO of Golioth and Zephyr TSC
[Alvaro Viebrantz][13] Founding Engineer of Golioth and Google GDE
**Code License:** LGPL
**Contributor Details:**
* Name: Dhruva Gole
* Project Blog: [https://dhruvag2000.github.io/Blog-GSoC22/][14]
* Project Poster:
![][15]
**About the contributor:**
![][16]
Dhruva is an undergraduate student majoring in Electrical engineering. He has a broad range of interests from embedded software development to hardware design and has experience in working on SBCs, microcontrollers, and embedded Linux platforms.
### Project #2: Apache Thrift Module for Zephyr
1 contributor full-size (350 hours).
[Apache Thrift][17] is an [IDL][18] specification,[RPC][19] framework, and code generator that abstracts away transport and protocol details to let developers focus on application logic.It works across all major operating systems, supports over 27 programming languages, 7 protocols, and 6 low-level transports. Originally [developed at Facebook in 2007][20], it was subsequently shared with the Apache Software Foundation.
![][21]
![][22]
Supporting Thrift in the Zephyr RTOS would benefit the community greatly. It would lead to new software and hardware technologies, new products, and additional means for cloud integration. Thrift can be used over virtually any transport as well and for that reason, it is a natural choice for the many different physical communication layers supported by Zephyr. The project idea is to get the proof-of-concept [Thrift for Zephyr Module][23] into shape for upstreaming. To achieve that, the contributor must:
Perform additional integration for Thrift features (protocols, transports)
Author additional sample applications using [supported boards][24] or [Qemu][25]
Author additional tests and generate coverage reports using the [Zephyr Test Framework][26]
Ensure the module follows appropriate [coding guidelines][27] and satisfies [module requirements][28]
Contribute any necessary improvements back to the Apache Thrift Project.
Contribute any necessary improvements back to the Zephyr Project.
**Mentors:**
* [Christopher Friedt][29] SWE / ASIC FW at Meta and Zephyr TSC member
* [Stephanos Ioannidis][30] Zephyr CXX Subsystem Maintainer
**Code License:** Apache 2.0.
**Contributor Details:**
**Name:** Young
**About the contributor:** Young is a student majoring in  communication engineering, and he will pursue his Masters degree in computer engineering. He has a broad range of interests from front-end development to hardware design, and has experience in working on the Web, IoT and embedded platforms. A low-cost single-board computer with a RISC-V 64 processor designed by him in 2021 was reported by several geek media.
The post [Google Summer of Code + Zephyr RTOS][31] appeared first on [Linux Foundation][32].
--------------------------------------------------------------------------------
via: https://www.linux.com/news/google-summer-of-code-zephyr-rtos/
作者:[The Linux Foundation][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linuxfoundation.org/blog/google-summer-of-code-zephyr-rtos/
[b]: https://github.com/lkxed
[1]: https://en.wikipedia.org/wiki/Google
[2]: https://en.wikipedia.org/wiki/Stipend
[3]: https://en.wikipedia.org/wiki/Free_and_open-source_software
[4]: https://en.wikipedia.org/wiki/Stipend
[5]: https://en.wikipedia.org/wiki/Purchasing_power_parity
[6]: https://www.arduino.cc/
[7]: https://github.com/arduino/ArduinoCore-API
[8]: https://github.com/arduino/ArduinoCore-mbed
[9]: https://github.com/zephyrproject-rtos/zephyr/issues/22247
[10]: https://github.com/soburi/arduino-on-zephyr
[11]: https://www.arduino.cc/reference/en/language/functions/communication/serial/
[12]: https://www.linkedin.com/in/jonathanberi/
[13]: https://www.linkedin.com/in/alvaro-viebrantz-55119048/
[14]: https://dhruvag2000.github.io/Blog-GSoC22/
[15]: https://www.linuxfoundation.org/wp-content/uploads/project-poster.png
[16]: https://www.linuxfoundation.org/wp-content/uploads/dhruva.jpeg
[17]: https://github.com/apache/thrift
[18]: https://en.wikipedia.org/wiki/Interface_description_language
[19]: https://en.wikipedia.org/wiki/Remote_procedure_call
[20]: https://thrift.apache.org/static/files/thrift-20070401.pdf
[21]: https://www.linuxfoundation.org/wp-content/uploads/apache-thrift-layered-architecture.png
[22]: https://www.linuxfoundation.org/wp-content/uploads/SPDX-license.png
[23]: https://github.com/cfriedt/thrift-for-zephyr
[24]: https://docs.zephyrproject.org/latest/boards/index.html
[25]: https://docs.zephyrproject.org/latest/guides/networking/qemu_user_setup.html
[26]: https://docs.zephyrproject.org/latest/guides/test/ztest.html
[27]: https://docs.zephyrproject.org/latest/contribute/coding_guidelines/index.html
[28]: https://docs.zephyrproject.org/latest/guides/modules.html
[29]: https://www.linkedin.com/in/christopher-friedt/
[30]: https://www.linkedin.com/in/stephanosio/
[31]: https://www.linuxfoundation.org/blog/google-summer-of-code-zephyr-rtos/
[32]: https://www.linuxfoundation.org/

View File

@ -1,72 +0,0 @@
[#]: subject: "Metas AI Model That Helps Overcome Language Barrier Is Now Open-Source"
[#]: via: "https://news.itsfoss.com/meta-open-source-ai-model/"
[#]: author: "Rishabh Moharir https://news.itsfoss.com/author/rishabh/"
[#]: collector: "lkxed"
[#]: translator: "fenglyulin"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Metas AI Model That Helps Overcome Language Barrier Is Now Open-Source
======
No Language Left Behind by Meta is an ambitious open-source project which aims to translate languages with the highest level of accuracy.
![meta][1]
Meta (formerly known as Facebook) has made quite a splash in the open-source world. If you did not know, Meta works on various research and innovative projects like React (a JavaScript library) apart from focusing on the metaverse and its social media platforms.
Researchers at Meta have decided to open-source one such project, an AI model called *No Language Left Behind*.
### Metas Attempt To Leave No Language Behind
![200 languages within a single AI model: A breakthrough in high-quality machine translation][2]
While around 7000 languages are spoken in the world today, most of the online content is available in a handful of popular languages like English. This leaves many people who dont know such languages at a disadvantage.
While many tools exist for translation, grammatical errors can make content difficult to read and understand. Moreover, if you are looking to translate it into a language that is not popular, it wont be a pretty experience.
Specifically, for languages of Africa and Asia.
Hence, Meta is working on a translational tool with one of the highest quality results recorded that can help counter this global issue.
No Language Left Behind or simply **NLLB-200** is a machine translation model that can translate over 200 languages using artificial intelligence
NLLBs performance in each language is determined and evaluated using a complex dataset called FLORES-200 (if youre curious).
As stated by Meta, NLLBs results are 40% better than “previous AI research” methods. It even has an accuracy of over 70% for some of the least-common languages. Thats quite an impressive feat!
To help develop and improve the quality of translations, Meta has made the source code open to all interested researchers. This includes code for NLLB-200, FLORES-200, model training, and re-creating the training database.
You can find the source code on [GitHub][3] and learn more about the project in its [research blog post][4].
### Rewards for Social Cause
Meta has announced rewards of up to $200,00 of grants for non-profit organizations and researchers who are working on any areas of the UN Sustainable Development Goals and translating African languages.
Other researchers currently working in academic fields like linguistics and machine translation are also encouraged to apply.
### The Impact of this Project
Although Meta intends to mostly make use of NLLB across its digital platforms, particularly the Metaverse, it can be hugely impactful in other domains as well.
Many users will be able to access and easily read online resources in their native languages without a lot of effort. The idea of making it an open-source project should allow the community to help make this happen.
*What are your thoughts on this project by Meta?*
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/meta-open-source-ai-model/
作者:[Rishabh Moharir][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/rishabh/
[b]: https://github.com/lkxed
[1]: https://news.itsfoss.com/wp-content/uploads/2022/07/meta-makes-ai-language-model-opensource.jpg
[2]: https://youtu.be/uCxSPPiwrNE
[3]: https://github.com/facebookresearch/fairseq/tree/nllb
[4]: https://ai.facebook.com/blog/nllb-200-high-quality-machine-translation/

View File

@ -2,7 +2,7 @@
[#]: via: "https://opensource.com/article/21/1/gnu-project-debugger"
[#]: author: "Stephan Avenwedde https://opensource.com/users/hansic99"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: translator: "Maisie-x"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "

View File

@ -2,7 +2,7 @@
[#]: via: "https://itsfoss.com/install-arch-linux-virtualbox/"
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: translator: "hanszhao80"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
@ -225,7 +225,7 @@ via: https://itsfoss.com/install-arch-linux-virtualbox/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
译者:[hanszhao80](https://github.com/hanszhao80)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -2,7 +2,7 @@
[#]: via: "https://ostechnix.com/getting-started-with-docker/"
[#]: author: "sk https://ostechnix.com/author/sk/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: translator: "MCGA"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "

View File

@ -1,104 +0,0 @@
[#]: subject: "massCode: A Free and Open-Source Code Snippet Manager"
[#]: via: "https://itsfoss.com/masscode/"
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
massCode: A Free and Open-Source Code Snippet Manager
======
Brief: An open-source code snippet manager that enables you to dabble with code, improve productivity, and save time.
If a tool makes things faster and efficient, that is a life-saver for many developers.
While there are different services and platforms that try to make the coding experience quicker, you still have several other options to consider.
For instance, a code snippet manager. With a snippet manager, you aim to save a section of code that you want to quickly access. It is more like assigning shortcuts to add the required code in your program.
This is not a new concept, but the tools available for the job may not be entirely open-source.
Fortunately, I stumbled upon a decent project that provides you with a free and open-source snippet manager, i.e., massCode.
### massCode: Cross-Platform Open-Source Snippet Manager
![masscode][1]
massCode is a useful snippet manager with some essential features.
It supports a wide range of programming languages and also includes Markdown support. You can organize the snippets of your code using folders, add tags, and more.
massCode is available for Linux, Windows, or macOS. Lets take a look at some key features.
### Features of massCode
![masscode screenshot][2]
massCode includes many useful functionalities. Some of them are:
* Multi-level folder organizer
* Each snippet can be stored in fragments (tabs)
* Integrated coding editor, i.e., [Ace][3].
* Code formatting or highlighting.
* Markdown support with preview.
* The ability to search for a snippet.
* Add descriptions to your snippet to know what it is for.
* Variety of dark/light themes available.
* Ability to migrate from [SnippetsLab][4].
* Auto-save to help you retain your work.
* Integrate it with cloud synchronization folders.
* Extension support for VSCode, Raycast, and Alfred.
In addition to all the features mentioned, you also get to easily copy the code snippets saved in a single click.
For customization, you can tweak the font size and family, toggle Word Wrap, highlight lines, use single quotes, or add a trailing command thanks to [Prettier][5].
Moreover, you can have multiple fragments for a snippet. So, it gives you the opportunity to use it for a wide range of use cases.
As mentioned, you can also integrate it with any of your cloud syncing services by changing the storage location to the synced folders.
![masscode migrate preferences][6]
Overall, it works well, with some limitations, like the ability to migrate nested folders from SnippetsLab to massCode.
### Install massCode on Linux
massCode is available as a [Snap package][7], but not on the Snap store. You can download the package directly and use the following command to get it installed:
```
sudo snap install --dangerous ~/Downloads/masscode_2.6.1_amd64.snap
```
One of our troubleshooting guides can help you know more about the [dangerous snap flag][8].
You can download it for Windows/macOS through its [official website][9] or its [GitHub releases section][10].
[massCode][11]
Have you tried massCode yet? Is there any other code snippet manager available for Linux? Let me know your thoughts in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/masscode/
作者:[Ankush Das][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lkxed
[1]: https://itsfoss.com/wp-content/uploads/2022/07/masscode-screenshot-1.png
[2]: https://itsfoss.com/wp-content/uploads/2022/07/masscode-screenshot.png
[3]: https://github.com/ajaxorg/ace
[4]: https://apps.apple.com/us/app/snippetslab/id1006087419?mt=12
[5]: https://prettier.io/
[6]: https://itsfoss.com/wp-content/uploads/2022/07/masscode-migrate-preferences.jpg
[7]: https://itsfoss.com/install-snap-linux/
[8]: https://itsfoss.com/snap-metadata-signature-error/
[9]: https://masscode.io/
[10]: https://github.com/massCodeIO/massCode/releases/tag/v2.6.1
[11]: https://masscode.io/

View File

@ -1,155 +0,0 @@
[#]: subject: "Check disk usage in Linux"
[#]: via: "https://opensource.com/article/22/7/check-disk-usage-linux"
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
[#]: collector: "lkxed"
[#]: translator: "MjSeven"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Check disk usage in Linux
======
The du and ncdu commands provide two different views of the same information, making it easy to keep track of what's stored on your computer.
![Data stack in blue][1]
Knowing how much of your disk is being used by your files is an important consideration, no matter how much storage you have. My laptop has a relatively small 250GB NVME drive. That's okay most of the time, but I began to explore gaming on Linux a couple of years ago. Installing Steam and a few games can make storage management more critical.
### The du command
The easiest way to examine what's left for storage on your disk drive is the [du command][2]. This command line utility estimates file space usage. Like all Linux tools, `du` is very powerful, but knowing how to use it for your particular needs is helpful. I always consult the man page for any utility. This specific tool has several switches to give you the best possible snapshot of file storage and how much space they consume on your system.
There are many options for the `du` command. Here are some of the common ones:
* -a - write counts for all files and not just directories
* --apparent-size - prints apparent sizes rather than disk usage
* -h - human-readable format
* -b - bytes
* -c -grand total
* -k - block size
* -m - size in megabytes
Be sure to check the `du` man page for a complete listing.
#### Display all files
The first option you could choose is `du -a`. It provides a readout of all files on your system and the directories they are stored in. This command lets me know I've got 11555168 bytes stored in my home directory. Using `du -a` provides a quick recursive look at my storage system. What if I want a more meaningful number, and I want to drill down into the directories to see where the big files are on my system?
I think there are some big files in my `Downloads` directory, so I enter `du -a /home/don/Downloads` to get a good look at that `Downloads` directory.
```
$ du -a ~/Downloads
4923    ./UNIX_Driver_5-0/UNIX Driver 50
4923    ./UNIX_Driver_5-0
20     ./epel-release-latest-9.noarch.rpm
12    ./rpmfusion-free-release-9.noarch.rpm
2256    ./PZO9297 000 Cover.pdf
8    ./pc.md
2644    ./geckodriver-v0.31.0-linux64.tar.gz
466468
```
The numbers on the far left are the file sizes in bytes. I want something more helpful to me so I add the switch for the human-readable format to my `du -h /home/don/Downloads` command. The result is 4.8 G(igabytes) which is a more useful number format for me.
```
$ du -a ~/Downloads
4.9M    ./UNIX_Driver_5-0/UNIX Driver 50
4.9M    ./UNIX_Driver_5-0
20K    ./epel-release-latest-9.noarch.rpm
12K    ./rpmfusion-free-release-9.noarch.rpm
2.2M    ./PZO9297 000 Cover.pdf
8.0K    ./pc.md
2.6M    ./geckodriver-v0.31.0-linux64.tar.gz
456M    .
```
As with most Linux commands, you can combine options. To look at your `Downloads` directory in a human-readable format, use the `du -ah ~/Downloads` command.
**[[ Read also: 5 Linux commands to check free disk space ]][3]**
#### Grand total
The `-c` option provides a grand total for disk usage at the last line. I can use `du -ch /home/don` to display every file and directory in my home directory. There is a lot of information, and I really just want what is at the end, so I will pipe the disk usage command to `tail`. The command is `du -ch /home/don | tail`.
![pipe the du command output into tail][4]
Image by:
(Don Watkins, CC BY-SA 4.0)
### The ncdu command
Another option for Linux users interested in what is stored on their drive is the [ncdu command][5]. The command stands for *NCurses Disk Usage*. Depending on your Linux distribution, you may need to download and install it.
On Linux Mint, Elementary, Pop_OS!, and other Debian-based distributions:
```
$ sudo apt install ncdu
```
On Fedora, Mageia, and CentOS:
```
$ sudo dnf install ncdu
```
On Arch, Manjaro, and similar:
```
$ sudo pacman -S ncdu
```
Once installed, you can use `ncdu` to analyze your filesystem. Here is a sample output after issuing `ncdu` inside my home directory. The man page for `ncdu` states that "ncdu (NCurses Disk Usage) is a curses-based version of the well-known `du`, and provides a fast way to see what directories are using your disk space."
![du command home directory output][6]
Image by:
(Don Watkins, CC BY-SA 4.0)
I can use the arrow keys to navigate up and down and press the **Enter** key to enter a directory. An interesting note is that `du` reported total disk usage in my home directory as 12GB, and `ncdu` reports that I have total disk usage of 11GB. You can find more information in the `ncdu` man page.
You can explore a particular directory by pointing `ncdu` to that directory. For example, `ncdu /home/don/Downloads`.
![ncdu command output][7]
Image by:
(Don Watkins, CC BY-SA 4.0)
Press the **?** key to display the Help menu
![ncdu help][8]
Image by:
(Don Watkins, CC BY-SA 4.0)
### Wrap up
The `du` and `ncdu` commands provide two different views of the same information, making it easy to keep track of what's stored on your computer.
If you're not comfortable in the terminal or just looking for yet another view of this kind of information, check out the [GNOME Disk Usage Analyzer][9]. You can easily install and use it if it's not already on your system. Check your distribution for `baobab` and install it if you'd like to experiment.
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/7/check-disk-usage-linux
作者:[Don Watkins][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/don-watkins
[b]: https://github.com/lkxed
[1]: https://opensource.com/sites/default/files/lead-images/data_stack_blue_disks.png
[2]: https://opensource.com/article/21/7/check-disk-space-linux-du
[3]: https://opensource.com/article/18/7/how-check-free-disk-space-linux
[4]: https://opensource.com/sites/default/files/2022-06/1-du-tail.png
[5]: https://opensource.com/article/21/8/ncdu-check-free-disk-space-linux
[6]: https://opensource.com/sites/default/files/2022-06/2home.png
[7]: https://opensource.com/sites/default/files/2022-06/3downloads.png
[8]: https://opensource.com/sites/default/files/2022-06/4ncdu.png
[9]: https://help.gnome.org/users/baobab/stable/

View File

@ -0,0 +1,152 @@
[#]: subject: "DAT Linux: Perfect Distro for Data Science Based on Ubuntu LTS"
[#]: via: "https://www.debugpoint.com/dat-linux-review/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
DAT Linux: Perfect Distro for Data Science Based on Ubuntu LTS
======
We review the first beta version of DAT Linux, curated only for data scientists.
Data science is in massive demand today, including job prospects, learning, university courses, etc. Its a stream which deals with extracting meaningful inferences by applying algorithms and AI models.
Most of todays commercial data science products are available from the major tech players. And those products target large enterprises with critical businesses. But hundreds of free and open-source tools, packages, and programs are available for data science work that many are unaware of.
Hence, setting up a working Linux system with those tools for data science work takes significant time because it requires little research, download & installation and so on.
Keeping that in mind, DAT Linux brings a vast, pre-installed, pre-configured set of tools and programs with its native tools to assist data scientists, students, teachers and hobbyists.
In this article, we review DAT Linux and its Beta release.
![DAT Linux 1.0b Desktop][1]
### DAT Linux Review
#### Base and Installation
The name “DAT” is a stripped-down version of the word “DATA”. As its target is Data Science, it became “DAT Linux” as a short.
At its core, DAT Linux is based on Ubuntu LTS, i.e. [Lubuntu 22.04 LTS][2] as of its 1.0b (Beta) release, which is the target version of this review.
The choice of Lubuntu with LXQt desktop is interesting, considering KDE Plasma or Xfce for a traditional desktop look. Perhaps, the performance is the aim of a data science work which may take considerable system resources. And LXQt desktop is probably the most lightweight desktop environment today.
The installer size is 3.3 GB, almost identical to the [Ubuntu 22.04 LTS][3]. However, there is a slight difference in the installer.
DAT Linux uses a customised Calamares Installer in place of the Ubiquity installer from Ubuntu. However, an installer doesnt mean much, but Calamares is by far the best installer available today in terms of usability & stability.
During the test, the installation went smooth and no major problems and errors for this beta version of DAT Linux.
#### First Look and Desktop
Lubuntu is [super-lightweight distribution][4] thanks to the LXQt desktop and its components. The LXQt brings several native apps such as QTerminal, and PCManFM-QT file manager.
The beauty of a traditional icon and menu-based desktop environment is its usability and time-tested approach. Moreover, you care less about desktop themes and looks when working on serious data science projects.
The LXQt desktop in DAT Linux is a stock experience with a bottom main panel. It has the application menu at the left, a list of open applications and windows in the middle and the system tray at the right. By default, LXQt offers four workspaces which I believe are more than sufficient to logically diving your data science apps for work.
Overall, its a fast, clean desktop perfect for work or projects.
#### The difference with the stock-Lubuntu
The default applications for various tasks are slightly different from a stock Lubuntu version. Firstly, the default web browser is LibreWolf (and not Firefox), a free and open-source privacy-focused browser.
Secondly, for installing additional apps and packages, it brings KDEs Discover, which is a central tool to install, remove and manage software and packages. In addition, DAT Linux also brings Muon package manager by KDE (which we featured in [Best KDE Apps Part 2][5]). The Muon package manager is also a powerful package manager for searching and installing packages. In addition, you can easily manage software sources and PPAs using Muon.
![Muon Package Manager][6]
Other extra software includes Vim editor, [nobleNote notebook manager][7], VLC Media Player, Xscreensaver and Picom. Also, LibreOffice is pre-installed in DAT Linux.
However, Flatpak and Snap (daemons) are not pre-installed which is suitable for a lightweight system.
#### Data Science Applications & Native Tools
The primary focus of this distro is Data science, which is loaded with all the necessary apps for this stream.
The application list is spread across dynamic programming languages, Python libraries, Business Intelligence reporting tools, scientific graph plotters and many more.
Heres the sample list of data science applications (You can read the detailed list [here][8]):
| App Name | Description |
| :- | :- |
| BiRT | Eclipse BIRT™ is an open source reporting system for producing compelling BI reports |
| Julia | Julia is a high-level, high-performance, dynamic programming language |
| Jupyter Notebook | The Jupyter Notebook is a web-based interactive, scientific computing platform |
| Jupyter Lab | JupyterLab is the latest web-based interactive development environment for notebooks, code, and data |
| MOA | MOA is an open source framework for Big Data stream mining. It includes a collection of machine learning algorithms |
| OpenRefine | OpenRefine is an open-source desktop application for data cleanup and transformation to other formats |
| PSPP | GNU PSPP is a program for statistical analysis of sampled data. It is a free as in freedom replacement for the proprietary program SPSS |
| R | R is a free software environment for statistical computing and graphics |
| R-Studio | RStudio is an Integrated Development Environment (IDE) for R |
| Spyder | Spyder is a free and open source scientific environment written in Python, for Python, and designed by and for scientists, engineers and data analysts |
As you can see, the above list should be sufficient for any data science use cases, whether you are a student, teacher, freelancer or professional.
#### DAT Linux Control Panel
DAT Linux folks also thought of a proper way of finding and launching these extra apps.
To do that, it brings DAT Linux Control Panel, a grid-based app launcher for the data science apps classified by functionalities in separate tabs.
It also gives you several additional options for native DAT Linux apps such as software updater, programming language cheat sheets & references, etc.
![DAT Linux Control Panel][9]
Finally, this release brings [Linux Kernel 5.15 LTS][10] with [Python 3.10][11] & [LXQt 0.17][12] which is the base for Ubuntu 22.04 LTS.
#### Performance
The performance metric is impressive. At its idle state, DAT Linux uses 500 MB to 700 MB of RAM, and the CPU is, on average, 4%. Most of the system resources are consumed by Systemd services.
The metric obviously goes up when you run many data science applications and browsers. Since the idle state performance is good, I believe the heavy workload state should also be well-optimised.
Also, its essential to remember that most data science work requires heavy computing power. Hence, its always better to use this distribution in modern hardware with the latest CPU families.
![DAT Linux Performance at Idle State with 3 hours uptime][13]
In addition to the above, DAT Linux takes around 10 GB of disk space for default installation and all the packages.
### Wrapping Up
Despite thousands of distros and variants, DAT Linux is unique because it is a blend of Lubuntu LTS with only Data Science packages. As per my little knowledge, only Fedora has a spin called “[Fedora Scientific][14]“, which mainly deals with scientific software.
However, DAT Linux did well by packaging all the necessary apps with a front-end to manage them. One of the main aspects is that this distro will save time from installing and configuring all these apps by a general user.
Also, the Ubuntu LTS base with LXQt desktop is a suitable choice. Although, I believe a better File manager (such as Dolphin or Nemo) would have been better than PCManFM-Qt.
Other than that, its a complete distro and performs well. I hope it goes out of Beta soon and gets a first stable release.
You can download DAT Linux from the [official website][15].
So, what do you think about this distro? Would it be successful in its target niche community? Let me know in the comment box below.
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/dat-linux-review/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed
[1]: https://www.debugpoint.com/wp-content/uploads/2022/07/DAT-Linux-1.0b-Desktop.jpg
[2]: https://www.debugpoint.com/lubuntu-22-04-lts/
[3]: https://www.debugpoint.com/web-stories/ubuntu-22-04-review/
[4]: https://www.debugpoint.com/lightweight-linux-distributions-2022/
[5]: https://www.debugpoint.com/great-kde-apps-part-2/
[6]: https://www.debugpoint.com/wp-content/uploads/2022/07/Muon-Package-Manager2.jpg
[7]: https://github.com/hakaishi/nobleNote
[8]: https://datlinux.com/
[9]: https://www.debugpoint.com/wp-content/uploads/2022/07/DAT-Linux-Control-Panel.jpg
[10]: https://www.debugpoint.com/linux-kernel-5-15/
[11]: https://www.debugpoint.com/install-python-3-10-ubuntu/
[12]: https://www.debugpoint.com/lxqt-0-17-release/
[13]: https://www.debugpoint.com/wp-content/uploads/2022/07/DAT-Linux-Performance-at-Idle-State-with-3-hours-uptime.jpg
[14]: https://labs.fedoraproject.org/en/scientific/
[15]: https://datlinux.com/download/

View File

@ -0,0 +1,143 @@
[#]: subject: "Monitoring tiny web services"
[#]: via: "https://jvns.ca/blog/2022/07/09/monitoring-small-web-services/"
[#]: author: "Julia Evans https://jvns.ca/"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Monitoring tiny web services
======
Hello! Ive started to run a few more servers recently ([nginx playground][1], [mess with dns][2], [dns lookup][3]), so Ive been thinking about monitoring.
It wasnt initially totally obvious to me how to monitor these websites, so I wanted to quickly write up what how I did it.
Im not going to talk about how to monitor Big Serious Mission Critical websites at all, only tiny unimportant websites.
### goal: spend approximately 0 time on operations
I want the sites to mostly work, but I also want to spend approximately 0% of my time on the ongoing operations.
I was initially very wary of running servers at all because at my last job I was on a 247 oncall rotation for some critical services, and in my mind “being responsible for servers” meant “get woken up at 2am to fix the servers” and “have lots of complicated dashboards”.
So for a while I only made static websites so that I wouldnt have to think about servers.
But eventually I realized that any server I was going to write was going to be very low stakes, if they occasionally go down for 2 hours its no big deal, and I could just set up some very simple monitoring to help keep them running.
### not having monitoring sucks
At first I didnt set up any monitoring for my servers at all. This had the extremely predictable outcome of sometimes the site broke, and I didnt find out about it until somebody told me!
### step 1: an uptime checker
The first step was to set up an uptime checker. There are tons of these out there, the ones Im using right now are [updown.io][4] and [uptime robot][5]. I like updowns user interface and [pricing][6] structure more (its per request instead of a monthly fee), but uptime robot has a more generous free tier.
These
1. check that the site is up
2. if it goes down, it emails me
I find that email notifications are a good level for me, Ill find out pretty quickly if the site goes down but it doesnt wake me up or anything.
### step 2: an end-to-end healthcheck
Next, lets talk about what “check that the site is up” actually means.
At first I just made one of my healthcheck endpoints a function that returned `200 OK` no matter what.
This is kind of useful it told me that the server was on!
But unsurprisingly I ran into problems because it wasnt checking that the API was actually _working_ sometimes the healthcheck succeeded even though the rest of the service had actually gotten into a bad state.
So I updated it to actually make a real API request and make sure it succeeded.
All of my services do very few things (the nginx playground has just 1 endpoint), so its pretty easy to set up a healthcheck that actually runs through most of the actions the service is supposed to do.
Heres what the end-to-end healthcheck handler for the nginx playground looks like. Its very basic: it just makes another POST request (to itself) and checks if that request succeeds or fails.
```
func healthHandler(w http.ResponseWriter, r *http.Request) {
// make a request to localhost:8080 with `healthcheckJSON` as the body
// if it works, return 200
// if it doesn't, return 500
client := http.Client{}
resp, err := client.Post("http://localhost:8080/", "application/json", strings.NewReader(healthcheckJSON))
if err != nil {
log.Println(err)
w.WriteHeader(http.StatusInternalServerError)
return
}
if resp.StatusCode != http.StatusOK {
log.Println(resp.StatusCode)
w.WriteHeader(http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusOK)
}
```
### healthcheck frequency: hourly
Right now Im running most of my healthchecks every hour, and some every 30 minutes.
I run them hourly because updown.ios pricing is per healthcheck, Im monitoring 18 different URLs, and I wanted to keep my healthcheck budget pretty minimal at $5/year.
Taking an hour to find out that one of these websites has gone down seems ok to me if there is a problem theres no guarantee Ill get to fixing it all that quickly anyway.
If it were free to run them more often Id probably run them every 5-10 minutes instead.
### step 3: automatically restart if the healthcheck fails
Some of my websites are on fly.io, and fly has a pretty standard feature where I can configure a HTTP healthcheck for a service and restart the service if the healthcheck starts failing.
“Restart a lot” is a very useful strategy to paper over bugs that I havent gotten around to fixing yet for a while the nginx playground had a process leak where `nginx` processes werent getting terminated, so the server kept running out of RAM.
With the healthcheck, the result of this was that every day or so, this would happen:
* the server ran out of RAM
* the healthcheck started failing
* it get restarted
* everything was fine again
* repeat the whole saga again some number of hours later
Eventually I got around to actually fixing the process leak, but it was nice to have a workaround in place that could keep things running while I was procrastinating fixing the bug.
These healthchecks to decide whether to restart the service run more often: every 5 minutes or so.
### this is not the best way to monitor Big Services
This is probably obvious and I said this already at the beginning, but “write one HTTP healthcheck” is not the best approach for monitoring a large complex service. But I wont go into that because thats not what this post is about.
### its been working well so far!
I originally wrote this post 3 months ago in April, but I waited until now to publish it to make sure that the whole setup was working.
Its made a pretty big difference before I was having some very silly downtime problems, and now for the last few months the sites have been up 99.95% of the time!
--------------------------------------------------------------------------------
via: https://jvns.ca/blog/2022/07/09/monitoring-small-web-services/
作者:[Julia Evans][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://jvns.ca/
[b]: https://github.com/lujun9972
[1]: https://nginx-playground.wizardzines.com
[2]: https://messwithdns.net
[3]: https://dns-lookup.jvns.ca
[4]: https://updown.io/
[5]: https://uptimerobot.com/
[6]: https://updown.io/#pricing

View File

@ -0,0 +1,162 @@
[#]: subject: "How to Install yay AUR Helper in Arch Linux [Beginners Guide]"
[#]: via: "https://www.debugpoint.com/install-yay-arch/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to Install yay AUR Helper in Arch Linux [Beginners Guide]
======
This beginners guide explains the steps to install the Yay AUR helper in Arch Linux.
The yay is an abbreviation of Yet Another Yogurt. It is technically a [pacman][1] wrapper and AUR helper written in [Go programming languages][2]. It is the most popular [Arch User Repository (AUR)][3] helper available today. With Yay, you can take advantage of a vast Arch User Repository of packages and easily compile and install any software.
It automates many package management tasks such as searching, resolving dependencies on the fly, compiling and building packages, and, of course, publishing your packages for AUR.
Lets look at how you can install Yay in Arch Linux or any Arch-based distro such as Manjaro. Once you install Arch Linux, you can install packages via pacman package manager from three main Arch official repo. But Yay is not installed by default after a fresh Arch Linux installation. Hence you need to install it to take advantage of AUR manually.
This guide covers the below topics.
* Install yay in Arch Linux
* Install yay in Manjaro
* How to use yay to install packages in Arch Linux and Manjaro
* Some yay tips
### Install yay in Arch Linux
#### Pre-requisite
Open a terminal and run the below commands. Provide admin password when prompted. These steps require the [base-devel][4] package and git package for compilation and installation.
```
sudo pacman -S base-devel
```
```
sudo pacman -S git
```
![Install git][5]
#### Install yay
The yay package has two versions in the Arch repository, as follows.
[yay][6] stable version[yay-git][7] development version
For this guide, I have used the stable version. Now, go to “/opt” directory and clone the git repo.
```
cd /optsudo git clone https://aur.archlinux.org/yay.git
```
![clone the yay repo][8]
Change the owner of the source directory. Replace “debugpoint” with your user name.
```
sudo chown -R debugpoint:users ./yay
```
If you are unaware of the user or group, you can find the user and groups using the example below.
```
id debugpoint
```
Go to the directory and compile.
```
cd yay
```
```
makepkg -si
```
This completes the installation for yay in Arch Linux.
![Install yay in Arch Linux][9]
### Install in yay in Manjaro
If you are using Manjaro Linux, the yay package is available in the community repo. You can easily install using the following commands in Manjaro.
```
pacman -Syyupacman -S yay
```
Now, lets look at how you can install any package using Yay and some basic yay usage.
### How to use yay to install packages
The first search on the AUR website to install any application to get the package name. For example, to install [featherpad][10] text editor, run the below command.
```
yay -S featherpad
```
After installation, you can find the application launcher in the application menu.
![Install a sample application (featherpad) using yay][11]
### Some yay tips
You can also do many tweaks and system operations using yay. Some of the examples are below.
**Refresh the system packages and upgrade:**
```
yay -Syu
```
**Use the development versions of packages and upgrade (be careful while running this command)**:
```
yay -Syu --devel --timeupdate
```
**Remove any packages (for example, featherpad)**:
```
yay -Rns featherpad
```
**Get a quick system stat:**
![system stat using yay][12]
```
yay -Ps
```
I hope this beginners guide helped you install yay in [Arch Linux][13], then use yay for installing packages, and perform different system actions.
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/install-yay-arch/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed
[1]: https://wiki.archlinux.org/index.php/pacman
[2]: https://golang.org/
[3]: https://wiki.archlinux.org/index.php/Arch_User_Repository
[4]: https://aur.archlinux.org/packages/meta-group-base-devel/
[5]: https://www.debugpoint.com/wp-content/uploads/2021/01/Install-git-1024x291.png
[6]: https://aur.archlinux.org/packages/yay/
[7]: https://aur.archlinux.org/packages/yay-git/
[8]: https://www.debugpoint.com/wp-content/uploads/2021/01/clone-the-yay-repo-1024x271.png
[9]: https://www.debugpoint.com/wp-content/uploads/2021/01/Install-yay-in-Arch-Linux-1024x460.png
[10]: https://aur.archlinux.org/packages/featherpad-git/
[11]: https://www.debugpoint.com/wp-content/uploads/2021/01/Install-a-sample-application-featherpad-using-yay-1024x620.png
[12]: https://www.debugpoint.com/wp-content/uploads/2021/01/system-stat-using-yay.png
[13]: https://www.debugpoint.com/tag/arch-linux/

View File

@ -0,0 +1,140 @@
[#]: subject: "Google Summer of Code + Zephyr RTOS"
[#]: via: "https://www.linux.com/news/google-summer-of-code-zephyr-rtos/"
[#]: author: "The Linux Foundation https://www.linuxfoundation.org/blog/google-summer-of-code-zephyr-rtos/"
[#]: collector: "lkxed"
[#]: translator: "lkxed"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
谷歌编程之夏与 Zephyr RTOS 项目介绍
======
**谷歌编程之夏**GSoC是一个谷歌举办的国际年度项目每年都在夏季举办。当贡献者们参与并完成一个 [自由开源软件][3] 的编码项目,[谷歌][1] 就会给他们发放 [津贴][2]。谷歌编程之夏于 2005 年推出,于 5 月至 8 月举行。项目创意由参与开源软件开发的主办组织提交,但学生也可以提出自己的项目创意。
今年,该项目向 18 岁或以上的任何人开放 —— 不仅限于学生和应届毕业生了。参与者通过编写软件获得报酬,其 [津贴][4] 的金额取决于他们所在国家/地区的 [购买力平价][5]。
**LCTT 译注:以往,这个活动只允许在校学生参与,今年条件放开,只需年龄 18+ 即可,对参与者的贡献时长要求也降低了,尽可能地让更多人参与进来。不过,今年的报名通道在 4 月 19 日就截止了,大家有兴趣的话明年可以关注一下。**
这也是 Zephyr 项目第一次作为 Linux 基金会的项目,参与到谷歌编程之夏中。让我们一起欢迎这些贡献者及其项目吧!
### 项目一:基于 Zephyr 的 Arduino 模块
1 个贡献者350 小时)。
[Arduino][6] 是一个流行的框架它为嵌入式设备编程提供了一个简化的接口。最近Arduino 采用 mbed OS 作为其一些新设备的基础 RTOS。通过这项工作他们将 [Arduino Core][7] 作为独立的抽象层,从 [Arduino Core for mbed][8] 中分离出来。这为在其他操作系统上利用 Arduino Core 开辟了可能性。
该项目的想法就是创建一个利用 Arduino Core 的 Zephyr 模块,以便开发人员在与 Arduino 兼容的设备上使用 Arduino 框架时,可以使用 Zephyr 作为底层操作系统。对用户的好处包括:
* 可以访问 Arduino API 以及高级 Zephyr 功能
* 得益于 Zephyrs 的设备支持,用户可以选择标准 Arduino 生态系统更广泛的设备
* 能够重复使用 Arduino 工具,如 Arduino IDE 和丰富的库
Arduino Core 使用 LGPL 下进行许可Zephyr 使用 Apache 2 下进行许可。这意味着该项目的开发很可能需要脱离主分支,并在单独的 repo 中进行,以保持代码和许可证分离。有关这方面的历史讨论,请参阅 [#22247][9],有关 Arduino 核心架构之前的早期尝试,请参阅 [soburi/arduino-on-zephyr][10]。
**贡献者的任务是:**
* 实现一个基于 Arduino Core 的准系统模块,可以为任何目标编译(不具备功能性,可能在 QEMU 中)
* 基于 Zephyr使用 Arduino API 实现一个通用外围设备,例如 [Serial][11]
* 以一个物理板为目标,例如 Arduino Zero
**导师:**
[Jonathan Beri][12] Golioth 和 Zephyr TSC 的首席执行官
[Alvaro Viebrantz][13] Golioth 和 Google GDE 的创始工程师
**代码许可证:** LGPL
**贡献者详细信息:**
* 姓名Dhruva Gole
* 项目博客:[https://dhruvag2000.github.io/Blog-GSoC22/][14]
* 项目海报:
![][15]
**关于贡献者:**
![][16]
Dhruva 是一名电气工程专业的本科生。他的兴趣广泛,从嵌入式软件开发到硬件设计,在 SBC、微控制器和嵌入式 Linux 平台方面拥有丰富的工作经验。
### 项目二Zephyr 的 Apache Thrift 模块
一个贡献者350 hours
[Apache Thrift][17] 是一个 [IDL][18] 规范、[RPC][19] 框架和代码生成器,它抽象出传输和协议细节,让开发者专注于应用逻辑。它适用于所有主流操作系统,支持超过 27 种编程语言、7 种协议和 6 种底层传输方式。最初,它于 [2007 年在 Facebook 开发][20],随后与 Apache 软件基金会共享。
![][21]
![][22]
在 Zephyr RTOS 中支持 Thrift 将使社区受益匪浅。它将带来新的软件和硬件技术、新产品以及云集成的其他方式。 Thrift 也可以用于几乎任何传输,因此,它是 Zephyr 支持的许多不同物理通信层的自然选择。该项目的想法是使概念验证 [Thrift for Zephyr 模块][23] 形成以供上游使用。为此,贡献者必须:
* 对 Thrift 功能(协议、传输)执行额外的集成
* 使用 [supported board][24] 或 [Qemu][25] 编写其他示例应用程序
* 使用 [Zephyr 测试框架][26] 编写其他测试并生成覆盖率报告
* 确保模块遵循适当的 [编码指南][27] 并满足 [模块要求][28]
* 将任何必要的改进贡献回 Apache Thrift 项目
* 将任何必要的改进贡献回 Zephyr 项目
**导师:**
* [Christopher Friedt][29] Meta 的 SWE / ASIC FW 和 Zephyr TSC 成员
* [Stephanos Ioannidis][30] Zephyr CXX 子系统维护者
**代码许可证:** Apache 2.0
**贡献者详细信息:**
* 姓名Young
**关于贡献者:** Young 是一名通信工程专业的学生,他将攻读计算机工程硕士学位。他兴趣广泛,从前端开发到硬件设计,在 Web、IoT 和嵌入式平台方面拥有丰富的工作经验。2021 年他设计的一款搭载 RISC-V 64 处理器的低成本单板机被多家极客媒体报道。
本文 [Google Summer of Code + Zephyr RTOS][31] 首发于 [Linux 基金会][32]。
--------------------------------------------------------------------------------
via: https://www.linux.com/news/google-summer-of-code-zephyr-rtos/
作者:[The Linux Foundation][a]
选题:[lkxed][b]
译者:[lkxed](https://github.com/lkxed)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linuxfoundation.org/blog/google-summer-of-code-zephyr-rtos/
[b]: https://github.com/lkxed
[1]: https://en.wikipedia.org/wiki/Google
[2]: https://en.wikipedia.org/wiki/Stipend
[3]: https://en.wikipedia.org/wiki/Free_and_open-source_software
[4]: https://en.wikipedia.org/wiki/Stipend
[5]: https://en.wikipedia.org/wiki/Purchasing_power_parity
[6]: https://www.arduino.cc/
[7]: https://github.com/arduino/ArduinoCore-API
[8]: https://github.com/arduino/ArduinoCore-mbed
[9]: https://github.com/zephyrproject-rtos/zephyr/issues/22247
[10]: https://github.com/soburi/arduino-on-zephyr
[11]: https://www.arduino.cc/reference/en/language/functions/communication/serial/
[12]: https://www.linkedin.com/in/jonathanberi/
[13]: https://www.linkedin.com/in/alvaro-viebrantz-55119048/
[14]: https://dhruvag2000.github.io/Blog-GSoC22/
[15]: https://www.linuxfoundation.org/wp-content/uploads/project-poster.png
[16]: https://www.linuxfoundation.org/wp-content/uploads/dhruva.jpeg
[17]: https://github.com/apache/thrift
[18]: https://en.wikipedia.org/wiki/Interface_description_language
[19]: https://en.wikipedia.org/wiki/Remote_procedure_call
[20]: https://thrift.apache.org/static/files/thrift-20070401.pdf
[21]: https://www.linuxfoundation.org/wp-content/uploads/apache-thrift-layered-architecture.png
[22]: https://www.linuxfoundation.org/wp-content/uploads/SPDX-license.png
[23]: https://github.com/cfriedt/thrift-for-zephyr
[24]: https://docs.zephyrproject.org/latest/boards/index.html
[25]: https://docs.zephyrproject.org/latest/guides/networking/qemu_user_setup.html
[26]: https://docs.zephyrproject.org/latest/guides/test/ztest.html
[27]: https://docs.zephyrproject.org/latest/contribute/coding_guidelines/index.html
[28]: https://docs.zephyrproject.org/latest/guides/modules.html
[29]: https://www.linkedin.com/in/christopher-friedt/
[30]: https://www.linkedin.com/in/stephanosio/
[31]: https://www.linuxfoundation.org/blog/google-summer-of-code-zephyr-rtos/
[32]: https://www.linuxfoundation.org/

View File

@ -1,223 +0,0 @@
[#]: subject: "How dynamic linking for modular libraries works on Linux"
[#]: via: "https://opensource.com/article/22/5/dynamic-linking-modular-libraries-linux"
[#]: author: "Jayashree Huttanagoudar https://opensource.com/users/jayashree-huttanagoudar"
[#]: collector: "lkxed"
[#]: translator: "robsean"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
如何在 Linux 上动态链接模块库
======
学习如何将多个 C <ruby>对象<rt>object</rt></ruby> 文件组合到一个带有动态库的单个可执行文件文件之中
![Links][1]
图片作者: Paul Lewin ,由 Opensource.com 稍微修改CC BY-SA 2.0
当不使用 C 编程语言编写一个应用程序时,你的代码通常有多个源文件代码。
归根结底,这些文件必需被编译到一个单个的可执行文件之中。你可以通过创建静态或动态库 (后者也被称为 <ruby>共享<rt>shared</rt></ruby> 库) 来实现这一点。这两种类型的库在创建和链接方面有所差异。两者都有缺点和优点,这取决于你的使用实例。
动态链接是最常见的方法,由其是在 Linux 系统上。动态链接会保持库模块化,因此,很多应用程序可以共享一个库。应用程序的模块化也允许单独更新其依赖的共享库。
在这篇文章中,我将演示动态链接是如何工作的。在后期的文章中,我将演示静态链接。
### 链接器
链接器是一个命令,它将一个程序的数个部分组合到一起,并为它们重新组织存储器分配。
链接器的功能包括:
* 集成一个程序的所有的部分
* 计算组织出一个新的存储器结构,以便所有的部分组合在一起
* 重新复活存储器地址,以便程序可以在新的存储器组织下运行
* 解析符号引用
作为这些链接器功能的结果,创建了一个名称为可执行文件的一个可运行程序。在你创建一个动态链接的可执行文件前,你需要一些将被链接 *到* 的库,和一个应用程序来编译。准备好你 [最喜欢的文本编辑器][2] 并继续。
### 创建 <ruby>对象<rt>object</rt></ruby> 文件
首先,创建带有这些函数识别标志的头文件 `mymath.h`
```
int add(int a, int b);
int sub(int a, int b);
int mult(int a, int b);
int divi(int a, int b);
```
使用这些函数定义来创建 `add.c` 、`sub.c` 、`mult.c` 和 `divi.c` 文件。我将把所有的代码都放置到一个代码块中,因此将其分为四个文件,如注释所示:
```
// add.c
int add(int a, int b){
return (a+b);
}
//sub.c
int sub(int a, int b){
return (a-b);
}
//mult.c
int mult(int a, int b){
return (a*b);
}
//divi.c
int divi(int a, int b){
return (a/b);
}
```
现在,使用 GCC 来创建对象文件 `add.o`、`sub.o`、`mult.o` 和 `divi.o`
```
$ gcc -c add.c sub.c mult.c divi.c
```
`-c` 选项跳过链接步骤,并且只创建对象文件。
### 创建一个共享的对象文件
在最终可执行文件的执行过程中将链接动态库。在最终可执行文件中仅放置动态库的名称。实际上的链接过程发生在运行时,在此期间,可执行文件和库都被放置到了主存储器之中。
除了可共享外,动态库的另外一个优点是它减少最终可执行文件的大小。在一个应用程序的最终可执行文件生成时,其使用的库只包括该库的名称,而不再包含该库的一个多余的副本。
你可以从你现有的示例代码中创建动态库:
```
$ gcc -Wall -fPIC -c add.c sub.c mult.c divi.c
```
选项 `-fPIC` 告诉 GCC 来生成位置独立代码 (PIC) 。`-Wall` 选项不是必需的,并且与代码的编译方式是无关的。不过,它却是有价值的选项,因为它会启用编译器警告,这在解决难题时是很有帮助的。
使用 GCC ,创建共享库 `libmymath.so`
```
$ gcc -shared -o libmymath.so \
add.o sub.o mult.o divi.o
```
现在,你已经创建了一个简单的示例数学库 `libmymath.so` ,你可以在 C 代码中使用它。当然,这里有非常复杂的 C 库,这就是他们这些开发者来生成最终产品的工艺流程,你和我可以安装这些库并在 C 代码中使用。
接下来,你可以在一些自定义代码中使用你的新的数学库,然后链接它。
### 创建一个动态链接的可执行文件
假设你已经为数学运算编写了一个命令。创建一个名称为 `mathDemo.c` 的文件,并将这些代码复制粘贴至其中:
```
#include <mymath.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
int x, y;
printf("Enter two numbers\n");
scanf("%d%d",&x,&y);
printf("\n%d + %d = %d", x, y, add(x, y));
printf("\n%d - %d = %d", x, y, sub(x, y));
printf("\n%d * %d = %d", x, y, mult(x, y));
if(y==0){
printf("\nDenominator is zero so can't perform division\n");
exit(0);
}else{
printf("\n%d / %d = %d\n", x, y, divi(x, y));
return 0;
}
}
```
注意:第一行是一个 `include` 语句,通过名称来引用你自己的 `libmymath` 库。为使用一个共享库,你必须已经安装了它,如果你没有安装你将要使用的库,那么当你的可执行文件在运行和搜索其包含的库时,它将不能找到共享库。在已知目录中未安装所需库的情况下,你需要能够编译代码,这里有 [一些方法来重写默认的设置][3]。不过,对于一般使用来说,库存在于已知位置是可以预期的,因此,这就是我在这里演示的东西。
复制文件 `libmymath.so` 到一个标准的系统目录,例如:`/usr/lib64` 然后运行 `ldconfig` 。`ldconfig` 命令会在标准库目录中创建所需要的链接,并将其缓存到可找到的最近的共享库。
```
$ sudo cp libmymath.so /usr/lib64/
$ sudo ldconfig
```
### 编译应用程序
从你的应用程序源文件代码 (`mathDemo.c`) 中创建一个名称为 `mathDemo.o` 的对象文件:
```
$ gcc -I . -c mathDemo.c
```
`-I` 选项告诉 GCC 来在其后所列出的目录中搜索头文件 (在这个实例中是 `mymath.h` )。在这个实例中,你正在具体指定当前目录,通过一个单个点 (`.` ) 来表示。创建一个可执行文件,使用 `-l` 选项来通过名称来引用到你的共享数学库:
```
$ gcc -o mathDynamic mathDemo.o -lmymath
```
GCC 会找到 `libmymath.so` ,因为它存在于一个默认的系统库目录中。使用 `ldd` 来查证所使用的共享库:
```
$ ldd mathDemo
linux-vdso.so.1 (0x00007fffe6a30000)
libmymath.so => /usr/lib64/libmymath.so (0x00007fe4d4d33000)
libc.so.6 => /lib64/libc.so.6 (0x00007fe4d4b29000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe4d4d4e000)
```
看看 `mathDemo` 可执行文件的大小:
```
$ du ./mathDynamic
24 ./mathDynamic
```
当然,它是一个小的应用程序,它所占用的磁盘空间量也反映了这一点。相比之下,相同代码的一个静态链接版本 (正如你将在我后期的文章所看到的一样) 是 932K !
```
$ ./mathDynamic
Enter two numbers
25
5
25 + 5 = 30
25 - 5 = 20
25 * 5 = 125
25 / 5 = 5
```
你可以使用 `file` 命令来查证它是动态链接的:
```
$ file ./mathDynamic
./mathDynamic: ELF 64-bit LSB executable, x86-64,
dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2,
with debug_info, not stripped
```
成功!
### 动态链接
因为链接发生在运行时,所以,使用一个共享库会导致产生一个轻量型的可执行文件。因为它在运行时解析引用,所以它会花费更多的执行时间。不过,因为 在日常使用的 Linux 系统上绝大多数的命令是动态链接的,并且在现代硬件上,所以和使用静态编译程序所能节省的时间相比是可以忽略的。对开发者和用户来说,它的固有模块性是一种强大的特色功能。
在这篇文章中,我描述了如何创建动态库并将其链接到一个最终可执行文件。在我的下一篇文章中,我将使用相同的源文件代码来创建一个静态链接的可执行文件。
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/5/dynamic-linking-modular-libraries-linux
作者:[Jayashree Huttanagoudar][a]
选题:[lkxed][b]
译者:[robsean](https://github.com/robsean)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jayashree-huttanagoudar
[b]: https://github.com/lkxed
[1]: https://opensource.com/sites/default/files/lead-images/links.png
[2]: https://opensource.com/article/21/2/open-source-text-editors
[3]: https://opensource.com/article/22/5/compile-code-ldlibrarypath

View File

@ -0,0 +1,104 @@
[#]: subject: "massCode: A Free and Open-Source Code Snippet Manager"
[#]: via: "https://itsfoss.com/masscode/"
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
massCode一个免费和开源的代码片段管理器
======
简介:一个开源的代码片段管理器,使你能够涉足代码,提高生产力,并节省时间。
如果一个工具能让事情变得更快、更有效率,那对许多开发者来说就是救命稻草。
虽然有不同的服务和平台试图使编码体验更快,但你仍然有其他几个选择可以考虑。
例如,一个代码片段管理器。使用代码片段管理器,你的目的是保存你想快速访问的代码部分。它更像是指定快捷方式,在你的程序中添加所需的代码。
这不是一个新的概念,但可用于这项工作的工具可能不完全是开源的。
幸运的是,我偶然发现了一个不错的项目,它为你提供了一个免费的、开源的片段管理器,即 massCode。
### massCode跨平台的开源片段管理器
![masscode][1]
massCode 是一个有用的片段管理器,具有一些基本功能。
它支持广泛的编程语言,还包括对 Markdown 的支持。你可以使用文件夹组织你的代码片段,添加标签等。
massCode 可用于 Linux、Windows 或 macOS。让我们来看看一些主要功能。
### massCode 的特点
![masscode screenshot][2]
massCode 包括许多有用的功能。其中一些是:
* 多层次的文件夹组织者
* 每个片段都可以存储在片段(标签)中
* 集成编码编辑器,即 [Ace][3]。
* 代码格式化或高亮显示。
* 支持带预览的 Markdown。
* 能够搜索一个片段。
* 给你的代码段添加描述,以了解它的用途。
* 各种深色/浅色主题可用。
* 能够从 [SnippetsLab][4] 迁移。
* 自动保存以帮助你保留你的工作。
* 将其与云同步文件夹整合。
* 对 VSCode、Raycast 和 Alfred 的扩展支持。
除了上述所有功能外,你还可以轻松地复制保存代码片段,只需点击一下。
对于自定义,你可以调整字体大小和系列、切换自动换行、高亮显示行、使用单引号或添加尾随命令,这要归功于 [Prettier][5]。
此外,一份片段可以有多个片段。 因此,它使你有机会将其用于各种用例。
如前所述,你也可以通过改变同步文件夹的存储位置将其与你的任何云同步服务整合。
![masscode migrate preferences][6]
总的来说,它工作得很好,有一些局限性,比如将嵌套文件夹从 SnippetsLab 迁移到 masCode 的能力。
### 在 Linux 上安装 massCode
massCode 有 [Snap 包][7],但不在 Snap 商店中。你可以直接下载该软件包,并使用以下命令来安装它:
```
sudo snap install --dangerous ~/Downloads/masscode_2.6.1_amd64.snap
```
我们的一份故障排除指南可以帮助你了解更多关于 [dangerous snap 选项][8]。
你可以通过其[官方网站][9]或 [GitHub 发布区][10]下载 Windows/MacOS 版。
[massCode][11]
你试过 massCode 了吗?还有其他可用于 Linux 的代码片段管理器吗?请在下面的评论中告诉我你的想法。
--------------------------------------------------------------------------------
via: https://itsfoss.com/masscode/
作者:[Ankush Das][a]
选题:[lkxed][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/lkxed
[1]: https://itsfoss.com/wp-content/uploads/2022/07/masscode-screenshot-1.png
[2]: https://itsfoss.com/wp-content/uploads/2022/07/masscode-screenshot.png
[3]: https://github.com/ajaxorg/ace
[4]: https://apps.apple.com/us/app/snippetslab/id1006087419?mt=12
[5]: https://prettier.io/
[6]: https://itsfoss.com/wp-content/uploads/2022/07/masscode-migrate-preferences.jpg
[7]: https://itsfoss.com/install-snap-linux/
[8]: https://itsfoss.com/snap-metadata-signature-error/
[9]: https://masscode.io/
[10]: https://github.com/massCodeIO/massCode/releases/tag/v2.6.1
[11]: https://masscode.io/

View File

@ -0,0 +1,155 @@
[#]: subject: "Check disk usage in Linux"
[#]: via: "https://opensource.com/article/22/7/check-disk-usage-linux"
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
[#]: collector: "lkxed"
[#]: translator: "MjSeven"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
检查 Linux 磁盘使用情况
======
du 和 ncdu 两个命令提供了相同信息的两种不同视图,便于我们跟踪存储在计算机上的内容。
![Data stack in blue][1]
无论你有多少存储空间,了解文件占用了多少磁盘空间都是一个重要的考虑事项。我的笔记本有一个相对较小的 250GB NVME 驱动器,大多数时候都没什么问题,但几年前我开始探索 Linux 上的游戏,情况变得有所不同,安装 Steam 和其他游戏使存储管理更加重要。
### du 命令
检查磁盘驱动器上剩余存储空间最简单的方法是 [du 命令][2]。它会估计文件空间使用情况,像其他所有 Linux 工具一样,`du` 非常强大,但知道如何根据你的特定需求使用它会很有帮助。我总是查阅 man 页面来获取实用程序。du 有几个选项,可以为你提供文件存储的最佳快照,以及它们在系统上消耗多少空间。
`du` 命令有很多选项,以下是一些常见的:
* -a - 包括文件夹和文件在内的存储信息
* --apparent-size - 打印自身大小而不是占用磁盘量
* -h - 人类可读的格式
* -b - 字节
* -c -总计
* -k - 块大小
* -m - 以兆字节为单位的大小
务必查看 `du` 手册页获取完整帮助列表。
#### 显示所有文件
你可以选择的第一个选项是 `du -a`,它可以显示系统上所有文件及其存储目录的大小。这个命令让我知道了我的主目录中存储了 11555168 个字节。使用 `du -a` 可以快速递归地查看我的存储系统。如果我想要一个更有意义的数字,并且我想深入到目录中查看大文件的位置,该怎么办?
我认为在 `Downloads` 目录下有一些大文件,所以我输入 `du -a /home/don/Downloads` 来查看。
```
$ du -a ~/Downloads
4923    ./UNIX_Driver_5-0/UNIX Driver 50
4923    ./UNIX_Driver_5-0
20     ./epel-release-latest-9.noarch.rpm
12    ./rpmfusion-free-release-9.noarch.rpm
2256    ./PZO9297 000 Cover.pdf
8    ./pc.md
2644    ./geckodriver-v0.31.0-linux64.tar.gz
466468
```
最左边的数字是以字节为单位的文件大小。我想要一些对我更有帮助的东西,所以我将人类可读格式的选项添加到命令中,结果是 4.8G(千兆字节),这对我来说是一种更有用的数字格式。(to 校正:这个 4.8G 不知道从何而来)
```
$ du -ah ~/Downloads
4.9M    ./UNIX_Driver_5-0/UNIX Driver 50
4.9M    ./UNIX_Driver_5-0
20K    ./epel-release-latest-9.noarch.rpm
12K    ./rpmfusion-free-release-9.noarch.rpm
2.2M    ./PZO9297 000 Cover.pdf
8.0K    ./pc.md
2.6M    ./geckodriver-v0.31.0-linux64.tar.gz
456M    .
```
与大多数 Linux 命令一样,你可以组合选项,要以人类可读的格式查看 `Downloads` 目录,使用 `du -ah ~/Downloads` 命令。
**[[ 另请阅读:检查可用磁盘空间的 5 个 Linux 命令 ]][3]**
#### 总和
`-c` 选项在最后一行提供了磁盘使用总和。我可以使用 `du -ch /home/don` 来显示主目录中的每个文件和目录。这里有很多信息,我只想知道最后一行的信息,所以我将磁盘使用命令通过管道传输给 `tail`。命令是 `du -ch /home/don | tail`to 校正:这条命令似乎没卵用,在 Ubuntu 试验过)
![将 du 命令输出通过管道传输到 tail][4]
Image by:
(Don Watkins, CC BY-SA 4.0)
### ncdu 命令
对存储在驱动器上内容感兴趣的 Linux 用户,另一个选择是 [ncdu 命令][5],它代表 *NCurses 磁盘使用情况*。基于你的 Linux 发行版,你可能需要下载并安装它。
在 Linux Mint、Elementary、Pop_OS! 或其它基于 Debian 的发行版上:
```
$ sudo apt install ncdu
```
在 Fedora、Mageia 或 CentOS 上:
```
$ sudo dnf install ncdu
```
在 Arch、Manjar 或者类似发行版上:
```
$ sudo pacman -S ncdu
```
安装后,你可以使用 ncdu 来分析你的文件系统。以下是在我的主目录中发出 `ncdu` 后的示例输出。`ncdu` 的 man 页面指出“ncduNCurses Disk Usage是众所周知的 `du` 基于 curses 的版本,它提供了一种快速查看哪些目录正在使用磁盘空间的方法。”
![du 命令输出][6]
Image by:
(Don Watkins, CC BY-SA 4.0)
我可以使用方向键上下导航,按下 **Enter** 键进入目录。有趣的是,`du` 报告我的主目录中的总磁盘使用量为 12GB`ncdu` 显示为 11GB。你可以在 `ncdu` 手册页中找到更多信息。
你可以将 `ncdu` 指向某个目录来探索特定目录。例如,`ncdu /home/don/Downloads`。
![ncdu 命令输出][7]
Image by:
(Don Watkins, CC BY-SA 4.0)
**?** 键显示帮助菜单。
![ncdu 帮助][8]
Image by:
(Don Watkins, CC BY-SA 4.0)
### 总结
`du``ncdu` 两个命令提供了相同信息的两种不同视图,便于我们跟踪存储在计算机上的内容。
如果你不习惯使用终端,或者只是在寻找此类信息的另一种试图,查看 [GNOME 磁盘使用分析器][9]。如果你的系统上还没有它,你可以轻松安装和使用它。检查你的发行版是否有 `baobab`,如果你想进行尝试,去安装它。
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/7/check-disk-usage-linux
作者:[Don Watkins][a]
选题:[lkxed][b]
译者:[MjSeven](https://github.com/MjSeven)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/don-watkins
[b]: https://github.com/lkxed
[1]: https://opensource.com/sites/default/files/lead-images/data_stack_blue_disks.png
[2]: https://opensource.com/article/21/7/check-disk-space-linux-du
[3]: https://opensource.com/article/18/7/how-check-free-disk-space-linux
[4]: https://opensource.com/sites/default/files/2022-06/1-du-tail.png
[5]: https://opensource.com/article/21/8/ncdu-check-free-disk-space-linux
[6]: https://opensource.com/sites/default/files/2022-06/2home.png
[7]: https://opensource.com/sites/default/files/2022-06/3downloads.png
[8]: https://opensource.com/sites/default/files/2022-06/4ncdu.png
[9]: https://help.gnome.org/users/baobab/stable/