mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-28 23:20:10 +08:00
commit
b1156209ef
@ -0,0 +1,401 @@
|
|||||||
|
学习 Linux/*BSD/Unix 的 30 个最佳在线文档
|
||||||
|
======
|
||||||
|
|
||||||
|
手册页(man)是由系统管理员和 IT 技术开发人员写的,更多的是为了作为参考而不是教你如何使用。手册页对于已经熟悉使用 Linux、Unix 和 BSD 操作系统的人来说是非常有用的。如果你仅仅需要知道某个命令或者某个配置文件的格式那么你可以使用手册页,但是手册页对于 Linux 新手来说并没有太大的帮助。想要通过使用手册页来学习一些新东西不是一个好的选择。这里有将提供 30 个学习 Linux 和 Unix 操作系统的最佳在线网页文档。
|
||||||
|
|
||||||
|
![Dennis Ritchie and Ken Thompson working with UNIX PDP11][1]
|
||||||
|
|
||||||
|
值得一提的是,相对于 Linux,BSD 的手册页更好。
|
||||||
|
|
||||||
|
### #1:Red Hat Enterprise Linux(RHEL)
|
||||||
|
|
||||||
|
![Red hat Enterprise Linux 文档][2]
|
||||||
|
|
||||||
|
RHEL 是由红帽公司开发的面向商业市场的 Linux 发行版。红帽的文档是最好的文档之一,涵盖从 RHEL 的基础到一些高级主题比如安全、SELinux、虚拟化、目录服务器、服务器集群、JBOSS 应用程序服务器、高可用性集群(HPC)等。红帽的文档已经被翻译成 22 种语言,发布成多页面 HTML、单页面 HTML、PDF、EPUB 等文件格式。好消息同样的文档你可以用于 Centos 和 Scientific Linux(社区企业发行版)。这些文档随操作系统一起下载提供,也就是说当你没有网络的时候,你也可以使用它们。RHEL 的文档**涵盖从安装到配置器群的所有内容**。唯一的缺点是你需要成为付费用户。当然这对于企业公司来说是一件完美的事。
|
||||||
|
|
||||||
|
1. RHEL 文档:[HTML/PDF格式][3](LCTT 译注:**此链接**需要付费用户才可以访问)
|
||||||
|
2. 是否支持论坛:只能通过红帽公司的用户网站提交支持案例。
|
||||||
|
|
||||||
|
#### 关于 CentOS Wiki 和论坛的说明
|
||||||
|
|
||||||
|
![Centos Linux Wiki][4]
|
||||||
|
|
||||||
|
CentOS(<ruby>社区企业操作系统<rt>Community ENTerprise Operating System</rt></ruby>)是由 RHEL 提供的自由源码包免费重建的。它为个人电脑或其它用途提供了可靠的、免费的企业级 Linux。你可以不用付出任何支持和认证费用就可以获得 RHEL 的稳定性。CentOS的 wiki 分为 Howto、技巧等等部分,链接如下:
|
||||||
|
|
||||||
|
1. 文档:[wiki 格式][87]
|
||||||
|
2. 是否支持论坛:[是][88]
|
||||||
|
|
||||||
|
### #2:Arch 的 Wiki 和论坛
|
||||||
|
|
||||||
|
![Arch Linux wiki 和教程][5]
|
||||||
|
|
||||||
|
Arch linux 是一个独立开发的 Linux 操作系统,它有基于 wiki 网站形式的非常不错的文档。它是由 Arch 社区的一些用户共同协作开发出来的,并且允许任何用户添加或修改内容。这些文档教程被分为几类比如说优化、软件包管理、系统管理、X window 系统还有获取安装 Arch Linux 等。它的[官方论坛][7]在解决许多问题的时候也非常有用。它有总共 4 万多个注册用户、超过 1 百万个帖子。 该 wiki 包含一些 **其它 Linux 发行版也适用的通用信息**。
|
||||||
|
|
||||||
|
1. Arch 社区文档:[Wiki 格式][8]
|
||||||
|
2. 是否支持论坛:[是][7]
|
||||||
|
|
||||||
|
### #3:Gentoo Linux Wiki 和论坛
|
||||||
|
|
||||||
|
![Gentoo Linux 手册和 Wiki][9]
|
||||||
|
|
||||||
|
Gentoo Linux 基于 Portage 包管理系统。Gentoo Linux 用户根据它们选择的配置在本地编译源代码。多数 Gentoo Linux 用户都会定制自己独有的程序集。 Gentoo Linux 的文档会给你一些有关 Gentoo Linux 操作系统的说明和一些有关安装、软件包、网络和其它等主要出现的问题的解决方法。Gentoo 有对你来说 **非常有用的论坛**,论坛中有超过 13 万 4 千的用户,总共发了有 5442416 个文章。
|
||||||
|
|
||||||
|
1. Gentoo 社区文档:[手册][10] 和 [Wiki 格式][11]
|
||||||
|
2. 是否支持论坛:[是][12]
|
||||||
|
|
||||||
|
### #4:Ubuntu Wiki 和文档
|
||||||
|
|
||||||
|
![Ubuntu Linux Wiki 和论坛][14]
|
||||||
|
|
||||||
|
Ubuntu 是领先的台式机和笔记本电脑发行版之一。其官方文档由 Ubuntu 文档工程开发维护。你可以在从官方文档中查看大量的信息,比如如何开始使用 Ubuntu 的教程。最好的是,此处包含的这些信息也可用于基于 Debian 的其它系统。你可能会找到由 Ubuntu 的用户们创建的社区文档,这是一份有关 Ubuntu 的使用教程和技巧等。Ubuntu Linux 有着网络上最大的 Linux 社区的操作系统,它对新用户和有经验的用户均有助益。
|
||||||
|
|
||||||
|
1. Ubuntu 社区文档:[wiki 格式][15]
|
||||||
|
2. Ubuntu 官方文档:[wiki 格式][16]
|
||||||
|
3. 是否支持论坛:[是][17]
|
||||||
|
|
||||||
|
### #5:IBM Developer Works
|
||||||
|
|
||||||
|
![IBM: Linux 程序员和系统管理员用到的技术][18]
|
||||||
|
|
||||||
|
IBM Developer Works 为 Linux 程序员和系统管理员提供技术资源,其中包含数以百计的文章、教程和技巧来协助 Linux 程序员的编程工作和应用开发还有系统管理员的日常工作。
|
||||||
|
|
||||||
|
1. IBM 开发者项目文档:[HTML 格式][19]
|
||||||
|
2. 是否支持论坛:[是][20]
|
||||||
|
|
||||||
|
### #6:FreeBSD 文档和手册
|
||||||
|
|
||||||
|
![Freebsd Documentation][21]
|
||||||
|
|
||||||
|
FreeBSD 的手册是由 <ruby>FreeBSD 文档项目<rt>FreeBSD Documentation Project</rt></ruby>所创建的,它介绍了 FreeBSD 操作系统的安装、管理和一些日常使用技巧等内容。FreeBSD 的手册页通常比 GNU Linux 的手册页要好一点。FreeBSD **附带有全部最新手册页的文档**。 FreeBSD 手册涵盖任何你想要的内容。手册包含一些通用的 Unix 资料,这些资料同样适用于其它的 Linux 发行版。FreeBSD 官方论坛会在你遇到棘手问题时给予帮助。
|
||||||
|
|
||||||
|
1. FreeBSD 文档:[HTML/PDF 格式][90]
|
||||||
|
2. 是否支持论坛:[是][91]
|
||||||
|
|
||||||
|
### #7:Bash Hackers Wiki
|
||||||
|
|
||||||
|
![Bash Hackers wiki][22]
|
||||||
|
|
||||||
|
这是一个对于 bash 使用者来说非常好的资源。Bash 使用者的 wiki 是为了归纳所有类型的 GNU Bash 文档。这个项目的动力是为了提供可阅读的文档和资料来避免用户被迫一点一点阅读 Bash 的手册,有时候这是非常麻烦的。Bash Hackers Wiki 分为各个类,比如说脚本和通用资料、如何使用、代码风格、bash 命令格式和其它。
|
||||||
|
|
||||||
|
1. Bash 用户教程:[wiki 格式][23]
|
||||||
|
|
||||||
|
### #8:Bash 常见问题
|
||||||
|
|
||||||
|
![Bash 常见问题:一些有关 GNU/BASH 常见问题的解决方法][24]
|
||||||
|
|
||||||
|
这是一个为 bash 新手设计的一个 wiki。它收集了 IRC 网络的 #bash 频道里常见问题的解决方法,这些解决方法是由该频道的普通成员提供。当你遇到问题的时候不要忘了在 [BashPitfalls][25] 部分检索查找答案。这些常见问题的解决方法可能会倾向于 Bash,或者偏向于最基本的 Bourne Shell,这决定于是谁给出的答案。大多数情况会尽力提供可移植的(Bourne)和高效的(Bash,在适当情况下)的两类答案。
|
||||||
|
|
||||||
|
1. Bash 常见问题:[wiki 格式][26]
|
||||||
|
|
||||||
|
### #9: Howtoforge - Linux 教程
|
||||||
|
|
||||||
|
![Howtoforge][27]
|
||||||
|
|
||||||
|
博客作者 Falko 在 Howtoforge 上有一些非常不错的东西。这个网站提供了 Linux 关于各种各样主题的教程,比如说其著名的“最佳服务器系列”,网站将主题分为几类,比如说 web 服务器、linux 发行版、DNS 服务器、虚拟化、高可用性、电子邮件和反垃圾邮件、FTP 服务器、编程主题还有一些其它的内容。这个网站也支持德语。
|
||||||
|
|
||||||
|
1. Howtoforge: [html 格式][28]
|
||||||
|
2. 是否支持论坛:是
|
||||||
|
|
||||||
|
### #10:OpenBSD 常见问题和文档
|
||||||
|
|
||||||
|
![OpenBSD 文档][29]
|
||||||
|
|
||||||
|
OpenBSD 是另一个基于 BSD 的类 Unix 计算机操作系统。OpenBSD 是由 NetBSD 项目分支而来。OpenBSD 因高质量的代码和文档、对软件许可协议的坚定立场和强烈关注安全问题而闻名。OpenBSD 的文档分为多个主题类别,比如说安装、包管理、防火墙设置、用户管理、网络、磁盘和磁盘阵列管理等。
|
||||||
|
|
||||||
|
1. OpenBSD:[html 格式][30]
|
||||||
|
2. 是否支持论坛:否,但是可以通过 [邮件列表][31] 来咨询
|
||||||
|
|
||||||
|
### #11: Calomel - 开源研究和参考文档
|
||||||
|
|
||||||
|
![开源研究和参考文档][32]
|
||||||
|
|
||||||
|
这个极好的网站是专门作为开源软件和那些特别专注于 OpenBSD 的软件的文档来使用的。这是最简洁的引导网站之一,专注于高质量的内容。网站内容分为多个类,比如说 DNS、OpenBSD、安全、web 服务器、Samba 文件服务器、各种工具等。
|
||||||
|
|
||||||
|
1. Calomel 官网:[html 格式][33]
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### #12:Slackware 书籍项目
|
||||||
|
|
||||||
|
![Slackware Linux 手册和文档][34]
|
||||||
|
|
||||||
|
Slackware Linux 是我的第一个 Linux 发行版。Slackware 是基于 Linux 内核的最早的发行版之一,也是当前正在维护的最古老的 Linux 发行版。 这个发行版面向专注于稳定性的高级用户。 Slackware 也是很少有的的“类 Unix” 的 Linux 发行版之一。官方的 Slackware 手册是为了让用户快速开始了解 Slackware 操作系统的使用方法而设计的。 这不是说它将包含发行版的每一个方面,而是为了说明它的实用性和给使用者一些有关系统的基础工作使用方法。手册分为多个主题,比如说安装、网络和系统配置、系统管理、包管理等。
|
||||||
|
|
||||||
|
1. Slackware Linux 手册:[html 格式][35]、pdf 和其它格式
|
||||||
|
2. 是否支持论坛:是
|
||||||
|
|
||||||
|
### #13:Linux 文档项目(TLDP)
|
||||||
|
|
||||||
|
![Linux 学习网站和文档][36]
|
||||||
|
|
||||||
|
<ruby>Linux 文档项目<rt>Linux Documentation Project</rt></ruby>旨在给 Linux 操作系统提供自由、高质量文档。网站是由志愿者创建和维护的。网站分为具体主题的帮助、由浅入深的指南等。在此我想推荐一个非常好的[文档][37],这个文档既是一个教程也是一个 shell 脚本编程的参考文档,对于新用户来说这个 HOWTO 的[列表][38]也是一个不错的开始。
|
||||||
|
|
||||||
|
1. Linux [文档工程][39] 支持多种查阅格式
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### #14:Linux Home Networking
|
||||||
|
|
||||||
|
![Linux Home Networking][40]
|
||||||
|
|
||||||
|
Linux Home Networking 是学习 linux 的另一个比较好的资源,这个网站包含了 Linux 软件认证考试的内容比如 RHCE,还有一些计算机培训课程。网站包含了许多主题,比如说网络、Samba 文件服务器、无线网络、web 服务器等。
|
||||||
|
|
||||||
|
1. Linux [home networking][41] 可通过 html 格式和 PDF(少量费用)格式查阅
|
||||||
|
2. 是否支持论坛:是
|
||||||
|
|
||||||
|
### #15:Linux Action Show
|
||||||
|
|
||||||
|
![Linux 播客][42]
|
||||||
|
|
||||||
|
Linux Action Show(LAS) 是一个关于 Linux 的播客。这个网站是由 Bryan Lunduke、Allan Jude 和 Chris Fisher 共同管理的。它包含了 FOSS 的最新消息。网站内容主要是评论一些应用程序和 Linux 发行版。有时候也会发布一些和开源项目著名人物的采访视频。
|
||||||
|
|
||||||
|
1. Linux [action show][43] 支持音频和视频格式
|
||||||
|
2. 是否支持论坛:是
|
||||||
|
|
||||||
|
### #16:Commandlinefu
|
||||||
|
|
||||||
|
![Commandlinefu 的最优 Unix / Linux 命令][45]
|
||||||
|
|
||||||
|
Commandlinefu 列出了各种有用或有趣的 shell 命令。这里所有命令都可以评论、讨论和投票(支持或反对)。对于所有 Unix 命令行用户来说是一个极好的资源。不要忘了查看[评选出来的最佳命令][44]。
|
||||||
|
|
||||||
|
1. [Commandlinefu][46] 支持 html 格式
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### #17:Debian 管理技巧和资源
|
||||||
|
|
||||||
|
![Debian Linux 管理: 系统管理员技巧和教程][48]
|
||||||
|
|
||||||
|
这个网站包含一些只和 Debian GNU/Linux 相关的主题、技巧和教程,特别是包含了关于系统管理的有趣和有用的信息。你可以在上面贡献文章、建议和问题。提交了之后不要忘记查看[最佳文章列表][47]里有没有你的文章。
|
||||||
|
|
||||||
|
1. Debian [系统管理][49] 支持 html 格式
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### #18: Catonmat - Sed、Awk、Perl 教程
|
||||||
|
|
||||||
|
![Sed 流编辑器、 Awk 文本处理工具、 Perl 语言教程][50]
|
||||||
|
|
||||||
|
这个网站是由博客作者 Peteris Krumins 维护的。主要关注命令行和 Unix 编程主题,比如说 sed 流编辑器、perl 语言、AWK 文本处理工具等。不要忘了查看 [sed 介绍][51]、sed 含义解释,还有命令行历史的[权威介绍][53]。
|
||||||
|
|
||||||
|
1. [catonmat][55] 支持 html 格式
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### #19:Debian GNU/Linux 文档和 Wiki
|
||||||
|
|
||||||
|
![Debian Linux 教程和 Wiki][56]
|
||||||
|
|
||||||
|
Debian 是另外一个 Linux 操作系统,其主要使用的软件以 GNU 许可证发布。Debian 因严格坚持 Unix 和自由软件的理念而闻名,它也是很受欢迎并且有一定影响力的 Linux 发行版本之一。 Ubuntu 等发行版本都是基于 Debian 的。Debian 项目以一种易于访问的形式提供给用户合适的文档。这个网站分为 Wiki、安装指导、常见问题、支持论坛几个模块。
|
||||||
|
|
||||||
|
1. Debian GNU/Linux [文档][57] 支持 html 和其它格式访问
|
||||||
|
2. Debian GNU/Linux [wiki][58]
|
||||||
|
3. 是否支持论坛:[是][59]
|
||||||
|
|
||||||
|
### #20:Linux Sea
|
||||||
|
|
||||||
|
Linux Sea 这本书提供了比较通俗易懂但充满技术(从最终用户角度来看)的 Linux 操作系统的介绍,使用 Gentoo Linux 作为例子。它既没有谈论 Linux 内核或 Linux 发行版的历史,也没有谈到 Linux 用户不那么感兴趣的细节。
|
||||||
|
|
||||||
|
1. Linux [sea][60] 支持 html 格式访问
|
||||||
|
2. 是否支持论坛: 否
|
||||||
|
|
||||||
|
### #21:O'reilly Commons
|
||||||
|
|
||||||
|
![免费 Linux / Unix / Php / Javascript / Ubuntu 学习笔记][61]
|
||||||
|
|
||||||
|
O'reilly 出版社发布了不少 wiki 格式的文章。这个网站主要是为了给那些喜欢创作、参考、使用、修改、更新和修订来自 O'Reilly 或者其它来源的素材的社区提供资料。这个网站包含关于 Ubuntu、PHP、Spamassassin、Linux 等的免费书籍。
|
||||||
|
|
||||||
|
1. Oreilly [commons][62] 支持 Wiki 格式
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### #22:Ubuntu 袖珍指南
|
||||||
|
|
||||||
|
![Ubuntu 新手书籍][63]
|
||||||
|
|
||||||
|
这本书的作者是 Keir Thomas。这本指南(或者说是书籍)对于所有 ubuntu 用户来说都值得一读。这本书旨在向用户介绍 Ubuntu 操作系统和其所依赖的理念。你可以从官网下载这本书的 PDF 版本,也可以在亚马逊买印刷版。
|
||||||
|
|
||||||
|
1. Ubuntu [pocket guide][64] 支持 PDF 和印刷版本.
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### #23: Linux: Rute User's Tutorial and Exposition
|
||||||
|
|
||||||
|
![GNU/LINUX system administration book][65]
|
||||||
|
|
||||||
|
这本书涵盖了 GNU/LINUX 系统管理,主要是对主流的发布版本比如红帽和 Debian 的说明,可以作为新用户的教程和高级管理员的参考。这本书旨在给出 Unix 系统的每个面的简明彻底的解释和实践性的例子。想要全面了解 Linux 的人都不需要再看了 —— 这里没有涉及的内容。
|
||||||
|
|
||||||
|
1. Linux: [Rute User's Tutorial and Exposition][66] 支持印刷版和 html 格式
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### #24:高级 Linux 编程
|
||||||
|
|
||||||
|
![高级 Linux 编程][67]
|
||||||
|
|
||||||
|
这本书是写给那些已经熟悉了 C 语言编程的程序员的。这本书采取一种教程式的方式来讲述大多数在 GNU/Linux 系统应用编程中重要的概念和功能特性。如果你是一个已经对 GNU/Linux 系统编程有一定经验的开发者,或者是对其它类 Unix 系统编程有一定经验的开发者,或者对 GNU/Linux 软件开发有兴趣,或者想要从非 Unix 系统环境转换到 Unix 平台并且已经熟悉了优秀软件的开发原则,那你很适合读这本书。另外,你会发现这本书同样适合于 C 和 C++ 编程。
|
||||||
|
|
||||||
|
1. [高级 Linux 编程][68] 支持印刷版和 PDF 格式
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### #25: LPI 101 Course Notes
|
||||||
|
|
||||||
|
![Linux 国际专业协会认证书籍][69]
|
||||||
|
|
||||||
|
LPIC 1、2、3 级是用于 Linux 系统管理员认证的。这个网站提供了 LPI 101 和 LPI 102 的测试训练。这些是根据 <ruby>GNU 自由文档协议<rt>GNU Free Documentation Licence</rt></ruby>(FDL)发布的。这些课程材料基于 Linux 国际专业协会的 LPI 101 和 102 考试的目标。这个课程是为了提供给你一些必备的 Linux 系统的操作和管理的技能。
|
||||||
|
|
||||||
|
1. LPI [训练手册][70] 支持 PDF 格式
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### #26: FLOSS 手册
|
||||||
|
|
||||||
|
![FLOSS Manuals is a collection of manuals about free and open source software][72]
|
||||||
|
|
||||||
|
FLOSS 手册是一系列关于自由和开源软件以及用于创建它们的工具和使用这些工具的社区的手册。社区的成员包含作者、编辑、设计师、软件开发者、积极分子等。这些手册中说明了怎样安装使用一些自由和开源软件,如何操作(比如设计和维持在线安全)开源软件,这其中也包含如何使用或支持自由软件和格式的自由文化服务手册。你也会发现关于一些像 VLC、 [Linux 视频编辑][71]、 Linux、 OLPC / SUGAR、 GRAPHICS 等软件的手册。
|
||||||
|
|
||||||
|
1. 你可以浏览 [FOSS 手册][73] 支持 Wiki 格式
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### #27:Linux 入门包
|
||||||
|
|
||||||
|
![Linux 入门包][74]
|
||||||
|
|
||||||
|
刚接触 Linux 这个美好世界?想找一个简单的入门方式?你可以下载一个 130 页的指南来入门。这个指南会向你展示如何在你的个人电脑上安装 Linux,如何浏览桌面,掌握最主流行的 Linux 程序和修复可能出现的问题的方法。
|
||||||
|
|
||||||
|
1. [Linux 入门包][75]支持 PDF 格式
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### #28:Linux.com - Linux 信息来源
|
||||||
|
|
||||||
|
Linux.com 是 Linux 基金会的一个产品。这个网站上提供一些新闻、指南、教程和一些关于 Linux 的其它信息。利用全球 Linux 用户的力量来通知、写作、连接 Linux 的事务。
|
||||||
|
|
||||||
|
1. 在线访问 [Linux.com][76]
|
||||||
|
2. 是否支持论坛:是
|
||||||
|
|
||||||
|
### #29: LWN
|
||||||
|
|
||||||
|
LWN 是一个注重自由软件及用于 Linux 和其它类 Unix 操作系统的软件的网站。这个网站有周刊、基本上每天发布的单独文章和文章的讨论对话。该网站提供有关 Linux 和 FOSS 相关的开发、法律、商业和安全问题的全面报道。
|
||||||
|
|
||||||
|
1. 在线访问 [lwn.net][77]
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### #30:Mac OS X 相关网站
|
||||||
|
|
||||||
|
与 Mac OS X 相关网站的快速链接:
|
||||||
|
|
||||||
|
* [Mac OS X 提示][78] —— 这个网站专用于苹果的 Mac OS X Unix 操作系统。网站有很多有关 Bash 和 Mac OS X 的使用建议、技巧和教程
|
||||||
|
* [Mac OS 开发库][79] —— 苹果拥有大量和 OS X 开发相关的优秀系列内容。不要忘了看一看 [bash shell 脚本入门][80]
|
||||||
|
* [Apple 知识库][81] - 这个有点像 RHN 的知识库。这个网站提供了所有苹果产品包括 OS X 相关的指南和故障报修建议。
|
||||||
|
|
||||||
|
### #30: NetBSD
|
||||||
|
|
||||||
|
(LCTT 译注:没错,又一个 30)
|
||||||
|
|
||||||
|
NetBSD 是另一个基于 BSD Unix 操作系统的自由开源操作系统。NetBSD 项目专注于系统的高质量设计、稳定性和性能。由于 NetBSD 的可移植性和伯克利式的许可证,NetBSD 常用于嵌入式系统。这个网站提供了一些 NetBSD 官方文档和各种第三方文档的链接。
|
||||||
|
|
||||||
|
1. 在线访问 [netbsd][82] 文档,支持 html、PDF 格式
|
||||||
|
2. 是否支持论坛:否
|
||||||
|
|
||||||
|
### 你要做的事
|
||||||
|
|
||||||
|
这是我的个人列表,这可能并不完全是权威的,因此如果你有你自己喜欢的独特 Unix/Linux 网站,可以在下方参与评论分享。
|
||||||
|
|
||||||
|
// 图片来源: [Flickr photo][83] PanelSwitchman。一些连接是用户在我们的 Facebook 粉丝页面上建议添加的。
|
||||||
|
|
||||||
|
### 关于作者
|
||||||
|
|
||||||
|
作者是 nixCraft 的创建者和经验丰富的系统管理员以及 Linux 操作系统 / Unix shell 脚本的培训师。它曾与全球客户及各行各业合作,包括 IT、教育,国防和空间研究以及一些非营利部门。可以关注作者的 [Twitter][84]、[Facebook][85]、[Google+][86]。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.cyberciti.biz/tips/linux-unix-bsd-documentations.html
|
||||||
|
|
||||||
|
作者:[Vivek Gite][a]
|
||||||
|
译者:[ScarboroughCoral](https://github.com/ScarboroughCoral)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://www.cyberciti.biz
|
||||||
|
[1]:https://www.cyberciti.biz/media/new/tips/2011/12/unix-pdp11.jpg "Dennis Ritchie and Ken Thompson working with UNIX PDP11"
|
||||||
|
[2]:https://www.cyberciti.biz/media/new/tips/2011/12/redhat-enterprise-linux-docs.png "Red hat Enterprise Linux Docs"
|
||||||
|
[3]:https://access.redhat.com/documentation/en-us/
|
||||||
|
[4]:https://www.cyberciti.biz/media/new/tips/2011/12/centos-linux-wiki.png "Centos Linux Wiki, Support, Documents"
|
||||||
|
[5]:https://www.cyberciti.biz/media/new/tips/2011/12/arch-linux-wiki.png "Arch Linux wiki and tutorials "
|
||||||
|
[6]:https://wiki.archlinux.org/index.php/Category:Networking_%28English%29
|
||||||
|
[7]:https://bbs.archlinux.org/
|
||||||
|
[8]:https://wiki.archlinux.org/
|
||||||
|
[9]:https://www.cyberciti.biz/media/new/tips/2011/12/gentoo-linux-wiki1.png "Gentoo Linux Handbook and Wiki"
|
||||||
|
[10]:http://www.gentoo.org/doc/en/handbook/
|
||||||
|
[11]:https://wiki.gentoo.org
|
||||||
|
[12]:https://forums.gentoo.org/
|
||||||
|
[13]:http://gentoo-wiki.com
|
||||||
|
[14]:https://www.cyberciti.biz/media/new/tips/2011/12/ubuntu-linux-wiki.png "Ubuntu Linux Wiki and Forums"
|
||||||
|
[15]:https://help.ubuntu.com/community
|
||||||
|
[16]:https://help.ubuntu.com/
|
||||||
|
[17]:https://ubuntuforums.org/
|
||||||
|
[18]:https://www.cyberciti.biz/media/new/tips/2011/12/ibm-devel.png "IBM: Technical for Linux programmers and system administrators"
|
||||||
|
[19]:https://www.ibm.com/developerworks/learn/linux/index.html
|
||||||
|
[20]:https://www.ibm.com/developerworks/community/forums/html/public?lang=en
|
||||||
|
[21]:https://www.cyberciti.biz/media/new/tips/2011/12/freebsd-docs.png "Freebsd Documentation"
|
||||||
|
[22]:https://www.cyberciti.biz/media/new/tips/2011/12/bash-hackers-wiki.png "Bash hackers wiki for bash users"
|
||||||
|
[23]:http://wiki.bash-hackers.org/doku.php
|
||||||
|
[24]:https://www.cyberciti.biz/media/new/tips/2011/12/bash-faq.png "Bash FAQ: Answers to frequently asked questions about GNU/BASH"
|
||||||
|
[25]:http://mywiki.wooledge.org/BashPitfalls
|
||||||
|
[26]:https://mywiki.wooledge.org/BashFAQ
|
||||||
|
[27]:https://www.cyberciti.biz/media/new/tips/2011/12/howtoforge.png "Howtoforge tutorials"
|
||||||
|
[28]:https://howtoforge.com/
|
||||||
|
[29]:https://www.cyberciti.biz/media/new/tips/2011/12/openbsd-faq.png "OpenBSD Documenation"
|
||||||
|
[30]:https://www.openbsd.org/faq/index.html
|
||||||
|
[31]:https://www.openbsd.org/mail.html
|
||||||
|
[32]:https://www.cyberciti.biz/media/new/tips/2011/12/calomel_org.png "Open Source Research and Reference Documentation"
|
||||||
|
[33]:https://calomel.org
|
||||||
|
[34]:https://www.cyberciti.biz/media/new/tips/2011/12/slackware-linux-book.png "Slackware Linux Book and Documentation "
|
||||||
|
[35]:http://www.slackbook.org/
|
||||||
|
[36]:https://www.cyberciti.biz/media/new/tips/2011/12/tldp.png "Linux Learning Site and Documentation "
|
||||||
|
[37]:http://tldp.org/LDP/abs/html/index.html
|
||||||
|
[38]:http://tldp.org/HOWTO/HOWTO-INDEX/howtos.html
|
||||||
|
[39]:http://tldp.org/
|
||||||
|
[40]:https://www.cyberciti.biz/media/new/tips/2011/12/linuxhomenetworking.png "Linux Home Networking "
|
||||||
|
[41]:http://www.linuxhomenetworking.com/
|
||||||
|
[42]:https://www.cyberciti.biz/media/new/tips/2011/12/linux-action-show.png "Linux Podcast "
|
||||||
|
[43]:http://www.jupiterbroadcasting.com/show/linuxactionshow/
|
||||||
|
[44]:https://www.commandlinefu.com/commands/browse/sort-by-votes
|
||||||
|
[45]:https://www.cyberciti.biz/media/new/tips/2011/12/commandlinefu.png "The best Unix / Linux Commands "
|
||||||
|
[46]:https://commandlinefu.com/
|
||||||
|
[47]:https://www.debian-administration.org/hof
|
||||||
|
[48]:https://www.cyberciti.biz/media/new/tips/2011/12/debian-admin.png "Debian Linux Adminstration: Tips and Tutorial For Sys Admin"
|
||||||
|
[49]:https://www.debian-administration.org/
|
||||||
|
[50]:https://www.cyberciti.biz/media/new/tips/2011/12/catonmat.png "Sed, Awk, Perl Tutorials"
|
||||||
|
[51]:http://www.catonmat.net/blog/worlds-best-introduction-to-sed/
|
||||||
|
[52]:https://www.catonmat.net/blog/sed-one-liners-explained-part-one/
|
||||||
|
[53]:https://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/
|
||||||
|
[54]:https://www.catonmat.net/blog/awk-one-liners-explained-part-one/
|
||||||
|
[55]:https://catonmat.net/
|
||||||
|
[56]:https://www.cyberciti.biz/media/new/tips/2011/12/debian-wiki.png "Debian Linux Tutorials and Wiki"
|
||||||
|
[57]:https://www.debian.org/doc/
|
||||||
|
[58]:https://wiki.debian.org/
|
||||||
|
[59]:https://www.debian.org/support
|
||||||
|
[60]:http://swift.siphos.be/linux_sea/
|
||||||
|
[61]:https://www.cyberciti.biz/media/new/tips/2011/12/orelly.png "Oreilly Free Linux / Unix / Php / Javascript / Ubuntu Books"
|
||||||
|
[62]:http://commons.oreilly.com/wiki/index.php/O%27Reilly_Commons
|
||||||
|
[63]:https://www.cyberciti.biz/media/new/tips/2011/12/ubuntu-guide.png "Ubuntu Book For New Users"
|
||||||
|
[64]:http://ubuntupocketguide.com/
|
||||||
|
[65]:https://www.cyberciti.biz/media/new/tips/2011/12/rute.png "GNU/LINUX system administration free book"
|
||||||
|
[66]:https://web.archive.org/web/20160204213406/http://rute.2038bug.com/rute.html.gz
|
||||||
|
[67]:https://www.cyberciti.biz/media/new/tips/2011/12/advanced-linux-programming.png "Download Advanced Linux Programming PDF version"
|
||||||
|
[68]:https://github.com/MentorEmbedded/advancedlinuxprogramming
|
||||||
|
[69]:https://www.cyberciti.biz/media/new/tips/2011/12/lpic.png "Download Linux Professional Institute Certification PDF Book"
|
||||||
|
[70]:http://academy.delmar.edu/Courses/ITSC1358/eBooks/LPI-101.LinuxTrainingCourseNotes.pdf
|
||||||
|
[71]://www.cyberciti.biz/faq/top5-linux-video-editing-system-software/
|
||||||
|
[72]:https://www.cyberciti.biz/media/new/tips/2011/12/floss-manuals.png "Download manuals about free and open source software"
|
||||||
|
[73]:https://flossmanuals.net/
|
||||||
|
[74]:https://www.cyberciti.biz/media/new/tips/2011/12/linux-starter.png "New to Linux? Start Linux starter book [ PDF version ]"
|
||||||
|
[75]:http://www.tuxradar.com/linuxstarterpack
|
||||||
|
[76]:https://linux.com
|
||||||
|
[77]:https://lwn.net/
|
||||||
|
[78]:http://hints.macworld.com/
|
||||||
|
[79]:https://developer.apple.com/library/mac/navigation/
|
||||||
|
[80]:https://developer.apple.com/library/mac/#documentation/OpenSource/Conceptual/ShellScripting/Introduction/Introduction.html
|
||||||
|
[81]:https://support.apple.com/kb/index?page=search&locale=en_US&q=
|
||||||
|
[82]:https://www.netbsd.org/docs/
|
||||||
|
[83]:https://www.flickr.com/photos/9479603@N02/3311745151/in/set-72157614479572582/
|
||||||
|
[84]:https://twitter.com/nixcraft
|
||||||
|
[85]:https://facebook.com/nixcraft
|
||||||
|
[86]:https://plus.google.com/+CybercitiBiz
|
||||||
|
[87]:https://wiki.centos.org/
|
||||||
|
[88]:https://www.centos.org/forums/
|
||||||
|
[90]: https://www.freebsd.org/docs.html
|
||||||
|
[91]: https://forums.freebsd.org/
|
108
published/20171108 Continuous infrastructure- The other CI.md
Normal file
108
published/20171108 Continuous infrastructure- The other CI.md
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
持续基础设施:另一个 CI
|
||||||
|
======
|
||||||
|
|
||||||
|
> 想要提升你的 DevOps 效率吗?将基础设施当成你的 CI 流程中的重要的一环。
|
||||||
|
|
||||||
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BIZ_darwincloud_520x292_0311LL.png?itok=74DLgd8Q)
|
||||||
|
|
||||||
|
持续交付(CD)和持续集成(CI)是 DevOps 的两个众所周知的方面。但在 CI 大肆流行的今天却忽略了另一个关键性的 "I":<ruby>基础设施<rt>infrastructure</rt></ruby>。
|
||||||
|
|
||||||
|
曾经有一段时间 “基础设施”就意味着<ruby>无头<rt>headless</rt></ruby>的黑盒子、庞大的服务器,和高耸的机架 —— 更不用说漫长的采购流程和对盈余负载的错误估计。后来到了虚拟机时代,把基础设施处理得很好,虚拟化 —— 以前的世界从未有过这样。我们不再需要管理实体的服务器。仅仅是简单的点击,我们就可以创建和销毁、开始和停止、升级和降级我们的服务器。
|
||||||
|
|
||||||
|
有一个关于银行的流行故事:它们实现了数字化,并且引入了在线表格,用户需要手动填写表格、打印,然后邮寄回银行(LCTT 译注:我真的遇到过有人问我这样的需求怎么办)。这就是我们今天基础设施遇到的情况:使用新技术来做和以前一样的事情。
|
||||||
|
|
||||||
|
在这篇文章中,我们会看到在基础设施管理方面的进步,将基础设施视为一个版本化的组件并试着探索<ruby>不可变服务器<rt>immutable server</rt></ruby>的概念。在后面的文章中,我们将了解如何使用开源工具来实现持续的基础设施。
|
||||||
|
|
||||||
|
![continuous infrastructure pipeline][2]
|
||||||
|
|
||||||
|
*实践中的持续集成流程*
|
||||||
|
|
||||||
|
这是我们熟悉的 CI,尽早发布、经常发布的循环流程。这个流程缺少一个关键的组件:基础设施。
|
||||||
|
|
||||||
|
突击小测试:
|
||||||
|
|
||||||
|
* 你怎样创建和升级你的基础设施?
|
||||||
|
* 你怎样控制和追溯基础设施的改变?
|
||||||
|
* 你的基础设施是如何与你的业务进行匹配的?
|
||||||
|
* 你是如何确保在正确的基础设施配置上进行测试的?
|
||||||
|
|
||||||
|
要回答这些问题,就要了解<ruby>持续基础设施<rt>continuous infrastructure</rt></ruby>。把 CI 构建流程分为<ruby>代码持续集成<rt>continuous integration code</rt></ruby>(CIc)和<ruby>基础设施持续集成<rt>continuous integration infrastructure</rt></ruby>(CIi)来并行开发和构建代码和基础设施,再将两者融合到一起进行测试。把基础设施构建视为 CI 流程中的重要的一环。
|
||||||
|
|
||||||
|
![pipeline with infrastructure][4]
|
||||||
|
|
||||||
|
*包含持续基础设施的 CI 流程*
|
||||||
|
|
||||||
|
关于 CIi 定义的几个方面:
|
||||||
|
|
||||||
|
1. 代码
|
||||||
|
|
||||||
|
通过代码来创建基础设施架构,而不是通过安装。<ruby>基础设施如代码<rt>Infrastructure as code</rt></ruby>(IaC)是使用配置脚本创建基础设施的现代最流行的方法。这些脚本遵循典型的编码和单元测试周期(请参阅下面关于 Terraform 脚本的示例)。
|
||||||
|
2. 版本
|
||||||
|
|
||||||
|
IaC 组件在源码仓库中进行版本管理。这让基础设施的拥有了版本控制的所有好处:一致性,可追溯性,分支和标记。
|
||||||
|
3. 管理
|
||||||
|
|
||||||
|
通过编码和版本化的基础设施管理,你可以使用你所熟悉的测试和发布流程来管理基础设施的开发。
|
||||||
|
|
||||||
|
CIi 提供了下面的这些优势:
|
||||||
|
|
||||||
|
1. <ruby>一致性<rt>Consistency</rt></ruby>
|
||||||
|
|
||||||
|
版本化和标记化的基础设施意味着你可以清楚的知道你的系统使用了哪些组件和配置。这建立了一个非常好的 DevOps 实践,用来鉴别和管理基础设施的一致性。
|
||||||
|
2. <ruby>可重现性<rt>Reproducibility</rt></ruby>
|
||||||
|
|
||||||
|
通过基础设施的标记和基线,重建基础设施变得非常容易。想想你是否经常听到这个:“但是它在我的机器上可以运行!”现在,你可以在本地的测试平台中快速重现类似生产环境,从而将环境像变量一样在你的调试过程中删除。
|
||||||
|
3. <ruby>可追溯性<rt>Traceability</rt></ruby>
|
||||||
|
|
||||||
|
你是否还记得曾经有过多少次寻找到底是谁更改了文件夹权限的经历,或者是谁升级了 `ssh` 包?代码化的、版本化的,发布的基础设施消除了临时性变更,为基础设施的管理带来了可追踪性和可预测性。
|
||||||
|
4. <ruby>自动化<rt>Automation</rt></ruby>
|
||||||
|
|
||||||
|
借助脚本化的基础架构,自动化是下一个合乎逻辑的步骤。自动化允许你按需创建基础设施,并在使用完成后销毁它,所以你可以将更多宝贵的时间和精力用在更重要的任务上。
|
||||||
|
5. <ruby>不变性<rt>Immutability</rt></ruby>
|
||||||
|
|
||||||
|
CIi 带来了不可变基础设施等创新。你可以创建一个新的基础设施组件而不是通过升级(请参阅下面有关不可变设施的说明)。
|
||||||
|
|
||||||
|
持续基础设施是从运行基础环境到运行基础组件的进化。像处理代码一样,通过证实的 DevOps 流程来完成。对传统的 CI 的重新定义包含了缺少的那个 “i”,从而形成了连贯的 CD 。
|
||||||
|
|
||||||
|
**(CIc + CIi) = CI -> CD**
|
||||||
|
|
||||||
|
### 基础设施如代码 (IaC)
|
||||||
|
|
||||||
|
CIi 流程的一个关键推动因素是<ruby>基础设施如代码<rt>infrastructure as code</rt></ruby>(IaC)。IaC 是一种使用配置文件进行基础设施创建和升级的机制。这些配置文件像其他的代码一样进行开发,并且使用版本管理系统进行管理。这些文件遵循一般的代码开发流程:单元测试、提交、构建和发布。IaC 流程拥有版本控制带给基础设施开发的所有好处,如标记、版本一致性,和修改可追溯。
|
||||||
|
|
||||||
|
这有一个简单的 Terraform 脚本用来在 AWS 上创建一个双层基础设施的简单示例,包括虚拟私有云(VPC)、弹性负载(ELB),安全组和一个 NGINX 服务器。[Terraform][5] 是一个通过脚本创建和更改基础设施架构和开源工具。
|
||||||
|
|
||||||
|
![terraform script][7]
|
||||||
|
|
||||||
|
*Terraform 脚本创建双层架构设施的简单示例*
|
||||||
|
|
||||||
|
完整的脚本请参见 [GitHub][8]。
|
||||||
|
|
||||||
|
### 不可变基础设施
|
||||||
|
|
||||||
|
你有几个正在运行的虚拟机,需要更新安全补丁。一个常见的做法是推送一个远程脚本单独更新每个系统。
|
||||||
|
|
||||||
|
要是不更新旧系统,如何才能直接丢弃它们并部署安装了新安全补丁的新系统呢?这就是<ruby>不可变基础设施<rt>immutable infrastructure</rt></ruby>。因为之前的基础设施是版本化的、标签化的,所以安装补丁就只是更新该脚本并将其推送到发布流程而已。
|
||||||
|
|
||||||
|
现在你知道为什么要说基础设施在 CI 流程中特别重要了吗?
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/17/11/continuous-infrastructure-other-ci
|
||||||
|
|
||||||
|
作者:[Girish Managoli][a]
|
||||||
|
选题:[lujun9972](https://github.com/lujun9972)
|
||||||
|
译者:[Jamskr](https://github.com/Jamskr)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://opensource.com/users/gammay
|
||||||
|
[1]:/file/376916
|
||||||
|
[2]:https://opensource.com/sites/default/files/images/life-uploads/figure1.jpg (continuous infrastructure pipeline in use)
|
||||||
|
[3]:/file/376921
|
||||||
|
[4]:https://opensource.com/sites/default/files/images/life-uploads/figure2.jpg (CI pipeline with infrastructure)
|
||||||
|
[5]:https://github.com/hashicorp/terraform
|
||||||
|
[6]:/file/376926
|
||||||
|
[7]:https://opensource.com/sites/default/files/images/life-uploads/figure3_0.png (sample terraform script)
|
||||||
|
[8]:https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples/two-tier
|
@ -1,17 +1,15 @@
|
|||||||
对于你的第一行 HTML 代码,让我们来帮助蝙蝠侠写一封情书
|
编写你的第一行 HTML 代码,来帮助蝙蝠侠写一封情书
|
||||||
======
|
======
|
||||||
|
|
||||||
![](https://cdn-images-1.medium.com/max/1000/1*kZxbQJTdb4jn_frfqpRg9g.jpeg)
|
![](https://cdn-images-1.medium.com/max/1000/1*kZxbQJTdb4jn_frfqpRg9g.jpeg)
|
||||||
|
|
||||||
[Image Credit][1]
|
|
||||||
|
|
||||||
在一个美好的夜晚,你的肚子拒绝消化你在晚餐吃的大块披萨,所以你不得不在睡梦中冲进洗手间。
|
在一个美好的夜晚,你的肚子拒绝消化你在晚餐吃的大块披萨,所以你不得不在睡梦中冲进洗手间。
|
||||||
|
|
||||||
在浴室里,当你在思考为什么会发生这种情况时,你听到一个来自通风口的低沉声音:“嘿,我是蝙蝠侠。”
|
在浴室里,当你在思考为什么会发生这种情况时,你听到一个来自通风口的低沉声音:“嘿,我是蝙蝠侠。”
|
||||||
|
|
||||||
这时,你会怎么做呢?
|
这时,你会怎么做呢?
|
||||||
|
|
||||||
在你恐慌并处于关键节点之前,蝙蝠侠说:“我需要你的帮助。我是一个超级极客,但我不懂 HTML。我需要用 HTML 写一封情书,你愿意帮助我吗?”
|
在你恐慌并处于关键时刻之前,蝙蝠侠说:“我需要你的帮助。我是一个超级极客,但我不懂 HTML。我需要用 HTML 写一封情书,你愿意帮助我吗?”
|
||||||
|
|
||||||
谁会拒绝蝙蝠侠的请求呢,对吧?所以让我们用 HTML 来写一封蝙蝠侠的情书。
|
谁会拒绝蝙蝠侠的请求呢,对吧?所以让我们用 HTML 来写一封蝙蝠侠的情书。
|
||||||
|
|
||||||
@ -21,9 +19,9 @@ HTML 网页与你电脑上的其它文件一样。就同一个 .doc 文件以 MS
|
|||||||
|
|
||||||
那么,让我们来创建一个 .html 文件。你可以在 Notepad 或其它任何编辑器中完成此任务,但我建议使用 VS Code。[在这里下载并安装 VS Code][2]。它是免费的,也是我唯一喜欢的微软产品。
|
那么,让我们来创建一个 .html 文件。你可以在 Notepad 或其它任何编辑器中完成此任务,但我建议使用 VS Code。[在这里下载并安装 VS Code][2]。它是免费的,也是我唯一喜欢的微软产品。
|
||||||
|
|
||||||
在系统中创建一个目录,将其命名为 “HTML Practice”(不带引号)。在这个目录中,再创建一个名为 “Batman’s Love Letter”(不带引号)的目录,这将是我们的项目根目录。这意味着我们所有与这个项目相关的文件都会在这里。
|
在系统中创建一个目录,将其命名为 “HTML Practice”(不带引号)。在这个目录中,再创建一个名为 “Batman's Love Letter”(不带引号)的目录,这将是我们的项目根目录。这意味着我们所有与这个项目相关的文件都会在这里。
|
||||||
|
|
||||||
打开 VS Code,按下 ctrl+n 创建一个新文件,按下 ctrl+s 保存文件。切换到 “Batman’s Love Letter” 文件夹并将其命名为 “loveletter.html”,然后单击保存。
|
打开 VS Code,按下 `ctrl+n` 创建一个新文件,按下 `ctrl+s` 保存文件。切换到 “Batman's Love Letter” 文件夹并将其命名为 “loveletter.html”,然后单击保存。
|
||||||
|
|
||||||
现在,如果你在文件资源管理器中双击它,它将在你的默认浏览器中打开。我建议使用 Firefox 来进行 web 开发,但 Chrome 也可以。
|
现在,如果你在文件资源管理器中双击它,它将在你的默认浏览器中打开。我建议使用 Firefox 来进行 web 开发,但 Chrome 也可以。
|
||||||
|
|
||||||
@ -37,7 +35,7 @@ HTML 网页与你电脑上的其它文件一样。就同一个 .doc 文件以 MS
|
|||||||
|
|
||||||
“After all the battles we fought together, after all the difficult times we saw together, and after all the good and bad moments we’ve been through, I think it’s time I let you know how I feel about you.”
|
“After all the battles we fought together, after all the difficult times we saw together, and after all the good and bad moments we’ve been through, I think it’s time I let you know how I feel about you.”
|
||||||
|
|
||||||
复制这些到 VS Code 中的 loveletter.html。单击 View -> Toggle Word Wrap (alt+z) 自动换行。
|
复制这些到 VS Code 中的 loveletter.html。单击 “View -> Toggle Word Wrap (alt+z)” 自动换行。
|
||||||
|
|
||||||
保存并在浏览器中打开它。如果它已经打开,单击浏览器中的刷新按钮。
|
保存并在浏览器中打开它。如果它已经打开,单击浏览器中的刷新按钮。
|
||||||
|
|
||||||
@ -61,7 +59,7 @@ HTML 网页与你电脑上的其它文件一样。就同一个 .doc 文件以 MS
|
|||||||
|
|
||||||
我们不希望这样。没有人想要阅读这么长的行。让我们设定段落宽度为 550px。
|
我们不希望这样。没有人想要阅读这么长的行。让我们设定段落宽度为 550px。
|
||||||
|
|
||||||
我们可以通过使用元素的 “style” 属性来实现。你可以在其 style 属性中定义元素的样式(例如,在我们的示例中为宽度)。以下行将在 “p” 元素上创建一个空样式属性:
|
我们可以通过使用元素的 `style` 属性来实现。你可以在其 `style` 属性中定义元素的样式(例如,在我们的示例中为宽度)。以下行将在 `p` 元素上创建一个空样式属性:
|
||||||
|
|
||||||
```
|
```
|
||||||
<p style="">...</p>
|
<p style="">...</p>
|
||||||
@ -75,23 +73,25 @@ HTML 网页与你电脑上的其它文件一样。就同一个 .doc 文件以 MS
|
|||||||
</p>
|
</p>
|
||||||
```
|
```
|
||||||
|
|
||||||
我们将 “width” 属性设置为 550px,用冒号 “:” 分隔,以分号 “;” 结束。
|
我们将 `width` 属性设置为 `550px`,用冒号 `:` 分隔,以分号 `;` 结束。
|
||||||
|
|
||||||
另外,注意我们如何将 `<p>` 和 `</p>` 放在单独的行中,文本内容用一个 tab 缩进。像这样设置代码使其更具可读性。
|
另外,注意我们如何将 `<p>` 和 `</p>` 放在单独的行中,文本内容用一个制表符缩进。像这样设置代码使其更具可读性。
|
||||||
|
|
||||||
### HTML 中的列表
|
### HTML 中的列表
|
||||||
|
|
||||||
接下来,蝙蝠侠希望列出他所钦佩的人的一些优点,例如:
|
接下来,蝙蝠侠希望列出他所钦佩的人的一些优点,例如:
|
||||||
|
|
||||||
“ You complete my darkness with your light. I love:
|
```
|
||||||
|
You complete my darkness with your light. I love:
|
||||||
- the way you see good in the worst things
|
- the way you see good in the worst things
|
||||||
- the way you handle emotionally difficult situations
|
- the way you handle emotionally difficult situations
|
||||||
- the way you look at Justice
|
- the way you look at Justice
|
||||||
I have learned a lot from you. You have occupied a special place in my heart over time.”
|
I have learned a lot from you. You have occupied a special place in my heart over time.
|
||||||
|
```
|
||||||
|
|
||||||
这看起来很简单。
|
这看起来很简单。
|
||||||
|
|
||||||
让我们继续,在 `</p>:` 下面复制所需的文本:
|
让我们继续,在 `</p>` 下面复制所需的文本:
|
||||||
|
|
||||||
```
|
```
|
||||||
<p style="width:550px;">
|
<p style="width:550px;">
|
||||||
@ -137,11 +137,11 @@ I have learned a lot from you. You have occupied a special place in my heart ove
|
|||||||
|
|
||||||
另外,注意我们没有写一个 `</br>`。有些标签不需要结束标签(它们被称为自闭合标签)。
|
另外,注意我们没有写一个 `</br>`。有些标签不需要结束标签(它们被称为自闭合标签)。
|
||||||
|
|
||||||
还有一件事:我们没有在两个段落之间使用 `<br>`,但第二个段落仍然是从一个新行开始,这是因为 “p” 元素会自动插入换行符。
|
还有一件事:我们没有在两个段落之间使用 `<br>`,但第二个段落仍然是从一个新行开始,这是因为 `<p>` 元素会自动插入换行符。
|
||||||
|
|
||||||
我们使用纯文本编写列表,但是有两个标签可以供我们使用来达到相同的目的:`<ul>` and `<li>`。
|
我们使用纯文本编写列表,但是有两个标签可以供我们使用来达到相同的目的:`<ul>` and `<li>`。
|
||||||
|
|
||||||
为了得到命名(to 校正:这里不太理解):ul 代表无序列表,li 代表列表项目。让我们使用它们来展示我们的列表:
|
让我们解释一下名字的意思:ul 代表<ruby>无序列表<rt>Unordered List</rt></ruby>,li 代表<ruby>列表项目<rt>List Item</rt></ruby>。让我们使用它们来展示我们的列表:
|
||||||
|
|
||||||
```
|
```
|
||||||
<p style="width:550px;">
|
<p style="width:550px;">
|
||||||
@ -164,12 +164,9 @@ I have learned a lot from you. You have occupied a special place in my heart ove
|
|||||||
在复制代码之前,注意差异部分:
|
在复制代码之前,注意差异部分:
|
||||||
|
|
||||||
* 我们删除了所有的 `<br>`,因为每个 `<li>` 会自动显示在新行中
|
* 我们删除了所有的 `<br>`,因为每个 `<li>` 会自动显示在新行中
|
||||||
|
|
||||||
* 我们将每个列表项包含在 `<li>` 和 `</li>` 之间
|
* 我们将每个列表项包含在 `<li>` 和 `</li>` 之间
|
||||||
|
|
||||||
* 我们将所有列表项的集合包裹在 `<ul>` 和 `</ul>` 之间
|
* 我们将所有列表项的集合包裹在 `<ul>` 和 `</ul>` 之间
|
||||||
|
* 我们没有像 `<p>` 元素那样定义 `<ul>` 元素的宽度。这是因为 `<ul>` 是 `<p>` 的子节点,`<p>` 已经被约束到 550px,所以 `<ul>` 不会超出这个范围。
|
||||||
* 我们没有像 “p” 元素那样定义 “ul” 元素的宽度。这是因为 “ul” 是 “p” 的子节点,“p” 已经被约束到 550px,所以 “ul” 不会超出这个范围。
|
|
||||||
|
|
||||||
让我们保存文件并刷新浏览器以查看结果:
|
让我们保存文件并刷新浏览器以查看结果:
|
||||||
|
|
||||||
@ -177,7 +174,7 @@ I have learned a lot from you. You have occupied a special place in my heart ove
|
|||||||
|
|
||||||
你会立即注意到在每个列表项之前显示了重点标志。我们现在不需要在每个列表项之前写 “-”。
|
你会立即注意到在每个列表项之前显示了重点标志。我们现在不需要在每个列表项之前写 “-”。
|
||||||
|
|
||||||
经过仔细检查,你会注意到最后一行超出 550px 宽度。这是为什么?因为 HTML 不允许 “ul” 元素出现在 "p" 元素中。让我们将第一行和最后一行放在单独的 “p” 元素中:
|
经过仔细检查,你会注意到最后一行超出 550px 宽度。这是为什么?因为 HTML 不允许 `<ul>` 元素出现在 `<p>` 元素中。让我们将第一行和最后一行放在单独的 `<p>` 元素中:
|
||||||
|
|
||||||
```
|
```
|
||||||
<p style="width:550px;">
|
<p style="width:550px;">
|
||||||
@ -207,11 +204,11 @@ I have learned a lot from you. You have occupied a special place in my heart ove
|
|||||||
|
|
||||||
保存并刷新。
|
保存并刷新。
|
||||||
|
|
||||||
注意,这次我们还定义了 “ul” 元素的宽度。那是因为我们现在已经将 “ul” 元素放在了 “p” 元素之外。
|
注意,这次我们还定义了 `<ul>` 元素的宽度。那是因为我们现在已经将 `<ul>` 元素放在了 `<p>` 元素之外。
|
||||||
|
|
||||||
定义情书中所有元素的宽度会变得很麻烦。我们有一个特定的元素用于此目的:“div” 元素。一个 “div” 元素就是一个通用容器,用于对内容进行分组,以便轻松设置样式。
|
定义情书中所有元素的宽度会变得很麻烦。我们有一个特定的元素用于此目的:`<div>` 元素。一个 `<div>` 元素就是一个通用容器,用于对内容进行分组,以便轻松设置样式。
|
||||||
|
|
||||||
让我们用 div 元素包装整个情书,并为其赋予宽度:550px
|
让我们用 `<div>` 元素包装整个情书,并为其赋予宽度:550px 。
|
||||||
|
|
||||||
```
|
```
|
||||||
<div style="width:550px;">
|
<div style="width:550px;">
|
||||||
@ -238,11 +235,11 @@ I have learned a lot from you. You have occupied a special place in my heart ove
|
|||||||
|
|
||||||
到目前为止,蝙蝠侠对结果很高兴,他希望在情书上标题。他想写一个标题: “Bat Letter”。当然,你已经看到这个名字了,不是吗?:D
|
到目前为止,蝙蝠侠对结果很高兴,他希望在情书上标题。他想写一个标题: “Bat Letter”。当然,你已经看到这个名字了,不是吗?:D
|
||||||
|
|
||||||
你可以使用 ht, h2, h3, h4, h5 和 h6 标签来添加标题,h1 是最大的标题和最主要的标题,h6 是最小的标题。
|
你可以使用 `<h1>`、`<h2>`、`<h3>`、`<h4>`、`<h5>` 和 `<h6>` 标签来添加标题,`<h1>` 是最大的标题和最主要的标题,`<h6>` 是最小的标题。
|
||||||
|
|
||||||
![](https://cdn-images-1.medium.com/max/1000/1*Ud-NzfT-SrMgur1WX4LCkQ.jpeg)
|
![](https://cdn-images-1.medium.com/max/1000/1*Ud-NzfT-SrMgur1WX4LCkQ.jpeg)
|
||||||
|
|
||||||
让我们在第二段之前使用 h1 做主标题和一个副标题:
|
让我们在第二段之前使用 `<h1>` 做主标题和一个副标题:
|
||||||
|
|
||||||
```
|
```
|
||||||
<div style="width:550px;">
|
<div style="width:550px;">
|
||||||
@ -280,9 +277,9 @@ I have learned a lot from you. You have occupied a special place in my heart ove
|
|||||||
|
|
||||||
所以,让我们在情书中添加一个蝙蝠侠标志。
|
所以,让我们在情书中添加一个蝙蝠侠标志。
|
||||||
|
|
||||||
在 HTML 中包含图像就像在一个 Word 文件中包含图像一样。在 MS Word 中,你到 菜单 -> 插入 -> 图像 -> 然后导航到图像位置为止 -> 选择图像 -> 单击插入。
|
在 HTML 中包含图像就像在一个 Word 文件中包含图像一样。在 MS Word 中,你到 “菜单 -> 插入 -> 图像 -> 然后导航到图像位置为止 -> 选择图像 -> 单击插入”。
|
||||||
|
|
||||||
在 HTML 中,我们使用 `<img>` 标签让浏览器知道我们需要加载的图像,而不是单击菜单。我们在 “src” 属性中写入文件的位置和名称。如果图像在项目根目录中,我们可以简单地在 src 属性中写入图像文件的名称。
|
在 HTML 中,我们使用 `<img>` 标签让浏览器知道我们需要加载的图像,而不是单击菜单。我们在 `src` 属性中写入文件的位置和名称。如果图像在项目根目录中,我们可以简单地在 `src` 属性中写入图像文件的名称。
|
||||||
|
|
||||||
在我们深入编码之前,从[这里][3]下载蝙蝠侠标志。你可能希望裁剪图像中的额外空白区域。复制项目根目录中的图像并将其重命名为 “bat-logo.jpeg”。
|
在我们深入编码之前,从[这里][3]下载蝙蝠侠标志。你可能希望裁剪图像中的额外空白区域。复制项目根目录中的图像并将其重命名为 “bat-logo.jpeg”。
|
||||||
|
|
||||||
@ -311,7 +308,7 @@ I have learned a lot from you. You have occupied a special place in my heart ove
|
|||||||
</div>
|
</div>
|
||||||
```
|
```
|
||||||
|
|
||||||
我们在第 3 行包含了 img 标签。这个标签也是一个自闭合的标签,所以我们不需要写 `</img>`。在 src 属性中,我们给出了图像文件的名称。这个名称应与图像名称完全相同,包括扩展名(.jpeg)及其大小写。
|
我们在第 3 行包含了 `<img>` 标签。这个标签也是一个自闭合的标签,所以我们不需要写 `</img>`。在 `src` 属性中,我们给出了图像文件的名称。这个名称应与图像名称完全相同,包括扩展名(.jpeg)及其大小写。
|
||||||
|
|
||||||
保存并刷新,查看结果。
|
保存并刷新,查看结果。
|
||||||
|
|
||||||
@ -319,7 +316,7 @@ I have learned a lot from you. You have occupied a special place in my heart ove
|
|||||||
|
|
||||||
该死的!刚刚发生了什么?
|
该死的!刚刚发生了什么?
|
||||||
|
|
||||||
当使用 img 标签包含图像时,默认情况下,图像将以其原始分辨率显示。在我们的例子中,图像比 550px 宽得多。让我们使用 style 属性定义它的宽度:
|
当使用 `<img>` 标签包含图像时,默认情况下,图像将以其原始分辨率显示。在我们的例子中,图像比 550px 宽得多。让我们使用 `style` 属性定义它的宽度:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -353,7 +350,7 @@ I have learned a lot from you. You have occupied a special place in my heart ove
|
|||||||
|
|
||||||
![](https://cdn-images-1.medium.com/max/1000/1*5c0ngx3BFVlyyP6UNtfYyg.jpeg)
|
![](https://cdn-images-1.medium.com/max/1000/1*5c0ngx3BFVlyyP6UNtfYyg.jpeg)
|
||||||
|
|
||||||
太棒了!这给蝙蝠侠的脸带来了胆怯的微笑 :)。(to 校正:这里什么意思)
|
太棒了!这让蝙蝠侠的脸露出了羞涩的微笑 :)。
|
||||||
|
|
||||||
### HTML 中的粗体和斜体
|
### HTML 中的粗体和斜体
|
||||||
|
|
||||||
@ -373,7 +370,7 @@ I don’t show my emotions, but I think this man behind the mask is falling for
|
|||||||
|
|
||||||
你说:哦!我还以为是给神奇女侠的呢。
|
你说:哦!我还以为是给神奇女侠的呢。
|
||||||
|
|
||||||
蝙蝠侠说:不,这是给超人的,请在最后写上“I love you Superman.”。
|
蝙蝠侠说:不,这是给超人的,请在最后写上 “I love you Superman.”。
|
||||||
|
|
||||||
好的,我们来写:
|
好的,我们来写:
|
||||||
|
|
||||||
@ -462,13 +459,11 @@ I don’t show my emotions, but I think this man behind the mask is falling for
|
|||||||
|
|
||||||
你可以通过三种方式设置样式或定义 HTML 元素的外观:
|
你可以通过三种方式设置样式或定义 HTML 元素的外观:
|
||||||
|
|
||||||
* 内联样式:我们使用元素的 “style” 属性来编写样式。这是我们迄今为止使用的,但这不是一个好的实践。
|
* 内联样式:我们使用元素的 `style` 属性来编写样式。这是我们迄今为止使用的,但这不是一个好的实践。
|
||||||
|
* 嵌入式样式:我们在由 `<style>` 和 `</style>` 包裹的 “style” 元素中编写所有样式。
|
||||||
* 嵌入式样式:我们在由 <style> 和 </style> 包裹的 “style” 元素中编写所有样式。
|
|
||||||
|
|
||||||
* 链接样式表:我们在具有 .css 扩展名的单独文件中编写所有元素的样式。此文件称为样式表。
|
* 链接样式表:我们在具有 .css 扩展名的单独文件中编写所有元素的样式。此文件称为样式表。
|
||||||
|
|
||||||
让我们来看看如何定义 “div” 的内联样式:
|
让我们来看看如何定义 `<div>` 的内联样式:
|
||||||
|
|
||||||
```
|
```
|
||||||
<div style="width:550px;">
|
<div style="width:550px;">
|
||||||
@ -484,9 +479,9 @@ div{
|
|||||||
|
|
||||||
在嵌入式样式中,我们编写的样式是与元素分开的。所以我们需要一种方法来关联元素及其样式。第一个单词 “div” 就做了这样的活。它让浏览器知道花括号 `{...}` 里面的所有样式都属于 “div” 元素。由于这种语法确定要应用样式的元素,因此它称为一个选择器。
|
在嵌入式样式中,我们编写的样式是与元素分开的。所以我们需要一种方法来关联元素及其样式。第一个单词 “div” 就做了这样的活。它让浏览器知道花括号 `{...}` 里面的所有样式都属于 “div” 元素。由于这种语法确定要应用样式的元素,因此它称为一个选择器。
|
||||||
|
|
||||||
我们编写样式的方式保持不变:属性(宽度)和值(550px)用冒号(:)分隔,以分号(;)结束。
|
我们编写样式的方式保持不变:属性(`width`)和值(`550px`)用冒号(`:`)分隔,以分号(`;`)结束。
|
||||||
|
|
||||||
让我们从 “div” 和 “img” 元素中删除内联样式,将其写入 `<style>` 元素:
|
让我们从 `<div>` 和 `<img>` 元素中删除内联样式,将其写入 `<style>` 元素:
|
||||||
|
|
||||||
```
|
```
|
||||||
<style>
|
<style>
|
||||||
@ -538,11 +533,11 @@ div{
|
|||||||
|
|
||||||
保存并刷新,结果应保持不变。
|
保存并刷新,结果应保持不变。
|
||||||
|
|
||||||
但是有一个大问题,如果我们的 HTML 文件中有多个 “div” 和 “img” 元素该怎么办?这样我们在 “style” 元素中为 div 和 img 定义的样式就会应用于页面上的每个 div 和 img。
|
但是有一个大问题,如果我们的 HTML 文件中有多个 `<div>` 和 `<img>` 元素该怎么办?这样我们在 `<style>` 元素中为 div 和 img 定义的样式就会应用于页面上的每个 div 和 img。
|
||||||
|
|
||||||
如果你在以后的代码中添加另一个 div,那么该 div 也将变为 550px 宽。我们并不希望这样。
|
如果你在以后的代码中添加另一个 div,那么该 div 也将变为 550px 宽。我们并不希望这样。
|
||||||
|
|
||||||
我们想要将我们的样式应用于现在正在使用的特定 div 和 img。为此,我们需要为 div 和 img 元素提供唯一的 id。以下是使用 “id” 属性为元素赋予 id 的方法:
|
我们想要将我们的样式应用于现在正在使用的特定 div 和 img。为此,我们需要为 div 和 img 元素提供唯一的 id。以下是使用 `id` 属性为元素赋予 id 的方法:
|
||||||
|
|
||||||
```
|
```
|
||||||
<div id="letter-container">
|
<div id="letter-container">
|
||||||
@ -556,7 +551,7 @@ div{
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
注意 “#” 符号。它表示它是一个 id,{...} 中的样式应该只应用于具有该特定 id 的元素。
|
注意 `#` 符号。它表示它是一个 id,`{...}` 中的样式应该只应用于具有该特定 id 的元素。
|
||||||
|
|
||||||
让我们来应用它:
|
让我们来应用它:
|
||||||
|
|
||||||
@ -610,11 +605,11 @@ div{
|
|||||||
|
|
||||||
HTML 已经准备好了嵌入式样式。
|
HTML 已经准备好了嵌入式样式。
|
||||||
|
|
||||||
但是,你可以看到,随着我们包含越来越多的样式,<style></style> 将变得很大。这可能很快会混乱我们的主 HTML 文件。
|
但是,你可以看到,随着我们包含越来越多的样式,`<style></style>` 将变得很大。这可能很快会混乱我们的主 HTML 文件。
|
||||||
|
|
||||||
因此,让我们更进一步,通过将 style 标签内的内容复制到一个新文件来使用链接样式。
|
因此,让我们更进一步,通过将 `<style>` 标签内的内容复制到一个新文件来使用链接样式。
|
||||||
|
|
||||||
在项目根目录中创建一个新文件,将其另存为 style.css:
|
在项目根目录中创建一个新文件,将其另存为 “style.css”:
|
||||||
|
|
||||||
```
|
```
|
||||||
#letter-container{
|
#letter-container{
|
||||||
@ -633,15 +628,13 @@ HTML 已经准备好了嵌入式样式。
|
|||||||
<link rel="stylesheet" type="text/css" href="style.css">
|
<link rel="stylesheet" type="text/css" href="style.css">
|
||||||
```
|
```
|
||||||
|
|
||||||
我们使用 link 元素在 HTML 文档中包含外部资源,它主要用于链接样式表。我们使用的三个属性是:
|
我们使用 `<link>` 元素在 HTML 文档中包含外部资源,它主要用于链接样式表。我们使用的三个属性是:
|
||||||
|
|
||||||
* rel:关系。链接文件与文档的关系。具有 .css 扩展名的文件称为样式表,因此我们保留 rel=“stylesheet”。
|
* `rel`:关系。链接文件与文档的关系。具有 .css 扩展名的文件称为样式表,因此我们保留 rel=“stylesheet”。
|
||||||
|
* `type`:链接文件的类型;对于一个 CSS 文件来说它是 “text/css”。
|
||||||
|
* `href`:超文本参考。链接文件的位置。
|
||||||
|
|
||||||
* type:链接文件的类型;对于一个 CSS 文件来说它是 “text/css”。
|
link 元素的结尾没有 `</link>`。因此,`<link>` 也是一个自闭合的标签。
|
||||||
|
|
||||||
* href:超文本参考。链接文件的位置。
|
|
||||||
|
|
||||||
link 元素的结尾没有 </link>。因此,<link> 也是一个自闭合的标签。
|
|
||||||
|
|
||||||
```
|
```
|
||||||
<link rel="gf" type="cute" href="girl.next.door">
|
<link rel="gf" type="cute" href="girl.next.door">
|
||||||
@ -651,7 +644,7 @@ link 元素的结尾没有 </link>。因此,<link> 也是一个自闭合的标
|
|||||||
|
|
||||||
可惜没有那么简单,让我们继续前进。
|
可惜没有那么简单,让我们继续前进。
|
||||||
|
|
||||||
这是我们 loveletter.html 的内容:
|
这是我们 “loveletter.html” 的内容:
|
||||||
|
|
||||||
```
|
```
|
||||||
<link rel="stylesheet" type="text/css" href="style.css">
|
<link rel="stylesheet" type="text/css" href="style.css">
|
||||||
@ -688,7 +681,7 @@ link 元素的结尾没有 </link>。因此,<link> 也是一个自闭合的标
|
|||||||
</div>
|
</div>
|
||||||
```
|
```
|
||||||
|
|
||||||
style.css 内容:
|
“style.css” 内容:
|
||||||
|
|
||||||
```
|
```
|
||||||
#letter-container{
|
#letter-container{
|
||||||
@ -701,7 +694,6 @@ style.css 内容:
|
|||||||
|
|
||||||
保存文件并刷新,浏览器中的输出应保持不变。
|
保存文件并刷新,浏览器中的输出应保持不变。
|
||||||
|
|
||||||
|
|
||||||
### 一些手续
|
### 一些手续
|
||||||
|
|
||||||
我们的情书已经准备好给蝙蝠侠,但还有一些正式的片段。
|
我们的情书已经准备好给蝙蝠侠,但还有一些正式的片段。
|
||||||
@ -710,7 +702,7 @@ style.css 内容:
|
|||||||
|
|
||||||
那么,浏览器如何知道你使用哪个版本的 HTML 来编写页面呢?要告诉浏览器你正在使用 HTML5,你需要在页面顶部包含 `<!DOCTYPE html>`。对于旧版本的 HTML,这行不同,但你不需要了解它们,因为我们不再使用它们了。
|
那么,浏览器如何知道你使用哪个版本的 HTML 来编写页面呢?要告诉浏览器你正在使用 HTML5,你需要在页面顶部包含 `<!DOCTYPE html>`。对于旧版本的 HTML,这行不同,但你不需要了解它们,因为我们不再使用它们了。
|
||||||
|
|
||||||
此外,在之前的 HTML 版本中,我们曾经将整个文档封装在 `<html></html>` 标签内。整个文件分为两个主要部分:Head 在 `<head></head>` 里面,Body 在 `<body></body>` 里面。这在 HTML5 中不是必须的,但由于兼容性原因,我们仍然这样做。让我们用 `<Doctype>`, `<html>`, `<head>` 和 `<body>` 更新我们的代码:
|
此外,在之前的 HTML 版本中,我们曾经将整个文档封装在 `<html></html>` 标签内。整个文件分为两个主要部分:头部在 `<head></head>` 里面,主体在 `<body></body>` 里面。这在 HTML5 中不是必须的,但由于兼容性原因,我们仍然这样做。让我们用 `<Doctype>`, `<html>`、 `<head>` 和 `<body>` 更新我们的代码:
|
||||||
|
|
||||||
```
|
```
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -754,7 +746,7 @@ style.css 内容:
|
|||||||
</html>
|
</html>
|
||||||
```
|
```
|
||||||
|
|
||||||
主要内容在 `<body>` 里面,元信息在 `<head>` 里面。所以我们把 div 保存在 `<body>` 里面并加载 `<head>` 里面的样式表。
|
主要内容在 `<body>` 里面,元信息在 `<head>` 里面。所以我们把 `<div>` 保存在 `<body>` 里面并加载 `<head>` 里面的样式表。
|
||||||
|
|
||||||
保存并刷新,你的 HTML 页面应显示与之前相同的内容。
|
保存并刷新,你的 HTML 页面应显示与之前相同的内容。
|
||||||
|
|
||||||
@ -766,7 +758,7 @@ style.css 内容:
|
|||||||
|
|
||||||
![](https://cdn-images-1.medium.com/max/1000/1*PASKm4ji29hbcZXVSP8afg.jpeg)
|
![](https://cdn-images-1.medium.com/max/1000/1*PASKm4ji29hbcZXVSP8afg.jpeg)
|
||||||
|
|
||||||
我们可以使用 `<title>` 标签来定义 HTML 文件的标题。标题标签也像链接标签一样在 head 内部。让我们我们在标题中加上 “Bat Letter”:
|
我们可以使用 `<title>` 标签来定义 HTML 文件的标题。标题标签也像链接标签一样在 `<head>` 内部。让我们我们在标题中加上 “Bat Letter”:
|
||||||
|
|
||||||
```
|
```
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -824,70 +816,41 @@ style.css 内容:
|
|||||||
我们学习了以下新概念:
|
我们学习了以下新概念:
|
||||||
|
|
||||||
* 一个 HTML 文档的结构
|
* 一个 HTML 文档的结构
|
||||||
|
* 在 HTML 中如何写元素(`<p></p>`)
|
||||||
* 在 HTML 中如何写元素(\<p>\</p>)
|
|
||||||
|
|
||||||
* 如何使用 style 属性在元素内编写样式(这称为内联样式,尽可能避免这种情况)
|
* 如何使用 style 属性在元素内编写样式(这称为内联样式,尽可能避免这种情况)
|
||||||
|
* 如何在 `<style>...</style>` 中编写元素的样式(这称为嵌入式样式)
|
||||||
* 如何在 <style>...</style> 中编写元素的样式(这称为嵌入式样式)
|
* 在 HTML 中如何使用 `<link>` 在单独的文件中编写样式并链接它(这称为链接样式表)
|
||||||
|
|
||||||
* 在 HTML 中如何使用 <link> 在单独的文件中编写样式并链接它(这称为链接样式表)
|
|
||||||
|
|
||||||
* 什么是标签名称,属性,开始标签和结束标签
|
* 什么是标签名称,属性,开始标签和结束标签
|
||||||
|
|
||||||
* 如何使用 id 属性为一个元素赋予 id
|
* 如何使用 id 属性为一个元素赋予 id
|
||||||
|
|
||||||
* CSS 中的标签选择器和 id 选择器
|
* CSS 中的标签选择器和 id 选择器
|
||||||
|
|
||||||
我们学习了以下 HTML 标签:
|
我们学习了以下 HTML 标签:
|
||||||
|
|
||||||
* \<p>:用于段落
|
* `<p>`:用于段落
|
||||||
|
* `<br>`:用于换行
|
||||||
|
* `<ul>`、`<li>`:显示列表
|
||||||
|
* `<div>`:用于分组我们信件的元素
|
||||||
|
* `<h1>`、`<h2>`:用于标题和子标题
|
||||||
|
* `<img>`:用于插入图像
|
||||||
|
* `<strong>`、`<em>`:用于粗体和斜体文字样式
|
||||||
|
* `<style>`:用于嵌入式样式
|
||||||
|
* `<link>`:用于包含外部样式表
|
||||||
|
* `<html>`:用于包裹整个 HTML 文档
|
||||||
|
* `<!DOCTYPE html>`:让浏览器知道我们正在使用 HTML5
|
||||||
|
* `<head>`:包裹元信息,如 `<link>` 和 `<title>`
|
||||||
|
* `<body>`:用于实际显示的 HTML 页面的主体
|
||||||
|
* `<title>`:用于 HTML 页面的标题
|
||||||
|
|
||||||
* \<br>:用于换行
|
我们学习了以下 CSS 属性:
|
||||||
|
|
||||||
* \<ul>, \<li>:显示列表
|
|
||||||
|
|
||||||
* \<div>:用于分组我们信件的元素
|
|
||||||
|
|
||||||
* \<h1>, \<h2>:用于标题和子标题
|
|
||||||
|
|
||||||
* \<img>:用于插入图像
|
|
||||||
|
|
||||||
* \<strong>, \<em>:用于粗体和斜体文字样式
|
|
||||||
|
|
||||||
* \<style>:用于嵌入式样式
|
|
||||||
|
|
||||||
* \<link>:用于包含外部样式表
|
|
||||||
|
|
||||||
* \<html>:用于包裹整个 HTML 文档
|
|
||||||
|
|
||||||
* \<!DOCTYPE html>:让浏览器知道我们正在使用 HTML5
|
|
||||||
|
|
||||||
* \<head>:包裹元信息,如 \<link> 和 \<title>
|
|
||||||
|
|
||||||
* \<body>:用于实际显示的 HTML 页面的主体
|
|
||||||
|
|
||||||
* \<title>:用于 HTML 页面的标题
|
|
||||||
|
|
||||||
我们学习了以下 CSS 属性:
|
|
||||||
|
|
||||||
* width:用于定义元素的宽度
|
* width:用于定义元素的宽度
|
||||||
|
|
||||||
* CSS 单位:“px” 和 “%”
|
* CSS 单位:“px” 和 “%”
|
||||||
|
|
||||||
朋友们,这就是今天的全部了,下一个教程中见。
|
朋友们,这就是今天的全部了,下一个教程中见。
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
想通过有趣且引人入胜的教程学习 Web 开发?
|
|
||||||
|
|
||||||
[点击这里获取每周新的 Web 开发教程][4]
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
作者简介:
|
作者简介:开发者 + 作者 | supersarkar.com | twitter.com/supersarkar
|
||||||
|
|
||||||
开发者 + 作者 | supersarkar.com | twitter.com/supersarkar
|
|
||||||
|
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
@ -895,7 +858,8 @@ via: https://medium.freecodecamp.org/for-your-first-html-code-lets-help-batman-w
|
|||||||
|
|
||||||
作者:[Kunal Sarkar][a]
|
作者:[Kunal Sarkar][a]
|
||||||
译者:[MjSeven](https://github.com/MjSeven)
|
译者:[MjSeven](https://github.com/MjSeven)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
[a]:https://medium.freecodecamp.org/@supersarkar
|
[a]:https://medium.freecodecamp.org/@supersarkar
|
177
published/20180228 Emacs -2- Introducing org-mode.md
Normal file
177
published/20180228 Emacs -2- Introducing org-mode.md
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (oneforalone)
|
||||||
|
[#]: reviewer: (wxy)
|
||||||
|
[#]: publisher: (wxy)
|
||||||
|
[#]: subject: (Emacs #2: Introducing org-mode)
|
||||||
|
[#]: via: (https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode)
|
||||||
|
[#]: author: (John Goerzen http://changelog.complete.org/archives/author/jgoerzen)
|
||||||
|
[#]: url: (https://linux.cn/article-10312-1.html)
|
||||||
|
|
||||||
|
Emacs 系列(二):org 模式介绍
|
||||||
|
======
|
||||||
|
|
||||||
|
在我 Emacs 系列中的[第一篇文章][1]里,我介绍了我在用了几十年的 vim 后转向了 Emacs,org 模式就是我为什么这样做的原因。
|
||||||
|
|
||||||
|
org 模式的精简和高效真的震惊了我,它真的是个“杀手”应用。
|
||||||
|
|
||||||
|
### 所以,org 模式到底是什么呢?
|
||||||
|
|
||||||
|
这是我昨天写的:
|
||||||
|
|
||||||
|
> 它是一个组织信息的平台,它的主页上这样写着:“一切都是纯文本:org 模式用于记笔记、维护待办事项列表、计划项目和使用快速有效的纯文本系统编写文档。”
|
||||||
|
|
||||||
|
这是事实,但并不是很准确。org 模式是一个你用来组织事务的小工具。它有一些非常合理的默认设置,但也允许你自己定制。
|
||||||
|
|
||||||
|
主要突出在这几件事上:
|
||||||
|
|
||||||
|
* **维护待办事项列表**:项目可以分散在 org 文件中,包含附件,有标签、截止日期、时间表。有一个方便的“日程”视图,显示需要做什么。项目也可以重复。
|
||||||
|
* **编写文档**:org 模式有个特殊的功能来生成 HTML、LaTeX、幻灯片(用 LaTeX beamer)和其他所有的格式。它也支持直接在缓冲区中运行和以 Emacs 所支持的的语言进行<ruby>文学编程<rt>literate programming</rt></ruby>。如果你想要深入了解这项功能的话,参阅[这篇文学式 DevOps 的文章][2]。而 [整个 Worg 网站][3] 是用 org 模式开发的。
|
||||||
|
* **记笔记**:对,它也能做笔记。通过全文搜索,文件的交叉引用(类似 wiki),UUID,甚至可以与其他的系统进行交互(通过 Message-ID 与 mu4e 交互,通过 ERC 的日志等等……)。
|
||||||
|
|
||||||
|
### 入门
|
||||||
|
|
||||||
|
我强烈建议去阅读 [Carsten Dominik 关于 org 模式的一篇很棒的 Google 讲话][4]。那篇文章真的很赞。
|
||||||
|
|
||||||
|
在 Emacs 中带有 org 模式,但如果你想要个比较新的版本的话,Debian 用户可以使用命令 `apt-get install org-mode` 来更新,或者使用 Emacs 的包管理系统命令 `M-x package-install RET org-mode RET`。
|
||||||
|
|
||||||
|
现在,你可能需要阅读一下 org 模式的精简版教程中的[导读部分][5],特别注意,你要设置下[启动部分][6]中提到的那些键的绑定。
|
||||||
|
|
||||||
|
### 一份好的教程
|
||||||
|
|
||||||
|
我会给出一些好的教程和介绍的链接,但这篇文章不会是一篇教程。特别是在本文末尾,有两个很不错的视频链接。
|
||||||
|
|
||||||
|
### 我的一些配置
|
||||||
|
|
||||||
|
我将在这里记录下一些我的配置并介绍它的作用。你没有必要每行每句将它拷贝到你的配置中 —— 这只是一个参考,告诉你哪些可以配置,要怎么在手册中查找,或许只是一个“我现在该怎么做”的参考。
|
||||||
|
|
||||||
|
首先,我将 Emacs 的编码默认设置为 UTF-8。
|
||||||
|
|
||||||
|
```
|
||||||
|
(prefer-coding-system 'utf-8)
|
||||||
|
(set-language-environment "UTF-8")
|
||||||
|
```
|
||||||
|
|
||||||
|
org 模式中可以打开 URL。默认的,它会在 Firefox 中打开,但我喜欢用 Chromium。
|
||||||
|
|
||||||
|
```
|
||||||
|
(setq browse-url-browser-function 'browse-url-chromium)
|
||||||
|
```
|
||||||
|
|
||||||
|
我把基本的键的绑定和设为教程里的一样,再加上 `M-RET` 的操作的配置。
|
||||||
|
|
||||||
|
```
|
||||||
|
(global-set-key "\C-cl" 'org-store-link)
|
||||||
|
(global-set-key "\C-ca" 'org-agenda)
|
||||||
|
(global-set-key "\C-cc" 'org-capture)
|
||||||
|
(global-set-key "\C-cb" 'org-iswitchb)
|
||||||
|
|
||||||
|
(setq org-M-RET-may-split-line nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### 捕获配置
|
||||||
|
|
||||||
|
我可以在 Emacs 的任何模式中按 `C-c c`,按下后它就会[帮我捕获某些事][7],其中包括一个指向我正在处理事务的链接。
|
||||||
|
|
||||||
|
你可以通过定义[捕获模板][8]来配置它。我将保存两个日志文件,作为会议、电话等的通用记录。一个是私人用的,一个是办公用的。如果我按下 `C-c c j`,它就会帮我捕获为私人项. 下面包含 `%a` 的配置是表示我当前的位置(或是我使用 `C-c l` 保存的链接)的链接。
|
||||||
|
|
||||||
|
```
|
||||||
|
(setq org-default-notes-file "~/org/tasks.org")
|
||||||
|
(setq org-capture-templates
|
||||||
|
'(
|
||||||
|
("t" "Todo" entry (file+headline "inbox.org" "Tasks")
|
||||||
|
"* TODO %?\n %i\n %u\n %a")
|
||||||
|
("n" "Note/Data" entry (file+headline "inbox.org" "Notes/Data")
|
||||||
|
"* %? \n %i\n %u\n %a")
|
||||||
|
("j" "Journal" entry (file+datetree "~/org/journal.org")
|
||||||
|
"* %?\nEntered on %U\n %i\n %a")
|
||||||
|
("J" "Work-Journal" entry (file+datetree "~/org/wjournal.org")
|
||||||
|
"* %?\nEntered on %U\n %i\n %a")
|
||||||
|
))
|
||||||
|
(setq org-irc-link-to-logs t)
|
||||||
|
```
|
||||||
|
|
||||||
|
我喜欢通过 UUID 来建立链接,这让我在文件之间移动而不会破坏位置。当我要 org 存储一个链接目标以便将来插入时,以下配置有助于生成 UUID。
|
||||||
|
|
||||||
|
```
|
||||||
|
(require 'org-id)
|
||||||
|
(setq org-id-link-to-org-use-id 'create-if-interactive)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 议程配置
|
||||||
|
|
||||||
|
我喜欢将星期天作为一周的开始,当我将某件事标记为完成时,我也喜欢记下时间。
|
||||||
|
|
||||||
|
```
|
||||||
|
(setq org-log-done 'time)
|
||||||
|
(setq org-agenda-start-on-weekday 0)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 文件归档配置
|
||||||
|
|
||||||
|
在这我将配置它,让它知道在议程中该使用哪些文件,而且在纯文本的搜索中添加一点点小功能。我喜欢保留一个通用的文件夹(我可以从其中移动或“重新归档”内容),然后将个人和工作项的任务、日志和知识库分开。
|
||||||
|
|
||||||
|
```
|
||||||
|
(setq org-agenda-files (list "~/org/inbox.org"
|
||||||
|
"~/org/email.org"
|
||||||
|
"~/org/tasks.org"
|
||||||
|
"~/org/wtasks.org"
|
||||||
|
"~/org/journal.org"
|
||||||
|
"~/org/wjournal.org"
|
||||||
|
"~/org/kb.org"
|
||||||
|
"~/org/wkb.org"
|
||||||
|
))
|
||||||
|
(setq org-agenda-text-search-extra-files
|
||||||
|
(list "~/org/someday.org"
|
||||||
|
"~/org/config.org"
|
||||||
|
))
|
||||||
|
|
||||||
|
(setq org-refile-targets '((nil :maxlevel . 2)
|
||||||
|
(org-agenda-files :maxlevel . 2)
|
||||||
|
("~/org/someday.org" :maxlevel . 2)
|
||||||
|
("~/org/templates.org" :maxlevel . 2)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(setq org-outline-path-complete-in-steps nil) ; Refile in a single go
|
||||||
|
(setq org-refile-use-outline-path 'file)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 外观配置
|
||||||
|
|
||||||
|
我喜欢一个较漂亮的的屏幕。在你开始习惯 org 模式之后,你可以试试这个。
|
||||||
|
|
||||||
|
```
|
||||||
|
(add-hook 'org-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(org-bullets-mode t)))
|
||||||
|
(setq org-ellipsis "⤵")
|
||||||
|
```
|
||||||
|
|
||||||
|
### 下一篇
|
||||||
|
|
||||||
|
希望这篇文章展示了 org 模式的一些功能。接下来,我将介绍如何定制 `TODO` 关键字和标记、归档旧任务、将电子邮件转发到 org 模式,以及如何使用 `git` 在不同电脑之间进行同步。
|
||||||
|
|
||||||
|
你也可以查看[本系列的所有文章列表][9]。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode
|
||||||
|
|
||||||
|
作者:[John Goerzen][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[oneforalone](https://github.com/oneforalone)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: http://changelog.complete.org/archives/author/jgoerzen
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://linux.cn/article-10297-1.html
|
||||||
|
[2]: http://www.howardism.org/Technical/Emacs/literate-devops.html
|
||||||
|
[3]: https://orgmode.org/worg/
|
||||||
|
[4]: https://www.youtube.com/watch?v=oJTwQvgfgMM
|
||||||
|
[5]: https://orgmode.org/guide/Introduction.html#Introduction
|
||||||
|
[6]: https://orgmode.org/guide/Activation.html#Activation
|
||||||
|
[7]: https://orgmode.org/guide/Capture.html#Capture
|
||||||
|
[8]: https://orgmode.org/guide/Capture-templates.html#Capture-templates
|
||||||
|
[9]: https://changelog.complete.org/archives/tag/emacs2018
|
@ -1,38 +1,40 @@
|
|||||||
如何实现 Linux + Windows 双系统启动
|
如何实现 Linux + Windows 双系统启动
|
||||||
=====
|
=====
|
||||||
|
> 设置你的计算机根据需要启动 Windows 10 或 Ubuntu 18.04。
|
||||||
|
|
||||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/migration_innovation_computer_software.png?itok=VCFLtd0q)
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/migration_innovation_computer_software.png?itok=VCFLtd0q)
|
||||||
|
|
||||||
尽管 Linux 是一个有着广泛的硬件和软件支持的操作系统,但事实上有时你仍需要使用 Windows,也许是因为有些不能在 Linux 下运行的重要软件。但幸运地是, 双启动 Windows 和 Linux 是很简单的—在这篇文章中我将会向你展示如何实现 Windows 10 + Ubuntu 18.04 双系统启动。
|
尽管 Linux 是一个有着广泛的硬件和软件支持的操作系统,但事实上有时你仍需要使用 Windows,也许是因为有些不能在 Linux 下运行的重要软件。但幸运地是,双启动 Windows 和 Linux 是很简单的 —— 在这篇文章中我将会向你展示如何实现 Windows 10 + Ubuntu 18.04 双系统启动。
|
||||||
|
|
||||||
在你开始之前,确保你已经备份了你的电脑文件。 虽然设置双启动过程不是非常复杂,但意外有可能仍会发生。所以花一点时间来备份你的重要文件以防混沌理论发挥作用。除了备份你的文件之外,考虑制作一份备份镜像也是个不错的选择,虽然这不是必需的且会变成一个更高级的过程。
|
在你开始之前,确保你已经备份了你的电脑文件。虽然设置双启动过程不是非常复杂,但意外有可能仍会发生。所以花一点时间来备份你的重要文件以防混沌理论发挥作用。除了备份你的文件之外,考虑制作一份备份镜像也是个不错的选择,虽然这不是必需的且会变成一个更高级的过程。
|
||||||
|
|
||||||
### 要求
|
### 要求
|
||||||
|
|
||||||
为了开始,你将需要以下5项东西:
|
为了开始,你将需要以下 5 项东西:
|
||||||
|
|
||||||
#### 1\. 两个 USB 闪存盘(或者 DVD-Rs)
|
#### 1、两个 USB 闪存盘(或者 DVD-R)
|
||||||
|
|
||||||
我推荐用 USB 闪存盘来安装 Windows 和 Ubuntu,因为他们比 DVDs 更快。这通常是毋庸置疑的, 但是创建一个可启动的介质会抹除闪存盘上的一切东西。因此,确保闪存盘是空的或者其包含的文件是你不再需要的。
|
我推荐用 USB 闪存盘来安装 Windows 和 Ubuntu,因为他们比 DVD 更快。这通常是毋庸置疑的, 但是创建一个可启动的介质会抹除闪存盘上的一切东西。因此,确保闪存盘是空的或者其包含的文件是你不再需要的。
|
||||||
|
|
||||||
如果你的电脑不支持从 USB 启动,你可以创建 DVD 介质来代替。不幸的是, 因为没有两台电脑似乎有相同的 DVD 烧录软件,所以我无法引导这一过程。 然而,如果你的 DVD 烧录软件有从一个 ISO 镜像中烧录的选项,这个选项是你需要的。
|
如果你的电脑不支持从 USB 启动,你可以创建 DVD 介质来代替。不幸的是,因为电脑上的 DVD 烧录软件似乎各有不同,所以我无法使用这一过程。然而,如果你的 DVD 烧录软件有从一个 ISO 镜像中烧录的选项,这个选项是你需要的。
|
||||||
|
|
||||||
#### 2\. 一份 Windows 10 许可证
|
#### 2、一份 Windows 10 许可证
|
||||||
|
|
||||||
如果你的电脑已经安装 Windows 10,那么许可证将会被安装到你的电脑中,所以你不需要担心在安装过程中输入它。如果你购买的是零售版,你应该拥有一个需要在安装过程中输入的产品密钥。
|
如果你的电脑已经安装 Windows 10,那么许可证将会被安装到你的电脑中,所以你不需要担心在安装过程中输入它。如果你购买的是零售版,你应该拥有一个需要在安装过程中输入的产品密钥。
|
||||||
|
|
||||||
#### 3\. Windows 10介质创建工具
|
#### 3、Windows 10 介质创建工具
|
||||||
|
|
||||||
下载并运行 Windows 10 [介质创建工具][1]。一旦你运行这个工具,它将会引导你完成在一个 USB 或者 DVD-R 上创建 Windows 安装介质的所需步骤。注意: 即使你已经安装了 Windows 10 。总之创建一个可引导的介质是一个不错的主意,万一刚好系统出错了且需要你重新安装。
|
下载并运行 Windows 10 [介质创建工具][1]。一旦你运行这个工具,它将会引导你完成在一个 USB 或者 DVD-R 上创建 Windows 安装介质的所需步骤。注意:即使你已经安装了 Windows 10,创建一个可引导的介质也是一个不错的主意,万一刚好系统出错了且需要你重新安装。
|
||||||
|
|
||||||
#### 4\. Ubuntu 18.04 安装介质
|
#### 4、Ubuntu 18.04 安装介质
|
||||||
|
|
||||||
下载 [Ubuntu 18.04][2] ISO 镜像。
|
下载 [Ubuntu 18.04][2] ISO 镜像。
|
||||||
|
|
||||||
#### 5\. Etcher 软件(用于制作一个可引导 Ubuntu 的 USB 驱动器)
|
#### 5、Etcher 软件(用于制作一个可引导 Ubuntu 的 USB 驱动器)
|
||||||
用于为任何 Linux 发型版本创建可启动的介质的工具,我推荐 [Etcher][3]。Etcher 可以在三大主流操作系统(Linux,MacOS,和 Windows)上运行且不会让你覆盖当前操作系统的分区。
|
|
||||||
|
|
||||||
一旦你下载完成并运行 Etcher,点击选择镜像并指向你在步骤4中下载的 Ubuntu ISO 镜像, 接下来, 点击驱动器以选择你的闪存驱动器,然后点击 ` Flash!` 开始将闪存驱动器转化为一个 Ubuntu 安装器的过程。 (如果你正使用一个 DVD-R, 使用你电脑中的 DVD 烧录软件来完成此过程。)
|
用于为任何 Linux 发行版创建可启动的介质的工具,我推荐 [Etcher][3]。Etcher 可以在三大主流操作系统(Linux、MacOS 和 Windows)上运行且不会让你覆盖当前操作系统的分区。
|
||||||
|
|
||||||
|
一旦你下载完成并运行 Etcher,点击选择镜像并指向你在步骤 4 中下载的 Ubuntu ISO 镜像, 接下来,点击驱动器以选择你的闪存驱动器,然后点击 “Flash!” 开始将闪存驱动器转化为一个 Ubuntu 安装器的过程。 (如果你正使用一个 DVD-R,使用你电脑中的 DVD 烧录软件来完成此过程。)
|
||||||
|
|
||||||
### 安装 Windows 和 Ubuntu
|
### 安装 Windows 和 Ubuntu
|
||||||
|
|
||||||
@ -42,124 +44,95 @@
|
|||||||
* 创建 Windows 安装介质
|
* 创建 Windows 安装介质
|
||||||
* 创建 Ubuntu 安装介质
|
* 创建 Ubuntu 安装介质
|
||||||
|
|
||||||
|
有两种方法可以进行安装。首先,如果你已经安装了 Windows 10 ,你可以让 Ubuntu 安装程序调整分区大小,然后在空白区域上进行安装。或者,如果你尚未安装 Windows 10,你可以在安装过程中将它(Windows)安装在一个较小的分区上(下面我将描述如何去做)。第二种方法是首选的且出错率较低。很有可能你不会遇到任何问题,但是手动安装 Windows 并给它一个较小的分区,然后再安装 Ubuntu 是最简单的方法。
|
||||||
|
|
||||||
有两种方法可以进行安装。首先,如果你已经安装了 WIndows 10 ,你可以让 Ubuntu 安装程序调整分区大小,然后在空白区域上进行安装。或者,如果你尚未安装 Windows 10,你可以在安装过程中将它安装在一个更小的分区上(下面我将描述如何去做)。第二种方法是首选的且出错率较低。很有可能你不会遇到任何问题。但是手动安装 Windows 并给它一个更小的分区,然后再安装 Ubuntu 是最简单的方法。
|
|
||||||
|
|
||||||
如果你的电脑上已经安装了 Windows 10,那么请跳过以下的 Windows 安装说明并继续安装 Ubuntu。
|
如果你的电脑上已经安装了 Windows 10,那么请跳过以下的 Windows 安装说明并继续安装 Ubuntu。
|
||||||
|
|
||||||
#### 安装 Windows
|
#### 安装 Windows
|
||||||
|
|
||||||
将创建的 Windows 安装介质插入你的电脑中并引导其启动。这如何做取决于你的电脑。但大多数有一个可以按下以启动启动菜单的快捷键。例如,在戴尔的电脑上就是 F12键。如果闪存盘并未作为一个选项显示,那么你可能需要重新启动你的电脑。有时候,只有在启动电脑前插入介质才能使其显示出来。如果看到类似‘’请按任意键以从安装介质中启动“的信息,请按下任意一个键。然后你应该会看到如下的界面。选择你的语言和键盘样式,然后单击`Next`。
|
将创建的 Windows 安装介质插入你的电脑中并引导其启动。这如何做取决于你的电脑。但大多数有一个可以按下以显示启动菜单的快捷键。例如,在戴尔的电脑上就是 F12 键。如果闪存盘并未作为一个选项显示,那么你可能需要重新启动你的电脑。有时候,只有在启动电脑前插入介质才能使其显示出来。如果看到类似“请按任意键以从安装介质中启动”的信息,请按下任意一个键。然后你应该会看到如下的界面。选择你的语言和键盘样式,然后单击 “Next”。
|
||||||
|
|
||||||
|
|
||||||
![Windows 安装][5]
|
![Windows 安装][5]
|
||||||
|
|
||||||
|
点击“现在安装”启动 Windows 安装程序。
|
||||||
|
|
||||||
点击`现在安装`启动 Windows 安装程序
|
![现在安装][6]
|
||||||
|
|
||||||
在下一个屏幕上,它会询问你的产品密钥。如果因你的电脑在出厂时已经安装了 Windows 10 而没有密钥的话,请选择‘’我没有一个产品密钥”。一旦赶上更新,它会在安装完成后自动激活。如果你有一个产品密钥,输入密钥并单击`下一步`。
|
|
||||||
|
|
||||||
|
在下一个屏幕上,它会询问你的产品密钥。如果因你的电脑在出厂时已经安装了 Windows 10 而没有密钥的话,请选择“我没有一个产品密钥”。在安装完成后更新该密码后会自动激活。如果你有一个产品密钥,输入密钥并单击“下一步”。
|
||||||
|
|
||||||
![输入产品密钥][7]
|
![输入产品密钥][7]
|
||||||
|
|
||||||
|
选择你想要安装的 Windows 版本。如果你有一个零售版,封面标签(LCTT 译注:类似于 CPU 型号的 logo 贴标)会告诉你你有什么版本。否则,它通常在你的计算机的附带文档中可以找到。在大多数情况下,它要么是 Windows 10 家庭版或者 Windows 10 专业版。大多数带有 家庭版的电脑都有一个简单的标签,上面写着“Windows 10”,而专业版则会明确标明。
|
||||||
选择你想要安装的 Windows 版本。如果你有一个零售版,标签(LCTT 译者注:类似于 CPU 型号 的 logo 贴标,)会告诉你你有什么版本。否则,它通常与计算机的附带文档放在一起。在大多数情况下,它要么是 Windows 10 家庭版 或者 Windows 10 专业版。大多数带有 家庭版的电脑都有一个简单的标签,上面写着"Windows 10",而专业版则有明确的标签。
|
|
||||||
|
|
||||||
|
|
||||||
![选择 Windows 版本][10]
|
![选择 Windows 版本][10]
|
||||||
|
|
||||||
|
勾选复选框以接受许可协议,然后单击“下一步”。
|
||||||
勾选复选框以接受许可协议,然后单击`下一步`。
|
|
||||||
|
|
||||||
|
|
||||||
![接受许可协议][12]
|
![接受许可协议][12]
|
||||||
|
|
||||||
|
在接受协议后,你有两种可用的安装选项。选择第二个选项“自定义:只安装 Windows (高级)”。
|
||||||
在接受协议后,你有两种可用的安装选项。选择第二个选项`自定义:只安装 Windows (高级)`。
|
|
||||||
|
|
||||||
|
|
||||||
![选择 Windows 的安装方式][14]
|
![选择 Windows 的安装方式][14]
|
||||||
|
|
||||||
|
|
||||||
接下来应该会显示你当前的硬盘配置。
|
接下来应该会显示你当前的硬盘配置。
|
||||||
|
|
||||||
|
|
||||||
![硬盘配置][16]
|
![硬盘配置][16]
|
||||||
|
|
||||||
|
你的结果可能看起来和我的不一样。我以前从来没有用过这个硬盘,所以它是完全未分配的。你可能会看到你当前操作系统的一个或多个分区。选中每个分区并移除它。(LCTT 译注:确保这些分区中没有你需要的数据!!)
|
||||||
你的结果可能看起来和我的不一样。我以前从来没有用过这个硬盘,所以它是完全未分配的。你可能会看到你当前操作系统的一个或多个分区。
|
|
||||||
|
|
||||||
此时,你的电脑屏幕将显示未分配的整个磁盘。创建一个新的分区以继续安装。
|
此时,你的电脑屏幕将显示未分配的整个磁盘。创建一个新的分区以继续安装。
|
||||||
|
|
||||||
|
|
||||||
![创建一个新分区][18]
|
![创建一个新分区][18]
|
||||||
|
|
||||||
|
你可以看到我通过创建一个 81920MB 大小的分区(接近 160GB 的一半)将驱动器分成了一半(或者说接近一半)。给 Windows 至少 40GB,最好 64GB 或者更多。把剩下的硬盘留着不要分配,作为以后安装 Ubuntu 的分区。
|
||||||
你可以看到我通过创建一个81920MB 大小的分区(接近 160GB 的一半)将驱动器分成了一半(或者说分得足够近)。给 Windows 至少 40GB,最好 64GB 或者更多。把剩下的硬盘留着不要分配,作为以后安装 Ubuntu 的分区
|
|
||||||
|
|
||||||
你的结果应该看起来像这样:
|
你的结果应该看起来像这样:
|
||||||
|
|
||||||
|
|
||||||
![保留未分配空间的分区][20]
|
![保留未分配空间的分区][20]
|
||||||
|
|
||||||
|
确认分区看起来合理,然后单击“下一步”。现在将开始安装 Windows。
|
||||||
确认分区看起来很好,然后单击`下一步`。现在将开始安装 Windows。
|
|
||||||
|
|
||||||
|
|
||||||
![安装 Windows][22]
|
![安装 Windows][22]
|
||||||
|
|
||||||
|
|
||||||
如果你的电脑成功地引导进入了 Windows 桌面环境,你就可以进入下一步了。
|
如果你的电脑成功地引导进入了 Windows 桌面环境,你就可以进入下一步了。
|
||||||
|
|
||||||
![Windows 桌面][24]
|
![Windows 桌面][24]
|
||||||
|
|
||||||
|
|
||||||
#### 安装 Ubuntu
|
#### 安装 Ubuntu
|
||||||
|
|
||||||
无论你是已经安装了 Windows,还是完成了上面的步骤,现在你已经安装了 Windows。现在用你之前创建的 Ubuntu 安装介质来引导进入 Ubuntu。继续插入安装介质并从中引导你的电脑,同样,启动引导菜单的快捷键因计算机型号而异,因此如果你不确定,请查阅你的文档。如果一切顺利的话,当安装介质加载完成之后,你将会看到以下界面:
|
无论你是已经安装了 Windows,还是完成了上面的步骤,现在你已经安装了 Windows。现在用你之前创建的 Ubuntu 安装介质来引导进入 Ubuntu。继续插入安装介质并从中引导你的电脑,同样,启动引导菜单的快捷键因计算机型号而异,因此如果你不确定,请查阅你的文档。如果一切顺利的话,当安装介质加载完成之后,你将会看到以下界面:
|
||||||
|
|
||||||
|
|
||||||
![Ubuntu 安装欢迎屏幕][26]
|
![Ubuntu 安装欢迎屏幕][26]
|
||||||
|
|
||||||
|
在这里,你可以选择 “尝试 Ubuntu” 或者 “安装 Ubuntu”。现在不要安装,相反,点击 “尝试 Ubuntu”。当完成加载之后,你应该可以看到 Ubuntu 桌面。
|
||||||
在这里,你可以选择 `尝试 Ubuntu` 或者 `安装 Ubuntu`。现在不要安装,相反,点击 `尝试 Ubuntu`。当完成加载之后,你应该可以看到 Ubuntu 桌面。
|
|
||||||
|
|
||||||
![Ubuntu 桌面][28]
|
![Ubuntu 桌面][28]
|
||||||
|
|
||||||
通过单击`尝试 Ubuntu`,你已经选择在安装之前试用 Ubuntu。 在 Live 模式下,你可以试用 Ubuntu,确保在你安装之前一切正常。Ubuntu 能兼容大多数 PC 硬件,但最好提前测试一下。确保你可以访问互联网并可以正常播放音频和视频。登录 YouTube 播放视频是一次性完成所有这些工作的好方法。如果你需要连接到无线网络,请单击屏幕右上角的网络图标。在那里,你可以找到一个无线网络列表并连接到你的无线网络。
|
通过单击“尝试 Ubuntu”,你已经选择在安装之前试用 Ubuntu。 在 Live 模式下,你可以试用 Ubuntu,确保在你安装之前一切正常。Ubuntu 能兼容大多数 PC 硬件,但最好提前测试一下。确保你可以访问互联网并可以正常播放音频和视频。登录 YouTube 播放视频是一次性完成所有这些工作的好方法(LCTT 译注:国情所限,这个方法在这里并不奏效)。如果你需要连接到无线网络,请单击屏幕右上角的网络图标。在那里,你可以找到一个无线网络列表并连接到你的无线网络。
|
||||||
|
|
||||||
准备好之后,双击桌面上的 `安装 Ubuntu 18.04 LTS`图标启动安装程序。
|
准备好之后,双击桌面上的 “安装 Ubuntu 18.04 LTS” 图标启动安装程序。
|
||||||
|
|
||||||
选择要用于安装过程的语言,然后单击 `继续`。
|
|
||||||
|
|
||||||
|
选择要用于安装过程的语言,然后单击 “继续”。
|
||||||
|
|
||||||
![选择 Ubuntu 的语言][30]
|
![选择 Ubuntu 的语言][30]
|
||||||
|
|
||||||
|
接下来,选择键盘布局。完成后选择后,单击“继续”。
|
||||||
接下来,选择键盘布局。完成后选择后,单击`继续`。
|
|
||||||
|
|
||||||
|
|
||||||
![选择 Ubuntu 的键盘][32]
|
![选择 Ubuntu 的键盘][32]
|
||||||
|
|
||||||
在下面的屏幕上有一些选项。一,你可以选择一个正常安装或最小化安装。对大多数人来说,普通安装是理想的。高级用户可能想要默认安装应用程序比较少的最小化安装。此外,你还可以选择下载更新以及是否包含第三方软件和驱动程序。我建议同时检查这两个方框。完成后,单击`继续`。
|
在下面的屏幕上有一些选项。你可以选择一个正常安装或最小化安装。对大多数人来说,普通安装是理想的。高级用户可能想要默认安装应用程序比较少的最小化安装。此外,你还可以选择下载更新以及是否包含第三方软件和驱动程序。我建议同时检查这两个方框。完成后,单击“继续”。
|
||||||
|
|
||||||
|
|
||||||
![选择 Ubuntu 安装选项][34]
|
![选择 Ubuntu 安装选项][34]
|
||||||
|
|
||||||
下一个屏幕将询问你是要擦除磁盘还是设置双启动。由于你是双启动,因此请选择`安装 Ubuntu,与 Windows 10共存`,单击`现在安装`。
|
下一个屏幕将询问你是要擦除磁盘还是设置双启动。由于你是双启动,因此请选择“安装 Ubuntu,与 Windows 10共存”,单击“现在安装”。
|
||||||
|
|
||||||
|
|
||||||
![安装 Ubuntu,与 Windows 10共存][36]
|
![安装 Ubuntu,与 Windows 10共存][36]
|
||||||
|
|
||||||
|
可能会出现以下屏幕。如果你从头开始安装 Windows 并在磁盘上保留了未分区的空间,Ubuntu 将会自动在空白区域中自行设置分区,因此你将看不到此屏幕。如果你已经安装了 Windows 10 并且它占用了整个驱动器,则会出现此屏幕,并在顶部为你提供一个选择磁盘的选项。如果你只有一个磁盘,则可以选择从 Windows 窃取多少空间给 Ubuntu。你可以使用鼠标左右拖动中间的垂直线以从其中一个分区中拿走一些空间并给另一个分区,按照你自己想要的方式调整它,然后单击“现在安装”。
|
||||||
可能会出现以下屏幕。如果你从头开始安装 Windows 并在磁盘上保留了未分区的空间, Ubuntu 将会自动在空白区域中自行设置分区,因此你将看不到此屏幕。如果你已经安装了 Windows 10 并且它占用了整个驱动器,则会出现此屏幕,并在顶部为你提供一个选择磁盘的选项。如果你只有一个磁盘,则可以选择从 Windows 窃取多少空间给 Ubuntu。你可以使用鼠标左右拖动中间的垂直线以从其中一个分区中拿走一些空间并给另一个分区,按照你自己想要的方式调整它,然后单击`现在安装`。
|
|
||||||
|
|
||||||
|
|
||||||
![分配驱动器空间][38]
|
![分配驱动器空间][38]
|
||||||
|
|
||||||
|
你应该会看到一个显示 Ubuntu 计划将要做什么的确认屏幕,如果一切正常,请单击“继续”。
|
||||||
你应该会看到一个显示 Ubuntu 计划将要做什么的确认屏幕,如果一切正常,请单击`继续`。
|
|
||||||
|
|
||||||
![确认屏幕][39]
|
![确认屏幕][39]
|
||||||
|
|
||||||
@ -167,7 +140,7 @@ Ubuntu 正在后台安装。不过,你仍需要进行一些配置。当 Ubuntu
|
|||||||
|
|
||||||
![选择地理位置][40]
|
![选择地理位置][40]
|
||||||
|
|
||||||
接下来,填写用户账户信息:你的姓名、计算机名、用户名和密码。完成后单击`继续`。
|
接下来,填写用户账户信息:你的姓名、计算机名、用户名和密码。完成后单击“继续”。
|
||||||
|
|
||||||
![账户设置][41]
|
![账户设置][41]
|
||||||
|
|
||||||
@ -188,7 +161,7 @@ via: https://opensource.com/article/18/5/dual-boot-linux
|
|||||||
作者:[Jay LaCroix][a]
|
作者:[Jay LaCroix][a]
|
||||||
选题:[lujun9972](https://github.com/lujun9972)
|
选题:[lujun9972](https://github.com/lujun9972)
|
||||||
译者:[Auk7F7](https://github.com/Auk7F7)
|
译者:[Auk7F7](https://github.com/Auk7F7)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
@ -198,9 +171,8 @@ via: https://opensource.com/article/18/5/dual-boot-linux
|
|||||||
[3]:http://www.etcher.io
|
[3]:http://www.etcher.io
|
||||||
[4]:/file/397066
|
[4]:/file/397066
|
||||||
[5]:https://opensource.com/sites/default/files/uploads/linux-dual-boot_01.png "Windows setup"
|
[5]:https://opensource.com/sites/default/files/uploads/linux-dual-boot_01.png "Windows setup"
|
||||||
[6]:/file/397076
|
[6]:https://opensource.com/sites/default/files/uploads/linux-dual-boot_02a.png
|
||||||
[7]:https://opensource.com/sites/default/files/uploads/linux-dual-boot_03.png "Enter product key"
|
[7]:https://opensource.com/sites/default/files/uploads/linux-dual-boot_03.png "Enter product key"
|
||||||
[8]:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "Click and drag to move"
|
|
||||||
[9]:/file/397081
|
[9]:/file/397081
|
||||||
[10]:https://opensource.com/sites/default/files/uploads/linux-dual-boot_04.png "Select Windows version"
|
[10]:https://opensource.com/sites/default/files/uploads/linux-dual-boot_04.png "Select Windows version"
|
||||||
[11]:/file/397086
|
[11]:/file/397086
|
@ -1,46 +1,46 @@
|
|||||||
GPaste 是 Gnome Shell 中优秀的剪贴板管理器
|
GPaste:Gnome Shell 中优秀的剪贴板管理器
|
||||||
======
|
======
|
||||||
**[GPaste][1] 是一个剪贴板管理系统,它包含了库、守护程序以及命令行和 Gnome 的接口(使用原生 Gnome Shell 扩展)。**
|
|
||||||
|
[GPaste][1] 是一个剪贴板管理系统,它包含了库、守护程序以及命令行和 Gnome 界面(使用原生 Gnome Shell 扩展)。
|
||||||
|
|
||||||
剪贴板管理器能够跟踪你正在复制和粘贴的内容,从而能够访问以前复制的项目。GPaste 带有原生的 Gnome Shell 扩展,是那些寻找 Gnome 剪贴板管理器的人的完美补充。
|
剪贴板管理器能够跟踪你正在复制和粘贴的内容,从而能够访问以前复制的项目。GPaste 带有原生的 Gnome Shell 扩展,是那些寻找 Gnome 剪贴板管理器的人的完美补充。
|
||||||
|
|
||||||
[![GPaste Gnome Shell extension Ubuntu 18.04][2]][3]
|
[![GPaste Gnome Shell extension Ubuntu 18.04][2]][3]
|
||||||
GPaste Gnome Shell扩展
|
|
||||||
|
|
||||||
**在 Gnome 中使用 GPaste,你只需单击顶部面板即可得到可配置的、可搜索的剪贴板历史记录。GPaste 不仅会记住你复制的文本,还能记住文件路径和图像**(后者需要在设置中启用,因为默认情况下它被禁用)。
|
*GPaste Gnome Shell扩展*
|
||||||
|
|
||||||
不仅如此,GPaste 还可以检测到增长的行,这意味着当检测到新文本是另一个文本的扩展时,它会替换它,这对于保持剪贴板整洁非常有用。
|
在 Gnome 中使用 GPaste,你只需单击顶部面板即可得到可配置的、可搜索的剪贴板历史记录。GPaste 不仅会记住你复制的文本,还能记住文件路径和图像(后者需要在设置中启用,因为默认情况下它被禁用)。
|
||||||
|
|
||||||
|
不仅如此,GPaste 还可以检测到增长的行,这意味着当检测到新文本是另一个文本的增长时,它会替换它,这对于保持剪贴板整洁非常有用。
|
||||||
|
|
||||||
在扩展菜单中,你可以暂停 GPaste 跟踪剪贴板,并从剪贴板历史记录或整个历史记录中删除项目。你还会发现一个启动 GPaste 用户界面窗口的按钮。
|
在扩展菜单中,你可以暂停 GPaste 跟踪剪贴板,并从剪贴板历史记录或整个历史记录中删除项目。你还会发现一个启动 GPaste 用户界面窗口的按钮。
|
||||||
|
|
||||||
**如果你更喜欢使用键盘,你可以使用快捷键从顶栏开启 GPaste 历史记录** (`Ctrl + Alt + H`) **或打开全部的 GPaste GUI**(`Ctrl + Alt + G`)。
|
如果你更喜欢使用键盘,你可以使用快捷键从顶栏开启 GPaste 历史记录(`Ctrl + Alt + H`)或打开全部的 GPaste GUI(`Ctrl + Alt + G`)。
|
||||||
|
|
||||||
该工具还包含这些键盘快捷键(可以更改):
|
该工具还包含这些键盘快捷键(可以更改):
|
||||||
|
|
||||||
* 从历史记录中删除活动项目: `Ctrl + Alt + V`
|
* 从历史记录中删除活动项目: `Ctrl + Alt + V`
|
||||||
|
* 将活动项目显示为密码(在 GPaste 中混淆剪贴板条目): `Ctrl + Alt + S`
|
||||||
* **将活动项目显示为密码(在 GPaste 中混淆剪贴板条目):** `Ctrl + Alt + S`
|
* 将剪贴板同步到主选择: `Ctrl + Alt + O`
|
||||||
|
* 将主选择同步到剪贴板:`Ctrl + Alt + P`
|
||||||
* 将剪贴板同步到主选择: `Ctrl + Alt + O`
|
* 将活动项目上传到 pastebin 服务:`Ctrl + Alt + U`
|
||||||
|
|
||||||
* 将主选择同步到剪贴板:`Ctrl + Alt + P`
|
|
||||||
|
|
||||||
* 将活动项目上传到 pastebin 服务:`Ctrl + Alt + U`
|
|
||||||
|
|
||||||
[![][4]][5]
|
[![][4]][5]
|
||||||
GPaste GUI
|
|
||||||
|
*GPaste GUI*
|
||||||
|
|
||||||
GPaste 窗口界面提供可供搜索的剪贴板历史记录(包括清除、编辑或上传项目的选项)、暂停 GPaste 跟踪剪贴板的选项、重启 GPaste 守护程序,备份当前剪贴板历史记录,还有它的设置。
|
GPaste 窗口界面提供可供搜索的剪贴板历史记录(包括清除、编辑或上传项目的选项)、暂停 GPaste 跟踪剪贴板的选项、重启 GPaste 守护程序,备份当前剪贴板历史记录,还有它的设置。
|
||||||
|
|
||||||
[![][6]][7]
|
[![][6]][7]
|
||||||
GPaste GUI
|
|
||||||
|
|
||||||
在 GPaste UI 中,你可以更改以下设置:
|
*GPaste GUI*
|
||||||
|
|
||||||
|
在 GPaste 界面中,你可以更改以下设置:
|
||||||
|
|
||||||
* 启用或禁用 Gnome Shell 扩展
|
* 启用或禁用 Gnome Shell 扩展
|
||||||
* 将守护程序状态与扩展程序的状态同步
|
* 将守护程序状态与扩展程序的状态同步
|
||||||
* 主选择影响历史
|
* 主选区生效历史
|
||||||
* 使剪贴板与主选择同步
|
* 使剪贴板与主选区同步
|
||||||
* 图像支持
|
* 图像支持
|
||||||
* 修整条目
|
* 修整条目
|
||||||
* 检测增长行
|
* 检测增长行
|
||||||
@ -48,11 +48,9 @@ GPaste GUI
|
|||||||
* 历史记录设置,如最大历史记录大小、内存使用情况、最大文本长度等
|
* 历史记录设置,如最大历史记录大小、内存使用情况、最大文本长度等
|
||||||
* 键盘快捷键
|
* 键盘快捷键
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 下载 GPaste
|
### 下载 GPaste
|
||||||
|
|
||||||
[Download GPaste](https://github.com/Keruspe/GPaste)
|
- [下载 GPaste](https://github.com/Keruspe/GPaste)
|
||||||
|
|
||||||
Gpaste 项目页面没有链接到任何 GPaste 二进制文件,它只有源码安装说明。非 Debian 或 Ubuntu 的 Linux 发行版的用户(你可以在下面找到 GPaste 安装说明)可以在各自的发行版仓库中搜索 GPaste。
|
Gpaste 项目页面没有链接到任何 GPaste 二进制文件,它只有源码安装说明。非 Debian 或 Ubuntu 的 Linux 发行版的用户(你可以在下面找到 GPaste 安装说明)可以在各自的发行版仓库中搜索 GPaste。
|
||||||
|
|
||||||
@ -60,17 +58,17 @@ Gpaste 项目页面没有链接到任何 GPaste 二进制文件,它只有源
|
|||||||
|
|
||||||
#### 在 Ubuntu(18.04、16.04)或 Debian(Jessie 和更新版本)中安装 GPaste
|
#### 在 Ubuntu(18.04、16.04)或 Debian(Jessie 和更新版本)中安装 GPaste
|
||||||
|
|
||||||
**对于 Debian,GPaste 可用于 Jessie 和更新版本,而对于 Ubuntu,GPaste 在 16.04 及更新版本的仓库中(因此可在 Ubuntu 18.04 Bionic Beaver 中使用)。**
|
对于 Debian,GPaste 可用于 Jessie 和更新版本,而对于 Ubuntu,GPaste 在 16.04 及更新版本的仓库中(因此可在 Ubuntu 18.04 Bionic Beaver 中使用)。
|
||||||
|
|
||||||
|
你可以使用以下命令在 Debian 或 Ubuntu 中安装 GPaste(守护程序和 Gnome Shell 扩展):
|
||||||
|
|
||||||
**你可以使用以下命令在 Debian 或 Ubuntu 中安装 GPaste(守护程序和 Gnome Shell 扩展):**
|
|
||||||
```
|
```
|
||||||
sudo apt install gnome-shell-extensions-gpaste gpaste
|
sudo apt install gnome-shell-extensions-gpaste gpaste
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
安装完成后,按下 `Alt + F2` 并输入 `r` 重新启动 Gnome Shell,然后按`回车`键。现在应该启用了 GPaste Gnome Shell 扩展,其图标应显示在顶部 Gnome Shell 面板上。如果没有,请使用 Gnome Tweaks(Gnome Tweak Tool)启用扩展。
|
安装完成后,按下 `Alt + F2` 并输入 `r` 重新启动 Gnome Shell,然后按回车键。现在应该启用了 GPaste Gnome Shell 扩展,其图标应显示在顶部 Gnome Shell 面板上。如果没有,请使用 Gnome Tweaks(Gnome Tweak Tool)启用扩展。
|
||||||
|
|
||||||
**[Debian][8] 和 [Ubuntu][9] 的 GPaste 3.28.0 中有一个错误,如果启用了图像支持选项会导致它崩溃,所以现在不要启用此功能。** 这在 GPaste 3.28.2 中被标记为[已修复][10],但 Debian 和 Ubuntu 仓库中尚未提供此包。
|
[Debian][8] 和 [Ubuntu][9] 的 GPaste 3.28.0 中有一个错误,如果启用了图像支持选项会导致它崩溃,所以现在不要启用此功能。这在 GPaste 3.28.2 中被标记为[已修复][10],但 Debian 和 Ubuntu 仓库中尚未提供此包。
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
@ -80,7 +78,7 @@ via: https://www.linuxuprising.com/2018/08/gpaste-is-great-clipboard-manager-for
|
|||||||
作者:[Logix][a]
|
作者:[Logix][a]
|
||||||
选题:[lujun9972](https://github.com/lujun9972)
|
选题:[lujun9972](https://github.com/lujun9972)
|
||||||
译者:[geekpi](https://github.com/geekpi)
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
@ -94,4 +92,4 @@ via: https://www.linuxuprising.com/2018/08/gpaste-is-great-clipboard-manager-for
|
|||||||
[7]:https://4.bp.blogspot.com/-047ShYc6RrQ/W2gyz5FCf_I/AAAAAAAABTA/-o6jaWzwNpsSjG0QRwRJ5Xurq_A6dQ0sQCLcBGAs/s1600/gpaste-gui_2.png
|
[7]:https://4.bp.blogspot.com/-047ShYc6RrQ/W2gyz5FCf_I/AAAAAAAABTA/-o6jaWzwNpsSjG0QRwRJ5Xurq_A6dQ0sQCLcBGAs/s1600/gpaste-gui_2.png
|
||||||
[8]:https://packages.debian.org/buster/gpaste
|
[8]:https://packages.debian.org/buster/gpaste
|
||||||
[9]:https://launchpad.net/ubuntu/+source/gpaste
|
[9]:https://launchpad.net/ubuntu/+source/gpaste
|
||||||
[10]:https://www.imagination-land.org/posts/2018-04-13-gpaste-3.28.2-released.html
|
[10]:https://www.imagination-land.org/posts/2018-04-13-gpaste-3.28.2-released.html
|
@ -1,89 +1,86 @@
|
|||||||
实验 3:用户环境
|
Caffeinated 6.828:实验 3:用户环境
|
||||||
======
|
======
|
||||||
### 实验 3:用户环境
|
|
||||||
|
|
||||||
#### 简介
|
### 简介
|
||||||
|
|
||||||
在本实验中,你将要实现一个基本的内核功能,要求它能够保护运行的用户模式环境(即:进程)。你将去增强这个 JOS 内核,去配置数据结构以便于保持对用户环境的跟踪、创建一个单一用户环境、将程序镜像加载到用户环境中、并将它启动运行。你也要写出一些 JOS 内核的函数,用来处理任何用户环境生成的系统调用,以及处理由用户环境引进的各种异常。
|
在本实验中,你将要实现一个基本的内核功能,要求它能够保护运行的用户模式环境(即:进程)。你将去增强这个 JOS 内核,去配置数据结构以便于保持对用户环境的跟踪、创建一个单一用户环境、将程序镜像加载到用户环境中、并将它启动运行。你也要写出一些 JOS 内核的函数,用来处理任何用户环境生成的系统调用,以及处理由用户环境引进的各种异常。
|
||||||
|
|
||||||
**注意:** 在本实验中,术语**_“环境”_** 和**_“进程”_** 是可互换的 —— 它们都表示同一个抽象概念,那就是允许你去运行的程序。我在介绍中使用术语**“环境”**而不是使用传统术语**“进程”**的目的是为了强调一点,那就是 JOS 的环境和 UNIX 的进程提供了不同的接口,并且它们的语义也不相同。
|
**注意:** 在本实验中,术语**“环境”** 和**“进程”** 是可互换的 —— 它们都表示同一个抽象概念,那就是允许你去运行的程序。我在介绍中使用术语**“环境”**而不是使用传统术语**“进程”**的目的是为了强调一点,那就是 JOS 的环境和 UNIX 的进程提供了不同的接口,并且它们的语义也不相同。
|
||||||
|
|
||||||
##### 预备知识
|
#### 预备知识
|
||||||
|
|
||||||
使用 Git 去提交你自实验 2 以后的更改(如果有的话),获取课程仓库的最新版本,以及创建一个命名为 `lab3` 的本地分支,指向到我们的 lab3 分支上 `origin/lab3` :
|
使用 Git 去提交你自实验 2 以后的更改(如果有的话),获取课程仓库的最新版本,以及创建一个命名为 `lab3` 的本地分支,指向到我们的 lab3 分支上 `origin/lab3` :
|
||||||
|
|
||||||
```
|
```
|
||||||
athena% cd ~/6.828/lab
|
athena% cd ~/6.828/lab
|
||||||
athena% add git
|
athena% add git
|
||||||
athena% git commit -am 'changes to lab2 after handin'
|
athena% git commit -am 'changes to lab2 after handin'
|
||||||
Created commit 734fab7: changes to lab2 after handin
|
Created commit 734fab7: changes to lab2 after handin
|
||||||
4 files changed, 42 insertions(+), 9 deletions(-)
|
4 files changed, 42 insertions(+), 9 deletions(-)
|
||||||
athena% git pull
|
athena% git pull
|
||||||
Already up-to-date.
|
Already up-to-date.
|
||||||
athena% git checkout -b lab3 origin/lab3
|
athena% git checkout -b lab3 origin/lab3
|
||||||
Branch lab3 set up to track remote branch refs/remotes/origin/lab3.
|
Branch lab3 set up to track remote branch refs/remotes/origin/lab3.
|
||||||
Switched to a new branch "lab3"
|
Switched to a new branch "lab3"
|
||||||
athena% git merge lab2
|
athena% git merge lab2
|
||||||
Merge made by recursive.
|
Merge made by recursive.
|
||||||
kern/pmap.c | 42 +++++++++++++++++++
|
kern/pmap.c | 42 +++++++++++++++++++
|
||||||
1 files changed, 42 insertions(+), 0 deletions(-)
|
1 files changed, 42 insertions(+), 0 deletions(-)
|
||||||
athena%
|
athena%
|
||||||
```
|
```
|
||||||
|
|
||||||
实验 3 包含一些你将探索的新源文件:
|
实验 3 包含一些你将探索的新源文件:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
inc/ env.h Public definitions for user-mode environments
|
inc/ env.h Public definitions for user-mode environments
|
||||||
trap.h Public definitions for trap handling
|
trap.h Public definitions for trap handling
|
||||||
syscall.h Public definitions for system calls from user environments to the kernel
|
syscall.h Public definitions for system calls from user environments to the kernel
|
||||||
lib.h Public definitions for the user-mode support library
|
lib.h Public definitions for the user-mode support library
|
||||||
kern/ env.h Kernel-private definitions for user-mode environments
|
kern/ env.h Kernel-private definitions for user-mode environments
|
||||||
env.c Kernel code implementing user-mode environments
|
env.c Kernel code implementing user-mode environments
|
||||||
trap.h Kernel-private trap handling definitions
|
trap.h Kernel-private trap handling definitions
|
||||||
trap.c Trap handling code
|
trap.c Trap handling code
|
||||||
trapentry.S Assembly-language trap handler entry-points
|
trapentry.S Assembly-language trap handler entry-points
|
||||||
syscall.h Kernel-private definitions for system call handling
|
syscall.h Kernel-private definitions for system call handling
|
||||||
syscall.c System call implementation code
|
syscall.c System call implementation code
|
||||||
lib/ Makefrag Makefile fragment to build user-mode library, obj/lib/libjos.a
|
lib/ Makefrag Makefile fragment to build user-mode library, obj/lib/libjos.a
|
||||||
entry.S Assembly-language entry-point for user environments
|
entry.S Assembly-language entry-point for user environments
|
||||||
libmain.c User-mode library setup code called from entry.S
|
libmain.c User-mode library setup code called from entry.S
|
||||||
syscall.c User-mode system call stub functions
|
syscall.c User-mode system call stub functions
|
||||||
console.c User-mode implementations of putchar and getchar, providing console I/O
|
console.c User-mode implementations of putchar and getchar, providing console I/O
|
||||||
exit.c User-mode implementation of exit
|
exit.c User-mode implementation of exit
|
||||||
panic.c User-mode implementation of panic
|
panic.c User-mode implementation of panic
|
||||||
user/ * Various test programs to check kernel lab 3 code
|
user/ * Various test programs to check kernel lab 3 code
|
||||||
```
|
```
|
||||||
|
|
||||||
另外,一些在实验 2 中的源文件在实验 3 中将被修改。如果想去查看有什么更改,可以运行:
|
另外,一些在实验 2 中的源文件在实验 3 中将被修改。如果想去查看有什么更改,可以运行:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ git diff lab2
|
$ git diff lab2
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
你也可以另外去看一下 [实验工具指南][1],它包含了与本实验有关的调试用户代码方面的信息。
|
你也可以另外去看一下 [实验工具指南][1],它包含了与本实验有关的调试用户代码方面的信息。
|
||||||
|
|
||||||
##### 实验要求
|
#### 实验要求
|
||||||
|
|
||||||
本实验分为两部分:Part A 和 Part B。Part A 在本实验完成后一周内提交;你将要提交你的更改和完成的动手实验,在提交之前要确保你的代码通过了 Part A 的所有检查(如果你的代码未通过 Part B 的检查也可以提交)。只需要在第二周提交 Part B 的期限之前代码检查通过即可。
|
本实验分为两部分:Part A 和 Part B。Part A 在本实验完成后一周内提交;你将要提交你的更改和完成的动手实验,在提交之前要确保你的代码通过了 Part A 的所有检查(如果你的代码未通过 Part B 的检查也可以提交)。只需要在第二周提交 Part B 的期限之前代码检查通过即可。
|
||||||
|
|
||||||
由于在实验 2 中,你需要做实验中描述的所有正则表达式练习,并且至少通过一个挑战(是指整个实验,不是每个部分)。写出详细的问题答案并张贴在实验中,以及一到两个段落的关于你如何解决你选择的挑战问题的详细描述,并将它放在一个名为 `answers-lab3.txt` 的文件中,并将这个文件放在你的 `lab` 目标的根目录下。(如果你做了多个问题挑战,你仅需要提交其中一个即可)不要忘记使用 `git add answers-lab3.txt` 提交这个文件。
|
由于在实验 2 中,你需要做实验中描述的所有正则表达式练习,并且至少通过一个挑战(是指整个实验,不是每个部分)。写出详细的问题答案并张贴在实验中,以及一到两个段落的关于你如何解决你选择的挑战问题的详细描述,并将它放在一个名为 `answers-lab3.txt` 的文件中,并将这个文件放在你的 `lab` 目标的根目录下。(如果你做了多个问题挑战,你仅需要提交其中一个即可)不要忘记使用 `git add answers-lab3.txt` 提交这个文件。
|
||||||
|
|
||||||
##### 行内汇编语言
|
#### 行内汇编语言
|
||||||
|
|
||||||
在本实验中你可能找到使用了 GCC 的行内汇编语言特性,虽然不使用它也可以完成实验。但至少你需要去理解这些行内汇编语言片段,这些汇编语言("`asm`" 语句)片段已经存在于提供给你的源代码中。你可以在课程 [参考资料][2] 的页面上找到 GCC 行内汇编语言有关的信息。
|
在本实验中你可能发现使用了 GCC 的行内汇编语言特性,虽然不使用它也可以完成实验。但至少你需要去理解这些行内汇编语言片段,这些汇编语言(`asm` 语句)片段已经存在于提供给你的源代码中。你可以在课程 [参考资料][2] 的页面上找到 GCC 行内汇编语言有关的信息。
|
||||||
|
|
||||||
#### Part A:用户环境和异常处理
|
### Part A:用户环境和异常处理
|
||||||
|
|
||||||
新文件 `inc/env.h` 中包含了在 JOS 中关于用户环境的基本定义。现在就去阅读它。内核使用数据结构 `Env` 去保持对每个用户环境的跟踪。在本实验的开始,你将只创建一个环境,但你需要去设计 JOS 内核支持多环境;实验 4 将带来这个高级特性,允许用户环境去 `fork` 其它环境。
|
新文件 `inc/env.h` 中包含了在 JOS 中关于用户环境的基本定义。现在就去阅读它。内核使用数据结构 `Env` 去保持对每个用户环境的跟踪。在本实验的开始,你将只创建一个环境,但你需要去设计 JOS 内核支持多环境;实验 4 将带来这个高级特性,允许用户环境去 `fork` 其它环境。
|
||||||
|
|
||||||
正如你在 `kern/env.c` 中所看到的,内核维护了与环境相关的三个全局变量:
|
正如你在 `kern/env.c` 中所看到的,内核维护了与环境相关的三个全局变量:
|
||||||
|
|
||||||
```
|
```
|
||||||
struct Env *envs = NULL; // All environments
|
struct Env *envs = NULL; // All environments
|
||||||
struct Env *curenv = NULL; // The current env
|
struct Env *curenv = NULL; // The current env
|
||||||
static struct Env *env_free_list; // Free environment list
|
static struct Env *env_free_list; // Free environment list
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
一旦 JOS 启动并运行,`envs` 指针指向到一个数组,即数据结构 `Env`,它保存了系统中全部的环境。在我们的设计中,JOS 内核将同时支持最大值为 `NENV` 个的活动的环境,虽然在一般情况下,任何给定时刻运行的环境很少。(`NENV` 是在 `inc/env.h` 中用 `#define` 定义的一个常量)一旦它被分配,对于每个 `NENV` 可能的环境,`envs` 数组将包含一个数据结构 `Env` 的单个实例。
|
一旦 JOS 启动并运行,`envs` 指针指向到一个数组,即数据结构 `Env`,它保存了系统中全部的环境。在我们的设计中,JOS 内核将同时支持最大值为 `NENV` 个的活动的环境,虽然在一般情况下,任何给定时刻运行的环境很少。(`NENV` 是在 `inc/env.h` 中用 `#define` 定义的一个常量)一旦它被分配,对于每个 `NENV` 可能的环境,`envs` 数组将包含一个数据结构 `Env` 的单个实例。
|
||||||
@ -92,38 +89,38 @@ JOS 内核在 `env_free_list` 上用数据结构 `Env` 保存了所有不活动
|
|||||||
|
|
||||||
内核使用符号 `curenv` 来保持对任意给定时刻的 _当前正在运行的环境_ 进行跟踪。在系统引导期间,在第一个环境运行之前,`curenv` 被初始化为 `NULL`。
|
内核使用符号 `curenv` 来保持对任意给定时刻的 _当前正在运行的环境_ 进行跟踪。在系统引导期间,在第一个环境运行之前,`curenv` 被初始化为 `NULL`。
|
||||||
|
|
||||||
##### 环境状态
|
#### 环境状态
|
||||||
|
|
||||||
数据结构 `Env` 被定义在文件 `inc/env.h` 中,内容如下:(在后面的实验中将添加更多的字段):
|
数据结构 `Env` 被定义在文件 `inc/env.h` 中,内容如下:(在后面的实验中将添加更多的字段):
|
||||||
|
|
||||||
```c
|
```c
|
||||||
struct Env {
|
struct Env {
|
||||||
struct Trapframe env_tf; // Saved registers
|
struct Trapframe env_tf; // Saved registers
|
||||||
struct Env *env_link; // Next free Env
|
struct Env *env_link; // Next free Env
|
||||||
envid_t env_id; // Unique environment identifier
|
envid_t env_id; // Unique environment identifier
|
||||||
envid_t env_parent_id; // env_id of this env's parent
|
envid_t env_parent_id; // env_id of this env's parent
|
||||||
enum EnvType env_type; // Indicates special system environments
|
enum EnvType env_type; // Indicates special system environments
|
||||||
unsigned env_status; // Status of the environment
|
unsigned env_status; // Status of the environment
|
||||||
uint32_t env_runs; // Number of times environment has run
|
uint32_t env_runs; // Number of times environment has run
|
||||||
|
|
||||||
// Address space
|
// Address space
|
||||||
pde_t *env_pgdir; // Kernel virtual address of page dir
|
pde_t *env_pgdir; // Kernel virtual address of page dir
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
以下是数据结构 `Env` 中的字段简介:
|
以下是数据结构 `Env` 中的字段简介:
|
||||||
|
|
||||||
* **env_tf**:
|
* `env_tf`:
|
||||||
这个结构定义在 `inc/trap.h` 中,它用于在那个环境不运行时保持它保存在寄存器中的值,即:当内核或一个不同的环境在运行时。当从用户模式切换到内核模式时,内核将保存这些东西,以便于那个环境能够在稍后重新运行时回到中断运行的地方。
|
这个结构定义在 `inc/trap.h` 中,它用于在那个环境不运行时保持它保存在寄存器中的值,即:当内核或一个不同的环境在运行时。当从用户模式切换到内核模式时,内核将保存这些东西,以便于那个环境能够在稍后重新运行时回到中断运行的地方。
|
||||||
* **env_link**:
|
* `env_link`:
|
||||||
这是一个链接,它链接到在 `env_free_list` 上的下一个 `Env` 上。`env_free_list` 指向到列表上第一个空闲的环境。
|
这是一个链接,它链接到在 `env_free_list` 上的下一个 `Env` 上。`env_free_list` 指向到列表上第一个空闲的环境。
|
||||||
* **env_id**:
|
* `env_id`:
|
||||||
内核在数据结构 `Env` 中保存了一个唯一标识当前环境的值(即:使用数组 `envs` 中的特定槽位)。在一个用户环境终止之后,内核可能给另外的环境重新分配相同的数据结构 `Env` —— 但是新的环境将有一个与已终止的旧的环境不同的 `env_id`,即便是新的环境在数组 `envs` 中复用了同一个槽位。
|
内核在数据结构 `Env` 中保存了一个唯一标识当前环境的值(即:使用数组 `envs` 中的特定槽位)。在一个用户环境终止之后,内核可能给另外的环境重新分配相同的数据结构 `Env` —— 但是新的环境将有一个与已终止的旧的环境不同的 `env_id`,即便是新的环境在数组 `envs` 中复用了同一个槽位。
|
||||||
* **env_parent_id**:
|
* `env_parent_id`:
|
||||||
内核使用它来保存创建这个环境的父级环境的 `env_id`。通过这种方式,环境就可以形成一个“家族树”,这对于做出“哪个环境可以对谁做什么”这样的安全决策非常有用。
|
内核使用它来保存创建这个环境的父级环境的 `env_id`。通过这种方式,环境就可以形成一个“家族树”,这对于做出“哪个环境可以对谁做什么”这样的安全决策非常有用。
|
||||||
* **env_type**:
|
* `env_type`:
|
||||||
它用于去区分特定的环境。对于大多数环境,它将是 `ENV_TYPE_USER` 的。在稍后的实验中,针对特定的系统服务环境,我们将引入更多的几种类型。
|
它用于去区分特定的环境。对于大多数环境,它将是 `ENV_TYPE_USER` 的。在稍后的实验中,针对特定的系统服务环境,我们将引入更多的几种类型。
|
||||||
* **env_status**:
|
* `env_status`:
|
||||||
这个变量持有以下几个值之一:
|
这个变量持有以下几个值之一:
|
||||||
* `ENV_FREE`:
|
* `ENV_FREE`:
|
||||||
表示那个 `Env` 结构是非活动的,并且因此它还在 `env_free_list` 上。
|
表示那个 `Env` 结构是非活动的,并且因此它还在 `env_free_list` 上。
|
||||||
@ -135,59 +132,64 @@ JOS 内核在 `env_free_list` 上用数据结构 `Env` 保存了所有不活动
|
|||||||
表示那个 `Env` 结构所代表的是一个当前活动的环境,但不是当前准备去运行的:例如,因为它正在因为一个来自其它环境的进程间通讯(IPC)而处于等待状态。
|
表示那个 `Env` 结构所代表的是一个当前活动的环境,但不是当前准备去运行的:例如,因为它正在因为一个来自其它环境的进程间通讯(IPC)而处于等待状态。
|
||||||
* `ENV_DYING`:
|
* `ENV_DYING`:
|
||||||
表示那个 `Env` 结构所表示的是一个僵尸环境。一个僵尸环境将在下一次被内核捕获后被释放。我们在实验 4 之前不会去使用这个标志。
|
表示那个 `Env` 结构所表示的是一个僵尸环境。一个僵尸环境将在下一次被内核捕获后被释放。我们在实验 4 之前不会去使用这个标志。
|
||||||
* **env_pgdir**:
|
* `env_pgdir`:
|
||||||
这个变量持有这个环境的内核虚拟地址的页目录。
|
这个变量持有这个环境的内核虚拟地址的页目录。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
就像一个 Unix 进程一样,一个 JOS 环境耦合了“线程”和“地址空间”的概念。线程主要由保存的寄存器来定义(`env_tf` 字段),而地址空间由页目录和 `env_pgdir` 所指向的页表所定义。为运行一个环境,内核必须使用保存的寄存器值和相关的地址空间去设置 CPU。
|
就像一个 Unix 进程一样,一个 JOS 环境耦合了“线程”和“地址空间”的概念。线程主要由保存的寄存器来定义(`env_tf` 字段),而地址空间由页目录和 `env_pgdir` 所指向的页表所定义。为运行一个环境,内核必须使用保存的寄存器值和相关的地址空间去设置 CPU。
|
||||||
|
|
||||||
我们的 `struct Env` 与 xv6 中的 `struct proc` 类似。它们都在一个 `Trapframe` 结构中持有环境(即进程)的用户模式寄存器状态。在 JOS 中,单个的环境并不能像 xv6 中的进程那样拥有它们自己的内核栈。在这里,内核中任意时间只能有一个 JOS 环境处于活动中,因此,JOS 仅需要一个单个的内核栈。
|
我们的 `struct Env` 与 xv6 中的 `struct proc` 类似。它们都在一个 `Trapframe` 结构中持有环境(即进程)的用户模式寄存器状态。在 JOS 中,单个的环境并不能像 xv6 中的进程那样拥有它们自己的内核栈。在这里,内核中任意时间只能有一个 JOS 环境处于活动中,因此,JOS 仅需要一个单个的内核栈。
|
||||||
|
|
||||||
##### 为环境分配数组
|
#### 为环境分配数组
|
||||||
|
|
||||||
在实验 2 的 `mem_init()` 中,你为数组 `pages[]` 分配了内存,它是内核用于对页面分配与否的状态进行跟踪的一个表。你现在将需要去修改 `mem_init()`,以便于后面使用它分配一个与结构 `Env` 类似的数组,这个数组被称为 `envs`。
|
在实验 2 的 `mem_init()` 中,你为数组 `pages[]` 分配了内存,它是内核用于对页面分配与否的状态进行跟踪的一个表。你现在将需要去修改 `mem_init()`,以便于后面使用它分配一个与结构 `Env` 类似的数组,这个数组被称为 `envs`。
|
||||||
|
|
||||||
```markdown
|
> **练习 1**、修改在 `kern/pmap.c` 中的 `mem_init()`,以用于去分配和映射 `envs` 数组。这个数组完全由 `Env` 结构分配的实例 `NENV` 组成,就像你分配的 `pages` 数组一样。与 `pages` 数组一样,由内存支持的数组 `envs` 也将在 `UENVS`(它的定义在 `inc/memlayout.h` 文件中)中映射用户只读的内存,以便于用户进程能够从这个数组中读取。
|
||||||
练习 1、修改在 `kern/pmap.c` 中的 `mem_init()`,以用于去分配和映射 `envs` 数组。这个数组完全由 `Env` 结构分配的实例 `NENV` 组成,就像你分配的 `pages` 数组一样。与 `pages` 数组一样,由内存支持的数组 `envs` 也将在 `UENVS`(它的定义在 `inc/memlayout.h` 文件中)中映射用户只读的内存,以便于用户进程能够从这个数组中读取。
|
|
||||||
```
|
|
||||||
|
|
||||||
你应该去运行你的代码,并确保 `check_kern_pgdir()` 是没有问题的。
|
你应该去运行你的代码,并确保 `check_kern_pgdir()` 是没有问题的。
|
||||||
|
|
||||||
##### 创建和运行环境
|
#### 创建和运行环境
|
||||||
|
|
||||||
现在,你将在 `kern/env.c` 中写一些必需的代码去运行一个用户环境。因为我们并没有做一个文件系统,因此,我们将设置内核去加载一个嵌入到内核中的静态的二进制镜像。JOS 内核以一个 ELF 可运行镜像的方式将这个二进制镜像嵌入到内核中。
|
现在,你将在 `kern/env.c` 中写一些必需的代码去运行一个用户环境。因为我们并没有做一个文件系统,因此,我们将设置内核去加载一个嵌入到内核中的静态的二进制镜像。JOS 内核以一个 ELF 可运行镜像的方式将这个二进制镜像嵌入到内核中。
|
||||||
|
|
||||||
在实验 3 中,`GNUmakefile` 将在 `obj/user/` 目录中生成一些二进制镜像。如果你看到 `kern/Makefrag`,你将注意到一些奇怪的的东西,它们“链接”这些二进制直接进入到内核中运行,就像 `.o` 文件一样。在链接器命令行上的 `-b binary` 选项,将因此把它们链接为“原生的”不解析的二进制文件,而不是由编译器产生的普通的 `.o` 文件。(就链接器而言,这些文件压根就不是 ELF 镜像文件 —— 它们可以是任何东西,比如,一个文本文件或图片!)如果你在内核构建之后查看 `obj/kern/kernel.sym` ,你将会注意到链接器很奇怪的生成了一些有趣的、命名很费解的符号,比如像 `_binary_obj_user_hello_start`、`_binary_obj_user_hello_end`、以及 `_binary_obj_user_hello_size`。链接器通过改编二进制文件的命令来生成这些符号;这种符号为普通内核代码使用一种引入嵌入式二进制文件的方法。
|
在实验 3 中,`GNUmakefile` 将在 `obj/user/` 目录中生成一些二进制镜像。如果你看到 `kern/Makefrag`,你将注意到一些奇怪的的东西,它们“链接”这些二进制直接进入到内核中运行,就像 `.o` 文件一样。在链接器命令行上的 `-b binary` 选项,将因此把它们链接为“原生的”不解析的二进制文件,而不是由编译器产生的普通的 `.o` 文件。(就链接器而言,这些文件压根就不是 ELF 镜像文件 —— 它们可以是任何东西,比如,一个文本文件或图片!)如果你在内核构建之后查看 `obj/kern/kernel.sym` ,你将会注意到链接器很奇怪的生成了一些有趣的、命名很费解的符号,比如像 `_binary_obj_user_hello_start`、`_binary_obj_user_hello_end`、以及 `_binary_obj_user_hello_size`。链接器通过改编二进制文件的命令来生成这些符号;这种符号为普通内核代码使用一种引入嵌入式二进制文件的方法。
|
||||||
|
|
||||||
在 `kern/init.c` 的 `i386_init()` 中,你将写一些代码在环境中运行这些二进制镜像中的一种。但是,设置用户环境的关键函数还没有实现;将需要你去完成它们。
|
在 `kern/init.c` 的 `i386_init()` 中,你将写一些代码在环境中运行这些二进制镜像中的一种。但是,设置用户环境的关键函数还没有实现;将需要你去完成它们。
|
||||||
|
|
||||||
```markdown
|
> **练习 2**、在文件 `env.c` 中,写完以下函数的代码:
|
||||||
练习 2、在文件 `env.c` 中,写完以下函数的代码:
|
|
||||||
|
|
||||||
* `env_init()`
|
> * `env_init()`
|
||||||
初始化 `envs` 数组中所有的 `Env` 结构,然后把它们添加到 `env_free_list` 中。也称为 `env_init_percpu`,它通过配置硬件,在硬件上为 level 0(内核)权限和 level 3(用户)权限使用单独的段。
|
|
||||||
* `env_setup_vm()`
|
|
||||||
为一个新环境分配一个页目录,并初始化新环境的地址空间的内核部分。
|
|
||||||
* `region_alloc()`
|
|
||||||
为一个新环境分配和映射物理内存
|
|
||||||
* `load_icode()`
|
|
||||||
你将需要去解析一个 ELF 二进制镜像,就像引导加载器那样,然后加载它的内容到一个新环境的用户地址空间中。
|
|
||||||
* `env_create()`
|
|
||||||
使用 `env_alloc` 去分配一个环境,并调用 `load_icode` 去加载一个 ELF 二进制
|
|
||||||
* `env_run()`
|
|
||||||
在用户模式中开始运行一个给定的环境
|
|
||||||
|
|
||||||
|
> 初始化 `envs` 数组中所有的 `Env` 结构,然后把它们添加到 `env_free_list` 中。也称为 `env_init_percpu`,它通过配置硬件,在硬件上为 level 0(内核)权限和 level 3(用户)权限使用单独的段。
|
||||||
|
|
||||||
|
> * `env_setup_vm()`
|
||||||
|
|
||||||
在你写这些函数时,你可能会发现新的 cprintf 动词 `%e` 非常有用 -- 它可以输出一个错误代码的相关描述。比如:
|
> 为一个新环境分配一个页目录,并初始化新环境的地址空间的内核部分。
|
||||||
|
|
||||||
r = -E_NO_MEM;
|
> * `region_alloc()`
|
||||||
panic("env_alloc: %e", r);
|
|
||||||
|
|
||||||
中 panic 将输出消息 "env_alloc: out of memory"。
|
> 为一个新环境分配和映射物理内存
|
||||||
|
|
||||||
|
> * `load_icode()`
|
||||||
|
|
||||||
|
> 你将需要去解析一个 ELF 二进制镜像,就像引导加载器那样,然后加载它的内容到一个新环境的用户地址空间中。
|
||||||
|
|
||||||
|
> * `env_create()`
|
||||||
|
|
||||||
|
> 使用 `env_alloc` 去分配一个环境,并调用 `load_icode` 去加载一个 ELF 二进制
|
||||||
|
|
||||||
|
> * `env_run()`
|
||||||
|
|
||||||
|
> 在用户模式中开始运行一个给定的环境
|
||||||
|
|
||||||
|
> 在你写这些函数时,你可能会发现新的 cprintf 动词 `%e` 非常有用 -- 它可以输出一个错误代码的相关描述。比如:
|
||||||
|
|
||||||
|
> ```
|
||||||
|
r = -E_NO_MEM;
|
||||||
|
panic("env_alloc: %e", r);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> 中 panic 将输出消息 "env_alloc: out of memory"。
|
||||||
|
|
||||||
下面是用户代码相关的调用图。确保你理解了每一步的用途。
|
下面是用户代码相关的调用图。确保你理解了每一步的用途。
|
||||||
|
|
||||||
* `start` (`kern/entry.S`)
|
* `start` (`kern/entry.S`)
|
||||||
@ -200,107 +202,94 @@ JOS 内核在 `env_free_list` 上用数据结构 `Env` 保存了所有不活动
|
|||||||
* `env_run`
|
* `env_run`
|
||||||
* `env_pop_tf`
|
* `env_pop_tf`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
在完成以上函数后,你应该去编译内核并在 QEMU 下运行它。如果一切正常,你的系统将进入到用户空间并运行二进制的 `hello` ,直到使用 `int` 指令生成一个系统调用为止。在那个时刻将存在一个问题,因为 JOS 尚未设置硬件去允许从用户空间到内核空间的各种转换。当 CPU 发现没有系统调用中断的服务程序时,它将生成一个一般保护异常,找到那个异常并去处理它,还将生成一个双重故障异常,同样也找到它并处理它,并且最后会出现所谓的“三重故障异常”。通常情况下,你将随后看到 CPU 复位以及系统重引导。虽然对于传统的应用程序(在 [这篇博客文章][3] 中解释了原因)这是重大的问题,但是对于内核开发来说,这是一个痛苦的过程,因此,在打了 6.828 补丁的 QEMU 上,你将可以看到转储的寄存器内容和一个“三重故障”的信息。
|
在完成以上函数后,你应该去编译内核并在 QEMU 下运行它。如果一切正常,你的系统将进入到用户空间并运行二进制的 `hello` ,直到使用 `int` 指令生成一个系统调用为止。在那个时刻将存在一个问题,因为 JOS 尚未设置硬件去允许从用户空间到内核空间的各种转换。当 CPU 发现没有系统调用中断的服务程序时,它将生成一个一般保护异常,找到那个异常并去处理它,还将生成一个双重故障异常,同样也找到它并处理它,并且最后会出现所谓的“三重故障异常”。通常情况下,你将随后看到 CPU 复位以及系统重引导。虽然对于传统的应用程序(在 [这篇博客文章][3] 中解释了原因)这是重大的问题,但是对于内核开发来说,这是一个痛苦的过程,因此,在打了 6.828 补丁的 QEMU 上,你将可以看到转储的寄存器内容和一个“三重故障”的信息。
|
||||||
|
|
||||||
我们马上就会去处理这些问题,但是现在,我们可以使用调试器去检查我们是否进入了用户模式。使用 `make qemu-gdb` 并在 `env_pop_tf` 处设置一个 GDB 断点,它是你进入用户模式之前到达的最后一个函数。使用 `si` 单步进入这个函数;处理器将在 `iret` 指令之后进入用户模式。然后你将会看到在用户环境运行的第一个指令,它将是在 `lib/entry.S` 中的标签 `start` 的第一个指令 `cmpl`。现在,在 `hello` 中的 `sys_cputs()` 的 `int $0x30` 处使用 `b *0x...`(关于用户空间的地址,请查看 `obj/user/hello.asm` )设置断点。这个指令 `int` 是系统调用去显示一个字符到控制台。如果到 `int` 还没有运行,那么可能在你的地址空间设置或程序加载代码时发生了错误;返回去找到问题并解决后重新运行。
|
我们马上就会去处理这些问题,但是现在,我们可以使用调试器去检查我们是否进入了用户模式。使用 `make qemu-gdb` 并在 `env_pop_tf` 处设置一个 GDB 断点,它是你进入用户模式之前到达的最后一个函数。使用 `si` 单步进入这个函数;处理器将在 `iret` 指令之后进入用户模式。然后你将会看到在用户环境运行的第一个指令,它将是在 `lib/entry.S` 中的标签 `start` 的第一个指令 `cmpl`。现在,在 `hello` 中的 `sys_cputs()` 的 `int $0x30` 处使用 `b *0x...`(关于用户空间的地址,请查看 `obj/user/hello.asm` )设置断点。这个指令 `int` 是系统调用去显示一个字符到控制台。如果到 `int` 还没有运行,那么可能在你的地址空间设置或程序加载代码时发生了错误;返回去找到问题并解决后重新运行。
|
||||||
|
|
||||||
##### 处理中断和异常
|
#### 处理中断和异常
|
||||||
|
|
||||||
到目前为止,在用户空间中的第一个系统调用指令 `int $0x30` 已正式寿终正寝了:一旦处理器进入用户模式,将无法返回。因此,现在,你需要去实现基本的异常和系统调用服务程序,因为那样才有可能让内核从用户模式代码中恢复对处理器的控制。你所做的第一件事情就是彻底地掌握 x86 的中断和异常机制的使用。
|
到目前为止,在用户空间中的第一个系统调用指令 `int $0x30` 已正式寿终正寝了:一旦处理器进入用户模式,将无法返回。因此,现在,你需要去实现基本的异常和系统调用服务程序,因为那样才有可能让内核从用户模式代码中恢复对处理器的控制。你所做的第一件事情就是彻底地掌握 x86 的中断和异常机制的使用。
|
||||||
|
|
||||||
```
|
> **练习 3**、如果你对中断和异常机制不熟悉的话,阅读 80386 程序员手册的第 9 章(或 IA-32 开发者手册的第 5 章)。
|
||||||
练习 3、如果你对中断和异常机制不熟悉的话,阅读 80386 程序员手册的第 9 章(或 IA-32 开发者手册的第 5 章)。
|
|
||||||
```
|
|
||||||
|
|
||||||
在这个实验中,对于中断、异常、以其它类似的东西,我们将遵循 Intel 的术语习惯。由于如<ruby>异常<rt>exception</rt></ruby>、<ruby>陷阱<rt>trap</rt></ruby>、<ruby>中断<rt>interrupt</rt></ruby>、<ruby>故障<rt>fault</rt></ruby>和<ruby>中止<rt>abort</rt></ruby>这些术语在不同的架构和操作系统上并没有一个统一的标准,我们经常在特定的架构下(如 x86)并不去考虑它们之间的细微差别。当你在本实验以外的地方看到这些术语时,它们的含义可能有细微的差别。
|
在这个实验中,对于中断、异常、以其它类似的东西,我们将遵循 Intel 的术语习惯。由于如<ruby>异常<rt>exception</rt></ruby>、<ruby>陷阱<rt>trap</rt></ruby>、<ruby>中断<rt>interrupt</rt></ruby>、<ruby>故障<rt>fault</rt></ruby>和<ruby>中止<rt>abort</rt></ruby>这些术语在不同的架构和操作系统上并没有一个统一的标准,我们经常在特定的架构下(如 x86)并不去考虑它们之间的细微差别。当你在本实验以外的地方看到这些术语时,它们的含义可能有细微的差别。
|
||||||
|
|
||||||
##### 受保护的控制转移基础
|
#### 受保护的控制转移基础
|
||||||
|
|
||||||
异常和中断都是“受保护的控制转移”,它将导致处理器从用户模式切换到内核模式(CPL=0)而不会让用户模式的代码干扰到内核的其它函数或其它的环境。在 Intel 的术语中,一个中断就是一个“受保护的控制转移”,它是由于处理器以外的外部异步事件所引发的,比如外部设备 I/O 活动通知。而异常正好与之相反,它是由当前正在运行的代码所引发的同步的、受保护的控制转移,比如由于发生了一个除零错误或对无效内存的访问。
|
异常和中断都是“受保护的控制转移”,它将导致处理器从用户模式切换到内核模式(`CPL=0`)而不会让用户模式的代码干扰到内核的其它函数或其它的环境。在 Intel 的术语中,一个中断就是一个“受保护的控制转移”,它是由于处理器以外的外部异步事件所引发的,比如外部设备 I/O 活动通知。而异常正好与之相反,它是由当前正在运行的代码所引发的同步的、受保护的控制转移,比如由于发生了一个除零错误或对无效内存的访问。
|
||||||
|
|
||||||
为了确保这些受保护的控制转移是真正地受到保护,处理器的中断/异常机制设计是:当中断/异常发生时,当前运行的代码不能随意选择进入内核的位置和方式。而是,处理器在确保内核能够严格控制的条件下才能进入内核。在 x86 上,有两种机制协同来提供这种保护:
|
为了确保这些受保护的控制转移是真正地受到保护,处理器的中断/异常机制设计是:当中断/异常发生时,当前运行的代码不能随意选择进入内核的位置和方式。而是,处理器在确保内核能够严格控制的条件下才能进入内核。在 x86 上,有两种机制协同来提供这种保护:
|
||||||
|
|
||||||
1. **中断描述符表** 处理器确保中断和异常仅能够导致内核进入几个特定的、由内核本身定义好的、明确的入口点,而不是去运行中断或异常发生时的代码。
|
1. **中断描述符表** 处理器确保中断和异常仅能够导致内核进入几个特定的、由内核本身定义好的、明确的入口点,而不是去运行中断或异常发生时的代码。
|
||||||
|
|
||||||
x86 允许最多有 256 个不同的中断或异常入口点去进入内核,每个入口点都使用一个不同的中断向量。一个向量是一个介于 0 和 255 之间的数字。一个中断向量是由中断源确定的:不同的设备、错误条件、以及应用程序去请求内核使用不同的向量生成中断。CPU 使用向量作为进入处理器的中断描述符表(IDT)的索引,它是内核设置的内核私有内存,GDT 也是。从这个表中的适当的条目中,处理器将加载:
|
x86 允许最多有 256 个不同的中断或异常入口点去进入内核,每个入口点都使用一个不同的中断向量。一个向量是一个介于 0 和 255 之间的数字。一个中断向量是由中断源确定的:不同的设备、错误条件、以及应用程序去请求内核使用不同的向量生成中断。CPU 使用向量作为进入处理器的中断描述符表(IDT)的索引,它是内核设置的内核私有内存,GDT 也是。从这个表中的适当的条目中,处理器将加载:
|
||||||
|
|
||||||
* 将值加载到指令指针寄存器(EIP),指向内核代码设计好的,用于处理这种异常的服务程序。
|
* 将值加载到指令指针寄存器(EIP),指向内核代码设计好的,用于处理这种异常的服务程序。
|
||||||
* 将值加载到代码段寄存器(CS),它包含运行权限为 0—1 级别的、要运行的异常服务程序。(在 JOS 中,所有的异常处理程序都运行在内核模式中,运行级别为 level 0。)
|
* 将值加载到代码段寄存器(CS),它包含运行权限为 0—1 级别的、要运行的异常服务程序。(在 JOS 中,所有的异常处理程序都运行在内核模式中,运行级别为 0。)
|
||||||
2. **任务状态描述符表** 处理器在中断或异常发生时,需要一个地方去保存旧的处理器状态,比如,处理器在调用异常服务程序之前的 `EIP` 和 `CS` 的原始值,这样那个异常服务程序就能够稍后通过还原旧的状态来回到中断发生时的代码位置。但是对于已保存的处理器的旧状态必须被保护起来,不能被无权限的用户模式代码访问;否则代码中的 bug 或恶意用户代码将危及内核。
|
|
||||||
|
|
||||||
基于这个原因,当一个 x86 处理器产生一个中断或陷阱时,将导致权限级别的变更,从用户模式转换到内核模式,它也将导致在内核的内存中发生栈切换。有一个被称为 TSS 的任务状态描述符表规定段描述符和这个栈所处的地址。处理器在这个新栈上推送 `SS`、`ESP`、`EFLAGS`、`CS`、`EIP`、以及一个可选的错误代码。然后它从中断描述符上加载 `CS` 和 `EIP` 的值,然后设置 `ESP` 和 `SS` 去指向新的栈。
|
2. **任务状态描述符表** 处理器在中断或异常发生时,需要一个地方去保存旧的处理器状态,比如,处理器在调用异常服务程序之前的 `EIP` 和 `CS` 的原始值,这样那个异常服务程序就能够稍后通过还原旧的状态来回到中断发生时的代码位置。但是对于已保存的处理器的旧状态必须被保护起来,不能被无权限的用户模式代码访问;否则代码中的 bug 或恶意用户代码将危及内核。
|
||||||
|
|
||||||
虽然 TSS 很大并且默默地为各种用途服务,但是 JOS 仅用它去定义当从用户模式到内核模式的转移发生时,处理器即将切换过去的内核栈。因为在 JOS 中的“内核模式”仅运行在 x86 的 level 0 权限上,当进入内核模式时,处理器使用 TSS 上的 `ESP0` 和 `SS0` 字段去定义内核栈。JOS 并不去使用 TSS 的任何其它字段。
|
基于这个原因,当一个 x86 处理器产生一个中断或陷阱时,将导致权限级别的变更,从用户模式转换到内核模式,它也将导致在内核的内存中发生栈切换。有一个被称为 TSS 的任务状态描述符表规定段描述符和这个栈所处的地址。处理器在这个新栈上推送 `SS`、`ESP`、`EFLAGS`、`CS`、`EIP`、以及一个可选的错误代码。然后它从中断描述符上加载 `CS` 和 `EIP` 的值,然后设置 `ESP` 和 `SS` 去指向新的栈。
|
||||||
|
|
||||||
|
虽然 TSS 很大并且默默地为各种用途服务,但是 JOS 仅用它去定义当从用户模式到内核模式的转移发生时,处理器即将切换过去的内核栈。因为在 JOS 中的“内核模式”仅运行在 x86 的运行级别 0 权限上,当进入内核模式时,处理器使用 TSS 上的 `ESP0` 和 `SS0` 字段去定义内核栈。JOS 并不去使用 TSS 的任何其它字段。
|
||||||
|
|
||||||
|
#### 异常和中断的类型
|
||||||
|
|
||||||
##### 异常和中断的类型
|
|
||||||
|
|
||||||
所有的 x86 处理器上的同步异常都能够产生一个内部使用的、介于 0 到 31 之间的中断向量,因此它映射到 IDT 就是条目 0-31。例如,一个页故障总是通过向量 14 引发一个异常。大于 31 的中断向量仅用于软件中断,它由 `int` 指令生成,或异步硬件中断,当需要时,它们由外部设备产生。
|
所有的 x86 处理器上的同步异常都能够产生一个内部使用的、介于 0 到 31 之间的中断向量,因此它映射到 IDT 就是条目 0-31。例如,一个页故障总是通过向量 14 引发一个异常。大于 31 的中断向量仅用于软件中断,它由 `int` 指令生成,或异步硬件中断,当需要时,它们由外部设备产生。
|
||||||
|
|
||||||
在这一节中,我们将扩展 JOS 去处理向量为 0-31 之间的、内部产生的 x86 异常。在下一节中,我们将完成 JOS 的 48(0x30)号软件中断向量,JOS 将(随意选择的)使用它作为系统调用中断向量。在实验 4 中,我们将扩展 JOS 去处理外部生成的硬件中断,比如时钟中断。
|
在这一节中,我们将扩展 JOS 去处理向量为 0-31 之间的、内部产生的 x86 异常。在下一节中,我们将完成 JOS 的 48(0x30)号软件中断向量,JOS 将(随意选择的)使用它作为系统调用中断向量。在实验 4 中,我们将扩展 JOS 去处理外部生成的硬件中断,比如时钟中断。
|
||||||
|
|
||||||
##### 一个示例
|
#### 一个示例
|
||||||
|
|
||||||
我们把这些片断综合到一起,通过一个示例来巩固一下。我们假设处理器在用户环境下运行代码,遇到一个除零问题。
|
我们把这些片断综合到一起,通过一个示例来巩固一下。我们假设处理器在用户环境下运行代码,遇到一个除零问题。
|
||||||
|
|
||||||
1. 处理器去切换到由 TSS 中的 `SS0` 和 `ESP0` 定义的栈,在 JOS 中,它们各自保存着值 `GD_KD` 和 `KSTACKTOP`。
|
1. 处理器去切换到由 TSS 中的 `SS0` 和 `ESP0` 定义的栈,在 JOS 中,它们各自保存着值 `GD_KD` 和 `KSTACKTOP`。
|
||||||
|
2. 处理器在内核栈上推入异常参数,起始地址为 `KSTACKTOP`:
|
||||||
2. 处理器在内核栈上推入异常参数,起始地址为 `KSTACKTOP`:
|
|
||||||
|
|
||||||
|
```
|
||||||
|
+--------------------+ KSTACKTOP
|
||||||
|
| 0x00000 | old SS | " - 4
|
||||||
|
| old ESP | " - 8
|
||||||
|
| old EFLAGS | " - 12
|
||||||
|
| 0x00000 | old CS | " - 16
|
||||||
|
| old EIP | " - 20 <---- ESP
|
||||||
|
+--------------------+
|
||||||
```
|
```
|
||||||
+--------------------+ KSTACKTOP
|
3. 由于我们要处理一个除零错误,它将在 x86 上产生一个中断向量 0,处理器读取 IDT 的条目 0,然后设置 `CS:EIP` 去指向由条目描述的处理函数。
|
||||||
| 0x00000 | old SS | " - 4
|
4. 处理服务程序函数将接管控制权并处理异常,例如中止用户环境。
|
||||||
| old ESP | " - 8
|
|
||||||
| old EFLAGS | " - 12
|
|
||||||
| 0x00000 | old CS | " - 16
|
|
||||||
| old EIP | " - 20 <---- ESP
|
|
||||||
+--------------------+
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
3. 由于我们要处理一个除零错误,它将在 x86 上产生一个中断向量 0,处理器读取 IDT 的条目 0,然后设置 `CS:EIP` 去指向由条目描述的处理函数。
|
|
||||||
|
|
||||||
4. 处理服务程序函数将接管控制权并处理异常,例如中止用户环境。
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
对于某些类型的 x86 异常,除了以上的五个“标准的”寄存器外,处理器还推入另一个包含错误代码的寄存器值到栈中。页故障异常,向量号为 14,就是一个重要的示例。查看 80386 手册去确定哪些异常推入一个错误代码,以及错误代码在那个案例中的意义。当处理器推入一个错误代码后,当从用户模式中进入内核模式,异常处理服务程序开始时的栈看起来应该如下所示:
|
对于某些类型的 x86 异常,除了以上的五个“标准的”寄存器外,处理器还推入另一个包含错误代码的寄存器值到栈中。页故障异常,向量号为 14,就是一个重要的示例。查看 80386 手册去确定哪些异常推入一个错误代码,以及错误代码在那个案例中的意义。当处理器推入一个错误代码后,当从用户模式中进入内核模式,异常处理服务程序开始时的栈看起来应该如下所示:
|
||||||
|
|
||||||
```
|
```
|
||||||
+--------------------+ KSTACKTOP
|
+--------------------+ KSTACKTOP
|
||||||
| 0x00000 | old SS | " - 4
|
| 0x00000 | old SS | " - 4
|
||||||
| old ESP | " - 8
|
| old ESP | " - 8
|
||||||
| old EFLAGS | " - 12
|
| old EFLAGS | " - 12
|
||||||
| 0x00000 | old CS | " - 16
|
| 0x00000 | old CS | " - 16
|
||||||
| old EIP | " - 20
|
| old EIP | " - 20
|
||||||
| error code | " - 24 <---- ESP
|
| error code | " - 24 <---- ESP
|
||||||
+--------------------+
|
+--------------------+
|
||||||
```
|
```
|
||||||
|
|
||||||
##### 嵌套的异常和中断
|
#### 嵌套的异常和中断
|
||||||
|
|
||||||
处理器能够处理来自用户和内核模式中的异常和中断。当收到来自用户模式的异常和中断时才会进入内核模式中,而且,在推送它的旧寄存器状态到栈中和通过 IDT 调用相关的异常服务程序之前,x86 处理器会自动切换栈。如果当异常或中断发生时,处理器已经处于内核模式中(`CS` 寄存器低位两个比特为 0),那么 CPU 只是推入一些值到相同的内核栈中。在这种方式中,内核可以优雅地处理嵌套的异常,嵌套的异常一般由内核本身的代码所引发。在实现保护时,这种功能是非常重要的工具,我们将在稍后的系统调用中看到它。
|
处理器能够处理来自用户和内核模式中的异常和中断。当收到来自用户模式的异常和中断时才会进入内核模式中,而且,在推送它的旧寄存器状态到栈中和通过 IDT 调用相关的异常服务程序之前,x86 处理器会自动切换栈。如果当异常或中断发生时,处理器已经处于内核模式中(`CS` 寄存器低位两个比特为 0),那么 CPU 只是推入一些值到相同的内核栈中。在这种方式中,内核可以优雅地处理嵌套的异常,嵌套的异常一般由内核本身的代码所引发。在实现保护时,这种功能是非常重要的工具,我们将在稍后的系统调用中看到它。
|
||||||
|
|
||||||
如果处理器已经处于内核模式中,并且发生了一个嵌套的异常,由于它并不需要切换栈,它也就不需要去保存旧的 `SS` 或 `ESP` 寄存器。对于不推入错误代码的异常类型,在进入到异常服务程序时,它的内核栈看起来应该如下图:
|
如果处理器已经处于内核模式中,并且发生了一个嵌套的异常,由于它并不需要切换栈,它也就不需要去保存旧的 `SS` 或 `ESP` 寄存器。对于不推入错误代码的异常类型,在进入到异常服务程序时,它的内核栈看起来应该如下图:
|
||||||
|
|
||||||
```
|
```
|
||||||
+--------------------+ <---- old ESP
|
+--------------------+ <---- old ESP
|
||||||
| old EFLAGS | " - 4
|
| old EFLAGS | " - 4
|
||||||
| 0x00000 | old CS | " - 8
|
| 0x00000 | old CS | " - 8
|
||||||
| old EIP | " - 12
|
| old EIP | " - 12
|
||||||
+--------------------+
|
+--------------------+
|
||||||
```
|
```
|
||||||
|
|
||||||
对于需要推入一个错误代码的异常类型,处理器将在旧的 `EIP` 之后,立即推入一个错误代码,就和前面一样。
|
对于需要推入一个错误代码的异常类型,处理器将在旧的 `EIP` 之后,立即推入一个错误代码,就和前面一样。
|
||||||
|
|
||||||
关于处理器的异常嵌套的功能,这里有一个重要的警告。如果处理器正处于内核模式时发生了一个异常,并且不论是什么原因,比如栈空间泄漏,都不会去推送它的旧的状态,那么这时处理器将不能做任何的恢复,它只是简单地重置。毫无疑问,内核应该被设计为禁止发生这种情况。
|
关于处理器的异常嵌套的功能,这里有一个重要的警告。如果处理器正处于内核模式时发生了一个异常,并且不论是什么原因,比如栈空间泄漏,都不会去推送它的旧的状态,那么这时处理器将不能做任何的恢复,它只是简单地重置。毫无疑问,内核应该被设计为禁止发生这种情况。
|
||||||
|
|
||||||
##### 设置 IDT
|
#### 设置 IDT
|
||||||
|
|
||||||
到目前为止,你应该有了在 JOS 中为了设置 IDT 和处理异常所需的基本信息。现在,我们去设置 IDT 以处理中断向量 0-31(处理器异常)。我们将在本实验的稍后部分处理系统调用,然后在后面的实验中增加中断 32-47(设备 IRQ)。
|
到目前为止,你应该有了在 JOS 中为了设置 IDT 和处理异常所需的基本信息。现在,我们去设置 IDT 以处理中断向量 0-31(处理器异常)。我们将在本实验的稍后部分处理系统调用,然后在后面的实验中增加中断 32-47(设备 IRQ)。
|
||||||
|
|
||||||
@ -311,102 +300,94 @@ x86 允许最多有 256 个不同的中断或异常入口点去进入内核,
|
|||||||
你将要实现的完整的控制流如下图所描述:
|
你将要实现的完整的控制流如下图所描述:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
IDT trapentry.S trap.c
|
IDT trapentry.S trap.c
|
||||||
|
|
||||||
+----------------+
|
+----------------+
|
||||||
| &handler1 |---------> handler1: trap (struct Trapframe *tf)
|
| &handler1 |----> handler1: trap (struct Trapframe *tf)
|
||||||
| | // do stuff {
|
| | // do stuff {
|
||||||
| | call trap // handle the exception/interrupt
|
| | call trap // handle the exception/interrupt
|
||||||
| | // ... }
|
| | // ... }
|
||||||
+----------------+
|
+----------------+
|
||||||
| &handler2 |--------> handler2:
|
| &handler2 |----> handler2:
|
||||||
| | // do stuff
|
| | // do stuff
|
||||||
| | call trap
|
| | call trap
|
||||||
| | // ...
|
| | // ...
|
||||||
+----------------+
|
+----------------+
|
||||||
.
|
.
|
||||||
.
|
.
|
||||||
.
|
.
|
||||||
+----------------+
|
+----------------+
|
||||||
| &handlerX |--------> handlerX:
|
| &handlerX |----> handlerX:
|
||||||
| | // do stuff
|
| | // do stuff
|
||||||
| | call trap
|
| | call trap
|
||||||
| | // ...
|
| | // ...
|
||||||
+----------------+
|
+----------------+
|
||||||
```
|
```
|
||||||
|
|
||||||
每个异常或中断都应该在 `trapentry.S` 中有它自己的处理程序,并且 `trap_init()` 应该使用这些处理程序的地址去初始化 IDT。每个处理程序都应该在栈上构建一个 `struct Trapframe`(查看 `inc/trap.h`),然后使用一个指针调用 `trap()`(在 `trap.c` 中)到 `Trapframe`。`trap()` 接着处理异常/中断或派发给一个特定的处理函数。
|
每个异常或中断都应该在 `trapentry.S` 中有它自己的处理程序,并且 `trap_init()` 应该使用这些处理程序的地址去初始化 IDT。每个处理程序都应该在栈上构建一个 `struct Trapframe`(查看 `inc/trap.h`),然后使用一个指针调用 `trap()`(在 `trap.c` 中)到 `Trapframe`。`trap()` 接着处理异常/中断或派发给一个特定的处理函数。
|
||||||
|
|
||||||
```markdown
|
> 练习 4、编辑 `trapentry.S` 和 `trap.c`,然后实现上面所描述的功能。在 `trapentry.S` 中的宏 `TRAPHANDLER` 和 `TRAPHANDLER_NOEC` 将会帮你,还有在 `inc/trap.h` 中的 T_* defines。你需要在 `trapentry.S` 中为每个定义在 `inc/trap.h` 中的陷阱添加一个入口点(使用这些宏),并且你将有 t、o 提供的 `_alltraps`,这是由宏 `TRAPHANDLER`指向到它。你也需要去修改 `trap_init()` 来初始化 `idt`,以使它指向到每个在 `trapentry.S` 中定义的入口点;宏 `SETGATE` 将有助你实现它。
|
||||||
练习 4、编辑 `trapentry.S` 和 `trap.c`,然后实现上面所描述的功能。在 `trapentry.S` 中的宏 `TRAPHANDLER` 和 `TRAPHANDLER_NOEC` 将会帮你,还有在 `inc/trap.h` 中的 T_* defines。你需要在 `trapentry.S` 中为每个定义在 `inc/trap.h` 中的陷阱添加一个入口点(使用这些宏),并且你将有 t、o 提供的 `_alltraps`,这是由宏 `TRAPHANDLER`指向到它。你也需要去修改 `trap_init()` 来初始化 `idt`,以使它指向到每个在 `trapentry.S` 中定义的入口点;宏 `SETGATE` 将有助你实现它。
|
|
||||||
|
|
||||||
你的 `_alltraps` 应该:
|
> 你的 `_alltraps` 应该:
|
||||||
|
|
||||||
1. 推送值以使栈看上去像一个结构 Trapframe
|
> 1. 推送值以使栈看上去像一个结构 Trapframe
|
||||||
2. 加载 `GD_KD` 到 `%ds` 和 `%es`
|
> 2. 加载 `GD_KD` 到 `%ds` 和 `%es`
|
||||||
3. `pushl %esp` 去传递一个指针到 Trapframe 以作为一个 trap() 的参数
|
> 3. `pushl %esp` 去传递一个指针到 Trapframe 以作为一个 trap() 的参数
|
||||||
4. `call trap` (`trap` 能够返回吗?)
|
> 4. `call trap` (`trap` 能够返回吗?)
|
||||||
|
|
||||||
|
> 考虑使用 `pushal` 指令;它非常适合 `struct Trapframe` 的布局。
|
||||||
|
|
||||||
|
> 使用一些在 `user` 目录中的测试程序来测试你的陷阱处理代码,这些测试程序在生成任何系统调用之前能引发异常,比如 `user/divzero`。在这时,你应该能够成功完成 `divzero`、`softint`、以有 `badsegment` 测试。
|
||||||
|
|
||||||
考虑使用 `pushal` 指令;它非常适合 `struct Trapframe` 的布局。
|
.
|
||||||
|
|
||||||
使用一些在 `user` 目录中的测试程序来测试你的陷阱处理代码,这些测试程序在生成任何系统调用之前能引发异常,比如 `user/divzero`。在这时,你应该能够成功完成 `divzero`、`softint`、以有 `badsegment` 测试。
|
> **小挑战!**目前,在 `trapentry.S` 中列出的 `TRAPHANDLER` 和他们安装在 `trap.c` 中可能有许多代码非常相似。清除它们。修改 `trapentry.S` 中的宏去自动为 `trap.c` 生成一个表。注意,你可以直接使用 `.text` 和 `.data` 在汇编器中切换放置其中的代码和数据。
|
||||||
|
|
||||||
|
.
|
||||||
|
|
||||||
|
> **问题**
|
||||||
|
|
||||||
|
> 在你的 `answers-lab3.txt` 中回答下列问题:
|
||||||
|
|
||||||
|
> 1. 为每个异常/中断设置一个独立的服务程序函数的目的是什么?(即:如果所有的异常/中断都传递给同一个服务程序,在我们的当前实现中能否提供这样的特性?)
|
||||||
|
> 2. 你需要做什么事情才能让 `user/softint` 程序正常运行?评级脚本预计将会产生一个一般保护故障(trap 13),但是 `softint` 的代码显示为 `int $14`。为什么它产生的中断向量是 13?如果内核允许 `softint` 的 `int $14` 指令去调用内核页故障的服务程序(它的中断向量是 14)会发生什么事情?
|
||||||
```
|
```
|
||||||
|
|
||||||
```markdown
|
|
||||||
小挑战!目前,在 `trapentry.S` 中列出的 `TRAPHANDLER` 和他们安装在 `trap.c` 中可能有许多代码非常相似。清除它们。修改 `trapentry.S` 中的宏去自动为 `trap.c` 生成一个表。注意,你可以直接使用 `.text` 和 `.data` 在汇编器中切换放置其中的代码和数据。
|
|
||||||
```
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
问题
|
|
||||||
|
|
||||||
在你的 `answers-lab3.txt` 中回答下列问题:
|
|
||||||
|
|
||||||
1. 为每个异常/中断设置一个独立的服务程序函数的目的是什么?(即:如果所有的异常/中断都传递给同一个服务程序,在我们的当前实现中能否提供这样的特性?)
|
|
||||||
2. 你需要做什么事情才能让 `user/softint` 程序正常运行?评级脚本预计将会产生一个一般保护故障(trap 13),但是 `softint` 的代码显示为 `int $14`。为什么它产生的中断向量是 13?如果内核允许 `softint` 的 `int $14` 指令去调用内核页故障的服务程序(它的中断向量是 14)会发生什么事情?
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
本实验的 Part A 部分结束了。不要忘了去添加 `answers-lab3.txt` 文件,提交你的变更,然后在 Part A 作业的提交截止日期之前运行 `make handin`。
|
本实验的 Part A 部分结束了。不要忘了去添加 `answers-lab3.txt` 文件,提交你的变更,然后在 Part A 作业的提交截止日期之前运行 `make handin`。
|
||||||
|
|
||||||
#### Part B:页故障、断点异常、和系统调用
|
### Part B:页故障、断点异常、和系统调用
|
||||||
|
|
||||||
现在,你的内核已经有了最基本的异常处理能力,你将要去继续改进它,来提供依赖异常服务程序的操作系统原语。
|
现在,你的内核已经有了最基本的异常处理能力,你将要去继续改进它,来提供依赖异常服务程序的操作系统原语。
|
||||||
|
|
||||||
##### 处理页故障
|
#### 处理页故障
|
||||||
|
|
||||||
页故障异常,中断向量为 14(`T_PGFLT`),它是一个非常重要的东西,我们将通过本实验和接下来的实验来大量练习它。当处理器产生一个页故障时,处理器将在它的一个特定的控制寄存器(`CR2`)中保存导致这个故障的线性地址(即:虚拟地址)。在 `trap.c` 中我们提供了一个专门处理它的函数的一个雏形,它就是 `page_fault_handler()`,我们将用它来处理页故障异常。
|
页故障异常,中断向量为 14(`T_PGFLT`),它是一个非常重要的东西,我们将通过本实验和接下来的实验来大量练习它。当处理器产生一个页故障时,处理器将在它的一个特定的控制寄存器(`CR2`)中保存导致这个故障的线性地址(即:虚拟地址)。在 `trap.c` 中我们提供了一个专门处理它的函数的一个雏形,它就是 `page_fault_handler()`,我们将用它来处理页故障异常。
|
||||||
|
|
||||||
```markdown
|
> **练习 5**、修改 `trap_dispatch()` 将页故障异常派发到 `page_fault_handler()` 上。你现在应该能够成功测试 `faultread`、`faultreadkernel`、`faultwrite` 和 `faultwritekernel` 了。如果它们中的任何一个不能正常工作,找出问题并修复它。记住,你可以使用 `make run-x` 或 `make run-x-nox` 去重引导 JOS 进入到一个特定的用户程序。比如,你可以运行 `make run-hello-nox` 去运行 `hello` 用户程序。
|
||||||
练习 5、修改 `trap_dispatch()` 将页故障异常派发到 `page_fault_handler()` 上。你现在应该能够成功测试 `faultread`、`faultreadkernel`、`faultwrite`、和 `faultwritekernel` 了。如果它们中的任何一个不能正常工作,找出问题并修复它。记住,你可以使用 make run- _x_ 或 make run- _x_ -nox 去重引导 JOS 进入到一个特定的用户程序。比如,你可以运行 make run-hello-nox 去运行 the _hello_ user 程序。
|
|
||||||
```
|
|
||||||
|
|
||||||
下面,你将进一步细化内核的页故障服务程序,因为你要实现系统调用了。
|
下面,你将进一步细化内核的页故障服务程序,因为你要实现系统调用了。
|
||||||
|
|
||||||
##### 断点异常
|
#### 断点异常
|
||||||
|
|
||||||
断点异常,中断向量为 3(`T_BRKPT`),它一般用在调试上,它在一个程序代码中插入断点,从而使用特定的 1 字节的 `int3` 软件中断指令来临时替换相应的程序指令。在 JOS 中,我们将稍微“滥用”一下这个异常,通过将它打造成一个伪系统调用原语,使得任何用户环境都可以用它来调用 JOS 内核监视器。如果我们将 JOS 内核监视认为是原始调试器,那么这种用法是合适的。例如,在 `lib/panic.c` 中实现的用户模式下的 `panic()` ,它在显示它的 `panic` 消息后运行一个 `int3` 中断。
|
断点异常,中断向量为 3(`T_BRKPT`),它一般用在调试上,它在一个程序代码中插入断点,从而使用特定的 1 字节的 `int3` 软件中断指令来临时替换相应的程序指令。在 JOS 中,我们将稍微“滥用”一下这个异常,通过将它打造成一个伪系统调用原语,使得任何用户环境都可以用它来调用 JOS 内核监视器。如果我们将 JOS 内核监视认为是原始调试器,那么这种用法是合适的。例如,在 `lib/panic.c` 中实现的用户模式下的 `panic()` ,它在显示它的 `panic` 消息后运行一个 `int3` 中断。
|
||||||
|
|
||||||
```markdown
|
> **练习 6**、修改 `trap_dispatch()`,让它在调用内核监视器时产生一个断点异常。你现在应该可以在 `breakpoint` 上成功完成测试。
|
||||||
练习 6、修改 `trap_dispatch()`,让它在调用内核监视器时产生一个断点异常。你现在应该可以在 `breakpoint` 上成功完成测试。
|
|
||||||
```
|
|
||||||
|
|
||||||
```markdown
|
.
|
||||||
小挑战!修改 JOS 内核监视器,以便于你能够从当前位置(即:在 `int3` 之后,断点异常调用了内核监视器) '继续' 异常,并且因此你就可以一次运行一个单步指令。为了实现单步运行,你需要去理解 `EFLAGS` 寄存器中的某些比特的意义。
|
|
||||||
|
|
||||||
可选:如果你富有冒险精神,找一些 x86 反汇编的代码 —— 即通过从 QEMU 中、或从 GNU 二进制工具中分离、或你自己编写 —— 然后扩展 JOS 内核监视器,以使它能够反汇编,显示你的每步的指令。结合实验 1 中的符号表,这将是你写的一个真正的内核调试器。
|
> **小挑战!**修改 JOS 内核监视器,以便于你能够从当前位置(即:在 `int3` 之后,断点异常调用了内核监视器) '继续' 异常,并且因此你就可以一次运行一个单步指令。为了实现单步运行,你需要去理解 `EFLAGS` 寄存器中的某些比特的意义。
|
||||||
```
|
|
||||||
|
|
||||||
```markdown
|
> 可选:如果你富有冒险精神,找一些 x86 反汇编的代码 —— 即通过从 QEMU 中、或从 GNU 二进制工具中分离、或你自己编写 —— 然后扩展 JOS 内核监视器,以使它能够反汇编,显示你的每步的指令。结合实验 1 中的符号表,这将是你写的一个真正的内核调试器。
|
||||||
问题
|
|
||||||
|
|
||||||
3. 在断点测试案例中,根据你在 IDT 中如何初始化断点条目的不同情况(即:你的从 `trap_init` 到 `SETGATE` 的调用),既有可能产生一个断点异常,也有可能产生一个一般保护故障。为什么?为了能够像上面的案例那样工作,你需要如何去设置它,什么样的不正确设置才会触发一个一般保护故障?
|
.
|
||||||
4. 你认为这些机制的意义是什么?尤其是要考虑 `user/softint` 测试程序的工作原理。
|
|
||||||
```
|
|
||||||
|
|
||||||
|
> **问题**
|
||||||
|
|
||||||
##### 系统调用
|
> 3. 在断点测试案例中,根据你在 IDT 中如何初始化断点条目的不同情况(即:你的从 `trap_init` 到 `SETGATE` 的调用),既有可能产生一个断点异常,也有可能产生一个一般保护故障。为什么?为了能够像上面的案例那样工作,你需要如何去设置它,什么样的不正确设置才会触发一个一般保护故障?
|
||||||
|
|
||||||
|
> 4. 你认为这些机制的意义是什么?尤其是要考虑 `user/softint` 测试程序的工作原理。
|
||||||
|
|
||||||
|
#### 系统调用
|
||||||
|
|
||||||
用户进程请求内核为它做事情就是通过系统调用来实现的。当用户进程请求一个系统调用时,处理器首先进入内核模式,处理器和内核配合去保存用户进程的状态,内核为了完成系统调用会运行有关的代码,然后重新回到用户进程。用户进程如何获得内核的关注以及它如何指定它需要的系统调用的具体细节,这在不同的系统上是不同的。
|
用户进程请求内核为它做事情就是通过系统调用来实现的。当用户进程请求一个系统调用时,处理器首先进入内核模式,处理器和内核配合去保存用户进程的状态,内核为了完成系统调用会运行有关的代码,然后重新回到用户进程。用户进程如何获得内核的关注以及它如何指定它需要的系统调用的具体细节,这在不同的系统上是不同的。
|
||||||
|
|
||||||
@ -414,45 +395,43 @@ x86 允许最多有 256 个不同的中断或异常入口点去进入内核,
|
|||||||
|
|
||||||
应用程序将在寄存器中传递系统调用号和系统调用参数。通过这种方式,内核就不需要去遍历用户环境的栈或指令流。系统调用号将放在 `%eax` 中,而参数(最多五个)将分别放在 `%edx`、`%ecx`、`%ebx`、`%edi`、和 `%esi` 中。内核将在 `%eax` 中传递返回值。在 `lib/syscall.c` 中的 `syscall()` 中已为你编写了使用一个系统调用的汇编代码。你可以通过阅读它来确保你已经理解了它们都做了什么。
|
应用程序将在寄存器中传递系统调用号和系统调用参数。通过这种方式,内核就不需要去遍历用户环境的栈或指令流。系统调用号将放在 `%eax` 中,而参数(最多五个)将分别放在 `%edx`、`%ecx`、`%ebx`、`%edi`、和 `%esi` 中。内核将在 `%eax` 中传递返回值。在 `lib/syscall.c` 中的 `syscall()` 中已为你编写了使用一个系统调用的汇编代码。你可以通过阅读它来确保你已经理解了它们都做了什么。
|
||||||
|
|
||||||
```markdown
|
> **练习 7**、在内核中为中断向量 `T_SYSCALL` 添加一个服务程序。你将需要去编辑 `kern/trapentry.S` 和 `kern/trap.c` 的 `trap_init()`。还需要去修改 `trap_dispatch()`,以便于通过使用适当的参数来调用 `syscall()` (定义在 `kern/syscall.c`)以处理系统调用中断,然后将系统调用的返回值安排在 `%eax` 中传递给用户进程。最后,你需要去实现 `kern/syscall.c` 中的 `syscall()`。如果系统调用号是无效值,确保 `syscall()` 返回值一定是 `-E_INVAL`。为确保你理解了系统调用的接口,你应该去阅读和掌握 `lib/syscall.c` 文件(尤其是行内汇编的动作),对于在 `inc/syscall.h` 中列出的每个系统调用都需要通过调用相关的内核函数来处理A。
|
||||||
练习 7、在内核中为中断向量 `T_SYSCALL` 添加一个服务程序。你将需要去编辑 `kern/trapentry.S` 和 `kern/trap.c` 的 `trap_init()`。还需要去修改 `trap_dispatch()`,以便于通过使用适当的参数来调用 `syscall()` (定义在 `kern/syscall.c`)以处理系统调用中断,然后将系统调用的返回值安排在 `%eax` 中传递给用户进程。最后,你需要去实现 `kern/syscall.c` 中的 `syscall()`。如果系统调用号是无效值,确保 `syscall()` 返回值一定是 `-E_INVAL`。为确保你理解了系统调用的接口,你应该去阅读和掌握 `lib/syscall.c` 文件(尤其是行内汇编的动作),对于在 `inc/syscall.h` 中列出的每个系统调用都需要通过调用相关的内核函数来处理A。
|
|
||||||
|
|
||||||
在你的内核中运行 `user/hello` 程序(make run-hello)。它应该在控制台上输出 "`hello, world`",然后在用户模式中产生一个页故障。如果没有产生页故障,可能意味着你的系统调用服务程序不太正确。现在,你应该有能力成功通过 `testbss` 测试。
|
> 在你的内核中运行 `user/hello` 程序(make run-hello)。它应该在控制台上输出 `hello, world`,然后在用户模式中产生一个页故障。如果没有产生页故障,可能意味着你的系统调用服务程序不太正确。现在,你应该有能力成功通过 `testbss` 测试。
|
||||||
|
|
||||||
|
.
|
||||||
|
|
||||||
|
> 小挑战!使用 `sysenter` 和 `sysexit` 指令而不是使用 `int 0x30` 和 `iret` 来实现系统调用。
|
||||||
|
|
||||||
|
> `sysenter/sysexit` 指令是由 Intel 设计的,它的运行速度要比 `int/iret` 指令快。它使用寄存器而不是栈来做到这一点,并且通过假定了分段寄存器是如何使用的。关于这些指令的详细内容可以在 Intel 参考手册 2B 卷中找到。
|
||||||
|
|
||||||
|
> 在 JOS 中添加对这些指令支持的最容易的方法是,在 `kern/trapentry.S` 中添加一个 `sysenter_handler`,在它里面保存足够多的关于用户环境返回、设置内核环境、推送参数到 `syscall()`、以及直接调用 `syscall()` 的信息。一旦 `syscall()` 返回,它将设置好运行 `sysexit` 指令所需的一切东西。你也将需要在 `kern/init.c` 中添加一些代码,以设置特殊模块寄存器(MSRs)。在 AMD 架构程序员手册第 2 卷的 6.1.2 节中和 Intel 参考手册的 2B 卷的 SYSENTER 上都有关于 MSRs 的很详细的描述。对于如何去写 MSRs,在[这里][4]你可以找到一个添加到 `inc/x86.h` 中的 `wrmsr` 的实现。
|
||||||
|
|
||||||
|
> 最后,`lib/syscall.c` 必须要修改,以便于支持用 `sysenter` 来生成一个系统调用。下面是 `sysenter` 指令的一种可能的寄存器布局:
|
||||||
|
|
||||||
|
> ```
|
||||||
|
eax - syscall number
|
||||||
|
edx, ecx, ebx, edi - arg1, arg2, arg3, arg4
|
||||||
|
esi - return pc
|
||||||
|
ebp - return esp
|
||||||
|
esp - trashed by sysenter
|
||||||
```
|
```
|
||||||
|
|
||||||
```markdown
|
> GCC 的内联汇编器将自动保存你告诉它的直接加载进寄存器的值。不要忘了同时去保存(`push`)和恢复(`pop`)你使用的其它寄存器,或告诉内联汇编器你正在使用它们。内联汇编器不支持保存 `%ebp`,因此你需要自己去增加一些代码来保存和恢复它们,返回地址可以使用一个像 `leal after_sysenter_label, %%esi` 的指令置入到 `%esi` 中。
|
||||||
小挑战!使用 `sysenter` 和 `sysexit` 指令而不是使用 `int 0x30` 和 `iret` 来实现系统调用。
|
|
||||||
|
|
||||||
`sysenter/sysexit` 指令是由 Intel 设计的,它的运行速度要比 `int/iret` 指令快。它使用寄存器而不是栈来做到这一点,并且通过假定了分段寄存器是如何使用的。关于这些指令的详细内容可以在 Intel 参考手册 2B 卷中找到。
|
> 注意,它仅支持 4 个参数,因此你需要保留支持 5 个参数的系统调用的旧方法。而且,因为这个快速路径并不更新当前环境的 trap 帧,因此,在我们添加到后续实验中的一些系统调用上,它并不适合。
|
||||||
|
|
||||||
在 JOS 中添加对这些指令支持的最容易的方法是,在 `kern/trapentry.S` 中添加一个 `sysenter_handler`,在它里面保存足够多的关于用户环境返回、设置内核环境、推送参数到 `syscall()`、以及直接调用 `syscall()` 的信息。一旦 `syscall()` 返回,它将设置好运行 `sysexit` 指令所需的一切东西。你也将需要在 `kern/init.c` 中添加一些代码,以设置特殊模块寄存器(MSRs)。在 AMD 架构程序员手册第 2 卷的 6.1.2 节中和 Intel 参考手册的 2B 卷的 SYSENTER 上都有关于 MSRs 的很详细的描述。对于如何去写 MSRs,在[这里][4]你可以找到一个添加到 `inc/x86.h` 中的 `wrmsr` 的实现。
|
> 在接下来的实验中我们启用了异步中断,你需要再次去评估一下你的代码。尤其是,当返回到用户进程时,你需要去启用中断,而 `sysexit` 指令并不会为你去做这一动作。
|
||||||
|
|
||||||
最后,`lib/syscall.c` 必须要修改,以便于支持用 `sysenter` 来生成一个系统调用。下面是 `sysenter` 指令的一种可能的寄存器布局:
|
#### 启动用户模式
|
||||||
|
|
||||||
eax - syscall number
|
|
||||||
edx, ecx, ebx, edi - arg1, arg2, arg3, arg4
|
|
||||||
esi - return pc
|
|
||||||
ebp - return esp
|
|
||||||
esp - trashed by sysenter
|
|
||||||
|
|
||||||
GCC 的内联汇编器将自动保存你告诉它的直接加载进寄存器的值。不要忘了同时去保存(push)和恢复(pop)你使用的其它寄存器,或告诉内联汇编器你正在使用它们。内联汇编器不支持保存 `%ebp`,因此你需要自己去增加一些代码来保存和恢复它们,返回地址可以使用一个像 `leal after_sysenter_label, %%esi` 的指令置入到 `%esi` 中。
|
|
||||||
|
|
||||||
注意,它仅支持 4 个参数,因此你需要保留支持 5 个参数的系统调用的旧方法。而且,因为这个快速路径并不更新当前环境的 trap 帧,因此,在我们添加到后续实验中的一些系统调用上,它并不适合。
|
|
||||||
|
|
||||||
在接下来的实验中我们启用了异步中断,你需要再次去评估一下你的代码。尤其是,当返回到用户进程时,你需要去启用中断,而 `sysexit` 指令并不会为你去做这一动作。
|
|
||||||
```
|
|
||||||
|
|
||||||
##### 启动用户模式
|
|
||||||
|
|
||||||
一个用户程序是从 `lib/entry.S` 的顶部开始运行的。在一些配置之后,代码调用 `lib/libmain.c` 中的 `libmain()`。你应该去修改 `libmain()` 以初始化全局指针 `thisenv`,使它指向到这个环境在数组 `envs[]` 中的 `struct Env`。(注意那个 `lib/entry.S` 中已经定义 `envs` 去指向到在 Part A 中映射的你的设置。)提示:查看 `inc/env.h` 和使用 `sys_getenvid`。
|
一个用户程序是从 `lib/entry.S` 的顶部开始运行的。在一些配置之后,代码调用 `lib/libmain.c` 中的 `libmain()`。你应该去修改 `libmain()` 以初始化全局指针 `thisenv`,使它指向到这个环境在数组 `envs[]` 中的 `struct Env`。(注意那个 `lib/entry.S` 中已经定义 `envs` 去指向到在 Part A 中映射的你的设置。)提示:查看 `inc/env.h` 和使用 `sys_getenvid`。
|
||||||
|
|
||||||
`libmain()` 接下来调用 `umain`,在 hello 程序的案例中,`umain` 是在 `user/hello.c` 中。注意,它在输出 "`hello, world`” 之后,它尝试去访问 `thisenv->env_id`。这就是为什么前面会发生故障的原因了。现在,你已经正确地初始化了 `thisenv`,它应该不会再发生故障了。如果仍然会发生故障,或许是因为你没有映射 `UENVS` 区域为用户可读取(回到前面 Part A 中 查看 `pmap.c`);这是我们第一次真实地使用 `UENVS` 区域)。
|
`libmain()` 接下来调用 `umain`,在 hello 程序的案例中,`umain` 是在 `user/hello.c` 中。注意,它在输出 "`hello, world`” 之后,它尝试去访问 `thisenv->env_id`。这就是为什么前面会发生故障的原因了。现在,你已经正确地初始化了 `thisenv`,它应该不会再发生故障了。如果仍然会发生故障,或许是因为你没有映射 `UENVS` 区域为用户可读取(回到前面 Part A 中 查看 `pmap.c`);这是我们第一次真实地使用 `UENVS` 区域)。
|
||||||
|
|
||||||
```markdown
|
> **练习 8**、添加要求的代码到用户库,然后引导你的内核。你应该能够看到 `user/hello` 程序会输出 `hello, world` 然后输出 `i am environment 00001000`。`user/hello` 接下来会通过调用 `sys_env_destroy()`(查看`lib/libmain.c` 和 `lib/exit.c`)尝试去“退出”。由于内核目前仅支持一个用户环境,它应该会报告它毁坏了唯一的环境,然后进入到内核监视器中。现在你应该能够成功通过 `hello` 的测试。
|
||||||
练习 8、添加要求的代码到用户库,然后引导你的内核。你应该能够看到 `user/hello` 程序会输出 "`hello, world`" 然后输出 "`i am environment 00001000`"。`user/hello` 接下来会通过调用 `sys_env_destroy()`(查看`lib/libmain.c` 和 `lib/exit.c`)尝试去"退出"。由于内核目前仅支持一个用户环境,它应该会报告它毁坏了唯一的环境,然后进入到内核监视器中。现在你应该能够成功通过 `hello` 的测试。
|
|
||||||
```
|
|
||||||
|
|
||||||
##### 页故障和内存保护
|
#### 页故障和内存保护
|
||||||
|
|
||||||
内存保护是一个操作系统中最重要的特性,通过它来保证一个程序中的 bug 不会破坏其它程序或操作系统本身。
|
内存保护是一个操作系统中最重要的特性,通过它来保证一个程序中的 bug 不会破坏其它程序或操作系统本身。
|
||||||
|
|
||||||
@ -462,10 +441,8 @@ GCC 的内联汇编器将自动保存你告诉它的直接加载进寄存器的
|
|||||||
|
|
||||||
对于内存保护,系统调用中有一个非常有趣的问题。许多系统调用接口让用户程序传递指针到内核中。这些指针指向用户要读取或写入的缓冲区。然后内核在执行系统调用时废弃这些指针。这样就有两个问题:
|
对于内存保护,系统调用中有一个非常有趣的问题。许多系统调用接口让用户程序传递指针到内核中。这些指针指向用户要读取或写入的缓冲区。然后内核在执行系统调用时废弃这些指针。这样就有两个问题:
|
||||||
|
|
||||||
1. 内核中的页故障可能比用户程序中的页故障多的多。如果内核在维护它自己的数据结构时发生页故障,那就是一个内核 bug,而故障服务程序将使整个内核(和整个系统)崩溃。但是当内核废弃了由用户程序传递给它的指针后,它就需要一种方式去记住那些废弃指针所导致的页故障其实是代表用户程序的。
|
1. 内核中的页故障可能比用户程序中的页故障多的多。如果内核在维护它自己的数据结构时发生页故障,那就是一个内核 bug,而故障服务程序将使整个内核(和整个系统)崩溃。但是当内核废弃了由用户程序传递给它的指针后,它就需要一种方式去记住那些废弃指针所导致的页故障其实是代表用户程序的。
|
||||||
2. 一般情况下内核拥有比用户程序更多的权限。用户程序可以传递一个指针到系统调用,而指针指向的区域有可能是内核可以读取或写入而用户程序不可访问的区域。内核必须要非常小心,不能被废弃的这种指针欺骗,因为这可能导致泄露私有信息或破坏内核的完整性。
|
2. 一般情况下内核拥有比用户程序更多的权限。用户程序可以传递一个指针到系统调用,而指针指向的区域有可能是内核可以读取或写入而用户程序不可访问的区域。内核必须要非常小心,不能被废弃的这种指针欺骗,因为这可能导致泄露私有信息或破坏内核的完整性。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
由于以上的原因,内核在处理由用户程序提供的指针时必须格外小心。
|
由于以上的原因,内核在处理由用户程序提供的指针时必须格外小心。
|
||||||
|
|
||||||
@ -473,32 +450,33 @@ GCC 的内联汇编器将自动保存你告诉它的直接加载进寄存器的
|
|||||||
|
|
||||||
这样,内核在废弃一个用户提供的指针时就绝不会发生页故障。如果内核出现这种页故障,它应该崩溃并终止。
|
这样,内核在废弃一个用户提供的指针时就绝不会发生页故障。如果内核出现这种页故障,它应该崩溃并终止。
|
||||||
|
|
||||||
```markdown
|
> **练习 9**、如果在内核模式中发生一个页故障,修改 `kern/trap.c` 去崩溃。
|
||||||
练习 9、如果在内核模式中发生一个页故障,修改 `kern/trap.c` 去崩溃。
|
|
||||||
|
|
||||||
提示:判断一个页故障是发生在用户模式还是内核模式,去检查 `tf_cs` 的低位比特即可。
|
> 提示:判断一个页故障是发生在用户模式还是内核模式,去检查 `tf_cs` 的低位比特即可。
|
||||||
|
|
||||||
阅读 `kern/pmap.c` 中的 `user_mem_assert` 并在那个文件中实现 `user_mem_check`。
|
> 阅读 `kern/pmap.c` 中的 `user_mem_assert` 并在那个文件中实现 `user_mem_check`。
|
||||||
|
|
||||||
修改 `kern/syscall.c` 去常态化检查传递给系统调用的参数。
|
> 修改 `kern/syscall.c` 去常态化检查传递给系统调用的参数。
|
||||||
|
|
||||||
引导你的内核,运行 `user/buggyhello`。环境将被毁坏,而内核将不会崩溃。你将会看到:
|
> 引导你的内核,运行 `user/buggyhello`。环境将被毁坏,而内核将不会崩溃。你将会看到:
|
||||||
|
|
||||||
[00001000] user_mem_check assertion failure for va 00000001
|
> ```
|
||||||
[00001000] free env 00001000
|
[00001000] user_mem_check assertion failure for va 00000001
|
||||||
Destroyed the only environment - nothing more to do!
|
[00001000] free env 00001000
|
||||||
最后,修改在 `kern/kdebug.c` 中的 `debuginfo_eip`,在 `usd`、`stabs`、和 `stabstr` 上调用 `user_mem_check`。如果你现在运行 `user/breakpoint`,你应该能够从内核监视器中运行回溯,然后在内核因页故障崩溃前看到回溯进入到 `lib/libmain.c`。是什么导致了这个页故障?你不需要去修复它,但是你应该明白它是如何发生的。
|
Destroyed the only environment - nothing more to do!
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> 最后,修改在 `kern/kdebug.c` 中的 `debuginfo_eip`,在 `usd`、`stabs`、和 `stabstr` 上调用 `user_mem_check`。如果你现在运行 `user/breakpoint`,你应该能够从内核监视器中运行回溯,然后在内核因页故障崩溃前看到回溯进入到 `lib/libmain.c`。是什么导致了这个页故障?你不需要去修复它,但是你应该明白它是如何发生的。
|
||||||
|
|
||||||
注意,刚才实现的这些机制也同样适用于恶意用户程序(比如 `user/evilhello`)。
|
注意,刚才实现的这些机制也同样适用于恶意用户程序(比如 `user/evilhello`)。
|
||||||
|
|
||||||
```
|
> **练习 10**、引导你的内核,运行 `user/evilhello`。环境应该被毁坏,并且内核不会崩溃。你应该能看到:
|
||||||
练习 10、引导你的内核,运行 `user/evilhello`。环境应该被毁坏,并且内核不会崩溃。你应该能看到:
|
|
||||||
|
|
||||||
[00000000] new env 00001000
|
> ```
|
||||||
...
|
[00000000] new env 00001000
|
||||||
[00001000] user_mem_check assertion failure for va f010000c
|
...
|
||||||
[00001000] free env 00001000
|
[00001000] user_mem_check assertion failure for va f010000c
|
||||||
|
[00001000] free env 00001000
|
||||||
```
|
```
|
||||||
|
|
||||||
**本实验到此结束。**确保你通过了所有的等级测试,并且不要忘记去写下问题的答案,在 `answers-lab3.txt` 中详细描述你的挑战练习的解决方案。提交你的变更并在 `lab` 目录下输入 `make handin` 去提交你的工作。
|
**本实验到此结束。**确保你通过了所有的等级测试,并且不要忘记去写下问题的答案,在 `answers-lab3.txt` 中详细描述你的挑战练习的解决方案。提交你的变更并在 `lab` 目录下输入 `make handin` 去提交你的工作。
|
||||||
@ -512,13 +490,13 @@ via: https://pdos.csail.mit.edu/6.828/2018/labs/lab3/
|
|||||||
作者:[csail.mit][a]
|
作者:[csail.mit][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[qhwdw](https://github.com/qhwdw)
|
译者:[qhwdw](https://github.com/qhwdw)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
[a]: https://pdos.csail.mit.edu
|
[a]: https://pdos.csail.mit.edu
|
||||||
[b]: https://github.com/lujun9972
|
[b]: https://github.com/lujun9972
|
||||||
[1]: https://pdos.csail.mit.edu/6.828/2018/labs/labguide.html
|
[1]: https://linux.cn/article-10273-1.html
|
||||||
[2]: https://pdos.csail.mit.edu/6.828/2018/labs/reference.html
|
[2]: https://pdos.csail.mit.edu/6.828/2018/labs/reference.html
|
||||||
[3]: http://blogs.msdn.com/larryosterman/archive/2005/02/08/369243.aspx
|
[3]: http://blogs.msdn.com/larryosterman/archive/2005/02/08/369243.aspx
|
||||||
[4]: http://ftp.kh.edu.tw/Linux/SuSE/people/garloff/linux/k6mod.c
|
[4]: http://ftp.kh.edu.tw/Linux/SuSE/people/garloff/linux/k6mod.c
|
@ -0,0 +1,163 @@
|
|||||||
|
有所为,有所不为:在 Linux 中使用超级用户权限
|
||||||
|
======
|
||||||
|
|
||||||
|
> sudo 命令允许特权用户以 root 用户身份运行全部或部分命令,但是理解其能做什么和不能做什么很有帮助。
|
||||||
|
|
||||||
|
![](https://images.idgesg.net/images/article/2018/11/superman-100781085-large.jpg)
|
||||||
|
|
||||||
|
在你想要使用超级权限临时运行一条命令时,`sudo` 命令非常方便,但是当它不能如你期望的工作时,你也会遇到一些麻烦。比如说你想在某些日志文件结尾添加一些重要的信息,你可能会尝试这样做:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ echo "Important note" >> /var/log/somelog
|
||||||
|
-bash: /var/log/somelog: Permission denied
|
||||||
|
```
|
||||||
|
|
||||||
|
好吧,看起来你似乎需要一些额外的特权。一般来说,你不能使用你的用户账号向系统日志中写入东西。我们使用 `sudo` 再尝试一次吧。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo !!
|
||||||
|
sudo echo "Important note" >> /var/log/somelog
|
||||||
|
-bash: /var/log/somelog: Permission denied
|
||||||
|
```
|
||||||
|
|
||||||
|
嗯,它还是没有啥反应。我们来试点不同的吧。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo 'echo "Important note" >> /var/log/somelog'
|
||||||
|
sudo: echo "Important note" >> /var/log/somelog: command not found
|
||||||
|
```
|
||||||
|
|
||||||
|
也可以查看:[在 Linux 下排查故障的宝贵提示和技巧][1]。
|
||||||
|
|
||||||
|
### 接下来该干什么?
|
||||||
|
|
||||||
|
上面在执行完第一条命令后的回应显示,我们缺少向日志文件写入时必须的特权。第二次,我们使用 root 权限运行了第一次的命令,但是返回了一个“没有权限”的错误。第三次,我们把整个命令放在一个引号里面再运行了一遍,返回了一个“没有发现命令”的错误。所以,到底错在哪里了呢?
|
||||||
|
|
||||||
|
* 第一条命令:没有 root 特权,你无法向这个日志中写入东西。
|
||||||
|
* 第二条命令:你的超级权限没有延伸到重定向。
|
||||||
|
* 第三条命令:`sudo` 不理解你用引号括起来的整个 “命令”。
|
||||||
|
|
||||||
|
而且如果你的用户还未添加到 sudo 用户组的时候,如果尝试使用 `sudo`,你可能已经看到过像下面的这么一条错误了:
|
||||||
|
|
||||||
|
```
|
||||||
|
nemo is not in the sudoers file. This incident will be reported.
|
||||||
|
```
|
||||||
|
|
||||||
|
### 你可以做什么?
|
||||||
|
|
||||||
|
一个相当简单的选择就是使用 `sudo` 命令暂时成为 root。鉴于你已经有了 sudo 特权,你可以使用下面的命令执行此操作:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo su
|
||||||
|
[sudo] password for nemo:
|
||||||
|
#
|
||||||
|
```
|
||||||
|
|
||||||
|
注意这个改变的提示符表明了你的新身份。然后你就可以以 root 运行之前的命令了:
|
||||||
|
|
||||||
|
```
|
||||||
|
# echo "Important note" >> /var/log/somelog
|
||||||
|
```
|
||||||
|
|
||||||
|
接着你可以输入 `^d` 返回你之前的身份。当然了,一些 sudo 的配置可能会阻止你使用 `sudo` 命令成为 root。
|
||||||
|
|
||||||
|
另一个切换用户为 root 的方法是仅用 `su` 命令,但是这需要你知道 root 密码。许多人被赋予了访问 sudo 的权限,而并不知道 root 密码,所以这并不是总是可行。
|
||||||
|
|
||||||
|
(采用 su 直接)切换到 root 之后,你就可以以 root 的身份运行任何你想执行的命令了。这种方式的问题是:1) 每个想要使用 root 特权的人都需要事先知道 root 的密码(这样不很安全);2) 如果在运行需要 root 权限的特定命令后未能退出特权状态,你的系统可能会受到一些重大错误的波及。`sudo` 命令旨在允许您仅在真正需要时使用 root 权限,并控制每个 sudo 用户应具有的 root 权限。它也可以使你在使用完 root 特权之后轻松地回到普通用户的状态。
|
||||||
|
|
||||||
|
另外请注意,整个讨论的前提是你可以正常地访问 sudo,并且你的访问权限没有受限。详细的内容后面会介绍到。
|
||||||
|
|
||||||
|
还有一个选择就是使用一个不同的命令。如果通过编辑文件从而在其后添加内容是一种选择的话,你也许可以使用 `sudo vi /var/log/somelog`,虽然编辑一个活跃的日志文件通常不是一个好主意,因为系统可能会频繁的向这个文件中进行写入操作。
|
||||||
|
|
||||||
|
最后一个但是有点复杂的选择是,使用下列命令之一可以解决我们之前看到的问题,但是它们涉及到了很多复杂的语法。第一个命令允许你在得到 “没有权限” 的拒绝之后可以使用 `!!` 重复你的命令:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo echo "Important note" >> /var/log/somelog
|
||||||
|
-bash: /var/log/somelog: Permission denied
|
||||||
|
$ !!:gs/>/|sudo tee -a / <=====
|
||||||
|
$ tail -1 /var/log/somelog
|
||||||
|
Important note
|
||||||
|
```
|
||||||
|
|
||||||
|
第二种是通过 `sudo` 命令,把你想要添加的信息传递给 `tee`。注意,`-a` 指定了你要**附加**文本到目标文件:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ echo "Important note" | sudo tee -a /var/log/somelog
|
||||||
|
$ tail -1 /var/log/somelog
|
||||||
|
Important note
|
||||||
|
```
|
||||||
|
|
||||||
|
### sudo 有多可控?
|
||||||
|
|
||||||
|
回答这个问题最快速的回答就是,它取决于管理它的人。大多数 Linux 的默认设置都非常简单。如果一个用户被安排到了一个特别的组中,例如 `wheel` 或者 `admin` 组,那这个用户无需知道 root 的密码就可以拥有运行任何命令的能力。这就是大多数 Linux 系统中的默认设置。一旦在 `/etc/group` 中添加了一个用户到了特权组中,这个用户就可以以 root 的权力运行任何命令。另一方面,可以配置 sudo,以便一些用户只能够以 root 身份运行单一指令或者一组命令中的任何一个。
|
||||||
|
|
||||||
|
如果把像下面展示的这些行添加到了 `/etc/sudoers` 文件中,例如 “nemo” 这个用户可以以 root 身份运行 `whoami` 命令。在现实中,这可能不会造成任何影响,它非常适合作为一个例子。
|
||||||
|
|
||||||
|
```
|
||||||
|
# User alias specification
|
||||||
|
nemo ALL=(root) NOPASSWD: WHOAMI
|
||||||
|
|
||||||
|
# Cmnd alias specification
|
||||||
|
Cmnd_Alias WHOAMI = /usr/bin/whoami
|
||||||
|
```
|
||||||
|
|
||||||
|
注意,我们添加了一个命令别名(`Cmnd_Alias`),它指定了一个可以运行的命令的全路径,以及一个用户别名,允许这个用户无需密码就可以使用 `sudo` 执行的单个命令。
|
||||||
|
|
||||||
|
当 nemo 运行 `sudo whoami` 命令的时候,他将会看到这个:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo whoami
|
||||||
|
root
|
||||||
|
```
|
||||||
|
|
||||||
|
注意这个,因为 nemo 使用 `sudo` 执行了这条命令,`whoami` 会显示该命令运行时的用户是 `root`。
|
||||||
|
|
||||||
|
至于其他的命令,nemo 将会看到像这样的一些内容:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo date
|
||||||
|
[sudo] password for nemo:
|
||||||
|
Sorry, user nemo is not allowed to execute '/bin/date' as root on butterfly.
|
||||||
|
```
|
||||||
|
|
||||||
|
### sudo 的默认设置
|
||||||
|
|
||||||
|
在默认路径中,我们会利用像下面展示的 `/etc/sudoers` 文件中的几行:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo egrep "admin|sudo" /etc/sudoers
|
||||||
|
# Members of the admin group may gain root privileges
|
||||||
|
%admin ALL=(ALL) ALL <=====
|
||||||
|
# Allow members of group sudo to execute any command
|
||||||
|
%sudo ALL=(ALL:ALL) ALL <=====
|
||||||
|
```
|
||||||
|
|
||||||
|
在这几行中,`%admin` 和 `%sudo` 都说明了任何添加到这些组中的人都可以使用 `sudo` 命令以 root 的身份运行任何命令。
|
||||||
|
|
||||||
|
下面列出的是 `/etc/group` 中的一行,它意味着每一个在该组中列出的成员,都拥有了 sudo 特权,而无需在 `/etc/sudoers` 中进行任何修改。
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo:x:27:shs,nemo
|
||||||
|
```
|
||||||
|
|
||||||
|
### 总结
|
||||||
|
|
||||||
|
`sudo` 命令意味着你可以根据需要轻松地部署超级用户的访问权限,而且只有在需要的时候才能赋予用户非常有限的特权访问权限。你可能会遇到一些与简单的 `sudo command` 不同的问题,不过在 `sudo` 的回应中应该会显示你遇到了什么问题。
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.networkworld.com/article/3322504/linux/selectively-deploying-your-superpowers-on-linux.html
|
||||||
|
|
||||||
|
作者:[Sandra Henry-Stocker][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[dianbanjiu](https://github.com/dianbanjiu)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html
|
||||||
|
[2]: https://www.facebook.com/NetworkWorld/
|
||||||
|
[3]: https://www.linkedin.com/company/network-world
|
@ -49,11 +49,11 @@ for catalog in "$@";do
|
|||||||
num=$(count_files_under_dir "${catalog}" "[0-9]*.md")
|
num=$(count_files_under_dir "${catalog}" "[0-9]*.md")
|
||||||
;;
|
;;
|
||||||
translating)
|
translating)
|
||||||
num=$(git grep -niE "translat|fanyi|翻译" sources/*.md |awk -F ":" '{if ($2<=3) print $1}' |wc -l)
|
num=$(git grep -niE "^[^[].*translat|^\[#\]: translator: \([^[:space:]]+\)|fanyi|翻译" sources/*.md |awk -F ":" '{if ($2<=3) print $1}'|wc -l)
|
||||||
;;
|
;;
|
||||||
sources)
|
sources)
|
||||||
total=$(count_files_under_dir "${catalog}" "[0-9]*.md")
|
total=$(count_files_under_dir "${catalog}" "[0-9]*.md")
|
||||||
translating_num=$(git grep -niE "translat|fanyi|翻译" sources/*.md |awk -F ":" '{if ($2<=3) print $1}' |wc -l)
|
translating_num=$(git grep -niE "^[^[].*translat|^\[#\]: translator: \([^[:space:]]+\)|fanyi|翻译" sources/*.md |awk -F ":" '{if ($2<=3) print $1}'|wc -l)
|
||||||
num=$((${total} - ${translating_num}))
|
num=$((${total} - ${translating_num}))
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (runningwater)
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (The Rise and Rise of JSON)
|
||||||
|
[#]: via: ( https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html)
|
||||||
|
[#]: author: (https://twobithistory.org)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
The Rise and Rise of JSON
|
The Rise and Rise of JSON
|
||||||
======
|
======
|
||||||
JSON has taken over the world. Today, when any two applications communicate with each other across the internet, odds are they do so using JSON. It has been adopted by all the big players: Of the ten most popular web APIs, a list consisting mostly of APIs offered by major companies like Google, Facebook, and Twitter, only one API exposes data in XML rather than JSON. Twitter, to take an illustrative example from that list, supported XML until 2013, when it released a new version of its API that dropped XML in favor of using JSON exclusively. JSON has also been widely adopted by the programming rank and file: According to Stack Overflow, a question and answer site for programmers, more questions are now asked about JSON than about any other data interchange format.
|
JSON has taken over the world. Today, when any two applications communicate with each other across the internet, odds are they do so using JSON. It has been adopted by all the big players: Of the ten most popular web APIs, a list consisting mostly of APIs offered by major companies like Google, Facebook, and Twitter, only one API exposes data in XML rather than JSON. Twitter, to take an illustrative example from that list, supported XML until 2013, when it released a new version of its API that dropped XML in favor of using JSON exclusively. JSON has also been widely adopted by the programming rank and file: According to Stack Overflow, a question and answer site for programmers, more questions are now asked about JSON than about any other data interchange format.
|
||||||
@ -80,7 +89,7 @@ via: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html
|
|||||||
|
|
||||||
作者:[Two-Bit History][a]
|
作者:[Two-Bit History][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
译者:[runningwater](https://github.com/runningwater)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
translating by valoniakim
|
||||||
|
|
||||||
What NASA Has Been Doing About Open Science
|
What NASA Has Been Doing About Open Science
|
||||||
======
|
======
|
||||||
![][1]
|
![][1]
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
[#]: collector: (lujun9972)
|
|
||||||
[#]: translator: (geekpi)
|
|
||||||
[#]: reviewer: ( )
|
|
||||||
[#]: publisher: ( )
|
|
||||||
[#]: subject: (How a university network assistant used Linux in the 90s)
|
|
||||||
[#]: via: (https://opensource.com/article/18/5/my-linux-story-student)
|
|
||||||
[#]: author: ([Alan Formy-Duva](https://opensource.com/users/alanfdoss)
|
|
||||||
[#]: url: ( )
|
|
||||||
|
|
||||||
How a university network assistant used Linux in the 90s
|
|
||||||
======
|
|
||||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/moneyrecycle_520x292.png?itok=SAaIziNr)
|
|
||||||
In the mid-1990s, I was enrolled in computer science classes. My university’s computer science department provided a SunOS server—a multi-user, multitasking Unix system—for its students. We logged into it and wrote source code for the programming languages we were learning, such as C, C++, and ADA. In those days, well before social networks and instant messaging, we also used the system to communicate with each other, sending emails and using utilities such as `write` and `talk`. We were each also allowed to host a personal website. I enjoyed being able to complete my assignments and contact other users.
|
|
||||||
|
|
||||||
It was my first experience with this type of operating environment, but I soon learned about another operating system that could do the same thing: Linux.
|
|
||||||
|
|
||||||
While I was a student, I also worked part-time at the university. My first position was as a network installer in the Department of Housing and Residence (H&R). This involved connecting student dormitories to the campus network. As this was the university's first dormitory network service, only two buildings and about 75 students had been connected.
|
|
||||||
|
|
||||||
In my second year, the network expanded to cover an additional two buildings. H&R decided to let the university’s Office of Information Technology (OIT) manage this growing operation. I transferred to OIT and started the position of Student Assistant to the OIT Network Manager. That is how I discovered Linux. One of my new responsibilities was to manage the firewall systems that provided network and internet access to the dormitories.
|
|
||||||
|
|
||||||
Each student was registered with their hardware MAC address. Registered students could connect to the dorm network and receive an IP address and a route to the internet. Unlike the other expensive SunOS and VMS servers used by the university, these firewalls used low-cost computers running the free and open source Linux operating system. By the end of the year, the system had registered nearly 500 students.
|
|
||||||
|
|
||||||
![Red hat Linux install disks][1]
|
|
||||||
|
|
||||||
The OIT network staff members were using Linux for HTTP, FTP, and other services. They also used Linux on their personal desktops. That's when I realized I had my hands on a computer system that looked and acted just like the expensive SunOS box in the CS department but without the high cost. Linux could run on commodity x86 hardware, such as a Dell Latitude with 8 MB of RAM and a 133Mhz Intel Pentium CPU. That was the selling point for me! I installed Red Hat Linux 5.2 on a box scavenged from the surplus warehouse and gave my friends login accounts.
|
|
||||||
|
|
||||||
While I used my new Linux server to host my website and provide accounts to my friends, it also offered graphics capabilities over the CS department server. Using the X Windows system, I could browse the web with Netscape Navigator, play music with [XMMS][2], and try out different window managers. I could also download and compile other open source software and write my own code.
|
|
||||||
|
|
||||||
I learned that Linux offered some pretty advanced features, many of which were more convenient than or superior to more mainstream operating systems. For example, many operating systems did not yet offer simple ways to apply updates. In Linux, this was easy, thanks to [autoRPM][3], an update manager written by Kirk Bauer, which sent the root user a daily email with available updates. It had an intuitive interface for reviewing and selecting software updates to install—pretty amazing for the mid-'90s.
|
|
||||||
|
|
||||||
Linux may not have been well-known back then, and it was often received with skepticism, but I was convinced it would survive. And survive it did!
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/article/18/5/my-linux-story-student
|
|
||||||
|
|
||||||
作者:[Alan Formy-Duval][a]
|
|
||||||
选题:[lujun9972](https://github.com/lujun9972)
|
|
||||||
译者:[译者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/alanfdoss
|
|
||||||
[1]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/images/life-uploads/red_hat_linux_install_disks.png?itok=VSw6Cke9 (Red hat Linux install disks)
|
|
||||||
[2]:http://www.xmms.org/
|
|
||||||
[3]:http://www.ccp14.ac.uk/solution/linux/autorpm_redhat7_3.html
|
|
@ -1,49 +0,0 @@
|
|||||||
hkurj translating
|
|
||||||
Why schools of the future are open
|
|
||||||
======
|
|
||||||
|
|
||||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OSDC_BYU_520x292_FINAL.png?itok=NVY7vR8o)
|
|
||||||
|
|
||||||
Someone recently asked me what education will look like in the modern era. My response: Much like it has for the last 100 years. How's that for a pessimistic view of our education system?
|
|
||||||
|
|
||||||
It's not a pessimistic view as much as it is a pragmatic one. Anyone who spends time in schools could walk away feeling similarly, given that the ways we teach young people are stubbornly resistant to change. As schools in the United States begin a new year, most students are returning to classrooms where desks are lined-up in rows, the instructional environment is primarily teacher-centred, progress is measured by Carnegie units and A-F grading, and collaboration is often considered cheating.
|
|
||||||
|
|
||||||
Were we able to point to evidence that this industrialized model was producing the kind of results that are required, where every child is given the personal attention needed to grow a love of learning and develop the skills needed to thrive in today's innovation economy, then we could very well be satisfied with the status quo. But any honest and objective look at current metrics speaks to the need for fundamental change.
|
|
||||||
|
|
||||||
But my view isn't a pessimistic one. In fact, it's quite optimistic.
|
|
||||||
|
|
||||||
For as easy as it is to dwell on what's wrong with our current education model, I also know of example after example of where education stakeholders are willing to step out of what's comfortable and challenge this system that is so immune to change. Teachers are demanding more collaboration with peers and more ways to be open and transparent about prototyping ideas that lead to true innovation for students—not just repackaging of traditional methods with technology. Administrators are enabling deeper, more connected learning to real-world applications through community-focused, project-based learning—not just jumping through hoops of "doing projects" in isolated classrooms. And parents are demanding that the joy and wonder of learning return to the culture of their schools that have been corrupted by an emphasis on test prep.
|
|
||||||
|
|
||||||
These and other types of cultural changes are never easy, especially in an environment so reluctant to take risks in the face of political backlash from any dip in test scores (regardless of statistical significance). So why am I optimistic that we are approaching a tipping point where the type of changes we desperately need can indeed overcome the inertia that has thwarted them for too long?
|
|
||||||
|
|
||||||
Because there is something else in water at this point in our modern era that was not present before: an ethos of openness, catalyzed by digital technology.
|
|
||||||
|
|
||||||
Think for a moment: If you need to learn how to speak basic French for an upcoming trip to France, where do you turn? You could sign up for a course at a local community college or check out a book from the library, but in all likelihood, you'll access a free online video and learn the basics you will need for your trip. Never before in human history has free, on-demand learning been so accessible. In fact, one can sign up right now for a free, online course from MIT on "[Special Topics in Mathematics with Applications: Linear Algebra and the Calculus of Variations][1]." Sign me up!
|
|
||||||
|
|
||||||
Why do schools such as MIT, Stanford, and Harvard offer free access to their courses? Why are people and corporations willing to openly share what was once tightly controlled intellectual property? Why are people all over the planet willing to invest their time—for no pay—to help with citizen science projects?
|
|
||||||
|
|
||||||
There is something else in water at this point in our modern era that was not present before: an ethos of openness, catalyzed by digital technology.
|
|
||||||
|
|
||||||
In his wonderful book [Open: How We'll Work Live and Learn in the Future][2], author David Price clearly describes how informal, social learning is becoming the new norm of learning, especially among young people accustomed to being able to get the "just in time" knowledge they need. Through a series of case studies, Price paints a clear picture of what happens when traditional institutions don't adapt to this new reality and thus become less and less relevant. That's the missing ingredient that has the crowdsourced power of creating positive disruption.
|
|
||||||
|
|
||||||
What Price points out (and what people are now demanding at a grassroots level) is nothing short of an open movement, one recognizing that open collaboration and free exchange of ideas have already disrupted ecosystems from music to software to publishing. And more than any top-down driven "reform," this expectation for openness has the potential to fundamentally alter an educational system that has resisted change for too long. In fact, one of the hallmarks of the open ethos is that it expects the transparent and fair democratization of knowledge for the benefit of all. So what better ecosystem for such an ethos to thrive than within the one that seeks to prepare young people to inherit the world and make it better?
|
|
||||||
|
|
||||||
Sure, the pessimist in me says that my earlier prediction about the future of education may indeed be the state of education in the short term future. But I am also very optimistic that this prediction will be proven to be dead wrong. I know that I and many other kindred-spirit educators are working every day to ensure that it's wrong. Won't you join me as we start a movement to help our schools [transform into open organizations][3]—to transition from from an outdated, legacy model to one that is more open, nimble, and responsive to the needs of every student and the communities in which they serve?
|
|
||||||
|
|
||||||
That's a true education model appropriate for the modern era.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/open-organization/18/9/modern-education-open-education
|
|
||||||
|
|
||||||
作者:[Ben Owens][a]
|
|
||||||
选题:[lujun9972](https://github.com/lujun9972)
|
|
||||||
译者:[译者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/engineerteacher
|
|
||||||
[1]: https://ocw.mit.edu/courses/mechanical-engineering/2-035-special-topics-in-mathematics-with-applications-linear-algebra-and-the-calculus-of-variations-spring-2007/
|
|
||||||
[2]: https://www.goodreads.com/book/show/18730272-open
|
|
||||||
[3]: https://opensource.com/open-organization/resources/open-org-definition
|
|
@ -1,59 +0,0 @@
|
|||||||
translating---geekpi
|
|
||||||
|
|
||||||
A Free Guide for Setting Your Open Source Strategy
|
|
||||||
======
|
|
||||||
|
|
||||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/os-strategy.jpg?itok=hSmtdJdK)
|
|
||||||
|
|
||||||
The majority of companies using open source understand its business value, but they may lack the tools to strategically implement an open source program and reap the full rewards. According to a recent survey from [The New Stack][1], “the top three benefits of open source programs are 1) increased awareness of open source, 2) more speed and agility in the development cycle, and 3) better license compliance.”
|
|
||||||
|
|
||||||
Running an open source program office involves creating a strategy to help you define and implement your approach as well as measure your progress. The [Open Source Guides to the Enterprise][2], developed by The Linux Foundation in partnership with the TODO Group, offer open source expertise based on years of experience and practice.
|
|
||||||
|
|
||||||
The most recent guide, [Setting an Open Source Strategy][3], details the essential steps in creating a strategy and setting you on the path to success. According to the guide, “your open source strategy connects the plans for managing, participating in, and creating open source software with the business objectives that the plans serve. This can open up many opportunities and catalyze innovation.” The guide covers the following topics:
|
|
||||||
|
|
||||||
1. Why create a strategy?
|
|
||||||
2. Your strategy document
|
|
||||||
3. Approaches to strategy
|
|
||||||
4. Key considerations
|
|
||||||
5. Other components
|
|
||||||
6. Determine ROI
|
|
||||||
7. Where to invest
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The critical first step here is creating and documenting your open source strategy, which will “help you maximize the benefits your organization gets from open source.” At the same time, your detailed strategy can help you avoid difficulties that may arise from mistakes such as choosing the wrong license or improperly maintaining code. According to the guide, this document can also:
|
|
||||||
|
|
||||||
* Get leaders excited and involved
|
|
||||||
* Help obtain buy-in within the company
|
|
||||||
* Facilitate decision-making in diffuse, multi-departmental organizations
|
|
||||||
* Help build a healthy community
|
|
||||||
* Explain your company’s approach to open source and support of its use
|
|
||||||
* Clarify where your company invests in community-driven, external R&D and where your company will focus on its value added differentiation
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
“At Salesforce, we have internal documents that we circulate to our engineering team, providing strategic guidance and encouragement around open source. These encourage the creation and use of open source, letting them know in no uncertain terms that the strategic leaders at the company are fully behind it. Additionally, if there are certain kinds of licenses we don’t want engineers using, or other open source guidelines for them, our internal documents need to be explicit,” said Ian Varley, Software Architect at Salesforce and contributor to the guide.
|
|
||||||
|
|
||||||
Open source programs help promote an enterprise culture that can make companies more productive, and, according to the guide, a strong strategy document can “help your team understand the business objectives behind your open source program, ensure better decision-making, and minimize risks.”
|
|
||||||
|
|
||||||
Learn how to align your goals for managing and creating open source software with your organization’s business objectives using the tips and proven practices in the new guide to [Setting an Open Source Strategy][3]. And, check out all 12 [Open Source Guides for the Enterprise][2] for more information on achieving success with open source.
|
|
||||||
|
|
||||||
This article originally appeared on [The Linux Foundation][4]
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://www.linux.com/blog/2018/11/free-guide-setting-your-open-source-strategy
|
|
||||||
|
|
||||||
作者:[Amber Ankerholz][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://www.linux.com/users/aankerholz
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://thenewstack.io/open-source-culture-starts-with-programs-and-policies/
|
|
||||||
[2]: https://www.linuxfoundation.org/resources/open-source-guides/
|
|
||||||
[3]: https://www.linuxfoundation.org/resources/open-source-guides/setting-an-open-source-strategy/
|
|
||||||
[4]: https://www.linuxfoundation.org/blog/2018/11/a-free-guide-for-setting-your-open-source-strategy/
|
|
@ -1,5 +1,5 @@
|
|||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: ( )
|
[#]: translator: (geekpi)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: ( )
|
||||||
[#]: publisher: ( )
|
[#]: publisher: ( )
|
||||||
[#]: subject: (10 ways to give thanks to open source and free software maintainers)
|
[#]: subject: (10 ways to give thanks to open source and free software maintainers)
|
||||||
|
108
sources/talk/20181129 9 top tech-recruiting mistakes to avoid.md
Normal file
108
sources/talk/20181129 9 top tech-recruiting mistakes to avoid.md
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (9 top tech-recruiting mistakes to avoid)
|
||||||
|
[#]: via: (https://opensource.com/article/18/11/top-tech-recruiting-mistakes-avoid)
|
||||||
|
[#]: author: (Rikki Endsley https://opensource.com/users/rikki-endsley)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
9 top tech-recruiting mistakes to avoid
|
||||||
|
======
|
||||||
|
We round up common mistakes tech recruiters make and a few best practices to adopt instead.
|
||||||
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/conversation-interview-mentor.png?itok=HjoOPcrB)
|
||||||
|
|
||||||
|
Some of my best friends and colleagues are tech recruiters, and a bunch of my favorite humans are on the job hunt. With these fine folks in mind, I decided to help them connect by finding out what kinds of recruiting efforts stand out to potential hires. I reached out to my colleagues and contacts and asked them what they like (and hate) when it comes to recruiting, then I rounded up a list of top tech-recruiting mistakes to avoid and best practices to use instead.
|
||||||
|
|
||||||
|
### 9 common tech recruiting mistakes to avoid
|
||||||
|
|
||||||
|
Don’t even think about reaching out to a potential candidate without doing due diligence on their background, experience, and expertise. Not knowing what skills a recruit has and what kind of work they’ve done in the past instantly turns off job seekers. Recruiters who make it clear that they’ve done their homework signal that they aren’t planning to waste a candidate’s time and stand a better chance of piquing their interest from the beginning. Common recruiting mistakes also include:
|
||||||
|
|
||||||
|
**1\. Sending form letters — or even worse, broken form letters.**
|
||||||
|
|
||||||
|
Unless someone is job-seeking and not getting many offers, chances are your form letter won’t stand out or get much interest. And if your form letter is broken and has [NAME] where a candidate’s name should appear, forget about getting any qualified candidate responses.
|
||||||
|
|
||||||
|
**2\. Blowing the salutation.**
|
||||||
|
|
||||||
|
Be sure to spell the candidate’s name correctly, and typing “Mr.” or “Miss” in the greeting could be a big mistake. For example, I can’t tell you how many “Mr. Endsley” messages I get every month, and “Miss Endsley” won’t sit well with me, either.
|
||||||
|
|
||||||
|
**3\. Not understanding what the recruit does.**
|
||||||
|
|
||||||
|
Potential candidates can tell whether you’ve done your homework, dug through their LinkedIn profiles, and have a grasp of their backgrounds, experiences, and areas of interest. Reaching out to a UX designer about an engineering role won’t get you good results.
|
||||||
|
|
||||||
|
**4\. Sending unsolicited contact requests.**
|
||||||
|
|
||||||
|
Don’t send LinkedIn connection requests to people you don’t know. Just don’t do it.
|
||||||
|
|
||||||
|
**5\. Being too general about the job position.**
|
||||||
|
|
||||||
|
Kill the coy. Share as many details you can about the role, including any must-have and nice-to-have skills. Draw potential recruits a picture of what the work looks like to make qualified candidates take notice.
|
||||||
|
|
||||||
|
**6\. Being too vague or mysterious about the team and company.**
|
||||||
|
|
||||||
|
Tech professionals with in-demand skills and experience are being more selective about what kind of team dynamics they walk into and [organizational ethics][1]. Letting potential hires know right away what the team looks like (e.g., small vs. large, remote vs. on-site) and which company you represent can save everyone a lot of time.
|
||||||
|
|
||||||
|
**7\. Having unrealistic or overly specific requirements.**
|
||||||
|
|
||||||
|
Does the right candidate really need to be an expert in every technology and programming language and hold multiple degrees? Be clear about what skills a candidate needs vs. what skills might come in handy or can be acquired on the job.
|
||||||
|
|
||||||
|
**8\. Getting too cutesy or culture-y in a description.**
|
||||||
|
|
||||||
|
Not all of us consider office puppies, free booze, and ping pong to be job perks. If this is the messaging you lead with, you’re going to attract a pretty specific kind of applicant and quickly narrow down your list of potential candidates.
|
||||||
|
|
||||||
|
Also [avoid terms][2] like “guys,” “rock star,” and “recent graduate,” which can translate to “women, minorities, and anyone over 25 need not apply.” Ouch.
|
||||||
|
|
||||||
|
**9\. Asking for referrals to other potential candidates.**
|
||||||
|
|
||||||
|
This is a no-win for recruiters. For example, I’m happy to recommend job seekers in my network for roles, but lots of other folks working in tech see this as lazy recruiting. The safest approach might be to ask a candidate later in the process, after you’ve developed a friendly working relationship and you've both agreed that this role doesn’t quite fit their interests or expertise. Then they might have other contacts in mind for it.
|
||||||
|
|
||||||
|
### 6 best practices for tech recruiters
|
||||||
|
|
||||||
|
**1\. Provide a sincere and personalized greeting.**
|
||||||
|
|
||||||
|
A personalized greeting goes a long way. Let potential candidates know you understand their previous work experience, you’re familiar with what they do, and that you have an idea of what they want to be doing.
|
||||||
|
![](https://opensource.com/sites/default/files/pictures/pjf_1.jpg)
|
||||||
|
|
||||||
|
**2\. Offer a transparent description of the team and the role.**
|
||||||
|
|
||||||
|
Be as clear as you can when describing the team and the role. Using words like “rock star” or “fast-paced team” does nothing to help the potential candidate visualize what they’d be walking into. Is this a small team? Remote team?
|
||||||
|
|
||||||
|
Being mysterious about the role won’t build intrigue, so opt for transparency.
|
||||||
|
|
||||||
|
**3\. Give the company name.**
|
||||||
|
|
||||||
|
Telling job candidates that the organization is a startup or a Fortune 500 company also won’t work as well being transparent about the organization from the beginning. How can anyone know whether they’re interested in a role if they don’t know which organization they’d be joining?
|
||||||
|
|
||||||
|
**4\. Be persistent and specific.**
|
||||||
|
|
||||||
|
In addition to providing the job description and company name, specifying the salary range and why you think the potential candidate is a good fit for the role stands out. Also consider specifying the work authorization and whether the organization provides visa sponsorships, relocation, and additional benefits beyond an hourly or annual salary. If you have a good feeling about a candidate who might not be a 100% technical fit with the job posting, let them know and open those lines of communication.
|
||||||
|
|
||||||
|
**5\. Invite potential candidates to local recruiting events.**
|
||||||
|
|
||||||
|
The event should provide brief presentations about the company, refreshments, and a networking opportunity. Here’s your chance to show off the culture (i.e., people) part of your organization in person.
|
||||||
|
|
||||||
|
**6\. Maintain a relationship with potential recruits.**
|
||||||
|
|
||||||
|
If you talk to a candidate who isn’t the right fit for a role, but who would be a great addition to your organization, keep the lines of communication open. If candidates have a good experience with a recruiter, they’ll also be more inclined to join the organization later or send other job seekers their way in the future.
|
||||||
|
|
||||||
|
### Bonus advice for tech recruits
|
||||||
|
|
||||||
|
Keep in mind that recruiters, like you, are just trying to do their jobs. If you're tired of hearing from recruiters and annoyed when they contact you, step back and get a little perspective. Although you might be in the fortunate spot of being happily employed and in-demand, not everyone else is. Grumbling about recruiters on social media is a great way to humble brag, but not the best way to show empathy for the job-seekers or win any friends.
|
||||||
|
|
||||||
|
_Thank you to the many people who contributed to this article! What would you add to these lists? Let us know in the comments._
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/18/11/top-tech-recruiting-mistakes-avoid
|
||||||
|
|
||||||
|
作者:[Rikki Endsley][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/rikki-endsley
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://spectrum.ieee.org/view-from-the-valley/at-work/tech-careers/engineers-say-no-thanks-to-silicon-valley-recruiters-citing-ethical-concerns
|
||||||
|
[2]: https://www.theladders.com/career-advice/job-descriptions-driving-away-women
|
@ -0,0 +1,68 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (Why giving back is important to the DevOps culture)
|
||||||
|
[#]: via: (https://opensource.com/article/18/11/why-sharing-important-devops-culture)
|
||||||
|
[#]: author: (Matty Stratton https://opensource.com/users/mattstratton)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Why giving back is important to the DevOps culture
|
||||||
|
======
|
||||||
|
Our habit of not sharing knowledge is doing us harm.
|
||||||
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bubblehands_fromRHT_520_0612LL.png?itok=_iQ2dO3S)
|
||||||
|
In the DevOps [CALMS][1] model (which stands for Culture, Automation, Lean, Measurement, and Sharing), Sharing is often overlooked or misunderstood. While each element of CALMS is just as important as the others, sharing knowledge is something that we often neglect.
|
||||||
|
|
||||||
|
### What happens if we don't share?
|
||||||
|
|
||||||
|
[Jeff Smith][2], director of production operations at [Centro][3], tells this story:
|
||||||
|
|
||||||
|
> A change to the level of granularity that gets stored in one of our reporting tables was made. The change increased the disk space usage on the database instance by 8x. Not only did this cause our existing database instance to rapidly fill up, but it also made operations question if the design pattern made sense. Because they weren't included in such an impactful change, all of the design decisions that went into the new process architecture were viewed as suspect and underwent a constant re-examination from ops. In a nutshell, a little bit of faith and trust was lost.
|
||||||
|
|
||||||
|
The damage caused by eroding faith can't be understated. Collaboration is based on trust. Every time this trust is chipped away, energy is spent on questioning the validity of decisions made by others.
|
||||||
|
|
||||||
|
### What are the benefits of sharing?
|
||||||
|
|
||||||
|
Today's systems are incredibly complex. The days when one person could hold an entire infrastructure and system interdependencies in their head are long gone. Communicating across boundaries of expertise makes our entire organization more robust and resilient.
|
||||||
|
|
||||||
|
Sharing isn't just about the technical data or access, though. "Inter-team communication should always start with the goal, not with one team's proposed solution to a problem," Jeff says. "When you start with a solution, the conversation veers in the wrong direction."
|
||||||
|
|
||||||
|
[Emily Freeman][4], CloudOps advocate at [Microsoft][5] says "Collaboration is impossible without sharing information." She points out that having a "mental map" of the skills and knowledge of other teams "enables people to ask questions more efficiently and reduces the fear they're asking too many questions or look stupid."
|
||||||
|
|
||||||
|
### How can we share better?
|
||||||
|
|
||||||
|
"Sharing doesn't have to be a drum circle every Tuesday at 10:30am," Emily says. "It's openness and authenticity. It's removing the shadows from your organization and ensuring everyone is honest and forthright and accountable."
|
||||||
|
|
||||||
|
At a minimum, there should be read-only access to logs, code, and after-incident reports for everyone. Before you cry "separation of concerns," please consider that the data that cannot be shared with everyone in the organization is a much smaller set than we usually think it is. It might require some additional effort to scrub and protect this small subset than to default to "nobody can see anything but their small part of it," but the benefits outweigh the effort.
|
||||||
|
|
||||||
|
"If anyone's excluded, they aren't part of your team, no matter what the org chart says," Emily reminds us.
|
||||||
|
|
||||||
|
It's more than the logs and the tooling, though. "The 'S' is often just seen as knowledge sharing, training, etc.," Jeff says. "But if it doesn't include the sharing of responsibility and ownership, it can be difficult to get your organization to that next level of productivity."
|
||||||
|
|
||||||
|
### Why don't we share?
|
||||||
|
|
||||||
|
There are many reasons that sharing information and knowledge isn't the default position for knowledge workers, but both Emily and Jeff agree it usually comes down to fear.
|
||||||
|
|
||||||
|
"Teams may feel that only their circle is capable of performing a particular task with the zeal and delicacy it deserves," Jeff says. "So information gets siloed, access gets restricted, and gates get constructed. But that diminishes our responsibility to build safe systems, instead leaning on 'operator expertise' as a crutch."
|
||||||
|
|
||||||
|
Emily agrees. "DevOps cultures never look to change the past," she says. "Instead, the companies that thrive at embracing the DevOps philosophy are realistic about where they are and work toward continuously improving their process so everyone on the team can thrive."
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/18/11/why-sharing-important-devops-culture
|
||||||
|
|
||||||
|
作者:[Matty Stratton][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/mattstratton
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://whatis.techtarget.com/definition/CALMS
|
||||||
|
[2]: https://twitter.com/DarkAndNerdy
|
||||||
|
[3]: https://www.centro.net/
|
||||||
|
[4]: https://twitter.com/editingemily
|
||||||
|
[5]: http://dev.azure.com/
|
@ -0,0 +1,93 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (3 emerging tipping points in open source)
|
||||||
|
[#]: via: (https://opensource.com/article/18/11/3-new-tipping-points-open-source)
|
||||||
|
[#]: author: (Bilgin lbryam https://opensource.com/users/bibryam)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
3 emerging tipping points in open source
|
||||||
|
======
|
||||||
|
Understand the factors advancing the open source model's evolution.
|
||||||
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/balance_tipping_seesaw_building.jpg?itok=Lu17pIYG)
|
||||||
|
|
||||||
|
Over the last two decades, open source has been expanding into all aspects of technology—from software to [hardware][1]; from small, disruptive startups to large, boring enterprises; from open standards to open [patents][2].
|
||||||
|
|
||||||
|
As movements evolve, they reach tipping points—stages that move the model in new directions. Following are three things that I believe are now reaching a tipping point in open source.
|
||||||
|
|
||||||
|
### Open for non-coders
|
||||||
|
|
||||||
|
As the name suggests, the open source model has mainly been focused on the source code. On the surface, that's probably because open source communities are usually made up of developers working on the source code, and the tools used in open source projects, such as source control systems, issue trackers, mailing list names, chat channel names, etc., all assume that developers are the center of the universe.
|
||||||
|
|
||||||
|
This has created big losses because it prevents creative people, designers, document writers, event organizers, community managers, lawyers, accountants, and many others from participating in open source communities. We need and want non-code contributors, but we don't have processes and tools to include them, means to measure their value, nor ways for their peers, the community, or their employers to reward their efforts. As a result, it has been a lose-lose for decades. We can see the implications in all the ugly websites, amateur logos, badly written and formatted documentation, disorganized events, etc., in open source projects.
|
||||||
|
|
||||||
|
The good news is that we are getting signals that change is on the way:
|
||||||
|
|
||||||
|
* [Linus Torvalds apologized][3] for his "bad behavior." While this wasn't specifically focused on non-coders, it symbolizes making open source a non-hostile place for less-technical contributors.
|
||||||
|
* The Cloud Native Computing Foundation (CNCF) introduced the [Non-Code Contributor's Guide][4]. In addition to showing the many ways people can contribute to open source projects, it also set a baseline for non-code contributions that other open source projects and foundations will end up following.
|
||||||
|
* The Apache Software Foundation (ASF) is working in the same direction. We've been holding long discussions, and we will have some concrete output very soon (note that is "ASF soon").
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
There is a little-known secret that is great news for non-coders and others new to open source: One of the easiest ways to be recognized as part of an established open source project is to do non-coding activities. Nowadays, with complex software stacks and tough competition, there is a pretty high bar for entering a project as a committer. Performing non-coding activities is less popular, and it opens a fast backdoor to open source communities.
|
||||||
|
|
||||||
|
![](https://opensource.com/sites/default/files/uploads/opensource_funnels.png)
|
||||||
|
|
||||||
|
### Macro acquisitions
|
||||||
|
|
||||||
|
Open source may have started in the hacker community as a way of scratching developers' personal itches, but today it is the place where innovation happens. Even the world's largest software companies are transitioning to the model to continue dominating their market.
|
||||||
|
|
||||||
|
Here are some good reasons enterprises have become so interested in contributing to open source:
|
||||||
|
|
||||||
|
* It multiplies the company's investments through contributions.
|
||||||
|
* They can benefit from the most recent technology advances and avoid reinventing the wheel.
|
||||||
|
* It helps spread knowledge of their software and its broader adoption.
|
||||||
|
* It increases the developer base and hiring pool.
|
||||||
|
* Internal developers' skills grow by learning from top coders in the field.
|
||||||
|
* It builds a company's reputation—developers want to work for organizations they can boast about.
|
||||||
|
* It aids recruitment and retention—developers want to work on exciting projects that affect large groups of people.
|
||||||
|
* New companies and projects can start faster through the open source networking effect.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Many enterprises are trying to shortcut the process by acquiring open source companies—which leads to even more open source adoption. Building an open source company takes many years of effort done out in the open. Hiring good developers who are willing to work in the open, building a community around a project, and creating a successful business model require delicate effort. Companies that manage to do this are very attractive for investment and acquisition, as they serve as a catalyst to turn the acquirer into an open source company at scale. The number of [successful open source companies][5] that is acquired seems to get bigger every day, and this trend is only getting stronger.
|
||||||
|
|
||||||
|
### Micro-funding of open source software
|
||||||
|
|
||||||
|
In addition to macro investments through acquisitions of open source companies, there has also been an increase in decentralized [micro-funding of self-sustaining][6] open source projects.
|
||||||
|
|
||||||
|
On one end of the spectrum, there are open source projects that are maintained primarily by intrinsically motivated developers. On the other end, large companies are hiring developers to work on open source projects driven by company roadmaps and strategies. That leaves a large number of open source projects that are not exciting enough for accidental contributors nor on enterprise companies' radar.
|
||||||
|
|
||||||
|
In recent years, there has been an increase in [platforms for funding and sustaining][7] these open source projects through bug bounties, micro-payments, recurring donations, one-time contributions, subscriptions, etc. These open source funding platforms allow individuals to take responsibility for open source sustainability in their own hands by paying maintainers directly. This enables people to contribute to the open source model through value transfer rather than code contributions.
|
||||||
|
|
||||||
|
There are three basic channels for open source contributions:
|
||||||
|
|
||||||
|
* Hobbyists contribute to open source projects because of intrinsic motivations rather than monetary value.
|
||||||
|
* Companies with open source business models (open core, SaaS, support, services, etc.) monetize open source projects directly with regular, planned, and centralized subsidization.
|
||||||
|
* Independent open source users provide irregular, micro, decentralized subsidization through [OSS funding][7] platforms.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
While hobbyists and hackers started the open source movement, it's turned into an enterprise monetization model. Having a model to sustain the remaining open source projects is welcome.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/18/11/3-new-tipping-points-open-source
|
||||||
|
|
||||||
|
作者:[Bilgin lbryam][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/bibryam
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/resources/what-open-hardware
|
||||||
|
[2]: https://www.redhat.com/en/blog/red-hat-welcomes-milestone-addition-open-invention-network-microsoft-joins-safeguard-linux-patent-attacks
|
||||||
|
[3]: https://lkml.org/lkml/2018/9/16/167
|
||||||
|
[4]: https://kubernetes.io/blog/2018/10/04/introducing-the-non-code-contributors-guide/
|
||||||
|
[5]: http://oss.cash/
|
||||||
|
[6]: https://opensource.com/article/18/8/open-source-tokenomics
|
||||||
|
[7]: http://oss.fund/
|
60
sources/talk/20181204 3 implications of serverless.md
Normal file
60
sources/talk/20181204 3 implications of serverless.md
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (3 implications of serverless)
|
||||||
|
[#]: via: (https://opensource.com/article/18/12/serverless-podcast-command-line-heros)
|
||||||
|
[#]: author: (Jen Wike Huger https://opensource.com/users/remyd)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
3 implications of serverless
|
||||||
|
======
|
||||||
|
Plus, when to go serverless and when to not?
|
||||||
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR)
|
||||||
|
|
||||||
|
If you strip away all of the modern conveniences and features that make up your internet experience today, what you're left with is the client-server model. This distributed network was what the internet was built on in the beginning, and that part hasn't changed. You could say, it is still serving us well.
|
||||||
|
|
||||||
|
So, when people talk about serverless, what does it mean? Well, it doesn't mean servers are GONE. Of course not: That "client-server model" is still the backbone of how things are getting done.
|
||||||
|
|
||||||
|
Serverless refers to a developer's ability to code, deploy, and create applications without having to know how to do the rest of it, like rack the servers, patch the operating system, and create container images.
|
||||||
|
|
||||||
|
### Top 3 implications of serverless
|
||||||
|
|
||||||
|
1. People who might not have been before are becoming developers now. Why? They have to learn less of that kind of stuff and get to do more of the creative stuff.
|
||||||
|
2. Developers don't have the recreate the wheel. Why? They let serverless providers do what they do best: run and maintain the servers, patch the operating systems, and build containers.
|
||||||
|
3. Reality check: Someone on your team still has to think about the big picture, about operations. Why? Because when your server crashes or any decision at all needs to be made about the server-side of your project or product, your phone will ring and someone has to pick up. Preferably someone who knows the gameplan, your strategy for going serverless.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### When to serverless and when to not?
|
||||||
|
|
||||||
|
So, serverless is great, right? But, the truth is it isn't always the right call. What are the factors that should be considered?
|
||||||
|
|
||||||
|
1. Cost
|
||||||
|
2. Scale
|
||||||
|
3. Time
|
||||||
|
4. Control
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The last one, control, is where things get interesting. Projects like [Apache OpenWhisk][1] have developed processes and tools to make it possible for you, as a developer, to operate and control your serverless computing environments.
|
||||||
|
|
||||||
|
### Why open source serverless?
|
||||||
|
|
||||||
|
For more on this, check out conversations with leading serverless thinkers and host Saron Yitbarek in [Episode 7 of Command Line Heroes podcast][2].
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/18/12/serverless-podcast-command-line-heros
|
||||||
|
|
||||||
|
作者:[Jen Wike Huger][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/remyd
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/article/18/11/developing-functions-service-apache-openwhisk
|
||||||
|
[2]: https://www.redhat.com/en/command-line-heroes
|
@ -0,0 +1,201 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (Celebrate Christmas In Linux Way With These Wallpapers)
|
||||||
|
[#]: via: (https://itsfoss.com/christmas-linux-wallpaper/)
|
||||||
|
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Celebrate Christmas In Linux Way With These Wallpapers
|
||||||
|
======
|
||||||
|
|
||||||
|
It’s the holiday season and many of you might be celebrating Christmas already. From the team of It’s FOSS, I would like to wish you a Merry Christmas and a happy new year.
|
||||||
|
|
||||||
|
To continue the festive mood, I’ll show you some really awesome [Linux wallpapers][1] on Christmas theme. But before we see that, how about a Christmas Tree in Linux terminal.
|
||||||
|
|
||||||
|
### Display Christmas Tree in Linux Terminal
|
||||||
|
|
||||||
|
<https://giphy.com/embed/xUNda6KphvbpYxL3tm>
|
||||||
|
|
||||||
|
If you want to display an animated Christmas tree in the terminal, you can use the command below:
|
||||||
|
|
||||||
|
```
|
||||||
|
curl https://raw.githubusercontent.com/sergiolepore/ChristBASHTree/master/tree-EN.sh | bash
|
||||||
|
```
|
||||||
|
|
||||||
|
If you don’t want to get it from the internet all the time, you can get the shell script from its GitHub repository, change the permission and run it like a normal shell script.
|
||||||
|
|
||||||
|
[ChristBASHTree][2]
|
||||||
|
|
||||||
|
### Display Christmas Tree in Linux terminal using Perl
|
||||||
|
|
||||||
|
[![Christmas Tree in Linux terminal by NixCraft][3]][4]
|
||||||
|
|
||||||
|
This trick was originally shared by [NixCraft][5]. You’ll need to install a Perl module for this.
|
||||||
|
|
||||||
|
To be honest, I don’t like using Perl modules because uninstalling them is a real pain. So **use this Perl module knowing that you’ll have to manually remove it**.
|
||||||
|
|
||||||
|
```
|
||||||
|
perl -MCPAN -e 'install Acme::POE::Tree'
|
||||||
|
```
|
||||||
|
|
||||||
|
You can read the original article [here][5] to know more about it.
|
||||||
|
|
||||||
|
## Download Linux Christmas Wallpapers
|
||||||
|
|
||||||
|
All these Linux Christmas wallpapers are created by Mark Riedesel and you can find plenty of other artwork on [his website][6].
|
||||||
|
|
||||||
|
He has been making such wallpapers almost every year since 2002. Quite understandably some of the earliest wallpapers don’t have modern aspect ratio. I have put them up in reverse chronological order.
|
||||||
|
|
||||||
|
One tiny note. The images displayed here are highly compressed so download the wallpapers from the provided link only.
|
||||||
|
|
||||||
|
![Christmas Linux Wallpaper][7]
|
||||||
|
|
||||||
|
[Download This Wallpaper][8]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][9]][10]
|
||||||
|
|
||||||
|
[Download This Wallpaper][11]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][12]][13]
|
||||||
|
|
||||||
|
[Download This Wallpaper][14]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][15]][16]
|
||||||
|
|
||||||
|
[Download This Wallpaper][17]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][18]][19]
|
||||||
|
|
||||||
|
[Download This Wallpaper][20]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][21]][22]
|
||||||
|
|
||||||
|
[Download This Wallpaper][23]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][24]][25]
|
||||||
|
|
||||||
|
[Download This Wallpaper][26]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][27]][28]
|
||||||
|
|
||||||
|
[Download This Wallpaper][29]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][30]][31]
|
||||||
|
|
||||||
|
[Download This Wallpaper][32]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][33]][34]
|
||||||
|
|
||||||
|
[Download This Wallpaper][35]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][36]][37]
|
||||||
|
|
||||||
|
[Download This Wallpaper][38]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][39]][40]
|
||||||
|
|
||||||
|
[Download This Wallpaper][41]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][42]][43]
|
||||||
|
|
||||||
|
[Download This Wallpaper][44]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][45]][46]
|
||||||
|
|
||||||
|
[Download This Wallpaper][47]
|
||||||
|
|
||||||
|
[![Christmas Linux Wallpapers][48]][49]
|
||||||
|
|
||||||
|
[Download This Wallpaper][50]
|
||||||
|
|
||||||
|
### Bonus: Linux Christmas carols
|
||||||
|
|
||||||
|
Here is a bonus for you. Christmas carols Linuxified for Linux lovers like us.
|
||||||
|
|
||||||
|
In [an article on Computer World][51], [Sandra Henry-Stocker][52] shared such Christmas carols. An excerpt:
|
||||||
|
|
||||||
|
To the tune of: [Chestnuts Roasting on an Open Fire][53]
|
||||||
|
|
||||||
|
> Running merrily on open source
|
||||||
|
> With users happy as can be
|
||||||
|
> We’re using Linux and getting lots done
|
||||||
|
> And happy everything is free
|
||||||
|
|
||||||
|
To the tune of: [The Twelve Days of Christmas][54]
|
||||||
|
|
||||||
|
> On my first day with Linux, my admin gave to me a password and a login ID
|
||||||
|
> On my second day with Linux my admin gave to me two new commands and a password and a login ID
|
||||||
|
|
||||||
|
You can read full carols [here][51].
|
||||||
|
|
||||||
|
Merry Linux to you!!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/christmas-linux-wallpaper/
|
||||||
|
|
||||||
|
作者:[Abhishek Prakash][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://itsfoss.com/author/abhishek/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://itsfoss.com/beautiful-linux-wallpapers/
|
||||||
|
[2]: https://github.com/sergiolepore/ChristBASHTree
|
||||||
|
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2016/12/perl-tree.gif?resize=600%2C622&ssl=1
|
||||||
|
[4]: https://itsfoss.com/christmas-linux-wallpaper/perl-tree/
|
||||||
|
[5]: https://www.cyberciti.biz/open-source/command-line-hacks/linux-unix-desktop-fun-christmas-tree-for-your-terminal/
|
||||||
|
[6]: http://www.klowner.com/
|
||||||
|
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/christmas-linux-wallpaper-featured.jpeg?resize=800%2C450&ssl=1
|
||||||
|
[8]: http://klowner.com/wallery/christmas_tux_2017/download/ChristmasTux2017_3840x2160.png
|
||||||
|
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2016_3840x2160_result.jpg?resize=800%2C450&ssl=1
|
||||||
|
[10]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2016_3840x2160_result/
|
||||||
|
[11]: http://www.klowner.com/wallpaper/christmas_tux_2016/
|
||||||
|
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2015_2560x1920_result.jpg?resize=800%2C600&ssl=1
|
||||||
|
[13]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2015_2560x1920_result/
|
||||||
|
[14]: http://www.klowner.com/wallpaper/christmas_tux_2015/
|
||||||
|
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2014_2560x1440_result.jpg?resize=800%2C450&ssl=1
|
||||||
|
[16]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2014_2560x1440_result/
|
||||||
|
[17]: http://www.klowner.com/wallpaper/christmas_tux_2014/
|
||||||
|
[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/christmastux2013_result.jpg?resize=800%2C450&ssl=1
|
||||||
|
[19]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2013_result/
|
||||||
|
[20]: http://www.klowner.com/wallpaper/christmas_tux_2013/
|
||||||
|
[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2012_2560x1440_result.jpg?resize=800%2C450&ssl=1
|
||||||
|
[22]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2012_2560x1440_result/
|
||||||
|
[23]: http://www.klowner.com/wallpaper/christmas_tux_2012/
|
||||||
|
[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/christmastux2011_2560x1440_result.jpg?resize=800%2C450&ssl=1
|
||||||
|
[25]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2011_2560x1440_result/
|
||||||
|
[26]: http://www.klowner.com/wallpaper/christmas_tux_2011/
|
||||||
|
[27]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2016/12/christmastux2010_5120x2880_result.jpg?resize=800%2C450&ssl=1
|
||||||
|
[28]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2010_5120x2880_result/
|
||||||
|
[29]: http://www.klowner.com/wallpaper/christmas_tux_2010/
|
||||||
|
[30]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2009_1600x1200_result.jpg?resize=800%2C600&ssl=1
|
||||||
|
[31]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2009_1600x1200_result/
|
||||||
|
[32]: http://www.klowner.com/wallpaper/christmas_tux_2009/
|
||||||
|
[33]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2008_2560x1600_result.jpg?resize=800%2C500&ssl=1
|
||||||
|
[34]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2008_2560x1600_result/
|
||||||
|
[35]: http://www.klowner.com/wallpaper/christmas_tux_2008/
|
||||||
|
[36]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2007_2560x1600_result.jpg?resize=800%2C500&ssl=1
|
||||||
|
[37]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2007_2560x1600_result/
|
||||||
|
[38]: http://www.klowner.com/wallpaper/christmas_tux_2007/
|
||||||
|
[39]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2006_1024x768_result.jpg?resize=800%2C600&ssl=1
|
||||||
|
[40]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2006_1024x768_result/
|
||||||
|
[41]: http://www.klowner.com/wallpaper/christmas_tux_2006/
|
||||||
|
[42]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2005_1600x1200_result.jpg?resize=800%2C600&ssl=1
|
||||||
|
[43]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2005_1600x1200_result/
|
||||||
|
[44]: http://www.klowner.com/wallpaper/christmas_tux_2005/
|
||||||
|
[45]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2004_1600x1200_result.jpg?resize=800%2C600&ssl=1
|
||||||
|
[46]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2004_1600x1200_result/
|
||||||
|
[47]: http://www.klowner.com/wallpaper/christmas_tux_2004/
|
||||||
|
[48]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2002_1600x1200_result.jpg?resize=800%2C600&ssl=1
|
||||||
|
[49]: https://itsfoss.com/christmas-linux-wallpaper/christmastux2002_1600x1200_result/
|
||||||
|
[50]: http://www.klowner.com/wallpaper/christmas_tux_2002/
|
||||||
|
[51]: http://www.computerworld.com/article/3151076/linux/merry-linux-to-you.html
|
||||||
|
[52]: https://twitter.com/bugfarm
|
||||||
|
[53]: https://www.youtube.com/watch?v=dhzxQCTCI3E
|
||||||
|
[54]: https://www.youtube.com/watch?v=oyEyMjdD2uk
|
@ -1,180 +0,0 @@
|
|||||||
[#]: collector: (lujun9972)
|
|
||||||
[#]: translator: ( )
|
|
||||||
[#]: reviewer: ( )
|
|
||||||
[#]: publisher: ( )
|
|
||||||
[#]: subject: (Emacs #2: Introducing org-mode)
|
|
||||||
[#]: via: (https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode)
|
|
||||||
[#]: author: (John Goerzen http://changelog.complete.org/archives/author/jgoerzen)
|
|
||||||
[#]: url: ( )
|
|
||||||
|
|
||||||
Emacs #2: Introducing org-mode
|
|
||||||
======
|
|
||||||
|
|
||||||
In [my first post in my series on Emacs][1], I described returning to Emacs after over a decade of vim, and org-mode being the reason why.
|
|
||||||
|
|
||||||
I really am astounded at the usefulness, and simplicity, of org-mode. It is really a killer app.
|
|
||||||
|
|
||||||
**So what exactly is org-mode?**
|
|
||||||
|
|
||||||
I wrote yesterday:
|
|
||||||
|
|
||||||
> It’s an information organization platform. Its website says “Your life in plain text: Org mode is for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system.”
|
|
||||||
|
|
||||||
That’s true, but doesn’t quite capture it. org-mode is a toolkit for you to organize things. It has reasonable out-of-the-box defaults, but it’s designed throughout for you to customize.
|
|
||||||
|
|
||||||
To highlight a few things:
|
|
||||||
|
|
||||||
* **Maintaining TODO lists** : items can be scattered across org-mode files, contain attachments, have tags, deadlines, schedules. There is a convenient “agenda” view to show you what needs to be done. Items can repeat.
|
|
||||||
* **Authoring documents** : org-mode has special features for generating HTML, LaTeX, slides (with LaTeX beamer), and all sorts of other formats. It also supports direct evaluation of code in-buffer and literate programming in virtually any Emacs-supported language. If you want to bend your mind on this stuff, read [this article on literate devops][2]. The [entire Worg website][3]
|
|
||||||
is made with org-mode.
|
|
||||||
* **Keeping notes** : yep, it can do that too. With full-text search, cross-referencing by file (as a wiki), by UUID, and even into other systems (into mu4e by Message-ID, into ERC logs, etc, etc.)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**Getting started**
|
|
||||||
|
|
||||||
I highly recommend watching [Carsten Dominik’s excellent Google Talk on org-mode][4]. It is an excellent introduction.
|
|
||||||
|
|
||||||
org-mode is included with Emacs, but you’ll often want a more recent version. Debian users can `apt-get install org-mode`, or it comes with the Emacs packaging system; `M-x package-install RET org-mode RET` may do it for you.
|
|
||||||
|
|
||||||
Now, you’ll probably want to start with the org-mode compact guide’s [introduction section][5], noting in particular to set the keybindings mentioned in the [activation section][6].
|
|
||||||
|
|
||||||
**A good tutorial…**
|
|
||||||
|
|
||||||
I’ve linked to a number of excellent tutorials and introductory items; this post is not going to serve as a tutorial. There are two good videos linked at the end of this post, in particular.
|
|
||||||
|
|
||||||
**Some of my configuration**
|
|
||||||
|
|
||||||
I’ll document some of my configuration here, and go into a bit of what it does. This isn’t necessarily because you’ll want to copy all of this verbatim — but just to give you a bit of an idea of some of what can be configured, an idea of what to look up in the manual, and maybe a reference for “now how do I do that?”
|
|
||||||
|
|
||||||
First, I set up Emacs to work in UTF-8 by default.
|
|
||||||
```
|
|
||||||
(prefer-coding-system 'utf-8) (set-language-environment "UTF-8")
|
|
||||||
```
|
|
||||||
|
|
||||||
org-mode can follow URLs. By default, it opens in Firefox, but I use Chromium.
|
|
||||||
```
|
|
||||||
(setq browse-url-browser-function 'browse-url-chromium)
|
|
||||||
```
|
|
||||||
|
|
||||||
I set the basic key bindings as documented in the Guide, plus configure the M-RET behavior.
|
|
||||||
|
|
||||||
```
|
|
||||||
(global-set-key "\C-cl" 'org-store-link)
|
|
||||||
(global-set-key "\C-ca" 'org-agenda)
|
|
||||||
(global-set-key "\C-cc" 'org-capture)
|
|
||||||
(global-set-key "\C-cb" 'org-iswitchb)
|
|
||||||
|
|
||||||
(setq org-M-RET-may-split-line nil)
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
**Configuration: Capturing**
|
|
||||||
|
|
||||||
I can press `C-c c` from anywhere in Emacs. It will [capture something for me][7], and include a link back to whatever I was working on.
|
|
||||||
|
|
||||||
You can define [capture templates][8] to set how this will work. I am going to keep two journal files for general notes about meetings, phone calls, etc. One for personal, one for work items. If I press `C-c c j`, then it will capture a personal item. The %a in all of these includes the link to where I was (or a link I had stored with `C-c l`).
|
|
||||||
|
|
||||||
```
|
|
||||||
(setq org-default-notes-file "~/org/tasks.org")
|
|
||||||
(setq org-capture-templates
|
|
||||||
'(
|
|
||||||
("t" "Todo" entry (file+headline "inbox.org" "Tasks")
|
|
||||||
"* TODO %?\n %i\n %u\n %a")
|
|
||||||
("n" "Note/Data" entry (file+headline "inbox.org" "Notes/Data")
|
|
||||||
"* %? \n %i\n %u\n %a")
|
|
||||||
("j" "Journal" entry (file+datetree "~/org/journal.org")
|
|
||||||
"* %?\nEntered on %U\n %i\n %a")
|
|
||||||
("J" "Work-Journal" entry (file+datetree "~/org/wjournal.org")
|
|
||||||
"* %?\nEntered on %U\n %i\n %a")
|
|
||||||
))
|
|
||||||
(setq org-irc-link-to-logs t)
|
|
||||||
```
|
|
||||||
|
|
||||||
I like to link by UUIDs, which lets me move things between files without breaking locations. This helps generate UUIDs when I ask Org to store a link target for future insertion.
|
|
||||||
|
|
||||||
```
|
|
||||||
(require 'org-id)
|
|
||||||
(setq org-id-link-to-org-use-id 'create-if-interactive)
|
|
||||||
```
|
|
||||||
|
|
||||||
**Configuration: agenda views**
|
|
||||||
|
|
||||||
I like my week to start on a Sunday, and for org to note the time when I mark something as done.
|
|
||||||
|
|
||||||
```
|
|
||||||
(setq org-log-done 'time)
|
|
||||||
(setq org-agenda-start-on-weekday 0)
|
|
||||||
```
|
|
||||||
|
|
||||||
**Configuration: files and refiling**
|
|
||||||
|
|
||||||
Here I tell it what files to use in the agenda, and to add a few more to the plain text search. I like to keep a general inbox (from which I can move, or “refile”, content), and then separate tasks, journal, and knowledge base for personal and work items.
|
|
||||||
|
|
||||||
```
|
|
||||||
(setq org-agenda-files (list "~/org/inbox.org"
|
|
||||||
"~/org/email.org"
|
|
||||||
"~/org/tasks.org"
|
|
||||||
"~/org/wtasks.org"
|
|
||||||
"~/org/journal.org"
|
|
||||||
"~/org/wjournal.org"
|
|
||||||
"~/org/kb.org"
|
|
||||||
"~/org/wkb.org"
|
|
||||||
))
|
|
||||||
(setq org-agenda-text-search-extra-files
|
|
||||||
(list "~/org/someday.org"
|
|
||||||
"~/org/config.org"
|
|
||||||
))
|
|
||||||
|
|
||||||
(setq org-refile-targets '((nil :maxlevel . 2)
|
|
||||||
(org-agenda-files :maxlevel . 2)
|
|
||||||
("~/org/someday.org" :maxlevel . 2)
|
|
||||||
("~/org/templates.org" :maxlevel . 2)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(setq org-outline-path-complete-in-steps nil) ; Refile in a single go
|
|
||||||
(setq org-refile-use-outline-path 'file)
|
|
||||||
```
|
|
||||||
|
|
||||||
**Configuration: Appearance**
|
|
||||||
|
|
||||||
I like a pretty screen. After you’ve gotten used to org a bit, you might try this.
|
|
||||||
|
|
||||||
```
|
|
||||||
(require 'org-bullets)
|
|
||||||
(add-hook 'org-mode-hook
|
|
||||||
(lambda ()
|
|
||||||
(org-bullets-mode t)))
|
|
||||||
(setq org-ellipsis "⤵")
|
|
||||||
```
|
|
||||||
|
|
||||||
**Coming up next…**
|
|
||||||
|
|
||||||
This hopefully showed a few things that org-mode can do. Coming up next, I’ll cover how to customize TODO keywords and tags, archiving old tasks, forwarding emails to org-mode, and using git to synchronize between machines.
|
|
||||||
|
|
||||||
You can also see a [list of all articles in this series][9].
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode
|
|
||||||
|
|
||||||
作者:[John Goerzen][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: http://changelog.complete.org/archives/author/jgoerzen
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://changelog.complete.org/archives/9861-emacs-1-ditching-a-bunch-of-stuff-and-moving-to-emacs-and-org-mode
|
|
||||||
[2]: http://www.howardism.org/Technical/Emacs/literate-devops.html
|
|
||||||
[3]: https://orgmode.org/worg/
|
|
||||||
[4]: https://www.youtube.com/watch?v=oJTwQvgfgMM
|
|
||||||
[5]: https://orgmode.org/guide/Introduction.html#Introduction
|
|
||||||
[6]: https://orgmode.org/guide/Activation.html#Activation
|
|
||||||
[7]: https://orgmode.org/guide/Capture.html#Capture
|
|
||||||
[8]: https://orgmode.org/guide/Capture-templates.html#Capture-templates
|
|
||||||
[9]: https://changelog.complete.org/archives/tag/emacs2018
|
|
@ -1,131 +0,0 @@
|
|||||||
[#]: collector: (lujun9972)
|
|
||||||
[#]: translator: ( )
|
|
||||||
[#]: reviewer: ( )
|
|
||||||
[#]: publisher: ( )
|
|
||||||
[#]: subject: (Emacs #3: More on org-mode)
|
|
||||||
[#]: via: (https://changelog.complete.org/archives/9877-emacs-3-more-on-org-mode)
|
|
||||||
[#]: author: (John Goerzen http://changelog.complete.org/archives/author/jgoerzen)
|
|
||||||
[#]: url: ( )
|
|
||||||
|
|
||||||
Emacs #3: More on org-mode
|
|
||||||
======
|
|
||||||
|
|
||||||
This is third in [a series on Emacs and org-mode][1].
|
|
||||||
|
|
||||||
**Todo tracking and keywords**
|
|
||||||
|
|
||||||
When using org-mode to [track your TODOs][2], it can have multiple states. You can press `C-c C-t` for a quick shift between states. I have set this:
|
|
||||||
|
|
||||||
```
|
|
||||||
(setq org-todo-keywords '(
|
|
||||||
(sequence "TODO(t!)" "NEXT(n!)" "STARTED(a!)" "WAIT(w@/!)" "OTHERS(o!)" "|" "DONE(d)" "CANCELLED(c)")
|
|
||||||
))
|
|
||||||
```
|
|
||||||
|
|
||||||
Here, I set up 5 states that are for a task that is not yet done: TODO, NEXT, STARTED, WAIT, and OTHERS. Each has a single-character shortcut (t, n, a, etc). The states after the pipe symbol are ones that are considered “done”. I have two: DONE (for things that I have done) and CANCELED (for things that I haven’t done, but for whatever reason, won’t).
|
|
||||||
|
|
||||||
The exclamation mark means to log the time when an item was changed to a state. I don’t add this to the done states because those are already logged anyhow. The @ sign means to prompt for a reason; so when switching to WAIT, org-mode will ask me why and add this to the note.
|
|
||||||
|
|
||||||
Here’s an example of an entry that has had some state changes:
|
|
||||||
|
|
||||||
```
|
|
||||||
** DONE This is a test
|
|
||||||
CLOSED: [2018-03-02 Fri 03:05]
|
|
||||||
|
|
||||||
- State "DONE" from "WAIT" [2018-03-02 Fri 03:05]
|
|
||||||
- State "WAIT" from "TODO" [2018-03-02 Fri 03:05] \\
|
|
||||||
waiting for pigs to fly
|
|
||||||
- State "TODO" from "NEXT" [2018-03-02 Fri 03:05]
|
|
||||||
- State "NEXT" from "TODO" [2018-03-02 Fri 03:05]
|
|
||||||
```
|
|
||||||
|
|
||||||
Here, the most recent items are on top.
|
|
||||||
|
|
||||||
**Agenda mode, schedules, and deadlines**
|
|
||||||
|
|
||||||
When you’re in a todo item, C-c C-s or C-c C-d can set a schedule or a deadline for it, respectively. These show up in agenda mode. The difference is in intent and presentation. A schedule is something that you expect to work on at around a time, while a deadline is something that is due at a specific time. By default, the agenda view will start warning you about deadline items in advance.
|
|
||||||
|
|
||||||
And while we’re at it, the [agenda view][3] will show you the items that you have coming up, offers a nice way to search for items based on plain text or tags, and handles bulk manipulation of items even across multiple files. I covered setting the files for agenda mode in [part 2][4] of this series.
|
|
||||||
|
|
||||||
**Tags**
|
|
||||||
|
|
||||||
Of course org-mode has [tags][5]. You can quickly set them with C-c C-q.
|
|
||||||
|
|
||||||
You can set shortcuts for tags you might like to use often. Perhaps something like this:
|
|
||||||
|
|
||||||
```
|
|
||||||
(setq org-tag-persistent-alist
|
|
||||||
'(("@phone" . ?p)
|
|
||||||
("@computer" . ?c)
|
|
||||||
("@websurfing" . ?w)
|
|
||||||
("@errands" . ?e)
|
|
||||||
("@outdoors" . ?o)
|
|
||||||
("MIT" . ?m)
|
|
||||||
("BIGROCK" . ?b)
|
|
||||||
("CONTACTS" . ?C)
|
|
||||||
("INBOX" . ?i)
|
|
||||||
))
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also add tags to this list on a per-file basis, and also set tags for something on a per-file basis. I use that for my inbox.org and email.org files to set an INBOX tag. I can then review all items tagged INBOX from the agenda view each day, and the simple act of refiling them into other files will cause them to lost the INBOX tag.
|
|
||||||
|
|
||||||
**Refiling**
|
|
||||||
|
|
||||||
“Refiling” is moving things around, either within a file or elsewhere. It has completion using your headlines. `C-c C-w` does this. I like these settings:
|
|
||||||
|
|
||||||
```
|
|
||||||
(setq org-outline-path-complete-in-steps nil) ; Refile in a single go
|
|
||||||
(setq org-refile-use-outline-path 'file)
|
|
||||||
```
|
|
||||||
|
|
||||||
**Archiving**
|
|
||||||
|
|
||||||
After awhile, you’ll get your files all cluttered with things that are done. org-mode has an [archive][6] feature to move things out of your main .org files and into some other files for future reference. If you have your org files in git or something, you may wish to delete these other files since you’d have things in history anyhow, but I find them handy for grepping and searching.
|
|
||||||
|
|
||||||
I periodically want to go through and archive everything in my files. Based on a [stackoverflow discussion][7], I have this code:
|
|
||||||
|
|
||||||
```
|
|
||||||
(defun org-archive-done-tasks ()
|
|
||||||
(interactive)
|
|
||||||
(org-map-entries
|
|
||||||
(lambda ()
|
|
||||||
(org-archive-subtree)
|
|
||||||
(setq org-map-continue-from (outline-previous-heading)))
|
|
||||||
"/DONE" 'file)
|
|
||||||
(org-map-entries
|
|
||||||
(lambda ()
|
|
||||||
(org-archive-subtree)
|
|
||||||
(setq org-map-continue-from (outline-previous-heading)))
|
|
||||||
"/CANCELLED" 'file)
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
This is based on [a particular answer][8] — see the comments there for some additional hints. Now you can run `M-x org-archive-done-tasks` and everything in the current file marked DONE or CANCELED will be pulled out into a different file.
|
|
||||||
|
|
||||||
**Up next**
|
|
||||||
|
|
||||||
I’ll wrap up org-mode with a discussion of automatically receiving emails into org, and syncing org between machines.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://changelog.complete.org/archives/9877-emacs-3-more-on-org-mode
|
|
||||||
|
|
||||||
作者:[John Goerzen][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: http://changelog.complete.org/archives/author/jgoerzen
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://changelog.complete.org/archives/tag/emacs2018
|
|
||||||
[2]: https://orgmode.org/guide/TODO-Items.html#TODO-Items
|
|
||||||
[3]: https://orgmode.org/guide/Agenda-Views.html#Agenda-Views
|
|
||||||
[4]: https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode
|
|
||||||
[5]: https://orgmode.org/guide/Tags.html#Tags
|
|
||||||
[6]: https://orgmode.org/guide/Archiving.html#Archiving
|
|
||||||
[7]: https://stackoverflow.com/questions/6997387/how-to-archive-all-the-done-tasks-using-a-single-command
|
|
||||||
[8]: https://stackoverflow.com/a/27043756
|
|
@ -1,3 +1,4 @@
|
|||||||
|
robsean translating
|
||||||
How To Remove Password From A PDF File in Linux
|
How To Remove Password From A PDF File in Linux
|
||||||
======
|
======
|
||||||
|
|
||||||
|
@ -1,145 +0,0 @@
|
|||||||
How to Manage Fonts in Linux
|
|
||||||
======
|
|
||||||
|
|
||||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_main.jpg?itok=qcJks7-c)
|
|
||||||
|
|
||||||
Not only do I write technical documentation, I write novels. And because I’m comfortable with tools like GIMP, I also create my own book covers (and do graphic design for a few clients). That artistic endeavor depends upon a lot of pieces falling into place, including fonts.
|
|
||||||
|
|
||||||
Although font rendering has come a long way over the past few years, it continues to be an issue in Linux. If you compare the look of the same fonts on Linux vs. macOS, the difference is stark. This is especially true when you’re staring at a screen all day. But even though the rendering of fonts has yet to find perfection in Linux, one thing that the open source platform does well is allow users to easily manage their fonts. From selecting, adding, scaling, and adjusting, you can work with fonts fairly easily in Linux.
|
|
||||||
|
|
||||||
Here, I’ll share some of the tips I’ve depended on over the years to help extend my “font-ability” in Linux. These tips will especially help those who undertake artistic endeavors on the open source platform. Because there are so many desktop interfaces available for Linux (each of which deal with fonts in a different way), when a desktop environment becomes central to the management of fonts, I’ll be focusing primarily on GNOME and KDE.
|
|
||||||
|
|
||||||
With that said, let’s get to work.
|
|
||||||
|
|
||||||
### Adding new fonts
|
|
||||||
|
|
||||||
For the longest time, I have been a collector of fonts. Some might say I have a bit of an obsession. And since my early days of using Linux, I’ve always used the same process for adding fonts to my desktops. There are two ways to do this:
|
|
||||||
|
|
||||||
* Make the fonts available on a per-user basis.
|
|
||||||
|
|
||||||
* Make the fonts available system-wide.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Because my desktops never have other users (besides myself), I only ever work with fonts on a per-user basis. However, I will show you how to do both. First, let’s see how to add fonts on a per-user basis. The first thing you must do is find fonts. Both True Type Fonts (TTF) and Open Type Fonts (OTF) can be added. I add fonts manually. Do this is, I create a new hidden directory in ~/ called ~/.fonts. This can be done with the command:
|
|
||||||
```
|
|
||||||
mkdir ~/.fonts
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
With that folder created, I then move all of my TTF and OTF files into the directory. That’s it. Every font you add into that directory will now be available for use to your installed apps. But remember, those fonts will only be available to that one user.
|
|
||||||
|
|
||||||
If you want to make that collection of fonts available to all, here’s what you do:
|
|
||||||
|
|
||||||
1. Open up a terminal window.
|
|
||||||
|
|
||||||
2. Change into the directory housing all of your fonts.
|
|
||||||
|
|
||||||
3. Copy all of those fonts with the commands sudo cp *.ttf *.TTF /usr/share/fonts/truetype/ and sudo cp *.otf *.OTF /usr/share/fonts/opentype
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The next time a user logs in, they’ll have access to all those glorious fonts.
|
|
||||||
|
|
||||||
### GUI Font Managers
|
|
||||||
|
|
||||||
There are a few ways to manage your fonts in Linux, via GUI. How it’s done will depend on your desktop environment. Let’s examine KDE first. With the KDE that ships with Kubuntu 18.04, you’ll find a Font Management tool pre-installed. Open that tool and you can easily add, remove, enable, and disable fonts (as well as get information about all of the installed fonts. This tool also makes it easy for you to add and remove fonts for personal and system-wide use. Let’s say you want to add a particular font for personal usage. To do this, download your font and then open up the Font Management tool. In this tool (Figure 1), click on Personal Fonts and then click the + Add button.
|
|
||||||
|
|
||||||
|
|
||||||
![adding fonts][2]
|
|
||||||
|
|
||||||
Figure 1: Adding personal fonts in KDE.
|
|
||||||
|
|
||||||
[Used with permission][3]
|
|
||||||
|
|
||||||
Navigate to the location of your fonts, select them, and click Open. Your fonts will then be added to the Personal section and are immediately available for you to use (Figure 2).
|
|
||||||
|
|
||||||
|
|
||||||
![KDE Font Manager][5]
|
|
||||||
|
|
||||||
Figure 2: Fonts added with the KDE Font Manager.
|
|
||||||
|
|
||||||
[Used with permission][3]
|
|
||||||
|
|
||||||
To do the same thing in GNOME requires the installation of an application. Open up either GNOME Software or Ubuntu Software (depending upon the distribution you’re using) and search for Font Manager. Select Font Manager and then click the Install button. Once the software is installed, launch it from the desktop menu. With the tool open, let’s install fonts on a per-user basis. Here’s how:
|
|
||||||
|
|
||||||
1. Select User from the left pane (Figure 3).
|
|
||||||
|
|
||||||
2. Click the + button at the top of the window.
|
|
||||||
|
|
||||||
3. Navigate to and select the downloaded fonts.
|
|
||||||
|
|
||||||
4. Click Open.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
![Adding fonts ][7]
|
|
||||||
|
|
||||||
Figure 3: Adding fonts in GNOME.
|
|
||||||
|
|
||||||
[Used with permission][3]
|
|
||||||
|
|
||||||
### Tweaking fonts
|
|
||||||
|
|
||||||
There are three concepts you must first understand:
|
|
||||||
|
|
||||||
* **Font Hinting:** The use of mathematical instructions to adjust the display of a font outline so that it lines up with a rasterized grid.
|
|
||||||
|
|
||||||
* **Anti-aliasing:** The technique used to add greater realism to a digital image by smoothing jagged edges on curved lines and diagonals.
|
|
||||||
|
|
||||||
* **Scaling factor:** **** A scalable unit that allows you to multiple the point size of a font. So if you’re font is 12pt and you have an scaling factor of 1, the font size will be 12pt. If your scaling factor is 2, the font size will be 24pt.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Let’s say you’ve installed your fonts, but they don’t look quite as good as you’d like. How do you tweak the appearance of fonts? In both the KDE and GNOME desktops, you can make a few adjustments. One thing to consider with the tweaking of fonts is that taste is very much subjective. You might find yourself having to continually tweak until you get the fonts looking exactly how you like (dictated by your needs and particular taste). Let’s first look at KDE.
|
|
||||||
|
|
||||||
Open up the System Settings tool and clock on Fonts. In this section, you can not only change various fonts, you can also enable and configure both anti-aliasing and enable font scaling factor (Figure 4).
|
|
||||||
|
|
||||||
|
|
||||||
![Configuring fonts][9]
|
|
||||||
|
|
||||||
Figure 4: Configuring fonts in KDE.
|
|
||||||
|
|
||||||
[Used with permission][3]
|
|
||||||
|
|
||||||
To configure anti-aliasing, select Enabled from the drop-down and then click Configure. In the resulting window (Figure 5), you can configure an exclude range, sub-pixel rendering type, and hinting style.
|
|
||||||
|
|
||||||
Once you’ve made your changes, click Apply. Restart any running applications and the new settings will take effect.
|
|
||||||
|
|
||||||
To do this in GNOME, you have to have either use Font Manager or GNOME Tweaks installed. For this, GNOME Tweaks is the better tool. If you open the GNOME Dash and cannot find Tweaks installed, open GNOME Software (or Ubuntu Software), and install GNOME Tweaks. Once installed, open it and click on the Fonts section. Here you can configure hinting, anti-aliasing, and scaling factor (Figure 6).
|
|
||||||
|
|
||||||
![Tweaking fonts][11]
|
|
||||||
|
|
||||||
Figure 6: Tweaking fonts in GNOME.
|
|
||||||
|
|
||||||
[Used with permission][3]
|
|
||||||
|
|
||||||
### Make your fonts beautiful
|
|
||||||
|
|
||||||
And that’s the gist of making your fonts look as beautiful as possible in Linux. You may not see a macOS-like rendering of fonts, but you can certainly improve the look. Finally, the fonts you choose will have a large impact on how things look. Make sure you’re installing clean, well-designed fonts; otherwise, you’re fighting a losing battle.
|
|
||||||
|
|
||||||
Learn more about Linux through the free ["Introduction to Linux" ][12] course from The Linux Foundation and edX.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://www.linux.com/learn/intro-to-linux/2018/5/how-manage-fonts-linux
|
|
||||||
|
|
||||||
作者:[Jack Wallen][a]
|
|
||||||
选题:[lujun9972](https://github.com/lujun9972)
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]:https://www.linux.com/users/jlwallen
|
|
||||||
[2]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_1.jpg?itok=7yTTe6o3 (adding fonts)
|
|
||||||
[3]:https://www.linux.com/licenses/category/used-permission
|
|
||||||
[5]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_2.jpg?itok=_g0dyVYq (KDE Font Manager)
|
|
||||||
[7]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_3.jpg?itok=8o884QKs (Adding fonts )
|
|
||||||
[9]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_4.jpg?itok=QJpPzFED (Configuring fonts)
|
|
||||||
[11]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_6.jpg?itok=4cQeIW9C (Tweaking fonts)
|
|
||||||
[12]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux
|
|
@ -1,313 +0,0 @@
|
|||||||
(translating by runningwater)
|
|
||||||
Version Control Before Git with CVS
|
|
||||||
======
|
|
||||||
Github was launched in 2008. If your software engineering career, like mine, is no older than Github, then Git may be the only version control software you have ever used. While people sometimes grouse about its steep learning curve or unintuitive interface, Git has become everyone’s go-to for version control. In Stack Overflow’s 2015 developer survey, 69.3% of respondents used Git, almost twice as many as used the second-most-popular version control system, Subversion. After 2015, Stack Overflow stopped asking developers about the version control systems they use, perhaps because Git had become so popular that the question was uninteresting.
|
|
||||||
|
|
||||||
Git itself is not much older than Github. Linus Torvalds released the first version of Git in 2005. Though today younger developers might have a hard time conceiving of a world where the term “version control software” didn’t more or less just mean Git, such a world existed not so long ago. There were lots of alternatives to choose from. Open source developers preferred Subversion, enterprises and video game companies used Perforce (some still do), while the Linux kernel project famously relied on a version control system called BitKeeper.
|
|
||||||
|
|
||||||
Some of these systems, particularly BitKeeper, might feel familiar to a young Git user transported back in time. Most would not. BitKeeper aside, the version control systems that came before Git worked according to a fundamentally different paradigm. In a taxonomy offered by Eric Sink, author of Version Control by Example, Git is a third-generation version control system, while most of Git’s predecessors, the systems popular in the 1990s and early 2000s, are second-generation version control systems. Where third-generation version control systems are distributed, second-generation version control systems are centralized. You have almost certainly heard Git described as a “distributed” version control system before. I never quite understood the distributed/centralized distinction, at least not until I installed and experimented with a centralized second-generation version control system myself.
|
|
||||||
|
|
||||||
The system I installed was CVS. CVS, short for Concurrent Versions System, was the very first second-generation version control system. It was also the most popular version control system for about a decade until it was replaced in 2000 by Subversion. Even then, Subversion was supposed to be “CVS but better,” which only underscores how dominant CVS had become throughout the 1990s.
|
|
||||||
|
|
||||||
CVS was first developed in 1986 by a Dutch computer scientist named Dick Grune, who was looking for a way to collaborate with his students on a compiler project. CVS was initially little more than a collection of shell scripts wrapping RCS (Revision Control System), a first-generation version control system that Grune wanted to improve. RCS works according to a pessimistic locking model, meaning that no two programmers can work on a single file at once. In order to edit a file, you have to first ask RCS for an exclusive lock on the file, which you keep until you are finished editing. If someone else is already editing a file you need to edit, you have to wait. CVS improved on RCS and ushered in the second generation of version control systems by trading the pessimistic locking model for an optimistic one. Programmers could now edit the same file at the same time, merging their edits and resolving any conflicts later. (Brian Berliner, an engineer who later took over the CVS project, wrote a very readable [paper][1] about CVS’ innovations in 1990.)
|
|
||||||
|
|
||||||
In that sense, CVS wasn’t all that different from Git, which also works according to an optimistic model. But that’s where the similarities end. In fact, when Linus Torvalds was developing Git, one of his guiding principles was WWCVSND, or “What Would CVS Not Do.” Whenever he was in doubt about a decision, he strove to choose the option that had not been chosen in the design of CVS. So even though CVS predates Git by over a decade, it influenced Git as a kind of negative template.
|
|
||||||
|
|
||||||
I’ve really enjoyed playing around with CVS. I think there’s no better way to understand why Git’s distributed nature is such an improvement on what came before. So I invite you to come along with me on an exciting journey and spend the next ten minutes of your life learning about a piece of software nobody has used in the last decade. (See correction.)
|
|
||||||
|
|
||||||
### Getting Started with CVS
|
|
||||||
|
|
||||||
Instructions for installing CVS can be found on the [project’s homepage][2]. On MacOS, you can install CVS using Homebrew.
|
|
||||||
|
|
||||||
Since CVS is centralized, it distinguishes between the client-side universe and the server-side universe in a way that something like Git does not. The distinction is not so pronounced that there are different executables. But in order to start using CVS, even on your own machine, you’ll have to set up the CVS backend.
|
|
||||||
|
|
||||||
The CVS backend, the central store for all your code, is called the repository. Whereas in Git you would typically have a repository for every project, in CVS the repository holds all of your projects. There is one central repository for everything, though there are ways to work with only a project at a time.
|
|
||||||
|
|
||||||
To create a local repository, you run the `init` command. You would do this somewhere global like your home directory.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs -d ~/sandbox init
|
|
||||||
```
|
|
||||||
|
|
||||||
CVS allows you to pass options to either the `cvs` command itself or to the `init` subcommand. Options that appear after the `cvs` command are global in nature, while options that appear after the subcommand are specific to the subcommand. In this case, the `-d` flag is global. Here it happens to tell CVS where we want to create our repository, but in general the `-d` flag points to the location of the repository we want to use for any given action. It can be tedious to supply the `-d` flag all the time, so the `CVSROOT` environment variable can be set instead.
|
|
||||||
|
|
||||||
Since we’re working locally, we’ve just passed a path for our `-d` argument, but we could also have included a hostname.
|
|
||||||
|
|
||||||
The command creates a directory called `sandbox` in your home directory. If you list the contents of `sandbox`, you’ll find that it contains another directory called `CVSROOT`. This directory, not to be confused with the environment variable, holds administrative files for the repository.
|
|
||||||
|
|
||||||
Congratulations! You’ve just created your first CVS repository.
|
|
||||||
|
|
||||||
### Checking In Code
|
|
||||||
|
|
||||||
Let’s say that you’ve decided to keep a list of your favorite colors. You are an artistically inclined but extremely forgetful person. You type up your list of colors and save it as a file called `favorites.txt`:
|
|
||||||
|
|
||||||
```
|
|
||||||
blue
|
|
||||||
orange
|
|
||||||
green
|
|
||||||
|
|
||||||
definitely not yellow
|
|
||||||
```
|
|
||||||
|
|
||||||
Let’s also assume that you’ve saved your file in a new directory called `colors`. Now you’d like to put your favorite color list under version control, because fifty years from now it will be interesting to look back and see how your tastes changed through time.
|
|
||||||
|
|
||||||
In order to do that, you will have to import your directory as a new CVS project. You can do that using the `import` command:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs -d ~/sandbox import -m "" colors colors initial
|
|
||||||
N colors/favorites.txt
|
|
||||||
|
|
||||||
No conflicts created by this import
|
|
||||||
```
|
|
||||||
|
|
||||||
Here we are specifying the location of our repository with the `-d` flag again. The remaining arguments are passed to the `import` subcommand. We have to provide a message, but here we don’t really need one, so we’ve left it blank. The next argument, `colors`, specifies the name of our new directory in the repository; here we’ve just used the same name as the directory we are in. The last two arguments specify the vendor tag and the release tag respectively. We’ll talk more about tags in a minute.
|
|
||||||
|
|
||||||
You’ve just pulled your “colors” project into the CVS repository. There are a couple different ways to go about bringing code into CVS, but this is the method recommended by [Pragmatic Version Control Using CVS][3], the Pragmatic Programmer book about CVS. What makes this method a little awkward is that you then have to check out your work fresh, even though you’ve already got an existing `colors` directory. Instead of using that directory, you’re going to delete it and then check out the version that CVS already knows about:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs -d ~/sandbox co colors
|
|
||||||
cvs checkout: Updating colors
|
|
||||||
U colors/favorites.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
This will create a new directory, also called `colors`. In this directory you will find your original `favorites.txt` file along with a directory called `CVS`. The `CVS` directory is basically CVS’ equivalent of the `.git` directory in every Git repository.
|
|
||||||
|
|
||||||
### Making Changes
|
|
||||||
|
|
||||||
Get ready for a trip.
|
|
||||||
|
|
||||||
Just like Git, CVS has a `status` subcommand:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs status
|
|
||||||
cvs status: Examining .
|
|
||||||
===================================================================
|
|
||||||
File: favorites.txt Status: Up-to-date
|
|
||||||
|
|
||||||
Working revision: 1.1.1.1 2018-07-06 19:27:54 -0400
|
|
||||||
Repository revision: 1.1.1.1 /Users/sinclairtarget/sandbox/colors/favorites.txt,v
|
|
||||||
Commit Identifier: fD7GYxt035GNg8JA
|
|
||||||
Sticky Tag: (none)
|
|
||||||
Sticky Date: (none)
|
|
||||||
Sticky Options: (none)
|
|
||||||
```
|
|
||||||
|
|
||||||
This is where things start to look alien. CVS doesn’t have commit objects. In the above, there is something called a “Commit Identifier,” but this might be only a relatively recent edition—no mention of a “Commit Identifier” appears in Pragmatic Version Control Using CVS, which was published in 2003. (The last update to CVS was released in 2008.)
|
|
||||||
|
|
||||||
Whereas with Git you’d talk about the version of a file associated with commit `45de392`, in CVS files are versioned separately. The first version of your file is version 1.1, the next version is 1.2, and so on. When branches are involved, extra numbers are appended, so you might end up with something like the `1.1.1.1` above, which appears to be the default in our case even though we haven’t created any branches.
|
|
||||||
|
|
||||||
If you were to run `cvs log` (equivalent to `git log`) in a project with lots of files and commits, you’d see an individual history for each file. You might have a file at version 1.2 and a file at version 1.14 in the same project.
|
|
||||||
|
|
||||||
Let’s go ahead and make a change to version 1.1 of our `favorites.txt` file:
|
|
||||||
|
|
||||||
```
|
|
||||||
blue
|
|
||||||
orange
|
|
||||||
green
|
|
||||||
+cyan
|
|
||||||
|
|
||||||
definitely not yellow
|
|
||||||
```
|
|
||||||
|
|
||||||
Once we’ve made the change, we can run `cvs diff` to see what CVS thinks we’ve done:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs diff
|
|
||||||
cvs diff: Diffing .
|
|
||||||
Index: favorites.txt
|
|
||||||
===================================================================
|
|
||||||
RCS file: /Users/sinclairtarget/sandbox/colors/favorites.txt,v
|
|
||||||
retrieving revision 1.1.1.1
|
|
||||||
diff -r1.1.1.1 favorites.txt
|
|
||||||
3a4
|
|
||||||
> cyan
|
|
||||||
```
|
|
||||||
|
|
||||||
CVS recognizes that we added a new line containing the color “cyan” to the file. (Actually, it says we’ve made changes to the “RCS” file; you can see that CVS never fully escaped its original association with RCS.) The diff we are being shown is the diff between the copy of `favorites.txt` in our working directory and the 1.1.1.1 version stored in the repository.
|
|
||||||
|
|
||||||
In order to update the version stored in the repository, we have to commit the change. In Git, this would be a multi-step process. We’d have to stage the change so that it appears in our index. Then we’d commit the change. Finally, to make the change visible to anyone else, we’d have to push the commit up to the origin repository.
|
|
||||||
|
|
||||||
In CVS, all of these things happen when you run `cvs commit`. CVS just bundles up all the changes it can find and puts them in the repository:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs commit -m "Add cyan to favorites."
|
|
||||||
cvs commit: Examining .
|
|
||||||
/Users/sinclairtarget/sandbox/colors/favorites.txt,v <-- favorites.txt
|
|
||||||
new revision: 1.2; previous revision: 1.1
|
|
||||||
```
|
|
||||||
|
|
||||||
I’m so used to Git that this strikes me as terrifying. Without an opportunity to stage changes, any old thing that you’ve touched in your working directory might end up as part of the public repository. Did you passive-aggressively rewrite a coworker’s poorly implemented function out of cathartic necessity, never intending for him to know? Too bad, he now thinks you’re a dick. You also can’t edit your commits before pushing them, since a commit is a push. Do you enjoy spending 40 minutes repeatedly running `git rebase -i` until your local commit history flows like the derivation of a mathematical proof? Sorry, you can’t do that here, and everyone is going to find out that you don’t actually write your tests first.
|
|
||||||
|
|
||||||
But I also now understand why so many people find Git needlessly complicated. If `cvs commit` is what you were used to, then I’m sure staging and pushing changes would strike you as a pointless chore.
|
|
||||||
|
|
||||||
When people talk about Git being a “distributed” system, this is primarily the difference they mean. In CVS, you can’t make commits locally. A commit is a submission of code to the central repository, so it’s not something you can do without a connection. All you’ve got locally is your working directory. In Git, you have a full-fledged local repository, so you can make commits all day long even while disconnected. And you can edit those commits, revert, branch, and cherry pick as much as you want, without anybody else having to know.
|
|
||||||
|
|
||||||
Since commits were a bigger deal, CVS users often made them infrequently. Commits would contain as many changes as today we might expect to see in a ten-commit pull request. This was especially true if commits triggered a CI build and an automated test suite.
|
|
||||||
|
|
||||||
If we now run `cvs status`, we can see that we have a new version of our file:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs status
|
|
||||||
cvs status: Examining .
|
|
||||||
===================================================================
|
|
||||||
File: favorites.txt Status: Up-to-date
|
|
||||||
|
|
||||||
Working revision: 1.2 2018-07-06 21:18:59 -0400
|
|
||||||
Repository revision: 1.2 /Users/sinclairtarget/sandbox/colors/favorites.txt,v
|
|
||||||
Commit Identifier: pQx5ooyNk90wW8JA
|
|
||||||
Sticky Tag: (none)
|
|
||||||
Sticky Date: (none)
|
|
||||||
Sticky Options: (none)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Merging
|
|
||||||
|
|
||||||
As mentioned above, in CVS you can edit a file that someone else is already editing. That was CVS’ big improvement on RCS. What happens when you need to bring your changes back together?
|
|
||||||
|
|
||||||
Let’s say that you have invited some friends to add their favorite colors to your list. While they are adding their colors, you decide that you no longer like the color green and remove it from the list.
|
|
||||||
|
|
||||||
When you go to commit your changes, you might discover that CVS notices a problem:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs commit -m "Remove green"
|
|
||||||
cvs commit: Examining .
|
|
||||||
cvs commit: Up-to-date check failed for `favorites.txt'
|
|
||||||
cvs [commit aborted]: correct above errors first!
|
|
||||||
```
|
|
||||||
|
|
||||||
It looks like your friends committed their changes first. So your version of `favorites.txt` is not up-to-date with the version in the repository. If you run `cvs status`, you’ll see that your local copy of `favorites.txt` is version 1.2 with some local changes, but the repository version is 1.3:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs status
|
|
||||||
cvs status: Examining .
|
|
||||||
===================================================================
|
|
||||||
File: favorites.txt Status: Needs Merge
|
|
||||||
|
|
||||||
Working revision: 1.2 2018-07-07 10:42:43 -0400
|
|
||||||
Repository revision: 1.3 /Users/sinclairtarget/sandbox/colors/favorites.txt,v
|
|
||||||
Commit Identifier: 2oZ6n0G13bDaldJA
|
|
||||||
Sticky Tag: (none)
|
|
||||||
Sticky Date: (none)
|
|
||||||
Sticky Options: (none)
|
|
||||||
```
|
|
||||||
|
|
||||||
You can run `cvs diff` to see exactly what the differences between 1.2 and 1.3 are:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs diff -r HEAD favorites.txt
|
|
||||||
Index: favorites.txt
|
|
||||||
===================================================================
|
|
||||||
RCS file: /Users/sinclairtarget/sandbox/colors/favorites.txt,v
|
|
||||||
retrieving revision 1.3
|
|
||||||
diff -r1.3 favorites.txt
|
|
||||||
3d2
|
|
||||||
< green
|
|
||||||
7,10d5
|
|
||||||
<
|
|
||||||
< pink
|
|
||||||
< hot pink
|
|
||||||
< bubblegum pink
|
|
||||||
```
|
|
||||||
|
|
||||||
It seems that our friends really like pink. In any case, they’ve edited a different part of the file than we have, so the changes are easy to merge. CVS can do that for us when we run `cvs update`, which is similar to `git pull`:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs update
|
|
||||||
cvs update: Updating .
|
|
||||||
RCS file: /Users/sinclairtarget/sandbox/colors/favorites.txt,v
|
|
||||||
retrieving revision 1.2
|
|
||||||
retrieving revision 1.3
|
|
||||||
Merging differences between 1.2 and 1.3 into favorites.txt
|
|
||||||
M favorites.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
If you now take a look at `favorites.txt`, you’ll find that it has been modified to include the changes that your friends made to the file. Your changes are still there too. Now you are free to commit the file:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs commit
|
|
||||||
cvs commit: Examining .
|
|
||||||
/Users/sinclairtarget/sandbox/colors/favorites.txt,v <-- favorites.txt
|
|
||||||
new revision: 1.4; previous revision: 1.3
|
|
||||||
```
|
|
||||||
|
|
||||||
The end result is what you’d get in Git by running `git pull --rebase`. Your changes have been added on top of your friends’ changes. There is no “merge commit.”
|
|
||||||
|
|
||||||
Sometimes, changes to the same file might be incompatible. If your friends had changed “green” to “olive,” for example, that would have conflicted with your change removing “green” altogether. In the early days of CVS, this was exactly the kind of case that caused people to worry that CVS wasn’t safe; RCS’ pessimistic locking ensured that such a case could never arise. But CVS guarantees safety by making sure that nobody’s changes get overwritten automatically. You have to tell CVS which change you want to keep going forward, so when you run `cvs update`, CVS marks up the file with both changes in the same way that Git does when Git detects a merge conflict. You then have to manually edit the file and pick the change you want to keep.
|
|
||||||
|
|
||||||
The interesting thing to note here is that merge conflicts have to be fixed before you can commit. This is another consequence of CVS’ centralized nature. In Git, you don’t have to worry about resolving merges until you push the commits you’ve got locally.
|
|
||||||
|
|
||||||
Since CVS doesn’t have easily addressable commit objects, the only way to group a collection of changes is to mark a particular working directory state with a tag.
|
|
||||||
|
|
||||||
Creating a tag is easy:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs tag VERSION_1_0
|
|
||||||
cvs tag: Tagging .
|
|
||||||
T favorites.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
You’ll later be able to return files to this state by running `cvs update` and passing the tag to the `-r` flag:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs update -r VERSION_1_0
|
|
||||||
cvs update: Updating .
|
|
||||||
U favorites.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
Because you need a tag to rewind to an earlier working directory state, CVS encourages a lot of preemptive tagging. Before major refactors, for example, you might create a `BEFORE_REFACTOR_01` tag that you could later use if the refactor went wrong. People also used tags if they wanted to generate project-wide diffs. Basically, all the things we routinely do today with commit hashes have to be anticipated and planned for with CVS, since you needed to have the tags available already.
|
|
||||||
|
|
||||||
Branches can be created in CVS, sort of. Branches are just a special kind of tag:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs rtag -b TRY_EXPERIMENTAL_THING colors
|
|
||||||
cvs rtag: Tagging colors
|
|
||||||
```
|
|
||||||
|
|
||||||
That only creates the branch (in full view of everyone, by the way), so you still need to switch to it using `cvs update`:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs update -r TRY_EXPERIMENTAL_THING
|
|
||||||
```
|
|
||||||
|
|
||||||
The above commands switch onto the new branch in your current working directory, but Pragmatic Version Control Using CVS actually advises that you create a new directory to hold your new branch. Presumably its authors found switching directories easier than switching branches in CVS.
|
|
||||||
|
|
||||||
Pragmatic Version Control Using CVS also advises against creating branches off of an existing branch. They recommend only creating branches off of the mainline branch, which in Git is known as `master`. In general, branching was considered an “advanced” CVS skill. In Git, you might start a new branch for almost any trivial reason, but in CVS branching was typically used only when really necessary, such as for releases.
|
|
||||||
|
|
||||||
A branch could later be merged back into the mainline using `cvs update` and the `-j` flag:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cvs update -j TRY_EXPERIMENTAL_THING
|
|
||||||
```
|
|
||||||
|
|
||||||
### Thanks for the Commit Histories
|
|
||||||
|
|
||||||
In 2007, Linus Torvalds gave [a talk][4] about Git at Google. Git was very new then, so the talk was basically an attempt to persuade a roomful of skeptical programmers that they should use Git, even though Git was so different from anything then available. If you haven’t already seen the talk, I highly encourage you to watch it. Linus is an entertaining speaker, even if he never fails to be his brash self. He does an excellent job of explaining why the distributed model of version control is better than the centralized one. A lot of his criticism is reserved for CVS in particular.
|
|
||||||
|
|
||||||
Git is a [complex tool][5]. Learning it can be a frustrating experience. But I’m also continually amazed at the things that Git can do. In comparison, CVS is simple and straightforward, though often unable to do many of the operations we now take for granted. Going back and using CVS for a while is an excellent way to find yourself with a new appreciation for Git’s power and flexibility. It illustrates well why understanding the history of software development can be so beneficial—picking up and re-examining obsolete tools will teach you volumes about the why behind the tools we use today.
|
|
||||||
|
|
||||||
If you enjoyed this post, more like it come out every two weeks! Follow [@TwoBitHistory][6] on Twitter or subscribe to the [RSS feed][7] to make sure you know when a new post is out.
|
|
||||||
|
|
||||||
#### Correction
|
|
||||||
|
|
||||||
I’ve been told that there are many organizations, particularly risk-adverse organizations that do things like make medical device software, that still use CVS. Programmers in these organizations have developed little tricks for working around CVS’ limitations, such as making a new branch for almost every change to avoid committing directly to `HEAD`. (Thanks to Michael Kohne for pointing this out.)
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://twobithistory.org/2018/07/07/cvs.html
|
|
||||||
|
|
||||||
作者:[Two-Bit History][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[runningwater](https://github.com/runningwater)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://twobithistory.org
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://docs.freebsd.org/44doc/psd/28.cvs/paper.pdf
|
|
||||||
[2]: https://www.nongnu.org/cvs/
|
|
||||||
[3]: http://shop.oreilly.com/product/9780974514000.do
|
|
||||||
[4]: https://www.youtube.com/watch?v=4XpnKHJAok8
|
|
||||||
[5]: https://xkcd.com/1597/
|
|
||||||
[6]: https://twitter.com/TwoBitHistory
|
|
||||||
[7]: https://twobithistory.org/feed.xml
|
|
@ -1,7 +1,3 @@
|
|||||||
**translating by [erlinux](https://github.com/erlinux)**
|
|
||||||
**PROJECT MANAGEMENT TOOL called [gn2.sh](https://github.com/lctt/lctt-cli)**
|
|
||||||
|
|
||||||
|
|
||||||
How to analyze your system with perf and Python
|
How to analyze your system with perf and Python
|
||||||
======
|
======
|
||||||
|
|
||||||
|
163
sources/tech/20181105 5 Minimal Web Browsers for Linux.md
Normal file
163
sources/tech/20181105 5 Minimal Web Browsers for Linux.md
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (5 Minimal Web Browsers for Linux)
|
||||||
|
[#]: via: (https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux)
|
||||||
|
[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
5 Minimal Web Browsers for Linux
|
||||||
|
======
|
||||||
|
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV)
|
||||||
|
|
||||||
|
There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options.
|
||||||
|
|
||||||
|
The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs.
|
||||||
|
|
||||||
|
There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered.
|
||||||
|
|
||||||
|
Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in.
|
||||||
|
|
||||||
|
### GNOME Web
|
||||||
|
|
||||||
|
GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation.
|
||||||
|
|
||||||
|
Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines:
|
||||||
|
|
||||||
|
* Simplicity - Feature bloat and user interface clutter are considered evil.
|
||||||
|
|
||||||
|
* Standards compliance - No non-standard features will ever be introduced to the codebase.
|
||||||
|
|
||||||
|
* Software freedom - Epiphany will always be released under a license that respects freedom.
|
||||||
|
|
||||||
|
* Human interface - Epiphany follows the [GNOME Human Interface Guidelines][6].
|
||||||
|
|
||||||
|
* Minimal preferences - Preferences are only added when they make sense and after careful consideration.
|
||||||
|
|
||||||
|
* Target audience - Non-technical users are the primary target audience (which helps to define the types of features that are included).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GNOME Web is as clean and simple a web browser as you’ll find (Figure 1).
|
||||||
|
|
||||||
|
![GNOME Web][8]
|
||||||
|
|
||||||
|
Figure 1: The GNOME Web browser displaying a minimal amount of preferences for the user.
|
||||||
|
|
||||||
|
[Used with permission][9]
|
||||||
|
|
||||||
|
The GNOME Web manifesto reads:
|
||||||
|
|
||||||
|
A web browser is more than an application: it is a way of thinking, a way of seeing the world. Epiphany's principles are simplicity, standards compliance, and software freedom.
|
||||||
|
|
||||||
|
### Netsurf
|
||||||
|
|
||||||
|
The [Netsurf][10] minimal web browser opens almost faster than you can release the mouse button. Netsurf uses its own layout and rendering engine (designed completely from scratch), which is rather hit and miss in its rendering (Figure 2).
|
||||||
|
|
||||||
|
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj)
|
||||||
|
|
||||||
|
Although you might find Netsurf to suffer from rendering issues on certain sites, understand the Hubbub HTML parser is following the work-in-progress HTML5 specification, so there will be issues popup now and then. To ease those rendering headaches, Netsurf does include HTTPS support, web page thumbnailing, URL completion, scale view, bookmarks, full-screen mode, keyboard shorts, and no particular GUI toolkit requirements. That last bit is important, especially when you switch from one desktop to another.
|
||||||
|
|
||||||
|
For those curious as to the requirements for Netsurf, the browser can run on a machine as slow as a 30Mhz ARM 6 computer with 16MB of RAM. That’s impressive, by today’s standard.
|
||||||
|
|
||||||
|
### QupZilla
|
||||||
|
|
||||||
|
If you’re looking for a minimal browser that uses the Qt Framework and the QtWebKit rendering engine, [QupZilla][11] might be exactly what you’re looking for. QupZilla does include all the standard features and functions you’d expect from a web browser, such as bookmarks, history, sidebar, tabs, RSS feeds, ad blocking, flash blocking, and CA Certificates management. Even with those features, QupZilla still manages to remain a very fast lightweight web browser. Other features include: Fast startup, speed dial homepage, built-in screenshot tool, browser themes, and more.
|
||||||
|
One feature that should appeal to average users is that QupZilla has a more standard preferences tools than found in many lightweight browsers (Figure 3). So, if going too far outside the lines isn’t your style, but you still want something lighter weight, QupZilla is the browser for you.
|
||||||
|
|
||||||
|
![QupZilla][13]
|
||||||
|
|
||||||
|
Figure 3: The QupZilla preferences tool.
|
||||||
|
|
||||||
|
[Used with permission][9]
|
||||||
|
|
||||||
|
### Otter Browser
|
||||||
|
|
||||||
|
Otter Browser is a free, open source attempt to recreate the closed-source offerings found in the Opera Browser. Otter Browser uses the WebKit rendering engine and has an interface that should be immediately familiar with any user. Although lightweight, Otter Browser does include full-blown features such as:
|
||||||
|
|
||||||
|
* Passwords manager
|
||||||
|
|
||||||
|
* Add-on manager
|
||||||
|
|
||||||
|
* Content blocking
|
||||||
|
|
||||||
|
* Spell checking
|
||||||
|
|
||||||
|
* Customizable GUI
|
||||||
|
|
||||||
|
* URL completion
|
||||||
|
|
||||||
|
* Speed dial (Figure 4)
|
||||||
|
|
||||||
|
* Bookmarks and various related features
|
||||||
|
|
||||||
|
* Mouse gestures
|
||||||
|
|
||||||
|
* User style sheets
|
||||||
|
|
||||||
|
* Built-in Note tool
|
||||||
|
|
||||||
|
|
||||||
|
![Otter][15]
|
||||||
|
|
||||||
|
Figure 4: The Otter Browser Speed Dial tab.
|
||||||
|
|
||||||
|
[Used with permission][9]
|
||||||
|
|
||||||
|
Otter Browser can be run on nearly any Linux distribution from an [AppImage][16], so there’s no installation required. Just download the AppImage file, give the file executable permissions (with the command chmod u+x otter-browser-*.AppImage), and then launch the app with the command ./otter-browser*.AppImage.
|
||||||
|
|
||||||
|
Otter Browser does an outstanding job of rendering websites and could function as your go-to minimal browser with ease.
|
||||||
|
|
||||||
|
### Lynx
|
||||||
|
|
||||||
|
Let’s get really minimal. When I first started using Linux, back in ‘97, one of the web browsers I often turned to was a text-only take on the app called [Lynx][17]. It should come as no surprise that Lynx is still around and available for installation from the standard repositories. As you might expect, Lynx works from the terminal window and doesn’t display pretty pictures or render much in the way of advanced features (Figure 5). In fact, Lynx is as bare-bones a browser as you will find available. Because of how bare-bones this web browser is, it’s not recommended for everyone. But if you happen to have a gui-less web server and you have a need to be able to read the occasional website, Lynx can be a real lifesaver.
|
||||||
|
|
||||||
|
![Lynx][19]
|
||||||
|
|
||||||
|
Figure 5: The Lynx browser rendering the Linux.com page.
|
||||||
|
|
||||||
|
[Used with permission][9]
|
||||||
|
|
||||||
|
I have also found Lynx an invaluable tool when troubleshooting certain aspects of a website (or if some feature on a website is preventing me from viewing the content in a regular browser). Another good reason to use Lynx is when you only want to view the content (and not the extraneous elements).
|
||||||
|
|
||||||
|
### Plenty More Where This Came From
|
||||||
|
|
||||||
|
There are plenty more minimal browsers than this. But the list presented here should get you started down the path of minimalism. One (or more) of these browsers are sure to fill that need, whether you’re running it on a low-powered machine or not.
|
||||||
|
|
||||||
|
Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux
|
||||||
|
|
||||||
|
作者:[Jack Wallen][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://www.linux.com/users/jlwallen
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://www.mozilla.org/en-US/firefox/new/
|
||||||
|
[2]: https://www.chromium.org/
|
||||||
|
[3]: https://vivaldi.com/
|
||||||
|
[4]: https://www.google.com/chrome/
|
||||||
|
[5]: https://www.merriam-webster.com/dictionary/epiphany
|
||||||
|
[6]: https://developer.gnome.org/hig/stable/
|
||||||
|
[7]: /files/images/minimalbrowsers1jpg
|
||||||
|
[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_1.jpg?itok=Q7wZLF8B (GNOME Web)
|
||||||
|
[9]: /licenses/category/used-permission
|
||||||
|
[10]: https://www.netsurf-browser.org/
|
||||||
|
[11]: https://qupzilla.com/
|
||||||
|
[12]: /files/images/minimalbrowsers3jpg
|
||||||
|
[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_3.jpg?itok=O8iMALWO (QupZilla)
|
||||||
|
[14]: /files/images/minimalbrowsers4jpg
|
||||||
|
[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_4.jpg?itok=5bCa0z-e (Otter)
|
||||||
|
[16]: https://sourceforge.net/projects/otter-browser/files/
|
||||||
|
[17]: https://lynx.browser.org/
|
||||||
|
[18]: /files/images/minimalbrowsers5jpg
|
||||||
|
[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_5.jpg?itok=p_Lmiuxh (Lynx)
|
||||||
|
[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux
|
@ -0,0 +1,342 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (How To Check The List Of Packages Installed From Particular Repository?)
|
||||||
|
[#]: via: (https://www.2daygeek.com/how-to-check-the-list-of-packages-installed-from-particular-repository/)
|
||||||
|
[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
How To Check The List Of Packages Installed From Particular Repository?
|
||||||
|
======
|
||||||
|
|
||||||
|
If you would like to check the list of package installed from particular repository then you are in the right place to get it done.
|
||||||
|
|
||||||
|
Why we need this detail? It may helps you to isolate the installed packages list based on the repository.
|
||||||
|
|
||||||
|
Like, it’s coming from distribution official repository or these are coming from PPA or these are coming from other resources, etc.,
|
||||||
|
|
||||||
|
You may want to know what are the packages came from third party repositories to keep eye on those to avoid any damages on your system.
|
||||||
|
|
||||||
|
So many third party repositories and PPAs are available for Linux. These repositories are included set of packages which is not available in distribution repository due to some limitation.
|
||||||
|
|
||||||
|
It helps administrator to easily install some of the important packages which is not available in the distribution official repository. Installing third party repository on production system is not advisable as this may not properly maintained by the repository maintainer due to many reasons.
|
||||||
|
|
||||||
|
So, you have to decide whether you want to install or not. I can say, we can believe some of the third party repositories which is well maintained and suggested by Linux distributions like [EPEL repository][1], Copr (Cool Other Package Repo), etc,.
|
||||||
|
|
||||||
|
If you would like to see the list of package was installed from the corresponding repo, use the following commands based on your distributions.
|
||||||
|
|
||||||
|
[List of Major repositories][2] and it’s details are below.
|
||||||
|
|
||||||
|
* **`CentOS:`** [EPEL][1], [ELRepo][3], etc is [CentOS Community Approved Repositories][4].
|
||||||
|
* **`Fedora:`** [RPMfusion repo][5] is commonly used by most of the [Fedora][6] users.
|
||||||
|
* **`ArchLinux:`** ArchLinux community repository contains packages that have been adopted by Trusted Users from the Arch User Repository.
|
||||||
|
* **`openSUSE:`** [Packman repo][7] offers various additional packages for openSUSE, especially but not limited to multimedia related applications and libraries that are on the openSUSE Build Service application blacklist. It’s the largest external repository of openSUSE packages.
|
||||||
|
* **`Ubuntu:`** Personal Package Archives (PPAs) are a kind of repository. Developers create them in order to distribute their software. You can find this information on the PPA’s Launchpad page. Also, you can enable Cananical partners repositories.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### What Is Repository?
|
||||||
|
|
||||||
|
A software repository is a central place which stores the software packages for the particular application.
|
||||||
|
|
||||||
|
All the Linux distributions are maintaining their own repositories and they allow users to retrieve and install packages on their machine.
|
||||||
|
|
||||||
|
Each vendor offered a unique package management tool to manage their repositories such as search, install, update, upgrade, remove, etc.
|
||||||
|
|
||||||
|
Most of the Linux distributions comes as freeware except RHEL and SUSE. To access their repositories you need to buy a subscriptions.
|
||||||
|
|
||||||
|
### How To Check The List Of Packages Installed From Particular Repository on RHEL/CentOS Systems?
|
||||||
|
|
||||||
|
This can be done in multiple ways. Here we will be giving you all the possible options and you can choose which one is best for you.
|
||||||
|
|
||||||
|
### Method-1: Using Yum Command
|
||||||
|
|
||||||
|
RHEL & CentOS systems are using RPM packages hence we can use the [Yum Package Manager][8] to get this information.
|
||||||
|
|
||||||
|
YUM stands for Yellowdog Updater, Modified is an open-source command-line front-end package-management utility for RPM based systems such as Red Hat Enterprise Linux (RHEL) and CentOS.
|
||||||
|
|
||||||
|
Yum is the primary tool for getting, installing, deleting, querying, and managing RPM packages from distribution repositories, as well as other third-party repositories.
|
||||||
|
|
||||||
|
```
|
||||||
|
[[email protected] ~]# yum list installed | grep @epel
|
||||||
|
apachetop.x86_64 0.15.6-1.el7 @epel
|
||||||
|
aria2.x86_64 1.18.10-2.el7.1 @epel
|
||||||
|
atop.x86_64 2.3.0-8.el7 @epel
|
||||||
|
axel.x86_64 2.4-9.el7 @epel
|
||||||
|
epel-release.noarch 7-11 @epel
|
||||||
|
lighttpd.x86_64 1.4.50-1.el7 @epel
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, you can use the yum command with other option to get the same details like above.
|
||||||
|
|
||||||
|
```
|
||||||
|
# yum repo-pkgs epel list installed
|
||||||
|
Loaded plugins: fastestmirror
|
||||||
|
Loading mirror speeds from cached hostfile
|
||||||
|
* epel: epel.mirror.constant.com
|
||||||
|
Installed Packages
|
||||||
|
apachetop.x86_64 0.15.6-1.el7 @epel
|
||||||
|
aria2.x86_64 1.18.10-2.el7.1 @epel
|
||||||
|
atop.x86_64 2.3.0-8.el7 @epel
|
||||||
|
axel.x86_64 2.4-9.el7 @epel
|
||||||
|
epel-release.noarch 7-11 @epel
|
||||||
|
lighttpd.x86_64 1.4.50-1.el7 @epel
|
||||||
|
```
|
||||||
|
|
||||||
|
### Method-2: Using Yumdb Command
|
||||||
|
|
||||||
|
Yumdb info provides information similar to yum info but additionally it provides package checksum data, type, user info (who installed the package). Since yum 3.2.26 yum has started storing additional information outside of the rpmdatabase (where user indicates it was installed by the user, and dep means it was brought in as a dependency).
|
||||||
|
|
||||||
|
```
|
||||||
|
# yumdb search from_repo epel* |egrep -v '(from_repo|^$)'
|
||||||
|
Loaded plugins: fastestmirror
|
||||||
|
apachetop-0.15.6-1.el7.x86_64
|
||||||
|
aria2-1.18.10-2.el7.1.x86_64
|
||||||
|
atop-2.3.0-8.el7.x86_64
|
||||||
|
axel-2.4-9.el7.x86_64
|
||||||
|
epel-release-7-11.noarch
|
||||||
|
lighttpd-1.4.50-1.el7.x86_64
|
||||||
|
```
|
||||||
|
|
||||||
|
### Method-3: Using Repoquery Command
|
||||||
|
|
||||||
|
repoquery is a program for querying information from YUM repositories similarly to rpm queries.
|
||||||
|
|
||||||
|
```
|
||||||
|
# repoquery -a --installed --qf "%{ui_from_repo} %{name}" | grep '^@epel'
|
||||||
|
@epel apachetop
|
||||||
|
@epel aria2
|
||||||
|
@epel atop
|
||||||
|
@epel axel
|
||||||
|
@epel epel-release
|
||||||
|
@epel lighttpd
|
||||||
|
```
|
||||||
|
|
||||||
|
### How To Check The List Of Packages Installed From Particular Repository on Fedora System?
|
||||||
|
|
||||||
|
DNF stands for Dandified yum. We can tell DNF, the next generation of yum package manager (Fork of Yum) using hawkey/libsolv library for back-end. Aleš Kozumplík started working on DNF since Fedora 18 and its implemented/launched in Fedora 22 finally.
|
||||||
|
|
||||||
|
[Dnf command][9] is used to install, update, search & remove packages on Fedora 22 and later system. It automatically resolve dependencies and make it smooth package installation without any trouble.
|
||||||
|
|
||||||
|
```
|
||||||
|
# dnf list installed | grep @updates
|
||||||
|
NetworkManager.x86_64 1:1.12.4-2.fc29 @updates
|
||||||
|
NetworkManager-adsl.x86_64 1:1.12.4-2.fc29 @updates
|
||||||
|
NetworkManager-bluetooth.x86_64 1:1.12.4-2.fc29 @updates
|
||||||
|
NetworkManager-libnm.x86_64 1:1.12.4-2.fc29 @updates
|
||||||
|
NetworkManager-libreswan.x86_64 1.2.10-1.fc29 @updates
|
||||||
|
NetworkManager-libreswan-gnome.x86_64 1.2.10-1.fc29 @updates
|
||||||
|
NetworkManager-openvpn.x86_64 1:1.8.8-1.fc29 @updates
|
||||||
|
NetworkManager-openvpn-gnome.x86_64 1:1.8.8-1.fc29 @updates
|
||||||
|
NetworkManager-ovs.x86_64 1:1.12.4-2.fc29 @updates
|
||||||
|
NetworkManager-ppp.x86_64 1:1.12.4-2.fc29 @updates
|
||||||
|
.
|
||||||
|
.
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, you can use the dnf command with other option to get the same details like above.
|
||||||
|
|
||||||
|
```
|
||||||
|
# dnf repo-pkgs updates list installed
|
||||||
|
Installed Packages
|
||||||
|
NetworkManager.x86_64 1:1.12.4-2.fc29 @updates
|
||||||
|
NetworkManager-adsl.x86_64 1:1.12.4-2.fc29 @updates
|
||||||
|
NetworkManager-bluetooth.x86_64 1:1.12.4-2.fc29 @updates
|
||||||
|
NetworkManager-libnm.x86_64 1:1.12.4-2.fc29 @updates
|
||||||
|
NetworkManager-libreswan.x86_64 1.2.10-1.fc29 @updates
|
||||||
|
NetworkManager-libreswan-gnome.x86_64 1.2.10-1.fc29 @updates
|
||||||
|
NetworkManager-openvpn.x86_64 1:1.8.8-1.fc29 @updates
|
||||||
|
NetworkManager-openvpn-gnome.x86_64 1:1.8.8-1.fc29 @updates
|
||||||
|
NetworkManager-ovs.x86_64 1:1.12.4-2.fc29 @updates
|
||||||
|
.
|
||||||
|
.
|
||||||
|
```
|
||||||
|
|
||||||
|
### How To Check The List Of Packages Installed From Particular Repository on openSUSE System?
|
||||||
|
|
||||||
|
Zypper is a command line package manager which makes use of libzypp. [Zypper command][10] provides functions like repository access, dependency solving, package installation, etc.
|
||||||
|
|
||||||
|
```
|
||||||
|
zypper search -ir "Update Repository (Non-Oss)"
|
||||||
|
Loading repository data...
|
||||||
|
Reading installed packages...
|
||||||
|
|
||||||
|
S | Name | Summary | Type
|
||||||
|
---+----------------------------+---------------------------------------------------+--------
|
||||||
|
i | gstreamer-0_10-fluendo-mp3 | GStreamer plug-in from Fluendo for MP3 support | package
|
||||||
|
i+ | openSUSE-2016-615 | Test-update for openSUSE Leap 42.2 Non Free | patch
|
||||||
|
i+ | openSUSE-2017-724 | Security update for unrar | patch
|
||||||
|
i | unrar | A program to extract, test, and view RAR archives | package
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, we can use repo id instead of repo name.
|
||||||
|
|
||||||
|
```
|
||||||
|
zypper search -ir 2
|
||||||
|
Loading repository data...
|
||||||
|
Reading installed packages...
|
||||||
|
|
||||||
|
S | Name | Summary | Type
|
||||||
|
---+----------------------------+---------------------------------------------------+--------
|
||||||
|
i | gstreamer-0_10-fluendo-mp3 | GStreamer plug-in from Fluendo for MP3 support | package
|
||||||
|
i+ | openSUSE-2016-615 | Test-update for openSUSE Leap 42.2 Non Free | patch
|
||||||
|
i+ | openSUSE-2017-724 | Security update for unrar | patch
|
||||||
|
i | unrar | A program to extract, test, and view RAR archives | package
|
||||||
|
```
|
||||||
|
|
||||||
|
### How To Check The List Of Packages Installed From Particular Repository on ArchLinux System?
|
||||||
|
|
||||||
|
[Pacman command][11] stands for package manager utility. pacman is a simple command-line utility to install, build, remove and manage Arch Linux packages. Pacman uses libalpm (Arch Linux Package Management (ALPM) library) as a back-end to perform all the actions.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ paclist community
|
||||||
|
acpi 1.7-2
|
||||||
|
acpid 2.0.30-1
|
||||||
|
adapta-maia-theme 3.94.0.149-1
|
||||||
|
android-tools 9.0.0_r3-1
|
||||||
|
blueman 2.0.6-1
|
||||||
|
brotli 1.0.7-1
|
||||||
|
.
|
||||||
|
.
|
||||||
|
ufw 0.35-5
|
||||||
|
unace 2.5-10
|
||||||
|
usb_modeswitch 2.5.2-1
|
||||||
|
viewnior 1.7-1
|
||||||
|
wallpapers-2018 1.0-1
|
||||||
|
xcursor-breeze 5.11.5-1
|
||||||
|
xcursor-simpleandsoft 0.2-8
|
||||||
|
xcursor-vanilla-dmz-aa 0.4.5-1
|
||||||
|
xfce4-whiskermenu-plugin-gtk3 2.3.0-1
|
||||||
|
zeromq 4.2.5-1
|
||||||
|
```
|
||||||
|
|
||||||
|
### How To Check The List Of Packages Installed From Particular Repository on Debian Based Systems?
|
||||||
|
|
||||||
|
For Debian based systems, it can be done using grep command.
|
||||||
|
|
||||||
|
If you want to know the list of installed repositories on your system, use the following command.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ls -lh /var/lib/apt/lists/ | uniq
|
||||||
|
total 370M
|
||||||
|
-rw-r--r-- 1 root root 10K Oct 26 10:53 archive.canonical.com_ubuntu_dists_bionic_InRelease
|
||||||
|
-rw-r--r-- 1 root root 6.4K Oct 26 10:53 archive.canonical.com_ubuntu_dists_bionic_partner_binary-amd64_Packages
|
||||||
|
-rw-r--r-- 1 root root 6.4K Oct 26 10:53 archive.canonical.com_ubuntu_dists_bionic_partner_binary-i386_Packages
|
||||||
|
-rw-r--r-- 1 root root 3.2K Jun 12 21:19 archive.canonical.com_ubuntu_dists_bionic_partner_i18n_Translation-en
|
||||||
|
drwxr-xr-x 2 _apt root 4.0K Jul 25 08:44 auxfiles
|
||||||
|
-rw-r--r-- 1 root root 3.7K Oct 16 15:13 download.virtualbox.org_virtualbox_debian_dists_bionic_contrib_binary-amd64_Packages
|
||||||
|
-rw-r--r-- 1 root root 7.2K Oct 16 15:13 download.virtualbox.org_virtualbox_debian_dists_bionic_contrib_Contents-amd64.lz4
|
||||||
|
-rw-r--r-- 1 root root 4.4K Oct 16 15:13 download.virtualbox.org_virtualbox_debian_dists_bionic_InRelease
|
||||||
|
-rw-r--r-- 1 root root 34 Mar 19 2018 download.virtualbox.org_virtualbox_debian_dists_bionic_non-free_Contents-amd64.lz4
|
||||||
|
-rw-r--r-- 1 root root 6.4K Sep 21 09:42 in.archive.ubuntu.com_ubuntu_dists_bionic-backports_Contents-amd64.lz4
|
||||||
|
-rw-r--r-- 1 root root 6.4K Sep 21 09:42 in.archive.ubuntu.com_ubuntu_dists_bionic-backports_Contents-i386.lz4
|
||||||
|
-rw-r--r-- 1 root root 73K Nov 6 11:16 in.archive.ubuntu.com_ubuntu_dists_bionic-backports_InRelease
|
||||||
|
.
|
||||||
|
.
|
||||||
|
-rw-r--r-- 1 root root 29 May 11 06:39 security.ubuntu.com_ubuntu_dists_bionic-security_main_dep11_icons-64x64.tar.gz
|
||||||
|
-rw-r--r-- 1 root root 747K Nov 5 23:57 security.ubuntu.com_ubuntu_dists_bionic-security_main_i18n_Translation-en
|
||||||
|
-rw-r--r-- 1 root root 2.8K Oct 9 22:37 security.ubuntu.com_ubuntu_dists_bionic-security_multiverse_binary-amd64_Packages
|
||||||
|
-rw-r--r-- 1 root root 3.7K Oct 9 22:37 security.ubuntu.com_ubuntu_dists_bionic-security_multiverse_binary-i386_Packages
|
||||||
|
-rw-r--r-- 1 root root 1.8K Jul 24 23:06 security.ubuntu.com_ubuntu_dists_bionic-security_multiverse_i18n_Translation-en
|
||||||
|
-rw-r--r-- 1 root root 519K Nov 5 20:12 security.ubuntu.com_ubuntu_dists_bionic-security_universe_binary-amd64_Packages
|
||||||
|
-rw-r--r-- 1 root root 517K Nov 5 20:12 security.ubuntu.com_ubuntu_dists_bionic-security_universe_binary-i386_Packages
|
||||||
|
-rw-r--r-- 1 root root 11K Nov 6 05:36 security.ubuntu.com_ubuntu_dists_bionic-security_universe_dep11_Components-amd64.yml.gz
|
||||||
|
-rw-r--r-- 1 root root 8.9K Nov 6 05:36 security.ubuntu.com_ubuntu_dists_bionic-security_universe_dep11_icons-48x48.tar.gz
|
||||||
|
-rw-r--r-- 1 root root 16K Nov 6 05:36 security.ubuntu.com_ubuntu_dists_bionic-security_universe_dep11_icons-64x64.tar.gz
|
||||||
|
-rw-r--r-- 1 root root 315K Nov 5 20:12 security.ubuntu.com_ubuntu_dists_bionic-security_universe_i18n_Translation-en
|
||||||
|
```
|
||||||
|
|
||||||
|
To get the list of installed packages from the `security.ubuntu.com` repository.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ grep Package /var/lib/apt/lists/security.ubuntu.com_*_Packages | awk '{print $2;}'
|
||||||
|
amd64-microcode
|
||||||
|
apache2
|
||||||
|
apache2-bin
|
||||||
|
apache2-data
|
||||||
|
apache2-dbg
|
||||||
|
apache2-dev
|
||||||
|
.
|
||||||
|
.
|
||||||
|
znc
|
||||||
|
znc-dev
|
||||||
|
znc-perl
|
||||||
|
znc-python
|
||||||
|
znc-tcl
|
||||||
|
zsh-static
|
||||||
|
zziplib-bin
|
||||||
|
```
|
||||||
|
|
||||||
|
The security repository containing multiple branches (main, multiverse and universe) and if you would like to list out the installed packages from the particular repository `universe` then use the following format.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ grep Package /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_bionic-security_universe*_Packages | awk '{print $2;}'
|
||||||
|
ant
|
||||||
|
ant-doc
|
||||||
|
ant-optional
|
||||||
|
apache2-suexec-custom
|
||||||
|
apache2-suexec-pristine
|
||||||
|
apparmor-easyprof
|
||||||
|
apport-kde
|
||||||
|
apport-noui
|
||||||
|
apport-valgrind
|
||||||
|
apt-transport-https
|
||||||
|
.
|
||||||
|
.
|
||||||
|
xul-ext-gdata-provider
|
||||||
|
xul-ext-lightning
|
||||||
|
xvfb
|
||||||
|
znc
|
||||||
|
znc-dev
|
||||||
|
znc-perl
|
||||||
|
znc-python
|
||||||
|
znc-tcl
|
||||||
|
zsh-static
|
||||||
|
zziplib-bin
|
||||||
|
```
|
||||||
|
|
||||||
|
one more example for `ppa.launchpad.net` repository.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ grep Package /var/lib/apt/lists/ppa.launchpad.net_*_Packages | awk '{print $2;}'
|
||||||
|
notepadqq
|
||||||
|
notepadqq-gtk
|
||||||
|
notepadqq-common
|
||||||
|
notepadqq
|
||||||
|
notepadqq-gtk
|
||||||
|
notepadqq-common
|
||||||
|
numix-gtk-theme
|
||||||
|
numix-icon-theme
|
||||||
|
numix-icon-theme-circle
|
||||||
|
numix-icon-theme-square
|
||||||
|
numix-gtk-theme
|
||||||
|
numix-icon-theme
|
||||||
|
numix-icon-theme-circle
|
||||||
|
numix-icon-theme-square
|
||||||
|
```
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.2daygeek.com/how-to-check-the-list-of-packages-installed-from-particular-repository/
|
||||||
|
|
||||||
|
作者:[Prakash Subramanian][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://www.2daygeek.com/author/prakash/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://www.2daygeek.com/install-enable-epel-repository-on-rhel-centos-scientific-linux-oracle-linux/
|
||||||
|
[2]: https://www.2daygeek.com/category/repository/
|
||||||
|
[3]: https://www.2daygeek.com/install-enable-elrepo-on-rhel-centos-scientific-linux/
|
||||||
|
[4]: https://www.2daygeek.com/additional-yum-repositories-for-centos-rhel-fedora-systems/
|
||||||
|
[5]: https://www.2daygeek.com/install-enable-rpm-fusion-repository-on-centos-fedora-rhel/
|
||||||
|
[6]: https://fedoraproject.org/wiki/Third_party_repositories
|
||||||
|
[7]: https://www.2daygeek.com/install-enable-packman-repository-on-opensuse-leap/
|
||||||
|
[8]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/
|
||||||
|
[9]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/
|
||||||
|
[10]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
|
||||||
|
[11]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/
|
@ -1,3 +1,5 @@
|
|||||||
|
translating by seriouszyx
|
||||||
|
|
||||||
A Free, Secure And Cross-platform Password Manager
|
A Free, Secure And Cross-platform Password Manager
|
||||||
======
|
======
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
Translating by qhwdw
|
||||||
An introduction to Udev: The Linux subsystem for managing device events
|
An introduction to Udev: The Linux subsystem for managing device events
|
||||||
======
|
======
|
||||||
Create a script that triggers your computer to do a specific action when a specific device is plugged in.
|
Create a script that triggers your computer to do a specific action when a specific device is plugged in.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: ( )
|
[#]: translator: (qhwdw)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: ( )
|
||||||
[#]: publisher: ( )
|
[#]: publisher: ( )
|
||||||
[#]: subject: (How to Build a Netboot Server, Part 1)
|
[#]: subject: (How to Build a Netboot Server, Part 1)
|
||||||
|
@ -0,0 +1,79 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (Bio-Linux: A stable, portable scientific research Linux distribution)
|
||||||
|
[#]: via: (https://opensource.com/article/18/11/bio-linux)
|
||||||
|
[#]: author: (Matt Calverley https://opensource.com/users/mattcalverley)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Bio-Linux: A stable, portable scientific research Linux distribution
|
||||||
|
======
|
||||||
|
Linux distro's integrated software approach offers powerful bioinformatic data analysis with a familiar look and feel.
|
||||||
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_science.png?itok=WDKARWGV)
|
||||||
|
|
||||||
|
Bio-Linux was introduced and detailed in a [Nature Biotechnology paper in July 2006][1]. The distribution was a group effort by the Natural Environment Research Council in the UK. As the creators and authors point out, the analysis demands of high-throughput “-omic” (genomic, proteomic, metabolomic) science has necessitated the development of integrated computing solutions to analyze the resultant mountains of experimental data.
|
||||||
|
|
||||||
|
From this need, Bio-Linux was born. The distribution, [according to its creators][2], serves as a “free bioinformatics workstation platform that can be installed on anything from a laptop to a large server.” The current distro version, Bio-Linux 8, is built on an Ubuntu 14.04 LTS base. Thus, the general look and feel of Bio-Linux is similar to that of Ubuntu.
|
||||||
|
|
||||||
|
In my own work as a research immunologist, I can attest to both the need for and success of the integrated software approach in Bio-Linux's design and development. Bio-Linux functions as a true turnkey solution to data pipeline requirements of modern science. As the website mentions, Bio-Linux includes [more than 250 pre-installed software packages][3], many of which are specific to the requirements of bioinformatic data analysis.
|
||||||
|
|
||||||
|
The power of this approach becomes immediately evident when you try to duplicate the software installation process under another operating system. Integrating all software components and installing all required dependencies is immensely time-consuming, and in some instances is not even possible outside of the Linux operating system. The Bio-Linux distro provides a portable, stable, integrated environment with pre-installed software sufficient to begin a vast array of bioinformatic analysis tasks.
|
||||||
|
|
||||||
|
By now you’re probably saying, “I’m sold—how do I get this amazing distro?”
|
||||||
|
|
||||||
|
I’m glad you asked. I'll start by saying that there is excellent documentation on the Bio-Linux website. This [documentation][4] covers both installation instructions and a very thorough overview of using the distro.
|
||||||
|
|
||||||
|
The distro can be installed and run locally, run off a CD/DVD or USB, installed on a server, or run out of a virtual machine environment. To begin the installation process for local installation, [download the disk image or ISO][5] for the Bio-Linux distro. The disk image is a 3.3GB file, and depending on your internet download speed, this may be a good time to get a cup of coffee or take a nice nap.
|
||||||
|
|
||||||
|
Once the ISO has been downloaded, the Bio-Linux developers recommend using [UNetBootin][6], a freely available cross-platform software package used to make bootable USBs. There is a link provided for UNetBootin on the Bio-Linux website. I can attest to the effectiveness of UNetBootin in both Mac and Linux operating systems.
|
||||||
|
|
||||||
|
On Unix family operating systems (Mac OS and Linux), it is also possible to make a bootable USB from the command line using the `dd `command:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo umount “USB location”
|
||||||
|
|
||||||
|
sudo dd bs=4M if=”ISO location” of =”USB location” conv=fdatasync
|
||||||
|
```
|
||||||
|
Regardless of the method you use, this might be another good time for a coffee break.
|
||||||
|
|
||||||
|
At this point in my installation, UNetBootin appeared to freeze at the `squashfs` file transfer during bootable USB creation. However, a quick check of the Ubuntu disks application confirmed that the file was still being written to the USB. In other words, be patient—it takes quite some time to make the bootable USB.
|
||||||
|
|
||||||
|
Once you’ve had your coffee and you have a finished USB in hand, you are ready to use Bio-Linux. As the Bio-Linux website points out, if you are trying to use a bootable USB with a Mac computer (particularly newer hardware versions), you may not be able to boot from the USB. There are workarounds, but they involve configuring the system for dual boot. Likewise, on Windows-based machines, it may be necessary to make changes to the boot order and possibly the secure boot settings for the machine from within BIOS.
|
||||||
|
|
||||||
|
From this point, how you use the distro is up to you. You can run the distro from the USB to test it. You can install the distro to your computer. You can even follow the instructions on the Bio-Linux website to make a VM instance of the distro or run it on a server. Regardless of how you use it, you have a high-powered bioinformatic data analysis workstation at your disposal.
|
||||||
|
|
||||||
|
Maybe you have a professional need for such a workstation, but even if you never use Bio-Linux as a professional researcher, it could provide a great resource for biology teaching professionals at all levels to introduce students to modern bioinformatics principles. For the price of a laptop and a USB, every school can have an in silico teaching resource to complement classroom lessons in the “-omics” age. Your only limitations are your creativity and the performance of your hardware.
|
||||||
|
|
||||||
|
### More on Linux
|
||||||
|
|
||||||
|
As an open source operating system with strong community support, the Linux kernel shares many of the strengths common to other successful open source software endeavors. Linux tends to be both stable and amenable to customization. It is also fairly hardware-agnostic, capable of running alongside other operating systems on a wide array of hardware configurations. In fact, installing Linux is a common method of regaining usability from dated hardware that is incapable of running other modern operating systems. Linux is also highly portable and can be run from any bootable external storage device, such as a USB drive, without the need to permanently install the operating system.
|
||||||
|
|
||||||
|
It is this combination of stability, customizability, and portability that initially drew me to Linux. Each Linux operating system variant is referred to as a distribution (or distro), and it seems as though there is a Linux distribution for every imaginable computing scenario or desire. The options can actually be rather intimidating, and I suspect they may often discourage people from trying Linux.
|
||||||
|
|
||||||
|
“How many different distributions can there possibly be?” you might wonder. If you have a few minutes, or even a few hours, have a look at [DistroWatch.com][7]. As its name implies, this site is devoted to the cataloging of all things Linux distribution-related. For visual learners, there is an amazing [Linux family tree][8] that really puts it into perspective.
|
||||||
|
|
||||||
|
While [entire books][9] are devoted to the topic of Linux distributions, the differences often depend on what software is included in the base installation, how the software is managed, and graphical differences affecting the “look and feel” of the distribution. Certainly, there are also subtleties of hardware compatibility, speed, and stability.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/18/11/bio-linux
|
||||||
|
|
||||||
|
作者:[Matt Calverley][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/mattcalverley
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://www.nature.com/articles/nbt0706-801
|
||||||
|
[2]: http://environmentalomics.org/bio-linux/
|
||||||
|
[3]: http://environmentalomics.org/bio-linux-software-list/
|
||||||
|
[4]: http://nebc.nerc.ac.uk/downloads/courses/Bio-Linux/bl8_latest.pdf
|
||||||
|
[5]: http://environmentalomics.org/bio-linux-download/
|
||||||
|
[6]: https://unetbootin.github.io/
|
||||||
|
[7]: https://distrowatch.com/
|
||||||
|
[8]: https://distrowatch.com/images/other/distro-family-tree.png
|
||||||
|
[9]: https://www.amazon.com/Introducing-Linux-Distros-Dieguez-Castro/dp/1484213939
|
@ -0,0 +1,127 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux)
|
||||||
|
[#]: via: (https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/)
|
||||||
|
[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux
|
||||||
|
======
|
||||||
|
|
||||||
|
We have to make the system up-to date to minimize the downtime and issues.
|
||||||
|
|
||||||
|
It’s one of the routine task for Linux administrator to patch the system once in a month or 60 days once or 90 days at maximum.
|
||||||
|
|
||||||
|
It would be sufficient schedule and we can’t do it this less than a month as it’s involve multiple activities and environments.
|
||||||
|
|
||||||
|
Basically infrastructure comes with Test, Development, QA a.k.a Staging & Prod environments.
|
||||||
|
|
||||||
|
Initially we will deploy the patches in the Test environment and corresponding team will be monitoring the system a week then they will give a status report like good or bad.
|
||||||
|
|
||||||
|
If it’s success then we will move forward to other environments. If everything is good then finally we will patch production servers.
|
||||||
|
|
||||||
|
Many of the organization has prepare to patch entire system. i mean full system update. It is a general patching schedule for a typical infrastructure.
|
||||||
|
|
||||||
|
In some of the infrastructure they may have only production environment so, we should not prepare for the full system update instead we can go with security patch to make the system more stable and secure.
|
||||||
|
|
||||||
|
Since Arch Linux and its derivatives distributions are fall under rolling release can be considered to be always up-to-date, as it uses the latest versions of software packages from the upstream.
|
||||||
|
|
||||||
|
In some cases if you want to update security patch alone then you have to use arch-audit tool to identify and fix the security patches.
|
||||||
|
|
||||||
|
### What is a Vulnerability?
|
||||||
|
|
||||||
|
A vulnerability is a security weakness in a software program or hardware components (firmware). It’s a flaw that can leave it open to attack.
|
||||||
|
|
||||||
|
To mitigate this we need to patch accordingly like for application/hardware it could be a code changes or config changes or parameter changes.
|
||||||
|
|
||||||
|
### What is Arch-Audit Tool?
|
||||||
|
|
||||||
|
[Arch-audit][1] is a tool like pkg-audit for Arch Linux system. It Uses data collected by the awesome Arch Security Team. It wont scan and find the vulnerable packages on your system like **yum –security check-update & yum updateinfo list available** and it will simply parse the <https://security.archlinux.org/> page and display the results in terminal. So, it would show the accurate data.
|
||||||
|
|
||||||
|
The Arch Security Team is a group of volunteers whose goal is to track security issues with Arch Linux packages. All issues are tracked on the Arch Linux security tracker.
|
||||||
|
|
||||||
|
The team was formerly known as the Arch CVE Monitoring Team. The mission of the Arch Security Team is to contribute to the improvement of the security of Arch Linux.
|
||||||
|
|
||||||
|
### How to Install arch-audit tool in Arch Linux
|
||||||
|
|
||||||
|
The arch-audit tool is available in community repository so you can use the Pacman Package Manager to install it.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo pacman -S arch-audit
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the `arch-audit` tool to find the open vulnerable packages on Arch based distributions.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ arch-audit
|
||||||
|
Package cairo is affected by CVE-2017-7475. Low risk!
|
||||||
|
Package exiv2 is affected by CVE-2017-11592, CVE-2017-11591, CVE-2017-11553, CVE-2017-17725, CVE-2017-17724, CVE-2017-17723, CVE-2017-17722. Medium risk!
|
||||||
|
Package libtiff is affected by CVE-2018-18661, CVE-2018-18557, CVE-2017-9935, CVE-2017-11613. High risk!. Update to 4.0.10-1!
|
||||||
|
Package openssl is affected by CVE-2018-0735, CVE-2018-0734. Low risk!
|
||||||
|
Package openssl-1.0 is affected by CVE-2018-5407, CVE-2018-0734. Low risk!
|
||||||
|
Package patch is affected by CVE-2018-6952, CVE-2018-1000156. High risk!. Update to 2.7.6-7!
|
||||||
|
Package pcre is affected by CVE-2017-11164. Low risk!
|
||||||
|
Package systemd is affected by CVE-2018-6954, CVE-2018-15688, CVE-2018-15687, CVE-2018-15686. Critical risk!. Update to 239.300-1!
|
||||||
|
Package unzip is affected by CVE-2018-1000035. Medium risk!
|
||||||
|
Package webkit2gtk is affected by CVE-2018-4372. Critical risk!. Update to 2.22.4-1!
|
||||||
|
```
|
||||||
|
|
||||||
|
The above result shows the vulnerability risk status as well such as Low, Medium and Critical.
|
||||||
|
|
||||||
|
To Show only vulnerable package names and their versions.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ arch-audit -q
|
||||||
|
cairo
|
||||||
|
exiv2
|
||||||
|
libtiff>=4.0.10-1
|
||||||
|
openssl
|
||||||
|
openssl-1.0
|
||||||
|
patch>=2.7.6-7
|
||||||
|
pcre
|
||||||
|
systemd>=239.300-1
|
||||||
|
unzip
|
||||||
|
webkit2gtk>=2.22.4-1
|
||||||
|
```
|
||||||
|
|
||||||
|
To show only packages that have already been fixed.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ arch-audit --upgradable --quiet
|
||||||
|
libtiff>=4.0.10-1
|
||||||
|
patch>=2.7.6-7
|
||||||
|
systemd>=239.300-1
|
||||||
|
webkit2gtk>=2.22.4-1
|
||||||
|
```
|
||||||
|
|
||||||
|
To cross check the above results, i’m going to test one of the package which is listed above in <https://www.archlinux.org/packages/> to confirm whether the vulnerability is still open or fixed it. Yes, it’s fixed and published the updated package in repository on yesterday.
|
||||||
|
![][3]
|
||||||
|
|
||||||
|
To print only package names and associated CVEs alone.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ arch-audit -uf "%n|%c"
|
||||||
|
libtiff|CVE-2018-18661,CVE-2018-18557,CVE-2017-9935,CVE-2017-11613
|
||||||
|
patch|CVE-2018-6952,CVE-2018-1000156
|
||||||
|
systemd|CVE-2018-6954,CVE-2018-15688,CVE-2018-15687,CVE-2018-15686
|
||||||
|
webkit2gtk|CVE-2018-4372
|
||||||
|
```
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/
|
||||||
|
|
||||||
|
作者:[Prakash Subramanian][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://www.2daygeek.com/author/prakash/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://github.com/ilpianista/arch-audit
|
||||||
|
[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||||
|
[3]: https://www.2daygeek.com/wp-content/uploads/2018/11/A-Tool-To-Check-Vulnerable-Packages-In-Arch-Linux.png
|
@ -1,145 +0,0 @@
|
|||||||
[#]: collector: (lujun9972)
|
|
||||||
[#]: translator: ( )
|
|
||||||
[#]: reviewer: ( )
|
|
||||||
[#]: publisher: ( )
|
|
||||||
[#]: subject: (OpenSnitch – an Application Firewall for Linux [Review])
|
|
||||||
[#]: via: (https://itsfoss.com/opensnitch-firewall-linux/)
|
|
||||||
[#]: author: ([John Paul](https://itsfoss.com/author/john/))
|
|
||||||
[#]: url: ( )
|
|
||||||
|
|
||||||
OpenSnitch – an Application Firewall for Linux [Review]
|
|
||||||
======
|
|
||||||
|
|
||||||
Just because Linux is a lot more secure than Windows, there is no reason you should not be cautious. There are a number of firewalls available for Linux that you can use to make your Linux system more secure. Today we will be taking a look at one of such firewall tool called OpenSnitch.
|
|
||||||
|
|
||||||
### What is OpenSnitch?
|
|
||||||
|
|
||||||
![Linux firewall and security][1]
|
|
||||||
|
|
||||||
[OpenSnitch][2] is a port of Little Snitch. Little Snitch, in turn, is an application firewall designed solely for Mac OS. OpenSnitch is created by [Simone Margaritelli][3], also known as [evilsocket][4].
|
|
||||||
|
|
||||||
The main thing that OpenSnitch does is track internet requests made by applications you have installed. OpenSnitch allows you to create rules for which apps to allow to access the internet and which to block. Each time an application that does not have a rule in place tries to access the internet, a dialog box appears. This dialog box gives you the option to allow or block the connection.
|
|
||||||
|
|
||||||
You can also decide whether this new rule applies to the process, the exact URL it is attempting to reach, the domain that it is attempting to reach, to this single instance, to this session or forever.
|
|
||||||
|
|
||||||
![OpenSnitch firewall app in Linux][5]OpenSnatch rule request
|
|
||||||
|
|
||||||
All of the rules that you create are stored as [JSON files][6] so you can change them later if you need to. For example, if you incorrectly blocked an application.
|
|
||||||
|
|
||||||
OpenSnitch also has a nice graphical user interface that lets you see at a glance:
|
|
||||||
|
|
||||||
* What applications are accessing the web
|
|
||||||
* What IP address they are using
|
|
||||||
* What User owns it
|
|
||||||
* What port is being used
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
You can also export the information to a CSV file if you wish.
|
|
||||||
|
|
||||||
OpenSnitch is available under the GPL v3 license.
|
|
||||||
|
|
||||||
![OpenSnitch firewall interface][7]OpenSnitch processes tab
|
|
||||||
|
|
||||||
### Installing OpenSnitch in Linux
|
|
||||||
|
|
||||||
The installation instructions on the [OpenSnitch GitHub page][8] are aimed at Ubuntu users. If you are using another distro, you will have to adjust the commands. As far as I know, this application is only packaged in the [Arch User Repository][9].
|
|
||||||
|
|
||||||
Before you start, you need to have Go properly installed and the `$GOPATH` environment variable is defined.
|
|
||||||
|
|
||||||
First, install the necessary dependencies.
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt-get install protobuf-compiler libpcap-dev libnetfilter-queue-dev python3-pip
|
|
||||||
|
|
||||||
go get github.com/golang/protobuf/protoc-gen-go
|
|
||||||
|
|
||||||
go get -u github.com/golang/dep/cmd/dep
|
|
||||||
|
|
||||||
python3 -m pip install --user grpcio-tools
|
|
||||||
```
|
|
||||||
|
|
||||||
Next, you will need to clone the OpenSnitch repo. There will probably be a message that no Go files where found. Ignore it. If you get a message that git is missing, just install it.
|
|
||||||
|
|
||||||
```
|
|
||||||
go get github.com/evilsocket/opensnitch
|
|
||||||
|
|
||||||
cd $GOPATH/src/github.com/evilsocket/opensnitch
|
|
||||||
```
|
|
||||||
|
|
||||||
If the `$GOPATH` environment variable is not setup correctly, you will get a “no such folder found” error on the previous command. just `cd` into the location of the “evilsocket/opensnitch” folder that was listed when you cloned it to your system.
|
|
||||||
|
|
||||||
Now, we build and install it.
|
|
||||||
|
|
||||||
```
|
|
||||||
make
|
|
||||||
|
|
||||||
sudo make install
|
|
||||||
```
|
|
||||||
|
|
||||||
If you get an error that the `dep` command could not be found, add `GOPATH/bin` is in the `PATH`.
|
|
||||||
|
|
||||||
Once that is finished, we will initiate the daemon and start the graphical user environment.
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo systemctl enable opensnitchd
|
|
||||||
|
|
||||||
sudo service opensnitchd start
|
|
||||||
|
|
||||||
opensnitch-ui
|
|
||||||
```
|
|
||||||
|
|
||||||
![OpenSnitch firewall interface][10]OpenSnitch on Manjaro
|
|
||||||
|
|
||||||
### Experience
|
|
||||||
|
|
||||||
I’ll be honest: my experience with OpenSnitch was not great. I started by trying to install it on Fedora. I had trouble finding some of the dependencies. I switched over to Manjaro and was happy to find it in the Arch User Repository.
|
|
||||||
|
|
||||||
Unfortunately, after I ran the installation, I could not launch the graphical user interface. So I ran the last three steps by hand. Everything seemed to be working fine. The dialog box popped up asking me if I wanted to let Firefox visit the Manjaro website.
|
|
||||||
|
|
||||||
Interestingly, when I ran an [AUR tool][11] `yay` to update my system, the dialog box requested rules for `yay`, `pacman`, `pamac`, and `git`. Later, I had to close and restart the GUI because it was acting up. When I restart it, it stopped asking me to create rules. I installed Falkon and OpenSnitch did not ask me to give it any permissions. It did not even list Falkon in the OpenSnithch GUI. I reinstalled OpenSnitch. Same issue.
|
|
||||||
|
|
||||||
Then I moved to Ubuntu Mate. Since the installation instructions were written for Ubuntu, things went easier. However, I ran into a couple issues. I tweaked the installation instructions above to fix the problems I encountered.
|
|
||||||
|
|
||||||
Installation was not the only issue that I ran into. The dialog box that appeared every time a new app created a connection only lasted for 10 seconds. That was barely enough time to explore the available options. Most of the time, I only had time to allow an application (only the ones I trust) to access the web forever.
|
|
||||||
|
|
||||||
The GUI also left a bit to be desired. For some reason, the window was set to be on top all of the time. On top of that, there are no setting to change it. It would also have been nice to have the option to change rules from the GUI.
|
|
||||||
|
|
||||||
![][12]OpenSnitch hosts tab
|
|
||||||
|
|
||||||
### Final Thoughts on OpenSnitch
|
|
||||||
|
|
||||||
I like what OpenSnitch is aiming for: any easy way to control what information leaves your computer. However, it has too many rough edges for me to recommend it to a regular or hobby user. If you are a power user, who likes to tinker and dig for answers then maybe this is for you.
|
|
||||||
|
|
||||||
It’s kinda disappointing. I would have hoped that an application that recently hit 1.0 would be in a little better shape.
|
|
||||||
|
|
||||||
Have you ever used OpenSnitch? If not, what is your favorite firewall app? How do you make your Linux system more secure? Let us know in the comments below.
|
|
||||||
|
|
||||||
If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][13].
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://itsfoss.com/opensnitch-firewall-linux/
|
|
||||||
|
|
||||||
作者:[John Paul][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://itsfoss.com/author/john/
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/linux-firewall-security.jpg?fit=800%2C450&ssl=1
|
|
||||||
[2]: https://www.opensnitch.io/
|
|
||||||
[3]: https://github.com/evilsocket
|
|
||||||
[4]: https://twitter.com/evilsocket
|
|
||||||
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/11/opensnitch-dialog.jpg?fit=800%2C421&ssl=1
|
|
||||||
[6]: https://www.json.org/
|
|
||||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/11/opensnitch-processes.jpg?fit=800%2C651&ssl=1
|
|
||||||
[8]: https://github.com/evilsocket/opensnitch
|
|
||||||
[9]: https://aur.archlinux.org/packages/opensnitch-git
|
|
||||||
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/opensnitch-manjaro.jpg?fit=800%2C651&ssl=1
|
|
||||||
[11]: https://itsfoss.com/best-aur-helpers/
|
|
||||||
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/11/opensnitch-hosts.jpg?fit=800%2C651&ssl=1
|
|
||||||
[13]: http://reddit.com/r/linuxusersgroup
|
|
94
sources/tech/20181129 4 open source Markdown editors.md
Normal file
94
sources/tech/20181129 4 open source Markdown editors.md
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
lxfminions translating
|
||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (4 open source Markdown editors)
|
||||||
|
[#]: via: (https://opensource.com/article/18/11/markdown-editors)
|
||||||
|
[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
4 open source Markdown editors
|
||||||
|
======
|
||||||
|
If you're looking for an easy way to format Markdown text, these editors may fit your needs.
|
||||||
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-docdish-typewriterkeys.png?itok=IeQWevaV)
|
||||||
|
|
||||||
|
I do most of my writing in a text editor and format it with [Markdown][1]—articles, essays, blog posts, and much more. I'm not the only one, either. Not only do countless people write with Markdown, but there are also more than a few publishing tools built around it.
|
||||||
|
|
||||||
|
Who'd have thought that a simple way to format web documents created by John Gruber and the late Aaron Schwartz would become so popular?
|
||||||
|
|
||||||
|
While most of my writing takes place in a text editor, I can understand the appeal of a dedicated Markdown editor. You get quick access to formatting, you can easily convert your documents to other formats, and you can get an instant preview.
|
||||||
|
|
||||||
|
If you're thinking about going Markdown and are looking for a dedicated editor, here are four open source options for your writing pleasure.
|
||||||
|
|
||||||
|
### Ghostwriter
|
||||||
|
|
||||||
|
[Ghostwriter][2] ranks in the top three of the dedicated Markdown editors I've used or tried. And I've used or tried a few!
|
||||||
|
|
||||||
|
![](https://opensource.com/sites/default/files/uploads/markdown-editors_ghostwriter.png)
|
||||||
|
|
||||||
|
As an editor, Ghostwriter is pretty much a blank canvas. Start typing and adding formatting by hand. If you don't want to do that, or are just learning Markdown and don't know what to add, you can select certain formatting from Ghostwriter's Format menu.
|
||||||
|
|
||||||
|
Admittedly, it's just basic formatting—lists, character formatting, and indenting. You'll have to add headings, code, and the like by hand. But the Task List option is interesting. I know a few people who create their to-do lists in Markdown, and this option makes creating and maintaining one much easier.
|
||||||
|
|
||||||
|
What sets Ghostwriter apart from other Markdown editors is its range of export options. You can choose the Markdown processor you want to use, including [Sundown][3], [Pandoc][4], or [Discount][5]. With a couple of clicks, you can convert what you're writing to HTML5, ODT, EPUB, LaTeX, PDF, or a Word document.
|
||||||
|
|
||||||
|
### Abricotine
|
||||||
|
|
||||||
|
If you like your Markdown editors simple, you'll like [Abricotine][6]. But don't let its simplicity fool you; Abricotine packs quite a punch.
|
||||||
|
|
||||||
|
![](https://opensource.com/sites/default/files/uploads/markdown-editors_abricotine.png)
|
||||||
|
|
||||||
|
Like any other editor, you can enter formatting by hand or use the Format or Insert menus. Abricotine also has a menu for inserting a [GitHub Flavored Markdown][7] table. There are 16 pre-packaged table formats, and you can add rows or columns as you need them. If the tables are looking a bit messy, you can pretty them up by pressing Ctrl+Shift+B.
|
||||||
|
|
||||||
|
Abricotine can automatically display images, links, and math. You can turn all that off if you want to. The editor is, however, limited to exporting documents as HTML.
|
||||||
|
|
||||||
|
### Mark Text
|
||||||
|
|
||||||
|
Like Abricotine, [Mark Text][8] is a simple Markdown editor that might surprise you. It has a few features you might not expect and does quite a good job of handling documents formatted with Markdown.
|
||||||
|
|
||||||
|
![](https://opensource.com/sites/default/files/uploads/markdown-editors_marktext.png)
|
||||||
|
|
||||||
|
Mark Text stays out of your way. There are no menus or toolbars. You get to the commands and functions by clicking the stacked menu in the top-left corner of the editor window. It's just you and your words.
|
||||||
|
|
||||||
|
The editor's default mode is a semi-WYSIWYG view, although you can change that to see the formatting code you've added to your writing. As for that formatting, Mark Text supports GitHub Flavored Markdown, so you can add tables and formatted blocks of code with syntax highlighting. In its default view, the editor displays any images in your document.
|
||||||
|
|
||||||
|
While Mark Text lacks Ghostwriter's range of export options, you can save your files as HTML or PDF. The output doesn't look too bad, either.
|
||||||
|
|
||||||
|
### Remarkable
|
||||||
|
|
||||||
|
[Remarkable][9] lies somewhere between Ghostwriter and Abricotine or Mark Text. It has that two-paned interface, but with a slightly more modern look. And it has a few useful features.
|
||||||
|
|
||||||
|
![](https://opensource.com/sites/default/files/uploads/markdown-editors_remarkable.png)
|
||||||
|
|
||||||
|
The first thing you notice about Remarkable is its [Material Design][10]-inspired look and feel. It's not for everyone, and I'll be honest: It took me a little while to get used to it. Once you do, it's easy to use.
|
||||||
|
|
||||||
|
You get quick access to formatting from the toolbar and the menus. You can also change the preview pane's style using one of 11 built-in Cascading Style Sheets or by creating one of your own.
|
||||||
|
|
||||||
|
Remarkable's export options are limited—you can export your work only as HTML or PDF files. You can, however, copy an entire document or a selected portion as HTML, which you can paste into another document or editor.
|
||||||
|
|
||||||
|
Do you have a favorite dedicated Markdown editor? Why not share it by leaving a comment?
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/18/11/markdown-editors
|
||||||
|
|
||||||
|
作者:[Scott Nesbitt][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/scottnesbitt
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://en.wikipedia.org/wiki/Markdown
|
||||||
|
[2]: https://wereturtle.github.io/ghostwriter/
|
||||||
|
[3]: https://github.com/vmg/sundown
|
||||||
|
[4]: https://pandoc.org
|
||||||
|
[5]: https://www.pell.portland.or.us/~orc/Code/discount/
|
||||||
|
[6]: http://abricotine.brrd.fr/
|
||||||
|
[7]: https://guides.github.com/features/mastering-markdown/
|
||||||
|
[8]: https://marktext.github.io/website/
|
||||||
|
[9]: https://remarkableapp.github.io/
|
||||||
|
[10]: https://en.wikipedia.org/wiki/Material_Design
|
@ -0,0 +1,344 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (HankChow)
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (Some Alternatives To ‘top’ Command line Utility You Might Want To Know)
|
||||||
|
[#]: via: (https://www.ostechnix.com/some-alternatives-to-top-command-line-utility-you-might-want-to-know/)
|
||||||
|
[#]: author: (SK https://www.ostechnix.com/author/sk/)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Some Alternatives To ‘top’ Command line Utility You Might Want To Know
|
||||||
|
======
|
||||||
|
|
||||||
|
![](https://www.ostechnix.com/wp-content/uploads/2018/11/Alternatives-To-Top-Command-720x340.png)
|
||||||
|
|
||||||
|
Every now and then, I see a lot of open source programs, tools, and utilities are being added to GitHub and GitLab by developers across the world. Some of those programs are new and some of them are just alternative programs to the most popular and widely used existing Linux programs. In this tutorial, we are going to discuss about some good alternatives to [**‘top’**][1], the command line task manager program. Read on.
|
||||||
|
|
||||||
|
### Alternatives To ‘top’ Command line Utility
|
||||||
|
|
||||||
|
As of writing this guide, I am aware of the following 6 alternatives to Top program, namely:
|
||||||
|
|
||||||
|
1. Htop
|
||||||
|
2. Vtop
|
||||||
|
3. Gtop
|
||||||
|
4. Gotop
|
||||||
|
5. Ptop
|
||||||
|
6. Hegemon
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
I will keep updating this list if I come across any similar utilities in the days to come. Bookmark this guide if you’re interested to know about such utilities.
|
||||||
|
|
||||||
|
#### 1\. Htop
|
||||||
|
|
||||||
|
The **htop** is a popular, open source and cross-platform interactive process manager. It is my favorite system activity monitor tool. htop is an enhanced version of the classic top program. It is originally developed for Linux, but the developer extended its support to other Unix-like operating systems such as FreeBSD and Mac OS X. htop is free open source, and ncurses-based utility released under GPLv2.
|
||||||
|
|
||||||
|
Compared to the classic top command, it has the following few advantages.
|
||||||
|
|
||||||
|
* htop starts faster than top program.
|
||||||
|
* htop allows us to scroll horizontally and vertically to view all processes and full command lines.
|
||||||
|
* There is no need to type the PID to kill a process in htop. But in top, you need to type the PID to kill the process.
|
||||||
|
* There is no need to type PID to change the priority of a process, but in top command, you do.
|
||||||
|
* We can kill multiple processes at once in htop.
|
||||||
|
* In top program you are subject to a delay for each unassigned key you press. It is especially annoying when multi-key escape sequences are triggered by accident.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Installing htop**
|
||||||
|
|
||||||
|
htop is available in the default repositories of most Linux distributions.
|
||||||
|
|
||||||
|
On Arch-based systems, run the following command to install htop.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo pacman -S htop
|
||||||
|
```
|
||||||
|
|
||||||
|
On Debian-based systems:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo apt install htop
|
||||||
|
```
|
||||||
|
|
||||||
|
On RPM-based systems:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo dnf install htop
|
||||||
|
```
|
||||||
|
|
||||||
|
Or,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo yum install htop
|
||||||
|
```
|
||||||
|
|
||||||
|
On openSUSE:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo zypper in htop
|
||||||
|
```
|
||||||
|
|
||||||
|
**Usage**
|
||||||
|
|
||||||
|
When you htop command without any arguments, you will see the following screen.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ htop
|
||||||
|
```
|
||||||
|
![](https://www.ostechnix.com/wp-content/uploads/2018/11/htop-command-1.png)
|
||||||
|
|
||||||
|
As you can see, htop task manager shows total memory and swap usage, total number of tasks, system average load and system uptime on the top. On the bottom side, just like top command, it displays the list of processes in multiple columns. Each column displays details such as pid, user, priority, nice value, virtual memory usage, cpu usage, memory usage by each process etc. You can read about these parameters in the top command tutorial linked in the first paragraph.
|
||||||
|
|
||||||
|
Unlike top command, htop allows you to perform each operation with a dedicated function key. Here is the list of shortcut keys to interact with htop.
|
||||||
|
|
||||||
|
* **F1, h, ?** – Open help section.
|
||||||
|
* **F2, S(Shift+s)** – Go to the setup section, where you can configure the meters displayed at the top of the screen, set various display options, choose among color schemes, and select which columns are displayed, in which order etc.
|
||||||
|
* **F3, /** – Search the command lines of all the displayed processes.
|
||||||
|
* **F4, \** – Filter processes. Just type the part of the process name and you will see only the processes that matches the name. Press F4 again and hit ESC key to cancel filtering.
|
||||||
|
* **F5, t** – Switch between tree view and default view. Press + to view the sub-tree.
|
||||||
|
* **F6, <, >** – Sort the processes by PID, USER, PRIORITY, NICE value, CPU usage, MEMORY usage etc.
|
||||||
|
* **F7, ]** – Increase the selected process’s priority.
|
||||||
|
* **F8, [** – Decrease the selected process’s priority.
|
||||||
|
* **F9, k** – Kill the processes. Use the UP/DOWN arrows to choose the process and press F9 or k to kill it.
|
||||||
|
* **F10, q** – Exit htop.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
All shortcuts keys are given at the bottom of the htop interface.
|
||||||
|
|
||||||
|
Please note that some of these function keys might be assigned to various Terminal operations. For example, when I hit the F2 key, it didn’t go to htop setup section. Instead it displayed the option to set the title to my Terminal window. In such cases, you might need to other keys given along with the function keys.
|
||||||
|
|
||||||
|
Apart from the above mentioned keys, there are few more keys available to perform different functions. For example,
|
||||||
|
|
||||||
|
* Press **‘u’** to show processes owned by a user.
|
||||||
|
* **Shift+m** will sort the processes by memory usage.
|
||||||
|
* **Shift+p** – Sort the processes by processor usage.
|
||||||
|
* **Shit+t** – Sort the processes by time.
|
||||||
|
* **CTRL+l** – Refresh screen.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
htop can do everything using the shortcut keys without having to mention any options when launching it. However, you can use some flags when starting it.
|
||||||
|
|
||||||
|
For example, to start htop displaying only processes owned by given user, run:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ htop -u <username>
|
||||||
|
```
|
||||||
|
|
||||||
|
Change the Output Refresh Interval:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ htop -d 10
|
||||||
|
```
|
||||||
|
|
||||||
|
As you can see, htop usage is incredibly easier than the usage of top command.
|
||||||
|
|
||||||
|
Refer htop man pages to know more about the available options and functionalities.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ man htop
|
||||||
|
```
|
||||||
|
|
||||||
|
Also, refer the project home page and HitHub repository.
|
||||||
|
|
||||||
|
+ [htop website](http://hisham.hm/htop/)
|
||||||
|
+ [htop GitHub Repository](https://github.com/hishamhm/htop)
|
||||||
|
|
||||||
|
#### 2\. Vtop
|
||||||
|
|
||||||
|
**Vtop** is yet another alternative to good-old top utility. It is a free and open source, command-line system activity monitor written in **NodeJS** and released under MIT. It uses unicode braille characters to draw CPU and Memory charts, helping you to visualize spikes.
|
||||||
|
|
||||||
|
Make sure you have NodeJS installed on your system. If not installed yet, refer the following guide.
|
||||||
|
|
||||||
|
Once node installed, run the following command to install Vtop.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install -g vtop
|
||||||
|
```
|
||||||
|
|
||||||
|
After installing Vtop, simply run vtop to start monitoring.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ vtop
|
||||||
|
```
|
||||||
|
|
||||||
|
Sample output:
|
||||||
|
|
||||||
|
![][3]
|
||||||
|
|
||||||
|
As you can see, Vtop interface is little bit different than top and htop programs. It displays each details in a separate box layout. You will see all shortcuts keys to interact with Vtop at the bottom.
|
||||||
|
|
||||||
|
Here is the list of shortcuts:
|
||||||
|
|
||||||
|
* **dd** – Kill the processes.
|
||||||
|
* **UP** arrow or **k** – Move up.
|
||||||
|
* **DOWN** arrow or **j** – Move down.
|
||||||
|
* **Left** arrow or or **h** to – Zoom the graphs in.
|
||||||
|
* **Right** arrow or **l** – Zoom the graphs out.
|
||||||
|
* **g** – Jump to top of the process list.
|
||||||
|
* **SHIFT+g** – Jump to end of the process list.
|
||||||
|
* **c** – Sort processes by CPU usage.
|
||||||
|
* **m** – Sort processes by memory usage.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
For more details, refer the following Vtop resources.
|
||||||
|
|
||||||
|
+ [Vtop website](http://parall.ax/vtop)
|
||||||
|
+ [Vtop GitHub Repository](https://github.com/MrRio/vtop)
|
||||||
|
|
||||||
|
|
||||||
|
#### 3\. Gtop
|
||||||
|
|
||||||
|
Gtop is same as Vtop system activity monitor. It is also written in NodeJS and released under MIT license.
|
||||||
|
|
||||||
|
To install it, run:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install gtop -g
|
||||||
|
```
|
||||||
|
|
||||||
|
Start gtop using command:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ gtop
|
||||||
|
```
|
||||||
|
|
||||||
|
Sample output:
|
||||||
|
|
||||||
|
![](https://www.ostechnix.com/wp-content/uploads/2018/11/gtop.png)
|
||||||
|
|
||||||
|
I noticed Gtop interface is very nice. It showed each elements with different set of colors which is eye-pleasing.
|
||||||
|
|
||||||
|
Keyboard shortcuts:
|
||||||
|
|
||||||
|
* **p** – Sort processes by process Id.
|
||||||
|
* **c** – Sort processes by CPU usage.
|
||||||
|
* **m** – Sort processes by Memory usage.
|
||||||
|
* **q** or **ctrl+c** – Quit Gtop.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
For more details, visit Gtop GitHub page.
|
||||||
|
|
||||||
|
+ [Gtop GitHub Repository](https://github.com/aksakalli/gtop)
|
||||||
|
|
||||||
|
|
||||||
|
#### 4\. Gotop
|
||||||
|
|
||||||
|
As the name says, **Gotop** is a TUI graphical activity monitor, written in **Go** programming language. It is completely free, open source and inspired by **gtop** and **vtop** programs which we mentioned in the previous sections. We already have written about it a while ago. If you’re interested to learn about it, please visit the following link.
|
||||||
|
|
||||||
|
+ [Gotop – Yet Another TUI Graphical Activity Monitor, Written In Go
|
||||||
|
](https://www.ostechnix.com/manage-python-packages-using-pip/)
|
||||||
|
|
||||||
|
#### 5\. Ptop
|
||||||
|
|
||||||
|
Some of you might not like programs written in NodeJS and Go. If you’re one of them, there is another process monitor program named **Ptop** , which is written in **Python** programming language. It is free, open source system activity monitor, released under MIT license.
|
||||||
|
|
||||||
|
Ptop is compatible with both Python2.x and Python3.x, so you can easily install it using **Pip** , a package manager to install programs developed in Python. If you haven’t installed Pip yet, refer the following link.
|
||||||
|
|
||||||
|
+ [How To Manage Python Packages Using Pip](https://www.ostechnix.com/manage-python-packages-using-pip/)
|
||||||
|
|
||||||
|
After installing Pip, run the following command to install ptop.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pip install ptop
|
||||||
|
```
|
||||||
|
|
||||||
|
Or, you can compile from source as shown below.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ git clone https://github.com/darxtrix/ptop
|
||||||
|
$ cd ptop/
|
||||||
|
$ pip install -r requirements.txt # install requirements
|
||||||
|
$ sudo python setup.py install
|
||||||
|
```
|
||||||
|
|
||||||
|
To update Ptop, run:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pip install --upgrade ptop
|
||||||
|
```
|
||||||
|
|
||||||
|
Even if you don’t update, Ptop will prompt you if you’d like to update to the latest version when launch it for the first time.
|
||||||
|
|
||||||
|
Now, let us run ptop and see what happens.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ptop
|
||||||
|
```
|
||||||
|
|
||||||
|
Here you go!
|
||||||
|
![](https://www.ostechnix.com/wp-content/uploads/2018/11/ptop-1.png)
|
||||||
|
Here is the list of shortcuts keys to interact with ptop:
|
||||||
|
|
||||||
|
* **Ctrl+k** – Kill the process.
|
||||||
|
* **Ctrl+n** – Sort processes by memory usage.
|
||||||
|
* **Ctrl+t** – Sort processes by process lifetime.
|
||||||
|
* **Ctrl+r** – Reset the stats.
|
||||||
|
* **Ctrl+f** – Filter a specific process information. Just type process name and you will see its details only.
|
||||||
|
* **Ctrl+l** – View the information of a selected process.
|
||||||
|
* **g** – Go to the top of the process list.
|
||||||
|
* **Ctrl+q** – Quit Ptop.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Ptop has a feature to change the theme. If you want a pretty output of Ptop, you could use any one of the available themes. Currently the following themes are supported:
|
||||||
|
|
||||||
|
* colorful
|
||||||
|
* elegant
|
||||||
|
* simple
|
||||||
|
* dark
|
||||||
|
* light
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
To set a theme, for example colorful, simply run:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ptop -t colorful
|
||||||
|
```
|
||||||
|
|
||||||
|
To view help section, use **-h** :
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ptop -h
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details, refer the project’s GitHub page.
|
||||||
|
|
||||||
|
+ [Ptop Github Repository](https://github.com/darxtrix/ptop)
|
||||||
|
|
||||||
|
#### 6\. Hegemon
|
||||||
|
|
||||||
|
**Hegemon** is another system activity monitor application written in **Rust** programming language. If you’re fan of programs written in Rust, hegemon might be a good choice. We have published a brief review about Hegemon a while ago. Please visit the following link to know more about this tool.
|
||||||
|
|
||||||
|
[Hegemon – A Modular System Monitor Application Written In Rust](https://www.ostechnix.com/hegemon-a-modular-system-monitor-application-written-in-rust/)
|
||||||
|
|
||||||
|
### Conclusion
|
||||||
|
|
||||||
|
You know now six alternatives to Top program. I won’t claim these programs are better than or best replacement for ‘top’ program. But it is always nice to know some alternatives. I use htop mostly to monitor the processes. Now is your turn. Have you used any tools listed here? Great! Which is your favorite tool and why? Please share your experience in the comment section below.
|
||||||
|
|
||||||
|
More good stuffs to come. Stay tuned!
|
||||||
|
|
||||||
|
Cheers!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.ostechnix.com/some-alternatives-to-top-command-line-utility-you-might-want-to-know/
|
||||||
|
|
||||||
|
作者:[SK][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://www.ostechnix.com/author/sk/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://www.ostechnix.com/the-top-command-tutorial-with-examples-for-beginners/
|
||||||
|
[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||||
|
[3]: http://www.ostechnix.com/wp-content/uploads/2018/11/vtop.png
|
@ -0,0 +1,125 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (Boxing yourself in on the Linux command line)
|
||||||
|
[#]: via: (https://opensource.com/article/18/12/linux-toy-boxes)
|
||||||
|
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Boxing yourself in on the Linux command line
|
||||||
|
======
|
||||||
|
Learn how to use the boxes utility to draw shapes with characters at the Linux terminal and make your words stand out.
|
||||||
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-boxes.png?itok=Rii6nT5P)
|
||||||
|
|
||||||
|
It's the holiday season, and every Linux terminal user deserves a little gift. It doesn't matter whether you celebrate Christmas, another holiday, or nothing at all. So I'm gathering together a collection of 24 Linux command-line toys over the next few weeks for you to enjoy and share with your friends. Let's have a little fun and add a little joy to a month that, at least here in the northern hemisphere, can be a little bit cold and dreary.
|
||||||
|
|
||||||
|
Chances are, there will be a few that you've heard of before. But, hopefully, we'll all have a chance to learn something new. (I know I did when doing some research to make sure I could make it to 24.)
|
||||||
|
|
||||||
|
The first of our 24 Linux terminal toys is a program called boxes. Why start with boxes? Because it's going to be hard to wrap up all of our other command-line presents to you without it!
|
||||||
|
|
||||||
|
On my Fedora machine, boxes wasn't installed by default, but it was in my normal repositories, so installing it was as simple as
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo dnf install boxes -y
|
||||||
|
```
|
||||||
|
|
||||||
|
If you're on a different distribution, there's a good chance you'll find it in your default repositories as well.
|
||||||
|
|
||||||
|
Boxes a utility I really wish I had in my high school and college computer science courses, where well-intentioned teachers insisted I provide very specific looking comment at the beginning of every source file, function, code block, etc.
|
||||||
|
|
||||||
|
```
|
||||||
|
/***************/
|
||||||
|
/* Hello World */
|
||||||
|
/***************/
|
||||||
|
```
|
||||||
|
|
||||||
|
It turns out, once you add a few lines of text inside, formatting them can get, well, tedious. Enter boxes. Boxes is a simple utility for surrounding a block of text with an ASCII art-style box. It comes with defaults for source code commenting, as well as other options.
|
||||||
|
|
||||||
|
It's really easy to use. Using pipes, I can push a short greeting into a box.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cat greeting.txt | boxes -d diamonds -a c
|
||||||
|
```
|
||||||
|
|
||||||
|
Which will give us the output as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
/\ /\ /\
|
||||||
|
/\//\\/\ /\//\\/\ /\//\\/\
|
||||||
|
/\//\\\///\\/\//\\\///\\/\//\\\///\\/\
|
||||||
|
//\\\//\/\\///\\\//\/\\///\\\//\/\\///\\
|
||||||
|
\\//\/ \/\\//
|
||||||
|
\/ \/
|
||||||
|
/\ I'm wishing you all a /\
|
||||||
|
//\\ joyous holiday season //\\
|
||||||
|
\\// and a Happy Gnu Year! \\//
|
||||||
|
\/ \/
|
||||||
|
/\ /\
|
||||||
|
//\\/\ /\//\\
|
||||||
|
\\///\\/\//\\\///\\/\//\\\///\\/\//\\\//
|
||||||
|
\/\\///\\\//\/\\///\\\//\/\\///\\\//\/
|
||||||
|
\/\\//\/ \/\\//\/ \/\\//\/
|
||||||
|
\/ \/ \/
|
||||||
|
```
|
||||||
|
|
||||||
|
Or perhaps something more fun, like:
|
||||||
|
|
||||||
|
```
|
||||||
|
echo "I am a dog" | boxes -d dog -a c
|
||||||
|
```
|
||||||
|
|
||||||
|
Which will, unsurprisingly, give you the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
__ _,--="=--,_ __
|
||||||
|
/ \." .-. "./ \
|
||||||
|
/ ,/ _ : : _ \/` \
|
||||||
|
\ `| /o\ :_: /o\ |\__/
|
||||||
|
`-'| :="~` _ `~"=: |
|
||||||
|
\` (_) `/
|
||||||
|
.-"-. \ | / .-"-.
|
||||||
|
.---{ }--| /,.-'-.,\ |--{ }---.
|
||||||
|
) (_)_)_) \_/`~-===-~`\_/ (_(_(_) (
|
||||||
|
( I am a dog )
|
||||||
|
) (
|
||||||
|
'---------------------------------------'
|
||||||
|
```
|
||||||
|
|
||||||
|
Boxes comes with [lots of options][1] for padding, position, and even processing regular expressions. You can learn more about boxes on the [project's homepage][2], or head over to [GitHub][3] to download the source code or contribute your own box. In fact, if you're looking for an idea to submit, I've got an idea for you: why not a holiday present?
|
||||||
|
|
||||||
|
```
|
||||||
|
_ _
|
||||||
|
/_\/_\
|
||||||
|
_______\_\/_/_______
|
||||||
|
| ///\\\ |
|
||||||
|
| /// \\\ |
|
||||||
|
| |
|
||||||
|
| "Happy pull |
|
||||||
|
| request!" |
|
||||||
|
|____________________|
|
||||||
|
```
|
||||||
|
|
||||||
|
Boxes is open source under a GPLv2 license.
|
||||||
|
|
||||||
|
Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end.
|
||||||
|
|
||||||
|
Or check out tomorrow's command-line toy, [Drive a locomotive through your Linux terminal][4].
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/18/12/linux-toy-boxes
|
||||||
|
|
||||||
|
作者:[Jason Baker][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/jason-baker
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: http://boxes.thomasjensen.com/examples.html
|
||||||
|
[2]: https://boxes.thomasjensen.com/
|
||||||
|
[3]: https://github.com/ascii-boxes/boxes
|
||||||
|
[4]: https://opensource.com/article/18/12/linux-toy-sl
|
@ -0,0 +1,71 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (geekpi)
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (Drive a locomotive through your Linux terminal)
|
||||||
|
[#]: via: (https://opensource.com/article/18/12/linux-toy-sl)
|
||||||
|
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Drive a locomotive through your Linux terminal
|
||||||
|
======
|
||||||
|
Using the sl command, you can train yourself to get on track with a fun command-line experience.
|
||||||
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-sl.png?itok=WPTj0Ga9)
|
||||||
|
|
||||||
|
It's December, and every Linux terminal user deserves a reward just for making through the year. So we're bringing you a sort of advent calendar of Linux command-line toys. What's a command-line toy? It might be a game, a pointless little time waster, or just something to bring you joy at the terminal.
|
||||||
|
|
||||||
|
**sl** , which is short for steam locomotive.
|
||||||
|
|
||||||
|
Today's Linux command-line toy is a suggestion from Opensource.com community moderator [Ben Cotton][1] . Ben suggested, which is short for steam locomotive.
|
||||||
|
|
||||||
|
It's also, conveniently and not coincidentally, a common typo for the Linux **ls** command. Want to stop mistyping ls? Try installing **sl**. It's probably packaged for your default repos. For me, in Fedora, that means it was as simple to install as:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo dnf install sl -y
|
||||||
|
```
|
||||||
|
|
||||||
|
Now, just type **sl** to try it out.
|
||||||
|
|
||||||
|
![](https://opensource.com/sites/default/files/uploads/linux-toy-sl-animated.gif)
|
||||||
|
|
||||||
|
You may notice, as I did, that **Ctrl+C** doesn't derail your train, so you have to wait for the entire train to pass. That'll teach you to mistype **ls**!
|
||||||
|
|
||||||
|
Want to check out the source to **sl**? It's over [on GitHub][2].
|
||||||
|
|
||||||
|
**sl** is also a great opportunity to share a personal PSA about open source licensing. While its [license][3] was "open source enough" to be packaged for my distribution, it's not technically an [OSI-approved][4] license. After the copyright line, the license reads simply:
|
||||||
|
|
||||||
|
```
|
||||||
|
Everyone is permitted to do anything on this program including copying,
|
||||||
|
modifying, and improving, unless you try to pretend that you wrote it.
|
||||||
|
i.e., the above copyright notice has to appear in all copies.
|
||||||
|
THE AUTHOR DISCLAIMS ANY RESPONSIBILITY WITH REGARD TO THIS SOFTWARE.
|
||||||
|
```
|
||||||
|
|
||||||
|
Unfortunately, when you chose a license that's not OSI-approved, you may accidentally be creating extra work for your users, as they must figure out whether your license will work for their situation. Do their corporate policies allow them to contribute? Can they even legally use the program? Does the license mesh with the license of another program they wish to integrate with it?
|
||||||
|
|
||||||
|
Unless you're a lawyer (and perhaps, even if you are), navigating the space of non-standard licenses can be tricky. So if you're still looking for a New Year's Resolution, why not resolve to choose only OSI-approved licenses for any new projects you start in 2019.
|
||||||
|
|
||||||
|
No disrespect to the creator, though. **sl** is still a great little command-line toy.
|
||||||
|
|
||||||
|
Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end.
|
||||||
|
|
||||||
|
Check out yesterday's toy, [Box yourself in on the Linux command line][5], and check back tomorrow for another!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/18/12/linux-toy-sl
|
||||||
|
|
||||||
|
作者:[Jason Baker][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/jason-baker
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/users/bcotton
|
||||||
|
[2]: https://github.com/mtoyoda/sl
|
||||||
|
[3]: https://github.com/mtoyoda/sl/blob/master/LICENSE
|
||||||
|
[4]: https://opensource.org/licenses
|
||||||
|
[5]: https://opensource.com/article/18/12/linux-toy-boxes
|
266
sources/tech/20181202 How To Customize The GNOME 3 Desktop.md
Normal file
266
sources/tech/20181202 How To Customize The GNOME 3 Desktop.md
Normal file
@ -0,0 +1,266 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (How To Customize The GNOME 3 Desktop?)
|
||||||
|
[#]: via: (https://www.2daygeek.com/how-to-customize-the-gnome-3-desktop/)
|
||||||
|
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
How To Customize The GNOME 3 Desktop?
|
||||||
|
======
|
||||||
|
|
||||||
|
We have got many emails from user to write an article about GNOME 3 desktop customization but we don’t get a time to write this topic.
|
||||||
|
|
||||||
|
I was using Ubuntu operating system since long time in my primary laptop and i got bored so, i would like to test some other distro which is related to Arch Linux.
|
||||||
|
|
||||||
|
I prefer to go with Majaro so, i have installed Manjaro 18.0 with GNOME 3 desktop in my laptop.
|
||||||
|
|
||||||
|
I’m customizing my desktop, how i want it. So, i would like to take this opportunity to write up this article in detailed way to help others.
|
||||||
|
|
||||||
|
This article helps others to customize their desktop without headache.
|
||||||
|
|
||||||
|
I’m not going to include all my customization and i will be adding a necessary things which will be mandatory and useful for Linux desktop users.
|
||||||
|
|
||||||
|
If you feel some tweak is missing in this article, i would request you to mention that in comment sections. It will be very helpful for other users.
|
||||||
|
|
||||||
|
### 1) How to Launch Activities Overview in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
The Activities Overview will display all the running applications or launched/opened windows by clicking `Super Key` or by clicking `Activities` button in the topmost left corner.
|
||||||
|
|
||||||
|
It allows you to launch a new applications, switch windows, and move windows between workspaces.
|
||||||
|
|
||||||
|
You can simply exit the Activities Overview by choosing the following any of the one actions like selecting a window, application or workspace, or by pressing the `Super Key` or `Esc Key`.
|
||||||
|
|
||||||
|
Activities Overview Screenshot.
|
||||||
|
![][2]
|
||||||
|
|
||||||
|
### 2) How to Resize Windows in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
The Launched windows can be maximized, unmaximized and snapped to one side of the screen (Left or Right) by using the following key combinations.
|
||||||
|
|
||||||
|
* `Super Key+Down Arrow:` To unmaximize the window.
|
||||||
|
* `Super Key+Up Arrow:` To maximize the window.
|
||||||
|
* `Super Key+Right Arrow:` To fill a window in the right side of the half screen.
|
||||||
|
* `Super Key+Left Arrow:` To fill a window in the left side of the half screen
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Use `Super Key+Down Arrow` to unmaximize the window.
|
||||||
|
![][3]
|
||||||
|
|
||||||
|
Use `Super Key+Up Arrow` to maximize the window.
|
||||||
|
![][4]
|
||||||
|
|
||||||
|
Use `Super Key+Right Arrow` to fill a window in the right side of the half screen.
|
||||||
|
![][5]
|
||||||
|
|
||||||
|
Use `Super Key+Left Arrow` to fill a window in the left side of the half screen.
|
||||||
|
![][6]
|
||||||
|
|
||||||
|
This feature will help you to view two applications at a time a.k.a splitting screen.
|
||||||
|
![][7]
|
||||||
|
|
||||||
|
### 3) How to Display Applications in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
Click on the `Show Application Grid` button in the Dash to display all the installed applications on your system.
|
||||||
|
![][8]
|
||||||
|
|
||||||
|
### 4) How to Add Applications on Dash in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
To speed up your day to day activity you may want to add frequently used application into Dash or Drag the application launcher to the Dash.
|
||||||
|
|
||||||
|
It will allow you to directly launch your favorite applications without searching them. To do so, simply right click on it and use the option `Add to Favorites`.
|
||||||
|
![][9]
|
||||||
|
|
||||||
|
To remove a application launcher a.k.a favorite from Dash, either drag it from the Dash to the grid button or simply right click on it and use the option `Remove from Favorites`.
|
||||||
|
![][10]
|
||||||
|
|
||||||
|
### 5) How to Switch Between Workspaces in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
Workspaces allow you to group windows together. It will helps you to segregate your work properly. If you are working on Multiple things and you want to group each work and related things separately then it will be very handy and perfect option for you.
|
||||||
|
|
||||||
|
You can switch workspaces in two ways, Open the Activities Overview and select a workspace from the right-hand side or use the following key combinations.
|
||||||
|
|
||||||
|
* Use `Ctrl+Alt+Up` Switch to the workspace above.
|
||||||
|
* Use `Ctrl+Alt+Down` Switch to the workspace below.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
![][11]
|
||||||
|
|
||||||
|
### 6) How to Switch Between Applications (Application Switcher) in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
Use either `Alt+Tab` or `Super+Tab` to switch between applications. To launch Application Switcher, use either `Alt+Tab` or `Super+Tab`.
|
||||||
|
|
||||||
|
Once launched, just keep holding the Alt or Super key and hit the tab key to move to the next application from left to right order.
|
||||||
|
|
||||||
|
### 7) How to Add UserName to Top Panel in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
If you would like to add your UserName to Top Panel then install the following [Add Username to Top Panel][12] GNOME Extension.
|
||||||
|
![][13]
|
||||||
|
|
||||||
|
### 8) How to Add Microsoft Bing’s wallpaper in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
Install the following [Bing Wallpaper Changer][14] GNOME shell extension to change your wallpaper every day to Microsoft Bing’s wallpaper.
|
||||||
|
![][15]
|
||||||
|
|
||||||
|
### 9) How to Enable Night Light in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
Night light app is one of the famous app which reduces strain on the eyes by turning your screen a dim yellow from blue light after sunset.
|
||||||
|
|
||||||
|
It is available in smartphones. The other known apps for the same purpose are flux and **[redshift][16]**.
|
||||||
|
|
||||||
|
To enable this, navigate to **System Settings** >> **Devices** >> **Displays** and turn Nigh Light on.
|
||||||
|
![][17]
|
||||||
|
|
||||||
|
Once it’s enabled and status icon will be placed on the top panel.
|
||||||
|
![][18]
|
||||||
|
|
||||||
|
### 10) How to Show the Battery Percentage in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
Battery percentage will show you the exact battery usage. To enable this follow the below steps.
|
||||||
|
|
||||||
|
Start GNOME Tweaks >> **Top Bar** >> **Battery Percentage** and switch it on.
|
||||||
|
![][19]
|
||||||
|
|
||||||
|
After modification you can able to see the battery percentage icon on the top panel.
|
||||||
|
![][20]
|
||||||
|
|
||||||
|
### 11) How to Enable Mouse Right Click in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
By default right click is disabled on GNOME 3 desktop environment. To enable this follow the below steps.
|
||||||
|
|
||||||
|
Start GNOME Tweaks >> **Keyboard & Mouse** >> Mouse Click Emulation and select “Area” option.
|
||||||
|
![][21]
|
||||||
|
|
||||||
|
### 12) How to Enable Minimize On Click in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
Enable one-click minimize feature which will help us to minimize opened window without using minimize option.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'
|
||||||
|
```
|
||||||
|
|
||||||
|
### 13) How to Customize Dock in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
If you would like to change your Dock similar to Deepin desktop or Mac then use the following set of commands.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ gsettings set org.gnome.shell.extensions.dash-to-dock dock-position BOTTOM
|
||||||
|
$ gsettings set org.gnome.shell.extensions.dash-to-dock extend-height false
|
||||||
|
$ gsettings set org.gnome.shell.extensions.dash-to-dock transparency-mode FIXED
|
||||||
|
$ gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 50
|
||||||
|
```
|
||||||
|
|
||||||
|
![][22]
|
||||||
|
|
||||||
|
### 14) How to Show Desktop in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
By default `Super Key+D` shortcut doesn’t show your desktop. To configure this follow the below steps.
|
||||||
|
|
||||||
|
Settings >> **Devices** >> **Keyboard** >> Click **Hide all normal windows** under Navigation then Press `Super Key+D` finally hit `Set` button to enable it.
|
||||||
|
![][23]
|
||||||
|
|
||||||
|
### 15) How to Customize Date and Time Format?
|
||||||
|
|
||||||
|
By default GNOME 3 shows date and time with `Sun 04:48`. It’s not clear and if you want to get the output with following format `Sun Dec 2 4:49 AM` follow the below steps.
|
||||||
|
|
||||||
|
**For Date Modification:** Start GNOME Tweaks >> **Top Bar** and enable `Weekday` option under Clock.
|
||||||
|
![][24]
|
||||||
|
|
||||||
|
**For Time Modification:** Settings >> **Details** >> **Date & Time** then choose `AM/PM` option in the time format.
|
||||||
|
![][25]
|
||||||
|
|
||||||
|
After modification you can able to see the date and time format same as below.
|
||||||
|
![][26]
|
||||||
|
|
||||||
|
### 16) How to Permanently Disable Unused Services in Boot?
|
||||||
|
|
||||||
|
In my case, i’m not going to use **Bluetooth** & **cpus a.k.a Printer service**. Hence, disabling these services on my laptop. To disable services on Arch based systems use **[Pacman Package Manager][27]**.
|
||||||
|
For Bluetooth
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo systemctl stop bluetooth.service
|
||||||
|
$ sudo systemctl disable bluetooth.service
|
||||||
|
$ sudo systemctl mask bluetooth.service
|
||||||
|
$ systemctl status bluetooth.service
|
||||||
|
```
|
||||||
|
|
||||||
|
For cups
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo systemctl stop org.cups.cupsd.service
|
||||||
|
$ sudo systemctl disable org.cups.cupsd.service
|
||||||
|
$ sudo systemctl mask org.cups.cupsd.service
|
||||||
|
$ systemctl status org.cups.cupsd.service
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally verify whether these services are disabled or not in the boot using the following command. If you want to double confirm this, you can reboot once and check the same. Navigate to the following link to know more about **[systemctl][28]** usage,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ systemctl list-unit-files --type=service | grep enabled
|
||||||
|
[email protected] enabled
|
||||||
|
dbus-org.freedesktop.ModemManager1.service enabled
|
||||||
|
dbus-org.freedesktop.NetworkManager.service enabled
|
||||||
|
dbus-org.freedesktop.nm-dispatcher.service enabled
|
||||||
|
display-manager.service enabled
|
||||||
|
gdm.service enabled
|
||||||
|
[email protected] enabled
|
||||||
|
linux-module-cleanup.service enabled
|
||||||
|
ModemManager.service enabled
|
||||||
|
NetworkManager-dispatcher.service enabled
|
||||||
|
NetworkManager-wait-online.service enabled
|
||||||
|
NetworkManager.service enabled
|
||||||
|
systemd-fsck-root.service enabled-runtime
|
||||||
|
tlp-sleep.service enabled
|
||||||
|
tlp.service enabled
|
||||||
|
```
|
||||||
|
|
||||||
|
### 17) Install Icons & Themes in GNOME 3 Desktop?
|
||||||
|
|
||||||
|
Bunch of Icons and Themes are available for GNOME Desktop so, choose the desired **[GTK Themes][29]** and **[Icons Themes][30]** for you. To configure this further, navigate to the below links which makes your Desktop more elegant.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.2daygeek.com/how-to-customize-the-gnome-3-desktop/
|
||||||
|
|
||||||
|
作者:[Magesh Maruthamuthu][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://www.2daygeek.com/author/magesh/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||||
|
[2]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-overview-screenshot.jpg
|
||||||
|
[3]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-unmaximize-the-window.jpg
|
||||||
|
[4]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-maximize-the-window.jpg
|
||||||
|
[5]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-fill-a-window-right-side.jpg
|
||||||
|
[6]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-fill-a-window-left-side.jpg
|
||||||
|
[7]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-split-screen.jpg
|
||||||
|
[8]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-display-applications.jpg
|
||||||
|
[9]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-add-applications-on-dash.jpg
|
||||||
|
[10]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-remove-applications-from-dash.jpg
|
||||||
|
[11]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-workspaces-screenshot.jpg
|
||||||
|
[12]: https://extensions.gnome.org/extension/1108/add-username-to-top-panel/
|
||||||
|
[13]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-add-username-to-top-panel.jpg
|
||||||
|
[14]: https://extensions.gnome.org/extension/1262/bing-wallpaper-changer/
|
||||||
|
[15]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-add-microsoft-bings-wallpaper.jpg
|
||||||
|
[16]: https://www.2daygeek.com/install-redshift-reduce-prevent-protect-eye-strain-night-linux/
|
||||||
|
[17]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-enable-night-light.jpg
|
||||||
|
[18]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-enable-night-light-1.jpg
|
||||||
|
[19]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-display-battery-percentage.jpg
|
||||||
|
[20]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-display-battery-percentage-1.jpg
|
||||||
|
[21]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-enable-mouse-right-click.jpg
|
||||||
|
[22]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-dock-customization.jpg
|
||||||
|
[23]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-enable-show-desktop.jpg
|
||||||
|
[24]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-customize-date.jpg
|
||||||
|
[25]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-customize-time.jpg
|
||||||
|
[26]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-customize-date-time.jpg
|
||||||
|
[27]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/
|
||||||
|
[28]: https://www.2daygeek.com/sysvinit-vs-systemd-cheatsheet-systemctl-command-usage/
|
||||||
|
[29]: https://www.2daygeek.com/category/gtk-theme/
|
||||||
|
[30]: https://www.2daygeek.com/category/icon-theme/
|
149
sources/tech/20181204 Have a cow at the Linux command line.md
Normal file
149
sources/tech/20181204 Have a cow at the Linux command line.md
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (Have a cow at the Linux command line)
|
||||||
|
[#]: via: (https://opensource.com/article/18/12/linux-toy-cowsay)
|
||||||
|
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Have a cow at the Linux command line
|
||||||
|
======
|
||||||
|
Bring a bovine voice to your terminal output with the cowsay utility.
|
||||||
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cowsay.png?itok=RA4NDbrY)
|
||||||
|
|
||||||
|
Welcome to the fourth day of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself, what’s a command-line toy. We’re figuring that out as we go, but generally, it could be a game, or any simple diversion that helps you have fun at the terminal.
|
||||||
|
|
||||||
|
Some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. Because just about everyone who I’ve mentioned this series to has asked me about it already, today’s selection is an obligatory one.
|
||||||
|
|
||||||
|
You didn’t think we’d make it through this series without mentioning cowsay, did you?
|
||||||
|
|
||||||
|
Cowsay is an udderly fantastic utility that takes text and outputs it as the spoken text of an ASCII-art bovine.
|
||||||
|
|
||||||
|
You’ll likely find cowsay packaged in your default repositories, and perhaps even already installed. For me, in Fedora, all it took to install was:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo dnf install -y cowsay
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, invoke it with cowsay followed by your message. Perhaps you’d like to pipe in the [fortune][1] [utility][1] we talked about yesterday.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ fortune | cowsay
|
||||||
|
_________________________________________
|
||||||
|
/ If at first you do succeed, try to hide \
|
||||||
|
\ your astonishment. /
|
||||||
|
-----------------------------------------
|
||||||
|
\ ^__^
|
||||||
|
\ (oo)\_______
|
||||||
|
(__)\ )\/\
|
||||||
|
||----w |
|
||||||
|
|| ||
|
||||||
|
```
|
||||||
|
|
||||||
|
That’s it! **Cowsay** ships with few variations, called cow files, that can usually be found in **/usr/share/cowsay.** To see the cow file options available on your system, use **-l** flag after cowsay. Then, use the **-f** flag to try one out.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cowsay -f dragon "Run for cover, I feel a sneeze coming on."
|
||||||
|
_______________________________________
|
||||||
|
/ Run for cover, I feel a sneeze coming \
|
||||||
|
\ on. /
|
||||||
|
---------------------------------------
|
||||||
|
\ / \ //\
|
||||||
|
\ |\___/| / \// \\
|
||||||
|
/0 0 \__ / // | \ \
|
||||||
|
/ / \/_/ // | \ \
|
||||||
|
@_^_@'/ \/_ // | \ \
|
||||||
|
//_^_/ \/_ // | \ \
|
||||||
|
( //) | \/// | \ \
|
||||||
|
( / /) _|_ / ) // | \ _\
|
||||||
|
( // /) '/,_ _ _/ ( ; -. | _ _\.-~ .-~~~^-.
|
||||||
|
(( / / )) ,-{ _ `-.|.-~-. .~ `.
|
||||||
|
(( // / )) '/\ / ~-. _ .-~ .-~^-. \
|
||||||
|
(( /// )) `. { } / \ \
|
||||||
|
(( / )) .----~-.\ \-' .~ \ `. \^-.
|
||||||
|
///.----..> \ _ -~ `. ^-` ^-_
|
||||||
|
///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~
|
||||||
|
/.-~
|
||||||
|
```
|
||||||
|
|
||||||
|
My real beef with **cowsay** is that I don’t have enough time today to really milk the cow puns for all they are worth. The steaks are just too high, and I might butcher the joke.
|
||||||
|
|
||||||
|
On a more serious note, I had completely forgotten about **cowsay** until I re-encountered it when learning Ansible playbooks. If you happen to have **cowsay** installed, when you run a playbook, you’ll get your output from a series of cows. For example, running this playbook:
|
||||||
|
|
||||||
|
```
|
||||||
|
- hosts:
|
||||||
|
- localhost
|
||||||
|
tasks:
|
||||||
|
- action: ping
|
||||||
|
```
|
||||||
|
|
||||||
|
Might give you the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ansible-playbook playbook.yml
|
||||||
|
__________________
|
||||||
|
< PLAY [localhost] >
|
||||||
|
------------------
|
||||||
|
\ ^__^
|
||||||
|
\ (oo)\_______
|
||||||
|
(__)\ )\/\
|
||||||
|
||----w |
|
||||||
|
|| ||
|
||||||
|
|
||||||
|
________________________
|
||||||
|
< TASK [Gathering Facts] >
|
||||||
|
------------------------
|
||||||
|
\ ^__^
|
||||||
|
\ (oo)\_______
|
||||||
|
(__)\ )\/\
|
||||||
|
||----w |
|
||||||
|
|| ||
|
||||||
|
|
||||||
|
ok: [localhost]
|
||||||
|
_____________
|
||||||
|
< TASK [ping] >
|
||||||
|
-------------
|
||||||
|
\ ^__^
|
||||||
|
\ (oo)\_______
|
||||||
|
(__)\ )\/\
|
||||||
|
||----w |
|
||||||
|
|| ||
|
||||||
|
|
||||||
|
ok: [localhost]
|
||||||
|
____________
|
||||||
|
< PLAY RECAP >
|
||||||
|
------------
|
||||||
|
\ ^__^
|
||||||
|
\ (oo)\_______
|
||||||
|
(__)\ )\/\
|
||||||
|
||----w |
|
||||||
|
|| ||
|
||||||
|
|
||||||
|
localhost : ok=2 changed=0 unreachable=0 failed=0
|
||||||
|
```
|
||||||
|
|
||||||
|
**Cowsay** is available under a GPLv3 license, and you can find the Perl [source code][2] on GitHub. I’ve also seen versions floating around in other languages, so take a look around for other variants; here’s [one in R][3], for example. Implementing your own version in your language of choice might even be a fun programming learning task.
|
||||||
|
|
||||||
|
Now that **cowsay** is out of the way, we can move on to greener pastures.
|
||||||
|
|
||||||
|
Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end.
|
||||||
|
|
||||||
|
Check out yesterday's toy, [How to bring good fortune to your Linux terminal][1], and check back tomorrow for another!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/18/12/linux-toy-cowsay
|
||||||
|
|
||||||
|
作者:[Jason Baker][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/jason-baker
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/article/18/12/linux-toy-fortune
|
||||||
|
[2]: https://github.com/tnalpgge/rank-amateur-cowsay
|
||||||
|
[3]: https://github.com/sckott/cowsay
|
@ -0,0 +1,92 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (Easily Convert Audio File Formats with SoundConverter in Linux)
|
||||||
|
[#]: via: (https://itsfoss.com/sound-converter-linux/)
|
||||||
|
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Easily Convert Audio File Formats with SoundConverter in Linux
|
||||||
|
======
|
||||||
|
|
||||||
|
**If you are looking for converting audio file formats to wav, mp3, ogg or any other format, SoundConverter is the tool you need in Linux.**
|
||||||
|
|
||||||
|
![Audio Converter in Linux][1]
|
||||||
|
|
||||||
|
So recently I purchased some DRM-free music. I got it from [SaReGaMa][2], the oldest and the largest music labels in India. The downloaded files were in HD quality and in WAV format.
|
||||||
|
|
||||||
|
Unfortunately, Rhythmbox doesn’t play the WAV files. On top of that, a single file was around 70 MB in size. Imagine transferring such large music files to smartphones. It would eat up a lot of space unnecessarily.
|
||||||
|
|
||||||
|
So I thought it was time to convert the WAV files to MP3, the evergreen and the most popular music file format.
|
||||||
|
|
||||||
|
And for this task, I needed an audio converter in Linux. In this quick tutorial, I’ll show you how can you convert your audio files from one format to another easily with a GUI tool called SoundCoverter.
|
||||||
|
|
||||||
|
### Installing SoundConverter in Linux
|
||||||
|
|
||||||
|
[SoundConverter][3] is a popular free and open source software. It should be available in the official repository of most Linux distributions.
|
||||||
|
|
||||||
|
Ubuntu/Linux Mint users can simply search for SoundConverter in the software center and install it from there.
|
||||||
|
|
||||||
|
![SoundConverter application in Software Center of Ubuntu][4]SoundConverter can be installed from Software Center
|
||||||
|
|
||||||
|
Alternatively, you can use the command line way. In Debian and Ubuntu based systems, you can use the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt install soundconverter
|
||||||
|
```
|
||||||
|
|
||||||
|
For Arch, Fedora and other non-Debian based distributions, you can use the software center or the package manager of your distribution.
|
||||||
|
|
||||||
|
### Using SoundConverter to convert audio file formats in Linux
|
||||||
|
|
||||||
|
Once you have installed SoundConverter, search for it in the menu and start it.
|
||||||
|
|
||||||
|
The default interface looks like this and it cannot be more simple than this:
|
||||||
|
|
||||||
|
![SoundConverter application interface in Linux][5]Simple Interface
|
||||||
|
|
||||||
|
Converting audio file format is as easy as selecting the file and clicking on convert.
|
||||||
|
|
||||||
|
However, I would advise you to check the default settings at least on the first run. By default it converts the audio file to OGG file format and you may not want that.
|
||||||
|
|
||||||
|
![Preferences in SoundConverter][6]Default output settings can be changed in Preferences
|
||||||
|
|
||||||
|
To change the default output settings, click on the Preferences icon visible on the interface. You’ll see plenty of options to change here.
|
||||||
|
|
||||||
|
You can change the default output format, bitrate, quality etc. You can also choose if you want to keep the converted files in the same folder as the original or not.
|
||||||
|
|
||||||
|
There is also an option of automatically deleting the original file after conversion. I don’t think you should use that option.
|
||||||
|
|
||||||
|
You can also change the output file name. By default, it will just change the suffix but you can also choose to name it based on track number, title, artist etc. For that to happen, you should have proper metadata on the original file.
|
||||||
|
|
||||||
|
Speaking of metadata, have you heard of [MusicBrainz Picard][7]? This tool helps you automatically updates the metadata of your local music files.
|
||||||
|
|
||||||
|
### Conclusion
|
||||||
|
|
||||||
|
I have discussed [recording audio in Linux][8] previously with a similar tiny application. Such nifty tools actually make life easier with their focused aim of completing a certain task. You may use full-fledged and a lot better audio editing tool like [Audacity][9] but that may be complicated to use for smaller tasks like converting audio file formats.
|
||||||
|
|
||||||
|
I hope you like SoundConverter. If you use some other tool, do mention that in the comments and I may cover it here on It’s FOSS. Enjoy!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/sound-converter-linux/
|
||||||
|
|
||||||
|
作者:[Abhishek Prakash][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://itsfoss.com/author/abhishek/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/Convert-audio-file-format-linux.png?resize=800%2C450&ssl=1
|
||||||
|
[2]: https://en.wikipedia.org/wiki/Saregama
|
||||||
|
[3]: http://soundconverter.org/
|
||||||
|
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/sound-converter-software-center.png?ssl=1
|
||||||
|
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/sound-converter-app-linux.jpeg?ssl=1
|
||||||
|
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/sound-converter-app-linux-preferences.jpeg?resize=800%2C431&ssl=1
|
||||||
|
[7]: https://itsfoss.com/musicbrainz-picard/
|
||||||
|
[8]: https://itsfoss.com/record-streaming-audio/
|
||||||
|
[9]: https://www.audacityteam.org/
|
@ -0,0 +1,47 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (geekpi)
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (How a university network assistant used Linux in the 90s)
|
||||||
|
[#]: via: (https://opensource.com/article/18/5/my-linux-story-student)
|
||||||
|
[#]: author: ([Alan Formy-Duva](https://opensource.com/users/alanfdoss)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
大学网络助理如何在 90 年代使用 Linux
|
||||||
|
======
|
||||||
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/moneyrecycle_520x292.png?itok=SAaIziNr)
|
||||||
|
在 20 世纪 90 年代中期,我报名了计算机科学课。我大学的计算机科学系为学生提供了一台 SunOS 服务器,它是一个多用户、多任务的 Unix 系统。我们登录它并编写我们在学习的编程语言代码,例如 C、C++ 和 ADA。在那些日子里,在社交网络和 IM 出现之前,我们还使用该系统相互通信,发送电子邮件和使用诸如 `write` 和 `talk` 之类的程序。我们每个人被允许托管一个个人网站。我很高兴它能够完成我的作业并联系其他用户。
|
||||||
|
|
||||||
|
这是我第一次体验这种类型的操作环境,但我很快就了解了另一个可以做同样事情的操作系统:Linux。
|
||||||
|
|
||||||
|
当我还是一名学生的时候,我还在大学兼职工作。我的第一个职位是住房和住宅部 (H&R) 的网络安装人员。这包含将学生宿舍与校园网络连接起来。由于这是该大学的第一个宿舍网络服务,因此只有两幢楼和大约 75 名学生已经连接。
|
||||||
|
|
||||||
|
在我工作的第二年,该网络扩展到另外两幢楼。H&R 决定让该大学的信息技术办公室 (OIT) 管理这不断增长的业务。我进入 OIT 并开始担任 OIT 网络经理的学生助理。这就是我发现 Linux 的方式。我的新职责之一是管理防火墙系统,它为宿舍提供网络和互联网访问。
|
||||||
|
|
||||||
|
每个学生都注册了他们硬件的 MAC 地址。注册学生可以连接到宿舍网络并获得 IP 地址及访问互联网。与大学使用的其他昂贵的 SunOS 和 VMS 服务器不同,这些防火墙使用运行着免费和开源 Linux 操作系统的低成本计算机。截至年底,该系统已注册近 500 名学生。
|
||||||
|
|
||||||
|
![Red hat Linux install disks][1]
|
||||||
|
|
||||||
|
OIT 网络工作人员使用 Linux 运行 HTTP、FTP 和其他服务。他们还在个人桌面上使用 Linux。就在那时,我意识到我手上的计算机看起来和运行起来就像 CS 系昂贵的 SunOS 机器一样但没有高昂的成本。Linux 可以在商用 x86 硬件上运行,例如有 8 MB RAM 和 133Mhz Intel Pentium CPU 的 Dell Latitude。那对我来说是个卖点!我在从一个剩余的仓库中清理出来的机器上安装了 Red Hat Linux 5.2,并给了我的朋友登录帐户。
|
||||||
|
|
||||||
|
我使用我的新 Linux 服务器来托管我的网站并向我的朋友提供帐户,同时它还提供 CS 系服务器没有的图形功能。它使用了 X Windows 系统,我可以使用 Netscape Navigator 浏览网页,使用 [XMMS][2] 播放音乐,并尝试不同的窗口管理器。我也可以下载并编译其他开源软件并编写自己的代码。
|
||||||
|
|
||||||
|
我了解到 Linux 提供了一些非常先进的功能,其中许多功能比更主流的操作系统更方便或更优越。例如,许多操作系统尚未提供应用更新的简单方法。在 Linux 中,这很简单,感谢 [autoRPM][3],一个由 Kirk Bauer 编写的更新管理器,它向 root 用户每日发送邮件,其中包含可用的更新。它有一个直观的界面,用于审查和选择要安装的软件更新 - 这对于 90 年代中期来说非常了不起。
|
||||||
|
|
||||||
|
Linux may not have been well-known back then, and it was often received with skepticism, but I was convinced it would survive. And survive it did!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/18/5/my-linux-story-student
|
||||||
|
|
||||||
|
作者:[Alan Formy-Duval][a]
|
||||||
|
选题:[lujun9972](https://github.com/lujun9972)
|
||||||
|
译者:[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/alanfdoss
|
||||||
|
[1]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/images/life-uploads/red_hat_linux_install_disks.png?itok=VSw6Cke9 (Red hat Linux install disks)
|
||||||
|
[2]:http://www.xmms.org/
|
||||||
|
[3]:http://www.ccp14.ac.uk/solution/linux/autorpm_redhat7_3.html
|
@ -0,0 +1,50 @@
|
|||||||
|
Why schools of the future are open
|
||||||
|
======
|
||||||
|
|
||||||
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OSDC_BYU_520x292_FINAL.png?itok=NVY7vR8o)
|
||||||
|
|
||||||
|
最近有些人和我说现代教育会是什么样子,我回答说:就像过去一百年一样。我们为什么会对我们的教育系统保持悲观态度呢?
|
||||||
|
|
||||||
|
这不是一个悲观的观点,而是一个务实的观点。鉴于任何把时间花在学校的人都想离开舒适区,所以我们教导年轻人怎么去固执的抵制变革。美国学校新的学年开始,大多数学生返回学校把桌子排成一排。教学环境主要以教师为中心,进步由卡内基单位和A-F评分来衡量,合作通常被认为是作弊。
|
||||||
|
|
||||||
|
我们从哪能够找到证据指出这种工业化模式正在产生所预想的结果,每个孩子都得到个人关注,以培养对学习的热爱,并发展出当今创新经济中茁壮成长所需的技能,然后我们可以非常满足了。 但是,任何真实客观地看待当前的指标都表明要从基本开始改变。
|
||||||
|
|
||||||
|
|
||||||
|
但我的观点并非悲观。 事实上,非常乐观。
|
||||||
|
|
||||||
|
尽管我们可以很容易的阐述现代教育的问题所在,但我也知道一个例子,教育利益相关者愿意走出哪些舒适的环境,并挑战这个对变革免疫的系统。 教师要求与同龄人进行更多的合作,并采取更多方式公开透明的对原型创意进行展示,从而为学生带来真正的创新 - 而不是通过技术重新包装传统方法。 管理员通过以社区为中心,基于项目的学习,实现更深入,更紧密的学习实际的应用程序 - 不仅仅是在孤立的教室中“做项目”。 父母们想把学习的快乐回归到学校的文化,这些文化因强调考试而受到损害。
|
||||||
|
|
||||||
|
所有文化变革向来都不容易,特别是在面对任何考试成绩下降导致政治反对的环境中,人们不愿意承担风险(无论统计意义如何重要)。
|
||||||
|
那么为什么我乐观地认为我们正在接近一个临界点,我们所需要的变化确实可以克服长期挫败它们的惯性?
|
||||||
|
|
||||||
|
因为在我们的现代时代,社会中还有其他东西在以前没有出现过:开放的精神,由数字技术催化。
|
||||||
|
|
||||||
|
想一想:如果你需要为即将到来的法国旅行学习基本的法语,你该怎么办? 您可以在当地社区学院注册一门课程或者从图书馆借书,但很有可能,您会用免费在线视频并了解旅行所需的基本知识。 人类历史上从未有过免费的按需学习。 事实上,现在正在参加麻省理工学院关于“[应用数学的专题:线性代数和变异微积分][1]的免费在线课程。报名参加!
|
||||||
|
|
||||||
|
为什么麻省理工学院,斯坦福大学和哈佛大学等学校提供免费课程? 为什么人们和公司愿意公开分享曾经严格控制的知识产权? 为什么全球各地的人们都愿意花时间 - 无偿 - 帮助公民科学项目?
|
||||||
|
|
||||||
|
在我们的现代,还有其他东西在以前没有出现过:在数字技术的催化下,开放的精神。
|
||||||
|
|
||||||
|
作者David Price在他那本很棒的书[开放:我们将如何在未来工作和学习][2]中,清楚地描述了非正式的社交学习如何成为新的学习规范,尤其是习惯于能够及时获取他们需要的知识学习的年轻人。通过一系列案例研究,Price清楚地描绘了当传统制度不适应这种新现实并因此变得越来越不相关时会发生什么。 这是缺失的元素,它能让众包产生积极的颠覆性的影响。
|
||||||
|
|
||||||
|
Price指出(以及人们现在对基层的要求)正是一场开放的运动,人们认识到开放式合作和自由交换思想已经破坏了从音乐到软件再到出版的生态系统。 而且,除了任何自上而下推动的“改革”之外,这种对开放性的期望有可能从根本上改变长期以来一直抵制变革的教育体系。 事实上,开放精神的标志之一是,它期望知识的透明和公平民主化,造福所有人。 那么,对于这样一种精神而言,还有什么生态系统比试图让年轻人做好准备,继承这个世界、让这个世界变得更好呢?
|
||||||
|
|
||||||
|
当然,也有另一种悲观的声音说,我早期关于教育未来的预测可能确实是短期未来的教育状况。 但我也非常乐观地认为,这种说法将被证明是错误的。 我知道我和许多其他志趣相投的教育工作者每天都在努力证明这是错误的。 当我们开始帮助我们的学校[转变为组织机构][3] - 从过时的传统模式过渡到更开放,灵活,响应每个学生和他们服务的社区需要的时候,你会加入我吗
|
||||||
|
|
||||||
|
这是适合现代时代的真正教育模式
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/open-organization/18/9/modern-education-open-education
|
||||||
|
|
||||||
|
作者:[Ben Owens][a]
|
||||||
|
选题:[lujun9972](https://github.com/lujun9972)
|
||||||
|
译者:[译者ID](https://github.com/hkurj)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/engineerteacher
|
||||||
|
[1]: https://ocw.mit.edu/courses/mechanical-engineering/2-035-special-topics-in-mathematics-with-applications-linear-algebra-and-the-calculus-of-variations-spring-2007/
|
||||||
|
[2]: https://www.goodreads.com/book/show/18730272-open
|
||||||
|
[3]: https://opensource.com/open-organization/resources/open-org-definition
|
@ -0,0 +1,66 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (geekpi)
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (A Free Guide for Setting Your Open Source Strategy)
|
||||||
|
[#]: via: (https://www.linux.com/blog/2018/11/free-guide-setting-your-open-source-strategy)
|
||||||
|
[#]: author: ([Amber Ankerholz](https://www.linux.com/users/aankerholz)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
制定开源战略的免费指南
|
||||||
|
======
|
||||||
|
|
||||||
|
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/os-strategy.jpg?itok=hSmtdJdK)
|
||||||
|
|
||||||
|
大多数使用开源的公司都了解其商业价值,但他们可能缺乏战略性地实施开源计划和获得全部回报的工具。根据 [The New Stack][1] 最近的一项调查,“开源计划的三大好处是1)提高了对开源的认识,2)提高了开发周期的速度和灵活性,以及 3)更好的许可证合规性“。
|
||||||
|
|
||||||
|
运营开源计划办公点涉及创建策略来帮助你定义和实施你的方法,并衡量你的进度。由 Linux 基金会与 TODO 集团合作开发的[企业开源指南][2]基于多年的经验和实践提供了专业开源知识。
|
||||||
|
|
||||||
|
最新的指南中,[设置开源战略][3]详细介绍了制定战略和确保成功之路的基本步骤。根据该指南,“你的开源战略将管理、参与和创建开源软件的计划与计划所服务的业务目标联系起来。这可以开辟许多机会并促进创新。“该指南涵盖以下主题:
|
||||||
|
|
||||||
|
1. 为什么制定战略?
|
||||||
|
2. 你的战略文件
|
||||||
|
3. 战略方法
|
||||||
|
4. 关键考虑因素
|
||||||
|
5. 其他组成
|
||||||
|
6. 确定投资回报率
|
||||||
|
7. 投资目标
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
这里关键的第一步是创建和记录你的开源策略,该策略将“帮助你最大限度地提高组织从开源中获得的利益。”同时,你详细的策略可以帮助你避免因错误而导致的困难,例如:选择错误的许可证或不正确地维护代码。根据指南,该文件还可以:
|
||||||
|
|
||||||
|
* 让领导者感到兴奋并参与
|
||||||
|
* 帮助在公司内获得支持
|
||||||
|
* 促进分散的多部门组织的决策
|
||||||
|
* 帮助建立一个健康的社区
|
||||||
|
* 解释贵公司的开源方式和对其使用的支持
|
||||||
|
* 明确贵公司在社区驱动的外部研发中投资的地方,以及贵公司将重点放在增值差异化的地方
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Salesforce 的软件架构师兼指南的撰稿人 Ian Varley 说:“在 Salesforce 内,我们有内部文件,我们将这些围绕开源战略指导和鼓励的文件分发给我们的工程团队。其中鼓励创建和使用开源,这让他们毫不含糊地知道公司的战略领导者完全支持它。此外,如果有某些我们不希望工程师使用的许可证或有其他开源指南,我们的内部文档需要明确。“
|
||||||
|
|
||||||
|
开源计划有助于促进企业文化,使企业更高效,并且根据指南,强有力的战略文档可以“帮助你的团队了解开源计划背后的业务目标,确保更好的决策,并最大限度地降低风险“。
|
||||||
|
|
||||||
|
了解如何使用[设置开源策略][3]新指南中的提示和经过验证的实践,将管理和创建开源软件的目标与组织的业务目标保持一致。然后,查看所有 12 个[企业开源指南][2],了解有关使用开源获得成功的更多信息。
|
||||||
|
|
||||||
|
本文最初发表在 [Linux基金会][4]
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.linux.com/blog/2018/11/free-guide-setting-your-open-source-strategy
|
||||||
|
|
||||||
|
作者:[Amber Ankerholz][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://www.linux.com/users/aankerholz
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://thenewstack.io/open-source-culture-starts-with-programs-and-policies/
|
||||||
|
[2]: https://www.linuxfoundation.org/resources/open-source-guides/
|
||||||
|
[3]: https://www.linuxfoundation.org/resources/open-source-guides/setting-an-open-source-strategy/
|
||||||
|
[4]: https://www.linuxfoundation.org/blog/2018/11/a-free-guide-for-setting-your-open-source-strategy/
|
@ -1,470 +0,0 @@
|
|||||||
学习Linux/\*BSD/Unix操作系统的30个最佳在线文档
|
|
||||||
======
|
|
||||||
|
|
||||||
|
|
||||||
手册页是由系统管理员和IT技术开发人员写的,更多的是为了作为参考而不是教你如何使用。手册页对于已经熟悉使用Linux、Unix和BSD操作系统的人来说是非常有用的。如果你仅仅需要知道某个命令或者某个配置文件的格式那么你可以使用手册页,但是手册页对于linux新手来说并没有太大的帮助。想要通过使用手册页来学习一些新东西不是一个好的选择。这里有将提供30个学习Linux和Unix操作系统的最佳在线网页文档。
|
|
||||||
|
|
||||||
![Dennis Ritchie and Ken Thompson working with UNIX PDP11][1]
|
|
||||||
|
|
||||||
需要知道的是,相对于Linux,BSD的手册页更好。
|
|
||||||
|
|
||||||
## #1: Red Hat Enterprise Linux
|
|
||||||
|
|
||||||
![Red hat Enterprise Linux Docs][2]
|
|
||||||
|
|
||||||
RHEL是由红帽公司开发的商业市场导向的的Linux发行版。红帽的文档是最好的文档之一,涵盖RHEL的基础到一些高级主题比如安全、安全增强式Linux、虚拟化、目录服务器、服务器集群、JBOSS应用程序服务器、高可用性集群等。红帽的文档已经被翻译成22种语言,发布成多页面HTML、单页面HTML、PDF、EPUB等文件格式。比较好的一点是你可以对于Centos和Scientific Linux(社区企业发行版)使用相同的文档。这些文档随操作系统一起下载提供,也就是说当你没有网络的时候,你也可以使用他们。RHEL的文档**涵盖从安装到配置器群的所有内容**。唯一的缺点是你需要成为付费用户。当然这对于企业公司来说是一件完美的事。
|
|
||||||
|
|
||||||
1. RHEL 文档: [HTML/PDF格式][3]
|
|
||||||
2. 支持论坛: 只能通过红帽公司的用户网站提交支持案例。
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 关于CentOS Wiki和论坛的说明
|
|
||||||
|
|
||||||
![Centos Linux Wiki][4]
|
|
||||||
|
|
||||||
CentOS(社区企业操作系统)是由RHEL免费提供的源包免费重建的。它为个人电脑或其他用途提供了可靠的、免费的企业级Linux。你可以不用任何支持和认证费用获取RHEL的稳定版。CentOS的wiki分为如何使用、技巧还有更多的信息请访问下方链接:
|
|
||||||
|
|
||||||
1. [文档 wiki][87]
|
|
||||||
2. [论坛支持][88]
|
|
||||||
|
|
||||||
## #2: Arch的 Wiki 和 论坛
|
|
||||||
|
|
||||||
![Arch Linux wiki 和 教程][5]
|
|
||||||
|
|
||||||
Arch linux 是一个独立开发的 Linux 操作系统,它有基于wiki网站形式的非常不错的文档。它是由Arch社区的一些用户共同协作开发出来的,并且允许任何用户添加或修改内容。这些文档教程被分为几类比如说[网络][6]、优化、软件包管理、系统管理、X window 系统还有获取安装 Arch 。它的[官方论坛][7]在解决许多问题的时候也非常有用。他有总共4万多个注册用户、超过1百万次提交。 wiki 包含一些 **其他Linux发行版也适用的通用信息**。
|
|
||||||
|
|
||||||
1. Arch 社区文档: [Wiki][8]
|
|
||||||
2. 是否支持论坛: [是][7]
|
|
||||||
|
|
||||||
## #3: Gentoo Linux Wiki 和 论坛
|
|
||||||
|
|
||||||
![Gentoo Linux 手册 和 Wiki][9]
|
|
||||||
|
|
||||||
Gentoo Linux 基于portage包管理系统。Gentoo Linux 用户根据他们选择的配置在本地编译源代码。多数 Gentoo Linux 用户都会定制自己独有的程序集。 Gentoo Linux 的文档会给你一些有关Gento Linux操作系统的说明和一些有关安装、软件包、网络和其他等主要出现的问题的解决方法。Gentoo有对你来说 **非常有用的论坛**,论坛中有超过13万4千的用户,总共有5442416次文章提交。
|
|
||||||
|
|
||||||
1. Gentoo 社区文档: [手册][10] and [Wiki][11]
|
|
||||||
2. 是否支持论坛: [是][12]
|
|
||||||
3. 用户提供的文档可以在 [gentoo-wiki.com][13] 查看
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #4: Ubuntu Wiki 和 文档
|
|
||||||
|
|
||||||
Ubuntu 是领先的台式机和笔记本电脑发行版之一。官方文档由 Ubuntu 文档工程开发维护。你可以在从官方文档中查看大量的信息,比如如何开始使用Ubuntu的教程。这些信息中最好的一部分是和基于 Debian 的系统共同工作。你可能会找到由Ubuntu的用户们创建的社区文档,其中是有关Ubuntu的使用教程和技巧等。Ubuntu Linux 是有着网络上最大的Linux社区的操作系统。
|
|
||||||
|
|
||||||
![Ubuntu Linux Wiki 和 论坛][14]
|
|
||||||
|
|
||||||
1. Ubuntu 社区文档: [wiki][15].
|
|
||||||
2. Ubuntu 官方文档: [wiki][16].
|
|
||||||
3. 是否支持论坛: [是][17].
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #5: IBM开发者项目
|
|
||||||
|
|
||||||
IBM开发者项目为 Linux 程序员和系统管理员提供技术资源,其中包含数以百计的文章、教程和技巧来协助 Linux 程序员的编程工作和应用开发还有系统管理员的日常工作。
|
|
||||||
|
|
||||||
![IBM: Linux 程序员和系统管理员用到的技术][18]
|
|
||||||
|
|
||||||
1. IBM 开发者项目文档: [HTML格式][19]
|
|
||||||
2. 是否支持论坛: [是][20].
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #6: FreeBSD 文档和手册
|
|
||||||
|
|
||||||
FreeBSD 的手册是由 FreeBSD 文档工程所创建的,介绍 FreeBSD 操作系统的安装、管理和一些日常使用技巧等内容。FreeBSD 的手册页通常比GNU Linux 的手册页要好一点。FreeBSD **附带有全部最新手册页的文档**。 FreeBSD 手册涵盖任何你想要的内容。手册包含一些通用 Unix 资料,这些资料同样适用于其他的 Linux 发行版。FreeBSD 官方论坛会在你遇到棘手问题时给予帮助。
|
|
||||||
|
|
||||||
![Freebsd Documentation][21]
|
|
||||||
|
|
||||||
1. FreeBSD 文档: [HTML/PDF 格式][90]
|
|
||||||
2. 是否支持论坛: [是][91].
|
|
||||||
|
|
||||||
|
|
||||||
## #7: Bash 用户的 Wiki
|
|
||||||
|
|
||||||
![Bash 用户的 wiki][22]
|
|
||||||
|
|
||||||
这是一个对于 bash 使用者来说非常好的资源。Bash 使用者的 wiki 是为了归纳所有类型的 GNU Bash 文档。这个项目的动力是为了提供可阅读的文档和资料来避免用户被迫一点一点阅读 Bash 的手册,有时候这是非常麻烦的。Bash 用户 Wiki 分为各个类,比如说脚本和通用资料、如何使用、代码风格、bash 命令格式和其他。
|
|
||||||
|
|
||||||
1. Bash 用户教程 [wiki][23] (wiki 格式)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #8: Bash 常见问题
|
|
||||||
|
|
||||||
![Bash 常见问题: 一些有关 GNU/BASH 常见问题的解决方法][24]
|
|
||||||
|
|
||||||
这是一个为bash新手设计的一个wiki。在IRC网络的 #bash 频道里有比较常见的问题集合的解决方法,这些解决方法是由频道的常规成员提供。当你遇到问题的时候不要忘了在[BashPitfalls][25]模块检索查找答案。这些常见问题的解决方法可能会倾向于Bash,或者偏向于最低标准的Bourne Shell,这决定于是谁给出的答案。大多数情况会尽力提供方便的(Bourne)和高效的(Bash,在适当情况下)的两类答案。
|
|
||||||
|
|
||||||
1. Bash 常见问题 [wiki][26] 格式.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #9: 如何锻造技术 - Linux 教程
|
|
||||||
|
|
||||||
![如何锻造技术][27]
|
|
||||||
|
|
||||||
|
|
||||||
博客作者 Falko 在如何锻造技术文档上有一些非常不错的东西。这个网站提供 Linux 关于各种各样主题的教程,比如说其作为最佳服务器系列,网站将主题分为几类,比如说 web 服务器、linux 发行版、DNS 服务器、虚拟化、高可用性、电子邮件和反垃圾邮件、FTP 服务器、编程主题还有一些其他的内容。这个网站也支持德语。
|
|
||||||
|
|
||||||
|
|
||||||
1. 如何锻造技术 [html][28] 格式.
|
|
||||||
2. 是否支持论坛: 是
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #10: OpenBSD 常见问题和文档
|
|
||||||
|
|
||||||
![OpenBSD 文档][29]
|
|
||||||
|
|
||||||
OpenBSD 是另一个类Unix 计算机操作系统,它是基于伯克利软件包的。OpenBSD 是来由 NetBSD 项目分支而来。OpenBSD 因高质量的代码和文档而著名,对软件许可协议有着坚定的立场,并且强烈关注安全问题。OpenBSD 的文档分为多个主题类别,比如说安装、包管理、防火墙设置、用户管理、网络、磁盘和磁盘阵列管理等。
|
|
||||||
|
|
||||||
1. OpenBSD [html][30] 格式.
|
|
||||||
2. 是否支持论坛: 否, 但是可以通过 [邮件列表][31] 来咨询.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #11: Calomel -开源研究和参考文档
|
|
||||||
|
|
||||||
|
|
||||||
这个极好的网站是专门作为开源软件和那些特别专注于 OpenBSD 的软件的文档来使用的。这是最简洁的引导网站之一,专注于高质量的内容。网站内容分为多个类,比如说 DNS、OpenBSD、安全、web 服务器、Samba 文件服务器、各种工具等。
|
|
||||||
|
|
||||||
![开源研究和参考文档][32]
|
|
||||||
|
|
||||||
1. Calomel 官网 [html][33] 格式.
|
|
||||||
2. 是否支持论坛: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #12: Slackware 书籍项目
|
|
||||||
|
|
||||||
![Slackware Linux 手册和文档 ][34]
|
|
||||||
|
|
||||||
Slackware Linux 是我的第一个 Linux 发行版。Slackware 是基于 Linux 内核的最早的发行版之一,也是当前正在维护的最古老的 Linux 发行版。 这个发行版面向专注于稳定性的高级用户。 Slackware 也是很少有的的类Unix的 Linux 发行版之一。官方 slackware 手册是为了让用户快速开始了解 Slackware 操作系统的使用方法而设计的。 这不是说它将包含发行版的每一个方面,而是为了说明它的实用性和给使用者一些有关系统的基础工作使用方法。手册分为多个主题,比如说安装、网络和系统配置、系统管理、包管理等。
|
|
||||||
|
|
||||||
1. Slackware [Linux 手册 html][35], pdf, 和 其他 格式.
|
|
||||||
2. 是否支持论坛: 是
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #13: Linux 文档工程 (TLDP)
|
|
||||||
|
|
||||||
![Linux 学习网站和文档][36]
|
|
||||||
|
|
||||||
Linux 文档工程旨在给 Linux 操作系统提供自由开发、高质量文档。网站是由志愿者创建和维护的。网站分为具体主题的帮助、由浅入深的指南等。在此我想推荐一个非常好的[文档][37],这个文档既是一个教程也是一个 shell 脚本编程的参考文档,对于新用户来说[使用方法列表][38]也是一个不错的开始。
|
|
||||||
|
|
||||||
1. Linux [文档工程][39] 支持多种查阅格式.
|
|
||||||
2. 是否支持论坛: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #14: Linux Home Networking
|
|
||||||
|
|
||||||
![Linux Home Networking][40]
|
|
||||||
|
|
||||||
Linux Home Networking 是学习 linux 的另一个比较好的资源,这个网站包含了 Linux 软件认证考试的内容比如 RHCE,还有一些计算机培训课程。网站包含了许多主题,比如说网络、Samba 文件服务器、无线网络、web 服务器等。
|
|
||||||
|
|
||||||
1. Linux [home networking][41] 可通过 html 格式和 PDF(部分免费)格式查阅.
|
|
||||||
2. 是否支持论坛: 是
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #15: Linux Action Show
|
|
||||||
|
|
||||||
![Linux 播客][42]
|
|
||||||
|
|
||||||
Linux Action Show ("LAS") 是一个关于 Linux 的资源播放平台。这个网站是由 Bryan Lunduke, Allan Jude, 和 Chris Fisher 共同发布的。它包含了 FOSS 的最新消息。网站内容主要是评论一些应用程序和 Linux 发行版。有时候也会发布一些和开源项目著名人物的采访视频。
|
|
||||||
|
|
||||||
1. Linux [action show][43] 支持音频和视频格式.
|
|
||||||
2. 是否支持论坛: 是
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #16: Commandlinefu
|
|
||||||
|
|
||||||
Commandlinefu 列出了各个 shell 命令,这些命令可能会让你感到十分有趣和有用。对于所有命令都可以评论、讨论和投票(支持或反对)。对于所有 Unix 命令行用户来说是一个极好的资源。不要忘了查看[最佳命令][44]
|
|
||||||
|
|
||||||
![Commandlinefu 的最优 Unix / Linux 命令][45]
|
|
||||||
|
|
||||||
1. [Commandlinefu][46] 支持 html 格式.
|
|
||||||
2. 是否支持论坛: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #17: Debian 管理技巧和资源
|
|
||||||
|
|
||||||
这个网站包含一些只和 Debian GNU/Linux 相关的主题、技巧和教程,特别是关于系统管理的有趣和有用的信息。你可以在上面贡献文章、建议和问题。提交了之后不要忘记查看[最佳文章列表][47]里有没有你的文章。
|
|
||||||
|
|
||||||
![Debian Linux 管理: 系统管理员技巧和教程][48]
|
|
||||||
|
|
||||||
1. Debian [系统管理][49] 支持 html 格式.
|
|
||||||
2. 是否支持论坛s: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #18: Catonmat - Sed 流编辑器, Awk 文本处理工具, Perl 语言教程
|
|
||||||
|
|
||||||
![Sed 流编辑器, Awk 文本处理工具, Perl 语言教程][50]
|
|
||||||
|
|
||||||
这个网站是由博客作者 Peteris Krumins 维护的。主要关注命令行和 Unix 编程主题,比如说 sed 流编辑器、perl 语言、AWK 文本处理工具等。不要忘了查看 [sed 介绍][51]、sed [one liner][52] 的含义解释,还有命令行历史的[权威指南][53]和 [awk][54]的解释。
|
|
||||||
|
|
||||||
1. [catonmat][55] 支持html格式.
|
|
||||||
2. 是否支持论坛: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #19: Debian GNU/Linux 文档和 Wiki
|
|
||||||
|
|
||||||
![Debian Linux 教程和 Wiki][56]
|
|
||||||
|
|
||||||
Debian 是另外一个基于 Linux 的操作系统,主要使用 GNU 发布的软件。Debian 因严格坚持 Unix 和自由软件的理念而著名,它也是很受欢迎并且有一定影响力的 Linux 发行版本之一。 Ubuntu 等发行版本都是基于 Debian 的。Debian 项目提供给用户一种易于访问的形式的特有文档。这个网站分为 Wiki、安装指导、常见问题、支持论坛几个模块。
|
|
||||||
|
|
||||||
1. Debian GNU/Linux [文档][57] 支持 html 和其他格式访问.
|
|
||||||
2. Debian GNU/Linux [wiki][58]
|
|
||||||
3. 是否支持论坛: [是][59]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #20: Linux Sea
|
|
||||||
|
|
||||||
Linux Sea 这本书提供了比较通俗易懂但充满技术(从最终用户角度来看)的 Linux 操作系统的介绍,使用 Gentoo Linux 作为例子。它既没有谈论Linux内核或Linux发行版的历史,也没有谈到 Linux 用户不那么感兴趣的细节。
|
|
||||||
|
|
||||||
1. Linux [sea][60] 支持 html 格式访问.
|
|
||||||
2. 是否支持论坛: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #21: Oreilly Commons
|
|
||||||
|
|
||||||
![免费 Linux / Unix / Php / Javascript / Ubuntu 学习笔记][61]
|
|
||||||
|
|
||||||
Oreilly 出版社发布了不少 wiki 格式的文章。这个网站主要是为了给那些喜欢创作、参考、使用、修改、更新和修订 OReilly上面或者其他来源的材料的社区提供资料。这个网站包含关于 Ubuntu、PHP、Spamassassin、Linux 等的免费书籍。
|
|
||||||
|
|
||||||
1. Oreilly [commons][62] 支持 Wiki 格式.
|
|
||||||
2. 是否支持论坛: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #22: Ubuntu 袖珍指南
|
|
||||||
|
|
||||||
![Ubuntu 新手书籍][63]
|
|
||||||
|
|
||||||
这本书的作者是 Keir Thomas。这本指南或者说是书籍对于所有 ubuntu 用户来说都值得一读。这本书旨在向用户介绍 Ubuntu 操作系统和支撑的理念。你可以从官网下载这本书的 PDF 版本,也可以在亚马逊买印刷版。
|
|
||||||
|
|
||||||
1. Ubuntu [pocket guide][64] 支持 PDF 和印刷版本.
|
|
||||||
2. 是否支持论坛: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #23: Linux: Rute User's Tutorial and Exposition
|
|
||||||
|
|
||||||
![GNU/LINUX system administration book][65]
|
|
||||||
|
|
||||||
|
|
||||||
这本书讲述了 GNU/LINUX 系统管理,主要是对主流的发布版本比如红帽和 Debian 的说明,作为新用户的教程和高级管理员的参考。这本书旨在给出 Unix 系统的每个面的简明彻底的解释和实践性的例子。想要全面了解LINUX的人都不需要再看了 - 这里没有涉及的内容。
|
|
||||||
|
|
||||||
1. Linux: [Rute User's Tutorial and Exposition][66] 支持印刷版和 html 格式.
|
|
||||||
2. 是否支持论坛: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #24: 高级 Linux 编程
|
|
||||||
|
|
||||||
![高级 Linux 编程][67]
|
|
||||||
|
|
||||||
这本书是写给那些已经熟悉了C语言编程的程序员的。这本书采取一种教程式的方式来讲述大多数在 GNU/Linux 系统应用编程中重要的概念和功能特性。如果你是一个已经对 GNU/Linux 系统编程有一定经验的开发者,或者是对其他类Unix系统编程有一定经验的开发者,或者对 GNU/Linux 软件开发有兴趣,或者想要从非Unix系统环境转换到 Unix 平台并且已经熟悉了优秀软件的开发原则,那你很适合读这本书。另外,你会发现这本书同样适合于 C 和 C++编程。
|
|
||||||
|
|
||||||
1. [高级 Linux 编程][68] 支持印刷版和 PDF 格式.
|
|
||||||
2. 是否支持论坛: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #25: LPI 101 Course Notes
|
|
||||||
|
|
||||||
![Linux 国际专业协会认证书籍][69]
|
|
||||||
|
|
||||||
LPIC 1、2、3级是用于 Linux 系统管理员认证的。这个网站提供了 LPI 101 和 LPI 102 的测试训练。这些是根据 GNU自有文档协议 发布的。这些课程材料基于Linux 国际专业协会的 LPI 101 和 102 考试的目的。这个课程是为了提供给你一些必备的 Linux 系统的操作和管理的技能。
|
|
||||||
|
|
||||||
|
|
||||||
1. 下载 LPI [训练手册][70] 支持 PDF 格式.
|
|
||||||
2. 是否支持论坛: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #26: FOSS 手册
|
|
||||||
|
|
||||||
FLOSS手册是一系列关于免费和开源软件以及用于创建它们的工具和使用这些工具的社区的手册。社区的成员包含作者、编辑、设计师、软件开发者、积极分子等。这些手册中说明了怎样安装使用一些免费开源软件,如何操作(比如设计和维持在线安全)开源软件,这其中也包含如何使用或支持免费软件和格式的免费文化服务的手册。你也会发现关于一些像 VLC, [Linux video editing][71], Linux, OLPC / SUGAR, GRAPHICS 等软件的手册。
|
|
||||||
|
|
||||||
![FLOSS Manuals is a collection of manuals about free and open source software][72]
|
|
||||||
|
|
||||||
1. 你可以浏览 [FOSS 手册][73] 支持 Wiki 格式.
|
|
||||||
2. 是否支持论坛: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #27: Linux 入门包
|
|
||||||
|
|
||||||
![Linux 入门包][74]
|
|
||||||
|
|
||||||
刚接触 Linux 这个美好世界?想找一个简单的入门方式?你可以下载一个130页的指南来掌握系统。这个指南会向你展示如何在你的个人电脑上安装 Linux,如何浏览桌面,掌握最主流行的 Linux 程序和修复可能出现的问题的方法。
|
|
||||||
|
|
||||||
1. 下载 [Linux 入门包][75] 支持 PDF 格式.
|
|
||||||
2. 是否支持论坛: f否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #28: Linux.com - Linux 信息来源
|
|
||||||
|
|
||||||
Linux.com 是Linux基金会的一个产品。这个网站上提供一些新闻、指南、教程和一些关于Linux的其他信息。利用全球 Linux 用户的力量来通知、写作、连接 Linux 的事务。
|
|
||||||
|
|
||||||
1. 在线访问 [Linux.com][76] .
|
|
||||||
2. 是否支持论坛: 是
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #29: LWN
|
|
||||||
|
|
||||||
LWN 是一个注重Linux和其他类Unix操作系统免费软件的网站。这个网站有周刊、每日小故事碎片和对小故事线索的讨论。该网站提供有关Linux和FOSS相关的开发,法律,商业和安全问题的全面报道。
|
|
||||||
|
|
||||||
1. 在线访问 [lwn.net][77].
|
|
||||||
2. 是否支持论坛: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #30: Mac OS X 相关网站
|
|
||||||
|
|
||||||
与Mac OS X相关网站的快速链接:
|
|
||||||
|
|
||||||
* [Mac OS X 提示][78] - 这个网站专用于苹果的 Mac OS X Unix 操作系统。网站有很多有关 Bash 和 Mac OS X 的使用建议、技巧和教程
|
|
||||||
|
|
||||||
* [Mac OS 开发库][79] - 苹果拥有和 OS X 开发相关的优秀系列。不要忘了看一看 [bash shell 脚本入门][80].
|
|
||||||
|
|
||||||
* [Apple 知识库][81] - 这个有点像红帽网络公司的知识库。这个网站提供了所有苹果产品包括 OS X 相关的指南和故障报修建议。
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## #30: NetBSD
|
|
||||||
|
|
||||||
NetBSD 是另一个基于伯克利软件包 Unix 操作系统的免费开源操作系统。NetBSD 项目专注于系统的高质量设计、稳定性和性能。由于 NetBSD 的可移植性和伯克利类的协议,NetBSD 常用于嵌入式系统。这个网站提供了一些 NetBSD 官方文档和各种第三方文档 的链接。
|
|
||||||
|
|
||||||
1. 在线访问 [netbsd][82] 文档,支持 html、PDF 格式.
|
|
||||||
2. 是否支持论坛: 否
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 你要做的事:
|
|
||||||
|
|
||||||
这是我的个人列表,这可能并不完全是权威的,因此如果你有你自己喜欢的独特 Unix/Linux 网站,可以在下方参与评论分享。
|
|
||||||
|
|
||||||
// 图片来源: [Flickr photo][83] by PanelSwitchman. 一些连接是用户在我们的Facebook粉丝页面上建议添加的。
|
|
||||||
|
|
||||||
// 对于那些庆祝的人,圣诞快乐! 对于其他人来说,享受周末。
|
|
||||||
|
|
||||||
## 关于作者
|
|
||||||
|
|
||||||
|
|
||||||
作者是nixCraft的创建者和经验丰富的系统管理员以及Linux操作系统/ Unix shell脚本的培训师。他曾与全球客户及各行各业合作,包括IT,教育,国防和空间研究以及一些非营利部门。可以关注作者的[Twitter][84], [Facebook][85], [Google+][86]。
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
来源: https://www.cyberciti.biz/tips/linux-unix-bsd-documentations.html
|
|
||||||
|
|
||||||
作者:[Vivek Gite][a]
|
|
||||||
译者:[ScarboroughCoral](https://github.com/ScarboroughCoral)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]:https://www.cyberciti.biz
|
|
||||||
[1]:https://www.cyberciti.biz/media/new/tips/2011/12/unix-pdp11.jpg "Dennis Ritchie and Ken Thompson working with UNIX PDP11"
|
|
||||||
[2]:https://www.cyberciti.biz/media/new/tips/2011/12/redhat-enterprise-linux-docs-150x150.png "Red hat Enterprise Linux Docs"
|
|
||||||
[3]:https://access.redhat.com/documentation/en-us/
|
|
||||||
[4]:https://www.cyberciti.biz/media/new/tips/2011/12/centos-linux-wiki-150x150.png "Centos Linux Wiki, Support, Documents"
|
|
||||||
[5]:https://www.cyberciti.biz/media/new/tips/2011/12/arch-linux-wiki-150x150.png "Arch Linux wiki and tutorials "
|
|
||||||
[6]:https://wiki.archlinux.org/index.php/Category:Networking_%28English%29
|
|
||||||
[7]:https://bbs.archlinux.org/
|
|
||||||
[8]:https://wiki.archlinux.org/
|
|
||||||
[9]:https://www.cyberciti.biz/media/new/tips/2011/12/gentoo-linux-wiki1-150x150.png "Gentoo Linux Handbook and Wiki"
|
|
||||||
[10]:http://www.gentoo.org/doc/en/handbook/
|
|
||||||
[11]:https://wiki.gentoo.org
|
|
||||||
[12]:https://forums.gentoo.org/
|
|
||||||
[13]:http://gentoo-wiki.com
|
|
||||||
[14]:https://www.cyberciti.biz/media/new/tips/2011/12/ubuntu-linux-wiki.png "Ubuntu Linux Wiki and Forums"
|
|
||||||
[15]:https://help.ubuntu.com/community
|
|
||||||
[16]:https://help.ubuntu.com/
|
|
||||||
[17]:https://ubuntuforums.org/
|
|
||||||
[18]:https://www.cyberciti.biz/media/new/tips/2011/12/ibm-devel.png "IBM: Technical for Linux programmers and system administrators"
|
|
||||||
[19]:https://www.ibm.com/developerworks/learn/linux/index.html
|
|
||||||
[20]:https://www.ibm.com/developerworks/community/forums/html/public?lang=en
|
|
||||||
[21]:https://www.cyberciti.biz/media/new/tips/2011/12/freebsd-docs.png "Freebsd Documentation"
|
|
||||||
[22]:https://www.cyberciti.biz/media/new/tips/2011/12/bash-hackers-wiki-150x150.png "Bash hackers wiki for bash users"
|
|
||||||
[23]:http://wiki.bash-hackers.org/doku.php
|
|
||||||
[24]:https://www.cyberciti.biz/media/new/tips/2011/12/bash-faq-150x150.png "Bash FAQ: Answers to frequently asked questions about GNU/BASH"
|
|
||||||
[25]:http://mywiki.wooledge.org/BashPitfalls
|
|
||||||
[26]:https://mywiki.wooledge.org/BashFAQ
|
|
||||||
[27]:https://www.cyberciti.biz/media/new/tips/2011/12/howtoforge-150x150.png "Howtoforge tutorials"
|
|
||||||
[28]:https://howtoforge.com/
|
|
||||||
[29]:https://www.cyberciti.biz/media/new/tips/2011/12/openbsd-faq-150x150.png "OpenBSD Documenation"
|
|
||||||
[30]:https://www.openbsd.org/faq/index.html
|
|
||||||
[31]:https://www.openbsd.org/mail.html
|
|
||||||
[32]:https://www.cyberciti.biz/media/new/tips/2011/12/calomel_org.png "Open Source Research and Reference Documentation"
|
|
||||||
[33]:https://calomel.org
|
|
||||||
[34]:https://www.cyberciti.biz/media/new/tips/2011/12/slackware-linux-book-150x150.png "Slackware Linux Book and Documentation "
|
|
||||||
[35]:http://www.slackbook.org/
|
|
||||||
[36]:https://www.cyberciti.biz/media/new/tips/2011/12/tldp-150x150.png "Linux Learning Site and Documentation "
|
|
||||||
[37]:http://tldp.org/LDP/abs/html/index.html
|
|
||||||
[38]:http://tldp.org/HOWTO/HOWTO-INDEX/howtos.html
|
|
||||||
[39]:http://tldp.org/
|
|
||||||
[40]:https://www.cyberciti.biz/media/new/tips/2011/12/linuxhomenetworking-150x150.png "Linux Home Networking "
|
|
||||||
[41]:http://www.linuxhomenetworking.com/
|
|
||||||
[42]:https://www.cyberciti.biz/media/new/tips/2011/12/linux-action-show-150x150.png "Linux Podcast "
|
|
||||||
[43]:http://www.jupiterbroadcasting.com/show/linuxactionshow/
|
|
||||||
[44]:https://www.commandlinefu.com/commands/browse/sort-by-votes
|
|
||||||
[45]:https://www.cyberciti.biz/media/new/tips/2011/12/commandlinefu.png "The best Unix / Linux Commands "
|
|
||||||
[46]:https://commandlinefu.com/
|
|
||||||
[47]:https://www.debian-administration.org/hof
|
|
||||||
[48]:https://www.cyberciti.biz/media/new/tips/2011/12/debian-admin.png "Debian Linux Adminstration: Tips and Tutorial For Sys Admin"
|
|
||||||
[49]:https://www.debian-administration.org/
|
|
||||||
[50]:https://www.cyberciti.biz/media/new/tips/2011/12/catonmat-150x150.png "Sed, Awk, Perl Tutorials"
|
|
||||||
[51]:http://www.catonmat.net/blog/worlds-best-introduction-to-sed/
|
|
||||||
[52]:https://www.catonmat.net/blog/sed-one-liners-explained-part-one/
|
|
||||||
[53]:https://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/
|
|
||||||
[54]:https://www.catonmat.net/blog/awk-one-liners-explained-part-one/
|
|
||||||
[55]:https://catonmat.net/
|
|
||||||
[56]:https://www.cyberciti.biz/media/new/tips/2011/12/debian-wiki-150x150.png "Debian Linux Tutorials and Wiki"
|
|
||||||
[57]:https://www.debian.org/doc/
|
|
||||||
[58]:https://wiki.debian.org/
|
|
||||||
[59]:https://www.debian.org/support
|
|
||||||
[60]:http://swift.siphos.be/linux_sea/
|
|
||||||
[61]:https://www.cyberciti.biz/media/new/tips/2011/12/orelly-150x150.png "Oreilly Free Linux / Unix / Php / Javascript / Ubuntu Books"
|
|
||||||
[62]:http://commons.oreilly.com/wiki/index.php/O%27Reilly_Commons
|
|
||||||
[63]:https://www.cyberciti.biz/media/new/tips/2011/12/ubuntu-guide-150x150.png "Ubuntu Book For New Users"
|
|
||||||
[64]:http://ubuntupocketguide.com/
|
|
||||||
[65]:https://www.cyberciti.biz/media/new/tips/2011/12/rute-150x150.png "GNU/LINUX system administration free book"
|
|
||||||
[66]:https://web.archive.org/web/20160204213406/http://rute.2038bug.com/rute.html.gz
|
|
||||||
[67]:https://www.cyberciti.biz/media/new/tips/2011/12/advanced-linux-programming-150x150.png "Download Advanced Linux Programming PDF version"
|
|
||||||
[68]:https://github.com/MentorEmbedded/advancedlinuxprogramming
|
|
||||||
[69]:https://www.cyberciti.biz/media/new/tips/2011/12/lpic-150x150.png "Download Linux Professional Institute Certification PDF Book"
|
|
||||||
[70]:http://academy.delmar.edu/Courses/ITSC1358/eBooks/LPI-101.LinuxTrainingCourseNotes.pdf
|
|
||||||
[71]://www.cyberciti.biz/faq/top5-linux-video-editing-system-software/
|
|
||||||
[72]:https://www.cyberciti.biz/media/new/tips/2011/12/floss-manuals.png "Download manuals about free and open source software"
|
|
||||||
[73]:https://flossmanuals.net/
|
|
||||||
[74]:https://www.cyberciti.biz/media/new/tips/2011/12/linux-starter-150x150.png "New to Linux? Start Linux starter book [ PDF version ]"
|
|
||||||
[75]:http://www.tuxradar.com/linuxstarterpack
|
|
||||||
[76]:https://linux.com
|
|
||||||
[77]:https://lwn.net/
|
|
||||||
[78]:http://hints.macworld.com/
|
|
||||||
[79]:https://developer.apple.com/library/mac/navigation/
|
|
||||||
[80]:https://developer.apple.com/library/mac/#documentation/OpenSource/Conceptual/ShellScripting/Introduction/Introduction.html
|
|
||||||
[81]:https://support.apple.com/kb/index?page=search&locale=en_US&q=
|
|
||||||
[82]:https://www.netbsd.org/docs/
|
|
||||||
[83]:https://www.flickr.com/photos/9479603@N02/3311745151/in/set-72157614479572582/
|
|
||||||
[84]:https://twitter.com/nixcraft
|
|
||||||
[85]:https://facebook.com/nixcraft
|
|
||||||
[86]:https://plus.google.com/+CybercitiBiz
|
|
||||||
[87]:https://wiki.centos.org/
|
|
||||||
[88]:https://www.centos.org/forums/
|
|
||||||
[90]: https://www.freebsd.org/docs.html
|
|
||||||
[91]: https://forums.freebsd.org/
|
|
@ -1,111 +0,0 @@
|
|||||||
持续基础设施: 另一个 CI
|
|
||||||
======
|
|
||||||
|
|
||||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BIZ_darwincloud_520x292_0311LL.png?itok=74DLgd8Q)
|
|
||||||
|
|
||||||
持续交付(CD)和持续集成(CI)是 DevOps 的两个众所周知的方面。但在 CI 大肆流行的今天却忽略了另一个关键性的 "I":基础设施(infrastructure)。
|
|
||||||
|
|
||||||
曾经有一段时间 “基础设施”就意味着无头的黑盒子,庞大的服务器,和高耸的机架——更不用说漫长的采购流程和对盈余负载的错误估计。后来到了虚拟机时代,把基础设施处理得很好,虚拟化——以前的世界从未有过这样。我们不再需要管理实体的服务器。仅仅是简单的点击,我们就可以创建和销毁,开始和停止,升级和降级我们的服务器。
|
|
||||||
|
|
||||||
有一个关于银行的流行的故事,它们实现了数字化,并且引入了在线表格,用户需要手动填写表格,打印,然后邮寄回银行。这就是我们今天要说的基础设施:使用新技术来做和以前一样的事情。
|
|
||||||
|
|
||||||
在这篇文章中,我们会看到在基础设施管理方面的进步,将基础设施视为一个版本化的组件并试着探索服务器一致性的概念。在后面的文章中,我们将了解如何使用开源工具来实现持续的基础设施。
|
|
||||||
|
|
||||||
![continuous infrastructure pipeline][2]
|
|
||||||
|
|
||||||
实践中的持续集成管道
|
|
||||||
|
|
||||||
这是我们熟悉的 CI,尽早发布,经常发布的循环管道。这个管道缺少一个关键的组件:基础设施。
|
|
||||||
|
|
||||||
突击小测试:
|
|
||||||
|
|
||||||
* 你怎样创建和升级你的基础设施?
|
|
||||||
* 你怎样控制和追溯基础设施的改变?
|
|
||||||
* 你的基础设施是如何与你的业务进行匹配的?
|
|
||||||
* 你是如何确保在正确的基础设施配置上进行测试的?
|
|
||||||
|
|
||||||
要回答这些问题,就要了解持续基础设施。把 CI 构建流程分为代码持续集成(CIc)和基础设施持续集成(CIi)来并行开发代码和基础设施,再将两者融合到一起进行测试 。把基础设施构建视为CI流程中的重要的一环。
|
|
||||||
|
|
||||||
![pipeline with infrastructure][4]
|
|
||||||
|
|
||||||
包含持续基础设施的 CI 管道流程
|
|
||||||
|
|
||||||
关于 CIi 定义的几个方面:
|
|
||||||
|
|
||||||
**1\. 代码**
|
|
||||||
|
|
||||||
通过代码来创建基础设施架构,而不是通过安装。使用配置脚代码是现代最流行的创建基础设施(IaC)的方法。这些脚本遵循典型的编码和单元测试周期(请参阅下面关于 Terraform 脚本的示例)。
|
|
||||||
|
|
||||||
**2\. 版本**
|
|
||||||
|
|
||||||
IaC 组件在源码仓库中进行版本管理。这让基础设施的拥有了版本控制的所有好处:一致性,可追溯性,分支和标记。
|
|
||||||
|
|
||||||
**3\. 管理**
|
|
||||||
|
|
||||||
通过编码和版本化的基础设施管理,你可以使用你所熟悉的测试和发布流程来管理基础设施的开发。
|
|
||||||
|
|
||||||
CIi 提供了下面的这些优势:
|
|
||||||
|
|
||||||
**1\. 一致性**
|
|
||||||
|
|
||||||
版本化和标记基础设施意味着你可以清楚的知道你的系统使用了哪些组件和配置。这是建立了一个非常好的 DevOps 实践,用来鉴定和管理基础设施的一致性。
|
|
||||||
|
|
||||||
**2\. 可重现性**
|
|
||||||
|
|
||||||
通过基础设施的标记和基线,重建基础设施变得非常容易。想想你是否经常听到这个:“但是它在我的机器上可以运行!”现在,你可以在本地的测试平台中快速重现类似生产环境,从而将环境像变量一样在你的调试过程中删除。
|
|
||||||
|
|
||||||
**3\. 可追溯性性**
|
|
||||||
|
|
||||||
你是否还记得曾经有过多少次寻找到底是谁更改了文件夹权限的经历,或者是谁升级了 `ssh` 包?编码,版本化,发布的基础设施消除了临时的变更,为基础设施的管理带来了可追踪性和可预测性。
|
|
||||||
|
|
||||||
**4\. 自动化**
|
|
||||||
|
|
||||||
借助脚本化的基础架构,自动化是下一个合乎逻辑的步骤。自动化允许你按需创建基础设施,并在使用完成后删除它,所以你可以将更多宝贵的时间和精力用在更重要的任务上。
|
|
||||||
|
|
||||||
**5\. 不变性**
|
|
||||||
|
|
||||||
CIi 不可变基础设施等创新。你可以创建一个新的基础设施组件而不是通过升级(请参阅下面有关不可变设施的说明)。
|
|
||||||
|
|
||||||
持续基础设施是从运行基础环境到运行基础组件的进化。像处理代码一样,通过认证的 DevOps 流程来完成。对传统的 CI 的重新定义包含了缺少的那个 “i”,从而形成了连贯的 CD 。
|
|
||||||
|
|
||||||
**(CIc + CIi) = CI -> CD**
|
|
||||||
|
|
||||||
## 基础设施代码 (IaC)
|
|
||||||
|
|
||||||
CIi 管道的一个关键推动因素是基础设施代码(IaC)。IaC 是一种使用配置文件进行基础设施创建和升级的机制。这些配置文件像其他的代码一样进行开发,并且使用版本管理系统进行管理。这些文件遵循一般的代码开发流程:单元测试,提交,构建,和发布。IaC 流程拥有版本控制带给基础设施开发的所有好处,像标记,版本一致性,和修改可追溯。
|
|
||||||
|
|
||||||
这有一个简单的 Terraform 脚本用来用来在 AWS 上创建一个双层基础设施的简单示例,包括虚拟私有云(VPC),弹性负载(ELB),安全组和一个 NGINX 服务器。Terraform 是一个通过通过脚本创建和更改基础设施架构和开源工具。
|
|
||||||
|
|
||||||
![terraform script][7]
|
|
||||||
|
|
||||||
Terraform 脚本创建双层架构设施的简单示例
|
|
||||||
|
|
||||||
完整的脚本请参见 [GitHub][8]。
|
|
||||||
|
|
||||||
## 基础设施架构的不变性
|
|
||||||
|
|
||||||
你有几个正在运行的 VM 需要更新安全补丁。一个常见的做法是推送一个远程脚本单独更新每个系统。
|
|
||||||
|
|
||||||
如何更新一个旧系统,如何丢弃它们并布置安装了新安全补丁的新系统?这就是基础设施的不变性。通过之前对基础设施的版本控制和标记,所以安装补丁只需要更新下脚本并将其推送到发布管道即可。
|
|
||||||
|
|
||||||
现在你知道为什么要说基础设施在 CI 管道中特别重要了吗?
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://opensource.com/article/17/11/continuous-infrastructure-other-ci
|
|
||||||
|
|
||||||
作者:[About The Author;Girish Managoli;With About Years;Experience In The Software It Industry;Girish Presently Holds Chief Architect Capacity At Mindtree;A Global It Services Organization;Based In India. Specialising In Paas;Saas Platforms;Girish Is Architect Of;I Got][a]
|
|
||||||
译者:[lujun9972](https://github.com/lujun9972)
|
|
||||||
校对:[Jamskr](https://github.com/Jamskr)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]:https://opensource.com
|
|
||||||
[1]:/file/376916
|
|
||||||
[2]:https://opensource.com/sites/default/files/images/life-uploads/figure1.jpg (continuous infrastructure pipeline in use)
|
|
||||||
[3]:/file/376921
|
|
||||||
[4]:https://opensource.com/sites/default/files/images/life-uploads/figure2.jpg (CI pipeline with infrastructure)
|
|
||||||
[5]:https://github.com/hashicorp/terraform
|
|
||||||
[6]:/file/376926
|
|
||||||
[7]:https://opensource.com/sites/default/files/images/life-uploads/figure3_0.png (sample terraform script)
|
|
||||||
[8]:https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples/two-tier
|
|
131
translated/tech/20180302 Emacs -3- More on org-mode.md
Normal file
131
translated/tech/20180302 Emacs -3- More on org-mode.md
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: (oneforalone)
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: subject: (Emacs #3: More on org-mode)
|
||||||
|
[#]: via: (https://changelog.complete.org/archives/9877-emacs-3-more-on-org-mode)
|
||||||
|
[#]: author: (John Goerzen http://changelog.complete.org/archives/author/jgoerzen)
|
||||||
|
[#]: url: ( )
|
||||||
|
|
||||||
|
Emacs 系列(三): `Org` 模式的补充
|
||||||
|
======
|
||||||
|
|
||||||
|
这是 [Emacs 和 `Org` 模式系列][1]的第三篇。
|
||||||
|
|
||||||
|
**Todo 的跟进及关键字**
|
||||||
|
|
||||||
|
当你使用 `Org` 模式来跟进的的 TODO 时,它有多种状态。你可以用 `C-c C-t` 来快速切换状态。我将它设为这样:
|
||||||
|
|
||||||
|
```
|
||||||
|
(setq org-todo-keywords '(
|
||||||
|
(sequence "TODO(t!)" "NEXT(n!)" "STARTED(a!)" "WAIT(w@/!)" "OTHERS(o!)" "|" "DONE(d)" "CANCELLED(c)")
|
||||||
|
))
|
||||||
|
```
|
||||||
|
|
||||||
|
在这里,我设置了一个任务未完成的五种状态:`TODO`、`NEXT`、`STARTED`、`WAIT` 及 `OTHERS`。每一个状态都单个字的快捷键(t,n,a 等)。这些符号之后的状态被认为是“完成”的状态。我有两个“完成”状态:`DONE`(已经完成)及 `CANCELLED`(还没完成,但由于其它的原因无法完成)。
|
||||||
|
|
||||||
|
`!` 的含义是记录某项更改为状态的时间。我不把这个添加到完成的状态,是因为它们已经被记录了。`@` 符号表示带理由的提示,所以当切换到 `WAIT` 时,`Org` 会问我为什么,并将这个添加到笔记中。
|
||||||
|
|
||||||
|
以下是项目状态发生变化的例子:
|
||||||
|
|
||||||
|
```
|
||||||
|
** DONE This is a test
|
||||||
|
CLOSED: [2018-03-02 Fri 03:05]
|
||||||
|
|
||||||
|
- State "DONE" from "WAIT" [2018-03-02 Fri 03:05]
|
||||||
|
- State "WAIT" from "TODO" [2018-03-02 Fri 03:05] \\
|
||||||
|
waiting for pigs to fly
|
||||||
|
- State "TODO" from "NEXT" [2018-03-02 Fri 03:05]
|
||||||
|
- State "NEXT" from "TODO" [2018-03-02 Fri 03:05]
|
||||||
|
```
|
||||||
|
|
||||||
|
在这里,最新的项目在最上面。
|
||||||
|
|
||||||
|
**议程模式,日程及期限**
|
||||||
|
|
||||||
|
当你处在一个待办项时,`C-c C-s` 或 `C-c C-d` 可以为其设置相应的日程或期限。这些都是在议程模式中的功能。区别在于意图和表现。日程是你希望在某个时候完成的事情,而期限是在某个特定的时间应该完成的事情。默认情况下,议程视图将在项目的截止日期前提醒你。
|
||||||
|
|
||||||
|
在此过程中,[议程视图][3]将显示即将出现的项目,提供了一种基于纯文本或标记搜索项目的方法,甚至可以进行跨多个文件处理项目的批量操作。我在本系列的[第 2 部分][4]中介绍了为议程模式配置。
|
||||||
|
|
||||||
|
**标签**
|
||||||
|
|
||||||
|
`Org` 模式当然也支持标签了。你可以通过 `C-c C-q` 快速的建立标签。
|
||||||
|
|
||||||
|
你可能会想为一些常用的标签设置快捷键。就像这样:
|
||||||
|
|
||||||
|
```
|
||||||
|
(setq org-tag-persistent-alist
|
||||||
|
'(("@phone" . ?p)
|
||||||
|
("@computer" . ?c)
|
||||||
|
("@websurfing" . ?w)
|
||||||
|
("@errands" . ?e)
|
||||||
|
("@outdoors" . ?o)
|
||||||
|
("MIT" . ?m)
|
||||||
|
("BIGROCK" . ?b)
|
||||||
|
("CONTACTS" . ?C)
|
||||||
|
("INBOX" . ?i)
|
||||||
|
))
|
||||||
|
```
|
||||||
|
|
||||||
|
你还可以根据每个文件向该列表添加标记,也可以根据每个文件为某些内容设置标记。我就在我的 `inbox.org` 和 `email.org` 文件中设置了一个 `INBOX` 的标签。然后我可以每天从日程视图中查看所有标记为 `INBOX` 的项目,像将它们重新归档到其他文件中的简单操作将让它们去掉 `INBOX` 标记。
|
||||||
|
|
||||||
|
**重新归档**
|
||||||
|
|
||||||
|
“重新归档”就是在文件中或其他地方移动。它是使用标来题完成。`C-c C-w` 就是做这个的。我设置成这样:
|
||||||
|
|
||||||
|
```
|
||||||
|
(setq org-outline-path-complete-in-steps nil) ; Refile in a single go
|
||||||
|
(setq org-refile-use-outline-path 'file)
|
||||||
|
```
|
||||||
|
|
||||||
|
**归档分类**
|
||||||
|
|
||||||
|
一段时间后,你的文件就会被已经完成的事情弄得乱七八糟。`Org` 模式有一个[归档][6]特性,可以将主 `.org` 文件移到其他文件中,以备将来参考。如果你在 `git` 或其他软件中 有 `Org` 文件,你可能希望删除这些其他文件,因为无论如何都会在历史中拥有这些文件,但是我发现它们对于 `grepping` 和搜索非常方便。
|
||||||
|
|
||||||
|
我会定期检查并归档文件中的所有内容。基于 [stackoverflow 的讨论][7],我有以下代码:
|
||||||
|
|
||||||
|
```
|
||||||
|
(defun org-archive-done-tasks ()
|
||||||
|
(interactive)
|
||||||
|
(org-map-entries
|
||||||
|
(lambda ()
|
||||||
|
(org-archive-subtree)
|
||||||
|
(setq org-map-continue-from (outline-previous-heading)))
|
||||||
|
"/DONE" 'file)
|
||||||
|
(org-map-entries
|
||||||
|
(lambda ()
|
||||||
|
(org-archive-subtree)
|
||||||
|
(setq org-map-continue-from (outline-previous-heading)))
|
||||||
|
"/CANCELLED" 'file)
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
这基于[一个特定的答案][8]——你可以从评论那获得一些额外的提示。现在你可以运行 `M-x org-archive-done-tasks`,当前文件中所有标记为 `DONE` 或 `CANCELED` 的内容都将放到另一个文件中。
|
||||||
|
|
||||||
|
**下一篇**
|
||||||
|
|
||||||
|
我将通过讨论在 `Org` 模式中自动接受邮件以及在不同的机子上同步来对 `Org` 模式进行总结。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://changelog.complete.org/archives/9877-emacs-3-more-on-org-mode
|
||||||
|
|
||||||
|
作者:[John Goerzen][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[oneforalone](https://github.com/oneforalone)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: http://changelog.complete.org/archives/author/jgoerzen
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://changelog.complete.org/archives/tag/emacs2018
|
||||||
|
[2]: https://orgmode.org/guide/TODO-Items.html#TODO-Items
|
||||||
|
[3]: https://orgmode.org/guide/Agenda-Views.html#Agenda-Views
|
||||||
|
[4]: https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode
|
||||||
|
[5]: https://orgmode.org/guide/Tags.html#Tags
|
||||||
|
[6]: https://orgmode.org/guide/Archiving.html#Archiving
|
||||||
|
[7]: https://stackoverflow.com/questions/6997387/how-to-archive-all-the-done-tasks-using-a-single-command
|
||||||
|
[8]: https://stackoverflow.com/a/27043756
|
145
translated/tech/20180518 How to Manage Fonts in Linux.md
Normal file
145
translated/tech/20180518 How to Manage Fonts in Linux.md
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
如何在 Linux 上管理字体
|
||||||
|
======
|
||||||
|
|
||||||
|
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_main.jpg?itok=qcJks7-c)
|
||||||
|
|
||||||
|
我不仅写技术文档,还写小说。并且因为我对 GIMP 等工具感到满意,所以我也(译者注:此处应指使用 GIMP)创建了自己的书籍封面(并为少数客户做了图形设计)。艺术创作取决于很多东西,包括字体。
|
||||||
|
|
||||||
|
虽然字体渲染已经在过去的几年里取得了长足进步,但它在 Linux 平台上仍是个问题。如果你在 Linux 和 macOS 平台上比较相同字体的外观,差别是显而易见的,尤其是你要盯着屏幕一整天的时候。虽然在 Linux 平台上尚未找到完美的字体渲染方案,开源平台做得好的一件事是允许用户轻松地管理他们的字体。通过选择、添加、缩放和调整,你可以在 Linux 平台上相当轻松地使用字体。
|
||||||
|
|
||||||
|
此处,我将分享一些这些年来我赖于在 Linux 上帮助我扩展“字体能力”的技巧。这些技巧将对那些在开源平台上进行艺术创作的人有特别的帮助。因为 Linux 平台上有非常多可用的桌面界面(每种界面以不同的方式处理字体),因此当桌面环境成为字体管理的中心时,我将主要聚焦在 GNOME 和 KDE 上。
|
||||||
|
|
||||||
|
话虽如此,让我们开始吧。
|
||||||
|
|
||||||
|
### 添加新字体
|
||||||
|
|
||||||
|
在相当长的一段时间里,我都是一个字体收藏家,甚至有些人会说我有些痴迷。从我使用 Linux 的早期开始,我就总是用相同的方法向我的桌面添加字体。有两种方法可以做到这一点:
|
||||||
|
|
||||||
|
* 使字体针对每个用户可用;
|
||||||
|
|
||||||
|
* 使字体在系统范围内可用。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
因为我的桌面从没有其他用户(除了我自己),我只使用了每个用户的字体设置。然而,我会向你演示如何完成这两种设置。首先,让我们来看一下如何向每个用户添加新字体。你首先要做的是找到字体文件,真实类型字体(TTF)和开源类型字体(OTF)都可以被添加。我选择手动添加字体,也就是说,我在 ~/ 目录下新建了一个名为 ~/.fonts 的隐藏目录。该操作可由以下命令完成:
|
||||||
|
```
|
||||||
|
mkdir ~/.fonts
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
当此文件夹新建完成,我将所有 TTF 和 OTF 字体文件移动到此文件夹中。也就是说,你在此文件夹中添加的所有字体都可以在已安装的应用中使用了。但是要记住,这些字体只会对这一个用户可用。
|
||||||
|
|
||||||
|
如果你想要使这个字体集合对所有用户可用,你可以如下操作:
|
||||||
|
|
||||||
|
1. 打开一个终端窗口;
|
||||||
|
|
||||||
|
2. 切换路径到包含你所有字体的目录中;
|
||||||
|
|
||||||
|
3. 使用 `sudo cp *.ttf *.TTF /usr/share/fonts/truetype/` 和 `sudo cp *.otf *.OTF /usr/share/fonts/opentype` 命令拷贝所有字体。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
当下次用户登录时,他们就将可以使用所有这些漂亮的字体。
|
||||||
|
|
||||||
|
### 图形界面字体管理
|
||||||
|
|
||||||
|
在 Linux 上你有许多方式来管理你的字体,如何完成取决于你的桌面环境。让我们以 KDE 为例。使用以 KDE 作为桌面环境的 Kubuntu 18.04,你能够找到一个预装的字体管理工具。打开此工具,你就能轻松地添加、移除、启用或禁用字体(当然也包括获得所有已安装字体的详细信息)。这个工具也能让你轻松地针对每个用户或在系统范围内添加和删除字体。假如你想要为用户添加一个特定的字体,你需要下载该字体并打开字体管理工具。在此工具中(图 1),点击个人字体并点击“+”号添加按钮。
|
||||||
|
|
||||||
|
|
||||||
|
![添加字体][2]
|
||||||
|
|
||||||
|
图 1: 在 KDE 中添加个人字体。
|
||||||
|
|
||||||
|
[经许可使用][3]
|
||||||
|
|
||||||
|
导航至你的字体路径,选择它们,然后点击打开。你的字体就会被添加进了个人区域,并且立即可用(图 2)。
|
||||||
|
|
||||||
|
|
||||||
|
![KDE 字体管理][5]
|
||||||
|
|
||||||
|
图 2: 使用 KDE 字体管理添加字体
|
||||||
|
|
||||||
|
[经许可使用][3]
|
||||||
|
|
||||||
|
在 GNOME 中做同样的事需要安装一个应用。打开 GNOME 软件中心或者 Ubuntu 软件中心(取决于你使用的发行版)并搜索字体管理器。选择 Font Manager 并点击安装按钮。一但安装完成,你就可以从桌面菜单中启动它,然后让我们安装个人字体。下面是如何安装:
|
||||||
|
|
||||||
|
1. 从左侧窗格选择“用户”(图 3);
|
||||||
|
|
||||||
|
2. 点击窗口顶部的 + 按钮;
|
||||||
|
|
||||||
|
3. 浏览并选择已下载的字体;
|
||||||
|
|
||||||
|
4. 点击“打开”。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
![添加字体][7]
|
||||||
|
|
||||||
|
图 3: 在 GNOME 中添加字体
|
||||||
|
|
||||||
|
[经许可使用][3]
|
||||||
|
|
||||||
|
### 调整字体
|
||||||
|
|
||||||
|
首先你需要理解 3 条概念:
|
||||||
|
|
||||||
|
* **字体提示:** 使用数学指令调整字体轮廓显示,使其与光栅化网格对齐。
|
||||||
|
|
||||||
|
* **抗锯齿:** 一种通过使曲线和斜线锯齿状边缘光滑化,提高数字图像真实性的技术。
|
||||||
|
|
||||||
|
* **缩放因子:** **** 一个允许你倍增字体大小的缩放单元。也就是说如果你的字体是 12pt 并且缩放因子为 1,那么字体大小将会是 12pt。如果你的缩放因子为 2,那么字体将会是 24pt。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
假设你已经安装好了你的字体,但他们看起来并不像你想的那么好。你将如何调整字体的外观?在 KDE 和 GNOME 中,你都可以做一些调整。在调整字体时需要考虑的一件事是,关于字体的口味是非常主观的。你也许会发现你只得不停地调整,直到你得到了看起来确实满意的字体(由你的需求和特殊口味决定)。让我们先看一下 KDE 下的情况吧。
|
||||||
|
|
||||||
|
打开系统设置工具并点击“字体”。在此节中,你不仅能切换不同字体,你也能够启用或配置抗锯齿或启用字体缩放因子(图 4)。
|
||||||
|
|
||||||
|
|
||||||
|
![配置字体][9]
|
||||||
|
|
||||||
|
图 4: 在 KDE 中配置字体
|
||||||
|
|
||||||
|
[经许可使用][3]
|
||||||
|
|
||||||
|
要配置抗锯齿,在下拉菜单中选择“启用”并点击“配置”。在结果窗口中(图 5),你可以配置排除范围、子像素渲染类型和提示类型。
|
||||||
|
|
||||||
|
一但你做了更改,点击“应用”。重启所有正在运行的程序,然后新的设置就会生效。
|
||||||
|
|
||||||
|
要在 GNOME 中这么做,你需要安装 Font Manager或 GNOME Tweaks。在此处,GNOME Tweaks 是更好的工具。如果你打开 GNOME Dash 菜单但没有找到 Tweaks,打开 GNOME Software(或 Ubuntu Software)并安装 GNOME Tweaks。安装完毕,打开并点击“字体”,此处你可以配置提示、抗锯齿和缩放因子(图 6)。
|
||||||
|
|
||||||
|
![调整字体][11]
|
||||||
|
|
||||||
|
图 6: 在 GNOME 中调整字体
|
||||||
|
|
||||||
|
[经许可使用][3]
|
||||||
|
|
||||||
|
### 美化你的字体
|
||||||
|
|
||||||
|
以上便是使你的 Linux 字体尽可能漂亮的要旨。你可能得不到像 macOS 那样渲染的字体,但你一定可以提升字体外观。最后,你选择的字体会很大程度地影响视觉效果,因此请确保你安装的字体是干净并且完整适配的,否则你将输掉这次对抗。
|
||||||
|
|
||||||
|
通过 The Linux Foundation 和 edX 平台的免费课程 [初识 Linux][12] 了解更多关于 Linux 的信息。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.linux.com/learn/intro-to-linux/2018/5/how-manage-fonts-linux
|
||||||
|
|
||||||
|
作者:[Jack Wallen][a]
|
||||||
|
选题:[lujun9972](https://github.com/lujun9972)
|
||||||
|
译者:[cycoe](https://github.com/cycoe)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://www.linux.com/users/jlwallen
|
||||||
|
[2]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_1.jpg?itok=7yTTe6o3 (adding fonts)
|
||||||
|
[3]:https://www.linux.com/licenses/category/used-permission
|
||||||
|
[5]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_2.jpg?itok=_g0dyVYq (KDE Font Manager)
|
||||||
|
[7]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_3.jpg?itok=8o884QKs (Adding fonts )
|
||||||
|
[9]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_4.jpg?itok=QJpPzFED (Configuring fonts)
|
||||||
|
[11]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_6.jpg?itok=4cQeIW9C (Tweaking fonts)
|
||||||
|
[12]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux
|
316
translated/tech/20180707 Version Control Before Git with CVS.md
Normal file
316
translated/tech/20180707 Version Control Before Git with CVS.md
Normal file
@ -0,0 +1,316 @@
|
|||||||
|
Git 之前使用 CVS 进行版本控制
|
||||||
|
======
|
||||||
|
Github 网站于 2008 年发布。如果你的软件工程师职业生涯跟我一样,也是晚于此时间的话,Git 可能是你用过的唯一版本控制软件。虽然其陡峭的学习曲线和不直观地用户界面时常会遭人抱怨,但不可否认的是, Git 已经成为人们学习版本控制的最佳选择。 2015 年,Stack Overflow 进行的开发者调查显示,69.3% 的被调查者在使用 Git,几乎是排名第二的 Subversion 版本控制系统使用者数量的两倍。2015 年之后,也许是因为 Git 太受欢迎了,大家对此话题不再感兴趣,所以 Stack Overflow 停止了关于开发人员使用版本控制系统软件的问卷调查。
|
||||||
|
|
||||||
|
Github 的发布时间距离 Git 自身发布时间很近。2005 年, Linus Torvalds 发布了 Git 的首个版本。现在的年经一代开发者可能很难想象“版本控制软件”生命周期所代表的世界并不仅仅只有 Git,虽然这样的世界诞生的时间并不长。除了 Git 外,还有很多可供选择。开源开发者较喜欢 Subversion,企业和视频游戏公司使用 Perforce (到如今有些仍在用),而 Linux 内核项目依赖于名为 BitKeeper 的版本控制系统。
|
||||||
|
|
||||||
|
其中一些系统,特别是 BitKeeper,会让年经一代的 Git 用户感觉很熟悉,上手也很快,但大多数相差很大。除了 BitKeeper,Git 之前的版本控制系统都是以不同的架构模型为基础运行的。作者 Eric Sink 在他的 [Version Control By Example][8] 一书中对版本控制进行了分类,按其说法,Git 属于第三代版本控制系统,而大多数 Git 的前身,即流行于二十世纪九零年代和二十一世纪早期的系统,都属于第二代版本控制系统。第三代版本控制系统是分布式的,第二代是集中式。你们以前大概都听过 Git 被描述为一款“分布式”版本控制系统。我一直都不明白分布式/集中式之间的区别,随后自己亲自安装了一款第二代的集中式版本控件系统,并做了相关实验,至少明白了一些。
|
||||||
|
|
||||||
|
我安装的版本系统是 CVS。CVS,即 `Concurrent Versions System` 的缩写,是最初的第二代版本控制系统。大约十年,它是最为流行的版本控制系统,直到 2000 年被 Subversion 所取代。即便如此,Subversion 被认为是 “CVS 但做的更好”,这更进一步突出了 CVS 在二十世纪九零年代的主导地位。
|
||||||
|
|
||||||
|
CVS 最早是由一位名叫 Dick Grune 的荷兰科学家在 1986 年间开发的,当时有一个编译器项目,他正在寻找一种能与其学生合作的方法。CVS 最初仅仅只是一个包装了 RCS(修订控制系统) 的 Shell 脚本集合,Grune 想改进这个第一代的版本控制系统。 RCS 是按悲观锁模式工作的,这意味着两个程序员不可以同时处理同一个文件。需要编辑一个文件话,首先得向 RCS 系统请求一个排它锁,锁定此文件直到完成编辑,如果你想编辑的文件有人正在编辑,你就必须等待。CVS 在 RCS 基础上改进,并把悲观锁模型替换成乐观锁模型,迎来了第二代版本控制系统的时代。现在,程序员可以同时编辑同一个文件、合并编辑部分,随后解决合并冲突问题。(后来接管 CVS 项目的工程师布莱恩·柏林(Brian Berliner)于 1990 年撰写了一篇关于 CVS 创新的非常易读的 [论文][1]。)
|
||||||
|
|
||||||
|
从这个意义上来讲,CVS 与 Git 并无差异,因为 Git 也是运行于乐观锁模式的,但也仅仅只有此点相似。实际上,Linus Torvalds 开发 Git 时,他的一个指导原则是 WWCVSND,即 “What Would CVS
|
||||||
|
Not Do (CVS 不能做的).” 每当他做决策时,他都会力争选择那些在 CVS 设计里没有使用的功能选项。所以即使 CVS 要早于 Git 十多年,但它对 Git 的影响是为负数的。
|
||||||
|
|
||||||
|
我非常喜欢折腾 CVS。我认为要弄明白为什么 Git 的分布式特性是对以前的版本控制系统的较大改善的话,除了折腾 CVS 外,没有更好的办法。因此,我邀请您跟我一起来一段激动人心的旅程,并在接下来的十分钟内了解下这个近十年来无人使用的软件。(可以看看修正部分)
|
||||||
|
|
||||||
|
### CVS 入门
|
||||||
|
|
||||||
|
CVS 的安装教程可以在其 [项目主页][2] 上找到。MacOS 系统的话,可以使用 Homebrew 安装。
|
||||||
|
|
||||||
|
由于 CVS 是集中式的,所以它有客户端和服务端之区分,这种模式 Git 是没有的。两端分别有不同的可执行文件,其区别不太明显。但要开始使用 CVS 的话,即使只在您的本地机器上使用,也必须设置 CVS 的服务后端。
|
||||||
|
|
||||||
|
CVS 的后端,即所有代码的中央存储区,被叫做存储库 (repository)。在 Git 中每一个项目都有一个存储库,而 CVS 中一个存储库就包含所有的项目。尽管有办法保证一次只能访问一个项目,但一个中央存储库包含所有东西是改变不了的。
|
||||||
|
|
||||||
|
要在本地创建存储库的话,请运行 `init` 命令。您可以像如下所示在家(home)目录创建,也可以在您本地的任何地方创建。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs -d ~/sandbox init
|
||||||
|
```
|
||||||
|
|
||||||
|
CVS 允许您将选项传递给 `cvs` 命令本身或 `init` 子命令。出现在 `cvs` 命令之后的选项默认是全局的,而出现在子命令之后的是子命令特有选项。上面所示例子中,`-d` 标志是全局选项。在这儿是告诉 CVS 我们想要创建存储库路径在哪里,但通用的 `-d` 标志指的是我们想要使用的且已经存在的存储库位置。一直使用 `-d` 标志很单调乏味,所以可以设置 `CVSROOT` 环境变量来代替。
|
||||||
|
|
||||||
|
因为我们只是在本地操作,所以仅仅使用 `-d` 参考来传送路径就可以,但也可以包含个主机名。
|
||||||
|
|
||||||
|
此命令在您的家目录创建了一个名叫 `sandbox` 的目录。 如果您列出 `sandbox` 内容,会发现下面包含有 `CVSROOT` 的目录。请不要把此目录与我们的环境变量混淆,它保存存储库的管理文件。
|
||||||
|
|
||||||
|
恭喜! 您刚刚创建了第一个 CVS 存储库。
|
||||||
|
|
||||||
|
### 检入代码
|
||||||
|
|
||||||
|
假设你决定留存下自己喜欢的颜色清单。因为您是一个有艺术倾向但很健忘的人,所以你键入颜色列表清单,并保存到一个叫 `favorites.txt` 的文件中:
|
||||||
|
|
||||||
|
```
|
||||||
|
blue
|
||||||
|
orange
|
||||||
|
green
|
||||||
|
|
||||||
|
definitely not yellow
|
||||||
|
```
|
||||||
|
|
||||||
|
我们也假设您把文件保存到一个叫 `colors` 的目录中。现在你想要把喜欢的颜色列表清单置于版本控制之下,因为从现在起的五十年间会回顾下,随着时间的推移自己的品味怎么变化,这件事很有意思。
|
||||||
|
|
||||||
|
为此,您必须将您的目录导入为新的 CVS 项目。可以使用 `import` 命令:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs -d ~/sandbox import -m "" colors colors initial
|
||||||
|
N colors/favorites.txt
|
||||||
|
|
||||||
|
No conflicts created by this import
|
||||||
|
```
|
||||||
|
|
||||||
|
这里我们再次使用 `-d` 标志来指定存储库的位置,其余的参数是传输给 `import ` 子命令的。必须要提供一条消息,但这儿没必要,所以留空。下一个参数 `colors`,指定了存储库中新目录的名字,这儿给的名字跟检入的目录名称一致。最后的两个参数分别指定了 vendor 标签和 release 标签。我们稍后就会谈论标签。
|
||||||
|
|
||||||
|
我们刚将 `colors` 项目拉入 CVS 存储库。将代引入 CVS 有很多种不同的方法,但这是 [Pragmatic Version Control Using CVS][3] 一书所推荐方法,这是一本关于 CVS 的程序员实用指导书籍。使用这种方法有点尴尬的就是你得重新检出 (check out) 工作项目,即使已经存在有 `colors` 此项目了。不要使用该目录,首先删除它,然后从 CVS 中检出刚才的版本,如下示:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs -d ~/sandbox co colors
|
||||||
|
cvs checkout: Updating colors
|
||||||
|
U colors/favorites.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
这个过程会创建一个新的目录,也叫做 `colors`。此目录里会发现您的源文件 `favorites.txt`,还有一个叫 `CVS` 的目录。这个 `CVS` 目录基本上与 Git 存储库的 `.git` 目录等同。
|
||||||
|
|
||||||
|
### 做出改动
|
||||||
|
|
||||||
|
准备旅行。
|
||||||
|
|
||||||
|
和 Git 一样,CVS 也有 `status` 命令:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs status
|
||||||
|
cvs status: Examining .
|
||||||
|
===================================================================
|
||||||
|
File: favorites.txt Status: Up-to-date
|
||||||
|
|
||||||
|
Working revision: 1.1.1.1 2018-07-06 19:27:54 -0400
|
||||||
|
Repository revision: 1.1.1.1 /Users/sinclairtarget/sandbox/colors/favorites.txt,v
|
||||||
|
Commit Identifier: fD7GYxt035GNg8JA
|
||||||
|
Sticky Tag: (none)
|
||||||
|
Sticky Date: (none)
|
||||||
|
Sticky Options: (none)
|
||||||
|
```
|
||||||
|
|
||||||
|
到这儿事情开始陌生起来了。CVS 没有提交对象这一概念。如上示,有一个叫 “提交标识符 Commit Identifier ” 的东西,但这可能是一个较新版本的标识,在 2003 年出版的《Pragmatic Version Control Using CVS》一书中并没有提到 “提交标识符” 这个概念。 (CVS 的最新版本于 2008 年发布的。)
|
||||||
|
|
||||||
|
在 Git 中,我们所谈论某文件版本其实是在谈论如 `commit 45de392` 相关的东西,而 CVS 中文件是独立版本化的。文件的第一个版本为 1.1 版本,下一个是 1.2 版本,依此类推。涉及分支时,会在后面添加扩展数字。因此您会看到如上所示的 `1.1.1.1` 的内容,这就是示例的版本号,即使我们没有创建分支,似乎默认的会给加上。
|
||||||
|
|
||||||
|
一个项目中会有很多的文件和很多次的提交,如果您运行 `cvs log` 命令(等同于 `git log`),会看到每个文件提交历史信息。同一个项目中,有可能一个文件处于 1.2 版本,一个文件处于 1.14 版本。
|
||||||
|
|
||||||
|
继续,我们对 1.1 版本的 `favorites.txt` 文件做些修改:
|
||||||
|
|
||||||
|
```
|
||||||
|
blue
|
||||||
|
orange
|
||||||
|
green
|
||||||
|
+cyan
|
||||||
|
|
||||||
|
definitely not yellow
|
||||||
|
```
|
||||||
|
|
||||||
|
修改完成,就可以运行 `cvs diff` 来看看 CVS 发生了什么:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs diff
|
||||||
|
cvs diff: Diffing .
|
||||||
|
Index: favorites.txt
|
||||||
|
===================================================================
|
||||||
|
RCS file: /Users/sinclairtarget/sandbox/colors/favorites.txt,v
|
||||||
|
retrieving revision 1.1.1.1
|
||||||
|
diff -r1.1.1.1 favorites.txt
|
||||||
|
3a4
|
||||||
|
> cyan
|
||||||
|
```
|
||||||
|
|
||||||
|
CVS 识别出我们我在文件中添加了一个包含颜色 "cyan" 的新行。(实际上,它说我们已经对 “RCS” 文件进行了更改;你可以看到,CVS 底层使用的还是 RCS。) 此差异指的是当前工作目录中的 `favorites.txt` 副本与存储库中 1.1.1.1 版本的文件之间的差异。
|
||||||
|
|
||||||
|
为了更新存储库中的版本,我们必须提交更改。Git 中,这个操作要好几个步骤。首先,暂存此修改,使其在索引中出现,然后提交此修改,最后,为了使此修改让其他人可见,我们必须把此提交推送到源存储库中。
|
||||||
|
|
||||||
|
而 CVS 中,只需要运行 `cvs commit` 命令就搞定一切。CVS 会查找所有修改的东西,进行捆绑,然后把它们放到存储库中。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs commit -m "Add cyan to favorites."
|
||||||
|
cvs commit: Examining .
|
||||||
|
/Users/sinclairtarget/sandbox/colors/favorites.txt,v <-- favorites.txt
|
||||||
|
new revision: 1.2; previous revision: 1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
我已经习惯了 Git, 所以这种操作会让我感到十分恐惧。因为没有变更暂存区的机制,工作目录下修改的一些老旧的东西都会一股脑给提交到公共存储库中。您有过因为不爽,私下里重写了某个同事不佳的功能实现,但仅仅只是自我宣泄一下并不想让他知道的时候吗?如果不小心提交上去了,就太糟糕了,他会认为你是个混蛋。在推送之前,你也不能修改提交过的东西了,因为提交就是推送。还是您愿意花费 40 分钟的时间来反复运行 `git rebase -i` 命令,以使得本地提交历史记录跟数学证明一样清晰严谨?很遗憾,CVS 里不支持,结果就是,大家都会看到您没有先写测试用例。
|
||||||
|
|
||||||
|
不过,到现在我终于理解了为什么那么多人都觉得 Git 没必要搞那么复杂。对那些早已经习惯直接 `cvs commit` 的人来说,进行暂存变更和推送变更操作确实是毫无意义的差事。
|
||||||
|
|
||||||
|
人们常谈论 Git 是一个 “分布式” 系统,其意思中分布式与非分布式的主要区别为:在 CVS 中,无法进行本地提交。一次提交操作就是向中央存储库提交代码,所以没有网络连接,刚无法执行此操作,获取到本地的只是您的工作目录;在 Git 中,会有一个完完全全的本地存储库,所以即使断网了也可以无间断执行提交操作。您还可以进行编辑提交内容、回退、分支和随心所欲的操作,且无人知晓。
|
||||||
|
|
||||||
|
虽然提交是个很大的话题,但 CVS 用户很少会关注。提交会包含很多的内容修改及今天我们盼望看到的十多次提交请求。还有很特别的,提交触发 CI 构建和触发自动测试程序等。
|
||||||
|
|
||||||
|
现在我们运行 `cvs status`,会看到产生了文件的新版本:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs status
|
||||||
|
cvs status: Examining .
|
||||||
|
===================================================================
|
||||||
|
File: favorites.txt Status: Up-to-date
|
||||||
|
|
||||||
|
Working revision: 1.2 2018-07-06 21:18:59 -0400
|
||||||
|
Repository revision: 1.2 /Users/sinclairtarget/sandbox/colors/favorites.txt,v
|
||||||
|
Commit Identifier: pQx5ooyNk90wW8JA
|
||||||
|
Sticky Tag: (none)
|
||||||
|
Sticky Date: (none)
|
||||||
|
Sticky Options: (none)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 合并
|
||||||
|
|
||||||
|
如上所述,在 CVS 中,你可以同时编辑其他人正在编辑的文件。这是 CVS 对 RCS 的重大改进。当需要将更改的部分重新组合在一起时会发生什么?
|
||||||
|
|
||||||
|
假设您邀请了一些来将他们喜欢的颜色添加到您的列表中。在他们添加的时候,您确定了不再喜欢绿色,然后把它从列表中删除。
|
||||||
|
|
||||||
|
当你提交更新的时候,会发现 CVS 报出了个问题:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs commit -m "Remove green"
|
||||||
|
cvs commit: Examining .
|
||||||
|
cvs commit: Up-to-date check failed for `favorites.txt'
|
||||||
|
cvs [commit aborted]: correct above errors first!
|
||||||
|
```
|
||||||
|
|
||||||
|
好像是朋友们首先提交了更新。所以您的 `favorites.txt` 文件版本没有更新到存储库中的最新版本。此时运行 `cvs status` 就可以看到,本地的 `favorites.txt` 文件副本有一些变更且是 1.2 版本的而存储库上的版本号是 1.3,如下示:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs status
|
||||||
|
cvs status: Examining .
|
||||||
|
===================================================================
|
||||||
|
File: favorites.txt Status: Needs Merge
|
||||||
|
|
||||||
|
Working revision: 1.2 2018-07-07 10:42:43 -0400
|
||||||
|
Repository revision: 1.3 /Users/sinclairtarget/sandbox/colors/favorites.txt,v
|
||||||
|
Commit Identifier: 2oZ6n0G13bDaldJA
|
||||||
|
Sticky Tag: (none)
|
||||||
|
Sticky Date: (none)
|
||||||
|
Sticky Options: (none)
|
||||||
|
```
|
||||||
|
|
||||||
|
你可以运行 `cvs diff` 来了解 1.2 版本与 1.3 版本的确切差异:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs diff -r HEAD favorites.txt
|
||||||
|
Index: favorites.txt
|
||||||
|
===================================================================
|
||||||
|
RCS file: /Users/sinclairtarget/sandbox/colors/favorites.txt,v
|
||||||
|
retrieving revision 1.3
|
||||||
|
diff -r1.3 favorites.txt
|
||||||
|
3d2
|
||||||
|
< green
|
||||||
|
7,10d5
|
||||||
|
<
|
||||||
|
< pink
|
||||||
|
< hot pink
|
||||||
|
< bubblegum pink
|
||||||
|
```
|
||||||
|
|
||||||
|
看来我们的朋友是真的喜欢粉红色,但好在他们编辑的是此文件的不同部分,所以很容易地合并此修改。跟 `git pull` 类似,只要运行 `cvs update` 命令,CVS 就可以为我们做合并操作,如下示:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs update
|
||||||
|
cvs update: Updating .
|
||||||
|
RCS file: /Users/sinclairtarget/sandbox/colors/favorites.txt,v
|
||||||
|
retrieving revision 1.2
|
||||||
|
retrieving revision 1.3
|
||||||
|
Merging differences between 1.2 and 1.3 into favorites.txt
|
||||||
|
M favorites.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
此时查看 `favorites.txt` 文件内容的话,你会发现你的朋友对文件所做的更改已经包含进去了,你的修改也在里面。现在你可以自由的提交文件了,如下示:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs commit
|
||||||
|
cvs commit: Examining .
|
||||||
|
/Users/sinclairtarget/sandbox/colors/favorites.txt,v <-- favorites.txt
|
||||||
|
new revision: 1.4; previous revision: 1.3
|
||||||
|
```
|
||||||
|
|
||||||
|
最终的结果就跟在 Git 中运行 `git pull --rebase` 一样。你的修改是添加在你朋友的修改之后的,所以没有 “合并提交” 这操作。
|
||||||
|
|
||||||
|
某些时候,对同一文件的修改可能导致冲突。例如,如果你的朋友把 “green” 修改成 “olive”,同时你完全删除 “green”,就会出现冲突。早期的时候,正是这种情况导致人们担心 CVS 不安全,而 RCS 的悲观锁机制可以确保此情况永不会发生。但 CVS 提供了一个安全保障机制,可以确保不会自动的覆盖任何人的修改。因此,当运行 `cvs update` 的时候,你必须告诉 CVS 想要做哪些修改才能继续下一步操作。CVS 会标记文件的所有变更,这跟 Git 检测到合并冲突时所做的方式一样,然后,你必须手工编辑文件,选择需要保留的变更进行合并。
|
||||||
|
|
||||||
|
这儿需要注意的有趣事情就是在进行提交之前必须修复并合并冲突。这是 CVS 集中式特性的另一个结果。而在 Git 里,在推送本地的提交内容之前,您都不用担心合并冲突问题。
|
||||||
|
|
||||||
|
由于 CVS 没有易于记录的提交对象,因此对变更集合进行分组的唯一方法就是对于特定的工作目录状态打个标记。
|
||||||
|
|
||||||
|
创建一个标记是很容易的:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs tag VERSION_1_0
|
||||||
|
cvs tag: Tagging .
|
||||||
|
T favorites.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
稍后,运行 `cvs update` 命令并把标签传输给 `-r` 标志就可以把文件恢复到此状态,如下示:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs update -r VERSION_1_0
|
||||||
|
cvs update: Updating .
|
||||||
|
U favorites.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
因为你需要一个标记来回退到早期的工作目录状态,所以 CVS 鼓励创建大量的抢占标记。例如,在重大的重构之前,你可以创建一个 `BEFORE_REFACTOR_01` 标记,如果重构出错,就可以使用此标记回退。你果想在项目范围上生成有差异的版本的话,也可以使用标记。基本上,我们使用 CVS 来管理的, 对于今天日常所做的所有事情都是预测性和计划性的,所以需要打上标记,以备回退修改。
|
||||||
|
|
||||||
|
可以在 CVS 中创建分支。分支只是一种特殊的标记,如下示:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs rtag -b TRY_EXPERIMENTAL_THING colors
|
||||||
|
cvs rtag: Tagging colors
|
||||||
|
```
|
||||||
|
|
||||||
|
(顺便提醒一下读者)这命令仅仅只是创建了分支,所以还需要使用 `cvs update` 命令来切换分支,如下示:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs update -r TRY_EXPERIMENTAL_THING
|
||||||
|
```
|
||||||
|
|
||||||
|
上面的命令就会把您的当前工作目录切换到新的分支,但《Pragmatic Version Control Using CVS》一书实际上是建议创建一个新的目录来间接替代新分支。估计,其作者发现在 CVS 里切换目录要比切换分支来得更简单吧。
|
||||||
|
|
||||||
|
此书也建议不要从现有分支创建分支,而只在主线分支,Git 中被叫做 `master`,上创建分支。一般来说,分支在 CVS 中主认为是 “高级” 技能。而在 Git 中,您几乎可以无理由的就创建新分支,但 CVS 中要在真正需要的时候才能创建,比如发布项目。
|
||||||
|
|
||||||
|
稍后可以使用 `cvs update` 和 `-j` 标志将分支合并回主线:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cvs update -j TRY_EXPERIMENTAL_THING
|
||||||
|
```
|
||||||
|
|
||||||
|
### 感谢历史上的贡献者
|
||||||
|
|
||||||
|
2007 年,Linus Torvalds 在 Google 进行了一场关于 Git 的 [演讲][4](译者注:需要梯子,国内用户可以访问 [腾讯视频][9])。当时 Git 是很新的东西,整场演讲基本上都是在说服满屋子都持有怀疑态度的程序员们,尽管 Git 是如此的与众不同,也应该使用 Git。如果没有看过这个视频的话,我强烈建议你去看看。Linus 是个有趣的演讲者,即使他有些傲慢。他非常出色地解释了为什么分布式的版本控制系统要比集中式的优秀。他的很多评论是直接针对 CVS 的。
|
||||||
|
|
||||||
|
Git 是一个 [相当复杂的工具][5]。学习起来是一个令人沮丧的经历,但也不断的给我惊喜,Git 还能做这样的事情。相比之下,CVS 简单明了,但是,许多我们认为理所当然的操作都做不了。想要对 Git 的强大功能和灵活性有全新的认识的话,就回过头来用用 CVS 吧,这是种很好的学习方式。这很好的诠释了为什么理解软件的开发历史可以让人受益匪浅。重拾过期淘汰的工具可以让我们理解今天所使用的工具后面所隐藏的哲理。
|
||||||
|
|
||||||
|
如果您喜欢此博文的话,每两周会有一次更新!请在 Twitter 上关注 [@TwoBitHistory][6] 或都通过 [RSS feed][7] 订阅,新博文出来会有通知。
|
||||||
|
|
||||||
|
#### 修正
|
||||||
|
|
||||||
|
有人告诉我,有很多组织企业,特别是像做医疗设备软件等这种规避风险类的企业,仍在使用 CVS。这些企业中的程序员通过使用一些小技巧来解决 CVS 的限制,例如为几乎每个更改创建一个新分支以避免直接提交给 `HEAD`。 (感谢 Michael Kohne 指出这一点。)
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://twobithistory.org/2018/07/07/cvs.html
|
||||||
|
|
||||||
|
作者:[Two-Bit History][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[runningwater](https://github.com/runningwater)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://twobithistory.org
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://docs.freebsd.org/44doc/psd/28.cvs/paper.pdf
|
||||||
|
[2]: https://www.nongnu.org/cvs/
|
||||||
|
[3]: http://shop.oreilly.com/product/9780974514000.do
|
||||||
|
[4]: https://www.youtube.com/watch?v=4XpnKHJAok8
|
||||||
|
[5]: https://xkcd.com/1597/
|
||||||
|
[6]: https://twitter.com/TwoBitHistory
|
||||||
|
[7]: https://twobithistory.org/feed.xml
|
||||||
|
[8]: https://ericsink.com/vcbe/index.html
|
||||||
|
[9]: https://v.qq.com/x/page/o0772kqh5iv.html
|
@ -1,40 +1,40 @@
|
|||||||
如何在 Python 中写你喜爱的 R 函数
|
如何用 Python 编写你喜爱的 R 函数
|
||||||
======
|
======
|
||||||
R 还是 Python ? 这个 Python 脚本模仿方便的 R 风格函数,使统计数据变得简单易行。
|
R 还是 Python ? Python 脚本模仿易使用的 R 风格函数,使得数据统计变得简单易行。
|
||||||
|
|
||||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_issue_bug_programming.png?itok=XPrh7fa0)
|
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_issue_bug_programming.png?itok=XPrh7fa0)
|
||||||
|
|
||||||
“Python vs. R” 是数据科学和机器学习的现代战争之一。毫无疑问,近年来两者发展迅猛并成为数据科学,预测分析和机器学习领域的顶级编程语言。事实上,根据 IEEE 最近一篇文章,Python 已在 [最受欢迎编程语言排行榜][1] 中超越 C++ 并且 R 语言也稳居前 10 位。
|
“Python vs. R” 是数据科学和机器学习的现代战争之一。毫无疑问,近年来这两者发展迅猛,成为数据科学,预测分析和机器学习领域的顶级编程语言。事实上,根据 IEEE 最近的一篇文章,Python 已在 [最受欢迎编程语言排行榜][1] 中超越 C++ 并且 R 语言也稳居前 10 位。
|
||||||
|
|
||||||
但是,这两者之间存在一些根本区别。[R] 主要作为统计分析和数据分析问题的快速原型设计的工具而开发的。另一方面,Python 开发为一种通用的,现代的面向对象语言,类似 C++ 或 Java,但具有更简单的学习曲线和更灵活的语言风格。因此,R 仍在统计学家,定量生物学家,物理学家和经济学家中备受青睐,而 Python 已逐渐成为日常脚本,自动化,后端Web开发,分析和通用机器学习框架的顶级语言并拥有广泛的支持基础和开源开发社区。
|
但是,这两者之间存在一些根本区别。[R][2] 语言设计的初衷主要是作为统计分析和数据分析问题的快速原型设计的工具,另一方面,Python 是作为一种通用的,现代的面向对象语言而开发的,类似 C++ 或 Java,但具有更简单的学习曲线和更灵活的语言风格。因此,R 仍在统计学家,定量生物学家,物理学家和经济学家中备受青睐,而 Python 已逐渐成为日常脚本,自动化,后端 Web 开发,分析和通用机器学习框架的顶级语言,拥有广泛的支持基础和开源开发社区。
|
||||||
|
|
||||||
###在 Python 环境中模仿函数式编程
|
### 在 Python 环境中模仿函数式编程
|
||||||
|
|
||||||
[R] 作为函数式编程语言的天性为用户提供了一个极其简单和紧凑的借口,用于快速计算概率和数据分析问题的基本描述/推论统计。例如,只用一个紧凑的函数调用来解决以下问题难道不是很好吗?
|
[R 作为函数式编程语言的本质][3]为用户提供了一个极其简洁的用于快速计算概率的接口,还为数据分析问题提供了必不可少的描述统计和推论统计方法(译者注:统计学从功能上分为描述统计学和推论统计学)。例如,只用一个简洁的函数调用来解决以下问题难道不是很好吗?
|
||||||
|
|
||||||
* 如何计算数据向量的均值 / 中值 / 众数。
|
* 如何计算数据向量的平均数 / 中位数 / 众数。
|
||||||
* 如何计算某些服从正态分布事件的累积概率。如果服从 Poisson 分布会怎样?
|
* 如何计算某些服从正态分布的事件的累积概率。如果服<ruby>从泊松分布<rt>Poisson distribution</rt></ruby>又该怎样计算呢?
|
||||||
* 如何计算一系列数据点的四分差。
|
* 如何计算一系列数据点的四分位距。
|
||||||
* 如何生成服从学生 t 分布的一些随机数。
|
* 如何生成服从学生 t 分布的一些随机数(译者注: 在概率论和统计学中,学生 t -分布(Student's t*-*distribution)可简称为t 分布,用于根据小样本来估计呈正态分布且方差未知的总体的均值)。
|
||||||
|
|
||||||
R编程环境可以完成所有这些工作。
|
R 编程环境可以完成所有这些工作。
|
||||||
|
|
||||||
另一方面,Python的脚本编写能力使分析师能够在各种分析流程中使用这些统计数据,具有无限的复杂性和创造力。
|
另一方面,Python 的脚本编写能力使分析师能够在各种分析流程中使用这些统计数据,具有无限的复杂性和创造力。
|
||||||
|
|
||||||
要结合二者的优势,您只需要一个简单的基于 Python 的包装器库,其中包含与 R 风格定义的概率分布和描述性统计相关的最常用函数。 这使您可以非常快速地调用这些函数,而无需转到正确的 Python 统计库并理解整个方法和参数列表。
|
要结合二者的优势,你只需要一个简单的 Python 封装的库,其中包含与 R 风格定义的概率分布和描述性统计相关的最常用函数。 这使你可以非常快速地调用这些函数,而无需转到正确的 Python 统计库并理解整个方法和参数列表。
|
||||||
|
|
||||||
|
|
||||||
### 便于调用 R 函数的 Python 包装脚本
|
### 便于调用 R 函数的 Python 包装脚本
|
||||||
|
|
||||||
[我编写了一个Python脚本] [4] 在 Python 中定义了简单统计分析中方便广泛使用的 R 函数。
|
[我编写了一个Python脚本][4] ,用 Python 简单统计分析定了义最简洁和最常用的 R 函数。导入此脚本后,你将能够自然地使用这些R函数,就像在R编程环境中一样。
|
||||||
|
|
||||||
此脚本的目标是提供简单的 Python 子例程,模仿 R 风格的统计函数,以快速计算密度/点估计,累积分布和分位数,并生成重要概率分布的随机变量。
|
此脚本的目标是提供简单的 Python 函数,模仿 R 风格的统计函数,以快速计算密度估计和点估计,累积分布和分位数,并生成重要概率分布的随机变量。
|
||||||
|
|
||||||
为了保持 R 风格的精髓,脚本不使用类层次结构,并且只在文件中定义原始函数。 因此,用户可以导入这个 Python 脚本,并在需要单个名称调用时使用所有功能。
|
为了延续 R 风格,脚本不使用类结构,并且只在文件中定义原始函数。 因此,用户可以导入这个 Python 脚本,并在需要单个名称调用时使用所有功能。
|
||||||
|
|
||||||
请注意,我使用 mimic 这个词。 在任何情况下,我都声称要模仿 R 的真正的函数式编程范例,该范式包括深层环境设置以及这些环境和对象之间的复杂关系。 这个脚本允许我(我希望无数其他 Python 用户)快速启动P ython 程序或 Jupyter 笔记本,导入脚本,并立即开始进行简单的描述性统计。 这就是目标,仅此而已。
|
请注意,我使用 mimic 这个词。 在任何情况下,我都声称要模仿 R 的真正的函数式编程范式,该范式包括深层环境设置以及这些环境和对象之间的复杂关系。 这个脚本允许我(我希望无数其他的 Python 用户)快速启动P ython 程序或 Jupyter 笔记本程序,导入脚本,并立即开始进行简单的描述性统计。 这就是目标,仅此而已。
|
||||||
|
|
||||||
如果您已经写过 R 代码(可能在研究生院)并且刚刚开始学习并使用 Python 进行数据分析,那么您将很高兴看到并在 Jupyter 笔记本中以类似在 R 环境中一样使用一些相同的知名函数。
|
如果你已经写过 R 代码(可能在研究生院)并且刚刚开始学习并使用 Python 进行数据分析,那么你将很高兴看到并在 Jupyter 笔记本中以类似在 R 环境中一样使用一些相同的知名函数。
|
||||||
|
|
||||||
无论出于何种原因,使用这个脚本很有趣。
|
无论出于何种原因,使用这个脚本很有趣。
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ lst=[20,12,16,32,27,65,44,45,22,18]
|
|||||||
<more code, more statistics...>
|
<more code, more statistics...>
|
||||||
```
|
```
|
||||||
|
|
||||||
假设您想从数据点向量计算[Tuckey五数] [5]摘要。 你只需要调用一个简单的函数 ** fivenum **,然后传递向量。 它将返回 NumPy 数组中的五数摘要。
|
假设你想从数据向量计算[ Tuckey 五数][5]摘要。 你只需要调用一个简单的函数 **fivenum**,然后将向量传进去。 它将返回五数摘要,存在 NumPy 数组中。
|
||||||
|
|
||||||
```
|
```
|
||||||
lst=[20,12,16,32,27,65,44,45,22,18]
|
lst=[20,12,16,32,27,65,44,45,22,18]
|
||||||
@ -56,7 +56,7 @@ fivenum(lst)
|
|||||||
> array([12. , 18.5, 24.5, 41. , 65. ])
|
> array([12. , 18.5, 24.5, 41. , 65. ])
|
||||||
```
|
```
|
||||||
|
|
||||||
或许你想要知道下面问题的解答
|
或许你想要知道下面问题的答案
|
||||||
|
|
||||||
假设一台机器平均每小时输出 10 件成品,标准偏差为 2。输出模式遵循接近正态的分布。 机器在下一个小时内输出至少 7 个但不超过 12 个单位的概率是多少?
|
假设一台机器平均每小时输出 10 件成品,标准偏差为 2。输出模式遵循接近正态的分布。 机器在下一个小时内输出至少 7 个但不超过 12 个单位的概率是多少?
|
||||||
|
|
||||||
@ -64,17 +64,17 @@ fivenum(lst)
|
|||||||
|
|
||||||
![](https://opensource.com/sites/default/files/uploads/r-functions-in-python_1.png)
|
![](https://opensource.com/sites/default/files/uploads/r-functions-in-python_1.png)
|
||||||
|
|
||||||
您可以使用 **pnorm** 只用一行代码获得答案:
|
使用 **pnorm** ,你可以只用一行代码就能获得答案:
|
||||||
|
|
||||||
```
|
```
|
||||||
pnorm(12,10,2)-pnorm(7,10,2)
|
pnorm(12,10,2)-pnorm(7,10,2)
|
||||||
> 0.7745375447996848
|
> 0.7745375447996848
|
||||||
```
|
```
|
||||||
或者您可能需要回答以下问题:
|
或者你可能需要回答以下问题:
|
||||||
|
|
||||||
假设你有一个不正的硬币,每次投它时有 60% 可能正面朝上。 你正在玩10次投掷游戏。 你如何绘制并给出这枚硬币所有可能的胜利数(从0到10)?
|
假设你有一个不公平硬币,每次投它时有 60% 可能正面朝上。 你正在玩 10 次投掷游戏。 你如何绘制并给出这枚硬币所有可能的胜利数(从0到10)的概率?
|
||||||
|
|
||||||
只需使用一个函数 **dbinom** 就可以获得一个只有几行代码的漂亮条形图:
|
只需使用一个函数 **dbinom** 就可以获得一个只有几行代码的美观条形图:
|
||||||
|
|
||||||
```
|
```
|
||||||
probs=[]
|
probs=[]
|
||||||
@ -88,35 +88,35 @@ plt.show()
|
|||||||
|
|
||||||
![](https://opensource.com/sites/default/files/uploads/r-functions-in-python_2.png)
|
![](https://opensource.com/sites/default/files/uploads/r-functions-in-python_2.png)
|
||||||
|
|
||||||
### 简单概率计算接口
|
### 简单的概率计算接口
|
||||||
|
|
||||||
R 提供了一个非常简单直观的界面,可以从基本概率分布中快速计算。 接口如下:
|
R 提供了一个非常简单直观的接口,可以从基本概率分布中快速计算。 接口如下:
|
||||||
|
|
||||||
* **d** {distribution} 给出点 **x** 处的密度函数值
|
* **d** 分布:给出点 **x** 处的密度函数值
|
||||||
* **p** {distribution} 给出 **x**点的累积值
|
* **p** 分布:给出 **x**点的累积值
|
||||||
* **q** {distribution} 以概率 **p**给出分位数函数值
|
* **q** 分布:以概率 **p**给出分位数函数值
|
||||||
* **r** {distribution} 生成一个或多个随机变量
|
* **r** 分布:生成一个或多个随机变量
|
||||||
|
|
||||||
在我们的实现中,我们坚持使用此接口及其关联的参数列表,以便您可以像在 R 环境中一样执行这些函数。
|
在我们的实现中,我们坚持使用此接口及其关联的参数列表,以便你可以像在 R 环境中一样执行这些函数。
|
||||||
|
|
||||||
### 目前实现的函数
|
### 目前已实现的函数
|
||||||
|
|
||||||
脚本中实现了以下R风格函数,以便快速调用。
|
脚本中实现了以下 R 风格函数,以便快速调用。
|
||||||
|
|
||||||
* 均值,中位数,方差,标准差
|
* 平均数,中位数,方差,标准差
|
||||||
* Tuckey 五数总结,IQR
|
* Tuckey 五数摘要,<ruby>四分位距<rt>interquartile range</rt></ruby>IQR
|
||||||
* 矩阵的协方差或两个向量之间的协方差
|
* 矩阵的协方差或两个向量之间的协方差
|
||||||
* 以下分布的密度,累积概率,分位数函数和随机变量生成:正态,均匀,二项式,泊松,F,学生t,卡方,β和伽马
|
* 以下分布的密度,累积概率,分位数函数和随机变量生成:正态,均匀,二项式,<ruby>泊松<rt>Poisson</rt></ruby>,F,<ruby>学生 t<rt>Student's t</rt></ruby>,<ruby>卡方<rt>Chi-square</rt></ruby>,<ruby>贝塔<rt>beta</rt></ruby>和<ruby>伽玛<rt>gamma</rt></ruby>
|
||||||
|
|
||||||
### 进行中的工作
|
### 进行中的工作
|
||||||
|
|
||||||
显然,这是一项正在进行的工作,我计划在此脚本中添加一些其他方便的R函数。 例如,在 R 中,单行命令 ** lm ** 可以为数字数据集提供一个普通的最小二乘拟合模型,其中包含所有必要的推理统计量(P 值,标准误差等)。 这是有力的简洁和紧凑! 另一方面,Python 中的标准线性回归问题经常使用 [Scikit-learn] [6] 来处理,这需要更多的脚本用于此用途,所以我打算使用 Python 的 [statsmodels] 合并这个单函数线性模型拟合特征 [7]后端。
|
显然,这是一项正在进行的工作,我计划在此脚本中添加一些其他方便的R函数。 例如,在 R 中,单行命令 **lm** 可以为数字数据集提供一个简单的最小二乘拟合模型,其中包含所有必要的推理统计(P 值,标准误差等)。 这非常简洁! 另一方面,Python 中的标准线性回归问题经常使用 [Scikit-learn][6] 库来处理,此用途需要更多的脚本,所以我打算使用 Python 的 [statsmodels][7] 库合并这个单函数线性模型来拟合功能。
|
||||||
|
|
||||||
如果您喜欢并在工作中使用此脚本,请通过主演或分析其 [GitHub存储库] [8]帮助其他人找到它。 另外,您可以查看我的其他 [GitHub repos] [9],了解 Python,R 或 MATLAB 中的有趣代码片段以及一些机器学习资源。
|
如果你喜欢这个脚本,并且愿意在工作中使用,请 [GitHub 仓库][8]点个 star 或者 fork 帮助其他人找到它。 另外,你可以查看我其他的 [GitHub 仓库][9],了解 Python,R 或 MATLAB 中的有趣代码片段以及一些机器学习资源。
|
||||||
|
|
||||||
如果您有任何问题或想法要分享,请通过 [tirthajyoti [AT] gmail.com] [10]与我联系。 如果你像我一样热衷于机器学习和数据科学,请 [加我在LinkedIn] [11]或[在Twitter上关注我。] [12]
|
如果你有任何问题或想法要分享,请通过 [tirthajyoti [AT] gmail.com][10] 与我联系。 如果你像我一样热衷于机器学习和数据科学,请 [在 LinkedIn 上加我为好友][11]或者[在 Twitter 上关注我][12]。
|
||||||
|
|
||||||
最初发表于[走向数据科学] [13]。 转载于[CC BY-SA 4.0] [14]。
|
本篇文章最初发表于[走向数据科学][13]。 请在 [CC BY-SA 4.0][14] 协议下转载。
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ via: https://opensource.com/article/18/10/write-favorite-r-functions-python
|
|||||||
作者:[Tirthajyoti Sarkar][a]
|
作者:[Tirthajyoti Sarkar][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[yongshouzhang](https://github.com/yongshouzhang)
|
译者:[yongshouzhang](https://github.com/yongshouzhang)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[Flowsnow](https://github.com/Flowsnow)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
@ -1,162 +0,0 @@
|
|||||||
如何使用 sudo 命令在 Linux 中部署超级用户权限
|
|
||||||
======
|
|
||||||
|
|
||||||
![](https://images.idgesg.net/images/article/2018/11/superman-100781085-large.jpg)
|
|
||||||
|
|
||||||
**sudo** 命令在你想要使用超级权限运行一条林临时的命令时非常方便,但是当它不能做到你期望的所有事的时候,你也会遇到一些麻烦。比如说你想在某些日志文件结尾添加一些重要的信息,你可能会尝试这样做:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ echo "Important note" >> /var/log/somelog
|
|
||||||
-bash: /var/log/somelog: Permission denied
|
|
||||||
```
|
|
||||||
|
|
||||||
好吧,看起来你似乎需要一些额外的特权。一般来说,你不能使用你的用户账号向系统日志中写入东西。我们使用 **sudo** 再尝试一次吧。
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo !!
|
|
||||||
sudo echo "Important note" >> /var/log/somelog
|
|
||||||
-bash: /var/log/somelog: Permission denied
|
|
||||||
```
|
|
||||||
|
|
||||||
emmm,它还是没有啥反应。我们来试点不同的吧。
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo 'echo "Important note" >> /var/log/somelog'
|
|
||||||
sudo: echo "Important note" >> /var/log/somelog: command not found
|
|
||||||
```
|
|
||||||
|
|
||||||
**[ 也可以查看:[在 Linux 下排查故障的宝贵提示和技巧][1] ]**
|
|
||||||
|
|
||||||
### 接下来该干什么?
|
|
||||||
|
|
||||||
上面在执行完第一条命令后的回应显示,我们缺少向日志文件写入时必须的特权。第二次,我们使用 root 权限运行了第一次的命令,但是返回了一个 **没有权限** 的错误。第三次,我们把整个命令放在一个引号里面再运行了一遍,返回了一个 **没有发现命令** 的错误。 。所以,到底错在哪里了呢?
|
|
||||||
|
|
||||||
* 第一条命令:没有 root 特权,你无法向这个日志中写入东西。
|
|
||||||
* 第二条命令:你的超级权限没有被正确重定位。
|
|
||||||
* 第三条命令:Sudo 不理解你用引号括起来的整个 “命令”。
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
在你的用户还未添加到 sudo 用户组的时候,如果尝试使用 sudo,你可能已经看到过像下面的这么一条命令了:
|
|
||||||
|
|
||||||
```
|
|
||||||
nemo is not in the sudoers file. This incident will be reported.
|
|
||||||
```
|
|
||||||
|
|
||||||
### 你可以做什么?
|
|
||||||
|
|
||||||
一个相当简单的选择就是使用 sudo 命令成为 root。鉴于你已经有了 sudo 特权,你可以使用下面的命令执行此操作:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo su
|
|
||||||
[sudo] password for nemo:
|
|
||||||
#
|
|
||||||
```
|
|
||||||
注意这个改变的符号表明了你的新身份。然后你就可以以 root 运行之前的命令了:
|
|
||||||
|
|
||||||
```
|
|
||||||
# echo "Important note" >> /var/log/somelog
|
|
||||||
```
|
|
||||||
接着你可以输入 **^d** 返回你之前的身份。当然了,一些 sudo 的配置可能会阻止你使用 sudo 命令成为 root。
|
|
||||||
|
|
||||||
用 **su** 命令是另一个切换用户为 root 的选择,但是这需要你知道 root 密码许多人被赋予了访问 sudo 的权限,而且无需提供 root 密码,所以这并不是总有用。
|
|
||||||
|
|
||||||
切换到 root 之后,你就可以以 root 的身份运行任何你想执行的命令了。要想通过这种途径有三个问题 1) 每个想要使用 root 特权的人都需要事先知道 root 的密码(这样很不安全) 2) 如果在运行需要 root 权限的特定命令后未能退出特权状态,你的系统可能会受到一些重大错误的波及。最好 _只有_ 当你真的需要 root 特权,以及能控制好每个 sudo 用户可以拥有多少 root 权限的时候再去使用它。在使用完 root 特权之后,最好及时恢复到普通用户的状态。
|
|
||||||
|
|
||||||
另外请注意,整个讨论的前提是你可以正常地访问 sudo,并且你的访问权限没有受限。详细的内容后面会介绍到。
|
|
||||||
|
|
||||||
还有一个选择就是使用一个不同的命令。如果通过编辑文件从而在其后添加内容是一种选择的话,你也许可以使用 “sudo vi /var/log/somelog”,通过编辑一个活跃的日志文件通常不是一个好办法,因为系统可能会频繁的向这个文件中进行写入操作。
|
|
||||||
|
|
||||||
最后一个但是有点复杂的选择是,使用下列可以解决我们之前看到的问题的命令之一,但是它们涉及到了很多复杂的语法。第一个命令允许你在得到 “没有权限” 的拒绝之后可以使用 !! 重复你的命令:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo echo "Important note" >> /var/log/somelog
|
|
||||||
-bash: /var/log/somelog: Permission denied
|
|
||||||
$ !!:gs/>/|sudo tee -a / <=====
|
|
||||||
$ tail -1 /var/log/somelog
|
|
||||||
Important note
|
|
||||||
```
|
|
||||||
|
|
||||||
第二种是通过 sudo 命令,把你想要添加的信息传递给 **tee**。注意,**-a** 指定了你要添加文本的目标文件:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ echo "Important note" | sudo tee -a /var/log/somelog
|
|
||||||
$ tail -1 /var/log/somelog
|
|
||||||
Important note
|
|
||||||
```
|
|
||||||
|
|
||||||
### sudo 有多可控?
|
|
||||||
|
|
||||||
回答这个问题最快速的回答就是,它取决于管理它的人。大多数 Linux 的默认设置都非常简单。如果一个用户被安排到了一个特别的组中,例如 **wheel** 或者 **admin** 组,那这个用户无需知道 root 的密码就可以拥有运行任何命令的能力。这就是大多数 Linux 系统中的默认设置。一旦在 **/etc/group** 中添加了一个用户到了特权组中,这个用户就可以以 root 的权力运行任何命令。另一方面,可以配置 sudo,以便一些用户只能够以 root 身份运行单一指令或者一组命令中的任何一个。
|
|
||||||
|
|
||||||
如果把像下面展示的这些行添加到了 **/etc/sudoers** 文件中,例如 “nemo” 这个用户可以以 root 身份运行 **whoami** 命令。在现实中,这可能不会造成任何影响,作为一个例子,它做的非常好。
|
|
||||||
|
|
||||||
```
|
|
||||||
# User alias specification
|
|
||||||
nemo ALL=(root) NOPASSWD: WHOAMI
|
|
||||||
|
|
||||||
# Cmnd alias specification
|
|
||||||
Cmnd_Alias WHOAMI = /usr/bin/whoami
|
|
||||||
```
|
|
||||||
|
|
||||||
注意,我们添加了一个命令别名(Cmnd_Alias),它指定了一个可以运行的命令的全路径,以及一个用户别名,允许这个用户无需密码就可以使用 sudo 执行的单个命令。
|
|
||||||
|
|
||||||
当 nemo 运行 **sudo whoami** 命令的时候,他将会看到这个:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo whoami
|
|
||||||
root
|
|
||||||
```
|
|
||||||
|
|
||||||
注意这个,一旦 nemo 使用 sudo 执行了这条命令,**whoami** 会显示此时的用户是 **root**。
|
|
||||||
|
|
||||||
至于其他的命令,nemo 将会看到像这样的一些内容:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo date
|
|
||||||
[sudo] password for nemo:
|
|
||||||
Sorry, user nemo is not allowed to execute '/bin/date' as root on butterfly.
|
|
||||||
```
|
|
||||||
|
|
||||||
### sudo 的默认设置
|
|
||||||
|
|
||||||
在默认路径中,我们会利用像下面展示的 **/etc/sudoers** 文件中的几行:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo egrep "admin|sudo" /etc/sudoers
|
|
||||||
# Members of the admin group may gain root privileges
|
|
||||||
%admin ALL=(ALL) ALL <=====
|
|
||||||
# Allow members of group sudo to execute any command
|
|
||||||
%sudo ALL=(ALL:ALL) ALL <=====
|
|
||||||
```
|
|
||||||
|
|
||||||
在这几行中,**%admin** 和 **%sudo** 都说明了任何添加到这些组中的人都可以使用 sudo 命令 以 root 的身份运行任何命令。
|
|
||||||
|
|
||||||
下面列出的是 /etc/group 中的一行,它意味着每一个在该组中列出的成员,都拥有了 sudo 特权,而无需在 /etc/sudoers 中进行任何修改。
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo:x:27:shs,nemo
|
|
||||||
```
|
|
||||||
|
|
||||||
### 总结
|
|
||||||
|
|
||||||
sudo 命令意味着你可以根据需要轻松地部署超级用户的访问权限,而且只有在需要的时候才能赋予用户非常有限的特权访问权限。你可能会遇到一些与简单的 "sudo command" 不同的问题,不过在 **sudo** 的回应中应该会显示你遇到了什么问题。
|
|
||||||
|
|
||||||
欢迎加入 [Facebook][2] 和 [LinkedIn][3] 上的 Network World 社区,并在其中重要的主题下进行留言评论。
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://www.networkworld.com/article/3322504/linux/selectively-deploying-your-superpowers-on-linux.html
|
|
||||||
|
|
||||||
作者:[Sandra Henry-Stocker][a]
|
|
||||||
选题:[lujun9972][b]
|
|
||||||
译者:[dianbanjiu](https://github.com/dianbanjiu)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
|
|
||||||
[b]: https://github.com/lujun9972
|
|
||||||
[1]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html
|
|
||||||
[2]: https://www.facebook.com/NetworkWorld/
|
|
||||||
[3]: https://www.linkedin.com/company/network-world
|
|
@ -0,0 +1,146 @@
|
|||||||
|
[#]: collector: "lujun9972"
|
||||||
|
[#]: translator: "qhwdw"
|
||||||
|
[#]: reviewer: " "
|
||||||
|
[#]: publisher: " "
|
||||||
|
[#]: subject: "OpenSnitch – an Application Firewall for Linux [Review]"
|
||||||
|
[#]: via: "https://itsfoss.com/opensnitch-firewall-linux/"
|
||||||
|
[#]: author: "[John Paul](https://itsfoss.com/author/john/)"
|
||||||
|
[#]: url: " "
|
||||||
|
|
||||||
|
OpenSnitch – 一个 Linux 上的应用程序防火墙
|
||||||
|
======
|
||||||
|
|
||||||
|
不能因为 Linux 比 Windows 更安全,就可以在 Linux 上放松警惕。Linux 上可以使用的防火墙很多,它们可以让你的 Linux 系统更安全。今天,我们将带你了解一个这样的防火墙工具,它就是 OpenSnitch。
|
||||||
|
|
||||||
|
### OpenSnitch 是什么?
|
||||||
|
|
||||||
|
![Linux firewall and security][1]
|
||||||
|
|
||||||
|
[OpenSnitch][2] 是从 Little Snitch 上移植过来的。而 Little Snitch 是专门为 Mac OS 设计的一款应用程序防火墙。OpenSnitch 是由 [Simone Margaritelli][3] 设计,也称为 [evilsocket][4]。
|
||||||
|
|
||||||
|
OpenSnitch 所做的主要事情就是跟踪你机器上安装的应用程序所发起的互联网请求。OpenSnitch 允许你去创建规则以同意或阻止那个应用程序发起的互联网访问。当一个应用程序尝试去访问互联网而没有相应的访问规则存在时,就会出现一个对话框,这个对话框让你去选择允许还是阻止那个连接。
|
||||||
|
|
||||||
|
你也可以决定这个新规则是应用到进程上、精确的 URL 上、域名上、单个实例上,以及本次会话还是永久有效。
|
||||||
|
|
||||||
|
![OpenSnitch firewall app in Linux][5]OpenSnatch 规则请求
|
||||||
|
|
||||||
|
你创建的所有规则都保存为 [JSON 文件][6],如果以后需要修改它,就可以去修改这个文件。比如说,你错误地阻止了一个应用程序。
|
||||||
|
|
||||||
|
OpenSnitch 也有一个漂亮的、一目了然的图形用户界面:
|
||||||
|
|
||||||
|
* 是什么应用程序访问 web
|
||||||
|
* 它们使用哪个 IP 地址
|
||||||
|
* 属主用户是谁
|
||||||
|
* 使用哪个端口
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
如果你愿意,也可以将这些信息导出到一个 CSV 文件中。
|
||||||
|
|
||||||
|
OpenSnitch 遵循 GPL v3 许可证使用。
|
||||||
|
|
||||||
|
![OpenSnitch firewall interface][7]OpenSnitch 进程标签页
|
||||||
|
|
||||||
|
### 在 Linux 中安装 OpenSnitch
|
||||||
|
|
||||||
|
[OpenSnitch GitHub 页面][8] 上的安装介绍是针对 Ubuntu 用户的。如果你使用的是其它发行版,你需要调整一下相关的命令。据我所知,这个应用程序仅打包到 [Arch User Repository][9] 中。
|
||||||
|
|
||||||
|
在你开始之前,你必须正确安装了 Go,并且已经定义好了 `$GOPATH` 环境变量。
|
||||||
|
|
||||||
|
首先,安装必需的依赖。
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt-get install protobuf-compiler libpcap-dev libnetfilter-queue-dev python3-pip
|
||||||
|
|
||||||
|
go get github.com/golang/protobuf/protoc-gen-go
|
||||||
|
|
||||||
|
go get -u github.com/golang/dep/cmd/dep
|
||||||
|
|
||||||
|
python3 -m pip install --user grpcio-tools
|
||||||
|
```
|
||||||
|
|
||||||
|
接下来,克隆 OpenSnitch 仓库。这里可能会出现一个没有 Go 文件的信息,不用理它。如果出现 git 没有找到的信息,那么你需要首先去安装 Git。
|
||||||
|
|
||||||
|
```
|
||||||
|
go get github.com/evilsocket/opensnitch
|
||||||
|
|
||||||
|
cd $GOPATH/src/github.com/evilsocket/opensnitch
|
||||||
|
```
|
||||||
|
|
||||||
|
如果没有正确设置 `$GOPATH` 环境变量,运行上面的命令时将会出现一个 “no such folder found” 的错误信息。只需要进入到你刚才克隆仓库位置的 “evilsocket/opensnitch” 文件夹中即可。
|
||||||
|
|
||||||
|
现在,我们构建并安装它。
|
||||||
|
|
||||||
|
```
|
||||||
|
make
|
||||||
|
|
||||||
|
sudo make install
|
||||||
|
```
|
||||||
|
|
||||||
|
如果出现 “`dep` command could not be found” 的错误信息,在 `PATH` 中添加 `GOPATH/bin` 即可。
|
||||||
|
|
||||||
|
安装完成后,我们将要启动它的守护程序和图形用户界面。
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo systemctl enable opensnitchd
|
||||||
|
|
||||||
|
sudo service opensnitchd start
|
||||||
|
|
||||||
|
opensnitch-ui
|
||||||
|
```
|
||||||
|
|
||||||
|
![OpenSnitch firewall interface][10]
|
||||||
|
运行在 Manjaro 上的 OpenSnitch
|
||||||
|
|
||||||
|
### 使用体验
|
||||||
|
|
||||||
|
实话实说:我使用 OpenSnitch 的体验并不好。我开始在 Fedora 上尝试安装它。遇到了许多依赖问题。我又转到 Manjaro 上,在 Arch User Repository 上我很容易地找到了这些依赖。
|
||||||
|
|
||||||
|
不幸的是,我安装之后,不能启动图形用户界面。因此,我手动去运行最后三个步骤。一切似乎很顺利。如果我想让 Firefox 去访问 Manjaro 的网站,对话框就会弹出来询问我。
|
||||||
|
|
||||||
|
有趣的是,当我运行一个 [AUR 工具][11] `yay` 去更新我的系统时,弹出对话框要求了 `yay`、`pacman`、`pamac`、和 `git` 的访问规则。后来,我关闭并重启动 GUI,因为它是活动的。当我重启动它时,它不再要求我去创建规则了。我安装了 Falkon,而 OpenSnitch 并没有询问我去授予它任何权限。它甚至在 OpenSnitch 的 GUI 中没有列出 Falkon。我重新安装了 OpenSnitch 后,这个问题依旧存在。
|
||||||
|
|
||||||
|
然后,我转到 Ubuntu Mate 上安装 OpenSnitch,因为安装介绍就是针对 Ubuntu 所写的,进展很顺利。但是,我遇到了几个问题。我调整了一下上面介绍的安装过程以解决我遇到的问题。
|
||||||
|
|
||||||
|
安装的问题并不是我遇到的唯一问题。每次一个新的应用程序创建一个连接时弹出的对话框仅存在 10 秒钟。这么短的时间根本不够去浏览所有的可用选项。大多数情况下,这点时间只够我去永久允许一个(我信任的)应用程序访问 web。
|
||||||
|
|
||||||
|
GUI 也有一点需要去改进。由于某些原因,每次窗口都被放在顶部。而且不能通过设置来修改这个问题。如果能够从 GUI 中改变规则将是一个不错的选择。
|
||||||
|
|
||||||
|
![][12]OpenSnitch 的 hosts 标签
|
||||||
|
|
||||||
|
### 对 OpenSnitch 的最后意见
|
||||||
|
|
||||||
|
我很喜欢 OpenSnitch 的目标:用任何简单的方式控制离开你的计算机的信息。但是,它还很粗糙,我不能将它推荐给普通或业余用户。如果你是一个高级用户,很乐意去摆弄或挖掘这些问题,那么它可能很适合你。
|
||||||
|
|
||||||
|
这有点令人失望。我希望即将到来的 1.0 版本能够做的更好。
|
||||||
|
|
||||||
|
你以前用过 OpenSnitch 吗?如果没有,你最喜欢的防火墙应用是什么?你是如何保护你的 Linux 系统的?在下面的评论区告诉我们吧。
|
||||||
|
|
||||||
|
如果你对本文感兴趣,请花一点时间将它分享到社交媒体上吧,Hacker News 或 [Reddit][13] 都行。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/opensnitch-firewall-linux/
|
||||||
|
|
||||||
|
作者:[John Paul][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[qhwdw](https://github.com/qhwdw)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://itsfoss.com/author/john/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/linux-firewall-security.jpg?fit=800%2C450&ssl=1
|
||||||
|
[2]: https://www.opensnitch.io/
|
||||||
|
[3]: https://github.com/evilsocket
|
||||||
|
[4]: https://twitter.com/evilsocket
|
||||||
|
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/11/opensnitch-dialog.jpg?fit=800%2C421&ssl=1
|
||||||
|
[6]: https://www.json.org/
|
||||||
|
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/11/opensnitch-processes.jpg?fit=800%2C651&ssl=1
|
||||||
|
[8]: https://github.com/evilsocket/opensnitch
|
||||||
|
[9]: https://aur.archlinux.org/packages/opensnitch-git
|
||||||
|
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/opensnitch-manjaro.jpg?fit=800%2C651&ssl=1
|
||||||
|
[11]: https://itsfoss.com/best-aur-helpers/
|
||||||
|
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/11/opensnitch-hosts.jpg?fit=800%2C651&ssl=1
|
||||||
|
[13]: http://reddit.com/r/linuxusersgroup
|
Loading…
Reference in New Issue
Block a user