Merge pull request #16 from LCTT/master

update from LCTT
This commit is contained in:
perfiffer 2021-09-08 09:00:56 +08:00 committed by GitHub
commit 79f97c375a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 1296 additions and 655 deletions

View File

@ -0,0 +1,79 @@
[#]: subject: "Apps for daily needs part 3: image editors"
[#]: via: "https://fedoramagazine.org/apps-for-daily-needs-part-3-image-editors/"
[#]: author: "Arman Arisman https://fedoramagazine.org/author/armanwu/"
[#]: collector: "lujun9972"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13761-1.html"
满足日常需求的应用(三):图像编辑器
======
![][1]
图像编辑器是许多人喜欢和需要的应用程序,从专业的设计师、学生,或那些有某些爱好的人。特别是在这个数字时代,越来越多的人因为各种原因需要图像编辑器。本文将介绍一些你可以在 Fedora Linux 上使用的开源图像编辑器。你可能需要安装提到的软件。如果你不熟悉如何在 Fedora Linux 中添加软件包,请参阅我之前的文章 [安装 Fedora 34 工作站后要做的事情][4]。这里列出了图像编辑器类的一些日常需求的应用程序。
### GIMP
GIMP<ruby>GNU 图像处理程序<rt>GNU Image Manipulation Program</rt></ruby>)是一个光栅图像(位图)编辑器,用于照片修饰、图像合成和图像创作。它的功能几乎与 Adobe Photoshop 相同。你可以用 GIMP 做很多你可以用 Photoshop 做的事情。正因为如此GIMP 作为 Adobe Photoshop 的开源替代品,已经成为最受欢迎的应用程序。
GIMP 有很多图像处理的功能,特别是针对光栅图像。你可以用 GIMP 修复或改变照片的颜色。你可以选择图像的一部分裁剪它然后与图像的其他部分合并。GIMP 还有许多你可以应用于你的图像的效果,包括模糊、阴影、噪音等等。许多人用 GIMP 来修复损坏的照片,提高图像质量,裁剪图像中不需要的部分,制作海报和各种图形设计作品,等等。此外,你还可以在 GIMP 中添加插件和脚本,使其功能更加全面。
![][5]
更多信息请见此链接: <https://www.gimp.org/>
### Inkscape
Inkscape 是一个流行的开源应用程序,用于创建和编辑矢量图。它是一个功能丰富的矢量图形编辑器,这使它可以与其他类似的专有应用程序(如 Adobe Illustrator 和 Corel Draw相竞争。正因为如此许多专业插画师使用它来创建基于矢量的艺术作品。
你可以用 Inkscape 制作艺术和技术插图如标志、图表、图标、桌面壁纸、流程图、漫画等等。此外Inkscape 可以处理各种图形文件格式。此外,你还可以添加附加组件,使你的工作更容易。
![][6]
更多信息请见此链接: <https://inkscape.org/>
### Krita
Krita 乍一看像 GIMP 或 Inkscape。但实际上它是一个完全不同的应用程序尽管它有一些类似的功能。Krita 是一款用于创作像艺术家那样的数字绘画的应用程序。你可以用 Krita 来制作概念艺术、插图、漫画、纹理和哑光画。
Krita 有 100 多个预装的专业画笔。它还有一个画笔稳定器功能,有 3 种不同的方式来平滑和稳定你的画笔笔触。此外,你可以用 9 种以上的独特画笔引擎来定制你的画笔。Krita 是那些喜欢进行数字绘画的人的合适应用。
![][7]
更多信息可在此链接获得:<https://krita.org/en/>
### darktable
darktable 是摄影师或那些想提高照片质量的人的完美选择。darktable 更侧重于图像编辑,特别是对 RAW 图像的非破坏性后期制作。因此,它提供专业的色彩管理,支持自动检测显示配置文件。此外,你还可以用 darktable 过滤和排序多张图片。所以你可以通过标签、评级、颜色标签等来搜索你的收藏。它可以导入各种图像格式,如 JPEG、CR2、NEF、HDR、PFM、RAF 等。
![][8]
更多信息可在此链接中获得:<https://www.darktable.org/>
### 总结
这篇文章介绍了四个图像编辑器,你可以在 Fedora Linux 上使用它们满足你日常需求。每个应用程序都代表了图像编辑器应用程序的一个子类别。实际上,还有许多其他的图像编辑器可以在 Fedora Linux 上使用。你也可以使用 RawTherapee 或 Photivo 作为 dartkable 替代品。此外,还有 Pinta 作为 GIMP 的替代品,以及 MyPaint 作为 Krita 的替代品。希望这篇文章能帮助你选择正确的图像编辑器。如果你有使用这些应用程序的经验,请在评论中分享你的经验。
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/apps-for-daily-needs-part-3-image-editors/
作者:[Arman Arisman][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/armanwu/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2021/07/FedoraMagz-Apps-3-Graphics-816x345.jpg
[2]: https://unsplash.com/@brookecagle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[3]: https://unsplash.com/s/photos/meeting-on-cafe-computer?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: https://fedoramagazine.org/things-to-do-after-installing-fedora-34-workstation/
[5]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-gimp-1024x576.png
[6]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-inkscape-1024x575.png
[7]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-krita-1024x592.png
[8]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-darktable-1024x583.png

View File

@ -0,0 +1,161 @@
[#]: subject: "Write a guessing game in ncurses on Linux"
[#]: via: "https://opensource.com/article/21/8/guess-number-game-ncurses-linux"
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
[#]: collector: "lujun9972"
[#]: translator: "perfiffer"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13762-1.html"
通过 ncurses 在 Linux 上写一个猜谜游戏
======
> 使用 ncurses 的灵活性和强大功能在 Linux 上创建一个猜数字游戏。
![](https://img.linux.net.cn/data/attachment/album/202109/07/224224ecchm0t5jbjc1dzy.jpg)
在我的 [上一篇文章][2],我简要介绍了使用 ncurses 库通过 C 语言编写文本模式交互式应用程序。使用 ncurses我们可以控制文本在终端上的显示位置和方式。如果你通过阅读手册页探索 ncurses 库函数,你会发现显示文本有很多不同的方式,包括粗体文本、颜色、闪烁文本、窗口、边框、图形字符和其它功能,这些都可以使你的应用脱颖而出。
如果你想探索一个更高级的程序来演示其中一些有趣的功能,有一个简单的“猜数字”游戏,我已更新为使用 ncurses 编写的了。该程序在一个范围内选择一个随机数,然后要求用户进行重复猜测,直到他们猜到这个秘密数字。当用户进行猜测时,程序会告知他们猜测的数字是太低还是太高。
请注意,程序限定可能的数字范围是 0 到 7。将值保持在有限的个位数数字范围内可以更轻松的使用 `getch()` 函数从用户读取单个数字。我还使用了 `getrandom` 内核系统调用来生成随机数,设定数字最大值为 7以从 0 (二进制 `0000`)到 7 (二进制 `0111`)中选择一个随机数。
```
#include <curses.h>;
#include <string.h>;          /* for strlen */
#include <sys/random.h>;      /* for getrandom */
int
random0_7()
{
   int num;
   getrandom(&num, sizeof(int), GRND_NONBLOCK);
   return (num & 7); /* from 0000 to 0111 */
}
int
read_guess()
{
  int ch;
  do {
    ch = getch();
  } while ((ch < '0') || (ch > '7'));
  return (ch - '0'); /* turn into a number */
}
```
通过使用 ncurses我们可以增加一些有趣的视觉体验。通过添加函数我们可以在屏幕顶部显示重要的文本信息在屏幕底部显示状态消息行
```
void
print_header(const char *text)
{
  move(0, 0);
  clrtoeol();
  attron(A_BOLD);
  mvaddstr(0, (COLS / 2) - (strlen(text) / 2), text);
  attroff(A_BOLD);
  refresh();
}
void
print_status(const char *text)
{
  move(LINES - 1, 0);
  clrtoeol();
 
  attron(A_REVERSE);
  mvaddstr(LINES - 1, 0, text);
  attroff(A_REVERSE);
  refresh();
}
```
通过这些函数,我们就可以构建猜数字游戏的主要部分。首先,程序为 ncurses 设置终端,然后从 0 到 7 中选择一个随机数。显示数字刻度后,程序启动一个循环,询问用户的猜测。
当用户进行猜测时,程序会在屏幕上提供反馈。如果猜测太低,程序会在屏幕上的数字下方打印一个左方括号。如果猜测太高,程序会在屏幕上的数字下方打印一个右方括号。这有助于用户缩小他们的选择范围,直到他们猜出正确的数字。
```
int
main()
{
  int number, guess;
  initscr();
  cbreak();
  noecho();
  number = random0_7();
  mvprintw(1, COLS - 1, "%d", number); /* debugging */
  print_header("Guess the number 0-7");
  mvaddstr(9, (COLS / 2) - 7, "0 1 2 3 4 5 6 7");
  print_status("Make a guess...");
  do {
    guess = read_guess();
    move(10, (COLS / 2) - 7 + (guess * 2));
    if (guess < number) {
      addch('[');
      print_status("Too low");
    }
    else if (guess > number) {
      addch(']');
      print_status("Too high");
    }
    else {
      addch('^');
    }
  } while (guess != number);
  print_header("That's right!");
  print_status("Press any key to quit");
  getch();
  endwin();
  return 0;
}
```
复制这个程序,自己尝试编译它。不要忘记你需要告诉 GCC 编译器链接到 ncurses 库:
```
$ gcc -o guess guess.c -lncurses
```
我留下了一个调试行,所以你可以看到屏幕右上角附近的秘密数字:
![guess number game interface][3]
*图1猜数字游戏。注意右上角的秘密数字。*
### 开始使用 ncurses
该程序使用了 ncurses 的许多其它函数,你可以从这些函数开始。例如,`print_header` 函数在屏幕顶部居中以粗体文本打印消息,`print_status` 函数在屏幕左下角以反向文本打印消息。使用它来帮助你开始使用 ncurses 编程。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/8/guess-number-game-ncurses-linux
作者:[Jim Hall][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/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/question-mark_chalkboard.jpg?itok=DaG4tje9 (question mark in chalk)
[2]: https://linux.cn/article-13756-1.html
[3]: https://opensource.com/sites/default/files/guessnumber07.png

View File

@ -3,24 +3,26 @@
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
[#]: collector: "lujun9972"
[#]: translator: "unigeorge"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13759-1.html"
用户必会的 20 个 Linux 命令
用户必会的 20 个 Linux 基础命令
======
无论新手老手,这 20 个 Linux 命令都能让你的操作更轻松。
![Command line prompt][1]
在黝黑的终端窗口中输入命令,这样的方式对某些人群来说可能好像过时了,但对许多专业计算机用户来说,这几乎是计算机完成能够执行的所有任务的最有效、最简便和最清晰的方式。如今,一些项目将开源命令引入了 macOS 和 Windows 等非开放平台,因此终端命令不仅仅是针对 Linux 和 BSD 用户,更是与每个人都息息相关。你可能会惊讶地发现,在一台普通的 [POSIX][2] 计算机上安装了数千个命令,当然,其中很多命令并不是真的有用,至少不是直接或定期性被使用。而其中的一部分命令虽然不是有效终端必须使用的命令,但相比其他命令而言使用频率较高,值得大家学习一下。
> 无论新手老手,这 20 个 Linux 命令都能让你的操作更轻松。
![](https://img.linux.net.cn/data/attachment/album/202109/07/082525n7amf7gejo16zaxx.jpg)
在黝黑的终端窗口中输入命令,这样的方式对某些人群来说可能好像过时了,但对许多专业计算机人员来说,这几乎是计算机完成能够执行的所有任务的最有效、最简便和最清晰的方式。如今,一些项目将开源命令引入了 macOS 和 Windows 等非开放平台,因此终端命令不仅仅是针对 Linux 和 BSD 用户,更是与每个人都息息相关。你可能会惊讶地发现,在一台普通的 [POSIX][2] 计算机上安装了数千个命令,当然,其中很多命令并不是真的有用,至少不是直接或经常性被使用。而其中的一部分命令虽然不是有效终端必须使用的命令,但相比其他命令而言使用频率较高,值得大家学习一下。
以下是终端用户最可能会使用的前 20 个命令:
### cd
在终端外,你可以单击图标从一个文件夹移动到另一个文件夹,但在终端中,你需要使用 `cd`。`cd` 命令代表 _change directory_(变更目录),是用户在 Linux 系统中移动的方式。这是 Linux 中从一个地方到另一个地方最快、最直接的路线。
在终端外,你可以单击图标从一个文件夹移动到另一个文件夹,但在终端中,你需要使用 `cd`。`cd` 命令代表<ruby>变更目录<rt>change directory</rt></ruby>,是用户在 Linux 系统中移动的方式。这是 Linux 中从一个地方到另一个地方最快、最直接的路线。
例如,在桌面上,当你想从你的主目录(你保存所有文件夹的地方)移动到一个名为 `presentations` 的文件夹时,你首先要打开你的 `Documents` 文件夹,然后打开一个名叫 `work` 的文件夹,然后是 `projects` 文件夹,然后是`conference` 文件夹,最后是 `presentations` 文件夹,里面存放的是 LibreOffice Impress 幻灯片。这个过程包含了很多次的双击操作。同时屏幕上还需要许多移动动作,这取决于新窗口出现的位置,以及大脑需要跟踪的许多路径点。许多人通过将 _所有文件_ 都放在桌面上来避免这个看似微不足道的任务。
例如,在桌面上,当你想从你的主目录(你保存所有文件夹的地方)移动到一个名为 `presentations` 的文件夹时,你首先要打开你的 `Documents` 文件夹,然后打开一个名叫 `work` 的文件夹,然后是 `projects` 文件夹,然后是 `conference` 文件夹,最后是 `presentations` 文件夹,里面存放的是 LibreOffice Impress 幻灯片。这个过程包含了很多次的双击操作。同时屏幕上还需要许多鼠标移动动作,这取决于新窗口出现的位置,以及大脑需要跟踪的许多路径点。许多人通过将 _所有文件_ 都放在桌面上来避免这个看似微不足道的任务。
而终端用户只需键入以下内容即可避免此问题:
@ -28,7 +30,7 @@
$ cd ~/Documents/work/projects/conference/presentations
```
一些有经验的终端用户甚至都懒得输入所有这些,而是使用 **Tab** 键自动完成单词填充。更甚者,有时你都不必依赖自动完成,而是改用通配符:
一些有经验的终端用户甚至都懒得输入所有这些,而是使用 `Tab` 键自动完成单词填充。更甚者,有时你都不必依赖自动完成,而是改用通配符:
```
$ cd ~/Doc*/work/*/conf*/p*
@ -38,7 +40,7 @@ $ cd ~/Doc*/work/*/conf*/p*
用 Buckaroo Banzai 的话来说:“无论你走到哪里,你就在那里。”
当你想弄清楚确切位置时,就可以使用 `pwd` 命令。`pwd` 代表 _print working directory_(打印工作目录),这正是它的作用。`--physical`(在某些情况时缩写为 `-P`)显示解析所有符号链接后的确切位置。
当你想弄清楚确切位置时,就可以使用 `pwd` 命令。`pwd` 代表<ruby>打印工作目录<rt>print working directory</rt></ruby>,这正是它的作用。`--physical`(在某些情况时缩写为 `-P`)显示解析所有符号链接后的确切位置。
```
$ pwd
@ -50,11 +52,11 @@ $ pwd --physical
### sed
流编辑器 `sed` 更广为人知的是一个强大的批量 _查找和替换_ 命令,但它同时也是一个合法的文本编辑器。你可以通过阅读我的 [介绍性文章][3] 来学习使用它,然后通过我的 [高级教程和备忘录][4] 成为老手。
流编辑器 `sed` 更广为人知的是一个强大的批量 _查找和替换_ 命令,但它同时也是一个正当合理的文本编辑器。你可以通过阅读我的 [介绍性文章][3] 来学习使用它,然后通过我的 [高级教程和备忘录][4] 成为老手。
### grep
`grep` 命令使用很普遍,以至于经常被用作动词(例如“我会通过一些文件 grep”和动名词例如“grep 一些输出”)。无论是查看日志文件还是解析其他命令的输出,它都是在 shell 中解析文本时的关键组件。这是忙碌的用户专注于特定信息的一种方式。考虑一下计算世界中的数据量grep 命令的流行就见怪不怪了。你可以通过阅读我的 [介绍性文章][5] 了解 grep然后下载 [备忘录][6] 学习。
`grep` 命令使用很普遍,以至于经常被用作动词(例如 “我会对一些文件进行 grep”和动名词例如 “grep 一些输出”)。无论是查看日志文件还是解析其他命令的输出,它都是在 shell 中解析文本时的关键组件。这是忙碌的用户专注于特定信息的一种方式。考虑一下计算世界中的数据量,`grep` 命令的流行就见怪不怪了。你可以通过阅读我的 [介绍性文章][5] 了解 `grep`,然后下载 [备忘录][6] 学习。
### file
@ -68,17 +70,17 @@ $ file example.bar
example.bar: ELF 64-bit LSB executable, x86-64 [...]
```
当然,`file` 命令并不神奇。它不过是根据文件如何识自身进行输出,并且文件可能是错误的、损坏的或伪装的。使用 [`hexdump`][7] 进行严格检查的方式确定性更强,但对于日常使用而言,`file` 命令非常方便。
当然,`file` 命令并不神奇。它不过是根据文件如何识自身进行输出,并且文件可能是错误的、损坏的或伪装的。使用 [hexdump][7] 进行严格检查的方式确定性更强,但对于日常使用而言,`file` 命令非常方便。
### awk
awk 不仅仅是一个命令,它还是一种字 [编程语言][8]。[点此下载我们的免费 Awk 电子书][9] 进行学习,你可能会写出远超你想象的脚本。
`awk` 不仅仅是一个命令,它还是一种字面意义上的 [编程语言][8]。[点此下载我们的免费 Awk 电子书][9] 进行学习,你可能会写出远超你想象的脚本。
### curl
`curl` 命令是用于终端的 [非交互式 Web 浏览器][10]。它是面向 Web 和 API 开发人员的 [开发工具][11]。因为灵活性,它是一个复杂的命令,但如果你想从你的终端顺利地与网络服务交互,该命令是很值得学习的。
`curl` 命令是用于终端的 [非交互式 Web 浏览器][10]。它是面向 Web 和 API 开发人员的 [开发工具][11]。它是一个复杂灵活的命令,但如果你想从你的终端顺利地与 Web 服务交互,该命令是很值得学习的。
下载我们免费的 [`curl` 备忘录][12],你可以从中学会 `curl` 的许多选项。
下载我们免费的 [curl 备忘录][12],你可以从中学会 `curl` 的许多选项。
### ps
@ -86,22 +88,22 @@ awk 不仅仅是一个命令,它还是一种文字 [编程语言][8]。[点此
### cat
[`cat` 命令][14] 是 _concatenate_(连接)的缩写,它曾因为能将由于大小限制而被(使用 `split` 命令)拆分成的若干小文件合并而非常有用。如今,`cat` 主要是用来将文本文件的内容转储到终端中以供快速阅读,除非你为此专门去使用 `head`、`tail`、`more` 或 `less` 等命令。
[cat 命令][14] 是<ruby>连接<rt>concatenate</rt></ruby>的缩写,它曾因为能将若干小文件合并而显得非常有用,这些小文件可能是由于大小限制而(使用 `split` 命令)拆分的。如今,`cat` 主要是用来将文本文件的内容转储到终端中以供快速阅读,除非你为此专门去使用 `head`、`tail`、`more` 或 `less` 等命令。
尽管它的原始用途几乎已被弃用,并且其他几个命令也主要是执行其次要功能,但 `cat` 仍然是一个有用的工具。例如,它可以是复制 (`cp`) 命令的替代品:
尽管它的原始用途几乎已被弃用,并且其他几个命令也主要提供了其次要功能,但 `cat` 仍然是一个有用的工具。例如,它可以是复制(`cp`命令的替代品:
```
$ cat myfile.ogg > /backups/myfile.ogg
```
它可以显示文件中不便观察的隐形字符。例如,使用 `--show-tabs` 选项,分割 [YAML][15] 的 **Tab** 字符就会显示为 `^I`
它可以显示文件中不便观察的隐形字符。例如,使用 `--show-tabs` 选项,分割 [YAML][15] 的 `Tab` 字符就会显示为 `^I`
```
$ cat --show-tabs my.yaml
\---
---
\- hosts: all
- hosts: all
  tasks:
  - name: Make sure the current version of 'sysstat' is installed.
    dnf:
@ -116,9 +118,9 @@ $ cat --show-tabs my.yaml
### find
`find` 命令可以用来查找文件,但它还有许多选项,这些选项可以帮助你查找具有各种过滤器和参数的文件。读者可以从我的 [介绍性文章][16] 中学习该命令的基础知识。
`find` 命令可以用来查找文件,但它还有许多选项,这些选项可以帮助你通过各种过滤器和参数查找文件。读者可以从我的 [介绍性文章][16] 中学习该命令的基础知识。
如果你一直想知道为什么最基本的,不起眼的 [`ls` 命令][17],不在本文列表中,那是因为 `find` 的灵活性。它不仅可以找到列表文件:
如果你一直想知道为什么最基本的、不起眼的 [ls 命令][17],不在本文列表中,那是因为 `find` 的灵活性。它不仅可以列表文件:
```
$ find .
@ -142,43 +144,43 @@ $ find . -ls
### tar
人们有时会引用 BSD 的 `tar` 语法来拿 Linux 命令开玩笑。尽管广为人赞,但 `tar` 命令实际上非常直观。读者可以阅读我的 [如何解压缩 tar.gz 文件][18] 文章,了解按需使用 `tar` 命令的简单知识。
人们有时会引用 BSD 的 `tar` 语法来拿 Linux 命令开玩笑。尽管有这样的名声,但 `tar` 命令实际上非常直观。读者可以阅读我的 [如何解压缩 tar.gz 文件][18] 文章,了解在需要时使用 `tar` 命令的简单知识。
### more or less or most
### more、less 和 most
这些统称为 pager 命令。pager 命令与 `cat` 类似,但前者会在屏幕底部暂停输出,直到你向下滚动查看更多内容。这些命令比较简单,但每个之间都有细微差别。用户是用箭头键还是空格键滚动?是必须手动退出,还是在显示的文件末尾自动退出?用户的首选搜索行为是什么样的?选择你最喜欢的 pager 命令并将其设置在 `.bashrc` 中吧!
这些统称为分页命令。分页命令与 `cat` 类似,但前者会在屏幕底部暂停输出,直到你向下滚动查看更多内容。这些命令比较简单,但每个之间都有细微差别。用户是用箭头键还是空格键滚动?是必须手动退出,还是在显示的文件末尾自动退出?用户的首选搜索行为是什么样的?选择你最喜欢的分页命令并将其设置在 `.bashrc` 中吧!
### ssh and scp
### ssh scp
OpenSSH 不仅有助于保护与远程系统的连接安全,还可以用于启用其他命令。例如,对于许多用户来说,有了 `.ssh` 目录,他们才能与 Git 存储库顺利交互、将更新发布到网站、登录云控制平
OpenSSH 不仅有助于保护与远程系统的连接安全,还可以用于启用其他命令。例如,对于许多用户来说,有了 `.ssh` 目录,他们才能与 Git 存储库顺利交互、将更新发布到网站、登录云控制平
### mv
`mv` 命令有双重作用:它既 [移动文件][19] 又 [重命名文件][20]。它有几个可用的保护措施,例如 `--interactive``--no-clobber` 选项避免破坏现有文件,`--backup` 命令确保数据在新位置验证之前被保留,以及 `--update` 选项确保旧版本不会替换新版本文件。
`mv` 命令有双重作用:它既可以 [移动文件][19] 又可以 [重命名文件][20]。它有几个可用的保护措施,例如 `--interactive``--no-clobber` 选项避免破坏现有文件,`--backup` 命令确保数据在新位置验证之前被保留,以及 `--update` 选项确保旧版本不会替换新版本文件。
### sudo
当某个用户账户的用户名已知,且具有 _全部_ 系统权限时,该用户很快就会成为黑客攻击的目标。`sudo` 命令消除了对字面上 `root` 用户的需求,从而优雅地移除了有关系统的重要信息。不过这还不是全部,使用 `sudo` 你还可以轻松地将权限管理到单个命令、用户和组。你可以启用选择命令的无密码执行、记录用户会话、使用摘要验证验证命令,[以及更多操作][21]。
当某个用户账户的用户名已知,且具有 _全部_ 系统权限时,该用户很快就会成为黑客攻击的目标。`sudo` 命令消除了对字面上 `root` 用户的需求,从而优雅地移除了有关系统的重要信息。不过这还不是全部,使用 `sudo` 你还可以轻松地管理单个命令、用户和组的权限。你可以在选定的命令上启用无密码执行、记录用户会话、使用摘要验证来验证命令,[等等][21]。
### alias
使用 `alias` 命令将长命令变成易于记忆的快捷方式:
```
`$ alias ls='ls --classify --almost-all --ignore-backups --color'`
$ alias ls='ls --classify --almost-all --ignore-backups --color'
```
### clear
有时终端会显得很混乱,输入 `clear`(或在某些 shell 中按 **Ctrl+L**)后,你就能得到漂亮、全新的屏幕了。
有时终端会显得很混乱,输入 `clear`(或在某些 shell 中按 `Ctrl+L`)后,你就能得到漂亮、刷新的屏幕了。
### setfacl
传统上POSIX 文件权限由 `chown``chmod` 决定。然而,如今系统变得更加复杂,因此有一个灵活性更高的命令。`setfacl` 命令允许创建一个 [访问控制列表 (ACL)][22],可以配置任意用户所需权限,并可以为文件夹及其中创建的内容设置默认权限。
传统上POSIX 文件权限由 `chown``chmod` 决定。然而,如今系统变得更加复杂,因此有一个灵活性更高的命令。`setfacl` 命令允许创建一个 [访问控制列表ACL][22],可以配置任意用户所需权限,并可以为文件夹及其中创建的内容设置默认权限。
### netcat
可能需要使用 netcat (`nc`) 的人不多,但这些使用人对它的依赖度会很高。`nc` 命令是一个通用的网络连接工具。
可能需要使用 `netcat``nc`)的人不多,但这些使用它的人确离不开它。`nc` 命令是一个通用的网络连接工具。
它可以连接到一个端口,类似于 `telnet` 命令:
@ -202,7 +204,7 @@ $ nc -zv 192.168.0.12 25-80
### 你自己构建的命令
在某种程度上Linux 终端是关于创造性解决问题的平台。当你学习命令时,你也在学习可用于创建自己的命令的构造块。我的 [shell history][23] 中的许多命令都是自己编写的 shell 脚本,从而实现了根据自己想要的工作方式定制工作流程。你为自己的效率和舒适度而设计的命令也可以作为 shell 中的基本命令。花些时间了解一些很棒的命令,然后试着构建自己的命令吧。当你构建出的命令非常好用时,把它开源,这样就可以与他人分享你的想法啦!
在某种程度上Linux 终端是一个创造性解决问题的平台。当你学习命令时,你也在学习可用于创建自己的命令的组块。我的 [shell 历史][23] 中的许多命令都是自己编写的 shell 脚本,从而实现了根据自己想要的工作方式定制工作流程。你为自己的效率和舒适度而设计的命令也可以作为 shell 中的基本命令。花些时间了解一些很棒的命令,然后试着构建自己的命令吧。当你构建出的命令非常好用时,把它开源,这样就可以与他人分享你的想法啦!
--------------------------------------------------------------------------------
@ -211,7 +213,7 @@ via: https://opensource.com/article/21/9/essential-linux-commands
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[unigeorge](https://github.com/unigeorge)
校对:[校对者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,96 @@
[#]: subject: "Lakka Linux 3.4 Brings Fidelity FX Support With the New RetroArch 1.9.9"
[#]: via: "https://news.itsfoss.com/lakka-retroarch-release/"
[#]: author: "Jacob Crume https://news.itsfoss.com/author/jacob/"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Lakka Linux 3.4 Brings Fidelity FX Support With the New RetroArch 1.9.9
======
For years now, [RetroArch][1] has been the gold standard in emulation, thanks to its ease of use and simplicity. Similarly, [Lakka][2] has gotten a name by using RetroArch to create an incredibly smooth and straightforward experience for its users.
Hence, we have recommended it in the past to [turn your old PC into a retrogaming console][3].
It is always a great day when these two large projects announce new releases, and it looks like we have some exciting news with Lakka 3.4 and RetroArch 1.9.9 release.
Here, we will be looking at some of the new features announced in RetroArch 1.9.9 and Lakka 3.4 and the significant impact on the future of emulation.
### Whats New?
With this release, RetroArch has introduced some useful and impactful new features. These include:
* AMD FidelityFX support for all games
* Windows users can now use HDR on many games
* New touchscreen menu for the Nintendo DS
Lakka (which includes RetroArch) has also received some welcome improvements.
* Improved stability
* 3 new cores for the PS1, PS2, and DOS
* Updated Mesa to version 21.2.1
Here we focus on the key highlights and, primarily, Integrated FidelityFX.
#### FidelityFX For Retro Games
![][4]
When AMD announced its open-source alternative to DLSS back in June, we could never have predicted the incredible impact it would have on emulation.
For those not aware, [FidelityFX][5] allows games to run at a lower resolution while retaining the same image quality, dramatically improving the performance.
Now, with the RetroArch 1.9.9 release, this technology is being brought to RetroArch and Lakka. This is great because it allows older games designed to run at a low resolution to look much better without resorting to mods or texture packs.
Overall, I expect this addition to be widely appreciated, especially by people looking for a more modern version of their favorite retro games.
If you want to learn more about FidelityFX and upscaling, Id highly suggest you check out [our article on Intels XeSS where we explain all this][6] and how it impacts you.
#### New Touchscreen Menu For Nintendo 3DS
One of the more interesting ports of RetroArch, the Nintendo 3DS, has also gotten a cool new feature. This comes in the form of a touchscreen menu for the bottom screen, which shows a few useful shortcuts without covering the game.
While this doesnt apply to Lakka, users of RetroArch running on top of another distribution should receive this change once RetroArch 1.9.9 lands in the repositories.
### Wrapping Up
Overall, [RetroArch 1.9.9][7] and [Lakka 3.4][8] are looking to be significant upgrades, especially with the new integration with FidelityFX.
As we have already seen, with emulators such as [RPCS3][9], FidelityFX can provide significant graphical improvements on older games, so it is exciting to see this come to RetroArch.
_What do you think about FidelityFX being used for retro games? 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/lakka-retroarch-release/
作者:[Jacob Crume][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/jacob/
[b]: https://github.com/lujun9972
[1]: https://www.retroarch.com/
[2]: http://lakka.tv
[3]: https://itsfoss.com/lakka-retrogaming-linux/
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjIzMCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
[5]: https://www.amd.com/en/technologies/radeon-software-fidelityfx-super-resolution
[6]: https://news.itsfoss.com/intel-xess-open-source/
[7]: https://www.libretro.com/index.php/retroarch-1-9-9-released/
[8]: http://lakka.tv/articles/2021/09/06/lakka-3.4/
[9]: http://rpcs3.net

View File

@ -0,0 +1,98 @@
[#]: subject: "OpenWrt 21.02 Arrives With Linux Kernel 5.4 & WPA3 Support"
[#]: via: "https://news.itsfoss.com/openwrt-21-02-release/"
[#]: author: "Rishabh Moharir https://news.itsfoss.com/author/rishabh/"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
OpenWrt 21.02 Arrives With Linux Kernel 5.4 & WPA3 Support
======
The OpenWrt community announced the first stable update of their series, OpenWrt 21.02.
In case you did not know, OpenWrt is a project that helps create custom operating systems for embedded devices.
It enables users to openly customize their devices according to their networking needs, something that the stock router firmware doesnt. Other than routers, OpenWrt can run on a variety of devices such as smartphones, residential gateways, and even 32 bit PCs!
With this release, they have over 5800 commits since the older OpenWrt 19.07.
Let us take a look at what is new with OpenWrt 21.02.
### OpenWrt 21.02: Whats New?
While there are several technical changes and improvements, let me highlight the key additions.
#### WPA3 Support
Although present in the 19.07 release, the latest security standard for Wi-Fi networks is now included by default in the images.
WPA3 stands for Wi-Fi Protected Access 3 and is a major improvement in terms of security over the popular WPA2. Backward compatibility is also supported.
#### TLS and HTTPS Support
Just like WPA3, TLS and HTTPS support is also included by default. This comes with the trusted CA certificates from Mozilla as well.
With this addition, _wget_ and _opkg_ should now support fetching resources over HTTPS out-of-the-box. Moreover, [LuCl][1] is available over HTTPS in addition to HTTP.
#### Initial DSA Support
As the release announcement states:
“DSA stands for Distributed Switch Architecture and is the Linux standard to deal with configurable Ethernet switches”
This has replaced the _swconfig_ system which was being used until now. This is a notable change to how VLANs and switch ports are managed.
#### New Minimum Hardware Requirements
With numerous new features and updates to OpenWrt, including the increase in the general size of the Linux kernel, the minimum requirements have been increased.
Devices now require at least 8 MB of flash and 64 MB memory to run the default build ensuring proper stability.
#### Package Updates
The release also comes packed in with several package upgrades, some of them are:
* Linux kernel 5.4.143
* gcc 8.4.0
* glibc 2.33
* binutils 2.34
* busybox 1.33.1
Along with the above-listed packages, there are many others that have also received upgrades. You can get the full technical details in the [official release announcement][2].
### Download OpenWrt 21.02
You can head to its official website to download the latest stable builds or opt for development snapshots for experiments.
Instructions to build your own packages, and firmware should be available in their documentation.
The _sysupgrade_ command can be used to upgrade your system from OpenWrt 19.07 to OpenWrt 21.02. Do note that you wont be able to upgrade from 18.06.
[OpenWrt 21.02][3]
#### 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/openwrt-21-02-release/
作者:[Rishabh Moharir][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/rishabh/
[b]: https://github.com/lujun9972
[1]: https://openwrt.org/docs/techref/luci
[2]: https://openwrt.org/releases/21.02/notes-21.02.0
[3]: https://openwrt.org/downloads

View File

@ -1,89 +0,0 @@
[#]: subject: "Apps for daily needs part 3: image editors"
[#]: via: "https://fedoramagazine.org/apps-for-daily-needs-part-3-image-editors/"
[#]: author: "Arman Arisman https://fedoramagazine.org/author/armanwu/"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Apps for daily needs part 3: image editors
======
![][1]
Photo by [Brooke Cagle][2] on [Unsplash][3]
Image editors are applications that are liked and needed by many people, from professional designers, students, or for those who have certain hobbies. Especially in this digital era, more and more people need image editors for various reasons. This article will introduce some of the open source image editors that you can use on Fedora Linux. You may need to install the software mentioned. If you are unfamiliar with how to add software packages in Fedora Linux, see my earlier article [Things to do after installing Fedora 34 Workstation][4]. Here is a list of a few apps for daily needs in the image editors category.
### GIMP
GIMP (GNU Image Manipulation Program) is a raster graphics editor used for photo retouching, image composition, and image authoring. It has almost the same functionality as Adobe Photoshop. You can use GIMP to do a lot of the things you can do with Photoshop. Because of that, GIMP has become the most popular application as an open source alternative to Adobe Photoshop.
GIMP has a lot of features for manipulating images, especially for raster images. You can fix or change the color of your photos using GIMP. You can select a part of the image, crop it, and then merge it with other pieces of the image. GIMP also has many effects that you can apply to your images, including blur, shadow, noise, etc. Many people use GIMP to repair damaged photos, improve image quality, crop unwanted parts of images, create posters and various graphic design works, and much more. Moreover you can also add plugins and scripts in GIMP, making it even more fully featured.
![][5]
More information is available at this link: <https://www.gimp.org/>
* * *
### Inkscape
Inkscape is a popular open source application used to create and edit vector graphics. It is a feature-rich vector graphics editor which makes it competitive with other similar proprietary applications, such as Adobe Illustrator and Corel Draw. Because of that, many professional illustrators use it to create vector-based artwork.
You can use Inkscape for making artistic and technical illustrations, such as logos, diagrams, icons, desktop wallpapers, flowcharts, cartoons, and much more. Moreover, Inkscape can handle various graphic file formats. In addition, you can also add add-ons to make your work easier.
![][6]
More information is available at this link: <https://inkscape.org/>
* * *
### Krita
Krita looks like GIMP or Inkscape at first glance. But actually it is an application that is quite different, although it has some similar functions. Krita is an application for creating digital paintings like those made by artists. You can use Krita for making concept art, illustration, comics, texture, and matte paintings.
Krita has over 100 professionally made brushes that come preloaded. It also has a brush stabilizer feature with 3 different ways to smooth and stabilize your brush strokes. Moreover, you can customize your brushes with over 9 unique brush engines. Krita is the right application for those of you who like digital painting activities.
![][7]
More information is available at this link: <https://krita.org/en/>
* * *
### darktable
darktable is perfect for photographers or for those who want to improve the quality of their photos. darktable focuses more on image editing specifically on non-destructive post-production of raw images. Therefore, it provides professional color management that supports automatic display profile detection. In addition, you can also use darktable to handle multiple images with filtering and sorting features. So you can search your collections by tags, rating, color labels, and many more. It can import various image formats, such as JPEG, CR2, NEF, HDR, PFM, RAF, etc.
![][8]
More information is available at this link: <https://www.darktable.org/>
* * *
### Conclusion
This article presented four image editors as apps for your daily needs that you can use on Fedora Linux. Each application represents a sub-category of image editor applications. Actually there are many other image editors that you can use in Fedora Linux. You can also use RawTherapee or Photivo as a dartkable alternative. In addition there is Pinta as an alternative to GIMP, and MyPaint as an alternative to Krita. Hopefully this article can help you to choose the right image editors. If you have experience in using these applications, please share your experience in the comments.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/apps-for-daily-needs-part-3-image-editors/
作者:[Arman Arisman][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/armanwu/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2021/07/FedoraMagz-Apps-3-Graphics-816x345.jpg
[2]: https://unsplash.com/@brookecagle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[3]: https://unsplash.com/s/photos/meeting-on-cafe-computer?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: https://fedoramagazine.org/things-to-do-after-installing-fedora-34-workstation/
[5]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-gimp-1024x576.png
[6]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-inkscape-1024x575.png
[7]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-krita-1024x592.png
[8]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-darktable-1024x583.png

View File

@ -1,164 +0,0 @@
[#]: subject: "Write a guessing game in ncurses on Linux"
[#]: via: "https://opensource.com/article/21/8/guess-number-game-ncurses-linux"
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
[#]: collector: "lujun9972"
[#]: translator: "perfiffer"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Write a guessing game in ncurses on Linux
======
Use the flexibility and power of ncurses to create a guess-the-number
game on Linux.
![question mark in chalk][1]
In my [last article][2], I gave a brief introduction to using the **ncurses** library to write text-mode interactive applications in C. With **ncurses**, we can control where and how text gets displayed on the terminal. If you explore the **ncurses** library functions by reading the manual pages, youll find there are a ton of different ways to display text, including bold text, colors, blinking text, windows, borders, graphic characters, and other features to make your application stand out.
If youd like to explore a more advanced program that demonstrates a few of these interesting features, heres a simple “guess the number” game, updated to use **ncurses**. The program picks a random number in a range, then asks the user to make repeated guesses until they find the secret number. As the user makes their guess, the program lets them know if the guess was too low or too high.
Note that this program limits the possible numbers from 0 to 7. Keeping the values to a limited range of single-digit numbers makes it easier to use **getch()** to read a single number from the user. I also used the **getrandom** kernel system call to generate random bits, masked with the number 7 to pick a random number from 0 (binary 0000) to 7 (binary 0111).
```
#include &lt;curses.h&gt;
#include &lt;string.h&gt;          /* for strlen */
#include &lt;sys/random.h&gt;      /* for getrandom */
int
random0_7()
{
   int num;
   getrandom(&amp;num, sizeof(int), GRND_NONBLOCK);
   return (num &amp; 7); /* from 0000 to 0111 */
}
int
read_guess()
{
  int ch;
  do {
    ch = getch();
  } while ((ch &lt; '0') || (ch &gt; '7'));
  return (ch - '0'); /* turn into a number */
}
```
By using **ncurses**, we can add some visual interest. Lets add functions to display important text at the top of the screen and a message line to display status information at the bottom of the screen.
```
void
print_header(const char *text)
{
  move(0, 0);
  clrtoeol();
  attron(A_BOLD);
  mvaddstr(0, (COLS / 2) - (strlen(text) / 2), text);
  attroff(A_BOLD);
  refresh();
}
void
print_status(const char *text)
{
  move(LINES - 1, 0);
  clrtoeol();
 
  attron(A_REVERSE);
  mvaddstr(LINES - 1, 0, text);
  attroff(A_REVERSE);
  refresh();
}
```
With these functions, we can construct the main part of our number-guessing game. First, the program sets up the terminal for **ncurses**, then picks a random number from 0 to 7. After displaying a number scale, the program then enters a loop to ask the user for their guess.
As the user makes their guess, the program provides visual feedback. If the guess is too low, the program prints a left square bracket under the number on the screen. If the guess is too high, the game prints a right square bracket. This helps the user to narrow their choice until they guess the correct number.
```
int
main()
{
  int number, guess;
  initscr();
  cbreak();
  noecho();
  number = random0_7();
  mvprintw(1, COLS - 1, "%d", number); /* debugging */
  print_header("Guess the number 0-7");
  mvaddstr(9, (COLS / 2) - 7, "0 1 2 3 4 5 6 7");
  print_status("Make a guess...");
  do {
    guess = read_guess();
    move(10, (COLS / 2) - 7 + (guess * 2));
    if (guess &lt; number) {
      addch('[');
      print_status("Too low");
    }
    else if (guess &gt; number) {
      addch(']');
      print_status("Too high");
    }
    else {
      addch('^');
    }
  } while (guess != number);
  print_header("That's right!");
  print_status("Press any key to quit");
  getch();
  endwin();
  return 0;
}
```
Copy this program and compile it for yourself to try it out. Dont forget that you need to tell GCC to link with the **ncurses** library:
```
`$ gcc -o guess guess.c -lncurses`
```
Ive left the debugging line in there, so you can see the secret number near the upper-right corner of the screen:
![guess number game interface][3]
Figure 1: Guess the number game. Notice the secret number in the upper right.
### Get yourself going with ncurses
This program uses a bunch of other features of **ncurses** that you can use as a starting point. For example, the print_header function prints a message in bold text centered at the top of the screen, and the print_status function prints a message in reverse text at the bottom-left of the screen. Use this to help you get started with **ncurses** programming.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/8/guess-number-game-ncurses-linux
作者:[Jim Hall][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/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/question-mark_chalkboard.jpg?itok=DaG4tje9 (question mark in chalk)
[2]: https://opensource.com/article/21/8/ncurses-linux
[3]: https://opensource.com/sites/default/files/guessnumber07.png

View File

@ -1,97 +0,0 @@
[#]: subject: "What are container runtimes?"
[#]: via: "https://opensource.com/article/21/9/container-runtimes"
[#]: author: "Nived V https://opensource.com/users/nivedv"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
What are container runtimes?
======
Take a deep dive into container runtimes so you can understand how
container environments are built.
![Ships at sea on the web][1]
In my examination of [container images][2], I discussed container fundamentals, but now it's time to delve deeper into container runtimes so you can understand how container environments are built. The information in this article is in part extracted from the [official documentation][3] of the Open Container Initiative (OCI), the open standard for containers, so this information is relevant regardless of your container engine.
### Container runtimes
So what really happens in the backend when you run a command like `podman run` or `docker run` command? Here is a step-by-step overview for you:
1. The image is pulled from an image registry if it not available locally
2. The image is extracted onto a copy-on-write filesystem, and all the container layers overlay each other to create a merged filesystem
3. A container mount point is prepared
4. Metadata is set from the container image, including settings like overriding CMD, ENTRYPOINT from user inputs, setting up SECCOMP rules, etc., to ensure container runs as expected
5. The kernel is alerted to assign some sort of isolation, such as process, networking, and filesystem, to this container (namespaces)
6. The kernel is also alerted to assign some resource limits like CPU or memory limits to this container (cgroups)
7. A system call (syscall) is passed to the kernel to start the container
8. SELinux/AppArmor is set up
Container runtimes take care of all of the above. When we think about container runtimes, the things that come to mind are probably runc, lxc, containerd, rkt, cri-o, and so on. Well, you are not wrong. These are container engines and container runtimes, and each is built for different situations.
_Container runtimes_ focus more on running containers, setting up namespace and cgroups for containers, and are also called lower-level container runtimes. Higher-level container runtimes or container engines focus on formats, unpacking, management, and image-sharing. They also provide APIs for developers.
### Open Container Initiative (OCI)
The Open Container Initiative (OCI) is a Linux Foundation project. Its purpose is to design certain open standards or a structure around how to work with container runtimes and container image formats. It was established in June 2015 by Docker, rkt, CoreOS, and other industry leaders.
It does this using two specifications:
#### 1\. Image Specification (image-spec)
The goal of this specification is to enable the creation of interoperable tools for building, transporting, and preparing a container image to run.
The high-level components of the spec include:
* [Image Manifest][4] — a document describing the elements that make up a container image
* [Image Index][5] — an annotated index of image manifests
* [Image Layout][6] — a filesystem layout representing the contents of an image
* [Filesystem Layer][7] — a changeset that describes a containers filesystem
* [Image Configuration][8] — a document determining layer ordering and configuration of the image suitable for translation into a [runtime bundle][9]
* [Conversion][10] — a document explaining how this translation should occur
* [Descriptor][11] — a reference that describes the type, metadata, and content address of referenced content
#### 2\. Runtime specification (runtime-spec)
This specification aims to define the configuration, execution environment, and lifecycle of a container. The config.json file provides the container configuration for all supported platforms and details the field that enables the creation of a container. The execution environment is detailed along with the common actions defined for a containers lifecycle to ensure that applications running inside a container have a consistent environment between runtimes.
The Linux container specification uses various kernel features, including namespaces, cgroups, capabilities, LSM, and filesystem jails to fulfill the spec.
### Now you know
Container runtimes are managed by the OCI specifications to provide consistency and interoperability. Many people use containers without the need to understand how they work, but understanding containers is a valuable advantage when you need to troubleshoot or optimize how you use them.
* * *
_This article is based on a [techbeatly][12] article and has been adapted with permission._
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/container-runtimes
作者:[Nived V][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/nivedv
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kubernetes_containers_ship_lead.png?itok=9EUnSwci (Ships at sea on the web)
[2]: https://opensource.com/article/21/8/container-fundamentals-2
[3]: https://github.com/opencontainers
[4]: https://github.com/opencontainers/image-spec/blob/master/manifest.md
[5]: https://github.com/opencontainers/image-spec/blob/master/image-index.md
[6]: https://github.com/opencontainers/image-spec/blob/master/image-layout.md
[7]: https://github.com/opencontainers/image-spec/blob/master/layer.md
[8]: https://github.com/opencontainers/image-spec/blob/master/config.md
[9]: https://github.com/opencontainers/runtime-spec
[10]: https://github.com/opencontainers/image-spec/blob/master/conversion.md
[11]: https://github.com/opencontainers/image-spec/blob/master/descriptor.md
[12]: https://medium.com/techbeatly/container-runtimes-deep-dive-77eb0e511939

View File

@ -1,152 +0,0 @@
[#]: subject: "4 Linux technologies fundamental to containers"
[#]: via: "https://opensource.com/article/21/8/container-linux-technology"
[#]: author: "Nived V https://opensource.com/users/nivedv"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
4 Linux technologies fundamental to containers
======
Namespaces, cgroups, seccomp, and SELinux are the Linux technologies
that make up the foundations of building and running a container process
on your system.
![Penguin driving a car with a yellow background][1]
In previous articles, I have written about [container images][2] and [runtimes][3]. In this article, I look at how containers are made possible by a foundation of some special Linux technologies, including namespaces and control groups.
![layers of linux technologies][4]
Figure 1: Linux technologies that contribute to containers
(Nived Velayudhan, [CC BY-SA 4.0][5])
Linux technologies make up the foundations of building and running a container process on your system. Technologies include:
1. Namespaces
2. Control groups (cgroups)
3. Seccomp
4. SELinux
### Namespaces
_Namespaces_ provide a layer of isolation for the containers by giving the container a view of what appears to be its own Linux filesystem. This limits what a process can see and therefore restricts the resources available to it.
There are several namespaces in the Linux kernel that are used by Docker or Podman and others while creating a container:
 
```
$ docker container run alpine ping 8.8.8.8
$ sudo lsns -p 29413
        NS TYPE   NPROCS PID USER COMMAND
4026531835 cgroup   299   1  root /usr/lib/systemd/systemd --
switched...
4026533105 mnt 1 29413 root ping 8.8.8.8
4026533106 uts 1 29413 root ping 8.8.8.8
4026533105 ipc 1 29413 root ping 8.8.8.8
[...]
```
#### **User**
The user namespace isolates users and groups within a container. This is done by allowing containers to have a different view of UID and GID ranges compared to the host system. The user namespace enables the software to run inside the container as the root user. If an intruder attacks the container and then escapes to the host machine, they're confined to only a non-root identity.
#### **Mnt**
The mnt namespace allows the containers to have their own view of the system's file system hierarchy. You can find the mount points for each container process in the _/proc/&lt;PID&gt;/mounts_ location in your Linux system.
#### **UTS**
The Unix Timesharing System (UTS) namespace allows containers to have a unique hostname and domain name. When you run a container, a random ID is used as the hostname even when using the `— name` tag. You can use the [`unshare` command][6] to get an idea of how this works.
```
$ docker container run -it --name nived alpine sh
/ # hostname
9c9a5edabdd6
/ #
$ sudo unshare -u sh
# hostname isolated.hostname
# hostname
# exit
$ hostname
homelab.redhat.com
```
#### **IPC**
The Inter-Process Communication (IPC) namespace allows different container processes to communicate by accessing a shared range of memory or using a shared message queue.
 
```
# ipcmk -M 10M
Shared memory id: 0
# ipcmk -M 20M
Shared memory id: 1
# ipcs
\---- Message Queues ----
key  msqid  owner  perms  used-bytes  messages
\---- Shared Memory Segments
key        shmid owner perms bytes    nattch status
0xd1df416a 0     root  644   10485760 0
0xbd487a9d 1     root  644   20971520 0
[...]
```
#### **PID**
The Process ID (PID) namespace ensures that the processes running inside a container are isolated from the external world. When you run a `ps` command inside a container, you only see the processes running inside the container and not on the host machine because of this namespace.
#### **Net**
The network namespace allows the container to have its own view of network interface, IP addresses, routing tables, port numbers, and so on. How does a container able to communicate to the external world? All containers you create get attached to a special virtual network interface for communication.
### Control groups (cgroups)
Cgroups are fundamental blocks of making a container. A cgroup allocates and limits resources such as CPU, memory, network I/O that are used by containers. The container engine automatically creates a cgroup filesystem of each type, and sets values for each container when the container is run.
### SECCOMP
Seccomp basically stands for _secure computing_. It is a Linux feature used to restrict the set of system calls that an application is allowed to make. The default seccomp profile for Docker, for example, disables around 44 syscalls (over 300 are available).
The idea here is to provide containers access to only those resources which the container might need. For example, if you don't need the container to change the clock time on your host machine, you probably have no use for the _clock_adjtime_ and _clock_settime_ syscalls, and it makes sense to block them out. Similarly, you don't want the containers to change the kernel modules, so there is no need for them to make _create_module, delete_module_ syscalls.
### SELinux
SELinux stands for _security-enhanced Linux_. If you are running a Red Hat distribution on your hosts, then SELinux is enabled by default. SELinux lets you limit an application to have access only to its own files and prevent any other processes from accessing them. So, if an application is compromised, it would limit the number of files that it can affect or control. It does this by setting up contexts for files and processes and by defining policies that would enforce what a process can see and make changes to.
SELinux policies for containers are defined by the `container-selinux` package. By default, containers are run with the **container_t** label and are allowed to read (r) and execute (x) under the _/usr_ directory and read most content from the _/etc_ directory. The label **container_var_lib_t** is common for files relating to containers.
### Wrap up
Containers are a critical part of today's IT infrastructure and a pretty interesting technology, too. Even if your role doesn't involve containerization directly, understanding a few fundamental container concepts and approaches gives you an appreciation for how they can help your organization. The fact that containers are built on open source Linux technologies makes them even better!
* * *
_This article is based on a [techbeatly][7] article and has been adapted with permission._
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/8/container-linux-technology
作者:[Nived V][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/nivedv
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background)
[2]: https://opensource.com/article/21/8/container-fundamentals-2
[3]: https://opensource.com/article/21/8/deep-dive-container-runtimes
[4]: https://opensource.com/sites/default/files/1linuxtechs.png (layers of linux technologies)
[5]: https://creativecommons.org/licenses/by-sa/4.0/
[6]: https://opensource.com/article/19/10/namespaces-and-containers-linux
[7]: https://nivedv.medium.com/container-internals-deep-dive-5cc424957413

View File

@ -1,116 +0,0 @@
[#]: subject: "How to Install Dropbox on Ubuntu Linux"
[#]: via: "https://itsfoss.com/install-dropbox-ubuntu/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to Install Dropbox on Ubuntu Linux
======
Dropbox is one of the [most popular cloud storage services available for Linux][1] and other operating systems.
In fact, Dropbox is one of the earliest services to provide a native Linux application. It still [supports 32-bit Linux systems][2] that is also a commendable job.
In this beginners tutorial, Ill show the steps for installing Dropbox on Ubuntu. The steps are really simple but some websites make it unnecessarily complicated.
### Install Dropbox on Ubuntu desktop
Lets see the installation procedure, step by step.
#### Step 1: Get Dropbox installer for Ubuntu
Dropbox offers DEB files for its installer. Go to the download section of its website:
[Dropbox Download][3]
And download the appropriate DEB file. Considering that you are using 64 bit Ubuntu, get the deb file for 64-bit version.
![Download the Dropbox installer][4]
#### Step 2: Install Dropbox installer
The deb file you downloaded is just an installer for Dropbox. Actual Dropbox installation starts later, similar to [installing Steam on Ubuntu][5].
To [install the downloaded deb file][6], either double click on it or right click and select open with Software Install.
![Installing the downloaded Dropbox deb file][7]
It will open the software center and you can click the install button.
![Installing Dropbox deb file][8]
Wait for the installation to finish.
#### Step 3: Start Dropbox installation
Dropbox installer is now installed. Press the Windows key (also known as super key) and search for Dropbox and click on it.
![Start Dropbox for installation][9]
On the first launch, it shows two popups. One about restarting Nautilus (the file explorer in Ubuntu) and the other about Dropbox installation.
![Starting Dropbox installation][10]
Clicking either Restart Nautilus/Close (on the Nautilus popup) or OK (on the installation popup) starts the actual Dropbox client download and installation. If the Nautilus Restart does not close on clicking Close button, click the x button.
Wait for the Dropbox installation to finish.
![Installing Dropbox][11]
Oh! Nautilus restart is required because Dropbox adds some extra features like showing the synchronization status in the file explorer.
Once Dropbox is installed, it should either take you to the Dropbox login page automatically or you can hit the Dropbox icon at the top and select sign in option.
![Sign in to Dropbox after installation][12]
In fact, this is how you would be accessing Dropbox settings in the future.
#### Step 4: Start using Dropbox on Ubuntu
![Sign in into Dropbox][13]
**Note**: Dropbox wont work until you successfully sign in. Heres a catch. The free version of Dropbox limits the number of devices you can link to your account. **If you already have 3 linked devices, you should remove some of the older ones that you do not use.**
Once you are successfully signed in, you should see a Dropbox folder created in your home directory and your files from the cloud starts appearing here.
![Dropbox folder is created under home directory][14]
If you want to save disk space or bandwidth, you can go to the Preferences and choose the Selective Sync option. The selective sync option allows you only sync selected folders from Dropbox cloud on your local system.
![Using selective sync in Dropbox][15]
Dropbox automatically starts at each boot. This is the behavior you should expect from any cloud service, I believe.
Thats all you need to get started with Dropbox on Ubuntu. I hope you find this tutorial helpful.
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-dropbox-ubuntu/
作者:[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://itsfoss.com/cloud-services-linux/
[2]: https://itsfoss.com/32-bit-linux-distributions/
[3]: https://www.dropbox.com/install-linux
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/get-dropbox-for-ubuntu.png?resize=800%2C294&ssl=1
[5]: https://itsfoss.com/install-steam-ubuntu-linux/
[6]: https://itsfoss.com/install-deb-files-ubuntu/
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/dropbox-installer-ubuntu.png?resize=797%2C476&ssl=1
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/installing-dropbox-deb-file.png?resize=800%2C346&ssl=1
[9]: https://itsfoss.com/wp-content/uploads/2021/09/start-drobox-ubuntu.webp
[10]: https://itsfoss.com/wp-content/uploads/2021/09/starting-dropbox-installation-800x599.webp
[11]: https://itsfoss.com/wp-content/uploads/2021/09/installing-dropbox.webp
[12]: https://itsfoss.com/wp-content/uploads/2021/09/sign-in-to-dropbox-after-first-installation.webp
[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/09/sign-in-dropbox.png?resize=800%2C409&ssl=1
[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/dropbox-folder-ubuntu.png?resize=800%2C491&ssl=1
[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/Dropbox-selective-sync.png?resize=800%2C399&ssl=1

View File

@ -0,0 +1,148 @@
[#]: subject: "Learn everything about computers with this Raspberry Pi kit"
[#]: via: "https://opensource.com/article/21/9/raspberry-pi-crowpi2"
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Learn everything about computers with this Raspberry Pi kit
======
The CrowPi is an amazing Raspberry Pi project system housed in a
laptop-like body.
![Teacher or learner?][1]
I like history, and I like computers, so I enjoy hearing stories about computing before computers were an everyday household appliance, much less a personal accessory. [One tale I hear often][2] is about how the computers of long ago (in computer years, anyway) were pleasantly basic. They were so basic, in fact, that it was relatively trivial for a curious user to figure out how to program one. Looking at modern computers, with object-oriented programming languages, complex GUI frameworks, network APIs, containers, and more, there's genuine concern that the tools of the computing trade have become essentially inaccessible to anyone without specialized training.
From the day the Raspberry Pi was released in 2012, it has always been intended as an educational platform. Several third-party vendors support the Pi with add-ons and training kits to help learners of all ages explore programming, physical computing, and open source. However, until recently, it's largely been up to the user to figure out how all the pieces on the market fit together. And then I got a CrowPi.
![CrowPi more than a laptop][3]
The CrowPi is not a laptop.
(Seth Kenlon, [CC BY-SA 4.0][4])
### Introducing the CrowPi2
Crows are surprisingly intelligent birds. They recognize and remember faces, mimic sounds they've heard, solve complex puzzles, and even use tools to accomplish a task. It's fitting that the CrowPi uses the crow as its logo and namesake because this device is packed with opportunities for exploration, experimentation, education, and, best of all, fun.
The design itself is clever: It looks like a laptop, but it's much more than that. When you lift the Bluetooth keyboard from the case, it reveals a hidden electronics workshop, complete with an LCD screen, 16 buttons, dials, RFID sensor, proximity sensor, breadboard, speakers, GPIO connections, a LED array, and much more. _And it's all programmable._
As its name implies, the unit itself is powered entirely by a Raspberry Pi, securely fastened within the underside of the case.
![crowpi pi board][5]
The CrowPi Pi board.
(Seth Kenlon, [CC BY-SA 4.0][4])
By default, you're meant to power the unit with a power adapter, and it ships with a wall adapter that you can plug into the case rather than powering the Pi directly. You can also use a battery supply plugged into an external micro-USB port. There's even a drawer built into the case so you can store your battery pack. When you do this, there's a USB cable popping out of the battery drawer and into the case power port, so there's no illusion that this is a "normal" laptop. However, with a device like this, that's pretty much the desired aesthetic!
### First boot
The CrowPi2 ships with Raspbian installed on a microSD card labeled **System**, although it includes a second microSD card loaded with [RetroPie][6], too. Being a responsible adult, I booted RetroPie first, naturally.
RetroPie is always fun, and the CrowPi2 ships with two SNES-style game controllers to ensure you have the optimal retro gaming experience.
Booting to the actual system is, amazingly, just as fun and arguably more so. The login manager is a custom project hub with quick links to sample coding projects, the Python and Arduino IDEs, Scratch, sample Python games, Minecraft, and more. You can also choose to exit the project hub and just use the desktop.
![CrowPi hub][7]
The CrowPi Hub.
(Seth Kenlon, [CC BY-SA 4.0][4])
The desktop is familiar to anyone used to the Raspberry Pi or Linux in general, but it's basic enough that it's easy to learn, too. There's an application menu in the top left, shortcut icons on the desktop, a system tray for network selection and volume control in the top right, and so on.
![CrowPi Desktop][8]
The CrowPi Desktop.
(Seth Kenlon, [CC BY-SA 4.0][4])
There's so much available on the CrowPi that it might be difficult to decide where to start. For me, there were four broad categories: Programming, physical electronics, Linux, and gaming.
There's an instruction manual in the box, so you know what you need to connect (for instance, the keyboard is battery-powered, so it does need charging sometimes, and it and the mouse always require a USB dongle). It's a quick read, though, and just one of the many examples of how seriously the CrowPi team takes documentation.
![CrowPi Docs][9]
The CrowPi Docs.
(Seth Kenlon, [CC BY-SA 4.0][4])
### Programming
If you're keen to learn how to code, there are many paths to success on the CrowPi. You should take the path that you find the most satisfying.
#### 1\. Scratch
[Scratch][10] is a simple visual coding application that lets you make games and interactive stories using code blocks that fit together like [Lego pieces][11]. It's the easiest way to begin coding, and I've seen kids as young as eight spend hours puzzling over the optimal algorithm for a game of their own design. Of course, it's not only great for kids! Adults can have a lot of fun with it, too. Not sure where to start? There's a 99-page booklet (printed on actual paper) in the box with Scratch lessons and projects for you to try.
#### 2\. Java and Minecraft
Minecraft is not open source (although there are [several open source projects][12] that reimplement it), but there's enough source available that it's often used to teach programming. Minecraft was written in Java, and the CrowPi ships with both [Minecraft Pi Edition][13] and the [BlueJ Java IDE][14] to make learning Java easier and more fun than ever.
#### 3\. Python and PyGame
There are several really fun games on the CrowPi that were written in Python and the [PyGame game engine][15]. You can play the games and then look at the source code to find out how the game works. The Geany, Thonny, and [Mu][16] editors are included on the CrowPi, so you can start programming in Python right away. As with Scratch, there's a booklet in the box with lessons so you can learn Python basics.
### Electronics
The physical electronics workshop concealed under the keyboard is essentially an array of Pi Hats. The whole thing is mapped out on a fold-out diagram in both English and Chinese so that you can identify all the components. There are plenty of sample projects to get you started. Here's a small list:
* **Hello** prints "hello" on the LCD screen when you speak to the CrowPi.
* **Intrusion alarm** sounds an alarm using the proximity sensor.
* **Remote controller** enables you to use a remote control (yes, this too is included in the box) to trigger events on the CrowPi.
* **RGB Tetris** lets you play a game of Tetris on an LED display.
* **Voice recognition** demonstrates natural language processing.
* **Ultrasonic music** creates a rudimentary Theramin using distance sensors and a speaker.
Those projects are just the beginning because you can build upon what exists. There's more to explore, of course. Patch cables, resistors, LEDs, and all sorts of components are included in the box so that you can learn all about the Pi's GPIO capabilities at your leisure.
One problem: The location of the sample projects is a little difficult to find. It's easy to find the demos (they're on the CrowPi hub screen), but the location of the source code isn't immediately obvious. It turns out that most of the sample projects are in `/usr/share/code`, which you can reach either through the file manager or a terminal.
![CrowPi Peripherals][17]
The CrowPi Peripherals
(Seth Kenlon, [CC BY-SA 4.0][4])
### Linux
The Raspberry Pi runs Linux. If you've been meaning to learn more about Linux, the CrowPi is a great platform for that, too. You can explore the desktop, the terminal, and nearly any Linux or open source application you can find. If you've been reading about open source for years and are ready to dive into an open source OS, this could be a platform for that (and much more, obviously).
### Gaming
The **RetroPie** SD card included in the box means you can reboot into a retro game console and play any number of old-school arcade games. It's not exactly a Steam Deck, but it's a fun and inspiring little gaming platform. Because it comes with not one but two game controllers, it's ideal for couch co-op. And best of all, you not only can play games on the CrowPi, but you can make your own games, too.
### Screwdriver included
I got to sit down with the CrowPi2 for about two weeks, and I've barely been able to get through all of the projects. There have been many nights when I've had to force myself to step away from it because even after I've tired of one project, I inevitably find something else to explore. To sum it up, I found one component in particular in the box, and I immediately knew that the CrowPi and I were well suited to one another: It was a small, humble screwdriver. There's no voiding of warranty stickers here. The CrowPi wants you to tinker, to take things apart, explore, and learn. This isn't a laptop or even just a Pi; this is a portable, low-powered, diverse, and open source learner's toolkit.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/raspberry-pi-crowpi2
作者:[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/osdc-lead-teacher-learner.png?itok=rMJqBN5G (Teacher or learner?)
[2]: https://opensource.com/article/21/8/my-first-programming-language
[3]: https://opensource.com/sites/default/files/crowpi-not-laptop.jpeg (CrowPi more than a laptop)
[4]: https://creativecommons.org/licenses/by-sa/4.0/
[5]: https://opensource.com/sites/default/files/crowpi-pi.jpeg (crowpi pi board)
[6]: https://opensource.com/article/19/1/retropie
[7]: https://opensource.com/sites/default/files/crowpi-hub.png (CrowPi hub)
[8]: https://opensource.com/sites/default/files/crowpi-desktop.png (CrowPi desktop)
[9]: https://opensource.com/sites/default/files/crowpi-docs.jpeg (CrowPi docs)
[10]: https://opensource.com/article/20/9/scratch
[11]: https://opensource.com/article/20/6/open-source-virtual-lego
[12]: https://opensource.com/alternatives/minecraft
[13]: https://www.minecraft.net/en-us/edition/pi
[14]: https://opensource.com/article/20/7/ide-java#bluej
[15]: https://opensource.com/downloads/python-gaming-ebook
[16]: https://opensource.com/article/18/8/getting-started-mu-python-editor-beginners
[17]: https://opensource.com/sites/default/files/crowpi-peripherals.jpeg (CrowPi peripherals)

View File

@ -0,0 +1,81 @@
[#]: subject: "Resize an image from the Linux terminal"
[#]: via: "https://opensource.com/article/21/9/resize-image-linux"
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Resize an image from the Linux terminal
======
Shrink an image from your terminal with the ImageMagick convert command.
![Old camera blue][1]
ImageMagick is a handy multipurpose command-line tool for all your image needs. ImageMagick supports a variety of image types, including JPG photos and PNG graphics.
### Resizing images
I often use ImageMagick on my webserver to resize images. For example, let's say I want to include a photo of my cats on my personal website. The photo from my phone is very large, about 4000x3000 pixels, at 3.3MB. That's much too large for a web page. I use the ImageMagick convert tool to change the size of my photo so that I can include it on my web page. ImageMagick is a full suite of tools, one of the most common is the `convert` command.
The ImageMagick `convert` command uses this general syntax:
```
`convert {input} {actions} {output}`
```
To resize a photo called `PXL_20210413_015045733.jpg` to a more manageable 500-pixel width, type this:
```
`$ convert PXL_20210413_015045733.jpg -resize 500x sleeping-cats.jpg`
```
The new image is now only 65KB in size. 
![Sleeping cats][2]
Jim Hall, [CC BY-SA 4.0][3]
You can provide both width and height dimensions with the `-resize` option. But, by providing only the width, ImageMagic does the math for you and automatically retains the aspect ratio by resizing the output image with a proportional height.
### Install ImageMagick on Linux
On Linux, you can install ImageMagick using your package manager. For instance, on Fedora or similar:
```
`$ sudo dnf install imagemagick`
```
On Debian and similar:
```
`$ sudo apt install imagemagick`
```
On macOS, use [MacPorts][4] or [Homebrew][5].
On Windows, use [Chocolatey][6].
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/resize-image-linux
作者:[Jim Hall][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/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-photo-camera-blue.png?itok=AsIMZ9ga (Old camera blue)
[2]: https://opensource.com/sites/default/files/sleeping-cats.jpg (Sleeping cats)
[3]: https://creativecommons.org/licenses/by-sa/4.0/
[4]: https://opensource.com/article/20/11/macports
[5]: https://opensource.com/article/20/6/homebrew-mac
[6]: https://opensource.com/article/20/3/chocolatey

View File

@ -0,0 +1,97 @@
[#]: subject: "How to Stop a Program in Linux Terminal"
[#]: via: "https://itsfoss.com/stop-program-linux-terminal/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to Stop a Program in Linux Terminal
======
Its amusing how the simplest of the things could be complicated when you are new to something.
The other day, I found my friend could not figure out how to exit the top command. Instead of stopping the command, he closed the entire terminal application.
Thats not only unnecessary, it is a not good thing to do.
### Stopping programs in Linux
In Linux, you can use the Ctrl+C keys to stop a running program in the terminal. This works for Ubuntu as well as any other Linux distribution.
Take the ping command for example. If you do not stop it, it will keep on displaying the result.
Hold the Ctrl button and press the C key at the same time. It sends the [SIGKILL signal][1] to the running program to force quit the command.
![Stopping a program in the Linux terminal][2]
Do you see the ^C? The caret (^) means Ctrl. So basically, the terminal shows the Ctrl+C keystrokes as ^C.
The Ctrl+C works very well for the commands that are designed to keep on running until interrupted. You feel like you have to cancel the command, use Ctrl+C.
In a more complicated method, you can [find the process ID and kill a running process][3]. Thats more advanced stuff and used only when the process is running in the background or by another user or in another terminal window.
Apart from that, there are some other commands and command line tools that have their own exit commands. Let me briefly mention some of them here.
#### How to exit Vim editor
[Existing Vim editor][4] has made so many jokes in the Linux world. It is difficult to figure out when you are new to this powerful command line based text editor. Among several ways of quitting vim, the most common is to press the Esc key and then type a colon (:) and then type `q!` for force quit without save or `wq` for save and quit.
![][5]
#### How to exit Nano editor
Quitting the [Nano editor][6] is a bit simpler than exiting Vim. Why? Because Nano mentions the shortcut at the bottom. You may not understand it if you are new to it but at least youll be able to figure it out the next time.
To exit Nano, press Ctrl+X. It will ask if you want to save the changes made to the file or not. You can enter your choice.
![][7]
#### How to exit less command
The less is a wonderful command that lets you view without cluttering your terminal screen like the cat command. If you are inside the less command view, use the key `q` to exit less.
#### How to exit the terminal
To exit the terminal itself, instead of closing the terminal, either use Ctrl+D keyboard shortcut or type the exit command:
```
exit
```
This actually exists you from the current shell. When you [open a terminal in Ubuntu][8] or any other Linux distribution, it runs the default shell. When you exit from this shell, terminal ends as well. Ctrl+D is the shortcut to do the same and quit the terminal.
I hope you find this quick tutorial helpful. I highly recommend learning these [Linux command tips][9].
**Recommended Read:**
![][10]
#### [21 Super Handy Linux Command Tips and Tricks That Will Save you a lot of Time and Increase Your Productivity][9]
Questions or suggestions? Please leave a comment below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/stop-program-linux-terminal/
作者:[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://linuxhandbook.com/sigterm-vs-sigkill/#what-is-sigkill
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/stop-a-program-linux-terminal.png?resize=800%2C373&ssl=1
[3]: https://itsfoss.com/how-to-find-the-process-id-of-a-program-and-kill-it-quick-tip/
[4]: https://itsfoss.com/how-to-exit-vim/
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/05/how-to-exit-vim.png?resize=737%2C422&ssl=1
[6]: https://itsfoss.com/nano-editor-guide/
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-editor-save-and-exit.png?resize=799%2C503&ssl=1
[8]: https://itsfoss.com/open-terminal-ubuntu/
[9]: https://itsfoss.com/linux-command-tricks/
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/07/linux-command-tips.png?fit=800%2C450&ssl=1

View File

@ -0,0 +1,93 @@
[#]: subject: "Run Web Applications in Linux Using Tangram Browser"
[#]: via: "https://itsfoss.com/tangram/"
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
[#]: collector: "lujun9972"
[#]: translator: "anine09"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Run Web Applications in Linux Using Tangram Browser
======
_**Brief:** Tangram is a browser that aims to help you run and manage web applications in Linux_. _Lets take a look at how it works._
Even if we have native Linux applications available for several tools, many end up using web applications.
Maybe in the form of an electron app or directly through a web browser, native experiences are becoming an old-school thing.
Of course, running web applications, no matter the platform, needs more system resources. And, considering every service is going for a web-based approach instead of a native experience, we need solutions to manage the web apps efficiently.
An open-source Linux app, Tangram, could be the solution.
### Tangram: A Browser Tailored to Run Web Applications
![][1]
You can choose to use some of the [best Linux web browsers][2] to run web applications. But, if you want something that entirely focuses on web application experience, Tangram is an exciting option.
The developer took inspiration from GNOME Web, [Franz][3], and [Rambox][4].
You do not get any fancy features but just the ability to change the user agent and manage the web applications you have logged in to.
It can be used to access multiple social media platforms, chat messengers, work collaboration applications, and more.
### Features of Tangram
![][5]
Considering it is a minimal browser based on WebKitGTK, not much you can do here. To list some of the essentials, heres what you can do:
* Re-order tabs in the sidebar
* Easily add any web service as a web app
* Ability to tweak the user agent (Desktop/mobile)
* Keyboard shortcuts
* Change position of the sidebar (tab bar)
All you need to do is load up a web service, log in, and click on “**Done**” to add it as a web application.
![][6]
### Installing Tangram in Linux
Tangram is available as a Flatpak for every Linux distribution, and you can also find it in [AUR][7].
If you want to install it via the terminal, type in the following command:
```
flatpak install flathub re.sonny.Tangram
```
You may refer to our [Flatpak guide][8] if you do not have it enabled on your system.
To explore more about it, you can check out its [GitHub page][9].
[Tangram Browser][10]
Have you tried this yet? Do you prefer web applications or native applications? Feel free to share your thoughts in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/tangram/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[anine09](https://github.com/anine09)
校对:[校对者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://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/tangram-web-app-browser.png?resize=800%2C611&ssl=1
[2]: https://itsfoss.com/best-browsers-ubuntu-linux/
[3]: https://itsfoss.com/franz-messaging-app/
[4]: https://itsfoss.com/rambox/
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/09/tangram-settings.png?resize=530%2C290&ssl=1
[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/tangram-web-app-whatsapp.png?resize=800%2C431&ssl=1
[7]: https://itsfoss.com/aur-arch-linux/
[8]: https://itsfoss.com/flatpak-guide/
[9]: https://github.com/sonnyp/Tangram
[10]: https://flathub.org/apps/details/re.sonny.Tangram

View File

@ -0,0 +1,96 @@
[#]: subject: "What are container runtimes?"
[#]: via: "https://opensource.com/article/21/9/container-runtimes"
[#]: author: "Nived V https://opensource.com/users/nivedv"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
什么是容器运行时?
======
深入了解容器运行时,你就可以理解容器环境是如何建立的。
![Ships at sea on the web][1]
在对[容器镜像][2]的检查中,我讨论了容器的基本原理,但现在是时候深入研究容器运行时了,这样你就可以了解容器环境是如何构建的。本文的部分信息摘自 Open Container Initiative (OCI)(容器的开放标准)的[官方文档][3],所以无论你的容器引擎如何,这些信息都是相关的。
### 容器运行机制
那么,当你运行 `podman run``docker run` 命令时,在后台到底发生了什么?这里为你提供一个逐步的概述:
1. 如果本地没有镜像,则从镜像注册处拉取镜像
2. 镜像被提取到一个写时拷贝的文件系统上,所有的容器层相互叠加以创建一个合并的文件系统
3. 准备一个容器挂载点
4. 从容器镜像中设置元数据,包括诸如覆盖 CMD、来自用户输入的 ENTRYPOINT、设置 SECCOMP 规则等设置,以确保容器按预期运行
5. 提醒内核为该容器分配某种隔离,如进程、网络和文件系统(命名空间)
6. 内核还被提醒为这个容器分配一些资源限制,如 CPU 或内存限制cgroups
7. 一个系统调用syscall被传递给内核以启动容器
8. 设置 SELinux/AppArmor
容器运行时负责上述所有的工作。当我们想到容器运行时,想到的可能是 runc、lxc、containerd、rkt、cri-o 等等。嗯,你没有错。这些都是容器引擎和容器运行时,每一种都是为不同的情况建立的。
_容器运行时_更侧重于运行容器为容器设置命名空间和 cgroups也被称为底层容器运行时。高层的容器运行时或容器引擎专注于格式、解包、管理和镜像共享。它们还为开发者提供 API。
### Open Container Initiative OCI
Open Container InitiativeOCI是一个 Linux 基金会项目。其目的是设计某些开放标准或围绕如何与容器运行时和容器镜像格式工作的结构。它是由 Docker、rkt、CoreOS 和其他行业领导者于 2015 年 6 月建立的。
它使用两个规范来做这件事:
#### 1\. 镜像规范image-spec
该规范的目标是创建可互操作的工具,用于构建、传输和准备运行的容器镜像。
该规范的高层组件包括:
* [Image Manifest][4] — 一个描述构成容器镜像的元素的文件
* [Image Index][5] — 镜像清单的注释索引
* [Image Layout][6] — 一个代表镜像内容的文件系统布局
* [Filesystem Layer][7] — 一个描述容器文件系统的变化集
* [Image Configuration][8] — 确定镜像层排序和配置的文件,适合转换成[运行时包][9]。
* [Conversion][10] — 解释应该如何进行转换的文件
* [Descriptor][11] — 一个描述被引用内容的类型、元数据和内容地址的参考资料
#### 2\. 运行时规范runtime-spec
该规范旨在定义容器的配置、执行环境和生命周期。config.json 文件为所有支持的平台提供了容器配置,并详细说明了能够创建容器的地方。执行环境与为容器的生命周期定义的通用操作一起被详细说明,以确保在容器内运行的应用在不同的运行时之间有一个一致的环境。
Linux 容器规范使用了各种内核功能包括命名空间、cgroups、capabilities、LSM 和文件系统监牢来实现该规范。
### 现在你知道了
容器运行时是由 OCI 规范管理的,以提供一致性和互操作性。许多人在使用容器时不需要了解它们是如何工作的,但当你需要排除故障或优化使用方法时,了解容器是一个宝贵的优势。
* * *
_本文基于 [techbeatly][12] 的文章并经授权改编。_
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/container-runtimes
作者:[Nived V][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/nivedv
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kubernetes_containers_ship_lead.png?itok=9EUnSwci (Ships at sea on the web)
[2]: https://opensource.com/article/21/8/container-fundamentals-2
[3]: https://github.com/opencontainers
[4]: https://github.com/opencontainers/image-spec/blob/master/manifest.md
[5]: https://github.com/opencontainers/image-spec/blob/master/image-index.md
[6]: https://github.com/opencontainers/image-spec/blob/master/image-layout.md
[7]: https://github.com/opencontainers/image-spec/blob/master/layer.md
[8]: https://github.com/opencontainers/image-spec/blob/master/config.md
[9]: https://github.com/opencontainers/runtime-spec
[10]: https://github.com/opencontainers/image-spec/blob/master/conversion.md
[11]: https://github.com/opencontainers/image-spec/blob/master/descriptor.md
[12]: https://medium.com/techbeatly/container-runtimes-deep-dive-77eb0e511939

View File

@ -0,0 +1,192 @@
[#]: subject: "4 Linux technologies fundamental to containers"
[#]: via: "https://opensource.com/article/21/8/container-linux-technology"
[#]: author: "Nived V https://opensource.com/users/nivedv"
[#]: collector: "lujun9972"
[#]: translator: "wxy"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
容器的四大基础技术
======
> 命名空间、控制组、seccomp 和 SELinux 构成了在你的系统上构建和运行一个容器进程的 Linux 技术基础。
![企鹅驾驶一辆黄色背景的汽车][1]
在以前的文章中,我介绍过 [容器镜像][2] 及其 [运行时][3]。在这篇文章中,我研究了容器是如何在一些特殊的 Linux 技术基础上实现的,这些技术包括命名空间和控制组。
![容器技术的层次][4]
*图1对容器有贡献的 Linux 技术Nived Velayudhan, [CC BY-SA 4.0][5]*
这些 Linux 技术构成了在系统上构建和运行容器进程的基础:
1. 命名空间
2. 控制组cgroups
3. Seccomp
4. SELinux
### 命名空间
<ruby>命名空间<rt>namespace</rt></ruby> 为容器提供了一个隔离层,给容器提供了一个看起来是它自己的 Linux 文件系统的视图。这就限制了进程所能看到的东西,从而限制了它所能获得的资源。
在创建容器时Docker 或 Podman 和其他容器技术使用了 Linux 内核中的几个命名空间:
```
[nivedv@homelab ~]$ docker container run alpine ping 8.8.8.8
[nivedv@homelab ~]$ sudo lsns -p 29413
NS TYPE NPROCS PID USER COMMAND
4026531835 cgroup 299 1 root /usr/lib/systemd/systemd --switched...
4026531837 user 278 1 root /usr/lib/systemd/systemd --switched...
4026533105 mnt 1 29413 root ping 8.8.8.8
4026533106 uts 1 29413 root ping 8.8.8.8
4026533107 ipc 1 29413 root ping 8.8.8.8
4026533108 pid 1 29413 root ping 8.8.8.8
4026533110 net 1 29413 root ping 8.8.8.8
```
#### 用户
用户(`user`)命名空间将用户和组隔离在一个容器内。这是通过允许容器与宿主系统有不同的 UID 和 GID 范围来实现的。用户命名空间使软件能够以 root 用户的身份在容器内运行。如果入侵者攻击容器,然后逃逸到宿主机上,他们就受限于只能以非 root身份出现了。
#### 挂载
挂载(`mnt`)命名空间允许容器对系统的文件系统层次结构有自己的视图。你可以在 Linux 系统中的 `/proc/<PID>/mounts` 位置找到每个容器进程的挂载点。
#### UTS
<ruby>Unix 分时系统<rt>Unix Timeharing System</rt></ruby>UTS命名空间允许容器有一个唯一的主机名和域名。当你运行一个容器时即使使用 `- name` 标签,也会使用一个随机的 ID 作为主机名。你可以使用 [unshare 命令][6] 来了解一下这个工作原理。
```
nivedv@homelab ~]$ docker container run -it --name nived alpine sh
/ # hostname
9c9a5edabdd6
/ #
nivedv@homelab ~]$ sudo unshare -u sh
sh-5.0# hostname isolated.hostname
sh-5.0# hostname
isolated.hostname
sh-5.0#
sh-5.0# exit
exit
[nivedv@homelab ~]$ hostname
homelab.redhat.com
```
#### IPC
<ruby>进程间通信<rt>Inter-Process Communication</rt></ruby>IPC命名空间允许不同的容器进程通过访问共享内存或使用共享消息队列来进行通信。
```
[root@demo /]# ipcmk -M 10M
Shared memory id: 0
[root@demo /]# ipcmk -M 20M
Shared memory id: 1
[root@demo /]#
[root@demo /]# ipcs
------ Message Queues --------
key msqid owner perms used-bytes messages
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0xd1df416a 0 root 644 10485760 0
0xbd487a9d 1 root 644 20971520 0
------ Semaphore Arrays --------
key semid owner perms nsems
```
#### PID
<ruby>进程 ID<rt>Process ID</rt></ruby>PID命名空间确保在容器内运行的进程与外部世界隔离。当你在容器内运行 `ps` 命令时,由于这个命名空间的存在,你只能看到在容器内运行的进程,而不是在宿主机上。
#### 网络
网络(`net`命名空间允许容器对网络接口、IP 地址、路由表、端口号等有自己的视图。容器如何能够与外部世界沟通?你创建的所有容器都会被附加到一个特殊的虚拟网络接口上进行通信。
```
[nivedv@homelab ~]$ docker container run --rm -it alpine sh
/ # ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=119 time=21.643 ms
64 bytes from 8.8.8.8: seq=1 ttl=119 time=20.940 ms
^C
[root@homelab ~]# ip link show veth84ea6fc
veth84ea6fc@if22: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
master docker0 state UP mode DEFAULT group default
```
### 控制组
控制组(`cgroup`)是制作一个容器的基本模块。控制组会分配和限制资源,如 CPU、内存、网络 I/O 等,这些资源被容器所使用。容器引擎会自动创建每种类型的控制组文件系统,并在容器运行时为每个容器设置值。
```
[root@homelab ~]# lscgroup | grep docker
cpuset:/docker
net_cls,net_prio:/docker
cpu,cpuacct:/docker
hugetlb:/docker
devices:/docker
freezer:/docker
memory:/docker
perf_event:/docker
blkio:/docker
pids:/docker
```
容器运行时为每个容器设置了控制组值,所有信息都存储在 `/sys/fs/cgroup/*/docker`。下面的命令将确保容器可以使用 50000 微秒的 CPU 时间,并将内存的软、硬限制分别设置为 500M 和 1G。
```
[root@homelab ~]# docker container run -d --name test-cgroups --cpus 0.5 --memory 1G --memory-reservation 500M httpd
[root@homelab ~]# lscgroup cpu,cpuacct:/docker memory:/docker
cpu,cpuacct:/docker/
cpu,cpuacct:/docker/c3503ac704dafea3522d3bb82c77faff840018e857a2a7f669065f05c8b2cc84
memory:/docker/
memory:/docker/c3503ac704dafea3522d3bb82c77faff840018e857a2a7f669065f05c8b2cc84
[root@homelab c....c84]# cat cpu.cfs_period_us
100000
[root@homelab c....c84]# cat cpu.cfs_quota_us
50000
[root@homelab c....c84]# cat memory.soft_limit_in_bytes
524288000
[root@homelab c....c84]# cat memory.limit_in_bytes
1073741824
```
### SECCOMP
Seccomp 意思是“<ruby>安全计算<rt>secure computing</rt></ruby>”。它是一项 Linux 功能用于限制应用程序允许进行的系统调用的集合。例如Docker 的默认 seccomp 配置文件禁用了大约 44 个系统调用(总计超过 300 个)。
这里的思路是让容器只访问容器可能需要的那些资源。例如,如果你不需要容器改变主机上的时钟时间,你可能不会使用 `clock_adjtime``clock_settime` 系统调用,屏蔽它们是合理的。同样地,你不希望容器改变内核模块,所以没有必要让它们进行 `create_module``delete_module` 系统调用。
### SELinux
SELinux 是“<ruby>安全增强的 Linux<rt>security-enhanced Linux</rt></ruby>”的缩写。如果你在你的宿主机上运行的是 Red Hat 发行版,那么 SELinux 是默认启用的。SELinux 可以让你限制一个应用程序只能访问它自己的文件,并阻止任何其他进程访问它们。因此,如果一个应用程序被破坏了,它将限制该应用程序可以影响或控制的文件数量。它通过为文件和进程设置上下文环境以及定义策略来实现这一目的,这些策略将强制执行一个进程可以看到和改变的内容。
容器的 SELinux 策略是由 `container-selinux` 包定义的。默认情况下,容器以 `container_t` 标签运行,允许在 `/usr` 目录下读取(`r`)和执行(`x`),并从 `/etc` 目录下读取大部分内容。标签`container_var_lib_t` 是与容器有关的文件的通用标签。
### 总结
容器是当今 IT 基础设施的一个重要组成部分,也是一项相当有趣的技术。即使你的工作不直接涉及容器化,了解一些基本的容器概念和方法,也能让你体会到它们如何帮助你的组织。容器是建立在开源的 Linux 技术之上的,这使它们变得更加美好。
本文基于 [techbeatly][7] 的文章,并经授权改编。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/8/container-linux-technology
作者:[Nived V][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/nivedv
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background)
[2]: https://opensource.com/article/21/8/container-fundamentals-2
[3]: https://opensource.com/article/21/8/deep-dive-container-runtimes
[4]: https://opensource.com/sites/default/files/1linuxtechs.png (layers of linux technologies)
[5]: https://creativecommons.org/licenses/by-sa/4.0/
[6]: https://opensource.com/article/19/10/namespaces-and-containers-linux
[7]: https://nivedv.medium.com/container-internals-deep-dive-5cc424957413

View File

@ -0,0 +1,116 @@
[#]: subject: "How to Install Dropbox on Ubuntu Linux"
[#]: via: "https://itsfoss.com/install-dropbox-ubuntu/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
如何在 Ubuntu Linux 上安装 Dropbox
======
Dropbox 是[最受欢迎的云存储服务之一,可用于 Linux][1] 和其他操作系统。
事实上Dropbox 是最早提供原生 Linux 应用的服务之一。它仍然[支持 32 位 Linux 系统][2],这也是一项值得称赞的工作。
在这个初学者的教程中,我将展示在 Ubuntu 上安装 Dropbox 的步骤。这些步骤其实很简单,但有些网站把它弄得不必要的复杂。
### 在 Ubuntu 桌面上安装 Dropbox
让我们来看看安装步骤,一步一步来。
#### 第一步:获取 Ubuntu 的 Dropbox 安装程序
Dropbox 为其安装程序提供 DEB文 件。进入网站的下载页面:
[Dropbox Download][3]
下载相应的 DEB 文件。考虑到你使用的是 64 位的 Ubuntu请获取 64 位版本的 DEB 文件。
![Download the Dropbox installer][4]
#### 第二步:安装 Dropbox 安装程序
你下载的 deb 文件只是 Dropbox 的一个安装程序。实际的 Dropbox 安装稍后开始,类似于[在 Ubuntu 上安装 Steam][5]。
要[安装下载的 deb 文件][6],可以双击它,或者右击并选择用软件安装打开。
![Installing the downloaded Dropbox deb file][7]
它将打开软件中心,你可以点击安装按钮。
![Installing Dropbox deb file][8]
等待安装完成。
#### 第三步:开始安装 Dropbox
现在 Dropbox 安装程序已经安装完毕。按 Windows 键(也叫 super 键),搜索 Dropbox 并点击它。
![Start Dropbox for installation][9]
第一次启动时,它显示两个弹出窗口。一个是关于重启 NautilusUbuntu 中的文件资源管理器),另一个是关于 Dropbox 的安装。
![Starting Dropbox installation][10]
点击 Restart Nautilus/Close在 Nautilus 弹出窗口)或 OK在安装弹出窗口开始实际的 Dropbox 客户端下载和安装。如果 “Nautilus Restart” 在点击关闭按钮时没有关闭,请点击 x 按钮。
等待Dropbox的安装完成。
![Installing Dropbox][11]
哦!需要重新启动 Nautilus因为 Dropbox 增加了一些额外的功能,如在文件资源管理器中显示同步状态。
当 Dropbox 安装完毕,它应该会自动带你到 Dropbox 的登录页面,或者你可以点击顶部的 Dropbox 图标并选择登录选项。
![Sign in to Dropbox after installation][12]
事实上,这就是你今后访问 Dropbox 设置的方式。
#### 第四步:开始在 Ubuntu 上使用 Dropbox
![Sign in into Dropbox][13]
**注意**在你成功登录之前Dropbox 将不会工作。这里有一个问题。免费版的 Dropbox 限制了你可以链接到你的账户的设备数量。**如果你已经有 3 个链接的设备,你应该删除一些你不使用的旧设备。**
当你成功登录后,你应该看到在你的家目录中创建了一个 Dropbox 文件夹,你的云端文件开始出现在这里。
![Dropbox folder is created under home directory][14]
如果你想节省磁盘空间或带宽,你可以进入偏好设置并选择选择性同步选项。选择性同步选项允许你只在本地系统上同步来自 Dropbox 云的选定文件夹。
![Using selective sync in Dropbox][15]
Dropbox 会在每次启动时自动启动。我相信,这是你应该从任何云服务中期待的行为。
这就是你在 Ubuntu 上开始使用 Dropbox 所需要的一切。我希望这个教程对你有帮助。
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-dropbox-ubuntu/
作者:[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://itsfoss.com/cloud-services-linux/
[2]: https://itsfoss.com/32-bit-linux-distributions/
[3]: https://www.dropbox.com/install-linux
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/get-dropbox-for-ubuntu.png?resize=800%2C294&ssl=1
[5]: https://itsfoss.com/install-steam-ubuntu-linux/
[6]: https://itsfoss.com/install-deb-files-ubuntu/
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/dropbox-installer-ubuntu.png?resize=797%2C476&ssl=1
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/installing-dropbox-deb-file.png?resize=800%2C346&ssl=1
[9]: https://itsfoss.com/wp-content/uploads/2021/09/start-drobox-ubuntu.webp
[10]: https://itsfoss.com/wp-content/uploads/2021/09/starting-dropbox-installation-800x599.webp
[11]: https://itsfoss.com/wp-content/uploads/2021/09/installing-dropbox.webp
[12]: https://itsfoss.com/wp-content/uploads/2021/09/sign-in-to-dropbox-after-first-installation.webp
[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/09/sign-in-dropbox.png?resize=800%2C409&ssl=1
[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/dropbox-folder-ubuntu.png?resize=800%2C491&ssl=1
[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/Dropbox-selective-sync.png?resize=800%2C399&ssl=1