mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge branch 'LCTT:master' into master
This commit is contained in:
commit
45f453d8df
@ -0,0 +1,235 @@
|
|||||||
|
[#]: subject: (Brave vs. Firefox: Your Ultimate Browser Choice for Private Web Experience)
|
||||||
|
[#]: via: (https://itsfoss.com/brave-vs-firefox/)
|
||||||
|
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (wxy)
|
||||||
|
[#]: reviewer: (wxy)
|
||||||
|
[#]: publisher: (wxy)
|
||||||
|
[#]: url: (https://linux.cn/article-13736-1.html)
|
||||||
|
|
||||||
|
Brave vs. Firefox:你的私人网络体验的终极浏览器选择
|
||||||
|
======
|
||||||
|
|
||||||
|
![](https://img.linux.net.cn/data/attachment/album/202108/30/223133tqzkg4pjpwwb8u4g.jpg)
|
||||||
|
|
||||||
|
Web 浏览器经过多年的发展,从下载文件到访问成熟的 Web 应用程序,已经有了长足的发展。
|
||||||
|
|
||||||
|
对于很多用户来说,Web 浏览器是他们如今完成工作的唯一需要。
|
||||||
|
|
||||||
|
因此,选择合适的浏览器就成为了一项重要的任务,它可以帮助改善你多年来的工作流程。
|
||||||
|
|
||||||
|
### Brave vs. Firefox
|
||||||
|
|
||||||
|
Brave 和 Mozilla Firefox 是两个最受到关注隐私的用户和开源爱好者欢迎的 Web 浏览器。
|
||||||
|
|
||||||
|
考虑到两者都非常注重隐私和安全,让我们看看它们到底能提供什么,以帮助你决定应该选择哪一个。
|
||||||
|
|
||||||
|
以下是我所使用的比较指标:
|
||||||
|
|
||||||
|
### 用户界面
|
||||||
|
|
||||||
|
用户界面是使用浏览器时的工作流程和体验的最大区别。
|
||||||
|
|
||||||
|
当然,你会有你的个人偏好,但它看起来越容易使用、越轻快、越干净,就越好。
|
||||||
|
|
||||||
|
![Brave 浏览器][12]
|
||||||
|
|
||||||
|
首先,Brave 与 Chrome 和微软 Edge 有着相似的外观和感受。它提供了一种简洁的体验,具有精简的 UI 元素,所有的基本选项都可以通过浏览器菜单访问。
|
||||||
|
|
||||||
|
它也提供了一个暗色主题。恰到好处的动画使得互动成为一种愉快的体验。
|
||||||
|
|
||||||
|
要定制它,你可以选择使用 Chrome Web 商店中的主题。
|
||||||
|
|
||||||
|
说到 Mozilla Firefox,多年来它经历了几次重大的重新设计,其最新的用户界面试图提供与 Chrome 更接近的体验。
|
||||||
|
|
||||||
|
![Firefox 浏览器][13]
|
||||||
|
|
||||||
|
Firefox 浏览器的设计看起来令人印象深刻,并提供了干净利落的用户体验。如果需要的话,你还可以选择一个暗色主题,此外还有其它几个主题可供下载使用。
|
||||||
|
|
||||||
|
这两个 Web 浏览器都能提供良好的用户体验。
|
||||||
|
|
||||||
|
如果你想要一个熟悉的体验,但又具有一丝独特之处,Mozilla Firefox 是一个不错的选择。
|
||||||
|
|
||||||
|
但是,如果你想获得更快捷的体验、更好的动画感受,Brave 更有优势。
|
||||||
|
|
||||||
|
### 性能
|
||||||
|
|
||||||
|
实际上,我发现 Brave 加载网页的速度更快,整体的用户体验感觉很轻快。
|
||||||
|
|
||||||
|
Firefox 浏览器倒不是非常慢,但它绝对感觉比 Brave 慢。
|
||||||
|
|
||||||
|
为了给你一些参考,我还利用 [Basemark][14] 运行了一个基准测试,看看事实上是否真的如此。
|
||||||
|
|
||||||
|
你可以使用其他的浏览器基准测试工具来测试一下,但我用 Basemark 进行了各种测试,所以我们在这篇文章中会用它。
|
||||||
|
|
||||||
|
![Firefox 基准得分][15]
|
||||||
|
|
||||||
|
![Brave 基准得分][16]
|
||||||
|
|
||||||
|
Firefox 浏览器成功获得了 **630** 的得分,而 Brave 以大约 **792** 的得分取得了更好的成绩。
|
||||||
|
|
||||||
|
请注意,这些基准测试是在没有安装任何浏览器扩展程序的情况下,以默认的浏览器设置进行的。
|
||||||
|
|
||||||
|
当然,你的分数可能会有所不同,这取决于你在后台进行的工作和你系统的硬件配置。
|
||||||
|
|
||||||
|
这是我在 **i5-7400、16GB 内存和 GTX 1050ti GPU** 配置的桌面电脑上得到的结果。
|
||||||
|
|
||||||
|
一般来说,与大多数流行的浏览器相比,Brave 浏览器是一个快速的浏览器。
|
||||||
|
|
||||||
|
这两者都占用了相当大的系统资源,而且在一定程度上随着标签数量、访问的网页类型和使用的拦截扩展的种类而变化。
|
||||||
|
|
||||||
|
例如,Brave 在默认情况下会主动阻止广告,但 Firefox 在默认情况下不会阻止显示广告。而且,这也影响了系统资源的使用。
|
||||||
|
|
||||||
|
### 浏览器引擎
|
||||||
|
|
||||||
|
Firefox 浏览器在自己的 Gecko 引擎基础上,使用来自 [servo 研究项目][17] 的组件来进行改进。
|
||||||
|
|
||||||
|
目前,它基本上是一个改进的 Gecko 引擎,其项目名称是随着 Firefox Quantum 的发布而推出的 “Quantum”。
|
||||||
|
|
||||||
|
另一方面,Brave 使用 Chromium 的引擎。
|
||||||
|
|
||||||
|
虽然两者都有足够的能力处理现代 Web 体验,但基于 Chromium 的引擎更受欢迎,Web 开发人员通常会在基于 Chrome 的浏览器上定制他们的网站以获得最佳体验。
|
||||||
|
|
||||||
|
另外,有些服务恰好只支持基于 Chrome 的浏览器。
|
||||||
|
|
||||||
|
### 广告 & 追踪器阻止功能
|
||||||
|
|
||||||
|
![][18]
|
||||||
|
|
||||||
|
正如我之前提到的,Brave 在阻止跟踪器和广告方面非常积极。默认情况下,它已经启用了屏蔽功能。
|
||||||
|
|
||||||
|
Firefox 浏览器也默认启用了增强的隐私保护功能,但并不阻止显示广告。
|
||||||
|
|
||||||
|
如果你想摆脱广告,你得选择火狐浏览器的 “严格隐私保护模式”。
|
||||||
|
|
||||||
|
也就是说,火狐浏览器执行了一些独特的跟踪保护技术,包括“全面 Cookie 保护”,可以为每个网站隔离 Cookie 并防止跨站 Cookie 跟踪。
|
||||||
|
|
||||||
|
![][19]
|
||||||
|
|
||||||
|
这是在 [Firefox 86][20] 中引入的技术,要使用它,你需要启用 “严格隐私保护模式”。
|
||||||
|
|
||||||
|
总的来说,Brave 可能看起来是一个更好的选择,而 Mozilla Firefox 提供了更好的隐私保护功能。
|
||||||
|
|
||||||
|
### 容器
|
||||||
|
|
||||||
|
当你访问 Facebook 时,Firefox 还提供了一种借助容器来隔离网站活动的方法。换句话说,它可以防止 Facebook 跟踪你的站外活动。
|
||||||
|
|
||||||
|
你还可以使用容器来组织你的标签,并在需要时分离会话。
|
||||||
|
|
||||||
|
Brave 没有提供任何类似的功能,但它本身可以阻止跨站追踪器和 cookie。
|
||||||
|
|
||||||
|
### 奖励
|
||||||
|
|
||||||
|
![][21]
|
||||||
|
|
||||||
|
与 Firefox 不同,Brave 通过屏蔽网络上的其他广告来提供自己的广告网络。
|
||||||
|
|
||||||
|
当你选择显示 Brave 的隐私友好型广告时,你会得到可以放到加密货币钱包里的通证奖励,而你可以用这些通证来回馈你喜欢的网站。
|
||||||
|
|
||||||
|
虽然这是摆脱主流广告的一个很好的商业策略,但对于不想要任何形式的广告的用户来说,这可能没有用。
|
||||||
|
|
||||||
|
因此,Brave 以奖励的形式提供了一个替代方案,即使你屏蔽了广告,也可以帮助网站发展。如果这是你欣赏的东西,Brave 将是你的一个好选择。
|
||||||
|
|
||||||
|
### 跨平台可用性
|
||||||
|
|
||||||
|
你会发现 Brave 和 Firefox 都有 Linux、Windows 和 macOS 版本,也有用于 iOS 和 Android 的移动应用程序。
|
||||||
|
|
||||||
|
对于 Linux 用户来说,Firefox 浏览器捆绑在大多数的 Linux 发行版中。而且,你也可以在软件中心里找到它。除此之外,还有一个 [Flatpak][22] 包可用。
|
||||||
|
|
||||||
|
Brave 不能通过默认的软件库和软件中心获得。因此,你需要按照官方的说明来添加私有仓库,然后 [把 Brave 安装在你的 Linux 发行版中][23]。
|
||||||
|
|
||||||
|
### 同步
|
||||||
|
|
||||||
|
通过 Mozilla Firefox,你可以创建一个 Firefox 账户来跨平台同步你的所有数据。
|
||||||
|
|
||||||
|
![][24]
|
||||||
|
|
||||||
|
Brave 也可以让你跨平台同步,但你需要能访问其中一个设备才行。
|
||||||
|
|
||||||
|
![][25]
|
||||||
|
|
||||||
|
因此,Firefox 的同步更方便。
|
||||||
|
|
||||||
|
另外,你可以通过 Firefox 的账户访问它的“虚拟专用网络”、数据泄露监控器、电子邮件中继,以及密码管理器。
|
||||||
|
|
||||||
|
### 服务集成
|
||||||
|
|
||||||
|
从一开始 Firefox 就提供了更多的服务集成,包括 Pocket、“虚拟私有网络”、密码管理器,还有一些新产品,如 Firefox 中继。
|
||||||
|
|
||||||
|
如果你想通过你的浏览器访问这些服务,Firefox 将是你的方便选择。
|
||||||
|
|
||||||
|
虽然 Brave 确实提供了加密货币钱包,但它并不适合所有人。
|
||||||
|
|
||||||
|
![][26]
|
||||||
|
|
||||||
|
同样,如果你喜欢使用 [Brave Search][27],在使用 Brave 浏览器时,由于用户体验的原因,你可能体验会更顺滑。
|
||||||
|
|
||||||
|
### 可定制性 & 安全性
|
||||||
|
|
||||||
|
Firefox 浏览器在可定制性方面大放异彩。你可以通过众多选项来调整体验,也可以控制你的浏览器的隐私/安全。
|
||||||
|
|
||||||
|
自定义的能力使你可以让 Firefox 比 Brave 浏览器更安全。
|
||||||
|
|
||||||
|
而加固 Firefox 浏览器是一个我们将讨论的单独话题。略举一例,[Tor 浏览器][28] 只是一个定制的 Firefox 浏览器。
|
||||||
|
|
||||||
|
然而,这并不意味着 Brave 的安全性更低。总的来说,它是一个安全的浏览器,但你确实可以通过 Firefox 浏览器获得更多的选择。
|
||||||
|
|
||||||
|
### 扩展支持
|
||||||
|
|
||||||
|
毫无疑问,Chrome Web 商店提供了更多的扩展。
|
||||||
|
|
||||||
|
因此,如果你是一个使用大量扩展(或不断尝试新扩展)的人,Brave 明显比 Firefox 更有优势。
|
||||||
|
|
||||||
|
可能 Firefox 的扩展清单不是最大的,但它确实支持大多数的扩展。对于常见的使用情况,你很少能找到一个 Firefox 中没有的扩展。
|
||||||
|
|
||||||
|
### 你应该选择那个?
|
||||||
|
|
||||||
|
如果你希望尽量兼容现代的 Web 体验,并希望有更多的扩展,Brave 浏览器似乎更合适。
|
||||||
|
|
||||||
|
另一方面,Firefox 浏览器是日常浏览的绝佳选择,它具有业界首创的隐私功能,并为不懂技术的用户提供了方便的同步选项。
|
||||||
|
|
||||||
|
在选择它们中的任何一个时会有一些取舍。因此,你需要优先考虑你最想要的东西。
|
||||||
|
|
||||||
|
请在下面的评论中告诉我你的最终选择!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/brave-vs-firefox/
|
||||||
|
|
||||||
|
作者:[Ankush Das][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://itsfoss.com/author/ankush/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: tmp.5yJseRG2rb#ui
|
||||||
|
[2]: tmp.5yJseRG2rb#perf
|
||||||
|
[3]: tmp.5yJseRG2rb#engine
|
||||||
|
[4]: tmp.5yJseRG2rb#ad
|
||||||
|
[5]: tmp.5yJseRG2rb#container
|
||||||
|
[6]: tmp.5yJseRG2rb#reward
|
||||||
|
[7]: tmp.5yJseRG2rb#cp
|
||||||
|
[8]: tmp.5yJseRG2rb#sync
|
||||||
|
[9]: tmp.5yJseRG2rb#service
|
||||||
|
[10]: tmp.5yJseRG2rb#customise
|
||||||
|
[11]: tmp.5yJseRG2rb#extensions
|
||||||
|
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/brave-ui-new.jpg?resize=800%2C450&ssl=1
|
||||||
|
[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/firefox-ui.jpg?resize=800%2C450&ssl=1
|
||||||
|
[14]: https://web.basemark.com
|
||||||
|
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/firefox-basemark.png?resize=800%2C598&ssl=1
|
||||||
|
[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/07/basemark-brave.png?resize=800%2C560&ssl=1
|
||||||
|
[17]: https://servo.org
|
||||||
|
[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/brave-blocker.png?resize=800%2C556&ssl=1
|
||||||
|
[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/firefox-blocker.png?resize=800%2C564&ssl=1
|
||||||
|
[20]: https://news.itsfoss.com/firefox-86-release/
|
||||||
|
[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/07/brave-rewards.png?resize=800%2C560&ssl=1
|
||||||
|
[22]: https://itsfoss.com/what-is-flatpak/
|
||||||
|
[23]: https://itsfoss.com/brave-web-browser/
|
||||||
|
[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/firefox-sync.png?resize=800%2C651&ssl=1
|
||||||
|
[25]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/brave-sync.png?resize=800%2C383&ssl=1
|
||||||
|
[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/brave-crypto-wallet.png?resize=800%2C531&ssl=1
|
||||||
|
[27]: https://itsfoss.com/brave-search-features/
|
||||||
|
[28]: https://itsfoss.com/install-tar-browser-linux/
|
@ -3,49 +3,47 @@
|
|||||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||||
[#]: collector: "lujun9972"
|
[#]: collector: "lujun9972"
|
||||||
[#]: translator: "geekpi"
|
[#]: translator: "geekpi"
|
||||||
[#]: reviewer: " "
|
[#]: reviewer: "wxy"
|
||||||
[#]: publisher: " "
|
[#]: publisher: "wxy"
|
||||||
[#]: url: " "
|
[#]: url: "https://linux.cn/article-13729-1.html"
|
||||||
|
|
||||||
用 ncdu 检查 Linux 中的可用磁盘空间
|
用 ncdu 检查 Linux 中的可用磁盘空间
|
||||||
======
|
======
|
||||||
用 ncdu Linux 命令获得关于磁盘使用的交互式报告。
|
|
||||||
![Check disk usage][1]
|
|
||||||
|
|
||||||
计算机用户多年来往往积累了大量的数据,无论是重要的个人项目、数码照片、视频、音乐还是代码库。虽然现在的硬盘往往相当大,但有时你必须退一步,评估一下你在硬盘上实际存储了什么。经典的 Linux 命令 [`df`][2] 和 [`du`][3] 是快速了解硬盘上的内容的方法,它们提供了一个可靠的报告,易于解析和处理。这对脚本和处理来说是很好的,但人的大脑对数百行的原始数据并不总是反应良好。认识到这一点,`ncdu` 命令旨在提供一份关于你在硬盘上使用的空间的交互式报告。
|
> 用 ncdu Linux 命令获得关于磁盘使用的交互式报告。
|
||||||
|
|
||||||
|
![](https://img.linux.net.cn/data/attachment/album/202108/29/095819e87oz4ox6p40t6q0.jpg)
|
||||||
|
|
||||||
|
计算机用户多年来往往积累了大量的数据,无论是重要的个人项目、数码照片、视频、音乐还是代码库。虽然现在的硬盘往往相当大,但有时你必须退一步,评估一下你在硬盘上实际存储了什么。经典的 Linux 命令 [df][2] 和 [du][3] 是快速了解硬盘上的内容的方法,它们提供了一个可靠的报告,易于解析和处理。这对脚本和处理来说是很好的,但人的大脑对数百行的原始数据并不总是反应良好。认识到这一点,`ncdu` 命令旨在提供一份关于你在硬盘上使用的空间的交互式报告。
|
||||||
|
|
||||||
### 在 Linux 上安装 ncdu
|
### 在 Linux 上安装 ncdu
|
||||||
|
|
||||||
在 Linux 上,你可以从你的软件仓库安装 `ncdu`。例如,在 Fedora 或 CentOS 上:
|
在 Linux 上,你可以从你的软件仓库安装 `ncdu`。例如,在 Fedora 或 CentOS 上:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
`$ sudo dnf install ncdu`
|
$ sudo dnf install ncdu
|
||||||
```
|
```
|
||||||
|
|
||||||
在 BSD 上,你可以使用 [pkgsrc][4]。
|
在 BSD 上,你可以使用 [pkgsrc][4]。
|
||||||
|
|
||||||
在 macOS 上,你可以从 [MacPorts][5] 或 [HomeBrew][6] 安装。
|
在 macOS 上,你可以从 [MacPorts][5] 或 [HomeBrew][6] 安装。
|
||||||
|
|
||||||
另外,你也可以[从源码编译 ncdu][7]。
|
另外,你也可以 [从源码编译 ncdu][7]。
|
||||||
|
|
||||||
### 使用 ncdu
|
### 使用 ncdu
|
||||||
|
|
||||||
ncdu 界面使用 ncurses 库,它将你的终端窗口变成一个基本的图形应用,所以你可以使用方向键来浏览菜单。
|
`ncdu` 界面使用 ncurses 库,它将你的终端窗口变成一个基本的图形应用,所以你可以使用方向键来浏览菜单。
|
||||||
|
|
||||||
![ncdu interface][8]
|
![ncdu interface][8]
|
||||||
|
|
||||||
CC BY-SA Seth Kenlon
|
|
||||||
|
|
||||||
这是 `ncdu` 的主要吸引力之一,也是它与最初的 `du` 命令不同的地方。
|
这是 `ncdu` 的主要吸引力之一,也是它与最初的 `du` 命令不同的地方。
|
||||||
|
|
||||||
要获得一个目录的完整列表,启动 `ncdu`。它默认为当前目录。
|
要获得一个目录的完整列表,启动 `ncdu`。它默认为当前目录。
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ ncdu
|
$ ncdu
|
||||||
ncdu 1.16 ~ Use the arrow keys to navigate, press ? for help
|
ncdu 1.16 ~ Use the arrow keys to navigate, press ? for help
|
||||||
\--- /home/tux -----------------------------------------------
|
--- /home/tux -----------------------------------------------
|
||||||
22.1 GiB [##################] /.var
|
22.1 GiB [##################] /.var
|
||||||
19.0 GiB [############### ] /Iso
|
19.0 GiB [############### ] /Iso
|
||||||
10.0 GiB [######## ] /.local
|
10.0 GiB [######## ] /.local
|
||||||
@ -58,7 +56,7 @@ ncdu 1.16 ~ Use the arrow keys to navigate, press ? for help
|
|||||||
[...]
|
[...]
|
||||||
```
|
```
|
||||||
|
|
||||||
这个列表首先显示了最大的目录(在这个例子中,那是 `~/.var` 目录,充满了很多的 flatpaks)。
|
这个列表首先显示了最大的目录(在这个例子中,那是 `~/.var` 目录,塞满了很多的 flatpak 包)。
|
||||||
|
|
||||||
使用键盘上的方向键,你可以浏览列表,深入到一个目录,这样你就可以更好地了解什么东西占用了最大的空间。
|
使用键盘上的方向键,你可以浏览列表,深入到一个目录,这样你就可以更好地了解什么东西占用了最大的空间。
|
||||||
|
|
||||||
@ -66,17 +64,15 @@ ncdu 1.16 ~ Use the arrow keys to navigate, press ? for help
|
|||||||
|
|
||||||
你可以在启动 `ncdu` 时提供任意一个文件夹的路径:
|
你可以在启动 `ncdu` 时提供任意一个文件夹的路径:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
`$ ncdu ~/chromiumos`
|
$ ncdu ~/chromiumos
|
||||||
```
|
```
|
||||||
|
|
||||||
### 排除目录
|
### 排除目录
|
||||||
|
|
||||||
默认情况下,`ncdu` 包括一切可以包括的东西,包括符号链接和伪文件系统,如 procfs 和 sysfs。你可以用 `--exclude-kernfs` 来排除这些。
|
默认情况下,`ncdu` 包括一切可以包括的东西,包括符号链接和伪文件系统,如 procfs 和 sysfs。你可以用 `--exclude-kernfs` 来排除这些。
|
||||||
|
|
||||||
你可以使用 --exclude 选项排除任意文件和目录,并在后面加上一个匹配模式。
|
你可以使用 `--exclude` 选项排除任意文件和目录,并在后面加上一个匹配模式。
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ ncdu --exclude ".var"
|
$ ncdu --exclude ".var"
|
||||||
@ -99,17 +95,14 @@ $ ncdu --exclude-from myexcludes.txt /home/tux
|
|||||||
|
|
||||||
### 颜色方案
|
### 颜色方案
|
||||||
|
|
||||||
你可以用 `--color dark` 选项给 ncdu 添加一些颜色。
|
你可以用 `--color dark` 选项给 `ncdu` 添加一些颜色。
|
||||||
|
|
||||||
![ncdu color scheme][9]
|
![ncdu color scheme][9]
|
||||||
|
|
||||||
CC BY-SA Seth Kenlon
|
|
||||||
|
|
||||||
### 包括符号链接
|
### 包括符号链接
|
||||||
|
|
||||||
`ncdu` 输出按字面意思处理符号链接,这意味着一个指向 9GB 文件的符号链接只占用 40 个字节。
|
`ncdu` 输出按字面意思处理符号链接,这意味着一个指向 9GB 文件的符号链接只占用 40 个字节。
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ ncdu ~/Iso
|
$ ncdu ~/Iso
|
||||||
9.3 GiB [##################] CentOS-Stream-8-x86_64-20210427-dvd1.iso
|
9.3 GiB [##################] CentOS-Stream-8-x86_64-20210427-dvd1.iso
|
||||||
@ -118,7 +111,6 @@ $ ncdu ~/Iso
|
|||||||
|
|
||||||
你可以用 `--follow-symlinks` 选项强制 ncdu 跟踪符号链接:
|
你可以用 `--follow-symlinks` 选项强制 ncdu 跟踪符号链接:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ ncdu --follow-symlinks ~/Iso
|
$ ncdu --follow-symlinks ~/Iso
|
||||||
9.3 GiB [##################] fake.iso
|
9.3 GiB [##################] fake.iso
|
||||||
@ -136,7 +128,7 @@ via: https://opensource.com/article/21/8/ncdu-check-free-disk-space-linux
|
|||||||
作者:[Seth Kenlon][a]
|
作者:[Seth Kenlon][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[geekpi](https://github.com/geekpi)
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
99
published/20210821 How to set up your printer on Linux.md
Normal file
99
published/20210821 How to set up your printer on Linux.md
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
[#]: subject: "How to set up your printer on Linux"
|
||||||
|
[#]: via: "https://opensource.com/article/21/8/add-printer-linux"
|
||||||
|
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: "fisherue"
|
||||||
|
[#]: reviewer: "wxy"
|
||||||
|
[#]: publisher: "wxy"
|
||||||
|
[#]: url: "https://linux.cn/article-13740-1.html"
|
||||||
|
|
||||||
|
如何在 Linux 系统设置打印机
|
||||||
|
======
|
||||||
|
|
||||||
|
> 如果系统没有自动检测到你的打印机,这篇文章教你如何在 Linux 系统手动添加打印机。
|
||||||
|
|
||||||
|
![](https://img.linux.net.cn/data/attachment/album/202109/01/104541gvvxvriei677o76v.jpg)
|
||||||
|
|
||||||
|
即使未来已来,<ruby>电子墨水<rt>e-ink</rt></ruby>和 AR 技术可以现实应用,我们还是会用到打印机的。打印机制造商还不能做到让自己的专利打印机可以与各种计算机完全标准化传递信息,以至于我们需要各种打印机驱动程序,在任何操作系统上都是如此。电子电气工程师协会信息科学与技术处(IEEE-ISTO)下属的打印机工作组(PWG)和开放打印技术组织(OpenPrinting.org)长期合作致力于让人们可以(使用任何型号打印机)轻松打印。带来的便利就是,很多打印机可以不需要用户进行配置就可以自动被识别使用。
|
||||||
|
|
||||||
|
如果系统没有自动检测到你的打印机,你可以在这篇文章中找到如何在 Linux 系统手动添加打印机。文中假定你使用的是 GNOME 图形桌面系统,其设置流程同样适用于 KDE 或其他大多数桌面系统。
|
||||||
|
|
||||||
|
### 打印机驱动程序
|
||||||
|
|
||||||
|
在你尝试用打印机打印文件时,要先确认你的 Linux 系统上是不是已经安装了更新的打印机驱动程序。
|
||||||
|
|
||||||
|
可以尝试安装的打印机驱动程序有三大类:
|
||||||
|
|
||||||
|
* 作为安装包提供的,捆绑在你的 Linux 系统上的开源 [Gutenprint 驱动程序][2]
|
||||||
|
* 打印机制造商提供的专用驱动程序
|
||||||
|
* 第三方开发提供的打印机驱动程序
|
||||||
|
|
||||||
|
开源打印机驱动程序库可以驱动 700 多种打印机,值得安装,这里面可能就有你的打印机的驱动,说不定可以自动设置好你的打印机(,你就可以使用它了)。
|
||||||
|
|
||||||
|
### 安装开源驱动程序包(库)
|
||||||
|
|
||||||
|
有些 Linux 发行版已经预装了开源打印机驱动程序包,如果没有,你可以用包管理器来安装。比如说,在 Fedora、CentOS、Magela 等类似发行版的 Linux 系统上,执行下面命令来安装:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo dnf install gutenprint
|
||||||
|
```
|
||||||
|
|
||||||
|
惠普(HP)系列的打印机,还需要安装惠普的 Linux 图形及打印系统软件包(HPLIP)。如在 Debian、Linux Mint 等类似的系统上,可以使用下面的命令:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo apt install hplip
|
||||||
|
```
|
||||||
|
|
||||||
|
### 安装制造商提供的驱动程序
|
||||||
|
|
||||||
|
很多时候因为打印机制造商使用了非标准的接口协议,这种情况开源打印机驱动程序就不能驱动打印机。另外的情况就是,开源驱动程序可以驱动打印机工作,但是会缺少供应商特有的某些性能。这些情况,你需要访问制造商的网站,找到适合你的打印机型号的 Linux 平台驱动。安装过程各异,仔细阅读安装指南逐步安装。
|
||||||
|
|
||||||
|
如果你的打印机根本不被厂商支持,你或许也只能尝试第三方提供的该型号打印机的驱动软件了。这类第三方驱动程序不是开源的,但大多数打印机的专用驱动程序也不是。如果你需要额外花费从供应商那里获取帮助服务才能安装好驱动并使用你的打印机,那是很心疼,或者你索性把这台打印机扔掉,至少你知道下次再也不会购买这个品牌的打印机了。
|
||||||
|
|
||||||
|
### 通用打印驱动系统(CUPS)
|
||||||
|
|
||||||
|
<ruby>通用打印驱动系统<rt>Common Unix Printing System</rt></ruby>(CUPS)是由 Easy Software Products 公司于 1997 年开发的,2007 年被苹果公司收购。这是 Linux 平台打印的开源基础软件包,大多数现代发行版都为它提供了一个定制化的界面。得益于 CUPS 技术,你可以发现通过 USB 接口连接到电脑的打印机,甚至连接在同一网络的共享打印机。
|
||||||
|
|
||||||
|
一旦你安装了需要的驱动程序包,你就能手工添加你的打印机了。首先,把打印机连接到运行的电脑上,并打开打印机电源。然后从“活动”屏幕或者应用列表中找到并打开“打印机”设置。
|
||||||
|
|
||||||
|
![printer settings][4]
|
||||||
|
|
||||||
|
基于你已经安装的驱动包,你的 Linux 系统有可能自动检测识别到你的打印机型号,不需要额外的设置就可以使用你的打印机了。
|
||||||
|
|
||||||
|
![printer settings][5]
|
||||||
|
|
||||||
|
一旦你在列表中找到你的打印机型号,设置使用这个驱动,恭喜你就可以在 Linux 系统上用它打印了。
|
||||||
|
|
||||||
|
(如果你的打印机没有被自动识别,)你需要自行添加打印机。在“打印机”设置界面,点击右上角的解锁按钮,输入管理用户密码,按钮转换成“添加打印机”按钮。
|
||||||
|
|
||||||
|
然后点击这个“添加打印机”按钮,电脑会搜索已经连接的本地打印机型号并匹配相应驱动程序。如果要添加网络共享打印机,在搜索框输入打印机或者其服务器机的 IP 地址。
|
||||||
|
|
||||||
|
![searching for a printer][6]
|
||||||
|
|
||||||
|
选中你想添加的打印机型号,点击“添加”按钮把打印机驱动加入系统,就可以使用它了。
|
||||||
|
|
||||||
|
### 在 Linux 系统上打印
|
||||||
|
|
||||||
|
在 Linux 系统上打印很容易,不管你是在使用本地打印机还是网络打印机。如果你计划购买打印机,建议查看开放打印技术组织的(可支持打印机)数据库([OpenPrinting.org][7]),看看你想购买的打印机是不是有相应的开源驱动程序。如果你已经拥有一台打印机,你现在也知道怎样在你的 Linux 系统上使用你的打印机了。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/8/add-printer-linux
|
||||||
|
|
||||||
|
作者:[Seth Kenlon][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[fisherue](https://github.com/fisherue)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/seth
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/happy-printer.png?itok=9J44YaDs "printing on Linux"
|
||||||
|
[2]: http://gimp-print.sourceforge.net/
|
||||||
|
[3]: https://www.turboprint.info/
|
||||||
|
[4]: https://opensource.com/sites/default/files/system-settings-printer_0.png "printer settings"
|
||||||
|
[5]: https://opensource.com/sites/default/files/settings-printer.png "printer settings"
|
||||||
|
[6]: https://opensource.com/sites/default/files/printer-search.png "searching for a printer"
|
||||||
|
[7]: http://www.openprinting.org/printers/
|
||||||
|
|
@ -0,0 +1,121 @@
|
|||||||
|
[#]: subject: "How to Monitor Log Files in Real Time in Linux [Desktop and Server]"
|
||||||
|
[#]: via: "https://www.debugpoint.com/2021/08/monitor-log-files-real-time/"
|
||||||
|
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: "geekpi"
|
||||||
|
[#]: reviewer: "wxy"
|
||||||
|
[#]: publisher: "wxy"
|
||||||
|
[#]: url: "https://linux.cn/article-13733-1.html"
|
||||||
|
|
||||||
|
如何在 Linux 中实时监控日志文件
|
||||||
|
======
|
||||||
|
|
||||||
|
> 本教程解释了如何实时监控 Linux 日志文件(桌面、服务器或应用),以进行诊断和故障排除。
|
||||||
|
|
||||||
|
![](https://img.linux.net.cn/data/attachment/album/202108/30/082607bmf6nlud6sdy49rm.jpg)
|
||||||
|
|
||||||
|
当你在你的 Linux 桌面、服务器或任何应用中遇到问题时,你会首先查看各自的日志文件。日志文件通常是来自应用的文本和信息流,上面有一个时间戳。它可以帮助你缩小具体的实例,并帮助你找到任何问题的原因。它也可以帮助从网络上获得援助。
|
||||||
|
|
||||||
|
一般来说,所有的日志文件都位于 `/var/log` 中。这个目录包含以 `.log` 为扩展名的特定应用、服务的日志文件,它还包含单独的其他目录,这些目录包含其日志文件。
|
||||||
|
|
||||||
|
![log files in var-log][1]
|
||||||
|
|
||||||
|
所以说,如果你想监控一堆日志文件或特定的日志文件。这里有一些你可以做到方法。
|
||||||
|
|
||||||
|
### 实时监控 Linux 日志文件
|
||||||
|
|
||||||
|
#### 使用 tail 命令
|
||||||
|
|
||||||
|
使用 `tail` 命令是实时跟踪日志文件的最基本方法。特别是,如果你所在的服务器只有一个终端,没有 GUI。这是很有帮助的。
|
||||||
|
|
||||||
|
比如:
|
||||||
|
|
||||||
|
```
|
||||||
|
tail /path/to/log/file
|
||||||
|
```
|
||||||
|
|
||||||
|
![Monitoring multiple log files via tail][2]
|
||||||
|
|
||||||
|
使用开关 `-f` 来跟踪日志文件,它是实时更新的。例如,如果你想跟踪 `syslog`,你可以使用以下命令:
|
||||||
|
|
||||||
|
```
|
||||||
|
tail -f /var/log/syslog
|
||||||
|
```
|
||||||
|
|
||||||
|
你可以用一个命令监控多个日志文件,使用:
|
||||||
|
|
||||||
|
```
|
||||||
|
tail -f /var/log/syslog /var/log/dmesg
|
||||||
|
```
|
||||||
|
|
||||||
|
如果你想监控 http 或 sftp 或任何服务器,你也可以在这个命令中监控它们各自的日志文件。
|
||||||
|
|
||||||
|
记住,上述命令需要管理员权限。
|
||||||
|
|
||||||
|
#### 使用 lnav(日志文件浏览器)
|
||||||
|
|
||||||
|
![lnav Running][3]
|
||||||
|
|
||||||
|
`lnav` 是一个很好的工具,你可以用它来通过彩色编码的信息以更有条理的方式监控日志文件。在 Linux 系统中,它不是默认安装的。你可以用下面的命令来安装它:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt install lnav ### Ubuntu
|
||||||
|
sudo dnf install lnav ### Fedora
|
||||||
|
```
|
||||||
|
|
||||||
|
好的是,如果你不想安装它,你可以直接下载其预编译的可执行文件,然后在任何地方运行。甚至从 U 盘上也可以。它不需要设置,而且有很多功能。使用 `lnav`,你可以通过 SQL 查询日志文件,以及其他很酷的功能,你可以在它的 [官方网站][4] 上了解。
|
||||||
|
|
||||||
|
一旦安装,你可以简单地用管理员权限从终端运行 `lnav`,它将默认显示 `/var/log` 中的所有日志并开始实时监控。
|
||||||
|
|
||||||
|
#### 关于 systemd 的 journalctl 说明
|
||||||
|
|
||||||
|
今天所有的现代 Linux 发行版大多使用 systemd。systemd 提供了运行 Linux 操作系统的基本框架和组件。systemd 通过 `journalctl` 提供日志服务,帮助管理所有 systemd 服务的日志。你还可以通过以下命令实时监控各个 systemd 服务和日志。
|
||||||
|
|
||||||
|
```
|
||||||
|
journalctl -f
|
||||||
|
```
|
||||||
|
|
||||||
|
下面是一些具体的 `journalctl` 命令,可以在一些情况下使用。你可以将这些命令与上面的 `-f` 开关结合起来,开始实时监控。
|
||||||
|
|
||||||
|
* 对紧急系统信息,使用:
|
||||||
|
```
|
||||||
|
journalctl -p 0
|
||||||
|
```
|
||||||
|
* 显示带有解释的错误:
|
||||||
|
```
|
||||||
|
journalctl -xb -p 3
|
||||||
|
```
|
||||||
|
* 使用时间控制来过滤输出:
|
||||||
|
```
|
||||||
|
journalctl --since "2020-12-04 06:00:00"
|
||||||
|
journalctl --since "2020-12-03" --until "2020-12-05 03:00:00"
|
||||||
|
journalctl --since yesterday
|
||||||
|
journalctl --since 09:00 --until "1 hour ago"
|
||||||
|
```
|
||||||
|
|
||||||
|
如果你想了解更多关于 `journalctl` 的细节,我已经写了一个 [指南][6]。
|
||||||
|
|
||||||
|
### 结束语
|
||||||
|
|
||||||
|
我希望这些命令和技巧能帮助你找出桌面或服务器问题/错误的根本原因。对于更多的细节,你可以随时参考手册,摆弄各种开关。如果你对这篇文章有什么意见或看法,请在下面的评论栏告诉我。
|
||||||
|
|
||||||
|
加油。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.debugpoint.com/2021/08/monitor-log-files-real-time/
|
||||||
|
|
||||||
|
作者:[Arindam][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://www.debugpoint.com/author/admin1/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/log-files-in-var-log-1024x312.jpeg
|
||||||
|
[2]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/Monitoring-multiple-log-files-via-tail-1024x444.jpeg
|
||||||
|
[3]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/lnav-Running-1024x447.jpeg
|
||||||
|
[4]: https://lnav.org/features
|
||||||
|
[6]: https://www.debugpoint.com/2020/12/systemd-journalctl/
|
@ -0,0 +1,105 @@
|
|||||||
|
[#]: subject: "Access your iPhone on Linux with this open source tool"
|
||||||
|
[#]: via: "https://opensource.com/article/21/8/libimobiledevice-iphone-linux"
|
||||||
|
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: "geekpi"
|
||||||
|
[#]: reviewer: "wxy"
|
||||||
|
[#]: publisher: "wxy"
|
||||||
|
[#]: url: "https://linux.cn/article-13737-1.html"
|
||||||
|
|
||||||
|
用这个开源工具在 Linux 上访问你的 iPhone
|
||||||
|
======
|
||||||
|
|
||||||
|
> 通过使用 Libimobiledevice 从 Linux 与 iOS 设备进行通信。
|
||||||
|
|
||||||
|
![](https://img.linux.net.cn/data/attachment/album/202108/31/092907bc26qep3ekc73czl.jpg)
|
||||||
|
|
||||||
|
iPhone 和 iPad 绝不是开源的,但它们是流行的设备。许多拥有 iOS 备的人恰好也在使用大量的开源软件,包括 Linux。Windows 和 macOS 的用户可以通过使用苹果公司提供的软件与 iOS 设备通信,但苹果公司不支持 Linux 用户。开源程序员早在 2007 年(就在 iPhone 发布一年后)就以 Libimobiledevice(当时叫 libiphone)来拯救了人们,这是一个与 iOS 通信的跨平台解决方案。它可以在 Linux、Android、Arm 系统(如树莓派)、Windows、甚至 macOS 上运行。
|
||||||
|
|
||||||
|
Libimobiledevice 是用 C 语言编写的,使用原生协议与 iOS 设备上运行的服务进行通信。它不需要苹果公司的任何库,所以它完全是自由而开源的。
|
||||||
|
|
||||||
|
Libimobiledevice 是一个面向对象的 API,它捆绑了许多便于你使用的终端工具。该库支持苹果从最早到其最新的型号的 iOS 设备。这是多年来研究和开发的结果。该项目中的应用包括 `usbmuxd`、`ideviceinstaller`、`idevicerestore`、`ifuse`、`libusbmuxd`、`libplist`、`libirecovery` 和 `libideviceactivation`。
|
||||||
|
|
||||||
|
### 在 Linux 上安装 Libimobiledevice
|
||||||
|
|
||||||
|
在 Linux 上,你可能已经默认安装了 `libimobiledevice`。你可以通过你的软件包管理器或应用商店找到,或者通过运行项目中包含的一个命令:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ifuse --help
|
||||||
|
```
|
||||||
|
|
||||||
|
你可以用你的包管理器安装 `libimobiledevice`。例如,在 Fedora 或 CentOS 上:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo dnf install libimobiledevice ifuse usbmuxd
|
||||||
|
```
|
||||||
|
|
||||||
|
在 Debian 和 Ubuntu 上:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo apt install usbmuxd libimobiledevice6 libimobiledevice-utils
|
||||||
|
```
|
||||||
|
|
||||||
|
或者,你可以从源代码 [下载][2] 并安装 `libimobiledevice`。
|
||||||
|
|
||||||
|
### 连接你的设备
|
||||||
|
|
||||||
|
当你安装了所需的软件包,将你的 iOS 设备连接到你的电脑。
|
||||||
|
|
||||||
|
为你的 iOS 设备建立一个目录作为挂载点。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ mkdir ~/iPhone
|
||||||
|
```
|
||||||
|
|
||||||
|
接下来,挂载设备:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ifuse ~/iPhone
|
||||||
|
```
|
||||||
|
|
||||||
|
你的设备提示你,是否信任你用来访问它的电脑。
|
||||||
|
|
||||||
|
![iphone prompts to trust the computer][3]
|
||||||
|
|
||||||
|
*图 1:iPhone 提示你要信任该电脑。*
|
||||||
|
|
||||||
|
信任问题解决后,你会在桌面上看到新的图标。
|
||||||
|
|
||||||
|
![iphone icons appear on desktop][4]
|
||||||
|
|
||||||
|
*图 2:iPhone 的新图标出现在桌面上。*
|
||||||
|
|
||||||
|
点击 “iPhone” 图标,显示出你的 iPhone 的文件夹结构。
|
||||||
|
|
||||||
|
![iphone folder structure displayed][5]
|
||||||
|
|
||||||
|
*图 3:显示了 iPhone 的文件夹结构。*
|
||||||
|
|
||||||
|
我通常最常访问的文件夹是 `DCIM`,那里存放着我的 iPhone 照片。有时我在写文章时使用这些照片,有时有一些照片我想用 GIMP 等开源应用来增强。可以直接访问这些图片,而不是通过电子邮件把它们发给我自己,这是使用 `libimobiledevice` 工具的好处之一。我可以把这些文件夹中的任何一个复制到我的 Linux 电脑上。我也可以在 iPhone 上创建文件夹并删除它们。
|
||||||
|
|
||||||
|
### 发现更多
|
||||||
|
|
||||||
|
[Martin Szulecki][6] 是该项目的首席开发者。该项目正在寻找开发者加入他们的 [社区][7]。Libimobiledevice 可以改变你使用外设的方式,而无论你在什么平台上。这是开源的又一次胜利,这意味着它是所有人的胜利。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/8/libimobiledevice-iphone-linux
|
||||||
|
|
||||||
|
作者:[Don Watkins][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/don-watkins
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_mobile_phone.png?itok=RqVtvxkd (A person looking at a phone)
|
||||||
|
[2]: https://github.com/libimobiledevice/libimobiledevice/
|
||||||
|
[3]: https://opensource.com/sites/default/files/1trust_0.png
|
||||||
|
[4]: https://opensource.com/sites/default/files/2docks.png
|
||||||
|
[5]: https://opensource.com/sites/default/files/2iphoneicon.png
|
||||||
|
[6]: https://github.com/FunkyM
|
||||||
|
[7]: https://libimobiledevice.org/#community
|
@ -3,23 +3,24 @@
|
|||||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||||
[#]: collector: "lujun9972"
|
[#]: collector: "lujun9972"
|
||||||
[#]: translator: "unigeorge"
|
[#]: translator: "unigeorge"
|
||||||
[#]: reviewer: " "
|
[#]: reviewer: "wxy"
|
||||||
[#]: publisher: " "
|
[#]: publisher: "wxy"
|
||||||
[#]: url: " "
|
[#]: url: "https://linux.cn/article-13730-1.html"
|
||||||
|
|
||||||
如何在 Bash shell 脚本中解析命令行选项
|
如何在 Bash shell 脚本中解析命令行选项
|
||||||
======
|
======
|
||||||
把选项交给你的 shell 脚本吧。
|
|
||||||
![Terminal commands][1]
|
|
||||||
|
|
||||||
终端命令通常具有 [<ruby>选项<rt>options or switches</rt></ruby>][2] 功能,用户可以使用选项来修改命令的执行方式。关于命令行接口的 [POSIX 规范][3] 中就对选项做出了规范,这也是基于最早的 UNIX 应用程序建立的一个由来已久的约定,因此你在创建自己的命令时,最好知道如何将选项包含进 [Bash 脚本][4] 中。
|
> 给你的 shell 脚本添加选项。
|
||||||
|
|
||||||
与大多数语言一样,有若干种方法可以解决 Bash 中解析选项的问题。但直到今天,我最喜欢的方法仍然是我从 Patrick Volkerding 的 Slackware 构建脚本中学到的方法,当我第一次得知 Linux 并勇于探索操作系统附带的纯文本文件时,它就是我关于 shell 脚本的引路人。
|
![](https://img.linux.net.cn/data/attachment/album/202108/29/110849lvhr1bjg1r43sfcx.jpg)
|
||||||
|
|
||||||
|
终端命令通常具有 [选项或开关][2],用户可以使用它们来修改命令的执行方式。关于命令行界面的 [POSIX 规范][3] 中就对选项做出了规范,这也是最早的 UNIX 应用程序建立的一个由来已久的惯例,因此你在创建自己的命令时,最好知道如何将选项包含进 [Bash 脚本][4] 中。
|
||||||
|
|
||||||
|
与大多数语言一样,有若干种方法可以解决 Bash 中解析选项的问题。但直到今天,我最喜欢的方法仍然是我从 Patrick Volkerding 的 Slackware 构建脚本中学到的方法,当我第一次发现 Linux 并敢于冒险探索操作系统所附带的纯文本文件时,这些脚本就是我的 shell 脚本的引路人。
|
||||||
|
|
||||||
### Bash 中的选项解析
|
### Bash 中的选项解析
|
||||||
|
|
||||||
在 Bash 中解析选项的策略是循环遍历传递给 shell 脚本的所有参数,确定它们是否为选项,然后转移到下一个参数。重复这个过程,直到没有选项为止。
|
在 Bash 中解析选项的策略是循环遍历所有传递给 shell 脚本的参数,确定它们是否是一个选项,然后转向下一个参数。重复这个过程,直到没有选项为止。
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
@ -38,7 +39,7 @@ echo $ALPHA
|
|||||||
|
|
||||||
在这段代码中,我创建了一个 `while` 循环,它会一直进行循环操作,直到处理完所有参数。`if` 语句会试着将在第一个位置(`$1`)中找到的参数与 `--alpha` 或 `-a` 匹配。(此处的待匹配项是任意选项名称,并没有特殊意义。在实际的脚本中,你可以使用 `--verbose` 和 `-v` 来触发详细输出)。
|
在这段代码中,我创建了一个 `while` 循环,它会一直进行循环操作,直到处理完所有参数。`if` 语句会试着将在第一个位置(`$1`)中找到的参数与 `--alpha` 或 `-a` 匹配。(此处的待匹配项是任意选项名称,并没有特殊意义。在实际的脚本中,你可以使用 `--verbose` 和 `-v` 来触发详细输出)。
|
||||||
|
|
||||||
`shift` 关键字会使所有参数向后移动一位,这样位置 2(`$2`)的参数移动到位置 1(`$1`)。处理完所有参数后会触发 else 语句,进而中断 while 循环。
|
`shift` 关键字会使所有参数位移一位,这样位置 2(`$2`)的参数移动到位置 1(`$1`)。处理完所有参数后会触发 `else` 语句,进而中断 `while` 循环。
|
||||||
|
|
||||||
在脚本的末尾,`$ALPHA` 的值会输出到终端。
|
在脚本的末尾,`$ALPHA` 的值会输出到终端。
|
||||||
|
|
||||||
@ -106,7 +107,7 @@ bar
|
|||||||
|
|
||||||
有一些选项需要传入参数。比如,你可能希望允许用户设置诸如颜色或图形分辨率之类的属性,或者将应用程序指向自定义配置文件。
|
有一些选项需要传入参数。比如,你可能希望允许用户设置诸如颜色或图形分辨率之类的属性,或者将应用程序指向自定义配置文件。
|
||||||
|
|
||||||
要在 Bash 中实现这一点,你仍然可以像使用布尔选项一样使用 `shift` 关键字,但参数需要向后移动两位而不是一位。
|
要在 Bash 中实现这一点,你仍然可以像使用布尔开关一样使用 `shift` 关键字,但参数需要位移两位而不是一位。
|
||||||
|
|
||||||
```
|
```
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
@ -133,7 +134,7 @@ for i in ${ARG[@]}; do
|
|||||||
done
|
done
|
||||||
```
|
```
|
||||||
|
|
||||||
在这段代码中,我添加了一个 `elif` 子句来将每个参数与 `--config` 和 `-c` 进行比较。如果匹配,名为 `CONFIG` 的变量的值就设置为下一个参数的值(这就表示 `--config` 选项需要一个参数)。所有参数都后移两位:其中一位是跳过 `--config` 或 `-c`,另一位是跳过其参数。与上节一样,循环重复直到没有匹配的参数。
|
在这段代码中,我添加了一个 `elif` 子句来将每个参数与 `--config` 和 `-c` 进行比较。如果匹配,名为 `CONFIG` 的变量的值就设置为下一个参数的值(这就表示 `--config` 选项需要一个参数)。所有参数都位移两位:其中一位是跳过 `--config` 或 `-c`,另一位是跳过其参数。与上节一样,循环重复直到没有匹配的参数。
|
||||||
|
|
||||||
下面是新版脚本的测试:
|
下面是新版脚本的测试:
|
||||||
|
|
||||||
@ -150,7 +151,7 @@ baz
|
|||||||
|
|
||||||
### Bash 让选项解析变得简单
|
### Bash 让选项解析变得简单
|
||||||
|
|
||||||
还有一些其他方法也可以解析 Bash 中的选项。你可以交替使用 `case` 语句或 `getopt` 命令。无论使用什么方法,用户选项都是应用程序的重要功能,而 Bash 让解析选项成为了一件简单的事。
|
还有一些其他方法也可以解析 Bash 中的选项。你可以替换使用 `case` 语句或 `getopt` 命令。无论使用什么方法,给你的用户提供选项都是应用程序的重要功能,而 Bash 让解析选项成为了一件简单的事。
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -159,7 +160,7 @@ via: https://opensource.com/article/21/8/option-parsing-bash
|
|||||||
作者:[Seth Kenlon][a]
|
作者:[Seth Kenlon][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[unigeorge](https://github.com/unigeorge)
|
译者:[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/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -3,19 +3,22 @@
|
|||||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||||
[#]: collector: "lujun9972"
|
[#]: collector: "lujun9972"
|
||||||
[#]: translator: "imgradeone"
|
[#]: translator: "imgradeone"
|
||||||
[#]: reviewer: " "
|
[#]: reviewer: "wxy"
|
||||||
[#]: publisher: " "
|
[#]: publisher: "wxy"
|
||||||
[#]: url: " "
|
[#]: url: "https://linux.cn/article-13739-1.html"
|
||||||
|
|
||||||
elementary OS 6 Odin 评测 – 迟到的新版本,但也实至名归
|
elementary OS 6 Odin 评测:迟到的新版本,但也实至名归
|
||||||
======
|
======
|
||||||
> 这篇 elementary OS 6 的评测将为您呈现该系统在旧款测试设备上的表现。
|
|
||||||
|
> 这篇 elementary OS 6 的评测将为你呈现该系统在旧款测试设备上的表现。
|
||||||
|
|
||||||
|
![](https://img.linux.net.cn/data/attachment/album/202109/01/095116zk73wcc4g5clnvq8.jpg)
|
||||||
|
|
||||||
elementary OS 的粉丝们焦急等待 elementary OS 6 Odin 发布已经将近两年了。如此焦急的原因,主要在于早期版本 elementary OS 5.1 的内核和软件包在 2021 年来说过于陈旧。而且,这一旧版本基于 Ubuntu 18.04 LTS 构建。因此,用户都急切地等待着基于 Ubuntu 20.04 LTS 的全新版本 —— 最重要的是,Ubutnu 20.04 LTS 已经发布一年,接下来也将有下一个 LTS 版本发布。
|
elementary OS 的粉丝们焦急等待 elementary OS 6 Odin 发布已经将近两年了。如此焦急的原因,主要在于早期版本 elementary OS 5.1 的内核和软件包在 2021 年来说过于陈旧。而且,这一旧版本基于 Ubuntu 18.04 LTS 构建。因此,用户都急切地等待着基于 Ubuntu 20.04 LTS 的全新版本 —— 最重要的是,Ubutnu 20.04 LTS 已经发布一年,接下来也将有下一个 LTS 版本发布。
|
||||||
|
|
||||||
你应该也明白的,过长的等待时间,很可能导致用户跳槽到其他发行版。
|
你应该也明白的,过长的等待时间,很可能导致用户跳槽到其他发行版。
|
||||||
|
|
||||||
但即便如此,新版本终于还是 [在 8 月发布了][1],它也在用户和粉丝群体中引起了很大的轰动。
|
但即便如此,新版本终于还是 [在 8 月发布了][1],它在用户和粉丝群体很受欢迎。
|
||||||
|
|
||||||
于是,我在一周前为一台旧设备(我知道新设备的体验会更好)安装了 elementary OS 6 Odin,下面就是测评。
|
于是,我在一周前为一台旧设备(我知道新设备的体验会更好)安装了 elementary OS 6 Odin,下面就是测评。
|
||||||
|
|
||||||
@ -23,7 +26,7 @@ elementary OS 的粉丝们焦急等待 elementary OS 6 Odin 发布已经将近
|
|||||||
|
|
||||||
### elementary OS 6 Odin 测评
|
### elementary OS 6 Odin 测评
|
||||||
|
|
||||||
测试设备
|
测试设备:
|
||||||
|
|
||||||
* CPU – Intel Core i3,4 GB 运行内存
|
* CPU – Intel Core i3,4 GB 运行内存
|
||||||
* 硬盘 – SSD 固态硬盘
|
* 硬盘 – SSD 固态硬盘
|
||||||
@ -31,23 +34,19 @@ elementary OS 的粉丝们焦急等待 elementary OS 6 Odin 发布已经将近
|
|||||||
|
|
||||||
#### 安装
|
#### 安装
|
||||||
|
|
||||||
在这一版本中,elementary 团队针对 elementary OS 安装器做了易用性优化,而这一次的安装器也是自制安装器。新安装器减少了安装前的准备步骤,虽然它还是需要依赖 GParted 进行分区操作(当然 GParted 本身是一款不错的工具)。
|
在这一版本中,elementary 团队针对他们自制的 elementary OS 安装器做了易用性优化。新安装器减少了安装前的准备步骤,虽然它还是需要依赖 GParted 进行分区操作(当然 GParted 本身是一款不错的工具)。
|
||||||
|
|
||||||
在前述测试设备中,安装过程大约花费了 10 分钟,没有任何报错。初始化之后,GRUB 也正常更新,没有任何意外。这是一个带有 Legacy BIOS 的三系统启动器。
|
在前述测试设备中,安装过程大约花费了 10 分钟,没有任何报错。安装完之后,GRUB 也正常更新,没有任何意外。这是一个安装在老式 BIOS 上多引导系统。
|
||||||
|
|
||||||
<!-- 不太确定“这是一个带有 Legacy BIOS 的三系统启动器”这句话的翻译。原句:It was a triple boot system with Legacy Bios. -->
|
|
||||||
|
|
||||||
#### 初见印象
|
#### 初见印象
|
||||||
|
|
||||||
如果你刚听说 elementary OS 和 Pantheon 桌面,或者从其他传统菜单型桌面环境迁移过来,你可能需要一两天时间来适应这款桌面。当然,如果你已经是 elementary OS 的老用户的话,那么你将获得一致的体验,外加性能和外观的优化。
|
如果你刚听说 elementary OS 和 Pantheon 桌面,或者从其他传统的菜单型桌面环境迁移过来,你可能需要一两天时间来适应这款桌面。当然,如果你已经是 elementary OS 的老用户的话,那么你将获得一致的体验,外加性能和外观的优化。
|
||||||
|
|
||||||
你应该可以察觉到一些明显可见的 [elementary OS 6 的新特性][3],像是强调色、原生暗黑模式,以及一组不错的新壁纸。
|
你应该可以察觉到一些明显可见的 [elementary OS 6 的新特性][3],像是强调色、原生暗黑模式,以及一组不错的新壁纸。
|
||||||
|
|
||||||
[][4]
|
|
||||||
|
|
||||||
#### 稳定性与性能
|
#### 稳定性与性能
|
||||||
|
|
||||||
我已经使用 elementary OS 6 Odin 超过一周的时间。在日常使用后,我只能说,它很稳定,没有突然的崩溃和意外。其他额外软件(需要从 apt 独立安装)也运作正常,没有性能损耗。
|
我已经使用 elementary OS 6 Odin 超过一周的时间。在日常使用后,我只能说,它很稳定,没有突然的崩溃和意外。其他(通过 `apt` 单独安装的)额外软件也运作正常,性能也没有降低。
|
||||||
|
|
||||||
在近乎闲置的情况下,CPU 使用率处在 5%-10% 之间,内存占用约为 900 MB。CPU / 内存的消耗主要分配在 Gala(Pantheon 的窗口管理器)、Wingpanel(顶栏)和应用中心。
|
在近乎闲置的情况下,CPU 使用率处在 5%-10% 之间,内存占用约为 900 MB。CPU / 内存的消耗主要分配在 Gala(Pantheon 的窗口管理器)、Wingpanel(顶栏)和应用中心。
|
||||||
|
|
||||||
@ -57,13 +56,11 @@ elementary OS 的粉丝们焦急等待 elementary OS 6 Odin 发布已经将近
|
|||||||
|
|
||||||
#### 应用程序与应用中心
|
#### 应用程序与应用中心
|
||||||
|
|
||||||
elementary OS 的应用程序列表经过精选,几乎所有类型的软件都可以从应用中心获取,包括 Flatpak 应用。不过,elementary OS 并没有预装一些重要的应用程序,像是 Firefox、LibreOffice、Torrent 客户端、硬盘分区工具、照片编辑器之类 —— 这些重要的程序需要在安装系统后再自行安装。我认为预装软件这一块有很大的改进空间。
|
elementary OS 的应用程序列表经过精选,几乎所有类型的软件都可以从应用中心获取,包括 Flatpak 应用。不过,elementary OS 默认并没有预装一些重要的应用程序,像是 Firefox、LibreOffice、Torrent 客户端、硬盘分区工具、照片编辑器之类 —— 这些重要的程序需要在安装系统后再自行安装。我认为预装软件这一块有很大的改进空间。
|
||||||
|
|
||||||
### 结束语
|
### 结束语
|
||||||
|
|
||||||
在这一周的测试中,我也多次遇到了一个 bug,Wi-Fi 有时会突然断开,不过这完全是 Ubuntu 20.04 上游的问题 —— 多年以来,它一直有奇怪的 Wi-Fi 问题。抛开这个问题,elementary OS 确实是一款稳定、优秀的 Linux 发行版。如果 elementary OS 有滚动更新的版本,也许会更好。因此,这是一款值得推荐的发行版,尤其适合 macOS 的迁移者。
|
在这一周的测试中,我也多次遇到了一个 bug,Wi-Fi 有时会突然断开,不过这完全是上游 Ubuntu 20.04 的问题 —— 多年以来,它一直有奇怪的 Wi-Fi 问题。抛开这个问题,elementary OS 确实是一款稳定、优秀的 Linux 发行版。如果 elementary OS 有滚动更新的版本,也许会更好。因此,这是一款值得推荐的发行版,尤其适合那些从 macOS 迁移过来的人。
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -71,8 +68,8 @@ via: https://www.debugpoint.com/2021/08/elementary-os-6-odin-review/
|
|||||||
|
|
||||||
作者:[Arindam][a]
|
作者:[Arindam][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
译者:[imgradeone](https://github.com/imgradeone)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -0,0 +1,154 @@
|
|||||||
|
[#]: subject: "Linux Kernel 5.14 Released Right After the 30th Anniversary of Linux"
|
||||||
|
[#]: via: "https://news.itsfoss.com/kernel-5-14-release/"
|
||||||
|
[#]: author: "Jacob Crume https://news.itsfoss.com/author/jacob/"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: " "
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
Linux Kernel 5.14 Released Right After the 30th Anniversary of Linux
|
||||||
|
======
|
||||||
|
|
||||||
|
Back in June, I looked at [Linux Kernel 5.13][1], where we received preliminary support for the M1, RISC-V improvements, and support for new GPUs.
|
||||||
|
|
||||||
|
Now, Linux kernel 5.14 is here! Linus Torvalds just [announced it on the kernel mailing list][2]:
|
||||||
|
|
||||||
|
![Kernel 5.14 announcement mail][3]
|
||||||
|
|
||||||
|
While this release is not quite as large as the aforementioned one, it still has many improvements, especially for ARM devices.
|
||||||
|
|
||||||
|
Let us take a quick look at the key highlights of this release.
|
||||||
|
|
||||||
|
### Linux Kernel 5.14: What’s New?
|
||||||
|
|
||||||
|
Linux kernel 5.14 contains a wide variety of new features, especially for ARM-based systems. This is all happening despite Linus Torvalds claiming that this is a relatively small release in the initial [kernel announcement][4].
|
||||||
|
|
||||||
|
Fast forward to its release candidate v7 before its final release, Linus mentioned:
|
||||||
|
|
||||||
|
> Most of the changes here are drivers (GPU and networking stand out),
|
||||||
|
>
|
||||||
|
> and the rest is pretty random stuff: arch, tracing, core networking, a
|
||||||
|
>
|
||||||
|
> couple of VM fixes..
|
||||||
|
|
||||||
|
Linus Torvalds, Linux kernel 5.14 RC7 announcement
|
||||||
|
|
||||||
|
This release contains a variety of new features. Here is a list of the key new features present in Linux kernel 5.14:
|
||||||
|
|
||||||
|
* The [Raspberry Pi 400][5] can now work completely with this kernel, thanks to the work done for the past couple of months.
|
||||||
|
* The [Rockchip RK3568 SoC][6] is now supported
|
||||||
|
* Initial support for the Sony Xperia 1/1II and 5/5II
|
||||||
|
* Various updates added for Microsoft Surface Duo
|
||||||
|
* Updates to DIY BananaPi M5 board added
|
||||||
|
* [Important updates][7] for RISC-V
|
||||||
|
* Improved support for Intel Alder Lake P and Alder Lake M graphics cards
|
||||||
|
* New hot-unplug support on AMD Radeon graphics cards
|
||||||
|
* ‘Secret’ memory areas introduced with a new system called ‘memfd_secret’
|
||||||
|
* Improvements to [lower the latency of its USB audio driver][8]s
|
||||||
|
* Improved support for USB4
|
||||||
|
* Initial groundwork to support Intel Alder lake processors
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
In this article, we will be looking at what these features are, and what they mean for the end user.
|
||||||
|
|
||||||
|
#### Raspberry Pi 400
|
||||||
|
|
||||||
|
Last year, the Raspberry Pi Foundation launched the [Raspberry Pi 400][5], a keyboard computer similar to those of the 1980s. Unfortunately, this computer requires a custom kernel version to function due to non-mainline drivers.
|
||||||
|
|
||||||
|
However, with the kernel 5.14 release, this appears to have changed. After months of development, the Raspberry Pi 400 can now be booted using the Linux kernel 5.14. While it is unfortunate for support to take this long, it is much better late than never.
|
||||||
|
|
||||||
|
#### RK35xx SoC Support
|
||||||
|
|
||||||
|
This year has truly been a glorious year for [Rockchip][9]. They started off by launching their rk35xx series of SoCs, with many manufacturers integrating the newly-released SoCs into their products.
|
||||||
|
|
||||||
|
One of the most notable uses of the RK35xx series is in the Quartz64, an SBC developed by [Pine64][10] (which I am currently helping mainline). And Linux 5.14 brings support for one of these SoCs, the RK3568.
|
||||||
|
|
||||||
|
For all the upcoming boards based on this SoC, this inclusion is extremely important as it greatly simplifies distro porting.
|
||||||
|
|
||||||
|
#### Initial Support for Sony Xperia 1/1II and 5/5II
|
||||||
|
|
||||||
|
[Sony][11] is one of the few mobile phone manufacturers that actively support running Linux on their phones. This is demonstrated through their compatibility with operating systems such as [Sailfish OS][12] and [Ubuntu Touch][13].
|
||||||
|
|
||||||
|
Now, with the Sony Xperia 1/1II and 5/5II being mainlined, it should be much easier to get an even wider variety of distributions booted. However, it should be also be kept in mind that this is only initial support, much like Linux 5.13’s M1 support.
|
||||||
|
|
||||||
|
#### RISC-V Updates
|
||||||
|
|
||||||
|
One of the trends I have noticed over the past few kernel updates is the ever-improving support for [RISC-V][14] processors. Last update, we got some significant build system improvements, a re-arranged kernel memory map, and support for the kernel debugging module KProbes.
|
||||||
|
|
||||||
|
This time, it appears that this trend is continuing, with the addition of a few RISC-V-specific improvements. These include:
|
||||||
|
|
||||||
|
* Support for transparent huge pages
|
||||||
|
* An optimized copy_{to,from}_user.
|
||||||
|
* Generic PCI resources mapping support
|
||||||
|
* Support for KFENCE (Kernel Electric Fence) for memory safety error detection/validation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
While mostly minor, these updates should pave the way for future RISC-V based devices.
|
||||||
|
|
||||||
|
#### Radeon Hot-Unplug
|
||||||
|
|
||||||
|
Perhaps my favorite feature of this release, AMD Radeon cards are getting a new hot-unplug feature. Previously, ripping your GPU out while your system was running would result in a kernel panic. Now, you can remove your (Radeon) GPU at any time and your system will continue to function normally, at least in theory.
|
||||||
|
|
||||||
|
I just hope that this feature works better on Linux than my experience with it on Windows. While I wouldn’t recommend randomly pulling your GPU out of your system mid-update, it is still a nice feature to see, and it will be interesting to see what people do with it.
|
||||||
|
|
||||||
|
#### USB 4 Support
|
||||||
|
|
||||||
|
As we see an increasing number of new laptops shipping with USB 4, it has become more and more important for Linux to start supporting it. Fortunately, the Linux kernel 5.14 has a wide variety of improvements for USB 4 users.
|
||||||
|
|
||||||
|
These include:
|
||||||
|
|
||||||
|
* More USB 4 support added to the thunderbolt core
|
||||||
|
* Build warning fixes all over the place
|
||||||
|
* USB-serial driver updates and new device support
|
||||||
|
* A wide variety of driver updates
|
||||||
|
* Lots of other tiny things
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
While not game-changing, these improvements should help many current and future users of USB 4.
|
||||||
|
|
||||||
|
### Wrapping Up
|
||||||
|
|
||||||
|
Between the improved USB support, multitude of updates for ARM and RISC-V devices, and minor GPU upgrades, this release is looking pretty good. As I mentioned before, I am most excited about the Radeon hot-unplug support, as this should make GPU swapping that little bit easier.
|
||||||
|
|
||||||
|
Similarly to last time, I’d recommend waiting for your distribution to offer official updates before upgrading to Linux kernel 5.14. Fortunately, users of distributions such as Arch and Manjaro should receive the updates very shortly. [Advanced Ubuntu users can install the latest mainline Kernel][15] with some effort though it should be avoided.
|
||||||
|
|
||||||
|
_What do you think about the improvements in Linux Kernel 5.14? Let me know down in the comments!_
|
||||||
|
|
||||||
|
#### 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/kernel-5-14-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://news.itsfoss.com/linux-kernel-5-13-release/
|
||||||
|
[2]: https://lkml.org/lkml/2021/8/29/382
|
||||||
|
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ1NiIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||||
|
[4]: http://lkml.iu.edu/hypermail/linux/kernel/2107.1/02943.html
|
||||||
|
[5]: https://www.raspberrypi.org/products/raspberry-pi-400/
|
||||||
|
[6]: https://www.96rocks.com/blog/2020/11/28/introduce-rockchip-rk3568/
|
||||||
|
[7]: https://lore.kernel.org/lkml/mhng-423e8bdb-977e-4b99-a1bb-b8c530664a51@palmerdabbelt-glaptop/
|
||||||
|
[8]: http://lkml.iu.edu/hypermail/linux/kernel/2107.1/00919.html
|
||||||
|
[9]: https://www.rock-chips.com/a/en/index.html
|
||||||
|
[10]: http://pine64.org
|
||||||
|
[11]: https://electronics.sony.com/c/mobile
|
||||||
|
[12]: https://sailfishos.org/
|
||||||
|
[13]: https://ubuntu-touch.io/
|
||||||
|
[14]: https://riscv.org/
|
||||||
|
[15]: https://itsfoss.com/upgrade-linux-kernel-ubuntu/
|
@ -0,0 +1,76 @@
|
|||||||
|
[#]: subject: "Ransomware Disguised as Open-Source Krita Painting App Promo Video"
|
||||||
|
[#]: via: "https://news.itsfoss.com/krita-email-scam/"
|
||||||
|
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: " "
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
Ransomware Disguised as Open-Source Krita Painting App Promo Video
|
||||||
|
======
|
||||||
|
|
||||||
|
Ransomware attacks are exponentially increasing. And, the way it gets distributed evolves every day.
|
||||||
|
|
||||||
|
One of the most effective ways is by using reputable brand names to lure users into downloading malicious files that may end up encrypting your files and demand a ransom.
|
||||||
|
|
||||||
|
And, in this case, some scammers have started using Krita’s name to deceive users through email.
|
||||||
|
|
||||||
|
### Spreading Malware via Email as Krita Officials
|
||||||
|
|
||||||
|
The attackers disguise themselves as the team for Krita, one of the best [digital open-source painting app][1].
|
||||||
|
|
||||||
|
The email mentions that Krita wants to collaborate with your YouTube channel or your social media space to share promotional videos about their software/product.
|
||||||
|
|
||||||
|
And, they mention that this is a paid advertising campaign, so you think you are getting a reward for promoting Krita.
|
||||||
|
|
||||||
|
Here’s how the email looks like (as shared by [Krita on Twitter][2]):
|
||||||
|
|
||||||
|
![][3]
|
||||||
|
|
||||||
|
Once you show interest in promoting Krita, they send you a follow-up mail instructing you to download a press kit containing screenshots, videos, and other materials.
|
||||||
|
|
||||||
|
The link may look similar to the official one like _krita.io, krita.net_, etc.
|
||||||
|
|
||||||
|
In a detailed video shared by a Twitter user, you can see that the link they share is malicious and sometimes goes undetected by Google’s safe browsing feature:
|
||||||
|
|
||||||
|
> Recently, I received the same email. Though I know this is likely a scam, I decided to proceed further just to see how far will they take us. They asked me to download some files and you can watch the full video here: <https://t.co/Mv2p9z3HCa> [pic.twitter.com/P1K2tlHiT4][4]
|
||||||
|
>
|
||||||
|
> — Inside Electronics (@InsideElectro) [August 29, 2021][5]
|
||||||
|
|
||||||
|
While I agree that this is not the best attempt to distribute malware, not everyone is as attentive as this user here.
|
||||||
|
|
||||||
|
### Never Trust an Email Without Proper Verification
|
||||||
|
|
||||||
|
It is easy for attackers to send you emails that you expect or something that may spark an interest in your work.
|
||||||
|
|
||||||
|
Scammers do their homework to know what you like, but always stay cautious no matter what or who appears to be sending the email.
|
||||||
|
|
||||||
|
If an email explicitly asks to enter your personal information, download an attachment, or visit a website to download a file, you need to double-check if it comes from an official source.
|
||||||
|
|
||||||
|
Generally, officials do not ask you to download any file or personal information unless you took action first. So, it is always wise to think twice and run a background check for what you interact with via emails.
|
||||||
|
|
||||||
|
#### 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/krita-email-scam/
|
||||||
|
|
||||||
|
作者:[Ankush Das][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://news.itsfoss.com/author/ankush/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://itsfoss.com/open-source-paint-apps/
|
||||||
|
[2]: https://twitter.com/Krita_Painting/status/1432295734074880003
|
||||||
|
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI3OSIgd2lkdGg9IjU4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||||
|
[4]: https://t.co/P1K2tlHiT4
|
||||||
|
[5]: https://twitter.com/InsideElectro/status/1431938502862663680?ref_src=twsrc%5Etfw
|
@ -0,0 +1,64 @@
|
|||||||
|
[#]: subject: "How my team built an open source learning experience platform"
|
||||||
|
[#]: via: "https://opensource.com/article/21/8/open-source-lms"
|
||||||
|
[#]: author: "Tesh Patel https://opensource.com/users/tesh"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: " "
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
How my team built an open source learning experience platform
|
||||||
|
======
|
||||||
|
Open source powers innovation through community and shared experiences.
|
||||||
|
![Student desk for open education][1]
|
||||||
|
|
||||||
|
Learning is based on the open exchange of ideas and experiences. By sharing, testing, and practicing what we've learned with others, we're able to develop in our lives and careers. It follows that openness is the ideal state for any successful learning organization.
|
||||||
|
|
||||||
|
I am passionate about learning, building teams, and technology. At Red Hat, we believe that open source powers innovation and results in better solutions. Five years ago, our learning management system was proprietary and closed. All of our learning platforms existed as islands with limited integration and provided a mediocre user experience. Over the past five years, our team has embraced the open source ethos. We've built and implemented new open source platforms, integrated our disparate learning platforms allowing us to freely exchange data and create a superior user experience.
|
||||||
|
|
||||||
|
If you're a fellow member of a learning organization, I hope you might find it helpful to hear about our experience so far and perhaps even join us as we seek to influence the future of learning.
|
||||||
|
|
||||||
|
### Unlocking potential
|
||||||
|
|
||||||
|
Our previous LMS served as the primary back-office system, system of record, and front-end experience for our learners. To put it plainly, it didn't serve any of those functions well. Our data was locked up in the vendor's vault. We had to live with the LMS's limited reporting capability or extract the data and manually manipulate it in spreadsheets. Perhaps worst of all, our learners faced a mediocre front-end system with a less-than-intuitive user experience. To live with our LMS, we had to create inefficient processes and workarounds.
|
||||||
|
|
||||||
|
And so, in 2016, we began our journey to open source learning by replacing our proprietary LMS with [Totara Learn, an open source LMS][2].
|
||||||
|
|
||||||
|
By moving to Totara Learn, we unlocked our data and turned our attention to improving the user experience for our learners.
|
||||||
|
|
||||||
|
### Identifying the ecosystem
|
||||||
|
|
||||||
|
Our learning ecosystem consists of more than just an LMS. In addition to our own content, we have access to content from third-party libraries, user-generated video content, virtual classroom tools for delivering online classes, and virtualized labs.
|
||||||
|
|
||||||
|
We knew we needed a single interface to disguise our complex learning platforms and tools and deliver one seamless experience to the learner. Initially, we tried customizing Totara Learn for this purpose. It's a great platform, but we eventually realized it wasn't cost-effective for us to remodel it from the ground up. What we needed was a platform designed for our unique requirements.
|
||||||
|
|
||||||
|
### Focusing on the learner
|
||||||
|
|
||||||
|
In 2017, as my team pondered our learning ecosystem challenges, an emerging category of products called learning experience platforms (LXP) emerged. I found several LXP vendors who claimed to solve problems with the learning experience. Many described their platform's experience as the "Netflix of learning."
|
||||||
|
|
||||||
|
In my experience, I've found that learning isn't suited to a Netflix-like environment. The notion of randomly perusing learning, enrolling in a program, and then abandoning as it gets more challenging or less interesting—as you do with Netflix shows—is the antithesis of what our continuous learning philosophy encourages. Real learning that builds skills and capabilities requires an intentional focus and an ongoing commitment with a learn, practice, reflection, feedback loop.
|
||||||
|
|
||||||
|
As my team compiled the requirements for an LXP, we quickly realized we were just at the beginning of determining what we'd need to build to create the best learning experience for our users. The requirements would continue to grow and evolve, so we needed a platform that could do the same. The idea for the Open Learning Platform (OLP) was born.
|
||||||
|
|
||||||
|
### Our open invitation
|
||||||
|
|
||||||
|
The OLP is a learning experience platform (LXP) that provides a personalized, online learning experience for users—typically employees at large enterprises. It consolidates disparate learning resources into a single portal. These days, learning can happen anywhere and in many forms. An LXP helps employees discover learning opportunities—offering ways to enhance them and manages their education. We've spent three years developing and building the OLP to meet the learning needs of users and educators. The OLP has come a long way, but we also know we're very much still on the journey.
|
||||||
|
|
||||||
|
Since the inception of the OLP, we knew we wanted it to be an open source project. Why invest time and energy in open sourcing the platform we've built over several years? Simple. We want to learn from the experiences and innovation of others and form a community that will help determine what the LMS and LXP of the future should be. We want to move past a cost-per-user licensing model and the limitations in thinking when the sole focus is to monetize a product. If even one other learning organization benefits from our open source project, then it will have been worth the investment of our time. We welcome you to join the conversation at[ Open Learning Platform][3].
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/8/open-source-lms
|
||||||
|
|
||||||
|
作者:[Tesh Patel][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/tesh
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesgen_rh_032x_0.png?itok=cApG9aB4 (Student desk for open education)
|
||||||
|
[2]: https://github.com/totara
|
||||||
|
[3]: https://www.openlearningplatform.org/
|
@ -1,5 +1,5 @@
|
|||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: ( )
|
[#]: translator: (unigeorge)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: ( )
|
||||||
[#]: publisher: ( )
|
[#]: publisher: ( )
|
||||||
[#]: url: ( )
|
[#]: url: ( )
|
||||||
@ -292,7 +292,7 @@ via: https://opensource.com/article/20/2/external-libraries-java
|
|||||||
|
|
||||||
作者:[Chris Hermansen][a]
|
作者:[Chris Hermansen][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
译者:[unigeorge](https://github.com/unigeorge)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
@ -1,265 +0,0 @@
|
|||||||
[#]: collector: (lujun9972)
|
|
||||||
[#]: translator: (chunibyo-wly)
|
|
||||||
[#]: reviewer: ( )
|
|
||||||
[#]: publisher: ( )
|
|
||||||
[#]: url: ( )
|
|
||||||
[#]: subject: (Deploy a deep learning model on Kubernetes)
|
|
||||||
[#]: via: (https://opensource.com/article/20/9/deep-learning-model-kubernetes)
|
|
||||||
[#]: author: (Chaimaa Zyani https://opensource.com/users/chaimaa)
|
|
||||||
|
|
||||||
Deploy a deep learning model on Kubernetes
|
|
||||||
======
|
|
||||||
Learn how to deploy, scale, and manage a deep learning model that serves
|
|
||||||
up image recognition predictions with Kubermatic Kubernetes Platform.
|
|
||||||
![Brain on a computer screen][1]
|
|
||||||
|
|
||||||
As enterprises increase their use of artificial intelligence (AI), machine learning (ML), and deep learning (DL), a critical question arises: How can they scale and industrialize ML development? These conversations often focus on the ML model; however, this is only one step along the way to a complete solution. To achieve in-production application and scale, model development must include a repeatable process that accounts for the critical activities that precede and follow development, including getting the model into a public-facing deployment.
|
|
||||||
|
|
||||||
This article demonstrates how to deploy, scale, and manage a deep learning model that serves up image recognition predictions using [Kubermatic Kubernetes Platform][2].
|
|
||||||
|
|
||||||
Kubermatic Kubernetes Platform is a production-grade, open source Kubernetes cluster-management tool that offers flexibility and automation to integrate with ML/DL workflows with full cluster lifecycle management.
|
|
||||||
|
|
||||||
### Get started
|
|
||||||
|
|
||||||
This example deploys a deep learning model for image recognition. It uses the [CIFAR-10][3] dataset that consists of 60,000 32x32 color images in 10 classes with the [Gluon][4] library in [Apache MXNet][5] and NVIDIA GPUs to accelerate the workload. If you want to use a pre-trained model on the CIFAR-10 dataset, check out the [getting started guide][6].
|
|
||||||
|
|
||||||
The model was trained over a span of 200 epochs, as long as the validation error kept decreasing slowly without causing the model to overfit. This plot shows the training process:
|
|
||||||
|
|
||||||
![Deep learning model training plot][7]
|
|
||||||
|
|
||||||
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
|
||||||
|
|
||||||
After training, it's essential to save the model's parameters so they can be loaded later:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
file_name = "net.params"
|
|
||||||
net.save_parameters(file_name)
|
|
||||||
```
|
|
||||||
|
|
||||||
Once the model is ready, wrap your prediction code in a Flask server. This allows the server to accept an image as an argument to its request and return the model's prediction in the response:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
from gluoncv.model_zoo import get_model
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
from mxnet import gluon, nd, image
|
|
||||||
from mxnet.gluon.data.vision import transforms
|
|
||||||
from gluoncv import utils
|
|
||||||
from PIL import Image
|
|
||||||
import io
|
|
||||||
import flask
|
|
||||||
app = flask.Flask(__name__)
|
|
||||||
|
|
||||||
@app.route("/predict",methods=["POST"])
|
|
||||||
def predict():
|
|
||||||
if flask.request.method == "POST":
|
|
||||||
if flask.request.files.get("img"):
|
|
||||||
img = Image.open(io.BytesIO(flask.request.files["img"].read()))
|
|
||||||
transform_fn = transforms.Compose([
|
|
||||||
transforms.Resize(32),
|
|
||||||
transforms.CenterCrop(32),
|
|
||||||
transforms.ToTensor(),
|
|
||||||
transforms.Normalize([0.4914, 0.4822, 0.4465], [0.2023, 0.1994, 0.2010])])
|
|
||||||
img = transform_fn(nd.array(img))
|
|
||||||
net = get_model('cifar_resnet20_v1', classes=10)
|
|
||||||
net.load_parameters('net.params')
|
|
||||||
pred = net(img.expand_dims(axis=0))
|
|
||||||
class_names = ['airplane', 'automobile', 'bird', 'cat', 'deer',
|
|
||||||
'dog', 'frog', 'horse', 'ship', 'truck']
|
|
||||||
ind = nd.argmax(pred, axis=1).astype('int')
|
|
||||||
prediction = 'The input picture is classified as [%s], with probability %.3f.'%
|
|
||||||
(class_names[ind.asscalar()], nd.softmax(pred)[0][ind].asscalar())
|
|
||||||
return prediction
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
app.run(host='0.0.0.0')
|
|
||||||
```
|
|
||||||
|
|
||||||
### Containerize the model
|
|
||||||
|
|
||||||
Before you can deploy your model to Kubernetes, you need to install Docker and create a container image with your model.
|
|
||||||
|
|
||||||
1. Download, install, and start Docker: [code]
|
|
||||||
|
|
||||||
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
|
|
||||||
|
|
||||||
sudo yum-config-manager --add-repo <https://download.docker.com/linux/centos/docker-ce.repo>
|
|
||||||
|
|
||||||
sudo yum install docker-ce
|
|
||||||
|
|
||||||
sudo systemctl start docker
|
|
||||||
|
|
||||||
```
|
|
||||||
2. Create a directory where you can organize your code and dependencies: [code]
|
|
||||||
|
|
||||||
mkdir kubermatic-dl
|
|
||||||
cd kubermatic-dl
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Create a `requirements.txt` file to contain the packages the code needs to run: [code]
|
|
||||||
|
|
||||||
flask
|
|
||||||
gluoncv
|
|
||||||
matplotlib
|
|
||||||
mxnet
|
|
||||||
requests
|
|
||||||
Pillow
|
|
||||||
|
|
||||||
```
|
|
||||||
4. Create the Dockerfile that Docker will read to build and run the model: [code]
|
|
||||||
|
|
||||||
FROM python:3.6
|
|
||||||
WORKDIR /app
|
|
||||||
COPY requirements.txt /app
|
|
||||||
RUN pip install -r ./requirements.txt
|
|
||||||
COPY app.py /app
|
|
||||||
CMD ["python", "app.py"]~
|
|
||||||
|
|
||||||
[/code] This Dockerfile can be broken down into three steps. First, it creates the Dockerfile and instructs Docker to download a base image of Python 3. Next, it asks Docker to use the Python package manager `pip` to install the packages in `requirements.txt`. Finally, it tells Docker to run your script via `python app.py`.
|
|
||||||
|
|
||||||
5. Build the Docker container: [code]`sudo docker build -t kubermatic-dl:latest .`[/code] This instructs Docker to build a container for the code in your current working directory, `kubermatic-dl`.
|
|
||||||
|
|
||||||
6. Check that your container is working by running it on your local machine: [code]`sudo docker run -d -p 5000:5000 kubermatic-dl`
|
|
||||||
```
|
|
||||||
|
|
||||||
7. Check the status of your container by running `sudo docker ps -a`:
|
|
||||||
|
|
||||||
![Checking the container's status][9]
|
|
||||||
|
|
||||||
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Upload the model to Docker Hub
|
|
||||||
|
|
||||||
Before you can deploy the model on Kubernetes, it must be publicly available. Do that by adding it to [Docker Hub][10]. (You will need to create a Docker Hub account if you don't have one.)
|
|
||||||
|
|
||||||
1. Log into your Docker Hub account: [code]`sudo docker login`
|
|
||||||
```
|
|
||||||
2. Tag the image so you can refer to it for versioning when you upload it to Docker Hub: [code]
|
|
||||||
|
|
||||||
sudo docker tag <your-image-id> <your-docker-hub-name>/<your-app-name>
|
|
||||||
|
|
||||||
sudo docker push <your-docker-hub-name>/<your-app-name>
|
|
||||||
```
|
|
||||||
|
|
||||||
![Tagging the image][11]
|
|
||||||
|
|
||||||
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
|
||||||
|
|
||||||
3. Check your image ID by running `sudo docker images`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Deploy the model to a Kubernetes cluster
|
|
||||||
|
|
||||||
1. Create a project on the Kubermatic Kubernetes Platform, then create a Kubernetes cluster using the [quick start tutorial][12].
|
|
||||||
|
|
||||||
![Create a Kubernetes cluster][13]
|
|
||||||
|
|
||||||
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
|
||||||
|
|
||||||
2. Download the `kubeconfig` used to configure access to your cluster, change it into the download directory, and export it into your environment:
|
|
||||||
|
|
||||||
![Kubernetes cluster example][14]
|
|
||||||
|
|
||||||
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
|
||||||
|
|
||||||
3. Using `kubectl`, check the cluster information, such as the services that `kube-system` starts on your cluster: [code]`kubectl cluster-info`
|
|
||||||
```
|
|
||||||
![Checking the cluster info][15]
|
|
||||||
|
|
||||||
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
|
||||||
|
|
||||||
4. To run the container in the cluster, you need to create a deployment (`deployment.yaml`) and apply it to the cluster: [code]
|
|
||||||
|
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: kubermatic-dl-deployment
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: kubermatic-dl
|
|
||||||
replicas: 3
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: kubermatic-dl
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: kubermatic-dl
|
|
||||||
image: kubermatic00/kubermatic-dl:latest
|
|
||||||
imagePullPolicy: Always
|
|
||||||
ports:
|
|
||||||
- containerPort: 8080
|
|
||||||
|
|
||||||
[/code] [code]`kubectl apply -f deployment.yaml`
|
|
||||||
```
|
|
||||||
|
|
||||||
5. To expose your deployment to the outside world, you need a service object that will create an externally reachable IP for your container: [code]`kubectl expose deployment kubermatic-dl-deployment --type=LoadBalancer --port 80 --target-port 5000`
|
|
||||||
```
|
|
||||||
6. You're almost there! Check your services to determine the status of your deployment and get the IP address to call your image recognition API: [code]`kubectl get service`
|
|
||||||
```
|
|
||||||
|
|
||||||
![Get the IP address to call your image recognition API][16]
|
|
||||||
|
|
||||||
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
|
||||||
|
|
||||||
7. Test your API with these two images using the external IP:
|
|
||||||
|
|
||||||
![Horse][17]
|
|
||||||
|
|
||||||
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
|
||||||
|
|
||||||
![Dog][18]
|
|
||||||
|
|
||||||
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
|
||||||
|
|
||||||
![Testing the API][19]
|
|
||||||
|
|
||||||
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Summary
|
|
||||||
|
|
||||||
In this tutorial, you created a deep learning model to be served as a [REST API][20] using Flask. It put the application inside a Docker container, uploaded the container to Docker Hub, and deployed it with Kubernetes. Then, with just a few commands, Kubermatic Kubernetes Platform deployed the app and exposed it to the world.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/article/20/9/deep-learning-model-kubernetes
|
|
||||||
|
|
||||||
作者:[Chaimaa Zyani][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/chaimaa
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_computer_solve_fix_tool.png?itok=okq8joti (Brain on a computer screen)
|
|
||||||
[2]: https://www.loodse.com/products/kubermatic/
|
|
||||||
[3]: https://www.cs.toronto.edu/~kriz/cifar.html
|
|
||||||
[4]: https://gluon.mxnet.io/
|
|
||||||
[5]: https://mxnet.apache.org/
|
|
||||||
[6]: https://gluon-cv.mxnet.io/build/examples_classification/demo_cifar10.html
|
|
||||||
[7]: https://opensource.com/sites/default/files/uploads/trainingplot.png (Deep learning model training plot)
|
|
||||||
[8]: https://creativecommons.org/licenses/by-sa/4.0/
|
|
||||||
[9]: https://opensource.com/sites/default/files/uploads/containerstatus.png (Checking the container's status)
|
|
||||||
[10]: https://hub.docker.com/
|
|
||||||
[11]: https://opensource.com/sites/default/files/uploads/tagimage.png (Tagging the image)
|
|
||||||
[12]: https://docs.kubermatic.com/kubermatic/v2.13/installation/install_kubermatic/_installer/
|
|
||||||
[13]: https://opensource.com/sites/default/files/uploads/kubernetesclusterempty.png (Create a Kubernetes cluster)
|
|
||||||
[14]: https://opensource.com/sites/default/files/uploads/kubernetesexamplecluster.png (Kubernetes cluster example)
|
|
||||||
[15]: https://opensource.com/sites/default/files/uploads/clusterinfo.png (Checking the cluster info)
|
|
||||||
[16]: https://opensource.com/sites/default/files/uploads/getservice.png (Get the IP address to call your image recognition API)
|
|
||||||
[17]: https://opensource.com/sites/default/files/uploads/horse.jpg (Horse)
|
|
||||||
[18]: https://opensource.com/sites/default/files/uploads/dog.jpg (Dog)
|
|
||||||
[19]: https://opensource.com/sites/default/files/uploads/testapi.png (Testing the API)
|
|
||||||
[20]: https://www.redhat.com/en/topics/api/what-is-a-rest-api
|
|
@ -1,404 +0,0 @@
|
|||||||
[#]: subject: (Analyze the Linux kernel with ftrace)
|
|
||||||
[#]: via: (https://opensource.com/article/21/7/linux-kernel-ftrace)
|
|
||||||
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
|
|
||||||
[#]: collector: (lujun9972)
|
|
||||||
[#]: translator: (mengxinayan)
|
|
||||||
[#]: reviewer: ( )
|
|
||||||
[#]: publisher: ( )
|
|
||||||
[#]: url: ( )
|
|
||||||
|
|
||||||
Analyze the Linux kernel with ftrace
|
|
||||||
======
|
|
||||||
Ftrace is a great way to learn more about the internal workings of the
|
|
||||||
Linux kernel.
|
|
||||||
![Linux keys on the keyboard for a desktop computer][1]
|
|
||||||
|
|
||||||
An operating system's kernel is one of the most elusive pieces of software out there. It's always there running in the background from the time your system gets turned on. Every user achieves their computing work with the help of the kernel, yet they never interact with it directly. The interaction with the kernel occurs by making system calls or having those calls made on behalf of the user by various libraries or applications that they use daily.
|
|
||||||
|
|
||||||
I've covered how to trace system calls in an earlier article using `strace`. However, with `strace`, your visibility is limited. It allows you to view the system calls invoked with specific parameters and, after the work gets done, see the return value or status indicating whether they passed or failed. But you had no idea what happened inside the kernel during this time. Besides just serving system calls, there's a lot of other activity happening inside the kernel that you're oblivious to.
|
|
||||||
|
|
||||||
### Ftrace Introduction
|
|
||||||
|
|
||||||
This article aims to shed some light on tracing the kernel functions by using a mechanism called `ftrace`. It makes kernel tracing easily accessible to any Linux user, and with its help you can learn a lot about Linux kernel internals.
|
|
||||||
|
|
||||||
The default output generated by the `ftrace` is often massive, given that the kernel is always busy. To save space, I've kept the output to a minimum and, in many cases truncated the output entirely.
|
|
||||||
|
|
||||||
I am using Fedora for these examples, but they should work on any of the latest Linux distributions.
|
|
||||||
|
|
||||||
### Enabling ftrace
|
|
||||||
|
|
||||||
`Ftrace` is part of the Linux kernel now, and you no longer need to install anything to use it. It is likely that, if you are using a recent Linux OS, `ftrace` is already enabled. To verify that the `ftrace` facility is available, run the mount command and search for `tracefs`. If you see output similar to what is below, `ftrace` is enabled, and you can easily follow the examples in this article:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo mount | grep tracefs
|
|
||||||
none on /sys/kernel/tracing type tracefs (rw,relatime,seclabel)
|
|
||||||
```
|
|
||||||
|
|
||||||
To make use of `ftrace`, you first must navigate to the special directory as specified in the mount command above, from where you'll run the rest of the commands in the article:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
`$ cd /sys/kernel/tracing`
|
|
||||||
```
|
|
||||||
|
|
||||||
### General work flow
|
|
||||||
|
|
||||||
First of all, you must understand the general workflow of capturing a trace and obtaining the output. If you're using `ftrace` directly, there isn't any special `ftrace-`specific commands to run. Instead, you basically write to some files and read from some files using standard command-line Linux utilities.
|
|
||||||
|
|
||||||
The general steps:
|
|
||||||
|
|
||||||
1. Write to some specific files to enable/disable tracing.
|
|
||||||
2. Write to some specific files to set/unset filters to fine-tune tracing.
|
|
||||||
3. Read generated trace output from files based on 1 and 2.
|
|
||||||
4. Clear earlier output or buffer from files.
|
|
||||||
5. Narrow down to your specific use case (kernel functions to trace) and repeat steps 1, 2, 3, 4.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Types of available tracers
|
|
||||||
|
|
||||||
There are several different kinds of tracers available to you. As mentioned earlier, you need to be in a specific directory before running any of these commands because the files of interest are present there. I use relative paths (as opposed to absolute paths) in my examples.
|
|
||||||
|
|
||||||
You can view the contents of the `available_tracers` file to see all the types of tracers available. You can see a few listed below. Don't worry about all of them just yet:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ pwd
|
|
||||||
/sys/kernel/tracing
|
|
||||||
|
|
||||||
$ sudo cat available_tracers
|
|
||||||
hwlat blk mmiotrace function_graph wakeup_dl wakeup_rt wakeup function nop
|
|
||||||
```
|
|
||||||
|
|
||||||
Out of all the given tracers, I focus on three specific ones: `function` and `function_graph` to enable tracing, and `nop` to disable tracing.
|
|
||||||
|
|
||||||
### Identify current tracer
|
|
||||||
|
|
||||||
Usually, by default, the tracer is set to `nop`. That is, "No operation" in the special file `current_tracer`, which usually means tracing is currently off:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ pwd
|
|
||||||
/sys/kernel/tracing
|
|
||||||
|
|
||||||
$ sudo cat current_tracer
|
|
||||||
nop
|
|
||||||
```
|
|
||||||
|
|
||||||
### View Tracing output
|
|
||||||
|
|
||||||
Before you enable any tracing, take a look at the file where the tracing output gets stored. You can view the contents of the file named `trace` using the [cat][2] command:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo cat trace
|
|
||||||
# tracer: nop
|
|
||||||
#
|
|
||||||
# entries-in-buffer/entries-written: 0/0 #P:8
|
|
||||||
#
|
|
||||||
# _-----=> irqs-off
|
|
||||||
# / _----=> need-resched
|
|
||||||
# | / _---=> hardirq/softirq
|
|
||||||
# || / _--=> preempt-depth
|
|
||||||
# ||| / delay
|
|
||||||
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
|
|
||||||
# | | | |||| | |
|
|
||||||
```
|
|
||||||
|
|
||||||
### Enable function tracer
|
|
||||||
|
|
||||||
You can enable your first tracer called `function` by writing `function` to the file `current_tracer` (its earlier content was `nop`, indicating that tracing was off.) Think of this operation as a way of enabling tracing:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ pwd
|
|
||||||
/sys/kernel/tracing
|
|
||||||
|
|
||||||
$ sudo cat current_tracer
|
|
||||||
nop
|
|
||||||
$ echo function > current_tracer
|
|
||||||
$
|
|
||||||
$ cat current_tracer
|
|
||||||
function
|
|
||||||
```
|
|
||||||
|
|
||||||
### View updated tracing output for function tracer
|
|
||||||
|
|
||||||
Now that you've enabled tracing, it's time to view the output. If you view the contents of the `trace` file, you see a lot of data being written to it continuously. I've piped the output and am currently viewing only the top 20 lines to keep things manageable. If you follow the headers in the output on the left, you can see which task and Process ID are running on which CPU. Toward the right side of the output, you see the exact kernel function running, followed by its parent function. There is also time stamp information in the center:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo cat trace | head -20
|
|
||||||
# tracer: function
|
|
||||||
#
|
|
||||||
# entries-in-buffer/entries-written: 409936/4276216 #P:8
|
|
||||||
#
|
|
||||||
# _-----=> irqs-off
|
|
||||||
# / _----=> need-resched
|
|
||||||
# | / _---=> hardirq/softirq
|
|
||||||
# || / _--=> preempt-depth
|
|
||||||
# ||| / delay
|
|
||||||
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
|
|
||||||
# | | | |||| | |
|
|
||||||
<idle>-0 [000] d... 2088.841739: tsc_verify_tsc_adjust <-arch_cpu_idle_enter
|
|
||||||
<idle>-0 [000] d... 2088.841739: local_touch_nmi <-do_idle
|
|
||||||
<idle>-0 [000] d... 2088.841740: rcu_nocb_flush_deferred_wakeup <-do_idle
|
|
||||||
<idle>-0 [000] d... 2088.841740: tick_check_broadcast_expired <-do_idle
|
|
||||||
<idle>-0 [000] d... 2088.841740: cpuidle_get_cpu_driver <-do_idle
|
|
||||||
<idle>-0 [000] d... 2088.841740: cpuidle_not_available <-do_idle
|
|
||||||
<idle>-0 [000] d... 2088.841741: cpuidle_select <-do_idle
|
|
||||||
<idle>-0 [000] d... 2088.841741: menu_select <-do_idle
|
|
||||||
<idle>-0 [000] d... 2088.841741: cpuidle_governor_latency_req <-menu_select
|
|
||||||
```
|
|
||||||
|
|
||||||
Remember that tracing is on, which means the output of tracing continues to get written to the trace file until you turn tracing off.
|
|
||||||
|
|
||||||
### Turn off tracing
|
|
||||||
|
|
||||||
Turning off tracing is simple. All you have to do is replace `function` tracer with `nop` in the `current_tracer` file and tracing gets turned off:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo cat current_tracer
|
|
||||||
function
|
|
||||||
|
|
||||||
$ sudo echo nop > current_tracer
|
|
||||||
|
|
||||||
$ sudo cat current_tracer
|
|
||||||
nop
|
|
||||||
```
|
|
||||||
|
|
||||||
### Enable function_graph tracer
|
|
||||||
|
|
||||||
Now try the second tracer, called `function_graph`. You can enable this using the same steps as before: write `function_graph` to the `current_tracer` file:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo echo function_graph > current_tracer
|
|
||||||
|
|
||||||
$ sudo cat current_tracer
|
|
||||||
function_graph
|
|
||||||
```
|
|
||||||
|
|
||||||
### Tracing output of function_graph tracer
|
|
||||||
|
|
||||||
Notice that the output format of the `trace` file has changed. Now, you can see the CPU ID and the duration of the kernel function execution. Next, you see curly braces indicating the beginning of a function and what other functions were called from inside it:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo cat trace | head -20
|
|
||||||
# tracer: function_graph
|
|
||||||
#
|
|
||||||
# CPU DURATION FUNCTION CALLS
|
|
||||||
# | | | | | | |
|
|
||||||
6) | n_tty_write() {
|
|
||||||
6) | down_read() {
|
|
||||||
6) | __cond_resched() {
|
|
||||||
6) 0.341 us | rcu_all_qs();
|
|
||||||
6) 1.057 us | }
|
|
||||||
6) 1.807 us | }
|
|
||||||
6) 0.402 us | process_echoes();
|
|
||||||
6) | add_wait_queue() {
|
|
||||||
6) 0.391 us | _raw_spin_lock_irqsave();
|
|
||||||
6) 0.359 us | _raw_spin_unlock_irqrestore();
|
|
||||||
6) 1.757 us | }
|
|
||||||
6) 0.350 us | tty_hung_up_p();
|
|
||||||
6) | mutex_lock() {
|
|
||||||
6) | __cond_resched() {
|
|
||||||
6) 0.404 us | rcu_all_qs();
|
|
||||||
6) 1.067 us | }
|
|
||||||
```
|
|
||||||
|
|
||||||
### Enable trace settings to increase the depth of tracing
|
|
||||||
|
|
||||||
You can always tweak the tracer slightly to see more depth of the function calls using the steps below. After which, you can view the contents of the `trace` file and see that the output is slightly more detailed. For readability, the output of this example is omitted:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo cat max_graph_depth
|
|
||||||
0
|
|
||||||
$ sudo echo 1 > max_graph_depth
|
|
||||||
$ # or
|
|
||||||
$ sudo echo 2 > max_graph_depth
|
|
||||||
|
|
||||||
$ sudo cat trace
|
|
||||||
```
|
|
||||||
|
|
||||||
### Finding functions to trace
|
|
||||||
|
|
||||||
The steps above are sufficient to get started with tracing. However, the amount of output generated is enormous, and you can often get lost while trying to find out items of interest. Often you want the ability to trace specific functions only and ignore the rest. But how do you know which processes to trace if you don't know their exact names? There is a file that can help you with this—`available_filter_functions` provides you with a list of available functions for tracing:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo wc -l available_filter_functions
|
|
||||||
63165 available_filter_functions
|
|
||||||
```
|
|
||||||
|
|
||||||
### Search for general kernel functions
|
|
||||||
|
|
||||||
Now try searching for a simple kernel function that you are aware of. User-space has `malloc` to allocate memory, while the kernel has its `kmalloc` function, which provides similar functionality. Below are all the `kmalloc` related functions:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo grep kmalloc available_filter_functions
|
|
||||||
debug_kmalloc
|
|
||||||
mempool_kmalloc
|
|
||||||
kmalloc_slab
|
|
||||||
kmalloc_order
|
|
||||||
kmalloc_order_trace
|
|
||||||
kmalloc_fix_flags
|
|
||||||
kmalloc_large_node
|
|
||||||
__kmalloc
|
|
||||||
__kmalloc_track_caller
|
|
||||||
__kmalloc_node
|
|
||||||
__kmalloc_node_track_caller
|
|
||||||
[...]
|
|
||||||
```
|
|
||||||
|
|
||||||
### Search for kernel module or driver related functions
|
|
||||||
|
|
||||||
From the output of `available_filter_functions`, you can see some lines ending with text in brackets, such as `[kvm_intel]` in the example below. These functions are related to the kernel module `kvm_intel`, which is currently loaded. You can run the `lsmod` command to verify:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo grep kvm available_filter_functions | tail
|
|
||||||
__pi_post_block [kvm_intel]
|
|
||||||
vmx_vcpu_pi_load [kvm_intel]
|
|
||||||
vmx_vcpu_pi_put [kvm_intel]
|
|
||||||
pi_pre_block [kvm_intel]
|
|
||||||
pi_post_block [kvm_intel]
|
|
||||||
pi_wakeup_handler [kvm_intel]
|
|
||||||
pi_has_pending_interrupt [kvm_intel]
|
|
||||||
pi_update_irte [kvm_intel]
|
|
||||||
vmx_dump_dtsel [kvm_intel]
|
|
||||||
vmx_dump_sel [kvm_intel]
|
|
||||||
|
|
||||||
$ lsmod | grep -i kvm
|
|
||||||
kvm_intel 335872 0
|
|
||||||
kvm 987136 1 kvm_intel
|
|
||||||
irqbypass 16384 1 kvm
|
|
||||||
```
|
|
||||||
|
|
||||||
### Trace specific functions only
|
|
||||||
|
|
||||||
To enable tracing of specific functions or patterns, you can make use of the `set_ftrace_filter` file to specify which functions from the above output you want to trace.
|
|
||||||
This file also accepts the `*` pattern, which expands to include additional functions with the given pattern. As an example, I am using the `ext4` filesystem on my machine. I can specify `ext4` specific kernel functions to trace using the following commands:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo mount | grep home
|
|
||||||
/dev/mapper/fedora-home on /home type ext4 (rw,relatime,seclabel)
|
|
||||||
|
|
||||||
$ pwd
|
|
||||||
/sys/kernel/tracing
|
|
||||||
|
|
||||||
$ sudo cat set_ftrace_filter
|
|
||||||
#### all functions enabled ####
|
|
||||||
$
|
|
||||||
$ echo ext4_* > set_ftrace_filter
|
|
||||||
$
|
|
||||||
$ cat set_ftrace_filter
|
|
||||||
ext4_has_free_clusters
|
|
||||||
ext4_validate_block_bitmap
|
|
||||||
ext4_get_group_number
|
|
||||||
ext4_get_group_no_and_offset
|
|
||||||
ext4_get_group_desc
|
|
||||||
[...]
|
|
||||||
```
|
|
||||||
|
|
||||||
Now, when you see the tracing output, you can only see functions `ext4` related to kernel functions for which you had set a filter earlier. All the other output gets ignored:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo cat trace |head -20
|
|
||||||
# tracer: function
|
|
||||||
#
|
|
||||||
# entries-in-buffer/entries-written: 3871/3871 #P:8
|
|
||||||
#
|
|
||||||
# _-----=> irqs-off
|
|
||||||
# / _----=> need-resched
|
|
||||||
# | / _---=> hardirq/softirq
|
|
||||||
# || / _--=> preempt-depth
|
|
||||||
# ||| / delay
|
|
||||||
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
|
|
||||||
# | | | |||| | |
|
|
||||||
cupsd-1066 [004] .... 3308.989545: ext4_file_getattr <-vfs_fstat
|
|
||||||
cupsd-1066 [004] .... 3308.989547: ext4_getattr <-ext4_file_getattr
|
|
||||||
cupsd-1066 [004] .... 3308.989552: ext4_file_getattr <-vfs_fstat
|
|
||||||
cupsd-1066 [004] .... 3308.989553: ext4_getattr <-ext4_file_getattr
|
|
||||||
cupsd-1066 [004] .... 3308.990097: ext4_file_open <-do_dentry_open
|
|
||||||
cupsd-1066 [004] .... 3308.990111: ext4_file_getattr <-vfs_fstat
|
|
||||||
cupsd-1066 [004] .... 3308.990111: ext4_getattr <-ext4_file_getattr
|
|
||||||
cupsd-1066 [004] .... 3308.990122: ext4_llseek <-ksys_lseek
|
|
||||||
cupsd-1066 [004] .... 3308.990130: ext4_file_read_iter <-new_sync_read
|
|
||||||
```
|
|
||||||
|
|
||||||
### Exclude functions from being traced
|
|
||||||
|
|
||||||
You don't always know what you want to trace but, you surely know what you don't want to trace. For that, there is this file aptly named `set_ftrace_notrace`—notice the "no" in there. You can write your desired pattern in this file and enable tracing, upon which everything except the mentioned pattern gets traced. This is often helpful to remove common functionality that clutters our output:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo cat set_ftrace_notrace
|
|
||||||
#### no functions disabled ####
|
|
||||||
```
|
|
||||||
|
|
||||||
### Targetted tracing
|
|
||||||
|
|
||||||
So far, you've been tracing everything that has happened in the kernel. But that won't help us if you wish to trace events related to a specific command. To achieve this, you can turn tracing on and off on-demand and, and in between them, run our command of choice so that you do not get extra output in your trace output. You can enable tracing by writing `1` to `tracing_on`, and `0` to turn it off:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo cat tracing_on
|
|
||||||
0
|
|
||||||
|
|
||||||
$ sudo echo 1 > tracing_on
|
|
||||||
$ sudo cat tracing_on
|
|
||||||
1
|
|
||||||
|
|
||||||
$ # Run some specific command that we wish to trace here
|
|
||||||
|
|
||||||
$ sudo echo 0 > tracing_on
|
|
||||||
|
|
||||||
$ cat tracing_on
|
|
||||||
0
|
|
||||||
```
|
|
||||||
|
|
||||||
### Tracing specific PID
|
|
||||||
|
|
||||||
If you want to trace activity related to a specific process that is already running, you can write that PID to a file named `set_ftrace_pid` and then enable tracing. That way, tracing is limited to this PID only, which is very helpful in some instances:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
`$ sudo echo $PID > set_ftrace_pid`
|
|
||||||
```
|
|
||||||
|
|
||||||
### Conclusion
|
|
||||||
|
|
||||||
`Ftrace` is a great way to learn more about the internal workings of the Linux kernel. With some practice, you can learn to fine-tune `ftrace` and narrow down your searches. To understand `ftrace` in more detail and its advanced usage, see these excellent articles written by the core author of `ftrace` himself—Steven Rostedt.
|
|
||||||
|
|
||||||
* [Debugging the Linux kernel, part 1][3]
|
|
||||||
* [Debugging the Linux kernel, part 2][4]
|
|
||||||
* [Debugging the Linux kernel, part 3][5]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/article/21/7/linux-kernel-ftrace
|
|
||||||
|
|
||||||
作者:[Gaurav Kamathe][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[萌新阿岩](https://github.com/mengxinayan)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://opensource.com/users/gkamathe
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
|
|
||||||
[2]: https://opensource.com/article/19/2/getting-started-cat-command
|
|
||||||
[3]: https://lwn.net/Articles/365835/
|
|
||||||
[4]: https://lwn.net/Articles/366796/
|
|
||||||
[5]: https://lwn.net/Articles/370423/
|
|
@ -2,7 +2,7 @@
|
|||||||
[#]: via: (https://opensource.com/article/21/7/linux-kernel-trace-cmd)
|
[#]: via: (https://opensource.com/article/21/7/linux-kernel-trace-cmd)
|
||||||
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
|
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
|
||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: ( )
|
[#]: translator: (mengxinayan)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: ( )
|
||||||
[#]: publisher: ( )
|
[#]: publisher: ( )
|
||||||
[#]: url: ( )
|
[#]: url: ( )
|
||||||
@ -364,7 +364,7 @@ via: https://opensource.com/article/21/7/linux-kernel-trace-cmd
|
|||||||
|
|
||||||
作者:[Gaurav Kamathe][a]
|
作者:[Gaurav Kamathe][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
译者:[萌新阿岩](https://github.com/mengxinayan)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
@ -1,247 +0,0 @@
|
|||||||
[#]: subject: (Brave vs. Firefox: Your Ultimate Browser Choice for Private Web Experience)
|
|
||||||
[#]: via: (https://itsfoss.com/brave-vs-firefox/)
|
|
||||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
|
||||||
[#]: collector: (lujun9972)
|
|
||||||
[#]: translator: ( )
|
|
||||||
[#]: reviewer: ( )
|
|
||||||
[#]: publisher: ( )
|
|
||||||
[#]: url: ( )
|
|
||||||
|
|
||||||
Brave vs. Firefox: Your Ultimate Browser Choice for Private Web Experience
|
|
||||||
======
|
|
||||||
|
|
||||||
Web browsers have evolved over the years. From downloading files to accessing a full-fledged web application, we have come a long way.
|
|
||||||
|
|
||||||
For a lot of users, the web browser is the only thing they need to get their work done these days.
|
|
||||||
|
|
||||||
Hence, choosing the right browser becomes an important task that could help improve your workflow over the years.
|
|
||||||
|
|
||||||
### Brave vs. Firefox Browser
|
|
||||||
|
|
||||||
Brave and Mozilla’s Firefox are two of the most popular web browsers for privacy-conscious users and open-source enthusiasts.
|
|
||||||
|
|
||||||
Considering that both focus heavily on privacy and security, let us look at what exactly they have to offer, to help you decide what you should go with.
|
|
||||||
|
|
||||||
Here are the comparison pointers that I’ve used, you can directly navigate to any of them:
|
|
||||||
|
|
||||||
* [User Interface][1]
|
|
||||||
* [Performance][2]
|
|
||||||
* [Browser Engine][3]
|
|
||||||
* [Ad & Tracking Blocking Capabilities][4]
|
|
||||||
* [Containers][5]
|
|
||||||
* [Rewards][6]
|
|
||||||
* [Cross-Platform Availability][7]
|
|
||||||
* [Synchronization][8]
|
|
||||||
* [Service Integrations][9]
|
|
||||||
* [Customizability][10]
|
|
||||||
* [Extension Support][11]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### User Interface
|
|
||||||
|
|
||||||
The user interface is what makes the biggest difference with the workflow and experience when using the browser.
|
|
||||||
|
|
||||||
Of course, you can have your personal preferences, but the easier, snappier, and cleaner it looks, the better it is.
|
|
||||||
|
|
||||||
![Brave browser][12]
|
|
||||||
|
|
||||||
To start with, Brave shares a similar look and feel to Chrome and Microsoft Edge. It offers a clean experience with minimal UI elements and all the essential options accessible through the browser menu.
|
|
||||||
|
|
||||||
It offers a black theme as well. The subtle animations make the interaction a pleasant experience.
|
|
||||||
|
|
||||||
To customize it, you can choose to use themes available from the chrome web store.
|
|
||||||
|
|
||||||
When it comes to Mozilla Firefox, it has had a couple of major redesigns over the years, and the latest user interface tries to offer a closer experience to Chrome.
|
|
||||||
|
|
||||||
![Firefox browser][13]
|
|
||||||
|
|
||||||
The Firefox design looks impressive and provides a clean user experience. It also lets you opt for a dark theme if needed and there are several theme options to download/apply as well.
|
|
||||||
|
|
||||||
Both web browsers offer a good user experience.
|
|
||||||
|
|
||||||
If you want a familiar experience, but with a pinch of uniqueness, Mozilla’s Firefox can be a good pick.
|
|
||||||
|
|
||||||
But, if you want a snappier experience with a better feel for the animations, Brave gets the edge.
|
|
||||||
|
|
||||||
### Performance
|
|
||||||
|
|
||||||
Practically, I find Brave loading web pages faster. Also, the overall user experience feels snappy.
|
|
||||||
|
|
||||||
Firefox is not terribly slow, but it definitely felt slower than Brave.
|
|
||||||
|
|
||||||
To give you some perspective, I also utilized [Basemark][14] to run a benchmark to see if that is true on paper.
|
|
||||||
|
|
||||||
You can check with other browser benchmark tools available, but Basemark performs a variety of tests, so we’ll go with that for this article.
|
|
||||||
|
|
||||||
![Firefox benchmark score][15]
|
|
||||||
|
|
||||||
![Brave benchmark score][16]
|
|
||||||
|
|
||||||
Firefox managed to score **630** and Brave pulled it off better with ~**792**.
|
|
||||||
|
|
||||||
Do note that these benchmarks were run with default browser settings without any browser extensions installed.
|
|
||||||
|
|
||||||
Of course, synthetic scores may vary depending on what you have going on in the background and the hardware configuration of your system.
|
|
||||||
|
|
||||||
This is what I got with **i5-7400, 16 GB RAM, and GTX 1050ti GPU** on my desktop.
|
|
||||||
|
|
||||||
In general, Brave browser is a fast browser compared to most of the popular options available.
|
|
||||||
|
|
||||||
Both utilize a decent chunk of system resources and that varies to a degree with the number of tabs, types of webpages accessed, and the kind of blocking extension used.
|
|
||||||
|
|
||||||
For instance, Brave blocks aggressively by default but Firefox does not block display advertisements by default. And, this affects the system resource usage.
|
|
||||||
|
|
||||||
### Browser Engine
|
|
||||||
|
|
||||||
Firefox utilizes its own Gecko engine as the foundation and is using components on top of that from [servo research project][17] to improve.
|
|
||||||
|
|
||||||
Currently, it is essentially an improved Gecko engine dubbed by a project name “Quantum” which was introduced with the release of Firefox Quantum.
|
|
||||||
|
|
||||||
On the other hand, Brave uses Chromium’s engine.
|
|
||||||
|
|
||||||
While both are capable enough to handle modern web experiences, Chromium-based engine is just more popular and web developers often tailor their sites for the best experience on Chrome-based browsers
|
|
||||||
|
|
||||||
Also, some services happen to exclusively support Chrome-based browsers.
|
|
||||||
|
|
||||||
### Ad & Tracker Blocking Capabilities
|
|
||||||
|
|
||||||
![][18]
|
|
||||||
|
|
||||||
As I have mentioned before, Brave is aggressive in blocking trackers and advertisements. By default, it comes with the blocking feature enabled.
|
|
||||||
|
|
||||||
Firefox also enables the enhanced privacy protection by default but does not block display advertisements.
|
|
||||||
|
|
||||||
You will have to opt for the “**Strict**” privacy protection mode with Firefox if you want to get rid of display advertisements.
|
|
||||||
|
|
||||||
With that being said, Firefox enforces some unique tracking protection technology that includes Total Cookie Protection which isolates cookies for each site and prevents cross-site cookie tracking.
|
|
||||||
|
|
||||||
![][19]
|
|
||||||
|
|
||||||
This was introduced with [Firefox 86][20] and to use it, you need to enable a strict privacy protection mode.
|
|
||||||
|
|
||||||
Overall, Brave might look like a better option out of the box, and Mozilla Firefox offers better privacy protection features.
|
|
||||||
|
|
||||||
### Containers
|
|
||||||
|
|
||||||
Firefox also offers a way to isolate site activity when you use Facebook with help of a container. In other words, it prevents Facebook from tracking your offsite activity.
|
|
||||||
|
|
||||||
You can also use containers to organize your tabs and separate sessions when needed.
|
|
||||||
|
|
||||||
Brave does not offer anything similar but it does block cross-site trackers and cookies out-of-the-box.
|
|
||||||
|
|
||||||
### Rewards
|
|
||||||
|
|
||||||
![][21]
|
|
||||||
|
|
||||||
Unlike Firefox, Brave offers its own advertising network by blocking other advertisements on the web.
|
|
||||||
|
|
||||||
When you opt in to display privacy-friendly ads by Brave, you get rewarded with tokens to a crypto wallet. And you can use these tokens to give back to your favorite websites.
|
|
||||||
|
|
||||||
While this is a good business strategy to get away from mainstream advertising, for users who do not want any kind of advertisements, it may not be useful.
|
|
||||||
|
|
||||||
So, Brave offers an alternative in the form of rewards to help websites even if you block advertisements. If it is something you appreciate, Brave will be a good pick for you.
|
|
||||||
|
|
||||||
### Cross-Platform Availability
|
|
||||||
|
|
||||||
You will find both Brave and Firefox available for Linux, Windows, and macOS. Mobile apps are also available for iOS and Android.
|
|
||||||
|
|
||||||
For Linux users, Firefox comes baked in with most of the Linux distributions. And, you can also find it available in the software center. In addition to that, there is also a [Flatpak][22] package available.
|
|
||||||
|
|
||||||
Brave is not available through default repositories and the software center. Hence, you need to follow the official instructions to add the private repository and then [get Brave installed in your Linux distro][23].
|
|
||||||
|
|
||||||
### Synchronization
|
|
||||||
|
|
||||||
With Mozilla Firefox, you get to create a Firefox account to sync all your data cross-platform.
|
|
||||||
|
|
||||||
![][24]
|
|
||||||
|
|
||||||
Brave also lets you sync cross-platform but you need access to one of the devices in order to successfully do it.
|
|
||||||
|
|
||||||
![][25]
|
|
||||||
|
|
||||||
Hence, Firefox sync is more convenient.
|
|
||||||
|
|
||||||
Also, you get access to Firefox’s VPN, data breach monitor, email relay, and password manager with the Firefox account.
|
|
||||||
|
|
||||||
### Service Integrations
|
|
||||||
|
|
||||||
Right off the bat, Firefox offers more service integrations that include Pocket, VPN, password manager, and also some of its new offerings like Firefox relay.
|
|
||||||
|
|
||||||
If you want access to these services through your browser, Firefox will be the convenient option for you.
|
|
||||||
|
|
||||||
While Brave does offer crypto wallets, it is not for everyone.
|
|
||||||
|
|
||||||
![][26]
|
|
||||||
|
|
||||||
Similarly, if you like using [Brave Search][27], you may have a seamless experience when using it with Brave browser because of the user experience.
|
|
||||||
|
|
||||||
### Customizability & Security
|
|
||||||
|
|
||||||
Firefox shines when it comes to customizability. You get more options to tweak the experience and also take control of the privacy/security of your browser.
|
|
||||||
|
|
||||||
The ability to customize lets you make Firefox more secure than the Brave browser.
|
|
||||||
|
|
||||||
While hardening Firefox is a separate topic which we’ll talk about. To give you an example, [Tor Browser][28] is just a customized Firefox browser.
|
|
||||||
|
|
||||||
However, that does not make Brave less secure. It is a secure browser overall but you do get more options with Firefox.
|
|
||||||
|
|
||||||
### Extension Support
|
|
||||||
|
|
||||||
There’s no doubt that the Chrome web store offers way more extensions.
|
|
||||||
|
|
||||||
So, Brave gets a clear edge over Firefox if you are someone who utilizes a lot of extensions (or constantly try new ones).
|
|
||||||
|
|
||||||
Firefox may not have the biggest catalog of extensions, it does support most of the extensions. For common use-cases, you will rarely find an extension that is not available as an addon for Firefox.
|
|
||||||
|
|
||||||
### What Should You Choose?
|
|
||||||
|
|
||||||
If you want the best compatibility with the modern web experience and want access to more extensions, Brave browser seems to make more sense.
|
|
||||||
|
|
||||||
On the other hand, Firefox is an excellent choice for everyday browsing with industry-first privacy features, and a convenient sync option for non-tech savvy users.
|
|
||||||
|
|
||||||
You will have a few trade-offs when selecting either of them. So, your will have to prioritize what you want the most.
|
|
||||||
|
|
||||||
Let me know about your final choice for your use case in the comments down below!
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://itsfoss.com/brave-vs-firefox/
|
|
||||||
|
|
||||||
作者:[Ankush Das][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://itsfoss.com/author/ankush/
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: tmp.5yJseRG2rb#ui
|
|
||||||
[2]: tmp.5yJseRG2rb#perf
|
|
||||||
[3]: tmp.5yJseRG2rb#engine
|
|
||||||
[4]: tmp.5yJseRG2rb#ad
|
|
||||||
[5]: tmp.5yJseRG2rb#container
|
|
||||||
[6]: tmp.5yJseRG2rb#reward
|
|
||||||
[7]: tmp.5yJseRG2rb#cp
|
|
||||||
[8]: tmp.5yJseRG2rb#sync
|
|
||||||
[9]: tmp.5yJseRG2rb#service
|
|
||||||
[10]: tmp.5yJseRG2rb#customise
|
|
||||||
[11]: tmp.5yJseRG2rb#extensions
|
|
||||||
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/brave-ui-new.jpg?resize=800%2C450&ssl=1
|
|
||||||
[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/firefox-ui.jpg?resize=800%2C450&ssl=1
|
|
||||||
[14]: https://web.basemark.com
|
|
||||||
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/firefox-basemark.png?resize=800%2C598&ssl=1
|
|
||||||
[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/07/basemark-brave.png?resize=800%2C560&ssl=1
|
|
||||||
[17]: https://servo.org
|
|
||||||
[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/brave-blocker.png?resize=800%2C556&ssl=1
|
|
||||||
[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/firefox-blocker.png?resize=800%2C564&ssl=1
|
|
||||||
[20]: https://news.itsfoss.com/firefox-86-release/
|
|
||||||
[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/07/brave-rewards.png?resize=800%2C560&ssl=1
|
|
||||||
[22]: https://itsfoss.com/what-is-flatpak/
|
|
||||||
[23]: https://itsfoss.com/brave-web-browser/
|
|
||||||
[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/firefox-sync.png?resize=800%2C651&ssl=1
|
|
||||||
[25]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/brave-sync.png?resize=800%2C383&ssl=1
|
|
||||||
[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/07/brave-crypto-wallet.png?resize=800%2C531&ssl=1
|
|
||||||
[27]: https://itsfoss.com/brave-search-features/
|
|
||||||
[28]: https://itsfoss.com/install-tar-browser-linux/
|
|
@ -2,7 +2,7 @@
|
|||||||
[#]: via: "https://opensource.com/article/21/8/linux-terminal"
|
[#]: via: "https://opensource.com/article/21/8/linux-terminal"
|
||||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||||
[#]: collector: "lujun9972"
|
[#]: collector: "lujun9972"
|
||||||
[#]: translator: " "
|
[#]: translator: "fisherue "
|
||||||
[#]: reviewer: " "
|
[#]: reviewer: " "
|
||||||
[#]: publisher: " "
|
[#]: publisher: " "
|
||||||
[#]: url: " "
|
[#]: url: " "
|
||||||
@ -108,7 +108,7 @@ via: https://opensource.com/article/21/8/linux-terminal
|
|||||||
|
|
||||||
作者:[Seth Kenlon][a]
|
作者:[Seth Kenlon][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
译者:[译者ID][c]
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
@ -127,3 +127,4 @@ via: https://opensource.com/article/21/8/linux-terminal
|
|||||||
[10]: https://opensource.com/article/21/7/terminal-basics-copying-files-linux-terminal
|
[10]: https://opensource.com/article/21/7/terminal-basics-copying-files-linux-terminal
|
||||||
[11]: https://opensource.com/article/21/7/terminal-basics-removing-files-and-folders-linux-terminal
|
[11]: https://opensource.com/article/21/7/terminal-basics-removing-files-and-folders-linux-terminal
|
||||||
[12]: https://opensource.com/downloads/bash-scripting-ebook
|
[12]: https://opensource.com/downloads/bash-scripting-ebook
|
||||||
|
[c]: https://github.com/fisherue
|
||||||
|
@ -1,182 +0,0 @@
|
|||||||
[#]: subject: "Debian vs Ubuntu: What’s the Difference? Which One Should You Use?"
|
|
||||||
[#]: via: "https://itsfoss.com/debian-vs-ubuntu/"
|
|
||||||
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
|
|
||||||
[#]: collector: "lujun9972"
|
|
||||||
[#]: translator: "perfiffer"
|
|
||||||
[#]: reviewer: " "
|
|
||||||
[#]: publisher: " "
|
|
||||||
[#]: url: " "
|
|
||||||
|
|
||||||
Debian vs Ubuntu: What’s the Difference? Which One Should You Use?
|
|
||||||
======
|
|
||||||
|
|
||||||
You can [use apt-get commands][1] for managing applications in both Debian and Ubuntu. You can install DEB packages in both distributions as well. Many times, you’ll find common package installation instructions for both distributions.
|
|
||||||
|
|
||||||
So, what’s the difference between the two, if they are so similar?
|
|
||||||
|
|
||||||
Debian and Ubuntu belong to the same side of the distribution spectrum. Debian is the original distribution created by Ian Murdock in 1993. Ubuntu was created in 2004 by Mark Shuttleworth and it is based on Debian.
|
|
||||||
|
|
||||||
### Ubuntu is based on Debian: What does it mean?
|
|
||||||
|
|
||||||
While there are hundreds of Linux distributions, only a handful of them are independent ones, created from scratch. [Debian][2], Arch, Red Hat are some of the biggest distributions that do not derive from any other distribution.
|
|
||||||
|
|
||||||
Ubuntu is derived from Debian. It means that Ubuntu uses the same APT packaging system as Debian and shares a huge number of packages and libraries from Debian repositories. It utilizes the Debian infrastructure as base.
|
|
||||||
|
|
||||||
![Ubuntu uses Debian as base][3]
|
|
||||||
|
|
||||||
That’s what most ‘derived’ distributions do. They use the same package management system and share packages as the base distribution. But they also add some packages and changes of their own. And that is how Ubuntu is different from Debian despite being derived from it.
|
|
||||||
|
|
||||||
### Difference between Ubuntu and Debian
|
|
||||||
|
|
||||||
So, Ubuntu is built on Debian architecture and infrastructure and uses .DEB packages same as Debian.
|
|
||||||
|
|
||||||
Does it mean using Ubuntu is the same as using Debian? Not quite so. There are many more factors involved that distinguish one distribution from the other.
|
|
||||||
|
|
||||||
Let me discuss these factors one by one to compare Ubuntu and Debian. Please keep in mind that some comparisons are applicable to desktop editions while some apply to the server editions.
|
|
||||||
|
|
||||||
![][4]
|
|
||||||
|
|
||||||
#### 1\. Release cycle
|
|
||||||
|
|
||||||
Ubuntu has two kinds of releases: LTS and regular. [Ubuntu LTS (long term support) release][5] comes out every two years and they get support for five years. You have the option to upgrade to the next available LTS release. The LTS releases are considered more stable.
|
|
||||||
|
|
||||||
There are also non-LTS releases, every six months. These releases are supported for nine months only, but they have newer software versions and features. You have to upgrade to the next Ubuntu versions when the current on reaches end of life.
|
|
||||||
|
|
||||||
So basically, you have the option to choose between stability and new features based on these releases.
|
|
||||||
|
|
||||||
On the other hand, Debian has three different releases: Stable, Testing and Unstable. Unstable is for actual testing and should be avoided.
|
|
||||||
|
|
||||||
The testing branch is not that unstable. It is used for preparing the next stable branch. Some Debian users prefer the testing branch to get newer features.
|
|
||||||
|
|
||||||
And then comes the stable branch. This is the main Debian release. It may not have the latest software and feature but when it comes to stability, Debian Stable is rock solid.
|
|
||||||
|
|
||||||
There is a new stable release every two years and it is supported for a total of three years. After that, you have to upgrade to the next available stable release.
|
|
||||||
|
|
||||||
#### 2\. Software freshness
|
|
||||||
|
|
||||||
![][6]
|
|
||||||
|
|
||||||
Debian’s focus on stability means that it does not always aim for the latest versions of the software. For example, the latest Debian 11 features GNOME 3.38, not the latest GNOME 3.40.
|
|
||||||
|
|
||||||
The same goes for other software like GIMP, LibreOffice, etc. This is a compromise you have to make with Debian. This is why “Debian stable = Debian stale” joke is popular in the Linux community.
|
|
||||||
|
|
||||||
Ubuntu LTS releases also focus on stability. But they usually have more recent versions of the popular software.
|
|
||||||
|
|
||||||
You should note that for _some software_, installing from developer’s repository is also an option. For example, if you want the latest Docker version, you can add Docker repository in both Debian and Ubuntu.
|
|
||||||
|
|
||||||
Overall, software in Debian Stable often have older versions when compared to Ubuntu.
|
|
||||||
|
|
||||||
#### 3\. Software availability
|
|
||||||
|
|
||||||
Both Debian and Ubuntu has a huge repository of software. However, [Ubuntu also has PPA][7] (Personal Package Archive). With PPA, installing newer software or getting the latest software version becomes a bit more easy.
|
|
||||||
|
|
||||||
![][8]
|
|
||||||
|
|
||||||
You may try using PPA in Debian but it won’t be a smooth experience. You’ll encounter issues most of the time.
|
|
||||||
|
|
||||||
#### 4\. Supported platforms
|
|
||||||
|
|
||||||
Ubuntu is available on 64-bit x86 and ARM platforms. It does not provide 32-bit ISO anymore.
|
|
||||||
|
|
||||||
Debian, on the other hand, supports both 32 bit and 64 bit architecture. Apart from that Debian also supports 64-bit ARM (arm64), ARM EABI (armel), ARMv7 (EABI hard-float ABI, armhf), little-endian MIPS (mipsel), 64-bit little-endian MIPS (mips64el), 64-bit little-endian PowerPC (ppc64el) and IBM System z (s390x).
|
|
||||||
|
|
||||||
No wonder it is called the ‘universal operating system’.
|
|
||||||
|
|
||||||
#### 5\. Installation
|
|
||||||
|
|
||||||
[Installing Ubuntu][9] is a lot easier than installing Debian. I am not kidding. Debian could be confusing even for intermediate Linux user.
|
|
||||||
|
|
||||||
When you download Debian, it provides a minimal ISO by default. This ISO has no non-free (not open source) firmware. You go on to install it and realize that your network adapters and other hardware won’t be recognized.
|
|
||||||
|
|
||||||
There is a separate non-free ISO that contains firmware but it is hidden and if you do not know that, you are in for a bad surprise.
|
|
||||||
|
|
||||||
![Getting non-free firmware is a pain in Debian][10]
|
|
||||||
|
|
||||||
Ubuntu is a lot more forgiving when it comes to including proprietary drivers and firmware in the default ISO.
|
|
||||||
|
|
||||||
Also, the Debian installer looks old whereas Ubuntu installer is modern looking. Ubuntu installer also recognizes other installed operating systems on the disk and gives you the option to install Ubuntu alongside the existing ones (dual boot). I have not noticed it with Debian installer in my testing.
|
|
||||||
|
|
||||||
![Installing Ubuntu is smoother][11]
|
|
||||||
|
|
||||||
#### 6\. Out of the box hardware support
|
|
||||||
|
|
||||||
As mentioned earlier, Debian focuses primarily on [FOSS][12] (free and open source software). This means that the kernel provided by Debian does not include proprietary drivers and firmware.
|
|
||||||
|
|
||||||
It’s not that you cannot make it work but you’ll have to do add/enable additional repositories and install it manually. This could be discouraging, specially for the beginners.
|
|
||||||
|
|
||||||
Ubuntu is not perfect but it is a lot better than Debian for providing drivers and firmware out of the box. This means less hassle and a more complete out-of-the-box experience.
|
|
||||||
|
|
||||||
#### 7\. Desktop environment choices
|
|
||||||
|
|
||||||
Ubuntu uses a customized GNOME desktop environment by default. You may install [other desktop environments][13] on top of it or opt for [various desktop based Ubuntu flavors][14] like Kubuntu (for KDE), Xubuntu (for Xfce) etc.
|
|
||||||
|
|
||||||
Debian also installs GNOME by default. But its installer gives you choice to install desktop environment of your choice during the installation process.
|
|
||||||
|
|
||||||
![][15]
|
|
||||||
|
|
||||||
You may also get [DE specific ISO images from its website][16].
|
|
||||||
|
|
||||||
#### 8\. Gaming
|
|
||||||
|
|
||||||
Gaming on Linux has improved in general thanks to Steam and its Proton project. Still, gaming depends a lot on hardware.
|
|
||||||
|
|
||||||
And when it comes to hardware compatibility, Ubuntu is better than Debian for supporting proprietary drivers.
|
|
||||||
|
|
||||||
Not that it cannot be done in Debian but it will require some time and effort to achieve that.
|
|
||||||
|
|
||||||
#### 9\. Performance
|
|
||||||
|
|
||||||
There is no clear ‘winner’ in the performance section, whether it is on the server or on the desktop. Both Debian and Ubuntu are popular as desktop as well as server operating systems.
|
|
||||||
|
|
||||||
The performance depends on your system’s hardware and the software component you use. You can tweak and control your system in both operating systems.
|
|
||||||
|
|
||||||
#### 10\. Community and support
|
|
||||||
|
|
||||||
Debian is a true community project. Everything about this project is governed by its community members.
|
|
||||||
|
|
||||||
Ubuntu is backed by [Canonical][17]. However, it is not entirely a corporate project. It does have a community but the final decision on any matter is in Canonical’s hands.
|
|
||||||
|
|
||||||
As far the support goes, both Ubuntu and Debian have dedicated forums where users can seek help and advice.
|
|
||||||
|
|
||||||
Canonical also offers professional support for a fee to its enterprise clients. Debian has no such features.
|
|
||||||
|
|
||||||
### Conclusion
|
|
||||||
|
|
||||||
Both Debian and Ubuntu are solid choices for desktop or server operating systems. The apt package manager and DEB packaging is common to both and thus giving a somewhat similar experience.
|
|
||||||
|
|
||||||
However, Debian still needs a certain level of expertise, specially on the desktop front. If you are new to Linux, sticking with Ubuntu will be a better choice for you. In my opinion, you should gain some experience, get familiar with Linux in general and then try your hands on Debian.
|
|
||||||
|
|
||||||
It’s not that you cannot jump onto the Debian wagon from the start, but it is more likely to be an overwhelming experience for Linux beginners.
|
|
||||||
|
|
||||||
**Your opinion on this Debian vs Ubuntu debate is welcome.**
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://itsfoss.com/debian-vs-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/apt-get-linux-guide/
|
|
||||||
[2]: https://www.debian.org/
|
|
||||||
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/Debian-ubuntu-upstream.png?resize=800%2C400&ssl=1
|
|
||||||
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/debian-vs-ubuntu.png?resize=800%2C450&ssl=1
|
|
||||||
[5]: https://itsfoss.com/long-term-support-lts/
|
|
||||||
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-policy.png?resize=795%2C456&ssl=1
|
|
||||||
[7]: https://itsfoss.com/ppa-guide/
|
|
||||||
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/ffmpeg_add_ppa.jpg?resize=800%2C222&ssl=1
|
|
||||||
[9]: https://itsfoss.com/install-ubuntu/
|
|
||||||
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/Debian-firmware.png?resize=800%2C600&ssl=1
|
|
||||||
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/03/choose-something-else-installing-ubuntu.png?resize=800%2C491&ssl=1
|
|
||||||
[12]: https://itsfoss.com/what-is-foss/
|
|
||||||
[13]: https://itsfoss.com/best-linux-desktop-environments/
|
|
||||||
[14]: https://itsfoss.com/which-ubuntu-install/
|
|
||||||
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/debian-install-desktop-environment.png?resize=640%2C479&ssl=1
|
|
||||||
[16]: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/
|
|
||||||
[17]: https://canonical.com/
|
|
@ -2,7 +2,7 @@
|
|||||||
[#]: via: "https://opensource.com/article/21/8/linux-stat-file-status"
|
[#]: via: "https://opensource.com/article/21/8/linux-stat-file-status"
|
||||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||||
[#]: collector: "lujun9972"
|
[#]: collector: "lujun9972"
|
||||||
[#]: translator: " "
|
[#]: translator: "New-World-2019"
|
||||||
[#]: reviewer: " "
|
[#]: reviewer: " "
|
||||||
[#]: publisher: " "
|
[#]: publisher: " "
|
||||||
[#]: url: " "
|
[#]: url: " "
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
[#]: via: "https://itsfoss.com/youtube-dl-audio-only/"
|
[#]: via: "https://itsfoss.com/youtube-dl-audio-only/"
|
||||||
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
|
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
|
||||||
[#]: collector: "lujun9972"
|
[#]: collector: "lujun9972"
|
||||||
[#]: translator: " "
|
[#]: translator: "geekpi"
|
||||||
[#]: reviewer: " "
|
[#]: reviewer: " "
|
||||||
[#]: publisher: " "
|
[#]: publisher: " "
|
||||||
[#]: url: " "
|
[#]: url: " "
|
||||||
|
@ -1,185 +0,0 @@
|
|||||||
[#]: subject: "10 Things to Do After Installing elementary OS 6 “Odin”"
|
|
||||||
[#]: via: "https://www.debugpoint.com/2021/08/10-things-to-do-after-install-elementary-os-6/"
|
|
||||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
|
||||||
[#]: collector: "lujun9972"
|
|
||||||
[#]: translator: " "
|
|
||||||
[#]: reviewer: " "
|
|
||||||
[#]: publisher: " "
|
|
||||||
[#]: url: " "
|
|
||||||
|
|
||||||
10 Things to Do After Installing elementary OS 6 “Odin”
|
|
||||||
======
|
|
||||||
A curated list of things to do after installing the latest elementary OS
|
|
||||||
6 code-named “Odin”._Pre-step_Applications > System Settings > Desktop
|
|
||||||
The [elementary OS 6 “Odin” released][1] a while back after more than two years in development. It brings a huge set of new features across its core modules, Pantheon desktop, native applications. This release is based on the Ubuntu 20.04 LTS.
|
|
||||||
|
|
||||||
That said, if you already completed the installation, there are certain customization that you might want to try out to personalize your system. The options those described here are generic and may not be useful for you at certain cases, but we feel it’s worth to list down some basics and give you a path to explore more of this beautiful elementary OS.
|
|
||||||
|
|
||||||
### Things to Do After Installing elementary OS 6 “Odin”
|
|
||||||
|
|
||||||
Make sure you connect to the internet first. You can get the list of networks available in the notification area at the top.
|
|
||||||
|
|
||||||
#### 1\. Change hostname
|
|
||||||
|
|
||||||
This might not be the first thing you would like to do. However, I am not sure why an option not given changing the hostname during installation itself. For example, see below terminal prompt, the hostname is the default hardware configuration set by elementary OS. Which is not looking good at all in my opinion.
|
|
||||||
|
|
||||||
![hostname change before][2]
|
|
||||||
|
|
||||||
To change the hostname, open a terminal and run the below command.
|
|
||||||
|
|
||||||
```
|
|
||||||
hostnamectl set-hostname your-new-hostname
|
|
||||||
```
|
|
||||||
|
|
||||||
example:
|
|
||||||
|
|
||||||
![changing hostname][3]
|
|
||||||
|
|
||||||
![changed hostname][4]
|
|
||||||
|
|
||||||
#### 2\. Update your system
|
|
||||||
|
|
||||||
The very first thing you should do after installing any Linux distribution is to make sure the system is up-to-date with packages and security updates.
|
|
||||||
|
|
||||||
To do that here, you can open App Center and check/install for updates.
|
|
||||||
|
|
||||||
Or, open the Terminal and run the below commands.
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt update
|
|
||||||
sudo apt upgrade
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 3\. Install Pantheon Tweaks
|
|
||||||
|
|
||||||
Pantheon Tweaks is a must-have application in elementary OS. It provides additional settings and configuration options that is not available via standard system settings app. To install Pantheon Tweaks, open a terminal and run the below commands. Note: The earlier tweak tool was elementary Tweaks, which is renamed with Pantheon Tweaks from Odin onwards.
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt install software-properties-common
|
|
||||||
sudo add-apt-repository -y ppa:philip.scott/pantheon-tweaks
|
|
||||||
sudo apt install -y pantheon-tweaks
|
|
||||||
```
|
|
||||||
|
|
||||||
After installation, open System Settings and you can find Tweaks option there.
|
|
||||||
|
|
||||||
A detailed installation guide is [available here][5] (if you need more information).
|
|
||||||
|
|
||||||
#### 4\. Configure Dock
|
|
||||||
|
|
||||||
Dock is the center of the desktop. And honestly, the default apps that is included in the dock are not that popular. So, you can always configure the dock items using the below steps.
|
|
||||||
|
|
||||||
* To remove: Right click and uncheck the **Keep in Dock** option.
|
|
||||||
* To add new items: Click on Application at the top. Then right-click on the application icon which you want in dock. Select **Add to Dock**.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
In my opinion, you should add at least – File manager, screenshot tool, Firefox, Calculator – among other things. And remove the ones you don’t need.
|
|
||||||
|
|
||||||
#### 5\. Change the look and feel
|
|
||||||
|
|
||||||
The elementary OS 6 Odin revamped the overall look of the desktop with pre-loaded accent color, native dark mode for entire desktop and applications. Also, pre-loads nice wallpapers. You can customize all these via . There you will have options for Wallpaper, Appearance, Panels and Multitasking.
|
|
||||||
|
|
||||||
![elementary OS 6 Odin settings window – Desktop][6]
|
|
||||||
|
|
||||||
Configure the look as you wish.
|
|
||||||
|
|
||||||
[][7]
|
|
||||||
|
|
||||||
SEE ALSO: elementary OS 6 Odin: New Features and Release Date
|
|
||||||
|
|
||||||
Oh, you can also schedule the Dark and Light mode based on Sunset and Sunrise!
|
|
||||||
|
|
||||||
#### 6\. Install Additional Applications
|
|
||||||
|
|
||||||
The native AppCenter is great for this OS. I find it one of the best curated app store available in Linux desktop. However, sometimes It’s also better to install necessary applications (mostly the known ones) those are not pre-loaded. Here’s a quick list of applications which you can install in a fresh system. _(Seriously, why LibreOffice is not preloaded?)_
|
|
||||||
|
|
||||||
* firefox
|
|
||||||
* gimp
|
|
||||||
* gedit
|
|
||||||
* inkscape
|
|
||||||
* obs-studio
|
|
||||||
* libreoffice
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### 7\. Some Battery Saver Tips (Laptop)
|
|
||||||
|
|
||||||
There are many ways which you can configure your elementary OS (or Linux desktop in general) to save battery life. Remember that battery life depends on your Laptop hardware, how old the battery/Laptop is among other things. So, following some of the below tips to get the maximum out of your Laptop battery.
|
|
||||||
|
|
||||||
* Install [tlp][8]. The tlp is a simple to use, terminal based utility to help you to save Battery Life in Linux. You need to just install it, and it will take care of the other settings by default. Installation commands:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo add-apt-repository ppa:linrunner/tlp
|
|
||||||
sudo apt update
|
|
||||||
sudo apt-get install tlp
|
|
||||||
sudo tlp start
|
|
||||||
```
|
|
||||||
|
|
||||||
* Turn off Bluetooth, which is turned on by default. Enable it when required.
|
|
||||||
|
|
||||||
|
|
||||||
* Install thermald via below command. This utility (actually a daemon) controls the P-States, T-States of your CPU for temperature and controls the heating.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt install thermald
|
|
||||||
```
|
|
||||||
|
|
||||||
* Control brightness to minimum as per your need.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### 8\. Install a Disk Utility
|
|
||||||
|
|
||||||
More often, you can find that you need to format a USB or write something to USB. By default, there are no application installed. The best applications with easy usage are the below ones. You can install them.
|
|
||||||
|
|
||||||
```
|
|
||||||
gnome-disk-utility
|
|
||||||
gparted
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 9\. Enable Minimize and Maximize Option
|
|
||||||
|
|
||||||
Many users prefer to have the Maximize, Minimize window buttons at the left or right of the window title bar. The elementary OS only gives you close and restore options by default. Which is completely fine because of the way it’s designed. However, you can use Pantheon Tweaks to enable it via Tweaks > Appearance > Window Controls.
|
|
||||||
|
|
||||||
![enable minimize maximize buttons elementary OS][9]
|
|
||||||
|
|
||||||
#### 10\. Learn the new multi-touch gestures in Odin
|
|
||||||
|
|
||||||
If you are a Laptop user, and using elementary OS Odin, then you definitely check out the super cool new gestures. A three-finger swipe up smoothly opens the Multitasking View, exposing open apps and workspaces. A three-finger swipe left or right smoothly switches between the dynamic workspaces, making it even faster to jump between tasks.
|
|
||||||
|
|
||||||
And with two fingers you can achieve similar feature inside native applications as well.
|
|
||||||
|
|
||||||
### Closing Notes
|
|
||||||
|
|
||||||
I hope these 10 things to do after installing elementary OS 6 helps you and get you started with elementary OS 6 Odin. Although, these are completely user preference; hence these may or may not apply to you. But in general, these are expected tweaks that the average user prefers.
|
|
||||||
|
|
||||||
Let me know in the comments below if there are some more tweaks you feel that should be added in the list.
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://www.debugpoint.com/2021/08/10-things-to-do-after-install-elementary-os-6/
|
|
||||||
|
|
||||||
作者:[Arindam][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://www.debugpoint.com/author/admin1/
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://www.debugpoint.com/2021/08/elementary-os-6/
|
|
||||||
[2]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/hostname-change-before.jpeg
|
|
||||||
[3]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/changing-hostname.jpeg
|
|
||||||
[4]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/changed-hostname.jpeg
|
|
||||||
[5]: https://www.debugpoint.com/2021/07/elementary-tweaks-install/
|
|
||||||
[6]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/elementary-OS-6-Odin-settings-window-Desktop.jpeg
|
|
||||||
[7]: https://www.debugpoint.com/2020/09/elementary-os-6-odin-new-features-release-date/
|
|
||||||
[8]: https://linrunner.de/tlp/
|
|
||||||
[9]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/enable-minimize-maximize-buttons-elementary-OS-1024x501.png
|
|
@ -1,105 +0,0 @@
|
|||||||
[#]: subject: "How to set up your printer on Linux"
|
|
||||||
[#]: via: "https://opensource.com/article/21/8/add-printer-linux"
|
|
||||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
|
||||||
[#]: collector: "lujun9972"
|
|
||||||
[#]: translator: "fisherue "
|
|
||||||
[#]: reviewer: " "
|
|
||||||
[#]: publisher: " "
|
|
||||||
[#]: url: " "
|
|
||||||
|
|
||||||
如何在 Linux 系统设置打印机
|
|
||||||
======
|
|
||||||
如果系统没有自动检测到你的打印机,这篇文章教你任何在 Linux 系统手动添加打印机。
|
|
||||||
![printing on Linux][1]
|
|
||||||
|
|
||||||
即使未来已来,电子墨水 (e-ink) 和 AR 技术可以现实应用,我们还是会用到打印机的。打印机制造商还不能做到让自己的专利打印机可以与各种计算机完全标准化传递信息,以至于我们需要各种打印机驱动程序,在任何操作系统上都是如此。电子电气工程师协会信息科学与技术处 (IEEE-ISTO) 下属的打印机工作组 (PWG) 和开放打印技术组织 (OpenPrinting.org) 长期合作致力于让人们可以(使用任何型号打印机)轻松打印。带来的便利就是,很多打印机可以不需要用户进行配置就可以自动被识别使用。
|
|
||||||
|
|
||||||
如果系统没有自动检测到你的打印机,你可以在这篇文章中找到如何在 Linux 系统手动添加打印机。文中假定你使用的是 GNOME 图形桌面系统,其设置流程同样适用于 KDE 或其他多数桌面系统。
|
|
||||||
|
|
||||||
### 打印机驱动程序
|
|
||||||
|
|
||||||
在你尝试用打印机打印文件时,要先确认你的 Linux 系统上是不是已经安装了匹配的打印机驱动程序。
|
|
||||||
|
|
||||||
可以尝试安装的打印机驱动程序有三大类:
|
|
||||||
|
|
||||||
* 在你的 Linux 系统作为安装包提供的开源打印机驱动程序 [Gutenprint drivers][2]
|
|
||||||
* 打印机制造商提供的专用驱动程序
|
|
||||||
* 第三方开发提供的打印机驱动程序
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
开源打印机驱动程序库可以驱动 700 多种打印机,值得安装,这里面可能就有你的打印机的驱动,说不定可以自动设置好你的打印机(,你就可以使用它了)。
|
|
||||||
|
|
||||||
### 安装开源驱动程序包(库)
|
|
||||||
|
|
||||||
有些 Linux 发行版已经预装了开源打印机驱动程序包,如果没有,你可以用包管理器来安装。比如说,在 Fedora, CentOS, Magela 等类似发行版的 Linux 系统上,执行下面命令来安装:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
`$ sudo dnf install gutenprint`
|
|
||||||
```
|
|
||||||
|
|
||||||
惠普 (HP) 系列的打印机,还需要安装惠普的 Linux 图形及打印系统软件包 (Hewlett-Packard's Linux Imaging and Printing (HPLIP) ). 类似 Debian, Linux Mint 等系列的系统,使用下面的命令:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
`$ sudo apt install hplip`
|
|
||||||
```
|
|
||||||
|
|
||||||
### 安装制造商提供的驱动程序
|
|
||||||
|
|
||||||
很多时候因为打印机制造商使用非标准的接口协议,这种情况开源打印机驱动程序就不能驱动打印机。另外的情况就是,开源驱动程序可以驱动打印机工作,但是会缺少品牌特有的有些性能。这些情况,你需要访问制造商的网站,找到适合你的打印机型号的 Linux 平台驱动。安装过程各异,仔细阅读安装指南逐步安装。
|
|
||||||
|
|
||||||
即便是厂家的驱动也不能驱动你的打印机工作,你或许也只能尝试第三方提供的该型号打印机的驱动软件 ([third-party driver authors][3]) 了。这类第三方驱动程序不是开源的,和打印机专用驱动程序一样闭源。如果你需要额外花费 45 美元(约 400 员人民币)从供应商那里获取帮助服务才能安装好驱动并使用你的打印机,那是很心疼,或者你索性把这台打印机扔掉,至少你知道下次再也不会购买这个品牌的打印机了。(译者注:国内售后服务收费没有北美那么高,有需要还是先电话咨询售后,有没有 Linux 平台的专用驱动可真是碰运气。)
|
|
||||||
|
|
||||||
### 统一接口打印驱动系统(CUPS)
|
|
||||||
|
|
||||||
统一接口打印驱动系统 (CUPS) 是由 Easy Software Products 公司于 1997 年开发的,2007 年被苹果公司 (Apple) 收购。这是 Linux 平台打印的开源基础软件包,很多改进的发行版本提供定制化的界面。得益于 CUPS 技术,你可以发使用通过 USB 接口连接到电脑的打印机,甚至连接在同一网络的共享打印机。
|
|
||||||
|
|
||||||
一旦你安装了需要的驱动程序包,你就能手工添加你的打印机了。首先,把打印机连接到运行的电脑上,并打开打印机电源。然后从启动器 **(Activities**)或者应用列表中找到并打开打印机设置**(Printers)**。![printer settings][4]
|
|
||||||
|
|
||||||
CC BY-SA Opensource.com
|
|
||||||
|
|
||||||
基于你已经安装的驱动包,你的 Linux 系统有可能自动检测识别到你的打印机型号,不需要额外的设置就可以使用你的打印机了。
|
|
||||||
|
|
||||||
![printer settings][5]
|
|
||||||
|
|
||||||
CC BY-SA Opensource.com
|
|
||||||
|
|
||||||
一旦你在列表中找到你的打印机型号,设置使用这个驱动,恭喜你就可以在 Linux 系统上用它打印了。
|
|
||||||
|
|
||||||
(如果你的打印机没有被自动识别,)你需要自行添加打印机。在打印机设置界面**(Printers)**,点击右上角的解锁按钮(**Unlock**),输入管理用户密码,按钮转换成**添加打印机**按钮 (**Add**) 。
|
|
||||||
|
|
||||||
然后点击这个**添加打印机**按钮 (**Add**) ,电脑会搜索已经连接的本地打印机型号并匹配相应驱动程序。如果要添加网络共享打印机,在搜索框输入打印机或者其服务器机的 IP 地址。
|
|
||||||
|
|
||||||
![searching for a printer][6]
|
|
||||||
|
|
||||||
CC BY-SA Opensource.com
|
|
||||||
|
|
||||||
选中你想添加的打印机型号,点击**添加**按钮 (**Add**) 把打印机驱动加入系统,就可以使用它了。
|
|
||||||
|
|
||||||
### 在 Linux 系统上打印
|
|
||||||
|
|
||||||
在 Linux 系统上打印很容易,不管你是在使用本地打印机还是网络打印机。如果你计划购买打印机,建议查看开放打印技术组织的(可支持打印机)数据库 ( [OpenPrinting.org database][7] ) ,看看你想购买的打印机是不是有相应的开源驱动程序。如果你已经拥有一台打印机,你现在也知道怎样在你的 Linux 系统上使用你的打印机了。
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/article/21/8/add-printer-linux
|
|
||||||
|
|
||||||
作者:[Seth Kenlon][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[fisherue](https://github.com/fisherue)
|
|
||||||
校对:[校对者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/happy-printer.png?itok=9J44YaDs "printing on Linux"
|
|
||||||
[2]: http://gimp-print.sourceforge.net/
|
|
||||||
[3]: https://www.turboprint.info/
|
|
||||||
[4]: https://opensource.com/sites/default/files/system-settings-printer_0.png "printer settings"
|
|
||||||
[5]: https://opensource.com/sites/default/files/settings-printer.png "printer settings"
|
|
||||||
[6]: https://opensource.com/sites/default/files/printer-search.png "searching for a printer"
|
|
||||||
[7]: http://www.openprinting.org/printers/
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
|||||||
[#]: subject: "Apps for daily needs part 4: audio editors"
|
|
||||||
[#]: via: "https://fedoramagazine.org/apps-for-daily-needs-part-4-audio-editors/"
|
|
||||||
[#]: author: "Arman Arisman https://fedoramagazine.org/author/armanwu/"
|
|
||||||
[#]: collector: "lujun9972"
|
|
||||||
[#]: translator: "geekpi"
|
|
||||||
[#]: reviewer: " "
|
|
||||||
[#]: publisher: " "
|
|
||||||
[#]: url: " "
|
|
||||||
|
|
||||||
Apps for daily needs part 4: audio editors
|
|
||||||
======
|
|
||||||
|
|
||||||
![][1]
|
|
||||||
|
|
||||||
Photo by [Brooke Cagle][2] on [Unsplash][3]
|
|
||||||
|
|
||||||
Audio editor applications or digital audio workstations (DAW) were only used in the past by professionals, such as record producers, sound engineers, and musicians. But nowadays many people who are not professionals also need them. These tools are used for narration on presentations, video blogs, and even just as a hobby. This is especially true now since there are so many online platforms that facilitate everyone sharing audio works, such as music, songs, podcast, etc. This article will introduce some of the open source audio editors or DAW 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 audio editors or DAW category.
|
|
||||||
|
|
||||||
### Audacity
|
|
||||||
|
|
||||||
I’m sure many already know Audacity. It is a popular multi-track audio editor and recorder that can be used for post-processing all types of audio. Most people use Audacity to record their voices, then do editing to make the results better. The results can be used as a podcast or a narration for a video blog. In addition, people also use Audacity to create music and songs. You can record live audio through a microphone or mixer. It also supports 32 bit sound quality.
|
|
||||||
|
|
||||||
Audacity has a lot of features that can support your audio works. It has support for plugins, and you can even write your own plugin. Audacity provides many built-in effects, such as noise reduction, amplification, compression, reverb, echo, limiter, and many more. You can try these effects while listening to the audio directly with the real-time preview feature. The built in plugin-manager lets you manage frequently used plugins and effects.
|
|
||||||
|
|
||||||
![][5]
|
|
||||||
|
|
||||||
More information is available at this link: <https://www.audacityteam.org/>
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
### LMMS
|
|
||||||
|
|
||||||
LMMS or Linux MultiMedia Studio is a comprehensive music creation application. You can use LMMS to produce your music from scratch with your computer. You can create melodies and beats according to your creativity, and make it better with selection of sound instruments and various effects. There are several built-in features related to musical instruments and effects, such as 16 built-in sythesizers, embedded ZynAddSubFx, drop-in VST effect plug-in support, bundled graphic and parametric equalizer, built-in analyzer, and many more. LMMS also supports MIDI keyboards and other audio peripherals.
|
|
||||||
|
|
||||||
![][6]
|
|
||||||
|
|
||||||
More information is available at this link: <https://lmms.io/>
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
### Ardour
|
|
||||||
|
|
||||||
Ardour has capabilities similar to LMMS as a comprehensive music creation application. It says on its website that Ardour is a DAW application that is the result of collaboration between musicians, programmers, and professional recording engineers from around the world. Ardour has various functions that are needed by audio engineers, musicians, soundtrack editors, and composers.
|
|
||||||
|
|
||||||
Ardour provides complete features for recording, editing, mixing, and exporting. It has unlimited multichannel tracks, non-linear editor with unlimited undo/redo, a full featured mixer, built-in plugins, and much more. Ardour also comes with video playback tools, so it is also very helpful in the process of creating and editing soundtracks for video projects.
|
|
||||||
|
|
||||||
![][7]
|
|
||||||
|
|
||||||
More information is available at this link: <https://ardour.org/>
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
### TuxGuitar
|
|
||||||
|
|
||||||
TuxGuitar is a tablature and score editor. It comes with a tablature editor, score viewer, multitrack display, time signature management, and tempo management. It includes various effects, such as bend, slide, vibrato, etc. While TuxGuitar focuses on the guitar, it allows you to write scores for other instruments. It can also serve as a basic MIDI editor. You need to have an understanding of tablature and music scoring to be able to use it.
|
|
||||||
|
|
||||||
![][8]
|
|
||||||
|
|
||||||
More information is available at this link: <http://www.tuxguitar.com.ar/>
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
### Conclusion
|
|
||||||
|
|
||||||
This article presented four audio editors as apps for your daily needs and use on Fedora Linux. Actually there are many other audio editors, or DAW, that you can use on Fedora Linux. You can also use Mixxx, Rosegarden, Kwave, Qtractor, MuseScore, musE, and many more. Hopefully this article can help you investigate and choose the right audio editor or DAW. If you have experience using these applications, please share your experiences in the comments.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://fedoramagazine.org/apps-for-daily-needs-part-4-audio-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-4-Audio-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/08/audio-audacity-1024x575.png
|
|
||||||
[6]: https://fedoramagazine.org/wp-content/uploads/2021/08/audio-lmms-1024x575.png
|
|
||||||
[7]: https://fedoramagazine.org/wp-content/uploads/2021/08/audio-ardour-1024x592.png
|
|
||||||
[8]: https://fedoramagazine.org/wp-content/uploads/2021/08/audio-tuxguitar-1024x575.png
|
|
@ -1,126 +0,0 @@
|
|||||||
[#]: subject: "Ulauncher: A Super Useful Application Launcher for Linux"
|
|
||||||
[#]: via: "https://itsfoss.com/ulauncher/"
|
|
||||||
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
|
||||||
[#]: collector: "lujun9972"
|
|
||||||
[#]: translator: "geekpi"
|
|
||||||
[#]: reviewer: " "
|
|
||||||
[#]: publisher: " "
|
|
||||||
[#]: url: " "
|
|
||||||
|
|
||||||
Ulauncher: A Super Useful Application Launcher for Linux
|
|
||||||
======
|
|
||||||
|
|
||||||
_**Brief:**_ _Ulauncher is a fast application launcher with extension and shortcut support to help you quickly access application and files in Linux._
|
|
||||||
|
|
||||||
An application launcher lets you quickly access or open an app without hovering over the application menu icons.
|
|
||||||
|
|
||||||
By default, I found the application launcher with Pop!_OS super handy. But, not every Linux distribution offers an application launcher out-of-the-box.
|
|
||||||
|
|
||||||
Fortunately, there is a solution with which you can add the application launcher to most of the popular distros out there.
|
|
||||||
|
|
||||||
### Ulauncher: Open Source Application Launcher
|
|
||||||
|
|
||||||
![][1]
|
|
||||||
|
|
||||||
Ulauncher is a quick application launcher built using Python while utilizing GTK+.
|
|
||||||
|
|
||||||
It gives a decent amount of customization and control options to tweak. Overall, you can adjust its behavior and experience to suit your taste.
|
|
||||||
|
|
||||||
Let me highlight some of the features that you can expect with it.
|
|
||||||
|
|
||||||
### Ulauncher Features
|
|
||||||
|
|
||||||
The options that you get with Ulauncher are super accessible and easy to customize. Some key highlights include:
|
|
||||||
|
|
||||||
* Fuzzy search algorithm, which lets you find applications even if you misspell them
|
|
||||||
* Remembers your last searched application in the same session
|
|
||||||
* Frequently used apps display (optional)
|
|
||||||
* Custom color themes
|
|
||||||
* Preset color themes that include a dark theme
|
|
||||||
* Shortcut to summon the launcher can be easily customized
|
|
||||||
* Browse files and directories
|
|
||||||
* Support for extensions to get extra functionality (emoji, weather, speed test, notes, password manager, etc.)
|
|
||||||
* Shortcuts for browsing sites like Google, Wikipedia, and Stack Overflow
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
It provides almost every helpful ability that you may expect in an application launcher, and even better.
|
|
||||||
|
|
||||||
### How to Use Ulauncher in Linux?
|
|
||||||
|
|
||||||
By default, you need to press **Ctrl + Space** to get the application launcher after you open it from the application menu for the first time.
|
|
||||||
|
|
||||||
Start typing in to search for an application. And, if you are looking for a file or directory, start typing with “**~**” or “**/**” (ignoring the quotes).
|
|
||||||
|
|
||||||
![][2]
|
|
||||||
|
|
||||||
There are default shortcuts like “**g XYZ**” where XYZ is the search term you want to search for in Google.
|
|
||||||
|
|
||||||
![][3]
|
|
||||||
|
|
||||||
Similarly, you can search for something directly taking you to Wikipedia or Stack Overflow, with “**wiki**” and “**so**” shortcuts, respectively.
|
|
||||||
|
|
||||||
Without any extensions, you can also calculate things on the go and copy the results directly to the keyboard.
|
|
||||||
|
|
||||||
![][4]
|
|
||||||
|
|
||||||
This should come in handy for quick calculations without needing to launch the calculator app separately.
|
|
||||||
|
|
||||||
You can head to its [extensions page][5] and browse for useful extensions along with screenshots that should instruct you how to use it.
|
|
||||||
|
|
||||||
To change how it works, enable frequent applications display, and adjust the theme — click on the gear icon on the right side of the launcher.
|
|
||||||
|
|
||||||
![][6]
|
|
||||||
|
|
||||||
You can set it to auto-start. But, if it does not work on your Systemd enabled distro, you can refer to its GitHub page to add it to the service manager.
|
|
||||||
|
|
||||||
The options are self-explanatory and are easy to customize, as shown in the screenshot below.
|
|
||||||
|
|
||||||
![][7]
|
|
||||||
|
|
||||||
### Installing Ulauncher in Linux
|
|
||||||
|
|
||||||
Ulauncher provides a **.deb** package for Debian or Ubuntu-based distributions. You can explore [how to install Deb][8] [f][8][iles][8] if you’re new to Linux.
|
|
||||||
|
|
||||||
In either case, you can also add its PPA and install it via terminal by following the commands below:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo add-apt-repository ppa:agornostal/ulauncher
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install ulauncher
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also find it available in the [AUR][9] for Arch and Fedora’s default repositories.
|
|
||||||
|
|
||||||
For more information, you can head to its official website or the [GitHub page][10].
|
|
||||||
|
|
||||||
[Ulauncher][11]
|
|
||||||
|
|
||||||
Ulauncher should be an impressive addition to any Linux distro. Especially, if you want the functionality of a quick launcher like Pop!_OS offers, this is a fantastic option to consider.
|
|
||||||
|
|
||||||
_Have you tried Ulauncher yet? You are welcome to share your thoughts on how this might help you get things done quickly._
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://itsfoss.com/ulauncher/
|
|
||||||
|
|
||||||
作者:[Ankush Das][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://itsfoss.com/author/ankush/
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/ulauncher.png?resize=800%2C512&ssl=1
|
|
||||||
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/ulauncher-directory.png?resize=800%2C503&ssl=1
|
|
||||||
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/ulauncher-google.png?resize=800%2C449&ssl=1
|
|
||||||
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/ulauncher-calculator.png?resize=800%2C429&ssl=1
|
|
||||||
[5]: https://ext.ulauncher.io
|
|
||||||
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/ulauncher-gear-icon.png?resize=800%2C338&ssl=1
|
|
||||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/ulauncher-settings.png?resize=800%2C492&ssl=1
|
|
||||||
[8]: https://itsfoss.com/install-deb-files-ubuntu/
|
|
||||||
[9]: https://itsfoss.com/aur-arch-linux/
|
|
||||||
[10]: https://github.com/Ulauncher/Ulauncher/
|
|
||||||
[11]: https://ulauncher.io
|
|
@ -1,121 +0,0 @@
|
|||||||
[#]: subject: "Linux kernel modules we can't live without"
|
|
||||||
[#]: via: "https://opensource.com/article/21/8/linux-kernel-module"
|
|
||||||
[#]: author: "Jen Wike Huger https://opensource.com/users/jen-wike"
|
|
||||||
[#]: collector: "lujun9972"
|
|
||||||
[#]: translator: " "
|
|
||||||
[#]: reviewer: " "
|
|
||||||
[#]: publisher: " "
|
|
||||||
[#]: url: " "
|
|
||||||
|
|
||||||
Linux kernel modules we can't live without
|
|
||||||
======
|
|
||||||
Open source enthusiasts weigh in on the Linux kernel modules they love.
|
|
||||||
![Linux keys on the keyboard for a desktop computer][1]
|
|
||||||
|
|
||||||
The Linux kernel is turning 30 this year! If you're like us, that's a big deal and we are celebrating Linux this week with a couple of special posts.
|
|
||||||
|
|
||||||
Today we start with a roundup of responses from around the community answering "What Linux kernel module can you not live without? And, why?" Let's hear what these 10 enthusiasts have to say.
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
I guess some kernel developers will run away screaming when they hear my answer. Still, I list here two of the most controversial modules:
|
|
||||||
|
|
||||||
* First is NVIDIA, as I have an NVIDIA graphics card on my work laptop and my personal desktop.
|
|
||||||
* The other one probably generates less hatred—the VMNET and VMMON modules from VMware to be able to run VMware Workstation. —[Peter Czanik][2]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
My favorite is the [zram][3] module. It creates a compressed block device in memory, which can then be used as a swap partition. Using a zram-based swap partition is ideal when memory is limited (for example, on virtual machines) and if you are worried about wearing out your SSD or, even worse, your flash-based storage because of frequent I/O operations. —[Stephan Avenwedde][4]
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
The most useful kernel module is definitively snd-hda-intel since it supports most integrated sound cards. I listen to music while coding an audio sequencer on the Linux desktop. —[Joël Krähemann][5]
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
My laptop would be worthless without the kmod-wl that I generate with the Broadcom file. I sometimes get messages about tainting the kernel, but what good is a laptop without wireless? —[Gregory Pittman][6]
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
I can't live without Bluetooth. Without it, my mouse, keyboard, speakers, and headset would be doorstops. —[Gary Smith][7]
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
I'm going to go out on a limb and say _all of them_. Seriously, we've gotten to the point where I grab a random piece of hardware, plug it in, and it just works.
|
|
||||||
|
|
||||||
* USB serial adapter just works
|
|
||||||
* Video card just works (though maybe not at its best)
|
|
||||||
* Network card just works
|
|
||||||
* Sound card just works
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
It's tough not to be utterly impressed with the broad scope of the driver work that all the modules bring to the whole. I remember the bad old days when we used to yell out xrandr magic strings to make projectors work, and now—yeah, it's a genuine rarity when stuff doesn't (mostly) just work.
|
|
||||||
|
|
||||||
If I had to nail it down to one, though, it'd be raid6. —[John 'Warthog9' Hawley][8]
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
I'm going to go back to the late 1990s for this one. I was a Unix systems administrator (and double duty as IS manager) for a small company. Our tape backup system died, and because of "small company" limited budgets, we didn't have a rush replacement or onsite repair on it. So we had to send it in for repair.
|
|
||||||
|
|
||||||
During those two weeks, we didn't have a way to make tape backups. No systems administrator wants to be in that position.
|
|
||||||
|
|
||||||
But then I remembered reading the [Floppy Tape How-to][9], and we happened to have a tower PC we'd just replaced that had a floppy tape drive.
|
|
||||||
|
|
||||||
So I reinstalled it with Linux, set up the **ftape** kernel driver module, ran a few backup/recovery tests, then ran our most important backups to QIC tapes. For those two weeks, we relied on **ftape** backups of critical data.
|
|
||||||
|
|
||||||
So to the unsung hero out there who made floppy tape drives work on 1990s Linux, you are awesome! —[Jim Hall][10]
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
Well, that's easy. It's the kvm kernel modules. On a personal front, I cannot imagine doing my day-to-day work without VMs. I'd like to believe that's the case with most of us. The kvm modules also play a big part in making Linux central to the cloud strategy. —[Gaurav Kamathe][11]
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
For me, it's dm-crypt, which is used for LUKS. See:
|
|
||||||
|
|
||||||
* <https://www.redhat.com/sysadmin/disk-encryption-luks>
|
|
||||||
* <https://manpages.debian.org/unstable/cryptsetup-bin/cryptsetup.8.en.html>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
It's fantastic to know others cannot see what's on your disk, for example, if you lose your notebook or it gets stolen. —[Maximilian Kolb][12]
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
For cryptography basics, it's hard to beat the crypto module and its C API, which is straightforward.
|
|
||||||
|
|
||||||
For day-to-day life, is there anything more valuable than the plug-and-play that Bluetooth provides? —[Marty Kalin][13]
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
Share with us in the comments: What Linux kernel module can you not live without?
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/article/21/8/linux-kernel-module
|
|
||||||
|
|
||||||
作者:[Jen Wike Huger][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://opensource.com/users/jen-wike
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
|
|
||||||
[2]: https://opensource.com/users/czanik
|
|
||||||
[3]: https://en.wikipedia.org/wiki/Zram
|
|
||||||
[4]: https://opensource.com/users/hansic99
|
|
||||||
[5]: https://opensource.com/users/joel2001k
|
|
||||||
[6]: https://opensource.com/users/greg-p
|
|
||||||
[7]: https://opensource.com/users/greptile
|
|
||||||
[8]: https://opensource.com/users/warthog9
|
|
||||||
[9]: https://tldp.org/HOWTO/Ftape-HOWTO.html
|
|
||||||
[10]: https://opensource.com/users/jim-hall
|
|
||||||
[11]: https://opensource.com/users/gkamathe
|
|
||||||
[12]: https://opensource.com/users/kolb
|
|
||||||
[13]: https://opensource.com/users/mkalindepauledu
|
|
184
sources/tech/20210828 Parse command-line options in Groovy.md
Normal file
184
sources/tech/20210828 Parse command-line options in Groovy.md
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
[#]: subject: "Parse command-line options in Groovy"
|
||||||
|
[#]: via: "https://opensource.com/article/21/8/parsing-command-options-groovy"
|
||||||
|
[#]: author: "Chris Hermansen https://opensource.com/users/clhermansen"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: " "
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
Parse command-line options in Groovy
|
||||||
|
======
|
||||||
|
Learn to add options to your Groovy applications.
|
||||||
|
![Woman sitting in front of her computer][1]
|
||||||
|
|
||||||
|
A recent article provided an [introduction to parsing command-line options in Java][2]. Because I really like Groovy, and because Groovy is well suited for scripting, and because it's fun to compare Java and Groovy solutions, I decided to paraphrase Seth's article, but using Groovy.
|
||||||
|
|
||||||
|
### Install Groovy
|
||||||
|
|
||||||
|
Groovy is based on Java, so it requires a Java installation. Both a recent and decent version of Java and Groovy might be in your Linux distribution's repositories. Alternately, you can install Groovy by following the instructions on the [groovy-lang.org][3].
|
||||||
|
|
||||||
|
A nice alternative for Linux users is [SDKMan][4], which can be used to get multiple versions of Java, Groovy, and many other related tools. For this article, I'm using my distro's OpenJDK11 release and SDKMan's latest Groovy release.
|
||||||
|
|
||||||
|
### Parsing command-line options in Groovy
|
||||||
|
|
||||||
|
When we create a script—a kind of short, often informal program—to be run from the command line, we normally follow the practice of passing arguments to the script on the command line. A good example of this is the `ls` command, used to list all the files and subfolders in a given folder, perhaps showing attributes and sorted in reverse order of last modification date, as in:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ ls -lt /home/me`
|
||||||
|
```
|
||||||
|
|
||||||
|
To show the contents of my home folder like this:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
total 252
|
||||||
|
drwxr-xr-x 5 me me 4096 Aug 10 12:23 Downloads
|
||||||
|
drwx------ 11 me me 4096 Aug 10 08:59 Dropbox
|
||||||
|
drwxr-xr-x 27 me me 12288 Aug 9 11:58 Pictures
|
||||||
|
-rw-rw-r-- 1 me me 235 Jul 28 16:22 wb.groovy
|
||||||
|
drwxr-xr-x 2 me me 4096 Jul 20 22:04 Desktop
|
||||||
|
drwxrwxr-x 2 me me 4096 Jul 20 15:16 Fixed
|
||||||
|
drwxr-xr-x 2 me me 16384 Jul 19 08:49 Music
|
||||||
|
-rw-rw-r-- 1 me me 433 Jul 7 13:24 foo
|
||||||
|
drwxr-xr-x 6 me me 4096 Jun 29 10:25 Documents
|
||||||
|
drwxr-xr-x 2 me me 4096 Jun 14 22:15 Templates
|
||||||
|
-rw-rw-r-- 1 me me 803 Jun 14 11:33 bar
|
||||||
|
```
|
||||||
|
|
||||||
|
Of course, arguments to commands can be handled by inspecting them and deciding what to do in each case; but this ends up being a duplication of effort that can be avoided by using a library designed for that purpose.
|
||||||
|
|
||||||
|
Seth's Java article introduces the [Apache Commons CLI library][5], a great API for handling command-line options. In fact, this library is so great that the good people who develop Groovy make it available by default in the Groovy installation. Therefore, once you have Groovy installed, you have access to this library through [**groovy.cli.picocli.CliBuilder**][6], which is already imported for you by default.
|
||||||
|
|
||||||
|
Here's a Groovy script that uses this CLI builder to achieve the same results as Seth's Java program:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
1 def cli = new CliBuilder(usage: 'ho.groovy [-a] -c')
|
||||||
|
2 cli.with {
|
||||||
|
3 a longOpt: 'alpha', 'Activate feature alpha'
|
||||||
|
4 c longOpt: 'config', args:1, argName: 'config', required: true, 'Set config file'
|
||||||
|
5 }
|
||||||
|
6 def options = cli.parse(args)
|
||||||
|
7 if (!options) {
|
||||||
|
8 return
|
||||||
|
9 }
|
||||||
|
10 if (options.a) {
|
||||||
|
11 println' Alpha activated'
|
||||||
|
12 }
|
||||||
|
13 if (options.c) {
|
||||||
|
14 println "Config set to ${options.c}"
|
||||||
|
15 }
|
||||||
|
```
|
||||||
|
|
||||||
|
I've included line numbers here to facilitate the discussion. Save this script without the line numbers in a file called **ho.groovy**.
|
||||||
|
|
||||||
|
On line 1, we define the variable **cli** and set it to a new instance of **CliBuilder** with a defined **usage** attribute. This is a string that will be printed if the **usage()** method is called.
|
||||||
|
|
||||||
|
On lines 2-5, we use [the **with()** method][7] that Groovy adds to objects, together with the DSL defined by **CliBuilder**, to set up the option definitions.
|
||||||
|
|
||||||
|
On line 3, we define the option '**a**', setting its **longOpt** field to '**alpha**' and its description to '**Activate feature alpha**'.
|
||||||
|
|
||||||
|
Similarly, on line 4, we define the option '**c**', setting its **longOpt** field to '**config**' and specifying that this option takes one argument whose name is '**config**'. Moreover, this is a **required** option (sounds funny, I know), and its description is '**Set config file**'.
|
||||||
|
|
||||||
|
Pausing briefly here for a bit of background, you can read all about these various options at the **CliBuilder** link above. More generally, things written in the form **longOpt: 'alpha'** are Groovy notation for key-value entries to be put in a **Map** instance, which you can read about [here][8]. Each key, in this case, corresponds to a method of the same name provided by the CliBuilder. If you're wondering what's going on with a line like:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`a longOpt: 'alpha', 'Activate feature alpha'`
|
||||||
|
```
|
||||||
|
|
||||||
|
then it may be useful to mention that Groovy allows us to drop parentheses in certain circumstances; so the above is equivalent to:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`a(longOpt: 'alpha', 'Activate feature alpha')`
|
||||||
|
```
|
||||||
|
|
||||||
|
i.e., it's a method call. Moreover, Groovy allows both positional and named parameters, the latter using that key: value syntax.
|
||||||
|
|
||||||
|
Onward! On lines 6-9, we call the **parse()** method of the **CliBuilder** instance **cli**, passing the **args—**an array of **String** values created by the Groovy run-time and containing the arguments from the command line. This method returns a **Map** of the options where the keys are the short-form of the predefined options—in this case, '**a**' and '**c**'. If the parsing fails, then **parse()** emits the **usage** message, a reasonable error message, and returns a null value, so we don't have to use a try-catch block (which one doesn't see as often in Groovy). So here—line 8—we just return since all our work is done for us.
|
||||||
|
|
||||||
|
On lines 10-12, we check to see if option '_a_' was included on the command line and if it is, print a message saying so.
|
||||||
|
|
||||||
|
Similarly, on lines 13-15, we check to see if option '**c**' was included on the command line and if so, print a message showing the argument provided to it.
|
||||||
|
|
||||||
|
### Running the command
|
||||||
|
|
||||||
|
Let’s run the script a few times; first with no arguments:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
$ groovy ho.groovy
|
||||||
|
error: Missing required option: c
|
||||||
|
usage: ho.groovy [-a] -c
|
||||||
|
-a,--alpha Activate feature alpha
|
||||||
|
-c,--config <config> [Set][9] config file
|
||||||
|
$
|
||||||
|
```
|
||||||
|
|
||||||
|
Notice the complaint about missing the required option '**c**'.
|
||||||
|
|
||||||
|
Then with the '**c**' option but no argument:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
$ groovy ho.groovy -c
|
||||||
|
error: Missing argument for option: c
|
||||||
|
usage: ho.groovy [-a] -c
|
||||||
|
-a,--alpha
|
||||||
|
Activate feature alpha
|
||||||
|
-c,--config <config> [Set][9] config file
|
||||||
|
$
|
||||||
|
```
|
||||||
|
|
||||||
|
Cool, the **CliBuilder** instance method **parse()** noticed no argument was provided to '**c**'.
|
||||||
|
|
||||||
|
Finally, let's try with both options and an argument to '**c**', in their long form:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
$ groovy ho.groovy --alpha --config bar
|
||||||
|
Alpha activated
|
||||||
|
Config set to bar
|
||||||
|
$
|
||||||
|
```
|
||||||
|
|
||||||
|
Looks good!
|
||||||
|
|
||||||
|
Since the idea of the '**c**' option is to provide a config file, we could also tell the **CliBuilder** instance that the type of this argument is File, and it will return that instead of a String. But we'll leave that for another day.
|
||||||
|
|
||||||
|
So, there you have it—command-line option parsing in Groovy.
|
||||||
|
|
||||||
|
### Groovy resources
|
||||||
|
|
||||||
|
The Groovy website has a lot of great documentation. Another great Groovy resource is [Mr. Haki][10], and specifically [this lovely article on CliBuilder][11].
|
||||||
|
|
||||||
|
Another great reason to learn Groovy is [Grails][12], a wonderfully productive full-stack web framework built on top of excellent components like Hibernate, Spring Boot, and Micronaut.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/8/parsing-command-options-groovy
|
||||||
|
|
||||||
|
作者:[Chris Hermansen][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/clhermansen
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_3.png?itok=qw2A18BM (Woman sitting in front of her computer)
|
||||||
|
[2]: https://opensource.com/article/21/8/java-commons-cli
|
||||||
|
[3]: https://groovy-lang.org/
|
||||||
|
[4]: https://sdkman.io/
|
||||||
|
[5]: https://commons.apache.org/proper/commons-cli/
|
||||||
|
[6]: https://docs.groovy-lang.org/latest/html/gapi/groovy/cli/picocli/CliBuilder.html
|
||||||
|
[7]: https://objectpartners.com/2014/07/09/groovys-with-and-multiple-assignment/
|
||||||
|
[8]: https://www.baeldung.com/groovy-maps
|
||||||
|
[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+set
|
||||||
|
[10]: https://blog.mrhaki.com/
|
||||||
|
[11]: https://blog.mrhaki.com/2009/09/groovy-goodness-parsing-commandline.html
|
||||||
|
[12]: https://grails.org/
|
@ -0,0 +1,138 @@
|
|||||||
|
[#]: subject: "Position text on your screen in Linux with ncurses"
|
||||||
|
[#]: via: "https://opensource.com/article/21/8/ncurses-linux"
|
||||||
|
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: "perfiffer"
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
Position text on your screen in Linux with ncurses
|
||||||
|
======
|
||||||
|
Use ncurses in Linux to place text at specific locations on the screen
|
||||||
|
and enable more user-friendly interfaces.
|
||||||
|
![Person using a laptop][1]
|
||||||
|
|
||||||
|
Most Linux utilities just scroll text from the bottom of the screen. But what if you wanted to position text on the screen, such as for a game or a data display? That's where **ncurses** comes in.
|
||||||
|
|
||||||
|
**curses** is an old Unix library that supports cursor control on a text terminal screen. The name _curses_ comes from the term _cursor control_. Years later, others wrote an improved version of **curses** to add new features, called _new curses_ or **ncurses**. You can find **ncurses** in every modern Linux distribution, although the development libraries, header files, and documentation may not be installed by default. For example, on Fedora, you will need to install the **ncurses-devel** package with this command:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ sudo dnf install ncurses-devel`
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using ncurses in a program
|
||||||
|
|
||||||
|
To directly address the screen, you'll first need to initialize the **ncurses** library. Most programs will do that with these three lines:
|
||||||
|
|
||||||
|
* initscr(); Initialize the screen and the **ncurses** code
|
||||||
|
* cbreak(); Disable buffering and make typed input immediately available
|
||||||
|
* noecho(); Turn off echo, so user input is not displayed to the screen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
These functions are defined in the **curses.h** header file, which you'll need to include in your program with:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`#include <curses.h>`
|
||||||
|
```
|
||||||
|
|
||||||
|
After initializing the terminal, you're free to use any of the **ncurses** functions, some of which we'll explore in a sample program.
|
||||||
|
|
||||||
|
When you're done with **ncurses** and want to go back to regular terminal mode, use **endwin();** to reset everything. This command resets any screen colors, moves the cursor to the lower-left of the screen, and makes the cursor visible. You usually do this right before exiting the program.
|
||||||
|
|
||||||
|
### Addressing the screen
|
||||||
|
|
||||||
|
The first thing to know about **ncurses** is that screen coordinates are _row,col_, and start in the upper-left at 0,0. **ncurses** defines two global variables to help you identify the screen size: LINES is the number of lines on the screen, and COLS is the number of columns. The bottom-right position is LINES-1,COLS-1.
|
||||||
|
|
||||||
|
For example, if you wanted to move the cursor to line 10 and column 30, you could use the move function with those coordinates:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`move(10, 30);`
|
||||||
|
```
|
||||||
|
|
||||||
|
Any text you display after that will start at that screen location. To display a single character, use the **addch(c)** function with a single character. To display a string, use **addstr(s)** with your string. For formatted output that's similar to **printf**, use **printw(fmt, …)** with the usual options.
|
||||||
|
|
||||||
|
Moving to a screen location and displaying text is such a common thing that **ncurses** provides a shortcut to do both at once. The **mvaddch(row, col, c)** function will display a character at screen location _row,col_. And the **mvaddstr(row, col, s)** function will display a string at that location. For a more direct example, using **mvaddstr(10, 30, "Welcome to ncurses");** in a program will display the text "Welcome to ncurses" starting at row 10 and column 30. And the line **mvaddch(0, 0, '+');** will display a single plus sign in the upper-left corner at row 0 and column 0.
|
||||||
|
|
||||||
|
Drawing text to the terminal screen can have a performance impact on certain systems, especially on older hardware terminals. So **ncurses** lets you "stack up" a bunch of text to display to the screen, then use the **refresh()** function to make all of those changes visible to the user.
|
||||||
|
|
||||||
|
Let's look at a simple example that pulls everything together:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
#include <curses.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
initscr();
|
||||||
|
cbreak();
|
||||||
|
noecho();
|
||||||
|
|
||||||
|
mvaddch(0, 0, '+');
|
||||||
|
mvaddch(LINES - 1, 0, '-');
|
||||||
|
mvaddstr(10, 30, "press any key to quit");
|
||||||
|
refresh();
|
||||||
|
|
||||||
|
getch();
|
||||||
|
|
||||||
|
endwin();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The program starts by initializing the terminal, then prints a plus sign in the upper-left corner, a minus in the lower-left corner, and the text "press any key to quit" at row 10 and column 30. The program gets a single character from the keyboard using the getch() function, then uses **endwin()** to reset the terminal before the program exits completely.
|
||||||
|
|
||||||
|
**getch()** is a useful function that you could use for many things. I often use it as a way to pause before I quit the program. And as with most **ncurses** functions, there's also a version of **getch()** called **mvgetch(row, col)** to move to screen position _row,col_ before waiting for a character.
|
||||||
|
|
||||||
|
### Compiling with ncurses
|
||||||
|
|
||||||
|
If you tried to compile that sample program in the usual way, such as `gcc pause.c`, you'll probably get a huge list of errors from the linker. That's because the **ncurses** library is not linked automatically by the GNU C Compiler. Instead, you'll need to load it for linking using the `-l ncurses` command-line option.
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ gcc -o pause pause.c -lncurses`
|
||||||
|
```
|
||||||
|
|
||||||
|
Running the new program will print a simple "press any key to quit" message that's more or less centered on the screen:
|
||||||
|
|
||||||
|
![centered message in a program window][2]
|
||||||
|
|
||||||
|
Figure 1: A centered "press any key to quit" message in a program.
|
||||||
|
|
||||||
|
### Building better programs with ncurses
|
||||||
|
|
||||||
|
Explore the **ncurses** library functions to learn about other ways to display text to the screen. You can find a list of all **ncurses** functions in the man ncurses manual page. This gives a general overview of **ncurses** and provides a table-like list of the different **ncurses** functions, with a reference to the manual page that has full details. For example, **printw** is described in the _curs_printw(3X)_ manual page, which you can view with:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ man 3x curs_printw`
|
||||||
|
```
|
||||||
|
|
||||||
|
or just:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ man curs_printw`
|
||||||
|
```
|
||||||
|
|
||||||
|
With **ncurses**, you can create more interesting programs. By printing text at specific locations on the screen, you can create games and advanced utilities to run in the terminal.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/8/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/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop)
|
||||||
|
[2]: https://opensource.com/sites/default/files/press-key_0.png
|
@ -0,0 +1,232 @@
|
|||||||
|
[#]: subject: "How to install only security and bugfixes updates with DNF"
|
||||||
|
[#]: via: "https://fedoramagazine.org/how-to-install-only-security-and-bugfixes-updates-with-dnf/"
|
||||||
|
[#]: author: "Mateus Rodrigues Costa https://fedoramagazine.org/author/mateusrodcosta/"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: " "
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
How to install only security and bugfixes updates with DNF
|
||||||
|
======
|
||||||
|
|
||||||
|
![][1]
|
||||||
|
|
||||||
|
Photo by [Scott Webb][2] on [Unsplash][3]
|
||||||
|
|
||||||
|
This article will explore how to filter the updates available to your Fedora Linux system by type. This way you can choose to, for example, only install security or bug fixes updates. This article will demo running the _dnf_ commands inside toolbox instead of using a real Fedora Linux install.
|
||||||
|
|
||||||
|
You might also want to read [Use dnf updateinfo to read update changelogs][4] before reading this article.
|
||||||
|
|
||||||
|
### Introduction
|
||||||
|
|
||||||
|
If you have been managing system updates for Fedora Linux or any other GNU/Linux distro, you might have noticed how, when you run a system update (with _dnf update_, in the case of Fedora Workstation), you usually are not installing only security updates.
|
||||||
|
|
||||||
|
Due to how package management in a GNU/Linux distro works, generally (with the exception of software running in a container, under Flatpak, or similar technologies) you are updating every single package regardless of whether it’s a “system” software or an “app”.
|
||||||
|
|
||||||
|
DNF divides updates in three types: “security”, “bugfix” and “enhancement”. And, as you will see, DNF allows filtering which types you want to operate on.
|
||||||
|
|
||||||
|
But, why would you want to update only a subset of packages?
|
||||||
|
|
||||||
|
Well, this might depend on how you personally choose to deal with system updates. If you are not comfortable at the moment with updating everything, then restricting the current update to only security updates might be a good choice. You could also install bug fix updates as well and only install enhancements and other types of updates during a future opportunity.
|
||||||
|
|
||||||
|
### How to filter security and bug fix updates
|
||||||
|
|
||||||
|
Start by creating a Fedora Linux 34 toolbox:
|
||||||
|
|
||||||
|
```
|
||||||
|
toolbox create --distro fedora --release f34 updatefilter-demo
|
||||||
|
```
|
||||||
|
|
||||||
|
Then enter that toolbox:
|
||||||
|
|
||||||
|
```
|
||||||
|
toolbox enter updatefilter-demo
|
||||||
|
```
|
||||||
|
|
||||||
|
From now on commands can be run on a real Fedora Linux install.
|
||||||
|
|
||||||
|
First, run _dnf check-update_ to see the unfiltered list of packages:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ dnf check-update
|
||||||
|
audit-libs.x86_64 3.0.5-1.fc34 updates
|
||||||
|
avahi.x86_64 0.8-14.fc34 updates
|
||||||
|
avahi-libs.x86_64 0.8-14.fc34 updates
|
||||||
|
...
|
||||||
|
vim-minimal.x86_64 2:8.2.3318-1.fc34 updates
|
||||||
|
xkeyboard-config.noarch 2.33-1.fc34 updates
|
||||||
|
yum.noarch 4.8.0-1.fc34 updates
|
||||||
|
```
|
||||||
|
|
||||||
|
DNF supports passing the types of updates to operate on as parameter: _‐‐security_ for security updates, _‐‐bugfix_ for bug fix updates and _‐‐enhancement_ for enhancement updates. Those work on commands such as _dnf check-update_, _dnf update_ and _dnf updateinfo_.
|
||||||
|
|
||||||
|
For example, this is how you filter the list of available updates by security updates only:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ dnf check-update --security
|
||||||
|
avahi.x86_64 0.8-14.fc34 updates
|
||||||
|
avahi-libs.x86_64 0.8-14.fc34 updates
|
||||||
|
curl.x86_64 7.76.1-7.fc34 updates
|
||||||
|
...
|
||||||
|
libgcrypt.x86_64 1.9.3-3.fc34 updates
|
||||||
|
nettle.x86_64 3.7.3-1.fc34 updates
|
||||||
|
perl-Encode.x86_64 4:3.12-460.fc34 updates
|
||||||
|
```
|
||||||
|
|
||||||
|
And now same thing but by bug fix updates only:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ dnf check-update --bugfix
|
||||||
|
audit-libs.x86_64 3.0.5-1.fc34 updates
|
||||||
|
ca-certificates.noarch 2021.2.50-1.0.fc34 updates
|
||||||
|
coreutils.x86_64 8.32-30.fc34 updates
|
||||||
|
...
|
||||||
|
systemd-pam.x86_64 248.7-1.fc34 updates
|
||||||
|
systemd-rpm-macros.noarch 248.7-1.fc34 updates
|
||||||
|
yum.noarch 4.8.0-1.fc34 updates
|
||||||
|
```
|
||||||
|
|
||||||
|
They can even be combined, so you can use two or more of them at the same time. For example, you can filter the list to show both security and bug fix updates:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ dnf check-update --security --bugfix
|
||||||
|
audit-libs.x86_64 3.0.5-1.fc34 updates
|
||||||
|
avahi.x86_64 0.8-14.fc34 updates
|
||||||
|
avahi-libs.x86_64 0.8-14.fc34 updates
|
||||||
|
...
|
||||||
|
systemd-pam.x86_64 248.7-1.fc34 updates
|
||||||
|
systemd-rpm-macros.noarch 248.7-1.fc34 updates
|
||||||
|
yum.noarch 4.8.0-1.fc34 updates
|
||||||
|
```
|
||||||
|
|
||||||
|
As mentioned, _dnf updateinfo_ also works with this filtering, so you can filter _dnf updateinfo_, _dnf updateinfo list_ and _dnf updateinfo info_. For example, for the list of security updates and their IDs:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ dnf updateinfo list --security
|
||||||
|
FEDORA-2021-74ebf2f06f Moderate/Sec. avahi-0.8-14.fc34.x86_64
|
||||||
|
FEDORA-2021-74ebf2f06f Moderate/Sec. avahi-libs-0.8-14.fc34.x86_64
|
||||||
|
FEDORA-2021-83fdddca0f Moderate/Sec. curl-7.76.1-7.fc34.x86_64
|
||||||
|
FEDORA-2021-e14e86e40e Moderate/Sec. glibc-2.33-20.fc34.x86_64
|
||||||
|
FEDORA-2021-e14e86e40e Moderate/Sec. glibc-common-2.33-20.fc34.x86_64
|
||||||
|
FEDORA-2021-e14e86e40e Moderate/Sec. glibc-minimal-langpack-2.33-20.fc34.x86_64
|
||||||
|
FEDORA-2021-8b25e4642f Low/Sec. krb5-libs-1.19.1-14.fc34.x86_64
|
||||||
|
FEDORA-2021-83fdddca0f Moderate/Sec. libcurl-7.76.1-7.fc34.x86_64
|
||||||
|
FEDORA-2021-31fdc84207 Moderate/Sec. libgcrypt-1.9.3-3.fc34.x86_64
|
||||||
|
FEDORA-2021-d1fc0b9d32 Moderate/Sec. nettle-3.7.3-1.fc34.x86_64
|
||||||
|
FEDORA-2021-92e07de1dd Important/Sec. perl-Encode-4:3.12-460.fc34.x86_64
|
||||||
|
```
|
||||||
|
|
||||||
|
If desired, you can install only security updates:
|
||||||
|
|
||||||
|
```
|
||||||
|
# dnf update --security
|
||||||
|
================================================================================
|
||||||
|
Package Arch Version Repository Size
|
||||||
|
================================================================================
|
||||||
|
Upgrading:
|
||||||
|
avahi x86_64 0.8-14.fc34 updates 289 k
|
||||||
|
avahi-libs x86_64 0.8-14.fc34 updates 68 k
|
||||||
|
curl x86_64 7.76.1-7.fc34 updates 297 k
|
||||||
|
...
|
||||||
|
perl-Encode x86_64 4:3.12-460.fc34 updates 1.7 M
|
||||||
|
Installing weak dependencies:
|
||||||
|
glibc-langpack-en x86_64 2.33-20.fc34 updates 563 k
|
||||||
|
|
||||||
|
Transaction Summary
|
||||||
|
================================================================================
|
||||||
|
Install 1 Package
|
||||||
|
Upgrade 11 Packages
|
||||||
|
|
||||||
|
Total download size: 9.7 M
|
||||||
|
Is this ok [y/N]:
|
||||||
|
```
|
||||||
|
|
||||||
|
Or even to install both security and bug fix updates while ignoring enhancement updates:
|
||||||
|
|
||||||
|
```
|
||||||
|
# dnf update --security --bugfix
|
||||||
|
================================================================================
|
||||||
|
Package Arch Version Repo Size
|
||||||
|
================================================================================
|
||||||
|
Upgrading:
|
||||||
|
audit-libs x86_64 3.0.5-1.fc34 updates 116 k
|
||||||
|
avahi x86_64 0.8-14.fc34 updates 289 k
|
||||||
|
avahi-libs x86_64 0.8-14.fc34 updates 68 k
|
||||||
|
...
|
||||||
|
rpm-plugin-systemd-inhibit x86_64 4.16.1.3-1.fc34 fedora 23 k
|
||||||
|
shared-mime-info x86_64 2.1-2.fc34 fedora 374 k
|
||||||
|
sqlite x86_64 3.34.1-2.fc34 fedora 755 k
|
||||||
|
|
||||||
|
Transaction Summary
|
||||||
|
================================================================================
|
||||||
|
Install 11 Packages
|
||||||
|
Upgrade 45 Packages
|
||||||
|
|
||||||
|
Total download size: 32 M
|
||||||
|
Is this ok [y/N]:
|
||||||
|
```
|
||||||
|
|
||||||
|
### Install only specific updates
|
||||||
|
|
||||||
|
You may also choose to only install the updates with a specific ID, such as _FEDORA-2021-74ebf2f06f_ for avahi by using _–advisory_ and specifying the ID:
|
||||||
|
|
||||||
|
```
|
||||||
|
# dnf update --advisory=FEDORA-2021-74ebf2f06f
|
||||||
|
================================================================================
|
||||||
|
Package Architecture Version Repository Size
|
||||||
|
================================================================================
|
||||||
|
Upgrading:
|
||||||
|
avahi x86_64 0.8-14.fc34 updates 289 k
|
||||||
|
avahi-libs x86_64 0.8-14.fc34 updates 68 k
|
||||||
|
|
||||||
|
Transaction Summary
|
||||||
|
================================================================================
|
||||||
|
Upgrade 2 Packages
|
||||||
|
|
||||||
|
Total download size: 356 k
|
||||||
|
Is this ok [y/N]:
|
||||||
|
```
|
||||||
|
|
||||||
|
Or even multiple updates, with _‐‐advisories_:
|
||||||
|
|
||||||
|
```
|
||||||
|
# dnf update --advisories=FEDORA-2021-74ebf2f06f,FEDORA-2021-83fdddca0f
|
||||||
|
================================================================================
|
||||||
|
Package Architecture Version Repository Size
|
||||||
|
================================================================================
|
||||||
|
Upgrading:
|
||||||
|
avahi x86_64 0.8-14.fc34 updates 289 k
|
||||||
|
avahi-libs x86_64 0.8-14.fc34 updates 68 k
|
||||||
|
curl x86_64 7.76.1-7.fc34 updates 297 k
|
||||||
|
libcurl x86_64 7.76.1-7.fc34 updates 284 k
|
||||||
|
|
||||||
|
Transaction Summary
|
||||||
|
================================================================================
|
||||||
|
Upgrade 4 Packages
|
||||||
|
|
||||||
|
Total download size: 937 k
|
||||||
|
Is this ok [y/N]:
|
||||||
|
```
|
||||||
|
|
||||||
|
### Conclusion
|
||||||
|
|
||||||
|
In the end it all comes down to how you personally prefer to manage your updates. But if you need, for whichever reason, to only install security updates, then these filters will surely come in handy!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://fedoramagazine.org/how-to-install-only-security-and-bugfixes-updates-with-dnf/
|
||||||
|
|
||||||
|
作者:[Mateus Rodrigues Costa][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/mateusrodcosta/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://fedoramagazine.org/wp-content/uploads/2021/08/how-to-install-only-security-and-bugfixes-updates-with-dnf-816x345.jpg
|
||||||
|
[2]: https://unsplash.com/@scottwebb?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||||
|
[3]: https://unsplash.com/s/photos/security?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||||
|
[4]: https://fedoramagazine.org/use-dnf-updateinfo-to-read-update-changelogs/
|
@ -0,0 +1,143 @@
|
|||||||
|
[#]: subject: "Linux Jargon Buster: What is sudo rm -rf? Why is it Dangerous?"
|
||||||
|
[#]: via: "https://itsfoss.com/sudo-rm-rf/"
|
||||||
|
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: " "
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
Linux Jargon Buster: What is sudo rm -rf? Why is it Dangerous?
|
||||||
|
======
|
||||||
|
|
||||||
|
When you are new to Linux, you’ll often come across advice to never run `sudo rm -rf /`. There are so many memes in the Linux world around `sudo rm -rf`.
|
||||||
|
|
||||||
|
![][1]
|
||||||
|
|
||||||
|
But it seems that there are some confusions around it. In the tutorial on [cleaning Ubuntu to make free space][2], I advised running some command that involved sudo and rm -rf. An It’s FOSS reader asked me why I am advising that if sudo rm -rf is a dangerous Linux command that should not be run.
|
||||||
|
|
||||||
|
And thus I thought of writing this chapter of Linux jargon buster and clear the misconceptions.
|
||||||
|
|
||||||
|
### sudo rm -rf: what does it do?
|
||||||
|
|
||||||
|
Let’s learn things in steps.
|
||||||
|
|
||||||
|
The rm command is used for [removing files and directories in Linux command line][3].
|
||||||
|
|
||||||
|
```
|
||||||
|
[email protected]:$ rm agatha
|
||||||
|
[email protected]:$
|
||||||
|
```
|
||||||
|
|
||||||
|
But some files will not be removed immediate because of read only [file permissions][4]. They have to be forced delete with the option `-f`.
|
||||||
|
|
||||||
|
```
|
||||||
|
[email protected]:$ rm books
|
||||||
|
rm: remove write-protected regular file 'books'? y
|
||||||
|
[email protected]:$ rm -f christie
|
||||||
|
[email protected]:$
|
||||||
|
```
|
||||||
|
|
||||||
|
However, rm command cannot be used to delete directories (folders) directly. You have to use the recursive option `-r` with the rm command.
|
||||||
|
|
||||||
|
```
|
||||||
|
[email protected]:$ rm new_dir
|
||||||
|
rm: cannot remove 'new_dir': Is a directory
|
||||||
|
```
|
||||||
|
|
||||||
|
And thus ultimately, rm -rf command means recursively force delete the given directory.
|
||||||
|
|
||||||
|
```
|
||||||
|
[email protected]:~$ rm -r new_dir
|
||||||
|
rm: remove write-protected regular file 'new_dir/books'? ^C
|
||||||
|
[email protected]:$ rm -rf new_dir
|
||||||
|
[email protected]:$
|
||||||
|
```
|
||||||
|
|
||||||
|
Here’s a screenshot of all the above commands:
|
||||||
|
|
||||||
|
![Example explaining rm command][5]
|
||||||
|
|
||||||
|
If you add sudo to the rm -rf command, you are deleting files with root power. That means you could delete system files owned by [root user][6].
|
||||||
|
|
||||||
|
### So, sudo rm -rf is a dangerous Linux command?
|
||||||
|
|
||||||
|
Well, any command that deletes something could be dangerous if you are not sure of what you are deleting.
|
||||||
|
|
||||||
|
Consider **rm -rf command** as a knife. Is knife a dangerous thing? Possibly. If you cut vegetables with the knife, it’s good. If you cut your fingers with the knife, it is bad, of course.
|
||||||
|
|
||||||
|
The same goes for rm -rf command. It is not dangerous in itself. It is used for deleting files after all. But if you use it to delete important files unknowingly, then it is a problem.
|
||||||
|
|
||||||
|
Now coming to ‘sudo rm -rf /’.
|
||||||
|
|
||||||
|
You know that with sudo, you run a command as root, which allows you to make any changes to the system.
|
||||||
|
|
||||||
|
/ is the symbol for the root directory. /var means the var directory under root. /var/log/apt means apt directory under log, under root.
|
||||||
|
|
||||||
|
![Linux directory hierarchy representation][7]
|
||||||
|
|
||||||
|
As per [Linux directory hierarchy][8], everything in a Linux file system starts at root. If you delete root, you are basically removing all the files of your system.
|
||||||
|
|
||||||
|
And this is why it is advised to not run `sudo rm -rf /` command because you’ll wipe out your entire Linux system.
|
||||||
|
|
||||||
|
Please note that in some cases, you could be running a command like ‘sudo rm -rf /var/log/apt’ which could be fine. Again, you have to pay attention on what you are deleting, the same as you have to pay attention on what you are cutting with a knife.
|
||||||
|
|
||||||
|
### I play with danger: what if I run sudo rm -rf / to see what happens?
|
||||||
|
|
||||||
|
Most Linux distributions provide a failsafe protection against accidentally deleting the root directory.
|
||||||
|
|
||||||
|
```
|
||||||
|
[email protected]:~$ sudo rm -rf /
|
||||||
|
[sudo] password for abhishek:
|
||||||
|
rm: it is dangerous to operate recursively on '/'
|
||||||
|
rm: use --no-preserve-root to override this failsafe
|
||||||
|
```
|
||||||
|
|
||||||
|
I mean it is human to make typos and if you accidentally typed “/ var/log/apt” instead of “/var/log/apt” (a space between / and var meaning that you are providing / and var directories to for deletion), you’ll be deleting the root directory.
|
||||||
|
|
||||||
|
![Pay attention when using sudo rm -rf][9]
|
||||||
|
|
||||||
|
That’s quite good. Your Linux system takes care of such accidents.
|
||||||
|
|
||||||
|
Now, what if you are hell-bent on destroying your system with sudo rm -rf /? You’ll have to use It will ask you to use –no-preserve-root with it.
|
||||||
|
|
||||||
|
No, please do not do that on your own. Let me show it to you.
|
||||||
|
|
||||||
|
So, I have elementary OS running in a virtual machine. I run `sudo rm -rf / --no-preserve-root` and you can see the lights going out literally in the video below (around 1 minute).
|
||||||
|
|
||||||
|
[Subscribe to our YouTube channel for more Linux videos][10]
|
||||||
|
|
||||||
|
### Clear or still confused?
|
||||||
|
|
||||||
|
Linux has an active community where most people try to help new users. Most people because there are some evil trolls lurking to mess with the new users. They will often suggest running rm -rf / for the simplest of the problems faced by beginners. These idiots get some sort of supremacist satisfaction I think for such evil acts. I ban them immediately from the forums and groups I administer.
|
||||||
|
|
||||||
|
I hope this article made things clearer for you. It’s possible that you still have some confusion, specially because it involves root, file permissions and other things new users might not be familiar with. If that’s the case, please let me know your doubts in the comment section and I’ll try to clear them.
|
||||||
|
|
||||||
|
In the end, remember. Don’t drink and root. Stay safe while running your Linux system :)
|
||||||
|
|
||||||
|
![][11]
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/sudo-rm-rf/
|
||||||
|
|
||||||
|
作者:[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://i2.wp.com/itsfoss.com/wp-content/uploads/2016/04/sudo-rm-rf.gif?resize=400%2C225&ssl=1
|
||||||
|
[2]: https://itsfoss.com/free-up-space-ubuntu-linux/
|
||||||
|
[3]: https://linuxhandbook.com/remove-files-directories/
|
||||||
|
[4]: https://linuxhandbook.com/linux-file-permissions/
|
||||||
|
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/rm-rf-command-example-800x487.png?resize=800%2C487&ssl=1
|
||||||
|
[6]: https://itsfoss.com/root-user-ubuntu/
|
||||||
|
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/linux-directory-structure.png?resize=800%2C400&ssl=1
|
||||||
|
[8]: https://linuxhandbook.com/linux-directory-structure/
|
||||||
|
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/sudo-rm-rf-example.png?resize=798%2C346&ssl=1
|
||||||
|
[10]: https://www.youtube.com/c/itsfoss?sub_confirmation=1
|
||||||
|
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/dont-drink-and-root.jpg?resize=800%2C450&ssl=1
|
113
sources/tech/20210830 Print from anywhere with CUPS on Linux.md
Normal file
113
sources/tech/20210830 Print from anywhere with CUPS on Linux.md
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
[#]: subject: "Print from anywhere with CUPS on Linux"
|
||||||
|
[#]: via: "https://opensource.com/article/21/8/share-printer-cups"
|
||||||
|
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: " "
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
Print from anywhere with CUPS on Linux
|
||||||
|
======
|
||||||
|
Share your printer with the Common Unix Printing System (CUPS).
|
||||||
|
![Two hands holding a resume with computer, clock, and desk chair ][1]
|
||||||
|
|
||||||
|
I have a printer in my office, but sometimes I work on my laptop in another room of the house. This isn't a problem for me for two reasons. First of all, I rarely print anything on paper and have gone months without using the printer. Secondly, though, I've set the printer to be shared over my home network, so I can send files to print from anywhere in the house. I didn't need any special equipment for this setup. It's accomplished with just my usual Linux computer and the Common Unix Printing System (CUPS).
|
||||||
|
|
||||||
|
### Installing CUPS on Linux
|
||||||
|
|
||||||
|
If you're running Linux, BSD, or macOS, then you probably already have CUPS installed. CUPS has been the open source solution to Unix printing since 1997. Apple relied on it so heavily for their fledgling Unix-based OS X that they ended up buying it in 2007 to ensure its continued development and maintenance.
|
||||||
|
|
||||||
|
If your system doesn't already have CUPS installed, you can install it with your package manager. For example, on Fedora, Mageia, or CentOS:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ sudo dnf install cups`
|
||||||
|
```
|
||||||
|
|
||||||
|
On Debian, Linux Mint, and similar:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ sudo apt install cups`
|
||||||
|
```
|
||||||
|
|
||||||
|
### Accessing CUPS on Linux and Mac
|
||||||
|
|
||||||
|
To access CUPS, open a web browser and navigate to `localhost:631`, which tells your computer to open whatever's on port 631 on itself (your computer always [refers to itself as localhost][2]).
|
||||||
|
|
||||||
|
Your web browser opens a page providing you access to your system's printer settings. From here, you can add printers, modify printer defaults, monitor queued jobs, and allow printers to be shared over your local network.
|
||||||
|
|
||||||
|
![CUPS web user interface][3]
|
||||||
|
|
||||||
|
Figure 1: The CUPS web user interface.
|
||||||
|
|
||||||
|
### Configuring a printer with CUPS
|
||||||
|
|
||||||
|
You can either add a new printer or modify an existing one from within the CUPS interface. Modifying a printer involves the exact same pages as adding a new one, except that when you're adding a printer, you make new choices, and when you're modifying a printer, you confirm or change existing ones.
|
||||||
|
|
||||||
|
First, click on the **Administration** tab, and then the **Add Printer** button.
|
||||||
|
|
||||||
|
If you're only modifying an existing printer, click **Manage Printers** instead, and then choose the printer you want to change. Choose **Modify Printer** from the **Administration** drop-down menu.
|
||||||
|
|
||||||
|
Regardless of whether you're modifying or adding, you must enter administrative authorization before CUPS allows you to continue. You can either log in as root, if that's available to you, or as your normal user identity, as long as you have `sudo` privileges.
|
||||||
|
|
||||||
|
Next, you're presented with a list of printer interfaces and protocols that you can use for a printer. If your printer is plugged directly into your computer and is on, it's listed as a _Local Printer_. If the printer has networking built into it and is attached to a switch or router on your network, you can usually use the Internet Printing Protocol (ipp) to access it (you may have to look at your router to determine the IP address of the printer, but read your printer's documentation for details). If the printer is a Hewlett-Packard, you may also be able to use HPLIP to access it.
|
||||||
|
|
||||||
|
Use whatever protocol makes sense for your physical setup. If you're unsure of what to use, you can try one, attempt to print a test page, and then try a different one in the case of failure.
|
||||||
|
|
||||||
|
The next screen asks for human-friendly details about the printer. This is mostly for your reference. Enter a name for the printer that makes sense (I usually use the model number, but large organizations sometimes name their printers after things like fictional starships or capital cities), a description, and the location.
|
||||||
|
|
||||||
|
You may also choose to share the printer with other computers on your network.
|
||||||
|
|
||||||
|
![CUPS web UI to share printers][4]
|
||||||
|
|
||||||
|
Figure 2: CUPS web user interface to share printers.
|
||||||
|
|
||||||
|
If sharing is not currently enabled, click the checkbox to enable sharing.
|
||||||
|
|
||||||
|
### Drivers
|
||||||
|
|
||||||
|
On the next screen, you must set your printer driver. Open source drivers for printers can often be found on [openprinting.org][5]. There's a good chance you already have a valid driver, as long as you have the `gutenprint` package installed, or have installed drivers bundled with the printer. If the printer is a PostScript printer (many laser printers are), you may only need a PPD file from [openprinting.org][5] rather than a driver.
|
||||||
|
|
||||||
|
Assuming you have drivers installed, you can choose your printer's make (manufacturer) for a list of available drivers. Select the appropriate driver and continue.
|
||||||
|
|
||||||
|
### Connecting to a shared printer
|
||||||
|
|
||||||
|
Now that you have successfully installed and configured your printer, you can connect to it from any other computer on your network. For example, suppose you have a laptop called **client** that you use around the house. You want to add your shared printer to it.
|
||||||
|
|
||||||
|
On the GNOME and Plasma desktops, you can add a printer from the **Printer** screen of **Settings:**
|
||||||
|
|
||||||
|
* If you have your printer connected to a computer, then you enter the IP address of the _computer_ (because the printer is accessible through its host).
|
||||||
|
* If you have your printer connected to a switch or router, then enter the IP address of the printer itself.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
On macOS, printer settings can be found in **System Preferences**.
|
||||||
|
|
||||||
|
Alternately, you can keep using the CUPS interface on your client computer. The process to access CUPS is the same: Ensure CUPS is installed, open a network, and navigate to `localhost:631`.
|
||||||
|
|
||||||
|
Once you've accessed the CUPS web interface, select the **Administration** tab. Click the **Find New Printers** button in the **Printers** section, and then add the shared printer to your network. You can also set the printer's IP address manually in CUPS by going through the normal **Add Printer** process.
|
||||||
|
|
||||||
|
### Print from anywhere
|
||||||
|
|
||||||
|
It's the 21st century! Put the USB thumb drive down, stop emailing yourself files to print from another computer, and make your printer available to your home network. It's surprisingly easy and supremely convenient. And best of all, you'll look like a networking wizard to all of your housemates!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/8/share-printer-cups
|
||||||
|
|
||||||
|
作者:[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/resume_career_document_general.png?itok=JEaFL2XI (Two hands holding a resume with computer, clock, and desk chair )
|
||||||
|
[2]: https://opensource.com/article/21/4/network-management
|
||||||
|
[3]: https://opensource.com/sites/default/files/cups-web-ui.jpeg
|
||||||
|
[4]: https://opensource.com/sites/default/files/cups-web-ui-share_0.jpeg
|
||||||
|
[5]: http://openprinting.org
|
@ -0,0 +1,164 @@
|
|||||||
|
[#]: 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, you’ll 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 you’d like to explore a more advanced program that demonstrates a few of these interesting features, here’s 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 <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 */
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
By using **ncurses**, we can add some visual interest. Let’s 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 < 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;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Copy this program and compile it for yourself to try it out. Don’t forget that you need to tell GCC to link with the **ncurses** library:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ gcc -o guess guess.c -lncurses`
|
||||||
|
```
|
||||||
|
|
||||||
|
I’ve 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
|
126
sources/tech/20210831 What is a container image.md
Normal file
126
sources/tech/20210831 What is a container image.md
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
[#]: subject: "What is a container image?"
|
||||||
|
[#]: via: "https://opensource.com/article/21/8/container-image"
|
||||||
|
[#]: author: "Nived V https://opensource.com/users/nivedv"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: " "
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
What is a container image?
|
||||||
|
======
|
||||||
|
A container image contains a packaged application, along with its
|
||||||
|
dependencies, and information on what processes it runs when launched.
|
||||||
|
![Shipping containers stacked][1]
|
||||||
|
|
||||||
|
Containers are a critical part of today's IT operations. A _container image_ contains a packaged application, along with its dependencies, and information on what processes it runs when launched.
|
||||||
|
|
||||||
|
You create container images by providing a set of specially formatted instructions, either as commits to a registry or as a Dockerfile. For example, this Dockerfile creates a container for a PHP web application:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
FROM registry.access.redhat.com/ubi8/ubi:8.1
|
||||||
|
|
||||||
|
RUN yum --disableplugin=subscription-manager -y module enable php:7.3 \
|
||||||
|
&& yum --disableplugin=subscription-manager -y install httpd php \
|
||||||
|
&& yum --disableplugin=subscription-manager clean all
|
||||||
|
|
||||||
|
ADD index.php /var/www/html
|
||||||
|
|
||||||
|
RUN sed -i 's/Listen 80/Listen 8080/' /etc/httpd/conf/httpd.conf \
|
||||||
|
&& sed -i 's/listen.acl_users = apache,nginx/listen.acl_users =/' /etc/php-fpm.d/www.conf \
|
||||||
|
&& mkdir /run/php-fpm \
|
||||||
|
&& chgrp -R 0 /var/log/httpd /var/run/httpd /run/php-fpm \
|
||||||
|
&& chmod -R g=u /var/log/httpd /var/run/httpd /run/php-fpm
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
USER 1001
|
||||||
|
CMD php-fpm & httpd -D FOREGROUND
|
||||||
|
```
|
||||||
|
|
||||||
|
Each instruction in this file adds a _layer_ to the container image. Each layer only adds the difference from the layer below it, and then, all these layers are stacked together to form a read-only container image.
|
||||||
|
|
||||||
|
### How does that work?
|
||||||
|
|
||||||
|
You need to know a few things about container images, and it's important to understand the concepts in this order:
|
||||||
|
|
||||||
|
1. Union file systems
|
||||||
|
2. Copy-on-Write
|
||||||
|
3. Overlay File Systems
|
||||||
|
4. Snapshotters
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Union File Systems (Aufs)
|
||||||
|
|
||||||
|
The Union File System (UnionFS) is built into the Linux kernel, and it allows contents from one file system to be merged with the contents of another, while keeping the "physical" content separate. The result is a unified file system, even though the data is actually structured in branches.
|
||||||
|
|
||||||
|
The idea here is that if you have multiple images with some identical data, instead of having this data copied over again, it's shared by using something called a _layer_.
|
||||||
|
|
||||||
|
![UnionFS][2]
|
||||||
|
|
||||||
|
Image CC BY-SA opensource.com
|
||||||
|
|
||||||
|
Each layer is a file system that can be shared across multiple containers, e.g., The httpd base layer is the official Apache image and can be used across any number of containers. Imagine the disk space we just saved since we are using the same base layer for all our containers.
|
||||||
|
|
||||||
|
These image layers are always read-only, but when we create a new container from this image, we add a thin writable layer on top of it. This writable layer is where you create/modify/delete or make other changes required for each container.
|
||||||
|
|
||||||
|
### Copy-on-write
|
||||||
|
|
||||||
|
When you start a container, it appears as if the container has an entire file system of its own. That means every container you run in the system needs its own copy of the file system. Wouldn't this take up a lot of disk space and also take a lot of time for the containers to boot? No—because every container does not need its own copy of the filesystem!
|
||||||
|
|
||||||
|
Containers and images use a copy-on-write mechanism to achieve this. Instead of copying files, the copy-on-write strategy shares the same instance of data to multiple processes and copies only when a process needs to modify or write data. All other processes would continue to use the original data. Before any write operation is performed in a running container, a copy of the file to be modified is placed on the writeable layer of the container. This is where the _write_ takes place. Now you know why it's called _copy-on-write_.
|
||||||
|
|
||||||
|
This strategy optimizes both image disk space usage and the performance of container start times and works in conjunction with UnionFS.
|
||||||
|
|
||||||
|
### Overlay File System
|
||||||
|
|
||||||
|
An overlay sits on top of an existing filesystem, combines an upper and lower directory tree, and presents them as a single directory. These directories are called _layers_. The lower layer remains unmodified. Each layer adds only the difference (the _diff_, in computing terminology) from the layer below it, and this unification process is referred to as a _union mount_.
|
||||||
|
|
||||||
|
The lowest directory or an Image layer is called _lowerdir_, and the upper directory is called _upperdir_. The final overlayed or unified layer is called _merged._
|
||||||
|
|
||||||
|
![Layered file system][3]
|
||||||
|
|
||||||
|
Image CC BY-SA opensource.com
|
||||||
|
|
||||||
|
Common terminology consists of these layer definitions:
|
||||||
|
|
||||||
|
* Base layer is where the files of your filesystem are located. In terms of container images, this layer would be your base image.
|
||||||
|
* Overlay layer is often called the _container layer_, as all the changes that are made to a running container, as adding, deleting, or modifying files, are written to this writable layer. All changes made to this layer are stored in the next layer, and is a _union_ view of the Base and Diff layers.
|
||||||
|
* Diff layer contains all changes made in the Overlay layer. If you write something that's already in the Base layer, then the overlay file system copies the file to the Diff layer and makes the modifications you intended to write. This is called a _copy-on-write_.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Snapshotters
|
||||||
|
|
||||||
|
Containers can build, manage, and distribute changes as a part of their container filesystem using layers and graph drivers. But working with graph drivers is really complicated and is error-prone. SnapShotters are different from graph drivers, as they have no knowledge of images or containers.
|
||||||
|
|
||||||
|
Snapshotters work very similar to Git, such as the concept of having trees, and tracking changes to trees for each commit. A _snapshot_ represents a filesystem state. Snapshots have parent-child relationships using a set of directories. A _diff can_ be taken between a parent and its snapshot to create a layer.
|
||||||
|
|
||||||
|
The Snapshotter provides an API for allocating, snapshotting, and mounting abstract, layered file systems.
|
||||||
|
|
||||||
|
### Wrap up
|
||||||
|
|
||||||
|
You now have a good sense of what container images are and how their layered approach makes containers portable. Next up, I'll cover container runtimes and internals.
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
_This article is based on a [techbeatly][4] article and has been adapted with permission._
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/8/container-image
|
||||||
|
|
||||||
|
作者:[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/bus-containers.png?itok=d_4QhZxT (Shipping containers stacked)
|
||||||
|
[2]: https://opensource.com/sites/default/files/unionfs.png (UnionFS)
|
||||||
|
[3]: https://opensource.com/sites/default/files/rect1036.png (Layered file system)
|
||||||
|
[4]: https://medium.com/techbeatly/container-part-ii-images-4f2139194775
|
@ -0,0 +1,99 @@
|
|||||||
|
[#]: subject: "Zulip: An Interesting Open-Source Alternative to Slack"
|
||||||
|
[#]: via: "https://itsfoss.com/zulip/"
|
||||||
|
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: "geekpi"
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
Zulip: An Interesting Open-Source Alternative to Slack
|
||||||
|
======
|
||||||
|
|
||||||
|
_**Brief:** Zulip is an open-source collaboration platform that pitches itself as a better replacement to Slack. Let us take a closer look._
|
||||||
|
|
||||||
|
Messaging and collaboration platforms make a big difference when it comes to your work.
|
||||||
|
|
||||||
|
While there are several options available, Slack is a popular one used by many organizations. But, what about an open-source alternative to Slack that you can self-host?
|
||||||
|
|
||||||
|
Zulip is one such software.
|
||||||
|
|
||||||
|
### Zulip: Open Source Collaboration Messaging App
|
||||||
|
|
||||||
|
![][1]
|
||||||
|
|
||||||
|
If you want to explore, I must mention that there are more [open-source alternatives to Slack][2] out there.
|
||||||
|
|
||||||
|
Here, I focus on Zulip.
|
||||||
|
|
||||||
|
Zulip is a free and open-source messaging application with paid hosted options and the ability to self-host.
|
||||||
|
|
||||||
|
It aims to provide a similar experience to Slack while striving to help you improve the effectiveness of conversations using topics.
|
||||||
|
|
||||||
|
In contrast to channels in Slack, Zulip chat adds topics (which are like tags) to quickly filter through the conversations that matter to you.
|
||||||
|
|
||||||
|
### Features of Zulip
|
||||||
|
|
||||||
|
![][3]
|
||||||
|
|
||||||
|
You get most of the essential features with Zulip. To list the key highlights, you can find:
|
||||||
|
|
||||||
|
* Markdown support
|
||||||
|
* Topics for channels
|
||||||
|
* Drag and drop file support
|
||||||
|
* Code blocks
|
||||||
|
* GitHub integration to track issues
|
||||||
|
* Email notification support
|
||||||
|
* Self-host option
|
||||||
|
* Message editing
|
||||||
|
* GIPHY integration
|
||||||
|
* Video calls with Zoom, Jitsi, or BigBlueButton
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
In addition to the features mentioned, you should expect the basic options that you usually get with Slack and others.
|
||||||
|
|
||||||
|
Also, you can integrate it with Matrix and IRC if you want.
|
||||||
|
|
||||||
|
![][4]
|
||||||
|
|
||||||
|
In my brief test usage, the user interface is good enough for effective communication. However, I failed to find any dark mode or the ability to change a theme.
|
||||||
|
|
||||||
|
It looks more straightforward than Slack so that it can improve the user experience side of things.
|
||||||
|
|
||||||
|
### Install Zulip in Linux
|
||||||
|
|
||||||
|
Zulip is available as an AppImage file from its official website. You may refer to our guide on [using AppImage in Linux][5] in case you need help.
|
||||||
|
|
||||||
|
It is also available as a snap package. So, you can utilize either of them for any Linux distro.
|
||||||
|
|
||||||
|
You can also install it through the terminal for Ubuntu/Debian-based distros using APT. Take a look at its [official instructions][6] if you want that.
|
||||||
|
|
||||||
|
Zulip is available for Windows, Mac, and Linux. You should also find it available for Android and iOS mobile phones.
|
||||||
|
|
||||||
|
[Zulip][7]
|
||||||
|
|
||||||
|
Considering that you can use Zulip on the web, desktop, and smartphones, it is a suitable replacement for Slack.
|
||||||
|
|
||||||
|
_Have you tried it yet? What messaging platform do you use to collaborate for work? Feel free to share your thoughts in the comments._
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/zulip/
|
||||||
|
|
||||||
|
作者:[Ankush Das][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://itsfoss.com/author/ankush/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/zulip-chat-new.png?resize=800%2C551&ssl=1
|
||||||
|
[2]: https://itsfoss.com/open-source-slack-alternative/
|
||||||
|
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/zulip-chat-screenshot.png?resize=800%2C550&ssl=1
|
||||||
|
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/zulip-settings.png?resize=800%2C546&ssl=1
|
||||||
|
[5]: https://itsfoss.com/use-appimage-linux/
|
||||||
|
[6]: https://zulip.com/help/desktop-app-install-guide
|
||||||
|
[7]: https://zulip.com/
|
@ -0,0 +1,131 @@
|
|||||||
|
[#]: subject: "Ubuntu Server vs Desktop: What’s the Difference?"
|
||||||
|
[#]: via: "https://itsfoss.com/ubuntu-server-vs-desktop/"
|
||||||
|
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: " "
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
Ubuntu Server vs Desktop: What’s the Difference?
|
||||||
|
======
|
||||||
|
|
||||||
|
When you click on the download button on the [Ubuntu website][1], it gives you a few options. Two of them are Ubuntu Desktop and Ubuntu Server.
|
||||||
|
|
||||||
|
This could confuse new users. Why are there two (actually 4 of them)? Which one should be downloaded? Ubuntu desktop or server? Are they the same? What is the difference?
|
||||||
|
|
||||||
|
![Ubuntu website gives you multiple options][2]
|
||||||
|
|
||||||
|
I am going to explain the difference between the desktop and server editions of Ubuntu. I’ll also explain which variant you should be using.
|
||||||
|
|
||||||
|
### Ubuntu desktop vs Ubuntu server
|
||||||
|
|
||||||
|
![Ubuntu desktop and server illustartion][3]
|
||||||
|
|
||||||
|
To understand the difference between Ubuntu desktop and server, you should understand the difference between a desktop and a server operating system.
|
||||||
|
|
||||||
|
#### Desktop
|
||||||
|
|
||||||
|
A desktop is referred to a personal computer. A desktop operating system comes with a graphical user interface so that the users can use their mouse and keyboard. The primary purpose of a desktop is to give you a system that can be used for web browsing, document editing, viewing/editing pictures and videos, coding and gaming. Basically, a general purpose computer for individuals, end users, or family members.
|
||||||
|
|
||||||
|
I am using the term desktop here, but this does not mean that it cannot be used on a laptop. Desktop is the generic term for a personal computer.
|
||||||
|
|
||||||
|
#### Server
|
||||||
|
|
||||||
|
On the other hand, a server operating system is specifically created for hosting web services like websites, apps, media servers, databases etc.
|
||||||
|
|
||||||
|
Usually, a server operating system does not come with a graphical interface. If it is Linux based operating system, you’ll have to use the system entirely via commands in terminal.
|
||||||
|
|
||||||
|
The advantage here is that the server OS do not need a lot of RAM and computational power because they do not use [graphical desktop environment][4]. Apart from that, the server operating system has packages configured differently as well.
|
||||||
|
|
||||||
|
Now that you understand the difference between server and desktop a little, let’s see the difference between Ubuntu server and desktop.
|
||||||
|
|
||||||
|
#### The user interface
|
||||||
|
|
||||||
|
The most visible difference between Ubuntu server and desktop is the user interface.
|
||||||
|
|
||||||
|
Ubuntu desktop features a graphical user interface with GNOME desktop environment. This makes it easier to use with the help of mouse clicks.
|
||||||
|
|
||||||
|
![User interface of Ubuntu GNOME edition][5]
|
||||||
|
|
||||||
|
Ubuntu server edition runs headless. You will only see a terminal interface when you are logged in to it. You’ll often manage it remotely from other computers overs SSH.
|
||||||
|
|
||||||
|
![Connecting to remote Ubuntu server via SSH][6]
|
||||||
|
|
||||||
|
#### Installation
|
||||||
|
|
||||||
|
[Installing Ubuntu as a desktop is easy][7] thanks to the graphical installer. You can create a live USB and experience the desktop version without installing. If you like it, you can install it in minutes following the on-screen instructions.
|
||||||
|
|
||||||
|
![Installing Ubuntu desktop via graphical installer][8]
|
||||||
|
|
||||||
|
Installing Ubuntu as a server is not as easy as the desktop edition. You are stuck with terminal interface. Even the simplest tasks like connecting to Wi-Fi could be a difficult task if you are not familiar with the procedure.
|
||||||
|
|
||||||
|
![Ubuntu server installation][9]
|
||||||
|
|
||||||
|
#### Applications
|
||||||
|
|
||||||
|
The default set of applications in Ubuntu desktop is focused on regular computer users. So, you’ll find web browsers, office suite, media players, games etc.
|
||||||
|
|
||||||
|
![Applications in Ubuntu][10]
|
||||||
|
|
||||||
|
Ubuntu server has applications that are more tailored for running web services. And that’s not it. Some applications are also configured differently. Take SSH for example. Ubuntu server has SSH preconfigured so that you can easily connect to it from remote systems. You have to explicitly enable SSH on Ubuntu desktop.
|
||||||
|
|
||||||
|
#### Hardware requirement
|
||||||
|
|
||||||
|
Since the desktop edition features a graphical user interface, you need at least 4 GB of RAM to run Ubuntu desktop. Disk space should be 20 GB at least.
|
||||||
|
|
||||||
|
This is where it gets interesting for Ubuntu server. It does not have a graphical interface. The command line interface does not consume a lot of system resources. As a result, you can easily run Ubuntu server on a machine with 512 MB and 5 GB of disk space.
|
||||||
|
|
||||||
|
The RAM and disk space on the server is subjected to the web service you run. If a web application requires at least 2 GB of RAM, you should have that much of RAM. But in the simplest of scenario, even 512 MB or 1 GB of RAM could work.
|
||||||
|
|
||||||
|
#### Usage
|
||||||
|
|
||||||
|
This is the main differentiator between Ubuntu desktop and server. Ask yourself, for what purpose you want to use Ubuntu?
|
||||||
|
|
||||||
|
If it is specifically for deploying web services, go for Ubuntu server. Keep in mind that you need to have basic Linux command line knowledge to navigate through the terminal.
|
||||||
|
|
||||||
|
If you want to use Ubuntu as a regular computer like Windows, go with Ubuntu desktop. If you want to use it for learning Linux commands, Docker or even simple (but local) LAMP server installation for learning, stay with Ubuntu desktop.
|
||||||
|
|
||||||
|
For a server, Ubuntu server is better than Ubuntu desktop. For regular computing usage, Ubuntu desktop is the better choice.
|
||||||
|
|
||||||
|
#### Should you use Ubuntu desktop for server or install GUI on server?
|
||||||
|
|
||||||
|
Here’s the thing. Both Ubuntu desktop and server are Linux. You can use Ubuntu desktop as server for hosting web services. That works.
|
||||||
|
|
||||||
|
Similarly, [you can install GUI on Ubuntu server][11] and use it graphically. That also works.
|
||||||
|
|
||||||
|
![GUI login on an Ubuntu server][12]
|
||||||
|
|
||||||
|
But just because it works, doesn’t mean you should do it. It defies the entire purpose of creating different editions for server and desktop.
|
||||||
|
|
||||||
|
You have to put extra effort in converting a server to desktop and vice versa. Why take that pain?
|
||||||
|
|
||||||
|
If your purpose of using Ubuntu is clear, download and install the appropriate Ubuntu edition.
|
||||||
|
|
||||||
|
_**I hope this makes things around Ubuntu desktop and server editions a bit more clear now. If you have questions or suggestions, please utilize the comment section.**_
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/ubuntu-server-vs-desktop/
|
||||||
|
|
||||||
|
作者:[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://ubuntu.com/
|
||||||
|
[2]: https://itsfoss.com/wp-content/uploads/2021/08/ubuntu-server-desktop-download-800x338.webp
|
||||||
|
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/ubuntu-desktop-server.png?resize=800%2C450&ssl=1
|
||||||
|
[4]: https://itsfoss.com/what-is-desktop-environment/
|
||||||
|
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/installing-gui-ubuntu-server-gnome-desktop.png?resize=792%2C597&ssl=1
|
||||||
|
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/system-restart-required.png?resize=800%2C469&ssl=1
|
||||||
|
[7]: https://itsfoss.com/install-ubuntu/
|
||||||
|
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/02/installing-ubuntu.png?resize=800%2C549&ssl=1
|
||||||
|
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/ubuntu-server-installation.png?resize=800%2C600&ssl=1
|
||||||
|
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/gnome-app-arranger.jpg?resize=799%2C450&ssl=1
|
||||||
|
[11]: https://itsfoss.com/install-gui-ubuntu-server/
|
||||||
|
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/05/installing-gui-ubuntu-server-gnome-desktop-greet.png?resize=798%2C600&ssl=1
|
@ -0,0 +1,267 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (chunibyo-wly)
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
[#]: subject: (Deploy a deep learning model on Kubernetes)
|
||||||
|
[#]: via: (https://opensource.com/article/20/9/deep-learning-model-kubernetes)
|
||||||
|
[#]: author: (Chaimaa Zyani https://opensource.com/users/chaimaa)
|
||||||
|
|
||||||
|
在 Kubernetes 上部署一个深度学习模型
|
||||||
|
======
|
||||||
|
了解如何使用 Kubermatic Kubernetes 平台部署、缩放与管理图像识别深度学习模型。
|
||||||
|
|
||||||
|
![Brain on a computer screen][1]
|
||||||
|
|
||||||
|
随着企业增加了对人工智能(AI)、机器学习(ML)与深度学习(DL)的使用,出现了一个关键问题:如何将机器学习的发展进行规模化与产业化?这些讨论经常聚焦于机器学习模型本身;然而,模型仅仅只是完整解决方案的其中一环。为了达到生产环境的应用和规模,模型的开发过程必须还包括一个可以说明开发前后关键活动以及可公用部署的可重复过程。
|
||||||
|
|
||||||
|
本文演示了如何使用[Kubermatic Kubernetes Platform][2]对图像识别预测的深度学习模型进行部署,缩放与管理。
|
||||||
|
|
||||||
|
Kubermatic Kubernetes 平台是一个可以与机器学习/深度学习工作流结合进行完整集群生命周期管理的一个自动且灵活的开源生产级 Kubernetes 集群管理工具。
|
||||||
|
|
||||||
|
### 开始
|
||||||
|
|
||||||
|
这个例子部署了一个图像识别的深度学习模型。它使用了包含 60,000 张分属 10 个类别的 32x32 彩色图 [CIFAR-10][3] 像数据集,同时使用了 [Apache MXNet][5] 的 [Gluon][4] 与 NVIDIA GPUs 进行加速计算。如果你希望使用 CIFAR-10 数据集的预训练模型,可以查阅 [getting started guide][6]。
|
||||||
|
|
||||||
|
使用训练集中的样本对模型训练 200 次,只要训练误差保持缓慢减少,就可以保证模型不会过拟合。下方图展示了训练的过程:
|
||||||
|
|
||||||
|
![深度学习模型训练 loss 图][7]
|
||||||
|
|
||||||
|
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
训练结束后,必须保存模型训练所得到的参数,以便稍后可以加载它们:
|
||||||
|
|
||||||
|
|
||||||
|
```python
|
||||||
|
file_name = "net.params"
|
||||||
|
net.save_parameters(file_name)
|
||||||
|
```
|
||||||
|
|
||||||
|
一旦你的模型训练好了,就可以用 Flask 服务器来封装它。下方的程序演示了如何接收 request 中的一张图片作为参数并且在 response 中返回模型的预测结果:
|
||||||
|
|
||||||
|
|
||||||
|
```python
|
||||||
|
from gluoncv.model_zoo import get_model
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from mxnet import gluon, nd, image
|
||||||
|
from mxnet.gluon.data.vision import transforms
|
||||||
|
from gluoncv import utils
|
||||||
|
from PIL import Image
|
||||||
|
import io
|
||||||
|
import flask
|
||||||
|
app = flask.Flask(__name__)
|
||||||
|
|
||||||
|
@app.route("/predict",methods=["POST"])
|
||||||
|
def predict():
|
||||||
|
if flask.request.method == "POST":
|
||||||
|
if flask.request.files.get("img"):
|
||||||
|
img = Image.open(io.BytesIO(flask.request.files["img"].read()))
|
||||||
|
transform_fn = transforms.Compose([
|
||||||
|
transforms.Resize(32),
|
||||||
|
transforms.CenterCrop(32),
|
||||||
|
transforms.ToTensor(),
|
||||||
|
transforms.Normalize([0.4914, 0.4822, 0.4465], [0.2023, 0.1994, 0.2010])])
|
||||||
|
img = transform_fn(nd.array(img))
|
||||||
|
net = get_model('cifar_resnet20_v1', classes=10)
|
||||||
|
net.load_parameters('net.params')
|
||||||
|
pred = net(img.expand_dims(axis=0))
|
||||||
|
class_names = ['airplane', 'automobile', 'bird', 'cat', 'deer',
|
||||||
|
'dog', 'frog', 'horse', 'ship', 'truck']
|
||||||
|
ind = nd.argmax(pred, axis=1).astype('int')
|
||||||
|
prediction = 'The input picture is classified as [%s], with probability %.3f.'%
|
||||||
|
(class_names[ind.asscalar()], nd.softmax(pred)[0][ind].asscalar())
|
||||||
|
return prediction
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run(host='0.0.0.0')
|
||||||
|
```
|
||||||
|
|
||||||
|
### 容器化模型
|
||||||
|
|
||||||
|
在将模型部署到 Kubernetes 前,你需要先安装 Docker 并使用你的模型创建一个镜像。
|
||||||
|
|
||||||
|
1. 下载、安装并启动 Docker:
|
||||||
|
```bash
|
||||||
|
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
|
||||||
|
|
||||||
|
sudo yum-config-manager --add-repo <https://download.docker.com/linux/centos/docker-ce.repo>
|
||||||
|
|
||||||
|
sudo yum install docker-ce
|
||||||
|
|
||||||
|
sudo systemctl start docker
|
||||||
|
|
||||||
|
```
|
||||||
|
2. 创建一个你用来管理代码与依赖的文件夹:
|
||||||
|
```bash
|
||||||
|
mkdir kubermatic-dl
|
||||||
|
cd kubermatic-dl
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 创建 `requirements.txt` 文件管理代码运行时需要的所有依赖:
|
||||||
|
```
|
||||||
|
flask
|
||||||
|
gluoncv
|
||||||
|
matplotlib
|
||||||
|
mxnet
|
||||||
|
requests
|
||||||
|
Pillow
|
||||||
|
|
||||||
|
```
|
||||||
|
4. 创建 Dockerfile,Docker 将根据这个文件创建镜像:
|
||||||
|
```
|
||||||
|
FROM python:3.6
|
||||||
|
WORKDIR /app
|
||||||
|
COPY requirements.txt /app
|
||||||
|
RUN pip install -r ./requirements.txt
|
||||||
|
COPY app.py /app
|
||||||
|
CMD ["python", "app.py"]
|
||||||
|
```
|
||||||
|
|
||||||
|
这个 Dockerfile 主要可以分为三个部分。首先,Docker 会下载 Python 的基础镜像。然后,Docker 会使用 Python 的包管理工具 `pip` 安装 `requirements.txt` 记录的包。最后,Docker 会通过执行 `python app.py` 来运行你的脚本。
|
||||||
|
|
||||||
|
|
||||||
|
1. 构建 Docker 容器: `sudo docker build -t kubermatic-dl:latest .` 这条命令使用 `kubermatic-dl` 镜像为你当前工作目录的代码创建了一个容器。
|
||||||
|
|
||||||
|
2. 使用 `sudo docker run -d -p 5000:5000 kubermatic-dl` 命令检查你的容器可以在你的主机上正常运行。
|
||||||
|
|
||||||
|
3. 使用 `sudo docker ps -a` 命令查看你本地容器的运行状态:
|
||||||
|
|
||||||
|
![查看容器的运行状态][9]
|
||||||
|
|
||||||
|
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 将你的模型上传到 Docker Hub
|
||||||
|
|
||||||
|
在向 Kubernetes 上部署模型前,你的镜像首先需要是公开可用的。你可以通过将你的模型上传到 [Docker Hub][10] 来将它公开。(如果你没有 Docker Hub 的账号,你需要先创建一个)
|
||||||
|
|
||||||
|
1. 在终端中登录 Docker Hub 账号:`sudo docker login`
|
||||||
|
|
||||||
|
2. 给你的镜像打上 tag ,这样你的模型上传到 Docker Hub 后也能拥有版本信息
|
||||||
|
```bash
|
||||||
|
sudo docker tag <your-image-id> <your-docker-hub-name>/<your-app-name>
|
||||||
|
|
||||||
|
sudo docker push <your-docker-hub-name>/<your-app-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
![给镜像打上 tag][11]
|
||||||
|
|
||||||
|
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
3. 使用 `sudo docker images` 命令检查你的镜像的 ID。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 部署你的模型到 Kubernetes 集群
|
||||||
|
|
||||||
|
1. 首先在 Kubermatic Kubernetes 平台创建一个项目, 然后根据 [快速开始][12] 创建一个 Kubernetes 集群。
|
||||||
|
|
||||||
|
![创建一个 Kubernetes 集群][13]
|
||||||
|
|
||||||
|
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
2. 下载用于访问你的集群的 `kubeconfig`,将它放置在下载目录中,并记得设置合适的环境变量,使得你的环境能找到它:
|
||||||
|
|
||||||
|
![Kubernetes 集群示例][14]
|
||||||
|
|
||||||
|
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
3. 使用 `kubectl` 命令检查集群信息,例如,需要检查 `kube-system` 是否在你的集群正常启动了就可以使用命令 `kubectl cluster-info`
|
||||||
|
|
||||||
|
![查看集群信息][15]
|
||||||
|
|
||||||
|
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
4. 为了在集群中运行容器,你需要创建一个部署用的配置文件(`deployment.yaml`),再运行 `apply` 命令将其应用于集群中:
|
||||||
|
```yaml
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: kubermatic-dl-deployment
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: kubermatic-dl
|
||||||
|
replicas: 3
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: kubermatic-dl
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: kubermatic-dl
|
||||||
|
image: kubermatic00/kubermatic-dl:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
|
||||||
|
``` `kubectl apply -f deployment.yaml`
|
||||||
|
```
|
||||||
|
|
||||||
|
5. 为了将你的部署开放到公网环境,你需要一个能够给你的容器创建外部可达 IP 地址的服务:`kubectl expose deployment kubermatic-dl-deployment --type=LoadBalancer --port 80 --target-port 5000`
|
||||||
|
|
||||||
|
6. 就快大功告成了!首先检查你布署的服务的状态,然后通过 IP 请求的你图像识别 API:`kubectl get service`
|
||||||
|
|
||||||
|
|
||||||
|
![获取请求图像识别 API 的 IP 地址][16]
|
||||||
|
|
||||||
|
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
7. 最后根据你的外部 IP 使用以下两张图片对你的图像识别服务进行测试:
|
||||||
|
|
||||||
|
![马][17]
|
||||||
|
|
||||||
|
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
![狗][18]
|
||||||
|
|
||||||
|
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
![测试 API][19]
|
||||||
|
|
||||||
|
(Chaimaa Zyami, [CC BY-SA 4.0][8])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 总结
|
||||||
|
|
||||||
|
|
||||||
|
在这篇教程中,你可以创建一个深度学习模型,并且使用 Flask 提供 [REST API][20] 服务。它介绍了如何将应用放在 Docker 容器中,如何将这个镜像上传到 Docker Hub 中,以及如何使用 Kubernetes 部署你的服务。只需几个简单的命令,你就可以使用 Kubermatic Kubernetes 平台部署该应用程序,并且开放服务给别人使用。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/20/9/deep-learning-model-kubernetes
|
||||||
|
|
||||||
|
作者:[Chaimaa Zyani][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/chunibyo-wly)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/chaimaa
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_computer_solve_fix_tool.png?itok=okq8joti (Brain on a computer screen)
|
||||||
|
[2]: https://www.loodse.com/products/kubermatic/
|
||||||
|
[3]: https://www.cs.toronto.edu/~kriz/cifar.html
|
||||||
|
[4]: https://gluon.mxnet.io/
|
||||||
|
[5]: https://mxnet.apache.org/
|
||||||
|
[6]: https://gluon-cv.mxnet.io/build/examples_classification/demo_cifar10.html
|
||||||
|
[7]: https://opensource.com/sites/default/files/uploads/trainingplot.png (Deep learning model training plot)
|
||||||
|
[8]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||||
|
[9]: https://opensource.com/sites/default/files/uploads/containerstatus.png (Checking the container's status)
|
||||||
|
[10]: https://hub.docker.com/
|
||||||
|
[11]: https://opensource.com/sites/default/files/uploads/tagimage.png (Tagging the image)
|
||||||
|
[12]: https://docs.kubermatic.com/kubermatic/v2.13/installation/install_kubermatic/_installer/
|
||||||
|
[13]: https://opensource.com/sites/default/files/uploads/kubernetesclusterempty.png (Create a Kubernetes cluster)
|
||||||
|
[14]: https://opensource.com/sites/default/files/uploads/kubernetesexamplecluster.png (Kubernetes cluster example)
|
||||||
|
[15]: https://opensource.com/sites/default/files/uploads/clusterinfo.png (Checking the cluster info)
|
||||||
|
[16]: https://opensource.com/sites/default/files/uploads/getservice.png (Get the IP address to call your image recognition API)
|
||||||
|
[17]: https://opensource.com/sites/default/files/uploads/horse.jpg (Horse)
|
||||||
|
[18]: https://opensource.com/sites/default/files/uploads/dog.jpg (Dog)
|
||||||
|
[19]: https://opensource.com/sites/default/files/uploads/testapi.png (Testing the API)
|
||||||
|
[20]: https://www.redhat.com/en/topics/api/what-is-a-rest-api
|
381
translated/tech/20210727 Analyze the Linux kernel with ftrace.md
Normal file
381
translated/tech/20210727 Analyze the Linux kernel with ftrace.md
Normal file
@ -0,0 +1,381 @@
|
|||||||
|
[#]: subject: (Analyze the Linux kernel with ftrace)
|
||||||
|
[#]: via: (https://opensource.com/article/21/7/linux-kernel-ftrace)
|
||||||
|
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (mengxinayan)
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
通过 `ftrace` 来分析 Linux 内核
|
||||||
|
======
|
||||||
|
通过 `ftrace` 来了解 Linux 内核内部工作方式是一个好方法。
|
||||||
|
![Linux keys on the keyboard for a desktop computer][1]
|
||||||
|
|
||||||
|
一个操作系统的内核是最难以理解的软件之一。自从你的系统启动后,它会一直在后台运行。尽管每个用户都不与内核直接交互,但他们在内核的帮助下完成自己的计算任务。与内核的交互发生在调用系统调用或者用户日常使用的各种库或应用间接调用了系统调用。
|
||||||
|
|
||||||
|
在之前的文章里我介绍了如何使用 `strace` 来追踪系统调用。然而,使用 `strace` 时你的可见性是受限的。它允许你查看特定参数的系统调用。并在工作完成后,看到其返回值或状态,来表明是通过还是失败。但是你无法知道内核在这段时间内发生了什么。除了系统调用外,内核中还有很多其他活动发生时却被忽略了。
|
||||||
|
|
||||||
|
### `ftrace` 介绍
|
||||||
|
|
||||||
|
本文的目的是通过使用一个名为 `ftrace` 的机制来追踪内核函数。任何 Linux 用户可以通过使用它来轻松地追踪内核,并且了解更多关于 Linux 内核内部如何工作。
|
||||||
|
|
||||||
|
`ftrace` 默认产生的输出是巨大的,因为内核总是忙的。为了节省空间,很多情况下我会通过截断来给出最小输出。
|
||||||
|
|
||||||
|
我使用 Fedora 来演示下面的例子,但是它们应该在其他最新的 Linux 发行版上同样可以运行。
|
||||||
|
|
||||||
|
### 启用 `ftrace`
|
||||||
|
|
||||||
|
`ftrace` 现在已经是内核中的一部分了,你不再需要事先安装它了。也就是说,如果你在使用最近的 Linux 系统,那么 `ftrace` 是已经启动了的。为了验证 `ftrace` 是否可用,运行 `mount` 命令并查找 `tracefs`。如果你看到类似下面的输出,表示 `ftrace` 已经启用,你可以轻松地尝试本文中下面的例子。下面的命令需要在 root 用户下使用(`sudo` 是不够的)
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo mount | grep tracefs
|
||||||
|
none on /sys/kernel/tracing type tracefs (rw,relatime,seclabel)
|
||||||
|
```
|
||||||
|
|
||||||
|
要想使用 `ftrace`,你首先需要进入上面 `mount` 命令中找到的特定目录中,在那个目录下运行文章中的其他命令。
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ cd /sys/kernel/tracing`
|
||||||
|
```
|
||||||
|
|
||||||
|
### 一般的工作流程
|
||||||
|
|
||||||
|
首先,你需要理解捕捉踪迹和获取输出的一般流程。如果你直接运行 `ftrace`,没有任何特定的 `ftrace-` 命令会被运行。相反的,你基本上是通过标准 Linux 命令来写入或读取一些文件。
|
||||||
|
|
||||||
|
通用的步骤如下:
|
||||||
|
1. 通过写入一些特定文件来启用/结束追踪
|
||||||
|
2. 通过写入一些特定文件来设置/取消追踪时的过滤规则
|
||||||
|
3. 读取基于第 1 和 2 步的追踪输出
|
||||||
|
4. 清除输出的文件或缓存
|
||||||
|
5. 缩小到特定用例(你要追踪的内核函数),重复1,2,3,4 步
|
||||||
|
|
||||||
|
First of all, you must understand the general workflow of capturing a trace and obtaining the output. If you're using `ftrace` directly, there isn't any special `ftrace-`specific commands to run. Instead, you basically write to some files and read from some files using standard command-line Linux utilities.
|
||||||
|
|
||||||
|
### 可用的追踪器类型
|
||||||
|
|
||||||
|
有多种不同的追踪器可供你使用。之前提到,在运行任何命令前,你需要进入一个特定的目录下,因为文件在这些目录下。我在我的例子中使用相对路径(与绝对路径相反)
|
||||||
|
|
||||||
|
你可以查看 `available_tracers` 文件内容来查看所有可用的追踪器类型。你可以可以看下面列出了几个。不需要担心有这么多。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pwd
|
||||||
|
/sys/kernel/tracing
|
||||||
|
|
||||||
|
$ sudo cat available_tracers
|
||||||
|
hwlat blk mmiotrace function_graph wakeup_dl wakeup_rt wakeup function nop
|
||||||
|
```
|
||||||
|
|
||||||
|
在所有输出的追踪器中,我会聚焦于下面三个特殊的:启用追踪的 `function` 和 `function_graph`,以及停止追踪的 `nop`
|
||||||
|
|
||||||
|
### 确认当前的追踪器
|
||||||
|
|
||||||
|
通常情况默认的追踪器设定为 `nop`。即在特殊文件中 `current_tracer` 中的 “无操作”,这意味着追踪目前是关闭的。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pwd
|
||||||
|
/sys/kernel/tracing
|
||||||
|
|
||||||
|
$ sudo cat current_tracer
|
||||||
|
nop
|
||||||
|
```
|
||||||
|
|
||||||
|
### 查看追踪输出
|
||||||
|
|
||||||
|
在启用任何追踪功能之前,请你看一下保存追踪输出的文件。你可以用 [cat](2) 命令查看名为 `trace` 的文件的内容。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo cat trace
|
||||||
|
# tracer: nop
|
||||||
|
#
|
||||||
|
# entries-in-buffer/entries-written: 0/0 #P:8
|
||||||
|
#
|
||||||
|
# _-----=> irqs-off
|
||||||
|
# / _----=> need-resched
|
||||||
|
# | / _---=> hardirq/softirq
|
||||||
|
# || / _--=> preempt-depth
|
||||||
|
# ||| / delay
|
||||||
|
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
|
||||||
|
# | | | |||| | |
|
||||||
|
```
|
||||||
|
|
||||||
|
### 启用 `function` 追踪器
|
||||||
|
|
||||||
|
你可以通过向 `current_tracer` 文件写入 `function` 来启用第一个追踪器 `function`(文件原本内容为 `nop`,意味着追踪是关闭的)。把这个操作看成是启用追踪的一种方式。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pwd
|
||||||
|
/sys/kernel/tracing
|
||||||
|
|
||||||
|
$ sudo cat current_tracer
|
||||||
|
nop
|
||||||
|
$ echo function > current_tracer
|
||||||
|
$
|
||||||
|
$ cat current_tracer
|
||||||
|
function
|
||||||
|
```
|
||||||
|
|
||||||
|
### 查看 `function` 追踪器的更新追踪输出
|
||||||
|
|
||||||
|
现在你已启动追踪,是时候查看输出了。如果你查看 `trace` 文件内容,你将会看到许多被连续写入的内容。我通过管道只展示了文件内容的前 20 行。根据左边输出的标题,你可以看到在某个 CPU 上运行的任务和进程 ID。根据右边输出的内容,你可以看到具体的内核函数和其副函数。中间显示了时间信息。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo cat trace | head -20
|
||||||
|
# tracer: function
|
||||||
|
#
|
||||||
|
# entries-in-buffer/entries-written: 409936/4276216 #P:8
|
||||||
|
#
|
||||||
|
# _-----=> irqs-off
|
||||||
|
# / _----=> need-resched
|
||||||
|
# | / _---=> hardirq/softirq
|
||||||
|
# || / _--=> preempt-depth
|
||||||
|
# ||| / delay
|
||||||
|
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
|
||||||
|
# | | | |||| | |
|
||||||
|
<idle>-0 [000] d... 2088.841739: tsc_verify_tsc_adjust <-arch_cpu_idle_enter
|
||||||
|
<idle>-0 [000] d... 2088.841739: local_touch_nmi <-do_idle
|
||||||
|
<idle>-0 [000] d... 2088.841740: rcu_nocb_flush_deferred_wakeup <-do_idle
|
||||||
|
<idle>-0 [000] d... 2088.841740: tick_check_broadcast_expired <-do_idle
|
||||||
|
<idle>-0 [000] d... 2088.841740: cpuidle_get_cpu_driver <-do_idle
|
||||||
|
<idle>-0 [000] d... 2088.841740: cpuidle_not_available <-do_idle
|
||||||
|
<idle>-0 [000] d... 2088.841741: cpuidle_select <-do_idle
|
||||||
|
<idle>-0 [000] d... 2088.841741: menu_select <-do_idle
|
||||||
|
<idle>-0 [000] d... 2088.841741: cpuidle_governor_latency_req <-menu_select
|
||||||
|
```
|
||||||
|
|
||||||
|
请记住当追踪打开后,这意味着追踪结果会被一直连续写入直至你关闭追踪。
|
||||||
|
|
||||||
|
### 关闭追踪
|
||||||
|
|
||||||
|
关闭追踪是简单的。你只需要在 `current_tracer` 文件中用 `nop` 替换 `function` 追踪器即可:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo cat current_tracer
|
||||||
|
function
|
||||||
|
|
||||||
|
$ sudo echo nop > current_tracer
|
||||||
|
|
||||||
|
$ sudo cat current_tracer
|
||||||
|
nop
|
||||||
|
```
|
||||||
|
|
||||||
|
### 启用 `function_graph` 追踪器
|
||||||
|
|
||||||
|
现在尝试第二个名为 `function_graph` 的追踪器。你可以使用和上面相同的步骤:在 `current_tracer` 文件中写入 `function_graph`:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo echo function_graph > current_tracer
|
||||||
|
|
||||||
|
$ sudo cat current_tracer
|
||||||
|
function_graph
|
||||||
|
```
|
||||||
|
|
||||||
|
### `function_tracer` 追踪器的追踪输出
|
||||||
|
|
||||||
|
注意到目前 `trace` 文件的输出格式已经发生变化。现在,你可以看到 CPU ID 和内核函数的执行时间。接下来,一个花括号表示一个函数的开始,以及它内部调用了哪些其他函数。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo cat trace | head -20
|
||||||
|
# tracer: function_graph
|
||||||
|
#
|
||||||
|
# CPU DURATION FUNCTION CALLS
|
||||||
|
# | | | | | | |
|
||||||
|
6) | n_tty_write() {
|
||||||
|
6) | down_read() {
|
||||||
|
6) | __cond_resched() {
|
||||||
|
6) 0.341 us | rcu_all_qs();
|
||||||
|
6) 1.057 us | }
|
||||||
|
6) 1.807 us | }
|
||||||
|
6) 0.402 us | process_echoes();
|
||||||
|
6) | add_wait_queue() {
|
||||||
|
6) 0.391 us | _raw_spin_lock_irqsave();
|
||||||
|
6) 0.359 us | _raw_spin_unlock_irqrestore();
|
||||||
|
6) 1.757 us | }
|
||||||
|
6) 0.350 us | tty_hung_up_p();
|
||||||
|
6) | mutex_lock() {
|
||||||
|
6) | __cond_resched() {
|
||||||
|
6) 0.404 us | rcu_all_qs();
|
||||||
|
6) 1.067 us | }
|
||||||
|
```
|
||||||
|
|
||||||
|
### 启用追踪的设置来增加追踪的深度
|
||||||
|
|
||||||
|
你可以使用下面的步骤来调整追踪器以看到更深层次的函数调用。完成之后,你可以查看 `trace` 文件的内容并发现输出变得更加详细了。为了文章的可读性,这个例子的输出被省略了:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo cat max_graph_depth
|
||||||
|
0
|
||||||
|
$ sudo echo 1 > max_graph_depth
|
||||||
|
$ # or
|
||||||
|
$ sudo echo 2 > max_graph_depth
|
||||||
|
|
||||||
|
$ sudo cat trace
|
||||||
|
```
|
||||||
|
|
||||||
|
### 查找要追踪的函数
|
||||||
|
|
||||||
|
上面的步骤足以让你开始追踪。但是它产生的输出内容是巨大的,当你想试图找到自己感兴趣的内容时,往往会很困难。通常你更希望能够之追踪特定的函数,而忽略其他函数。但如果你不知道它们确切的名称,你怎么知道要追踪哪些进程?有一个文件可以帮助你解决这个问题 —— `available_filter_functions` 文件提供了一个可供追踪的函数列表。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo wc -l available_filter_functions
|
||||||
|
63165 available_filter_functions
|
||||||
|
```
|
||||||
|
|
||||||
|
### 查找一般的内核函数
|
||||||
|
|
||||||
|
现在试着搜索一个你所知道的简单内核函数。用户空间有 `malloc` 函数用来分配内存,而内核有 `kmalloc` 函数,它提供类似的功能。下面是所有与 `kmalloc` 相关的函数。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo grep kmalloc available_filter_functions
|
||||||
|
debug_kmalloc
|
||||||
|
mempool_kmalloc
|
||||||
|
kmalloc_slab
|
||||||
|
kmalloc_order
|
||||||
|
kmalloc_order_trace
|
||||||
|
kmalloc_fix_flags
|
||||||
|
kmalloc_large_node
|
||||||
|
__kmalloc
|
||||||
|
__kmalloc_track_caller
|
||||||
|
__kmalloc_node
|
||||||
|
__kmalloc_node_track_caller
|
||||||
|
[...]
|
||||||
|
```
|
||||||
|
|
||||||
|
### 查找内核模块或者驱动相关函数
|
||||||
|
|
||||||
|
在 `available_filter_functions` 文件的输出中,你可以看到一些以括号内文字结尾的行,例如下面的例子中的 `[kvm_intel]`。这些函数与当前加载的内核模块 `kvm_intel` 有关。你可以运行 `lsmod` 命令来验证。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo grep kvm available_filter_functions | tail
|
||||||
|
__pi_post_block [kvm_intel]
|
||||||
|
vmx_vcpu_pi_load [kvm_intel]
|
||||||
|
vmx_vcpu_pi_put [kvm_intel]
|
||||||
|
pi_pre_block [kvm_intel]
|
||||||
|
pi_post_block [kvm_intel]
|
||||||
|
pi_wakeup_handler [kvm_intel]
|
||||||
|
pi_has_pending_interrupt [kvm_intel]
|
||||||
|
pi_update_irte [kvm_intel]
|
||||||
|
vmx_dump_dtsel [kvm_intel]
|
||||||
|
vmx_dump_sel [kvm_intel]
|
||||||
|
|
||||||
|
$ lsmod | grep -i kvm
|
||||||
|
kvm_intel 335872 0
|
||||||
|
kvm 987136 1 kvm_intel
|
||||||
|
irqbypass 16384 1 kvm
|
||||||
|
```
|
||||||
|
|
||||||
|
### 仅追踪特定的函数
|
||||||
|
|
||||||
|
为了实现对特定函数或模式的追踪,你可以利用 `set_ftrace_filter` 文件来指定你要追踪上述输出中的哪些函数。这个文件也接受 `*` 模式,它可以扩展到包括具有给定模式的其他函数。作为一个例子,我在我的机器上使用ext4文件系统。我可以用下面的命令指定ext4的特定内核函数来追踪。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo mount | grep home
|
||||||
|
/dev/mapper/fedora-home on /home type ext4 (rw,relatime,seclabel)
|
||||||
|
|
||||||
|
$ pwd
|
||||||
|
/sys/kernel/tracing
|
||||||
|
|
||||||
|
$ sudo cat set_ftrace_filter
|
||||||
|
#### all functions enabled ####
|
||||||
|
$
|
||||||
|
$ echo ext4_* > set_ftrace_filter
|
||||||
|
$
|
||||||
|
$ cat set_ftrace_filter
|
||||||
|
ext4_has_free_clusters
|
||||||
|
ext4_validate_block_bitmap
|
||||||
|
ext4_get_group_number
|
||||||
|
ext4_get_group_no_and_offset
|
||||||
|
ext4_get_group_desc
|
||||||
|
[...]
|
||||||
|
```
|
||||||
|
|
||||||
|
现在当你可以看到追踪输出时,你只能看到与内核函数有关的 `ext4` 函数,而你之前已经为其设置了一个过滤器。所有其他的输出都被忽略了。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo cat trace |head -20
|
||||||
|
# tracer: function
|
||||||
|
#
|
||||||
|
# entries-in-buffer/entries-written: 3871/3871 #P:8
|
||||||
|
#
|
||||||
|
# _-----=> irqs-off
|
||||||
|
# / _----=> need-resched
|
||||||
|
# | / _---=> hardirq/softirq
|
||||||
|
# || / _--=> preempt-depth
|
||||||
|
# ||| / delay
|
||||||
|
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
|
||||||
|
# | | | |||| | |
|
||||||
|
cupsd-1066 [004] .... 3308.989545: ext4_file_getattr <-vfs_fstat
|
||||||
|
cupsd-1066 [004] .... 3308.989547: ext4_getattr <-ext4_file_getattr
|
||||||
|
cupsd-1066 [004] .... 3308.989552: ext4_file_getattr <-vfs_fstat
|
||||||
|
cupsd-1066 [004] .... 3308.989553: ext4_getattr <-ext4_file_getattr
|
||||||
|
cupsd-1066 [004] .... 3308.990097: ext4_file_open <-do_dentry_open
|
||||||
|
cupsd-1066 [004] .... 3308.990111: ext4_file_getattr <-vfs_fstat
|
||||||
|
cupsd-1066 [004] .... 3308.990111: ext4_getattr <-ext4_file_getattr
|
||||||
|
cupsd-1066 [004] .... 3308.990122: ext4_llseek <-ksys_lseek
|
||||||
|
cupsd-1066 [004] .... 3308.990130: ext4_file_read_iter <-new_sync_read
|
||||||
|
```
|
||||||
|
|
||||||
|
### 排除要被追踪的函数
|
||||||
|
|
||||||
|
你并不总是知道你想追踪什么,但是,你肯定知道你不想追踪什么。因此,有一个 `set_ftrace_notrace` —— 请注意其中的 "no"。你可以在这个文件中写下你想要的模式,并启用追踪。这样除了所提到的模式外,任何其他东西都会被追踪到。这通常有助于删除那些使我们的输出变得混乱的普通功能。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo cat set_ftrace_notrace
|
||||||
|
#### no functions disabled ####
|
||||||
|
```
|
||||||
|
|
||||||
|
### 具有目标性的追踪
|
||||||
|
|
||||||
|
到目前为止,你一直在追踪内核中发生的一切。但是,他无法帮助你追踪与某个特定命令有关的事件。为了达到这个目的,你可以按需打开和关闭跟踪,并且在它们之间,运行我们选择的命令,这样你就不会在跟踪输出中得到额外的输出。你可以通过向 `tracing_on` 写入 `1` 来启用跟踪,写 `0` 来关闭跟踪。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo cat tracing_on
|
||||||
|
0
|
||||||
|
|
||||||
|
$ sudo echo 1 > tracing_on
|
||||||
|
$ sudo cat tracing_on
|
||||||
|
1
|
||||||
|
|
||||||
|
$ # Run some specific command that we wish to trace here
|
||||||
|
|
||||||
|
$ sudo echo 0 > tracing_on
|
||||||
|
|
||||||
|
$ cat tracing_on
|
||||||
|
0
|
||||||
|
```
|
||||||
|
|
||||||
|
### 追踪特定的 PID
|
||||||
|
|
||||||
|
如果你想追踪与正在运行的特定进程有关的活动,你可以将该 PID 写入一个名为 `set_ftrace_pid` 的文件,然后启用追踪。这样一来,追踪就只限于这个PID,这在某些情况下是非常有帮助的。
|
||||||
|
|
||||||
|
```
|
||||||
|
`$ sudo echo $PID > set_ftrace_pid`
|
||||||
|
```
|
||||||
|
|
||||||
|
### 总结
|
||||||
|
|
||||||
|
`ftrace` 是一个了解 Linux 内核内部工作的很好方式。通过一些练习,你可以学会对 `ftrace` 进行调整以缩小搜索范围。要想更详细地了解 `ftrace` 和它的高级用法,请看 `ftrace` 的核心作者 Steven Rostedt 写的这些优秀文章。
|
||||||
|
|
||||||
|
* [调试 Linux 内核,第一部分](3)
|
||||||
|
* [调试 Linux 内核,第二部分](4)
|
||||||
|
* [调试 Linux 内核,第三部分](5)
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/7/linux-kernel-ftrace
|
||||||
|
|
||||||
|
作者:[Gaurav Kamathe][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[萌新阿岩](https://github.com/mengxinayan)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/gkamathe
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
|
||||||
|
[2]: https://opensource.com/article/19/2/getting-started-cat-command
|
||||||
|
[3]: https://lwn.net/Articles/365835/
|
||||||
|
[4]: https://lwn.net/Articles/366796/
|
||||||
|
[5]: https://lwn.net/Articles/370423/
|
@ -0,0 +1,182 @@
|
|||||||
|
[#]: subject: "Debian vs Ubuntu: What’s the Difference? Which One Should You Use?"
|
||||||
|
[#]: via: "https://itsfoss.com/debian-vs-ubuntu/"
|
||||||
|
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: "perfiffer"
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
Debian 和 Ubuntu:有什么不同?应该选择哪一个?
|
||||||
|
======
|
||||||
|
|
||||||
|
在 Debian 和 Ubuntu 系统中,你都可以 [使用 apt-get 命令][1] 来管理应用。你也可以在这两个发型版中安装 DEB 安装包。很多时候,你会在这两个发行版中发现同样的包安装介绍。
|
||||||
|
|
||||||
|
它们两者是如此的相似,那么,它们两者之间有什么区别呢?
|
||||||
|
|
||||||
|
Debian 和 Ubuntu 属于同一系列的发行版。Debain 是由Ian Murdock 在 1993 年创建的最初的发行版。Ubuntu 是 Mark Shuttleworth 在 2004 年基于 Debian 创建的发行版。
|
||||||
|
|
||||||
|
### Ubuntu 基于 Debian:这意味着什么?
|
||||||
|
|
||||||
|
Linux 发行版虽然有数百个,但其中只有少数是从零开始的独立发行版。 [Debian][2],Arch,Red Hat 是其中几个不派生于其它发行版的使用最广的发行版。
|
||||||
|
|
||||||
|
Ubuntu 源自 Debian。这意味着 Ubuntu 使用与 Debian 相同的 `APT` 包管理系统,并共享 Debian 库中的大量包和库。它建立在 Debian 基础架构上。
|
||||||
|
|
||||||
|
![Ubuntu uses Debian as base][3]
|
||||||
|
|
||||||
|
这就是大多数“衍生”发行版所做的。它们使用相同的包管理器,并将包共享为基本发行版。但他们也做了一些改变,添加了一些自己的包。这就是 Ubuntu 和 Debian 的不同之处,尽管它是从 Debian 衍生而来的。
|
||||||
|
|
||||||
|
### Ubuntu 和 Debian 的不同之处
|
||||||
|
|
||||||
|
因此,Ubuntu 构建在 Debian 架构和基础设施上,也与 Debian 一样是用 `.DEB` 格式的软件包。
|
||||||
|
|
||||||
|
这意味着使用 Ubuntu 和使用 Debian 是一样的吗?并不完全如此。有很多因素可以用来区分两个不同的发行版。
|
||||||
|
|
||||||
|
让我逐一讨论这些因素来比较 Ubuntu 和 Debian。请记住,有些比较适用于桌面版本,而有些比较适用于服务器版本。
|
||||||
|
|
||||||
|
![][4]
|
||||||
|
|
||||||
|
#### 1\. 发布周期
|
||||||
|
|
||||||
|
Ubuntu 有两种发布版本:LTS 和 regular。[Ubuntu LTS (长期支持) 版本][5] 每两年发布一次,并且会提供五年的支持。你可以选择升级到下一个可用的 LTS 版本。LTS 版本更稳定。
|
||||||
|
|
||||||
|
还有一个非 LTS 版本,每六个月发布一次。这些版本仅仅提供九个月的支持,但是它们会有一些新的软件版本和功能。当当前的版本已经不在维护了,你必须升级到下一个 Ubuntu 版本。
|
||||||
|
|
||||||
|
所以基本上,你可以根据这些版本在稳定性和新特性之间进行选择。
|
||||||
|
|
||||||
|
另一方面,Debian 有三个不同的版本:稳定版、测试版和非稳定版 。非稳定版是为了实际测试,应该避免使用。
|
||||||
|
|
||||||
|
测试版并不是非稳定版。它是用来为下一个稳定版做准备。有一些 Debian 用户更倾向于使用测试版来获取新的特性。
|
||||||
|
|
||||||
|
然后是稳定版。这是 Debian 的主要版本。Debian 稳定版可能没有最新的软件和功能,但在稳定性方面毋庸置疑。
|
||||||
|
|
||||||
|
每两年 Debian 会发布一个稳定版,并且会提供三年的支持。此后,你必须升级到下一个可用的稳定版。
|
||||||
|
|
||||||
|
#### 2\. 软件更新
|
||||||
|
|
||||||
|
![][6]
|
||||||
|
|
||||||
|
Debian 更关注稳定性,这意味着它并不总是使用最新版本的软件。例如,最新的 Debian 11 用的 GNOME 版本为 3.38,并不是最新版的 GNOME 3.40。
|
||||||
|
|
||||||
|
对于 GIMP、LibreOffice 等其它软件也是如此。这是你必须对 Debian 做出的妥协。这就是“Debian stable = Debian stale”笑话在 Linux 社区流行的原因。
|
||||||
|
|
||||||
|
Ubuntu LTS 版本也关注稳定性。但是它们通常拥有较新版本的常见软件。
|
||||||
|
|
||||||
|
你应该注意,对于某些软件,从开发人员仓库安装也是一种选择。例如,如果你想要安装最新版的 Docker,你可以在 Debian 和 Ubuntu 中添加 Docker 仓库。
|
||||||
|
|
||||||
|
总体来说,相比较于 Ubuntu ,Debian 稳定版的软件版本会更旧。
|
||||||
|
|
||||||
|
#### 3\. 软件可用性
|
||||||
|
|
||||||
|
Debian 和 Ubuntu 都拥有一个巨大的软件仓库。然而,[Ubuntu 同时有PPA][7]<ruby>(Personal Package Archive)<ruby>。通过 `PPA`,安装更新版本的软件或者获取最新版本的软件都将会变的更容易。
|
||||||
|
|
||||||
|
![][8]
|
||||||
|
|
||||||
|
你可以在 Debian 中尝试使用 PPA,但是体验并不好。大多数时候你都会遇到问题。
|
||||||
|
|
||||||
|
#### 4\. 支持的平台
|
||||||
|
|
||||||
|
Ubuntu 可以在 64 位的 x86 和 ARM 平台上使用。它不再提供 32 位的镜像。
|
||||||
|
|
||||||
|
另一方面,Debian 支持 32 位和 64 位架构。除此之外,Debian 还支持 64 位 ARM(arm64)、ARM EABI(armel)、ARMv7(EABI hard-float ABI,armhf)、little-endian MIPS(mipsel)、64 位 little-endian MIPS(mips64el)、64 位 little-endian PowerPC(ppc64el) 和 IBM System z(s390x)。
|
||||||
|
|
||||||
|
所以它也被称为 “通用操作系统”。
|
||||||
|
|
||||||
|
#### 5\. 安装
|
||||||
|
|
||||||
|
[安装 Ubuntu][9] 比安装 Debian 容易得多。我并不是在骗你。即使对于中级 Linux 用户,Debian 也可能令人困惑。
|
||||||
|
|
||||||
|
当你下载 Debian 的时候,它默认提供的是最小化镜像。 此镜像没有非免费(非开源)固件。如果你继续安装它,你就可能会发现你的网络适配器和其它硬件将无法识别。
|
||||||
|
|
||||||
|
有一个单独的非免费镜像包含固件,但它是隐藏的,如果你不知道,你可能会大吃一惊。
|
||||||
|
|
||||||
|
![Getting non-free firmware is a pain in Debian][10]
|
||||||
|
|
||||||
|
Ubuntu 在默认提供的镜像中包含专有驱动程序和固件时要宽容的多。
|
||||||
|
|
||||||
|
此外,Debian 安装程序看起来很旧,而 Ubuntu 安装程序看起来就比较现代化。Ubuntu 安装程序还可以识别磁盘上其它已安装的操作系统,并为你提供将 Ubuntu 与现有操作系统一起安装的选项(双引导)。但我在测试时并没有注意到 Debian 有此选项。
|
||||||
|
|
||||||
|
![Installing Ubuntu is smoother][11]
|
||||||
|
|
||||||
|
#### 6\. 开箱即用的硬件支持
|
||||||
|
|
||||||
|
就像之前提到的,Debian 主要关注 [FOSS][12](自由和开源软件)。这意味着 Debian 提供的内核不包括专有驱动程序和固件。
|
||||||
|
|
||||||
|
这并不是说你无法使其工作,而是你必须添加/启动其它存储库并手动安装。这可能令人沮丧,特别是对于初学者来说。
|
||||||
|
|
||||||
|
Ubuntu 并不完美,但在提供开箱即用的驱动程序和固件方面,它比 Debian 好得多。这意味着更少的麻烦和更完整的开箱即用体验。
|
||||||
|
|
||||||
|
#### 7\. 桌面环境选择
|
||||||
|
|
||||||
|
Ubuntu 默认使用定制的 GNOME 桌面环境。你可以在其上安装其它桌面环境,或者选择各种基于桌面的 Ubuntu 风格,如 Kubuntu(使用 KDE 桌面),Xubuntu(使用 Xfce 桌面)等。
|
||||||
|
|
||||||
|
Debian 也默认使用的 GNOME 桌面。但是它会让你在安装的过程中选择你要安装的桌面环境。
|
||||||
|
|
||||||
|
![][15]
|
||||||
|
|
||||||
|
你还可以从其网站获取[DE 特定的 ISO 镜像][16]。
|
||||||
|
|
||||||
|
#### 8\. 游戏性
|
||||||
|
|
||||||
|
由于 Stream 及其 Proton 项目,Linux 上的游戏总体上有所改善。尽管如此,游戏在很大程度上取决于硬件。
|
||||||
|
|
||||||
|
在硬件兼容性上,Ubuntu 比 Debian 更好的支持专有驱动程序。
|
||||||
|
|
||||||
|
并不是说它在 Debian 中不能完成,而是需要一些时间和精力来实现。
|
||||||
|
|
||||||
|
#### 9\. 性能
|
||||||
|
|
||||||
|
性能部分没有明显的“赢家”,无论是在服务器版本还是在桌面版本。 Debian 和 Ubuntu 作为桌面和服务器操作系统都很受欢迎。
|
||||||
|
|
||||||
|
性能取决于你系统的硬件和你所使用的软件组件。你可以在你的操作系统中调整和控制你的系统。
|
||||||
|
|
||||||
|
#### 10\. 社区和支持
|
||||||
|
|
||||||
|
Debian 是社区项目。此项目的一切都由其社区成员管理。
|
||||||
|
|
||||||
|
Ubuntu 由 [Canonical][17] 提供支持。然而,它并不是一个真正意义上的企业项目。它确实有一个社区,但任何事情的最终决定权都掌握在 Canonical 手中。
|
||||||
|
|
||||||
|
就支持而言,Ubuntu 和 Debian 都有专门的论坛,用户可以在其中寻求帮助和提出建议。
|
||||||
|
|
||||||
|
Canonical 还为其企业客户提供收费的专业支持。 Debian 没有这样的功能。
|
||||||
|
|
||||||
|
### 结论
|
||||||
|
|
||||||
|
Debian 和 Ubuntu 都是桌面或服务器操作系统的可靠选择。 apt 包管理器和 DEB 包对两者都是通用的,因此提供了一些相似的体验。
|
||||||
|
|
||||||
|
然而,Debian 仍然需要一定程度的专业知识,特别是在桌面方面。如果你是 Linux 新手,坚持使用 Ubuntu 将是你更好的选择。在我看来,你应该获得一些经验,熟悉 Linux,然后尝试使用 Debian。
|
||||||
|
|
||||||
|
并不是说你不能从一开始就使用 Debian,但对于 Linux 初学者来说,这并不是一种很好的体验。
|
||||||
|
|
||||||
|
**欢迎你对这场 Debian 与 Ubuntu 辩论发表意见。**
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/debian-vs-ubuntu/
|
||||||
|
|
||||||
|
作者:[Abhishek Prakash][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[perfiffer](https://github.com/perfiffer)
|
||||||
|
校对:[校对者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/apt-get-linux-guide/
|
||||||
|
[2]: https://www.debian.org/
|
||||||
|
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/Debian-ubuntu-upstream.png?resize=800%2C400&ssl=1
|
||||||
|
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/debian-vs-ubuntu.png?resize=800%2C450&ssl=1
|
||||||
|
[5]: https://itsfoss.com/long-term-support-lts/
|
||||||
|
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-policy.png?resize=795%2C456&ssl=1
|
||||||
|
[7]: https://itsfoss.com/ppa-guide/
|
||||||
|
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/ffmpeg_add_ppa.jpg?resize=800%2C222&ssl=1
|
||||||
|
[9]: https://itsfoss.com/install-ubuntu/
|
||||||
|
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/Debian-firmware.png?resize=800%2C600&ssl=1
|
||||||
|
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/03/choose-something-else-installing-ubuntu.png?resize=800%2C491&ssl=1
|
||||||
|
[12]: https://itsfoss.com/what-is-foss/
|
||||||
|
[13]: https://itsfoss.com/best-linux-desktop-environments/
|
||||||
|
[14]: https://itsfoss.com/which-ubuntu-install/
|
||||||
|
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/debian-install-desktop-environment.png?resize=640%2C479&ssl=1
|
||||||
|
[16]: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/
|
||||||
|
[17]: https://canonical.com/
|
@ -0,0 +1,187 @@
|
|||||||
|
[#]: subject: "10 Things to Do After Installing elementary OS 6 “Odin”"
|
||||||
|
[#]: via: "https://www.debugpoint.com/2021/08/10-things-to-do-after-install-elementary-os-6/"
|
||||||
|
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: " anine09"
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
安装elementary OS 6 “Odin”后要做的 10 件事
|
||||||
|
======
|
||||||
|
|
||||||
|
一个关于安装 elementary OS 6 “Odin” 后要做的事情的列表。
|
||||||
|
|
||||||
|
在经过两年多的开发后 [elementary OS 6 “Odin”][1] 于不久前发布,此次版本更新在核心模块、 Pantheon 桌面、本地应用中引入了一系列变化巨大的新特性,elementary OS 6 “Odin” 基于 Ubuntu 20.04 LTS。
|
||||||
|
|
||||||
|
也就是说,如果你完成了安装,你可能想要尝试通过一些特定的设置来使你的系统更加的个性化。这里描述的选项是通用的,在某些情况下可能对你无效,但是我们觉得有必要列出一些基础知识,让你有合适的方式来探索这个漂亮的 elementary OS。
|
||||||
|
|
||||||
|
### 安装完 elementary OS 6 “Odin” 后要做的事情
|
||||||
|
|
||||||
|
***准备步骤***
|
||||||
|
|
||||||
|
首先确保你已经连上了互联网,你可以在顶部的通知区域查看可用的网络列表
|
||||||
|
|
||||||
|
#### 1\. 更改 hostname
|
||||||
|
|
||||||
|
这可能不是你想做的第一件事。但是我不知道为什么在安装过程中没有给出更改 hostname 的选项。例如,见下图的终端提示, 这个 hostname 是 elementary OS 的默认硬件配置。在我看来这一点都不好。
|
||||||
|
|
||||||
|
![hostname 修改之前][2]
|
||||||
|
|
||||||
|
打开终端并运行下列命令以更改 hostname
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hostnamectl set-hostname your-new-hostname
|
||||||
|
```
|
||||||
|
|
||||||
|
示例:
|
||||||
|
|
||||||
|
![修改 hostname][3]
|
||||||
|
|
||||||
|
![hostname 修改之后][4]
|
||||||
|
|
||||||
|
#### 2\. 升级你的系统
|
||||||
|
|
||||||
|
在安装任何 Linux 发行版后,你应该做的第一件事就是确保系统处于最新的软件包和安全更新状态。
|
||||||
|
|
||||||
|
你可以通过打开应用中心来检查或者安装更新。
|
||||||
|
|
||||||
|
或者打开终端运行下列命令。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt update
|
||||||
|
sudo apt upgrade
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 3\. 安装 Pantheon Tweaks
|
||||||
|
|
||||||
|
Pantheon Tweaks 是 elementary OS 的必备应用。它提供了一些无法通过系统原生设置程序修改的额外的设置和配置选项,请打开终端并运行以下命令以安装 Pantheon Tweaks。注意:先前版本的 Tweak 工具叫做 elementary Tweaks,从 Odin 版本开始更名为 Pantheon Tweaks。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install software-properties-common
|
||||||
|
sudo add-apt-repository -y ppa:philip.scott/pantheon-tweaks
|
||||||
|
sudo apt install -y pantheon-tweaks
|
||||||
|
```
|
||||||
|
|
||||||
|
安装后打开系统设置,你可以在那里找到 Tweaks 选项。
|
||||||
|
|
||||||
|
[这里][5] 提供了更详细的安装指南(如果你需要了解更多信息)
|
||||||
|
|
||||||
|
### 4. 配置 Dock
|
||||||
|
|
||||||
|
Dock 是整个桌面的中心。老实说,Dock 中默认包含的应用并不常用,因此你是可以通过以下步骤配置 Dock 中的项目的。
|
||||||
|
|
||||||
|
* 移除:右键单击并取消 **在 Dock 中驻留** 选项。
|
||||||
|
* 添加新的项目:单击顶部的应用程序。然后右键单击你想要放在 Dock 的应用图标。选择 **添加到 Dock**。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
在我看来,你应该至少把文件管理、截图工具、Firefox 、计算器,以及其他的一些应用添加到 Dock。然后移除 Dock 上那些你不需要的应用。
|
||||||
|
|
||||||
|
#### 5\. 更改外观
|
||||||
|
|
||||||
|
elementary OS 6 Odin 改进了桌面的整体外观,为整个桌面和应用程序提供了自带的强调色和原生的夜间模式,同时,系统自带了许多漂亮的壁纸。你可以通过 **应用 > 系统设置 > 桌面** 来定制壁纸、外观、面板和多任务视图。
|
||||||
|
|
||||||
|
![elementary OS 6 Odin 桌面设置界面][6]
|
||||||
|
|
||||||
|
按照你希望的样子来配置你系统的外观
|
||||||
|
|
||||||
|
参见:[elementary OS 6 Odin Promises Complete Dark Style](https://www.debugpoint.com/2020/11/elementary-os-6-odin-dark-style/)
|
||||||
|
|
||||||
|
你也可以基于日出和日落的时间来设置夜间模式。
|
||||||
|
|
||||||
|
#### 6\. 安装其他的应用
|
||||||
|
|
||||||
|
自带的应用中心非常适合这个系统,我发现它是 Linux 桌面最好的应用商店之一。然而,有时候需要安装没有预装的必要应用(大多数是知名的应用)。下面是个新系统推荐安装的软件列表。(说真的,为什么 LibreOffice 没有预装?)
|
||||||
|
|
||||||
|
* firefox
|
||||||
|
* gimp
|
||||||
|
* gedit
|
||||||
|
* inkscape
|
||||||
|
* obs-studio
|
||||||
|
* libreoffice
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 7\. 一些针对笔记本电脑的省电贴士
|
||||||
|
|
||||||
|
有许多方法可以配置你的 elementary OS (或者一般的 Linux 桌面),以达到延长电池寿命的目的。记住,电池寿命取决于你的笔记本硬件,以及电池和笔记本的使用年限。所以,遵循下面的一些建议,最大限度的利用你的笔记本电池。
|
||||||
|
|
||||||
|
* 安装 [tlp][8]. tlp 是一个简单易用的命令行程序,用来帮你在 Linux 上延长电池寿命。你只需要安装它,默认情况下,它会处理好其他的设置。安装命令:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo add-apt-repository ppa:linrunner/tlp
|
||||||
|
sudo apt update
|
||||||
|
sudo apt-get install tlp
|
||||||
|
sudo tlp start
|
||||||
|
```
|
||||||
|
|
||||||
|
* 关闭蓝牙,默认情况下,蓝牙是开启状态。在需要的时候再启动它。
|
||||||
|
|
||||||
|
* 通过下面的命令安装 thermald。这个实用程序(实际是个守护进程)控制着你的 CPU 的 P-States 和 T-States 的温度以及 CPU 发热。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt install thermald
|
||||||
|
```
|
||||||
|
|
||||||
|
* 根据你的需要将亮度调到最小。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 8\. 安装磁盘实用程序
|
||||||
|
|
||||||
|
在很多情况下,你发现你需要格式化 USB 或者向 USB 中写入一些东西。默认情况下,系统没有安装任何相关的应用。你可以安装以下这些易用的应用。
|
||||||
|
|
||||||
|
```
|
||||||
|
gnome-disk-utility
|
||||||
|
gparted
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 9\. 启用最大化和最小化选项
|
||||||
|
|
||||||
|
许多用户喜欢在窗口标题栏左边或者右边使用最大化、最小化的按钮,elementary OS 默认只提供关闭和恢复两个选项。这没什么问题,因为这就是它的设计理念。然而你可以通过使用 Pantheon Tweaks 来开启最大化和最小化按钮,具体的方式是:调整 > 外观 > 窗口控制。
|
||||||
|
|
||||||
|
![在 elementary OS 中启动最大化和最小化设置][9]
|
||||||
|
|
||||||
|
#### 10\. 在 Odin 中学习新的多点触控手势
|
||||||
|
|
||||||
|
如果你是笔记本用户,并且使用 elementary OS Odin,那么你一定要看看这些超酷的新触控手势。三根手指向上滑动,就会平滑的打开多任务视图,打开应用程序和工作空间。用三根手指向左或向右滑动,就能在动态工作空间之间流畅的切换,使任务之间的额切换更快。
|
||||||
|
|
||||||
|
用两根手指也可以再本地应用中实现类似的功能。
|
||||||
|
|
||||||
|
### 结束语
|
||||||
|
|
||||||
|
我希望安装elementary OS 6 Odin 后要做的 10 件事能帮助到你,让你开始使用 elementary OS 6 Odin,尽管这些事情完全是用户的偏好,因此这些事情有可能适合你也有可能不适用于你,但总的来说,这些都是一般用户喜欢的预期调整。
|
||||||
|
|
||||||
|
如果你觉得有更多的东西应该添加到列表中,请在下面的评论中告诉我。
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.debugpoint.com/2021/08/10-things-to-do-after-install-elementary-os-6/
|
||||||
|
|
||||||
|
作者:[Arindam][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://www.debugpoint.com/author/admin1/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://www.debugpoint.com/2021/08/elementary-os-6/
|
||||||
|
[2]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/hostname-change-before.jpeg
|
||||||
|
[3]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/changing-hostname.jpeg
|
||||||
|
[4]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/changed-hostname.jpeg
|
||||||
|
[5]: https://www.debugpoint.com/2021/07/elementary-tweaks-install/
|
||||||
|
[6]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/elementary-OS-6-Odin-settings-window-Desktop.jpeg
|
||||||
|
[7]: https://www.debugpoint.com/2020/09/elementary-os-6-odin-new-features-release-date/
|
||||||
|
[8]: https://linrunner.de/tlp/
|
||||||
|
[9]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/enable-minimize-maximize-buttons-elementary-OS-1024x501.png
|
||||||
|
|
@ -1,131 +0,0 @@
|
|||||||
[#]: subject: "How to Monitor Log Files in Real Time in Linux [Desktop and Server]"
|
|
||||||
[#]: via: "https://www.debugpoint.com/2021/08/monitor-log-files-real-time/"
|
|
||||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
|
||||||
[#]: collector: "lujun9972"
|
|
||||||
[#]: translator: "geekpi"
|
|
||||||
[#]: reviewer: " "
|
|
||||||
[#]: publisher: " "
|
|
||||||
[#]: url: " "
|
|
||||||
|
|
||||||
如何在 Linux 中实时监控日志文件(桌面和服务器)
|
|
||||||
======
|
|
||||||
本教程解释了如何实时监控 Linux 日志文件(桌面、服务器或应用),以进行诊断和故障排除。
|
|
||||||
|
|
||||||
当你在你的 Linux 桌面、服务器或任何应用中遇到问题时,你会首先查看各自的日志文件。日志文件通常是来自应用的文本和信息流,上面有一个时间戳。它可以帮助你缩小具体的实例,并帮助你找到任何问题的原因。它也可以帮助从网络上获得援助。
|
|
||||||
|
|
||||||
一般来说,所有的日志文件都位于 /var/log 中。这个目录包含以 .log 为扩展名的特定应用、服务的日志文件,它还包含单独的其他目录,这些目录包含其日志文件。
|
|
||||||
|
|
||||||
![log files in var-log][1]
|
|
||||||
|
|
||||||
所以说,如果你想监控一堆日志文件或特定的日志文件。这里有一些你可以做到方法。
|
|
||||||
|
|
||||||
### 实时监控 Linux 日志文件
|
|
||||||
|
|
||||||
#### 使用 tail 命令
|
|
||||||
|
|
||||||
使用 tail 命令是实时跟踪日志文件的最基本方法。特别是,如果你所在的服务器只有一个终端,没有 GUI。这是很有帮助的。
|
|
||||||
|
|
||||||
比如:
|
|
||||||
|
|
||||||
```
|
|
||||||
tail /path/to/log/file
|
|
||||||
```
|
|
||||||
|
|
||||||
![Monitoring multiple log files via tail][2]
|
|
||||||
|
|
||||||
使用开关 -f 来跟踪日志文件,它是实时更新的。例如,如果你想跟踪 syslog,你可以使用以下命令。
|
|
||||||
|
|
||||||
```
|
|
||||||
tail -f /var/log/syslog
|
|
||||||
```
|
|
||||||
|
|
||||||
你可以用一个命令监控多个日志文件,使用:
|
|
||||||
|
|
||||||
```
|
|
||||||
tail -f /var/log/syslog /var/log/dmesg
|
|
||||||
```
|
|
||||||
|
|
||||||
如果你想监控 http 或 sftp 或任何服务器,你也可以在这个命令中监控它们各自的日志文件。
|
|
||||||
|
|
||||||
记住,上述命令需要管理员权限。
|
|
||||||
|
|
||||||
#### 使用 lnav(日志文件浏览器)
|
|
||||||
|
|
||||||
![lnav Running][3]
|
|
||||||
|
|
||||||
lnav 是一个很好的工具,你可以用它来用彩色编码的信息以更有条理的方式监控日志文件。在 Linux 系统中,它不是默认安装的。你可以用下面的命令来安装它:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt install lnav (Ubuntu)
|
|
||||||
sudo dnf install lnav (Fedora)
|
|
||||||
```
|
|
||||||
|
|
||||||
lnav 的好处是,如果你不想安装它,你可以直接下载其预编译的可执行文件,然后在任何地方运行。甚至从 U 盘上也可以。它不需要设置,而且有很多功能。使用 lnav,你可以通过 SQL 查询日志文件,以及其他很酷的功能,你可以在它的[官方网站][4]上了解。
|
|
||||||
|
|
||||||
Once installed, you can simply run lnav from terminal with admin privilege, and it will show all the logs from /var/log by default and start monitoring in real time.
|
|
||||||
|
|
||||||
#### 关于 systemd 的 journalctl 说明
|
|
||||||
|
|
||||||
今天所有的现代 Linux 发行版大多使用 systemd。systemd 提供了运行 Linux 操作系统的基本框架和组件。systemd 通过 journalctl 提供日志服务,帮助管理所有 systemd 服务的日志。你还可以通过以下命令实时监控各个 systemd 服务和日志。
|
|
||||||
|
|
||||||
```
|
|
||||||
journalctl -f
|
|
||||||
```
|
|
||||||
|
|
||||||
下面是一些特定的 journalctl 命令,可以在一些情况下使用。你可以将这些命令与上面的 -f 开关结合起来,开始实时监控。
|
|
||||||
|
|
||||||
* 对紧急系统信息,使用
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
journalctl -p 0
|
|
||||||
```
|
|
||||||
|
|
||||||
* 显示带有解释的错误
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
journalctl -xb -p 3
|
|
||||||
```
|
|
||||||
|
|
||||||
* 使用时间控制来过滤输出
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
journalctl --since "2020-12-04 06:00:00"
|
|
||||||
journalctl --since "2020-12-03" --until "2020-12-05 03:00:00"
|
|
||||||
journalctl --since yesterday
|
|
||||||
journalctl --since 09:00 --until "1 hour ago"
|
|
||||||
```
|
|
||||||
|
|
||||||
如果你想了解更多关于 journalctl 的细节,我已经写了一个[指南][6]。
|
|
||||||
|
|
||||||
### 结束语
|
|
||||||
|
|
||||||
我希望这些命令和技巧能帮助你找出桌面或服务器问题/错误的根本原因。对于更多的细节,你可以随时参考手册,玩弄各种开关。如果你对这篇文章有什么意见或看法,请在下面的评论栏告诉我。
|
|
||||||
|
|
||||||
干杯。
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://www.debugpoint.com/2021/08/monitor-log-files-real-time/
|
|
||||||
|
|
||||||
作者:[Arindam][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://www.debugpoint.com/author/admin1/
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/log-files-in-var-log-1024x312.jpeg
|
|
||||||
[2]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/Monitoring-multiple-log-files-via-tail-1024x444.jpeg
|
|
||||||
[3]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/lnav-Running-1024x447.jpeg
|
|
||||||
[4]: https://lnav.org/features
|
|
||||||
[6]: https://www.debugpoint.com/2020/12/systemd-journalctl/
|
|
@ -1,107 +0,0 @@
|
|||||||
[#]: subject: "Access your iPhone on Linux with this open source tool"
|
|
||||||
[#]: via: "https://opensource.com/article/21/8/libimobiledevice-iphone-linux"
|
|
||||||
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
|
|
||||||
[#]: collector: "lujun9972"
|
|
||||||
[#]: translator: "geekpi"
|
|
||||||
[#]: reviewer: " "
|
|
||||||
[#]: publisher: " "
|
|
||||||
[#]: url: " "
|
|
||||||
|
|
||||||
用这个开源工具在 Linux 上访问你的 iPhone
|
|
||||||
======
|
|
||||||
过使用 Libimobiledevice 从 Linux 与 iOS 设备进行通信。
|
|
||||||
![A person looking at a phone][1]
|
|
||||||
|
|
||||||
iPhone 和 iPad 决不是开源的,但它们是流行的设备。许多拥有 iOS 备的人恰好也在使用大量的开源,包括 Linux。Windows 和 macOS 的用户可以通过使用苹果提供的软件与 iOS 设备通信,但苹果不支持 Linux 用户。开源程序员早在 2007 年(就在 iPhone 发布一年后)就以 Libimobiledevice(当时叫 libiphone)来拯救了人们,这是一个与 iOS 通信的跨平台解决方案。它可以在 Linux、Android、Arm 系统(如 Raspberry Pi)、Windows、甚至 macOS 上运行。
|
|
||||||
|
|
||||||
Libimobiledevice 是用 C 语言编写的,使用原生协议与 iOS 设备上运行的服务进行通信。它不需要苹果公司的任何库,所以它是完全免费和开源的。
|
|
||||||
|
|
||||||
Libimobiledevice 是一个面向对象的 API,有许多终端工具与它捆绑在一起,以方便你使用。该库支持苹果最早的 iOS 设备,一直到其最新的型号。这是多年来研究和开发的结果。该项目中的应用包括 **usbmuxd**、**ideviceinstaller**、**idevicerestore**、**ifuse**、**libusbmuxd**、**libplist**、**libirecovery**、和 **libideviceactivation**。
|
|
||||||
|
|
||||||
### 在 Linux 上安装 Libimobiledevice
|
|
||||||
|
|
||||||
在 Linux 上,你可能已经默认安装了 **libimobiledevice**。你可以通过你的软件包管理器或应用商店找到,或者通过运行项目中包含的一个命令:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
`$ ifuse --help`
|
|
||||||
```
|
|
||||||
|
|
||||||
你可以用你的包管理器安装 **libimobiledevice**。例如,在 Fedora 或 CentOS 上:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
`$ sudo dnf install libimobiledevice ifuse usbmuxd`
|
|
||||||
```
|
|
||||||
|
|
||||||
在 Debian 和 Ubuntu 上:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
`$ sudo apt install usbmuxd libimobiledevice6 libimobiledevice-utils`
|
|
||||||
```
|
|
||||||
|
|
||||||
或者,你可以从源代码[下载][2]并安装 **libimobiledevice**。
|
|
||||||
|
|
||||||
### 连接你的设备
|
|
||||||
|
|
||||||
当你安装了所需的软件包,将你的 iOS 设备连接到你的电脑。
|
|
||||||
|
|
||||||
为你的 iOS 设备建立一个目录作为挂载点。
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
`$ mkdir ~/iPhone`
|
|
||||||
```
|
|
||||||
|
|
||||||
接下来,挂载设备:
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
`$ ifuse ~/iPhone`
|
|
||||||
```
|
|
||||||
|
|
||||||
你的设备提示你信任你用来访问它的电脑。
|
|
||||||
|
|
||||||
![iphone prompts to trust the computer][3]
|
|
||||||
|
|
||||||
图 1:iPhone 提示你要信任电脑。
|
|
||||||
|
|
||||||
信任问题解决后,你会在桌面上看到新的图标。
|
|
||||||
|
|
||||||
![iphone icons appear on desktop][4]
|
|
||||||
|
|
||||||
图 2:iPhone 的新图标出现在桌面上。
|
|
||||||
|
|
||||||
点击 **iPhone** 图标,显示出你的 iPhone 的文件夹结构。
|
|
||||||
|
|
||||||
![iphone folder structure displayed][5]
|
|
||||||
|
|
||||||
图 3:显示了 iPhone 的文件夹结构。
|
|
||||||
|
|
||||||
我通常最常访问的文件夹是 **DCIM**,那里存放着我的 iPhone 照片。有时我在写文章时使用这些照片,有时有一些照片我想用 Gimp 等开源应用来增强。可以直接访问这些图片,而不是通过电子邮件把它们发给我自己,这是使用 Libimobiledevice 工具的好处之一。我可以把这些文件夹中的任何一个复制到我的 Linux 电脑上。我也可以在 iPhone 上创建文件夹并删除它们。
|
|
||||||
|
|
||||||
### 发现更多
|
|
||||||
|
|
||||||
[Martin Szulecki][6] 是该项目的首席开发者。该项目正在寻找开发者加入他们的[社区][7]。Libimobiledevice 可以改变你使用外设的方式,而无论你在什么平台上。这是开源的又一次胜利,这意味着它是所有人的胜利。
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/article/21/8/libimobiledevice-iphone-linux
|
|
||||||
|
|
||||||
作者:[Don Watkins][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/don-watkins
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_mobile_phone.png?itok=RqVtvxkd (A person looking at a phone)
|
|
||||||
[2]: https://github.com/libimobiledevice/libimobiledevice/
|
|
||||||
[3]: https://opensource.com/sites/default/files/1trust_0.png
|
|
||||||
[4]: https://opensource.com/sites/default/files/2docks.png
|
|
||||||
[5]: https://opensource.com/sites/default/files/2iphoneicon.png
|
|
||||||
[6]: https://github.com/FunkyM
|
|
||||||
[7]: https://libimobiledevice.org/#community
|
|
@ -0,0 +1,87 @@
|
|||||||
|
[#]: subject: "Apps for daily needs part 4: audio editors"
|
||||||
|
[#]: via: "https://fedoramagazine.org/apps-for-daily-needs-part-4-audio-editors/"
|
||||||
|
[#]: author: "Arman Arisman https://fedoramagazine.org/author/armanwu/"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: "geekpi"
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
满足日常需求的应用第四部分:音频编辑器
|
||||||
|
======
|
||||||
|
|
||||||
|
![][1]
|
||||||
|
|
||||||
|
照片由 [Brooke Cagle][2] 在 [Unsplash][3] 上发布。
|
||||||
|
|
||||||
|
音频编辑应用或数字音频工作站(DAW)在过去只被专业人士使用,如唱片制作人、音响工程师和音乐家。但现在很多不是专业人士的人也需要它们。这些工具被用于演示文稿解说、视频博客,甚至只是作为一种爱好。现在尤其如此,因为有这么多的在线平台,方便大家分享音频作品,如音乐、歌曲、播客等。本文将介绍一些你可以在 Fedora Linux 上使用的开源音频编辑器或 DAW。你可能需要安装提到的软件。如果你不熟悉如何在 Fedora Linux 中添加软件包,请参阅我之前的文章[安装 Fedora 34 工作站后要做的事情][4]。这里列出了音频编辑器或 DAW 类的一些日常需求的应用。
|
||||||
|
|
||||||
|
### Audacity
|
||||||
|
|
||||||
|
我相信很多人已经知道 Audacity 了。它是一个流行的多轨音频编辑器和录音机,可用于对所有类型的音频进行后期处理。大多数人使用 Audacity 来记录他们的声音,然后进行编辑,使其结果更好。其结果可以作为播客或视频博客的解说词。此外,人们还用 Audacity 来创作音乐和歌曲。你可以通过麦克风或调音台录制现场音频。它还支持 32 位的声音质量。
|
||||||
|
|
||||||
|
Audacity 有很多功能,可以支持你的音频作品。它有对插件的支持,你甚至可以自己编写插件。Audacity 提供了许多内置效果,如降噪、放大、压缩、混响、回声、限制器等。你可以利用实时预览功能在直接聆听音频的同时尝试这些效果。内置的插件管理器可以让你管理经常使用的插件和效果。
|
||||||
|
|
||||||
|
![][5]
|
||||||
|
|
||||||
|
更多信息可在此链接中找到: <https://www.audacityteam.org/>
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
### LMMS
|
||||||
|
|
||||||
|
LMMS 或 Linux MultiMedia Studio 是一个全面的音乐创作应用。你可以使用 LMMS 用你的电脑从头开始制作你的音乐。你可以根据自己的创意创造旋律和节拍,并通过选择声音乐器和各种效果使其更加完美。有几个与乐器和效果有关的内置功能,如 16 个内置合成器、嵌入式 ZynAddSubFx、支持插入式 VST 效果插件、捆绑图形和参数均衡器、内置分析器等等。LMMS 还支持 MIDI 键盘和其他音频外围设备。
|
||||||
|
|
||||||
|
![][6]
|
||||||
|
|
||||||
|
更多信息可在此链接中获得: <https://lmms.io/>
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
### Ardour
|
||||||
|
|
||||||
|
Ardour 作为一个全面的音乐创作应用,其功能与 LMMS 相似。它在其网站上说,Ardour 是一个 DAW 应用,是来自世界各地的音乐家、程序员和专业录音工程师合作的结果。Ardour 拥有音频工程师、音乐家、配乐编辑和作曲家需要的各种功能。
|
||||||
|
|
||||||
|
Ardour 为录音、编辑、混音和输出提供了完整的功能。它有无限的多声道音轨、无限撤销/重做的非线性编辑器、一个全功能的混音器、内置插件等。Ardour 还带有视频播放工具,所以它在为视频项目创建和编辑配乐的过程中也很有帮助。
|
||||||
|
|
||||||
|
![][7]
|
||||||
|
|
||||||
|
更多信息可在此链接中获得: <https://ardour.org/>
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
### TuxGuitar
|
||||||
|
|
||||||
|
TuxGuitar 是一个指法谱和乐谱编辑器。它配备了指法编辑器、乐谱查看器、多轨显示、拍号管理和速度管理。它包括各种效果,如弯曲、滑动、颤音等。虽然 TuxGuitar 专注于吉他,但它也允许你为其他乐器写乐谱。它也可以作为一个基本的 MIDI 编辑器。你需要对指法谱和乐谱有一定的了解才能使用它。
|
||||||
|
|
||||||
|
![][8]
|
||||||
|
|
||||||
|
更多的信息可以在这个链接上获得: <http://www.tuxguitar.com.ar/>
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
### 总结
|
||||||
|
|
||||||
|
这篇文章介绍了四个音频编辑器,作为你在 Fedora Linux 上的日常需要和使用的应用。实际上,还有许多其他的你可以在 Fedora Linux 上使用的音频编辑器或者 DAW。你也可以使用 Mixxx、Rosegarden、Kwave、Qtractor、MuseScore、musE 等等。希望这篇文章能帮助你调查和选择合适的音频编辑器或者 DAW。如果你有使用这些应用的经验,请在评论中分享你的经验。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://fedoramagazine.org/apps-for-daily-needs-part-4-audio-editors/
|
||||||
|
|
||||||
|
作者:[Arman Arisman][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://fedoramagazine.org/author/armanwu/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://fedoramagazine.org/wp-content/uploads/2021/07/FedoraMagz-Apps-4-Audio-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/08/audio-audacity-1024x575.png
|
||||||
|
[6]: https://fedoramagazine.org/wp-content/uploads/2021/08/audio-lmms-1024x575.png
|
||||||
|
[7]: https://fedoramagazine.org/wp-content/uploads/2021/08/audio-ardour-1024x592.png
|
||||||
|
[8]: https://fedoramagazine.org/wp-content/uploads/2021/08/audio-tuxguitar-1024x575.png
|
@ -0,0 +1,126 @@
|
|||||||
|
[#]: subject: "Ulauncher: A Super Useful Application Launcher for Linux"
|
||||||
|
[#]: via: "https://itsfoss.com/ulauncher/"
|
||||||
|
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: "geekpi"
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
Ulauncher:一个超级实用的 Linux 应用启动器
|
||||||
|
======
|
||||||
|
|
||||||
|
_**简介:**_ _Ulauncher 是一个快速的应用启动器,支持扩展和快捷方式,帮助你在 Linux 中快速访问应用和文件。_
|
||||||
|
|
||||||
|
一个应用启动器可以让你快速访问或打开一个应用,而无需在应用菜单图标上徘徊。
|
||||||
|
|
||||||
|
在默认情况下,我发现 Pop!_OS 的应用启动器超级方便。但是,并不是每个 Linux 发行版都提供开箱即用的应用启动器。
|
||||||
|
|
||||||
|
幸运的是,有一个你可以在大多数流行的发行版中添加应用启动器的方案。
|
||||||
|
|
||||||
|
### Ulauncher:开源应用启动器
|
||||||
|
|
||||||
|
![][1]
|
||||||
|
|
||||||
|
Ulauncher 是一个使用 Python 还有 GTK+ 构建的快速应用启动器。
|
||||||
|
|
||||||
|
它提供了相当数量的自定义和控制选项来进行调整。总的来说,你可以调整它的行为和体验以适应你的喜好。
|
||||||
|
|
||||||
|
让我来说一下你可以期待它的一些功能。
|
||||||
|
|
||||||
|
### Ulauncher 功能
|
||||||
|
|
||||||
|
Ulauncher 中的选项非常非常易于访问且易于定制。一些关键的亮点包括:
|
||||||
|
|
||||||
|
* 模糊搜索算法,让你找到应用,即使你拼错了它们
|
||||||
|
* 记住你在同一会话中最后搜索的应用
|
||||||
|
* 经常使用的应用显示(可选)
|
||||||
|
* 自定义颜色主题
|
||||||
|
* 预设颜色主题,包括一个黑暗主题
|
||||||
|
* 召唤启动器的快捷方式可以轻松定制
|
||||||
|
* 浏览文件和目录
|
||||||
|
* 支持扩展,以获得额外的功能(表情符号、天气、速度测试、笔记、密码管理器等)
|
||||||
|
* 浏览谷歌、维基百科和 Stack Overflow 等网站的快捷方式
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
它几乎提供了你在一个应用启动器中所期望的所有有用的能力,甚至更好。
|
||||||
|
|
||||||
|
### 如何在 Linux 中使用 Ulauncher?
|
||||||
|
|
||||||
|
默认情况下,首次从应用菜单打开应用启动器后,你需要按 **Ctrl + Space** 打开应用启动器。
|
||||||
|
|
||||||
|
开始输入以搜索一个应用。而且,如果你正在寻找一个文件或目录,开始输入 “**~**” 或者 “**/**” (忽略引号)。
|
||||||
|
|
||||||
|
![][2]
|
||||||
|
|
||||||
|
有一些默认的快捷键,如 “**g XYZ**”,其中 XYZ 是你想在谷歌中搜索的搜索词。
|
||||||
|
|
||||||
|
![][3]
|
||||||
|
|
||||||
|
同样,你可以通过 “**wiki**” 和 “**so**” 快捷键,直接在维基百科或 Stack Overflow 搜索。
|
||||||
|
|
||||||
|
在没有任何扩展的情况下,你也可以直接计算内容,并将结果直接复制到键盘上。
|
||||||
|
|
||||||
|
![][4]
|
||||||
|
|
||||||
|
这在快速计算时应该很方便,不需要单独启动计算器应用。
|
||||||
|
|
||||||
|
你可以前往它的[扩展页面][5],浏览有用的扩展,以及指导你如何使用它的截图。
|
||||||
|
|
||||||
|
要改变它的工作方式,启用频繁的应用显示,并调整主题,请点击启动器右侧的齿轮图标。
|
||||||
|
|
||||||
|
![][6]
|
||||||
|
|
||||||
|
你可以把它设置为自动启动。但是,如果它在你的支持 Systemd 的发行版上不工作,你可以参考它的 GitHub 页面,把它添加到服务管理器中。
|
||||||
|
|
||||||
|
这些选项是非常只管,且易于定制,如下图所示。
|
||||||
|
|
||||||
|
![][7]
|
||||||
|
|
||||||
|
### 在 Linux 中安装 Ulauncher
|
||||||
|
|
||||||
|
Ulauncher 为基于 Debian 或 Ubuntu 的发行版提供了一个 **.deb** 包。如果你是 Linux 新手,你可以探索[如何安装 Deb 文件][8] 。
|
||||||
|
|
||||||
|
在这两种情况下,你也可以添加它的 PPA,并通过终端按照下面的命令来安装它:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo add-apt-repository ppa:agornostal/ulauncher
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install ulauncher
|
||||||
|
```
|
||||||
|
|
||||||
|
你也可以在 [AUR][9] 中找到它,用于 Arch 和 Fedora 的默认仓库。
|
||||||
|
|
||||||
|
对于更多信息,你可以前往其官方网站或 [GitHub页面][10]。
|
||||||
|
|
||||||
|
[Ulauncher][11]
|
||||||
|
|
||||||
|
Ulauncher 应该是任何 Linux 发行版中一个令人印象深刻的补充。特别是,如果你想要一个像 Pop!_OS 提供的快速启动器的功能,这是一个值得考虑的奇妙选择。
|
||||||
|
|
||||||
|
_你试过 Ulauncher了吗?欢迎你就这如何帮助你快速完成工作分享你的想法。_
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/ulauncher/
|
||||||
|
|
||||||
|
作者:[Ankush Das][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://itsfoss.com/author/ankush/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/ulauncher.png?resize=800%2C512&ssl=1
|
||||||
|
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/ulauncher-directory.png?resize=800%2C503&ssl=1
|
||||||
|
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/ulauncher-google.png?resize=800%2C449&ssl=1
|
||||||
|
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/ulauncher-calculator.png?resize=800%2C429&ssl=1
|
||||||
|
[5]: https://ext.ulauncher.io
|
||||||
|
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/ulauncher-gear-icon.png?resize=800%2C338&ssl=1
|
||||||
|
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/ulauncher-settings.png?resize=800%2C492&ssl=1
|
||||||
|
[8]: https://itsfoss.com/install-deb-files-ubuntu/
|
||||||
|
[9]: https://itsfoss.com/aur-arch-linux/
|
||||||
|
[10]: https://github.com/Ulauncher/Ulauncher/
|
||||||
|
[11]: https://ulauncher.io
|
@ -0,0 +1,122 @@
|
|||||||
|
[#]: subject: "Linux kernel modules we can't live without"
|
||||||
|
[#]: via: "https://opensource.com/article/21/8/linux-kernel-module"
|
||||||
|
[#]: author: "Jen Wike Huger https://opensource.com/users/jen-wike"
|
||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: "geekpi"
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
我们离不开的 Linux 内核模块
|
||||||
|
======
|
||||||
|
开源爱好者们对他们所喜爱的 Linux 内核模块进行了评价。
|
||||||
|
![Linux keys on the keyboard for a desktop computer][1]
|
||||||
|
|
||||||
|
Linux 内核今年就要满 30 岁了! 如果你像我们一样,这是件大事,我们本周将用几个特别的帖子来庆祝 Linux。
|
||||||
|
|
||||||
|
今天,我们先来看看来自社区的回复,回答“你不能没有哪个 Linux 内核模块?为什么?”让我们听听这 10 位爱好者是怎么说的。
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
我猜一些内核开发者听到我的回答后会尖叫着跑开。不过,我还是在这里列出了两个最具争议性的模块“
|
||||||
|
|
||||||
|
* 第一个是 NVIDIA,因为我的工作笔记本和个人台式机上都有 NVIDIA 显卡。
|
||||||
|
* 另一个可能产生的仇恨较少。VMware 的 VMNET 和 VMMON 模块,以便能够运行 VMware Workstation。—[Peter Czanik][2]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
我最喜欢的是 [zram][3] 模块。它在内存中创建了一个压缩块设备,然后可以作为交换分区使用。在内存有限的情况下(例如,在虚拟机上),还有如果你担心频繁的 I/O 操作会磨损你的 SSD 或者甚至更糟糕的是基于闪存的存储,那么使用基于 zram 的交换分区是非常理想的。—[Stephan Avenwedde][4] 。
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
最有用的内核模块无疑是 snd-hda-intel,因为它支持大多数集成声卡。我一边听音乐,一边在 Linux 桌面上编码一个音频编曲器。—[Joël Krähemann][5]
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
如果没有我用 Broadcom 文件生成的 kmod-wl,我的笔记本就没有价值了。我有时会收到关于内核污染的信息,但没有无线的笔记本电脑有什么用呢?—[Gregory Pittman][6] 。
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
我不能没有蓝牙。没有它,我的鼠标、键盘、扬声器和耳机就成了门板。—[Gary Smith][7]
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
我要冒昧地说_所有这些_都是。 说真的,我们已经到了随机拿一块硬件,插入它,它就可以工作的地步。
|
||||||
|
|
||||||
|
* USB 串行适配器能正常工作
|
||||||
|
* 显卡可以使用(尽管可能不是最好的)。
|
||||||
|
* 网卡正常工作
|
||||||
|
* 声卡正常工作
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
很难不对所有模块为整体带来的广泛的驱动程序工作印象深刻。我记得在过去的坏日子里,我们曾经大喊 xrandr 魔法字符串来使投影仪工作。而现在,是的,当东西(大部分)不能正常工作时,这是一种真正的罕见。
|
||||||
|
|
||||||
|
如果我不得不把它归结为一个,那就是 raid6。—[John 'Warthog9' Hawley][8]
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
对于这个问题,我想回到 20 世纪 90 年代末。我是一家小公司的 Unix 系统管理员(兼任 IS 经理)。我们的磁带备份系统死了,由于“小公司”预算有限,我们没有急于更换或现场维修。所以我们不得不把它送去维修。
|
||||||
|
|
||||||
|
在那两个星期里,我们没有办法进行磁带备份。没有一个系统管理员愿意处于这种境地。
|
||||||
|
|
||||||
|
但后来我想起了读过的[如何使用软盘磁带机][9],我们刚好有一台刚换下来的塔式电脑,有一个软磁带驱动器。
|
||||||
|
|
||||||
|
于是我用 Linux 重新安装了它,设置了 **ftape** 内核驱动模块,进行了一些备份/恢复测试,然后将我们最重要的备份运行到 QIC 磁带上。在这两个星期里,我们依靠 **ftape** 备份重要数据。
|
||||||
|
|
||||||
|
所以,对于那些让软盘磁带机在 1990 年代的 Linux 上工作的无名英雄,你真是太厉害了!—[Jim Hall][10]
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
嗯,这很简单。是 kvm 内核模块。在个人方面,我无法想象在没有虚拟机的情况下做我的日常工作。我愿意相信我们大多数人都是这样。kvm 模块在使 Linux 成为云战略的核心方面也发挥了很大作用。—[Gaurav Kamathe][11]
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
对我来说,是 dm-crypt,它是用于 LUKS 的。见:
|
||||||
|
|
||||||
|
* <https://www.redhat.com/sysadmin/disk-encryption-luks>
|
||||||
|
* <https://manpages.debian.org/unstable/cryptsetup-bin/cryptsetup.8.en.html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
知道别人无法看到你的磁盘上的内容是非常棒的,例如,如果你的笔记本丢失或被盗时。—[Maximilian Kolb][12]
|
||||||
|
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
对于密码学基础,很难超越 crypto 模块和它的 C API,它很简单。
|
||||||
|
|
||||||
|
在日常生活中,还有什么比蓝牙提供的即插即用更有价值的吗?—[Marty Kalin][13]
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
在评论中与我们分享。你的生活中不能没有什么 Linux 内核模块?
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/21/8/linux-kernel-module
|
||||||
|
|
||||||
|
作者:[Jen Wike Huger][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/jen-wike
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
|
||||||
|
[2]: https://opensource.com/users/czanik
|
||||||
|
[3]: https://en.wikipedia.org/wiki/Zram
|
||||||
|
[4]: https://opensource.com/users/hansic99
|
||||||
|
[5]: https://opensource.com/users/joel2001k
|
||||||
|
[6]: https://opensource.com/users/greg-p
|
||||||
|
[7]: https://opensource.com/users/greptile
|
||||||
|
[8]: https://opensource.com/users/warthog9
|
||||||
|
[9]: https://tldp.org/HOWTO/Ftape-HOWTO.html
|
||||||
|
[10]: https://opensource.com/users/jim-hall
|
||||||
|
[11]: https://opensource.com/users/gkamathe
|
||||||
|
[12]: https://opensource.com/users/kolb
|
||||||
|
[13]: https://opensource.com/users/mkalindepauledu
|
Loading…
Reference in New Issue
Block a user