mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
commit
6484dd2251
@ -0,0 +1,90 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (CanYellow)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-15344-1.html)
|
||||
[#]: subject: (Understanding Linus's Law for open source security)
|
||||
[#]: via: (https://opensource.com/article/21/2/open-source-security)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
理解开源安全中的林纳斯定律
|
||||
======
|
||||
|
||||
<ruby>林纳斯定律<rt>Linus's Law</rt></ruby>即“<ruby>只要有足够多的眼睛关注,任何漏洞都无处隐藏<rt>given enough eyeballs, all bugs are shallow</rt></ruby>”。那么林纳斯定律是如何应用于开源软件安全的呢?
|
||||
|
||||
![][0]
|
||||
|
||||
这篇文章讨论 Linux 对开源软件安全的影响。
|
||||
|
||||
开源软件的一个常被赞扬的优点是它的代码能够被任何人审查(安全专家通常称之为“代码审计”)。然而,如果你真的去问很多开源软件用户他们上一次检查代码是什么时候。你大概只能收获他们茫然的眼神或者是喃喃的低语。此外,对于一些相当大型的开源应用,有效地审查每一行代码也是困难的。
|
||||
|
||||
根据上述这些稍显不安的事实,我们不得不思考:如果没有人察看这些代码,它是开源还是闭源真的有关系吗?
|
||||
|
||||
### 你应该相信开源吗?
|
||||
|
||||
计算机爱好者倾向于作出认为开源软件比其他软件更加安全的传统假设。我们通常不会讨论这意味者什么:比较的基础是什么(比什么“更”安全?),或者上述结论是如何得到的。这是一个危险的陈述,因为它表明只要你将一些东西称之为“开源”,它就自动如魔法般地继承了更高的安全性。这不是开源,事实上,这正是开源安全非常反对的。
|
||||
|
||||
除非你已经亲自审计并理解了软件代码,否则就不应该假定一个应用程序是安全的。一但你做到了这一点,就可以给予它 <ruby>终极信任<rt>ultimate trust</rt></ruby>。_终极信任_ 不是对计算机而言的,而是对你本人而言的,至少在这一应用程序被渗透攻击之前,你信任它是因为你选择了相信它是安全的。
|
||||
|
||||
使用者本人是唯一可以对软件代码给予终极信任的人,因此任何人想要获得这样的享受都必须亲自审查代码。相信其他人的话是不管用的。
|
||||
|
||||
在你已经亲自审计并理解了软件代码之前,你对一个应用程序给予的最大信任度是一个范围,可以是从 _根本不信任_ 到 _相当信任_ 之间。然而我们并没有一个关于信任程度的标准对照表,这是一个你必须亲自做出的个人选择。如果你已经从非常信任的人那里听说了一款应用程序是安全的,那么你可能会更信任这个软件,而不是信任那些你没有得到信任建议的东西。
|
||||
|
||||
然而,因为无法审计专有(闭源)软件代码,你不可能给予它 _终极信任_。
|
||||
|
||||
### 林纳斯定律
|
||||
|
||||
现实很骨感,并不是每个人都是程序员,同时也不是每个程序员都有时间检查数以万计的代码行。因此如果你没有亲自审查代码,你就只能选择(一定程度上)相信那些 _亲自_ 审查了代码的人。
|
||||
|
||||
那么,有哪些人会审查代码呢?
|
||||
|
||||
林纳斯定律声称 _只要有足够的眼睛关注,任何漏洞都无处隐藏_,然而我们并不知道多少双眼睛是“足够”的。请不要低估这一数量,应用程序往往经过了远超你想象数量的人员审查。原始开发人员以及后续开发人员显然清楚他们自己写下的代码,不过开源软件往往都是团队成果,开源时间越长,阅读了代码的开发人员越多。新加入的开发人员也必须回顾项目代码的核心部分,因为他们必须学习基础代码以加入新的功能。
|
||||
|
||||
同时,为了使开源软件能够在 Linux 发行版上可用,负责开源软件打包分发的开发人员会加入多个项目。有时一个应用程序可能会在不熟悉项目代码的情况下打包,但是大多数时候,开源软件打包人员都是熟悉所打包的项目代码的。这不仅仅是因为他们不想在他们不信任的软件上签名,还由于他们可能不得不修改代码来使得程序能够正确编译。漏洞报告人员和漏洞修复人员一般也是熟悉代码库的,因为他们需要尝试解决小到运行异常,大到程序崩溃的问题。当然,一些漏洞报告人员不是通过亲自审查项目代码,而是通过关注明显未按预期工作的现象,无意中揭示了代码漏洞。系统管理员通常都是通晓用户依赖的重要应用软件的代码的。最后,还有一些安全研究人员,他们专门深入代码内部以揭露潜在的漏洞。
|
||||
|
||||
### 信任与透明
|
||||
|
||||
很多人先入为主的认为大型软件的审计是基本不可能的,因为它由数以万计的代码行组成。不要被软件运行所需的代码量欺骗了。我们不需要真的阅读数以万计的代码行。代码是高度结构化的,可被利用的代码漏洞仅仅只是其中的一行,不过它通常影响软件的全部功能。
|
||||
|
||||
当然,也有例外。有时仅仅一个系统调用或者链接一个有缺陷的库文件就可能引入一系列漏洞。幸运的是,多亏安全研究人员以及漏洞数据库所扮演的积极角色,这些错误相对而言是容易发现的。
|
||||
|
||||
一些人指着错误追踪系统,比如 <ruby>[通用漏洞披露][2]<rt>Common Vulnerabilities and Exposures</rt></ruby>(CVE)网站,并推断开源软件显而易见是不安全的。毕竟已经向公众公开了大量的安全风险,涉及许多开源项目。但是不要被数据欺骗了。只是因为我们看不到现闭源软件的漏洞,并不意味着闭源软件中不存在漏洞。事实上,已经有很多针对闭源软件的漏洞攻击提出了,闭源软件也是存在漏洞的。区别在于开发者(以及用户)可以查看开源软件的 _所有的漏洞_ 从而降低漏洞的影响。这是扩大对开源软件信任的系统机制的一部分,却正是闭源软件软件所缺少的。
|
||||
|
||||
对于任何代码而言,可能永远没有“足够的眼睛”来发现漏洞,但是开发社区越壮大、越多样化,越有机会发现和修复代码中的缺陷。
|
||||
|
||||
### 信任与人
|
||||
|
||||
在开源社区中,参与同一项目的众多开发者已经发现“不安全”的漏洞,却保持沉默的的可能性是微乎其微的,因为人们很少同意以这样的方式合谋。我们已经看到了在应对 COVID-19 的过程中,人类的行为是如何不一致了,在这里也一样:
|
||||
|
||||
* 我们都发现了漏洞(病毒)。
|
||||
* 我们知晓如何避免它传播(待在家里)。
|
||||
* 然而病毒还是在持续传播,因为总是有一个或者多个人偏离了消减疫情的计划。
|
||||
|
||||
开源软件中的漏洞也一样,如果有人发现了漏洞总会公之于众(当然,我们说的是“假如”能够发现)。
|
||||
|
||||
然而就专有软件而言,有很大可能参与项目的众多开发者即使注意到不安全的漏洞却仍然保持沉默,因为专有模式依赖于薪水。如果一个开发者将漏洞泄漏出来,他可能只是伤害了该专有软件的声誉,进而降低软件的销售额;或者,在更糟糕的情况下,他可能因此而丢了工作。开发人员拿着薪水秘密地研究软件,往往不会谈论其缺陷。如果你曾经是一名开发者,你可能曾经签署过 NDA (LCTT 译注:<ruby>保密协议<rt>Non-Disclosure Agreement</rt></ruby>),也被培训过商业秘密的重要性,等等不一而足。专有软件鼓励在面对严重的秘密缺陷时保持沉默,更多时候甚至是强制要求沉默。
|
||||
|
||||
### 信任与软件
|
||||
|
||||
不要信任未经你审计的软件。
|
||||
|
||||
如果你必须相信未经你审计的软件,那么选择相信已经面向那些更有可能将软件缺陷公之于众的开发者公开代码的软件。
|
||||
|
||||
开源软件并没有比专有软件继承更高的安全性,但是修复它的系统得到了更好的规划、实施和人员配置。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/open-source-security
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[CanYellow](https://github.com/CanYellow)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer)
|
||||
[2]: https://cve.mitre.org
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/13/114637dg6w34suucuupucv.jpg
|
94
published/20210330 A DevOps guide to documentation.md
Normal file
94
published/20210330 A DevOps guide to documentation.md
Normal file
@ -0,0 +1,94 @@
|
||||
[#]: subject: "A DevOps guide to documentation"
|
||||
[#]: via: "https://opensource.com/article/21/3/devops-documentation"
|
||||
[#]: author: "Will Kelly https://opensource.com/users/willkelly"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "Veryzzj"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15349-1.html"
|
||||
|
||||
文档写作的 DevOps 指南
|
||||
======
|
||||
|
||||
> 将文档写作加入到 DevOps 的生命周期中。
|
||||
|
||||
![][0]
|
||||
|
||||
DevOps 正在挑战技术文档的规范,这在 IT 历史上是前所未有的。从自动化到提高交付速度,再到拆除瀑布式软件开发生命周期模型,这意味着业务和技术文档写作的理念需要做出巨大改变。
|
||||
|
||||
以下是 DevOps 对技术文档写作不同方面的影响。
|
||||
|
||||
### 技术写手的角色变化
|
||||
|
||||
技术写手必须适应 DevOps。好消息是,许多技术写手已经加入到开发团队中,并且拥有合作关系和不断增长的产品知识的技术写手很具优势。
|
||||
|
||||
但是如果一个技术写手习惯于独立工作,并依赖于领域专家的草稿作为文档的基础,那么就需要做一些调整。
|
||||
|
||||
进行一些投资,以确保文档和其他与项目有关的内容开发工作获得所需的工具、结构和支持。从改变 [技术写手聘用方式][2] 开始。以 [DevOps 的速度][3] 编写文档需要重新思考内容规划,并打破 DevOps 团队和支持项目的技术写手之间长期存在的隔阂。
|
||||
|
||||
DevOps 使开发团队摆脱了传统文档实践的束缚。首先,文档 [完成的定义][4] 必须改变。一些企业的文化使技术写手成为软件开发的被动参与者。DevOps 提出了新的要求:随着 DevOps 文化的转变,技术写手的角色也应发生变化。技术写手需要(且必须适应)DevOps 提供的透明度。他们必须融入 DevOps 团队。取决于组织如何塑造这个角色,将技术写手带入团队可能会带来技能上的挑战。
|
||||
|
||||
### 文档标准、方法和规格
|
||||
|
||||
虽然 DevOps 还没有影响到技术文档本身,但开源社区已经加强了对应用编程接口(API)文档的帮助,已经有不同规模的企业的 DevOps 团队正在使用这些文档。
|
||||
|
||||
用于记录 API 的开源规范和工具是个非常值得关注的领域。我想这是由于 [谷歌文档季][5] 的影响,它使开源软件项目能够获得专业的技术写作人才来解决他们最关键的文档项目。
|
||||
|
||||
开源 API 属于 DevOps 文档讨论的一部分。云原生应用集成需求的重要性正在上升。[OpenAPI 规范][6](一个定义和记录 API 的开放标准)是在 DevOps 环境下 API 文档的良好资源。然而,该规范会导致文档的创建和更新过程变得很费时,这使其饱受批评。
|
||||
|
||||
曾经也有短暂尝试过创建 <ruby>[持续文档][7]<rt>Continuous Documentation</rt></ruby>,并且还有一个来自 CA(现在的 Broadcom)的创建 [DocOps][8] 框架的运动。然而,DocOps 从来没有作为一个行业运动流行起来。
|
||||
|
||||
DevOps 文档标准的现状意味着 DevOps 团队(包括技术写手)需要在项目的最初阶段就开始创建文档。要做到这一点,你需要把文档作为一个敏捷故事和(同样重要的)管理期望,并且把它与年度绩效评估放在一起执行。
|
||||
|
||||
### 文档工具
|
||||
|
||||
文档的编写应该以一种所有团队成员都可以使用的格式或平台在线进行。MediaWiki、DokuWiki、TikiWiki 和其他 [开源维基][9] 为 DevOps 团队提供了一个编写和维护文档的中央仓库。
|
||||
|
||||
让团队选择他们的维基平台,就像让他们选择他们的其他持续集成/持续开发(CI/CD)工具链一样。开源维基强大之处在于其可扩展性。例如,DokuWiki 包括一系列的扩展,你可以通过安装这些扩展来创建一个符合你的 DevOps 团队的创作要求的平台。
|
||||
|
||||
如果你有足够的野心来加强你的团队的编写和协作能力,[Nextcloud][10](一个开源的云协作套件)是一个让你的 DevOps 团队上网并给他们提供编写文档所需工具的选择。
|
||||
|
||||
### DevOps 最佳实践
|
||||
|
||||
文档在 DevOps 转型中也发挥着作用。例如,你会想要记录组织从 DevOps 实现效率和流程增益的最佳实践,这些信息太重要了,不能靠着 DevOps 团中之间口耳相传。如果你所在的组织有多个 DevOps 团队,那么文档就是统一的力量,它可以促进最佳实践的标准化,并设置了衡量代码质量的基准指标。
|
||||
|
||||
一般情况下,开发人员承担了记录 DevOps 实践的工作。即使他们的组织有技术写手,他们也可能跨开发团队工作。因此,开发人员和系统管理员能够捕捉、记录和交流他们的最佳实践是很重要的。这里有一些朝正确的方向发展的提示:
|
||||
|
||||
* 提前花时间为 DevOps 最佳实践创建标准模板。不要陷入复制在线模板的陷阱。采访利益相关者和团队来创建一个符合团队需求的模板。
|
||||
* 寻找一些创造性的信息收集的方法,例如记录团队会议和使用聊天系统日志来作为文档的基础。
|
||||
* 建立一个用于发布最佳实践的维基。使用维基可以跟踪编辑和更新。这样的平台可以帮助团队在最佳实践发生变化时进行更新和维护。
|
||||
|
||||
当在构建 CI/CD 工具链时记录依赖关系是非常明智的。尤其是当加入新的团队成员时,你会发现这些记录非常有用,另外当团队成员忘记一些事情时,这也是一种保险。
|
||||
|
||||
最后,自动化对 DevOps 利益相关者和从业者都很有吸引力。在自动化中断之前,一切都很有趣。拥有自动化运行手册、管理指南和其他内容的文档(并且是最新的)意味着无论何时发生故障,员工都可以让自动化重新工作。
|
||||
|
||||
### 最后一些想法
|
||||
|
||||
DevOps 对于技术文档来说是一个积极的因素。它将内容开发纳入 DevOps 生命周期,并打破组织文化中开发人员和技术作者之间的隔阂。在没有技术写手的情况下,团队就可以使用工具来加快文档创作的速度,以与 DevOps 的速度相匹配。
|
||||
|
||||
你的组织将如何把文档加入到 DevOps 生命周期?请在评论区分享你的经验。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/3/devops-documentation
|
||||
|
||||
作者:[Will Kelly][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[Veryzzj](https://github.com/Veryzzj)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/willkelly
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/typewriter-hands.jpg?itok=oPugBzgv "Typewriter with hands"
|
||||
[2]: https://opensource.com/article/19/11/hiring-technical-writers-devops
|
||||
[3]: https://searchitoperations.techtarget.com/opinion/Make-DevOps-documentation-an-integral-part-of-your-strategy?_ga=2.73253915.980148481.1610758264-908287796.1564772842
|
||||
[4]: https://www.agilealliance.org/glossary/definition-of-done
|
||||
[5]: https://developers.google.com/season-of-docs
|
||||
[6]: https://swagger.io/specification/
|
||||
[7]: https://devops.com/continuous-documentation
|
||||
[8]: https://www.cmswire.com/cms/information-management/the-importance-of-docops-in-the-new-era-of-business-027489.php
|
||||
[9]: https://opensource.com/article/20/7/sharepoint-alternative
|
||||
[10]: https://opensource.com/article/20/7/nextcloud
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/15/101537c4kcxxzqzh6fxkor.jpg
|
@ -0,0 +1,96 @@
|
||||
[#]: subject: "WiFi 6 Promises Much More than Faster Speeds"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/06/wifi-6-promises-much-more-than-faster-speeds/"
|
||||
[#]: author: "Sharon Katta https://www.opensourceforu.com/author/sharon-katta/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "cool-summer-021"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15369-1.html"
|
||||
|
||||
WiFi 6 带来的不仅是高速
|
||||
======
|
||||
|
||||
> WiFi 6 提高了网络连通性,它在不久的将来有望为数万亿台设备组网,并且能够不间断而高效地工作。它虽然在 2019 年就取得了官方认证,但由于疫情原因,它的测试工作面临不少挑战。本文旨在对这项技术进行概述。
|
||||
|
||||
![WiFi-6][1]
|
||||
|
||||
WiFi 技术的下一代标准,称为 “WiFi 6”,也可以称为 “AX WiFi” 或 “802.11ax”。它是为满足指数级增长的设备组网需求而产生的,因此也可以用于 VR 和智能家居。它是现有的 802.11ac WiFi 标准的升级版,可以应对现有技术在容量、效率、覆盖范围和性能方面遇到的挑战。
|
||||
|
||||
![Figure 1: WiFi 6][2]
|
||||
|
||||
这项技术是在 2014 年进行研发,完成于 2018 年,由 IEEE 高性能无线网络研究组(HEW SG)发布。产品认证于 2019 年后期进行,此时三星 Galaxy Note 10 和 Ruckus R750 使用了这种技术。WiFi 6 运行于 1GHz 和 6GHz 波段,主要的频率为 2.4GHz-5GHz。
|
||||
|
||||
如今,每个家庭平均有九台设备需要连接 WiFi。WiFi 6 主要致力于改善网络质量,而不是提升某些设备的速度。
|
||||
|
||||
### WiFi 6的特点
|
||||
|
||||
- **多用户、多输入、多输出(MU-MIMO):** 路由器和多台设备可以同时通信。在 2.4GHz 和 5GHz 频率上,它支持四个同步的数据流,当这些数据流添加到一个用户时,可以从智能路由器接收到相当大的输入数据的带宽。
|
||||
- **1024-QAM:** 这令 WiFi 6 的每个数据包能编码的字节数更多,吞吐量增加了 25%。它不仅提高了大业务量情况下的通信效率,也最大限度增加了传输速率。这在现代企业应用系统领域有很大的优势。
|
||||
- **正交频分复用(OFDM):** 支持四倍的副载波,速度也提高了 11%。扩展的信号支持用户同时进行更多数据包传输。所以数据包之间的等待时间和延迟就减少了。
|
||||
- **增加的信道宽度:** 80MHz 的波段加入了 160MHz 的信道通信,信道宽度增加了一倍。因此,路由器可以容纳更多用户,为每个用户提供更大的数据流。
|
||||
- **目标唤醒时间(TWT):** 这是 WiFi 6 特有的。它支持每台设备独立协商发送和接收的唤醒时间。它可以增加总体睡眠时间,令电池寿命最大化。它还支持许多额外的网络选项,特别是对 IoT 设备的支持。
|
||||
- **提升安全性:** 一切支持 WiFi 6 的设备都需要包含 WPA3 协议。它可以对未经验证的通信进行加密,针对暴力字典攻击提供了强大的密码保护,以及对敏感信息进行 192 位的加密,提升数据的可靠性。
|
||||
- **波束赋形:** 借助八根天线,波束赋形能提高传输速率,通信范围也因直接定向到某个客户端而扩大。它对快速移动的、可能面临多用户、多输入、多输出的设备起到了支撑作用。波束赋形也有利于控制那些蓄意发出干扰信号的天线的传输。然后信号会被重新定向到新的目标。
|
||||
|
||||
### 支持 WiFi 6 的设备
|
||||
|
||||
到目前为止,路由器、中继器、网状网络和多数 WiFi 使用者还是以 WiFi 5 为标准。WiFi 6 是 2019 年推出的。一些支持 WiFi 5 的早期设备存在一些兼容性问题 —— 它们可以使用 WiFi 6 的网络,但得不到相应的支持服务。
|
||||
|
||||
WiFi 6 的路由器是向后兼容的。应该确保网络已经为此做好了准备。
|
||||
|
||||
WiFi 6 实现了较低的电量消耗,在任何场景(包括 IoT)下,都是个不错的选择。它减少了不必要的数据流动,还会通知设备何时将数据激活或令其睡眠。所以不必要的数据流动减少了,性能和电池寿命也提高了。
|
||||
|
||||
三星 Galaxy Note 10 和 Ruckus R750 是全球第一款经认证支持 WiFi 6 的智能手机和接入设备,苹果的最新款 iPhone 也紧随其后。WiFi 联盟已经确立了认证方案,正如人们预期的那样,等待入市的那些新款无线产品也开始申请认证了。下列设备已支持 WiFi 6:
|
||||
|
||||
* iPhone 11 和之后的型号
|
||||
* 三星 Galaxy S10、S20、Note 10 和 Note 20
|
||||
* 配置 M1 处理器的苹果电脑
|
||||
* 智能电视
|
||||
|
||||
> 为了全面享受到 802.11ax 标准带来的改进,硬件和软件的功能都需要基于这种 WiFi 技术进行升级。
|
||||
|
||||
### 硬件测试
|
||||
|
||||
为了充分挖掘最新款设备的潜力,需要一台 WiFi 6 路由器来运行网络。几年前,这么做的成本很高,但现在我们有多种选择,甚至可以使用网格系统、游戏路由器、范围扩展器等等。只有在进行实际测试时,才可以购买最划算的设备。如今,在速度方面,TP-Link Archer AX6000 是最快的,它击败了所有的竞争者。这款路由器可以以 1523 Mbps 的速率无线传输数据,有效传输距离为 1.5米(5 英尺)。
|
||||
|
||||
很重要的一点,请务必记住,这些路由器提速,并不是在变魔术。理论上的最大速率 9.6 Gbps是实现不了的。这种理论上的最大速率,实际上也会被多台设备分摊掉。
|
||||
|
||||
WiFi 6 侧重于在连接设备密集的地方提供高质量的连接。它不会令单台设备的速率指数级增长,但会使相关的设备运行处于理想水平。
|
||||
|
||||
只有各大互联网服务提供商(ISP)的加速计划与 WiFi 6 路由器结合起来,才能体现它的真正潜力。真正的挑战是那些 ISP 承受的,因为它们需要铺设新型的光纤来利用这种下一代技术。存在一个重要的问题:当ISP 的通信速率变得更快,现有的硬件会变得多余吗?
|
||||
|
||||
### WiFi 6 的应用
|
||||
|
||||
- **大型公共场所(LPV):** 体育馆和会议中心是上千台设备同时联网的公共场所。WiFi 6 能改善参会者体验,增强消费者互动,还能提供附加服务,比如即时回放,订购餐食等。它还支持 LPV 业主开拓新的商业机会。
|
||||
- **交通枢纽:** 公共交通站点也是人们需要同时联网的场所。OFDMA 和 BSS 这类明显具有 WiFi 6 色彩的技术为解决这种问题提供了必要的工具。
|
||||
- **物联网和智慧城市建设:** WiFi 6 的能效令物联网设备可以进入休眠模式,并且可以在预定的间隔内开启信号发射器,以便在无需过多维护的情况下增加现场作业时间。
|
||||
- **教育机构:** 大学校园内的图书馆、礼堂和报告厅内的日间 WiFi 使用密度是最高的,夜晚几乎没有人。WiFi 6 是这类场景的完美选项。
|
||||
|
||||
(LCTT 译注:相关产品推荐部分节略。)
|
||||
|
||||
### 面临的挑战
|
||||
|
||||
WiFi 6 不一定使速度更快,但它能确保在一定范围内的设备速率不会在未来几年变慢。虽然它面临三重挑战,但这些问题常常被忽视。
|
||||
|
||||
- 需要对不支持的设备进行升级:即使 Wifi 6 向后兼容,但只能在最大限度使用这种技术时才能做得合理。这意味着每次都要更新设备。
|
||||
- 内部网络以外的速度和性能:WiFi 6 能为诸如云文件共享之类服务提供极好的连接性。然而,ISP 的相关资源也会影响速度和性能。
|
||||
- 覆盖范围问题:在各个国家,传输信号和带宽都是由法律规定上限的。因此,为了符合法律规定的上限,WiFi 6 的覆盖范围也是受限的。
|
||||
|
||||
尽管存在这些挑战,一些企业,像 Aruba、华硕、AT&T、Boingo、博通、思科、Comcast、CommScope、Cypress、Extreme Networks、英特尔、Netgear、Orange、高通、TP-Link 和小米,都在关注 WiFi 6 更多的可能性。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/06/wifi-6-promises-much-more-than-faster-speeds/
|
||||
|
||||
作者:[Sharon Katta][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[cool-summer-021](https://github.com/cool-summer-021)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/sharon-katta/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/05/WiFi-6.jpg
|
||||
[2]: https://www.opensourceforu.com/wp-content/uploads/2022/05/WiFi-6-1.jpg
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/21/165355hi20ky6mchmj0h38.jpg
|
152
published/20220628 Linux su vs sudo- what-s the difference-.md
Normal file
152
published/20220628 Linux su vs sudo- what-s the difference-.md
Normal file
@ -0,0 +1,152 @@
|
||||
[#]: subject: "Linux su vs sudo: what's the difference?"
|
||||
[#]: via: "https://opensource.com/article/22/6/linux-su-vs-sudo-sysadmin"
|
||||
[#]: author: "David Both https://opensource.com/users/dboth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "chai001125"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15347-1.html"
|
||||
|
||||
Linux 中的 su 和 sudo 命令有什么区别?
|
||||
======
|
||||
|
||||
> 本文将比较非 root 用户提权为 root 用户的两个 Linux 命令 的区别。
|
||||
|
||||
![][0]
|
||||
|
||||
`su` 和 `sudo` 命令都允许用户执行非特权用户不允许做的系统管理任务,即只有 root 用户能执行的命令。有些人更喜欢 `sudo` 命令:例如 [Seth Kenlon][2] 最近发布的一篇 《[在 Linux 上使用 sudo 的 5 个理由][3]》,他在其中详细阐述了 `sudo` 命令的许多优点。
|
||||
|
||||
但是,相较于 `sudo` 命令,我**更偏好于 `su` 命令** 来做系统管理工作。在本文中,我比较了这两个命令的区别,并解释了为什么我更喜欢 `su` 而不是 `sudo`,但我仍然同时使用这两个命令的原因。
|
||||
|
||||
### 过去的系统管理员主要使用 su 命令
|
||||
|
||||
`su` 和 `sudo` 命令是为**不同的世界**设计的。早期的 Unix 计算机需要全职系统管理员,他们使用 root 用户作为唯一的管理帐户。在这个古老的世界里,有管理员密码的人会在电传打字机或 CRT 终端(例如 DEC VT100)上以 root 用户登录,然后执行一些管理 Unix 计算机的工作。
|
||||
|
||||
管理员还会有一些非 root 帐户,用于执行一些非 root 的任务,例如编写文档和管理电子邮件等。在这些 Unix 计算机上通常有许多非 root 帐户,他们都不需要完全的 root 访问权限,只需要以 root 权限运行很少的命令,大约 1 至 2 个就可以了。许多系统管理员以 root 用户登录,完成 root 工作,并在任务完成后,退出 root 会话。有时候,系统管理员需要整天以 root 用户来登录,因为 `sudo` 命令需要键入更多的内容才能运行必要的命令,因此大多数系统管理员很少使用 `sudo` 命令。
|
||||
|
||||
`sudo` 和 `su` 这两个命令都能够提权为 root 用户,但它们实现的方式大不相同。这种差异是由于它们**最初打算用于不同的情况**。
|
||||
|
||||
### sudo 命令
|
||||
|
||||
`sudo` 命令的初衷是让 root 用户能够让几个非 root 用户访问他们经常需要的一两个特权命令。`sudo` 命令允许非 root 用户暂时地获得更高权限,来执行一些特权命令,例如添加和删除用户、删除属于其他用户的文件、安装新软件以及管理现代 Linux 主机所需的任何命令。
|
||||
|
||||
`sudo` 命令允许非 root 用户访问一两个 _需要更高权限_ 的常用命令,这样可以帮助系统管理员节省来自用户的许多请求,并减少等待时间。`sudo` 命令不会将用户帐户切换为 root 用户,因为大多数非 root 用户永远不应该拥有完全的 root 访问权限。在大多数情况下,`sudo` 允许用户执行一两个命令,然后提权就会过期。在这个通常为 5 分钟的短暂的提权时间内,用户可以执行任何需要提权的管理命令。需要继续使用提权的用户可以运行 `sudo -v` 命令来重新验证 root 访问权限,并将提权时间再延长 5 分钟。
|
||||
|
||||
使用 `sudo` 命令还有一些副作用,例如生成非 root 用户使用命令的日志条目及其 ID。这些日志可以在之后作为出现问题的检验,来给用户更多的操作培训。(你以为我会说“问责”用户,对吧?)
|
||||
|
||||
### su 命令
|
||||
|
||||
`su` 命令能够将非 root 用户提权到 root 权限 —— 事实上,能让非 root 用户成为 root 用户。唯一的要求是用户知道 root 密码。因为用户已经以 root 权限登录,所以之后的操作就没有限制了。
|
||||
|
||||
`su` 命令所提供的提权没有时间限制。用户可以作为 root 执行命令,不需要进行重新验证是否有 root 权限。完成任务后,用户可以执行退出命令 `exit`,从 root 用户恢复到自己原来的非 root 帐户。
|
||||
|
||||
### su 和 sudo 在使用上的争议和变化
|
||||
|
||||
最近在 `su` 与 `sudo` 的使用上存在一些分歧。
|
||||
|
||||
> 真正的系统管理员不会使用 `sudo`。—— Paul Venezia
|
||||
|
||||
Venezia 在他的 [InfoWorld 文章][4] 中辩称,对于许多担任系统管理员的人来说,`sudo` 是一个不必要的工具。他没有花太多时间为这个观点进行解释,他只是把它说成了一个事实。我同意他对于系统管理员的观点,因为我们不需要 `sudo` 来完成我们的工作。事实上,`sudo` 使得事情变得更复杂了。
|
||||
|
||||
然而,
|
||||
|
||||
> 时代在“改变”。—— Bob Dylan
|
||||
|
||||
Bob Dylan 是对的,尽管他唱的歌不是指计算机(LCTT 译注:Bob Dylan 是美国创作歌手、艺术家和作家,这里指他不是针对于电脑而说的)。
|
||||
|
||||
自从人手一台的**个人计算机**时代到来,计算机的管理方式发生了重大变化。在许多环境中,计算机的使用者也是它的管理员,这使得为这些用户提供一些对 root 权限的访问是有必要的。
|
||||
|
||||
一些现代发行版,例如 Ubuntu 及其衍生版本,只能使用 `sudo` 命令来执行特权命令。在这些发行版中,用户无法直接以 root 用户身份登录,甚至无法通过 `su` 切换到 root,因此需要 `sudo` 命令来允许非 root 用户获得 root 权限。在这一环境中,所有系统管理任务均使用 `sudo` 来执行。
|
||||
|
||||
通过锁定 root 帐户并将常规用户帐户添加到“轮子”组(`wheel`),可以实现此配置,但是这种配置很容易被绕过。接下来,让我们在 Ubuntu 主机或虚拟机上尝试一些小实验吧。我在这里说明一些我的设置,以便你可以根据需要来重现它。我安装的是 Ubuntu 16.04 LTS1,并使用 VirtualBox 将其安装在虚拟机中。在安装过程中,我创建了一个非 root 用户 `student`,为了简便起见我给这个用户设置了一个简单的密码。
|
||||
|
||||
以 `student` 用户身份登录 Ubuntu,并打开终端。查看 `/etc/shadow` 文件中的 root 条目,其中存储了经哈希的密码。
|
||||
|
||||
```
|
||||
student@ubuntu1:~$ cat /etc/shadow
|
||||
cat: /etc/shadow: Permission denied
|
||||
```
|
||||
|
||||
可以看到终端拒绝了我们对 `/etc/shadow` 的访问,因此我们无法查看 `/etc/shadow` 文件。所有发行版都是如此,以防止非特权用户看到和访问加密的密码,因为非特权用户可能会使用常见的黑客工具来破解这些密码。
|
||||
|
||||
现在,让我们使用 `su -` 命令来成为 root 用户。
|
||||
|
||||
```
|
||||
student@ubuntu1:~$ su -
|
||||
Password: <Enter root password – but there isn't one>
|
||||
su: Authentication failure
|
||||
```
|
||||
|
||||
认证失败的原因是因为 root 帐户没有密码、并且被锁定了。接下来,使用 `sudo` 命令查看 `/etc/shadow` 文件。
|
||||
|
||||
```
|
||||
student@ubuntu1:~$ sudo cat /etc/shadow
|
||||
[sudo] password for student: <enter the student password>
|
||||
root:!:17595:0:99999:7:::
|
||||
<截取>
|
||||
student:$6$tUB/y2dt$A5ML1UEdcL4tsGMiq3KOwfMkbtk3WecMroKN/:17597:0:99999:7:::
|
||||
<截取>
|
||||
```
|
||||
|
||||
在这里,我仅截取了部分结果,只显示 root 和 `student` 用户的条目。我还缩短了加密密码,以便该条目能显示在一行中。各个字段以冒号(`:`)分隔,第二个字段是密码。请注意,root 的密码字段是一个感叹号(`!`),这表明 root 帐户已被锁定,且无法使用。
|
||||
|
||||
现在,要将 root 帐户变成一个合适的系统管理员,你只需为 root 帐户设置密码。
|
||||
|
||||
```
|
||||
student@ubuntu1:~$ sudo su -
|
||||
[sudo] password for student: <Enter password for student>
|
||||
root@ubuntu1:~# passwd root
|
||||
Enter new UNIX password: <Enter new root password>
|
||||
Retype new UNIX password: <Re-enter new root password>
|
||||
passwd: password updated successfully
|
||||
root@ubuntu1:~#
|
||||
```
|
||||
|
||||
现在,你可以直接以 root 身份登录到控制台,或者直接使用 `su` 登录到 root,而不是在每个命令前都加一个 `sudo`。当然,你也可以在每次想以 root 身份登录时,使用 `sudo su -`,但这又是何必呢?
|
||||
|
||||
请不要误解我的意思。像 Ubuntu 这样的发行版及其上下游衍生版非常好,多年来我已经使用了其中的几个。在使用 Ubuntu 和相关发行版时,我做的第一件事就是设置一个 root 密码,这样我就可以直接以 root 身份登录。其他发行版,如 Fedora 及其相关发行版,现在在安装过程中提供了一些有趣的选择。我注意到的第一个 Fedora 版本是 Fedora 34,我在写我的一本即将出版的书时安装了很多次。
|
||||
|
||||
在安装页面上,可以找到其中一个安装选项,来设置 root 密码。这个新选项允许用户选择“<ruby>锁定 root 帐户<rt> Lock root account </rt></ruby>”,就像 Ubuntu 锁定 root 帐户的方式一样。此页面上还有一个选项,允许使用密码以 root 身份远程 SSH 登录到此主机,但这仅在 root 帐户解锁时有效。第二个选项位于允许创建非 root 帐户的页面上。此页面上的选项之一是“<ruby>让此用户成为管理员<rt> Make this user administrator </rt></ruby>”。选中此选项后,用户 ID 将添加到一个名为 `wheel` 组的特殊组中,该组授权该组的成员使用 `sudo` 命令。Fedora 36 甚至在该复选框的描述中提到了 `wheel` 组。
|
||||
|
||||
可以将多个非 root 用户设置为管理员。使用此方法指定为管理员的任何人都可以使用 `sudo` 命令在 Linux 计算机上执行所有管理任务。Linux 在安装时只允许创建一个非 root 用户,所以其他新用户可以在创建时添加到 `wheel` 组中。root 用户或其他管理员可以使用文本编辑器或 `usermod` 命令直接将现有用户添加到 `wheel` 组。
|
||||
|
||||
在大多数情况下,今天的管理员只需要执行一些基本任务,例如添加新的打印机、安装更新或新软件,或者删除不再需要的软件。这些 GUI 工具需要 root 或管理密码,并将接受来自管理员用户的密码。
|
||||
|
||||
### 在 Linux 上,我是怎么使用 su 和 sudo 的呢
|
||||
|
||||
我**同时使用 `su` 和 `sudo`**。它们都是我所使用的很重要的系统管理员工具。
|
||||
|
||||
我不锁定 root 帐户,因为我需要用 root 帐户来运行我的 [Ansible][5] 脚本和我编写的 [rsbu][6] Bash 程序,来执行备份。这两个程序都需要以 root 身份运行,我编写的其他几个管理 Bash 的脚本也是如此。我**使用 `su` 命令**切换到 root 用户,这样我就可以执行这些脚本和许多其他常见的命令。当我需要确定问题和解决问题时,使用 `su` 命令将我的权限提升到 root 十分有用,因为我不希望 `sudo` 带来的提权会话超时。
|
||||
|
||||
当非 root 用户需要执行这些任务时,我**使用 `sudo` 命令**,来执行需要 root 权限的任务。我在 `sudoers` 文件中设置了非 root 帐户,只允许访问完成任务所需的一两个命令。当我只需要运行一两个需要提权的快速命令时,我自己也会使用 `sudo` 命令。
|
||||
|
||||
### 结论
|
||||
|
||||
实际上只要你把工作完成好了,你使用什么工具都无大碍。你使用的是 Vim 还是 Emacs,是 systemd 还是 SystemV,是 RPM 亦或是 DEB,是 `sudo` 亦或是 `su`,在结果上会有什么区别呢?这里的关键在于你应该使用**最适合你的工具**。Linux 和开源软件的最大优势之一是通常有许多选项可用于我们需要完成的任务。
|
||||
|
||||
`su` 和 `sudo` 都各有长处,如果正确使用的话,两者都是非常安全的。我选择同时使用 `su` 和 `sudo` 命令,基于它们的历史功能,因为这对我来说十分有用。对于我自己的大部分工作,我更喜欢 `su` 命令,因为它与我的工作流程最适配。
|
||||
|
||||
在评论区分享你喜欢的工作方式吧!
|
||||
|
||||
本文摘自于我的书《<ruby>系统管理员的 Linux 哲学<rt>The Linux Philosophy for Sysadmins</rt></ruby>(Apress,2018 年)》一书的第 19 章,并经许可后重新发布。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/linux-su-vs-sudo-sysadmin
|
||||
|
||||
作者:[David Both][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[chai001125](https://github.com/chai001125)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/dboth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/bash_command_line.png
|
||||
[2]: https://opensource.com/users/seth
|
||||
[3]: https://opensource.com/article/22/5/use-sudo-linux
|
||||
[4]: http://www.infoworld.com/t/unix/nine-traits-the-veteran-unix-admin-276?page=0,0&source=fssr
|
||||
[5]: https://opensource.com/article/20/10/first-day-ansible
|
||||
[6]: https://opensource.com/article/17/1/rsync-backup-linux
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/14/171220a47je4l0teaonzos.jpg
|
104
published/20221004 Learn the OSI model in 5 minutes.md
Normal file
104
published/20221004 Learn the OSI model in 5 minutes.md
Normal file
@ -0,0 +1,104 @@
|
||||
[#]: subject: "Learn the OSI model in 5 minutes"
|
||||
[#]: via: "https://opensource.com/article/22/10/osi-model-network-communications"
|
||||
[#]: author: "Anamika https://opensource.com/users/anamika"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "cool-summer-021"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15352-1.html"
|
||||
|
||||
5 分钟内了解 OSI 模型
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 理解 OSI 框架的基本概念,掌握计算机系统通信机制。
|
||||
|
||||
<ruby>开放系统互联<rt>Open Systems Interconnection</rt></ruby>(OSI)模型是一个定义计算机、服务器和用户如何在一个系统内通信的标准。它是第一个网络通信标准模型,在上世纪 80 年代早期,所有主流的计算机和通信公司都采用了这个标准。
|
||||
|
||||
OSI 模型提供了一种用于描述网络的通用语言,并以离散的块或层的方式来描述。
|
||||
|
||||
### OSI 模型的各个层
|
||||
|
||||
该模型描述了计算机系统通过网络进行通信的七个层。
|
||||
|
||||
- 7 应用层
|
||||
- 6 表示层
|
||||
- 5 会话层
|
||||
- 4 传输层
|
||||
- 3 网络层
|
||||
- 2 数据链路层
|
||||
- 1 物理层
|
||||
|
||||
每个层都有自己的工作方式和一系列跟其他层不同的协议。本文将逐个剖析这些层级。
|
||||
|
||||
### 应用层
|
||||
|
||||
应用层是在软件中实现的。它是与应用程序交互的层级。
|
||||
|
||||
用发送消息作为例子。发送消息的程序与应用层进行交互,并发送消息。接着,应用层向 OSI 模型的下一个层级(即表示层)发送消息。
|
||||
|
||||
### 表示层
|
||||
|
||||
来自应用层的数据被转发到表示层。表示层接收到文字、字符、字母、数字等形式的数据,并把它们转换为机器可识读的二进制格式数据。这个过程叫做编译。
|
||||
|
||||
在此阶段,ASCII(美国信息交换标准码)字符被转换为扩充的二进制编码的十进制交换码(EBCDIC)。转换后的数据在继续传输前,也会进行编码和加密过程,使用 SSL 协议进行加密和解密。
|
||||
|
||||
表示层的作用是抽象化,它假设下面的层级会处理它们收到的数据。它也负责压缩数据。数据的压缩可能是有损的,也有可能是无损的,这取决于很多因素,这不属于本文的讨论范围。
|
||||
|
||||
### 会话层
|
||||
|
||||
会话层的作用是建立和管理连接。该层级的主要工作是建立会话。例如,你登录网上商城,就在你的机器和服务器之间建立了会话。
|
||||
|
||||
会话层的作用是实现数据的发送和接收,完成后连接的会话就终止了。在一个会话建立前,会进行身份验证。与上一层类似,会话层也假设在它的工作完成后,下面的层级也会准确无误地处理数据。
|
||||
|
||||
### 传输层
|
||||
|
||||
传输层的作用是管理数据传输和其自身的关于数据如何传输的一些协议。从会话层传到这里的数据被分为更小的数据单元,这些数据单元称为片段。这个过程叫做“分段”。每个片段包含来源端口号、目标端口号和一个序列号。端口号用来识别发送数据的应用程序。注意,数据以块的形式传输。序列号用于把这些片段按正确的顺序排列。
|
||||
|
||||
传输层负责控制流量或在给定的时间内传输的数据量。它也负责错误控制,比如数据丢失、损坏等情况。它利用一种错误检测值,通常叫做校验和。传输层对每个数据片段加上校验和,就可以检查所发送的数据是否被正确接收。然后数据传输到网络层。
|
||||
|
||||
### 网络层
|
||||
|
||||
网络层的作用是跟其他网络进行通信。它把从一台机器接收到的数据片段传输给另一台位于不同网络的机器。路由器是作用于网络层的。
|
||||
|
||||
网络层的功能是逻辑寻址(就是确定 IP 地址)。它为发送方和接收方分配 IP 地址,数据包附带了这个地址,就可以被传输到正确的目标机器。接着网络层对数据包进行路由。负载均衡也是在网络层进行的,旨在确保不会发生过载。下一步,数据传输到数据链路层。
|
||||
|
||||
### 数据链路层
|
||||
|
||||
数据链路层支持跟其他设备直接通信。
|
||||
|
||||
它接收到来自网络层、包含发送方和接收方 IP 地址的数据包,进行物理寻址,然后将发送方和接收方的 MAC 地址分配给数据包,形成帧。
|
||||
|
||||
### 物理层
|
||||
|
||||
物理层由系统的所有硬件和物理设备(包括网线、导航系统、适配器等)组成。在这里,从前面层级接收到的数据都是 0 和 1 形式的。物理层把这些数据转换并通过各种方式(如果是光纤电缆,有电线、电信号、光信号;如果是 WIFI,则为无线电信号)传输至本地媒介。
|
||||
|
||||
注意,物理层作用于接收方的一端,把接收到的信号以帧的形式传输到数据链路层(把它转换回二进制数据形式)。然后帧传输到上面的层级,最终应用层(应用软件)会接收到需要的数据。
|
||||
|
||||
### 结语
|
||||
|
||||
当你需要描述网络架构或排除网络问题时,OSI 模型的相关知识会对你有所帮助。我希望本文能令你对这个模型的方方面面有清晰的理解。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/osi-model-network-communications
|
||||
|
||||
作者:[Anamika][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[cool-summer-021](https://github.com/cool-summer-021)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/anamika
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/code_computer_development_programming.png
|
||||
[2]: https://opensource.com/article/22/10/osi-model-network-communications#application-layer
|
||||
[3]: https://opensource.com/article/22/10/osi-model-network-communications#presentation-layer
|
||||
[4]: https://opensource.com/article/22/10/osi-model-network-communications#session-layer
|
||||
[5]: https://opensource.com/article/22/10/osi-model-network-communications#transport-layer
|
||||
[6]: https://opensource.com/article/22/10/osi-model-network-communications#network-layer
|
||||
[7]: https://opensource.com/article/22/10/osi-model-network-communications#data-link-layer
|
||||
[8]: https://opensource.com/article/22/10/osi-model-network-communications#physical-layer
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/16/092612etn6gwaecb91bweg.jpg
|
112
published/20221019.5 ⭐️⭐️ Our open source startup journey.md
Normal file
112
published/20221019.5 ⭐️⭐️ Our open source startup journey.md
Normal file
@ -0,0 +1,112 @@
|
||||
[#]: subject: "Our open source startup journey"
|
||||
[#]: via: "https://opensource.com/article/22/10/tooljet-open-source-journey"
|
||||
[#]: author: "Navaneeth PK https://opensource.com/users/navaneeth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "CanYellow"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15359-1.html"
|
||||
|
||||
我们的开源创业之旅
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 以下是开源项目 ToolJet 是如何在一年的时间里取得 13000 颗星标和 200 个贡献者的故事。
|
||||
|
||||
[ToolJet][1] 是一款开源的低代码框架,用于快速构建和部署内部工具。它的代码库完全由 JavaScript 和 TypeScript 组成。
|
||||
|
||||
2021 年 4 月,一名开发者独自开始了 ToolJet 的开发,并于 2021 年 6 月推出公测版本,一炮而红。此后,ToolJet 成立了基金会。目前,我们已经有一个 20 人的开发团队。
|
||||
|
||||
### 为什么选择开源
|
||||
|
||||
在开发 ToolJet 之前,我曾担任一些企业客户的顾问。这些客户中的许多都庞大到足以维护构建几十个内部工具。尽管来自销售人员、支持人员以及运营人员不断要求对内部工具添加更多功能和修复错误,但开发团队却很难有精力来开发内部工具。
|
||||
|
||||
我尝试使用过多个平台来构建和维护内部工具。这些工具大多非常昂贵,而且经常不符合要求。我们需要进行修改,而且大多数工具不支持内部托管。
|
||||
|
||||
作为一名 Ruby 开发者,我最初使用 ActiveAdmin 和 RailsAdmin 来构建内部工具。这两款工具都是极好的,只是将它们应用在使用多个数据源的任务上比较困难。于是我意识到市场上需要一种可以构建用户界面,并能够连接多个数据源的框架。我相信任何为开发者制作的工具都应当是开源的。开发者日常使用的大部分工具与框架都源自世界各地人们的公开协作。
|
||||
|
||||
### 第一次提交
|
||||
|
||||
制作像 ToolJet 这样的工具需要全身心的投入,通过出售我的一个业余项目,我获得了五六个月的空闲,于是我立即着手将在我脑海里酝酿了两年的想法付诸现实。
|
||||
|
||||
2021 年 4 月 1 日,我完成了 ToolJet 的第一次提交(使用 `rails new` 命令)。
|
||||
|
||||
稍等!我刚刚说 ToolJet 的代码是完全基于 JavaScript 的?请接着往下看。
|
||||
|
||||
### 构建完成并推销给投资者
|
||||
|
||||
4、5 月间,我一直坐在电脑屏幕前编写代码和向种子轮的投资者推销我的工具。
|
||||
|
||||
我的工作还包括创建拖放式应用程序构建器,撰写所有的文档以保证有在主流平台上设置 ToolJet 的文档,创建项目网站,制作发布时所需的海报以及博客文章等等。这一过程进展顺利,没有遇到大的挑战。当时,ToolJet 的前端使用的是 React ,而后端则用的是 Ruby on Rails 。
|
||||
|
||||
编程工作进行得很顺利,然而向投资者推广的工作进行得并不顺利。我向专注于初创时期投资的风投和天使投资人发送了大约 40 封电子邮件,都石沉大海。大部分邮件都被忽略了,不过也有一些公司向我说明了拒绝的原因,另外一些则给我回了电话。
|
||||
|
||||
大部分的电话内容都是一样的:我无法说服他们接受开源商业模式。
|
||||
|
||||
### 工具发布
|
||||
|
||||
6 月 7 日是发布日。我们首先在 ProductHunt(LCTT 译注:[ProductHunt][11] 是一个新品发布平台)上发布。六个小时后,只有 70 名用户注册。但是我们有成为当天第一名产品的趋势(最终在那一周的产品中排名第三)。这里是原始的 [发布帖][2]。
|
||||
|
||||
下午 6 点左右,我又在 [HackerNews][3] 上发帖,一个小时内,这个帖子便升至榜首。大量的访问者注册并给我的版本库点亮星标,我对此很高兴。许多访问者和用户报告了软件和文档中的错误。距离在 HackNews 上发帖八个小时之后,超过 1000 名 GitHub 用户给 ToolJet 的 GitHub 版本库点亮了星标,并且有数百人注册了 ToolJet 云。上升趋势一直持续到三天后,ToolJet 版本库总计得到了 2400 个星标。
|
||||
|
||||
![ToolJet repo stats on GitHub][4]
|
||||
|
||||
### 获得资助
|
||||
|
||||
ToolJet 项目在 GitHub 上的吸引力足以被风投(VC)世界注意到。发布之后的日子被各种来电挤满了。我们也有其他的选择,但从没有认真考虑过这些它们。这些选择包括:
|
||||
|
||||
- 引导性融资:在项目初期,难以获得付费用户,而我此前也没有足够的储蓄来支撑整个项目。
|
||||
- 作为业余项目:在开发小型项目上这是可以的,但我不认为这在 ToolJet 的开发上行得通,毕竟在 ToolJet 平台能够为客户所用之前,我们需要创建大量的集成和 UI 控件。作为一个业余项目,要实现这些可能需要花费数月甚至数年时间。
|
||||
|
||||
我知道如果将 ToolJet 作为一个业余项目来开发,我可能需要花几个月的时间才能达到我期望的程度。而我希望通过扩大团队加速项目的成熟。鉴于该项目的吸引力,引入风险投资(VC)的资助是显而易见的选择。
|
||||
|
||||
好消息是在 HackNews 上发布之后的两周内我们成功募集了 [155 万美元的资金][5]。
|
||||
|
||||
### 在开源中积累很重要
|
||||
|
||||
发布后不久,我们发现许多人希望为 ToolJet 项目做贡献,但是他们几乎都是 JavaScript 开发者。我们也意识到像 ToolJet 这样的项目在未来会有成百上千的数据接口,只有基于插件的架构才行得通。我们于 2021 年 8 月决定从 Ruby 迁移到 TypeScript 上来。即使这花费了一个月的时间和巨大的努力,这仍然是我们在 ToolJet 项目上作出的最正确的决定。今天,我们有一个由我们的 [插件开发套件][6] 支持的可扩展的基于插件的架构。我们获得了来自超过 200 名开发者的贡献。关于这次迁移的文章参见 [这篇博客][7] 和 [另一篇博客][8]。
|
||||
|
||||
### 发布 v1.0 版本
|
||||
|
||||
自 8 月份以后,很多用户已经在生产环境中使用 ToolJet ,该平台并没有出现过任何稳定性或扩展性的问题。我们准备在发布 v1.0 版本之前完成开发人员平台的功能。开发人员平台允许任何 JavaScript 开发者构建和发布 ToolJet 插件。这样开发人员就可以为 ToolJet 开发数据接口。把集成测试的时间算上,创建一个 ToolJet 接口的时间也只需要30分钟。
|
||||
|
||||
### 创建持续成长的社区
|
||||
|
||||
![ToolJet star history][9]
|
||||
|
||||
我们没有在销售上投入资金,我们的大部分精力都放在了传播 ToolJet 的消息、撰写我们的经验教训以及维持开发社区的活跃上。我们有一个关注社区里问题的三人团队。
|
||||
|
||||
### 商业模式
|
||||
|
||||
如果没有 [商业产品][10] 来支付账单,ToolJet 就无法成为一项可持续的业务。我们构建了 ToolJet 的客户付费的企业版本。ToolJet 的免费的社区版本没有任何使用限制,企业版中的额外功能都只与大型团队有关。我们现在的客户已经有超大型公司。我们有足够的银行存款来打造更好的 ToolJet ,因此我们目前正聚焦于产品提升上。
|
||||
|
||||
### 接下来做什么
|
||||
|
||||
我们在开源社区的不断反馈和贡献的帮助下,我们可以经常性发布更好的 ToolJet 版本。很多主要的优化、大量的数据接口以及 UI 组件正在开发进程中。我们正以前所未有的速度朝着我们的最初目标前进,即成为一个可以连接到数百个数据源和构建最复杂的用户界面的开源框架。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/tooljet-open-source-journey
|
||||
|
||||
作者:[Navaneeth PK][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[CanYellow](https://github.com/CanYellow)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/navaneeth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://github.com/ToolJet/ToolJet
|
||||
[2]: https://www.producthunt.com/products/tooljet-0-5-3
|
||||
[3]: https://news.ycombinator.com/item?id=27421408
|
||||
[4]: https://opensource.com/sites/default/files/2022-10/tooljet-repo-stats.png
|
||||
[5]: https://blog.tooljet.com/raising-vc-funding-for-open-source-project
|
||||
[6]: https://www.npmjs.com/package/@tooljet/cli
|
||||
[7]: https://blog.tooljet.com/migrating-toojet-from-ruby-on-rails-to-nodejs
|
||||
[8]: https://blog.tooljet.com/how-we-migrated-tooljet-server-from-ruby-to-node-js
|
||||
[9]: https://opensource.com/sites/default/files/2022-10/tooljet-star-history.png
|
||||
[10]: https://opensource.com/article/19/11/product-vs-project
|
||||
[11]: https://www.producthunt.com/
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/17/221548rbp2t6z8ah3h031s.jpg
|
@ -0,0 +1,88 @@
|
||||
[#]: subject: "Write documentation like you develop code"
|
||||
[#]: via: "https://opensource.com/article/22/10/docs-as-code"
|
||||
[#]: author: "Lorna Mitchell https://opensource.com/users/lornajane"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "CanYellow"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15364-1.html"
|
||||
|
||||
像书写代码一样撰写文档
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 不想让文档成为事后的想法?或许你该尝试一下全新的写作方式。
|
||||
|
||||
很多工程师与手工艺者都对他们使用的工具有特别的要求。为了顺利的完成工作,你需要最好的工具和使用它们的技巧。软件开发中最好的工具在应用到其他的数字创作领域中也可以是很强大的。<ruby>[文档即代码][1]<rt>Docs as Code</rt></ruby> 的方式就是很好的例子。“文档即代码”意味着使用与代码开发相同的工具和工作流来撰写文档。文档即代码的支持者认为,这样的方式可以在降低写作者的工作量的同时,也带来了更好的文档。
|
||||
|
||||
### 文本格式与源文件控制
|
||||
|
||||
从传统的写作平台切换到文档即代码方式时,最主要的调整是将写作内容保存在基于文本的标记格式中。这一转变使得基于纯文本的工具都适用于文档写作。无论你选择 [DocBook][2]、[Markdown][3] 或者其他的标记语言,从只使用一种工具到使用一种标准格式配合多种工具是一种巨大的转变。
|
||||
|
||||
找到支持你的工作流程的工具是非常重要的。很多开发者在文档即代码项目中使用他们的 [代码编辑器][4]。因为他们已经是这些工具的高阶用户,一切都很顺利。而找到适合团队里其他专业人员,比如技术撰稿、编辑、信息架构师和文档产品责任人的工具可能需要一番努力。这里有一些选项可供参考:
|
||||
|
||||
- 各种 [优秀的 Markdown 编辑器][5] 之一
|
||||
- 附带良好的预览工具的代码编辑器可能更适合非程序员
|
||||
- 流行的 Git 托管服务的网页界面尤其适用于偶尔有需要的贡献者
|
||||
|
||||
一旦内容以标记语言的格式安全地保存,就可以使用 [Git][6] 这样的版本控制进行管理。Git 相比大多数文档平台具有更多的功能:
|
||||
|
||||
- 清晰详细的文档版本历史:谁在什么时候改变了什么。如果你有良好的提交信息惯例,你甚至可以了解到为什么会有这样的变更。
|
||||
- 简明的并行修改过程。在 Git 中使用分支工作意味着任何人可以做出他们想要的任何改变,并在最后合并所做的变更。
|
||||
- 先进的协作与审查工具。所有的源代码管理平台都被设计成支持详细审查每一个变更,并根据需要进行讨论,使每个人都确信这个变更可以继续进行。
|
||||
- 自动质量检查,比如拼写检查和链接检查。这不仅节省了时间,而且可以发现可能遗漏的错误。
|
||||
|
||||
源代码管理有很多优点。但要记住,如果你准备入门源代码管理,它有一定的学习曲线。这是一些有助于撰写者入门的优秀的 [学习资源][7] 和 [文章][8]。你也可以让具有好奇心的文档撰写者自行寻找对他们有用的学习材料,而不是请你的工程师来培训他们。(问我是怎么学会的? —— 当然是通过艰苦的方式!)
|
||||
|
||||
### 拉取请求和评审循环
|
||||
|
||||
所有的源代码管理平台都围绕 <ruby>拉取请求<rt>Pull Request</rt></ruby> 这一概念设计的,这有时也称为 <rbuy>合并请求<rt>Merge Request</rt></ruby>:有时候,某个人或某个团队先将一系列改变整合到一起,然后请求把这些修改拉到主项目中。不过从许多方面来说,在文档中一次处理多个变更比在代码中更容易。改变一篇文章中的某个地方,比更改代码并发现有其它几个地方依赖它,副作用更小。
|
||||
|
||||
最强大的协作工具是 [diff][9],它可以通过一个易于理解的方式展示旧版本与新版本之间的差异。该工具有许多不同的版本,可以使比较视图更易于查看:双栏模式、行内模式,甚至是渲染过的 Markdown 模式。团队中的每一个成员都可以选择最适合他们的工具。举例而言,网页视图通常用于查看细微变更,而对于更大的变更,我习惯于使用 `vimdiff` 或 [Meld][10] 在本地浏览。
|
||||
|
||||
评审意见可以被添加到整个修改中,也可以添加到拟议的变更的个别行中。一些项目限制了行的最大长度,即硬换行,或者一行一句,以使得向文本的特定的部分添加注释更加容易。可以添加进一步的修改与评论,直到审查过程结束,修改被接受。由于拉取请求在项目仓库以队列形式展示,这是一种很好的方式,可以展示目前正在进行的任务以及需要进行检查操作的任务。`diff` 工具使得评审人员更方便地添加他们的思考。尤其是你在与技术受众工作时,你可以通过他们日常使用的工具获得来自他们的评论。
|
||||
|
||||
### 持续集成与部署
|
||||
|
||||
以纯文本形式提供你的文档的源代码有很多益处,你可以轻易找到每一个需要修改的位置,你可以使用现有的诸如 [wc][11]、[grep][12] 或 `tree` 之类的工具,来处理潜在的大型文档集。当你将这些与源代码管理平台结合起来之后,你可能获得更多的可用工具,并且它们都是开源的。
|
||||
|
||||
另一个工作流程上的巨大提升是持续部署的能力。简单来说,这意味着,每当一个拉取请求被合并到主项目中,项目可以直接自动化部署到位。如果这个变更足够好,就可以放进项目中,它也足够好到可以在放到文档网站上帮助你的读者。典型情况下,持续部署是配置在一台单独的自动化服务器上的,比如 [Jenkins][13] 或者 [Git 钩子][14]。不论哪种方式,基于文本的标记语言与文档即代码平台(通常是静态网页生成器,比如 [Hugo][15] 或 [Sphinx][16])结合来生成文档网站,然后自动部署。
|
||||
|
||||
在部署之前,同样的自动化流程可以被用于对将要合并的拉取请求进行检查。在一个编程项目中,通过计算机自行进行代码检查、代码测试和其他的质量检查已经习以为常。通过类似 [Vale][17] 之类的工具可以对文本进行检查,文档项目也可以同样对待。你也可以添加其他的工具,比如添加一个链接检查器来确保文中所有的链接都是有效的。
|
||||
|
||||
### 用于文档流程的代码工具
|
||||
|
||||
被工程师们熟知并喜爱的工具都是非常好的工具,它们同时也可以用于其他类型的项目中。对于文档而言,它们提升了宝贵的效率,尤其是当你希望你的文档与你的团队同步推进的时候。上面讨论到的所有工具都是开源的,你可以亲自尝试,也可以为大型全球团队,亦或者介于两者之间的团队,部署它们。愿你的成文过程和编程过程一样顺畅。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/docs-as-code
|
||||
|
||||
作者:[Lorna Mitchell][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[CanYellow](https://github.com/CanYellow)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/lornajane
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.writethedocs.org/guide/docs-as-code
|
||||
[2]: https://opensource.com/article/17/9/docbook
|
||||
[3]: http://commonmark.org
|
||||
[4]: https://opensource.com/article/20/12/eclipse
|
||||
[5]: https://opensource.com/article/21/10/markdown-editors
|
||||
[6]: https://opensource.com/downloads/cheat-sheet-git
|
||||
[7]: https://opensource.com/article/18/1/step-step-guide-git
|
||||
[8]: https://opensource.com/article/19/4/write-git
|
||||
[9]: https://opensource.com/article/21/11/linux-diff-patch
|
||||
[10]: https://opensource.com/article/20/3/meld
|
||||
[11]: https://www.redhat.com/sysadmin/linux-wc-command?intcmp=7013a000002qLH8AAM
|
||||
[12]: https://opensource.com/downloads/grep-cheat-sheet
|
||||
[13]: https://www.jenkins.io
|
||||
[14]: https://www.redhat.com/sysadmin/git-hooks
|
||||
[15]: https://opensource.com/article/18/3/start-blog-30-minutes-hugo
|
||||
[16]: https://opensource.com/article/19/11/document-python-sphinx
|
||||
[17]: https://vale.sh
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/19/215600m3bzhqlu23lskssl.jpg
|
@ -3,48 +3,50 @@
|
||||
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "robsean"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15350-1.html"
|
||||
|
||||
如何在 Linux Mint 上安装 GNOME 桌面环境
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
Linux Mint 是一款极好的 Linux 发行版,特别适合初学者。
|
||||
|
||||
我喜欢它仍然保持常见的 Ubuntu/Debian 字体,但是它还做了一些 [比 Ubuntu 更好的][1] 工作。其中之一就是它没有使用 Snaps 。
|
||||
我喜欢它仍然保持常见的 Ubuntu/Debian 习惯,但是它还做了一些 [比 Ubuntu 更好的][1] 工作,其中之一就是它没有使用 Snap。
|
||||
|
||||
然而,我不是 Cinnamon 桌面环境的粉丝,因为我从来没有真正地喜欢过 Windows XP 或 7 的默认设置。
|
||||
|
||||
当我在为 Linux Mint 寻找能提供稳定使用 GNOME 的能力时,这便是我最终获得的结果:
|
||||
当我寻求保持 Linux Mint 稳定的同时而提供 GNOME 的能力时,这便是我最终获得的结果:
|
||||
|
||||
![install gnome in linux mint][2]
|
||||
|
||||
这就是我运行 GNOME 42.5 的 Linux Mint 21 。
|
||||
不太炫,这就是我运行 GNOME 42.5 的 Linux Mint 21 。
|
||||
|
||||
如果你想在 Linux Mint 上安装 GNOME ,那么这篇指南非常适合你。
|
||||
|
||||
### 在 Linux Mint 上安装GNOME 之前所要知道的事
|
||||
|
||||
你真的应该有足够的理由来在 Mint 上安装 GNOME 。如果你只是为了尝鲜,可以在虚拟机中尝试。我使用 [在 VirtualBox 中安装的 Linux Mint][3] 来演示这篇教程。
|
||||
要在 Mint 上安装 GNOME,你务必需要有足够的理由。如果你只是为了尝鲜,可以在虚拟机中尝试。我使用 [在 VirtualBox 中安装的 Linux Mint][3] 来演示这篇教程。
|
||||
|
||||
在发行版上安装一种桌面环境与直接使用来自发行版所提供的桌面环境相比,移除桌面环境部分会使其变成一件很复杂化的事。
|
||||
安装除发行版提供的桌面环境之外的其他桌面环境,移除桌面环境部分会使其变成一件很复杂的事。
|
||||
|
||||
Cinnamon 使用一些 GNOME 元素。如果你决定稍后移除 GNOME ,这可能会影响到 Cinnamon 的一部分功能。
|
||||
Cinnamon 使用了一些 GNOME 元素。如果你决定稍后移除 GNOME ,这可能会影响到 Cinnamon 的一部分功能。
|
||||
|
||||
这可能会导致缺少实战经验用户的恐慌。当然,在 TTY 屏幕中重新安装 Cinnamon 桌面环境可能是一种可行的解决方案。
|
||||
|
||||
最重要的一点是,如果你很容易惊慌地不知所措和不喜欢解决难题,那么你就不应该在你的主力计算机上做这些 ‘试验’ 。
|
||||
最重要的一点是,如果你很容易惊慌地不知所措和不喜欢解决难题,那么你就不应该在你的主力计算机上做这些 “试验” 。
|
||||
|
||||
抛开这些顾虑,让我们看看在 Linux Mint 上获取 GNOME 的简单过程。
|
||||
|
||||
### 在 Linux Mint 上安装 GNOME 桌面环境
|
||||
|
||||
在这里,你有两个选项。1、你可以使用包含所有的 GNOME 实用程序的完整的 GNOME 桌面,2、你也可以使用包含极少数软件包的 GNOME 精简版本、
|
||||
在这里,你有两个选项:1、你可以使用包含所有的 GNOME 实用程序的完整的 GNOME 桌面,2、你也可以使用包含极少数软件包的 GNOME 精简版本。
|
||||
|
||||
我都将讲解一下。
|
||||
|
||||
为 **安装精简版本的 GNOME** ,你需要安装一个名称为 `vanilla-GNOME` 的软件包,使用下面给定的命令:
|
||||
为 **安装精简版本的 GNOME** ,你需要安装一个名称为 `vanilla-gnome-desktop` 的软件包,使用下面给定的命令:
|
||||
|
||||
```
|
||||
sudo apt install vanilla-gnome-desktop
|
||||
@ -60,29 +62,29 @@ sudo apt install gnome
|
||||
|
||||
![choose display manager][4]
|
||||
|
||||
`gdm3` 是 GNOME 桌面的显示管理器,而 Linux Mint 使用 `lightdm` 作为默认的显示管理器,这两种显示器都可以正常工作,但是,我建议你使用 gdm3 来获取完整的 GNOME 体验。
|
||||
`gdm3` 是 GNOME 桌面的显示管理器,而 Linux Mint 使用 `lightdm` 作为默认的显示管理器,这两种显示器都可以正常工作,但是,我建议你使用 `gdm3` 来获取完整的 GNOME 体验。
|
||||
|
||||
#### 切换到 GNOME
|
||||
|
||||
在完成后,注销并按一次 enter 按键,在这里,你将看到一个小齿轮图标。从这里选择 GNOME :
|
||||
在完成后,注销并按一次回车键,在这里,你将看到一个小齿轮图标。从这里选择 “GNOME” :
|
||||
|
||||
![choose gnome while logging in][5]
|
||||
|
||||
现在,你拥有以 Linux Mint 为基础的 GNOME 桌面环境!
|
||||
|
||||
#### 额外提示:如何应用整体风格一致的主题
|
||||
#### 额外提示:如何应用整体风格一致的主题
|
||||
|
||||
你可以继续使用 Cinnamon 桌面的主题,但是它们大多不能如前工作,因此,我建议使用 GNOME 桌面的主题(例如 Adwaita )来保持桌面环境的一致性。
|
||||
|
||||
对我而言,其默认的字体没有一点效果。并且,我更喜欢 Fedora 提供的一些字体。因此,从系统菜单打开 <ruby>GNOME 调整<rt>GNOME tweaks</rt></ruby> 窗口,并作出如下更改:
|
||||
对我而言,其默认的字体没有一点效果。并且,我更喜欢 Fedora 提供的一些字体。因此,从系统菜单打开 <ruby>GNOME 调整<rt>GNOME tweaks</rt></ruby>,并作出如下更改:
|
||||
|
||||
![change fonts in ubuntu to have vanilla gnome experience][6]
|
||||
|
||||
这里是我使用的一些东西:
|
||||
这里是我使用的一些设置:
|
||||
|
||||
- **Cantarell Regular (11)** 用于界面和文档文本。
|
||||
- **Noto Sans Mono Regular (13)** 用于等宽字体文本。
|
||||
- **Cantarell Bold (11)** 用于窗口标题。
|
||||
- `Cantarell Regular (11)` 用于界面和文档文本。
|
||||
- `Noto Sans Mono Regular (13)` 用于等宽字体文本。
|
||||
- `Cantarell Bold (11)` 用于窗口标题。
|
||||
|
||||
它们的结果是,比默认的 Ubuntu 字体方案要好得多。
|
||||
|
||||
@ -101,7 +103,7 @@ via: https://itsfoss.com/install-gnome-linux-mint/
|
||||
作者:[Sagar Sharma][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[robsean](https://github.com/robseans)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
@ -114,3 +116,4 @@ via: https://itsfoss.com/install-gnome-linux-mint/
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/11/choose-gnome-while-logging-in.png
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/11/change-fonts-in-ubuntu-to-have-vanilla-gnome-experience.png
|
||||
[7]: https://itsfoss.com/install-switch-themes-gnome-shell/
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/15/104944fkv32vbys5x1hiv9.jpg
|
@ -0,0 +1,292 @@
|
||||
[#]: subject: "Introducing Rust calls to C library functions"
|
||||
[#]: via: "https://opensource.com/article/22/11/rust-calls-c-library-functions"
|
||||
[#]: author: "Marty Kalin https://opensource.com/users/mkalindepauledu"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "yzuowei"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15353-1.html"
|
||||
|
||||
从 Rust 调用 C 库函数
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> Rust FFI 和 bindgen 工具是为 Rust 调用 C 库而设计的。Rust 很容易与 C 语言对话,从而与任何其它可以与 C 语言对话的语言对话。
|
||||
|
||||
为什么要从 Rust 调用 C 函数?简短的答案就是软件库。冗长的答案则触及到 C 在众多编程语言中的地位,特别是相对 Rust 而言。C、C++,还有 Rust 都是系统语言,这意味着程序员可以访问机器层面的数据类型与操作。在这三个系统语言中,C 依然占据主导地位。现代操作系统的内核主要是用 C 来写的,其余部分依靠汇编语言补充。在标准系统函数库中,输入与输出、数字处理、加密计算、安全、网络、国际化、字符串处理、内存管理等等,大多都是用 C 来写的。这些函数库所代表的是一个庞大的基础设施,支撑着用其他语言写出来的应用。Rust 发展至今也有着可观的函数库,但是 C 的函数库 —— 自 1970 年代就已存在,迄今还在蓬勃发展 —— 是一种无法被忽视的资源。最后一点是,C 依然还是编程语言中的 [通用语][1]:大部分语言都可以与 C 交流,透过 C,语言之间可以互相交流。
|
||||
|
||||
### 两个概念证明的例子
|
||||
|
||||
Rust 支持 FFI(<ruby>外部函数接口<rt>Foreign Function Interface</rt></ruby>)用以调用 C 函数。任何 FFI 所需要面临的问题是调用方语言是否涵盖了被调用语言的数据类型。例如,`ctypes` 是 Python 调用 C 的 FFI,但是 Python 并没有包括 C 所支持的无符号整数类型。结果就是,`ctypes` 必须寻求解决方案。
|
||||
|
||||
相比之下,Rust 包含了所有 C 中的原始(即,机器层面)类型。比如说,Rust 中的 `i32` 类对应 C 中的 `int` 类。C 特别声明了 `char` 类必须是一个字节大小,而其他类型,比如 `int`,必须至少是这个大小(LCTT 译注:原文处有评论指出 `int` 大小依照 C 标准应至少为 2 字节);然而如今所有合理的 C 编译器都支持四字节的 `int`,以及八字节的 `double`(Rust 中则是 `f64` 类),以此类推。
|
||||
|
||||
针对 C 的 FFI 所面临的另一个挑战是:FFI 是否能够处理 C 的裸指针,包括指向被看作是字符串的数组指针。C 没有字符串类型,它通过结合字符组和一个非打印终止符(大名鼎鼎的 _空终止符_)来实现字符串。相比之下,Rust 有两个字符串类型:`String` 和 `&str` (字符串切片)。问题是,Rust FFI 是否能将 C 字符串转化成 Rust 字符串——答案是 _肯定的_。
|
||||
|
||||
出于对效率的追求,结构体指针在 C 中也很常见。一个 C 结构体在作为一个函数的参数或者返回值的时候,其默认行为是传递值(即,逐字节复制)。C 结构体,如同它在 Rust 中的对应部分一样,可以包含数组和嵌套其他结构体,所以其大小是不定的。结构体在两种语言中的最佳用法是传递或返回引用,也就是说,传递或返回结构体的地址而不是结构体本身的副本。Rust FFI 再一次成功处理了 C 的结构体指针,其在 C 函数库中十分普遍。
|
||||
|
||||
第一段代码案例专注于调用相对简单的 C 库函数,比如 `abs`(绝对值)和 `sqrt`(平方根)。这些函数使用非指针标量参数并返回一个非指针标量值。第二段代码案例则涉及了字符串和结构体指针,在这里会介绍工具 [bindgen][2],其通过 C 接口(头文件)生成 Rust 代码,比如 `math.h` 以及 `time.h`。C 头文件声明了 C 函数的调用语法,并定义了会被调用的结构体。两段代码都能在 [我的主页上][3] 找到。
|
||||
|
||||
### 调用相对简单的 C 函数
|
||||
|
||||
第一段代码案例有四处 Rust 对标准数学库内的 C 函数的调用:两处分别调用了 `abs`(绝对值)和 `pow`(幂),两处重复调用了 `sqrt`(平方根)。这个程序可以直接用 `rustc` 编译器进行构建,或者使用更方便的命令 `cargo build`:
|
||||
|
||||
```
|
||||
use std::os::raw::c_int; // 32位
|
||||
use std::os::raw::c_double; // 64位
|
||||
|
||||
// 从标准库 libc 中引入三个函数。
|
||||
// 此处是 Rust 对三个 C 函数的声明:
|
||||
extern "C" {
|
||||
fn abs(num: c_int) -> c_int;
|
||||
fn sqrt(num: c_double) -> c_double;
|
||||
fn pow(num: c_double, power: c_double) -> c_double;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x: i32 = -123;
|
||||
println!("\n{x}的绝对值是: {}.", unsafe { abs(x) });
|
||||
|
||||
let n: f64 = 9.0;
|
||||
let p: f64 = 3.0;
|
||||
println!("\n{n}的{p}次方是: {}.", unsafe { pow(n, p) });
|
||||
|
||||
let mut y: f64 = 64.0;
|
||||
println!("\n{y}的平方根是: {}.", unsafe { sqrt(y) });
|
||||
|
||||
y = -3.14;
|
||||
println!("\n{y}的平方根是: {}.", unsafe { sqrt(y) }); //** NaN = NotaNumber(不是数字)
|
||||
}
|
||||
```
|
||||
|
||||
顶部的两个 `use` 声明是 Rust 的数据类型 `c_int` 和 `c_double`,对应 C 类型里的 `int` 和 `double`。Rust 标准模块 `std::os::raw` 定义了 14 个类似的类型以确保跟 C 的兼容性。模块 `std::ffi` 中有 14 个同样的类型定义,以及对字符串的支持。
|
||||
|
||||
位于 `main` 函数上的 `extern "C"` 区域声明了 3 个 C 库函数,这些函数会在 `main` 函数内被调用。每次调用都使用了标准的 C 函数名,但每次调用都必须发生在一个 `unsafe` 区域内。正如每个新接触 Rust 的程序员所发现的那样,Rust 编译器极度强制内存安全。其他语言(特别是 C 和 C++)作不出相同的保证。`unsafe` 区域其实是说:Rust 对外部调用中可能存在的不安全行为不负责。
|
||||
|
||||
第一个程序输出为:
|
||||
|
||||
```
|
||||
-123的绝对值是: 123.
|
||||
9的3次方是: 729.
|
||||
64的平方根是: 8.
|
||||
-3.14的平方根是: NaN.
|
||||
```
|
||||
|
||||
输出的最后一行的 `NaN` 表示<ruby>不是数字<rt>Not a Number</rt></ruby>:C 库函数 `sqrt` 期待一个非负值作为参数,这使得参数 `-3.14` 生成了 `NaN` 作为返回值。
|
||||
|
||||
### 调用涉及指针的 C 函数
|
||||
|
||||
C 库函数为了提高效率,经常在安全、网络、字符串处理、内存管理,以及其他领域中使用指针。例如,库函数 `asctime`(ASCII 字符串形式的时间)期待一个结构体指针作为其参数。Rust 调用类似 `asctime` 的 C 函数就会比调用 `sqrt` 要更加棘手一些,后者既没有牵扯到指针,也不涉及到结构体。
|
||||
|
||||
函数 `asctime` 调用的 C 结构体类型为 `struct tm`。一个指向此结构体的指针会作为参数被传递给库函数 `mktime`(时间作为值)。此结构体会将时间拆分成诸如年、月、小时之类的单位。此结构体的<ruby>字段<rt>field</rt></ruby>类型为 `time_t`,是 `int`(32位)和 `long`(64 位)的别名。两个库函数将这些破碎的时间片段组合成了一个单一值:`asctime` 返回一个以字符串表示的时间,而 `mktime` 返回一个 `time_t` 值表示自 “<ruby>[纪元][4]<rt>Epoch</rt></ruby> 以来所经历的秒数,这是一个系统的时钟和时间戳的相对时间。典型的纪元设置为 1900 年或 1970 年,1 月 1 日 0 时 0 分 0 秒。(LCTT 校注:Unix、Linux 乃至于如今所有主要的计算机和网络的时间纪元均采用 1970 年为起点。)
|
||||
|
||||
以下的 C 程序调用了 `asctime` 和 `mktime`,并使用了其他库函数 `strftime` 来将 `mktime` 的返回值转化成一个格式化的字符串。这个程序可被视作 Rust 对应版本的预热:
|
||||
|
||||
```
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
int main () {
|
||||
struct tm sometime; /* 时间被打破细分 */
|
||||
char buffer[80];
|
||||
int utc;
|
||||
|
||||
sometime.tm_sec = 1;
|
||||
sometime.tm_min = 1;
|
||||
sometime.tm_hour = 1;
|
||||
sometime.tm_mday = 1;
|
||||
sometime.tm_mon = 1;
|
||||
sometime.tm_year = 1; /*LCTT 校注:注意,相对于 1900 年的年数*/
|
||||
sometime.tm_hour = 1;
|
||||
sometime.tm_wday = 1;
|
||||
sometime.tm_yday = 1;
|
||||
|
||||
printf("日期与时间: %s\n", asctime(&sometime));
|
||||
|
||||
utc = mktime(&sometime);
|
||||
if( utc < 0 ) {
|
||||
fprintf(stderr, "错误: mktime 无法生成时间\n");
|
||||
} else {
|
||||
printf("返回的整数值: %d\n", utc);
|
||||
strftime(buffer, sizeof(buffer), "%c", &sometime);
|
||||
printf("更加可读的版本: %s\n", buffer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
程序输出为:
|
||||
|
||||
```
|
||||
日期与时间: Fri Feb 1 01:01:01 1901
|
||||
返回的整数值: 2120218157
|
||||
更加可读的版本: Fri Feb 1 01:01:01 1901
|
||||
```
|
||||
|
||||
(LCTT 译注:如果你尝试在自己电脑上运行这段代码,然后得到了一行关于 `mktime` 的错误信息,然后又在网上随便找了个在线 C 编译器,复制代码然后得到了跟这里的结果有区别但是没有错误的结果,不要慌,我的电脑上也是这样的。导致本地机器上 `mktime` 失败的原因是作者没有设置 `tm_isdst`,这个是用来标记夏令时的标志。[`tm_isdst` 大于零则夏令时生效中,等于零则不生效,小于零标记未知][5]。加入 `sometime.tm_isdst = 0` 或 `= -1` 后应该就能得到跟在线编译器大致一样的结果。不同的地方在于结果第一行我得到的是 `Mon Feb ...`,这个与作者代码中 `sometime.tm_wday = 1` 对应,这里应该是作者**写错了**;第二行我和作者和网上得到的数字都不一样,这大概是合理的,因为这与机器的纪元有关;第三行我跟作者的结果是一样的,1901 年 2 月 1 日也确实是周五,这是因为 [`mktime` 其实会修正时间参数中不合理的地方][6]。至于夏令时具体是如何影响 `mktime` 这个问题,我能查到的只有 `mktime` 的计算受时区影响,更底层的原因我也不知道了。)
|
||||
|
||||
总的来说,Rust 在调用库函数 `asctime` 和 `mktime` 时,必须处理以下两个问题:
|
||||
|
||||
- 将裸指针作为唯一参数传递给每个库函数。
|
||||
- 把从 `asctime` 返回的 C 字符串转化为 Rust 字符串。
|
||||
|
||||
### Rust 调用 asctime 和 mktime
|
||||
|
||||
工具 `bindgen` 会根据类似 `math.h` 和 `time.h` 之类的 C 头文件生成 Rust 支持的代码。下面这个简化版的 `time.h` 就可以用来做例子,简化版与原版主要有两个不同:
|
||||
|
||||
- 内置类型 `int` 被用来取代别名类型 `time_t`。工具 bindgen 可以处理 `time_t` 类,但是会生成一些烦人的警告,因为 `time_t` 不符合 Rust 的命名规范:`time_t` 以下划线区分 `time` 和 `t`;Rust 更偏好驼峰式命名方法,比如 `TimeT`。
|
||||
- 出于同样的原因,这里选择 `StructTM` 作为 `struct tm` 的别名。
|
||||
|
||||
以下是一份简化版的头文件,`mktime` 和 `asctime` 在文件底部:
|
||||
|
||||
```
|
||||
typedef struct tm {
|
||||
int tm_sec; /* 秒 */
|
||||
int tm_min; /* 分钟 */
|
||||
int tm_hour; /* 小时 */
|
||||
int tm_mday; /* 日 */
|
||||
int tm_mon; /* 月 */
|
||||
int tm_year; /* 年 */
|
||||
int tm_wday; /* 星期 */
|
||||
int tm_yday; /* 一年中的第几天 */
|
||||
int tm_isdst; /* 夏令时 */
|
||||
} StructTM;
|
||||
|
||||
extern int mktime(StructTM*);
|
||||
extern char* asctime(StructTM*);
|
||||
```
|
||||
|
||||
`bindgen` 安装好后,`mytime.h` 作为以上提到的头文件,以下命令(`%` 是命令行提示符)可以生成所需的 Rust 代码并将其保存到文件 `mytime.rs`:
|
||||
|
||||
```
|
||||
% bindgen mytime.h > mytime.rs
|
||||
```
|
||||
|
||||
以下是 `mytime.rs` 中的重要部分:
|
||||
|
||||
```
|
||||
/* automatically generated by rust-bindgen 0.61.0 */
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct tm {
|
||||
pub tm_sec: ::std::os::raw::c_int,
|
||||
pub tm_min: ::std::os::raw::c_int,
|
||||
pub tm_hour: ::std::os::raw::c_int,
|
||||
pub tm_mday: ::std::os::raw::c_int,
|
||||
pub tm_mon: ::std::os::raw::c_int,
|
||||
pub tm_year: ::std::os::raw::c_int,
|
||||
pub tm_wday: ::std::os::raw::c_int,
|
||||
pub tm_yday: ::std::os::raw::c_int,
|
||||
pub tm_isdst: ::std::os::raw::c_int,
|
||||
}
|
||||
|
||||
pub type StructTM = tm;
|
||||
|
||||
extern "C" {
|
||||
pub fn mktime(arg1: *mut StructTM) -> ::std::os::raw::c_int;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn asctime(arg1: *mut StructTM) -> *mut ::std::os::raw::c_char;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bindgen_test_layout_tm() {
|
||||
const UNINIT: ::std::mem::MaybeUninit<tm> = ::std::mem::MaybeUninit::uninit();
|
||||
let ptr = UNINIT.as_ptr();
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<tm>(),
|
||||
36usize,
|
||||
concat!("Size of: ", stringify!(tm))
|
||||
);
|
||||
...
|
||||
```
|
||||
|
||||
Rust 结构体 `struct tm`,跟原本在 C 中的一样,包含了 9 个 4 字节的整型字段。这些字段名称在 C 和 Rust 中是一样的。`extern "C"` 区域声明了库函数 `astime` 和 `mktime` 分别需要只一个参数,一个指向可变实例 `StructTM` 的裸指针。(库函数可能会通过指针改变作为参数传递的结构体。)
|
||||
|
||||
`#[test]` 属性下的其余代码是用来测试 Rust 版的时间结构体的布局。通过命令 `cargo test` 可以进行这些测试。问题在于,C 没有规定编译器应该如何对结构体中的字段进行布局。比如说,C 的 `struct tm` 以字段 `tm_sec` 开头用以表示秒;但是 C 不需要编译版本遵循这个排序。不管怎样,Rust 测试应该会成功,而 Rust 对库函数的调用也应如预期般工作。
|
||||
|
||||
### 设置好第二个案例并开始运行
|
||||
|
||||
从 `bindgen` 生成的代码不包含 `main` 函数,所以是一个天然的模块。以下是一个 `main` 函数初始化了 `StructTM` 并调用了 `asctime` 和 `mktime`:
|
||||
|
||||
```
|
||||
mod mytime;
|
||||
use mytime::*;
|
||||
use std::ffi::CStr;
|
||||
|
||||
fn main() {
|
||||
let mut sometime = StructTM {
|
||||
tm_year: 1,
|
||||
tm_mon: 1,
|
||||
tm_mday: 1,
|
||||
tm_hour: 1,
|
||||
tm_min: 1,
|
||||
tm_sec: 1,
|
||||
tm_isdst: -1,
|
||||
tm_wday: 1,
|
||||
tm_yday: 1
|
||||
};
|
||||
|
||||
unsafe {
|
||||
let c_ptr = &mut sometime; // 裸指针
|
||||
|
||||
// 调用,转化,并拥有
|
||||
// 返回的 C 字符串
|
||||
let char_ptr = asctime(c_ptr);
|
||||
let c_str = CStr::from_ptr(char_ptr);
|
||||
println!("{:#?}", c_str.to_str());
|
||||
|
||||
let utc = mktime(c_ptr);
|
||||
println!("{}", utc);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
这段 Rust 代码可以被编译(直接用 `rustc` 或使用 `cargo`)并运行。输出为:
|
||||
|
||||
```
|
||||
Ok(
|
||||
"Mon Feb 1 01:01:01 1901\n",
|
||||
)
|
||||
2120218157
|
||||
```
|
||||
|
||||
对 C 函数 `asctime` 和 `mktime` 的调用必须再一次被放在 `unsafe` 区域内,因为 Rust 编译器无法对这些外部函数的潜在内存安全风险负责。此处声明一下,`asctime` 和 `mktime` 并没有安全风险。调用的两个函数的参数是裸指针 `ptr`,其指向结构体 `sometime` (在<ruby>栈<rt>stack</rt></ruby>中)的地址。
|
||||
|
||||
`asctime` 是两个函数中调用起来更棘手的那个,因为这个函数返回的是一个指向 C `char` 的指针,如果函数返回 `Mon` 那么指针就指向 `M`。但是 Rust 编译器并不知道 C 字符串 (`char` 的空终止数组)的储存位置。是内存里的静态空间?还是<ruby>堆<rt>heap</rt></ruby>?`asctime` 函数内用来储存时间的文字表达的数组实际上是在内存的静态空间里。无论如何,C 到 Rust 字符串转化需要两个步骤来避免编译错误:
|
||||
|
||||
- 调用 `Cstr::from_ptr(char_ptr)` 来将 C 字符串转化为 Rust 字符串并返回一个引用储存在变量 `c_str` 中。
|
||||
- 对 `c_str.to_str()` 的调用确保了 `c_str` 是所有者。
|
||||
|
||||
Rust 代码不会增加从 `mktime` 返回的整型值的易读性,这一部分留作课外作业给感兴趣的人去探究。Rust 模板 `chrono::format` 也有一个 `strftime` 函数,它可以被当作 C 的同名函数来使用,两者都是获取时间的文字表达。
|
||||
|
||||
### 使用 FFI 和 bindgen 调用 C
|
||||
|
||||
Rust FFI 和工具 `bindgen` 都能够出色地协助 Rust 调用 C 库,无论是标准库还是第三方库。Rust 可以轻松地与 C 交流,并透过 C 与其他语言交流。对于调用像 `sqrt` 一样简单的库函数,Rust FFI 表现直截了当,这是因为 Rust 的原始数据类型覆盖了它们在 C 中的对应部分。
|
||||
|
||||
对于更为复杂的交流 —— 特别是 Rust 调用像 `asctime` 和 `mktime` 一样,会涉及到结构体和指针的 C 库函数 —— `bindgen` 工具是优秀的帮手。这个工具会生成支持代码以及所需要的测试。当然,Rust 编译器无法假设 C 代码对内存安全的考虑会符合 Rust 的标准;因此,Rust 必须在 `unsafe` 区域内调用 C。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/11/rust-calls-c-library-functions
|
||||
|
||||
作者:[Marty Kalin][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[yzuowei](https://github.com/yzuowei)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/mkalindepauledu
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://baike.baidu.com/item/lingua%20franka/5359711
|
||||
[2]: https://github.com/rust-lang/rust-bindgen
|
||||
[3]: https://condor.depaul.edu/mkalin
|
||||
[4]: https://baike.baidu.com/item/UNIX时间/8932323
|
||||
[5]: https://cplusplus.com/reference/ctime/tm/
|
||||
[6]: https://cplusplus.com/reference/ctime/mktime/
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/16/110147q4kk0qoqe0e3m6bb.jpg
|
@ -0,0 +1,135 @@
|
||||
[#]: subject: "Create a holiday light display with your Raspberry Pi and ping pong balls"
|
||||
[#]: via: "https://opensource.com/article/22/11/raspberry-pi-holiday-light-display"
|
||||
[#]: author: "Brian McCafferty https://opensource.com/users/bdm"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "Return7g"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15365-1.html"
|
||||
|
||||
利用树莓派和乒乓球制作一个假日彩灯
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 这个树莓派教程用于制作一个可编程的 LED 灯光显示器,非常适合各种技能水平的人。
|
||||
|
||||
我喜欢圣诞装饰品和灯饰,因此很长一段时间以来我一直想做一个可编程的 LED 项目。最近,我制作了一个由 LED 灯、乒乓球和树莓派 Zero 组成的灯阵列。这个项目相对简单并且具有教学价值,因此我认为它非常值得分享。
|
||||
|
||||
整个彩灯由我设计,但其中一些灵感也来自 YouTube。你可以在我的 [Git 存储库][1] 中找到源代码和制作说明。
|
||||
|
||||
### 购物清单
|
||||
|
||||
- [树莓派 Zero][2]
|
||||
- [树莓派保护壳][3]
|
||||
- 5V 2A 的电源线
|
||||
- 展架
|
||||
- 255 个乒乓球
|
||||
- 热熔胶枪和若干热熔胶棒
|
||||
- 烙铁
|
||||
- 焊锡丝
|
||||
- 22 AWG 0.35mm 实芯线
|
||||
- 10 米 WS2812(B) LED 灯带(每米 30 像素)
|
||||
- 万用表
|
||||
- 钢丝钳
|
||||
- 剥线钳
|
||||
|
||||
### 设计树莓派的灯光效果
|
||||
|
||||
这个设计是根据我展框的大小决定的。我在全球速卖通买到了每米 30 像素的灯带,它可以轻松地切成 0.5 米的长度,每条有 15 个 LED 灯。乒乓球的直径是 40 毫米,所以我测量并隔开 40 毫米划了线,LED 灯条放在每隔 40 毫米的中间部分,这就产生了 17 条线。因此我的灯光阵列是 15×17。你可以根据实际情况来调整尺寸。
|
||||
|
||||
为了给灯带和树莓派供电,我在电路板底部设置了数据线和电源线。我的 LED 灯不需要很多电,所以我使用树莓派 Zero 的 5V 输出 GPIO 为它们供电。当我以 50% 的亮度运行时,这个亮度已经足以在白天和晚上透过我的窗户看到。
|
||||
|
||||
### 布线
|
||||
|
||||
我从电路板的底部以之字形开始布线,这使得焊接非常容易,因为每行的末尾不必返回到每行的开头。
|
||||
|
||||
我的线路大致像这样(为清楚起见,这里进行了简化,实际上它一共有 17 行):
|
||||
|
||||
```
|
||||
<---------------\
|
||||
|
|
||||
/---------------/
|
||||
|
|
||||
\---------------< # 这里连接树莓派
|
||||
```
|
||||
|
||||
### 使用树莓派制作显示屏
|
||||
|
||||
当设计和布线的工作完成后就可以开始制作显示屏了。
|
||||
|
||||
我在展板上测量并绘制了线路。我的灯带背面有胶带,所以我只需要取下背衬并将其贴在展板上。我检查了每个灯带的位置和数据线的方向,以确保灯带可以按照树莓派的指令正确串联起来。
|
||||
|
||||
连接好所有灯带后,我剪下三段长度相同的电线,并将每个灯带末端的电源线、数据线和接地线连接到其上方。
|
||||
|
||||
![Connect each light strip at the end of each line.][4]
|
||||
|
||||
在线路连接完成后,我检查了每条灯带之间的电源线和地线之间的连接,以确保其连通性。我还检查了是否存在错误的桥接,所以我验证了电源线和地线之间的连接。我还进行了一些测试以确保所有灯都正常点亮(链路测试参阅 [测试代码][5])。
|
||||
|
||||
完成上述工作后,我开始在乒乓球上剪洞,用剪刀刺入乒乓球的底部,然后剪一个小洞让 LED 灯穿进去。手工不太行,每个球都不太一样,但效果真的很好。我使用的每米 30 个像素的 LED 灯,所以每个 LED 之间有大约 30 毫米的空隙。一个乒乓球是 40 毫米宽,但我不打算开始单独焊接每一个 LED!我想,这是很重要的。首先,我并不擅长焊接(正如我的照片所显示的),而且无论如何,我想“好吧,它们是乒乓球。我可以把它们压在一起!”
|
||||
|
||||
我是这样做的:
|
||||
|
||||
在 LED 灯上滴上热熔胶,然后在 LED 上放了一个乒乓球并按住大约五秒钟,就粘好了一个乒乓球。粘贴下一个乒乓球时我只需要挤着上一个乒乓球,就能让所有乒乓球都变得整齐了。我对它的外观很满意。它还有一个很好的好处,就是掩盖了我糟糕的焊接工作;)
|
||||
|
||||
![It's a tight fit, but the 40mm ping pong balls fit in a 30mm space just fine.][6]
|
||||
|
||||
我继续为余下的乒乓球进行焊接。尽管这个过程中有几个乒乓球被压碎了,但最终还是顺利完成了制作。
|
||||
|
||||
![255 LEDs and 255 ping pong balls in an array.][7]
|
||||
|
||||
### 测试代码
|
||||
|
||||
测试代码需要确保所有部件都能正常工作,为此我使用了这个 [Adafruit 指南][8],它以红、绿和蓝点亮每个 LED,然后依次进行循环。我在测试时使用它来确保我连接无误并且焊接正常。
|
||||
|
||||
在此之后,我在电子表格中设计了一个网格,将每个像素映射到一个网格位置。由于我的像素编号呈之字形排列,因此很难跟踪每个 LED(例如 A1 为 256,B1 为 226)。重新映射网格位置能使得我在构建图像时更容易。
|
||||
|
||||
在所有准备工作完成之后,我就可以在纸上和电子表格中设计图像,然后编码。于是我开始添加一些动画(使用循环并将像素变为一种颜色,然后变为另一种颜色)。
|
||||
|
||||
最终的结果还算顺利。
|
||||
|
||||
![A Christmas gift in LED.][9]
|
||||
|
||||
![Reindeer painted with light.][10]
|
||||
|
||||
![An LED snowflake.][11]
|
||||
|
||||
### 能玩一年的树莓派彩灯
|
||||
|
||||
我不确定这是否已经完全完成了。自从把它摆放到橱窗里,几乎每个晚上我都会添加一些新的图像和动画。我已经在考虑除夕夜的时候要做成什么样了。它不会像圣诞装饰品一起在圣诞节后被放进储藏室。我只需要在上面显示其它图案,就能使它成为一个能玩一年的彩灯!我的一个朋友推荐了像素版马里奥,这听起来是个好主意!
|
||||
|
||||
我的代码仍然需要完善。例如,我做了一些滚动文本,但当我为文本的每个位置重新绘制时却花了很多时间。我想我可以用循环做一些事情,或者图像库可以帮助更轻松地滚动字母,并使添加文本更容易,而不是在每一步打开和关闭每个像素。
|
||||
|
||||
这里有一张照片记录了我制作的全过程:[LED 乒乓墙][12]。
|
||||
|
||||
可以在此处观看它的运行视频:[XMas 灯光展示][13]。
|
||||
|
||||
这个彩灯最终的效果我非常满意。以后我也会尝试更多利用 LED 彩灯完成的项目。我也鼓励大家亲自动手制作一个这样的彩灯,它会比你想象中更简单。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/11/raspberry-pi-holiday-light-display
|
||||
|
||||
作者:[Brian McCafferty][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[Return7g](https://github.com/Return7g)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/bdm
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://github.com/bmccafferty/ping-pong-led-wall
|
||||
[2]: https://shop.pimoroni.com/products/raspberry-pi-zero-wh-with-pre-soldered-header
|
||||
[3]: https://shop.pimoroni.com/products/pibow-zero-w
|
||||
[4]: https://opensource.com/sites/default/files/2022-11/IMG_20201126_115520.jpeg
|
||||
[5]: https://opensource.com#the-code
|
||||
[6]: https://opensource.com/sites/default/files/2022-11/IMG_20201127_101409.webp
|
||||
[7]: https://opensource.com/sites/default/files/2022-11/IMG_20201127_160500.webp
|
||||
[8]: https://learn.adafruit.com/neopixels-on-raspberry-pi/python-usage
|
||||
[9]: https://opensource.com/sites/default/files/2022-11/IMG_20201127_181931.webp
|
||||
[10]: https://opensource.com/sites/default/files/2022-11/IMG_20201202_215902.webp
|
||||
[11]: https://opensource.com/sites/default/files/2022-11/IMG_20201127_215314.webp
|
||||
[12]: https://projects.bdm.scot/Xmas%20LED%20Wall%202020/
|
||||
[13]: https://youtu.be/zc0501GzpMw
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/20/095754r7q0z001lvx6p600.jpg
|
@ -3,18 +3,20 @@
|
||||
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15346-1.html"
|
||||
|
||||
Monica:个人关系管理的开源应用
|
||||
Monica:人际关系管理的开源应用
|
||||
======
|
||||
|
||||
你可能已经知道 CRM 代表 **客户关系管理**。 我们已经有了一份帮助小型企业的[开源 CRM 软件][1]列表。
|
||||
![][0]
|
||||
|
||||
在这里,我将讨论一个有趣的开源 Web 应用,它采用相同的人际关系概念。 听起来很独特,对吧?
|
||||
你可能已经知道 CRM 代表 <ruby>客户关系管理<rt>Customer Relationship Management</rt></ruby>。 我们已经有了一份帮助小型企业的 [开源 CRM 软件][1] 列表。
|
||||
|
||||
Monica 是一款可让你组织和记录你与亲人互动的应用。 **如果你自行托管,它是免费的,如果你需要托管版本那么订阅**。
|
||||
在这里,我将讨论一个有趣的开源 Web 应用,它采用相同的人际关系概念。听起来很独特,对吧?
|
||||
|
||||
Monica 是一款可让你组织和记录你与亲人互动的应用。**如果你自行托管,它是免费的,如果你需要托管版本那么订阅**。
|
||||
|
||||
### Monica:跟踪社交互动
|
||||
|
||||
@ -22,11 +24,11 @@ Monica 是一款可让你组织和记录你与亲人互动的应用。 **如果
|
||||
|
||||
很难记住与家人、朋友或同事互动的每一个细节。
|
||||
|
||||
你可以使用[笔记应用][3]或 [CubyText][4] 等知识管理应用来添加一些信息。 但这些并不是为记录你的互动而量身定制的。 因此,你将不得不付出一些努力,以在需要时得心应手的方式添加信息。
|
||||
你可以使用 [笔记应用][3] 或 [CubyText][4] 等知识管理应用来添加一些信息。但这些并不是为记录你的互动而量身定制的。 因此,你将不得不付出一些努力,以在需要时得心应手的方式添加信息。
|
||||
|
||||
使用 Monica,添加你的家庭、工作、联系人之间的关系、活动、日记、重要日期的提醒、债务等信息变得更加容易。
|
||||
|
||||
可以将其安装在自己的服务器上或选择 **$90/年**的订阅以获得托管版本。
|
||||
可以将其安装在自己的服务器上或选择 **$90/年** 的订阅以获得托管版本。
|
||||
|
||||
有趣的是,开发人员最初是根据他的个人要求构建它的。
|
||||
|
||||
@ -34,26 +36,26 @@ Monica 是一款可让你组织和记录你与亲人互动的应用。 **如果
|
||||
|
||||
![dashboard][5]
|
||||
|
||||
你可以获得大量选项来添加有关你日常生活中的人和互动的信息。 其中一些包括:
|
||||
你可以获得大量选项来添加有关你日常生活中的人和互动的信息。其中一些包括:
|
||||
|
||||
- 添加关于一个人的注释
|
||||
- 列出与联系人相关的重要其他人的姓名(他们的孩子、宠物等)
|
||||
- 通话记录
|
||||
- 每个联系人的备用联系方式
|
||||
- 重要约会和重要事件提醒。 生日会自动设置为提醒。
|
||||
- 重要约会和重要事件提醒。生日会自动设置为提醒。
|
||||
- 管理礼物信息
|
||||
- 有用的仪表板,一目了然
|
||||
- 支持日记条目
|
||||
|
||||
Monica 似乎配备了各种功能,使其成为写日记、做笔记、添加联系信息、添加事件等的一体化工具。
|
||||
|
||||
不幸的是,没有可用的移动应用。 你可以从 Web 浏览器访问它,但它可能不是每个人的最佳体验。 所以,如果你坚持用智能手机做笔记和其他东西,你可能想看看其他的。
|
||||
不幸的是,没有可用的移动应用。你可以从 Web 浏览器访问它,但它可能不是每个人的最佳体验。所以,如果你坚持用智能手机做笔记和其他东西,你可能想看看其他的。
|
||||
|
||||
### 自托管或订阅访问
|
||||
|
||||
如果你想要 Monica 的托管版本,可以查看它的[定价页面][6]了解更多信息。
|
||||
如果你想要 Monica 的托管版本,可以查看它的 [定价页面][6] 了解更多信息。
|
||||
|
||||
对于自托管,你需要前往其 [GitHub 页面][7]并按照说明下载并安装它。 可以选择在 Platform.sh 或 Heroku 上快速部署。
|
||||
对于自托管,你需要前往其 [GitHub 页面][7] 并按照说明下载并安装它。可以选择在 Platform.sh 或 Heroku 上快速部署。
|
||||
|
||||
在选择服务器来托管 Monica 之前,请检查最低系统要求。
|
||||
|
||||
@ -61,7 +63,7 @@ Monica 似乎配备了各种功能,使其成为写日记、做笔记、添加
|
||||
|
||||
这一切都很方便。 所以,选择对你来说不错的。
|
||||
|
||||
前往其[官方网站][8]获取所有详细信息并开始使用。
|
||||
前往其 [官方网站][8] 获取所有详细信息并开始使用。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -84,3 +86,4 @@ via: https://itsfoss.com/monica/
|
||||
[6]: https://www.monicahq.com/pricing
|
||||
[7]: https://github.com/monicahq/monica#get-started
|
||||
[8]: https://www.zdnet.com/article/microsoft-office-365-banned-in-german-schools-over-privacy-fears/
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/14/093133zpw06jndpzbdpphp.jpg
|
@ -0,0 +1,68 @@
|
||||
[#]: subject: "Try this Java file manager on Linux"
|
||||
[#]: via: "https://opensource.com/article/22/12/linux-file-manager-jfileprocessor"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15357-1.html"
|
||||
|
||||
在 Linux 上试试这个 Java 文件管理器
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> JFileProcessor 作为一个 Linux 文件管理器,在设计和功能上都采取了极简理念。
|
||||
|
||||
计算机是一个奇特的文件柜,里面装满了虚拟文件夹和文件,等待着被引用、交叉引用、编辑、更新、保存、复制、移动、重命名和归类。在本文中,我将介绍一下 Linux 系统的文件管理器。
|
||||
|
||||
在 <ruby>昇阳微系统<rt>Sun Microsystem</rt></ruby> 时代的末期,出现了一种叫做 <ruby>Java 桌面系统<rt>Java Desktop System</rt></ruby> 的东西,奇怪的是它 _不是_ 用 Java 编写的。相反,它是(根据当时的 sun.com 上的描述)“对集成和优化的桌面软件的明智选择,大部分基于开源代码和开放标准”。它基于 GNOME,带有办公套件、电子邮件和日历应用、即时消息和“Java 技术”。我发现自己在思考用 Java 创建桌面需要什么。客观地说,桌面实际上并不包括那么多东西。一般的共识似乎是桌面由面板、系统托盘、应用菜单和文件管理器组成。
|
||||
|
||||
想象一个实际的 Java 桌面是一个有趣的思维练习。虽然不足以以此为目标启动一个开源项目,但足以在网络上快速搜索必要的组件。事实证明,有人用 Java 编写并维护了一个文件管理器。
|
||||
|
||||
### JFileProcessor
|
||||
|
||||
我找到的 Java 文件管理器叫做 JFileProcessor,简称 JFP。它不仅是用 Java 编写的,更具体是说是用 [Groovy][1](一种流行的 Java 脚本语言)进行的一项迷人的实践。
|
||||
|
||||
![Image of the JfileProcessor folders.][2]
|
||||
|
||||
作为文件管理器,JFileProcessor 在设计和功能上都采用了极简方式。它允许你查看、打开、移动、复制、剪切或删除本地系统和远程系统上的文件。它不是特别定制化的,它没有如拆分面板或可移动面板等额外功能。除了管理文件外,它没什么别的中心主题。JFileProcessor 在某种程度上令人耳目一新,因为它很简单。这是一个文件管理器,仅此而已。有时这就是你在文件管理器中想要的全部。
|
||||
|
||||
我之前写过关于 [设置 Java Swing 主题][3] 的方式,从技术上讲,该技术可以应用于这个开源应用。但是,我认为这个应用的部分魅力在于 OpenSolaris 称之为 “Blueprint” 的主题。这是 Java 的怀旧外观,我喜欢以其原生 GUI 外观运行它,作为对我的 OpenSolaris(现为 OpenIndiana)笔记本电脑的回忆。
|
||||
|
||||
### 用户体验
|
||||
|
||||
除了设计,真正重要的是用户体验。JFileProcessor 只有三个你日常使用的按钮:向上、后退和前进。它们未绑定到键盘快捷键,因此你必须单击按钮才能导航(或使用 `Tab` 键选择按钮)。在使用图形应用时,我经常使用键盘快捷键,所以当我尝试浏览我的系统时,这大大减慢了我的速度。但是,有时我实际上只是懒洋洋地浏览文件,因此 JFileProcessor 完全按照我的需要工作。
|
||||
|
||||
JFileProcessor 也有一个搜索组件。只要你设置合理的起始文件夹,搜索就会快速而智能,同时允许使用通配符和正则模式搜索。例如,当我搜索特定的电子书或漫画档案或游戏规则手册时,或者当我粗略地知道该目录包含一个项目但懒得一直点击到目的地址。在子目录中快速搜索,必然会得到明显的结果,然后双击打开文件,不管我设置了什么 XDG 偏好(Evince 用于 PDF,Foliate 用于电子书,等等)。
|
||||
|
||||
右键单击任何文件或目录会弹出上下文菜单。它具有你期望的大部分常见任务:复制、剪切、粘贴、删除、重命名、新建。它也有一些不错的额外功能。
|
||||
|
||||
![Right-click context menu in JFileProcessor][4]
|
||||
|
||||
例如,你可以只将文件名复制到剪贴板或保存文件路径。你还可以运行一些脚本,包括用于批量重命名文件的脚本、用于对选定文件运行命令的脚本、用于创建 ZIP 或 TAR 存档的脚本等等。当然,编码器有多种选择,包括在当前位置打开终端和打开新的编码窗口。
|
||||
|
||||
### 安装
|
||||
|
||||
我是 Java 的忠实粉丝。它是一种清晰的语言,具有合理的分隔符和对跨平台兼容性的坚定立场。我喜欢它作为一种语言,我喜欢看到程序员用它创造的东西。
|
||||
|
||||
JFileProcessor 的名字很贴切。这是一种处理文件的有效方法,从某种意义上说,JFileProcessor 为你提供了一个简单的窗口来查看系统上的文件数据,并允许你以图形方式与它们进行交互,就像你可能在终端中与它们交互一样。它不是我用过的最高效的文件管理器,也不是功能最多的一个。然而,这是一个令人愉快的应用,为你提供了文件管理所需的基本工具,其相对较小的代码库使你可以在下午阅读一些精彩的内容。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/linux-file-manager-jfileprocessor
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][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/seth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/20/12/groovy
|
||||
[2]: https://opensource.com/sites/default/files/2022-09/jfileprocessor.webp
|
||||
[3]: https://opensource.com/article/22/3/beautify-java-applications
|
||||
[4]: https://opensource.com/sites/default/files/2022-09/jfileprocessor-menu.webp
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/17/121727uuepuz1q3qhgippd.jpg
|
@ -31,7 +31,7 @@ $ sudo dnf install cinnamon-desktop
|
||||
在 Linux Mint、Debian 和类似系统上:
|
||||
|
||||
```
|
||||
$ sudo dnf install cinnamon-desktop-environment
|
||||
$ sudo apt install cinnamon-desktop-environment
|
||||
```
|
||||
|
||||
当然,作为该桌面的发源地,Linux Mint 也预装了 Cinnamon。
|
||||
|
@ -0,0 +1,125 @@
|
||||
[#]: subject: "How to Access UEFI Settings in Linux Systems"
|
||||
[#]: via: "https://itsfoss.com/access-uefi-from-linux/"
|
||||
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15361-1.html"
|
||||
|
||||
如何在 Linux 系统中访问 UEFI 设置
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
想要在固件级别检查启动顺序或电源设置? **你可以在系统启动时按 `F2`、`F10` 或 `Del` 按键访问 UEFI 设置**。
|
||||
|
||||
这种方法的问题是你可能不知道确切的键,并且必须警惕在正确的时间按下这些键。
|
||||
|
||||
![Mr. Bean][1a]
|
||||
|
||||
如果你不想像上面 Gif 中的憨豆先生,你可以从 Linux 中的 [Grub 引导加载器][1] 页面访问 UEFI 设置。
|
||||
|
||||
![uefi firmware settings grub linux][2]
|
||||
|
||||
当你打开 Linux 系统时,你会看到这个页面。Fedora 和 Ubuntu 等大多数 Linux 发行版都使用 Grub,它们允许你像这样从 Grub 页面访问 UEFI 设置。
|
||||
|
||||
如果你没有看到此页面,或你的发行版不使用 Grub 怎么办? 仍然有一些方法可以从 Linux 中访问 UEFI 设置。
|
||||
|
||||
在你了解如何操作之前,请 [确保你的系统使用的是 UEFI][3]。
|
||||
|
||||
另一件重要的事情。你的系统重启才能进入 UEFI 设置。你无法从操作系统中访问和修改固件设置。
|
||||
|
||||
### 从 Linux 启动到 UEFI 设置
|
||||
|
||||
此方法仅适用于具有 systemd 的 Linux 发行版。这意味着这种方法适用于任何基于 Ubuntu、Debian、Fedora 和任何主流的基于 Arch 的发行版,包括 Manjaro 和 EndeavourOS。
|
||||
|
||||
[确保你的 Linux 发行版使用 systemd][4] 仍然是一个好主意。使用给定的命令,如果它返回 systemd,你就可以开始了:
|
||||
|
||||
```
|
||||
ps --no-headers -o comm 1
|
||||
```
|
||||
|
||||
![how to know if i am using systemd on linux?][5]
|
||||
|
||||
当你发现你的发行版正在使用 systemd,你可以使用给定的命令启动到 UEFI 设置:
|
||||
|
||||
```
|
||||
systemctl reboot --firmware-setup
|
||||
```
|
||||
|
||||
让我首先分解使用的选项:
|
||||
|
||||
- `reboot`:顾名思义,它将重启你的系统。
|
||||
- `--firmware-setup`: 当此选项与 `reboot` 一起使用时,它会指示系统固件启动进入固件设置界面。
|
||||
|
||||
就是这样! 一个命令,你将进入 UEFI 设置。我知道 Windows 允许 [从 Windows 中启动进入 UEFI 固件设置][6]。很高兴在 Linux 中看到类似的东西。
|
||||
|
||||
#### 创建桌面快捷方式以启动到 UEFI 设置(可选)
|
||||
|
||||
如果你经常发现自己启动进入 UEFI 设置,并且不记得所有命令,你可以通过创建桌面快捷方式让你的生活更轻松。这将使你可以通过单击桌面图标启动到 UEFI。
|
||||
|
||||
不过,对于大多数 Linux 用户来说,这是不必要的,也不是必需的。只有当你觉得有必要时才去做。该方法需要 [在命令行中编辑文件][7]。
|
||||
|
||||
首先,使用给定的命令为 UEFI 设置创建桌面快捷方式文件:
|
||||
|
||||
```
|
||||
sudo nano /usr/share/applications/uefi-reboot.desktop
|
||||
```
|
||||
|
||||
并将以下内容粘贴到文件中:
|
||||
|
||||
```
|
||||
[Desktop Entry]
|
||||
Name=UEFI Firmware Setup (Reboot)
|
||||
Comment=Access the motherboard configuration utility
|
||||
Exec=systemctl reboot --firmware-setup
|
||||
Icon=system-restart
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=System;Settings;
|
||||
```
|
||||
|
||||
![create a desktop shortcut to boot into uefi settings][8]
|
||||
|
||||
完成后,[保存更改并退出 nano][9] 文本编辑器。
|
||||
|
||||
现在,你将在系统菜单中找到 UEFI 固件设置的快捷方式:
|
||||
|
||||
![boot into uefi firmware from system menu][10]
|
||||
|
||||
完成了!一种进入 UEFI 设置的巧妙方法。
|
||||
|
||||
### 总结
|
||||
|
||||
访问启动设置的经典方法对某些人来说可能有点不方便。Grub 页面可能不会显示旧版本的 UEFI 选项。
|
||||
|
||||
这就是 systemd 方法的亮点所在。当我的系统崩溃并且我的功能键没有响应时,我发现这种方法是救命稻草,这是启动到 UEFI 所必需的(我当时就是这么想的!)。
|
||||
|
||||
我希望你发现它同样有用。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/access-uefi-from-linux/
|
||||
|
||||
作者:[Sagar Sharma][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/sagar/
|
||||
[b]: https://github.com/lkxed
|
||||
[1a]: https://img.linux.net.cn/data/attachment/album/202212/19/092256nkeoyuou6h3ykud6.gif
|
||||
[1]: https://itsfoss.com/what-is-grub/
|
||||
[2]: https://itsfoss.com/wp-content/uploads/2022/12/uefi-firmware-settings-grub-linux.webp
|
||||
[3]: https://itsfoss.com/check-uefi-or-bios/
|
||||
[4]: https://linuxhandbook.com/check-if-systemd/
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/12/how-to-know-if-i-am-using-systemd-on-linux.png
|
||||
[6]: https://itsfoss.com/access-uefi-settings-windows-10/
|
||||
[7]: https://learnubuntu.com/edit-files-command-line/
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/12/create-a-desktop-shortcut-to-boot-into-uefi-settings.png
|
||||
[9]: https://linuxhandbook.com/nano-save-exit/
|
||||
[10]: https://itsfoss.com/wp-content/uploads/2022/12/boot-into-uefi-firmware-from-system-menu.png
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/19/092450oi0c0c7cp4ng2nem.jpg
|
@ -0,0 +1,88 @@
|
||||
[#]: subject: "Convert and Manipulate Images With ‘Converter’ GUI Tool in Linux"
|
||||
[#]: via: "https://itsfoss.com/converter-tool/"
|
||||
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15368-1.html"
|
||||
|
||||
在 Linux 中使用 “Converter” GUI 工具转换和操作图像
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
你可以随时在你的系统上 [安装 ImageMagick][1] 来转换图像,但并不是每个人都喜欢使用终端来转换和操作图像。
|
||||
|
||||
那么,如果你有一个 GUI 应用作为前端来帮助解决这个问题呢? **Converter** 就是这样的工具。
|
||||
|
||||
它是 ImageMagick 的前端。所以你不需要使用命令来转换和操作图像。
|
||||
|
||||
请注意,大多数 Ubuntu 系统通常都预装了 ImageMagick。如果你的系统上还没有安装,你可以随时参考我们的 [安装指南][1]。
|
||||
|
||||
### Converter:ImageMagick 的图形前端
|
||||
|
||||
![converter gui][2]
|
||||
|
||||
转换图像不应该花费很多精力。这是一项简单的任务,而且应该如此。
|
||||
|
||||
我不想键入命令来快速转换图像。因此,我更喜欢使我能够更快地做事的图形工具。
|
||||
|
||||
[Converter][3] 是一个开源图形前端,可以让你做到这点。它是一个 GTK4 + libadwaita 应用。
|
||||
|
||||
你可以将图像转换为各种文件格式,包括 png、webp、jpeg、heif、heic 和 bmp。可以肯定地说,你获得了对最流行的图像文件格式的支持。所以,它应该会派上用场。
|
||||
|
||||
![file format converter][4]
|
||||
|
||||
你可以设置一个位置来保存所有文件,转换后的图像将自动存储在该位置。
|
||||
|
||||
![customize converter][5]
|
||||
|
||||
你还可以调整图像的质量、大小和背景颜色。要访问这些选项,请在转换图像之前单击用户界面中的“<ruby>更多选项<rt>More Options</rt></ruby>”。
|
||||
|
||||
![converter more options][6]
|
||||
|
||||
可以使用百分比、精确像素或比率自定义图像大小。对于精确操作,更改尺寸可能更有用。如果你希望图像缩放到一定程度,百分比或比例功能应该可以帮助你做到这一点。你还可以选择为图像添加滤镜。
|
||||
|
||||
总体而言,你可以获得使用 Converter 调整大小、转换和优化图像质量的基本功能。
|
||||
|
||||
你还可以 [调整 Nautilus][7] 以获得 [右键单击上下文菜单中的调整大小选项][8]。但它不像这个工具那样通用。
|
||||
|
||||
### 在 Linux 上安装 Converter
|
||||
|
||||
Converter 在 [Flathub][9] 上以 Flatpak 的形式提供,可以安装在你选择的任何 Linux 发行版上。
|
||||
|
||||
遗憾的是,你无法在 Linux 系统上安装任何二进制包。因此,你可能需要参考我们的 [Flatpak 指南][10] 来安装它。
|
||||
|
||||
```
|
||||
flatpak install flathub io.gitlab.adhami3310.Converter
|
||||
```
|
||||
|
||||
你可以在其 [GitLab 页面][3] 上探索更多相关信息。
|
||||
|
||||
_你对我们接下来要重点介绍的此类有趣工具有什么建议吗? 让我们在评论中知道。_
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/converter-tool/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[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/lkxed
|
||||
[1]: https://itsfoss.com/install-imagemagick-ubuntu/
|
||||
[2]: https://itsfoss.com/wp-content/uploads/2022/12/converter-gui.png
|
||||
[3]: https://gitlab.com/adhami3310/Converter
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/12/file-format-converter.png
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/12/customize-converter.png
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/12/converter-more-options.png
|
||||
[7]: https://itsfoss.com/nautilus-tips-tweaks/
|
||||
[8]: https://itsfoss.com/resize-images-with-right-click/
|
||||
[9]: https://flathub.org/apps/details/io.gitlab.adhami3310.Converter
|
||||
[10]: https://itsfoss.com/flatpak-guide/
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/21/161705qzvydyyd8v8y3cyh.jpg
|
@ -0,0 +1,262 @@
|
||||
[#]: subject: "7 pro tips for using the GDB step command"
|
||||
[#]: via: "https://opensource.com/article/22/12/gdb-step-command"
|
||||
[#]: author: "Alexandra https://opensource.com/users/ahajkova"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "chai001125"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15362-1.html"
|
||||
|
||||
GDB 的 7 个单步调试命令
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 即使是复杂的函数,也有几种方法可以单步调试,所以下次在排除代码故障时,可以尝试一下这些 GDB 技术。
|
||||
|
||||
**调试器** 是一个可以运行你的代码并检查问题的软件。[GNU Debugger][1](GBD)是最流行的调试器之一,在这篇文章中,我研究了 GDB 的 `step` 命令和其他几种常见情况的相关命令。`step` 是一个被广泛使用的命令,但它有一些人们不太了解的地方,可能会使得他们十分困惑。此外,还有一些方法可以**在不使用 `step` 命令的情况下进入一个函数**,比如使用不太知名的 `advance` 命令。
|
||||
|
||||
### 1、无调试符号
|
||||
|
||||
考虑以下这个简单的示例程序:
|
||||
|
||||
```
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
int num() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
void bar(int i) {
|
||||
printf("i = %d\n", i);
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
bar(num());
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
如果你在没有 <ruby>调试符号<rt> debugging sysbols </rt></ruby> 的情况下进行编译(LCTT 译注:即在使用 `gcc` 编译程序时没有写 `-g` 选项),然后在 `bar` 上设置一个断点,然后尝试在这个函数内使用 `step` 来单步执行语句。GDB 会给出一个 <ruby>没有行号信息<rt> no line number information </rt></ruby> 的错误信息。
|
||||
|
||||
```
|
||||
gcc exmp.c -o exmp
|
||||
gdb ./exmp
|
||||
(gdb) b bar
|
||||
Breakpoint 1 at 0x401135
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, 0x0000000000401135 in bar ()
|
||||
(gdb) step
|
||||
Single stepping until exit from function bar,
|
||||
which has no line number information.
|
||||
i = 2
|
||||
0x0000000000401168 in main ()
|
||||
```
|
||||
|
||||
### 2、stepi 命令
|
||||
|
||||
但是你仍然可以在没有行号信息的函数内部单步执行语句,但要使用 `stepi` 命令来代替 `step`。`stepi` 一次只执行一条指令。当使用 GDB 的 `stepi` 命令时,先做 `display/i $pc` 通常很有用,这会在每一步之后**显示** <ruby>程序计数器<rt> program counter </rt></ruby> 的值和**相应的** <ruby>机器指令<rt> machine instruction </rt></ruby>:
|
||||
|
||||
```
|
||||
(gdb) b bar
|
||||
Breakpoint 1 at 0x401135
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, 0x0000000000401135 in bar ()
|
||||
(gdb) display/i $pc
|
||||
1: x/i $pc
|
||||
=> 0x401135 <bar+4>: sub $0x10,%rsp
|
||||
```
|
||||
|
||||
在上述的 `display` 命令中,`i` 代表机器指令,`$pc` 表示程序计数器寄存器(即 PC 寄存器)。
|
||||
|
||||
使用 `info registers` 命令,来**打印寄存器的内容**,也是十分有用的。
|
||||
|
||||
```
|
||||
(gdb) info registers
|
||||
rax 0x2 2
|
||||
rbx 0x7fffffffdbc8 140737488346056
|
||||
rcx 0x403e18 4210200
|
||||
(gdb) print $rax
|
||||
$1 = 2
|
||||
(gdb) stepi
|
||||
0x0000000000401139 in bar ()
|
||||
1: x/i $pc
|
||||
=> 0x401139 <bar+8>: mov %edi,-0x4(%rbp)
|
||||
```
|
||||
|
||||
### 3、复杂的函数调用
|
||||
|
||||
在带调试符号的 `-g` 选项,重新编译示例程序后,你可以使用行号在 `main` 中 `bar` 调用上设置断点,然后再单步执行 `bar` 函数的语句:
|
||||
|
||||
```
|
||||
gcc -g exmp.c -o exmp
|
||||
gdb ./exmp
|
||||
(gdb) b exmp.c:14
|
||||
Breakpoint 1 at 0x401157: file exmp.c, line 14.
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, main () at exmp.c:14
|
||||
14 bar(num());
|
||||
```
|
||||
|
||||
接下来,用 `step`,来单步执行 `bar()` 函数的语句:
|
||||
|
||||
```
|
||||
(gdb) step
|
||||
num () at exmp.c:4
|
||||
4 return 2;
|
||||
```
|
||||
|
||||
函数调用的参数需要在实际的函数调用之前进行处理,`bar()` 函数的参数是 `num()` 函数,所以 `num()` 会在 `bar()` 被调用之前执行。但是,通过 GDB 调试,你怎么才能如愿以偿地进入 `bar()` 函数呢?你可以使用 `finish` 命令,并再次使用 `step` 命令。
|
||||
|
||||
```
|
||||
(gdb) finish
|
||||
Run till exit from #0 num () at exmp.c:4
|
||||
0x0000000000401161 in main () at exmp.c:14
|
||||
14 bar(num());
|
||||
Value returned is $1 = 2
|
||||
(gdb) step
|
||||
bar (i=2) at exmp.c:9
|
||||
9 printf("i = %d\n", i);
|
||||
```
|
||||
|
||||
### 4、tbreak 命令
|
||||
|
||||
`tbreak` 命令会设置一个**临时断点**。如果你不想设置永久断点,那么这个命令是很有用的。举个例子🌰,你想进入一个复杂的函数调用,例如 `f(g(h()), i(j()), ...)`,在这种情况下,你需要一个很长的 `step/finish/step` 序列,才能到达 `f` 函数。如果你设置一个临时断点,然后再使用 `continue` 命令,这样就不需要以上的序列了。为了证明这一点,你需要像以前一样将断点设置在 `main` 的 `bar` 调用上。然后在 `bar` 上设置临时断点。当到达该临时断点后,临时断点会被自动删除。
|
||||
|
||||
```
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, main () at exmp.c:14
|
||||
14 bar(num());
|
||||
(gdb) tbreak bar
|
||||
Temporary breakpoint 2 at 0x40113c: file exmp.c, line 9.
|
||||
```
|
||||
|
||||
在调用 `bar` 的时候遇到断点,并在 `bar` 上设置临时断点后,你只需要使用 `continue` 继续运行直到 `bar` 结束。
|
||||
|
||||
```
|
||||
(gdb) continue
|
||||
Continuing.
|
||||
Temporary breakpoint 2, bar (i=2) at exmp.c:9
|
||||
9 printf("i = %d\n", i);
|
||||
```
|
||||
|
||||
### 5、disable 命令
|
||||
|
||||
类似地,你也可以在 `bar` 上设置一个正常的断点,然后执行 `continue`,然后在不再需要第二个断点时,使用 `disable` 命令禁用这个断点,这样也能达到与 `tbreak` 相同的效果。
|
||||
|
||||
```
|
||||
(gdb) b exmp.c:14
|
||||
Breakpoint 1 at 0x401157: file exmp.c, line 14.
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, main () at exmp.c:14
|
||||
14 bar(num());
|
||||
(gdb) b bar
|
||||
Breakpoint 2 at 0x40113c: file exmp.c, line 9.
|
||||
(gdb) c
|
||||
Continuing.
|
||||
Breakpoint 2, bar (i=2) at exmp.c:9
|
||||
9 printf("i = %d\n", i);
|
||||
(gdb) disable 2
|
||||
```
|
||||
|
||||
正如你所看到的,`info breakpoints` 命令在 `Enb` 列下显示为 `n`,这意味着这个断点已被禁用。但你也能在再次需要这个断点时,再启用它。
|
||||
|
||||
```
|
||||
(gdb) info breakpoints
|
||||
Num Type Disp Enb Address What
|
||||
1 breakpoint keep y 0x0000000000401157 in main at exmp.c:14
|
||||
breakpoint already hit 1 time
|
||||
2 breakpoint keep n 0x000000000040113c in bar at exmp.c:9
|
||||
breakpoint already hit 1 time
|
||||
(gdb) enable 2
|
||||
(gdb) info breakpoints
|
||||
Num Type Disp Enb Address What
|
||||
1 breakpoint keep y 0x000000000040116a in main at exmp.c:19
|
||||
breakpoint already hit 1 time
|
||||
2 breakpoint keep y 0x0000000000401158 in bar at exmp.c:14
|
||||
breakpoint already hit 1 time
|
||||
```
|
||||
|
||||
### 6、advance 命令运行程序到指定的位置
|
||||
|
||||
另一个进入函数内部的方法是 `advance` 命令。你可以简单地用 `advance bar`,来代替 `tbreak bar ; continue`。这一命令会将程序继续运行到指定的位置。
|
||||
|
||||
`advance` 命令的一个很棒的地方在于:如果程序并没有到达你试图进入的位置,那么 GDB 将在当前函数运行完成后停止。因此,程序的执行会受到限制:
|
||||
|
||||
```
|
||||
Breakpoint 1 at 0x401157: file exmp.c, line 14.
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, main () at exmp.c:14
|
||||
14 bar(num());
|
||||
(gdb) advance bar
|
||||
bar (i=2) at exmp.c:9
|
||||
9 printf("i = %d\n", i);
|
||||
```
|
||||
|
||||
### 7、skip 命令
|
||||
|
||||
进入 `bar` 函数的另一种方式是使用 `skip num` 命令:
|
||||
|
||||
```
|
||||
(gdb) b exmp.c:14
|
||||
Breakpoint 1 at 0x401157: file exmp.c, line 14.
|
||||
(gdb) skip num
|
||||
Function num will be skipped when stepping.
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, main () at exmp.c:14
|
||||
14 bar(num());
|
||||
(gdb) step
|
||||
bar (i=2) at exmp.c:9
|
||||
9 printf("i = %d\n", i);
|
||||
```
|
||||
|
||||
请使用 `info skip` 命令,来了解 GDB 跳过了哪些函数。`num()` 函数被标记为 `y`,表示跳过了 `num()` 函数:
|
||||
|
||||
```
|
||||
(gdb) info skip
|
||||
Num Enb Glob File RE Function
|
||||
1 y n <none> n num
|
||||
```
|
||||
|
||||
如果不再需要 `skip`,可以禁用(并稍后重新启用)或完全删除它。你可以添加另一个 `skip`,并禁用第一个 `skip`,然后全部删除。要禁用某个 `skip`,必须指定其编号(例如,`skip disable 1`),如果没有指定,则会禁用所有的 `skip`。启用或删除 `skip` 的工作原理相同:
|
||||
|
||||
```
|
||||
(gdb) skip bar
|
||||
(gdb) skip disable 1
|
||||
(gdb) info skip
|
||||
Num Enb Glob File RE Function
|
||||
1 n n <none> n num
|
||||
2 y n <none> n bar
|
||||
(gdb) skip delete
|
||||
(gdb) info skip
|
||||
Not skipping any files or functions.
|
||||
```
|
||||
|
||||
### GDB 的 step 命令
|
||||
|
||||
使用 GDB 的 `step` 命令是调试程序的一个有用工具。即使是复杂的函数,也有几种方法可以单步调试这些函数,所以下次你在排除代码问题的时候,可以尝试一下这些 GDB 技术。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/gdb-step-command
|
||||
|
||||
作者:[Alexandra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[chai001125](https://github.com/chai001125)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/ahajkova
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/21/3/debug-code-gdb
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/19/093831nrjrmozx1mixmgii.jpg
|
@ -0,0 +1,146 @@
|
||||
[#]: subject: "Linux Kernel 6.1 Released With Initial Rust Code"
|
||||
[#]: via: "https://news.itsfoss.com/linux-kernel-6-1-release/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15343-1.html"
|
||||
|
||||
Linux 内核 6.1 发布,包含初始 Rust 支持
|
||||
======
|
||||
|
||||
> Linux 内核 6.1 现在可以使用了!考虑到这是今年最后一个稳定版本,它有可能是 LTS 版本。
|
||||
|
||||
![Linux 内核 6.1 发布,包含初始 Rust 支持][1]
|
||||
|
||||
Linux 内核 6.1 终于来了,它以改进和支持新硬件的形式为我们提前带来了节日礼物。🎄
|
||||
|
||||
它是在 Linux 内核 6.0 发布的几个月后出现的,当时的命名方案从 5.x.x 改为 6.x,以减少小版本号太多带来的混乱。
|
||||
|
||||
像往常一样,今年的最后一个内核版本 **可能被作为一个长期发布的版本**,从而得到几年的支持。
|
||||
|
||||
Linux 内核 6.1 如约带来了许多改进,并初步支持了 AMD 和英特尔尚未发布的硬件。
|
||||
|
||||
在发布公告中,Linus Torvalds 提到:
|
||||
|
||||
> 所以到现在,我们晚了一个星期,不过上周已经没那么紧迫了,而且很顺利,我对 6.1 的状态要比几个星期前感到放心多了,当时似乎还比较紧迫。当然,这意味着现在我们有一个可怕的合并窗口,就在节日假期之前,而且我也有一些节前的旅行要安排。因此,虽然推迟一周是正确的做法,但它确实使 6.2 合并窗口的时间变得很尴尬。
|
||||
|
||||
他进一步补充说,考虑到每个人都应该过一个平静的假日季,他将会更严格的对合并窗口的规则进行要求。
|
||||
|
||||
### 🆕 Linux 内核 6.1 有什么新内容?
|
||||
|
||||
在这个版本中,我们看到了各种变化,例如改进了对 ARM SoC 的支持,初步支持英特尔即将推出的 Meteor Lake CPU,以及 AMD 的 RDNA 3 GPU。
|
||||
|
||||
你可以在其 [公告][2] 中找到更多技术细节。
|
||||
|
||||
#### 对 Rust 的实验性支持
|
||||
|
||||
![linux 6.1 rust][3]
|
||||
|
||||
虽然我们预计这将发生在 Linux 内核 6.0,但它在 Linux 内核 6.1 中才出现,这将允许开发者用 Rust 编写内核代码。
|
||||
|
||||
#### 英特尔 Meteor Lake 的启用
|
||||
|
||||
![英特尔][4]
|
||||
|
||||
英特尔的开源开发者一直在努力工作,为即将到来的 Meteor Lake 芯片提供初步支持。
|
||||
|
||||
它被称为英特尔的第一个 7 纳米微架构,开发人员已经向 DRM-next 推送了各种提交。
|
||||
|
||||
这些包括各种固件提交,对 Meteor Lake CPU 及其集成 GPU 的初步支持。
|
||||
|
||||
#### 对 AMD RDNA 3 图形的初始支持
|
||||
|
||||
![AMD][5]
|
||||
|
||||
这段时间,AMD 一直在为 Linux 内核 6.1 添加 RDNA 3 图形架构的代码。
|
||||
|
||||
这包括对他们即将推出的 GPU 的支持和对他们之前的 GPU 产品的各种修复。
|
||||
|
||||
你可以通过 [这里][6] 查看完整的补丁列表。
|
||||
|
||||
#### 对 AMD 电脑的优化
|
||||
|
||||
![优化 AMD][7]
|
||||
|
||||
AMD PMF(AMD 平台管理框架)已经被引入这个内核版本。
|
||||
|
||||
该驱动旨在为 AMD PC 更安静、更高效的运行提供支持。
|
||||
|
||||
它利用板载传感器与 AMD 的各种热能和功率内核驱动来实现这一目标。
|
||||
|
||||
#### 改进的 ARM SoC 支持
|
||||
|
||||
![arm soc][8]
|
||||
|
||||
Linux 内核 6.1 带来了对 ARM SoC 的更多支持,例如:
|
||||
|
||||
- 联发科 MT8186
|
||||
- 德州仪器 AM62A
|
||||
- 恩智浦 i.MX8DXL
|
||||
- 高通 IPQ8064 的各种变体
|
||||
|
||||
该内核还对一些智能手机提供了支持,如 PINE64 PinePhone Pro、索尼 Xperia 1 IV 和三星 Galaxy E5/E7/Grand Max。
|
||||
|
||||
#### 存储的改进
|
||||
|
||||
内核在存储方面有很多改进。
|
||||
|
||||
例如,Btrfs 在这次更新中带来了异步缓冲写入,提供了超过 2 倍的吞吐量。
|
||||
|
||||
然后是对 EXT4 的改进,包括性能优化和一些错误修复。
|
||||
|
||||
与此同时,[EROFS][9] 为 Linux 内核 6.1 引入了基于 FSCache 的共享域支持。
|
||||
|
||||
#### 🛠️ 其他改进措施
|
||||
|
||||
这些并不是 Linux 内核 6.1 提供的唯一改进,以下是其他一些值得注意的改进:
|
||||
|
||||
- 对微软 Surface Pro 9 和 Surface Laptop 5 的支持。
|
||||
- 启用 AMD Zen 4 LbrExtV2。
|
||||
- AMD CPU “缓存到缓存”和内存报告功能。
|
||||
- 引入 AMD IOMMU v2。
|
||||
- 为 Wi-Fi 802.11be/Wi-Fi 7 做准备。
|
||||
|
||||
### 如何安装 Linux 内核 6.1?
|
||||
|
||||
如果你使用基于 Arch 的发行版或 Fedora,你可以轻松升级。
|
||||
|
||||
不幸的是,如果你使用其他 Linux 发行版(Pop!_OS 和 Linux Lite 在某种程度上可以是个例外),你可能无法直接从发行版中获得升级。
|
||||
|
||||
然而,几乎所有的 Linux 发行版都明确地允许你安装最新的内核。这里有一个关于 Ubuntu 的指南👇
|
||||
|
||||
> **[如何在 Ubuntu 中安装最新的主线 Linux 内核版本](https://itsfoss.com/upgrade-linux-kernel-ubuntu/)**
|
||||
|
||||
所以,如果你乐于冒险(并且知道自己在做什么),你可以在 [Linux 内核档案][10] 上找到列出的较新的内核。你可以下载 [tarball][11] 来测试它。
|
||||
|
||||
然而,像往常一样,如果你不想冒任何风险,我们建议等待你的 Linux 发行版推送更新。最好是坚持使用你的 Linux 发行版默认提供的东西。
|
||||
|
||||
> **[下载 Linux 6.1][12]**
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/linux-kernel-6-1-release/
|
||||
|
||||
作者:[Sourav Rudra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/sourav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2022/12/linux-kernel-6-1-release.png
|
||||
[2]: https://lore.kernel.org/lkml/CAHk-=wj_HcgFZNyZHTLJ7qC2613zphKDtLh6ndciwopZRfH0aQ@mail.gmail.com/T/#u
|
||||
[3]: https://news.itsfoss.com/content/images/2022/12/linux-6-1-rust.png
|
||||
[4]: https://news.itsfoss.com/content/images/2022/12/intel-meteor.png
|
||||
[5]: https://news.itsfoss.com/content/images/2022/12/amd-rdna-3.png
|
||||
[6]: https://lists.freedesktop.org/archives/dri-devel/2022-September/373430.html
|
||||
[7]: https://news.itsfoss.com/content/images/2022/12/amd-rdna-3--1-.png
|
||||
[8]: https://news.itsfoss.com/content/images/2022/12/amd-rdna-3--2-.png
|
||||
[9]: https://en.wikipedia.org/wiki/EROFS
|
||||
[10]: https://www.kernel.org/
|
||||
[11]: https://git.kernel.org/torvalds/t/linux-6.1.tar.gz
|
||||
[12]: https://www.kernel.org
|
@ -0,0 +1,229 @@
|
||||
[#]: subject: "5 Best Linux Phones to Watch Out for in 2023"
|
||||
[#]: via: "https://www.debugpoint.com/best-linux-phones/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "chai001125"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15371-1.html"
|
||||
|
||||
2023 年值得期待的 5 款最佳 Linux 手机
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 以下是一份可能在 2023 年成为主流的最佳 Linux 手机榜单,并介绍了各个 Linux 手机的特点和价格。
|
||||
|
||||
安卓和 iOS 智能手机是世界上最流行的手机。然而,还有许多人都想要更“开放”、且**在隐私方面做得更好的手机**。如果你使用安卓手机,那么你就是放弃了你的隐私。在个人隐私保护方面,苹果的 iOS 手机表现得要好一点,但它也仅提供了有限的隐私保护。
|
||||
|
||||
这就是现在 Linux 手机变得很流行的原因,因为它们为开发者和终端用户提供了许多选择。虽然目前有各种类型的 Linux 手机,但是要选择最好的 Linux 手机仍然令人困惑。从 2022 年的趋势来看,以下是一些可能在 2023 年成为主流的 Linux 手机。
|
||||
|
||||
### 关于 Linux 手机,你需要知道的事情
|
||||
|
||||
当你浏览或者计划购买一部 Linux 手机之前,你应该先了解以下关于 Linux 手机的事情:
|
||||
|
||||
- Linux 手机使用的是主流 Linux 发行版的修改版,它有一个适合手机的桌面环境。这对今天的大多数手机(例如安卓、苹果 iOS)来说,也是类似的。
|
||||
- 如果你打算买一部 Linux 手机,并将其作为你日常所使用的手机的话,请不要太期待这个 Linux 手机。因为 Linux 手机的操作系统、功能和应用生态系统仍处于早期发展阶段,远远比不上与安卓或 iOS 手机。
|
||||
- 然而,Linux 手机的操作系统提供了最好的隐私功能,这会成为你想要出手买一部 Linux 手机的原因。
|
||||
|
||||
### 最好的 Linux 手机
|
||||
|
||||
#### 1、Librem🥇
|
||||
|
||||
**Purism** 公司是 Linux 手机市场上一个相当著名的品牌。Purism 公司推出的 **Librem 5 Linux** 智能手机支持 **PureOS**。PureOS 是一个专为 Linux 手机设计的操作系统,不基于安卓或 iOS 系统,它是一个原生设计的自由开源的操作系统;它还支持 <ruby>融合<rt> convergence </rt></ruby>,这意味着你可以通过 USB 集线器将手机插入电脑显示器,并将其作为一个桌面操作系统使用🆒。
|
||||
|
||||
这款手机拥有优质的硬件和手感,还十分注重安全和隐私。但是,这款令人印象深刻的智能手机价格有点贵,售价为 1299 美元💔。
|
||||
|
||||
Librem 5 Linux 的主要特点和规格:
|
||||
|
||||
- 完全的自由开源,基于 Linux 的移动操作系统:PureOS
|
||||
- 拥有独立的调制解调器、Wi-Fi 和蓝牙芯片
|
||||
- 拥有 3 个专门的硬件键,来启用和禁用互联网、相机、Wi-Fi 和蓝牙
|
||||
- 拥有智能卡读卡器
|
||||
- 拥有 SD 卡读卡器
|
||||
- 电池可更换
|
||||
|
||||
![Librem 5][1]
|
||||
|
||||
| 规格 | 描述 |
|
||||
| :- | :- |
|
||||
| **屏幕** | 5.7 英寸(IPS TFT 720×1440) |
|
||||
| **内存** | 3 GB |
|
||||
| **存储** | 32 GB eMMC |
|
||||
| **电池容量** | 4500 mAh |
|
||||
| **CPU** | NXP i.MX 8M QUAD CORE Cortex-A53(四核),64 位 ARM,最高主频为 1.5GHz |
|
||||
| **GPU** | Vivante GC7000 Lite |
|
||||
| **屏幕** | 5.7 英寸,IPS TFT,720×1440 像素 |
|
||||
| **摄像头** | 带 LED 闪光灯的 1300 万像素(后置)摄像头和 800 万像素(前置)摄像头 |
|
||||
| **USB 接口** | Type C 接口 |
|
||||
|
||||
有点兴趣?你可以进一步浏览 [Librem 5 的购买官网][2]。
|
||||
|
||||
#### 2、Pinephone🥈
|
||||
|
||||
Linux 手机榜单的第 2 名是 **Pinephone**。Pinephone 也许是市场上最完善、最实用的 Linux 手机了。它由 **Pine64** 公司开发,具有出色的功能,并是支持多种 Linux ARM 的移动发行版。
|
||||
|
||||
此外,PinePhone 同时有很多个版本,其中包括专业版本。PinePhone 的价格比较便宜,并且十分注重用户的隐私和可扩展性,如果你是第一次使用 Linux 手机,PinePhone 将会是一个不错的选择😌。
|
||||
|
||||
Pinephone 的主要特点和规格:
|
||||
|
||||
- 支持的操作系统有 KDE Plasma mobile、Manjaro mobile、Sailfish OS 和 Ubuntu touch。
|
||||
- 配备启用和禁用 LTE、摄像头、Wifi/BT 和麦克风的 5 个开关
|
||||
- 可启动的 microSD 和 16GB/32GB eMMC 的内存空间
|
||||
- Type C 接口(可用于电源、数据和视频输出)
|
||||
- 拥有 6 个 Pogo 引脚,允许自定义硬件扩展,如热像仪、无线充电、NFC、扩展电池盒或键盘盒。
|
||||
- 拥有 3.5 毫米耳机插孔
|
||||
- 支持融合,可将其插到一台电脑上
|
||||
- 价格实惠,2 种型号的售价分别为 149 美元和 199 美元起
|
||||
|
||||
![Pinephone][3]
|
||||
|
||||
| 规格 | 描述 |
|
||||
| :- | :- |
|
||||
| **屏幕** | 5.95 英寸,高清 IPS 电容式触摸屏 |
|
||||
| **CPU** | Allwinner A64 ARM QUAD Core Cortex-A53(四核),64 位 |
|
||||
| **GPU** | Mali-400 MP2 |
|
||||
| **内存** | 2 种型号:2GB 和 3GB LPDDR3 SDRAM |
|
||||
| **存储** | 2 种型号:16GB and 32GB eMMC |
|
||||
| **摄像头** | 500 万像素、1/4英寸、LED 闪光灯(后置)摄像头和 200 万像素、1/5英寸(前置)摄像头 |
|
||||
| **电池** | 锂离子电池(容量为 2800 mAh) |
|
||||
| **音频插孔** | 3.5 毫米 |
|
||||
|
||||
想要入手你的第一部 Linux 手机?请进一步浏览 [Pinephone 的购买官网][4] 吧。
|
||||
|
||||
#### 3、Pro 1 X – F(X)tec🥉
|
||||
|
||||
[**Pro 1 X** – F(X)tec][5] 是一款提供各种操作系统选择的智能手机,因此它是 Linux 手机榜单中十分令人激动的一项产品。
|
||||
|
||||
Pro 1 X **支持各种操作系统**,例如 LineageOS、安卓、Ubuntu Touch 等。此外,一个**内置的滑出式键盘**使它看起来更加独特且十分有吸引力。
|
||||
|
||||
Pro 1 X 由伦敦的 **F(x)tec** 公司开发。它是 Linux 手机市场上新出的产品,很有前景。然而,这个手机还没有上市,计划在 2022 年 12 月开始发货。因此,你可能需要等待几天,才能看到别人对这部手机的评价。
|
||||
|
||||
![Pro 1 X][6]
|
||||
|
||||
Pro 1 X 的主要特点和规格:
|
||||
|
||||
- 首款基于 Linux 的、有内置滑出式的 QUERTY 键盘的智能手机
|
||||
- 支持 Ubuntu touch 操作系统,并有安卓选项
|
||||
- 已解锁的启动程序
|
||||
- 拥有 3.5 毫米耳机插孔
|
||||
- 拥有 AMOLED 显示屏
|
||||
- 128 GB 存储/6 GB 内存:售价为 829 美元起
|
||||
- 256 GB 存储/8 GB 内存:售价为 899 美元起
|
||||
|
||||
| 规格 | 描述 |
|
||||
| :- | :- |
|
||||
| **CPU** | Snapdragon 662 Qualcomm |
|
||||
| **GPU** | Adreno 610 Qualcomm |
|
||||
| **内存** | 2 种型号:6GB 和 8GB LPDDR4 |
|
||||
| **存储** | 128 GB(可扩展至 2 TB) |
|
||||
| **屏幕** | 5.99英寸,弧形边缘,Corning® Gorilla® Glass 3(分辨率为 2160 x 1080 像素的 AMOLED 显示屏) |
|
||||
| **摄像头** | 1200 万像素 Sony IMX363(后置)摄像头和800万像素(前置)摄像头 |
|
||||
| **电池容量** | 3200 mAh |
|
||||
| **音频插孔** | 3.5 毫米 |
|
||||
|
||||
它的内置滑出式键盘是否吸引了你?去 [pro 1 x 的购买官网][5] 看看吧。
|
||||
|
||||
#### 4、Volla Phone
|
||||
|
||||
[Volla Phone][7] 可以同时运行**两个操作系统:Ubuntu Touch 和 VollaOS**。
|
||||
|
||||
VollaOS 是一个安卓操作系统的修改版,没有谷歌专有的部分,同时也很注重用户的隐私;Ubuntu Touch 是一个流行的 Linux 手机发行版。
|
||||
|
||||
Volla Phone 的主要特点和规格:
|
||||
|
||||
- 没有谷歌专有部分及其服务
|
||||
- 不依赖云计算
|
||||
- 加密的设备存储
|
||||
- 使用安卓操作系统的修改版:Volla OS
|
||||
- 支持的操作系统有 Ubuntu Touch,Manjaro,Sailfish OS
|
||||
- 拥有 USB C 充电口
|
||||
- 拥有 3.5 毫米耳机插孔
|
||||
- 可以用指纹解锁
|
||||
- 拥有离线地图
|
||||
|
||||
![Volla Phone][8]
|
||||
|
||||
| 规格 | 描述 |
|
||||
| :- | :- |
|
||||
| **CPU** | MediaTek Helio P23 |
|
||||
| **GPU** | ARM Mali-G71 MP2 |
|
||||
| **内存** | 4 GB DDR3 RAM |
|
||||
| **存储** | 64 GB,eMMC |
|
||||
| **屏幕** | 6.3 英寸,IPS,2340×1080 像素 |
|
||||
| **摄像头** | 1600万像素带闪光灯的(后置)摄像头和1600万像素(前置)摄像头 |
|
||||
| **电池容量** | 4700 mAh |
|
||||
| **USB 接口** | Type C 接口和 3.5 毫米音频插孔 |
|
||||
|
||||
这个手机看起来也很不错呢,不妨到 [Volla 的购买官网][9] 看看吧。
|
||||
|
||||
#### 5、Fairphone 4
|
||||
|
||||
[Fairphone 4][10] 是另一款具有模块化硬件的 Linux 智能手机。它支持 PostmarketOS 操作系统,并使用安卓操作系统的修改版本:FairPhone OS。这个手机的主要卖点是它的 <ruby>模块化<rt> modularity </rt></ruby>,你可以替换手机的任何模块:你可以毫不费力地更换它的电池🔋;此外,不仅仅是更换电池,你还可以简单地用螺丝刀来更换它的显示屏等部件。
|
||||
|
||||
![][14]
|
||||
|
||||
Fairphone 4 的规格:
|
||||
|
||||
| 规格 | 描述 |
|
||||
| :- | :- |
|
||||
| **CPU** | Octa-Core Kryo 570(八核) |
|
||||
| **内存** | 2 种型号:6GB 和 8GB |
|
||||
| **存储** | 2 种型号:128GB 和 256GB |
|
||||
| **GPU** | Adreno 619 |
|
||||
| **屏幕** | 6.3 英寸,全高清,IPS |
|
||||
| **摄像头** | 2 个 4800 万像素(后置)摄像头和 2500 万像素(前置)摄像头 |
|
||||
| **电池** | 锂离子电池(容量为 3905 mAh)|
|
||||
| **芯片组** | Qualcomm SM7225 Snapdragon 750G |
|
||||
|
||||
进一步可浏览 [FairPhone 的购买官网][11]。
|
||||
|
||||
#### 是否有支持 Linux 操作系统的主流安卓手机呢?
|
||||
|
||||
如果你不想购买上述现成的 Linux 手机,那么你也可以在**安卓手机**上使用 Linux 移动操作系统,因为安卓是基于 Linux 内核上修改的。因此,这些手机应该也能使用 Ubuntu Touch 或 PostmarketOS 操作系统。
|
||||
|
||||
- Google Pixel 3a/3a XL
|
||||
- Sony Xperia X (F5121 & F5122)
|
||||
- Google Nexus 5
|
||||
- OnePlus One
|
||||
- 支持 Ubuntu Touch OS 操作系统的 [完整列表][12]
|
||||
- Xiaomi Redmi 2
|
||||
- Xiaomi Mi Note 2
|
||||
- OnePlus GT
|
||||
- OnePlus 6
|
||||
- 支持 PostmarketOS 操作系统的 [完整列表][13]
|
||||
|
||||
### 结语
|
||||
|
||||
以上就是关于如今市场上最好的 Linux 手机的全部内容了。你可以从这些手机的官方网站上了解更多信息。因为手机的隐私保护在当下变得越来越重要了,我相信在未来会有越来越多的人使用 Linux 手机。
|
||||
|
||||
诚然,Linux 手机本身的功能及其操作系统比不上安卓和苹果 iOS 手机。但是,对于 Linux 手机来说,更重要的是它的标准的设立、全球购买的可行性、在这一新兴市场的低入门价格以及对 Linux 手机应用生态系统的大力投资。在 Linux 手机的生态系统中需要更简化的界面,没有简单的界面,Linux 手机将变得更加零散,就像台式机一样。Linux 手机的制造商还需要和自由及开源软件(FOSS)参与者一起合作,最终才能使 Linux 手机广受欢迎。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/best-linux-phones/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[chai001125](https://github.com/chai001125)
|
||||
校对:[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/lkxed
|
||||
[1]: https://www.debugpoint.com/wp-content/uploads/2022/12/Librem-5-image2.jpg
|
||||
[2]: https://puri.sm/products/librem-5/
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/12/Pinephone.jpg
|
||||
[4]: https://pine64.com/product-category/pinephone
|
||||
[5]: https://www.fxtec.com/pro1x
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2022/12/Pro-1-X.jpg
|
||||
[7]: https://volla.online/de/index.html
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2022/12/Volla-Phone.jpg
|
||||
[9]: https://volla.online/de/shop/
|
||||
[10]: https://shop.fairphone.com/en/buy-fairphone-4
|
||||
[11]: https://shop.fairphone.com/
|
||||
[12]: https://devices.ubuntu-touch.io/
|
||||
[13]: https://wiki.postmarketos.org/wiki/Devices
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/22/145904l88upudto8u7y3ui.jpg
|
||||
[14]: https://img.linux.net.cn/data/attachment/album/202212/22/150220zuowaoguya3azajw.jpg
|
109
published/20221213.3 ⭐️ Linux Mint Upgrade Tool Usage Guide.md
Normal file
109
published/20221213.3 ⭐️ Linux Mint Upgrade Tool Usage Guide.md
Normal file
@ -0,0 +1,109 @@
|
||||
[#]: subject: "Linux Mint Upgrade Tool: Usage Guide"
|
||||
[#]: via: "https://www.debugpoint.com/mint-upgrade-tool/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15372-1.html"
|
||||
|
||||
Linux Mint 升级工具使用指南
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 以下是如何使用 Mint 升级工具升级到新的 Linux Mint 版本,即带有实际升级过程截图的 mintupgrade GUI。
|
||||
|
||||
如果你正在寻找最近发布的 **Linux Mint 21 Vanessa** 的**详细升级**步骤,请阅读本指南👉
|
||||
|
||||
> **[从 Linux Mint 20.3 升级到 21][1]**
|
||||
|
||||
### Linux Mint 升级工具
|
||||
|
||||
Linux Mint 团队 [宣布][2] 在几个月前,他们构建了一个新的程序来升级 Linux Mint 的主要版本。它被称为 “mintupgrade2”。现在开发已经完成,目前正在支持和计划升级到主要版本,例如 Linux Mint 20 到 21,而不是小版本升级。
|
||||
|
||||
尽管你可以使用标准的 `apt` 命令升级版本,但 Mint 团队认为重大版本升级是棘手的。新用户很难进行无缝升级,因为它涉及终端和一系列复杂的命令步骤。
|
||||
|
||||
此外,该图形界面是一个封装器,为 `mintupgrade` 程序带来了更多功能,它带来了一组系统前检查和带有一键修复的升级过程。
|
||||
|
||||
此外,`mintupgrade` 会进行基本检查,比如你是否连接到电源、系统是否是最新的、磁盘空间可用性等。
|
||||
|
||||
为了向你展示它的外观和工作情况,我们安装了一台 LMDE 4 测试机测试。
|
||||
|
||||
但在此之前,看一下它的功能集:
|
||||
|
||||
- 完全由 GUI 驱动的升级过程
|
||||
- 多语言支持
|
||||
- 升级前检查:系统备份、电源、磁盘空间、已删除包列表
|
||||
- 可配置
|
||||
- 提醒你有关先前版本中的孤儿包
|
||||
- 它为你提供了解决问题的选项
|
||||
|
||||
### 它如何运作
|
||||
|
||||
当我们通过命令 `mintupgrade` 运行 Mint 升级程序时,GUI 友好的欢迎屏幕为你提供了一个很好的起点并开始升级过程。然后,它开始自己进行一系列检查。
|
||||
|
||||
![开始升级过程][3]
|
||||
|
||||
除此之外,当它在你的系统中发现问题时,它会停止并为你提供足够的详细信息。单击“<ruby>修复<rt>Fix</rt></ruby>”后,它可以再次恢复该过程。
|
||||
|
||||
不止如此,如果由于网络或互联网或任何其他问题而中断,它可以恢复升级过程。
|
||||
|
||||
这个程序在我们的测试过程中在我们的测试系统中发现了以下错误,并且只需单击一下即可修复它们。
|
||||
|
||||
![Apt 缓存检查][4]
|
||||
|
||||
![Mint Upgrade 检测到系统快照不存在][5]
|
||||
|
||||
![检查孤立包][6]
|
||||
|
||||
![升级前状态][7]
|
||||
|
||||
![Mint Upgrade 可以检测需要降级的包][8]
|
||||
|
||||
最后,我们成功地将测试系统从 LMDE 4 升级到 LMDE 5。
|
||||
|
||||
![升级完成][9]
|
||||
|
||||
#### 如何获取此升级程序
|
||||
|
||||
使用以下命令可以轻松安装该程序。但是,如果你正在运行最新版本的 Linux Mint 21,它应该已经安装并尝试从终端运行 mintupgrade。
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
```
|
||||
|
||||
```
|
||||
sudo apt install mintupgrade
|
||||
```
|
||||
|
||||
### 结束语
|
||||
|
||||
最后,我认为它是 Linux Mint 团队最好的程序之一。正如你在上面看到的,它自己处理了许多错误。我所做的只是单击“修复”按钮。该程序足够智能,可以了解所有故障点并采取补救措施。
|
||||
|
||||
> **[GitHub 上的 mintupgrade 源码][10]**
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/mint-upgrade-tool/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/upgrade-linux-mint-21-from-20-3/
|
||||
[2]: https://www.debugpoint.com/2022/04/linux-mint-21-announcement/
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/04/Starting-the-upgrade-process.jpg
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2022/04/Apt-Cache-check.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2022/04/Mint-Upgrade-detects-that-system-snapshots-not-present.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2022/04/Check-for-Orphan-Packages.jpg
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2022/04/Status-before-upgrade.jpg
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2022/04/Mint-Upgrade-can-detect-the-packages-require-downgrade.jpg
|
||||
[9]: https://www.debugpoint.com/wp-content/uploads/2022/04/Upgrade-Complete.jpg
|
||||
[10]: https://github.com/linuxmint/mintupgrade
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202212/22/152601upz4gujhajauj5rj.jpg
|
@ -0,0 +1,85 @@
|
||||
[#]: subject: "Pulsar: A Community-Led Open Source Code Editor to Continue the Legacy of Atom"
|
||||
[#]: via: "https://news.itsfoss.com/pulsar-editor/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15356-1.html"
|
||||
|
||||
Pulsar:一个由社区主导的以继承 Atom 的开源代码编辑器
|
||||
======
|
||||
|
||||
> Pulsar 的目标是成为 Atom 的替代品,随着其开发的进一步深入,将挑战 Visual Studio Code。
|
||||
|
||||
![Pulsar:一个由社区领导的开源代码编辑器,以延续 Atom 遗志][1]
|
||||
|
||||
微软决定杀死 Atom 文本编辑器,以支持 Visual Studio Code,这并不奇怪。
|
||||
|
||||
如果你不知道,你可以看一下我们以前的报道:
|
||||
|
||||
> [为了支持微软 VS Code,微软的 GitHub 正在扼杀 GitHub 的 Atom 编辑器][5]
|
||||
|
||||
虽然你可能有了更好的选择,但曾经流行的 Atom 是一个令人印象深刻的工具。
|
||||
|
||||
**它有一个可用的社区构建版**;然而,还有一个新的版本(**Pulsar**),旨在实现与原始 Atom 对等的功能,并引入现代功能和更新架构。
|
||||
|
||||
根据它的文档,原来开发 Atom 社区版的团队现在参与创建了 Pulsar。他们之所以做一个独立的复刻版本,是因为项目的目标不同。
|
||||
|
||||
**Pulsar** 希望将一切现代化,以成为 Atom 的继承者。
|
||||
|
||||
> 💡 Pulsar 是一个新项目,作为 Atom 的新复刻,有开发/测试版本可供测试。
|
||||
|
||||
### Pulsar 编辑器看起来怎么样?
|
||||
|
||||
![Pulsar 编辑器][2]
|
||||
|
||||
当然,用户界面也是大同小异。考虑到 Pulsar 还没有一个稳定的版本,看起来有时会显得有些混淆。
|
||||
|
||||
然而,文档、软件包以及从 Git 仓库安装软件包的能力等基本要素看起来都已具备。
|
||||
|
||||
根据官方网站的介绍,Pulsar 的主要功能亮点包括:
|
||||
|
||||
- 跨平台支持(Linux、macOS 和 Windows)
|
||||
- 内置的软件包管理器
|
||||
- 智能自动补全
|
||||
- 文件系统浏览器
|
||||
- 多窗格的用户界面
|
||||
- 查找和替换功能
|
||||
|
||||
在写这篇文章时,Pulsar 还不能自动更新。你可以通过官方网站安装较新的版本。
|
||||
|
||||
![Pulsar 编辑器设置][3]
|
||||
|
||||
你可以自定义编辑器、改变键盘绑定、管理软件包、应用主题,并通过所有可用选项配置你的体验。
|
||||
|
||||
到目前为止,要说 Pulsar 是否会比 Atom 社区版更好还为时过早。然而,这是我们可以关注的事情。
|
||||
|
||||
### 下载并试用 Pulsar
|
||||
|
||||
如前所述,Pulsar 正处于早期开发阶段。因此,你可以找到用于 Linux 发行版的二进制文件和 AppImage 文件,你可以在任何发行版上试用。
|
||||
|
||||
在我的测试中,它 **在 Linux Mint 不能正常运行**,但在 **Ubuntu 22.04 LTS** 上工作良好。
|
||||
|
||||
你可以到它的 [官方下载页面][4] 去获取你的系统所需的软件包,并进行测试。
|
||||
|
||||
> **[Pulsar 编辑器][4]**
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/pulsar-editor/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2022/12/pulsar-hackable-text-editor.png
|
||||
[2]: https://news.itsfoss.com/content/images/2022/12/pulsar-editor.png
|
||||
[3]: https://news.itsfoss.com/content/images/2022/12/pulsar-editor-settings.png
|
||||
[4]: https://pulsar-edit.dev/download.html#releases
|
||||
[5]: https://news.itsfoss.com/atom-being-discontinued/
|
138
published/20221215.5 ⭐️ XFCE 4.18 Release Looks Impressive!.md
Normal file
138
published/20221215.5 ⭐️ XFCE 4.18 Release Looks Impressive!.md
Normal file
@ -0,0 +1,138 @@
|
||||
[#]: subject: "XFCE 4.18 Release Looks Impressive!"
|
||||
[#]: via: "https://news.itsfoss.com/xfce-4-18-release/"
|
||||
[#]: author: "Jacob Crume https://news.itsfoss.com/author/jacob/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "wxy"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15355-1.html"
|
||||
|
||||
Xfce 4.18 版本发布:令人印象深刻
|
||||
======
|
||||
|
||||
> Xfce 4.18 已发布,添加了一些有趣的功能和细微的变化。
|
||||
|
||||
![Xfce 4.18 版本看起来令人印象深刻!][1]
|
||||
|
||||
Xfce 是目前最好的桌面环境之一。它因其简单性而受欢迎,是一个轻量级的选择。
|
||||
|
||||
不像其他桌面环境,你不会看到 Xfce 定期的添加功能。所以,等待升级总是令人兴奋的。
|
||||
|
||||
Xfce 4.18 是最新的版本,它增加了一些有用的功能和其他技术改进。让我重点介绍一下。
|
||||
|
||||
### Xfce 4.18 的新变化
|
||||
|
||||
![Xfce 4.18 有新的默认壁纸][2]
|
||||
|
||||
虽然这不是一个完整的变化列表,但其中一些比较明显的变化包括:
|
||||
|
||||
- 文件管理器的改进。
|
||||
- 桌面和面板的变化。
|
||||
- 更多的设置。
|
||||
- 新的壁纸。
|
||||
|
||||
#### 文件管理器的改进
|
||||
|
||||
![Xfce 4.18 文件管理器的分割视图][3]
|
||||
|
||||
Xfce 的默认文件管理器 Thunar 在这个版本中得到了相当多的改变。作为许多 Linux 用户的最爱,Thunar 有一个干净直观的用户界面,使其对不同技能水平的人都很简单易用。
|
||||
|
||||
在这个版本中,这个有用的工具获得了几个新功能。比如说:
|
||||
|
||||
- 工具条上新的搜索图标使用户能够快速搜索文件和文件夹。
|
||||
- 你现在可以添加一个分割视图。
|
||||
- 启用独立的图像预览。
|
||||
|
||||
还有一个有趣的新增功能,可以帮助你**高亮文件**,以便快速发现它们。你可以设置一个前景和背景颜色,如果你不想要这个功能,也可以重置。
|
||||
|
||||
![xfce 4.18 文件高亮][4]
|
||||
|
||||
你可以从文件的属性选项中访问这个功能。
|
||||
|
||||
Thunar 文件管理器还增加了一些其他功能,包括:
|
||||
|
||||
- 一个用于定制键盘快捷键的新标签。
|
||||
- 新的书签菜单。
|
||||
|
||||
#### 精致的设置和桌面变化
|
||||
|
||||
Xfce 桌面的大部分都保持不变。你不应该期待开箱后有不同的用户体验。
|
||||
|
||||
虽然没有重大的视觉改造,但有细微的完善和功能改进。
|
||||
|
||||
例如,你可以发现日历小部件的新能力。显示设置提供了更多选项,即使你没有连接多个显示器。
|
||||
|
||||
Xfce 面板也有一些变化。
|
||||
|
||||
![Xfce 4.18 面板设置][5]
|
||||
|
||||
这些变化包括用像素而不是百分比来调整高度,以及一个新的 “保持面板在窗口上方” 选项。这使得窗口可以在面板下面延伸,而不是在顶部被切断。
|
||||
|
||||
更不用说,时钟小程序现在可以自定义其字体类、字体大小和布局。
|
||||
|
||||
![Xfce 4.18 时钟][6]
|
||||
|
||||
#### 新壁纸
|
||||
|
||||
当然,我们也得到了一些新的壁纸;你已经在本文的开头看到了新的默认壁纸。
|
||||
|
||||
![Xfce 4.18 新壁纸集][7]
|
||||
|
||||
如果你很好奇,你可以看看其他为 [壁纸竞赛][8] 提交的各种作品。也许你会发现别人不喜欢的东西。
|
||||
|
||||
![Xfce 4.18 新壁纸集锦][9]
|
||||
|
||||
这些是计划添加到背景集的其它候选作品。
|
||||
|
||||
#### 其他变化
|
||||
|
||||
除了之前提到的那些,这个版本还引入了一些其他变化。
|
||||
|
||||
- 初步的 Wayland 支持,它允许 Xfce 在 Wayland 显示服务器上运行。
|
||||
- GTK4 的更新,提供了更好的性能和稳定性。
|
||||
- 一些核心应用程序的小更新,包括对 Xfdesktop、Xfwm4 和 Xfce4-panel 应用程序的改进。
|
||||
|
||||
关于完整的变化列表,你可以参考 [官方博客文章][10]。
|
||||
|
||||
### 获得 Xfce 4.18
|
||||
|
||||
你可以通过软件库为滚动发布的发行版(如 Arch Linux)安装它。对于其他发行版,如果你不想自己做实验,你可能必须等待官方的更新。
|
||||
|
||||
要想快速尝试,你可以安装 Xubuntu 23.04 日常构建版来获得这些功能。
|
||||
|
||||
如果你使用的是其他为了稳定起见而不提供快速桌面环境更新的 Linux 发行版,如果你知道自己在做什么,你可以尝试手动安装。
|
||||
|
||||
> **[下载 Xfce 4.18][11]**
|
||||
|
||||
### 总结
|
||||
|
||||
Xfce 4.18 是 Xfce 桌面环境的一次重大更新,有许多新的功能和改进。
|
||||
|
||||
Thunar 文件管理器的更新尤其值得注意,因为它们为用户提供了更多的控制和定制选项。初步的 Wayland 支持和 GTK4 更新将提高性能和稳定性。
|
||||
|
||||
总的来说,Xfce 4.18是一个受欢迎的更新,将改善 Xfce 用户的用户体验。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/xfce-4-18-release/
|
||||
|
||||
作者:[Jacob Crume][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/jacob/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2022/12/xfce-4-18-release.png
|
||||
[2]: https://news.itsfoss.com/content/images/2022/12/xfce-4-18-hero.jpg
|
||||
[3]: https://news.itsfoss.com/content/images/2022/12/xfce-4-18-file-manager.jpg
|
||||
[4]: https://news.itsfoss.com/content/images/2022/12/xfce-4-18-file-highlight.jpg
|
||||
[5]: https://news.itsfoss.com/content/images/2022/12/xfce-4-18-panel.jpg
|
||||
[6]: https://news.itsfoss.com/content/images/2022/12/xfce-4-18-clock-settings.jpg
|
||||
[7]: https://news.itsfoss.com/content/images/2022/12/xfce-4-18-new-wallaper.jpg
|
||||
[8]: https://gitlab.xfce.org/artwork/public/-/issues/1#note_58300
|
||||
[9]: https://news.itsfoss.com/content/images/2022/12/xfce-4-18-new-wallpapers.jpg
|
||||
[10]: https://alexxcons.github.io/blogpost_8.html
|
||||
[11]: https://www.xfce.org/
|
@ -1,96 +0,0 @@
|
||||
[#]: subject: "Privacy-Preserving Ads Make a Debut on Brave Search"
|
||||
[#]: via: "https://news.itsfoss.com/brave-search-ads/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Privacy-Preserving Ads Make a Debut on Brave Search
|
||||
======
|
||||
|
||||
Brave Search is testing privacy-preserving ads. But, the Brave browser does not seem to block them by default.
|
||||
|
||||
![Privacy-Preserving Ads Make a Debut on Brave Search][1]
|
||||
|
||||
Brave Search is an independent search engine that claims not to track its users and provides a safe and secure search experience.
|
||||
|
||||
It aims to be a privacy-friendly alternative to the extensive tech services from Microsoft and Google.
|
||||
|
||||
With a [recent announcement][2], they introduced a new feature to Brave Search. The search will now show '_privacy-preserving_' ads as part of a global beta program.
|
||||
|
||||
What does this mean? Allow me to explain.
|
||||
|
||||
### Privacy-Preserving Ads: Meaning?
|
||||
|
||||
![brave search privacy preserving ads][3]
|
||||
|
||||
Brave is planning to run ads on their search platform; they claim that these ads are anonymous, are marked, and follow its commitment of putting users first.
|
||||
|
||||
These ads are said to be clearly labeled and are integrated into Brave Search.
|
||||
|
||||
To display relevant advertisements, Brave Search will only use your **search query, country, and device type**.
|
||||
|
||||
So, in theory, this should stop them from keeping a profile of your searches.
|
||||
|
||||
They also add that:
|
||||
|
||||
> Brave Search ads protect users’ data and anonymity, while supporting their access to independent and transparent search as a true alternative to Big Tech search engines.
|
||||
|
||||
This has been released as a beta test globally, where Brave Search users will be shown text-based ads in search results.
|
||||
|
||||
Users who opted for Brave Private Ads (for _Brave Rewards_) and are using the latest version of Brave won't be shown search ads since these are not yet eligible for BAT earnings.
|
||||
|
||||
Additionally, they offer a '**Search Premium**' subscription for an ad-free search experience, which costs **$3 per month**.
|
||||
|
||||
With this subscription, you get a completely ad-free search experience while also supporting Brave.
|
||||
|
||||
### Is This a Step in the Right Direction?
|
||||
|
||||
Even though Brave Search is based on an **open-source search project**[Tailcat][4], they have no plans to make it open-source.
|
||||
|
||||
So, Brave Search already has a red flag 🚩 for many privacy enthusiasts who prefer open-source solutions for their transparency.
|
||||
|
||||
**Will privacy-preserving ads make a difference, just like Brave Search's original claims for its search engine?**
|
||||
|
||||
Well, I certainly hope so. Why? **Because we need more competitors to Google**. And something is better than nothing.
|
||||
|
||||
Even without open-source code, we will have to sit back and see what kind of transparency they provide in their advertisement testing soon.
|
||||
|
||||
Though, the implementation of Brave's privacy-preserving ads has got a few users upset.
|
||||
|
||||
A [comment][5] made by a Reddit user on the official Subreddit of Brave Browser mentions:
|
||||
|
||||
> Putting in an exception for your own ads is in exceptionally bad taste. All the marketing fluff around "independent, private search" is not an excuse.
|
||||
|
||||
Brave Browser seems to be **not blocking Brave search ads** with its in-built ad-blocker (Brave Shields).
|
||||
|
||||
On that, a member of the Brave support team clarified:
|
||||
|
||||
> Shields at this time does not block 1st part, non tracking ads by default anyway (with the exception of setting to Aggressive, I believe) so it's actually just following the standard we've already set.
|
||||
|
||||
So, you can block the Brave search ads with the privacy protection settings set to aggressive, I believe?
|
||||
|
||||
However, not everyone prefers the aggressive blocker. So, let us see how things turn out for Brave search ad experimentation.
|
||||
|
||||
💭 **Thoughts? Feel free to share them in the comments section.**
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/brave-search-ads/
|
||||
|
||||
作者:[Sourav Rudra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/sourav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2022/12/brave-privacy-preserving-ads.png
|
||||
[2]: https://brave.com/private-search-ads/
|
||||
[3]: https://news.itsfoss.com/content/images/2022/12/Brave_Search_Ads.jpg
|
||||
[4]: https://www.tailcat.com
|
||||
[5]: https://www.reddit.com/r/brave_browser/comments/z9t171/comment/iyjledp/?utm_source=share&utm_medium=web2x&context=3
|
@ -1,90 +0,0 @@
|
||||
[#]: subject: "Linux Mint 21.1 beta is now available for testing"
|
||||
[#]: via: "https://debugpointnews.com/linux-mint-21-1-beta/"
|
||||
[#]: author: "arindam https://debugpointnews.com/author/dpicubegmail-com/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Linux Mint 21.1 beta is now available for testing
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
**Check out the new features of Linux Mint 21.1 beta, which is now slowly available for download in mirrors. The official announcement is awaited.**
|
||||
|
||||
![Linux Mint 21.1 beta Cinnamon desktop][2]
|
||||
|
||||
Linux Mint 21.1 is the first point release of the 21 series and will be released before Christmas this year. Codenamed “Vera”, which was [announced a few weeks back][3], is now available for beta testing.
|
||||
|
||||
The beta testing is expected to continue for at least a week before the final release. Since it is the first point, the feature list is not at that higher end. But some significant updates are arriving in the final release.
|
||||
|
||||
### Linux Mint 21.1 beta & new features
|
||||
|
||||
One of the biggest updates to the Driver Manager in this release is the ability to run the app with your user account without requiring a password to launch it. This is a major convenience, as it means you don’t have to enter a password every time you want to use the Driver Manager. In addition, when you remove a driver, the app now purges it from the system completely, ensuring that no trace of the driver remains on your computer.
|
||||
|
||||
Another key update to the Driver Manager is the ability to detect USB installation media and help you mount them. This is particularly useful if you’re installing software or drivers from a USB drive, as it makes the process much easier and more streamlined.
|
||||
|
||||
In addition to these updates, the Mint team has also included a feature for verifying the checksum of ISO files. This is an important part of any installation process, as it ensures that your ISO file is legitimate and hasn’t been tampered with. While other [utilities][4] are available for verifying ISO checksums, including command line tools, it’s nice to see this feature included in the default desktop environment.
|
||||
|
||||
Another change in this release is the default desktop view, which is expected to be updated. The default icons for the Computer, Home, Trash, and Network are now hidden from view, as the Computer icon is already included in the Panel, and the other icons are not used as frequently.
|
||||
|
||||
Other noteworthy updates in this release include the inclusion of Timeshift backports for prior releases (such as Mint 20.x) and an updated version of Blueman. Overall, this is a solid point release that includes several useful updates and bug fixes.
|
||||
|
||||
![New default icon set and bibata cursor][5]
|
||||
|
||||
Finally, you may notice the “green” icon sets and the cursor is different in the Cinnamon flavour. Linux Mint 21.1 brings the “Mint-y-Aqua” theme and the stunning “Bibata-modern” cursor theme to pair with it. Both of them look awesome together, giving a much-needed fresh vibe.
|
||||
|
||||
### Summary of changes
|
||||
|
||||
- First point release of Linux Mint 21, based on Ubuntu 22.04.1 release
|
||||
- Linux Kernel 5.15 LTS
|
||||
- Cinnamon 5.6.4 desktop
|
||||
- Xfce 4.16 desktop
|
||||
- MATE 1.26 desktop
|
||||
- Friendly driver manager
|
||||
- Cleaner default desktop view with fewer icons
|
||||
- Default theme changes to “Mint-Y-Aqua” from the green-based icons
|
||||
- New cursor theme: Bibata (one of the best cursor theme in Linux)
|
||||
- A bunch of stunning wallpapers
|
||||
- And an array of bug fixes
|
||||
|
||||
### Download and bug reporting for beta
|
||||
|
||||
While the team is preparing for the official announcement, the ISO images are slowly becoming available to the public. As always, being a beta release, it may have bugs. So use it with caution.
|
||||
|
||||
If you are running Linux Mint 21.0, don’t upgrade it yet. Wait for the final release.
|
||||
|
||||
Still, if you want to try it on a virtual machine, download the Cinnamon, Xfce and MATE flavours of this beta release from the torrent links below.
|
||||
|
||||
- [linuxmint-21.1-cinnamon-64bit-beta.iso.torrent][6]
|
||||
- [linuxmint-21.1-mate-64bit-beta.iso.torrent][7]
|
||||
- [linuxmint-21.1-xfce-64bit-beta.iso.torrent][8]
|
||||
|
||||
I will update the changelog here once it is available. And finally, report any issues or bugs at the dedicated [21.1 beta bug tracking page][9].
|
||||
|
||||
Cheers.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://debugpointnews.com/linux-mint-21-1-beta/
|
||||
|
||||
作者:[arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://debugpointnews.com/author/dpicubegmail-com/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://debugpointnews.com/wp-content/uploads/2022/12/21-1-beta-head.jpg
|
||||
[2]: https://debugpointnews.com/wp-content/uploads/2022/12/Linux-Mint-21.1-beta-Cinnamon-desktop.jpg
|
||||
[3]: https://debugpointnews.com/linux-mint-21-1-announcement/
|
||||
[4]: https://www.debugpoint.com/collision/
|
||||
[5]: https://debugpointnews.com/wp-content/uploads/2022/12/New-default-icon-set-and-bibata-cursor.jpg
|
||||
[6]: https://linuxmint.com/torrents/linuxmint-21.1-cinnamon-64bit-beta.iso.torrent
|
||||
[7]: https://linuxmint.com/torrents/linuxmint-21.1-mate-64bit-beta.iso.torrent
|
||||
[8]: https://linuxmint.com/torrents/linuxmint-21.1-xfce-64bit-beta.iso.torrent
|
||||
[9]: https://github.com/linuxmint/mint21.1-beta/issues
|
@ -1,99 +0,0 @@
|
||||
[#]: subject: "Linen is a Google-Searchable Open-Source Alternative to Slack and Discord"
|
||||
[#]: via: "https://news.itsfoss.com/linen/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Linen is a Google-Searchable Open-Source Alternative to Slack and Discord
|
||||
======
|
||||
|
||||
An interesting open-source alternative to Slack and Discord.
|
||||
|
||||
![Linen is a Google-Searchable Open-Source Alternative to Slack and Discord][1]
|
||||
|
||||
Linen is an interesting open-source project brewing up.
|
||||
|
||||
It aims to be an **open alternative to Slack and Discord**, focusing on making communities more accessible and helping reduce the support burden.
|
||||
|
||||
It could be worth adding it as an open-source Slack alternative, but it is in its **early stages of development** when publishing this.
|
||||
|
||||
**_What's different with Linen, exactly?_**
|
||||
|
||||
- **Open Source**
|
||||
- **Unlimited history retention**
|
||||
- **Communities are Google searchable**
|
||||
- **Supports sync from Slack and Discord**
|
||||
- **Eliminate the need to join Slack/Discord for information**
|
||||
|
||||
### Community-Focused Slack Alternative
|
||||
|
||||
[Linen][2] pitches itself as an open-source app for communities rather than primarily targeting teams for collaboration/communication.
|
||||
|
||||
![linen ui][3]
|
||||
|
||||
In contrast, Slack is primarily for team discussions and collaboration. You cannot share the conversation through a URL or find the discussions indexed on search engines like Google.
|
||||
|
||||
But with Linen, you can **find a URL for every conversation** that can be shared with anyone to view/join the conversation.
|
||||
|
||||
![linen message url][4]
|
||||
|
||||
Here's something for the test: [https://linen.dev/s/itsfoss/t/5099789/topic][5]
|
||||
|
||||
**You can also find this conversation listed on Google** (it may take time to find it exactly).
|
||||
|
||||
For example, suppose we are a community of an open-source project where we discuss an issue or a solution; listing it on Google enables more users to find out about it.
|
||||
|
||||
Here's an example of a conversation listed on Google that could help me if I was exploring solutions to fix my code issues with Kotlin:
|
||||
|
||||
![linen google search][6]
|
||||
|
||||
As a developer/user, I could view the conversation, get my answer, and move on without troubling anyone else in the community with a repeat question.
|
||||
|
||||
**Sounds lovely, right? Linen helps you enhance community support.**
|
||||
|
||||
Sure, you can use it for your team communication as well. But, it is a more appropriate solution to create an open community chat network.
|
||||
|
||||
Currently, it does not provide the feature to create a private community for the public. They only use it for internal team discussions, per their [GitHub page][7].
|
||||
|
||||
![][8]
|
||||
|
||||
### How To Get Started?
|
||||
|
||||
Linen does not support self-hosting at the moment. But, their roadmap on [GitHub][9] indicates that it has been planned for the near future.
|
||||
|
||||
So, you can [sign up for a free account][10] using the official cloud instance or opt for the business/premium edition to use custom domain/branding benefits for your team.
|
||||
|
||||
You can **import your Slack/Discord conversations for free**.
|
||||
|
||||
> 💡 The free community edition is hosted under Linen.dev where you rely on community support. Opt for its premium edition to get priority support.
|
||||
|
||||
Linen may not be for everyone, but it sounds like a useful idea for many communities and teams.
|
||||
|
||||
_💬 What do you think about it? Let me know in the comments below._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/linen/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2022/11/linen-slack-discord-alternative.png
|
||||
[2]: https://www.linen.dev
|
||||
[3]: https://news.itsfoss.com/content/images/2022/11/linen-example.png
|
||||
[4]: https://news.itsfoss.com/content/images/2022/11/linen-conversation-url.png
|
||||
[5]: https://linen.dev/s/itsfoss/t/5099789/topic
|
||||
[6]: https://news.itsfoss.com/content/images/2022/11/linen-google-seo.png
|
||||
[7]: https://github.com/linen-dev/linen.dev
|
||||
[8]: https://news.itsfoss.com/content/images/2022/11/linen-settings.png
|
||||
[9]: https://github.com/Linen-dev/linen.dev
|
||||
[10]: https://www.linen.dev/signup
|
@ -1,91 +0,0 @@
|
||||
[#]: subject: "Apple Silicon GPU Driver is Now Available in Asahi Linux"
|
||||
[#]: via: "https://news.itsfoss.com/apple-gpu-driver-asahi-linux/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Apple Silicon GPU Driver is Now Available in Asahi Linux
|
||||
======
|
||||
|
||||
We finally have a GPU driver for Apple M silicon systems on Asahi Linux.
|
||||
|
||||
![Apple Silicon GPU Driver is Now Available in Asahi Linux][1]
|
||||
|
||||
Asahi Linux aims to be a port of Linux for Apple Silicon Macs; work started on it back in 2020, right after the launch of Apple's M1 chips at the WWDC event.
|
||||
|
||||
A small team is behind all the development behind Asahi Linux and reverse engineering stuff; they have been quite busy since the last time we looked at their work.
|
||||
|
||||
Previously, they worked on improving support for Apple SoCs such as the M1, M1 Pro, and M1 Max. They provided varying levels of support for devices that used these chips.
|
||||
|
||||
It still is a work in progress, but promising results in 2022.
|
||||
|
||||
They have now taken it further by providing initial support for Apple Silicon GPUs by releasing drivers (in _alpha_).
|
||||
|
||||
That sounds great! 😃
|
||||
|
||||
Let me take you through the gist of it.
|
||||
|
||||
### Hardware Acceleration With Desktop Environments and Old Games
|
||||
|
||||
![asahi linux running quake3][2]
|
||||
|
||||
Introduced as an alpha-stage GPU driver, it can run desktop environments and a few games smoothly.
|
||||
|
||||
**The implementation:** The driver features a work-in-progress implementation of OpenGL 2.1 and OpenGL ES 2.0 for current Apple M-series systems.
|
||||
|
||||
They also mention that:
|
||||
|
||||
> These drivers have not yet passed the OpenGL (ES) conformance tests. There will be bugs!
|
||||
|
||||
So, you can expect plenty of hiccups along the way should you choose to run applications using these drivers.
|
||||
|
||||
**How it works now?:** In its current form, the driver can run desktop environments like GNOME and KDE Plasma with hardware acceleration.
|
||||
|
||||
Even older games like [Quake3][3] and [Neverball][4] can run quite well, with these and the desktop environments running at a solid **60 fps at 4k resolution**.
|
||||
|
||||
Many users may also notice that quite a few apps don't work with this driver right away. On that, the developers mention:
|
||||
|
||||
> Since the driver is still in development, there are lots of known issues and we’re still working hard on improving conformance test results. Please don’t open new bugs for random apps not working! It’s still the early days and we know there’s a lot of work to do.
|
||||
|
||||
**What does the future hold?:** The developers have said that while OpenGL (ES) 2 suffices for some applications, newer applications will require new features such as multiple render targets, multisampling, and transform feedback.
|
||||
|
||||
All of this can be achieved with OpenGL (ES) 3, and work on that has already started. But, it will need a lot of developmental effort to get ready.
|
||||
|
||||
They have also hinted at support for Vulkan in the future, although it is a long time in the making.
|
||||
|
||||
Here's what they tell about it:
|
||||
|
||||
> We’re working on it! Although we’re only shipping OpenGL right now, we’re designing with Vulkan in mind. Most of the work we’re putting toward OpenGL will be reused for Vulkan. We estimated that we could ship working OpenGL 2 drivers much sooner than a working Vulkan 1.0 driver, and we wanted to get hardware accelerated desktops into your hands as soon as possible.
|
||||
|
||||
When a Reddit user [asked][5] about **120 Hz support for MacBook Pro**, one of the maintainers had this to say:
|
||||
|
||||
> 120Hz is disabled because it still is capped at 60Hz if we do nothing and was having other weird issues. It's still unclear exactly how VRR works on macOS, we need to figure that out first.
|
||||
|
||||
It seems like Asahi Linux has a lot of room to grow, and improvements like this to GPU drivers on a new Silicon system should finally open up new opportunities in terms of performance.
|
||||
|
||||
Linux users have been asking for something like this for a long time, and it is now closer to becoming a reality than ever before.
|
||||
|
||||
If you are feeling adventurous and want to try the new GPU driver, you can try installing it on your Asahi Linux system. Refer to the [official announcement][6] for instructions to experiment with it.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/apple-gpu-driver-asahi-linux/
|
||||
|
||||
作者:[Sourav Rudra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/sourav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2022/12/apple-gpu-asahi-linux.png
|
||||
[2]: https://news.itsfoss.com/content/images/2022/12/AsahiLinux_Quake3.jpg
|
||||
[3]: https://ioquake3.org
|
||||
[4]: https://neverball.org
|
||||
[5]: https://www.reddit.com/r/AsahiLinux/comments/zeucpz/comment/iza3wwv/?utm_source=share&utm_medium=web2x&context=3
|
||||
[6]: https://asahilinux.org/2022/12/gpu-drivers-now-in-asahi-linux/
|
@ -1,90 +0,0 @@
|
||||
[#]: subject: "Mastodon's Adoption Gets a Boost With Vivaldi Browser Integration"
|
||||
[#]: via: "https://news.itsfoss.com/vivaldi-mastodon-integration/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Mastodon's Adoption Gets a Boost With Vivaldi Browser Integration
|
||||
======
|
||||
|
||||
Vivaldi's making an effort to have more users join Mastodon with its new update. That's nice to see!
|
||||
|
||||
![Mastodon's Adoption Gets a Boost With Vivaldi Browser Integration][1]
|
||||
|
||||
Vivaldi browser is one of the best web browsers for Linux (Windows, macOS, and mobile platforms).
|
||||
|
||||
I know it is not an open-source pick, but it gets all the lead with its tab management, customizability, and productivity features. And it treats me better than Firefox nowadays (Mozilla, we still need you to do better)🙄
|
||||
|
||||
**Note:**_Vivaldi is **not open-source**. Most of it is based on Chromium, for which you can find the [source code][2]._
|
||||
|
||||
If you did not know, Vivaldi recently built a Mastodon instance (**Vivaldi Social**) to encourage people to use open-source and decentralized social media platforms.
|
||||
|
||||
It is one of the best Mastodon instances you can join:
|
||||
|
||||
To take this further, **Vivaldi 5.6 update** has integrated access to its Mastodon instance from within its web browser.
|
||||
|
||||
> 🐘 Hey! We are on [Mastodon][3] for a while; follow **us if you haven't already**! 😄
|
||||
|
||||
### Access Mastodon From Web Panels
|
||||
|
||||
Web panels on Vivaldi make it a breeze to multitask. You can keep browsing or working on what you want and still access additional services in a single click.
|
||||
|
||||
Here's what it looks like:
|
||||
|
||||
![mastodon on vivaldi][4]
|
||||
|
||||
I can access Vivaldi's Mastodon instance quickly.
|
||||
|
||||
Of course, you can add your custom web panel for any Mastodon instance you like.
|
||||
|
||||
![vivaldi web panel addition][5]
|
||||
|
||||
However, I believe out-of-the-box integration should encourage Vivaldi users to try Mastodon if they haven't yet.
|
||||
|
||||
In the official announcement, Vivaldi also explains it properly for its users:
|
||||
|
||||
> [Vivaldi Social][6] came into existence as we love the idea of distributed social networks based on open standards. We want to offer better alternatives to people to communicate in an algorithm-free environment with no surveillance capitalism, devoid of tracking or data profiling.The Mastodon server platform communicates through the [Activity Pub][7] standard, a decentralized social networking and messaging protocol recommended by the [World Wide Web Consortium (W3C)][8]. Any platform or application that implements ActivityPub becomes a part of a massive social network. This big social network is also called the [Fediverse][9] (“federated” + “universe”).
|
||||
|
||||
Before anyone gets their pitchfork ready, I want Vivaldi to be 100% open-source, but we also want more companies in the mainstream to adopt and encourage the use of open-source tech.
|
||||
|
||||
And I think Vivaldi has got an excellent approach to that.
|
||||
|
||||
So, this integration should ultimately let every Vivaldi (or Linux user) use Mastodon more than often.
|
||||
|
||||
In addition to this change, Vivaldi 5.6 release involves a couple of improvements that include:
|
||||
|
||||
- A new search engine (You.com)
|
||||
- Panels joining editable toolbars
|
||||
- Revamped settings page
|
||||
- Pin tab stacks (_this is exciting!_)
|
||||
|
||||
You can update the browser to get the latest version or download Vivaldi 5.6 on its official website.
|
||||
|
||||
[Download Vivaldi 5.6][10]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/vivaldi-mastodon-integration/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2022/12/mastodon-integration-in-vivaldi-browser-1.png
|
||||
[2]: https://vivaldi.com/source/
|
||||
[3]: https://mastodon.social/web/@itsfoss
|
||||
[4]: https://news.itsfoss.com/content/images/2022/12/mastodon-vivaldi.jpg
|
||||
[5]: https://news.itsfoss.com/content/images/2022/12/add-custom-panel.jpg
|
||||
[6]: https://vivaldi.com/blog/news/vivaldi-social-a-new-mastodon-instance/
|
||||
[7]: https://en.wikipedia.org/wiki/ActivityPub
|
||||
[8]: https://www.w3.org/
|
||||
[9]: https://en.wikipedia.org/wiki/Fediverse
|
||||
[10]: https://vivaldi.com/download/
|
@ -0,0 +1,89 @@
|
||||
[#]: subject: "Unfortunately, Komodo IDE is now Open Source!"
|
||||
[#]: via: "https://news.itsfoss.com/komodo-ide-open-source/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Unfortunately, Komodo IDE is now Open Source!
|
||||
======
|
||||
|
||||
Komodo IDE is now open-source and not at a great time. Curious to take a peek at the source code? Learn more here.
|
||||
|
||||
![Unfortunately, Komodo IDE is now Open Source!][1]
|
||||
|
||||
Komodo IDE is a popular integrated development environment for dynamic programming languages that was introduced back in May 2000.
|
||||
|
||||
Used by many programmers around the world, it has proved to be quite helpful over the years.
|
||||
|
||||
Unfortunately, all good things end.
|
||||
|
||||
This is the case with Komodo IDE, it has now been retired, and all development has ceased.
|
||||
|
||||
But there's a silver lining to this 😃
|
||||
|
||||
The company behind it, called '[ActiveState][2]', has now made the code openly available for anyone to use and modify.
|
||||
|
||||
> 💡 Similar to "Komodo Edit" application, which was made open-source in 2008.
|
||||
|
||||
They have cited numerous factors for their decision, which I will explain.
|
||||
|
||||
### So, Why Open-Source it Now?
|
||||
|
||||
![komodo ide][3]
|
||||
|
||||
ActiveState felt that it was becoming difficult to maintain Komodo IDE without encountering various compatibility issues on newer systems.
|
||||
|
||||
**What were the contributing factors?:** There were many factors that led to this. Take, for instance, the frameworks on which Komodo was built, '_XUL and XULRunner_'; they were retired by Mozilla back in 2016.
|
||||
|
||||
Then there was the amount of effort needed to make Komodo compatible with newer systems. They would have to completely rewrite Komodo using a newer framework they felt was not feasible.
|
||||
|
||||
And the final nail in the coffin was the fact that there are already a lot of free code editors available on the market right now doing better. They feel that '_it’s not a good business to be in anymore_'.
|
||||
|
||||
**What now?:** ActiveState have made the whole Komodo IDE codebase available on their [GitHub repo][4] without the revision history.
|
||||
|
||||
They have provided 3.2 million lines of code that consist of various programming languages such as Python, JavaScript, XUL, HTML, C++, and more.
|
||||
|
||||
Anyone can copy, change, and use the code as they see fit.
|
||||
|
||||
The forums for Komodo will be kept open for a year from their [original announcement][5], as it contains a treasure trove of information relating to Komodo.
|
||||
|
||||
They are also open to moving the content to a different platform if anyone is willing to take on the task of managing it.
|
||||
|
||||
On this topic, one of the employees from the Komodo dev team, Carey Hoffman, had this to add:
|
||||
|
||||
> The extensive existing help information in the forums can act as a significant knowledge base for users and continue to be a central place to ask questions of the community and receive answers. I’ll very likely be there periodically on my own time to help where I can, such as when people are trying to build Komodo at home, or having difficulty making any kind of code edits.
|
||||
|
||||
### Community Gets a Chance
|
||||
|
||||
This can come in pretty handy for the community in general, as people can now try their hand at creating something truly special out of the code for Komodo.
|
||||
|
||||
A Reddit user, [yvrelna][6] mentions:
|
||||
|
||||
> I never used Komodo, but it's great to hear that Komodo is now freed from its cage. Companies should do this more often. If they're unwilling to support a software anymore, they should just release it as open source.It would've been better if the software is open source to begin with of course, but there's really no reason for a company to retain their codebase closed if they have no interest in maintaining it.Only thing is that they should've done it sooner, when there are still enough people that still cares about the software to possibly pick it up to maintain it.
|
||||
|
||||
Indeed, the user is not wrong here; companies should go the extra mile by making code for their deprecated software open so that the community has a chance to create something out of it or even maintain it for the long term.
|
||||
|
||||
ActiveState seems to have understood this sentiment and has thanked its users by open-sourcing Komodo.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/komodo-ide-open-source/
|
||||
|
||||
作者:[Sourav Rudra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/sourav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2022/12/komodo-ide-goes-open-source.png
|
||||
[2]: https://www.activestate.com/
|
||||
[3]: https://news.itsfoss.com/content/images/2022/12/Komodo_IDE.png
|
||||
[4]: https://github.com/ActiveState/OpenKomodoIDE
|
||||
[5]: https://www.activestate.com/blog/activestate-komodo-ide-now-open-source/
|
||||
[6]: https://www.reddit.com/user/yvrelna/
|
@ -0,0 +1,82 @@
|
||||
[#]: subject: "Puppy Linux 22.12 (S15Pup) Arrives Based on Slackware 15"
|
||||
[#]: via: "https://debugpointnews.com/puppy-linux-22-12-s15pup/"
|
||||
[#]: author: "arindam https://debugpointnews.com/author/dpicubegmail-com/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Puppy Linux 22.12 (S15Pup) Arrives Based on Slackware 15
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
**A new Puppy Linux flavour (Puppy Linux 22.12 S15Pup) is now available based on Slackware 15.**
|
||||
|
||||
Puppy Linux is a super lightweight distro which runs entirely on RAM and requires a very low memory footprint. It is almost loaded with all the necessary applications for everything you need. It is quite remarkable that the Puppy Linux team managed to package all these applications, which run in low memory and surprisingly within 400 MB of ISO size. There are many variants of Puppy Linux based on Ubuntu and other distros – thanks to the fantastic Puppy Builder Woof-CE.
|
||||
|
||||
### Puppy Linux 22.12 (s15pup): What’s New
|
||||
|
||||
The recent release of Puppy Linux 22.12 is based on the Slackware 15.0 components, which were released in February 2022. At its core, the JWM (Joe’s Window Manager) provides flexibility and good performance in Puppy Linux because it runs off the RAM.
|
||||
|
||||
![Puppy Linux 22.12 based on Slackware 15][2]
|
||||
|
||||
Based on Slackware, Puppy 22.12 comes with Linux Kernel LTS series 5.15 for the 64-bit. And the 5.10 for the 32-bit system. The desktop feel is the same as other Puppy flavours based on the JWM 2.4.3. The JWM is used in other distro-based Puppy flavours as well.
|
||||
|
||||
In addition, FFmpeg is loaded with Mplayer for your media playing needs – if at all required in a LIVE system. Also, the “Light” web browser, based on Firefox, gives you easy and performant access to the internet. Alternative browser installation options are also present.
|
||||
|
||||
Furthermore, Puppy Linux 22.12 s15pup pre-loads most of the LXDE apps and components for the overall lightweight experience, such as Lxrandr 0.3.2, Lxtask 0.1.10 and Lxterminal 0.4.0.
|
||||
|
||||
ISO of this Slackware flavour is less than 400 MB in size, and, amazingly, all of the following applications are pre-loaded on it. Here’s a summary of the key packages in this version:
|
||||
|
||||
| Abiword 3.0.1 | Gparted 1.3.1 | Parcellite 1.2.1 |
|
||||
| Bash 5.1.016 | Grep 3.7 | Rox-filer 17w |
|
||||
| Busybox 1.35.0 | Gtk+2 2.24.33 | Samba 4.12.15 |
|
||||
| Cups 2.4.2 | Gtk+3 3.24.31 | Sed 4.8 |
|
||||
| Curl 7.86.0 | Gtkdialog 0.8.5a | Sylpheed 3.7.0 |
|
||||
| Dhcpcd 9.4.1 | Icu4c 69.1 | Syslinux 4.07 |
|
||||
| Didiwiki 0.8 | Jwm 2.4.3 | Transmission 2.60 |
|
||||
| Evince 2.32.0 | Lxrandr 0.3.2 | Util-linux 2.37.4 |
|
||||
| Ffmpeg 4.4.3 | Lxtask 0.1.10 | Viewnior 1.7 |
|
||||
| Gcc 11.2.0 | Lxterminal 0.4.0 | Xdelta 30.16 |
|
||||
| Geany 1.35 | Mesa 21.3.5 | Xsane 0.999 |
|
||||
| Ghostscript 9.55.0 | MPlayer 1.4 |
|
||||
| Glib2 2.70.3 | Mtpaint 3.50.09 |
|
||||
| Glibc 2.33 | Ncurses 6.3 |
|
||||
| Gnumeric 1.10.17 | Openssl 1.1.1s |
|
||||
|
||||
### Download
|
||||
|
||||
Puppy Linux is one of those few distros which still provides a 32-bit installation file alongside 64-bit. You can download this version from the following links for the respective architectures.
|
||||
|
||||
- [S15Pup 64-bit – based on Slackware 15.0][3]
|
||||
- [S15Pup 32-bit – based on Slackware 15.0][4]
|
||||
- [ScPup 64-bit – based on Slackware current][5]
|
||||
- [ScPup 32-bit – based on Slackware current][6]
|
||||
|
||||
If you are running it on a virtual machine, make sure to change the CPU architecture to 64-bit before installing it.
|
||||
|
||||
_Via [release announcement][7] & [release notes][8]_
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://debugpointnews.com/puppy-linux-22-12-s15pup/
|
||||
|
||||
作者:[arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://debugpointnews.com/author/dpicubegmail-com/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://debugpointnews.com/wp-content/uploads/2022/12/pups15head.jpg
|
||||
[2]: https://debugpointnews.com/wp-content/uploads/2022/12/Puppy-Linux-22.12-based-on-Slackware-15.jpg
|
||||
[3]: https://sourceforge.net/projects/spup/files/S15Pup64/
|
||||
[4]: https://sourceforge.net/projects/spup/files/S15Pup32/
|
||||
[5]: https://sourceforge.net/projects/spup/files/ScPup64/
|
||||
[6]: https://sourceforge.net/projects/spup/files/ScPup/
|
||||
[7]: https://forum.puppylinux.com/viewtopic.php?t=7464&sid=5ee2c343a8dbc0babc476139d188c50f
|
||||
[8]: http://distro.ibiblio.org/puppylinux/puppy-s15pup/release-S15Pup-22.12.htm
|
@ -0,0 +1,73 @@
|
||||
[#]: subject: "Microsoft Soundscape to Go Open Source Marking the End of the Project"
|
||||
[#]: via: "https://news.itsfoss.com/microsoft-soundscape-open-source/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Microsoft Soundscape to Go Open Source Marking the End of the Project
|
||||
======
|
||||
|
||||
Microsoft makes an excellent decision to open-source its innovative audio app.
|
||||
|
||||
![Microsoft Soundscape to Go Open Source Marking the End of the Project][1]
|
||||
|
||||
The [Soundscape project][2] was a fascinating experimental research effort undertaken by Microsoft to use sound-based technology to help visually impaired people navigate their surroundings.
|
||||
|
||||
Launched back in 2017, it used 3D audio cues and augmented reality to enhance a user's awareness by guiding them through places.
|
||||
|
||||
Soon after, they also launched an iOS app to showcase their progress.
|
||||
|
||||
The app could use the iPhone's sensors to read out points of interest as the user walked past something or even roads and intersections to help them figure out where they were.
|
||||
|
||||
**Unfortunately,** with a [recent announcement][3], Microsoft has decided not to continue further with the development of this project and will be making the **code open-source**.
|
||||
|
||||
### Microsoft Soundscape Source Code to be Available on GitHub
|
||||
|
||||
![Microsoft Soundscape - an Illustrated Demonstration][4]
|
||||
|
||||
**What Happened?:** Well, according to Microsoft, it's natural to either stop or transition a few projects as they evolve their research portfolio.
|
||||
|
||||
With this move, Microsoft hopes the community will take over and benefit from the 'novel experiences' they helped develop.
|
||||
|
||||
They also add that:
|
||||
|
||||
> As Microsoft Research continues to expand into new accessibility innovation areas, we hope the open-source software release of the Soundscape code supports the community in further developing confidence and utility of spatial audio navigation experiences.
|
||||
|
||||
You know, this move is quite similar to the one made by ActiveState recently, where they discontinued Komodo IDE and made the code open-source to say thank you to its users.
|
||||
|
||||
**What's Next?:** Starting **January 3, 2023**, the source code for Soundscape will be made available on GitHub. Developers are free to use the code in any manner they see fit.
|
||||
|
||||
Furthermore, the iOS app will also be discontinued, and existing users can use it until June 2023.
|
||||
|
||||
They will also stop taking new feature requests and only focus on bug fixes and general maintenance of the iOS app until the time comes.
|
||||
|
||||
As for the Microsoft Soundscape Authoring app, it will no longer be available after January 17, 2023.
|
||||
|
||||
Microsoft has also clarified that its other offerings would remain unaffected.
|
||||
|
||||
### Community-Driven Approach Wins
|
||||
|
||||
As was the case with Komodo IDE, a community-driven approach can be of great help for deprecated software.
|
||||
|
||||
Where the community can get together and create something truly unique while also helping the end users add value to their lives.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/microsoft-soundscape-open-source/
|
||||
|
||||
作者:[Sourav Rudra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/sourav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2022/12/microsoft-soundscape-goes-open-source.png
|
||||
[2]: https://www.microsoft.com/en-us/research/product/soundscape/
|
||||
[3]: https://www.microsoft.com/en-us/research/blog/microsoft-soundscape-new-horizons-with-a-community-driven-approach/
|
||||
[4]: https://youtu.be/v5DXykmOdJ8
|
@ -0,0 +1,94 @@
|
||||
[#]: subject: "Better Late Than Never! GNOME's File Picker Adds Thumbnail View After 18 Years"
|
||||
[#]: via: "https://news.itsfoss.com/gnome-file-picker/"
|
||||
[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Better Late Than Never! GNOME's File Picker Adds Thumbnail View After 18 Years
|
||||
======
|
||||
|
||||
A long-lost request, and a much-needed one, finally made its way through!
|
||||
|
||||
![Better Late Than Never! GNOME's File Picker Adds Thumbnail View After 18 Years][1]
|
||||
|
||||
Nowadays, the user interface of a program is extremely important; even the simplest of interactions can make or break the user's experience.
|
||||
|
||||
The GNOME file picker lacked a proper thumbnail preview for viewing files, instead relying on a plain list view. This may have been unintuitive for many.
|
||||
|
||||
The lack of this feature was also the topic of many memes and debates over the years.
|
||||
|
||||
But now, finally, after 18 long years since the original [feature request][2] was put out, GNOME is set to receive support for a proper thumbnail view.
|
||||
|
||||
Let's look at this upcoming change to GNOME's file picker.
|
||||
|
||||
#### Recommended Read 📖
|
||||
|
||||
### Feature to Arrive With GNOME 44
|
||||
|
||||
![gnome file thumbnail view][3]
|
||||
|
||||
As demonstrated by this early build screenshot provided by GNOME developer [Matthias Clasen][4]. The file picker on GNOME is going to feature a thumbnail view.
|
||||
|
||||
This is how it looks like with GNOME 43 on board:
|
||||
|
||||
![file picker with gnome 43][5]
|
||||
|
||||
**How to access it?:** It is a grid view for the file picker on GNOME that shows the thumbnail previews of files and folders.
|
||||
|
||||
It will now be easy to differentiate items in the file manager; no more opening a file to see what it contains!
|
||||
|
||||
![gnome file thumbnail view selector][6]
|
||||
|
||||
When this feature arrives, you can enable it by clicking on the new view toggle button at the top right.
|
||||
|
||||
**What Changed?:** 18 years for a simple feature addition is a long time. Numerous technical reasons made the implementation of this an arduous task.
|
||||
|
||||
But I am glad that it is finally here. 😃
|
||||
|
||||
One of the reasons that made this possible was the recent deprecations and modernization work carried out in the GTK code base.
|
||||
|
||||
> 💡 GTK is the toolkit that is at the core of all things GNOME.
|
||||
|
||||
And, those changes resulted in [GtkListView][7] and [GtkGridView][8] using the same data models to make this feature work.
|
||||
|
||||
**When to expect?:** The historical [merge request][9] has already been accepted and is paving the way for its introduction to GNOME.
|
||||
|
||||
You can expect this to arrive with GNOME 44 sometime in 2023.
|
||||
|
||||
I'm looking forward to that! 😁
|
||||
|
||||
We would be covering it as part of GNOME 44's feature offerings. So, stay tuned to our coverage for that!
|
||||
|
||||
_Don't forget to follow us on [Mastodon][10] and [Twitter][11]! Feel free to share your thoughts on this in the comments below._
|
||||
|
||||
Notion – One workspace. Every team.We’re more than a doc. Or a table. Customize Notion to work the way you do.![][12]Notion![][13]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/gnome-file-picker/
|
||||
|
||||
作者:[Sourav Rudra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/sourav/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://news.itsfoss.com/content/images/size/w2000/2022/12/gtk-file-chooser-gets-thumbnail-preview-support.png
|
||||
[2]: https://bugzilla.gnome.org/show_bug.cgi?id=141154
|
||||
[3]: https://news.itsfoss.com/content/images/2022/12/GNOME_File_Thumbnail.png
|
||||
[4]: https://twitter.com/matthias_clasen
|
||||
[5]: https://news.itsfoss.com/content/images/2022/12/file-picker-now.png
|
||||
[6]: https://news.itsfoss.com/content/images/2022/12/GNOME_File_Thumbnail-2.png
|
||||
[7]: https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklistview.c
|
||||
[8]: https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkgridview.c
|
||||
[9]: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5163
|
||||
[10]: https://mastodon.social/@itsfoss
|
||||
[11]: https://twitter.com/itsfoss2
|
||||
[12]: https://notion.grsm.io/front-static/logo-ios.png
|
||||
[13]: https://www.notion.so/front-static/meta/default.png
|
@ -1,90 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (CanYellow)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Understanding Linus's Law for open source security)
|
||||
[#]: via: (https://opensource.com/article/21/2/open-source-security)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
Understanding Linus's Law for open source security
|
||||
======
|
||||
Linus's Law is that given enough eyeballs, all bugs are shallow. How
|
||||
does this apply to open source software security?
|
||||
![Hand putting a Linux file folder into a drawer][1]
|
||||
|
||||
In 2021, there are more reasons why people love Linux than ever before. In this series, I'll share 21 different reasons to use Linux. This article discusses Linux's influence on the security of open source software.
|
||||
|
||||
An often-praised virtue of open source software is that its code can be reviewed (or "audited," as security professionals like to say) by anyone and everyone. However, if you actually ask many open source users when the last time they reviewed code was, you might get answers ranging from a blank stare to an embarrassed murmur. And besides, there are some really big open source applications out there, so it can be difficult to review every single line of code effectively.
|
||||
|
||||
Extrapolating from these slightly uncomfortable truths, you have to wonder: When nobody looks at the code, does it really matter whether it's open or not?
|
||||
|
||||
### Should you trust open source?
|
||||
|
||||
We tend to make a trite assumption in hobbyist computing that open source is "more secure" than anything else. We don't often talk about what that means, what the basis of comparison is ("more" secure than what?), or how the conclusion has even been reached. It's a dangerous statement to make because it implies that as long as you call something _open source_, it automatically and magically inherits enhanced security. That's not what open source is about, and in fact, it's what open source security is very much against.
|
||||
|
||||
You should never assume an application is secure unless you have personally audited and understood its code. Once you have done this, you can assign _ultimate trust_ to that application. Ultimate trust isn't a thing you do on a computer; it's something you do in your own mind: You trust software because you choose to believe that it is secure, at least until someone finds a way to exploit that software.
|
||||
|
||||
You're the only person who can place ultimate trust in that code, so every user who wants that luxury must audit the code for themselves. Taking someone else's word for it doesn't count!
|
||||
|
||||
So until you have audited and understood a codebase for yourself, the maximum trust level you can give to an application is a spectrum ranging from approximately, _not trustworthy at all_ to _pretty trustworthy_. There's no cheat sheet for this. It's a personal choice you must make for yourself. If you've heard from people you strongly trust that an application is secure, then you might trust that software more than you trust something for which you've gotten no trusted recommendations.
|
||||
|
||||
Because you cannot audit proprietary (non-open source) code, you can never assign it _ultimate trust_.
|
||||
|
||||
### Linus's Law
|
||||
|
||||
The reality is, not everyone is a programmer, and not everyone who is a programmer has the time to dedicate to reviewing hundreds and hundreds of lines of code. So if you're not going to audit code yourself, then you must choose to trust (to some degree) the people who _do_ audit code.
|
||||
|
||||
So exactly who does audit code, anyway?
|
||||
|
||||
Linus's Law asserts that _given enough eyeballs, all bugs are shallow_, but we don't really know how many eyeballs are "enough." However, don't underestimate the number. Software is very often reviewed by more people than you might imagine. The original developer or developers obviously know the code that they've written. However, open source is often a group effort, so the longer code is open, the more software developers end up seeing it. A developer must review major portions of a project's code because they must learn a codebase to write new features for it.
|
||||
|
||||
Open source packagers also get involved with many projects in order to make them available to a Linux distribution. Sometimes an application can be packaged with almost no familiarity with the code, but often a packager gets familiar with a project's code, both because they don't want to sign off on software they don't trust and because they may have to make modifications to get it to compile correctly. Bug reporters and triagers also sometimes get familiar with a codebase as they try to solve anomalies ranging from quirks to major crashes. Of course, some bug reporters inadvertently reveal code vulnerabilities not by reviewing it themselves but by bringing attention to something that obviously doesn't work as intended. Sysadmins frequently get intimately familiar with the code of an important software their users rely upon. Finally, there are security researchers who dig into code exclusively to uncover potential exploits.
|
||||
|
||||
### Trust and transparency
|
||||
|
||||
Some people assume that because major software is composed of hundreds of thousands of lines of code, it's basically impossible to audit. Don't be fooled by how much code it takes to make an application run. You don't actually have to read millions of lines. Code is highly structured, and exploitable flaws are rarely just a single line hidden among the millions of lines; there are usually whole functions involved.
|
||||
|
||||
There are exceptions, of course. Sometimes a serious vulnerability is enabled with just one system call or by linking to one flawed library. Luckily, those kinds of errors are relatively easy to notice, thanks to the active role of security researchers and vulnerability databases.
|
||||
|
||||
Some people point to bug trackers, such as the [Common Vulnerabilities and Exposures (CVE)][2] website, and deduce that it's actually as plain as day that open source isn't secure. After all, hundreds of security risks are filed against lots of open source projects, out in the open for everyone to see. Don't let that fool you, though. Just because you don't get to see the flaws in closed software doesn't mean those flaws don't exist. In fact, we know that they do because exploits are filed against them, too. The difference is that _all_ exploits against open source applications are available for developers (and users) to see so those flaws can be mitigated. That's part of the system that boosts trust in open source, and it's wholly missing from proprietary software.
|
||||
|
||||
There may never be "enough" eyeballs on any code, but the stronger and more diverse the community around the code, the better chance there is to uncover and fix weaknesses.
|
||||
|
||||
### Trust and people
|
||||
|
||||
In open source, the probability that many developers, each working on the same project, have noticed something _not secure_ but have all remained equally silent about that flaw is considered to be low because humans rarely mutually agree to conspire in this way. We've seen how disjointed human behavior can be recently with COVID-19 mitigation:
|
||||
|
||||
* We've all identified a flaw (a virus).
|
||||
* We know how to prevent it from spreading (stay home).
|
||||
* Yet the virus continues to spread because one or more people deviate from the mitigation plan.
|
||||
|
||||
|
||||
|
||||
The same is true for bugs in software. If there's a flaw, someone noticing it will bring it to light (provided, of course, that someone sees it).
|
||||
|
||||
However, with proprietary software, there can be a high probability that many developers working on a project may notice something not secure but remain equally silent because the proprietary model relies on paychecks. If a developer speaks out against a flaw, then that developer may at best hurt the software's reputation, thereby decreasing sales, or at worst, may be fired from their job. Developers being paid to work on software in secret do not tend to talk about its flaws. If you've ever worked as a developer, you've probably signed an NDA, and you've been lectured on the importance of trade secrets, and so on. Proprietary software encourages, and more often enforces, silence even in the face of serious flaws.
|
||||
|
||||
### Trust and software
|
||||
|
||||
Don't trust software you haven't audited.
|
||||
|
||||
If you must trust software you haven't audited, then choose to trust code that's exposed to many developers who independently are likely to speak up about a vulnerability.
|
||||
|
||||
Open source isn't inherently more secure than proprietary software, but the systems in place to fix it are far better planned, implemented, and staffed.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/open-source-security
|
||||
|
||||
作者:[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/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer)
|
||||
[2]: https://cve.mitre.org
|
@ -1,114 +0,0 @@
|
||||
[#]: subject: "Our open source startup journey"
|
||||
[#]: via: "https://opensource.com/article/22/10/tooljet-open-source-journey"
|
||||
[#]: author: "Navaneeth PK https://opensource.com/users/navaneeth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Our open source startup journey
|
||||
======
|
||||
|
||||
[ToolJet][1] is an open source, low-code framework for rapidly building and deploying internal tools. Our codebase is 100% JavaScript and TypeScript.
|
||||
|
||||
A lone developer in April 2021 started ToolJet. The public beta launched in June 2021 and was an instant hit. With this traction, ToolJet raised funding, and currently, we have a team of 20 members.
|
||||
|
||||
### Why open source?
|
||||
|
||||
Before working on ToolJet, I worked with a few enterprise clients as a consultant. Many of these clients were large enough to build and maintain dozens of internal tools. Despite the constant requests from sales, support, and operations teams to add more features and fix the bugs in their internal tools, engineering teams struggled to find the bandwidth to work on the internal utilities.
|
||||
|
||||
I tried using a few platforms to build and maintain internal tools. Most of these tools were very expensive, and frequently, they didn't really fit the requirements. We needed modifications, and most utilities didn't support on-premise hosting.
|
||||
|
||||
As a Ruby developer, I primarily used ActiveAdmin and RailsAdmin to build internal tools. Both utilities are amazing, but making them work with more than one data source is difficult. I then realized there is a need in the market for a framework that could build user interfaces and connect to multiple data sources. I believe any tool built for developers should be open source. Most of the tools and frameworks that developers use daily result from people from all over the world collaborating in public.
|
||||
|
||||
### The first commit
|
||||
|
||||
Building something like ToolJet needed a full-time commitment. Selling one of my side projects gave me a runway of 5-6 months, and I immediately started working on an idea I'd had in mind for at least two years.
|
||||
|
||||
The first commit (rails new) of ToolJet was on April 1, 2021.
|
||||
|
||||
Wait! I said the codebase is 100% JavaScript. Continue reading to discover why.
|
||||
|
||||
### Building and pitching investors
|
||||
|
||||
I sat in front of my screens for most of April and May, coding and pitching to investors for a pre-seed round.
|
||||
|
||||
My work also included creating the drag-and-drop application builder, documenting everything, ensuring there was documentation for setting ToolJet up on popular platforms, creating a website, creating posters and blog posts for launch, and more. The process went well without any major challenges. At this point, the frontend of ToolJet was built using React, with the backend using Ruby on Rails.
|
||||
|
||||
While the coding was going well, investor pitches weren't going great. I sent around 40 cold emails to venture capitalist firms and "angel investors" focused on early-stage funding. While most of them ignored the email, some shared their reason for rejection, and some scheduled a call.
|
||||
|
||||
Most of the calls were the same; I couldn't convince them of an open source business model.
|
||||
|
||||
### The launch
|
||||
|
||||
June 7th was the day of the launch. First, we launched on ProductHunt. Six hours passed, and there were only 70 new signups. But we were trending as the #1 product of the day (and ended up as the #3 product of the week). For posterity, here's the original [post][2].
|
||||
|
||||
I also posted on [HackerNews][3] around 6 PM, and within an hour, the post was #1. I was very happy that many visitors signed up and starred the repository. Many of these visitors and users reported bugs in the application and documentation. Within eight hours of posting on HN, more than 1,000 GitHub users starred ToolJet's GitHub repository, and there were hundreds of signups for ToolJet cloud. The trend continued for three days, and the repo had 2.4k stars.
|
||||
|
||||
![ToolJet repo stats on GitHub][4]
|
||||
|
||||
Image by:
|
||||
|
||||
GitHub StarTrack for ToolJet. (Navaneeth PK, CC BY-SA 4.0)
|
||||
|
||||
### Getting funding
|
||||
|
||||
The traction on GitHub was enough to be noticed by the venture capitalist (VC) world. The days following the launch were packed with calls. We had other options, but did not consider seriously consider them, including:
|
||||
|
||||
- Bootstrapping: During the early stages of the product, it was hard to find paying customers, and I did not have enough savings to fund the project until that happened.
|
||||
- Building as a side project: While this strategy works great for smaller projects, I didn't feel it would work for ToolJet because we needed to create dozens of integrations and UI widgets before the platform could become useful for customers. As a side project, it might take months or years to achieve that.
|
||||
|
||||
I knew it could take months to build the platform I wanted if ToolJet became just a side project. I wanted to accelerate growth by expanding the team, and VC funding was the obvious choice, given the traction.
|
||||
|
||||
The good news is that we raised[$1.55 million in funding][5] within two weeks of the HN launch.
|
||||
|
||||
### Stack matters in open source
|
||||
|
||||
Soon after the launch, we found that many people wanted to contribute to ToolJet, but they were mostly JavaScript developers. We also realized that for a framework like ToolJet that in the future should have hundreds of data source connectors, only a plugin-based architecture made sense. We decided to migrate from Ruby to TypeScript in August 2021. Even though this took about a month and significant effort, this was one of the best decisions we've made for the project. Today, we have an extensible plugin-based architecture powered by our [plugin development kit][6]. We have contributions from over 200 developers. We've written extensively about this migration [here][7] and [here][8].
|
||||
|
||||
### Launching v1.0
|
||||
|
||||
Many users have been using ToolJet on production environments since August, and the platform did not show any stability or scalability issues. We were waiting to wrap up the developer platform feature before we called it v1.0. The ToolJet developer platform allows any JavaScript developer to build and publish plugins for ToolJet. Developers are now able to make connectors for ToolJet. Creating a ToolJet connector can take just 30 minutes, including integration tests.
|
||||
|
||||
### Building a growing community
|
||||
|
||||
![ToolJet star history][9]
|
||||
|
||||
Image by:
|
||||
|
||||
ToolJet Star History (Navaneeth PK, CC BY-SA 4.0)
|
||||
|
||||
We didn't spend money on marketing. Most of our efforts in spreading the news about ToolJet have been writing about our learnings and being active in developer communities. We have a team of three members who take care of community queries.
|
||||
|
||||
### The business model
|
||||
|
||||
ToolJet won't be a sustainable business without a [commercial product][10] to pay the bills. We've built an enterprise edition of ToolJet, for which customers must pay. There's no limit on usage for the free community edition, and additional features in the enterprise edition are relevant only to large teams. We have very large companies as paying customers right now, but we haven't started monetizing ToolJet aggressively. We have enough money left in the bank to build an even better ToolJet, so our focus currently is on product improvement.
|
||||
|
||||
### What's next?
|
||||
|
||||
We frequently release better versions of ToolJet with the help of constant feedback and contributions from the open source community. Many major improvements and dozens of connectors and UI components are in progress. We're moving faster than ever towards our initial goal of being the open framework that can connect to hundreds of data sources and build even the most complicated user interfaces!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/tooljet-open-source-journey
|
||||
|
||||
作者:[Navaneeth PK][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/navaneeth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://github.com/ToolJet/ToolJet
|
||||
[2]: https://www.producthunt.com/products/tooljet-0-5-3
|
||||
[3]: https://news.ycombinator.com/item?id=27421408
|
||||
[4]: https://opensource.com/sites/default/files/2022-10/tooljet-repo-stats.png
|
||||
[5]: https://blog.tooljet.com/raising-vc-funding-for-open-source-project
|
||||
[6]: https://www.npmjs.com/package/@tooljet/cli
|
||||
[7]: https://blog.tooljet.com/migrating-toojet-from-ruby-on-rails-to-nodejs
|
||||
[8]: https://blog.tooljet.com/how-we-migrated-tooljet-server-from-ruby-to-node-js
|
||||
[9]: https://opensource.com/sites/default/files/2022-10/tooljet-star-history.png
|
||||
[10]: https://opensource.com/article/19/11/product-vs-project
|
@ -1,85 +0,0 @@
|
||||
[#]: subject: "Write documentation like you develop code"
|
||||
[#]: via: "https://opensource.com/article/22/10/docs-as-code"
|
||||
[#]: author: "Lorna Mitchell https://opensource.com/users/lornajane"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Write documentation like you develop code
|
||||
======
|
||||
|
||||
Don't want documentation to be an afterthought? Try a new approach.
|
||||
|
||||
Many engineers and craftspeople are particular about their tools. To do a job well, you need the best tools and the skills to use them. The best tools in software development can be very powerful when applied to other kinds of digital creation. The [Docs as Code][1] approach is a great example. Docs as Code entails writing documentation using the same tools and workflows used for developing code. Proponents of Docs as Code report that this method leads to better documentation while easing the workload of the people who write it.
|
||||
|
||||
### Text formats and source control
|
||||
|
||||
The most significant adjustment when moving from a more traditional documentation platform to the Docs as Code approach is that the content is stored in a text-based markup format. This change makes all the tools for text-based materials available for generating documentation. Whether you choose [DocBook][2], [Markdown][3], or another markup language, the transition from using just one tool to using a standard format and a variety of tools is a big change.
|
||||
|
||||
Finding tools that support your workflow is really important. Many developers use their [coding editors][4] when working on Docs as Code projects. Since they are already advanced-level users with that tool, it works well for them. Finding tooling that fits the other professionals on the team, such as technical writers, editors, information architects, and documentation product owners, may take more effort. A few options to consider:
|
||||
|
||||
- One of the many [good markdown editors][5] available
|
||||
- Coding editors with good preview tools, which make them approachable for non-coders
|
||||
- The web interfaces of popular Git hosting services, especially for occasional contributors
|
||||
|
||||
Once content is safely in a markup format, the project can use source control such as [Git][6], an open source tool with many more features than most documentation platforms can claim:
|
||||
|
||||
- A clear and detailed version history of who changed what and when. If you have good commit message culture, you may even be able to learn why the change was made.
|
||||
- Easy parallel change processes. Working in branches in Git means everyone can make all the changes they want to and combine them at the end.
|
||||
- Advanced collaboration and review tooling. All the source-control platforms are designed to review each change in detail and have as much discussion as needed until everyone is confident that the change can go ahead.
|
||||
- Automated quality checks such as spellchecking and link checking. This saves time and catches errors that might otherwise be missed.
|
||||
|
||||
Source control has many benefits. Just keep in mind that if you're new to source control, it has a learning curve. There are some excellent [learning resources][7] and [articles for writers][8] that can help. You can also let your curious documentarians find the learning materials that work for them rather than asking your engineers to teach them. (Ask me how I learned this—the hard way of course!)
|
||||
|
||||
### Pull requests and review cycles
|
||||
|
||||
All source-control platforms are designed around the concept of pull requests, sometimes also called merge requests. Someone, or some team, puts together a set of changes and then requests that the changes are pulled into the main project. In many ways, working with many changes at once is easier in documentation than in code. Changing one article in one place in documentation has fewer side effects than when you change code and find that there were several other sections depending on it.
|
||||
|
||||
The most powerful collaboration tool is the [diff][9], which shows the difference between old and new versions in a way that's easy to follow. There are many versions of this tool available to make the comparison view easier to look at: side-by-side, inline, or even as rendered markdown rather than just text. Each team member can use the tool or tools that work best for them. For example, the web view is commonly used to look at a small change, but for something bigger I would want to look at it locally using `vimdiff` or [Meld][10].
|
||||
|
||||
Review comments can be added to the change as a whole or to individual lines in the proposed change. Some projects adopt a maximum line length, called a hard wrap, or start each sentence on a new line to make it easier to attach comments to specific parts of a block of text. Further changes and comments can be added until the review process is complete and the change is accepted. Since the pull requests are shown in a queue on the repository for the project, this is a good way to show what's in progress and what needs review attention. The tools make it easy for reviewers to add their thoughts. In particular, if you are working with technical audiences it can be easier to get reviews from these folks via the tools they use daily.
|
||||
|
||||
### Continuous integration and deployment
|
||||
|
||||
Having the source of your documentation available in plain text has many benefits, such as making it easy to find every occurrence of something that needs changing and using existing tools such as [wc][11], [grep][12], or `tree` to work with potentially large document sets. When you combine this with a source-control platform, even more existing tools become available, and they're all open source.
|
||||
|
||||
One big workflow improvement is the ability to have continuous deployment in place. This simply means that when a pull request is merged into the main project, the project is immediately and automatically deployed. If the change is good enough to be accepted into the project, it is also good enough to be live on the documentation site, helping your readers. Typically, continuous deployment is set up with either a separate automation server, such as [Jenkins][13], or [Git Hooks][14]. Either way, the text-based markup is combined with the Docs as Code platform (usually a static site generator such as [Hugo][15] or [Sphinx][16]) to produce the documentation website, which is then deployed.
|
||||
|
||||
The same automation can be used before deployment to add some excellent checks to the pull requests before they are merged. On a coding project, it's common to run code linters, tests, and other quality checks that a machine can do itself. Documentation projects can get the same treatment, with tools like [Vale][17] to do prose linting and check for correct heading styles, spellings, and so on. It's also useful to add other tools here, such as a link checker to make sure all the links go somewhere valid.
|
||||
|
||||
### Code tools for docs workflows
|
||||
|
||||
The tools known and loved by engineers are very good tools, but they are useful for all sorts of other projects too. For documentation, they contribute valuable efficiency, especially when you need your documentation to be moving at the same speed as your development teams. All the tools discussed here are open source, so you can try them for yourself, deploy them for a huge global team, or anything in between. May your docs process be as smooth as any code process.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/docs-as-code
|
||||
|
||||
作者:[Lorna Mitchell][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/lornajane
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.writethedocs.org/guide/docs-as-code
|
||||
[2]: https://opensource.com/article/17/9/docbook
|
||||
[3]: http://commonmark.org
|
||||
[4]: https://opensource.com/article/20/12/eclipse
|
||||
[5]: https://opensource.com/article/21/10/markdown-editors
|
||||
[6]: https://opensource.com/downloads/cheat-sheet-git
|
||||
[7]: https://opensource.com/article/18/1/step-step-guide-git
|
||||
[8]: https://opensource.com/article/19/4/write-git
|
||||
[9]: https://opensource.com/article/21/11/linux-diff-patch
|
||||
[10]: https://opensource.com/article/20/3/meld
|
||||
[11]: https://www.redhat.com/sysadmin/linux-wc-command?intcmp=7013a000002qLH8AAM
|
||||
[12]: https://opensource.com/downloads/grep-cheat-sheet
|
||||
[13]: https://www.jenkins.io
|
||||
[14]: https://www.redhat.com/sysadmin/git-hooks
|
||||
[15]: https://opensource.com/article/18/3/start-blog-30-minutes-hugo
|
||||
[16]: https://opensource.com/article/19/11/document-python-sphinx
|
||||
[17]: https://vale.sh
|
@ -1,93 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How open principles will impact the future of work)
|
||||
[#]: via: (https://opensource.com/open-organization/21/1/open-is-future-of-work)
|
||||
[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland)
|
||||
|
||||
How open principles will impact the future of work
|
||||
======
|
||||
In many ways, the nature of our work defines us. So how do we prepare
|
||||
for a future when the nature of work will change dramatically?
|
||||
![Working on a team, busy worklife][1]
|
||||
|
||||
If we define "work" as any contribution that receives any kind of reward, then work is—and always has been—one of the major factors that define who we are. It is a major aspect of our lives. Throughout our work (whatever that may be for us), we meet friends, identify sources of intellectual stimulation and emotional fulfillment, grow, and feel at our most creative and innovative. To our families, friends, communities and societies, work is extremely important. We should not take work—or its role in our lives—lightly or for granted.
|
||||
|
||||
So if the [nature of work is going to change][2] in the future, it might mean that something key to our very sense of _self_ is going to change. And we should plan for those changes very seriously.
|
||||
|
||||
Consider the transformation of work throughout the Industrial Revolution (between the 1700s and 1800s). It drove many people from rural farm work into factories in the cities, fundamentally altering their lifestyles. It required new, more specialized skills (rather than the kind of artisanship common in rural economies). As we examine our own personal work environments in the decades to come, we'll see a potential reversal of the trends we saw during the Industrial era: from hierarchy and interchangeable general skills and activities to the reinstatement of horizontal collaboration and more specialized mastery (back to artisanship).
|
||||
|
||||
This time, though, these changes come on a global scale rather than a local one, and the speed of change is far more accelerated.
|
||||
|
||||
And in this new work environment, [open organization principles][3] will play a vital role.
|
||||
|
||||
In this series, I'll review [_The Shift_, a book by Professor Lynda Gratton][4]—a book that, while written in 2014 from data assembled in 2010, still rings true today (and will in the future, too). In this book, Gratton projects how work will change around 2025 and 2050. This is vital information, as it will help us make sound choices when preparing for and developing our careers moving forward.
|
||||
|
||||
Gratton explains predominant forces influencing the future of work in this timeframe. In this article series, I'll summarize them—and explain how open organization principles are involved in each.
|
||||
|
||||
### Five factors influencing the future of work
|
||||
|
||||
Driving the Industrial Revolution were inventions that used coal and steam power. Today, [Gratton][5] says, five subtle forces are causing a similar "shift":
|
||||
|
||||
1. increased global activities
|
||||
2. rapid advances in technology
|
||||
3. human longevity and demographics
|
||||
4. societal and family structural changes
|
||||
5. the need for a low-carbon economy
|
||||
|
||||
|
||||
|
||||
In short: Computers will become faster. Materials will become stronger. Medicines will cure more diseases allowing longer human life. To varying degrees, these will all impact on how we work in the future. Here are a few notes on each.
|
||||
|
||||
#### 1\. Globalization
|
||||
|
||||
In a previous article, "[Globalization: A history of openness][6]," I discussed multiple forces and factors related to globalization, one of them being trade. Between 1950 and 2010 the volume of global trade has increased by 60 times, while at the same time transportation costs have fallen. And at the same time, developing countries are seeing not only increased trade but new innovations. I also discussed globalization in early history as part of my article "[Open organizations through the ages][7]." And I explored the importance of global governance—both now and into the future—in my article ["What would a global open organization look like?"][8] According to Gratton, globalization will have an undeniable and unavoidable impact on the future work.
|
||||
|
||||
If the nature of work is going to change in the future, it might mean that something key to our very sense of self is going to change. And we should plan for those changes very seriously.
|
||||
|
||||
#### 2\. Technology
|
||||
|
||||
The cost of computing has been coming down at an alarming rate. And it will continue to decrease. This will help connect billions of people that have been mostly left out of the greater global economy until now. They will start to both enter the workforce and become more influential consumers. At the same time, computers and advanced automation [will replace jobs performed by humans][9] in the future. This all will influence work shifts in the future.
|
||||
|
||||
#### 3\. Demographics and longevity
|
||||
|
||||
Gratton also notes the impacts that various generations will have on the future of work, particularly in the United States. Younger generations will play a major role in the future, as their attitudes are different from earlier generations. Moreover, birth rates in various global regions will have an impact on prosperity. There will be more migration, as some regions' populations will decline while others increase. They will move to what Professor Gratton calls "creative clusters." And finally, Gratton argues, the life expectancy globally will change. By 2025, 10% of the world's population will be over the age of 65. These people will more than likely want to continue to work for sustained income, continued mental stimulation, physical activity, connection to others, and a source of meaning and purpose in their lives. Also, consider that many children today will more than likely live longer than 100 years. If they retired at 65 years old, they would have 35 years to do very little. With that thought in mind, having several career changes and being active in volunteer and community service programs in the future will expand greatly.
|
||||
|
||||
#### 4\. Society
|
||||
|
||||
In addition to the generational changes, Gratton notes several important social changes, too. There will be changing roles of women in the workplace, she says. People will have more choices to form the life they want than ever before. And with increased productivity per person, there will be more average free time available than ever before, she writes.
|
||||
|
||||
#### 5\. Energy resources
|
||||
|
||||
I've talked about the expansion of resource-saving industries in a presentation I've given on "[The Resource Industrial Revolution][10]." Gratton adds valuable points to this conversation. Climate change, she notes, will gradually become a major issue, which will reduce transportation and consumption. In particular, global water supply will not be able to keep pace with demand. Water desalination projects will expand greatly (possibly powered by [Generation IV][11] distributed small modular nuclear power plants (SMR's) now being developed). Environmental catastrophes will displace people and migration will create displaced communities throughout the globe. More energy-efficient ways of living will be discovered and introduced. This will influence future jobs.
|
||||
|
||||
### Preparing for the future
|
||||
|
||||
These five forces will prompt fundamental changes to the way we work in the future, Gratton argues. But we need to begin preparing for that future now. In the next article of this series, I'll explain Gratton's outlook and a few scenarios for grappling with a rapidly changing future. How could a person look at those changes as career opportunities? On the other hand, what would happen if a person simply _ignored_ those changes to come? I'll review Gratton's thoughts on those questions. Also, I'll also explain how open principles can form the heart of necessary changes.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/open-organization/21/1/open-is-future-of-work
|
||||
|
||||
作者:[Ron McFarland][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/ron-mcfarland
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team_dev_email_chat_video_work_wfm_desk_520.png?itok=6YtME4Hj (Working on a team, busy worklife)
|
||||
[2]: https://opensource.com/open-organization/18/7/transformation-beyond-digital-2
|
||||
[3]: https://theopenorganization.org/definition/
|
||||
[4]: http://lyndagratton.com/books/the-shift/
|
||||
[5]: https://en.wikipedia.org/wiki/Lynda_Gratton
|
||||
[6]: https://opensource.com/open-organization/20/7/globalization-history-open
|
||||
[7]: https://opensource.com/open-organization/20/8/global-history-collaboration
|
||||
[8]: https://opensource.com/open-organization/20/9/global-open-organization
|
||||
[9]: https://opensource.com/open-organization/19/9/claiming-human-age-of-AI
|
||||
[10]: https://www.slideshare.net/RonMcFarland1/the-starting-of-the-third-industrial-revolution
|
||||
[11]: https://en.wikipedia.org/wiki/Generation_IV_reactor
|
@ -2,7 +2,7 @@
|
||||
[#]: via: "https://fedoramagazine.org/open-source-game-achievements/"
|
||||
[#]: author: "Dennis Payne https://fedoramagazine.org/author/dulsi/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: translator: "toknow-gh"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
@ -1,95 +0,0 @@
|
||||
[#]: subject: "WiFi 6 Promises Much More than Faster Speeds"
|
||||
[#]: via: "https://www.opensourceforu.com/2022/06/wifi-6-promises-much-more-than-faster-speeds/"
|
||||
[#]: author: "Sharon Katta https://www.opensourceforu.com/author/sharon-katta/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
WiFi 6 Promises Much More than Faster Speeds
|
||||
======
|
||||
WiFi 6 increases the network connectivity, and has been developed to ensure the trillions of devices connected in the near future continue to work seamlessly and efficiently. Though it was certified in 2019, it faced a few challenges in testing due to the pandemic. This article gives an overview of this technology.
|
||||
|
||||
![WiFi-6][1]
|
||||
|
||||
The next-generation standard in WiFi technology, termed ‘WiFi 6’, is also known as ‘AX WiFi’ or ‘802.11ax’. Developed to meet the exponential increase in demand for devices in the world, it can be used for virtual reality (VR) and smart home devices as well. It is an improvement on the current 802.11ac WiFi standard and meets current challenges in terms of capacity, efficiency, coverage and performance.
|
||||
|
||||
![Figure 1: WiFi 6][2]
|
||||
|
||||
Researched in 2014, this standard was invented in 2018 and launched by the IEEE High Efficiency WLAN Study Group (HEW SG). It began certifications in late 2019, with Samsung’s Galaxy Note 10 and Ruckus R750 employing this technology. Specified to operate between the 1GHz and 6GHz bands, WiFi 6 focuses mainly between the 2.4GHz and 5GHz frequencies.
|
||||
|
||||
In an average household today, nine devices are connected to WiFi. WiFi 6 aims at improving the network rather than boosting the speed for individual devices.
|
||||
|
||||
### Features of WiFi 6
|
||||
|
||||
**Multi-user, multi-input, multi-output (MU-MIMO):** This communication between routers and multiple devices concurrently. It supports four simultaneous data streams, added to which one user can have a considerable bandwidth of incoming data from a smart router, both on the 2.4GHz and 5GHz frequencies.
|
||||
**1024-QAM:** This helps WiFi 6 encode more bits per packet. There is a 25 per cent increase in throughput. Not only does it improve efficiency in high-traffic situations, it also maximises data rates. This is a huge advantage for modern enterprise applications.
|
||||
**Orthogonal frequency-division multiplexing (OFDM):** This allows four times as many subcarriers and increases speed by 11 per cent. The expanded signal allows for greater simultaneous packet delivery across users. Hence, the wait time between packets and latency is reduced.
|
||||
*Increased channel width:* The 160MHz channel communication is added to the 80MHz band, thus doubling the channel width. This allows routers to handle more users and provide larger streams per user.
|
||||
*Target wake time (TWT):* This feature is unique to WiFi 6. It allows each device to independently negotiate wake time for transmission and reception. This helps to increase total sleep time and maximise battery life. TWT enables many additional networking options, especially for IoT devices.
|
||||
*Improved security:* All WiFi 6 devices will need to include Wi-Fi Protected Access 3 (WPA3). This will lead to encryption of unauthenticated traffic, robust password protection against brute-force dictionary attacks, and superior data reliability for sensitive information with 192-bit encryption.
|
||||
*Beamforming:* With eight support antennas, beamforming helps to improve data rates, and the range is extended by directing signals towards specific clients at once. It offers a backup for rapidly moving devices that may face issues with MU-MIMO. Beamforming also helps to control transmissions from antennas that cause signals to interfere on purpose. The signal can then be redirected to a new direction.
|
||||
|
||||
### Devices that support WiFi 6
|
||||
|
||||
Until recently, WiFi 5 was the standard used for routers, repeaters, mesh networks and many WiFi clients. WiFi 6 was launched in 2019. There will be some compatibility issues for the earlier devices that supported WiFi 5 — they will be able to utilise the WiFi 6 network but not be able to receive support for the same.
|
||||
|
||||
WiFi 6 routers are backward-compatible, and it is better to make sure that the network is ready for that.
|
||||
|
||||
WiFi 6 enables lower battery consumption, making it a great choice for any environment, including the Internet of Things (IoT). It reduces unnecessary data activity, and tells devices when to put their data to sleep and when to be active. As a result, unnecessary data activity is reduced, and performance and battery life are maximised.
|
||||
|
||||
The Samsung Galaxy Note 10 and Ruckus R750 were the world’s first smartphone and access point certified to support Wi-Fi 6, with the latest generation of the Apple iPhone following suit. The Wi-Fi Alliance has set up its certification programme, and new wireless products hitting the market are expected to start applying for compliance certification. The devices listed below are already WiFi 6 enabled:
|
||||
|
||||
* iPhone 11 and after
|
||||
* Samsung Galaxy S10, S20, Note 10, and Note 20
|
||||
* Apple computers with M1 processors
|
||||
* Smart TVs
|
||||
|
||||
> To take advantage of the improvements in the 802.11ax standard fully, both hardware and software functionalities have to be built on this WiFi technology.
|
||||
|
||||
### Hardware testing
|
||||
|
||||
To unlock the full potential of the latest devices, a WiFi 6 router is needed to run the network. This was an expensive affair a few years ago, but now we have a number of options even for mesh systems, gaming routers, range extenders, and more. The best purchase can be made only when hands-on testing is done. Beating all its competitors, the current king in terms of speed for WiFi 6 routers is TP-Link Archer AX6000. This router was able to transmit data wirelessly at a rate of 1523 Mbps up to a distance of 1.5 metres (5 feet).
|
||||
|
||||
One important thing to remember here is that these routers do not magically increase speeds. The theoretical maximum of achieving 9.6 Gbps is unlikely. This high theoretical speed can be split up across a whole network of devices.
|
||||
|
||||
WiFi 6 emphasises quality connectivity in areas where connected devices are densely populated. It does not increase the speed of each device exponentially but ensures these operate at an optimum level.
|
||||
|
||||
Only the combination of a faster plan from the Internet service providers (ISPs) along with the WiFi 6 router, can fulfil its true potential. The real challenge is for the ISPs, as they need new fibre rollouts to capitalise on this next-gen technology. An important question is: when faster ISP speeds come, will the existing hardware become redundant?
|
||||
|
||||
### Applications of WiFi 6
|
||||
|
||||
**Large public venues (LPVs):** Stadiums and convention centres are a few of the common areas where thousands of devices connect to WiFi at the same time. WiFi 6 can help to improve attendee experiences, increase customer interactions, and create value-added services like viewing instant replays or ordering food from one’s seat at an event. WiFi 6 allows LPV owners to create new business opportunities.
|
||||
**Transport hubs:** Public transport stations are also an area where people attempt to connect to the network simultaneously. OFDMA and BSS colouring in WiFi 6 provide the necessary tools needed to overcome this challenge.
|
||||
**IoT and smart city deployments:** Power efficiencies in WiFi 6 enable IoT devices to go into sleep mode and turn on their transmitters at predefined intervals to prolong field time without much maintenance.
|
||||
**Education:** Libraries, auditoriums, and lecture halls at college and university campuses have the highest density of WiFi users during the day, and almost no one at night. WiFi 6 is a perfect choice in this situation.
|
||||
|
||||
### The challenges
|
||||
|
||||
WiFi 6 does not promise an increase in speed, but is an upgrade designed to make sure the speeds of our devices within a given range/area doesn’t slow down a few years down the road. There are three major challenges it faces though, which are often overlooked.
|
||||
Improving the functionality of unsupported devices: Even though WiFi 6 is backward- compatible, justice to it can only be done when this technology is used to the maximum. This means devices need to be upgraded each time.
|
||||
|
||||
Speed and performance outside the internal network: WiFi 6 can provide excellent connectivity for services like cloud file shares. However, the assets and resources of ISPs can affect speed and performance.
|
||||
|
||||
*Coverage issues:* Transmission and bandwidths are capped according to the regulations prevalent in each country. Hence, the coverage of WiFi 6 may be restricted to ensure this cap is met.
|
||||
|
||||
In spite of these challenges, companies like Aruba, Asus, AT&T, Boingo, Broadcom, Cisco, Comcast, CommScope, Cypress, Extreme Networks, Intel, Netgear, Orange, Qualcomm, TP-Link and Xiaomi are all focusing on the potential WiFi 6 has.
|
||||
|
||||
(LCTT 译注:选题删除了原文中的相关产品推荐部分。)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.opensourceforu.com/2022/06/wifi-6-promises-much-more-than-faster-speeds/
|
||||
|
||||
作者:[Sharon Katta][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.opensourceforu.com/author/sharon-katta/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.opensourceforu.com/wp-content/uploads/2022/05/WiFi-6.jpg
|
||||
[2]: https://www.opensourceforu.com/wp-content/uploads/2022/05/WiFi-6-1.jpg
|
@ -1,187 +0,0 @@
|
||||
[#]: subject: "How to Record Streaming Audio in Ubuntu and other Linux Distributions"
|
||||
[#]: via: "https://itsfoss.com/record-streaming-audio/"
|
||||
[#]: author: "Abhishek Prakash https://itsfoss.com/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "FYJNEVERFOLLOWS"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Record Streaming Audio in Ubuntu and other Linux Distributions
|
||||
======
|
||||
How to record audio in Ubuntu and other Linux distributions?
|
||||
|
||||
If you want to record a voice over through the microphone of your computer, you can use GNOME Sound recorder or Audacity.
|
||||
|
||||
Using GNOME Sound Recorder is easy but it lacks features. Audacity could be overwhelming initially but it has plenty of features for professional level recording. However, I am not going into that detail in this tutorial.
|
||||
|
||||
GNOME Sound Recorder works with the microphone. There is another tool called Audio recorder and you can use it to record streaming music (from Sptify, YouTube, internet radio, Skype and most other sources) apart from microphone input.
|
||||
|
||||
To summarize, I’ll show you the steps:
|
||||
|
||||
* To record sound using GNOME Sound Recorder
|
||||
* To record streaming audio using Audio Recorder
|
||||
|
||||
### Using Sound Recorder to record audio from the microphone
|
||||
|
||||
GNOME desktop environment has a good variety of useful applications. Sound Recorder is one of them.
|
||||
|
||||
You can install the [Sound Recorder][1] from the Ubuntu Software Center.
|
||||
|
||||
![Sound Recorder can be installed from the Ubuntu Software Center][2]
|
||||
|
||||
Or, you can use this command in the terminal to install it:
|
||||
|
||||
```
|
||||
sudo apt install gnome-sound-recorder
|
||||
```
|
||||
|
||||
Once installed, you can find it in the system menu and start from there.
|
||||
|
||||
![GNOME Sound Recorder][3]
|
||||
|
||||
Before you start using it, you should ensure that you have the correct input source chosen in the system settings. GNOME Sound Recorder
|
||||
|
||||
![Ensure that you have chosen correct input in system settings][4]
|
||||
|
||||
Once you open the Sound Recorder application, it will show an interface like the one below.
|
||||
|
||||
![Hit the Record button to start audio recording][5]
|
||||
|
||||
Hit on the record button and it starts recording audio instantly. While recording, you get options to pause, stop or discord the recording.
|
||||
|
||||
![Options while recording audio][6]
|
||||
|
||||
Your recordings are saved and available from the application interface itself. Click on the saved recordings to highlight it.
|
||||
|
||||
You can replay the recordings or delete it. You can choose to save it to another location by clicking the save/download button. You may also rename the recordings using the edit button.
|
||||
|
||||
![Saved recordings][7]
|
||||
|
||||
That’s quite convenient, right? You can choose to record in MP3, FLAC and a couple of more formats.
|
||||
|
||||
#### Removing GNOME Sound Recorder
|
||||
|
||||
Don’t like it or find it lacking in terms of features?
|
||||
|
||||
You can remove GNOME Sound Recorder from the Ubuntu Software Center or use the following command:
|
||||
|
||||
```
|
||||
sudo apt remove gnome-sound-recorder
|
||||
```
|
||||
|
||||
The application of GNOME Sound recorder is limited. It only records from the microphone and this is not what you would want in certain situations.
|
||||
|
||||
Imagin you want to record a Skype call or something which is playing in an application or web browser? The nifty Audio Recorder helps in such cases.
|
||||
|
||||
### Using Audio Recorder to record streaming audio
|
||||
|
||||
You can watch this video to see how to use Audio Recorder. It’s a bit old but the steps are the same.
|
||||
|
||||
![A Video from YouTube][8]
|
||||
|
||||
[Subscribe to our YouTube channel for more Linux videos][9]
|
||||
|
||||
You can use the [official PPA][10] to install Audio Recorder in Ubuntu and Linux Mint. Use the following commands in the terminal (Ctrl+Alt+T) one by one:
|
||||
|
||||
```
|
||||
sudo apt-add-repository ppa:audio-recorder/ppa
|
||||
sudo apt update
|
||||
sudo apt install audio-recorder
|
||||
```
|
||||
|
||||
Alternatively, you can download the source code from [launchpad][11]. Once installed, you can start the application from the Activity Overview:
|
||||
|
||||
![Audio Recorder][12]
|
||||
|
||||
#### Record all kinds of sound from various sources
|
||||
|
||||
Audio Recorder records all kinds of sounds your computer makes.
|
||||
|
||||
It records audio played through your system’s soundcard, microphones, browsers, webcams and more.
|
||||
|
||||
In other words, it records even if your system sneezes (given that you want to record it). It allows you to select the recording device such as webcam, microphone, Skype, etc.
|
||||
|
||||
To record the streaming music, select the appropriate source. For example, if you are playing streaming radio in Rhythmbox, then select Rythmbox.
|
||||
|
||||
![Audio-Recorder Audio Settings][13]
|
||||
|
||||
#### Record at your convenience
|
||||
|
||||
Audio Recorder also gives you the option of setting timer. You can start, stop or pause recording at a given clock time or at a pre-defined interval. You can also set the limit on the recorded file size.
|
||||
|
||||
Moreover, you can pause (and stop) when there is no audio (or very low sound) and resume it when sound comes back.
|
||||
|
||||
All you have to do is to edit the text in the Timer panel. Comment out the “rules” you don’t want to apply and edit the ones per your requirement.
|
||||
|
||||
![Audio-recorder Timer Settings][14]
|
||||
|
||||
It provides additional settings like auto start at login, show tray icon and other record settings.
|
||||
|
||||
![Audio-recorder Additional Settings][15]
|
||||
|
||||
#### Save the recorded music file in various file formats
|
||||
|
||||
Another gem. You can save the recorded file in your favourite file format. Supported file formats are OGG audio, Flac, MP3, SPX and WAV. I prefer MP3 for my recordings.
|
||||
|
||||
The **recorded files are stored in ~/Audio** i.e., in the Audio folder inside your home directory.
|
||||
|
||||
![Audio-recorder Audio Formats][16]
|
||||
|
||||
#### How good is Audio Recorder?
|
||||
|
||||
I used Audio Recorder in Ubuntu to [record the music played on YouTube][17]. I saved a 2-minute video in MP3 format that took 934 KB of space. But I must say I was not expecting the recorded sound quality to be so good. Honestly, I could not distinguish it from the original YouTube song.
|
||||
|
||||
#### Removing Audio Recorder
|
||||
|
||||
If you don’t find Audio Recorder to your liking, you can remove it using the following commands:
|
||||
|
||||
```
|
||||
sudo apt remove audio-recorder
|
||||
```
|
||||
|
||||
It will be a good idea to [remove the PPA as well][18]:
|
||||
|
||||
```
|
||||
sudo apt-add-repository -r ppa:audio-recorder/ppa
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
There are probably several other tools for audio recording in Linux. Like GNOME, other desktop environments may also have sound recording apps. I know Deepin has one for sure.
|
||||
|
||||
GNOME Sound Recorder is a decent tool for recording sound from your microphone. For recording sound from various sources, Audio Recorder is a good choice.
|
||||
|
||||
I hope it helps with your audio recording needs. Let me know if you have any suggestions.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/record-streaming-audio/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/FYJNEVERFOLLOWS)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://wiki.gnome.org/Apps/SoundRecorder
|
||||
[2]: https://itsfoss.com/wp-content/uploads/2022/08/sound-recorder-ubuntu.png
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/08/sound-recorder.png
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/08/microphone-settings-ubuntu.png
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/08/using-sound-recorder-linux.png
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/08/sound-recording-with-sound-recorder.png
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2022/08/sound-recorder-interface.png
|
||||
[8]: https://youtu.be/o7Ia2QGeB7Q
|
||||
[9]: https://www.youtube.com/c/itsfoss?sub_confirmation=1
|
||||
[10]: https://launchpad.net/~audio-recorder/+archive/ubuntu/ppa
|
||||
[11]: https://launchpad.net/audio-recorder
|
||||
[12]: https://itsfoss.com/wp-content/uploads/2022/08/audio-recorder-in-overview.png
|
||||
[13]: https://itsfoss.com/wp-content/uploads/2022/08/audio-recorder-audio-settings.png
|
||||
[14]: https://itsfoss.com/wp-content/uploads/2022/08/audio-recorder-timer-settings.png
|
||||
[15]: https://itsfoss.com/wp-content/uploads/2022/08/audio-recorder-additional-settings.png
|
||||
[16]: https://itsfoss.com/wp-content/uploads/2022/08/audio-recorder-audio-formats.png
|
||||
[17]: https://itsfoss.com/youtube-dl-audio-only/
|
||||
[18]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/
|
@ -1,100 +0,0 @@
|
||||
[#]: subject: "Learn the OSI model in 5 minutes"
|
||||
[#]: via: "https://opensource.com/article/22/10/osi-model-network-communications"
|
||||
[#]: author: "Anamika https://opensource.com/users/anamika"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Learn the OSI model in 5 minutes
|
||||
======
|
||||
Get the basics of the Open Systems Interconnection (OSI) framework for conceptualizing communication within a computer system.
|
||||
|
||||
The Open Systems Interconnection (OSI) model is a standard for how computers, servers, and people communicate within a system. It was the first standard model for network communications and was adopted in the early 1980s by all major computer and telecommunications companies.
|
||||
|
||||
The OSI model provides a universal language for describing networks and thinking about them in discrete chunks, or layers.
|
||||
|
||||
### Layers of the OSI model
|
||||
|
||||
The model describes the seven layers through which computer systems communicate over a network.
|
||||
|
||||
1. [Application layer][2]
|
||||
2. [Presentation layer][3]
|
||||
3. [Session layer][4]
|
||||
4. [Transport layer][5]
|
||||
5. [Network layer][6]
|
||||
6. [Data link layer][7]
|
||||
7. [Physical layer][8]
|
||||
|
||||
Each of these layers has its own way of working, with its own set of protocols that distinguish it from the others. This article provides a breakdown of the layers one by one.
|
||||
|
||||
### Application layer
|
||||
|
||||
The application layer is implemented in software. It is the layer used to interact with applications.
|
||||
|
||||
Consider the example of sending a message. The sender will interact with the application layer and send the message. The application layer sends the message to the next layer in the OSI Model, the presentation layer.
|
||||
|
||||
### Presentation layer
|
||||
|
||||
The data from the application layer is forwarded to the presentation layer. The presentation layer receives the data in the form of words, characters, letters, numbers, and so on, and converts them into machine representable binary format. This process is known as translation.
|
||||
|
||||
At this stage, ASCII characters (American Standard Code for Information Interchange) are converted into Extended Binary Coded Decimal Interchange Code (EBCDIC). Before the converted data goes further, it also undergoes encoding and encryption processes, using the SSL protocol for encryption and decryption.
|
||||
|
||||
The presentation layer provides abstraction and assumes that the layers following it will take care of the data forwarded to them from this layer. It also plays a role in compression of the data. The compression can be lossy or lossless, depending on various factors beyond this article's scope.
|
||||
|
||||
### Session layer
|
||||
|
||||
The session layer helps in setting up and managing connections. The main work of this layer is to establish a session. For example, on an online shopping site, a session is created between your computer and the site's server.
|
||||
|
||||
The session layer enables the sending and receiving of data, followed by the termination of connected sessions. Authentication is done before a session is established, followed by authorization. Like the previous layers, the session layer also assumes that, after its work is done, the data will be correctly handled by the subsequent layers.
|
||||
|
||||
### Transport layer
|
||||
|
||||
The transport layer manages data transportation and its own set of protocols for how data will be transferred. The data received here from the session layer is divided into smaller data units called segments. This process is known as segmentation. Every segment contains the source's and destination's port numbers and a sequence number. Port numbers identify the application on which the data needs to be sent. Note that the data is transferred in chunks. The sequence numbers are used to reassemble the segments in the correct order.
|
||||
|
||||
The transport layer takes care of the flow control, or the amount of data transferred at a given time. It also accounts for error control, such as data loss, data corruption, and so on. It makes use of an error-detecting value known as a checksum. The transport layer adds a checksum to every data segment to check whether the sent data is received correctly. Data is then transferred to the network layer.
|
||||
|
||||
### Network layer
|
||||
|
||||
The network layer helps communicate with other networks. It works to transmit received data segments from one computer to another located in a different network. The router lives in the network layer.
|
||||
|
||||
The function of the network layer is logical addressing (IP Addressing). It assigns the sender's and receiver's IP addresses to each data packet to ensure it is received at the correct destination. The network layer then routes the data packets. Load balancing also happens in the network layer to make sure that no overloading takes place. Next, the data is transported to the data link layer.
|
||||
|
||||
### Data link layer
|
||||
|
||||
The data link layer allows direct communication with other devices, such as computers and hosts.
|
||||
|
||||
It receives data packets containing the IP addresses of the sender and receiver from the network layer and does the physical addressing, assigning the media access control (MAC) addresses of the sender and receiver to a data packet to form a frame.
|
||||
|
||||
### Physical layer
|
||||
|
||||
This layer consists of all the hardware and mechanical elements of a system, including the configuration of wires, pins, adapters, and so forth. The data received here by the preceding layers is in the form of 0s and 1s. The physical layer converts this data and transports it to local media via various means, including wires, electrical signals, light signals (as in optical fiber cables), and radio signals (as in WiFi).
|
||||
|
||||
Note that the physical layer works at the receiver's end and transports the received signal to the data link as a frame (by converting it back to bits). The frame is moved to the higher layers, and ultimately the required data is received at the application layer, which is the software.
|
||||
|
||||
### Conclusion
|
||||
|
||||
The OSI model is helpful when you need to describe network architecture or troubleshoot network problems. I hope this article gave you a clearer understanding of the elements this model.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/10/osi-model-network-communications
|
||||
|
||||
作者:[Anamika][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/anamika
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/code_computer_development_programming.png
|
||||
[2]: https://opensource.com/article/22/10/osi-model-network-communications#application-layer
|
||||
[3]: https://opensource.com/article/22/10/osi-model-network-communications#presentation-layer
|
||||
[4]: https://opensource.com/article/22/10/osi-model-network-communications#session-layer
|
||||
[5]: https://opensource.com/article/22/10/osi-model-network-communications#transport-layer
|
||||
[6]: https://opensource.com/article/22/10/osi-model-network-communications#network-layer
|
||||
[7]: https://opensource.com/article/22/10/osi-model-network-communications#data-link-layer
|
||||
[8]: https://opensource.com/article/22/10/osi-model-network-communications#physical-layer
|
@ -1,537 +0,0 @@
|
||||
[#]: subject: "How To Securely Transfer Files With SCP In Linux"
|
||||
[#]: via: "https://ostechnix.com/securely-transfer-files-with-scp-in-linux/"
|
||||
[#]: author: "sk https://ostechnix.com/author/sk/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "MjSeven"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How To Securely Transfer Files With SCP In Linux
|
||||
======
|
||||
|
||||
File transfer over a network can be done in various ways and using different protocols. The most commonly used protocols for **copying files remotely** are **Rsync**, **SCP** and **SFTP**. In this guide, we will look at **what is SCP** and how to **securely transfer files between local and remote computers with SCP** in Linux and Unix-like operating systems.
|
||||
|
||||
### What is SCP?
|
||||
|
||||
SCP, stands for **Secure Copy**, is a command line program to copy files and directories between a local and a remote system or between two remote systems in a secure way in Linux and Unix-like operating systems.
|
||||
|
||||
Using `scp` command, you can securely copy a file or a directory,
|
||||
|
||||
- from your local system to a remote system,
|
||||
- from a remote system to your local system,
|
||||
- between remote systems from your local system.
|
||||
|
||||
When transferring data with the scp command, the files and directories are both encrypted. So even if your network is compromised, the perpetrators can't get any meaningful data.
|
||||
|
||||
SCP is a component of the openSSH program and it uses the SSH protocol to securely transfer files. OpenSSH comes pre-installed with almost all modern Linux and Unix distributions, so don't bother installing it.
|
||||
|
||||
#### A word of caution:
|
||||
|
||||
According to the **official announcement** from the openSSH developers,
|
||||
|
||||
> The **scp protocol is outdated**, inflexible and not readily fixed. We recommend the use of more modern protocols like sftp and rsync for file transfer instead.
|
||||
>
|
||||
> Link - [https://lists.mindrot.org/pipermail/openssh-unix-dev/2019-March/037672.html][1]
|
||||
|
||||
However, the majority of the users still prefer SCP over other protocols. Because, SCP handles remote-to-remote file transfers more efficiently than its counterparts such as SFTP and Rsync.
|
||||
|
||||
And also, SCP works exactly like `cp` command, while `rsync` changes its behavior based on whether the source directory has a **trailing slash** or not. Take a look at the following commands:
|
||||
|
||||
- `rsync source destination/` - would copy the source into the destination folder.
|
||||
- `rsync source/ destination/` - would copy the contents of the source folder into the destination folder.
|
||||
|
||||
So you must always double check if you've put the trailing slash in the path.
|
||||
|
||||
I personally use **[Rsync][2]** for copying large size files between two hosts and SCP for copying single files over a network.
|
||||
|
||||
### SCP Command Syntax
|
||||
|
||||
The general syntax for SCP command is given below:
|
||||
|
||||
```
|
||||
scp [-346ABCpqrTv] [-c cipher] [-F ssh_config] [-i identity_file] [-J destination] [-l limit] [-o ssh_option] [-P port] [-S program] source ... target
|
||||
```
|
||||
|
||||
Depending upon the file transfer path, the syntax will differ. Here I have included some example syntax format.
|
||||
|
||||
Copy a file from your local system to a remote system:
|
||||
|
||||
```
|
||||
scp <options> SourceFile User@RemoteHost:RemotePath
|
||||
```
|
||||
|
||||
Similarly, to copy a directory from your local system to a remote system, use `-r` flag:
|
||||
|
||||
```
|
||||
scp -r SourceDirectory User@RemoteHost:RemotePath
|
||||
```
|
||||
|
||||
Copy multiple files to a remote system:
|
||||
|
||||
```
|
||||
scp <options> SourceFile1 SourceFile2 User@RemoteHost:RemotePath
|
||||
```
|
||||
|
||||
Copy a file from remote system to your local system:
|
||||
|
||||
```
|
||||
scp <options> User@RemoteHost:RemoteFilePath DestinationFile
|
||||
```
|
||||
|
||||
Copy a directory from remote system to local system:
|
||||
|
||||
```
|
||||
scp -r User@RemoteHost:RemoteDirectoryPath DestinationDirectory
|
||||
```
|
||||
|
||||
Copy a file from one remote system to another remote system from your local system:
|
||||
|
||||
```
|
||||
scp <options> User@RemoteHost1:RemoteFile1 User@RemoteHost2:RemotePath
|
||||
```
|
||||
|
||||
Please note that when you copy files between two remote systems, the traffic will not pass through the local system. The operation takes place directly between two remote systems. You can, however, pass the traffic from the system on which you run scp command using `-3` option.
|
||||
|
||||
Copy a directory from one remote system to another remote system from your local system:
|
||||
|
||||
```
|
||||
scp -r User@RemoteHost1:RemoteDirectory User@RemoteHost2:DestinationPath
|
||||
```
|
||||
|
||||
### SCP Command Options
|
||||
|
||||
The most commonly used options of SCP command are:
|
||||
|
||||
- **`-C`** : Enable compression. Here, C stands for Compression. When you use this option, the data transfer speed will be faster, because the data is compressed. SCP will automatically enable the compression at the source system and decompression at the destination system.
|
||||
- **`-c <cipher>`** : c stands for cipher. By default, SCP uses **'AES-128'** encryption method for encrypting data. You can change the encryption method using `-c` option.
|
||||
- **`-i <identity_file>`** : i stands for Identity file or Private key. As you already know, there are password-based and key-based authentication used in SSH. If you want to use key-based authentication while transferring files, you can use the -i option to specify the Identity file or Private key.
|
||||
- **`-l limit`** : l stands for limit bandwidth. Using this option, you can set the maximum bandwidth used for transferring data. The limit should be specified in **`Kbit/s`**.
|
||||
- **`-F <ssh_config>`** : Some times, you may need to use different networks to connect to your Linux systems. Or you may be behind a proxy server. In such situations, you can use different `ssh_config` file using `-F` option.
|
||||
- **`-P port`** - P stands for Port. Please note that it is uppercase P. By default, SSH uses port number 22. You might have changed the port number in the destination host for security reasons. In that case, you should explicitly mention the new port number using `-P` option.
|
||||
- **`-p`** : if you want to preserve modification times, access times, and modes from the original file, you need to use -p option while copying files. Please note that it is lowercase p.
|
||||
- **`-r`** : Recursively copy entire directories.
|
||||
- **`-B`** : B stands for batch mode. It is used for selecting batch mode while transferring files. It prevents asking for passwords or passphrases.
|
||||
- **`-S program`** : Name of the program to use for the encrypted connection.
|
||||
- **`-v`** : v stands for verbose. When using the `-v` option, the command will print the progress in your Terminal screen. So, you will see the what exactly is going on when the files are being transferred. It is useful in debugging connection, authentication, and configuration problems.
|
||||
|
||||
SCP has so many options. You can check the man pages of SCP command to learn about other options. Let us see some **useful scp command examples**.
|
||||
|
||||
### Important Notes to Remember before You Begin
|
||||
|
||||
- The `scp` command relies on `ssh` for secure file transfer. So you must have either a **ssh key** or **password** to authenticate to the remote systems.
|
||||
- To be able to transfer files, you must have **read permission on the source files** and **write permission on the destination** location.
|
||||
- The `scp` command will not check the destination location before writing. Any files in the destination with the same name will be **overwritten without notification**.
|
||||
- To be able to distinguish between local and remote locations, use a **colon** (**`:`**).
|
||||
- When transferring large files, it is recommended to start the task inside a **[Screen][3]** or **[Tmux][4]** session.
|
||||
|
||||
### Transfer Files With SCP in Linux
|
||||
|
||||
As I already mentioned, we can use `scp` command to copy a file or a directory from a local system to a remote system and vice versa and copy files and folders between one remote computer to another remote computer.
|
||||
|
||||
#### 1 Copy Files with SCP from Local System to Remote System
|
||||
|
||||
To copy a file from a local system to a remote system using `scp` command, run:
|
||||
|
||||
```
|
||||
$ scp File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
**Sample Output:**
|
||||
|
||||
```
|
||||
ostechnix@192.168.1.40's password:
|
||||
File1.txt 100% 104 814.0KB/s 00:00
|
||||
```
|
||||
|
||||
Let us break down the above command and see what each option does.
|
||||
|
||||
- `**File1.txt**` - The source file to be copied to the destination.
|
||||
- `**ostechnix**` - The username of the remote system.
|
||||
- `**192.168.1.40**` - The IP address of the remote system.
|
||||
- `**/home/ostechnix/**` - The destination directory in the remote system. This is the absolute path where we want to transfer the source file i.e. `File.txt`.
|
||||
|
||||
You can also copy the file and rename it as well. The following command transfers the **`File1.txt`** to the destination and saves the file with different name **`myfile.txt`**.
|
||||
|
||||
```
|
||||
$ scp File1.txt ostechnix@192.168.1.40:/home/ostechnix/myfile.txt
|
||||
```
|
||||
|
||||
![Copy Files From Local System To Remote System][5]
|
||||
|
||||
Copy Files from Local System to Remote System
|
||||
|
||||
#### 2. Copy Multiple Files with SCP from Local System to Remote System
|
||||
|
||||
To transfer multiple files from a local system to a remote system with `scp` command, run:
|
||||
|
||||
```
|
||||
$ scp File1.txt File2.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
**Sample Output:**
|
||||
|
||||
```
|
||||
ostechnix@192.168.1.40's password:
|
||||
File1.txt 100% 104 689.4KB/s 00:00
|
||||
File2.txt 100% 496 6.3MB/s 00:00
|
||||
```
|
||||
|
||||
![Copy Multiple Files from Local System to Remote System][6]
|
||||
|
||||
Copy Multiple Files from Local System to Remote System
|
||||
|
||||
Here,
|
||||
|
||||
- `**File1.txt**` and **`File2.txt`** - The name of the sources that will be copied to the specified destination.
|
||||
- `**ostechnix@192.168.1.40**` - The username and IP address of the remote system.
|
||||
- `**/home/ostechnix**` - The destination path where we want to put the copied files.
|
||||
|
||||
If the files have same extension, you can use the following alternative commands to achieve the same goal.
|
||||
|
||||
```
|
||||
$ scp {File1,File2}.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
Or,
|
||||
|
||||
```
|
||||
$ scp *.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
#### 3. Recursively Copy Directories with SCP from Local System to Remote System
|
||||
|
||||
To recursively copy an entire directory including the sub-directories and its contents from your local system to a remote system, use **`-r`** flag like below.
|
||||
|
||||
```
|
||||
$ scp -r Documents/ ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
![Copy a Directory from Local System to Remote System][7]
|
||||
|
||||
Copy a Directory from Local System to Remote System
|
||||
|
||||
The above command will copy the entire directory **'`Documents`'** including its contents to the destination system.
|
||||
|
||||
Here,
|
||||
|
||||
- **`-r`** : Copy files and directories recursively including the sub-directories and its contents.
|
||||
- **`Documents`** : The name of the source directory that we want to copy to the destination.
|
||||
- `**ostechnix@192.168.1.40**` : The username and IP address of the remote system.
|
||||
- `**/home/ostechnix**` : The destination path where we want to put the copied directory.
|
||||
|
||||
#### 4. Transfer Files with SCP from Remote System to Local System
|
||||
|
||||
Remember we copied `FIle1.txt` to the remote system from our local system. Let us copy it back to the local system.
|
||||
|
||||
To copy a file from a remote system to your local system with `scp`, run:
|
||||
|
||||
```
|
||||
$ scp ostechnix@192.168.1.40:/home/ostechnix/File1.txt Downloads/
|
||||
```
|
||||
|
||||
Here,
|
||||
|
||||
- `**ostechnix@192.168.1.40**` : The username and IP address of the remote system.
|
||||
- **`/home/ostechnix/File.txt`** : The absolute path of file that we want to copy to the local system.
|
||||
- **`Downloads`** - The location where to save the copied file.
|
||||
|
||||
![Transfer Files from Remote System to Local System][8]
|
||||
|
||||
Transfer Files from Remote System to Local System
|
||||
|
||||
#### 5. Transfer Multiple Files using SCP from Remote System to Local System
|
||||
|
||||
To copy multiple files from a remote system to your local system, mention the absolute path of the files that you want to copy **within the curly braces** as shown below.
|
||||
|
||||
```
|
||||
$ scp ostechnix@192.168.1.40:/home/ostechnix/\{File1.txt,File2.txt\} Downloads/
|
||||
```
|
||||
|
||||
![Transfer Multiple Files from Remote System to Local System][9]
|
||||
|
||||
Transfer Multiple Files from Remote System to Local System
|
||||
|
||||
The above command will copy the `File1.txt` and `File2.txt` from the `/home/ostechnix/` directory of the remote system to the `Downloads` directory of the local system.
|
||||
|
||||
Please note that there is **no spaces after the commas within the curly braces**.
|
||||
|
||||
#### 6. Recursively Copy Directories from Remote System to Local System
|
||||
|
||||
To copy an entire directory including the sub-directories and its contents recursively from a remote computer to your local system using `scp`, use **`-r`** flag.
|
||||
|
||||
```
|
||||
$ scp -r ostechnix@192.168.1.40:/home/ostechnix/Documents Downloads/
|
||||
```
|
||||
|
||||
The above command will copy the entire **`Documents`** from the remote system to the **`Downloads`** directory in your local system.
|
||||
|
||||
#### 7. Copy Files using SCP between Two Remote Computers
|
||||
|
||||
To copy files directly from one remote system to another remote system with `scp`, run:
|
||||
|
||||
```
|
||||
$ scp senthil@192.168.1.40:/home/senthil/File1.txt kumar@192.168.1.20:/home/kumar/
|
||||
```
|
||||
|
||||
You will be asked to enter the password of the both remote systems.
|
||||
|
||||
Here,
|
||||
|
||||
- **`senthil@192.168.1.40`** - The username and IP address of the remote system from the file is currently located.
|
||||
- **`/home/senthil/File1.txt`** - The name the file1 that is being copied and its location.
|
||||
- `**kumar@192.168.1.20**` - The username and IP address of the remote system where we want to copy the file.
|
||||
- **`/home/kumar`** - The location where to save the copied file on the remote system.
|
||||
|
||||
The above command will copy the `/home/senthil/File1.txt` from the remote host `192.168.1.40` to `/home/kumar/` directory on the remote host `192.168.1.20`.
|
||||
|
||||
In this method, the data will be transferred directly from one remote system to another remote system. If you want to route the traffic through the machine on which the command is run, use `**-3**` flag like below.
|
||||
|
||||
```
|
||||
$ scp -3 senthil@192.168.1.40:/home/senthil/File1.txt kumar@192.168.1.20:/home/kumar/
|
||||
```
|
||||
|
||||
#### 8. Enable Compression while Copying Files with SCP
|
||||
|
||||
So far we have transferred files without compressing them. Now we will enable compression while transferring files using **`-C`** flag.
|
||||
|
||||
```
|
||||
$ scp -C File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
The `-C` flag will enable compression of data at the source and automatically decompress the data at destination side.
|
||||
|
||||
By enabling compression, you can increase the file copy or transfer speed significantly.
|
||||
|
||||
#### 9. Limit Bandwidth while Transferring Files using SCP
|
||||
|
||||
We can limit the bandwidth while copying files with SCP using `-l` flag. Please note that the maximum bandwidth is specified in Kbits/s. 1 byte=8 bits. So if you want to limit bandwidth to 200 KB/s, the value for `-l` would be **1600** (200*8).
|
||||
|
||||
```
|
||||
$ scp -l 1600 File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
This is useful when transferring large files to prevent SCP from throttling the bandwidth.
|
||||
|
||||
#### 10. Use Different Port while Copying Files using SCP
|
||||
|
||||
As a system admin, you might **[have changed the default port of your SSH protocol][10]** on the remote servers for security reasons. In such cases, you can specify the port number with `-P` flag when transferring files. Please note that this is **uppercase P**.
|
||||
|
||||
```
|
||||
$ scp -P 2022 File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
#### 11. Use Different Cipher while Copying Files with SCP
|
||||
|
||||
By default, SCP uses **'`AES-128`'** for encrypting files. If you want to use different cipher, use **`-c`** flag followed by the cipher name.
|
||||
|
||||
For example, if you want to use **'`3des-cbc`'** cipher, the command would be like below:
|
||||
|
||||
```
|
||||
$ scp -c 3des-cbc File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
To view the list of supported ciphers, run:
|
||||
|
||||
```
|
||||
$ ssh -Q cipher localhost | paste -d, -s -
|
||||
```
|
||||
|
||||
**Sample Output:**
|
||||
|
||||
```
|
||||
3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
|
||||
```
|
||||
|
||||
#### 12. Copying Files with SCP in Verbose Mode
|
||||
|
||||
if you want to know what's going on behind the scenes while copying files with scp, you can use `**-v**` flag. When transferring files with SCP in Verbose mode, the step by step process of the SCP command execution will be displayed in the terminal. This comes in handy when troubleshooting times.
|
||||
|
||||
```
|
||||
$ scp -v File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
You will see a whole lot of output when sending files in Verbose mode as shown in the following output.
|
||||
|
||||
![Copying Files with SCP in Verbose Mode][11]
|
||||
|
||||
Copying Files with SCP in Verbose Mode
|
||||
|
||||
#### 13. Transferring Files with SCP in Quiet Mode
|
||||
|
||||
We can transfer files in quiet mode with **`-q`** flag. When sharing files in quiet mode, it will not show the copy progress, warning or diagnostic message in the output.
|
||||
|
||||
```
|
||||
$ scp -q File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
#### 14. Preserve File Attributes when Transferring Files with SCP
|
||||
|
||||
To preserve file attributes such as file modification times, access times, and modes when copying files with SCP, use **`-p`** flag. Please note that this is **lowercase p**.
|
||||
|
||||
```
|
||||
$ scp -p File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
#### 15. Use Identity File when Copying Files with SCP
|
||||
|
||||
SSH supports both password-based and key-based authentication. Key-based authentication is most widely used authentication method in Linux environments.
|
||||
|
||||
If you want to use key-based authentication while transferring files, use the **`-i`** option to specify the Identity file or Private key.
|
||||
|
||||
```
|
||||
$ scp -i my_private_key.pem File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
#### 16. Use Different ssh_config File when Transferring Files with SCP
|
||||
|
||||
There are situations where you need to use different networks to connect to your Linux systems. Or you may be behind a proxy server. In such situations, you can use different `ssh_config` file using `**-F**` option.
|
||||
|
||||
```
|
||||
$ scp -F /home/ostechnix/my_ssh_config File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
#### 17. Copy files with SCP using IPv4 or IPv6
|
||||
|
||||
We can force SCP to only use IPv4 or IPv6 addresses when copying files. This can be achieved by adding **`-4`** for IPv4 networks and **`-6`** for IPv6 networks.
|
||||
|
||||
```
|
||||
$ scp -6 File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
### Frequently Asked Questions
|
||||
|
||||
#### Question 1: What is SCP?
|
||||
|
||||
**Answer:** SCP is a command line program to securely transfer files and directories from a local system to a remote system and vice versa, or between two remote systems directly.
|
||||
|
||||
#### Question 2: How to copy a file from the local computer to remote computer using SCP?
|
||||
|
||||
To copy a file from your local system to a remote system, the command would be:
|
||||
|
||||
```
|
||||
scp SourceFile.txt User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### Question 3: How to copy recursively copy files and directories?
|
||||
|
||||
To recursively copy a directory including the sub-directories, use `-r` flag.
|
||||
|
||||
```
|
||||
scp -r /some/local/directory User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### Question 4: Can I transfer multiple files using SCP?
|
||||
|
||||
Yes, you can. Just mention the source file names with space separated.
|
||||
|
||||
Copy multiple files from local to remote:
|
||||
|
||||
```
|
||||
scp file1.txt file2.txt file3.txt User@RemoteHost:/some/remote/directory
|
||||
scp {file1,file2,file3}.txt User@RemoteHost:/some/remote/directory
|
||||
scp *.txt User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
Copy multiple files from remote to local:
|
||||
|
||||
```
|
||||
scp User@RemoteHost:/some/remote/directory/\{file1.txt,file2.txt,file3.txt\} /some/local/directory
|
||||
```
|
||||
|
||||
Copy multiple files from remote to remote:
|
||||
|
||||
```
|
||||
$ scp User@RemoteHost1:/some/remote/directory/\{file1.txt,file2.txt,file3.txt\} User@RemoteHost2:/some/remote/directory/
|
||||
```
|
||||
|
||||
#### Question 5: How to transfer all files in a directory?
|
||||
|
||||
To transfer all files in a directory, switch to that directory:
|
||||
|
||||
```
|
||||
cd dir_name
|
||||
```
|
||||
|
||||
```
|
||||
scp *.txt User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### Question 6: Can I compress files?
|
||||
|
||||
Yes, you can. Use **`-C`** to compress files. The files are compressed at source and decompress at destination automatically.
|
||||
|
||||
```
|
||||
scp -C /some/large/file User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### Question 7: Can I preserve file attributes?
|
||||
|
||||
To preserve file attributes such as modification times, access times, and modes from the original file, use `-p` flag.
|
||||
|
||||
```
|
||||
scp -p file.txt User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### Question 8: Can I use different port?
|
||||
|
||||
Yes. SCP allows you to use different port with `-P` flag.
|
||||
|
||||
```
|
||||
scp -P 2022 file.txt User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### Question 9: Can I use different cipher?
|
||||
|
||||
Yes, you can. Use -c flag to use different cipher.
|
||||
|
||||
```
|
||||
scp -c 3des-cbc User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### Question 10: How do I list the supported ciphers by SSH?
|
||||
|
||||
To view the list of supported ciphers by SSH and SCP, use the following command
|
||||
|
||||
```
|
||||
ssh -Q cipher localhost | paste -d, -s -
|
||||
```
|
||||
|
||||
#### Question 11: Is SCP really secure?
|
||||
|
||||
Yes, it is completely secure to use. SCP uses the same SSH mechanism used by openSSH. The data in transit is encrypted at the source side and decrypted at destination.
|
||||
|
||||
#### Question 12: Can I transfer files from a Windows system to a Linux system?
|
||||
|
||||
Yes, you can. Use either **PSCP** program to transfer files from windows platform to Linux platform. You can also use **WinSCP**.
|
||||
|
||||
### Conclusion
|
||||
|
||||
In this comprehensive guide, we learned what is SCP, and how to **securely transfer files with SCP** in Linux. We provided **17 SCP command examples**. We also looked at the commonly asked questions about SCP.
|
||||
|
||||
Whether you're a Linux Admin, or a Developer or a Regular user, you will have to copy files to and from a remote system at some point. Knowing how to **use SCP to securely copy files** will be definitely useful.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://ostechnix.com/securely-transfer-files-with-scp-in-linux/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://lists.mindrot.org/pipermail/openssh-unix-dev/2019-March/037672.html
|
||||
[2]: https://ostechnix.com/linux-rsync-command-examples-for-beginners/
|
||||
[3]: https://ostechnix.com/screen-command-examples-to-manage-multiple-terminal-sessions/
|
||||
[4]: https://ostechnix.com/tmux-command-examples-to-manage-multiple-terminal-sessions/
|
||||
[5]: https://ostechnix.com/wp-content/uploads/2022/11/Copy-Files-from-Local-System-to-Remote-System.png
|
||||
[6]: https://ostechnix.com/wp-content/uploads/2022/11/Copy-Multiple-Files-from-Local-System-to-Remote-System.png
|
||||
[7]: https://ostechnix.com/wp-content/uploads/2022/11/Copy-Directory-from-Local-System-to-Remote-System.png
|
||||
[8]: https://ostechnix.com/wp-content/uploads/2022/11/Transfer-Files-from-Remote-System-to-Local-System.png
|
||||
[9]: https://ostechnix.com/wp-content/uploads/2022/11/Transfer-Multiple-Files-from-Remote-System-to-Local-System.png
|
||||
[10]: https://ostechnix.com/how-to-change-apache-ftp-and-ssh-default-port-to-a-custom-port-part-3/
|
||||
[11]: https://ostechnix.com/wp-content/uploads/2022/11/Copying-Files-with-SCP-in-Verbose-Mode.png
|
@ -1,283 +0,0 @@
|
||||
[#]: subject: "Introducing Rust calls to C library functions"
|
||||
[#]: via: "https://opensource.com/article/22/11/rust-calls-c-library-functions"
|
||||
[#]: author: "Marty Kalin https://opensource.com/users/mkalindepauledu"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "yzuowei"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Introducing Rust calls to C library functions
|
||||
======
|
||||
|
||||
Why call C functions from Rust? The short answer is software libraries. A longer answer touches on where C stands among programming languages in general and towards Rust in particular. C, C++, and Rust are systems languages, which give programmers access to machine-level data types and operations. Among these three systems languages, C remains the dominant one. The kernels of modern operating systems are written mainly in C, with assembly language accounting for the rest. The standard system libraries for input and output, number crunching, cryptography, security, networking, internationalization, string processing, memory management, and more, are likewise written mostly in C. These libraries represent a vast infrastructure for applications written in any other language. Rust is well along the way to providing fine libraries of its own, but C libraries—around since the 1970s and still growing—are a resource not to be ignored. Finally, C is still the [lingua franca][1] among programming languages: most languages can talk to C and, through C, to any other language that does so.
|
||||
|
||||
### Two proof-of-concept examples
|
||||
|
||||
Rust has an FFI (Foreign Function Interface) that supports calls to C functions. An issue for any FFI is whether the calling language covers the data types in the called language. For example, `ctypes` is an FFI for calls from Python into C, but Python doesn't cover the unsigned integer types available in C. As a result, `ctypes` must resort to workarounds.
|
||||
|
||||
By contrast, Rust covers all the primitive (that is, machine-level) types in C. For example, the Rust `i32` type matches the C `int` type. C specifies only that the `char` type must be one byte in size and other types, such as `int`, must be at least this size; but nowadays every reasonable C compiler supports a four-byte `int`, an eight-byte `double` (in Rust, the `f64` type), and so on.
|
||||
|
||||
There is another challenge for an FFI directed at C: Can the FFI handle C's raw pointers, including pointers to arrays that count as strings in C? C does not have a string type, but rather implements strings as character arrays with a non-printing terminating character, the _null terminator_ of legend. By contrast, Rust has two string types: `String` and `&str` (string slice). The question, then, is whether the Rust FFI can transform a C string into a Rust one—and the answer is _yes_.
|
||||
|
||||
Pointers to structures also are common in C. The reason is efficiency. By default, a C structure is passed _by_value (that is, by a byte-per-byte copy) when a structure is either an argument passed to a function or a value returned from one. C structures, like their Rust counterparts, can include arrays and nest other structures and so be arbitrarily large in size. Best practice in either language is to pass and return structures by reference, that is, by passing or returning the structure's address rather than a copy of the structure. Once again, the Rust FFI is up to the task of handling C pointers to structures, which are common in C libraries.
|
||||
|
||||
The first code example focuses on calls to relatively simple C library functions such as `abs` (absolute value) and `sqrt` (square root). These functions take non-pointer scalar arguments and return a non-pointer scalar value. The second code example, which covers strings and pointers to structures, introduces the [bindgen][2] utility, which generates Rust code from C interface (header) files such as `math.h` and `time.h`. C header files specify the calling syntax for C functions and define structures used in such calls. The two code examples are [available on my homepage][3].
|
||||
|
||||
### Calling relatively simple C functions
|
||||
|
||||
The first code example has four Rust calls to C functions in the standard mathematics library: one call apiece to `abs` (absolute value) and `pow` (exponentiation), and two calls to `sqrt` (square root). The program can be built directly with the `rustc` compiler, or more conveniently with the `cargo build` command:
|
||||
|
||||
```
|
||||
use std::os::raw::c_int; // 32 bits
|
||||
use std::os::raw::c_double; // 64 bits
|
||||
|
||||
// Import three functions from the standard library libc.
|
||||
// Here are the Rust declarations for the C functions:
|
||||
extern "C" {
|
||||
fn abs(num: c_int) -> c_int;
|
||||
fn sqrt(num: c_double) -> c_double;
|
||||
fn pow(num: c_double, power: c_double) -> c_double;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x: i32 = -123;
|
||||
println!("\nAbsolute value of {x}: {}.", unsafe { abs(x) });
|
||||
|
||||
let n: f64 = 9.0;
|
||||
let p: f64 = 3.0;
|
||||
println!("\n{n} raised to {p}: {}.", unsafe { pow(n, p) });
|
||||
|
||||
let mut y: f64 = 64.0;
|
||||
println!("\nSquare root of {y}: {}.", unsafe { sqrt(y) });
|
||||
|
||||
y = -3.14;
|
||||
println!("\nSquare root of {y}: {}.", unsafe { sqrt(y) }); //** NaN = NotaNumber
|
||||
}
|
||||
```
|
||||
|
||||
The two `use` declarations at the top are for the Rust data types `c_int` and `c_double`, which match the C types `int` and `double`, respectively. The standard Rust module `std::os::raw` defines fourteen such types for C compatibility. The module `std::ffi` has the same fourteen type definitions together with support for strings.
|
||||
|
||||
The `extern "C"` block above the `main` function then declares the three C library functions called in the `main` function below. Each call uses the standard C function's name, but each call must occur within an `unsafe` block. As every programmer new to Rust discovers, the Rust compiler enforces memory safety with a vengeance. Other languages (in particular, C and C++) do not make the same guarantees. The `unsafe` block thus says: Rust takes no responsibility for whatever unsafe operations may occur in the external call.
|
||||
|
||||
The first program's output is:
|
||||
|
||||
```
|
||||
Absolute value of -123: 123.
|
||||
9 raised to 3: 729
|
||||
Square root of 64: 8.
|
||||
Square root of -3.14: NaN.
|
||||
```
|
||||
|
||||
In the last output line, the `NaN` stands for Not a Number: the C `sqrt` library function expects a non-negative value as its argument, which means that the argument -3.14 generates `NaN` as the returned value.
|
||||
|
||||
### Calling C functions involving pointers
|
||||
|
||||
C library functions in security, networking, string processing, memory management, and other areas regularly use pointers for efficiency. For example, the library function `asctime` (time as an ASCII string) expects a pointer to a structure as its single argument. A Rust call to a C function such as `asctime` is thus trickier than a call to `sqrt`, which involves neither pointers nor structures.
|
||||
|
||||
The C structure for the `asctime` function call is of type `struct tm`. A pointer to such a structure also is passed to library function `mktime` (make a time value). The structure breaks a time into units such as the year, the month, the hour, and so forth. The structure's fields are of type `time_t`, an alias for for either `int` (32 bits) or `long` (64 bits). The two library functions combine these broken-apart time pieces into a single value: `asctime` returns a string representation of the time, whereas `mktime` returns a `time_t` value that represents the number of elapsed seconds since the _epoch_, which is a time relative to which a system's clock and timestamp are determined. Typical epoch settings are January 1 00:00:00 (zero hours, minutes, and seconds) of either 1900 or 1970.
|
||||
|
||||
The C program below calls `asctime` and `mktime`, and uses another library function `strftime` to convert the `mktime` returned value into a formatted string. This program acts as a warm-up for the Rust version:
|
||||
|
||||
```
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
int main () {
|
||||
struct tm sometime; /* time broken out in detail */
|
||||
char buffer[80];
|
||||
int utc;
|
||||
|
||||
sometime.tm_sec = 1;
|
||||
sometime.tm_min = 1;
|
||||
sometime.tm_hour = 1;
|
||||
sometime.tm_mday = 1;
|
||||
sometime.tm_mon = 1;
|
||||
sometime.tm_year = 1;
|
||||
sometime.tm_hour = 1;
|
||||
sometime.tm_wday = 1;
|
||||
sometime.tm_yday = 1;
|
||||
|
||||
printf("Date and time: %s\n", asctime(&sometime));
|
||||
|
||||
utc = mktime(&sometime);
|
||||
if( utc < 0 ) {
|
||||
fprintf(stderr, "Error: unable to make time using mktime\n");
|
||||
} else {
|
||||
printf("The integer value returned: %d\n", utc);
|
||||
strftime(buffer, sizeof(buffer), "%c", &sometime);
|
||||
printf("A more readable version: %s\n", buffer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
The program outputs:
|
||||
|
||||
```
|
||||
Date and time: Fri Feb 1 01:01:01 1901
|
||||
The integer value returned: 2120218157
|
||||
A more readable version: Fri Feb 1 01:01:01 1901
|
||||
```
|
||||
|
||||
In summary, the Rust calls to library functions `asctime` and `mktime` must deal with two issues:
|
||||
|
||||
- Passing a raw pointer as the single argument to each library function.
|
||||
- Converting the C string returned from `asctime` into a Rust string.
|
||||
|
||||
### Rust calls to `asctime` and `mktime`
|
||||
|
||||
The `bindgen` utility generates Rust support code from C header files such as `math.h` and `time.h`. In this example, a simplified version of `time.h` will do but with two changes from the original:
|
||||
|
||||
- The built-in type `int` is used instead of the alias type `time_t`. The bindgen utility can handle the `time_t` type but generates some distracting warnings along the way because `time_t` does not follow Rust naming conventions: in `time_t` an underscore separates the `t` at the end from the `time` that comes first; Rust would prefer a CamelCase name such as `TimeT`.
|
||||
- The type `struct tm` type is given `StructTM` as an alias for the same reason.
|
||||
|
||||
Here is the simplified header file with declarations for `mktime` and `asctime` at the bottom:
|
||||
|
||||
```
|
||||
typedef struct tm {
|
||||
int tm_sec; /* seconds */
|
||||
int tm_min; /* minutes */
|
||||
int tm_hour; /* hours */
|
||||
int tm_mday; /* day of the month */
|
||||
int tm_mon; /* month */
|
||||
int tm_year; /* year */
|
||||
int tm_wday; /* day of the week */
|
||||
int tm_yday; /* day in the year */
|
||||
int tm_isdst; /* daylight saving time */
|
||||
} StructTM;
|
||||
|
||||
extern int mktime(StructTM*);
|
||||
extern char* asctime(StructTM*);
|
||||
```
|
||||
|
||||
With `bindgen` installed, `%` as the command-line prompt, and `mytime.h` as the header file above, the following command generates the required Rust code and saves it in the file `mytime.rs`:
|
||||
|
||||
```
|
||||
% bindgen mytime.h > mytime.rs
|
||||
```
|
||||
|
||||
Here is the relevant part of `mytime.rs`:
|
||||
|
||||
```
|
||||
/* automatically generated by rust-bindgen 0.61.0 */
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct tm {
|
||||
pub tm_sec: ::std::os::raw::c_int,
|
||||
pub tm_min: ::std::os::raw::c_int,
|
||||
pub tm_hour: ::std::os::raw::c_int,
|
||||
pub tm_mday: ::std::os::raw::c_int,
|
||||
pub tm_mon: ::std::os::raw::c_int,
|
||||
pub tm_year: ::std::os::raw::c_int,
|
||||
pub tm_wday: ::std::os::raw::c_int,
|
||||
pub tm_yday: ::std::os::raw::c_int,
|
||||
pub tm_isdst: ::std::os::raw::c_int,
|
||||
}
|
||||
|
||||
pub type StructTM = tm;
|
||||
|
||||
extern "C" {
|
||||
pub fn mktime(arg1: *mut StructTM) -> ::std::os::raw::c_int;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn asctime(arg1: *mut StructTM) -> *mut ::std::os::raw::c_char;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bindgen_test_layout_tm() {
|
||||
const UNINIT: ::std::mem::MaybeUninit<tm> = ::std::mem::MaybeUninit::uninit();
|
||||
let ptr = UNINIT.as_ptr();
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<tm>(),
|
||||
36usize,
|
||||
concat!("Size of: ", stringify!(tm))
|
||||
);
|
||||
...
|
||||
```
|
||||
|
||||
The Rust structure `struct tm`, like the C original, contains nine 4-byte integer fields. The field names are the same in C and Rust. The `extern "C"` blocks declare the library functions `asctime` and `mktime` as taking one argument apiece, a raw pointer to a mutable `StructTM` instance. (The library functions may mutate the structure via the pointer passed as an argument.)
|
||||
|
||||
The remaining code, under the `#[test]` attribute, tests the layout of the Rust version of the time structure. The test can be run with the `cargo test` command. At issue is that C does not specify how the compiler must lay out the fields of a structure. For example, the C `struct tm` starts out with the field `tm_sec` for the second; but C does not require that the compiled version has this field as the first. In any case, the Rust tests should succeed and the Rust calls to the library functions should work as expected.
|
||||
|
||||
### Getting the second example up and running
|
||||
|
||||
The code generated from `bindgen` does not include a `main` function and, therefore, is a natural module. Below is the `main` function with the `StructTM` initialization and the calls to `asctime` and `mktime`:
|
||||
|
||||
```
|
||||
mod mytime;
|
||||
use mytime::*;
|
||||
use std::ffi::CStr;
|
||||
|
||||
fn main() {
|
||||
let mut sometime = StructTM {
|
||||
tm_year: 1,
|
||||
tm_mon: 1,
|
||||
tm_mday: 1,
|
||||
tm_hour: 1,
|
||||
tm_min: 1,
|
||||
tm_sec: 1,
|
||||
tm_isdst: -1,
|
||||
tm_wday: 1,
|
||||
tm_yday: 1
|
||||
};
|
||||
|
||||
unsafe {
|
||||
let c_ptr = &mut sometime; // raw pointer
|
||||
|
||||
// make the call, convert and then own
|
||||
// the returned C string
|
||||
let char_ptr = asctime(c_ptr);
|
||||
let c_str = CStr::from_ptr(char_ptr);
|
||||
println!("{:#?}", c_str.to_str());
|
||||
|
||||
let utc = mktime(c_ptr);
|
||||
println!("{}", utc);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The Rust code can be compiled (using either `rustc` directly or `cargo`) and then run. The output is:
|
||||
|
||||
```
|
||||
Ok(
|
||||
"Mon Feb 1 01:01:01 1901\n",
|
||||
)
|
||||
2120218157
|
||||
```
|
||||
|
||||
The calls to the C functions `asctime` and `mktime` again must occur inside an `unsafe` block, as the Rust compiler cannot be held responsible for any memory-safety mischief in these external functions. For the record, `asctime` and `mktime` are well behaved. In the calls to both functions, the argument is the raw pointer `ptr`, which holds the (stack) address of the `sometime` structure.
|
||||
|
||||
The call to `asctime` is the trickier of the two calls because this function returns a pointer to a C `char`, the character `M` in `Mon` of the text output. Yet the Rust compiler does not know where the C string (the null-terminated array of `char`) is stored. In the static area of memory? On the heap? The array used by the `asctime` function to store the text representation of the time is, in fact, in the static area of memory. In any case, the C-to-Rust string conversion is done in two steps to avoid compile-time errors:
|
||||
|
||||
- The call `Cstr::from_ptr(char_ptr)` converts the C string to a Rust string and returns a reference stored in the `c_str` variable.
|
||||
- The call to `c_str.to_str()` ensures that `c_str` is the owner.
|
||||
|
||||
The Rust code does not generate a human-readable version of the integer value returned from `mktime`, which is left as an exercise for the interested. The Rust module `chrono::format` includes a `strftime` function, which can be used like the C function of the same name to get a text representation of the time.
|
||||
|
||||
### Calling C with FFI and bindgen
|
||||
|
||||
The Rust FFI and the `bindgen` utility are well designed for making Rust calls out to C libraries, whether standard or third-party. Rust talks readily to C and thereby to any other language that talks to C. For calling relatively simple library functions such as `sqrt`, the Rust FFI is straightforward because Rust's primitive data types cover their C counterparts.
|
||||
|
||||
For more complicated interchanges—in particular, Rust calls to C library functions such as `asctime` and `mktime` that involve structures and pointers—the `bindgen` utility is the way to go. This utility generates the support code together with appropriate tests. Of course, the Rust compiler cannot assume that C code measures up to Rust standards when it comes to memory safety; hence, calls from Rust to C must occur in `unsafe` blocks.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/11/rust-calls-c-library-functions
|
||||
|
||||
作者:[Marty Kalin][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/mkalindepauledu
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://en.wikipedia.org/wiki/Lingua_franca
|
||||
[2]: https://github.com/rust-lang/rust-bindgen
|
||||
[3]: https://condor.depaul.edu/mkalin
|
||||
|
@ -2,7 +2,7 @@
|
||||
[#]: via: "https://opensource.com/article/22/11/extend-c-python"
|
||||
[#]: author: "Stephan Avenwedde https://opensource.com/users/hansic99"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: translator: "MjSeven"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
@ -1,130 +0,0 @@
|
||||
[#]: subject: "Create a holiday light display with your Raspberry Pi and ping pong balls"
|
||||
[#]: via: "https://opensource.com/article/22/11/raspberry-pi-holiday-light-display"
|
||||
[#]: author: "Brian McCafferty https://opensource.com/users/bdm"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "Return7g"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Create a holiday light display with your Raspberry Pi and ping pong balls
|
||||
======
|
||||
|
||||
I love Christmas decorations and lights, and I'd been wanting to do an programmable LED project for a long time. Recently, I built a light array made of LED lights, ping pong balls, and a Raspberry Pi Zero. I thought it was worth sharing, because it ended up being relatively easy but also educational.
|
||||
|
||||
It's mostly my own design, with some inspiration from YouTube videos. You can find the source code and build instructions in my [Git repository][1].
|
||||
|
||||
### Shopping list
|
||||
|
||||
- [Raspberry Pi Zero][2]
|
||||
- [Pibow Case][3]
|
||||
- 5v 2A USB power supply
|
||||
- Poster frame
|
||||
- 255 ping pong balls
|
||||
- Hot glue gun and LOTS of hot glue sticks
|
||||
- Soldering iron
|
||||
- Solder
|
||||
- 22 AWG 0.35mm solid core wiring
|
||||
- 10 meters of WS2812(B) LED strip lights (30 pixels per meter)
|
||||
- Multimeter
|
||||
- Wire cutters
|
||||
- Wire strippers
|
||||
|
||||
### Design the Raspberry Pi light display
|
||||
|
||||
My design was driven by the size of the poster frame I happened to have available. I got 30 pixel per meter tape from Ali Express, which cut nicely into 0.5m sections, so that gave me 15 LEDs across. Ping pong balls are 40mm, so I measured and placed the lines 40mm apart, with the LED Strip in the middle of each 40mm section. This gave me 17 lines down in total. My array was therefore 15×17. If you try this yourself, yours can be a different size.
|
||||
|
||||
To get power to the array and the Raspberry Pi, I placed the open connections for both data and power at the bottom of the board. I didn't have that many LEDs needing power, so I was able to use the 5v out GPIO from the Raspberry Pi Zero to power them. I run them at 50% brightness, which is easily bright enough to see in the day and at night through my window.
|
||||
|
||||
### Wiring
|
||||
|
||||
In my design, I started at the bottom of the board and wired up in an S-curve. This made soldering easier because loops at the end of each row didn't have to return all the way back to the start of each line. The WS2812 data lines do require you to wire the data the correct way: power can be fed from either side of the strip, but data must be fed from the side with the arrows pointing away.
|
||||
|
||||
My wiring looks like this (this is abbreviated for clarity, in real life it's 17 lines deep):
|
||||
|
||||
```
|
||||
<---------------\
|
||||
|
|
||||
/---------------/
|
||||
|
|
||||
\---------------< # Pi connected here
|
||||
```
|
||||
|
||||
### Build the display with your Raspberry Pi
|
||||
|
||||
Once the design and wiring plan was sorted, it was time to get started on the build.
|
||||
|
||||
I measured and drew my lines in pencil on the poster backboard. The WS2812 strips I got came with sticky tape on the back, so I just removed the backing and attached that directly to the backboard. I was sure to position each strip so that the data arrows went one way, then back the other, to ensure that the lights could be daisy-chained correctly for the Pi's instructions.
|
||||
|
||||
Once all light strips were attached, I cut three similar lengths of wire and connected the 5v, data, and ground lines from the end of each light section to the one above it.
|
||||
|
||||
![Connect each light strip at the end of each line.][4]
|
||||
|
||||
After completing each row, I checked continuity between the 5v and ground lines between each strip to ensure my joins were correct. I also checked that I had not accidentally bridged any connections, so I verified that there was no continuity between the 5v and ground lines (in other words, a 5v wire on one line didn't bridge to the ground on the next line.) I also ran some tests to ensure everything was lighting up correctly (see [the code][5] section for my strand tests.)
|
||||
|
||||
Once this was complete, I started to cut holes in the ping pong balls by stabbing scissors into the bottom of them, and cutting a small hole for the LED to shine into. There was no exact science to this, and each one was different, but the effect really worked. I was working with 30 pixels per meter, so my lighting had about 30mm between each LED. A ping pong ball is 40mm across, but I wasn't about to start soldering each LED individually! First of all, I'm not that good at soldering (as my photos show), and anyway, I thought "Well, they're ping pong balls. I can just squash them together!"
|
||||
|
||||
And that's what I did.
|
||||
|
||||
I placed a hot glue blob around each LED and then placed a ping pong ball onto the LED, held it for about five seconds, and moved on to the next one. I held onto the previous ping pong ball as I slid the next one in, pushing it against the first before "folding" it into its neighbor. The effect worked really well. I was happy with what it was looking like straight away. It also had the nice bonus of hiding my bad soldering job ;)
|
||||
|
||||
![It's a tight fit, but the 40mm ping pong balls fit in a 30mm space just fine.][6]
|
||||
|
||||
I continued doing this for 255 LEDs and ping pong balls. There were a few crushed ping pong balls in the process, but in the end, I got there.
|
||||
|
||||
![255 LEDs and 255 ping pong balls in an array.][7]
|
||||
|
||||
### Test the code
|
||||
|
||||
For the test code to ensure that everything was working, I used this [Adafruit guide][8] which lights each LED in red, green, and blue, and then does a rainbow cycle. I used this when I was building to ensure my connections were correct and that everything was soldered correctly.
|
||||
|
||||
After that, I designed a grid in a spreadsheet to map each pixel to a grid position. This helped to make building the images easier. Since my pixel numbers run in a zig-zag pattern, it would have been hard to keep track of each LED (e.g. LED A1 was 256 and B1 was 226).
|
||||
|
||||
Once this was all set, it was time to design some images on paper and in the spreadsheet. Then it was time to code! It got a bit addictive and I started adding some animation (using loops and turning pixels onto one color and then another color).
|
||||
|
||||
The end result was everything I'd hoped it would be.
|
||||
|
||||
![A Christmas gift in LED.][9]
|
||||
|
||||
![Reindeer painted with light.][10]
|
||||
|
||||
![An LED snowflake.][11]
|
||||
|
||||
### A Raspberry Pi light display all year
|
||||
|
||||
I am not sure this will ever be truly finished. Nearly every night since it's been up in the window, I've added some new images and animations. I'm already thinking about what to do for New Year's Eve. I also won't be putting this back in storage with my Christmas decorations in January. I just need to think of other things to draw on it to make it a year-round project! A friend of mine suggested a pixel Mario and I love that idea!
|
||||
|
||||
My code also needs a little work. For example, I do some scrolling text, but I redraw the whole board for each position of the text, so it took quite a bit of time to do. I think I can do something with loops, or perhaps the image library can help scroll the letters easier, and make it easier to add text rather than turning each pixel on and off at every step.
|
||||
|
||||
I've got a photo record of my progress from start to finish: [LED Ping Pong Wall][12].
|
||||
|
||||
You can also see a video of it in action here: [XMas light display][13].
|
||||
|
||||
I'm really pleased with how this turned out, and I think it looks amazing. I'm very excited to try some other LED projects in the future. I encourage you to try a light array of your own even as your first project. It's easier than it looks!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/11/raspberry-pi-holiday-light-display
|
||||
|
||||
作者:[Brian McCafferty][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/bdm
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://github.com/bmccafferty/ping-pong-led-wall
|
||||
[2]: https://shop.pimoroni.com/products/raspberry-pi-zero-wh-with-pre-soldered-header
|
||||
[3]: https://shop.pimoroni.com/products/pibow-zero-w
|
||||
[4]: https://opensource.com/sites/default/files/2022-11/IMG_20201126_115520.jpeg
|
||||
[5]: https://opensource.com#the-code
|
||||
[6]: https://opensource.com/sites/default/files/2022-11/IMG_20201127_101409.webp
|
||||
[7]: https://opensource.com/sites/default/files/2022-11/IMG_20201127_160500.webp
|
||||
[8]: https://learn.adafruit.com/neopixels-on-raspberry-pi/python-usage
|
||||
[9]: https://opensource.com/sites/default/files/2022-11/IMG_20201127_181931.webp
|
||||
[10]: https://opensource.com/sites/default/files/2022-11/IMG_20201202_215902.webp
|
||||
[11]: https://opensource.com/sites/default/files/2022-11/IMG_20201127_215314.webp
|
||||
[12]: https://projects.bdm.scot/Xmas%20LED%20Wall%202020/
|
||||
[13]: https://youtu.be/zc0501GzpMw
|
@ -1,122 +0,0 @@
|
||||
[#]: subject: "How to Access UEFI Settings in Linux Systems"
|
||||
[#]: via: "https://itsfoss.com/access-uefi-from-linux/"
|
||||
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Access UEFI Settings in Linux Systems
|
||||
======
|
||||
|
||||
Want to check the boot order or the power settings at the firmware level? **You can access the UEFI settings by pressing the F2, F10 or Del buttons when your system boots**.
|
||||
|
||||
The problem with this approach is that you may not know the exact key and must be alert about pressing those keys at the right time.
|
||||
|
||||
![Mr. Bean][1a]
|
||||
|
||||
If you don’t want to feel like Mr. Bean in the above Gif, you can access the UEFI settings from the [Grub bootloader][1] screen in Linux.
|
||||
|
||||
![uefi firmware settings grub linux][2]
|
||||
|
||||
You see this screen when you turn on your Linux system. Most Linux distributions like Fedora and Ubuntu use Grub and they allow you to access the UEFI settings from the Grub screen like this.
|
||||
|
||||
What if you don’t see this screen or your distro doesn’t use Grub? There are still ways to access UEFI settings from within Linux.
|
||||
|
||||
Before you see how to do that, please [ensure that your system uses UEFI][3].
|
||||
|
||||
**_Another important thing. Your system will reboot into UEFI settings._** _You cannot access and modify the firmware settings from within an operating system._
|
||||
|
||||
### Boot into UEFI settings from Linux
|
||||
|
||||
This method will only work on Linux distros having systemd. This means this method will work on anything based on Ubuntu, Debian, Fedora, and any mainstream Arch-based distros, including Manjaro and EndeavourOS.
|
||||
|
||||
It is still a good idea to [ensure that your Linux distro uses systemd][4]. Use the given command and if it returns systemd you are good to go:
|
||||
|
||||
```
|
||||
ps --no-headers -o comm 1
|
||||
```
|
||||
|
||||
![how to know if i am using systemd on linux?][5]
|
||||
|
||||
Once you figure out that your distro is utilizing systemd, you can use the given command to boot into UEFI settings:
|
||||
|
||||
```
|
||||
systemctl reboot --firmware-setup
|
||||
```
|
||||
|
||||
Let me break down the used options first:
|
||||
|
||||
- `reboot`: As its name suggest, it will reboot your system.
|
||||
- `--firmware-setup`: When this option is used with `reboot`, it will indicate to the system’s firmware to boot into the firmware setup interface.
|
||||
|
||||
Yup, that was it! A single command and you will be kicked into UEFI settings. I know Windows allows [booting into UEFI firmware settings from within Windows][6]. It’s good to see something similar in Linux as well.
|
||||
|
||||
#### Create a desktop shortcut to boot into UEFI settings (optional)
|
||||
|
||||
If you often find yourself booting into the UEFI settings and don’t remember the command all the time, you can make your life easier by creating a desktop shortcut. This will let you boot into UEFI by clicking on desktop icon.
|
||||
|
||||
_**Now, this is unnecessary and not required for most Linux users. Do it only if you feel the need for it. The method requires [editing files in the command line][7].**_
|
||||
|
||||
First, use the given command to create a desktop shortcut file for UEFI settings:
|
||||
|
||||
```
|
||||
sudo nano /usr/share/applications/uefi-reboot.desktop
|
||||
```
|
||||
|
||||
And paste the following content in the file:
|
||||
|
||||
```
|
||||
[Desktop Entry]
|
||||
Name=UEFI Firmware Setup (Reboot)
|
||||
Comment=Access the motherboard configuration utility
|
||||
Exec=systemctl reboot --firmware-setup
|
||||
Icon=system-restart
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=System;Settings;
|
||||
```
|
||||
|
||||
![create a desktop shortcut to boot into uefi settings][8]
|
||||
|
||||
Once done, [save the changes and exit from the nano][9] text editor.
|
||||
|
||||
And now, you will find the shortcut for UEFI Firmware Setup in your system menu:
|
||||
|
||||
![boot into uefi firmware from system menu][10]
|
||||
|
||||
That’s it! A neat way to get into UEFI settings.
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
The classic ways of accessing the boot settings may be a little inconvenient for some people. The grub screen may not show the UEFI option for older versions.
|
||||
|
||||
And this is where the systemd method shines. I found this method a lifesaver when my system crashed and my function keys were not responding, which are necessary to boot into UEFI (that’s what I thought then!).
|
||||
|
||||
I hope you find it equally helpful.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/access-uefi-from-linux/
|
||||
|
||||
作者:[Sagar Sharma][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/sagar/
|
||||
[b]: https://github.com/lkxed
|
||||
[1a]: https://external-preview.redd.it/dxmsKYDmzgfb1thu3EFI8Ni-DNfprNX8W8xDtff4QWU.gif?format=mp4&s=c31204644ac6a2a348133986714ff97cf3c4a48a
|
||||
[1]: https://itsfoss.com/what-is-grub/
|
||||
[2]: https://itsfoss.com/wp-content/uploads/2022/12/uefi-firmware-settings-grub-linux.webp
|
||||
[3]: https://itsfoss.com/check-uefi-or-bios/
|
||||
[4]: https://linuxhandbook.com/check-if-systemd/
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/12/how-to-know-if-i-am-using-systemd-on-linux.png
|
||||
[6]: https://itsfoss.com/access-uefi-settings-windows-10/
|
||||
[7]: https://learnubuntu.com/edit-files-command-line/
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/12/create-a-desktop-shortcut-to-boot-into-uefi-settings.png
|
||||
[9]: https://linuxhandbook.com/nano-save-exit/
|
||||
[10]: https://itsfoss.com/wp-content/uploads/2022/12/boot-into-uefi-firmware-from-system-menu.png
|
@ -1,87 +0,0 @@
|
||||
[#]: subject: "Convert and Manipulate Images With ‘Converter’ GUI Tool in Linux"
|
||||
[#]: via: "https://itsfoss.com/converter-tool/"
|
||||
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Convert and Manipulate Images With ‘Converter’ GUI Tool in Linux
|
||||
======
|
||||
|
||||
You can always [install ImageMagick][1] on your system to convert images, but not everyone likes to use the terminal for converting and manipulating images.
|
||||
|
||||
So, what if you have a GUI app as a front-end to help with that? **Converter** is precisely that.
|
||||
|
||||
It is a front-end to ImageMagick. So you do not need to use commands to convert and manipulate images.
|
||||
|
||||
Note that most Ubuntu systems usually have ImageMagick pre-installed. You can always refer to our [installation guide][1] if you do not have it on your system.
|
||||
|
||||
### Converter: A Graphical Front-end to ImageMagick
|
||||
|
||||
![converter gui][2]
|
||||
|
||||
It should not take a lot of effort to convert images. It is a simple task, and that is how it should be.
|
||||
|
||||
I do not want to type a command to convert an image quickly. Hence, I prefer graphical tools that enable me to do things faster.
|
||||
|
||||
[Converter][3] is an open-source graphical front-end that enables you to do that. It is a GTK4+libadwaita application.
|
||||
|
||||
You can convert the images to various file formats that include **png, webp, jpeg, heif, heic, and bmp**. It is safe to say that you get support for the most popular image file formats. So, it should come in pretty handy.
|
||||
|
||||
![file format converter][4]
|
||||
|
||||
You can set a location to save all the files, and the converted images will automatically be stored at that location.
|
||||
|
||||
![customize converter][5]
|
||||
|
||||
You can also adjust an image’s quality, size, and background color. To access these options, click on “**More Options**” in the user interface before converting the image.
|
||||
|
||||
![converter more options][6]
|
||||
|
||||
The image size can be customized using its percentage, exact pixels, or ratio. For precise manipulation, changing the dimensions should help.
|
||||
|
||||
If you want the image scaled to an extent, the percentage or ratio functionality should help you do that. You can also choose to add filters to your images.
|
||||
|
||||
Overall, you get the basic options to re-size, convert, and optimize the image quality with Converter.
|
||||
|
||||
You can also [tweak Nautilus][7] to have the [resize option in the right-click context menu][8]. It won’t be as versatile as this tool.
|
||||
|
||||
### Install Converter on Linux
|
||||
|
||||
Converter is available as a Flatpak on [Flathub][9] to install on any Linux distribution of your choice.
|
||||
|
||||
Unfortunately, you do not get any binary packages to install on your Linux system. So, you might want to refer to our [Flatpak guide][10] to get it installed.
|
||||
|
||||
```
|
||||
flatpak install flathub io.gitlab.adhami3310.Converter
|
||||
```
|
||||
|
||||
You can explore more about it on its [GitLab page][3].
|
||||
|
||||
_Do you have any suggestions to nifty tools like this for us to highlight next? Let us know in the comments._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/converter-tool/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/install-imagemagick-ubuntu/
|
||||
[2]: https://itsfoss.com/wp-content/uploads/2022/12/converter-gui.png
|
||||
[3]: https://gitlab.com/adhami3310/Converter
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/12/file-format-converter.png
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/12/customize-converter.png
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/12/converter-more-options.png
|
||||
[7]: https://itsfoss.com/nautilus-tips-tweaks/
|
||||
[8]: https://itsfoss.com/resize-images-with-right-click/
|
||||
[9]: https://flathub.org/apps/details/io.gitlab.adhami3310.Converter
|
||||
[10]: https://itsfoss.com/flatpak-guide/
|
@ -1,255 +0,0 @@
|
||||
[#]: subject: "7 pro tips for using the GDB step command"
|
||||
[#]: via: "https://opensource.com/article/22/12/gdb-step-command"
|
||||
[#]: author: "Alexandra https://opensource.com/users/ahajkova"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "chai001125"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
7 pro tips for using the GDB step command
|
||||
======
|
||||
|
||||
A debugger is software that runs your code and examines any problems it finds. [GNU Debugger][1] (GBD) is one of the most popular debuggers, and in this article, I examine GDB's `step` command and related commands for several common use cases. Step is a widely used command but there are a few lesser known things about it which might be confusing. Also, there are ways to step into a function without actually using the `step` command itself such as using the less known `advance` command.
|
||||
|
||||
### No debugging symbols
|
||||
|
||||
Consider a simple example program:
|
||||
|
||||
```
|
||||
#include <stdio.h>
|
||||
|
||||
int num() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
void bar(int i) {
|
||||
printf("i = %d\n", i);
|
||||
}
|
||||
|
||||
int main() {
|
||||
bar(num());
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
If you compile without the debugging symbols first, set a breakpoint on `bar` and then try to step within it. The GDB gives an error message about no line number information:
|
||||
|
||||
```
|
||||
gcc exmp.c -o exmp
|
||||
gdb ./exmp
|
||||
(gdb) b bar
|
||||
Breakpoint 1 at 0x401135
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, 0x0000000000401135 in bar ()
|
||||
(gdb) step
|
||||
Single stepping until exit from function bar,
|
||||
which has no line number information.
|
||||
i = 2
|
||||
0x0000000000401168 in main ()
|
||||
```
|
||||
|
||||
### Stepi
|
||||
|
||||
It is still possible to step inside the function that has no line number information but the `stepi` command should be used instead. Stepi executes just one instruction at a time. When using GDB's `stepi` command, it's often useful to first do `display/i $pc`. This causes the program counter value and corresponding machine instruction to be displayed after each step:
|
||||
|
||||
```
|
||||
(gdb) b bar
|
||||
Breakpoint 1 at 0x401135
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, 0x0000000000401135 in bar ()
|
||||
(gdb) display/i $pc
|
||||
1: x/i $pc
|
||||
=> 0x401135 <bar+4>: sub $0x10,%rsp
|
||||
```
|
||||
|
||||
In the above `display` command, the `i` stands for machine instructions and `$pc` is the program counter register.
|
||||
|
||||
It can be useful to use info registers and print some register contents:
|
||||
|
||||
```
|
||||
(gdb) info registers
|
||||
rax 0x2 2
|
||||
rbx 0x7fffffffdbc8 140737488346056
|
||||
rcx 0x403e18 4210200
|
||||
(gdb) print $rax
|
||||
$1 = 2
|
||||
(gdb) stepi
|
||||
0x0000000000401139 in bar ()
|
||||
1: x/i $pc
|
||||
=> 0x401139 <bar+8>: mov %edi,-0x4(%rbp)
|
||||
```
|
||||
|
||||
### Complicated function call
|
||||
|
||||
After recompiling the example program with debugging symbols you can set the breakpoint on the `bar` call in main using its line number and then try to step into `bar` again:
|
||||
|
||||
```
|
||||
gcc -g exmp.c -o exmp
|
||||
gdb ./exmp
|
||||
(gdb) b exmp.c:14
|
||||
Breakpoint 1 at 0x401157: file exmp.c, line 14.
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, main () at exmp.c:14
|
||||
14 bar(num());
|
||||
```
|
||||
|
||||
Now, let's step into`bar()`:
|
||||
|
||||
```
|
||||
(gdb) step
|
||||
num () at exmp.c:4
|
||||
4 return 2;
|
||||
```
|
||||
|
||||
The arguments for a function call need to be processed before the actual function call, so `num()` is expected to execute before `bar()`is called. But how do you step into the `bar` as was desired? You need to use the `finish` command and `step` again:
|
||||
|
||||
```
|
||||
(gdb) finish
|
||||
Run till exit from #0 num () at exmp.c:4
|
||||
0x0000000000401161 in main () at exmp.c:14
|
||||
14 bar(num());
|
||||
Value returned is $1 = 2
|
||||
(gdb) step
|
||||
bar (i=2) at exmp.c:9
|
||||
9 printf("i = %d\n", i);
|
||||
```
|
||||
|
||||
### Tbreak
|
||||
|
||||
The `tbreak` command sets a temporary breakpoint. It's useful for situations where you don't want to set a permanent breakpoint. For example, if you want to step into a complicated function call like `f(g(h()), i(j()), ...)` , in such a case you need a long sequence of `step/finish/step` to step into `f` . Setting a temporary breakpoint and then using continue can help to avoid using such sequences. To demonstrate this, you need to set the breakpoint to the `bar` call in `main` as before. Then set the temporary breakpoint on `bar`. As a temporary breakpoint it is automatically removed after being hit:
|
||||
|
||||
```
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, main () at exmp.c:14
|
||||
14 bar(num());
|
||||
(gdb) tbreak bar
|
||||
Temporary breakpoint 2 at 0x40113c: file exmp.c, line 9.
|
||||
```
|
||||
|
||||
After hitting the breakpoint on the call to `bar` and setting a temporary breakpoint on `bar`, you just need to continue to end up in `bar`.
|
||||
|
||||
```
|
||||
(gdb) continue
|
||||
Continuing.
|
||||
Temporary breakpoint 2, bar (i=2) at exmp.c:9
|
||||
9 printf("i = %d\n", i);
|
||||
```
|
||||
|
||||
### Disable command
|
||||
|
||||
Alternatively, you could set a normal breakpoint on `bar` , continue, and then disable this second breakpoint when it's no longer needed. This way you can achieve the same results as with the `tbreak` with one extra command:
|
||||
|
||||
```
|
||||
(gdb) b exmp.c:14
|
||||
Breakpoint 1 at 0x401157: file exmp.c, line 14.
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, main () at exmp.c:14
|
||||
14 bar(num());
|
||||
(gdb) b bar
|
||||
Breakpoint 2 at 0x40113c: file exmp.c, line 9.
|
||||
(gdb) c
|
||||
Continuing.
|
||||
Breakpoint 2, bar (i=2) at exmp.c:9
|
||||
9 printf("i = %d\n", i);
|
||||
(gdb) disable 2
|
||||
```
|
||||
|
||||
As you can see, the `info breakpoints` command displays `n` under `Enb`which means it’s disabled but you can enable it later if it’s needed again.
|
||||
|
||||
```
|
||||
(gdb) info breakpoints
|
||||
Num Type Disp Enb Address What
|
||||
1 breakpoint keep y 0x0000000000401157 in main at exmp.c:14
|
||||
breakpoint already hit 1 time
|
||||
2 breakpoint keep n 0x000000000040113c in bar at exmp.c:9
|
||||
breakpoint already hit 1 time
|
||||
(gdb) enable 2
|
||||
(gdb) info breakpoints
|
||||
Num Type Disp Enb Address What
|
||||
1 breakpoint keep y 0x000000000040116a in main at exmp.c:19
|
||||
breakpoint already hit 1 time
|
||||
2 breakpoint keep y 0x0000000000401158 in bar at exmp.c:14
|
||||
breakpoint already hit 1 time
|
||||
```
|
||||
|
||||
### Advance location
|
||||
|
||||
Another option you can use is an `advance` command. Instead of `tbreak bar ; continue` , you can simply do `advance bar` . This command continues running the program up to the given location.
|
||||
|
||||
The other cool thing about `advance` is that if the location that you try to advance to is not reached, GDB will stop after the current frame's function finishes. Thus, execution of the program is constrained:
|
||||
|
||||
```
|
||||
Breakpoint 1 at 0x401157: file exmp.c, line 14.
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, main () at exmp.c:14
|
||||
14 bar(num());
|
||||
(gdb) advance bar
|
||||
bar (i=2) at exmp.c:9
|
||||
9 printf("i = %d\n", i);
|
||||
```
|
||||
|
||||
### Skipping a function
|
||||
|
||||
Yet another way to step into the `bar,` avoiding `num`, is using the `skip` command:
|
||||
|
||||
```
|
||||
(gdb) b exmp.c:14
|
||||
Breakpoint 1 at 0x401157: file exmp.c, line 14.
|
||||
(gdb) skip num
|
||||
Function num will be skipped when stepping.
|
||||
(gdb) r
|
||||
Starting program: /home/ahajkova/exmp
|
||||
Breakpoint 1, main () at exmp.c:14
|
||||
14 bar(num());
|
||||
(gdb) step
|
||||
bar (i=2) at exmp.c:9
|
||||
9 printf("i = %d\n", i);
|
||||
```
|
||||
|
||||
To know which functions are currently skipped, `info skip` is used. The `num` function is marked as enabled to be skipped by `y`:
|
||||
|
||||
```
|
||||
(gdb) info skip
|
||||
Num Enb Glob File RE Function
|
||||
1 y n <none> n num
|
||||
```
|
||||
|
||||
If `skip` is not needed any more it can be disabled (and re-enabled later) or deleted altogether. You can add another `skip` and disable the first one and then delete them all. To disable a certain `skip`, its number has to be specified, if not specified, each `skip`is disabled. It works the same for enabling or deleting a `skip`:
|
||||
|
||||
```
|
||||
(gdb) skip bar
|
||||
(gdb) skip disable 1
|
||||
(gdb) info skip
|
||||
Num Enb Glob File RE Function
|
||||
1 n n <none> n num
|
||||
2 y n <none> n bar
|
||||
(gdb) skip delete
|
||||
(gdb) info skip
|
||||
Not skipping any files or functions.
|
||||
```
|
||||
|
||||
### GDB step command
|
||||
|
||||
Using GDB's `step` command is a useful tool for debugging your application. There are several ways to step into even complicated functions, so give these GDB techniques a try next time you're troubleshooting your code.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/gdb-step-command
|
||||
|
||||
作者:[Alexandra][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/ahajkova
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/21/3/debug-code-gdb
|
@ -1,61 +0,0 @@
|
||||
[#]: subject: "Install open source solar power at home"
|
||||
[#]: via: "https://opensource.com/article/22/12/open-source-solar-power-home"
|
||||
[#]: author: "Joshua Pearce https://opensource.com/users/joshuapearce"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Install open source solar power at home
|
||||
======
|
||||
|
||||
You might have already given some thought to powering your home with solar. Solar photovoltaic panels, which convert sunlight directly into electricity, have fallen so far down in cost that it makes economic sense everywhere. That is why large companies have put in a lot of solar, and even the electric utilities have started installing massive solar farms—it simply costs less than antiquated fossil fuels. Like most homeowners, you would like to save money and eviscerate your electric bill, but you are probably cringing a bit at the upfront cost. To get a rough idea of the cost, a 5kW system that would power an average home installed at $3/W would cost about $15,000, while a larger home might need 10kW to offset all of their electricity purchases and cost $30,000. If you want batteries, double the cost (you don’t need batteries as most solar arrays connect to the grid, but if the grid goes down, so does your solar array until it is turned back on.) Paying for all your electricity for the next several decades is an investment, even if you save a lot of money.
|
||||
|
||||
There is some good financial news. First, both the US and Canada have enacted a 30% tax credit for solar. This credit drops the price down to about $2/W. Second, [Opensource.com previously discussed][1] how you could get a free book, [_To Catch the Sun_][2], that walks you through how to design your own system (you will still need a certified electrician and inspections to attach it to the grid). If you are a little handy, you can cut the remaining cost by about 50%. These costs are primarily for materials, including solar panels, wiring, electronics, and racking. Amazingly, solar panel costs have dropped so low for small solar systems (like the ones for your house) the racking (mechanical structures that hold the solar panels up) can cost more than the panels!
|
||||
|
||||
### Open source to the rescue again
|
||||
|
||||
Applying the open source development paradigm to software results in faster innovation, better products, and lower costs. The same is true of open source hardware—and even in the relatively obscure area of photovoltaic racking. Nearly all commercial photovoltaic racking is made from proprietary odd aluminum extrusions. They cost a lot of money. If you have a bit of unshaded backyard, you have a few open source racking solutions to choose from.
|
||||
|
||||
### Open source solar rack designs
|
||||
|
||||
The first DIY solar rack design meets the following criteria: (1) made from locally-accessible renewable materials, (2) 25-year lifetime to match solar warranties, (3) able to be fabricated by average consumers, (4) able to meet Canadian structural building codes (if you live where there is no snow this is a bit overkill, but, hey, you might have other weather extremes like hurricanes to deal with), (5) low cost and (6) that it is shared using an open source license. [The open source wood-based fixed-tilt ground-mounted bifacial photovoltaic rack design][3] works throughout North America. The racking system saves from 49% to 77% compared to commercial proprietary racking. The racking design, however, is highly dependent on the cost of lumber, which varies worldwide.
|
||||
|
||||
Check your local cost of wood before you dive into this open source design.
|
||||
|
||||
![Non-tilting solar rack plans][4]
|
||||
|
||||
If you are even more adventurous, you might consider this second design that allows you to change the tilt angle. The results of [the second study][5] show the racking systems with an optimal variable seasonal tilt angle have the best lifetime energy production, with 5.2% more energy generated compared to the fixed-tilt system (or 4.8% more energy, if limited to a maximum tilt angle of 60°). Both fixed and variable wooden racking systems show similar electricity costs, which are only 29% of that of proprietary commercial metal racking. The variable tilt rack provides the lowest cost option even when modest labor costs are included and also may provide specific advantages for applications such as [agrivoltaics][6] (i.e., you can garden underneath the panels and amazingly get increases in yields for shade-tolerant crops like lettuce). This design has been certified by [OSHWA with CERN-OHL-S-2.0 licenses][7].
|
||||
|
||||
IMAGE
|
||||
|
||||
![Tilt-adjustable solar racks][8]
|
||||
|
||||
There is about 1kW for each of the 2 PV module racks shown. So a house would need about five of them. Both papers provide full calculations and step-by-step build instructions.
|
||||
|
||||
As anyone with a solar system will tell you, getting a negative electricity bill is pretty rewarding. This happens if you size your system to meet all of your load and live in a net-metered part of the country. Please note that the electric utilities don’t pay you; the credit carries over until you use it in the winter.
|
||||
|
||||
Have fun with a little open source solar!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/open-source-solar-power-home
|
||||
|
||||
作者:[Joshua Pearce][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/joshuapearce
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/21/11/open-source-solar-power
|
||||
[2]: https://tocatchthesun.com/
|
||||
[3]: https://doi.org/10.3390/designs6030041
|
||||
[4]: https://opensource.com/sites/default/files/2022-11/nontilt.png
|
||||
[5]: https://doi.org/10.3390/designs6030054
|
||||
[6]: https://www.academia.edu/18406368/The_potential_of_agrivoltaic_systems
|
||||
[7]: https://certification.oshwa.org/ca000013.html
|
||||
[8]: https://opensource.com/sites/default/files/2022-11/tilt.png
|
@ -1,78 +0,0 @@
|
||||
[#]: subject: "Simplify your Linux PC with the PCManFM file manager"
|
||||
[#]: via: "https://opensource.com/article/22/12/linux-file-manager-pcmanfm"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Simplify your Linux PC with the PCManFM file manager
|
||||
======
|
||||
|
||||
The PCMan File Manager, or PCManFM for short, is a fast and lightweight file manager that's full of features. It was developed for the [LXDE][1] desktop environment, but is a stand-alone application and can be used with the desktop or window manager of your choice.
|
||||
|
||||
### Install PCManFM
|
||||
|
||||
On Linux, you can probably find PCManFM in your software repository. For instance, on Fedora, Mageia, and similar:
|
||||
|
||||
```
|
||||
$ sudo dnf install pcmanfm
|
||||
```
|
||||
|
||||
On Debian, Elementary, and similar:
|
||||
|
||||
```
|
||||
$ sudo apt install pcmanfm
|
||||
```
|
||||
|
||||
![Image of the PCMan file manager.][2]
|
||||
|
||||
PCManFM doesn't have to replace your desktop's file manager, but some distributions assume that when you install a "third party" file manager, you want it to take precedence over the default. Depending on the desktop you're using, there are different ways of setting your default file manager. Usually, it's in **System Settings** under **Default Applications**.
|
||||
|
||||
If your desktop environment or window manager has no interface to select your default applications, you can set your preference in the `~/.local/share/applications/mimeapps.list` file. To designate a file manager as default, place it at the top of the `[Default Applications]` section, first specifying the file type and then the name of the application file (as it appears in `/usr/share/applications`) you want to use to open it:
|
||||
|
||||
```
|
||||
inode/directory=myfilemanager.desktop;
|
||||
```
|
||||
|
||||
### PCManFM
|
||||
|
||||
If you're a fan of GNOME 2 or the Mate project's [Caja file manager][3], then PCManFM is a great alternative to consider. PCManFM is a lot like Caja in design, but it's not bound to the desktop in the way Caja is, so it's available even on the latest GNOME desktop.
|
||||
|
||||
The default layout of PCManFM has a helpful toolbar near the top of the window, a side panel providing quick access to common directories and drives, and a status bar with details about your current selection. You can hide or show any of these elements using the **View** menu.
|
||||
|
||||
### Tabs and panels
|
||||
|
||||
PCManFM also uses tabs. If you've never used a tabbed file manager before, then think of a web browser and how it uses tabs to let you open multiple web pages in just one window. PCManFM can similarly open several directories in the same window.
|
||||
|
||||
To transfer a file or folder from one tab to another, just drag the file's icon to the tab and hover. After a nominal delay, PCManFM brings the target tab to the front so you can continue your drag-and-drop operation. It takes some getting used to if you're not used to interacting with tabs in a file manager, but it doesn't take long, and it's a very powerful feature for decluttering your workspace.
|
||||
|
||||
Another nice feature of the PCManFM interface is its ability to split a window into two panels. Each panel is effectively a tab, but each one only takes up half of the window.
|
||||
|
||||
![Image of dual panels in PCMan.png][4]
|
||||
|
||||
This makes dragging from one to the other just as easy and natural as dragging a file into a folder. I find it useful for comparing the contents of folders, too.
|
||||
|
||||
### File management with PCMan
|
||||
|
||||
PCManFM is a great little file manager with all the basic features you need on an everyday basis. It's a natural replacement for a file manager you might find too complicated, as well as a great option on [old computers][5] that might struggle with a file manager that's constantly drawing thumbnails and refreshing and generating animations. PCMan focuses on the core task of a file manager: managing files. Try it out on your Linux PC.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/linux-file-manager-pcmanfm
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/19/12/lxqt-lxde-linux-desktop
|
||||
[2]: https://opensource.com/sites/default/files/2022-10/pcmanfilemanager.png
|
||||
[3]: https://opensource.com/article/22/12/linux-file-manager-caja
|
||||
[4]: https://opensource.com/sites/default/files/2022-10/%E2%80%8BDual.panel_.in%20PCManFM.png
|
||||
[5]: https://opensource.com/article/22/10/obsolete-computer-linux-opportunity
|
@ -0,0 +1,301 @@
|
||||
[#]: subject: "How to Install the Minimalist ArchBang Linux Distro"
|
||||
[#]: via: "https://itsfoss.com/install-archbang/"
|
||||
[#]: author: "Sreenath https://itsfoss.com/author/sreenath/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Install the Minimalist ArchBang Linux Distro
|
||||
======
|
||||
|
||||
ArchBang is a minimal and lightweight [Arch Linux based distribution][1]. It uses the i3 window manager. With its minimal nature, ArchBang can help you revive your old computer or low-end devices.
|
||||
|
||||
There are two ways to install Arch Bang:
|
||||
|
||||
- Using the guided installer script
|
||||
- Following Arch wiki
|
||||
|
||||
No prizes for guessing that using the guided installer script will be easier to follow.
|
||||
|
||||
In this tutorial, I’ll show you the steps for installing ArchBang with its text-based installer script.
|
||||
|
||||
Please [check if your computer has UEFI or the legacy BIOS system][2]. Some steps are different for them.
|
||||
|
||||
I have performed the demo in a virtual machine. And hence the wifi configuration part is not there. Internet connection is not mandatory here; you can also install it offline. You can connect to wifi from within the system after successfully installing ArchBang.
|
||||
|
||||
Also, this method will remove any other operating system installed on your disk. Please be mindful of that.
|
||||
|
||||
### Download ArchBang Live ISO
|
||||
|
||||
To install ArchBang, you need the live ISO first.
|
||||
|
||||
You can go to their [official website and download the required ISO][3], as shown in the below screenshot.
|
||||
|
||||
![go to archbang iso images to download the iso file from sourceforge][4]
|
||||
|
||||
It brings you to their Sourceforge page. Download the ISO, which is approximately 1.2 GiB in size.
|
||||
|
||||
### Create the Live USB of ArchBang
|
||||
|
||||
Once downloaded, you should make a bootable USB of ArchBang. You can [use software like Balena Etcher][5] to create it. It’s quite simple to use.
|
||||
|
||||
Plug in your USB, browse to the downloaded ISO file and then hit the Flash button.
|
||||
|
||||
![etcher flash][6]
|
||||
|
||||
### Using text-based ArchBang installer
|
||||
|
||||
ArchBang live ISO will bring you to the default i3 desktop with conky running.
|
||||
|
||||
![archbang live iso home screen][7]
|
||||
|
||||
You have two methods to start the installation process:
|
||||
|
||||
- Press **Super + I** (as per desktop conky) to start installation directly.
|
||||
- Press **Super + T** to enter the terminal and use the command: `sudo abinstall`
|
||||
|
||||
A terminal with several options will appear when you do the above step:
|
||||
|
||||
![archbang installer][8]
|
||||
|
||||
The above screenshot shows the main menu of ArchBang installer. You can select each section with the associated number.
|
||||
|
||||
When you complete each category of the above installer, it will return to this menu and you can select the next category by pressing the corresponding number and Enter key.
|
||||
|
||||
Also, the completed sections will be checked with an “x” mark.
|
||||
|
||||
#### Step 1: Select / Set Partition
|
||||
|
||||
On the new installer screen, enter “1” to start [partitioning the disk][9].
|
||||
|
||||
Inside this, select the **Default** option. The installer has several tools to partition the disk, like cfdisk, fdisk, parted, etc. I used fdisk to do the job.
|
||||
|
||||
##### Partitioning for Non-UEFI system
|
||||
|
||||
Once the tool is selected, it will ask to choose the storage device. In my case, it was `/dev/sda` . Select the appropriate choice in your context.
|
||||
|
||||
To start partitioning, enter “n” for a new partition. After that, select **Primary Partition.**
|
||||
|
||||
![creating partition for non uefi system][10]
|
||||
|
||||
For [non-UEFI systems][2], you can create one single root partition for all purposes. So, accept all the default values for “First Sector” and “Last Sector”. Then, press “w” to write the changes.
|
||||
|
||||
On the next screen, you have to choose your filesystem and swap method. In this tutorial, I am using the EXT4 file system and Swap to File as the swap method.
|
||||
|
||||
So set those according to the screenshot.
|
||||
|
||||
![format the disk and select ext4 partition][11]
|
||||
|
||||
##### Partitioning for UEFI system
|
||||
|
||||
For UEFI users, you need to have two partitions, one EFI, with a 550 MB space, and another main root partition with the rest of the space (Swap as a file setting).
|
||||
|
||||
Press n and select **Primary Partition.** Then select the Partition number as 1.
|
||||
|
||||
Accept the default value for “First sector”. Now enter “+550M” as the value for “Last Sector”.
|
||||
|
||||
Once again, press “n” and select **Primary Partition**. Accept the default value for the first and last sectors.
|
||||
|
||||
![create two partitions for efi system][12]
|
||||
|
||||
Press “t” to change the type and select the partition number “1” or `/dev/sda1`, whose type is to be changed from “Linux” to “EFI”.
|
||||
|
||||
Select the partition type as EFI, as shown below:
|
||||
|
||||
![change type of smaller partition to efi][13]
|
||||
|
||||
Press “w” to write the changes. Then it will ask for filesystem selection. Here, you need to select the larger partition as the root partition (/dev/sda2, that is option 2 in the below screenshot).
|
||||
|
||||
![select larger partition for root partition in efi system][14]
|
||||
|
||||
Select EXT4 filesystem. This will again ask for mounting EFI partition.
|
||||
|
||||
![select efi partition][15]
|
||||
|
||||
In this step, you need to select the EFI partition at `/dev/sda1` and choose the mount point as `/boot/efi` . This will ask for format. Give consent by pressing “y”.
|
||||
|
||||
Also, don’t forget to choose the swap to file option.
|
||||
|
||||
#### Step 2: Start ArchBang installation
|
||||
|
||||
This is pretty simple. Select the Install ArchBang option from the main menu by pressing the corresponding number (2 in this case). It will start the installation process.
|
||||
|
||||
![installing archbang progress bar][16]
|
||||
|
||||
You should wait for some time to complete the installation.
|
||||
|
||||
#### Step 3: Set Hostname
|
||||
|
||||
Once installation is completed, Select the 3rd option on the main menu, which is for setting the hostname. You need to enter a hostname.
|
||||
|
||||
![provide hostname and press enter][17]
|
||||
|
||||
#### Step 4: Set Location
|
||||
|
||||
Location/Time Zone is typically mentioned in Zone/City format. I used Asia/Kolkata as the time zone.
|
||||
|
||||
The installer provides the list of available zones and cities; you need to enter the number corresponding to your choice.
|
||||
|
||||
![set time zone info][18]
|
||||
|
||||
Also, set your location the same way.
|
||||
|
||||
#### Step 5: Set Hardware Clock
|
||||
|
||||
You have two options; Set Hardware Clock to UTC or Local Time.
|
||||
|
||||
![set hardware clock time][19]
|
||||
|
||||
There are two time standards:** localtime** and Coordinated Universal Time (UTC). The localtime standard depends on the current time zone, while UTC is the global time standard and is independent of time zone values.
|
||||
|
||||
Enter your choice and press Enter key.
|
||||
|
||||
#### Step 6: Set Locale
|
||||
|
||||
Usually, you set the locale to en_US, if you are unsure what to do. That should be fine for most English-speaking users.
|
||||
|
||||
If you want to use the operating system in some other language like French, Spanish, Dutch etc, you can choose the appropriate locale from the list.
|
||||
|
||||
![set locale][20]
|
||||
|
||||
#### Step 7: Desktop Keyboard Layout
|
||||
|
||||
Similarly, most users should be fine with US keyboard. If you have some other keyboard (like French, or Italian), enter the appropriate choice from the available ones.
|
||||
|
||||
![set desktop keyboard layout][21]
|
||||
|
||||
#### Step 8: Configure Bootloader
|
||||
|
||||
In ArchBang, you get GRUB2, Syslinux, or Systemd for the bootloader. To make it simple, I am selecting GRUB2 from the choice.
|
||||
|
||||
![select grub2 as bootloader][22]
|
||||
|
||||
Now, it will ask you to specify the method to install GRUB. Select **Automatic** and press enter.
|
||||
|
||||
![select automatic grub][23]
|
||||
|
||||
#### Step 9: Set Root Password
|
||||
|
||||
Now, you should enter the root password. Select “Root Password” from the main menu.
|
||||
|
||||
![enter and confirm root password][24]
|
||||
|
||||
Here, enter and confirm the root password.
|
||||
|
||||
#### Step 10: Create a New User
|
||||
|
||||
Using a system with only a Root User is not secure. So, you should create a new user. In this installer, select the 10th option. Here, you should type a user name, password and confirm the password.
|
||||
|
||||
![create user and password][25]
|
||||
|
||||
Once done, press Enter to go to the main menu.
|
||||
|
||||
#### Step 11: Finish configuration
|
||||
|
||||
At this stage, you have reviewed all the configurations needed. You can now make it to effect by entering the letter “d” as shown in the screenshot below:
|
||||
|
||||
![enter d option to finish the installation][26]
|
||||
|
||||
This will ask permission to reboot your system.
|
||||
|
||||
![press y to reboot your system to new archbang][27]
|
||||
|
||||
Entering “y” will reboot your system to the newly installed ArchBang system.
|
||||
|
||||
### Post Installation Tweaks
|
||||
|
||||
Once rebooted, you will land in the same console. Probably there is no [display manager][28] installed. Here you should enter the username and password and press enter.
|
||||
|
||||
![login to archbang through tty][29]
|
||||
|
||||
This will bring you to the i3WM.
|
||||
|
||||
![installed archbang with i3wm][30]
|
||||
|
||||
Once installed, you need to do a couple of update tasks. **Connect to the internet first**.
|
||||
|
||||
Firstly, you need to update the Pacman keys and archlinux-keyring.
|
||||
|
||||
To do the same, open a terminal by pressing **Super + T** and run the following commands one by one:
|
||||
|
||||
```
|
||||
sudo pacman-key –init
|
||||
sudo pacman-key –populate
|
||||
sudo pacman -Syyu archlinux-keyring
|
||||
```
|
||||
|
||||
This will update system packages and keyrings. Reboot your system.
|
||||
|
||||
Now, you should install a display manager. I prefer LightDM display manager. So open a terminal and enter the following command to install it:
|
||||
|
||||
```
|
||||
sudo pacman -S lightdm lightdm-gtk-greeter
|
||||
```
|
||||
|
||||
Once installed, use the following command to start the Lightdm service:
|
||||
|
||||
```
|
||||
sudo systemctl enable lightdm.service
|
||||
```
|
||||
|
||||
You will get a good and minimal login screen from the next reboot.
|
||||
|
||||
![lightdm login screen in archbang][31]
|
||||
|
||||
You can now enjoy ArchBang Linux according to your liking.
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
ArchBang brings a good Arch Linux experience coupled with a not-so-hard installer and i3WM as the window manager.
|
||||
|
||||
I understand that using a text-based installer like this one could be intimidating for some users. But then, it is [one of the joys of the Arch Linux][32] domain. It feels like a challenge and when you successfully install it, it gives you a sense of accomplishment.
|
||||
|
||||
I have tried to detail all the steps with the necessary explanation. Please let me know if you face any issues or if you have any questions.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/install-archbang/
|
||||
|
||||
作者:[Sreenath][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/sreenath/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/arch-based-linux-distros/
|
||||
[2]: https://itsfoss.com/check-uefi-or-bios/
|
||||
[3]: https://sourceforge.net/projects/archbang/files/
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/12/go-to-archbang-iso-images-to-download-the-iso-file-from-sourceforge.png
|
||||
[5]: https://itsfoss.com/install-etcher-linux/
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/06/etcher-flash.png
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2022/12/archbang-live-iso-home-screen.webp
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/12/archbang-installer.png
|
||||
[9]: https://itsfoss.com/partition-managers-linux/
|
||||
[10]: https://itsfoss.com/wp-content/uploads/2022/12/creating-partition-for-non-uefi-system.png
|
||||
[11]: https://itsfoss.com/wp-content/uploads/2022/12/format-the-disk-and-select-ext4-partition.png
|
||||
[12]: https://itsfoss.com/wp-content/uploads/2022/12/create-two-partitions-for-efi-system.png
|
||||
[13]: https://itsfoss.com/wp-content/uploads/2022/12/change-type-of-smaller-partition-to_efi.png
|
||||
[14]: https://itsfoss.com/wp-content/uploads/2022/12/select-larger-partition-for-root-partition-in-efi-system.png
|
||||
[15]: https://itsfoss.com/wp-content/uploads/2022/12/select-efi-partition.png
|
||||
[16]: https://itsfoss.com/wp-content/uploads/2022/12/installing-archbang-progress-bar.png
|
||||
[17]: https://itsfoss.com/wp-content/uploads/2022/12/provide-hostname-and-press-enter.png
|
||||
[18]: https://itsfoss.com/wp-content/uploads/2022/12/set-time-zone-info.png
|
||||
[19]: https://itsfoss.com/wp-content/uploads/2022/12/set-hardware-clock-time.png
|
||||
[20]: https://itsfoss.com/wp-content/uploads/2022/12/set-locale.png
|
||||
[21]: https://itsfoss.com/wp-content/uploads/2022/12/set-desktop-keyboard-layout.png
|
||||
[22]: https://itsfoss.com/wp-content/uploads/2022/12/select-grub2-as-bootloader.png
|
||||
[23]: https://itsfoss.com/wp-content/uploads/2022/12/select-automatic-grub.png
|
||||
[24]: https://itsfoss.com/wp-content/uploads/2022/12/enter-and-confirm-root-password.png
|
||||
[25]: https://itsfoss.com/wp-content/uploads/2022/12/create-user-and-password.png
|
||||
[26]: https://itsfoss.com/wp-content/uploads/2022/12/enter-d-option-to-finish-the-installation.png
|
||||
[27]: https://itsfoss.com/wp-content/uploads/2022/12/press-y-to-reboot-your-system-to-new-archbang.png
|
||||
[28]: https://itsfoss.com/display-manager/
|
||||
[29]: https://itsfoss.com/wp-content/uploads/2022/12/login-to-archbang-through-tty.png
|
||||
[30]: https://itsfoss.com/wp-content/uploads/2022/12/installed-archbang-with-i3wm.png
|
||||
[31]: https://itsfoss.com/wp-content/uploads/2022/12/lightdm-login-screen-in-archbang.png
|
||||
[32]: https://itsfoss.com/why-arch-linux/
|
119
sources/tech/20221212.2 ⭐️⭐️ A sysadmin's guide to Carbonio.md
Normal file
119
sources/tech/20221212.2 ⭐️⭐️ A sysadmin's guide to Carbonio.md
Normal file
@ -0,0 +1,119 @@
|
||||
[#]: subject: "A sysadmin's guide to Carbonio"
|
||||
[#]: via: "https://opensource.com/article/22/12/carbonio-community-edition-sysadmin"
|
||||
[#]: author: "Arman Khosravi https://opensource.com/users/arman-khosravi"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
A sysadmin's guide to Carbonio
|
||||
======
|
||||
|
||||
[Carbonio Community Edition (Carbonio CE)][1] is an open source no-cost email and collaboration platform by Zextras. It provides privacy for organizations seeking digital sovereignty by using on-premises self-hosted servers. Using self-hosted servers offers a deeper level of control over infrastructure and data. However, it requires more attention to server configurations and infrastructure management to guarantee data sovereignty. Tasks done by system administrators play an important role in this matter. This makes administrative tasks a crucial part of achieving digital sovereignty, therefore, an administrative console dedicated to such tasks becomes extremely valuable to facilitate sysadmins' everyday jobs.
|
||||
|
||||
This is why Zextras launched the first release of its own admin panel for Carbonio CE on October 2022. For Carbonio CE system administrators, it is the first step toward the creation of an all-inclusive admin console.
|
||||
|
||||
In this article, I go into detail about the Carbonio CE Admin Panel and take a deeper look into what it can accomplish.
|
||||
|
||||
![Image of the Carbonio admin panel.][2]
|
||||
|
||||
### What is the Carbonio CE Admin Panel?
|
||||
|
||||
The Carbonio CE Admin Panel is designed to assist the Carbonio CE system administrators with the most repetitive and frequent tasks such as user management and domain configuration. It is a browser-based application that runs on a particular port and is available for system administrators to use in production environments as soon as Carbonio CE is installed.
|
||||
|
||||
### Why do you need the admin panel?
|
||||
|
||||
Everything done in Carbonio CE Admin Panel can be done through the command-line interface as well. This raises the question: why might system administrators prefer using the admin panel rather than the command-line interface?
|
||||
|
||||
Using the admin panel has its own obvious advantages such as:
|
||||
|
||||
- Making repetitive activities much easier to perform
|
||||
- Saving system administrators' time monitoring servers
|
||||
- Providing a much easier learning process for junior system administrators
|
||||
|
||||
Even though using the admin panel makes administrative tasks easier to perform, there is more to using this native user interface for Carboino CE. In essence, the Carbonio CE Admin Panel gives you the ability to monitor and manage your organization server from a single centralized location. Even when you're far away, you may still access your admin panel to check the status of servers and carry out various administrative activities.
|
||||
|
||||
### Creating and managing user accounts
|
||||
|
||||
Managing users has always been one of the most, if not the most, performed action by sysadmins. Therefore it should be an essential part of every administrative GUI available for system administrators. Suppose you, as the system administrator of the company have received some request by users to edit some information on their account. For instance, giving them access to some features, or your company has hired new employees, or some employees have left the company. All these scenarios require a sysadmin to manage user accounts frequently.
|
||||
|
||||
Using the Carbonio CE Admin Panel you can simply go to **Domains > select a domain > Accounts** and select any account to modify, or press the **+** button to add a new account.
|
||||
|
||||
![Image of the accounts Carbonio adminpanel.][3]
|
||||
|
||||
### Creating and managing mailing lists
|
||||
|
||||
Besides creating user accounts, a system administrator is often required to create different mailing lists that reflect the organizational structure of the company. Using mailing lists, users can simply send emails to a group of users by inserting the list address instead of every user address one by one.
|
||||
|
||||
Creating mailing lists in Carbonio CE is extremely easy using the admin panel. You need to go to **Domains > select a domain > Mailing List > press the + button**. You can now use the wizard that opens up to create a mailing list.
|
||||
|
||||
![Image of the Carbonio admin panel mailing list.][4]
|
||||
|
||||
The essential steps to follow are:
|
||||
|
||||
- Insert the name
|
||||
- Insert the mailing list address
|
||||
- Press **NEXT**
|
||||
- Insert the members
|
||||
- Press **CREATE**.
|
||||
|
||||
You can follow the same path to edit mail lists created before.
|
||||
|
||||
### Creating and managing domains
|
||||
|
||||
Managing domains is another task frequently done by system administrators. Similar to accounts, creating a domain is very easy in the Carbonio Admin Panel. You only need to go to **Domains > select a domain > under the details** and find different entries to monitor the status of the domain. To create a new domain simply click on the **CREATE** button on the top bar and select **Create New Domain** and insert the necessary information such as:
|
||||
|
||||
- Domain name
|
||||
- Maximum number of accounts and maximum email quota
|
||||
- Mail server where the domain is hosted
|
||||
|
||||
![Image of the Carbonio admin domains panel.][5]
|
||||
|
||||
### Creating and managing mailstore servers
|
||||
|
||||
The Carbonio CE Admin Panel allows system administrators to manage different servers present in the infrastructure and provide them with different tools to configure them. To monitor a new mailstore server you can go to **Mailstores > Servers List** and find all the available mailstore servers in your infrastructure in a list (when just one server is installed, only one server is shown in this area).
|
||||
|
||||
Under **Server Details**, you can select any of the available servers in the list and select **Data Volumes** to show more details of the storage volumes attached to it. While multiple volumes can be mounted simultaneously, only one primary volume, one secondary volume, and one index volume can be designated as active. You can add new volumes using the **NEW VOLUME +** button in the same section. You can also change the volume properties simply by clicking on them to open their detail window.
|
||||
|
||||
![Image of the Carbonio admin panel volumes.][6]
|
||||
|
||||
### Creating and managing classes of service
|
||||
|
||||
Another scenario that can be facilitated with the help of the admin panel is creating classes of service (COS). After the installation, a system administrator might need to create different classes (groups) and assign different properties to them. This way, later in the process each user or a group of users can be easily nominated to a class of service in order to have access to the features and properties assigned to that specific COS.
|
||||
|
||||
![Image of the Carbonio admin panel COS features.][7]
|
||||
|
||||
To create a COS simply click on the **CREATE** button and select **Create New COS** or alternatively go to **COS** on the left panel and click on **CREATE NEW COS +**. You can then insert the name of the COS and define the different services available to this specific class.
|
||||
|
||||
To edit a COS, go to **COS** on the left panel and select a COS from the dropdown menu at top of the list.
|
||||
|
||||
You can define settings like quotas, the mail servers that can host accounts from this COS, or enable features for this COS. You can also define features for general features like Mail, Calendar, and Contacts. Additional customizable options include Tagging, Out of Office Reply, Distribution List Folders, and so on.
|
||||
|
||||
![Image of the Carbonio admin panel classes of service preferences.][8]
|
||||
|
||||
### Conclusion
|
||||
|
||||
In this article, you saw a few scenarios in which the Carbonio CE Admin Panel saves you time and effort. The admin panel is an evolution of classical administrative tools in a new and centralized interface that gives the possibility of accessing different functionalities and monitoring tools from the same location.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/carbonio-community-edition-sysadmin
|
||||
|
||||
作者:[Arman Khosravi][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/arman-khosravi
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/22/3/open-source-collaboration-carbonio
|
||||
[2]: https://opensource.com/sites/default/files/2022-11/carbonio_admin_panel.webp
|
||||
[3]: https://opensource.com/sites/default/files/2022-11/accounts_carbonio_admin_panel.webp
|
||||
[4]: https://opensource.com/sites/default/files/2022-11/mailing_list_carbonio_admin_panel.webp
|
||||
[5]: https://opensource.com/sites/default/files/2022-11/domains_carbonio_admin_panel.webp
|
||||
[6]: https://opensource.com/sites/default/files/2022-11/volumes_carbonio_admin_panel.webp
|
||||
[7]: https://opensource.com/sites/default/files/2022-11/cos_features_carbonio_admin_panel.webp
|
||||
[8]: https://opensource.com/sites/default/files/2022-11/cos_preferences_carbonio_admin_panel.webp
|
@ -0,0 +1,257 @@
|
||||
[#]: subject: "Battle of the Texts and the Unicode Savior"
|
||||
[#]: via: "https://itsfoss.com/unicode-linux/"
|
||||
[#]: author: "Sylvain Leroux https://www.yesik.it/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Battle of the Texts and the Unicode Savior
|
||||
======
|
||||
|
||||
We all know how to type text on the keyboard. Don’t we?
|
||||
|
||||
So, may I challenge you to type that text in your favorite text editor:
|
||||
|
||||
![«Ayumi moved to Tokyo in 1993 to pursue her career» said Dmitrii][1]
|
||||
|
||||
This text is challenging to type since it contains:
|
||||
|
||||
- typographical signs not directly available on the keyboard,
|
||||
- hiragana Japanese characters,
|
||||
- the name of the Japanese capital written with a macron on top of the two letters “o” to comply with the Hepburn romanization standard,
|
||||
- and finally, the first name Dmitrii written using the Cyrillic alphabet.
|
||||
|
||||
No doubt, writing such a sentence on early computers would have been simply impossible. Because computers used limited character sets, unable to let coexist several writing systems. But today such limitations are lifted as we will see in this article.
|
||||
|
||||
### How do computers store text?
|
||||
|
||||
Computers stores characters as numbers. And they use tables to map those numbers to the glyph used to represent them.
|
||||
|
||||
For a long time, computers stored each character as a number between 0 and 255 (which fits exactly one byte). But that was far from being sufficient to represent the whole set of characters used in human writing. So, the trick was to use a different correspondence table depending on where in the world you lived.
|
||||
|
||||
Here is the [ISO 8859-15][2] correspondence table commonly used in France:
|
||||
|
||||
![The ISO 8859-15 encoding][3]
|
||||
|
||||
But if you lived in Russia, your computer would have probably used the [KOI8-R][4] or [Windows-1251][5] encoding instead. Let’s assume that later was used:
|
||||
|
||||
![The Windows-1251 encoding is a popular choice to store text written using the Cyrillic alphabets][6]
|
||||
|
||||
For numbers lower than 128, the two tables are identical. This range is corresponding to the [US-ASCII][7] standard, some kind of minimum-compatible set between characters tables. But beyond 128, the two tables are completely different.
|
||||
|
||||
For example, according to Windows-1251, the string _“said Дмитрий”_ is stored as:
|
||||
|
||||
```
|
||||
115 97 105 100 32 196 236 232 242 240 232 233
|
||||
```
|
||||
|
||||
To follow a common practice in computer sciences, those twelve numbers can be rewritten using the more compact hexadecimal notation:
|
||||
|
||||
```
|
||||
73 61 69 64 20 c4 ec e8 f2 f0 e8 e9
|
||||
```
|
||||
|
||||
If Dmitrii sends me that file, and I open it I might end up seeing that:
|
||||
|
||||
```
|
||||
said Äìèòðèé
|
||||
```
|
||||
|
||||
The file _appears_ to be corrupted. But it isn’t. The data— that is the _numbers_–stored in that file don’t have changed. As I live in France, my computer has _assumed_ the file to be encoded as ISO8859-15. And it displayed the characters _of that table_ corresponding to the data. And not the character of the encoding table used when the text was originally written.
|
||||
|
||||
To give you an example, take the character Д. It has the numeric code 196 (c4) according to Windows-1251. The only thing stored in the file is the number 196. But that same number corresponds to Ä according to ISO8859-15. So my computer wrongly believed it was the glyph intended to be displayed.
|
||||
|
||||
![When the same text file is written then read again but using a different encoding][8]
|
||||
|
||||
As a side note, you can still occasionally see an illustration of those issues on ill-configured websites or in email send by [mail user agents][9] making false assumptions about the character encoding used on the recipient’s computer. Such glitches are sometimes nicknamed [mojibake][10]. Hopefully, this is less and less frequent today.
|
||||
|
||||
![Example of Mojibake on the website of a French movie distributor. The website name has been changed to preserve the innocent.][11]
|
||||
|
||||
### Unicode comes to save to the day
|
||||
|
||||
I explained encoding issues when exchanging files between different countries. But things were even worst since the encodings used by different manufacturers for the same country were not always the same. You can understand what I mean if you had to exchange files between Mac and PC in the 80s.
|
||||
|
||||
Is it a coincidence or not, the [Unicode][12] project started in 1987, led by people of Xerox and … Apple.
|
||||
|
||||
The goal of the project was to define a universal character set allowing to _simultaneously_ use any character used in human writing within the same text. The original Unicode project was limited to 65536 different characters (each character being represented using 16 bits— that is two bytes per character). A number that has proven to be insufficient.
|
||||
|
||||
So, in 1996 Unicode has been extended to support up to 1 million different [code points][13]. Roughly speaking, a “code point” a number that identifies an entry in the Unicode character table. And one core job of the Unicode project is to make an inventory of all letters, symbols, punctuation marks and other characters that are (or were) used worldwide, and to assign to each of them a code point that will uniquely identify that character.
|
||||
|
||||
This is a huge project: to give you some idea, the version 10 of Unicode, published in 2017, defines over 136,000 characters covering 139 modern and historic scripts.
|
||||
|
||||
With such a large number of possibilities, a basic encoding would require 32 bits (that is 4 bytes) per character. But for text using mainly the characters in the US-ASCII range, 4 bytes per character means 4 times more storage required to save the data and 4 times more bandwidth to transmit them.
|
||||
|
||||
![Encoding text as UTF-32 requires 4 bytes per character][14]
|
||||
|
||||
So besides the [UTF-32][15] encoding, the Unicode consortium defined the more space-efficient [UTF-16][16] and [UTF-8][17] encodings, using respectively 16 and 8 bits. But how to store over 100,000 different values in only 8 bits? Well, you can’t. But the trick is to use one code value (8 bits in UTF-8, 16 in UTF-16) to store the most frequently used characters. And to use several code values for the least commonly used characters. So UTF-8 and UTF-16 are _variable length_ encoding. Even if this has drawbacks, UTF-8 is a good compromise between space and time efficiency. Not mentioning being backward compatible with most 1-byte pre-Unicode encoding, since UTF-8 was specifically designed so any valid US-ASCII file is also a valid UTF-8 file. In a sense, UTF-8 is a superset of US-ASCII. And today, there is no reason for not using the UTF-8 encoding. Unless of course if you write mostly with languages requiring multi-byte encodings or if you have to deal with legacy systems.
|
||||
|
||||
I let you compare the UTF-16 and UTF-8 encoding of the same string on the illustrations below. Pay special attention to the UTF-8 encoding using one byte to store the characters of the Latin alphabet. But using two bytes to store characters of the Cyrillic alphabet. That is twice more space than when storing the same characters using the Windows-1251 Cyrillic encoding.
|
||||
|
||||
![UTF-16 is a variable length encoding requiring 2 bytes to encode most characters. Some character still requires 4 bytes though (for example][18]
|
||||
|
||||
![UTF-8 is a variable length encoding requiring 1, 2, 3 or 4 bytes per character][19]
|
||||
|
||||
### And how does that help for typing text?
|
||||
|
||||
Well… It doesn’t hurt to have some knowledge of the underlying mechanism to understand the capabilities and limitations of your computer. Especially we will talk about Unicode and hexadecimal a little later. But for now… a little bit more history. Just a little bit, I promise…
|
||||
|
||||
… just enough to say starting in the 80s, computer keyboard used to have a [compose key][20] (sometimes labeled the “multi” key) next to the shift key. By pressing that key, you entered in “compose” mode. And once in that mode, you were able to enter characters not directly available on your keyboard by entering mnemonics instead. For example, in compose mode, typing RO produced the ® character (which is easy to remember as an R inside an O).
|
||||
|
||||
![compose key on lk201 keyboard][21]
|
||||
|
||||
It is now a rarity to see the compose key on modern keyboards. Probably because of the domination of PCs that don’t make use of it. But on Linux (and possibly on other systems?) you can emulate the compose key. This is something that can be configured in the GUI on many desktop environments using the “keyboard” control panel: But the exact procedure varies depending on your desktop environment or even depending its version. If you changed that setting, don’t hesitate to use the comment section to share the specific steps you’ve followed on your computer.
|
||||
|
||||
As for myself, for now, I will assume you use the default Shift+AltGr combination to emulate the compose key.
|
||||
|
||||
So, as a practical example, to enter the LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, you can type Shift+AltGr<< (you don’t have to maintain Shift+AltGr pressed when entering the mnemonic). If you managed to do that, I think you should be able to guess by yourself how to enter the _RIGHT-POINTING_ DOUBLE ANGLE QUOTATION MARK.
|
||||
|
||||
As another example, try Shift+AltGr--- to produce an EM DASH. For that to work, you have to press the [hyphen-minus][22] key on the main keyboard, not the one you will find on your numeric keypad.
|
||||
|
||||
Worth mentioning the “compose” key works in a non-GUI environment too. But depending if you use you use X11 or a text-only console, the supported compose key sequence are not the same.
|
||||
|
||||
On the console, you can check the list of supported compose key by using the `dumpkeys` command:
|
||||
|
||||
```
|
||||
dumpkeys --compose-only
|
||||
```
|
||||
|
||||
On the GUI, compose key is implemented at Gtk/X11 level. For a list of all mnemonics supported by the Gtk, take a look at that page: [https://help.ubuntu.com/community/GtkComposeTable][23]
|
||||
|
||||
### Is there a way to avoid relying on Gtk for character composition?
|
||||
|
||||
Maybe I’m a purist, but I found somewhat unfortunate the compose key support being hard-coded in Gtk. After all, not all GUI applications are using that library. And I cannot add my own mnemonics without re-compiling the Gtk.
|
||||
|
||||
Hopefully, there is support for character composition at X11-level too. Formerly, through the venerable [X Input Method (XIM)][24].
|
||||
|
||||
This will work at lower-level than Gtk-based character composition. But will allow a great amount of flexibility. And will work with many X11 applications.
|
||||
|
||||
For example, let’s imagine I just want to add the --> composition to enter the → character (U+2192 RIGHTWARDS ARROW), I would create a `~/.XCompose` file containing those lines:
|
||||
|
||||
```
|
||||
cat > ~/.XCompose << EOT
|
||||
# Load default compose table for the current local
|
||||
include "%L"
|
||||
|
||||
# Custom definitions
|
||||
<Multi_key> <minus> <minus> <greater> : U2192 # RIGHTWARDS ARROW
|
||||
EOT
|
||||
```
|
||||
|
||||
Then you can test by starting a new X11 application, forcing libraries to use XIM as input method:
|
||||
|
||||
```
|
||||
GTK_IM_MODULE="xim" QT_IM_MODULE="xim" xterm
|
||||
```
|
||||
|
||||
The new compose sequence should be available in the application you launched. I encourage you to learn more about the compose file format by typing `man 5 compose`.
|
||||
|
||||
To make XIM the default input method for all your applications, just add to your `~/.profile` file the following two lines. that change will be effective the next time you’ll open a session on your computer:
|
||||
|
||||
```
|
||||
export GTK_IM_MODULE="xim"
|
||||
export QT_IM_MODULE="xim"
|
||||
```
|
||||
|
||||
It’s pretty cool, isn’t it? That way you can add all the compose sequences you might want. And there are already a couple of funny ones in the default XIM settings. Try for example to press composeLLAP.
|
||||
|
||||
Well, I must mention two drawbacks though. XIM is relatively old and is probably only suitable for those of us who don’t regularly need multi-bytes input methods. Second, when using XIM as your input method, you no longer can enter Unicode characters by their code point using the Ctrl+Shift+u sequence. What? Wait a minute? I didn’t talk about that yet? So let’s do it now:
|
||||
|
||||
### What if there is no compose key sequence for the character I need?
|
||||
|
||||
The compose key is a nice tool to type some characters not available on the keyboard. But the default set of combinations is limited, and switching to XIM and defining a new compose sequence for a character you will need only once in a lifetime can be cumbersome.
|
||||
|
||||
Does that prevent you to mix Japanese, Latin and Cyrillic characters in the same text? Certainly not, thanks to Unicode. For example, the name あゆみ is made of:
|
||||
|
||||
- the [HIRAGANA LETTER A (U+3042)][25]
|
||||
- the [HIRAGANA LETTER YU (U+3086)][26]
|
||||
- and the [HIRAGANA LETTER MI (U+307F)][27]
|
||||
|
||||
I mentioned above the official Unicode character names, following the convention to write them in all upper cases. After their name, you will find their Unicode code point, written between parenthesis, as a 16-bit hexadecimal number. Does that remind you something?
|
||||
|
||||
Anyway, once you know the code point of a character, you can enter it using the following combination:
|
||||
|
||||
- Ctrl+Shift+u, then XXXX (the _hexadecimal_ code point of the character you want) and finally Enter.
|
||||
|
||||
As a shorthand, if you don’t release Ctrl+Shift while entering the code point, you won’t have to press Enter.
|
||||
|
||||
Unfortunately, that feature is implemented at software library level rather than at X11 level. So the support may be variable among different applications. In LibreOffice, for example, you have to type the code point using the main keyboard. Whereas Gtk-based application will accept entry from the numeric keypad as well.
|
||||
|
||||
Finally, when working at the console on my Debian system, there is a similar feature, but requiring instead to press Alt+XXXXX where XXXXX is the code point of the character you want, but written in _decimal_ this time. I wonder if this is Debian-specific or related to the fact I’m using the en_US.UTF-8 locale. If you have more information about that, I would be curious to read you in the comment section!
|
||||
|
||||
| GUI | Console | Character |
|
||||
| :- | :- | :- |
|
||||
| Ctrl+Shift+u3042Enter | Alt+12354 | あ |
|
||||
| Ctrl+Shift+u3086Enter | Alt+12422 | ゆ |
|
||||
| Ctrl+Shift+u307FEnter | Alt+12415 | み |
|
||||
|
||||
### Dead keys
|
||||
|
||||
Last but not least, there is a simpler method to enter key combinations that do not rely (necessarily) on the compose key.
|
||||
|
||||
Some keys on your keyboard were specifically designed to create a combination of characters. Those are called [dead keys][28]. Because when you press them once, nothing seems to happen. But they will silently modify the character produced by the next key you will press. This is a behavior inspired from mechanical typewriter: with them, pressing a dead key imprinted a character, but will not move the carriage. So the next keystroke will imprint another character at the same position. Visually resulting in a combination of the two pressed keys.
|
||||
|
||||
We use that a lot in French. For example, to enter the letter “ë” I have to press the ¨ dead key followed by the e key. Similarly, Spanish people have the ~ dead key on their keyboard. And on the keyboard layout for Nordic languages, you can find the ° key. And I could continue that list for a very long time.
|
||||
|
||||
![hungary dead keys][29]
|
||||
|
||||
Obviously, not all dead keys are available on all keyboard. I fact, most dead keys are NOT available on your keyboard. For example, I assume very few of you— if any— have a dead key ¯ to enter the macron (“flat accent”) used to write Tōkyō.
|
||||
|
||||
For those dead keys that are not directly available on your keyboard, you need to resort to other solutions. The good news is we’ve already used those techniques. But this time we will use them to emulate dead keys. Not “ordinary” keys.
|
||||
|
||||
So, a first option could be to generate the macron dead key by using Compose- (the hyphen-minus key available on your keyboard). Nothing appears. But if after that you press the o key it will finally produce “ō”.
|
||||
|
||||
The list of dead keys that Gtk can produce using the compose mode can be found [here][30].
|
||||
|
||||
A different solution would use the Unicode COMBINING MACRON (U+0304) character. Followed by the letter o. I will leave the details up to you. But if you’re curious, you may discover this leads to a very subtlely different result, rather than really producing a LATIN SMALL LETTER O WITH MACRON. And if I wrote the end of the previous sentence in all uppercase, this is a hint guiding you toward a method to enter ō with fewer keystrokes than by using a Unicode combining character… But I let that to your sagacity.
|
||||
|
||||
### Your turn to practice!
|
||||
|
||||
So, did you get it all? Does that work on your computer? It’s your turn to try that: using the clues given above, and a little bit of practice, now you can enter the text of the challenge given in the beginning of this article. Do it, then copy-paste your text in the comment section below as proof of your success.
|
||||
|
||||
There is nothing to win, except maybe the satisfaction of impressing your peers!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/unicode-linux/
|
||||
|
||||
作者:[Sylvain Leroux][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.yesik.it/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/wp-content/uploads/2017/10//text-challenge.png
|
||||
[2]: https://en.wikipedia.org/wiki/ISO/IEC_8859-15
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2017/10//ISO_8859-15.png
|
||||
[4]: https://en.wikipedia.org/wiki/KOI8-R
|
||||
[5]: https://en.wikipedia.org/wiki/Windows-1251
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2017/10//Windows-1251.png
|
||||
[7]: https://en.wikipedia.org/wiki/ASCII
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2017/10//windows-1251-to-iso8859-15-encoding-decoding-error-example.png
|
||||
[9]: https://en.wikipedia.org/wiki/Email_client
|
||||
[10]: https://en.wikipedia.org/wiki/Mojibake
|
||||
[11]: https://itsfoss.com/wp-content/uploads/2017/10/Mojibake-french-example.png
|
||||
[12]: https://en.wikipedia.org/wiki/Unicode
|
||||
[13]: https://en.wikipedia.org/wiki/Code_point
|
||||
[14]: https://itsfoss.com/wp-content/uploads/2017/10//unicode-utf-32-encoding-example.png
|
||||
[15]: https://en.wikipedia.org/wiki/UTF-32
|
||||
[16]: https://en.wikipedia.org/wiki/UTF-16
|
||||
[17]: https://en.wikipedia.org/wiki/UTF-8
|
||||
[18]: https://itsfoss.com/wp-content/uploads/2017/10//unicode-utf-16-encoding-example.png
|
||||
[19]: https://itsfoss.com/wp-content/uploads/2017/10//unicode-utf-8-encoding-example.png
|
||||
[20]: https://en.wikipedia.org/wiki/Compose_key
|
||||
[21]: https://itsfoss.com/wp-content/uploads/2022/12/compose_key_on_lk201_keyboard.jpg
|
||||
[22]: https://en.wikipedia.org/wiki/Hyphen-minus
|
||||
[23]: https://help.ubuntu.com/community/GtkComposeTable
|
||||
[24]: https://en.wikipedia.org/wiki/X_Input_Method
|
||||
[25]: http://www.fileformat.info/info/unicode/char/3042/index.htm
|
||||
[26]: http://www.fileformat.info/info/unicode/char/3086/index.htm
|
||||
[27]: http://www.fileformat.info/info/unicode/char/307F/index.htm
|
||||
[28]: https://en.wikipedia.org/wiki/Dead_key
|
||||
[29]: https://itsfoss.com/wp-content/uploads/2022/12/hungary_dead_keys.png
|
||||
[30]: https://help.ubuntu.com/community/GtkDeadKeyTable
|
@ -0,0 +1,300 @@
|
||||
[#]: subject: "Use Django to send emails with SMTP"
|
||||
[#]: via: "https://opensource.com/article/22/12/django-send-emails-smtp"
|
||||
[#]: author: "Sofiia Tarhonska https://opensource.com/users/sofiiatarhonska"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Use Django to send emails with SMTP
|
||||
======
|
||||
|
||||
Numerous professions utilize simple mail transfer protocol (SMTP) to deliver emails to their end users. SMTP also retrieves messages, though that has not been its primary use case. Open source frameworks like Django, a Python-based web framework, allows more control for sending emails using functions and expressions.
|
||||
|
||||
This article shows how to configure an SMTP server and send emails in Django using SMTP.
|
||||
|
||||
### Project setup and overview
|
||||
|
||||
Before proceeding, this tutorial requires a code editor (such as [VS Code or Codium][1]) on your preferred device.
|
||||
|
||||
Start by creating a new directory using the command in the terminal:
|
||||
|
||||
```
|
||||
mkdir exampledirectory
|
||||
```
|
||||
|
||||
Then change into the directory using the command:
|
||||
|
||||
```
|
||||
cd exampledirectory
|
||||
```
|
||||
|
||||
Within the newly created directory, create a [virtual environment][2] using the built-in venv module in the command terminal:
|
||||
|
||||
```
|
||||
python -m venv
|
||||
```
|
||||
|
||||
This command creates a virtual environment within the folder created earlier. To activate it, use the following command in the terminal:
|
||||
|
||||
On Linux and Mac:
|
||||
|
||||
```
|
||||
source .virtenv/bin/activate
|
||||
```
|
||||
|
||||
On Windows:
|
||||
|
||||
```
|
||||
\Scripts\activate
|
||||
```
|
||||
|
||||
### Creating a Django project
|
||||
|
||||
After activating the virtual environment, proceed to install the Django package from [pip][3]:
|
||||
|
||||
```
|
||||
pip install django
|
||||
```
|
||||
|
||||
Create a new Django project:
|
||||
|
||||
```
|
||||
python -m django startproject NewEmailProject
|
||||
```
|
||||
|
||||
This command creates a project with the name `NewEmailProject`. To run the project, head to the project directory (`NewEmailProject`) and run the server:
|
||||
|
||||
```
|
||||
python manage.py runserver
|
||||
```
|
||||
|
||||
Open the link for the developmental server in a browser. You see the Django homepage with release notes.
|
||||
|
||||
### Configuration for sending emails
|
||||
|
||||
Next, open the `settings.py` file (in the `NewEmailProject` folder) to customize configurations for sending emails using Django.
|
||||
|
||||
Scroll to the end of the code and update the file with the following code:
|
||||
|
||||
```
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||
EMAIL_HOST = 'smtp.yourserver.com'
|
||||
EMAIL_USE_TLS = False
|
||||
EMAIL_PORT = 465
|
||||
EMAIL_USE_SSL = True
|
||||
EMAIL_HOST_USER = 'your@djangoapp.com'
|
||||
EMAIL_HOST_PASSWORD = 'your password'
|
||||
```
|
||||
|
||||
Change the value of the `EMAIL_HOST` depending on your email client. Here are the acceptable values for common email clients:
|
||||
|
||||
- **Gmail:**`smtp.gmail.com`
|
||||
- **Outlook:**`smtp-mail.outlook.com`
|
||||
- **Yahoo:**`smtp.mail.yahoo.com`
|
||||
|
||||
You can change the `EMAIL_PORT` or leave 465 as the default.
|
||||
|
||||
You can use the secure socket layer (SSL) and transport socket layer (TSL) interchangeably as they specify connection security.
|
||||
|
||||
To figure out other custom configurations for your email server, check out the full [Django Project documentation][4].
|
||||
|
||||
### SMTP email backend
|
||||
|
||||
The `EMAIL_BACKEND` expression helps determine the most suitable backend when sending emails through the Django SMTP server. This variable points to `smtp.EmailBackend`, which receives all the parameters needed for sending emails. It tells Django to send the email to the recipient email using SMTP and not to the console.
|
||||
|
||||
### Sending emails with SMTP
|
||||
|
||||
When the environment is set up and `settings.py` is updated, you can send emails in Django. You can use an HTML form that sends a post request of the necessary information needed for sending an email.
|
||||
|
||||
Create a Django application for sending emails:
|
||||
|
||||
```
|
||||
python manage.py startapp mail
|
||||
```
|
||||
|
||||
Next, open the `settings.py` file and add the Django application (mail) to the `INSTALLED_APPS` list:
|
||||
|
||||
```
|
||||
INSTALLED_APPS = [
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"mail"]
|
||||
```
|
||||
|
||||
### Send mail function
|
||||
|
||||
In the mail application's `views.py` file, start by importing the `EmailMessage` and `get_connection` from `django.core.mail`:
|
||||
|
||||
```
|
||||
from django.core.mail import EmailMessage, get_connection
|
||||
```
|
||||
|
||||
The `EmailMessage` class is responsible for creating the email message itself. The `get_connection()` function returns an instance of the email backend specified in `EMAIL_BACKEND`.
|
||||
|
||||
Now create a function that accepts a `POST` request, which contains form data submitted from the client side. Followed by the `get_connection()` functions parameters containing the email configurations created in the project `settings.py` file.
|
||||
|
||||
Next, import the settings:
|
||||
|
||||
```
|
||||
from django.conf import settings
|
||||
```
|
||||
|
||||
This import allows access to the email configurations created in the `settings.py`. Next, create the variables:
|
||||
|
||||
```
|
||||
subject, recipient_list,
|
||||
```
|
||||
|
||||
Then you can `message`, and store the corresponding attributes used in the HTML form. The `email_from` variable contains the sender email, which is obtained from `EMAIL_HOST_USER` in the `settings.py` file.
|
||||
|
||||
After the variables are processed, the `EmailMessage` class sends an email using the `sends()` method, and then closes the connection. The `send_email()` function renders the `home.html` file containing the email form.
|
||||
|
||||
You can create a templates folder within your mail application and store the HTML files within that folder:
|
||||
|
||||
```
|
||||
from django.core.mail import EmailMessage, get_connectionfrom django.conf import settingsdef send_email(request):
|
||||
if request.method == "POST":
|
||||
with get_connection(
|
||||
host=settings.EMAIL_HOST,
|
||||
port=settings.EMAIL_PORT,
|
||||
username=settings.EMAIL_HOST_USER,
|
||||
password=settings.EMAIL_HOST_PASSWORD,
|
||||
use_tls=settings.EMAIL_USE_TLS
|
||||
) as connection:
|
||||
subject = request.POST.get("subject")
|
||||
email_from = settings.EMAIL_HOST_USER
|
||||
recipient_list = [request.POST.get("email"), ]
|
||||
message = request.POST.get("message")
|
||||
EmailMessage(subject, message, email_from, recipient_list, connection=connection).send()
|
||||
|
||||
return render(request, 'home.html')
|
||||
```
|
||||
|
||||
This is a bootstrap form for generating a message:
|
||||
|
||||
```
|
||||
<form method="post" action=".">
|
||||
{% csrf_token %}
|
||||
<div class="mb-3">
|
||||
<label for="exampleFormControlInput1" class="form-label">Receipt email address</label>
|
||||
<input type="text" class="form-control" name="email" id="exampleFormControlInput1" placeholder="Receipt email address">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="exampleInputSubject" class="form-label">Subject</label>
|
||||
<input type="text" class="form-control" name="subject" id="exampleInputSubject">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="exampleFormControlTextarea1" class="form-label">Message</label>
|
||||
<textarea class="form-control" id="exampleFormControlTextarea1" name="message" rows="3"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Send</button>
|
||||
</form>
|
||||
```
|
||||
|
||||
This form sends a post request to the `send_email()` function. This processes the form data and sends the email to the recipients.
|
||||
|
||||
Now open the `urls.py` file in the `NewEmailProject` folder to create the homepage URL. Update the `urlpattern` list by adding the code `path("", send_email)` .
|
||||
|
||||
### Sending email to multiple recipients
|
||||
|
||||
To specify multiple recipients when sending the same email, create a new function called `send_emails` within the `views.py` file and modify the send function code:
|
||||
|
||||
```
|
||||
def send_emails(request):
|
||||
if request.method == "POST":
|
||||
with get_connection(
|
||||
host=settings.EMAIL_HOST,
|
||||
port=settings.EMAIL_PORT,
|
||||
username=settings.EMAIL_HOST_USER,
|
||||
password=settings.EMAIL_HOST_PASSWORD,
|
||||
use_tls=settings.EMAIL_USE_TLS
|
||||
) as connection:
|
||||
recipient_list = request.POST.get("email").split()
|
||||
subject = request.POST.get("subject")
|
||||
email_from = settings.EMAIL_HOST_USER
|
||||
message = request.POST.get("message")
|
||||
print(type(recipient_list))
|
||||
EmailMessage(subject, message, email_from, recipient_list, connection=connection).send()
|
||||
|
||||
return render(request, 'send_emails.html')
|
||||
```
|
||||
|
||||
For the `recipient_list` variable, I'm using the Python `split()` method to convert the recipients email string to list so that I can email all of them.
|
||||
|
||||
Next, create another HTML file called `send_emails.html` in the templates folder and use the same form code for the `home.html` file within it.
|
||||
|
||||
To specify multiple email recipients, use a space between each email address:
|
||||
|
||||
```
|
||||
first@gmail.com second@gmail.com third@gmail.com
|
||||
```
|
||||
|
||||
You should also update the `urlpattern` list by adding the code:
|
||||
|
||||
```
|
||||
path("send-emails/", send_email)
|
||||
```
|
||||
|
||||
### Sending HTML emails
|
||||
|
||||
You can also send HTML emails with Django using a slightly modified version of the `send_email` function:
|
||||
|
||||
```
|
||||
html_message = '''<h1>this is an automated message</h1>'''
|
||||
msg = EmailMessage(subject, html_message, email_from,recipient_list, connection=connection)
|
||||
msg.content_subtype = "html"
|
||||
msg.send()
|
||||
```
|
||||
|
||||
### Sending emails with attachment
|
||||
|
||||
To include attachment to mails, create a variable and put it in the file path in a string like this:
|
||||
|
||||
```
|
||||
attachment = "mail/templates/example.png"
|
||||
```
|
||||
|
||||
Then, move the `EmailMessage` function to a variable and call the `attach_file` method followed by the `send` method:
|
||||
|
||||
```
|
||||
msg = EmailMessage(subject, message, email_from, recipient_list, connection=connection)
|
||||
msg.attach_file(attachment)
|
||||
msg.send()
|
||||
```
|
||||
|
||||
### Django email libraries
|
||||
|
||||
This guide on sending emails in Django would not be complete if I didn't mention the email libraries that are available to users. Here are some noteworthy email libraries.
|
||||
|
||||
- **Django mailer** is a Django app for queuing as it saves emails in a database and sends the mail out at a designated time.
|
||||
- **Django templated email** aims to send templated emails. It offers features like configurable template naming and location, template inheritance, and adding recipients to the CC and BCC lists.
|
||||
- **Anymail** allows the use of an email service provider (ESP). By using `django.core.mail`, it provides a sustained API that avoids tying your code to a single ESP.
|
||||
|
||||
### Emailing with Django
|
||||
|
||||
Sending emails in Django can sound daunting, but it's as simple as creating a virtual environment. You can add Django to the environment and create an email backend. Finally, you can set up an HTML template. Give it a try.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/django-send-emails-smtp
|
||||
|
||||
作者:[Sofiia Tarhonska][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/sofiiatarhonska
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/20/6/open-source-alternatives-vs-code#vscodium
|
||||
[2]: https://opensource.com/article/21/2/python-virtualenvwrapper
|
||||
[3]: https://www.redhat.com/sysadmin/install-python-pip-linux
|
||||
[4]: https://docs.djangoproject.com/en/3.2/ref/settings/#email-backend
|
||||
|
@ -0,0 +1,79 @@
|
||||
[#]: subject: "Drupal 10 is worth a fresh look"
|
||||
[#]: via: "https://opensource.com/article/22/12/drupal-10-fresh-look"
|
||||
[#]: author: "Martin Anderson-Clutz https://opensource.com/users/mandclu"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Drupal 10 is worth a fresh look
|
||||
======
|
||||
|
||||
The popular Drupal open source content management system (CMS) reaches a significant milestone when version 10 is released on December 14. Personally, I think Drupal X sounds way cooler, but so far, my calls to name it that haven't gotten much traction. I enlisted the help of my friend Aaron Judd of [Northern Commerce][1] to give us a sense of how cool Drupal X could look:
|
||||
|
||||
![New Drupal 10 racing 10 logo][2]
|
||||
|
||||
### What's a Drupal, anyway?
|
||||
|
||||
Drupal is an open source CMS and development framework. While other CMS options focus on simple long-form content (think blogs) or entirely free-form content (like in Wix or Squarespace), Drupal has made a name for itself in handling more complex content architectures, in multiple languages, with robust content governance. Drupal sites (like this site, Opensource.com!) benefit from a strong role-based access control (RBAC) system, unlimited custom roles and workflows, and a powerful and extensible media library.
|
||||
|
||||
Here's a rundown for anyone who hasn't kept tabs on what's coming in the newest major version.
|
||||
|
||||
### A fresh face
|
||||
|
||||
Most Drupal sites use custom themes to give them a unique look and feel. Still, the initial experience you have when installing a CMS matters. In Drupal, themes define the look and feel of a site, and you can use different themes for public and administrative experiences. Until recently, the Bartik and Seven themes had been the default face of Drupal for more than a decade. To put that in context, when Bartik was released, the most popular browser in the world was Internet Explorer 8. A lot has changed since then, particularly around best practices for building websites.
|
||||
|
||||
In fact, a significant change in Drupal 10 will be the removal of support for Internet Explorer (IE), which is itself no longer supported by Microsoft and hasn't seen major updates since 2013. That may not sound like an improvement, but continued support for IE kept the community from adopting modern markup and styling. For example, thanks to being unencumbered by support for legacy browsers, Drupal 10 includes a new responsive grid layout that's so innovative it got a writeup in [CSS Tricks][3].
|
||||
|
||||
![Responsive grid configuration][4]
|
||||
|
||||
The new faces of Drupal are two brand new themes: Olivero for visitors and Claro for admins. In addition to being fresh and modern designs, both were developed with accessibility as a top priority.
|
||||
|
||||
### Improvements under the hood
|
||||
|
||||
More than a decade ago, the Drupal community decided to "Get Off the Drupal Island." That meant adopting solutions shared across popular projects and frameworks instead of ones developed and maintained exclusively by the Drupal community. Today Drupal leverages a variety of projects and libraries whose names will be familiar to open source developers who have never touched Drupal: Symfony, Composer, CKEditor, Twig, Nightwatch, and more.
|
||||
|
||||
That has brought a variety of powerful capabilities to Drupal and allowed it to contribute back to those solutions, benefitting a broader set of developers. It has also become a determining factor for the cadence of Drupal's major version releases.
|
||||
|
||||
To illustrate, consider that Drupal 7 was released in early 2011. Drupal 8 was released almost five years later, towards the end of 2015. Drupal 9 was released in June of 2020, with a key motivator being the move to supported versions of underlying dependencies and removing deprecated code. And now, roughly two and half years later, we're already planning to release Drupal 10. This new major version will leverage updated versions of PHP, Symfony, and Composer, among others.
|
||||
|
||||
### An all-new editor
|
||||
|
||||
An upgrade of particular note is the move to CKEditor 5. Although notionally an incremental update, under the hood CKEditor 5 was completely rewritten, much the same as the transition from Drupal 7 to 8. In addition to a sleeker interface, CKEditor 5 has the potential for exciting new capabilities, such as real-time collaboration. Drupal's CKEditor integration for version 5 has already been augmented with a number of UI enhancements. For example, media placed within content can be configured using an overlaid toolbar ribbon instead of needing to launch a modal dialog to access these settings. Also, the styles dropdown now includes a preview of each type available.
|
||||
|
||||
![Real-time collaboration][5]
|
||||
|
||||
### A look ahead
|
||||
|
||||
Earlier in 2022, Drupal creator and project lead Dries Buytaert announced a focus on "ambitious site builders." This means that while the community will continue to work on making the developer experience better in general, moving forward there is a particular focus on making it easier to create engaging experiences in Drupal without having to write code or use command-line tools. Three strategic initiatives embody this new focus: Automatic Updates, the Project Browser, and Recipes.
|
||||
|
||||
**Automatic Updates** will reduce the total cost of ownership for Drupal sites and help them be more secure by ensuring they always have the latest core security patches. This will be a major benefit for site owners and Drupal development teams everywhere. However, judging by personal experience, Wednesday night pizza sales may take a hit (traditionally, the Drupal security team releases updates on the third Wednesday of the month). There is now a stable release of Automatic Updates as a contrib module. Work has begun to move this into Drupal core, so all Drupal sites will eventually be able to leverage this capability.
|
||||
|
||||
The **[Project Browser][6]** makes Drupal sites easier to build, maintain, and evolve by allowing site builders to search and browse through a subset of Drupal's vast catalog of available modules, prefiltered to the site's Drupal version, for security, stability, and more. A site builder can select, download, and install a module without leaving the site's web interface. In fact, there's an "app store" like interface meant to promote the most popular modules available that are compatible with the current site's version of Drupal. While other CMS options have had similar offerings, this advancement means you don't need to sacrifice ease-of-use to take advantage of the power of Drupal. Also, all of the thousands of modules listed are 100% free.
|
||||
|
||||
For many years Drupal has had a concept of distributions. These are opinionated versions of Drupal designed to meet specific use cases such as media publishing, fundraising, intranet portals, and more. While distributions have proven an excellent way to accelerate initial development, in practice, they have been known to require significant work to maintain and create extra work for site owners during maintenance. The **Recipes** initiative aims to make more granular, composable functionality available when building a site. Want to add a staff directory, events calendar, or locations map to your site? In the future, this will be as easy as installing a recipe and then customizing it to meet your site's specific needs.
|
||||
|
||||
### It's an exciting time to try Drupal
|
||||
|
||||
Drupal 10 is the culmination of work contributed by thousands of dedicated and talented community members worldwide. If you're not already using Drupal, we hope you'll try it out for your next project. There's a common saying among Drupalists: "Come for the code, stay for the community."
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/drupal-10-fresh-look
|
||||
|
||||
作者:[Martin Anderson-Clutz][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/mandclu
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.northern.co/
|
||||
[2]: https://opensource.com/sites/default/files/2022-12/DrupalX-RacerSticker-DrupalBlue-300ppi.png
|
||||
[3]: https://css-tricks.com/an-auto-filling-css-grid-with-max-columns
|
||||
[4]: https://opensource.com/sites/default/files/2022-11/responsive-grid-config.png
|
||||
[5]: https://opensource.com/sites/default/files/2022-11/realtime-collaboration_0.gif
|
||||
[6]: https://www.drupal.org/project/project_browser
|
@ -0,0 +1,104 @@
|
||||
[#]: subject: "Experience Linux desktop nostalgia with Rox"
|
||||
[#]: via: "https://opensource.com/article/22/12/linux-file-manager-rox"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Experience Linux desktop nostalgia with Rox
|
||||
======
|
||||
|
||||
Rox-Filer is an open source file manager for Linux, once intended for the defunct Rox desktop but now a streamlined application for any window manager or desktop. There hasn't been much activity on the Rox project since 2014, and even then it is mostly in maintenance mode. And that's part of Rox-Filer's charm. In a way, Rox-Filer is a snapshot of an old desktop style that was progressive for its time but has given way to a more or less standardized, or at least conventional, interface.
|
||||
|
||||
### Install Rox-Filer
|
||||
|
||||
On Linux, your distribution's software repository may have Rox available for install. For instance, Debian packages it:
|
||||
|
||||
```
|
||||
$ sudo apt install rox-filer
|
||||
```
|
||||
|
||||
If your Linux distribution doesn't package Rox-Filer but you want to try it out, you can [compile from source][1] by downloading the [source code][2], installing its build dependencies, and then compiling:
|
||||
|
||||
```
|
||||
$ sudo dnf install gtk2-devel libSM-devel \
|
||||
shared-mime-info glade-libs xterm
|
||||
$ wget https://codeload.github.com/rox-desktop/rox-filer/zip/refs/heads/master
|
||||
$ unzip rox*zip
|
||||
$ cd rox-filer-master
|
||||
$ ./ROX-Filer/AppRun
|
||||
```
|
||||
|
||||
### Configuring Rox
|
||||
|
||||
The Rox file manager is based on the look and feel of RISC OS, an operating system developed by Acorn in Cambridge England (the same group responsible for the popular Arm microprocessor). Today, there's an [open source RISC OS][3] you can install on a Raspberry Pi, but for now, Rox is close enough.
|
||||
|
||||
Rox has a simple layout. It has no menu bar, but there's a toolbar across the top, and the file panel is at the bottom.
|
||||
|
||||
![Image of the Rox file manager.][4]
|
||||
|
||||
As with the KDE Plasma Desktop, the default action of a single click in Rox is to open an item, whether it's a folder or a file. Unfortunately, no version of Rox, either packaged or compiled directly from the source, seems to be completely integrated with the mimetype definitions of the modern Linux desktop. For instance, Rox on CentOS renders an error when I click on even a basic text file, while the packaged version of Rox on Debian opens a plain text file but not a JPEG or archive file. You can fix this by setting a **Run Action** in the right-click context menu.
|
||||
|
||||
![Setting a run action in the Rox file manager.][5]
|
||||
|
||||
Setting a run action can have broad definitions, so you don't have to set a separate run action for JPEG, PNG, WEBP, and all other image types, instead set the same run command for all mimetypes starting with `image`.
|
||||
|
||||
Once you set that, you're ready to manage files with Rox.
|
||||
|
||||
### Navigation
|
||||
|
||||
You can navigate through your file system using the arrow icon in the top toolbar. The **Up** arrow takes you to the parent directory of your current location (in other words, the folder your current folder is in). To descend into a folder, click on it.
|
||||
|
||||
### Refreshing the view
|
||||
|
||||
Rox may not redraw the screen for every action, so sometimes you may need to prompt it to refresh. Click the **Circle** arrow in the Rox toolbar to refresh your current location's contents.
|
||||
|
||||
### Copy or move a file
|
||||
|
||||
There are two ways to copy or move a file in Rox. First, you can launch a second Rox window and drag and drop files from one window to the other. When you do, you're prompted to copy, move, or link the item you've dropped.
|
||||
|
||||
Alternatively, you can right-click an item and open the **File** submenu from the context menu. In the **File** submenu, choose **Copy** and then enter the destination path for the item you want to move or copy. After you've confirmed that the file has successfully been copied to the target location, you can optionally select the item again, choosing **Delete** from the **File** menu.
|
||||
|
||||
### Options
|
||||
|
||||
You can customize some aspects of Rox by selecting **Options** from the right-click menu. This brings up a Rox configuration screen that's admittedly only partially relevant to Rox. The Rox options assume you're running a window manager, like [Windowmaker][6] which provides a traditional dock (or "pinboard" in Rox terminology). I wasn't able to get the pinboard options to work on [Fluxbox][7], my preferred window manager, or Windowmaker. In both cases, the window manager handled iconified windows, and I wasn't able to configure Rox to override the control. It's possible that I wasn't drastic enough in some of my configurations, but considering that Linux window managers are very capable of managing iconified windows, the pinboard mechanism of Rox isn't a vital feature (and probably not as flexible as the window manager's options).
|
||||
|
||||
The other options, however, still work as expected. For instance, Rox by default resizes its window size to fit the contents of a folder. When you change from a directory containing twelve items to a directory containing just three, Rox shrinks its footprint. I find this jarring, so I chose the **Never automatically resize** option, forcing Rox to stay whatever size I set.
|
||||
|
||||
### Window commands
|
||||
|
||||
Some of my favorite features are four menu items hidden away at the bottom of the **Window** submenu in the right-click context menu. They are:
|
||||
|
||||
- **Enter path**: Enter an arbitrary path and change directory to it.
|
||||
- **Shell command**: Enter an arbitrary shell command and execute it.
|
||||
- **Terminal here**: Open a terminal at your current location.
|
||||
- **Switch to terminal**: Open a terminal at your current location, and close the Rox.
|
||||
|
||||
I love options that allow for quick navigation or quick commands, so it's nice to have these close at hand.
|
||||
|
||||
### Oldies
|
||||
|
||||
Rox is a "blast from the past," whether or not you've ever used RISC OS or something like it. Rox represents a style of digital file management and even desktop configuration that just doesn't quite exist anymore. I've run Fluxbox, on and off again, at work and at home for the past decade, and I love manually configuring menus and configuration files. However, most of the Linux desktop has moved on from the conventions Rox relies upon. It's not impossible to make Rox fully functional, but it would take a lot of work, and most of what you'd be configuring are already provided by modern window managers and desktops. Even so, Rox is fun to use and experience. It's a great demonstration of how flexible a traditional Linux desktop setup was (and still can be, if you use only a window manager), and much of its charm is in its simplicity. I can't imagine a file manager today not having a dedicated move function, but Rox dares to force you to copy and delete instead. It's a different kind of file manager, and it might not be the one you use all day every day, but it's something you have to try if you miss, or literally missed, the "old days" of the Linux (or RISC OS) desktop.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/linux-file-manager-rox
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/21/11/compiling-code
|
||||
[2]: https://sourceforge.net/projects/rox/files/rox/
|
||||
[3]: https://www.riscosopen.org/content/downloads
|
||||
[4]: https://opensource.com/sites/default/files/2022-10/rox-filemanager.png
|
||||
[5]: https://opensource.com/sites/default/files/2022-10/rox-menu-run.png
|
||||
[6]: https://opensource.com/article/19/12/linux-window-maker-desktop
|
||||
[7]: https://opensource.com/article/19/12/fluxbox-linux-desktop
|
@ -0,0 +1,182 @@
|
||||
[#]: subject: "Best Screen Recorders for Wayland in Linux [Compared & Tested]"
|
||||
[#]: via: "https://www.debugpoint.com/screen-recorders-linux-wayland/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Best Screen Recorders for Wayland in Linux [Compared & Tested]
|
||||
======
|
||||
|
||||
**Here’s a list of screen recorders which work in Wayland currently in most modern Linux distributions.**
|
||||
|
||||
![][1]
|
||||
|
||||
Modern Wayland protocol is used by default in most frontrunner Linux distributions, such as Ubuntu and Fedora. However, this X.Org successor comes with work for the app developers to re-platform their app for Wayland because Wayland is more secure and follows modern standards.
|
||||
|
||||
Linux legacy applications, those written with X.Org in mind, don’t work well in most cases unless it is modified.
|
||||
|
||||
Screen recorder apps fall into that category. There are many popular screen recorders which were developed for X.Org – doesn’t work anymore in Wayland.
|
||||
|
||||
However, few of them work. In this list, I will walk you through a few that I tested in the Wayland session. And they work well.
|
||||
|
||||
### Best screen recorder apps for Wayland in Linux distros
|
||||
|
||||
#### 1. Kooha
|
||||
|
||||
The first on this list is Kooha, written in GTK and supports X11 and Wayland. It’s a fast and simple screen recorder for the GNOME desktop. This application is one of the best GNOME apps that provides hassle-free recording experiences. This utility supports hardware acceleration, a timer, multiple sources as input and many advanced features. Here’s a summary:
|
||||
|
||||
- Option to select monitor for multiple displays or any window
|
||||
- Hardware accelerated encoding (disabled by default; enable it via settings)
|
||||
- Option to record the area of a screen
|
||||
- Record mic and computer sound together
|
||||
- Delay timer for records
|
||||
- Option to choose the frame rate
|
||||
- Support for WebM, mp4, gif, Mkv file types
|
||||
|
||||
![Kooha - Best Screen Recoder for GNOME][2]
|
||||
|
||||
![Kooha Settings][3]
|
||||
|
||||
Installing Kooha is easy using Flatpak. [Set up your system for Flatpak & Flathub][4] and run the following command to install it.
|
||||
|
||||
```
|
||||
flatpak install io.github.seadve.Kooha
|
||||
```
|
||||
|
||||
We tested it in the latest Ubuntu 22.10 and Fedora 37 with Wayland session, it works flawlessly.
|
||||
|
||||
**More details about Kooha**
|
||||
|
||||
- [Home page][5]
|
||||
- [Source code][6]
|
||||
|
||||
#### 2. GNOME screen recorder
|
||||
|
||||
The second in the list is GNOME Shell’s built-in screen recorder. It’s part of the GNOME’s new screenshot utility which you can launch by searching “screenshot” in the application menu.
|
||||
|
||||
GNOME Screen recorder provides you option to record the entire screen or a rectangular portion. In addition, you have the option to record the cursor as well.
|
||||
|
||||
However it only supports recording to webM format. And you can’t do a delayed start of your recording.
|
||||
|
||||
You don’t need to install anything extra to use this. Since it comes by default with GNOME desktop.
|
||||
|
||||
Use the keyboard shortcut `CTRL+SHIFT+ALT+R` to launch it. And select your option, then hit the record button.
|
||||
|
||||
The recordings saved at ~/home/Videos/Screencasts.
|
||||
|
||||
![GNOME Screen recorder][7]
|
||||
|
||||
#### 3. OBS Studio
|
||||
|
||||
The popular free and open-source streaming application OBS Studio recently started supporting Wayland. Although it is primarily used for live streaming, but it’s screen recording feature actually works in Wayland and you can use it.
|
||||
|
||||
Since its a professional grade software, you can take advantage of it’s recording feature. In addition, you can also record the sound from the mic of your system while recording the screen.
|
||||
|
||||
Installing OBS Studio is easy with Flatpak. [Set up your system for Flathub][4] and install it using the following command.
|
||||
|
||||
```
|
||||
flatpak install com.obsproject.Studio
|
||||
```
|
||||
|
||||
Note: OBS Studio need FFmpeg to run. We have a guide [here][8], if you want to install FFmpeg.
|
||||
|
||||
After you launch OBS Studio, click on + sign under Sources to add source. Then select “Screen capture..”. And then click ok.
|
||||
|
||||
![Screen capture option][9]
|
||||
|
||||
![recording in OBS Studio in Wayland][10]
|
||||
|
||||
After you stop the recording, it is saved at your ~/home directory.
|
||||
|
||||
**More details about OBS Studio**
|
||||
|
||||
- [Home page][11]
|
||||
- [Source code][12]
|
||||
|
||||
#### 4. vokoscreenNG
|
||||
|
||||
The vokoscreenNG is a little different screen recording app which is totally underrated. It’s an old application and supports window capture, rectangular caption. In addition, it also support audio capture alongside screen, system tray control, magnifying glass, countdown, timer and many cool features.
|
||||
|
||||
Recently, an experimental Wayland support introduced which you can try out. It works fairly well. Currently it supports webm, m4, mkv, mov and avi formats for Wayland. However, audio recording is not yet available for Wayland sessions.
|
||||
|
||||
You can download the pre-compiled executable for Linux distros which require no installation from the below link. And run.
|
||||
|
||||
[Download][13]
|
||||
|
||||
![vokoscreenNG][14]
|
||||
|
||||
**More details about vokoscreenNG**
|
||||
|
||||
- [Home page][15]
|
||||
|
||||
#### 5. Wayfarer
|
||||
|
||||
The final screen recorder in this list is Wayfarer, based on GTK4. It currently supports all the modern protocols such as Wayland, Pipewire with wireplumber. It’s simple user interface supports screen recording with audio capture. You can also select a portion of your desktop or the entire screen for recording.
|
||||
|
||||
Furthermore, you can select the frame rate, select mouse capture and have the ability to delay the recording. Currently it supports webm, mp4 and mkv formats.
|
||||
|
||||
![Wayfarer screen recorder for Linux][16]
|
||||
|
||||
However, it is currently available in Arch User repository (AUR) for Arch Linux. You can setup any AUR helper such as Yay and install it using the following command.
|
||||
|
||||
```
|
||||
yay -S wayfarer-git
|
||||
```
|
||||
|
||||
**More details about Wayfarer**
|
||||
|
||||
[Home page & source code][17]
|
||||
|
||||
### Other excellent screen recorders which are currently not working with Wayland
|
||||
|
||||
Other than the above list, there are some excellent screen recorders available for X.Org which is currently broken in Wayland. As per my test in Ubuntu 22.10 and Fedora 37 wayland session, none of these works. You can only see a black screen in the recording file. I hope they get fixed in coming days and become compatible with Wayland.
|
||||
|
||||
- [Peek][18] (may work with XWayland backend)
|
||||
- [Simple screen recorder][19]
|
||||
- [Blue Recorder][20] (supports Wayland but is currently broken)
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
From my personal experience, Wayland is faster and better. Since many modern distros are moving towards Wayland, you must change your workflow with replacement apps. I hope this list of screen recorders in Wayland helps you pick the one that suits you best.
|
||||
|
||||
Do let me know if you know of any other apps of a similar category which work with Wayland.
|
||||
|
||||
[Next:Top 10 32-Bit Linux Distributions in 2022 [Compared]][21]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/screen-recorders-linux-wayland/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/wp-content/uploads/2022/12/wayrec.jpg
|
||||
[2]: https://www.debugpoint.com/wp-content/uploads/2021/12/Kooha-Best-Screen-Recoder-for-GNOME.jpg
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/12/Kooha-Settings.jpg
|
||||
[4]: https://www.debugpoint.com/how-to-install-flatpak-apps-ubuntu-linux/
|
||||
[5]: https://apps.gnome.org/app/io.github.seadve.Kooha/
|
||||
[6]: https://github.com/SeaDve/Kooha
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2022/12/GNOME-Screen-recorder.jpg
|
||||
[8]: https://www.debugpoint.com/install-ffmpeg-ubuntu/
|
||||
[9]: https://www.debugpoint.com/wp-content/uploads/2022/12/Screen-capture-option.jpg
|
||||
[10]: https://www.debugpoint.com/wp-content/uploads/2022/12/recording-in-OBS-Studio-in-Wayland.jpg
|
||||
[11]: https://obsproject.com/
|
||||
[12]: https://github.com/obsproject/obs-studio
|
||||
[13]: https://linuxecke.volkoh.de/vokoscreen/vokoscreen-download.html
|
||||
[14]: https://www.debugpoint.com/wp-content/uploads/2022/12/vokoscreenNG.jpg
|
||||
[15]: https://linuxecke.volkoh.de/vokoscreen
|
||||
[16]: https://www.debugpoint.com/wp-content/uploads/2022/12/Wayfarer-screen-recorder-for-Linux.jpg
|
||||
[17]: https://github.com/stronnag/wayfarer
|
||||
[18]: https://github.com/phw/peek
|
||||
[19]: https://www.maartenbaert.be/simplescreenrecorder/
|
||||
[20]: https://github.com/xlmnxp/blue-recorder
|
||||
[21]: https://www.debugpoint.com/32-bit-linux-distributions/
|
@ -0,0 +1,159 @@
|
||||
[#]: subject: "How to Switch from Debian Stable to Testing"
|
||||
[#]: via: "https://itsfoss.com/switch-debian-stable-testing/"
|
||||
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Switch from Debian Stable to Testing
|
||||
======
|
||||
|
||||
If you are looking for the most stable Linux distribution, sure, Debian is the right choice.
|
||||
|
||||
Especially if you are planning to use it on servers.
|
||||
|
||||
But, on the desktop side, things are a bit different. I mean, you are given packages that are at least a year old and support for new-age hardware is even worse.
|
||||
|
||||
So what do you do in those cases, Well, you can use Debian testing!
|
||||
|
||||
But before jumping to the explanation part, let’s briefly understand Debian testing.
|
||||
|
||||
### What is Debian Testing?
|
||||
|
||||
Debian offers you 3 variants of Debian:
|
||||
|
||||
- Debian stable (what you get by default from their homepage).
|
||||
- Debian testing (has **newer packages** and breaks less often than Debian unstable).
|
||||
- Debian unstable (has the most recent packages and is **considered the most fragile of all**).
|
||||
|
||||
So Debian testing can be considered a sweet spot between stability and fresh packages.
|
||||
|
||||
I’ve been playing around with Debian testing for some time and haven’t faced any issues.
|
||||
|
||||
In fact, many Debian users prefer the testing variant over the stable version. Despite the name testing, it is pretty usable.
|
||||
|
||||
But still, **I would recommend you to experiment with this on VM,** try using it with your primary tools and if things go well, you can apply those changes in the main system.
|
||||
|
||||
### Switch from Debian stable to Debian testing
|
||||
|
||||
**_Warning: You can not downgrade from Debian testing to Debian stable, as installer scripts and installation tools are only designed to replace the older version with the new one._**
|
||||
|
||||
Also, I would recommend [using timeshift to create a backup][1] before applying the shown steps on your main machine.
|
||||
|
||||
First, update the existing packages using the given command:
|
||||
|
||||
```
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
```
|
||||
|
||||
Next, make a copy of original `sources.list` file:
|
||||
|
||||
```
|
||||
sudo cp /etc/apt/sources.list sources.list.backup
|
||||
```
|
||||
|
||||
Now, let’s start with the first step.
|
||||
|
||||
#### Step 1: Edit sources.list file
|
||||
|
||||
There are two ways of editing `sources.list` file. Either you can manually alter the current release name with `testing` or you can [use the sed command][2] to get your job done.
|
||||
|
||||
And I’m going with a 2nd one to make the whole process easier. You just have to use the given command, and it will replace `bullseye` with `testing` for you:
|
||||
|
||||
```
|
||||
sudo sed -i 's/bullseye/testing/g' /etc/apt/sources.list
|
||||
```
|
||||
|
||||
Now, open your terminal and use the given command to open `sources.list` files:
|
||||
|
||||
```
|
||||
sudo nano /etc/apt/sources.list
|
||||
```
|
||||
|
||||
And comment out the lines having `security.debian.org` and anything that ends with `-updates` as shown below:
|
||||
|
||||
![comment out security sources][3]
|
||||
|
||||
If you are using nano as I do, you can press `Alt + /` to jump to the end of the line. And then you have to add the following line:
|
||||
|
||||
```
|
||||
deb http://security.debian.org testing-security main
|
||||
```
|
||||
|
||||
![2. add line to keep track of testing in debian][4]
|
||||
|
||||
And [save the changes and exit from the nano][5] text editor.
|
||||
|
||||
#### Step 2: Update the Repository and install new packages
|
||||
|
||||
Now, update the repository index, and it will show you a massive update pending:
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
```
|
||||
|
||||
![update repository in linux][6]
|
||||
|
||||
Now, you can use the given command, and it will get you the most recent packages:
|
||||
|
||||
```
|
||||
sudo apt upgrade
|
||||
```
|
||||
|
||||
Sit back and relax as it is going to take a while.
|
||||
|
||||
Once done, it will present you with the list of changes made as you switched from Debian stable to testing:
|
||||
|
||||
![packages that are updated when switched to debian testing][7]
|
||||
|
||||
You can read if you want or you can **just press q** to proceed further.
|
||||
|
||||
Now, it will show you the message that some of the libraries installed on your system needs to restart. Press the **TAB** key, and it will select the **OK** option, and then press **Enter:**
|
||||
|
||||
![libraries needs to be restarted after update][8]
|
||||
|
||||
Next, it will ask you whether you want to restart services during the package upgrade. Here you have a choice. As I’m doing this for desktop usage only, I will go with `YES`:
|
||||
|
||||
![restart services during package upgrades without asking?][9]
|
||||
|
||||
Once done, you can reboot your system and then use the following command to have full effect from the changes you’ve just made:
|
||||
|
||||
```
|
||||
sudo apt full-upgrade
|
||||
```
|
||||
|
||||
Now, reboot your system, and you’ll have the most recent packages. Such as **I was running GNOME 43** when I got into the system:
|
||||
|
||||
![running gnome 43 in debian][10]
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
In this tutorial, I explained how you could switch from Debian stable to Debian testing. I hope this will be helpful to you.
|
||||
|
||||
And if you face any issues or have any queries, let me know in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/switch-debian-stable-testing/
|
||||
|
||||
作者:[Sagar Sharma][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/sagar/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/backup-restore-linux-timeshift/
|
||||
[2]: https://linuxhandbook.com/sed-command-basics/
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/11/comment-out-security-sources.gif
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/11/2.-add-line-to-keep-track-of-testing-in-debian.png
|
||||
[5]: https://linuxhandbook.com/nano-save-exit/
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/11/update-repository-in-linux.png
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2022/11/packages-that-are-updated-when-switched-to-debian-testing.png
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2022/11/libraries-needs-to-be-restarted-after-update.png
|
||||
[9]: https://itsfoss.com/wp-content/uploads/2022/11/restart-services-during-package-upgrades-without-asking.png
|
||||
[10]: https://itsfoss.com/wp-content/uploads/2022/11/running-gnome-43-in-debian.png
|
@ -0,0 +1,90 @@
|
||||
[#]: subject: "Why Drupal is the future of content strategy"
|
||||
[#]: via: "https://opensource.com/article/22/12/drupal-content-strategy"
|
||||
[#]: author: "Suzanne Dergacheva https://opensource.com/users/pixelite"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Why Drupal is the future of content strategy
|
||||
======
|
||||
|
||||
As a long-time advocate for open source and a contributor to Drupal, I spend a lot of time thinking about how organizations can leverage the platform. I've been thinking about Drupal's position in the larger digital ecosystem and how it compares to the other options on the market. And how Drupal can lean more on its strengths when planning out the strategy for a new project.
|
||||
|
||||
### How Drupal fits into the digital landscape
|
||||
|
||||
In 2022, putting a site online can be as fast as the time it takes to make a coffee. This is made possible because websites have many similar features and there's usually no need to build one from scratch. When I started my career, frameworks like Ruby on Rails were appealing because of their flexibility. But I quickly learned that the lack of standard solutions for common things like multilingual content, media management, and workflows, meant that each project required a huge investment in custom development.
|
||||
|
||||
On the other hand, web builders that have emerged over the last ten years, like Wix and Squarespace offer the dream of "drag-and-drop" website construction and customizable templates. But in reality, their flexibility is very surface-level. They don't offer enough flexibility to build a solid content model, create an experience, or provide the level of content compliance that large organizations need.
|
||||
|
||||
This is where Drupal stands out, providing both powerful functionality out-of-the-box, and the tools to build out custom functionality on top of that content.
|
||||
|
||||
### Drupal, the content management system
|
||||
|
||||
When I started using Drupal 15 years ago, it was described as a content management system. And it is, as it gives content editors the power to log in and manage content, rather than relying on a webmaster or a web developer to do it.
|
||||
|
||||
But there was also the promise that site builders could update not just the content, but the content model. Site builders could extend Drupal using configuration instead of writing code. This set it apart from the frameworks that were out at the time. From years of teaching people Drupal, I can tell you that there's a certain amount of joy and empowerment that people get when they realize how much they can do through the Drupal admin UI.
|
||||
|
||||
At its core, this is still Drupal's strength. You can control not just the content, but how content is organized. The fact that taxonomy and localization are baked into Drupal's content model, gives a huge advantage over other systems that have a more limited concept of content.
|
||||
|
||||
### Drupal, the platform
|
||||
|
||||
Shortly after adopting Drupal as our agency's technology of choice, I started calling it a platform. As an ambitious 20-something, I was keen to build more than nice-looking content-rich websites. The ambition was to create more powerful tools to organize the flow of information. This includes integrating Drupal with other systems to build functionality and workflows around your content. You can also create content synchronizations between a CRM and Drupal. Finally, you can search interfaces that allow you to search diverse content sources and filter content in new ways.
|
||||
|
||||
The fact that Drupal is so adaptable to these architectures distinguishes it immediately from other CMSs. When talking to large organizations, teams of developers or IT leaders see the benefit of using a technology that is so flexible and adaptable to functional needs.
|
||||
|
||||
### Drupal, the digital experience platform
|
||||
|
||||
While these attributes are still very compelling, Drupal is now referred to as a digital experience platform (DXP). Its main difference from the proprietary DXPs of the world is that it's open. It doesn't ship with a stack of integrated technologies but rather lets you decide what your stack will be. Whether it's for marketing integrations or multi-channel experiences, you can decide how content feeds into and out of Drupal. This flexibility is one of Drupal's strengths. But it can be a challenge when pitching Drupal against other DXPs that come with a complete marketing toolset.
|
||||
|
||||
Marketing folks often look for a packaged solution. And while an agency can package Drupal with a stack of tools, it's hard for Drupal to market this type of ready-to-go solution.
|
||||
|
||||
### Drupal's strength as a content strategy platform
|
||||
|
||||
So how does Drupal position itself when talking to marketers? Drupal's core strength is still its flexible content architecture. This means that it's an ideal platform for implementing a content strategy and content governance plan. These are two things that plenty of organizations are missing. They are also the two reasons for marketers to adopt a platform like Drupal.
|
||||
|
||||
### Better content strategy with Drupal
|
||||
|
||||
While Drupal can already be adapted to the content strategy of any organization, it doesn't mean that every Drupal website has a strong content strategy. Drupal implementers have to proactively make choices that prioritize the needs of content and content editors. This means doing things like:
|
||||
|
||||
- Organizing content around user needs, not organizational structure
|
||||
- Structuring content to be reusable, adaptable, personalized, translatable
|
||||
- Integrating content with digital services by making content available via API
|
||||
- Setting up tools so that content compliance is checked systematically
|
||||
|
||||
Meanwhile, beyond the website, organizations need to use best practices to prioritize their content strategy practice. This means:
|
||||
|
||||
- Empowering communicators and treating content editors as first-class users
|
||||
- Sharing best practices for web publishing across the organization
|
||||
- Creating a clear, actionable content governance plan
|
||||
- Using tools like the digital asset management (DAM) tool that fosters content governance
|
||||
- Creating a smooth flow of content and feedback between content experts and users
|
||||
|
||||
With new expectations of platforms to handle personalization and faster cycles for re-branding or implementing a completely new marketing strategy, it's more important than ever for your website to be a tool to help your content strategy. If you're looking for ways to orient your practice around a strong content strategy, here are some places to start:
|
||||
|
||||
- Get content editors involved in the process when launching a new web project
|
||||
- Build [documentation][1] that's driven by content needs, not just technology. Use real content examples in your documentation and talk about the "why" of the content.
|
||||
- Prioritize ongoing content governance rather than just relying on big projects to revamp your content every 3-5 years
|
||||
- Invest in cleaning up legacy content instead of migrating content as-is when you do invest in a website redesign
|
||||
- Invest in the content editor experience, something that Drupal facilitates and continues to invest in, but still takes active effort to do for each project
|
||||
|
||||
To sum up, Drupal is already a CMS and a DXP. But this is beside the point. There is a need to leverage Drupal's capabilities towards creating a strong content strategy to really get the most out of the platform.
|
||||
|
||||
_This article is based on the author's talk at DrupalCon Portland: [Future of content management: using Drupal as a content strategy platform][2]._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/drupal-content-strategy
|
||||
|
||||
作者:[Suzanne Dergacheva][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/pixelite
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/tags/documentation
|
||||
[2]: https://www.youtube.com/watch?v=iexCIUuMWDU
|
@ -0,0 +1,148 @@
|
||||
[#]: subject: "Enjoy two-panel file management on Linux with far2l"
|
||||
[#]: via: "https://opensource.com/article/22/12/linux-file-manager-far2l"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Enjoy two-panel file management on Linux with far2l
|
||||
======
|
||||
|
||||
Far2l is a port of the Windows text-based file manager **Far**. And to be clear, that's a lower-case **L** (as in "Linux") not a number **1**. It runs in the terminal and is designed around a plug-in structure, enabling compatibility with SSH, WebDAV, NFS, and more. You can compile and run far2l on Linux, Mac, and BSD, or Far on Windows.
|
||||
|
||||
### Install far2l
|
||||
|
||||
Far2l is currently in beta, so you're unlikely to find it in your Linux distribution's software repository. However, you can [compile it from source][1] by downloading cloning its [Git repository][2]:
|
||||
|
||||
```
|
||||
$ git clone --depth 1 https://github.com/elfmz/far2l.git
|
||||
```
|
||||
|
||||
You can browse through the source code to see all of its different components. The main source files are in `utils/src`:
|
||||
|
||||
```
|
||||
SharedResource.cpp
|
||||
StackSerializer.cpp
|
||||
StringConfig.cpp
|
||||
StrPrintf.cpp
|
||||
TestPath.cpp
|
||||
Threaded.cpp
|
||||
ThreadedWorkQueue.cpp
|
||||
TimeUtils.cpp
|
||||
TTYRawMode.cpp
|
||||
utils.cpp
|
||||
WideMB.cpp
|
||||
ZombieControl.cpp
|
||||
```
|
||||
|
||||
The file `ZombieControl.cpp` works to [mitigate a zombie apocalypse][3] (at least, in terms of processes), the file `ThreadedWorkQueue.cpp` helps speed processes along by using threading. Far2l isn't just built for extensibility, it's built responsibly!
|
||||
|
||||
Assuming you've already prepared your system for compiling code, as described in the [compiling from source][1] article, you must also install some development libraries required by far2l. On Fedora, CentOS, OpenMandriva, and Mageia, the minimal list is:
|
||||
|
||||
- wxGTK3-devel
|
||||
- spdlog-devel
|
||||
- xerces-c-devel
|
||||
- uchardet-devel (your repository may not have this one, but there's a workaround)
|
||||
|
||||
On Debian, the minimal list is:
|
||||
|
||||
- libwxgtk3.0-gtk3-dev
|
||||
- libuchardet-dev
|
||||
- libspdlog-dev
|
||||
- libxerces-c-dev
|
||||
|
||||
Use [CMake][4] to prepare the makefiles:
|
||||
|
||||
```
|
||||
$ mkdir build
|
||||
$ cd !$
|
||||
$ cmake .. -DUSEUCD=no
|
||||
```
|
||||
|
||||
The `-DUSECD=no` option is required only if you don't have the development libraries for `chardet` installed. If you do, then you can omit that option.
|
||||
|
||||
Finally, compile the code and install far2l to a temporary location:
|
||||
|
||||
```
|
||||
$ make -j$(nproc --all)
|
||||
$ mkdir ~/far2l
|
||||
$ make install DESTDIR=~/far2l
|
||||
```
|
||||
|
||||
If you prefer to install it to your system instead of to a temporary directory, then omit the `DESTDIR=~/far2l` option.
|
||||
|
||||
To launch far2l, invoke the binary stored in the `bin` subdirectory of your install path. For instance:
|
||||
|
||||
```
|
||||
$ ~/far2l/local/bin/far2l
|
||||
```
|
||||
|
||||
### Using far2l
|
||||
|
||||
When you first launch far2l, it creates a configuration directory in `~/.config` and prompts you to choose what font you'd like to use. On my system, 16 pt font size was the default, and anything less than that was impossible to read. I used the open source Fantasque Mono Regular as my font, but any monospace font ought to work.
|
||||
|
||||
Far2l is a two-panel file manager, meaning that the default view has a place to display two separate directories. At launch, both directories happen to be your home directory. To maximize the amount of screen space used for listing files, far2l uses two columns in each panel, and you can use the **Left** and **Right** arrows to change from one column to the other.
|
||||
|
||||
In the right column, you can also use the **Right** arrow to move "down" the list of files by one screen. In the left column, use the **Left** arrow to move "up" the list of files by one screen.
|
||||
|
||||
![Image of the far2l file manager.][5]
|
||||
|
||||
This navigation takes some getting used to, especially if you're used to terminal file managers that only use the **Right** arrow to descend into a directory. However, once you get used to far2l's navigation, you're likely to appreciate the added speed you gain from this simple pagination.
|
||||
|
||||
### Open a file or folder
|
||||
|
||||
To open a folder, select a folder in your file list and press the **Return** key. This causes the active panel to change to a view of that directory. The inactive panel doesn't change, so it's not uncommon for far2l to always be showing two different directories at the same time. That's a feature of the two-panel file manager design, although it can take some getting used to if you're not in the habit of splitting windows.
|
||||
|
||||
After you've moved into a directory, you can move back into its parent folder by selecting the double dots (`..`) at the top of the file listing and pressing **Return**.
|
||||
|
||||
To open a file, select a folder in your file list and press the **Return** key. The file opens according to your desktop's mimetype preferences.
|
||||
|
||||
### Panel and window navigation
|
||||
|
||||
To move from one panel to another, press the **Tab** key.
|
||||
|
||||
The fun thing about far2l is that its file listing is actually a layer over the top of your terminal. To hide the file listing temporarily, and to reveal it once it's gone, press **Ctrl+O** (that's the letter `O` not the digit zero).
|
||||
|
||||
You can also adjust how much of your terminal the file panels take up. Press **Ctrl+Up** and **Ctrl+Down** to adjust the vertical size of the file panels.
|
||||
|
||||
Make no mistake, though, you're not just suspending far2l when you access the terminal underneath. This isn't your usual terminal, it's a far2l terminal that interacts with the file manager and adds a few features to your standard terminal experience. For example, the [`find` command][6] gains graphical auto-completion.
|
||||
|
||||
![Image of far2l responsive terminal.][7]
|
||||
|
||||
### Copying and moving files
|
||||
|
||||
All the usual file management functions are available within far2l are available with function keys. These are listed along the bottom of the far2l window. There are lots of options for some of the actions, which is either over-complex or really really powerful, depending on your preference.
|
||||
|
||||
![Image of far21 move options.][8]
|
||||
|
||||
### Exiting far2l
|
||||
|
||||
To close far2l, type `exit far` into the command prompt at the bottom of the far2l window.
|
||||
|
||||
### Far out
|
||||
|
||||
Far2l is a dynamic and responsive text-based file manager. If you're a fan of classic two-panel file managers, then you'll feel at home with far2l. Far2l provides an interesting and novel interpretation of a terminal, and if you don't try far2l for its two-panel file management, you should at least try it for its terminal.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/linux-file-manager-far2l
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/21/11/compiling-code
|
||||
[2]: https://github.com/elfmz/far2l
|
||||
[3]: https://www.redhat.com/sysadmin/killing-zombies-linux-style
|
||||
[4]: https://opensource.com/article/21/5/cmake
|
||||
[5]: https://opensource.com/sites/default/files/2022-10/far2l.filemanager.png
|
||||
[6]: https://www.redhat.com/sysadmin/linux-find-command
|
||||
[7]: https://opensource.com/sites/default/files/2022-10/far2l-popup.png
|
||||
[8]: https://opensource.com/sites/default/files/2022-10/far2l-move-options.png
|
@ -0,0 +1,107 @@
|
||||
[#]: subject: "Harmonoid: A Beautiful Cross-Platform Music Player With Essential Features"
|
||||
[#]: via: "https://itsfoss.com/harmonoid/"
|
||||
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Harmonoid: A Beautiful Cross-Platform Music Player With Essential Features
|
||||
======
|
||||
|
||||
Fortunately, there’s no shortage of [good open-source music players for Linux][1]. We have covered a variety of options in the past.
|
||||
|
||||
Here, I highlight a music player that is free to use, open-source, and available for multiple platforms, including **Linux, Windows, and Android**.
|
||||
|
||||
### Harmonoid: Intuitive User Experience With Material Design
|
||||
|
||||
![harmonoid player][2]
|
||||
|
||||
Harmonoid is written in Dart programming language. It utilizes [libmpv][3] and [mpv][4] for its media playback capabilities on desktop platforms.
|
||||
|
||||
It provides an excellent user interface to work with. And does not use electron.js. So, if you hate Electron, this is something you can try.
|
||||
|
||||
Usually, you see apps feature material design UI on Android. If you did not know, Material is Google’s open-source design system.
|
||||
|
||||
![harmonoid player info][5]
|
||||
|
||||
Not a lot of creators use it for desktop applications. For a change, Harmonoid features a material design user experience that can be snappy and intuitive simultaneously.
|
||||
|
||||
This lets Harmonoid present a unique user experience to Linux users. The animations feel smooth and easy to navigate and offer plenty of valuable features to help manage your music library.
|
||||
|
||||
![harmonoid url][6]
|
||||
|
||||
If you want a music player with a good UI and feature set, I recommend trying Harmonoid.
|
||||
|
||||
**Recommended Read**: [Best Music Players for Linux Users][1]
|
||||
|
||||
### Features of Harmonoid
|
||||
|
||||
![harmonoid player options][7]
|
||||
|
||||
[Harmonoid][8] may look like a simple music player, but it comes packed with some of the most valuable features. They include:
|
||||
|
||||
- **Sing along feature where it finds lyrics, or you can manually add them**
|
||||
- **Edit song details, including artist, year, genre, track number, album, and title**
|
||||
- Easy sorting and ordering of your music list
|
||||
- A quick search feature to find what you are looking for
|
||||
- Caches metadata to offer a fast experience every time you load it
|
||||
- Good integration support with Windows and Linux
|
||||
- Discord rich presence support to show your music along with artwork and play buttons
|
||||
- Adjust the speed, volume, and pitch of the music
|
||||
- Raw metadata reader to read tags of any file or song in your library
|
||||
- Playback is powered by MPV
|
||||
- .LRC file compatibility
|
||||
- **Online URL (YouTube) and radio stream supported**
|
||||
- Cross-platform
|
||||
- Multiple artist support
|
||||
- Dark/light mode
|
||||
|
||||
In addition to these, several subtle abilities go a long way, like **gapless playback and context menu integration, and it is a lightweight application** in general.
|
||||
|
||||
Harmonoid should fit perfectly for users who want to play music or want to organize their collection simultaneously. I would say that it offers the best of both worlds.
|
||||
|
||||
![harmonoid settings][9]
|
||||
|
||||
### Install Harmonoid on Linux
|
||||
|
||||
You can grab the **.deb/.rpm** package from its [download page][10] and install it on Ubuntu-based distros or Fedora.
|
||||
|
||||
Additionally, you need to install mpv and libmpv using the following command (for Ubuntu):
|
||||
|
||||
```
|
||||
sudo apt install mpv lipmpv-dev
|
||||
```
|
||||
|
||||
Ensuring to install these packages will let you handle all kinds of files for playback with Harmonoid.
|
||||
|
||||
You can also find Harmonoid on [AUR][11] for Arch-based distributions. To explore more about the player, head to its [GitHub page][12] and the [official website][8].
|
||||
|
||||
_Have you tried Harmonoid to play and organize music on your Linux system? What’s your favorite music player for Linux? Let me know your thoughts in the comments down below._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/harmonoid/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://itsfoss.com/best-music-players-linux/
|
||||
[2]: https://itsfoss.com/wp-content/uploads/2022/12/harmonoid-player.png
|
||||
[3]: https://github.com/mpv-player/mpv/tree/master/libmpv
|
||||
[4]: https://mpv.io
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/12/harmonoid-player-info.png
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/12/harmonoid-url.png
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2022/12/harmonoid-player-options.png
|
||||
[8]: https://harmonoid.com
|
||||
[9]: https://itsfoss.com/wp-content/uploads/2022/12/harmonoid-settings.png
|
||||
[10]: https://harmonoid.com/downloads
|
||||
[11]: https://aur.archlinux.org/packages/harmonoid-bin
|
||||
[12]: https://github.com/harmonoid/harmonoid
|
@ -0,0 +1,96 @@
|
||||
[#]: subject: "5 reasons to love Linux GNOME Files"
|
||||
[#]: via: "https://opensource.com/article/22/12/linux-file-manager-gnome"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
5 reasons to love Linux GNOME Files
|
||||
======
|
||||
|
||||
The GNOME desktop is a common default desktop for most Linux distributions and, as with most operating systems, you manage your data on GNOME with software called a file manager. GNOME promotes a simple and clear naming scheme for its applications, and so its file manager is called, simply, Files. Its intuitive interface is simple enough that you forget what operating system you're using altogether. You're just using a computer, managing files in the most obvious way. GNOME Files is a shining example of thoughtful, human-centric design, and it's an integral part of modern computing. These are my top five favorite things about GNOME Files, and why I love using it.
|
||||
|
||||
### 1. Intuitive design
|
||||
|
||||
![THe GNOME Files file manager is an intuitive and friendly application.][1]
|
||||
|
||||
As long as you've managed files on a computer before, you basically already know how to use GNOME Files. Sure, everybody loves innovation, and everybody loves seeing new ideas that make the computer world a little more exciting. However, there's a time and a place for everything, and frankly sometimes the familiar just feels better. Good file management is like breathing. It's something you do without thinking about what you're doing. When it becomes difficult for any reason, it's disruptive and uncomfortable.
|
||||
|
||||
GNOME Files doesn't have any surprises in store for you, at least not the kind that make you stop what you thought you were doing in order to recalculate and start again. And my favorite aspect of the "do it the way you think you should do it" design of GNOME Files is that there isn't only one way to accomplish a task. One thing I've learned from teaching people how to do things on computers is that everyone seems to have a slightly different workflow for even the simplest of tasks, so it's a relief that GNOME Files accounts for that.
|
||||
|
||||
When you need to move a file, do you open a second window so you can drag and drop between the two? Or do you right-click and Cut the file and then navigate to the destination and Paste the file? Or do you drag the file onto a button or folder icon, blazing a trail through directories as they open for you? In GNOME Files, the "standard" assumptions usually apply (insofar as there are standard assumptions.)
|
||||
|
||||
### 2. Space saver
|
||||
|
||||
If you manage a lot of files for a lot of the time you're at your computer, you're probably familiar with just how much screen real estate a file manager can take up. Many file managers have lots of buttons across several toolbars, a menu bar, and a status bar, such that just one file manager window takes up a good portion of your screen. To make matters worse, many users prefer to open several folders, each in its own window, which takes even more space.
|
||||
|
||||
GNOME Files tends to optimize space. What takes up three separate toolbars in other file managers is in a single toolbar in GNOME Files, and that toolbar is what would traditionally be the window title bar. In the top bar, there's a forward and back button, file path information, a view settings button, and a drop-down menu with access to common functions.
|
||||
|
||||
![The GNOME Files toolbar has just the essential buttons, and in a compact space.][2]
|
||||
|
||||
### 3. Other locations
|
||||
|
||||
Not all operating systems or file managers make it so you can interact with your network as naturally as you can interact with your own computer. Linux has a long tradition of viewing the network as just another computer, and in fact, the name "GNOME" was an acronym for "GNU Network Object Model Environment."
|
||||
|
||||
In GNOME Files, it's trivial to open a folder on a computer you're not sitting in front of. Whether it's a server in a data center or just your office desktop while you're relaxing in your lounge with a laptop, the **Other Locations** bookmark in the GNOME Files side panel allows you to access files as if they were on your hard drive.
|
||||
|
||||
![It's easy to connect to remote systems through GNOME Files.][3]
|
||||
|
||||
To use it, you enter the file sharing protocol you want to use, along with the username and IP address of the computer you want to access. The `ssh://` protocol is most common between Linux or Unix machines, while `smb://` is useful for an environment with [Windows machines][4], and `dav://` is useful for applications running on the Internet. Assuming the target computer is accessible over the protocol you're using, and that its [firewall is set correctly][5] to permit you to pass through it, you can interact with a remote system as naturally as though they were on your local machine.
|
||||
|
||||
### 4. Preferences
|
||||
|
||||
Most file managers have configuration options, and to be fair GNOME Files actually doesn't give you very many choices compared to others. However, the options that it does offer are, like the modes of working it offers its users, the "standard" ones. I'm misusing the word "standard" intentionally: There is no standard, and what feels standard to one person is niche to someone else. But if you like what you're experiencing with GNOME Files under normal circumstances, and you feel that you're its intended audience, then the configuration options it offers are in line with the experience it promotes. For example:
|
||||
|
||||
- Sort folders before files
|
||||
- Expand folders in _list view_
|
||||
- Show the **Create link** option in the contextual menu
|
||||
- Show the **Delete Permanently** option in the contextual menu
|
||||
- Adjust visible information beneath a filename in _icon view_
|
||||
|
||||
That's nearly all the options you're given, and in a way it's surface-level choices. But that's GNOME Files. If you want something with more options, there are several very good alternatives that may better fit your style of work. If you're looking for a file manager that just covers the most common use cases, then try GNOME Files.
|
||||
|
||||
### 5. It's full of stars
|
||||
|
||||
I love the concept of metadata, and I generally hate the way it's _not_ implemented. Metadata has the potential to be hugely useful in a pragmatic way, but it's usually relegated to specialized metadata editing applications, hidden from view and out of reach. GNOME Files humbly contributes to improving this situation with one simple feature: The gold star.
|
||||
|
||||
In GNOME Files, you can star any file or folder. It's a bit of metadata so simple that it's almost silly to call it metadata, but in my experience, it makes a world of difference. Instead of desperately running [find][6] command to filter files by recent changes, or re-sorting a folder by modification time, or using [grep][7] to find that one string I just know is in an important file, I can star the files that are important to me.
|
||||
|
||||
Making plans for the zombie apocalypse all day? Star it so you can find it tomorrow when you resume your important work. After it's over and the brain-eaters have been dealt with, un-star the folder and resume normal operation. It's simple. Maybe too simple for some. But I'm a heavy star-user, and it saves me several methods of searching and instead reduces "what was I working on?" to the click of a single button.
|
||||
|
||||
### Install GNOME Files
|
||||
|
||||
If you've downloaded a mainstream Linux distribution, then chances are good that you already have GNOME and GNOME Files installed. However, not all distributions default to GNOME, and even those that do often have different desktops available for download. The development name of GNOME Files is `nautilus`, so to find out whether you have GNOME Files installed, open a terminal and type `nautilus &` and then press **Return**. If you see this error, you don't have GNOME Files available:
|
||||
|
||||
```
|
||||
bash: nautilus: command not found...
|
||||
```
|
||||
|
||||
To install GNOME Files, you must install the GNOME desktop. If you're happy with your current desktop, though, that's probably not what you want to do. Instead, consider trying [PCManFM][8] or [Thunar][9].
|
||||
|
||||
If you're interested in GNOME, though, this is a great reason to try it. You can probably install GNOME from your distribution's repository or software center.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/linux-file-manager-gnome
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/2022-10/gnome-files.webp
|
||||
[2]: https://opensource.com/sites/default/files/2022-10/gnome-files-toolbar.webp
|
||||
[3]: https://opensource.com/sites/default/files/2022-10/gnome-files-connect.webp
|
||||
[4]: https://opensource.com/article/21/4/share-files-linux-windows
|
||||
[5]: https://www.redhat.com/sysadmin/secure-linux-network-firewall-cmd
|
||||
[6]: https://opensource.com/article/21/9/linux-find-command
|
||||
[7]: https://www.redhat.com/sysadmin/how-to-use-grep
|
||||
[8]: http://linnk-to-pcmanfm-article
|
||||
[9]: http://link-to-article
|
@ -0,0 +1,384 @@
|
||||
[#]: subject: "Use my Groovy color wheel calculator"
|
||||
[#]: via: "https://opensource.com/article/22/12/groovy-color-wheel"
|
||||
[#]: author: "Chris Hermansen https://opensource.com/users/clhermansen"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Use my Groovy color wheel calculator
|
||||
======
|
||||
|
||||
Every so often, I find myself needing to calculate complementary colors. For example, I might be making a line graph in a web app or bar graphs for a report. When this happens, I want to use complementary colors to have the maximum "visual difference" between the lines or bars.
|
||||
|
||||
Online calculators can be useful in calculating two or maybe three complementary colors, but sometimes I need a lot more–for instance, maybe 10 or 15.
|
||||
|
||||
Many online resources explain how to do this and offer formulas, but I think it's high time for a Groovy color calculator. So please follow along. First, you might need to install Java and Groovy.
|
||||
|
||||
### Install Java and Groovy
|
||||
|
||||
Groovy is based on Java and requires a Java installation as well. Both a recent/decent version of Java and Groovy might be in your Linux distribution's repositories. Or you can install Groovy by following the instructions on the above link.
|
||||
|
||||
A nice alternative for Linux users is [SDKMan][1], which can get multiple versions of Java, Groovy, and many other related tools. For this article, I'm using SDK's releases of:
|
||||
|
||||
- Java: version 11.0.12-open of OpenJDK 11
|
||||
- Groovy: version 3.0.8
|
||||
|
||||
### Using a color wheel
|
||||
|
||||
Before you start coding, look at a real color wheel. If you open [GIMP (the GNU Image Manipulation Program)][2] and look on the upper left-hand part of the screen, you'll see the controls to set the foreground and background colors, circled in red on the image below:
|
||||
|
||||
![Controls to set foreground and background colors][3]
|
||||
|
||||
If you click on the upper left square (the foreground color), a window will open that looks like this:
|
||||
|
||||
![Set foreground color][4]
|
||||
|
||||
If it doesn't quite look like that, click on the fourth from the left button on the top left row, which looks like a circle with a triangle inscribed in it.
|
||||
|
||||
The ring around the triangle represents a nearly continuous range of colors. In the image above, starting from the triangle pointer (the black line that interrupts the circle on the left), the colors shade from blue into cyan into green, yellow, orange, red, magenta, violet, and back to blue. This is the color wheel. If you pick two colors opposite each other on that wheel, you will have two complementary colors. If you choose 17 colors evenly spaced around that wheel, you'll have 17 colors that are as distinct as possible.
|
||||
|
||||
Make sure you have selected the **HSV** button in the top right of the window, then look at the sliders marked H, S, and V, respectively. These are **h**ue, **s**aturation, and **v**alue. When choosing contrasting colors, the hue is the interesting parameter.
|
||||
|
||||
Its value runs from zero to 360 degrees; in the image above, it's 192.9 degrees.
|
||||
|
||||
You can use this color wheel to calculate the complementary color to another manually–just add 180 to your color's value, giving you 372.9. Next, subtract 360, leaving 17.9 degrees. Type that 17.9 into the **H** box, replacing the 192.9, and poof, you have its complementary color:
|
||||
|
||||
![Change foreground color][5]
|
||||
|
||||
If you inspect the text box labeled **HTML notation** you'll see that the color you started with was **#0080a3,** and its complement is **#a33100**. Look at the fields marked **Current** and **Old** to see the two colors complementing each other.
|
||||
|
||||
There is a most excellent and detailed [article on Wikipedia explaining HSL (hue, saturation, and lightness) and HSV (hue, saturation, and value) color models][6] and how to convert between them and the RGB standard most of us know.
|
||||
|
||||
I'll automate this in Groovy. Because you might want to use this in various ways, create a **Color** class that provides constructors to create an instance of Color and then several methods to query the color of the instance in HSV and RGB.
|
||||
|
||||
Here's the **Color** class, with an explanation following:
|
||||
|
||||
```
|
||||
1 /**
|
||||
2 * This class based on the color transformation calculations
|
||||
3 * in https://en.wikipedia.org/wiki/HSL_and_HSV
|
||||
4 *
|
||||
5 * Once an instance of Color is created, it can be transformed
|
||||
6 * between RGB triplets and HSV triplets and converted to and
|
||||
7 * from hex codes.
|
||||
8 */
|
||||
|
||||
9 public class Color {
|
||||
|
||||
10 /**
|
||||
11 * May as well keep the color as both RGB and HSL triplets
|
||||
12 * Keep each component as double to avoid as many rounding
|
||||
13 * errors as possible.
|
||||
14 */
|
||||
|
||||
15 private final Map rgb // keys 'r','g','b'; values 0-1,0-1,0-1 double
|
||||
16 private final Map hsv // keys 'h','s','v'; values 0-360,0-1,0-1 double
|
||||
|
||||
17 /**
|
||||
18 * If constructor provided a single int, treat it as a 24-bit RGB representation
|
||||
19 * Throw exception if not a reasonable unsigned 24 bit value
|
||||
20 */
|
||||
|
||||
21 public Color(int color) {
|
||||
22 if (color < 0 || color > 0xffffff) {
|
||||
23 throw new IllegalArgumentException('color value must be between 0x000000 and 0xffffff')
|
||||
24 } else {
|
||||
25 this.rgb = [r: ((color & 0xff0000) >> 16) / 255d, g: ((color & 0x00ff00) >> 8) / 255d, b: (color & 0x0000ff) / 255d]
|
||||
26 this.hsv = rgb2hsv(this.rgb)
|
||||
27 }
|
||||
28 }
|
||||
|
||||
29 /**
|
||||
30 * If constructor provided a Map, treat it as:
|
||||
31 * - RGB if map keys are 'r','g','b'
|
||||
32 * - Integer and in range 0-255 ⇒ scale
|
||||
33 * - Double and in range 0-1 ⇒ use as is
|
||||
34 * - HSV if map keys are 'h','s','v'
|
||||
35 * - Integer and in range 0-360,0-100,0-100 ⇒ scale
|
||||
36 * - Double and in range 0-360,0-1,0-1 ⇒ use as is
|
||||
37 * Throw exception if not according to above
|
||||
38 */
|
||||
|
||||
39 public Color(Map triplet) {
|
||||
40 def keySet = triplet.keySet()
|
||||
41 def types = triplet.values().collect { it.class }
|
||||
42 if (keySet == ['r','g','b'] as Set) {
|
||||
43 def minV = triplet.min { it.value }.value
|
||||
44 def maxV = triplet.max { it.value }.value
|
||||
45 if (types == [Integer,Integer,Integer] && 0 <= minV && maxV <= 255) {
|
||||
46 this.rgb = [r: triplet.r / 255d, g: triplet.g / 255d, b: triplet.b / 255d]
|
||||
47 this.hsv = rgb2hsv(this.rgb)
|
||||
48 } else if (types == [Double,Double,Double] && 0d <= minV && maxV <= 1d) {
|
||||
49 this.rgb = triplet
|
||||
50 this.hsv = rgb2hsv(this.rgb)
|
||||
51 } else {
|
||||
52 throw new IllegalArgumentException('rgb triplet must have integer values between (0,0,0) and (255,255,255) or double values between (0,0,0) and (1,1,1)')
|
||||
53 }
|
||||
54 } else if (keySet == ['h','s','v'] as Set) {
|
||||
55 if (types == [Integer,Integer,Integer] && 0 <= triplet.h && triplet.h <= 360
|
||||
56 && 0 <= triplet.s && triplet.s <= 100 && 0 <= triplet.v && triplet.v <= 100) {
|
||||
57 this.hsv = [h: triplet.h as Double, s: triplet.s / 100d, v: triplet.v / 100d]
|
||||
58 this.rgb = hsv2rgb(this.hsv)
|
||||
59 } else if (types == [Double,Double,Double] && 0d <= triplet.h && triplet.h <= 360d
|
||||
60 && 0d <= triplet.s && triplet.s <= 1d && 0d <= triplet.v && triplet.v <= 1d) {
|
||||
61 this.hsv = triplet
|
||||
62 this.rgb = hsv2rgb(this.hsv)
|
||||
63 } else {
|
||||
64 throw new IllegalArgumentException('hsv triplet must have integer values between (0,0,0) and (360,100,100) or double values between (0,0,0) and (360,1,1)')
|
||||
65 }
|
||||
66 } else {
|
||||
67 throw new IllegalArgumentException('triplet must be a map with keys r,g,b or h,s,v')
|
||||
68 }
|
||||
69 }
|
||||
|
||||
70 /**
|
||||
71 * Get the color representation as a 24 bit integer which can be
|
||||
72 * rendered in hex in the familiar HTML form.
|
||||
73 */
|
||||
|
||||
74 public int getHex() {
|
||||
75 (Math.round(this.rgb.r * 255d) << 16) +
|
||||
76 (Math.round(this.rgb.g * 255d) << 8) +
|
||||
77 Math.round(this.rgb.b * 255d)
|
||||
78 }
|
||||
|
||||
79 /**
|
||||
80 * Get the color representation as a map with keys r,g,b
|
||||
81 * and the corresponding double values in the range 0-1
|
||||
82 */
|
||||
|
||||
83 public Map getRgb() {
|
||||
84 this.rgb
|
||||
85 }
|
||||
|
||||
86 /**
|
||||
87 * Get the color representation as a map with keys r,g,b
|
||||
88 * and the corresponding int values in the range 0-255
|
||||
89 */
|
||||
|
||||
90 public Map getRgbI() {
|
||||
91 this.rgb.collectEntries {k, v -> [(k): Math.round(v*255d)]}
|
||||
92 }
|
||||
|
||||
93 /**
|
||||
94 * Get the color representation as a map with keys h,s,v
|
||||
95 * and the corresponding double values in the ranges 0-360,0-1,0-1
|
||||
96 */
|
||||
|
||||
97 public Map getHsv() {
|
||||
98 this.hsv
|
||||
99 }
|
||||
|
||||
100 /**
|
||||
101 * Get the color representation as a map with keys h,s,v
|
||||
102 * and the corresponding int values in the ranges 0-360,0-100,0-100
|
||||
103 */
|
||||
|
||||
104 public Map getHsvI() {
|
||||
105 [h: Math.round(this.hsv.h), s: Math.round(this.hsv.s*100d), v: Math.round(this.hsv.v*100d)]
|
||||
106 }
|
||||
|
||||
107 /**
|
||||
108 * Internal routine to convert an RGB triple to an HSV triple
|
||||
109 * Follows the Wikipedia section https://en.wikipedia.org/wiki/HSL_and_HSV#Hue_and_chroma
|
||||
110 * (almost) - note that the algorithm given there does not adjust H for G < B
|
||||
111 */
|
||||
|
||||
112 private static def rgb2hsv(Map rgbTriplet) {
|
||||
113 def max = rgbTriplet.max { it.value }
|
||||
114 def min = rgbTriplet.min { it.value }
|
||||
115 double c = max.value - min.value
|
||||
116 if (c) {
|
||||
117 double h
|
||||
118 switch (max.key) {
|
||||
119 case 'r': h = ((60d * (rgbTriplet.g - rgbTriplet.b) / c) + 360d) % 360d; break
|
||||
120 case 'g': h = ((60d * (rgbTriplet.b - rgbTriplet.r) / c) + 120d) % 360d; break
|
||||
121 case 'b': h = ((60d * (rgbTriplet.r - rgbTriplet.g) / c) + 240d) % 360d; break
|
||||
122 }
|
||||
123 double v = max.value // hexcone model
|
||||
124 double s = max.value ? c / max.value : 0d
|
||||
125 [h: h, s: s, v: v]
|
||||
126 } else {
|
||||
127 [h: 0d, s: 0d, v: 0d]
|
||||
128 }
|
||||
129 }
|
||||
|
||||
130 /**
|
||||
131 * Internal routine to convert an HSV triple to an RGB triple
|
||||
132 * Follows the Wikipedia section https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB
|
||||
133 */
|
||||
|
||||
134 private static def hsv2rgb(Map hsvTriplet) {
|
||||
135 double c = hsvTriplet.v * hsvTriplet.s
|
||||
136 double hp = hsvTriplet.h / 60d
|
||||
137 double x = c * (1d - Math.abs(hp % 2d - 1d))
|
||||
138 double m = hsvTriplet.v - c
|
||||
139 if (hp < 1d) [r: c + m, g: x + m, b: 0d + m]
|
||||
140 else if (hp < 2d) [r: x + m, g: c + m, b: 0d + m]
|
||||
141 else if (hp < 3d) [r: 0d + m, g: c + m, b: x + m]
|
||||
142 else if (hp < 4d) [r: 0d + m, g: x + m, b: c + m]
|
||||
143 else if (hp < 5d) [r: x + m, g: 0d + m, b: c + m]
|
||||
144 else if (hp < 6d) [r: c + m, g: 0d + m, b: x + m]
|
||||
145 }
|
||||
|
||||
146 }
|
||||
```
|
||||
|
||||
The **Color** class definition, which begins on line 9 and ends on line 146, looks a lot like a Java class definition (at first glance, anyway) that would do the same thing. But this is Groovy, so you have no imports up at the beginning, just comments. Plus, the details illustrate some more Groovyness.
|
||||
|
||||
Line 15 creates the private final variable **rgb** that contains the color value supplied to the class constructor. You'll keep this value as **Map** with keys `r`, `g`, and `b` to access the RGB values. Keep the values as double values between 0 and 1 so that 0 would indicate a hexadecimal value of **#00** or an integer value of 0 and 1 would mean a hexadecimal value of **#ff** or an integer value of 255. Use double to avoid accumulating rounding errors when converting inside the class.
|
||||
|
||||
Similarly, line 16 creates the private final variable **hsv** that contains the same color value but in HSV format–also a **Map**, but with keys `h`, `s`, and `v` to access the HSV values, which will be kept as double values between 0 and 360 (hue) and 0 and 1 (saturation and value).
|
||||
|
||||
Lines 21-28 define a **Color** constructor to be called when passing in an int argument. For example, you might use this as:
|
||||
|
||||
```
|
||||
def blue = new Color(0x0000ff)
|
||||
```
|
||||
|
||||
- On lines 22-23, check to make sure the argument passed to the constructor is in the allowable range for a 24-bit integer RGB constructor, and throw an exception if not.
|
||||
- On line 25, initialize the **rgb** private variable as the desired RGB Map, using bit shifts and dividing each by a double value 255 to scale the numbers between 0 and 1.
|
||||
- On line 26, convert the RGB triplet to HSV and assign it to the **hsv** private variable.
|
||||
|
||||
Lines 39-69 define another **Color** constructor to be called when passing in either an RGB or HSV triple as a **Map**. You might use this as:
|
||||
|
||||
```
|
||||
def green = new Color([r: 0, g: 255, b: 0])
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
def cyan = new Color([h: 180, s: 100, v: 100])
|
||||
```
|
||||
|
||||
Or similarly with double values scaled between 0 and 1 instead of integers between 0 and 255 in the RGB case and between 0 and 360, 0 and 1, and 0 and 1 for hue, saturation, and value, respectively.
|
||||
|
||||
This constructor looks complicated, and in a way, it is. It checks the **keySet()** of the map argument to decide whether it denotes an RGB or HSV tuple. It checks the class of the values passed in to determine whether the values are to be interpreted as integers or double values and, therefore, whether they are scaled into 0-1 (or 0-360 for hue).
|
||||
|
||||
Arguments that can't be sorted out using this checking are deemed incorrect, and an exception is thrown.
|
||||
|
||||
Worth noting is the handy streamlining provided by Groovy:
|
||||
|
||||
```
|
||||
def types = triplet.values().collect { it.class }
|
||||
```
|
||||
|
||||
This uses the **values()** method on the map to get the values as a **List** and then the **collect()** method on that **List** to get the class of each value so that they can later be checked against **[Integer,Integer,Integer]** or **[Double,Double,Double]** to ensure that arguments meet expectations.
|
||||
|
||||
Here is another useful streamlining provided by Groovy:
|
||||
|
||||
```
|
||||
def minV = triplet.min { it.value }.value
|
||||
```
|
||||
|
||||
The **min()** method is defined on **Map**; it iterates over the **Map** and returns the **MapEntry**—a (key, value) pair—having the minimum value encountered. The **.value** on the end selects the value field from that **MapEntry**, which gives something to check against later to determine whether the values need to be normalized.
|
||||
|
||||
Both rely on the Groovy Closure, similar to a Java lambda–a kind of anonymous procedure defined where it is called. For example, **collect()** takes a single **Closure** argument and passes it to each **MapEntry** encountered, known as the parameter within the closure body. Also, the various implementations of the Groovy Collection interface, including here **Map**, define the **collect()** and **min()** methods that iterate over the elements of the **Collection** and call the **Closure** argument. Finally, the syntax of Groovy supports compact and low-ceremony invocations of these various features.
|
||||
|
||||
Lines 70-106 define five "getters" that return the color used to create the instance in one of five formats:
|
||||
|
||||
- **getHex()** returns an int corresponding to a 24-bit HTML RGB color.
|
||||
- **getRgb()** returns a **Map** with keys `r`, `g`, `b` and corresponding double values in the range 0-1.
|
||||
- **getRgbI()** returns a **Map** with keys `r`, `g`, `b` and corresponding int values in the range 0-255.
|
||||
- **getHsv()** returns a **Map** with keys `h`, `s`, `v` and corresponding double values in the range 0-360, 0-1 and 0-1, respectively.
|
||||
- **getHsvI()** returns a **Map** with keys `h`, `s`, `v` and corresponding int values in the range 0-360, 0-100 and 0-100, respectively.
|
||||
|
||||
Lines 112-129 define a static private (internal) method **rgb2hsv()** that converts an RGB triplet to an HSV triplet. This follows the algorithm described in the Wikipedia article [section on Hue and chroma][7], except that the algorithm there yields negative hue values when the green value is less than the blue value, so the version is modified slightly. This code isn't particularly Groovy other than using the **max()** and **min()****Map** methods and returning a **Map** instance declaratively without a return statement.
|
||||
|
||||
This method is used by the two getter methods to return the **Color** instance value in the correct form. Since it doesn't refer to any instance fields, it is static.
|
||||
|
||||
Similarly, lines 134-145 define another private (internal) method **hsv2rgb()**, that converts an HSV triplet to an RGB triplet, following the algorithm described in the Wikipedia article [section on HSV to RGB conversion][8]. The constructor uses this method to convert HSV triple arguments into RGB triples. Since it doesn't refer to any instance fields, it is static.
|
||||
|
||||
That's it. Here's an example of how to use this class:
|
||||
|
||||
```
|
||||
1 def favBlue = new Color(0x0080a3)
|
||||
|
||||
2 def favBlueRgb = favBlue.rgb
|
||||
3 def favBlueHsv = favBlue.hsv
|
||||
|
||||
4 println "favBlue hex = ${sprintf('0x%06x',favBlue.hex)}"
|
||||
5 println "favBlue rgbt = ${favBlue.rgb}"
|
||||
6 println "favBlue hsvt = ${favBlue.hsv}"
|
||||
|
||||
7 int spokeCount = 8
|
||||
8 double dd = 360d / spokeCount
|
||||
9 double d = favBlue.hsv.h
|
||||
10 for (int spoke = 0; spoke < spokeCount; spoke++) {
|
||||
11 def color = new Color(h: d, s: favBlue.hsv.s, v: favBlue.hsv.v)
|
||||
12 println "spoke $spoke $d° hsv ${color.hsv}"
|
||||
13 println " hex ${sprintf('0x%06x',color.hex)} hsvI ${color.hsvI} rgbI ${color.rgbI}"
|
||||
14 d = (d + dd) % 360d
|
||||
15 }
|
||||
```
|
||||
|
||||
As my starting value, I've chosen the lighter blue from the [opensource.com][9] header **#0080a3**, and I'm printing a set of seven more colors that give maximum separation from the original blue. I call each position going around the color wheel a spoke and compute its position in degrees in the variable **d**, which is incremented each time through the loop by the number of degrees **dd** between each spoke.
|
||||
|
||||
As long as `Color.groovy` and this test script are in the same directory, you can compile and run them as follows:
|
||||
|
||||
```
|
||||
$ groovy test1Color.groovy
|
||||
favBlue hex = 0x0080a3
|
||||
favBlue rgbt = [r:0.0, g:0.5019607843137255, b:0.6392156862745098]
|
||||
favBlue hsvt = [h:192.88343558282207, s:1.0, v:0.6392156862745098]
|
||||
spoke 0 192.88343558282207° hsv [h:192.88343558282207, s:1.0, v:0.6392156862745098]
|
||||
hex 0x0080a3 hsvI [h:193, s:100, v:64] rgbI [r:0, g:128, b:163]
|
||||
spoke 1 237.88343558282207° hsv [h:237.88343558282207, s:1.0, v:0.6392156862745098]
|
||||
hex 0x0006a3 hsvI [h:238, s:100, v:64] rgbI [r:0, g:6, b:163]
|
||||
spoke 2 282.8834355828221° hsv [h:282.8834355828221, s:1.0, v:0.6392156862745098]
|
||||
hex 0x7500a3 hsvI [h:283, s:100, v:64] rgbI [r:117, g:0, b:163]
|
||||
spoke 3 327.8834355828221° hsv [h:327.8834355828221, s:1.0, v:0.6392156862745098]
|
||||
hex 0xa30057 hsvI [h:328, s:100, v:64] rgbI [r:163, g:0, b:87]
|
||||
spoke 4 12.883435582822074° hsv [h:12.883435582822074, s:1.0, v:0.6392156862745098]
|
||||
hex 0xa32300 hsvI [h:13, s:100, v:64] rgbI [r:163, g:35, b:0]
|
||||
spoke 5 57.883435582822074° hsv [h:57.883435582822074, s:1.0, v:0.6392156862745098]
|
||||
hex 0xa39d00 hsvI [h:58, s:100, v:64] rgbI [r:163, g:157, b:0]
|
||||
spoke 6 102.88343558282207° hsv [h:102.88343558282207, s:1.0, v:0.6392156862745098]
|
||||
hex 0x2fa300 hsvI [h:103, s:100, v:64] rgbI [r:47, g:163, b:0]
|
||||
spoke 7 147.88343558282207° hsv [h:147.88343558282207, s:1.0, v:0.6392156862745098]
|
||||
hex 0x00a34c hsvI [h:148, s:100, v:64] rgbI [r:0, g:163, b:76]
|
||||
```
|
||||
|
||||
You can see the degree position of the spokes reflected in the HSV triple. I've also printed the hex RGB value and the int version of the RGB and HSV triples.
|
||||
|
||||
I could have built this in Java. Had I done so, I probably would have created separate **RgbTriple** and **HsvTriple** helper classes because Java doesn't provide the declarative syntax for **Map**. That would have made finding the min and max values more verbose. So, as usual, the Java would have been more lengthy without improving readability. There would have been three constructors, though, which might be a more straightforward proposition.
|
||||
|
||||
I could have used 0-1 for the hue as I did for saturation and value, but somehow I like 0-360 better.
|
||||
|
||||
Finally, I could have added–and I may still do so one day–other conversions, such as HSL.
|
||||
|
||||
### Wrap up
|
||||
|
||||
Color wheels are useful in many situations and building one in Groovy is a great exercise to learn both how the wheel works and the, well, grooviness of Groovy. Take your time; the code above is long. However, you can build your own practical color calculator and learn a lot along the way.
|
||||
|
||||
#### Groovy resources
|
||||
|
||||
The Apache Groovy language site provides [a good tutorial-level overview][10] of working with Collection, particularly Map classes. This documentation is quite concise and easy to follow, at least partly because the facility it is documenting has been designed to be itself concise and easy to use!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/groovy-color-wheel
|
||||
|
||||
作者:[Chris Hermansen][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/clhermansen
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://sdkman.io/
|
||||
[2]: https://www.gimp.org/
|
||||
[3]: https://opensource.com/sites/default/files/2022-12/1controls.png
|
||||
[4]: https://opensource.com/sites/default/files/2022-12/2foregroundcolor.png
|
||||
[5]: https://opensource.com/sites/default/files/2022-12/3changeforegroundcolor_0.png
|
||||
[6]: https://en.wikipedia.org/wiki/HSL_and_HSV
|
||||
[7]: https://en.wikipedia.org/wiki/HSL_and_HSV#Hue_and_chroma
|
||||
[8]: https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB
|
||||
[9]: https://opensource.com/
|
||||
[10]: https://groovy-lang.org/databases.html
|
||||
|
@ -0,0 +1,108 @@
|
||||
[#]: subject: "Try this Python-based file manager on Linux"
|
||||
[#]: via: "https://opensource.com/article/22/12/linux-file-manager-dragonfly-navigator"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Try this Python-based file manager on Linux
|
||||
======
|
||||
|
||||
Dragonfly Navigator is a general-purpose file manager written in Python and Qt. It's easy to install, easy to use, and a great example of what Python can do.
|
||||
|
||||
Python is a popular language for several reasons, but I think one of its primary strengths is that it's equally useful to beginner-level programmers and to experienced coders. There's something exciting about a language you can take from [drawing basic geometric shapes][1] to [scraping the web][2] to programming a zombie apocalypse [video game][3], or writing desktop applications you can use every day. And that's what Dragonfly Navigator is: a desktop utility that everyone can use.
|
||||
|
||||
### Installing Dragonfly Navigator
|
||||
|
||||
To install Dragonfly Navigator, first download the source code from its [Git repository][4]. If you're on Debian Linux or similar, download the `.deb` file. If you're using Fedora, CentOS, Mageia, OpenMandriva, or similar, then download the `.tar.gz` file.
|
||||
|
||||
Dragonfly Navigator has a few dependencies. Because you aren't installing it through your package manager, it's up to you to resolve those. There are just two, so use your package manager (`dnf` or `apt`) to find and install them:
|
||||
|
||||
- PyQt5, also called `python-qt5`
|
||||
- Python PIL, also called `pillow`
|
||||
|
||||
### Launching Dragonfly Navigator
|
||||
|
||||
To launch Dragonfly Navigator, either install the `.deb` file (on Debian-based systems) or unarchive the `.tar.gz` file:
|
||||
|
||||
```
|
||||
$ tar xvf dragonfly*gz
|
||||
```
|
||||
|
||||
On Debian-based systems, Dragonfly Navigator appears in your application menu. ON other systems, you must launch it manually unless you [manually install it][5].
|
||||
|
||||
For now, I'm not installing it, so I launch it manually:
|
||||
|
||||
```
|
||||
$ cd dragonfly
|
||||
$ ./dragonfly
|
||||
```
|
||||
|
||||
![Dragonfly Navigator is a two-panel file manager][6]
|
||||
|
||||
### Dual pane
|
||||
|
||||
Dragonfly Navigator is a two-panel file manager, meaning that it's always showing you two directories. At launch, both directories happen to be your home directory. You can browse through files and folders in either panel. They function exactly the same, and it only matters which panel you're "in" when you start copying or moving files.
|
||||
|
||||
### Open a directory
|
||||
|
||||
To open a directory, double-click it. By default, the directory opens in that same pane. If you want to utilize the two-panel layout, though, hold down the **Ctrl** key as you double-click to display its contents in the other panel.
|
||||
|
||||
### Open a file
|
||||
|
||||
To open a file, double-click or right-click on it.
|
||||
|
||||
Yes, you can right-click a file to open it. That takes some getting used to, if you're used to a right-click bringing up a contextual menu. There is no contextual menu in Dragonfly Navigator, though, and you might be surprised at how much time you feel like you're saving yourself when you reduce the very common action of opening a file to just one click. It may seem silly now, but trust me you'll grow to cherish it.
|
||||
|
||||
### Quick preview
|
||||
|
||||
Some files are available for a quick preview so you don't have to open them in any particular application. To preview a file, hover your mouse over it and press the **Alt** key on your keyboard. A preview appears in the opposite panel.
|
||||
|
||||
![The second panel of Dragonfly Navigator can be used as a preview pane.][7]
|
||||
|
||||
### Copying and moving files
|
||||
|
||||
To copy or move a file from one directory to another (or a directory to a directory), there are a few steps.
|
||||
|
||||
- In one panel, navigate to the destination directory. This is the location you want to copy a file _to_.
|
||||
- In the other panel, select the file you want to copy.
|
||||
- Click the **Copy** button in the middle strip of Dragonfly Navigator.
|
||||
|
||||
For moving a file, follow the same steps but click the **Move** button instead.
|
||||
|
||||
If you're not used to a dual-panel file manager, this feels unfamiliar at first. But if you think about it, there are several steps required to copy a file in your usual file manager (find the file, open another window, drag-and-drop, and so on.) After you do it a few times, it becomes second nature.
|
||||
|
||||
### Selecting files
|
||||
|
||||
Normally, you click a file or folder to make it your active selection. That's probably no different than your current file manager, or at least to some file manager you've used in the past.
|
||||
|
||||
To select multiple items in a range, click one file, and then hold the **Shift** key and click another file. All items between the two files you clicked are also selected.
|
||||
|
||||
To select multiple arbitrary files, hold the **Ctrl** key and click on the files you want selected.
|
||||
|
||||
### The power of Qt and Python
|
||||
|
||||
The Qt toolkit is a powerful programming utility, and Python is capable of creating great applications with it. I've only covered the basics of Dragonfly Navigator in this article, so download it, read the docs, click around, explore it, and maybe you'll have found a fun new file manager.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/linux-file-manager-dragonfly-navigator
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/17/10/python-101#turtle
|
||||
[2]: https://opensource.com/article/20/5/web-scraping-python
|
||||
[3]: https://opensource.com/downloads/python-gaming-ebook
|
||||
[4]: https://github.com/suncore/dflynav/releases
|
||||
[5]: https://opensource.com/article/18/1/how-install-apps-linux
|
||||
[6]: https://opensource.com/sites/default/files/2022-10/dragonfly-navigator.webp
|
||||
[7]: https://opensource.com/sites/default/files/2022-10/dragonfly-navigator-preview.webp
|
169
sources/tech/20221219.0 ⭐️⭐️ Use Rexx for scripting in 2023.md
Normal file
169
sources/tech/20221219.0 ⭐️⭐️ Use Rexx for scripting in 2023.md
Normal file
@ -0,0 +1,169 @@
|
||||
[#]: subject: "Use Rexx for scripting in 2023"
|
||||
[#]: via: "https://opensource.com/article/22/12/rexx-scripting"
|
||||
[#]: author: "Howard Fosdick https://opensource.com/users/howtech"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Use Rexx for scripting in 2023
|
||||
======
|
||||
|
||||
In a [previous article][1], I showed how the Rexx scripting language is both powerful and easy to use. It uses specific techniques to reconcile these two goals that are often considered in conflict.
|
||||
|
||||
This article walks you through two example Rexx scripts so you can get a feel for the language. Rexx purports to be highly capable yet easy to work with.
|
||||
|
||||
### An example of a Rexx script
|
||||
|
||||
The [LISP programming language][2] is famous for its overuse of parentheses. It can be a real challenge for programmers to ensure they're all matched up correctly.
|
||||
|
||||
This short script reads a line of LISP code from the user and determines whether the parentheses in the input are properly matched. If the parentheses aren't properly balanced, the program displays a syntax error.
|
||||
|
||||
Below are three sample interactions with the program. In the first, the LISP code I entered was correctly typed. But the next two contain mismatched parentheses that the Rexx script identifies:
|
||||
|
||||
```
|
||||
Enter a line to analyze:
|
||||
(SECOND (LAMBDA (LIS) (FIRST (CDR LIS)) ))
|
||||
Parentheses are balanced
|
||||
|
||||
Enter a line to analyze:
|
||||
((EQSTR (CAR LIS1) (CAR LIS2))
|
||||
Syntax error: too many left parens, not balanced
|
||||
|
||||
Enter a line to analyze:
|
||||
(EQSTR (CAR LIS1) CAR LIS2))
|
||||
Syntax error: right paren before or without left paren
|
||||
```
|
||||
|
||||
Here's the Rexx program:
|
||||
|
||||
```
|
||||
counter = 0 /* counts parentheses */
|
||||
|
||||
say 'Enter a line to analyze:' /* prompts user for input */
|
||||
pull input_string /* reads line of user input */
|
||||
|
||||
length_of_string = length(input_string)
|
||||
|
||||
/* process each character of the input line, one at a time */
|
||||
|
||||
do j = 1 to length_of_string while counter >= 0
|
||||
|
||||
character = substr(input_string,j,1)
|
||||
if character = '(' then counter = counter + 1
|
||||
if character = ')' then counter = counter - 1
|
||||
|
||||
end
|
||||
|
||||
/* display the appropriate message to the user */
|
||||
|
||||
if counter = 0 then
|
||||
say 'Parentheses are balanced'
|
||||
else if counter < 0 then
|
||||
say 'Syntax error: right paren before or without left paren'
|
||||
else
|
||||
say 'Syntax error: too many left parens, not balanced'
|
||||
```
|
||||
|
||||
First, the program prompts the user to enter a line of input with the `say` instruction. Then it reads it with a `pull` instruction.
|
||||
|
||||
`The say` and `pull` instructions are used for conversational input/output, or direct interaction with users. Rexx also supports character-oriented and line- or record- oriented I/O.
|
||||
|
||||
Next, the script uses the `length` function to place the length of the input line into the variable `length_of_string`.
|
||||
|
||||
The `do` loop processes each character from the input line, one at a time. It increments the `counter` each time it encounters a left parenthesis, and decrements it each time it recognizes a right parenthesis.
|
||||
|
||||
If the `counter` ends up as zero after processing the entire input line, the program knows that any parentheses in the input line match up correctly. If the `counter` is not 0 after processing, the input line has mismatched parentheses.
|
||||
|
||||
The final `if` statements display the proper message to the user. One could code these `if` statements in any number of styles, as per individual preference. (The main requirement is that whenever multiple statements are coded within a branch, they must be enclosed in a `do...end` group.)
|
||||
|
||||
This program shows that Rexx is free-form and case-insensitive. It does not rely on reserved words, so you're free to use common words like `counter` or `character` to represent variables.
|
||||
|
||||
The one key requirement Rexx does impose is that any function must immediately be followed by a left parenthesis. Examples in the program are the `length` and `substr` functions. Put a space between a function name and its following parenthesis, and Rexx won't recognize the function.
|
||||
|
||||
Outside of a few minimal requirements like these, Rexx requires very little from the programmer in terms of syntax, special characters, or restrictive coding rules.
|
||||
|
||||
Rexx programs look and read like pseudo-code. This makes them relatively easy to read and work with.
|
||||
|
||||
### A real-world example of a Rexx script
|
||||
|
||||
Here's a program from the real world:
|
||||
|
||||
Les Koehler, a Rexx user, had a legacy accounting program that matched accounting records on hand against those that a vendor sent to him daily. The legacy program ran for several hours every day to process 25,000 records. It employed a sequential "walk the list" technique to match one set of records against the other.
|
||||
|
||||
Les replaced the legacy program with a Rexx script. The Rexx script performs matching by using associative arrays:
|
||||
|
||||
```
|
||||
/* Create an associative array reflecting */
|
||||
/* the values in the first list of names */
|
||||
/* by Les Koehler */
|
||||
|
||||
flag. = 0 /* Create array, set all items to 0 */
|
||||
do a = 1 to list_a.0 /* Process all existing records */
|
||||
aa = strip(list_a.a) /* Strip preceding/trailing blanks */
|
||||
flag.aa = 1 /* Mark each record with a 1 */
|
||||
end
|
||||
|
||||
/* Try to match names in the second list */
|
||||
/* against those in the associative array */
|
||||
|
||||
m = 0 /* M counts number of missing names */
|
||||
do b = 1 to list_b.0 /* Look for matching name from LIST_B */
|
||||
bb = strip(list_b.b) /* Put LIST_B name into variable BB */
|
||||
if \ flag.bb then do /* If name isn't in FLAG array */
|
||||
m = m+1 /* add 1 to count of missing names */
|
||||
missing.m = bb /* add missing name to MISSING array */
|
||||
end
|
||||
end
|
||||
|
||||
missing.0 = m /* Save the count of unmatched names */
|
||||
```
|
||||
|
||||
Les was able to reduce processing time from several hours down to a matter of seconds.
|
||||
|
||||
The first line of code (`flag. = 0`) creates a new array called `flag` and initializes every element in that array to `0`.
|
||||
|
||||
The array `list_a` contains all the existing accounting records. Its first element (`list_a.0`) by convention contains the number of elements in the array.
|
||||
|
||||
So the first `do` loop processes all elements in the array of existing records (`list_a`) and marks each of them as existing in the `flag` array. The statement `flag.aa = 1` marks the content-addressable item in the `flag` array as present.
|
||||
|
||||
The second `do` loop peddles through each item in the set of new records, contained in the array called `list_b`.
|
||||
|
||||
The `if` statement checks whether an item from the second array of records is marked present in the `flag` array. If not, the program increments the number of items present in the new list of accounting records that do not exist in the old list of records. And it puts the missing item into the `missing` array: `missing.m = bb`.
|
||||
|
||||
The final statement (`missing.0 = m`) simply updates the number of items in the `missing` array, by convention stored in array position 0.
|
||||
|
||||
### Rexx improvements
|
||||
|
||||
Why is this Rexx program so fast compared to the legacy code it replaces? First, the associative arrays allow direct lookup of a new record against the old records. Direct access is much faster than the sequential "walk-the-list" technique it replaced.
|
||||
|
||||
Secondly, all the array elements reside in memory. Once the files of the old and new accounting records have been initialized into the Rexx arrays, no further disk I/O is needed. Disk I/O is always orders of magnitude slower than memory access.
|
||||
|
||||
A Rexx array expands as much as memory allows. This script takes advantage of modern computers with seemingly endless amounts of RAM, and frees the programmer from managing memory.
|
||||
|
||||
### Conclusion
|
||||
|
||||
I hope these two simple programs have shown how easy Rexx is to read, write, and maintain. Rexx is designed to put the burden of programming on the machine instead of the programmer. Yet the language still has plenty of power, due to the design techniques I've described in this series of articles.
|
||||
|
||||
For free Rexx downloads, tools, tutorials, and more, visit [RexxInfo.org][3]. You can join the [Rexx Language Association][4] for free.
|
||||
|
||||
_This article is dedicated to the memory of Les Koehler, who was active with Rexx and the Rexx community since their very earliest days._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/rexx-scripting
|
||||
|
||||
作者:[Howard Fosdick][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/howtech
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/22/10/rexx-scripting-language
|
||||
[2]: https://opensource.com/article/21/5/learn-lisp
|
||||
[3]: http://www.RexxInfo.org
|
||||
[4]: http://www.RexxLA.org
|
@ -0,0 +1,260 @@
|
||||
[#]: subject: "How I use my old camera as a webcam with Linux"
|
||||
[#]: via: "https://opensource.com/article/22/12/old-camera-webcam-linux"
|
||||
[#]: author: "Tom Oliver https://opensource.com/users/tomoliver"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How I use my old camera as a webcam with Linux
|
||||
======
|
||||
|
||||
This year after largely abandoning my MacBook in favor of a NixOS machine, I started getting requests to "turn my camera on" when video calling people. This was a problem because I didn't have a webcam. I thought about buying one, but then I realized I had a perfectly good Canon EOS Rebel XS DSLR from 2008 lying around on my shelf. This camera has a mini-USB port, so naturally, I pondered: Did a DSLR, mini-USB port, and a desktop PC mean I could have a webcam?
|
||||
|
||||
There's just one problem. My Canon EOS Rebel XS isn't capable of recording video. It can take some nice pictures, but that's about it. So that's the end of that.
|
||||
|
||||
Or is it?
|
||||
|
||||
There happens to be some amazing open source software called [gphoto2][1]. Once installed, it allows you to control various supported cameras from your computer and it takes photos and videos.
|
||||
|
||||
### Supported cameras
|
||||
|
||||
First, find out whether yours is supported:
|
||||
|
||||
```
|
||||
$ gphoto2 --list-cameras
|
||||
```
|
||||
|
||||
### Capture an image
|
||||
|
||||
You can take a picture with it:
|
||||
|
||||
```
|
||||
$ gphoto2 --capture-image-and-download
|
||||
```
|
||||
|
||||
The shutter activates, and the image is saved to your current working directory.
|
||||
|
||||
### Capture video
|
||||
|
||||
I sensed the potential here, so despite the aforementioned lack of video functionality on my camera, I decided to try `gphoto2 --capture-movie`. Somehow, although my camera does not support video natively, gphoto2 still manages to spit out an MJPEG file!
|
||||
|
||||
On my camera, I need to put it in "live-view" mode before gphoto2 records video. This consists of setting the camera to portrait mode and then pressing the **Set** button so that the viewfinder is off and the camera screen displays an image. Unfortunately, though, this isn't enough to be able to use it as a webcam. It still needs to get assigned a video device, such as `/dev/video0`.
|
||||
|
||||
### Install ffmpeg and v4l2loopback
|
||||
|
||||
Not surprisingly, there's an open source solution to this problem. First, use your package manager to install `gphoto2`, `ffmpeg`, and `mpv`. For example, on Fedora, CentOS, Mageia, and similar:
|
||||
|
||||
```
|
||||
$ sudo dnf install gphoto2 ffmpeg mpv
|
||||
```
|
||||
|
||||
On Debian, Linux Mint, and similar:
|
||||
|
||||
```
|
||||
$ sudo apt install gphoto2 ffmpeg mpv
|
||||
```
|
||||
|
||||
I use NixOS, so here's my configuration:
|
||||
|
||||
```
|
||||
# configuration.nix
|
||||
...
|
||||
environment.systemPackages = with pkgs; [
|
||||
ffmpeg
|
||||
gphoto2
|
||||
mpv
|
||||
...
|
||||
```
|
||||
|
||||
Creating a virtual video device requires the `v4l2loopback` Linux kernel module. At the time of this writing, that capability is not included in the mainline kernel, so you must download and compile it yourself:
|
||||
|
||||
```
|
||||
$ git clone https://github.com/umlaeute/v4l2loopback
|
||||
$ cd v4l2loopback
|
||||
$ make
|
||||
$ sudo make install
|
||||
$ sudo depmod -a
|
||||
```
|
||||
|
||||
If you're using NixOS like me, you can just add the extra module package in `configuration.nix`:
|
||||
|
||||
```
|
||||
[...]
|
||||
boot.extraModulePackages = with config.boot.kernelPackages;
|
||||
[ v4l2loopback.out ];
|
||||
boot.kernelModules = [
|
||||
"v4l2loopback"
|
||||
];
|
||||
boot.extraModprobeConfig = ''
|
||||
options v4l2loopback exclusive_caps=1 card_label="Virtual Camera"
|
||||
'';
|
||||
[...]
|
||||
```
|
||||
|
||||
On NixOS, run `sudo nixos-rebuild switch` and then reboot.
|
||||
|
||||
### Create a video device
|
||||
|
||||
Assuming your computer currently has no `/dev/video` device, you can create one on demand thanks to the `v4l2loopback`.
|
||||
|
||||
Run this command to send data from `gphoto2` to `ffmpeg`, using a device such as `/dev/video0` device:
|
||||
|
||||
```
|
||||
$ gphoto2 --stdout --capture-movie |
|
||||
ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -f v4l2 /dev/video0
|
||||
```
|
||||
|
||||
You get output like this:
|
||||
|
||||
```
|
||||
ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
|
||||
built with gcc 11.3.0 (GCC)
|
||||
configuration: --disable-static ...
|
||||
libavutil 56. 70.100 / 56. 70.100
|
||||
libavcodec 58.134.100 / 58.134.100
|
||||
libavformat 58. 76.100 / 58. 76.100
|
||||
libavdevice 58. 13.100 / 58. 13.100
|
||||
libavfilter 7.110.100 / 7.110.100
|
||||
libavresample 4. 0. 0 / 4. 0. 0
|
||||
libswscale 5. 9.100 / 5. 9.100
|
||||
libswresample 3. 9.100 / 3. 9.100
|
||||
libpostproc 55. 9.100 / 55. 9.100
|
||||
Capturing preview frames as movie to 'stdout'. Press Ctrl-C to abort.[mjpeg @ 0x1dd0380] Format mjpeg detected only with low score of 25, misdetection possible!
|
||||
Input #0, mjpeg, from 'pipe:':
|
||||
Duration: N/A, bitrate: N/A
|
||||
Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 768x512 ...
|
||||
Stream mapping:
|
||||
Stream #0:0 -> #0:0 (mjpeg (native) -> rawvideo (native))[swscaler @ 0x1e27340] deprecated pixel format used, make sure you did set range correctly
|
||||
Output #0, video4linux2,v4l2, to '/dev/video0':
|
||||
Metadata:
|
||||
encoder : Lavf58.76.100
|
||||
Stream #0:0: Video: rawvideo (I420 / 0x30323449) ...
|
||||
Metadata:
|
||||
encoder : Lavc58.134.100 rawvideoframe= 289 fps= 23 q=-0.0 size=N/A time=00:00:11.56 bitrate=N/A speed=0.907x
|
||||
```
|
||||
|
||||
To see the video feed from your webcam, use `mpv`:
|
||||
|
||||
```
|
||||
$ mpv av://v4l2:/dev/video0 --profile=low-latency --untimed
|
||||
```
|
||||
|
||||
![Streaming a live feed from the webcam][2]
|
||||
|
||||
### Start your webcam automatically
|
||||
|
||||
It's a bit annoying to execute a command every time you want to use your webcam. Luckily, you can run this command automatically at startup. I implement it as a `systemd` service:
|
||||
|
||||
```
|
||||
# configuration.nix
|
||||
...
|
||||
systemd.services.webcam = {
|
||||
enable = true;
|
||||
script = ''
|
||||
${pkgs.gphoto2}/bin/gphoto2 --stdout --capture-movie |
|
||||
${pkgs.ffmpeg}/bin/ffmpeg -i - \
|
||||
-vcodec rawvideo -pix_fmt yuv420p -f v4l2 /dev/video0
|
||||
'';
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
...
|
||||
```
|
||||
|
||||
On NixOS, run `sudo nixos-rebuild switch` and then reboot your computer. Your webcam is on and active.
|
||||
|
||||
To check for any problems, you can use `systemctl status webcam`. This tells you the last time the service was run and provides a log of its previous output. It's useful for debugging.
|
||||
|
||||
### Iterating to make it better
|
||||
|
||||
It's tempting to stop here. However, considering the current global crises, it may be pertinent to wonder whether it's necessary to have a webcam on all the time. It strikes me as sub-optimal for two reasons:
|
||||
|
||||
- It's a waste of electricity.
|
||||
- There are privacy concerns associated with this kind of thing.
|
||||
|
||||
My camera has a lens cap, so to be honest, the second point doesn't really bother me. I can always put the lens cap on when I'm not using the webcam. However, leaving a big power-hungry DSLR camera on all day (not to mention the CPU overhead required for decoding the video) isn't doing anything for my electricity bill.
|
||||
|
||||
The ideal scenario:
|
||||
|
||||
- I leave my camera plugged in to my computer all the time but switched off.
|
||||
- When I want to use the webcam, I switch on the camera with its power button.
|
||||
- My computer detects the camera and starts the systemd service.
|
||||
- After finishing with the webcam, I switch it off again.
|
||||
|
||||
To achieve this, you need to use a custom [udev rule][3].
|
||||
|
||||
A udev rule tells your computer to perform a certain task when it discovers that a device has become available. This could be an external hard drive or even a non-USB device. In this case, you need it to [recognize the camera through its USB connection][4].
|
||||
|
||||
First, specify what command to run when the udev rule is triggered. You can do that as a shell script (`systemctl restart webcam` should work). I run NixOS, so I just create a derivation (a Nix package) that restarts the systemd service:
|
||||
|
||||
```
|
||||
# start-webcam.nix
|
||||
with import <nixpkgs> { };
|
||||
writeShellScriptBin "start-webcam" ''
|
||||
systemctl restart webcam
|
||||
# debugging example
|
||||
# echo "hello" &> /home/tom/myfile.txt
|
||||
# If myfile.txt gets created then we know the udev rule has triggered properly''
|
||||
```
|
||||
|
||||
Next, actually define the udev rule. Find the device and vendor ID of the camera. Do this by using the `lsusb` command. That command is likely already installed on your distribution, but I don't use it often, so I just install it as needed using `nix-shell`:
|
||||
|
||||
```
|
||||
$ nix-shell -p usbutils
|
||||
```
|
||||
|
||||
Whether you already have it on your computer or you've just installed it, run `lsusb`:
|
||||
|
||||
```
|
||||
$ lsusb
|
||||
Bus 002 Device 008: ID 04a9:317b Canon, Inc. Canon Digital Camera[...]
|
||||
```
|
||||
|
||||
In this output, the vendor ID is 04a9 and the device ID is 317b. That's enough to create the udev rule:
|
||||
|
||||
```
|
||||
ACTION=="add", SUBSYSTEM=="usb",
|
||||
ATTR{idVendor}=="04a9",
|
||||
ATTR{idProduct}=="317b",
|
||||
RUN+="/usr/local/bin/start-webcam.sh"
|
||||
```
|
||||
|
||||
Alternatively, if you're using NixOS:
|
||||
|
||||
```
|
||||
# configuration.nix[...]let
|
||||
startWebcam = import ./start-webcam.nix;[...]
|
||||
services.udev.extraRules = ''
|
||||
ACTION=="add", \
|
||||
SUBSYSTEM=="usb", \
|
||||
ATTR{idVendor}=="04a9", \
|
||||
ATTR{idProduct}=="317b", \
|
||||
RUN+="${startWebcam}/bin/start-webcam"'';[...]
|
||||
```
|
||||
|
||||
Finally, remove the **wantedBy = ["multi-user.target"];** line in your `start-webcam` systemd service. (If you leave it, then the service starts automatically when you next reboot, whether the camera is switched on or not.)
|
||||
|
||||
### Reuse old technology
|
||||
|
||||
I hope this article has made you think twice before chucking some of your old tech. Linux can breathe life back into technology, whether it's your [computer][5] or something simple like a digital camera or some other peripheral.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/old-camera-webcam-linux
|
||||
|
||||
作者:[Tom Oliver][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/tomoliver
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/20/7/gphoto2-linux
|
||||
[2]: https://opensource.com/sites/default/files/2022-12/streaming-webcam.png
|
||||
[3]: https://opensource.com/article/18/11/udev
|
||||
[4]: https://opensource.com/article/22/1/cameras-usb-ports-obs
|
||||
[5]: https://opensource.com/article/22/4/how-linux-saves-earth
|
||||
|
@ -0,0 +1,93 @@
|
||||
[#]: subject: "Discover the power of the Linux SpaceFM file manager"
|
||||
[#]: via: "https://opensource.com/article/22/12/linux-file-manager-spacefm"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Discover the power of the Linux SpaceFM file manager
|
||||
======
|
||||
|
||||
SpaceFM is a tabbed file manager for Linux using the GTK toolkit, so it fits right in on desktops like [GNOME][1], [Mate][2], [Cinnamon][3], and others. SpaceFM also features a built-in device manager system, so it's particularly good for window managers, like [Fluxbox][4] or [fvwm][5], which typically don't include a graphical device manager. If you're happy with the file managers on Linux, but you want to try one that's a little bit different in design, SpaceFM is worth a look.
|
||||
|
||||
### Install SpaceFM
|
||||
|
||||
On Linux, you're likely to find **SpaceFM** in your distribution's software repository. On Fedora, Mageia, OpenMandriva, and similar:
|
||||
|
||||
```
|
||||
$ sudo dnf install spacefm
|
||||
```
|
||||
|
||||
On Debian and Debian-based systems:
|
||||
|
||||
```
|
||||
$ sudo apt install spacefm
|
||||
```
|
||||
|
||||
### Panels
|
||||
|
||||
I don't know why SpaceFM is called SpaceFM, but it could be because it makes a concerted effort to let you use every bit of space in its window for something useful. By default, SpaceFM is actually pretty simple, standard-issue file manager. It has a single panel listing your files, a toolbar, and a menu bar.
|
||||
|
||||
![SpaceFM is typical in design. At first.][6]
|
||||
|
||||
All the "usual" rules apply.
|
||||
|
||||
- **Double-click** to open a directory or to open a file in its default application.
|
||||
- **Right-click** for a contextual menu providing lots of standard options (copy, paste, rename, view properties, create a new folder, and so on).
|
||||
|
||||
The way SpaceFM sets itself apart, though, is its panel system. SpaceFM displays one panel by default. That's the big file window listing your files. But it can have up to four panel views, plus a few bonus panels for some specific tasks.
|
||||
|
||||
### Opening a new panel
|
||||
|
||||
Instead of seeing one directory in your file manager, you can see two. To bring up another directory in its own pane, press **Ctrl+2** or go to the **View** menu and select **Panel 2**. Alternatively, click the second green dot icon from the left in the menu panel.
|
||||
|
||||
With two panels, you can move files from one directory to another without opening a new file manager window, or you can browse two directories to compare their contents.
|
||||
|
||||
But why settle for two panels? Maybe you'd rather see _three_ directories at once. To bring up a third directory in a dedicated pane, press **Ctrl+3** or go to the **View** menu and select **Panel 3**. Alternatively, click the third green dot icon from the left in the menu panel. This panel appears at the bottom of the SpaceFM window.
|
||||
|
||||
With three panels open, you can move files between several directories, or sort files from a common "dumping ground" (like your Desktop or Downloads folder) into specific directories.
|
||||
|
||||
Of course, once you've tried three panels you'll probably find yourself itching for a fourth. To open a fourth directory in its own pane, press **Ctrl+4** or go to the **View** menu and select **Panel 4**. Alternatively, click the fourth green dot icon from the left in the menu panel. This one opens next to Panel 3, splitting your SpaceFM window into even quarters.
|
||||
|
||||
![SpaceFM can have up to four panels.][7]
|
||||
|
||||
What about a _fifth_ panel? Well, actually SpaceFM stops at four panels. If you really do want a fifth panel, you have to open a new SpaceFM window. However, there are still more panels, used for information other than file listings, to explore.
|
||||
|
||||
### Special panels
|
||||
|
||||
The **View** menu reveals that in addition to file panels, there are additionally task-specific panels you can choose to display. This includes:
|
||||
|
||||
- **Task manager**: Lists ongoing file manager processes. This isn't a general-purpose task manager, so to set nice values or detect a zombie apocalypse of undead PIDs, [htop or top][8] is still your utility of choice.
|
||||
- **Bookmarks**: Links to common folders, such as Desktop, Documents, Downloads, and any location you want to keep handy.
|
||||
- **Devices**: USB thumb drives and remote file systems.
|
||||
- **File tree**: A view of your file system in order of directory inheritance.
|
||||
|
||||
These panels open on the left side of SpaceFM, but they do stack. You can have bookmarks, devices, tasks, and a file tree open at once, although it helps to have a very tall SpaceFM window.
|
||||
|
||||
### Make space for SpaceFM
|
||||
|
||||
SpaceFM is a configurable multi-tasking file manager. It maximizes the information you can build into a single window, and it lets you decide what's important, and when. This article has focused on the panels of SpaceFM because those are, at least in my view, the most unique aspect of the application. However, there's a lot more to SpaceFM, including plugins, preferences, a design mode, keyboard shortcuts, and customization. This isn't a small application, even though it is a lightweight one. Spend some time with SpaceFM, because you never know what you'll discover.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/linux-file-manager-spacefm
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/19/12/gnome-linux-desktop
|
||||
[2]: https://opensource.com/article/19/12/mate-linux-desktop
|
||||
[3]: https://opensource.com/article/19/12/cinnamon-linux-desktop
|
||||
[4]: https://opensource.com/article/19/12/fluxbox-linux-desktop
|
||||
[5]: https://opensource.com/article/19/12/fvwm-linux-desktop
|
||||
[6]: https://opensource.com/sites/default/files/2022-10/spacefm.webp
|
||||
[7]: https://opensource.com/sites/default/files/2022-10/spacefm-panels.webp
|
||||
[8]: https://opensource.com/life/16/2/open-source-tools-system-monitoring
|
@ -0,0 +1,97 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (CanYellow)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How open principles will impact the future of work)
|
||||
[#]: via: (https://opensource.com/open-organization/21/1/open-is-future-of-work)
|
||||
[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland)
|
||||
|
||||
开放原则将如何影响未来工作
|
||||
======
|
||||
我们的工作性质在很多方面塑造了我们自己。未来工作的性质将发生巨大变化,我们又该做何准备呢?
|
||||
|
||||
![团队合作,忙碌的工作生活][1]
|
||||
|
||||
如果我们将“工作”定位为获得某种回报的任何形式的付出,那么工作是并且一直是决定我们是谁的主要因素之一。工作是我们生活的一个重要方面。在工作中(不论这对我们意味着什么),我们结识朋友,我们获得智力激励和情感满足的源泉,我们得到成长,我们感受自身无穷的创造性。对于我们的家人、朋友、社区和社会而言,工作极其重要,我们不应轻视工作的重要性亦或视其为理所当然。
|
||||
|
||||
因此如果未来[工作的性质将发生变化][2],这可能意味着恰恰是我们 _自我认知_ 中的某些关键要素将发生变化。我们应该认真准备应对这些转变。
|
||||
|
||||
考察自第一次工业革命(18、19世纪)以来的工作转变,很多人从从事农业劳动转为进入城市工厂工作,这从根本上改变了他们的生活方式。新的工作方式需要全新的更专业的工作技能而不再是农村经济中常见的手艺。接下来的几十年里,当我们检视我们的个人工作环境时,我们可能会发现工业时代以来的这一趋势可能发生逆转:从层级制度、可代替的通用技术与活动重新转变为横向协作与对专业知识的熟练掌握的更高要求(回到手工艺时代)。
|
||||
|
||||
这个时代与这些转变的到来将是全球性的而非区域性的,转变的速度已经大大加快了。
|
||||
|
||||
在这一新的工作环境中,[开放组织原则][3]将扮演关键性的角色。
|
||||
|
||||
本系列中,我将回顾 [Lynda Gratton 教授的作品,_转变_][4] (中译本:转变:未来社会工作岗位需求变化及应对策略,ISBN:9787121152894),本书成书于2014年(译注,本书原版有 [2011版][T1] 与 [2014版][T2] ),书中数据于2010年收集,但今天仍然适用(将来也一样)。本书中,Gratton教授指出了工作将在2025到2050年间如何变化。这是关键信息,因为它有助于我们在准备和发展我们的职业生涯时作出正确的选择。
|
||||
|
||||
Gratton教授阐释了在上述时间段内影响未来工作的主要因素。本系列中,我们将对它们做一个总结并解释开放组织原则如何融入它们之中。
|
||||
|
||||
|
||||
### 影响未来工作的五个因素
|
||||
|
||||
煤碳与蒸汽动力的发明推动了第一次工业革命。[Gratton教授][5]说,今天五种微妙的力量导致了类似的转变:
|
||||
|
||||
1. 日益增长的全球化活动
|
||||
2. 技术的快速进步
|
||||
3. 人类寿命与人口数量
|
||||
4. 社会与家庭结构变化
|
||||
5. 低碳经济的需求
|
||||
|
||||
简而言之,计算机更快了,材料更强了,药物能治疗更多的疾病使得人类的寿命更长。这些都在不同程度上影响了我们未来的工作方式。以下针对上述每一点的一些笔记。
|
||||
|
||||
#### 1\. 全球化
|
||||
|
||||
|
||||
在以前的文章 [《全球化:开放的历史》][6] 中,我讨论了全球化的多种动力与影响因素,其中之一就是贸易。从1950年到2010年的60年间,全球贸易的体量增加了60倍,与此同时运输成本降低了,发展中国家不仅看到了贸易增长,而且看到了新的创新。我还在我的另一篇文章 [《历史变迁中的开放组织》][7]中讨论了历史早期的全球化。我另外在我的文章[《全球性的开放组织是怎么样的》][8]中探讨了从现在到未来全球治理的重要性。如Gratton教授所言,全球化在未来工作中将发挥不可否认与不可避免的影响。
|
||||
|
||||
如果未来工作的性质将发生变化,这可能意味着恰恰是我们自我认知中的某些关键要素将发生变化。我们应该认真准备应对这些转变。
|
||||
|
||||
#### 2\. 技术
|
||||
|
||||
计算成本一直在以惊人的速度下降,它还将继续下降。这有助于连接到目前为止仍然大部分被隔离在更大的全球经济之外的数十亿人。他们将开始进入劳动力市场并成为更有影响力的消费者。与此同时,计算机与高级自动化在未来将[取代人类工作][9],这都将影响未来的工作转变。
|
||||
|
||||
#### 3\.人口数量与寿命
|
||||
|
||||
Gratton教授还记录了不同世代的人对未来工作的影响,尤其是在美国。年轻一代在未来将扮演主要角色,他们的态度将不同于上一代。此外,全球不同地区的出生率将影响经济繁荣。由于一些地区的人口降低而另一些的将会增加,将会出现更多的移民。他们将移民至Gratton教授谓之“创新集群”的地方。最后,Gratton教授认为全球预期寿命将会变化。截至2025年,世界人口的10%都将超过65岁,这些人口将更可能希望继续工作,为了得到持续的收入、精神刺激、身体活动,与他人的联系以及生活的意义与目的的源泉。考虑到今天的很多儿童都更可能拥有超过100岁的寿命,如果他们在65岁退休,他们余下的至少35年里将做不了太多事情。基于这样的考虑,在未来职业道路的多次转换以及在社区与志愿服务项目中的积极参与将会大大拓展。
|
||||
|
||||
#### 4\. 社会
|
||||
|
||||
常规的变化之外,Gratton教授还描述了一些社会变化。她说,未来女性在工作上的角色将会变化,人们将比以往拥有更多的选择来塑造他们希望的生活;随着个人劳动生产率的提升,平均空闲时间将比以往更多。
|
||||
|
||||
#### 5\. 能源
|
||||
|
||||
我在[资源工业革命][10]上的一篇演讲中讨论了资源节约型工业的扩张。格拉特教授为该对话补充一些有价值的观点。她认为气候变化将逐渐成为主要议题,并导致运输与消费的降低。尤其是世界范围内的水资源供给将无法跟上用水需求。海水淡化项目将大幅扩张(可能由正在开发的[第四代][11]分布式小型模块化核电站提供动力)。环境灾难将使人们背井离乡,并在世界范围内形成移民社区。更多能效高的生活方式将会被发现和引入,这将影响未来工作。
|
||||
|
||||
|
||||
### 为未来提前准备
|
||||
|
||||
上述五种力量将推动未来工作方式发生根本性的改变,Gratton教授认为我们现在就需要开始为这样的未来提前做准备。本系列的下一篇文章中,我将介绍Gratton教授对未来的展望以及应对快速变化的未来的一些情境。个人如何将这些变化视作职业机会?另一方面,如果简单地选择对即将到来的变化 _视而不见_ 又会发生什么?我将回顾Gratton教授在这些问题上的思考。同样的,我也将解释开放原则如何形成必经的变革的核心。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/open-organization/21/1/open-is-future-of-work
|
||||
|
||||
作者:[Ron McFarland][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[CanYellow](https://github.com/CanYellow)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/ron-mcfarland
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team_dev_email_chat_video_work_wfm_desk_520.png?itok=6YtME4Hj (Working on a team, busy worklife)
|
||||
[2]: https://opensource.com/open-organization/18/7/transformation-beyond-digital-2
|
||||
[3]: https://theopenorganization.org/definition/
|
||||
[4]: http://lyndagratton.com/books/the-shift/
|
||||
[5]: https://en.wikipedia.org/wiki/Lynda_Gratton
|
||||
[6]: https://opensource.com/open-organization/20/7/globalization-history-open
|
||||
[7]: https://opensource.com/open-organization/20/8/global-history-collaboration
|
||||
[8]: https://opensource.com/open-organization/20/9/global-open-organization
|
||||
[9]: https://opensource.com/open-organization/19/9/claiming-human-age-of-AI
|
||||
[10]: https://www.slideshare.net/RonMcFarland1/the-starting-of-the-third-industrial-revolution
|
||||
[11]: https://en.wikipedia.org/wiki/Generation_IV_reactor
|
||||
|
||||
[T1]: https://isbnsearch.org/isbn/9780007427956
|
||||
[T2]: https://isbnsearch.org/isbn/9780007525850
|
@ -1,92 +0,0 @@
|
||||
[#]: subject: "A DevOps guide to documentation"
|
||||
[#]: via: "https://opensource.com/article/21/3/devops-documentation"
|
||||
[#]: author: "Will Kelly https://opensource.com/users/willkelly"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "Veryzzj"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
文档写作的 DevOps 指南
|
||||
======
|
||||
|
||||
将文档写作加入到 DevOps 的生命周期中
|
||||
![Typewriter with hands][1]
|
||||
|
||||
DevOps 正在挑战技术文档的规范,这在IT历史上是前所未有的。从自动化到提高交付速度,再到拆除瀑布式软件开发生命周期模型,这意味着业务和技术文档的理念需要做出巨大改变。
|
||||
|
||||
以下是DevOps对技术文档不同方面的影响。
|
||||
|
||||
### 技术作家的角色变化
|
||||
|
||||
技术作家必须适应 DevOps。好消息是,许多技术作家已经加入到开发团队中,并且由于拥有合作关系和不断增长的产品知识,这些技术作家很具优势。
|
||||
|
||||
但是如果一个技术作家习惯独立工作,并依赖于领域专家的草稿作为文档的基础,那么就需要做一些调整。
|
||||
|
||||
进行一些投资以确保文档和其他与项目有关的开发工作获得所需的工具、结构和支持。 从改变[技术作家聘用习惯][2]开始。以[DevOps 的速度][3]编写文档需要重新思考内容规划,并打破DevOps 团队和支持项目的技术作家之间长期存在的隔阂。
|
||||
|
||||
DevOps 使开发团队摆脱了传统文档实践的束缚。首先,文档[完成的定义][4]必须改变。一些企业的文化使技术作家成为软件开发的被动参与者。DevOps提出了新的要求--随着 DevOps 文化的转变,技术作家的角色也应发生变化。技术作家需要(且必须适应)DevOps 提供的透明度。他们必须融入 DevOps 团队。取决于组织如何塑造这个角色,将技术作家带入团队可能会带来技能上的挑战。
|
||||
|
||||
### 文档标准、方法和规格
|
||||
|
||||
虽然 DevOps 还没有影响到技术文档本身,但开源社区已经加强了对应用编程接口(API)文档的帮助质保,已经有不同规模的企业的 DevOps 团队正在使用这些文档。
|
||||
|
||||
用于记录 API 的开源规范和工具是个非常值得关注的领域。我想这是由于[谷歌文档季][5]的影响,使得一些专业的技术作家能够接触到开源项目,并解决最关键的文档类项目。
|
||||
|
||||
开源 API 属于 DevOps文档讨论。云原生应用集成需求的重要性正在上升。[OpenAPI 规范][6]--一个定义和记录API的开放标准--是在 DevOps 环境下 API 文档的良好资源。然而,该规范会导致文档的创建和更新过程变得很费时,这使其饱受批评。
|
||||
|
||||
曾经也有短暂尝试过创建[持续文档][7],并且还有一个来自 CA(现在的Broadcom)的创建[DocOps][8]框架的运动。然而,DocOps 从来没有作为一个行业运动流行起来。
|
||||
|
||||
DevOps 文档标准的现状意味着 DevOps 团队(包括技术作家)需要在项目的最初阶段开始创建文档。要做到这一点,需要把文档作为一个敏捷故事和(同样重要的)管理期望来添加,并且把它与年度绩效评估放在一起执行。
|
||||
|
||||
### Documentation tools 文档工具
|
||||
|
||||
文档的编写应该以一种所有团队成员都可以使用的格式或平台在线进行。MediaWiki、DokuWiki、TikiWiki和其他[开源维基][9]为 DevOps 团队提供了一个编写和维护文档的中央仓库。
|
||||
|
||||
让团队选择他们的 wiki,就像让他们选择他们的其他持续集成/持续开发(CI/CD)工具链一样。开源维基强大之处在于其可扩展性。例如,DokuWiki包括一系列的扩展,你可以通过安装这些扩展来创建一个符合你的 DevOps 团队的创作要求的平台。
|
||||
|
||||
如果你有足够的野心来加强你的团队的编写和协作能力,[Nextcloud][10](一个开源的云协作套件)是一个让你的 DevOps 团队上网并给他们提供编写文档所需工具的选择。
|
||||
|
||||
### DevOps 最佳实践
|
||||
|
||||
文档在 DevOps 转型中也发挥着作用。例如,组织从 DevOps 实现效率和流程增益的最佳实践的相关记录,这些信息太重要了,不能靠着 DevOps团中之间口口相传。如果你所在的组织有多个 DevOps 团队,那么文档就是统一的力量,它可以促进最佳实践的标准化,并设置了衡量代码质量的基准指标。。
|
||||
|
||||
一般情况下,开发人员承担了记录 DevOps 实践的工作。即使他们的组织有技术作家,他们也可能跨开发团队工作。因此,开发人员和系统管理员能够捕捉、记录和交流他们的最佳实践是很重要的。这里有一些朝正确的方向发展的提示:
|
||||
|
||||
* 提前花时间为 DevOps 最佳实践创建标准模板。不要陷入复制在线模板,采访利益相关者和团队来创建一个符合团队需求的模板。
|
||||
* 寻找一些方法进行信息收集,例如记录团队会议和使用聊天系统日志来作为文档的基础。
|
||||
* 建立一个用于发布最佳实践的 wiki。使用 wiki 可以跟踪编辑和更新。这样的平台可以帮助团队在最佳实践发生变化时进行更新和维护。
|
||||
|
||||
当在构建 CI/CD 工具链时记录依赖关系是非常明智的。尤其是当加入新的团队成员时,你会发现这些记录非常有用,另外当团队成员忘记一些事情时,这也是一种保险。
|
||||
|
||||
最后,自动化对 DevOps 利益相关者和从业者都很有吸引力。在自动化中断之前,一切都很有趣。拥有自动化运行手册、管理指南和其他内容的文档(并且是最新的)意味着无论何时发生故障,员工都可以让自动化重新工作。
|
||||
|
||||
### 最后一些想法
|
||||
|
||||
DevOps 对于技术文档来说是一个积极的因素。它将内容开发纳入DevOps生命周期,并打破组织文化中开发人员和技术作者之间的隔阂。没有技术作家的优势,团队就可以使用工具来加快文档创作的速度,以与DevOps的速度相匹配。
|
||||
|
||||
您的组织将如何把文档加入到 DevOps 生命周期?请在评论区分享您的经验。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/3/devops-documentation
|
||||
|
||||
作者:[Will Kelly][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[Veryzzj](https://github.com/Veryzzj)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/willkelly
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/typewriter-hands.jpg?itok=oPugBzgv "Typewriter with hands"
|
||||
[2]: https://opensource.com/article/19/11/hiring-technical-writers-devops
|
||||
[3]: https://searchitoperations.techtarget.com/opinion/Make-DevOps-documentation-an-integral-part-of-your-strategy?_ga=2.73253915.980148481.1610758264-908287796.1564772842
|
||||
[4]: https://www.agilealliance.org/glossary/definition-of-done
|
||||
[5]: https://developers.google.com/season-of-docs
|
||||
[6]: https://swagger.io/specification/
|
||||
[7]: https://devops.com/continuous-documentation
|
||||
[8]: https://www.cmswire.com/cms/information-management/the-importance-of-docops-in-the-new-era-of-business-027489.php
|
||||
[9]: https://opensource.com/article/20/7/sharepoint-alternative
|
||||
[10]: https://opensource.com/article/20/7/nextcloud
|
@ -1,151 +0,0 @@
|
||||
[#]: subject: "Linux su vs sudo: what's the difference?"
|
||||
[#]: via: "https://opensource.com/article/22/6/linux-su-vs-sudo-sysadmin"
|
||||
[#]: author: "David Both https://opensource.com/users/dboth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "chai001125"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Linux 中的 `su` 和 `sudo` 命令有什么区别呢?
|
||||
======
|
||||
|
||||
>本文将比较 <ruby>非 root 用户<rt> non-root user </rt></ruby> 提权为 root 用户的两个 **Linux 命令** 的区别。
|
||||
|
||||
![bash logo on green background][1]
|
||||
|
||||
`su` 和 `sudo` 命令都允许用户执行非特权用户不允许做的系统管理任务,即只有 root 用户能执行的命令。有些人更喜欢 `sudo` 命令:例如 [Seth Kenlon][2] 最近发布的一篇 [《在 Linux 上使用 `sudo` 的 5 个理由》][3],他在其中详细阐述了 `sudo` 命令的许多优点。
|
||||
|
||||
但是,相较于 `sudo` 命令,我**更偏好于 `su` 命令**,来做系统管理工作。在本文中,我比较了这两个命令的区别,并解释了为什么我更喜欢 `su` 而不是 `sudo`,但我仍然同时使用这两个命令的原因。
|
||||
|
||||
### 过去的系统管理员主要使用 `su` 命令
|
||||
|
||||
`su` 和 `sudo` 命令是为**不同的世界**设计的。早期的 Unix 计算机需要全职系统管理员,他们使用 root 用户作为唯一的管理帐户。在这个古老的世界里,有管理员密码的人会在电传打字机或 CRT 终端(例如 DEC VT100)上以 root 用户登录,然后执行一些管理 Unix 计算机的工作。
|
||||
|
||||
root 用户还有一个非 root 帐户,用于执行一些非 root 的任务,例如编写文档和管理电子邮件等。在这些 Unix 计算机上通常有许多非 root 帐户,他们都不需要完全的 root 访问权限,只需要以 root 权限运行很少的命令,大约 1 至 2 个就可以了。许多系统管理员以 root 用户登录,完成 root 工作,并在任务完成后,退出 root 会话。系统管理员需要整天以 root 用户来登录,因为 `sudo` 命令需要键入更多的内容才能运行基本命令,因此大多数系统管理员很少使用 `sudo` 命令。
|
||||
|
||||
`sudo` 和 `su` 这两个命令都能够提权为 root 用户,但它们实现的方式大不相同。这种差异是由于它们**最初打算用于不同的情况**。
|
||||
|
||||
### `sudo` 命令
|
||||
|
||||
`sudo` 命令的初衷是让 root 用户能够将他们定期需要的 1 到 2 个特权命令委托给 1 至 2 个非 root 用户。`sudo` 命令允许非 root 用户暂时地获得更高权限,来执行一些特权命令,例如添加和删除用户、删除属于其他用户的文件、安装新软件以及管理现代 Linux 主机所需的任何命令。
|
||||
|
||||
`sudo` 命令允许非 root 用户访问 1 到 2 个 _需要更高权限_ 的常用命令,这样可以帮助系统管理员节省来自用户的许多请求,并减少等待时间。`sudo` 命令不会将用户帐户切换为 root 用户,因为大多数非 root 用户永远不应该拥有完全的 root 访问权限。在大多数情况下,`sudo` 允许用户执行 1 或 2 个命令,然后提权就会过期。在这个通常为 5 分钟的短暂的提权时间内,用户可以执行任何需要提权的管理命令。需要继续使用提权的用户可以运行 `sudo -v` 命令来重新验证 root 访问权限,并将提权时间再延长 5 分钟。
|
||||
|
||||
使用 `sudo` 命令还有一些副作用,例如生成非 root 用户使用命令的日志条目及其 ID。这些日志可以在之后作为出现问题的检验,来给用户更多的操作培训。你以为我会说“责备”用户,对吗?
|
||||
|
||||
### `su` 命令
|
||||
|
||||
`su` 命令能够将非 root 用户提权到 root 权限——事实上,能让非 root 用户成为 root 用户。唯一的要求是用户知道根密码。因为用户已经以 root 权限登录,所以之后的操作就没有限制了。
|
||||
|
||||
`su` 命令所提供的提权没有时间限制。用户可以作为 root 执行命令,不需要进行重新认证是否有 root 权限。完成任务后,用户可以执行退出命令 `exit`,从 root 用户恢复到自己原来的非 root 帐户。
|
||||
|
||||
### `su` 和 `sudo` 在使用上的争议和变化
|
||||
|
||||
最近在 `su` 与 `sudo` 的使用上存在一些分歧。
|
||||
|
||||
> 真正的系统管理员不会使用 `sudo`。——保罗·威尼斯(Paul Venezia)
|
||||
|
||||
Venezia 在他的 [InfoWorld 文章][4] 中辩称,对于许多担任系统管理员的人来说,`sudo` 是一个不必要的工具。他没有花太多时间为这个观点进行解释,他只是把它说成了一个事实。我同意他对于系统管理员的观点,因为我们不需要 `sudo` 来完成我们的工作。事实上,`sudo` 使得事情变得更复杂了。
|
||||
|
||||
然而,
|
||||
|
||||
> 这时代正在“变革”当中。——鲍勃·迪伦
|
||||
|
||||
迪伦是对的,尽管他没有为电脑唱歌(LCTT 译注:鲍勃·迪伦是美国创作歌手、艺术家和作家,这里指他不是针对于电脑而说的)。
|
||||
|
||||
自从**个人计算机**时代到来以来,计算机的管理方式发生了重大变化。在许多环境中,计算机的使用者也是它的管理员,这使得为这些用户提供一些对 root 权限的访问是有必要的。
|
||||
|
||||
一些现代发行版,例如 Ubuntu 及其衍生版本,只能使用 `sudo` 命令来执行特权命令。在这些发行版中,用户无法直接以 root 用户身份登录,甚至无法通过 `su` 切换到 root,因此需要 `sudo` 命令来允许非 root 用户获得 root 权限。在这一环境中,所有系统管理任务均使用 `sudo` 来执行。
|
||||
|
||||
通过锁定 root 帐户并将常规用户帐户添加到 wheel 组,可以进行此配置,但是这种配置很容易被绕过。接下来,让我们在任何 Ubuntu 主机或 VM 上尝试一些小实验吧。我在这里说明一些我实验的设置,以便你可以根据需要来重现它。我安装的是 Ubuntu 16.04 LTS1,并使用 VirtualBox 将其安装在 VM 中。在安装过程中,我创建了一个非 root 用户 `student`,为了简便起见我给这个用户设置了一个简单的密码。
|
||||
|
||||
以 `student` 用户身份登录 Ubuntu,并打开终端。查看 `/etc/shadow` 文件中的 root 条目,其中存储了经哈希的密码。
|
||||
|
||||
```
|
||||
student@ubuntu1:~$ cat /etc/shadow
|
||||
cat: /etc/shadow: Permission denied
|
||||
```
|
||||
|
||||
可以看到终端拒绝了我们对 `/etc/shadow` 的访问,因此我们无法查看 `/etc/shadow` 文件。所有发行版都是如此,以防止非特权用户看到和访问加密的密码,因为非特权用户可能会使用常见的黑客工具来破解这些密码。
|
||||
|
||||
现在,让我们使用 `su -` 命令来成为 root 用户。
|
||||
|
||||
```
|
||||
student@ubuntu1:~$ su -
|
||||
Password: <Enter root password – but there isn't one>
|
||||
su: Authentication failure
|
||||
```
|
||||
|
||||
认证失败的原因是因为根帐户没有密码、并且被锁定了。接下来,使用 `sudo` 命令查看 `/etc/shadow` 文件。
|
||||
|
||||
```
|
||||
student@ubuntu1:~$ sudo cat /etc/shadow
|
||||
[sudo] password for student: <enter the student password>
|
||||
root:!:17595:0:99999:7:::
|
||||
<snip>
|
||||
student:$6$tUB/y2dt$A5ML1UEdcL4tsGMiq3KOwfMkbtk3WecMroKN/:17597:0:99999:7:::
|
||||
<snip>
|
||||
```
|
||||
|
||||
在这里,我仅截取了部分结果,只显示 root 和 `student` 用户的条目。我还缩短了加密密码,以便该条目能显示在一行中。各个字段以冒号(`:`)分隔,第二个字段是密码。请注意,root 的密码字段是一个感叹号(`!`),这表明 root 帐户已被锁定,且无法使用。
|
||||
|
||||
现在,要将根帐户变成一个合适的系统管理员,你只需为根帐户设置密码。
|
||||
|
||||
```
|
||||
student@ubuntu1:~$ sudo su -
|
||||
[sudo] password for student: <Enter password for student>
|
||||
root@ubuntu1:~# passwd root
|
||||
Enter new UNIX password: <Enter new root password>
|
||||
Retype new UNIX password: <Re-enter new root password>
|
||||
passwd: password updated successfully
|
||||
root@ubuntu1:~#
|
||||
```
|
||||
|
||||
现在,你可以直接以 root 身份登录到控制台,或者直接使用 `su` 登录到 root,而不是在每个命令前都加一个 `sudo`。当然,你也可以在每次想以 root 身份登录时,使用 `sudo su -`,但这又是何必呢?
|
||||
|
||||
请不要误解我的意思。像 Ubuntu 这样的发行版非常好,多年来我已经使用了其中的几个。在使用 Ubuntu 和相关发行版时,我做的第一件事就是设置一个 root 密码,这样我就可以直接以 root 身份登录。其他发行版,如 Fedora 及其相关发行版,现在在安装过程中提供了一些有趣的选择。我注意到的第一个 Fedora 版本是 Fedora 34,我在写我的一本即将出版的书时安装了很多次。
|
||||
|
||||
在安装页面上,可以找到其中一个安装选项,来设置 root 密码。这个新选项允许用户以锁定 Ubuntu root 帐户的方式选择“<ruby>锁定 root 帐户<rt> Lock root account </rt></ruby>”。此页面上还有一个选项,允许使用密码以 root 身份远程 SSH 登录到此主机,但这仅在 root 帐户解锁时有效。第二个选项位于允许创建非根用户帐户的页面上。此页面上的选项之一是“<ruby>让此用户成为管理员<rt> Make this user administrator </rt></ruby>”。选中此选项后,用户 ID 将添加到一个名为 wheel 组的特殊组中,该组授权该组的成员使用 `sudo` 命令。Fedora 36 甚至在该复选框的描述中提到了 wheel 组。
|
||||
|
||||
可以将多个非 root 用户设置为管理员。使用此方法指定为管理员的任何人都可以使用 `sudo` 命令在 Linux 计算机上执行所有管理任务。Linux 在安装时只允许创建一个非 root 用户,所以其他新用户可以在创建时添加到 wheel 组中。root 用户或其他管理员可以使用文本编辑器或 `usermod` 命令直接将现有用户添加到 wheel 组。
|
||||
|
||||
在大多数情况下,今天的管理员只需要执行一些基本任务,例如添加新的打印机、安装更新或新软件,或者删除不再需要的软件。这些 GUI 工具需要 root 或管理密码,并将接受来自管理员用户的密码。
|
||||
|
||||
### 在 Linux 上,我是怎么使用 `su` 和 `sudo` 的呢
|
||||
|
||||
我**同时使用 `su` 和 `sudo`**。它们都是我所使用的很重要的系统管理员工具。
|
||||
|
||||
我不锁定根帐户,因为我需要用根帐户来运行我的 [Ansible][5] 脚本和我编写的 [rsbu][6] Bash 程序,来执行备份。这两个程序都需要以 root 身份运行,我编写的其他几个管理 Bash 的脚本也是如此。我**使用 `su` 命令**,切换到 root 用户,这样我就可以执行这些脚本和许多其他常见的命令。当我需要确定问题和解决问题时,使用 `su` 命令将我的权限提升到 root 十分有用,因为我不希望 `sudo` 带来的提权会话超时。
|
||||
|
||||
当非 root 用户需要执行这些任务时,我**使用 `sudo` 命令**,来执行需要 root 权限的任务。我在 sudoers 文件中设置了非根帐户,只允许访问完成任务所需的 1 到 2 个命令。当我只需要运行 1 个或 2 个需要提权的快速命令时,我自己也会使用 `sudo` 命令。
|
||||
|
||||
### 结论
|
||||
|
||||
实际上只要你把工作完成好了,你使用什么工具都无大碍。你使用的是 vim 还是 Emacs,是 systemd 还是 SystemV,是 RPM 亦或是 DEB,是 `sudo` 亦或是 `su`,在结果上会有什么区别呢?这里的关键在于你应该使用**最适合你的工具**。Linux 和开源软件的最大优势之一是通常有许多选项可用于我们需要完成的任务。
|
||||
|
||||
`su` 和 `sudo` 都各有长处,如果正确使用的话,两者都是非常安全的。我选择同时使用 `su` 和 `sudo` 命令,基于它们的历史功能,因为这对我来说十分有用。对于我自己的大部分工作,我更喜欢 `su` 命令,因为它与我的工作流程最适配。
|
||||
|
||||
在评论区分享你喜欢的工作方式吧!
|
||||
|
||||
本文摘自于我的书《系统管理员的 Linux 方法(Apress,2018 年)》(The Linux Philosophy for Sysadmins)一书的第 19 章,并经许可后重新发布。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/6/linux-su-vs-sudo-sysadmin
|
||||
|
||||
作者:[David Both][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[chai001125](https://github.com/chai001125)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/dboth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/sites/default/files/lead-images/bash_command_line.png
|
||||
[2]: https://opensource.com/users/seth
|
||||
[3]: https://opensource.com/article/22/5/use-sudo-linux
|
||||
[4]: http://www.infoworld.com/t/unix/nine-traits-the-veteran-unix-admin-276?page=0,0&source=fssr
|
||||
[5]: https://opensource.com/article/20/10/first-day-ansible
|
||||
[6]: https://opensource.com/article/17/1/rsync-backup-linux
|
@ -0,0 +1,186 @@
|
||||
[#]: subject: "How to Record Streaming Audio in Ubuntu and other Linux Distributions"
|
||||
[#]: via: "https://itsfoss.com/record-streaming-audio/"
|
||||
[#]: author: "Abhishek Prakash https://itsfoss.com/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "FYJNEVERFOLLOWS"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
如何在 Ubuntu 和其他 Linux 发行版中录制流音频
|
||||
======
|
||||
如何在 Ubuntu 和其他 Linux 发行版中录制音频?
|
||||
|
||||
如果你想通过计算机的麦克风录制语音,可以使用 `GNOME Sound Recorder` 或 `Audacity`。
|
||||
|
||||
使用 `GNOME Sound Recorder` 很简单,但它缺乏功能。`Audacity` 最初可能会让人无法抗拒,但它有很多专业级录音的功能。然而,在本教程中,我不会详细讨论这个问题。
|
||||
|
||||
`GNOME Sound Recorder` 能与麦克风配合使用。还有一个叫做 `Audio recorder` 的工具,除了麦克风输入,你可以使用它来录制流媒体音乐(来自 Sptify、YouTube、互联网广播、Skype 和其他大多数来源)。
|
||||
|
||||
总而言之,我将向你展示以下步骤:
|
||||
|
||||
* 使用 `GNOME Sound Recorder` 录制声音
|
||||
* 使用 `Audio Recorder` 录制流音频
|
||||
|
||||
### 使用 `Sound Recorder` 从麦克风录制音频
|
||||
|
||||
`GNOME` 桌面环境有很多有用的应用程序。Sound Recorder 就是其中之一。
|
||||
|
||||
你可以从 `Ubuntu` 软件中心安装 [Sound Recorder][1]。
|
||||
|
||||
![Sound Recorder can be installed from the Ubuntu Software Center][2]
|
||||
|
||||
或者,你可以在终端中使用此命令来安装它:
|
||||
|
||||
```
|
||||
sudo apt install gnome-sound-recorder
|
||||
```
|
||||
|
||||
安装后,你可以在系统菜单中找到它并从那里开始。
|
||||
|
||||
![GNOME Sound Recorder][3]
|
||||
|
||||
在开始使用它之前,应确保在系统设置中选择了正确的输入源
|
||||
|
||||
![Ensure that you have chosen correct input in system settings][4]
|
||||
|
||||
一打开 `Sound Recorder`,它将显示如下界面。
|
||||
|
||||
![Hit the Record button to start audio recording][5]
|
||||
|
||||
点击录制按钮,它立即开始录制音频。录制时,你可以选择暂停、停止或取消录制。
|
||||
|
||||
![Options while recording audio][6]
|
||||
|
||||
你的录音将保存并可从应用程序界面本身获得。单击保存的录音以突出显示。
|
||||
|
||||
你可以回放或删除录音。你可以通过单击保存/下载按钮选择将其保存到其他位置。你也可以使用编辑按钮重命名录音。
|
||||
|
||||
![Saved recordings][7]
|
||||
|
||||
这很方便,对吧?你可以选择以 `MP3`、`FLAC` 和多种格式录制。
|
||||
|
||||
#### 删除 GNOME Sound Recorder
|
||||
|
||||
不喜欢它或发现它缺乏功能?
|
||||
|
||||
你可以从 `Ubuntu` 软件中心删除 `GNOME Sound Recorder` 或使用以下命令:
|
||||
|
||||
```
|
||||
sudo apt remove gnome-sound-recorder
|
||||
```
|
||||
|
||||
`GNOME Sound Recorder` 的应用受到限制。它只从麦克风录制,在某些情况下这不是你想要的。
|
||||
|
||||
想象一下你想录制 Skype 通话或在应用程序或网络浏览器中播放的内容?在这种情况下,漂亮的 `Audio Recorder` 会有所帮助。
|
||||
|
||||
### 使用 Audio Recorder 来录制流音频
|
||||
|
||||
你可以观看以下视频以了解如何使用 `Audio Recorder`。它有点旧,但步骤是一样的。
|
||||
|
||||
![A Video from YouTube][8]
|
||||
|
||||
[Subscribe to our YouTube channel for more Linux videos][9]
|
||||
你可以使用 [官方 PPA][10] 在 Ubuntu 和 LinuxMint 中安装 `Audio Recorder`。在终端中依次使用以下命令(`Ctrl+Alt+T`):
|
||||
|
||||
```
|
||||
sudo apt-add-repository ppa:audio-recorder/ppa
|
||||
sudo apt update
|
||||
sudo apt install audio-recorder
|
||||
```
|
||||
|
||||
或者,你可以从[启动台][11]下载源代码。安装后,你可以从“活动概述”里启动应用程序:
|
||||
|
||||
![Audio Recorder][12]
|
||||
|
||||
#### 记录不同来源的各种声音
|
||||
|
||||
`Audio Recorder` 记录计算机产生的各种声音。
|
||||
|
||||
它记录通过系统声卡、麦克风、浏览器、网络摄像头等播放的音频。
|
||||
|
||||
换句话说,即使你的系统打喷嚏,它也会记录(如果你想记录的话)。它允许你选择录制设备,如网络摄像头、麦克风、Skype等。
|
||||
|
||||
要录制流媒体音乐,请选择适当的源。例如,如果你正在Rhythmbox 中播放流媒体广播,请选择 Rythbox。
|
||||
|
||||
![Audio-Recorder Audio Settings][13]
|
||||
|
||||
#### 在你方便的时候录制
|
||||
|
||||
`Audio Recorder` 还提供了设置计时器的选项。你可以在给定的时钟时间或预定义的间隔开始、停止或暂停录制。你还可以设置录制文件大小的限制。
|
||||
|
||||
此外,你可以在没有音频(或声音很低)时暂停(和停止),并在声音恢复时继续。
|
||||
|
||||
你所要做的就是编辑计时器面板中的文本。注释掉你不想应用的“规则”,并根据你的要求编辑这些规则。
|
||||
|
||||
![Audio-recorder Timer Settings][14]
|
||||
|
||||
它提供了其他设置,如登录时自动启动、显示托盘图标和其他记录设置。
|
||||
|
||||
![Audio-recorder Additional Settings][15]
|
||||
|
||||
#### 以各种文件格式保存录制的音乐文件
|
||||
|
||||
另一个宝藏。你可以将录制的文件保存为你喜爱的文件格式。支持的文件格式有 OGG 音频、Flac、MP3、SPX 和 WAV。我录音时更喜欢用 MP3 格式。
|
||||
|
||||
**录制的文件存储在 `~/Audio`** 中,即主目录中的 `Audio` 文件夹中。
|
||||
|
||||
![Audio-recorder Audio Formats][16]
|
||||
|
||||
#### `Audio Recorder` 有多好?
|
||||
|
||||
我在 Ubuntu 中使用 `Audio Recorder` [录制YouTube上播放的音乐][17]。我用 MP3 格式保存了一段 2 分钟的视频,占用了 934 KB 的空间。但我必须说,我没想到录制的音质会这么好。老实说,我无法将它与 YouTube 上的原始歌曲区分开来。
|
||||
|
||||
#### 删除 `Audio Recorder`
|
||||
|
||||
如果你不喜欢 `Audio Recorder`,可以使用以下命令将其删除:
|
||||
|
||||
```
|
||||
sudo apt remove audio-recorder
|
||||
```
|
||||
|
||||
[同时删除 PPA][18] 是个好主意:
|
||||
|
||||
```
|
||||
sudo apt-add-repository -r ppa:audio-recorder/ppa
|
||||
```
|
||||
|
||||
### 结论
|
||||
|
||||
Linux 中可能还有其他几种用于音频录制的工具。像 `GNOME` 一样,其他桌面环境也可能有录音应用程序。我知道 `Deepin` 肯定有一个。
|
||||
|
||||
`GNOME Sound Recorder` 是一个不错的工具,用于从麦克风录制声音。对于录制各种来源的声音,`Audio Recorder` 是一个不错的选择。
|
||||
|
||||
我希望这篇文章能满足你的录音需求。如果你有什么建议,请告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/record-streaming-audio/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/FYJNEVERFOLLOWS)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://wiki.gnome.org/Apps/SoundRecorder
|
||||
[2]: https://itsfoss.com/wp-content/uploads/2022/08/sound-recorder-ubuntu.png
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2022/08/sound-recorder.png
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2022/08/microphone-settings-ubuntu.png
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2022/08/using-sound-recorder-linux.png
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2022/08/sound-recording-with-sound-recorder.png
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2022/08/sound-recorder-interface.png
|
||||
[8]: https://youtu.be/o7Ia2QGeB7Q
|
||||
[9]: https://www.youtube.com/c/itsfoss?sub_confirmation=1
|
||||
[10]: https://launchpad.net/~audio-recorder/+archive/ubuntu/ppa
|
||||
[11]: https://launchpad.net/audio-recorder
|
||||
[12]: https://itsfoss.com/wp-content/uploads/2022/08/audio-recorder-in-overview.png
|
||||
[13]: https://itsfoss.com/wp-content/uploads/2022/08/audio-recorder-audio-settings.png
|
||||
[14]: https://itsfoss.com/wp-content/uploads/2022/08/audio-recorder-timer-settings.png
|
||||
[15]: https://itsfoss.com/wp-content/uploads/2022/08/audio-recorder-additional-settings.png
|
||||
[16]: https://itsfoss.com/wp-content/uploads/2022/08/audio-recorder-audio-formats.png
|
||||
[17]: https://itsfoss.com/youtube-dl-audio-only/
|
||||
[18]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/
|
@ -0,0 +1,539 @@
|
||||
[#]: subject: "How To Securely Transfer Files With SCP In Linux"
|
||||
[#]: via: "https://ostechnix.com/securely-transfer-files-with-scp-in-linux/"
|
||||
[#]: author: "sk https://ostechnix.com/author/sk/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "MjSeven"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
如何在 Linux 中使用 SCP 安全地传输文件
|
||||
======
|
||||
|
||||
在网络上文件传输可以通过各种不同的方式和协议来完成。**远程复制文件**最常用的协议是 **Rsync**、**SCP** 和 **SFTP**。在本文中,我们将了解**什么是 SCP** 以及如何在 Linux 和类 Unix 操作系统中**使用 SCP 在本地和远程计算机之间安全地传输文件**。
|
||||
|
||||
### 什么是 SCP?
|
||||
|
||||
SCP,代表**安全复制**,它是一个命令行程序,在 Linux 和类 Unix 操作系统中以安全的方式在本地和远程系统之间,或在两个远程系统之间复制文件和目录。
|
||||
|
||||
使用 `scp` 命令,你可以安全地复制文件或目录:
|
||||
|
||||
- 从本地到远程系统
|
||||
- 从远程系统到本地
|
||||
- 在两个远程系统之间
|
||||
|
||||
使用 scp 命令传输数据时,文件和目录都是加密的。因此,即使网络被破坏,犯罪者也无法获得任何有意义的数据。
|
||||
|
||||
SCP 是 openSSH 程序的一个组件,它使用 SSH 协议安全地传输文件。几乎所有现代 Linux 和 Unix 发行版都预装了 OpenSSH,所以不必费心安装它。
|
||||
|
||||
#### 提醒一句:
|
||||
|
||||
根据 openSSH 开发人员的**官方公告**:
|
||||
|
||||
> **scp 协议已经过时了**,它不灵活且不易修复。我们建议使用更现代的协议,如 sftp 和 rsync 来代替。
|
||||
>
|
||||
> 参考 - [https://lists.mindrot.org/pipermail/openssh-unix-dev/2019-March/037672.html][1]
|
||||
|
||||
但是,大多数用户仍然更喜欢 SCP 协议。因为,SCP 处理远程文件传输比同行 SFTP 和 Rsync 更快。
|
||||
|
||||
另外,SCP 的工作原理与 `cp` 命令完全相同,而 `rsync` 则会判断源目录是否有**结尾斜杠**而出现不同的行为。看一看下面的命令:
|
||||
|
||||
- `rsync source destination/` - 将 source 目录复制到 destination 文件夹内。
|
||||
- `rsync source/ destination/` - 将 source 目录的内容复制到 destination 文件夹中。
|
||||
|
||||
所以,你必须反复检查是否在路径中添加了斜杠。
|
||||
|
||||
我个人使用 **[Rsync][2]** 在两台主机之间复制大文件,使用 SCP 在网络上复制单个文件。
|
||||
|
||||
### SCP 命令语法
|
||||
|
||||
SCP 的通用语法如下:
|
||||
|
||||
```bash
|
||||
scp [-346ABCpqrTv] [-c cipher] [-F ssh_config] [-i identity_file] [-J destination] [-l limit] [-o ssh_option] [-P port] [-S program] source ... target
|
||||
```
|
||||
|
||||
根据文件传输路径的不同,语法也会有所不同。这里我罗列了一些语法格式示例。
|
||||
|
||||
从本地复制一个文件到远程系统:
|
||||
|
||||
```
|
||||
scp <options> SourceFile User@RemoteHost:RemotePath
|
||||
```
|
||||
|
||||
类似的,从本地系统复制一个目录到远程系统,使用 `-r` 参数:
|
||||
|
||||
```
|
||||
scp -r SourceDirectory User@RemoteHost:RemotePath
|
||||
```
|
||||
|
||||
复制多个文件到远程系统:
|
||||
|
||||
```
|
||||
scp <options> SourceFile1 SourceFile2 User@RemoteHost:RemotePath
|
||||
```
|
||||
|
||||
远程系统复制文件到本地:
|
||||
|
||||
```
|
||||
scp <options> User@RemoteHost:RemoteFilePath DestinationFile
|
||||
```
|
||||
|
||||
远程系统复制目录到本地:
|
||||
|
||||
```
|
||||
scp -r User@RemoteHost:RemoteDirectoryPath DestinationDirectory
|
||||
```
|
||||
|
||||
在本地将文件在两个远程系统之间复制:
|
||||
|
||||
```
|
||||
scp <options> User@RemoteHost1:RemoteFile1 User@RemoteHost2:RemotePath
|
||||
```
|
||||
|
||||
注意,当你在两个远程系统之间复制文件时,流量不会通过本地系统。操作直接在两个远程系统之间进行。但是,你可以使用 `-3` 参数传递运行 scp 命令的系统的流量。
|
||||
|
||||
本地将目录从一个远程系统复制到另一个远程系统:
|
||||
|
||||
```
|
||||
scp -r User@RemoteHost1:RemoteDirectory User@RemoteHost2:DestinationPath
|
||||
```
|
||||
|
||||
### SCP 命令参数
|
||||
|
||||
SCP 命令最常用的参数有:
|
||||
|
||||
- **`-C`** : 启用压缩。C 代表压缩。使用此参数时,数据传输速度会更快,因为数据是压缩的。SCP 将自动在源系统上压缩,并在目标系统上解压缩。
|
||||
- **`-c <cipher>`** : c 代表加密。默认情况下,SCP 使用 **AES-128** 加密方法对数据进行加密。你可以使用 `-c` 参数更改加密方法。
|
||||
- **`-i <identity_file>`** : i 代表身份文件或私钥。如你所知,SSH 中使用基于密码或密钥的身份验证。如果希望在传输文件时使用基于密钥的身份验证,可以使用 -i 参数指定身份文件或私钥。
|
||||
- **`-l limit`** : l 代表极限带宽。通过此参数,可以设置传输数据的最大带宽。它的单位是 **`Kbit/s`**。
|
||||
- **`-F <ssh_config>`** : 有时你可能需要使用不同的网络来连接到 Linux 系统,或你有一个代理服务器,这种情况下,你可以使用 `-F` 参数使用不同的 `ssh_config` 文件。
|
||||
- **`-P port`** - P 代表端口。注意,这是大写的 P。默认情况下,SSH 使用端口 22。但出于安全原因,你可能已经更改了目标主机中的端口号。这种情况下,你应该使用 `-P` 参数显示指定新端口号。
|
||||
- **`-p`** : 如果希望保留原始文件的修改时间、访问时间和模式,你需要使用 -p 参数。注意是小写 p。
|
||||
- **`-r`** : 递归复制整个目录。
|
||||
- **`-B`** : B 代表批处理模式。它用于在传输文件时选择批处理模式。可以防止询问密码。
|
||||
- **`-S program`** : 用于加密连接的程序名称。
|
||||
- **`-v`** : v 代表详细。当使用 `-v` 参数时,命令将会在终端屏幕上打印进度。你会看到文件传输时到底发生了什么。它在调试连接、身份验证和配置问题时非常有用。
|
||||
|
||||
SCP 有很多参数,你可以查看它的手册页来了解其他参数。让我们看一些**有用的 scp 命令示例**。
|
||||
|
||||
### 开始前要记住的重要事项
|
||||
|
||||
- `scp` 命令依赖于 `ssh` 进行安全的文件传输。因此,你必须有一个 **ssh 密钥**或**密码**才能向远程系统进行身份验证。
|
||||
- 为了能传输文件,你必须对**源文件有读权限**,对**目标位置有写权限**。
|
||||
- `scp` 命令在写入前不会检查目标位置。目标位置中具有相同名称的任何文件都将被**覆盖而不通知**。
|
||||
- 为了能够区分本地和远程位置,使用**冒号**(`:`)。
|
||||
- 传输大文件时,建议在 **[Screen][3]** 或 **[Tmux][4]** 会话内启动任务。
|
||||
|
||||
### 在 Linux 中使用 SCP 传输文件
|
||||
|
||||
正如我所说,我们可以使用 `scp` 命令将文件或目录从本地复制到远程系统,反之亦然,或者在两台远程系统之间复制文件或目录。
|
||||
|
||||
### 1. 使用 SCP 从本地系统复制文件到远程系统
|
||||
|
||||
使用 `scp` 命令将文件从本地复制到远程系统,运行:
|
||||
|
||||
```
|
||||
$ scp File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
|
||||
```
|
||||
ostechnix@192.168.1.40's password:
|
||||
File1.txt 100% 104 814.0KB/s 00:00
|
||||
```
|
||||
|
||||
让我们分析一下上面的命令,看看每个参数都做了什么。
|
||||
|
||||
- **`File1.txt`** - 源文件
|
||||
- **`ostechnix`** - 远程系统的用户名
|
||||
- **`192.168.1.40`** - 远程系统的 IP 地址
|
||||
- **`/home/ostechnix/`** - 远程系统中的目标目录。这是我们想要传输源文件的绝对路径,如 `File.txt`。
|
||||
|
||||
你还可以修改目标文件的名称。下面的命令将 `File1.txt` 传输到目的地,保存为 `myfile.txt`。
|
||||
|
||||
```
|
||||
$ scp File1.txt ostechnix@192.168.1.40:/home/ostechnix/myfile.txt
|
||||
```
|
||||
|
||||
![将文件从本地复制到远程系统][5]
|
||||
|
||||
将文件从本地复制到远程系统
|
||||
|
||||
#### 2. 使用 SCP 从本地系统复制多个文件到远程系统
|
||||
|
||||
使用 `scp` 命令将多个文件从本地系统传输到远程系统,运行:
|
||||
|
||||
```bash
|
||||
$ scp File1.txt File2.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
|
||||
```
|
||||
ostechnix@192.168.1.40's password:
|
||||
File1.txt 100% 104 689.4KB/s 00:00
|
||||
File2.txt 100% 496 6.3MB/s 00:00
|
||||
```
|
||||
|
||||
![从本地复制多个文件到远程系统][6]
|
||||
|
||||
从本地复制多个文件到远程系统
|
||||
|
||||
这里:
|
||||
|
||||
- **`File1.txt`** 和 **`File2.txt`** - 源文件名
|
||||
- **`ostechnix@192.168.1.40`** - 远程系统的用户名和 IP 地址
|
||||
- **`/home/ostechnix`** - 目标文件的路径
|
||||
|
||||
如果文件具有相同的扩展名,你可以使用以下替代命令来实现相同的目标。
|
||||
|
||||
```
|
||||
$ scp {File1,File2}.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
或者,
|
||||
|
||||
```
|
||||
$ scp *.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
#### 3. 使用 SCP 从本地到远程系统递归复制目录
|
||||
|
||||
递归地将整个目录(包括子目录及其内容)从本地复制到远程系统,使用 **`-r`** 参数。
|
||||
|
||||
```bash
|
||||
$ scp -r Documents/ ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
![从本地复制目录到远程系统][7]
|
||||
|
||||
从本地复制目录到远程系统
|
||||
|
||||
上述命令将整个 **`Documents`** 目录包括其内容复制到目标系统。
|
||||
|
||||
其中,
|
||||
|
||||
- `-r` : 递归复制文件和目录,包括子目录及其内容
|
||||
- `Documents` : 源目录名称
|
||||
- **`ostechnix@192.168.1.40`** : 远程系统的用户名和 IP 地址
|
||||
- **`/home/ostechnix`** : 目标目录的路径
|
||||
|
||||
#### 4. 用 SCP 将文件从远程系统传输到本地
|
||||
|
||||
还记得我们从本地系统复制了 `File1.txt` 到远程系统,让我们把它复制回本地。
|
||||
|
||||
使用 `scp` 命令从远程系统复制文件到本地,运行:
|
||||
|
||||
```
|
||||
$ scp ostechnix@192.168.1.40:/home/ostechnix/File1.txt Downloads/
|
||||
```
|
||||
|
||||
其中
|
||||
|
||||
- **`ostechnix@192.168.1.40`** : 远程系统的用户名和 IP 地址
|
||||
- `/home/ostechnix/File.txt` : 远程系统文件的绝对路径
|
||||
- `Downloads` - 本地保存复制文件的位置
|
||||
|
||||
![从远程系统传输文件到本地][8]
|
||||
|
||||
从远程系统传输文件到本地
|
||||
|
||||
#### 5. 使用 SCP 将多个文件从远程系统传输到本地
|
||||
|
||||
将多个文件从远程系统复制到本地,在**花括号内**注明文件的绝对路径,如下所示:
|
||||
|
||||
```
|
||||
$ scp ostechnix@192.168.1.40:/home/ostechnix/\{File1.txt,File2.txt\} Downloads/
|
||||
```
|
||||
|
||||
![将多个文件从远程系统传输到本地][9]
|
||||
|
||||
将多个文件从远程系统传输到本地
|
||||
|
||||
上述命令将从远程系统的 `/home/ostechnix/` 目录中复制 `File1.txt` 和 `File2.txt` 到本地的 `Downloads` 目录中。
|
||||
|
||||
注意,**花括号内的逗号后面没有空格**。
|
||||
|
||||
#### 6. 从远程系统递归复制目录到本地
|
||||
|
||||
使用 `scp` 从远程系统递归复制整个目录(包括子目录及其内容)到本地系统,使用 **`-r`** 参数。
|
||||
|
||||
```
|
||||
$ scp -r ostechnix@192.168.1.40:/home/ostechnix/Documents Downloads/
|
||||
```
|
||||
|
||||
上述命令将从远程系统将整个 **`Documents`** 目录复制到本地的 **`Downloads`** 目录。
|
||||
|
||||
#### 7. 使用 SCP 在两台远程计算机之间复制文件
|
||||
|
||||
使用 `scp` 命令将文件从一个远程系统直接复制到另一个远程系统,运行:
|
||||
|
||||
```
|
||||
$ scp senthil@192.168.1.40:/home/senthil/File1.txt kumar@192.168.1.20:/home/kumar/
|
||||
```
|
||||
|
||||
它会要求你输入两个远程系统的密码:
|
||||
|
||||
其中,
|
||||
|
||||
- `senthil@192.168.1.40` - 文件源端远程系统的用户名和 IP 地址
|
||||
- `/home/senthil/File1.txt` - 复制的文件名及其位置
|
||||
- **`kumar@192.168.1.20`** - 复制文件到目标端的用户名和 IP 地址
|
||||
- `/home/kumar` - 在目标端上保存复制文件的位置
|
||||
|
||||
上述命令将从远程主机 `192.168.1.40` 复制 `/home/senthil/File1.txt` 到 `192.168.1.20` 上的 `/home/kumar/` 目录。
|
||||
|
||||
在这种方法中,数据将直接从一个远程系统传输到另一个远程系统。如果你想通过本地机器路由流量,使用 **`-3`** 参数,如下所示:
|
||||
|
||||
```
|
||||
$ scp -3 senthil@192.168.1.40:/home/senthil/File1.txt kumar@192.168.1.20:/home/kumar/
|
||||
```
|
||||
|
||||
#### 8. 使用 SCP 复制文件时启用压缩
|
||||
|
||||
到目前为止,我们在没有压缩的情况下传输了文件。现在我们将使用 **`-C`** 参数在传输文件时启用压缩。
|
||||
|
||||
```
|
||||
$ scp -C File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
`-C` 参数将在源端启用压缩,并在目标端自动解压数据。
|
||||
|
||||
通过启用压缩,可以显著提高文件复制或传输速度。
|
||||
|
||||
#### 9. 使用 SCP 传输文件时限制带宽
|
||||
|
||||
我们可以使用 `-l` 参数限制带宽。注意,最大带宽单位为 Kbits/s。1 字节 = 8 bit。因此,如果你想将带宽限制在 200KB/s,`-l` 的值将是 **1600**(200*8)。
|
||||
|
||||
```
|
||||
$ scp -l 1600 File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
这在传输大文件时非常有用,可以防止 SCP 限制带宽。
|
||||
|
||||
#### 10. 使用 SCP 复制文件时使用不同端口
|
||||
|
||||
作为系统管理员,出于安全原因,你可能在远程服务器上[**更改了 SSH 协议的默认端口**][10]。这种情况下,你可以在传输文件时使用 `-P` 参数指定端口号。注意:**大写的 P**。
|
||||
|
||||
```
|
||||
$ scp -P 2022 File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
#### 11. 使用 SCP 复制文件时使用不同的加密方法
|
||||
|
||||
默认情况下,SCP 使用 **`AES-128`** 对文件进行加密。如果你想使用不同的加密方法,使用 **`c`** 参数。
|
||||
|
||||
例如,如果你想使用 **3des-cbc** 加密方法,命令如下所示:
|
||||
|
||||
```
|
||||
$ scp -c 3des-cbc File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
要查看支持的密码列表,执行:
|
||||
|
||||
```
|
||||
$ ssh -Q cipher localhost | paste -d, -s -
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
|
||||
```
|
||||
3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
|
||||
```
|
||||
|
||||
#### 12. 在详细模式下使用 SCP 复制文件
|
||||
|
||||
如果你想知道使用 scp 复制文件时幕后发生了什么,你可以使用 **`-v`** 参数。使用详细模式传输文件时,终端上会显示执行 SCP 命令执行的每一步过程。这在故障排除时很方便。
|
||||
|
||||
```
|
||||
$ scp -v File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
在详细模式下发送文件时,你将看到大量输出,如下所示:
|
||||
|
||||
![在 Verbose 模式下使用 SCP 复制文件][11]
|
||||
|
||||
在详细模式下使用 SCP 复制文件
|
||||
|
||||
#### 13. 在安静模式下使用 SCP 传输文件
|
||||
|
||||
我们可以使用 **`-q`** 参数在安静模式下传输文件。在安静模式下共享文件时,不会在输出中显示进度、警告或诊断信息。
|
||||
|
||||
```
|
||||
$ scp -q File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
#### 14. 使用 SCP 传输文件时保留文件属性
|
||||
|
||||
使用 **`-p`** 参数可以保留文件修改时间、访问时间和模式等文件属性。注意,这是**小写的 p**。
|
||||
|
||||
```
|
||||
$ scp -p File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
#### 15. 使用 SCP 复制文件时使用身份文件
|
||||
|
||||
SSH 同时支持基于密码和密钥的身份验证。密钥是 Linux 环境中使用最广泛的身份验证方法。
|
||||
|
||||
如果你想在传输文件时使用基于密钥的身份验证,使用 **`-i`** 参数指定身份文件或私钥。
|
||||
|
||||
```
|
||||
$ scp -i my_private_key.pem File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
#### 16. 使用不同的 ssh 配置文件
|
||||
|
||||
在某些情况下,你需要使用不同的网络来连接到 Linux 系统,或你有一个代理服务器。这在情况下,你可以配合 **`-F`** 参数使用不同的 `ssh_config` 文件。
|
||||
|
||||
```
|
||||
$ scp -F /home/ostechnix/my_ssh_config File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
#### 17. 使用 IPv4 或 IPv6 复制文件
|
||||
|
||||
在复制文件时,我们可以强制 SCP 只使用 IPv4 或 IPv6 地址。IPv4 网络添加 **`-4`** 参数,IPv6 网络添加 **`-6`** 参数可以实现这一点。
|
||||
|
||||
```
|
||||
$ scp -6 File1.txt ostechnix@192.168.1.40:/home/ostechnix/
|
||||
```
|
||||
|
||||
### 常见问题
|
||||
|
||||
#### 问题 1:什么是 SCP?
|
||||
|
||||
**回答:** SCP 是一个命令行程序,旨在将文件和目录从本地系统安全地传输到远程系统,反之亦然,或者直接在两个远程系统之间传输。
|
||||
|
||||
#### 问题 2: 如何使用 SCP 将文件从本地复制到远程计算机?
|
||||
|
||||
将文件从本地复制到远程系统,命令如下:
|
||||
|
||||
```
|
||||
scp SourceFile.txt User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### 问题 3:如何递归复制文件和目录?
|
||||
|
||||
递归复制包含子目录的目录,使用 `-r` 参数:
|
||||
|
||||
```
|
||||
scp -r /some/local/directory User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### 问题 4:使用 SCP 可以传输多个文件吗?
|
||||
|
||||
当然,只要用空格分隔源文件名即可。
|
||||
|
||||
从本地复制多个文件到远程:
|
||||
|
||||
```
|
||||
scp file1.txt file2.txt file3.txt User@RemoteHost:/some/remote/directory
|
||||
scp {file1,file2,file3}.txt User@RemoteHost:/some/remote/directory
|
||||
scp *.txt User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
从远程复制多个文件到本地:
|
||||
|
||||
```
|
||||
scp User@RemoteHost:/some/remote/directory/\{file1.txt,file2.txt,file3.txt\} /some/local/directory
|
||||
```
|
||||
|
||||
从一个远程系统复制多个文件到另一个远程系统:
|
||||
|
||||
```
|
||||
$ scp User@RemoteHost1:/some/remote/directory/\{file1.txt,file2.txt,file3.txt\} User@RemoteHost2:/some/remote/directory/
|
||||
```
|
||||
|
||||
#### 问题 5:如何传输目录下的所有文件?
|
||||
|
||||
传输整个目录,首先进入该目录:
|
||||
|
||||
```
|
||||
cd dir_name
|
||||
```
|
||||
|
||||
然后,
|
||||
|
||||
```
|
||||
scp *.txt User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### 问题 6:可以压缩文件吗?
|
||||
|
||||
当然。使用 **`-C`** 压缩文件。文件会在源端压缩,在目标端自动解压缩。
|
||||
|
||||
```
|
||||
scp -C /some/large/file User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### 问题 7:可以保留文件属性吗?
|
||||
|
||||
保留原始文件的修改时间、访问时间和模式等文件属性,使用 **`-p`** 参数。
|
||||
|
||||
```
|
||||
scp -p file.txt User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### 问题 8: 可以使用其他端口吗?
|
||||
|
||||
当然。SCP 配合 **`-P`** 参数允许你使用其他端口。
|
||||
|
||||
```
|
||||
scp -P 2022 file.txt User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### 问题 9: 可以使用不同的加密方法吗?
|
||||
|
||||
当然。使用 **`-c`** 参数。
|
||||
|
||||
```
|
||||
scp -c 3des-cbc User@RemoteHost:/some/remote/directory
|
||||
```
|
||||
|
||||
#### 问题 10: 如何列出 SSH 支持的加密方法?
|
||||
|
||||
使用以下命令查看 SSH 和 SCP 支持的加密方法列表:
|
||||
|
||||
```
|
||||
ssh -Q cipher localhost | paste -d, -s -
|
||||
```
|
||||
|
||||
#### 问题 11:SCP 真的安全吗?
|
||||
|
||||
当然,它用起来是完全安全的。SCP 和 openSSH 使用相同的 SSH 机制。传输的数据在源端加密,目标端解密。
|
||||
|
||||
#### 问题 12:可以从 Windows 系统传输文件到 Linux 吗?
|
||||
|
||||
当然。使用 **PSCP** 程序将文件从 windows 传输到 Linux 平台,你也可以使用 **WinSCP**。
|
||||
|
||||
### 总结
|
||||
|
||||
在这篇全面指南中,我们了解了什么是 SCP,以及如何在 Linux 中使用 **SCP 安全地传输文件**,其中包括 **17 个 SCP 命令示例**,另外还回答了关于 SCP 的常见问题。
|
||||
|
||||
无论你是 Linux 管理人员、开发人员还是普通用户,你都会面临某个时候将文件复制到远程系统或从远程系统复制文件的情况,知道如何**使用 SCP 安全地复制文件**将是非常有用的。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://ostechnix.com/securely-transfer-files-with-scp-in-linux/
|
||||
|
||||
作者:[sk][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://ostechnix.com/author/sk/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://lists.mindrot.org/pipermail/openssh-unix-dev/2019-March/037672.html
|
||||
[2]: https://ostechnix.com/linux-rsync-command-examples-for-beginners/
|
||||
[3]: https://ostechnix.com/screen-command-examples-to-manage-multiple-terminal-sessions/
|
||||
[4]: https://ostechnix.com/tmux-command-examples-to-manage-multiple-terminal-sessions/
|
||||
[5]: https://ostechnix.com/wp-content/uploads/2022/11/Copy-Files-from-Local-System-to-Remote-System.png
|
||||
[6]: https://ostechnix.com/wp-content/uploads/2022/11/Copy-Multiple-Files-from-Local-System-to-Remote-System.png
|
||||
[7]: https://ostechnix.com/wp-content/uploads/2022/11/Copy-Directory-from-Local-System-to-Remote-System.png
|
||||
[8]: https://ostechnix.com/wp-content/uploads/2022/11/Transfer-Files-from-Remote-System-to-Local-System.png
|
||||
[9]: https://ostechnix.com/wp-content/uploads/2022/11/Transfer-Multiple-Files-from-Remote-System-to-Local-System.png
|
||||
[10]: https://ostechnix.com/how-to-change-apache-ftp-and-ssh-default-port-to-a-custom-port-part-3/
|
||||
[11]: https://ostechnix.com/wp-content/uploads/2022/11/Copying-Files-with-SCP-in-Verbose-Mode.png
|
@ -1,64 +0,0 @@
|
||||
[#]: subject: "Try this Java file manager on Linux"
|
||||
[#]: via: "https://opensource.com/article/22/12/linux-file-manager-jfileprocessor"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
在 Linux 上试试这个 Java 文件管理器
|
||||
======
|
||||
|
||||
计算机是奇特的文件柜,里面装满了等待引用、交叉引用、编辑、更新、保存、复制、移动、重命名和组织的虚拟文件夹和文件。在本文中,我将介绍一下 Linux 系统的文件管理器。
|
||||
|
||||
在 Sun Microsystem 时代的末期,出现了一种叫做 Java 桌面系统的东西,奇怪的是它_不是_用 Java 编写的。相反,它是(根据当时的 sun.com 上的描述)“对集成和优化的桌面软件的明智选择,大部分基于开源代码和开放标准”。它基于 GNOME,带有办公套件、电子邮件和日历应用、即时消息和“Java 技术”。我发现自己在思考用 Java 创建桌面需要什么。客观地说,桌面实际上并没有那么多。一般的共识似乎是桌面由面板、系统托盘、应用菜单和文件管理器组成。
|
||||
|
||||
想象一个实际的 Java 桌面是一个有趣的思维练习。不足以以此为目标启动一个开源项目,但足以在网络上快速搜索必要的组件。事实证明,有人用 Java 编写并维护了一个文件管理器。
|
||||
|
||||
### JFileProcessor
|
||||
|
||||
我找到的 Java 文件管理器叫做 JFileProcessor,简称 JFP。这不仅在 Java 中,而且在 [Groovy][1](一种流行的 Java 脚本语言)中都是一项迷人的练习。
|
||||
|
||||
![Image of the JfileProcessor folders.][2]
|
||||
|
||||
作为文件管理器,JFileProcessor 在设计和功能上都采用了最小化的方法。它允许你查看、打开、移动、复制、剪切或删除本地系统和远程系统上的文件。它不是特别定制化的,它没有额外的功能,如拆分面板或可移动面板。除了管理文件外,它不围绕任何中心主题构建。JFileProcessor 在某种程度上令人耳目一新,因为它很简单。这是一个文件管理器,仅此而已。有时这就是你在文件管理器中想要的全部。
|
||||
|
||||
我之前写过关于[设置 Java Swing 主题][3]的方式,从技术上讲,该技术是这个开源应用的一个选项。但是,我认为这个应用的部分魅力在于 OpenSolaris 称之为 “Blueprint” 的主题。这是 Java 的怀旧外观,我喜欢以其原生 GUI 外观运行它,作为对我的 OpenSolaris(现为 OpenIndiana)笔记本电脑的回忆。
|
||||
|
||||
|
||||
### 用户体验
|
||||
|
||||
除了设计,真正重要的是用户体验。JFileProcessor 只有三个你日常使用的按钮:向上、后退和前进。它们未绑定到键盘快捷键,因此你必须单击按钮才能导航(或使用 **Tab** 键选择按钮)。在使用图形应用时,我经常使用键盘快捷键,所以当我尝试浏览我的系统时,这大大减慢了我的速度。但是,有时我实际上只是懒洋洋地浏览文件,因此 JFileProcessor 完全按照我的需要工作。
|
||||
|
||||
JFileProcessor 也有一个搜索组件。只要你设置合理的起始文件夹,搜索就会快速而智能,同时允许适用 glob 和正则模式搜索。例如,当我搜索特定的电子书或漫画档案或游戏规则手册时,或者任何时候我粗略地知道该目录包含一个项目但懒得一直点击到目的地址。在子目录中快速搜索,必然会得到明显的结果,然后双击打开文件,不管我设置了什么XDG偏好(Evince用于PDF,Foliate用于电子书,等等)。
|
||||
|
||||
右键单击任何文件或目录会弹出上下文菜单。它具有你期望的大部分常见任务:复制、剪切、粘贴、删除、重命名、新建。它也有一些不错的额外功能。
|
||||
|
||||
![Right-click context menu in JFileProcessor][4]
|
||||
|
||||
例如,你可以只将文件名复制到剪贴板或保存文件路径。你还可以运行一些脚本,包括用于批量重命名文件的脚本、用于对选定文件运行命令的脚本、用于创建 ZIP 或 TAR 存档的脚本等等。当然,编码器有多种选择,包括在当前位置打开终端和打开新的编码窗口。
|
||||
|
||||
### 安装
|
||||
|
||||
我是 Java 的忠实粉丝。它是一种清晰的语言,具有合理的分隔符和对跨平台兼容性的坚定立场。我喜欢它作为一种语言,我喜欢看到程序员用它创造的东西。
|
||||
|
||||
JFileProcessor 的名字很贴切。这是一种处理文件的有效方法,从某种意义上说,JFileProcessor 为你提供了一个简单的窗口来查看系统上的文件数据,并允许你以图形方式与它们进行交互,就像你可能在终端中与它们交互一样。它不是我用过的最高效的文件管理器,也不是功能最多的一个。然而,这是一个令人愉快的应用,为你提供了文件管理所需的基本工具,其相对较小的代码库使你可以在下午阅读一些精彩的内容。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/linux-file-manager-jfileprocessor
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/20/12/groovy
|
||||
[2]: https://opensource.com/sites/default/files/2022-09/jfileprocessor.webp
|
||||
[3]: https://opensource.com/article/22/3/beautify-java-applications
|
||||
[4]: https://opensource.com/sites/default/files/2022-09/jfileprocessor-menu.webp
|
@ -0,0 +1,61 @@
|
||||
[#]: subject: "Install open source solar power at home"
|
||||
[#]: via: "https://opensource.com/article/22/12/open-source-solar-power-home"
|
||||
[#]: author: "Joshua Pearce https://opensource.com/users/joshuapearce"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
在家里安装开源太阳能
|
||||
======
|
||||
|
||||
你可能已经考虑过用太阳能为您的家供电。将太阳光直接转化为电能的太阳能光伏电池板的成本已大幅下降,因此在任何地方都具有经济意义。这就是为什么大公司投入大量太阳能,甚至电力公司也开始安装大型太阳能发电场的原因,因为它的成本低于过时的化石燃料。像大多数房主一样,你想省钱并节省电费,但你可能对前期费用有点畏缩。为了大致了解成本,以 3 美元/瓦的价格为普通家庭供电的 5kW 系统的成本约为 15,000 美元,而更大的家庭可能需要 10kW 才能抵消所有电力购买,成本为 30,000 美元。如果你想要电池,成本加倍(你不需要电池,因为大多数太阳能电池阵列连接到电网,但如果电网瘫痪,你的太阳能电池阵列也会瘫痪,直到它重新开启)支付你未来几十年所有的电费是一种投资,即使你存了很多钱。
|
||||
|
||||
有一些好消息。首先,美国和加拿大都对太阳能实行了 30% 的税收抵免。此项优惠将价格降至约 2 美元/W。其次,[Opensource.com 之前讨论][1]过你可以获得一本免费书籍[_捕捉阳光_][2],它会引导你完成如何设计自己的系统(你仍然需要一个合格的电工和检查来把它连接到电网)。如果你有一点手艺,你可以将剩余成本削减约 50%。这些成本主要用于材料,包括太阳能电池板、布线、电子设备和支架。令人惊讶的是,对于小型太阳能系统(比如你家的太阳能系统)来说,太阳能电池板的成本下降得如此之低,以至于支架(支撑太阳能电池板的机械结构)的成本可能比面板还高!
|
||||
|
||||
### 开源再次拯救
|
||||
|
||||
将开源开发范式应用于软件可以加快创新速度、改进产品并降低成本。开源硬件也是如此,甚至在光伏支架这个相对不为人知的领域也是如此。几乎所有的商业光伏支架都是由专有的奇特铝型材制成。它们会花很多钱。如果你有一些没有遮挡的后院,你有一些开源的支架解决方案可以选择。
|
||||
|
||||
### 开源太阳能支架设计
|
||||
|
||||
第一个 DIY 太阳能支架设计符合以下标准:(1) 由当地可获得的可再生材料制成,(2) 25 年的使用寿命与太阳能保修相匹配,(3) 能够由普通消费者制造,(4) 能够 符合加拿大结构建筑规范(如果你住在没有雪的地方,这有点矫枉过正,但是,嘿,你可能有其他极端天气需要应对,例如飓风),(5)低成本,(6)它是共享的 使用开源许可证。[开源的木质固定倾斜地面安装双面光伏支架设计][3]在整个北美都适用。与商业专有支架相比,该支架系统可节省 49% 至 77%。然而,支架设计高度依赖于世界各地不同的木材成本。
|
||||
|
||||
在深入研究这个开源设计之前,请检查你当地的木材成本。
|
||||
|
||||
![Non-tilting solar rack plans][4]
|
||||
|
||||
如果你更喜欢冒险,你可能会考虑第二种允许改变倾斜角度的设计。[第二项研究][5]的结果表明,具有最佳可变季节性倾斜角的支架系统具有最佳的终身能量产生,与固定倾斜系统相比,产生的能量多 5.2%(或者,如果最大倾斜角限制为 60°,能量多 4.8%)。固定和可变木制支架系统的电力成本相似,仅为专有商业金属货架的 29%。可变倾斜支架提供了最低成本的选择,即使包括适度的劳动力成本,也可能为[农业光伏][6]等应用提供特定优势(即,你可以在面板下面种菜,对于莴苣等耐阴作物来说,能惊人地增加产量)。此设计已通过[具有 CERN-OHL-S-2.0 许可证的 OSHWA][7] 的认证。
|
||||
|
||||
图片
|
||||
|
||||
![Tilt-adjustable solar racks][8]
|
||||
|
||||
所示的 2 个 PV 模块架中的每一个大约有 1kW。所以一所房子大约需要五个。这两篇论文都提供了完整的计算和分步建造说明。
|
||||
|
||||
正如拥有太阳能系统的任何人都会告诉你的那样,获得负电费是非常有益的。如果你的系统规模能满足你所有的负荷,并且住在该国的净计量地区,就会出现这种情况。请注意,电力公司不会向你付款; 额度会一直延续到你在冬天使用它为止。
|
||||
|
||||
享受一点开源太阳能带来的乐趣!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/open-source-solar-power-home
|
||||
|
||||
作者:[Joshua Pearce][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/joshuapearce
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/21/11/open-source-solar-power
|
||||
[2]: https://tocatchthesun.com/
|
||||
[3]: https://doi.org/10.3390/designs6030041
|
||||
[4]: https://opensource.com/sites/default/files/2022-11/nontilt.png
|
||||
[5]: https://doi.org/10.3390/designs6030054
|
||||
[6]: https://www.academia.edu/18406368/The_potential_of_agrivoltaic_systems
|
||||
[7]: https://certification.oshwa.org/ca000013.html
|
||||
[8]: https://opensource.com/sites/default/files/2022-11/tilt.png
|
@ -0,0 +1,78 @@
|
||||
[#]: subject: "Simplify your Linux PC with the PCManFM file manager"
|
||||
[#]: via: "https://opensource.com/article/22/12/linux-file-manager-pcmanfm"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
使用 PCManFM 文件管理器简化你的 Linux PC
|
||||
======
|
||||
|
||||
PCMan 文件管理器,或简称 PCManFM,是一个功能齐全的快速轻量级文件管理器。它是为 [LXDE][1] 桌面环境开发的,但它是一个独立的应用,可以与你选择的桌面或窗口管理器一起使用。
|
||||
|
||||
### 安装 PCManFM
|
||||
|
||||
在 Linux 上,你可能可以在软件仓库中找到 PCManFM。例如,在 Fedora、Mageia 和类似软件上:
|
||||
|
||||
```
|
||||
$ sudo dnf install pcmanfm
|
||||
```
|
||||
|
||||
在 Debian、Elementary 和类似系统上:
|
||||
|
||||
```
|
||||
$ sudo apt install pcmanfm
|
||||
```
|
||||
|
||||
![Image of the PCMan file manager.][2]
|
||||
|
||||
PCManFM 不必替换你的桌面文件管理器,但某些发行版假定当你安装“第三方”文件管理器时,你希望它优先于默认设置。根据你使用的桌面,有不同的方法来设置默认文件管理器。通常,它位于**默认应用**下的**系统设置**中。
|
||||
|
||||
如果你的桌面环境或窗口管理器没有选择默认应用的界面,你可以在 `~/.local/share/applications/mimeapps.list` 文件中设置你的首选项。要将文件管理器指定为默认,请将其放在 `[Default Applications]` 部分的顶部,首先指定文件类型,然后指定你像用于打开的应用文件的名称(在 `/usr/share/applications` 下):
|
||||
|
||||
```
|
||||
inode/directory=myfilemanager.desktop;
|
||||
```
|
||||
|
||||
### PCManFM
|
||||
|
||||
如果您是 GNOME 2 或 Mate 项目的 [Caja 文件管理器][3]的粉丝,那么 PCManFM 是一个不错的选择。PCManFM 在设计上很像 Caja,但它不像 Caja 那样绑定到桌面,所以它甚至可以在最新的 GNOME 桌面上使用。
|
||||
|
||||
PCManFM 的默认布局在窗口顶部附近有一个有用的工具栏,一个提供对常用目录和驱动器的快速访问的侧面板,以及一个包含有关你当前选择的详细信息的状态栏。你可以使用**视图**菜单隐藏或显示这些元素中的任何一个。
|
||||
|
||||
### 选项卡和面板
|
||||
|
||||
PCManFM 也使用选项卡。如果你以前从未使用过选项卡式文件管理器,那么想想 Web 浏览器以及它如何使用选项卡让你在一个窗口中打开多个网页。PCManFM 可以类似地在同一窗口中打开多个目录。
|
||||
|
||||
要将文件或文件夹从一个选项卡传输到另一个选项卡,只需将文件的图标拖动到选项卡并悬停即可。少许延迟后,PCManFM 将目标选项卡置于最前面,以便你可以继续进行拖放操作。如果你不习惯与文件管理器中的选项卡进行交互,则需要一些时间来适应,但这不会花很长时间,而且它是整理工作区的一项非常强大的功能。
|
||||
|
||||
PCManFM 界面的另一个不错的功能是它能够将一个窗口分成两个面板。每个面板实际上都是一个选项卡,但每个面板只占窗口的一半。
|
||||
|
||||
![Image of dual panels in PCMan.png][4]
|
||||
|
||||
这使得从一个面板拖到另一个面板就像将文件拖到文件夹中一样简单自然。我发现它对于比较文件夹的内容也很有用。
|
||||
|
||||
### 使用 PCMan 进行文件管理
|
||||
|
||||
PCManFM 是一款很棒的小型文件管理器,具有你日常所需的所有基本功能。它是你可能会觉得过于复杂的文件管理器的自然替代品,也是[旧计算机][5]上的一个很好的选择,这些电脑可能对不断绘制缩略图、刷新和生成动画的文件管理器感到挣扎。PCMan 专注于文件管理器的核心任务:管理文件。在你的 Linux 电脑上试试吧。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/linux-file-manager-pcmanfm
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/19/12/lxqt-lxde-linux-desktop
|
||||
[2]: https://opensource.com/sites/default/files/2022-10/pcmanfilemanager.png
|
||||
[3]: https://opensource.com/article/22/12/linux-file-manager-caja
|
||||
[4]: https://opensource.com/sites/default/files/2022-10/%E2%80%8BDual.panel_.in%20PCManFM.png
|
||||
[5]: https://opensource.com/article/22/10/obsolete-computer-linux-opportunity
|
@ -0,0 +1,96 @@
|
||||
[#]: subject: "Try this Linux web browser as your file manager"
|
||||
[#]: via: "https://opensource.com/article/22/12/linux-file-manager-konqueror"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
试试这个 Linux 网络浏览器作为你的文件管理器
|
||||
======
|
||||
|
||||
Konqueror 是 KDE Plasma 桌面的文件管理器和 Web 浏览器。在许多方面,Konqueror 定义了“网络透明度”,因为它适用于个人桌面。使用 Konqueror,你可以像浏览本地文件一样轻松地浏览远程网络文件(包括 Internet 本身,它实际上只是通过花哨的镜头查看的远程文件的集合)。有时需要进行一些配置和设置,具体取决于你需要访问的文件共享类型。但最终,通过 Konqueror 实现了即时访问你有权查看的所有数据的目标,这是其他文件管理器无法实现的。在其巅峰时期,它开发的开源网络引擎 (KHTML) 被苹果和谷歌采用,并作为现代网络浏览和 Electron 应用开发的核心库延续至今。
|
||||
|
||||
今天,KDE Plasma 桌面将 Konqueror 作为网络浏览器。文件管理已正式转移到 [Dolphin][1],但 Konqueror 仍然能够完成这项工作。要获得完整和经典的 Konqueror 体验,你应该尝试 Plasma Desktop 3.x fork [TDE][2],但在本文中,我在 KDE Plasma Desktop 版本 5 中使用 Konqueror。
|
||||
|
||||
### 安装 Konqueror
|
||||
|
||||
如果你已经在运行 KDE Plasma Desktop,你可能已经安装了 Konqueror。如果没有,你可以从发行版软件仓库中安装它。在 Fedora、CentOS、Mageia、OpenMandriva 和类似软件上:
|
||||
|
||||
```
|
||||
$ sudo dnf install -y konqueror konqueror-plugins
|
||||
```
|
||||
|
||||
在 Debian、Linux Mint、Elementary 和类似软件上:
|
||||
|
||||
```
|
||||
$ sudo apt install -y konqueror konqueror-plugins
|
||||
```
|
||||
|
||||
![Image of Konqueror's file manager.][3]
|
||||
|
||||
### 将 Konqueror 配置为文件管理器
|
||||
|
||||
Konqueror 最方便的功能是它除了是一个文件管理器之外,还是一个网络浏览器。至少,这在理论上是它最方便的功能。如果那你没有将 Konqueror 用作 Web 浏览器,那么你可能不希望每个文件管理器窗口顶部都有 URL 区域或搜索引擎区域。
|
||||
|
||||
与大多数 KDE 应用一样,Konqueror 是高度可配置的。你可以重新定位并添加和删除工具栏、添加或删除按钮等。
|
||||
|
||||
要调整显示的工具栏,请启动 Konqueror 并转到**设置** 菜单并选择**显示的工具栏**。**主**工具栏可能是你真正需要的文件管理工具栏。它是带有导航按钮的工具栏。但是,你甚至可能不需要它,只要你乐于使用键盘快捷键或使用 **Go** 菜单进行导航即可。
|
||||
|
||||
Konqueror 中的键盘导航与 Dolphin 中的相同:
|
||||
|
||||
- **Alt+向左箭头**:后退一步
|
||||
- **Alt+向上箭头**:移动到父目录
|
||||
- **Alt+Home**:转到主目录
|
||||
|
||||
### 侧边栏
|
||||
|
||||
要获得包含常用文件夹列表的侧边栏,请按 **F9** 或从**设置**菜单中选择**显示边栏**。这会在 Konqueror 窗口的左侧添加一个按钮栏。单击 **Home** 图标以显示你的主目录的文件树。
|
||||
|
||||
![Image of Konqueror with a sidebar.][4]
|
||||
|
||||
正如按钮栏所暗示的那样,此侧边栏可用于多种用途。你可以显示书签位置,你最近访问过的位置的历史,远程文件系统等。
|
||||
|
||||
### 应用
|
||||
|
||||
有些人习惯于应用菜单。它高效快捷,并且始终在同一个地方。其他人更喜欢从终端启动应用。
|
||||
|
||||
不过,还有另一种查看应用启动器的方法。Konqueror 的 **Go** 菜单允许你转到名为 **Applications** 的元位置,它按类别列出了应用程序启动器,就像文件管理器中的文件一样。
|
||||
|
||||
![Image of applications in Konqueror.][5]
|
||||
|
||||
你也可以在 Dolphin 中看到这个,方法是在位置区域中手动输入 **applications:**,但在这两者中,Konqueror 提供了一个菜单选项,可以直接进入该位置。
|
||||
|
||||
### 网络文件夹
|
||||
|
||||
类似地,Konqueror 还提供了一个菜单选择进入网络文件夹。其中最好的网络文件夹是 Internet,但**网络文件夹**是 HTTP 以外的网络协议的元位置。大多数远程位置需要一些设置,因为它们通常需要身份验证才能访问。它们中的大多数都可以通过**系统设置**进行配置,包括可通过蓝牙、SMB 或 CIFS、MTP 设备、Fish(通过 SSH 的文件系统)访问的文件系统,甚至是 Google Drive。
|
||||
|
||||
### 拆分视图
|
||||
|
||||
你可以将 Konqueror 窗口拆分为多个窗格,这样你就可以同时查看两个文件夹而无需打开两个窗口。有两种拆分选项:垂直拆分,一个窗格在左侧,另一个窗格在右侧,或者水平拆分,一个窗格在另一个窗格之上。
|
||||
|
||||
要分割 Konqueror 窗口,进入**窗口**菜单,选择**分割视图左/右**或**分割视图上/下**。每个窗格都是独立的,所以你可以在一个窗格中浏览,然后把文件从一个窗格拖到另一个窗格。
|
||||
|
||||
### 征服你的文件系统
|
||||
|
||||
Konqueror 不_仅仅_是一个文件管理器,我认为 Plasma 桌面的开发者并不期望你把它作为你的主要文件管理器。在**文件**菜单中甚至有一个选项可以在 **Dolphin** 中打开一个位置,这表明 Konqueror 是一个带有文件管理器组件的网络浏览器。但是,当你需要时,这个文件管理器组件是一个不错的功能。如果你不喜欢 Dolphin 提供的所有功能,Konqueror 可能是一个合适的替代品。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/linux-file-manager-konqueror
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/22/12/linux-file-manager-dolphin
|
||||
[2]: https://opensource.com/article/19/12/linux-trinity-desktop-environment-tde
|
||||
[3]: https://opensource.com/sites/default/files/2022-10/konqueror-filemanager.png
|
||||
[4]: https://opensource.com/sites/default/files/2022-10/konqueror-sidebar.png
|
||||
[5]: https://opensource.com/sites/default/files/2022-10/konqueror-applications.png
|
@ -0,0 +1,237 @@
|
||||
[#]: subject: "Improve your documentation with JavaScript"
|
||||
[#]: via: "https://opensource.com/article/22/12/dynamic-documentation-javascript"
|
||||
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "duoluoxiaosheng"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
|
||||
使用 JavaScript 增强您的文档
|
||||
======
|
||||
|
||||
开源软件项目通常拥有非常多样化的用户人群。有些用户非常擅长使用该系统,并且只需要很少的文档。对于这些实力派的用户。文档只需要提供必要的提示,并且可以包含更多的技术信息,比如说在 shell 中运行的命令行。有些用户可能只是初学者。这些用户需要更多的帮助来设置系统并学习如何使用它。
|
||||
|
||||
写一个同时适合这两个用户群体的文档是令人生畏的。网站文档需要在 “提供详细的技术信息” 和 “提供更多的概述和指导” 之间寻求一个平衡。这是一个很难找到的平衡。如果你的文档不能同时满足这两个用户人群,那么考虑一下另外一个选择 —— 动态文档。
|
||||
|
||||
探索在网页中添加一点 [JavaScript][1] 使用户可以选择自己想看的内容。
|
||||
|
||||
### 构建您的内容
|
||||
|
||||
你可以把例程添加的你的文档中需要同时满足 <ruby>专家<rt>expert</rt></ruby> 和 <ruby>初学者<rt>novice</rt></ruby> 的地方。在这个例程中,你可以使用一个叫做 AwesmeProject 的虚构的音乐播放器。
|
||||
|
||||
你可以用 HTML 编写一个简短的安装文档,通过 HTML 的 <ruby>类<rt>class</rt></ruby> 功能同时为专家和初学者提供操作指南。例如,你可以用下面的代码来为专家定义一个段落:
|
||||
|
||||
```
|
||||
<p class="expert reader">
|
||||
```
|
||||
|
||||
这就同时指派了专家类 和读者类。 你可以用下面的代码来为初学者创建一个相同的段落。
|
||||
|
||||
```
|
||||
<p class="novice reader">
|
||||
```
|
||||
|
||||
完整的 HTML 文件同时包含初学者的段落和专家的段落。
|
||||
|
||||
```
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<title>How to install the software</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>How to install the software</h1>
|
||||
|
||||
<p>Thanks for installing AwesomeProject! With AwesomeProject,
|
||||
you can manage your music collection like a wizard.</p>
|
||||
|
||||
<p>But first, we need to install it:</p>
|
||||
|
||||
<p class="expert reader">You can install AwesomeProject from
|
||||
source. Download the tar file, extract it, then run:
|
||||
<code>./configure ; make ; make install</code></p>
|
||||
|
||||
<p class="novice reader">AwesomeProject is available in
|
||||
most Linux distributions. Check your graphical package manager and search for AwesomeProject to install it.</p>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
```
|
||||
|
||||
例子中的 HTML 文档没有与之关联的样式表,所以浏览器中会显示所有的段落。
|
||||
|
||||
![Image of html in black text.][2]
|
||||
|
||||
我们可在文档中添加一些简单的样式来为 <ruby>读者<rt>reader</rt></ruby>,<ruby>专家<rt>expert</rt></ruby> 或者 <ruby>初学者<rt>novice</rt></ruby> 突出任何元素。为了使不同的文本更容易区分,让我们把读者类的背景颜色设置成米白色,专家类的字体颜色设置为深红色,初学者的字体颜色则设置为深蓝色。
|
||||
|
||||
```
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<title>How to install the software</title>
|
||||
|
||||
<style>
|
||||
|
||||
.reader {
|
||||
background-color: ghostwhite;
|
||||
}
|
||||
|
||||
.expert {
|
||||
color: darkred;
|
||||
}
|
||||
|
||||
.novice {
|
||||
color: darkblue;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>How to install the software</h1>
|
||||
```
|
||||
|
||||
当你在浏览器中查看这个网页时,这些样式有助于这两个段落的突出。安装指导的所有段落都有一个米白色背景,因为他们都有 <ruby>读者<rt>reader</rt></ruby> 这个类。第一个段落的字体是深红色的,这是由 <ruby>专家<rt>expert</rt></ruby> 这个类定义的。第二个段落的字体是深蓝色的,则是由 <ruby>初学者<rt>novice</rt></ruby> 这个类定义的。
|
||||
|
||||
![Image of html in red and black text.][3]
|
||||
|
||||
### 添加 JavaScript 控件
|
||||
|
||||
这些类的应用,使你可以添加一些简单的 JavaScript 函数,只显示其中一个内容块。一个方法是,首先给所有的读者类元素设置 `display:none` 。这会将内容隐藏,使其不会在页面上显示。然后,用函数将你想显示的类元素设置为 `display:block` :
|
||||
|
||||
```
|
||||
<script>
|
||||
function readerview(audience) {
|
||||
var list, item;
|
||||
// hide all class="reader"
|
||||
list = document.getElementsByClassName("reader");
|
||||
for (item = 0; item < list.length; item++) {
|
||||
list[item].style.display = "none";
|
||||
}
|
||||
// show all class=audience
|
||||
list = document.getElementsByClassName(audience);
|
||||
for (item = 0; item < list.length; item++) {
|
||||
list[item].style.display = "block";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
要在 HTML 文档中使用这个 JavaScript,你可以吧这个功能附加到一个按钮上。由于 `readerview` 函数需要一个<ruby>听众<rt>audience</rt></ruby>(这应该是相对那个虚拟音乐播放器来说的)作为参数,你可以使用你想查看的听众类别来调用这个函数,可以是<ruby>读者<rt>reader</rt></ruby>,<ruby>专家<rt>expert</rt></ruby> 或者 <ruby>初学者<rt>novice</rt></ruby> 。
|
||||
|
||||
```
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>How to install the software</title>
|
||||
<style>
|
||||
.reader {
|
||||
background-color: ghostwhite;
|
||||
}
|
||||
|
||||
.expert {
|
||||
color: darkred;
|
||||
}
|
||||
|
||||
.novice {
|
||||
color: darkblue;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<script>
|
||||
function readerview(audience) {
|
||||
var list, item;
|
||||
|
||||
// hide all class="reader"
|
||||
list = document.getElementsByClassName("reader");
|
||||
|
||||
for (item = 0; item < list.length; item++) {
|
||||
list[item].style.display = "none";
|
||||
}
|
||||
|
||||
// show all class=audience
|
||||
list = document.getElementsByClassName(audience);
|
||||
|
||||
for (item = 0; item < list.length; item++) {
|
||||
list[item].style.display = "block";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<h1>How to install the software</h1>
|
||||
|
||||
<nav>
|
||||
|
||||
<button onclick="readerview('novice')">view novice text</button>
|
||||
|
||||
<button onclick="readerview('expert')">view expert text</button>
|
||||
|
||||
</nav>
|
||||
|
||||
<p>Thanks for installing AwesomeProject! With AwesomeProject,
|
||||
you can manage your music collection like a wizard.</p>
|
||||
|
||||
<p>But first, we need to install it:</p>
|
||||
<p class="expert reader">You can install AwesomeProject from
|
||||
source. Download the tar file, extract it, then run
|
||||
<code>./configure ; make ; make install</code></p>
|
||||
|
||||
<p class="novice reader">AwesomeProject is available in
|
||||
most Linux distributions. Check your graphical package
|
||||
manager and search for AwesomeProject to install it.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
有了这些设置,用户可以在网页上选择他们想看的文本。
|
||||
|
||||
![Image of window that allows you to select between novice and expert text.][4]
|
||||
|
||||
点击任何一个按钮都将只显示用户想要阅读的文本。例如,如果你点击了 “<ruby>阅读初学者内容<rt>view novice text</rt></ruby>” 按钮,你就只会看到蓝色段落。
|
||||
|
||||
![Image showing blue text when you press the novice button.][5]
|
||||
|
||||
点击 “<ruby>阅读专家内容<rt>view expert text</rt></ruby>” 按钮,就会隐藏初学者文本,只显示红色的专家文本。
|
||||
|
||||
![Image of red text after the expert button is clicked.][6]
|
||||
|
||||
### 将此扩展到你的文档
|
||||
|
||||
如果你的项目需要你为不同的听众编写多个操作文档,你可以考虑使用这种方法,一次发布,多次阅读。为所有的用户编写一个文档,是每个人都能很容易的发现和分享你项目的文档。而你也不必同时维护尽在细节上有所不同的多个文档。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/12/dynamic-documentation-javascript
|
||||
|
||||
作者:[Jim Hall][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[duoluoxiaosheng](https://github.com/duoluoxiaosehng)
|
||||
校对:[校对者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/lkxed
|
||||
[1]: https://opensource.com/downloads/learn-javascript
|
||||
[2]: https://opensource.com/sites/default/files/2022-12/publishonec.textblack.png
|
||||
[3]: https://opensource.com/sites/default/files/2022-12/publishone.red_.blue_.png
|
||||
[4]: https://opensource.com/sites/default/files/2022-12/publishone.novicexpert.png
|
||||
[5]: https://opensource.com/sites/default/files/2022-12/publishone.blue_.png
|
||||
[6]: https://opensource.com/sites/default/files/2022-12/publishone.red_.png
|
Loading…
Reference in New Issue
Block a user