diff --git a/published/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md b/published/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md new file mode 100644 index 0000000000..eb5c8998cd --- /dev/null +++ b/published/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md @@ -0,0 +1,96 @@ +8 个在 KDE Plasma 桌面环境下提高生产力的技巧和提示 +====== + +![](https://www.maketecheasier.com/assets/uploads/2018/01/kde-plasma-desktop-featured.jpg) + +众所周知,KDE 的 Plasma 是 Linux 下最强大的桌面环境之一。它是高度可定制的,并且看起来也很棒。当你完成所有的配置工作后,你才能体会到它的所有特性。 + +你能够轻松地配置 Plasma 桌面并且使用它大量方便且节省时间的特性来加速你的工作,拥有一个能够帮助你而非阻碍你的桌面环境。 + +以下这些提示并没有特定顺序,因此你无需按次序阅读。你只需要挑出最适合你的工作流的那几个即可。 + +**相关阅读**:[10 个你应该尝试的最佳 KDE Plasma 应用][1] + +### 1、多媒体控制 + +这点不太算得上是一条提示,因为它是很容易被记在脑海里的。Plasma 可在各处进行多媒体控制。当你需要暂停、继续或跳过一首歌时,你不需要每次都打开你的媒体播放器。你能够通过将鼠标移至那个最小化窗口之上,甚至通过锁屏进行控制。当你需要切换歌曲或忘了暂停时,你也不必麻烦地登录再进行操作。 + +### 2、KRunner + +![KDE Plasma KRunner][2] + +KRunner 是 Plasma 桌面中一个经常受到赞誉的特性。大部分人习惯于穿过层层的应用启动菜单来找到想要启动的程序。当你使用 KRunner 时就不需要这么做。 + +为了使用 KRunner,确保你当前的活动焦点在桌面本身(点击桌面而不是窗口)。然后开始输入你想要启动的应用名称,KRunner 将会带着建议项从你的屏幕顶部自动下拉。在你寻找的匹配项上点击或敲击回车键。这比记住你每个应用所属的类别要更快。 + +### 3、跳转列表 + +![KDE Plasma 的跳转列表][3] + +跳转列表功能是最近才被添加进 Plasma 桌面的。它允许你在启动应用时直接跳转至特定的区域或特性部分。 + +因此如果你在菜单栏上有一个应用启动图标,你可以通过右键得到可跳转位置的列表。选择你想要跳转的位置,然后就可以“起飞”了。 + +### 4、KDE Connect + +![KDE Connect Android 客户端菜单][4] + +如果你有一个安卓手机,那么 [KDE Connect][5] 会为你提供大量帮助。它可以将你的手机连接至你的桌面,由此你可以在两台设备间无缝地共享。 + +通过 KDE Connect,你能够在你的桌面上实时地查看 [Android 设备通知][6]。它同时也让你能够从 Plasma 中收发文字信息,甚至不需要拿起你的手机。 + +KDE Connect 也允许你在手机和电脑间发送文件或共享网页。你可以轻松地从一个设备转移至另一设备,而无需烦恼或打乱思绪。 + +### 5、Plasma Vaults + +![KDE Plasma Vault][7] + +Plasma Vaults 是 Plasma 桌面的另一个新功能。它的 KDE 为加密文件和文件夹提供的简单解决方案。如果你不使用加密文件,此项功能不会为你节省时间。如果你使用,Vaults 是一个更简单的途径。 + +Plasma Vaults 允许你以无 root 权限的普通用户创建加密目录,并通过你的任务栏来管理它们。你能够快速地挂载或卸载目录,而无需外部程序或附加权限。 + +### 6、Pager 控件 + +![KDE Plasma Pager][8] + +配置你的桌面的 pager 控件。它允许你轻松地切换至另三个附加工作区,带来更大的屏幕空间。 + +将控件添加到你的菜单栏上,然后你就可以在多个工作区间滑动切换。每个工作区都与你原桌面的尺寸相同,因此你能够得到数倍于完整屏幕的空间。这就使你能够排布更多的窗口,而不必受到一堆混乱的最小化窗口的困扰。 + +### 7、创建一个 Dock + +![KDE Plasma Dock][9] + +Plasma 以其灵活性和可配置性出名,同时也是它的优势。如果你有常用的程序,你可以考虑将常用程序设置为 OS X 风格的 dock。你能够通过单击启动,而不必深入菜单或输入它们的名字。 + +### 8、为 Dolphin 添加文件树 + +![Plasma Dolphin 目录][10] + +通过目录树来浏览文件夹会更加简单。Dolphin 作为 Plasma 的默认文件管理器,具有在文件夹窗口一侧,以树的形式展示目录列表的内置功能。 + +为了启用目录树,点击“控制”标签,然后“配置 Dolphin”、“显示模式”、“详细”,最后选择“可展开文件夹”。 + +记住这些仅仅是提示,不要强迫自己做阻碍自己的事情。你可能讨厌在 Dolphin 中使用文件树,你也可能从不使用 Pager,这都没关系。当然也可能会有你喜欢但是此处没列举出来的功能。选择对你有用处的,也就是说,这些技巧中总有一些能帮助你度过日常工作中的艰难时刻。 + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/kde-plasma-tips-tricks-improve-productivity/ + +作者:[Nick Congleton][a] +译者:[cycoe](https://github.com/cycoe) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.maketecheasier.com/author/nickcongleton/ +[1]:https://www.maketecheasier.com/10-best-kde-plasma-applications/ (10 of the Best KDE Plasma Applications You Should Try) +[2]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-krunner.jpg (KDE Plasma KRunner) +[3]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-jumplist.jpg (KDE Plasma Jump Lists) +[4]:https://www.maketecheasier.com/assets/uploads/2017/05/kde-connect-menu-e1494899929112.jpg (KDE Connect Menu Android) +[5]:https://www.maketecheasier.com/send-receive-sms-linux-kde-connect/ +[6]:https://www.maketecheasier.com/android-notifications-ubuntu-kde-connect/ +[7]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-vault.jpg (KDE Plasma Vault) +[8]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-pager.jpg (KDE Plasma Pager) +[9]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-dock.jpg (KDE Plasma Dock) +[10]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-dolphin.jpg (Plasma Dolphin Directory) diff --git a/published/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md b/published/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md new file mode 100644 index 0000000000..fa65d2cdfa --- /dev/null +++ b/published/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md @@ -0,0 +1,124 @@ +Qalculate! :全宇宙最好的计算器软件 +====== + +十多年来,我一直都是 GNU-Linux 以及 [Debian][1] 的用户。随着我越来越频繁的使用桌面环境,我发现对我来说除了少数基于 web 的服务以外我的大多数需求都可以通过 Debian 软件库里自带的[桌面应用][2]解决。 + +我的需求之一就是进行单位换算。尽管有很多很多在线服务可以做这件事,但是我还是需要一个可以在桌面环境使用的应用。这主要是因为隐私问题以及我不想一而再再而三的寻找在线服务做事。为此我搜寻良久,直到找到 Qalculate!。 + +### Qalculate! 最强多功能计算器应用 + +![最佳计算器应用 Qalculator][3] + +这是 aptitude 上关于 [Qalculate!][4] 的介绍,我没法总结的比他们更好了: + +> 强大易用的桌面计算器 - GTK+ 版 +> +> Qalculate! 是一款外表简单易用,内核强大且功能丰富的应用。其功能包含自定义函数、单位、高计算精度、作图以及可以输入一行表达式(有容错措施)的图形界面(也可以选择使用传统按钮)。 + +这款应用也发行过 KDE 的界面,但是至少在 Debian Testing 软件库里,只出现了 GTK+ 版的界面,你也可以在 GitHub 上的这个[仓库][5]里面看到。 + +不必多说,Qalculate! 在 Debian 的软件源内处于可用状态,因此可以使用 [apt][6] 命令或者是基于 Debian 的发行版比如 Ubuntu 提供的软件中心轻松安装。在 Windows 或者 macOS 上也可以使用这款软件。 + +#### Qalculate! 特性一览 + +列出全部的功能清单会有点长,请允许我只列出一部分功能并使用截图来展示极少数 Qalculate! 提供的功能。这么做是为了让你熟悉 Qalculate! 的基本功能,并在之后可以自由探索 Qalculate! 到底还能干什么。 + +* 代数 +* 微积分 +* 组合数学 +* 复数 +* 数据集 +* 日期与时间 +* 经济学 +* 对数和指数 +* 几何 +* 逻辑学 +* 向量和矩阵 +* 杂项 +* 数论 +* 统计学 +* 三角学 + +#### 使用 Qalculate! + +Qalculate! 的使用不是很难。你甚至可以在里面写简单的英文。但是我还是推荐先[阅读手册][7]以便充分发挥 Qalculate! 的潜能。 + +![使用 Qalculate 进行字节到 GB 的换算][8] + +![摄氏度到华氏度的换算][9] + +#### qalc 是 Qalculate! 的命令行版 + +你也可以使用 Qalculate! 的命令行版 `qalc`: + +``` +$ qalc 62499836 byte to gibibyte +62499836 * byte = approx. 0.058207508 gibibyte + +$ qalc 40 degree celsius to fahrenheit +(40 * degree) * celsius = 104 deg*oF +``` + +Qalculate! 的命令行界面可以让不喜欢 GUI 而是喜欢命令行界面(CLI)或者是使用无头结点(没有 GUI)的人可以使用 Qalculate!。这些人大多是在服务器环境下工作。 + +如果你想要在脚本里使用这一软件的话,我想 libqalculate 是最好的解决方案。看一看 `qalc` 以及 qalculate-gtk 是如何依赖于它工作的就足以知晓如何使用了。 + +再提一嘴,你还可以了解下如何根据一系列数据绘图,其他应用方式就留给你自己发掘了。不要忘记查看 `/usr/share/doc/qalculate/index.html` 以获取 Qalculate! 的全部功能。 + +注释:注意 Debian 更喜欢 [gnuplot][10],因为其输出的图片很精美。 + +#### 附加技巧:你可以通过在 Debian 下通过命令行感谢开发者 + +如果你使用 Debian 而且喜欢哪个包的话,你可以使用如下命令感谢 Debian 下这个软件包的开发者或者是维护者: + +``` +reportbug --kudos $PACKAGENAME +``` + +因为我喜欢 Qalculate!,我想要对 Debian 的开发者以及维护者 Vincent Legout 的卓越工作表示感谢: + +``` +reportbug --kudos qalculate +``` + +建议各位阅读我写的关于如何使用报错工具[在 Debian 中上报 BUG][11]的详细指南。 + +#### 一位高分子化学家对 Qalculate! 的评价 + +经由作者 [Philip Prado][12],我们联系上了 Timothy Meyers 先生,他目前是在高分子实验室工作的高分子化学家。 + +他对 Qaclulate! 的专业评价是: + +> 看起来几乎任何科学家都可以使用这个软件,因为如果你知道指令以及如何使其生效的话,几乎任何数据计算都可以使用这个软件计算。 + +> 我觉得这个软件少了些物理常数,但我想不起来缺了哪些。我觉得它没有太多有关[流体动力学][13]的东西,再就是少了点部分化合物的[光吸收][14]系数,但这些东西只对我这个化学家来说比较重要,我不知道这些是不是对别人来说也是特别必要的。[自由能][15]可能也是。 + +最后,我分享的关于 Qalculate! 的介绍十分简陋,其实际功能与你的需要以及你的想象力有关系。希望你能喜欢 Qalculate! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/qalculate/ + +作者:[Shirish][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[name1e5s](https://github.com/name1e5s) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://itsfoss.com/author/shirish/ +[1]:https://www.debian.org/ +[2]:https://itsfoss.com/essential-linux-applications/ +[3]:https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/05/qalculate-app-featured-1.jpeg?w=800&ssl=1 +[4]:https://qalculate.github.io/ +[5]:https://github.com/Qalculate +[6]:https://itsfoss.com/apt-command-guide/ +[7]:https://qalculate.github.io/manual/index.html +[8]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/04/qalculate-byte-conversion.png?zoom=2&ssl=1 +[9]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/04/qalculate-gtk-weather-conversion.png?zoom=2&ssl=1 +[10]:http://www.gnuplot.info/ +[11]:https://itsfoss.com/bug-report-debian/ +[12]:https://itsfoss.com/author/phillip/ +[13]:https://en.wikipedia.org/wiki/Fluid_dynamics +[14]:https://en.wikipedia.org/wiki/Absorption_(electromagnetic_radiation) +[15]:https://en.wikipedia.org/wiki/Gibbs_free_energy diff --git a/published/20190103 How to use Magit to manage Git projects.md b/published/20190103 How to use Magit to manage Git projects.md new file mode 100644 index 0000000000..f9370ca14e --- /dev/null +++ b/published/20190103 How to use Magit to manage Git projects.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10564-1.html) +[#]: subject: (How to use Magit to manage Git projects) +[#]: via: (https://opensource.com/article/19/1/how-use-magit) +[#]: author: (Sachin Patil https://opensource.com/users/psachin) + +如何在 Emacs 中使用 Magit 管理 Git 项目 +====== + +> Emacs 的 Magit 扩展插件使得使用 Git 进行版本控制变得简单起来。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e-) + +[Git][1] 是一个很棒的用于项目管理的 [版本控制][2] 工具,就是新人学习起来太难。Git 的命令行工具很难用,你不仅需要熟悉它的标志和选项,还需要知道什么环境下使用它们。这使人望而生畏,因此不少人只会非常有限的几个用法。 + +好在,现今大多数的集成开发环境 (IDE) 都包含了 Git 扩展,大大地简化了使用使用的难度。Emacs 中就有这么一款 Git 扩展名叫 [Magit][3]。 + +Magit 项目成立有差不多 10 年了,它将自己定义为 “一件 Emacs 内的 Git 瓷器”。也就是说,它是一个操作界面,每个操作都能一键完成。本文会带你领略一下 Magit 的操作界面并告诉你如何使用它来管理 Git 项目。 + +若你还没有做,请在开始本教程之前先 [安装 Emacs][4],再 [安装 Magit][5]。 + +### Magit 的界面 + +首先用 Emacs 的 [Dired 模式][6] 访问一个项目的目录。比如我所有的 Emacs 配置存储在 `~/.emacs.d/` 目录中,就是用 Git 来进行管理的。 + +![](https://opensource.com/sites/default/files/uploads/visiting_a_git_project.png) + +若你在命令行下工作,则你需要输入 `git status` 来查看项目的当前状态。Magit 也有类似的功能:`magit-status`。你可以通过 `M-x magit-status` (快捷方式是 `Alt+x magit-status` )来调用该功能。结果看起来像下面这样: + +![](https://opensource.com/sites/default/files/uploads/magit_status.png) + +Magit 显示的信息比 `git status` 命令的要多得多。它分别列出了未追踪文件列表、未暂存文件列表以及已暂存文件列表。它还列出了储藏stash列表以及最近几次的提交 —— 所有这些信息都在一个窗口中展示。 + +如果你想查看修改了哪些内容,按下 `Tab` 键。比如,我移动光标到未暂存的文件 `custom_functions.org` 上,然后按下 `Tab` 键,Magit 会显示修改了哪些内容: + +![](https://opensource.com/sites/default/files/uploads/show_unstaged_content.png) + +这跟运行命令 `git diff custom_functions.org` 类似。储藏文件更简单。只需要移动光标到文件上然后按下 `s` 键。该文件就会迅速移动到已储藏文件列表中: + +![](https://opensource.com/sites/default/files/uploads/staging_a_file.png) + +要反储藏unstage某个文件,使用 `u` 键。按下 `s` 和 `u` 键要比在命令行输入 `git add -u ` 和 `git reset HEAD ` 快的多也更有趣的多。 + +### 提交更改 + +在同一个 Magit 窗口中,按下 `c` 键会显示一个提交窗口,其中提供了许多标志,比如 `--all` 用来暂存所有文件或者 `--signoff` 来往提交信息中添加签名行。 + +![](https://opensource.com/sites/default/files/uploads/magit_commit_popup.png) + +将光标移动到想要启用签名标志的行,然后按下回车。`--signoff` 文本会变成高亮,这说明该标志已经被启用。 + +![](https://opensource.com/sites/default/files/uploads/magit_signoff_commit.png) + +再次按下 `c` 键会显示一个窗口供你输入提交信息。 + +![](https://opensource.com/sites/default/files/uploads/magit_commit_message.png) + +最后,使用 `C-c C-c `(按键 `Ctrl+cc` 的缩写形式) 来提交更改。 + +![](https://opensource.com/sites/default/files/uploads/magit_commit_message_2.png) + +### 推送更改 + +更改提交后,提交行将会显示在 `Recent commits` 区域中显示。 + +![](https://opensource.com/sites/default/files/uploads/magit_commit_log.png) + +将光标放到该提交处然后按下 `p` 来推送该变更。 + +若你想感受一下使用 Magit 的感觉,我已经在 YouTube 上传了一段 [演示][7]。本文只涉及到 Magit 的一点皮毛。它有许多超酷的功能可以帮你使用 Git 分支、变基等功能。你可以在 Magit 的主页上找到 [文档、支持,以及更多][8] 的链接。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/how-use-magit + +作者:[Sachin Patil][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/psachin +[b]: https://github.com/lujun9972 +[1]: https://git-scm.com +[2]: https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control +[3]: https://magit.vc +[4]: https://www.gnu.org/software/emacs/download.html +[5]: https://magit.vc/manual/magit/Installing-from-Melpa.html#Installing-from-Melpa +[6]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired-Enter.html#Dired-Enter +[7]: https://youtu.be/Vvw75Pqp7Mc +[8]: https://magit.vc/ diff --git a/translated/tech/20190110 5 useful Vim plugins for developers.md b/published/20190110 5 useful Vim plugins for developers.md similarity index 75% rename from translated/tech/20190110 5 useful Vim plugins for developers.md rename to published/20190110 5 useful Vim plugins for developers.md index 95d73b5ec2..f405baa6ab 100644 --- a/translated/tech/20190110 5 useful Vim plugins for developers.md +++ b/published/20190110 5 useful Vim plugins for developers.md @@ -1,28 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (pityonline) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10563-1.html) [#]: subject: (5 useful Vim plugins for developers) [#]: via: (https://opensource.com/article/19/1/vim-plugins-developers) [#]: author: (Ricardo Gerardi https://opensource.com/users/rgerardi) -5 个好用的 Vim 插件 +5 个好用的开发者 Vim 插件 ====== -通过这 5 个插件扩展 Vim 功能来提升你的编码效率。 +> 通过这 5 个插件扩展 Vim 功能来提升你的编码效率。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) -我用 Vim 已经超过 20 年了,两年前我决定把它作为我的首要文本编辑器。我用 Vim 来编写代码,配置文件,博客文章及其它任意可以用纯文本表达的东西。Vim 有很多超级棒的功能,一旦你适合了它,你的工作会变得非常高效。 +我用 Vim 已经超过 20 年了,两年前我决定把它作为我的首要文本编辑器。我用 Vim 来编写代码、配置文件、博客文章及其它任意可以用纯文本表达的东西。Vim 有很多超级棒的功能,一旦你适合了它,你的工作会变得非常高效。 -在日常编辑工作中,我更倾向于使用 Vim 稳定的原生扩展,但开源社区对 Vim 开发了大量可以提升工作效率的插件。 +在日常编辑工作中,我更倾向于使用 Vim 稳定的原生功能,但开源社区对 Vim 开发了大量的插件,可以扩展 Vim 的功能、改进你的工作流程和提升工作效率。 以下列举 5 个非常好用的可以用于编写任意编程语言的插件。 -### 1. Auto Pairs +### 1、Auto Pairs -[Auto Pairs][2] 插件可以帮助你插入和删除成对的文字,如花括号,圆括号或引用标记。这在编写代码时非常有用,因为很多编程语言都有成对标记的语法,就像圆括号用于函数调用,或引号用于字符串定义。 +[Auto Pairs][2] 插件可以帮助你插入和删除成对的文字,如花括号、圆括号或引号。这在编写代码时非常有用,因为很多编程语言都有成对标记的语法,就像圆括号用于函数调用,或引号用于字符串定义。 Auto Pairs 最基本的功能是在你输入一个左括号时会自动补全对应的另一半括号。比如,你输入了一个 `[`,它会自动帮你补充另一半 `]`。相反,如果你用退格键删除开头的一半括号,Auto Pairs 会删除另一半。 @@ -39,9 +39,9 @@ func main() { x := true items := []string{"tv", "pc", "tablet"} - if x { + if x { for _, i := range items - } + } } ``` @@ -57,7 +57,7 @@ func main() { items := []string{"tv", "pc", "tablet"} if x { - for _, i := range items { + for _, i := range items { | (cursor here) } } @@ -66,17 +66,17 @@ func main() { Auto Pairs 提供了大量其它选项(你可以在 [GitHub][3] 上找到),但最基本的功能已经很让人省时间了。 -### 2. NERD Commenter +### 2、NERD Commenter -[NERD Commenter][4] 插件增加了方便注释的功能,类似在 IDEintegrated development environment 中注释功能。有了这个插件,你可以一键注释单行或多行代码。 +[NERD Commenter][4] 插件给 Vim 增加了代码注释的功能,类似在 IDEintegrated development environment 中注释功能。有了这个插件,你可以一键注释单行或多行代码。 -NERD Commenter 使用了标准的 Vim [filetype][5],所以它能理解一些编程语言并使用合适的方式来注释代码。 +NERD Commenter 可以与标准的 Vim [filetype][5] 插件配合,所以它能理解一些编程语言并使用合适的方式来注释代码。 -最易上手的方法是按 `Leader+Space` 组合键来开关当前行的注释。Vim 默认的 Leader 键是 `\`。 +最易上手的方法是按 `Leader+Space` 组合键来切换注释当前行。Vim 默认的 Leader 键是 `\`。 在可视化模式Visual mode中,你可以选择多行一并注释。NERD Commenter 也可以按计数注释,所以你可以加个数量 n 来注释 n 行。 -还有个有用的特性 Sexy Comment 可以用 `Leader+cs` 来触发,它的块注释风格更漂亮一些。例如下面这段代码: +还有个有用的特性 “Sexy Comment” 可以用 `Leader+cs` 来触发,它的块注释风格更漂亮一些。例如下面这段代码: ``` package main @@ -85,13 +85,13 @@ import "fmt" func main() { x := true -    items := []string{"tv", "pc", "tablet"} + items := []string{"tv", "pc", "tablet"} -    if x { -        for _, i := range items { -            fmt.Println(i) -        } -    } + if x { + for _, i := range items { + fmt.Println(i) + } + } } ``` @@ -104,15 +104,15 @@ import "fmt" func main() { /* - *    x := true - *    items := []string{"tv", "pc", "tablet"} - * - *    if x { - *        for _, i := range items { - *            fmt.Println(i) - *        } - *    } - */ + * x := true + * items := []string{"tv", "pc", "tablet"} + * + * if x { + * for _, i := range items { + * fmt.Println(i) + * } + * } + */ } ``` @@ -120,9 +120,9 @@ func main() { NERD Commenter 是任何使用 Vim 写代码的开发者都必装的插件。 -### 3. VIM Surround +### 3、VIM Surround -[Vim Surround][6] 插件可以帮你在现有文本中实现环绕插入成对的符号(如括号或双引号)或标签(如 HTML 或 XML 标签)。它和 Auto Pairs 有点儿类似,但在编辑文本时更有用。 +[Vim Surround][6] 插件可以帮你“环绕”现有文本插入成对的符号(如括号或双引号)或标签(如 HTML 或 XML 标签)。它和 Auto Pairs 有点儿类似,但是用于处理已有文本,在编辑文本时更有用。 比如你有以下一个句子: @@ -130,7 +130,7 @@ NERD Commenter 是任何使用 Vim 写代码的开发者都必装的插件。 "Vim plugins are awesome !" ``` -当你的光标处理句中任何位置时,你可以用 `ds"` 组合键删除句子两端的双引号。 +当你的光标处于引起来的句中任何位置时,你可以用 `ds"` 组合键删除句子两端的双引号。 ``` Vim plugins are awesome ! @@ -142,7 +142,7 @@ Vim plugins are awesome ! 'Vim plugins are awesome !' ``` -或者用 `cs'[` 替换成中括号: +或者再用 `cs'[` 替换成中括号: ``` [ Vim plugins are awesome ! ] @@ -154,7 +154,7 @@ Vim plugins are awesome !

Vim plugins are awesome !

``` -当光标在 awesome 这个单词的任何位置时,你可以按 `ysiw ` 直接给它加上着重标签: +当光标在 “awesome” 这个单词的任何位置时,你可以按 `ysiw` 直接给它加上着重标签(``): ```

Vim plugins are awesome !

@@ -162,13 +162,13 @@ Vim plugins are awesome ! 注意它聪明地加上了 `
` 闭合标签。 -Vim Surround 也可以用 `ySS` 缩进文本。比如你有以下文本: +Vim Surround 也可以用 `ySS` 缩进文本并加上标签。比如你有以下文本: ```

Vim plugins are awesome !

``` -你可以用 `ySS
` 加上 `div` 标签,注意生成的段落是自动缩进的。 +你可以用 `ySS
` 加上 `div` 标签,注意生成的段落是自动缩进的。 ```
@@ -178,9 +178,9 @@ Vim Surround 也可以用 `ySS` 缩进文本。比如你有以下文本: Vim Surround 有很多其它选项,你可以参照 [GitHub][7] 上的说明尝试它们。 -### 4. Vim Gitgutter +### 4、Vim Gitgutter -[Vim Gitgutter][8] 插件对使用 Git 作为版本控制工具的人来说非常有用。它会在 Vim 显示行号的列旁 `git diff` 的差异标记。假设你有如下已提交过的代码: +[Vim Gitgutter][8] 插件对使用 Git 作为版本控制工具的人来说非常有用。它会在 Vim 的行号列旁显示 `git diff` 的差异标记。假设你有如下已提交过的代码: ```   1 package main @@ -218,15 +218,15 @@ _   5 func main() {    14 } ``` -`-` 标记表示在第 5 行和第 6 行之间删除了一行。`~` 表示第 8 行有修改,`+` 表示新增了第 11 行。 +`_` 标记表示在第 5 行和第 6 行之间删除了一行。`~` 表示第 8 行有修改,`+` 表示新增了第 11 行。 另外,Vim Gitgutter 允许你用 `[c` 和 `]c` 在多个有修改的块之间跳转,甚至可以用 `Leader+hs` 来暂存某个变更集。 这个插件提供了对变更的即时视觉反馈,如果你用 Git 的话,有了它简直是如虎添翼。 -### 5. VIM Fugitive +### 5、VIM Fugitive -[Vim Fugitive][9] 是另一个超棒的将 Git 工作流集成到 Vim 中的插件。它对 Git 做了一些封装,可以让你在 Vim 里直接执行 Git 命令并将结果集成在 Vim 界面里。这个插件有超多的特性,更多信息请访问它的 [GitHub][10] 项目页面。 +[Vim Fugitive][9] 是另一个将 Git 工作流集成到 Vim 中的超棒插件。它对 Git 做了一些封装,可以让你在 Vim 里直接执行 Git 命令并将结果集成在 Vim 界面里。这个插件有超多的特性,更多信息请访问它的 [GitHub][10] 项目页面。 这里有一个使用 Vim Fugitive 的基础 Git 工作流示例。设想我们已经对下面的 Go 代码做出修改,你可以用 `:Gblame` 调用 `git blame` 来查看每行最后的提交信息: @@ -277,7 +277,7 @@ _   5 func main() {    14 } ``` -Vim Fugitive 在分割的窗口里显示 `git status` 的输出结果。你可以在某文件名所在的行用 `-` 键暂存这个文件,再按一次 `-` 可以取消暂存。这个信息会随着你的操作自动更新: +Vim Fugitive 在分割的窗口里显示 `git status` 的输出结果。你可以在该行按下 `-` 键用该文件的名字暂存这个文件的提交,再按一次 `-` 可以取消暂存。这个信息会随着你的操作自动更新: ```   1 # On branch master @@ -342,7 +342,7 @@ Vim Fugitive 的 GitHub 项目主页有很多屏幕录像展示了它的更多 ### 接下来? -这些 Vim 插件都是程序开发者的神器!还有其它几类开发者常用的插件:自动完成插件和语法检查插件。它些大都是和具体的编程语言相关的,以后我会在一些文章中介绍它们。 +这些 Vim 插件都是程序开发者的神器!还有另外两类开发者常用的插件:自动完成插件和语法检查插件。它些大都是和具体的编程语言相关的,以后我会在一些文章中介绍它们。 你在写代码时是否用到一些其它 Vim 插件?请在评论区留言分享。 @@ -353,7 +353,7 @@ via: https://opensource.com/article/19/1/vim-plugins-developers 作者:[Ricardo Gerardi][a] 选题:[lujun9972][b] 译者:[pityonline](https://github.com/pityonline) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md b/published/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md new file mode 100644 index 0000000000..760c2ed1cf --- /dev/null +++ b/published/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md @@ -0,0 +1,230 @@ +[#]: collector: (lujun9972) +[#]: translator: (hopefully2333) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10568-1.html) +[#]: subject: (The Evil-Twin Framework: A tool for improving WiFi security) +[#]: via: (https://opensource.com/article/19/1/evil-twin-framework) +[#]: author: (André Esser https://opensource.com/users/andreesser) + +Evil-Twin 框架:一个用于提升 WiFi 安全性的工具 +====== + +> 了解一款用于对 WiFi 接入点安全进行渗透测试的工具。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-cloud-safe.png?itok=yj2TFPzq) + +越来越多的设备通过无线传输的方式连接到互联网,以及,大范围可用的 WiFi 接入点为攻击者攻击用户提供了很多机会。通过欺骗用户连接到[虚假的 WiFi 接入点][1],攻击者可以完全控制用户的网络连接,这将使得攻击者可以嗅探和篡改用户的数据包,将用户的连接重定向到一个恶意的网站,并通过网络发起其他的攻击。 + +为了保护用户并告诉他们如何避免线上的危险操作,安全审计人员和安全研究员必须评估用户的安全实践能力,用户常常在没有确认该 WiFi 接入点为安全的情况下就连接上了该网络,安全审计人员和研究员需要去了解这背后的原因。有很多工具都可以对 WiFi 的安全性进行审计,但是没有一款工具可以测试大量不同的攻击场景,也没有能和其他工具集成得很好的工具。 + +Evil-Twin Framework(ETF)用于解决 WiFi 审计过程中的这些问题。审计者能够使用 ETF 来集成多种工具并测试该 WiFi 在不同场景下的安全性。本文会介绍 ETF 的框架和功能,然后会提供一些案例来说明该如何使用这款工具。 + +### ETF 的架构 + +ETF 的框架是用 [Python][2] 写的,因为这门开发语言的代码非常易读,也方便其他开发者向这个项目贡献代码。除此之外,很多 ETF 的库,比如 [Scapy][3],都是为 Python 开发的,很容易就能将它们用于 ETF。 + +ETF 的架构(图 1)分为不同的彼此交互的模块。该框架的设置都写在一个单独的配置文件里。用户可以通过 `ConfigurationManager` 类里的用户界面来验证并修改这些配置。其他模块只能读取这些设置并根据这些设置进行运行。 + +![Evil-Twin Framework Architecture][5] + +*图 1:Evil-Twin 的框架架构* + +ETF 支持多种与框架交互的用户界面,当前的默认界面是一个交互式控制台界面,类似于 [Metasploit][6] 那种。正在开发用于桌面/浏览器使用的图形用户界面(GUI)和命令行界面(CLI),移动端界面也是未来的一个备选项。用户可以使用交互式控制台界面来修改配置文件里的设置(最终会使用 GUI)。用户界面可以与存在于这个框架里的每个模块进行交互。 + +WiFi 模块(AirCommunicator)用于支持多种 WiFi 功能和攻击类型。该框架确定了 Wi-Fi 通信的三个基本支柱:数据包嗅探、自定义数据包注入和创建接入点。三个主要的 WiFi 通信模块 AirScanner、AirInjector,和 AirHost,分别用于数据包嗅探、数据包注入,和接入点创建。这三个类被封装在主 WiFi 模块 AirCommunicator 中,AirCommunicator 在启动这些服务之前会先读取这些服务的配置文件。使用这些核心功能的一个或多个就可以构造任意类型的 WiFi 攻击。 + +要使用中间人(MITM)攻击(这是一种攻击 WiFi 客户端的常见手法),ETF 有一个叫做 ETFITM(Evil-Twin Framework-in-the-Middle)的集成模块,这个模块用于创建一个 web 代理,来拦截和修改经过的 HTTP/HTTPS 数据包。 + +许多其他的工具也可以利用 ETF 创建的 MITM。通过它的可扩展性,ETF 能够支持它们,而不必单独地调用它们,你可以通过扩展 Spawner 类来将这些工具添加到框架里。这使得开发者和安全审计人员可以使用框架里预先配置好的参数字符来调用程序。 + +扩展 ETF 的另一种方法就是通过插件。有两类插件:WiFi 插件和 MITM 插件。MITM 插件是在 MITM 代理运行时可以执行的脚本。代理会将 HTTP(s) 请求和响应传递给可以记录和处理它们的插件。WiFi 插件遵循一个更加复杂的执行流程,但仍然会给想参与开发并且使用自己插件的贡献者提供一个相对简单的 API。WiFi 插件还可以进一步地划分为三类,其中每个对应一个核心 WiFi 通信模块。 + +每个核心模块都有一些特定事件能触发响应的插件的执行。举个例子,AirScanner 有三个已定义的事件,可以对其响应进行编程处理。事件通常对应于服务开始运行之前的设置阶段、服务正在运行时的中间执行阶段、服务完成后的卸载或清理阶段。因为 Python 允许多重继承,所以一个插件可以继承多个插件类。 + +上面的图 1 是框架架构的摘要。从 ConfigurationManager 指出的箭头意味着模块会从中读取信息,指向它的箭头意味着模块会写入/修改配置。 + +### 使用 ETF 的例子 + +ETF 可以通过多种方式对 WiFi 的网络安全或者终端用户的 WiFi 安全意识进行渗透测试。下面的例子描述了这个框架的一些渗透测试功能,例如接入点和客户端检测、对使用 WPA 和 WEP 类型协议的接入点进行攻击,和创建 evil twin 接入点。 + +这些例子是使用 ETF 和允许进行 WiFi 数据捕获的 WiFi 卡设计的。它们也在 ETF 设置命令中使用了下面这些缩写: + + * **APS** Access Point SSID + * **APB** Access Point BSSID + * **APC** Access Point Channel + * **CM** Client MAC address + +在实际的测试场景中,确保你使用了正确的信息来替换这些缩写。 + +#### 在解除认证攻击后捕获 WPA 四次握手的数据包。 + +这个场景(图 2)做了两个方面的考虑:解除认证攻击de-authentication attack和捕获 WPA 四次握手数据包的可能性。这个场景从一个启用了 WPA/WPA2 的接入点开始,这个接入点有一个已经连上的客户端设备(在本例中是一台智能手机)。目的是通过常规的解除认证攻击(LCTT 译注:类似于 DoS 攻击)来让客户端断开和 WiFi 的网络,然后在客户端尝试重连的时候捕获 WPA 的握手包。重连会在断开连接后马上手动完成。 + +![Scenario for capturing a WPA handshake after a de-authentication attack][8] + +*图 2:在解除认证攻击后捕获 WPA 握手包的场景* + +在这个例子中需要考虑的是 ETF 的可靠性。目的是确认工具是否一直都能捕获 WPA 的握手数据包。每个工具都会用来多次复现这个场景,以此来检查它们在捕获 WPA 握手数据包时的可靠性。 + +使用 ETF 来捕获 WPA 握手数据包的方法不止一种。一种方法是使用 AirScanner 和 AirInjector 两个模块的组合;另一种方法是只使用 AirInjector。下面这个场景是使用了两个模块的组合。 + +ETF 启用了 AirScanner 模块并分析 IEEE 802.11 数据帧来发现 WPA 握手包。然后 AirInjecto 就可以使用解除认证攻击来强制客户端断开连接,以进行重连。必须在 ETF 上执行下面这些步骤才能完成上面的目标: + + 1. 进入 AirScanner 配置模式:`config airscanner` + 2. 设置 AirScanner 不跳信道:`config airscanner` + 3. 设置信道以嗅探经过 WiFi 接入点信道的数据(APC):`set fixed_sniffing_channel = ` + 4. 使用 CredentialSniffer 插件来启动 AirScanner 模块:`start airscanner with credentialsniffer` + 5. 从已嗅探的接入点列表中添加目标接入点的 BSSID(APS):`add aps where ssid = ` + 6. 启用 AirInjector 模块,在默认情况下,它会启用解除认证攻击:`start airinjector` + +这些简单的命令设置能让 ETF 在每次测试时执行成功且有效的解除认证攻击。ETF 也能在每次测试的时候捕获 WPA 的握手数据包。下面的代码能让我们看到 ETF 成功的执行情况。 + +``` +███████╗████████╗███████╗ +██╔════╝╚══██╔══╝██╔════╝ +█████╗     ██║   █████╗   +██╔══╝     ██║   ██╔══╝   +███████╗   ██║   ██║     +╚══════╝   ╚═╝   ╚═╝     +                                        + +[+] Do you want to load an older session? [Y/n]: n +[+] Creating new temporary session on 02/08/2018 +[+] Enter the desired session name: +ETF[etf/aircommunicator/]::> config airscanner +ETF[etf/aircommunicator/airscanner]::> listargs +  sniffing_interface =               wlan1; (var) +              probes =                True; (var) +             beacons =                True; (var) +        hop_channels =               false; (var) +fixed_sniffing_channel =                  11; (var) +ETF[etf/aircommunicator/airscanner]::> start airscanner with +arpreplayer        caffelatte         credentialsniffer  packetlogger       selfishwifi         +ETF[etf/aircommunicator/airscanner]::> start airscanner with credentialsniffer +[+] Successfully added credentialsniffer plugin. +[+] Starting packet sniffer on interface 'wlan1' +[+] Set fixed channel to 11 +ETF[etf/aircommunicator/airscanner]::> add aps where ssid = CrackWPA +ETF[etf/aircommunicator/airscanner]::> start airinjector +ETF[etf/aircommunicator/airscanner]::> [+] Starting deauthentication attack +                    - 1000 bursts of 1 packets +                    - 1 different packets +[+] Injection attacks finished executing. +[+] Starting post injection methods +[+] Post injection methods finished +[+] WPA Handshake found for client '70:3e:ac:bb:78:64' and network 'CrackWPA' +``` + +#### 使用 ARP 重放攻击并破解 WEP 无线网络 + +下面这个场景(图 3)将关注[地址解析协议][9](ARP)重放攻击的效率和捕获包含初始化向量(IVs)的 WEP 数据包的速度。相同的网络可能需要破解不同数量的捕获的 IVs,所以这个场景的 IVs 上限是 50000。如果这个网络在首次测试期间,还未捕获到 50000 IVs 就崩溃了,那么实际捕获到的 IVs 数量会成为这个网络在接下来的测试里的新的上限。我们使用 `aircrack-ng` 对数据包进行破解。 + +测试场景从一个使用 WEP 协议进行加密的 WiFi 接入点和一台知道其密钥的离线客户端设备开始 —— 为了测试方便,密钥使用了 12345,但它可以是更长且更复杂的密钥。一旦客户端连接到了 WEP 接入点,它会发送一个不必要的 ARP 数据包;这是要捕获和重放的数据包。一旦被捕获的包含 IVs 的数据包数量达到了设置的上限,测试就结束了。 + +![Scenario for capturing a WPA handshake after a de-authentication attack][11] + +*图 3:在进行解除认证攻击后捕获 WPA 握手包的场景* + +ETF 使用 Python 的 Scapy 库来进行包嗅探和包注入。为了最大限度地解决 Scapy 里的已知的性能问题,ETF 微调了一些低级库,来大大加快包注入的速度。对于这个特定的场景,ETF 为了更有效率地嗅探,使用了 `tcpdump` 作为后台进程而不是 Scapy,Scapy 用于识别加密的 ARP 数据包。 + +这个场景需要在 ETF 上执行下面这些命令和操作: + + 1. 进入 AirScanner 设置模式:`config airscanner` + 2. 设置 AirScanner 不跳信道:`set hop_channels = false` + 3. 设置信道以嗅探经过接入点信道的数据(APC):`set fixed_sniffing_channel = ` + 4. 进入 ARPReplayer 插件设置模式:`config arpreplayer` + 5. 设置 WEP 网络目标接入点的 BSSID(APB):`set target_ap_bssid ` + 6. 使用 ARPReplayer 插件启动 AirScanner 模块:`start airscanner with arpreplayer` + +在执行完这些命令后,ETF 会正确地识别加密的 ARP 数据包,然后成功执行 ARP 重放攻击,以此破坏这个网络。 + +#### 使用一款全能型蜜罐 + +图 4 中的场景使用相同的 SSID 创建了多个接入点,对于那些可以探测到但是无法接入的 WiFi 网络,这个技术可以发现网络的加密类型。通过启动具有所有安全设置的多个接入点,客户端会自动连接和本地缓存的接入点信息相匹配的接入点。 + +![Scenario for capturing a WPA handshake after a de-authentication attack][13] + +*图 4:在解除认证攻击后捕获 WPA 握手包数据。* + +使用 ETF,可以去设置 `hostapd` 配置文件,然后在后台启动该程序。`hostapd` 支持在一张无线网卡上通过设置虚拟接口开启多个接入点,并且因为它支持所有类型的安全设置,因此可以设置完整的全能蜜罐。对于使用 WEP 和 WPA(2)-PSK 的网络,使用默认密码,和对于使用 WPA(2)-EAP 的网络,配置“全部接受”策略。 + +对于这个场景,必须在 ETF 上执行下面的命令和操作: + + 1. 进入 APLauncher 设置模式:`config aplauncher` + 2. 设置目标接入点的 SSID(APS):`set ssid = ` + 3. 设置 APLauncher 为全部接收的蜜罐:`set catch_all_honeypot = true` + 4. 启动 AirHost 模块:`start airhost` + +使用这些命令,ETF 可以启动一个包含所有类型安全配置的完整全能蜜罐。ETF 同样能自动启动 DHCP 和 DNS 服务器,从而让客户端能与互联网保持连接。ETF 提供了一个更好、更快、更完整的解决方案来创建全能蜜罐。下面的代码能够看到 ETF 的成功执行。 + +``` +███████╗████████╗███████╗ +██╔════╝╚══██╔══╝██╔════╝ +█████╗     ██║   █████╗   +██╔══╝     ██║   ██╔══╝   +███████╗   ██║   ██║     +╚══════╝   ╚═╝   ╚═╝     +                                        + +[+] Do you want to load an older session? [Y/n]: n +[+] Creating ne´,cxzw temporary session on 03/08/2018 +[+] Enter the desired session name: +ETF[etf/aircommunicator/]::> config aplauncher +ETF[etf/aircommunicator/airhost/aplauncher]::> setconf ssid CatchMe +ssid = CatchMe +ETF[etf/aircommunicator/airhost/aplauncher]::> setconf catch_all_honeypot true +catch_all_honeypot = true +ETF[etf/aircommunicator/airhost/aplauncher]::> start airhost +[+] Killing already started processes and restarting network services +[+] Stopping dnsmasq and hostapd services +[+] Access Point stopped... +[+] Running airhost plugins pre_start +[+] Starting hostapd background process +[+] Starting dnsmasq service +[+] Running airhost plugins post_start +[+] Access Point launched successfully +[+] Starting dnsmasq service +``` + +### 结论和以后的工作 + +这些场景使用常见和众所周知的攻击方式来帮助验证 ETF 测试 WIFI 网络和客户端的能力。这个结果同样证明了该框架的架构能在平台现有功能的优势上开发新的攻击向量和功能。这会加快新的 WiFi 渗透测试工具的开发,因为很多的代码已经写好了。除此之外,将 WiFi 技术相关的东西都集成到一个单独的工具里,会使 WiFi 渗透测试更加简单高效。 + +ETF 的目标不是取代现有的工具,而是为它们提供补充,并为安全审计人员在进行 WiFi 渗透测试和提升用户安全意识时,提供一个更好的选择。 + +ETF 是 [GitHub][14] 上的一个开源项目,欢迎社区为它的开发做出贡献。下面是一些您可以提供帮助的方法。 + +当前 WiFi 渗透测试的一个限制是无法在测试期间记录重要的事件。这使得报告已经识别到的漏洞更加困难且准确性更低。这个框架可以实现一个记录器,每个类都可以来访问它并创建一个渗透测试会话报告。 + +ETF 工具的功能涵盖了 WiFi 渗透测试的方方面面。一方面,它让 WiFi 目标侦察、漏洞挖掘和攻击这些阶段变得更加容易。另一方面,它没有提供一个便于提交报告的功能。增加了会话的概念和会话报告的功能,比如在一个会话期间记录重要的事件,会极大地增加这个工具对于真实渗透测试场景的价值。 + +另一个有价值的贡献是扩展该框架来促进 WiFi 模糊测试。IEEE 802.11 协议非常的复杂,考虑到它在客户端和接入点两方面都会有多种实现方式。可以假设这些实现都包含 bug 甚至是安全漏洞。这些 bug 可以通过对 IEEE 802.11 协议的数据帧进行模糊测试来进行发现。因为 Scapy 允许自定义的数据包创建和数据包注入,可以通过它实现一个模糊测试器。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/evil-twin-framework + +作者:[André Esser][a] +选题:[lujun9972][b] +译者:[hopefully2333](https://github.com/hopefully2333) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/andreesser +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Rogue_access_point +[2]: https://www.python.org/ +[3]: https://scapy.net +[4]: /file/417776 +[5]: https://opensource.com/sites/default/files/uploads/pic1.png (Evil-Twin Framework Architecture) +[6]: https://www.metasploit.com +[7]: /file/417781 +[8]: https://opensource.com/sites/default/files/uploads/pic2.png (Scenario for capturing a WPA handshake after a de-authentication attack) +[9]: https://en.wikipedia.org/wiki/Address_Resolution_Protocol +[10]: /file/417786 +[11]: https://opensource.com/sites/default/files/uploads/pic3.png (Scenario for capturing a WPA handshake after a de-authentication attack) +[12]: /file/417791 +[13]: https://opensource.com/sites/default/files/uploads/pic4.png (Scenario for capturing a WPA handshake after a de-authentication attack) +[14]: https://github.com/Esser420/EvilTwinFramework diff --git a/published/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md b/published/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md new file mode 100644 index 0000000000..66407b0156 --- /dev/null +++ b/published/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md @@ -0,0 +1,393 @@ +[#]: collector: (lujun9972) +[#]: translator: (luming) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10569-1.html) +[#]: subject: (How To Copy A File/Folder From A Local System To Remote System In Linux?) +[#]: via: (https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in-multiple-servers-using-shell-script/) +[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) + +如何在 Linux 上复制文件/文件夹到远程系统? +====== + +从一个服务器复制文件到另一个服务器,或者从本地到远程复制是 Linux 管理员的日常任务之一。 + +我觉得不会有人不同意,因为无论在哪里这都是你的日常操作之一。有很多办法都能处理这个任务,我们试着加以概括。你可以挑一个喜欢的方法。当然,看看其他命令也能在别的地方帮到你。 + +我已经在自己的环境下测试过所有的命令和脚本了,因此你可以直接用到日常工作当中。 + +通常大家都倾向 `scp`,因为它是文件复制的原生命令native command之一。但本文所列出的其它命令也很好用,建议你尝试一下。 + +文件复制可以轻易地用以下四种方法。 + +- `scp`:在网络上的两个主机之间复制文件,它使用 `ssh` 做文件传输,并使用相同的认证方式,具有相同的安全性。 +- `rsync`:是一个既快速又出众的多功能文件复制工具。它能本地复制、通过远程 shell 在其它主机之间复制,或者与远程的 `rsync` 守护进程daemon 之间复制。 +- `pscp`:是一个并行复制文件到多个主机上的程序。它提供了诸多特性,例如为 `scp` 配置免密传输,保存输出到文件,以及超时控制。 +- `prsync`:也是一个并行复制文件到多个主机上的程序。它也提供了诸多特性,例如为 `ssh` 配置免密传输,保存输出到 文件,以及超时控制。 + +### 方式 1:如何在 Linux 上使用 scp 命令从本地系统向远程系统复制文件/文件夹? + +`scp` 命令可以让我们从本地系统复制文件/文件夹到远程系统上。 + +我会把 `output.txt` 文件从本地系统复制到 `2g.CentOS.com` 远程系统的 `/opt/backup` 文件夹下。 + +``` +# scp output.txt root@2g.CentOS.com:/opt/backup + +output.txt 100% 2468 2.4KB/s 00:00 +``` + +从本地系统复制两个文件 `output.txt` 和 `passwd-up.sh` 到远程系统 `2g.CentOs.com` 的 `/opt/backup` 文件夹下。 + +``` +# scp output.txt passwd-up.sh root@2g.CentOS.com:/opt/backup + +output.txt 100% 2468 2.4KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +``` + +从本地系统复制 `shell-script` 文件夹到远程系统 `2g.CentOs.com` 的 `/opt/back` 文件夹下。 + +这会连同`shell-script` 文件夹下所有的文件一同复制到`/opt/back` 下。 + +``` +# scp -r /home/daygeek/2g/shell-script/ root@:/opt/backup/ + +output.txt 100% 2468 2.4KB/s 00:00 +ovh.sh 100% 76 0.1KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +passwd-up1.sh 100% 7 0.0KB/s 00:00 +server-list.txt 100% 23 0.0KB/s 00:00 +``` + +### 方式 2:如何在 Linux 上使用 scp 命令和 Shell 脚本复制文件/文件夹到多个远程系统上? + +如果你想复制同一个文件到多个远程服务器上,那就需要创建一个如下面那样的小 shell 脚本。 + +并且,需要将服务器添加进 `server-list.txt` 文件。确保添加成功后,每个服务器应当单独一行。 + +最终,你想要的脚本就像下面这样: + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do + scp /home/daygeek/2g/shell-script/output.txt root@$server:/opt/backup +done +``` + +完成之后,给 `file-copy.sh` 文件设置可执行权限。 + +``` +# chmod +x file-copy.sh +``` + +最后运行脚本完成复制。 + +``` +# ./file-copy.sh + +output.txt 100% 2468 2.4KB/s 00:00 +output.txt 100% 2468 2.4KB/s 00:00 +``` + +使用下面的脚本可以复制多个文件到多个远程服务器上。 + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do + scp /home/daygeek/2g/shell-script/output.txt passwd-up.sh root@$server:/opt/backup +done +``` + +下面结果显示所有的两个文件都复制到两个服务器上。 + +``` +# ./file-cp.sh + +output.txt 100% 2468 2.4KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +output.txt 100% 2468 2.4KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +``` + +使用下面的脚本递归地复制文件夹到多个远程服务器上。 + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do + scp -r /home/daygeek/2g/shell-script/ root@$server:/opt/backup +done +``` + +上述脚本的输出。 + +``` +# ./file-cp.sh + +output.txt 100% 2468 2.4KB/s 00:00 +ovh.sh 100% 76 0.1KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +passwd-up1.sh 100% 7 0.0KB/s 00:00 +server-list.txt 100% 23 0.0KB/s 00:00 + +output.txt 100% 2468 2.4KB/s 00:00 +ovh.sh 100% 76 0.1KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +passwd-up1.sh 100% 7 0.0KB/s 00:00 +server-list.txt 100% 23 0.0KB/s 00:00 +``` + +### 方式 3:如何在 Linux 上使用 pscp 命令复制文件/文件夹到多个远程系统上? + +`pscp` 命令可以直接让我们复制文件到多个远程服务器上。 + +使用下面的 `pscp` 命令复制单个文件到远程服务器。 + +``` +# pscp.pssh -H 2g.CentOS.com /home/daygeek/2g/shell-script/output.txt /opt/backup + +[1] 18:46:11 [SUCCESS] 2g.CentOS.com +``` + +使用下面的 `pscp` 命令复制多个文件到远程服务器。 + +``` +# pscp.pssh -H 2g.CentOS.com /home/daygeek/2g/shell-script/output.txt ovh.sh /opt/backup + +[1] 18:47:48 [SUCCESS] 2g.CentOS.com +``` + +使用下面的 `pscp` 命令递归地复制整个文件夹到远程服务器。 + +``` +# pscp.pssh -H 2g.CentOS.com -r /home/daygeek/2g/shell-script/ /opt/backup + +[1] 18:48:46 [SUCCESS] 2g.CentOS.com +``` + +使用下面的 `pscp` 命令使用下面的命令复制单个文件到多个远程服务器。 + +``` +# pscp.pssh -h server-list.txt /home/daygeek/2g/shell-script/output.txt /opt/backup + +[1] 18:49:48 [SUCCESS] 2g.CentOS.com +[2] 18:49:48 [SUCCESS] 2g.Debian.com +``` + +使用下面的 `pscp` 命令复制多个文件到多个远程服务器。 + +``` +# pscp.pssh -h server-list.txt /home/daygeek/2g/shell-script/output.txt passwd-up.sh /opt/backup + +[1] 18:50:30 [SUCCESS] 2g.Debian.com +[2] 18:50:30 [SUCCESS] 2g.CentOS.com +``` + +使用下面的命令递归地复制文件夹到多个远程服务器。 + +``` +# pscp.pssh -h server-list.txt -r /home/daygeek/2g/shell-script/ /opt/backup + +[1] 18:51:31 [SUCCESS] 2g.Debian.com +[2] 18:51:31 [SUCCESS] 2g.CentOS.com +``` + +### 方式 4:如何在 Linux 上使用 rsync 命令复制文件/文件夹到多个远程系统上? + +`rsync` 是一个即快速又出众的多功能文件复制工具。它能本地复制、通过远程 shell 在其它主机之间复制,或者在远程 `rsync` 守护进程daemon 之间复制。 + +使用下面的 `rsync` 命令复制单个文件到远程服务器。 + +``` +# rsync -avz /home/daygeek/2g/shell-script/output.txt root@2g.CentOS.com:/opt/backup + +sending incremental file list +output.txt + +sent 598 bytes received 31 bytes 1258.00 bytes/sec +total size is 2468 speedup is 3.92 +``` + +使用下面的 `rsync` 命令复制多个文件到远程服务器。 + +``` +# rsync -avz /home/daygeek/2g/shell-script/output.txt passwd-up.sh root@2g.CentOS.com:/opt/backup + +sending incremental file list +output.txt +passwd-up.sh + +sent 737 bytes received 50 bytes 1574.00 bytes/sec +total size is 2537 speedup is 3.22 +``` + +使用下面的 `rsync` 命令通过 `ssh` 复制单个文件到远程服务器。 + +``` +# rsync -avzhe ssh /home/daygeek/2g/shell-script/output.txt root@2g.CentOS.com:/opt/backup + +sending incremental file list +output.txt + +sent 598 bytes received 31 bytes 419.33 bytes/sec +total size is 2.47K speedup is 3.92 +``` + +使用下面的 `rsync` 命令通过 `ssh` 递归地复制文件夹到远程服务器。这种方式只复制文件不包括文件夹。 + +``` +# rsync -avzhe ssh /home/daygeek/2g/shell-script/ root@2g.CentOS.com:/opt/backup + +sending incremental file list +./ +output.txt +ovh.sh +passwd-up.sh +passwd-up1.sh +server-list.txt + +sent 3.85K bytes received 281 bytes 8.26K bytes/sec +total size is 9.12K speedup is 2.21 +``` + +### 方式 5:如何在 Linux 上使用 rsync 命令和 Shell 脚本复制文件/文件夹到多个远程系统上? + +如果你想复制同一个文件到多个远程服务器上,那也需要创建一个如下面那样的小 shell 脚本。 + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do + rsync -avzhe ssh /home/daygeek/2g/shell-script/ root@2g.CentOS.com$server:/opt/backup +done +``` + +上面脚本的输出。 + +``` +# ./file-copy.sh + +sending incremental file list +./ +output.txt +ovh.sh +passwd-up.sh +passwd-up1.sh +server-list.txt + +sent 3.86K bytes received 281 bytes 8.28K bytes/sec +total size is 9.13K speedup is 2.21 + +sending incremental file list +./ +output.txt +ovh.sh +passwd-up.sh +passwd-up1.sh +server-list.txt + +sent 3.86K bytes received 281 bytes 2.76K bytes/sec +total size is 9.13K speedup is 2.21 +``` + +### 方式 6:如何在 Linux 上使用 scp 命令和 Shell 脚本从本地系统向多个远程系统复制文件/文件夹? + +在上面两个 shell 脚本中,我们需要事先指定好文件和文件夹的路径,这儿我做了些小修改,让脚本可以接收文件或文件夹作为输入参数。当你每天需要多次执行复制时,这将会非常有用。 + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do +scp -r $1 root@2g.CentOS.com$server:/opt/backup +done +``` + +输入文件名并运行脚本。 + +``` +# ./file-copy.sh output1.txt + +output1.txt 100% 3558 3.5KB/s 00:00 +output1.txt 100% 3558 3.5KB/s 00:00 +``` + +### 方式 7:如何在 Linux 系统上用非标准端口复制文件/文件夹到远程系统? + +如果你想使用非标准端口,使用下面的 shell 脚本复制文件或文件夹。 + +如果你使用了非标准Non-Standard端口,确保像下面 `scp` 命令那样指定好了端口号。 + +``` +# file-copy-scp.sh + +#!/bin/sh +for server in `more server-list.txt` +do +scp -P 2222 -r $1 root@2g.CentOS.com$server:/opt/backup +done +``` + +运行脚本,输入文件名。 + +``` +# ./file-copy.sh ovh.sh + +ovh.sh 100% 3558 3.5KB/s 00:00 +ovh.sh 100% 3558 3.5KB/s 00:00 +``` + +如果你使用了非标准Non-Standard端口,确保像下面 `rsync` 命令那样指定好了端口号。 + +``` +# file-copy-rsync.sh + +#!/bin/sh +for server in `more server-list.txt` +do +rsync -avzhe 'ssh -p 2222' $1 root@2g.CentOS.com$server:/opt/backup +done +``` + +运行脚本,输入文件名。 + +``` +# ./file-copy-rsync.sh passwd-up.sh +sending incremental file list +passwd-up.sh + +sent 238 bytes received 35 bytes 26.00 bytes/sec +total size is 159 speedup is 0.58 + +sending incremental file list +passwd-up.sh + +sent 238 bytes received 35 bytes 26.00 bytes/sec +total size is 159 speedup is 0.58 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in-multiple-servers-using-shell-script/ + +作者:[Prakash Subramanian][a] +选题:[lujun9972][b] +译者:[LuuMing](https://github.com/LuuMing) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/prakash/ +[b]: https://github.com/lujun9972 diff --git a/published/20190123 Book Review- Fundamentals of Linux.md b/published/20190123 Book Review- Fundamentals of Linux.md new file mode 100644 index 0000000000..bdde86d16e --- /dev/null +++ b/published/20190123 Book Review- Fundamentals of Linux.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (mySoul8012) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10565-1.html) +[#]: subject: (Book Review: Fundamentals of Linux) +[#]: via: (https://itsfoss.com/fundamentals-of-linux-book-review) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +书评:《Linux 基础》 +====== + +介绍 Linux 的基础知识以及它的工作原理的书很多,今天,我们将会点评这样一本书。这次讨论的主题为 Oliver Pelz 所写的 《[Linux 基础][1]Fundamentals of Linux》,由 [PacktPub][2] 出版。 + +[Oliver Pelz][3] 是一位拥有超过十年软件开发经验的开发者和系统管理员,拥有生物信息学学位证书。 + +### 《Linux 基础》 + +![Fundamental of Linux books][4] + +正如可以从书名中猜到那样,《Linux 基础》的目标是为读者打下一个从了解 Linux 到学习 Linux 命令行的坚实基础。这本书一共有两百多页,因此它专注于教给用户日常任务和解决经常遇到的问题。本书是为想要成为 Linux 管理员的读者而写的。 + +第一章首先概述了虚拟化。本书作者指导了读者如何在 [VirtualBox][6] 中创建 [CentOS][5] 实例。如何克隆实例,如何使用快照。并且同时你也会学习到如何通过 SSH 命令连接到虚拟机。 + +第二章介绍了 Linux 命令行的基础知识,包括 shell 通配符,shell 展开,如何使用包含空格和特殊字符的文件名称。如何来获取命令手册的帮助页面。如何使用 `sed`、`awk` 这两个命令。如何浏览 Linux 的文件系统。 + +第三章更深入的介绍了 Linux 文件系统。你将了解如何在 Linux 中文件是如何链接的,以及如何搜索它们。你还将获得用户、组,以及文件权限的大概了解。由于本章的重点介绍了如何与文件进行交互。因此还将会介绍如何从命令行中读取文本文件,以及初步了解如何使用 vim 编辑器。 + +第四章重点介绍了如何使用命令行。以及涵盖的重要命令。如 `cat`、`sort`、`awk`、`tee`、`tar`、`rsync`、`nmap`、`htop` 等。你还将会了解到进程,以及它们如何彼此通讯。这一章还介绍了 Bash shell 脚本编程。 + +第五章同时也是本书的最后一章,将会介绍 Linux 和其他高级命令,以及网络的概念。本书的作者讨论了 Linux 是如何处理网络,并提供使用多个虚拟机的示例。同时还将会介绍如何安装新的程序,如何设置防火墙。 + +### 关于这本书的思考 + +Linux 的基础知识只有五章和少少的 200 来页可能看起来有些短,但是也涵盖了相当多的信息。同时也将会获得如何使用命令行所需要的知识的一切。 + +使用本书的时候,需要注意一件事情,即,本书专注于对命令行的关注,没有任何关于如何使用图形化的用户界面的任何教程。这是因为在 Linux 中有太多不同的桌面环境,以及很多的类似的系统应用,因此很难编写一本可以涵盖所有变种的书。此外,还有部分原因还因为本书的面向的用户群体为潜在的 Linux 管理员。 + +当我看到作者使用 Centos 教授 Linux 的时候有点惊讶。我原本以为他会使用更为常见的 Linux 的发行版本,例如 Ubuntu、Debian 或者 Fedora。原因在于 Centos 是为服务器设计的发行版本。随着时间的推移变化很小,能够为 Linux 的基础知识打下一个非常坚实的基础。 + +我自己使用 Linux 已经操作五年了。我大部分时间都在使用桌面版本的 Linux。我有些时候会使用命令行操作。但我并没有花太多的时间在那里。我使用鼠标完成了本书中涉及到的很多操作。现在呢。我同时也知道了如何通过终端做到同样的事情。这种方式不会改变我完成任务的方式,但是会有助于自己理解幕后发生的事情。 + +如果你刚刚使用 Linux,或者计划使用。我不会推荐你阅读这本书。这可能有点绝对化。但是如何你已经花了一些时间在 Linux 上。或者可以快速掌握某种技术语言。那么这本书很适合你。 + +如果你认为本书适合你的学习需求。你可以从以下链接获取到该书: + +- [下载《Linux 基础》](https://www.packtpub.com/networking-and-servers/fundamentals-linux) + +我们将在未来几个月内尝试点评更多 Linux 书籍,敬请关注我们。 + +你最喜欢的关于 Linux 的入门书籍是什么?请在下面的评论中告诉我们。 + +如果你发现这篇文章很有趣,请花一点时间在社交媒体、Hacker News或 [Reddit][8] 上分享。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/fundamentals-of-linux-book-review + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[mySoul8012](https://github.com/mySoul8012) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://www.packtpub.com/networking-and-servers/fundamentals-linux +[2]: https://www.packtpub.com/ +[3]: http://www.oliverpelz.de/index.html +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/fundamentals-of-linux-book-review.jpeg?resize=800%2C450&ssl=1 +[5]: https://centos.org/ +[6]: https://www.virtualbox.org/ +[7]: https://www.centos.org/ +[8]: http://reddit.com/r/linuxusersgroup diff --git a/translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md b/published/20190124 Get started with LogicalDOC, an open source document management system.md similarity index 59% rename from translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md rename to published/20190124 Get started with LogicalDOC, an open source document management system.md index b49933414c..35e90d4839 100644 --- a/translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md +++ b/published/20190124 Get started with LogicalDOC, an open source document management system.md @@ -1,47 +1,48 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10561-1.html) [#]: subject: (Get started with LogicalDOC, an open source document management system) [#]: via: (https://opensource.com/article/19/1/productivity-tool-logicaldoc) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) -开始使用 LogicalDOC,一个开源文档管理系统 +开始使用 LogicalDOC 吧,一个开源文档管理系统 ====== -使用 LogicalDOC 更好地跟踪文档版本,这是我们开源工具系列中的第 12 个工具,它将使你在 2019 年更高效。 + +> 使用 LogicalDOC 更好地跟踪文档版本,这是我们开源工具系列中的第 12 个工具,它将使你在 2019 年更高效。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/document_free_access_cut_security.png?itok=ocvCv8G2) -每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 12 个工具来帮助你在 2019 年更有效率。 ### LogicalDOC -高效的一部分是能够在你需要时找到你需要的东西。我们都看到过充满类似名称文件的目录, 这是每次更改文档时为跟踪所有版本而重命名这些文件的结果。例如,我的妻子是一名作家,她在将文档发送给审稿人之前,她经常使用新名称保存文档修订版。 +高效部分表现在能够在你需要时找到你所需的东西。我们都看到过塞满名称类似的文件的目录,这是每次更改文档时为了跟踪所有版本而重命名这些文件而导致的。例如,我的妻子是一名作家,她在将文档发送给审稿人之前,她经常使用新名称保存文档修订版。 ![](https://opensource.com/sites/default/files/uploads/logicaldoc-1.png) -程序员对此一个自然的解决方案是 Git 或者其他版本控制器,这个不适用于文档作者,因为用于代码的系统通常不能很好地兼容商业文本编辑器使用的格式。之前有人说,“只是更改格式”,[这不是每个人的选择][1]。同样,许多版本控制工具对于非技术人员来说并不是非常友好。在大型组织中,有一些工具可以解决此问题,但它们还需要大型组织的资源来运行、管理和支持它们。 +程序员对此一个自然的解决方案是 Git 或者其他版本控制器,但这个不适用于文档作者,因为用于代码的系统通常不能很好地兼容商业文本编辑器使用的格式。之前有人说,“改变格式就行”,[这不是适合每个人的选择][1]。同样,许多版本控制工具对于非技术人员来说并不是非常友好。在大型组织中,有一些工具可以解决此问题,但它们还需要大型组织的资源来运行、管理和支持它们。 ![](https://opensource.com/sites/default/files/uploads/logicaldoc-2.png) [LogicalDOC CE][2] 是为解决此问题而编写的开源文档管理系统。它允许用户签入、签出、查看版本、搜索和锁定文档,并保留版本历史记录,类似于程序员使用的版本控制工具。 -LogicalDOC 可在 Linux、MacOS 和 Windows 上[安装][3],使用基于 Java 的安装程序。在安装中,系统将提示你提供数据库存储文职,并提供仅限本地文件存储的选项。你将获得访问服务器的 URL 和默认用户名和密码,以及保存用于自动安装脚本选项。 +LogicalDOC 可在 Linux、MacOS 和 Windows 上[安装][3],使用基于 Java 的安装程序。在安装时,系统将提示你提供数据库存储位置,并提供只在本地文件存储的选项。你将获得访问服务器的 URL 和默认用户名和密码,以及保存用于自动安装脚本选项。 登录后,LogicalDOC 的默认页面会列出你已标记、签出的文档以及有关它们的最新说明。切换到“文档”选项卡将显示你有权访问的文件。你可以在界面中选择文件或使用拖放来上传文档。如果你上传 ZIP 文件,LogicalDOC 会解压它,并将其中的文件添加到仓库中。 ![](https://opensource.com/sites/default/files/uploads/logicaldoc-3.png) -右键单击文件将显示一个菜单选项,包括检出文件、锁定文件以防止更改,以及执行大量其他操作。签出文件会将其下载到用于编辑的本地计算机。在重新签入之前,其他任何人都无法修改签出文件。当重新签入文件时(使用相同的菜单),用户可以向版本添加标签,并且需要评论对其执行的操作。 +右键单击文件将显示一个菜单选项,包括检出文件、锁定文件以防止更改,以及执行大量其他操作。签出文件会将其下载到本地计算机以便编辑。在重新签入之前,其他任何人都无法修改签出的文件。当重新签入文件时(使用相同的菜单),用户可以向版本添加标签,并且需要备注对其执行的操作。 ![](https://opensource.com/sites/default/files/uploads/logicaldoc-4.png) 查看早期版本只需在“版本”页面下载就行。对于某些第三方服务,它还有导入和导出选项,内置 [Dropbox][4] 支持。 -文档管理不仅仅是对能够负担得起昂贵解决方案的大公司。LogicalDOC 可帮助你追踪文档的版本历史,并为难以管理的文档提供了安全的仓库。 +文档管理不仅仅是能够负担得起昂贵解决方案的大公司才能有的。LogicalDOC 可帮助你追踪文档的版本历史,并为难以管理的文档提供了安全的仓库。 -------------------------------------------------------------------------------- @@ -50,7 +51,7 @@ via: https://opensource.com/article/19/1/productivity-tool-logicaldoc 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/tech/20190129 Get started with gPodder, an open source podcast client.md b/published/20190129 Get started with gPodder, an open source podcast client.md similarity index 69% rename from translated/tech/20190129 Get started with gPodder, an open source podcast client.md rename to published/20190129 Get started with gPodder, an open source podcast client.md index 429189b926..f5449a95de 100644 --- a/translated/tech/20190129 Get started with gPodder, an open source podcast client.md +++ b/published/20190129 Get started with gPodder, an open source podcast client.md @@ -1,35 +1,36 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10567-1.html) [#]: subject: (Get started with gPodder, an open source podcast client) [#]: via: (https://opensource.com/article/19/1/productivity-tool-gpodder) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -开始使用 gPodder,一个开源播客客户端 +开始使用 gPodder 吧,一个开源播客客户端 ====== -使用 gPodder 将你的播客同步到你的设备上,gPodder 是我们开源工具系列中的第 17 个工具,它将在 2019 年提高你的工作效率。 + +> 使用 gPodder 将你的播客同步到你的设备上,gPodder 是我们开源工具系列中的第 17 个工具,它将在 2019 年提高你的工作效率。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/podcast-record-microphone.png?itok=8yUDOywf) -每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 17 个工具来帮助你在 2019 年更有效率。 ### gPodder -我喜欢播客。哎呀,我非常喜欢他们,因此我录制了其中的三个(你可以在[我的个人资料][1]中找到它们的链接)。我从播客那里学到了很多东西,并在我工作时在后台播放它们。但是,在多台桌面和移动设备之间保持同步可能会带来一些挑战。 +我喜欢播客。哎呀,我非常喜欢它们,因此我录制了其中的三个(你可以在[我的个人资料][1]中找到它们的链接)。我从播客那里学到了很多东西,并在我工作时在后台播放它们。但是,如何在多台桌面和移动设备之间保持同步可能会有一些挑战。 -[gPodder][2] 是一个简单的跨平台播客下载器、播放器和同步工具。它支持 RSS feed、[FeedBurner][3]、[YouTube][4] 和 [SoundCloud][5],它还有一个开源同步服务,你可以根据需要运行它。gPodder 不直接播放播客。相反, 它使用你选择的音频或视频播放器。 +[gPodder][2] 是一个简单的跨平台播客下载器、播放器和同步工具。它支持 RSS feed、[FeedBurner][3]、[YouTube][4] 和 [SoundCloud][5],它还有一个开源的同步服务,你可以根据需要运行它。gPodder 不直接播放播客。相反,它会使用你选择的音频或视频播放器。 ![](https://opensource.com/sites/default/files/uploads/gpodder-1.png) -安装 gPodder 非常简单。安装程序适用于 Windows 和 MacOS,同时包可用于主要的 Linux 发行版。如果你的发行版中没有它,你可以直接从 Git 下载运行。通过 “Add Podcasts via URL” 菜单,你可以输入播客的 RSS 源 URL 或其他服务的“特殊” URL。gPodder 将获取节目列表并显示一个对话框,你可以在其中选择要下载的节目或在列表上标记旧节目。 +安装 gPodder 非常简单。安装程序适用于 Windows 和 MacOS,同时也有用于主要的 Linux 发行版的软件包。如果你的发行版中没有它,你可以直接从 Git 下载运行。通过 “Add Podcasts via URL” 菜单,你可以输入播客的 RSS 源 URL 或其他服务的 “特殊” URL。gPodder 将获取节目列表并显示一个对话框,你可以在其中选择要下载的节目或在列表上标记旧节目。 ![](https://opensource.com/sites/default/files/uploads/gpodder-2.png) -它一个更好的功能是,如果 URL 已经在你的剪贴板中,gPodder 会自动将它放入播放 URL 中,这样你就可以很容易地将新的播客添加到列表中。如果你已有播客 feed 的 OPML 文件,那么可以上传并导入它。还有一个发现选项,让你可搜索 [gPodder.net][6] 上的播客,这是由编写和维护 gPodder 的人员提供的免费和开源播客列表网站。 +它一个更好的功能是,如果 URL 已经在你的剪贴板中,gPodder 会自动将它放入播放 URL 中,这样你就可以很容易地将新的播客添加到列表中。如果你已有播客 feed 的 OPML 文件,那么可以上传并导入它。还有一个发现选项,让你可搜索 [gPodder.net][6] 上的播客,这是由编写和维护 gPodder 的人员提供的自由及开源的播客的列表网站。 ![](https://opensource.com/sites/default/files/uploads/gpodder-3.png) @@ -48,7 +49,7 @@ via: https://opensource.com/article/19/1/productivity-tool-gpodder 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/tech/20190131 Will quantum computing break security.md b/published/20190131 Will quantum computing break security.md similarity index 51% rename from translated/tech/20190131 Will quantum computing break security.md rename to published/20190131 Will quantum computing break security.md index a4b3792e6f..33323796ce 100644 --- a/translated/tech/20190131 Will quantum computing break security.md +++ b/published/20190131 Will quantum computing break security.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10566-1.html) [#]: subject: (Will quantum computing break security?) [#]: via: (https://opensource.com/article/19/1/will-quantum-computing-break-security) [#]: author: (Mike Bursell https://opensource.com/users/mikecamel) @@ -10,42 +10,36 @@ 量子计算会打破现有的安全体系吗? ====== -> 你会希望黑客冒充成你的银行吗? +> 你会希望[某黑客][6]J. Random Hacker假冒你的银行吗? ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) -近年来,量子计算机已经出现在大众的视野当中。量子计算机被认为是第六类计算机,这六类计算机包括: - -1. **人力:** 在人造的计算工具出现之前,人类只能使用人力去进行计算。而承担计算工作的人,只能被称为“计算者”。 - -2. **模拟计算工具:** 由人类制造的一些模拟计算过程的小工具,例如[安提凯希拉装置][1]Antikythera mechanism、星盘、计算尺等等。 - -3. **机械工具:** 在这一个类别中包括了运用到离散数学但未使用电子技术进行计算的工具,例如算盘、Charles Babbage 的差分机Difference Engine等等。 - -4. **电子模拟计算工具:** 这一个类别的计算机多数用于军事方面的用途,例如炸弹瞄准器、枪炮瞄准装置等等。 - -5. **电子计算机:** 这个类别包含的种类就太多了,几乎包含现代所有的电子设备,从移动电话到超级计算机,都在这个类别当中。 - -6. **量子计算机:** 即将进入我们的生活,而且与之前的几类完全不同。 +近年来,量子计算机quantum computer已经出现在大众的视野当中。量子计算机被认为是第六类计算机,这六类计算机包括: +1. 人力Humans:在人造的计算工具出现之前,人类只能使用人力去进行计算。而承担计算工作的人,只能被称为“计算者”。 +2. 模拟计算工具Mechanical analogue:由人类制造的一些模拟计算过程的小工具,例如[安提凯希拉装置][1]Antikythera mechanism星盘astrolabe计算尺slide rule等等。 +3. 机械工具Mechanical digital:在这一个类别中包括了运用到离散数学但未使用电子技术进行计算的工具,例如算盘abacus、Charles Babbage 的差分机Difference Engine等等。 +4. 电子模拟计算工具Electronic analogue:这一个类别的计算机多数用于军事方面的用途,例如炸弹瞄准器、枪炮瞄准装置等等。 +5. 电子计算机Electronic digital:我在这里会稍微冒险一点,我觉得 Colossus 是第一台电子计算机,[^1] :这一类几乎包含现代所有的电子设备,从移动电话到超级计算机,都在这个类别当中。 +6. 量子计算机Quantum computer:即将进入我们的生活,而且与之前的几类完全不同。 ### 什么是量子计算? -量子计算的概念来源于量子力学,因此使用的计算方式和我们平常使用的普通计算并不相同。如果想要深入理解,建议从参考[维基百科上的定义][2]开始。对我们来说,最重要的是理解这一点:量子计算机使用量子位qubit进行计算。在这样的前提下,对于很多数学算法和运算操作,量子计算机的计算速度会比普通计算机要快得多。 +量子计算Quantum computing的概念来源于量子力学quantum mechanics,使用的计算方式和我们平常使用的普通计算非常不同。如果想要深入理解,建议从参考[维基百科上的定义][2]开始。对我们来说,最重要的是理解这一点:量子计算机使用量子位qubit进行计算。在这样的前提下,对于很多数学算法和运算操作,量子计算机的计算速度会比普通计算机要快得多。 这里的“快得多”是按数量级来说的“快得多”。在某些情况下,一个计算任务如果由普通计算机来执行,可能要耗费几年或者几十年才能完成,但如果由量子计算机来执行,就只需要几秒钟。这样的速度甚至令人感到可怕。因为量子计算机会非常擅长信息的加密解密计算,即使在没有密钥的情况下,也能快速完成繁重的计算任务。 -这意味着,如果拥有足够强大的量子计算机,那么你的所有信息都会被一览无遗,任何被加密的数据都可以被正确解密出来,甚至伪造数字签名也会成为可能。这确实是一个严重的问题。毕竟谁也不想被黑客冒充成自己在用的银行,更不希望自己在区块链上的交易被篡改得面目全非。 +这意味着,如果拥有足够强大的量子计算机,那么你的所有信息都会被一览无遗,任何被加密的数据都可以被正确解密出来,甚至伪造数字签名也会成为可能。这确实是一个严重的问题。谁也不想被某个黑客冒充成自己在用的银行,更不希望自己在区块链上的交易被篡改得面目全非。 ### 好消息 尽管上面的提到的问题非常可怕,但也不需要太担心。 -首先,如果要实现上面提到的能力,一台可以操作大量量子位的量子计算机是必不可少的,而这个硬件上的要求就是一个很高的门槛。目前普遍认为,规模大得足以有效破解经典加密算法的量子计算机在最近几年还不可能出现。 +首先,如果要实现上面提到的能力,一台可以操作大量量子位的量子计算机是必不可少的,而这个硬件上的要求就是一个很高的门槛。[^4] 目前普遍认为,规模大得足以有效破解经典加密算法的量子计算机在最近几年还不可能出现。 其次,除了攻击现有的加密算法需要大量的量子位以外,还需要很多量子位来保证容错性。 -还有,尽管确实有一些理论上的模型阐述了量子计算机如何对一些现有的算法作出攻击,但是要让这样的理论模型实际运作起来的难度会比我们想象中大得多。事实上,有一些攻击手段也是未被完全确认是可行的,又或者这些攻击手段还需要继续耗费很多年的改进才能到达如斯恐怖的程度。 +还有,尽管确实有一些理论上的模型阐述了量子计算机如何对一些现有的算法作出攻击,但是要让这样的理论模型实际运作起来的难度会比我们[^5] 想象中大得多。事实上,有一些攻击手段也是未被完全确认是可行的,又或者这些攻击手段还需要继续耗费很多年的改进才能到达如斯恐怖的程度。 最后,还有很多专业人士正在研究能够防御量子计算的算法(这样的算法也被称为“后量子算法post-quantum algorithms”)。如果这些防御算法经过测试以后投入使用,我们就可以使用这些算法进行加密,来对抗量子计算了。 @@ -55,23 +49,25 @@ 但我们也并不是高枕无忧了,以下两个问题就值得我们关注: -1. 人们在设计应用系统的时候仍然没有对量子计算作出太多的考量。如果设计的系统可能会使用 10 年以上,又或者数据存储和加密的时间跨度在 10 年以上,那么就必须考虑量子计算在未来会不会对系统造成不利的影响。 - -2. 新出现的防御量子计算的算法可能会是专有的。也就是说,如果基于这些防御量子计算的算法来设计系统,那么在系统落地的时候,可能会需要为此付费。尽管我是支持开源的,尤其是[开源密码学][3],但我最担心的就是这方面的内容无法被开源。而且,在建立新的协议标准时,无论是故意的,无意的,还是别无选择,都很可能不会使用开源的专有算法。 - - - +1. 人们在设计应用系统的时候仍然没有对量子计算作出太多的考量。如果设计的系统可能会使用 10 年以上,又或者数据加密和签名的时间跨度在 10 年以上,那么就必须考虑量子计算在未来会不会对系统造成不利的影响。 +2. 新出现的防御量子计算的算法可能会是专有的。也就是说,如果基于这些防御量子计算的算法来设计系统,那么在系统落地的时候,可能会需要为此付费。尽管我是支持开源的,尤其是[开源密码学][3],但我最担心的就是无法开源这方面的内容。而且最糟糕的是,在建立新的协议标准时(不管是事实标准还是通过标准组织建立的标准),无论是故意的,还是无意忽略,或者是没有好的开源替代品,他们都很可能使用专有算法而排除使用开源算法。 ### 我们要怎样做? -幸运的是,针对上述两个问题,我们还是有应对措施的。首先,在整个系统的设计阶段,就需要考虑到它是否会受到量子计算的影响,并作出相应的规划。当然了,不需要现在就立即采取行动,因为当前的技术水平也没法实现有效的方案,但至少也要[在加密方面保持敏捷性][4],以便在任何需要的时候为你的协议和系统更换更有效的加密算法。 +幸运的是,针对上述两个问题,我们还是有应对措施的。首先,在整个系统的设计阶段,就需要考虑到它是否会受到量子计算的影响,并作出相应的规划。当然了,不需要现在就立即采取行动,因为当前的技术水平也没法实现有效的方案,但至少也要[在加密方面保持敏捷性][4],以便在任何需要的时候为你的协议和系统更换更有效的加密算法。[^7] 其次是参与开源运动。尽可能鼓励密码学方面的有识之士团结起来,支持开放标准,并投入对非专有的防御量子计算的算法研究当中去。这一点也算是当务之急,因为号召更多的人重视起来并加入研究,比研究本身更为重要。 - - 本文首发于《[Alice, Eve, and Bob][5]》,并在作者同意下重新发表。 +[^1]: 我认为把它称为第一台电子可编程计算机是公平的。我知道有早期的非可编程的,也有些人声称是 ENIAC,但我没有足够的空间或精力在这里争论这件事。 +[^2]: No。 +[^3]: See 2. Don't get me wrong, by the way—I grew up near Weston-super-Mare, and it's got things going for it, but it's not Mayfair. +[^4]: 如果量子物理学家说很难,那么在我看来,就很难。 +[^5]: 而且我假设我们都不是量子物理学家或数学家。 +[^6]: I'm definitely not. +[^7]: 而且不仅仅是出于量子计算的原因:我们现有的一些经典算法很可能会陷入其他非量子攻击,例如新的数学方法。 + -------------------------------------------------------------------------------- via: https://opensource.com/article/19/1/will-quantum-computing-break-security @@ -79,7 +75,7 @@ via: https://opensource.com/article/19/1/will-quantum-computing-break-security 作者:[Mike Bursell][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -90,4 +86,4 @@ via: https://opensource.com/article/19/1/will-quantum-computing-break-security [3]: https://opensource.com/article/17/10/many-eyes [4]: https://aliceevebob.com/2017/04/04/disbelieving-the-many-eyes-hypothesis/ [5]: https://aliceevebob.com/2019/01/08/will-quantum-computing-break-security/ - +[6]: https://www.techopedia.com/definition/20225/j-random-hacker diff --git a/translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md b/published/20190207 How to determine how much memory is installed, used on Linux systems.md similarity index 64% rename from translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md rename to published/20190207 How to determine how much memory is installed, used on Linux systems.md index 5732d2a1c5..96b474f7e4 100644 --- a/translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md +++ b/published/20190207 How to determine how much memory is installed, used on Linux systems.md @@ -1,39 +1,42 @@ [#]: collector: (lujun9972) [#]: translator: (leommxj) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10571-1.html) [#]: subject: (How to determine how much memory is installed, used on Linux systems) [#]: via: (https://www.networkworld.com/article/3336174/linux/how-much-memory-is-installed-and-being-used-on-your-linux-systems.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -如何在Linux系统中判断安装、使用了多少内存 +如何在 Linux 系统中判断安装、使用了多少内存 ====== + +> 有几个命令可以报告在 Linux 系统上安装和使用了多少内存。根据你使用的命令,你可能会被细节淹没,也可能获得快速简单的答案。 + ![](https://images.idgesg.net/images/article/2019/02/memory-100787327-large.jpg) -在Linux系统中有很多种方法获取有关安装了多少内存的信息及查看多少内存正在被使用。有些命令提供了大量的细节,而其他命令提供了简洁但不一定易于理解的答案。在这篇文章中,我们将介绍一些查看内存及其使用状态的有用的工具。 +在 Linux 系统中有很多种方法获取有关安装了多少内存的信息及查看多少内存正在被使用。有些命令提供了大量的细节,而其他命令提供了简洁但不一定易于理解的答案。在这篇文章中,我们将介绍一些查看内存及其使用状态的有用的工具。 -在我们开始之前,让我们先来回顾一些基础知识。物理内存和虚拟内存并不是一回事。后者包括配置为 swap 的磁盘空间。Swap 空间可能包括为此目的特意留出来的分区,以及在创建新的 swap 分区不可行时创建的用来增加可用 swap 空间的文件。有些Linux命令提供关于两者的信息。 +在我们开始之前,让我们先来回顾一些基础知识。物理内存和虚拟内存并不是一回事。后者包括配置为交换空间的磁盘空间。交换空间可能包括为此目的特意留出来的分区,以及在创建新的交换分区不可行时创建的用来增加可用交换空间的文件。有些 Linux 命令会提供关于两者的信息。 -Swap 通过提供当物理内存占满时可以用来存放内存中非活动页的磁盘空间来扩展内存。 +当物理内存占满时,交换空间通过提供可以用来存放内存中非活动页的磁盘空间来扩展内存。 -**/proc/kcore** 是在内存管理中起作用的一个文件。这个文件看上去是个普通文件(虽然非常大),但它并不占用任何空间。它就像其他 /proc 下的文件一样是个虚拟文件。 +`/proc/kcore` 是在内存管理中起作用的一个文件。这个文件看上去是个普通文件(虽然非常大),但它并不占用任何空间。它就像其他 `/proc` 下的文件一样是个虚拟文件。 ``` $ ls -l /proc/kcore -r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore ``` -有趣的是,下面查询的两个系统并没有安装相同大小的内存,但 /proc/kcore 的大小却是相同的。第一个系统安装了 4 GB 的内存,而第二个系统安装了 6 GB。 +有趣的是,下面查询的两个系统并没有安装相同大小的内存,但 `/proc/kcore` 的大小却是相同的。第一个系统安装了 4 GB 的内存,而第二个系统安装了 6 GB。 ``` system1$ ls -l /proc/kcore -r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore system2$ ls -l /proc/kcore --r-------- 1 root root 140737477881856 Feb 5 13:00 /proc/kcore +-r-------- 1 root root 140737477881856 Feb 5 13:00 /proc/kcore ``` -一种不靠谱的解释说这个文件代表可用虚拟内存的大小(没准要加 4 KB),如果这样,这些系统的虚拟内存可就是 128TB 了!这个数字似乎代表了64位系统可以寻址多少内存,而不是当前系统有多少可用内存。在命令行中计算 128 TB 和这个文件大小加上 4 KB 很容易。 +一种不靠谱的解释说这个文件代表可用虚拟内存的大小(没准要加 4 KB),如果这样,这些系统的虚拟内存可就是 128TB 了!这个数字似乎代表了 64 位系统可以寻址多少内存,而不是当前系统有多少可用内存。在命令行中计算 128 TB 和这个文件大小加上 4 KB 很容易。 ``` $ expr 1024 \* 1024 \* 1024 \* 1024 \* 128 @@ -42,7 +45,7 @@ $ expr 1024 \* 1024 \* 1024 \* 1024 \* 128 + 4096 140737488359424 ``` -另一个用来检查内存的更人性化的命令是 **free**。它会给出一个易于理解的内存报告。 +另一个用来检查内存的更人性化的命令是 `free`。它会给出一个易于理解的内存报告。 ``` $ free @@ -51,7 +54,7 @@ Mem: 6102476 812244 4090752 13112 1199480 4984140 Swap: 2097148 0 2097148 ``` -使用 **-g** 选项,free会以 GB 为单位返回结果。 +使用 `-g` 选项,`free` 会以 GB 为单位返回结果。 ``` $ free -g @@ -60,7 +63,7 @@ Mem: 5 0 3 0 1 4 Swap: 1 0 1 ``` -使用 **-t** 选项,free 会显示与无附加选项时相同的值(不要把 -t 选项与 TB 搞混),并额外在输出的底部添加一行总计数据。 +使用 `-t` 选项,`free` 会显示与无附加选项时相同的值(不要把 `-t` 选项理解成 TB),并额外在输出的底部添加一行总计数据。 ``` $ free -t @@ -82,7 +85,7 @@ Total: 7 0 5 如果你尝试用这个报告来解释“这个系统安装了多少内存?”,你可能会感到失望。上面的报告就是在前文说的装有 6 GB 内存的系统上运行的结果。这并不是说这个结果是错的,这就是系统对其可使用的内存的看法。 -free 命令也提供了每隔 X 秒刷新显示的选项(下方示例中 X 为 10)。 +`free` 命令也提供了每隔 X 秒刷新显示的选项(下方示例中 X 为 10)。 ``` $ free -s 10 @@ -95,7 +98,7 @@ Mem: 6102476 812260 4090712 13112 1199504 4984120 Swap: 2097148 0 2097148 ``` -使用 **-l** 选项,free命令会提供高低内存使用信息。 +使用 `-l` 选项,`free` 命令会提供高低内存使用信息。 ``` $ free -l @@ -106,7 +109,7 @@ High: 0 0 0 Swap: 2097148 0 2097148 ``` -查看内存的另一个选择是 **/proc/meminfo** 文件。像 /proc/kcore 一样,这也是一个虚拟文件,它可以提供关于安装/使用了多少内存以及可用内存的报告。显然,空闲内存和可用内存并不是同一回事。MemFree 看起来代表未使用的 RAM。MemAvailable则是对于启动新程序时可使用的内存的一个估计。 +查看内存的另一个选择是 `/proc/meminfo` 文件。像 `/proc/kcore` 一样,这也是一个虚拟文件,它可以提供关于安装或使用了多少内存以及可用内存的报告。显然,空闲内存和可用内存并不是同一回事。`MemFree` 看起来代表未使用的 RAM。`MemAvailable` 则是对于启动新程序时可使用的内存的一个估计。 ``` $ head -3 /proc/meminfo @@ -124,7 +127,7 @@ $ grep MemTotal /proc/meminfo MemTotal: 6102476 kB ``` -**DirectMap** 将内存信息分为几类。 +`DirectMap` 将内存信息分为几类。 ``` $ grep DirectMap /proc/meminfo @@ -132,9 +135,9 @@ DirectMap4k: 213568 kB DirectMap2M: 6076416 kB ``` -DirectMap4k 代表被映射成标准 4 k 页的内存大小,DirectMap2M 则显示了被映射为 2 MB 的页的内存大小。 +`DirectMap4k` 代表被映射成标准 4 k 页的内存大小,`DirectMap2M` 则显示了被映射为 2 MB 的页的内存大小。 -**getconf** 命令将会提供比我们大多数人想要看到的更多的信息。 +`getconf` 命令将会提供比我们大多数人想要看到的更多的信息。 ``` $ getconf -a | more @@ -174,9 +177,9 @@ $ getconf -a | grep PAGES | awk 'BEGIN {total = 1} {if (NR == 1 || NR == 3) tota 上面的命令通过将下方输出的第一行和最后一行的值相乘来计算内存。 ``` -PAGESIZE 4096 <== -_AVPHYS_PAGES 1022511 -_PHYS_PAGES 1525619 <== +PAGESIZE 4096 <== +_AVPHYS_PAGES 1022511 +_PHYS_PAGES 1525619 <== ``` 自己动手计算一下,我们就知道这个值是怎么来的了。 @@ -186,9 +189,9 @@ $ expr 4096 \* 1525619 / 1024 6102476 ``` -显然值得为以上的指令之一设置个 alias。 +显然值得为以上的指令之一设置个 `alias`。 -另一个具有非常易于理解的输出的命令是 **top** 。在 top 输出的前五行,你可以看到一些数字显示多少内存正被使用。 +另一个具有非常易于理解的输出的命令是 `top` 。在 `top` 输出的前五行,你可以看到一些数字显示多少内存正被使用。 ``` $ top @@ -206,9 +209,7 @@ $ sudo dmidecode -t 17 | grep "Size.*MB" | awk '{s+=$2} END {print s / 1024 "GB" 6GB ``` -取决于你想要获取多少细节,Linux系统提供了许多用来查看系统安装内存以及使用/空闲内存的选择。 - -在 [Facebook][1] 或 [LinkedIn][2] 上加入 Network World 社区,评论最重要的话题。 +取决于你想要获取多少细节,Linux 系统提供了许多用来查看系统安装内存以及使用/空闲内存的选择。 -------------------------------------------------------------------------------- @@ -217,7 +218,7 @@ via: https://www.networkworld.com/article/3336174/linux/how-much-memory-is-insta 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[leommxj](https://github.com/leommxj) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20190219 3 tools for viewing files at the command line.md b/published/20190219 3 tools for viewing files at the command line.md new file mode 100644 index 0000000000..eb975657c2 --- /dev/null +++ b/published/20190219 3 tools for viewing files at the command line.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10573-1.html) +[#]: subject: (3 tools for viewing files at the command line) +[#]: via: (https://opensource.com/article/19/2/view-files-command-line) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +在命令行查看文件的 3 个工具 +====== + +> 看一下 `less`、Antiword 和 `odt2xt` 这三个实用程序,它们都可以在终端中查看文件。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg) + +我常说,你不需要使用命令行也可以高效使用 Linux —— 我知道许多 Linux 用户从不打开终端窗口,并且也用的挺好。然而,即使我不认为自己是一名技术人员,我也会在命令行上花费大约 20% 的计算时间,包括操作文件、处理文本和使用实用程序。 + +我经常在终端窗口中做的一件事是查看文件,无论是文本还是需要用到文字处理器的文件。有时使用命令行实用程序比启动文本编辑器或文字处理器更容易。 + +下面是我在命令行中用来查看文件的三个实用程序。 + +### less + +[less][1] 的美妙之处在于它易于使用,它将你正在查看的文件分解为块(或页面),这使得它们更易于阅读。你可以使用它在命令行查看文本文件,例如 README、HTML 文件、LaTeX 文件或其他任何纯文本文件。我在[上一篇文章][2]中介绍了 `less`。 + +要使用 `less`,只需输入: + +``` +less file_name +``` + +![](https://opensource.com/sites/default/files/uploads/less.png) + +通过按键盘上的空格键或 `PgDn` 键向下滚动文件,按 `PgUp` 键向上移动文件。要停止查看文件,按键盘上的 `Q` 键。 + +### Antiword + +[Antiword][3] 是一个很好地实用小程序,你可以使用它将 Word 文档转换为纯文本。只要你想,还可以将它们转换为 [PostScript][4] 或 [PDF][5]。在本文中,让我们继续使用文本转换。 + +Antiword 可以读取和转换 Word 2.0 到 2003 版本创建的文件(LCTT 译注:此处疑为 Word 2000,因为 Word 2.0 for DOS 发布于 1984 年,而 WinWord 2.0 发布于 1991 年,都似乎太老了)。它不能读取 DOCX 文件 —— 如果你尝试这样做,Antiword 会显示一条错误消息,表明你尝试读取的是一个 ZIP 文件。这在技术上说是正确的,但仍然令人沮丧。 + +要使用 Antiword 查看 Word 文档,输入以下命令: + +``` +antiword file_name.doc +``` + +Antiword 将文档转换为文本并显示在终端窗口中。不幸的是,它不能在终端中将文档分解成页面。不过,你可以将 Antiword 的输出重定向到 `less` 或 [more][6] 之类的实用程序,一遍对其进行分页。通过输入以下命令来执行此操作: + +``` +antiword file_name.doc | less +``` + +如果你是命令行的新手,那么我告诉你 `|` 称为管道。这就是重定向。 + +![](https://opensource.com/sites/default/files/uploads/antiword.png) + +### odt2txt + +作为一个优秀的开源公民,你会希望尽可能多地使用开放格式。对于你的文字处理需求,你可能需要处理 [ODT][7] 文件(由诸如 LibreOffice Writer 和 AbiWord 等文字处理器使用)而不是 Word 文件。即使没有,也可能会遇到 ODT 文件。而且,即使你的计算机上没有安装 Writer 或 AbiWord,也很容易在命令行中查看它们。 + +怎样做呢?用一个名叫 [odt2txt][8] 的实用小程序。正如你猜到的那样,`odt2txt` 将 ODT 文件转换为纯文本。要使用它,运行以下命令: + +``` +odt2txt file_name.odt +``` + +与 Antiword 一样,`odt2txt` 将文档转换为文本并在终端窗口中显示。和 Antiword 一样,它不会对文档进行分页。但是,你也可以使用以下命令将 `odt2txt` 的输出管道传输到 `less` 或 `more` 这样的实用程序中: + +``` +odt2txt file_name.odt | more +``` + +![](https://opensource.com/sites/default/files/uploads/odt2txt.png) + +你有一个最喜欢的在命令行中查看文件的实用程序吗?欢迎留下评论与社区分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/view-files-command-line + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://www.gnu.org/software/less/ +[2]: https://opensource.com/article/18/4/using-less-view-text-files-command-line +[3]: http://www.winfield.demon.nl/ +[4]: http://en.wikipedia.org/wiki/PostScript +[5]: http://en.wikipedia.org/wiki/Portable_Document_Format +[6]: https://opensource.com/article/19/1/more-text-files-linux +[7]: http://en.wikipedia.org/wiki/OpenDocument +[8]: https://github.com/dstosberg/odt2txt diff --git a/translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md b/published/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md similarity index 56% rename from translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md rename to published/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md index cba74fd894..2eec9eb896 100644 --- a/translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md +++ b/published/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md @@ -1,60 +1,70 @@ [#]: collector: (lujun9972) [#]: translator: (guevaraya) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10562-1.html) [#]: subject: (How to List Installed Packages on Ubuntu and Debian [Quick Tip]) [#]: via: (https://itsfoss.com/list-installed-packages-ubuntu) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何索引 Ubuntu 和 Debian 上已安装的软件包 [快速提示] +如何列出 Ubuntu 和 Debian 上已安装的软件包 ====== 当你安装了 [Ubuntu 并想好好用一用][1]。但在将来某个时候,你肯定会遇到忘记曾经安装了那些软件包。 这个是完全正常。没有人要求你把系统里所有已安装的软件包都记住。但是问题是,如何才能知道已经安装了哪些软件包?如何查看安装过的软件包呢? -### 索引 Ubuntu 和 Debian 上已安装的软件包 +### 列出 Ubuntu 和 Debian 上已安装的软件包 -![索引已安装的软件包][2] +![列出已安装的软件包][2] -如果你经常用 [apt 命令][3],你可能会注意到 apt 可以索引已安装的软件包。这里说对了一点。 +如果你经常用 [apt 命令][3],你可能觉得会有个命令像 `apt` 一样可以列出已安装的软件包。不算全错。 +[apt-get 命令][4] 没有类似列出已安装软件包的简单的选项,但是 `apt` 有一个这样的命令: -[apt-get 命令] 没有类似索引已安装软件包的简单的选项,但是 apt 有一个这样的命令: ``` apt list --installed ``` -这个会显示 apt 命令安装的所有的软件包。同时也会包含由于依赖被安装的软件包。也就是说不仅会包含你曾经安装的程序,而且会包含大量库文件和间接安装的软件包。 -![用 atp 命令索引显示已安装的软件包][5] 用 atp 命令索引显示已安装的软件包 +这个会显示使用 `apt` 命令安装的所有的软件包。同时也会包含由于依赖而被安装的软件包。也就是说不仅会包含你曾经安装的程序,而且会包含大量库文件和间接安装的软件包。 + +![用 atp 命令列出显示已安装的软件包][5] + +*用 atp 命令列出显示已安装的软件包* + +由于列出出来的已安装的软件包太多,用 `grep` 过滤特定的软件包是一个比较好的办法。 -由于索引出来的已安装的软件包太多,用 grep 过滤特定的软件包是一个比较好的办法。 ``` apt list --installed | grep program_name ``` -如上命令也可以检索出 .deb 格式的软件包文件。是不是很酷?不是吗? +如上命令也可以检索出使用 .deb 软件包文件安装的软件。是不是很酷? -如果你阅读过 [apt 与 apt-get 对比][7]的文章,你可能已经知道 apt 和 apt-get 命令都是基于 [dpkg][8]。也就是说用 dpkg 命令可以索引 Debian 系统的所有已经安装的软件包。 +如果你阅读过 [apt 与 apt-get 对比][7]的文章,你可能已经知道 `apt` 和 `apt-get` 命令都是基于 [dpkg][8]。也就是说用 `dpkg` 命令可以列出 Debian 系统的所有已经安装的软件包。 ``` dpkg-query -l ``` -你可以用 grep 命令检索指定的软件包。 -![用 dpkg 命令索引显示已经安装的软件包][9]![用 dpkg 命令索引显示已经安装的软件包][9]用 dpkg 命令索引显示已经安装的软件包 +你可以用 `grep` 命令检索指定的软件包。 +![用 dpkg 命令列出显示已经安装的软件包][9]! -现在你可以搞定索引 Debian 的软件包管理器安装的应用了。那 Snap 和 Flatpak 这个两种应用呢?如何索引他们?因为他们不能被 apt 和 dpkg 访问。 +*用 dpkg 命令列出显示已经安装的软件包* + +现在你可以搞定列出 Debian 的软件包管理器安装的应用了。那 Snap 和 Flatpak 这个两种应用呢?如何列出它们?因为它们不能被 `apt` 和 `dpkg` 访问。 显示系统里所有已经安装的 [Snap 软件包][10],可以这个命令: ``` snap list ``` -Snap 可以用绿色勾号索引显示经过认证的发布者。 -![索引已经安装的 Snap 软件包][11]索引已经安装的 Snap 软件包 + +Snap 可以用绿色勾号标出哪个应用来自经过认证的发布者。 + +![列出已经安装的 Snap 软件包][11] + +*列出已经安装的 Snap 软件包* 显示系统里所有已安装的 [Flatpak 软件包][12],可以用这个命令: @@ -65,37 +75,45 @@ flatpak list 让我来个汇总: -用 apt 命令显示已安装软件包: +用 `apt` 命令显示已安装软件包: -**apt** **list –installed** +``` +apt list –installed +``` -用 dpkg 命令显示已安装软件包: +用 `dpkg` 命令显示已安装软件包: -**dpkg-query -l** +``` +dpkg-query -l +``` -索引系统里 Snap 已安装软件包: +列出系统里 Snap 已安装软件包: -**snap list** +``` +snap list +``` -索引系统里 Flatpak 已安装软件包: +列出系统里 Flatpak 已安装软件包: -**flatpak list** +``` +flatpak list +``` ### 显示最近安装的软件包 -现在你已经看过以字母顺序索引的已经安装软件包了。如何显示最近已经安装的软件包? +现在你已经看过以字母顺序列出的已经安装软件包了。如何显示最近已经安装的软件包? 幸运的是,Linux 系统保存了所有发生事件的日志。你可以参考最近安装软件包的日志。 -有两个方法可以来做。用 dpkg 命令的日志或者 apt 命令的日志。 +有两个方法可以来做。用 `dpkg` 命令的日志或者 `apt` 命令的日志。 -你仅仅需要用 grep 命令过滤已经安装的软件包日志。 +你仅仅需要用 `grep` 命令过滤已经安装的软件包日志。 ``` grep " install " /var/log/dpkg.log ``` -这会显示所有的软件安装包,其中包括最近安装的过程中被依赖的软件包。 +这会显示所有的软件安装包,其中包括最近安装的过程中所依赖的软件包。 ``` 2019-02-12 12:41:42 install ubuntu-make:all 16.11.1ubuntu1 @@ -108,13 +126,13 @@ grep " install " /var/log/dpkg.log 2019-02-14 11:49:10 install qml-module-qtgraphicaleffects:amd64 5.9.5-0ubuntu1 ``` -你也可以查看 apt历史命令日志。这个仅会显示用 apt 命令安装的的程序。但不会显示被依赖安装的软件包,详细的日志在日志里可以看到。有时你只是想看看对吧? +你也可以查看 `apt` 历史命令日志。这个仅会显示用 `apt` 命令安装的的程序。但不会显示被依赖安装的软件包,详细的日志在日志里可以看到。有时你只是想看看对吧? ``` grep " install " /var/log/apt/history.log ``` -具体的显示如下: +具体的显示如下: ``` Commandline: apt install pinta @@ -128,28 +146,30 @@ Commandline: apt install cool-retro-term Commandline: apt install ubuntu-software ``` -![显示最近已安装的软件包][13]显示最近已安装的软件包 +![显示最近已安装的软件包][13] -apt 的历史日志非常有用。因为他显示了什么时候执行了 apt 命令,哪个用户执行的命令以及安装的软件包名 +*显示最近已安装的软件包* -### 小贴士: 在软件中心显示已安装的程序包名 +`apt` 的历史日志非常有用。因为他显示了什么时候执行了 `apt` 命令,哪个用户执行的命令以及安装的软件包名。 -如果你觉得终端和命令行交互不友好,可以有一个方法查看系统的程序名。 +### 小技巧:在软件中心显示已安装的程序包名 + +如果你觉得终端和命令行交互不友好,还有一个方法可以查看系统的程序名。 可以打开软件中心,然后点击已安装标签。你可以看到系统上已经安装的程序包名 -![Ubuntu 软件中心显示已安装的软件包][14] 在软件中心显示已安装的软件包 +![Ubuntu 软件中心显示已安装的软件包][14] -这个不会显示库和其他命令行的东西,有可能你也不想看到他们,因为你是大量交互都是在 GUI,相反你可以一直用 Synaptic 软件包管理器。 +*在软件中心显示已安装的软件包* -**结束语** +这个不会显示库和其他命令行的东西,有可能你也不想看到它们,因为你的大量交互都是在 GUI。此外,你也可以用 Synaptic 软件包管理器。 -我希望这个简易的教程可以帮你查看 Ubuntu 和 基于 Debian 的发行版的已安装软件包。 +### 结束语 + +我希望这个简易的教程可以帮你查看 Ubuntu 和基于 Debian 的发行版的已安装软件包。 如果你对本文有什么问题或建议,请在下面留言。 - - -------------------------------------------------------------------------------- via: https://itsfoss.com/list-installed-packages-ubuntu @@ -157,7 +177,7 @@ via: https://itsfoss.com/list-installed-packages-ubuntu 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[guevaraya](https://github.com/guevaraya) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/sources/talk/20180916 The Rise and Demise of RSS.md b/sources/talk/20180916 The Rise and Demise of RSS.md index 8511d220d9..d7f5c610b6 100644 --- a/sources/talk/20180916 The Rise and Demise of RSS.md +++ b/sources/talk/20180916 The Rise and Demise of RSS.md @@ -1,3 +1,4 @@ +name1e5s translating The Rise and Demise of RSS ====== There are two stories here. The first is a story about a vision of the web’s future that never quite came to fruition. The second is a story about how a collaborative effort to improve a popular standard devolved into one of the most contentious forks in the history of open-source software development. diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/sources/talk/20181220 7 CI-CD tools for sysadmins.md deleted file mode 100644 index 76ff85fae3..0000000000 --- a/sources/talk/20181220 7 CI-CD tools for sysadmins.md +++ /dev/null @@ -1,136 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (jdh8383) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (7 CI/CD tools for sysadmins) -[#]: via: (https://opensource.com/article/18/12/cicd-tools-sysadmins) -[#]: author: (Dan Barker https://opensource.com/users/barkerd427) - -7 CI/CD tools for sysadmins -====== -An easy guide to the top open source continuous integration, continuous delivery, and continuous deployment tools. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc) - -Continuous integration, continuous delivery, and continuous deployment (CI/CD) have all existed in the developer community for many years. Some organizations have involved their operations counterparts, but many haven't. For most organizations, it's imperative for their operations teams to become just as familiar with CI/CD tools and practices as their development compatriots are. - -CI/CD practices can equally apply to infrastructure and third-party applications and internally developed applications. Also, there are many different tools but all use similar models. And possibly most importantly, leading your company into this new practice will put you in a strong position within your company, and you'll be a beacon for others to follow. - -Some organizations have been using CI/CD practices on infrastructure, with tools like [Ansible][1], [Chef][2], or [Puppet][3], for several years. Other tools, like [Test Kitchen][4], allow tests to be performed on infrastructure that will eventually host applications. In fact, those tests can even deploy the application into a production-like environment and execute application-level tests with production loads in more advanced configurations. However, just getting to the point of being able to test the infrastructure individually is a huge feat. Terraform can also use Test Kitchen for even more [ephemeral][5] and [idempotent][6] infrastructure configurations than some of the original configuration-management tools. Add in Linux containers and Kubernetes, and you can now test full infrastructure and application deployments with prod-like specs and resources that come and go in hours rather than months or years. Everything is wiped out before being deployed and tested again. - -However, you can also focus on getting your network configurations or database data definition language (DDL) files into version control and start running small CI/CD pipelines on them. Maybe it just checks syntax or semantics or some best practices. Actually, this is how most development pipelines started. Once you get the scaffolding down, it will be easier to build on. You'll start to find all kinds of use cases for pipelines once you get started. - -For example, I regularly write a newsletter within my company, and I maintain it in version control using [MJML][7]. I needed to be able to host a web version, and some folks liked being able to get a PDF, so I built a [pipeline][8]. Now when I create a new newsletter, I submit it for a merge request in GitLab. This automatically creates an index.html with links to HTML and PDF versions of the newsletter. The HTML and PDF files are also created in the pipeline. None of this is published until someone comes and reviews these artifacts. Then, GitLab Pages publishes the website and I can pull down the HTML to send as a newsletter. In the future, I'll automatically send the newsletter when the merge request is merged or after a special approval step. This seems simple, but it has saved me a lot of time. This is really at the core of what these tools can do for you. They will save you time. - -The key is creating tools to work in the abstract so that they can apply to multiple problems with little change. I should also note that what I created required almost no code except [some light HTML templating][9], some [node to loop through the HTML files][10], and some more [node to populate the index page with all the HTML pages and PDFs][11]. - -Some of this might look a little complex, but most of it was taken from the tutorials of the different tools I'm using. And many developers are happy to work with you on these types of things, as they might also find them useful when they're done. The links I've provided are to a newsletter we plan to start for [DevOps KC][12], and all the code for creating the site comes from the work I did on our internal newsletter. - -Many of the tools listed below can offer this type of interaction, but some offer a slightly different model. The emerging model in this space is that of a declarative description of a pipeline in something like YAML with each stage being ephemeral and idempotent. Many of these systems also ensure correct sequencing by creating a [directed acyclic graph][13] (DAG) over the different stages of the pipeline. - -These stages are often run in Linux containers and can do anything you can do in a container. Some tools, like [Spinnaker][14], focus only on the deployment component and offer some operational features that others don't normally include. [Jenkins][15] has generally kept pipelines in an XML format and most interactions occur within the GUI, but more recent implementations have used a [domain specific language][16] (DSL) using [Groovy][17]. Further, Jenkins jobs normally execute on nodes with a special Java agent installed and consist of a mix of plugins and pre-installed components. - -Jenkins introduced pipelines in its tool, but they were a bit challenging to use and contained several caveats. Recently, the creator of Jenkins decided to move the community toward a couple different initiatives that will hopefully breathe new life into the project—which is the one that really brought CI/CD to the masses. I think its most interesting initiative is creating a Cloud Native Jenkins that can turn a Kubernetes cluster into a Jenkins CI/CD platform. - -As you learn more about these tools and start bringing these practices into your company or your operations division, you'll quickly gain followers. You will increase your own productivity as well as that of others. We all have years of backlog to get to—how much would your co-workers love if you could give them enough time to start tackling that backlog? Not only that, but your customers will start to see increased application reliability, and your management will see you as a force multiplier. That certainly can't hurt during your next salary negotiation or when interviewing with all your new skills. - -Let's dig into the tools a bit more. We'll briefly cover each one and share links to more information. - -### GitLab CI - -GitLab is a fairly new entrant to the CI/CD space, but it's already achieved the top spot in the [Forrester Wave for Continuous Integration Tools][20]. That's a huge achievement in such a crowded and highly qualified field. What makes GitLab CI so great? It uses a YAML file to describe the entire pipeline. It also has a functionality called Auto DevOps that allows for simpler projects to have a pipeline built automatically with multiple tests built-in. This system uses [Herokuish buildpacks][21] to determine the language and how to build the application. Some languages can also manage databases, which is a real game-changer for building new applications and getting them deployed to production from the beginning of the development process. The system has native integrations into Kubernetes and will deploy your application automatically into a Kubernetes cluster using one of several different deployment methodologies, like percentage-based rollouts and blue-green deployments. - -In addition to its CI functionality, GitLab offers many complementary features like operations and monitoring with Prometheus deployed automatically with your application; portfolio and project management using GitLab Issues, Epics, and Milestones; security checks built into the pipeline with the results provided as an aggregate across multiple projects; and the ability to edit code right in GitLab using the WebIDE, which can even provide a preview or execute part of a pipeline for faster feedback. - -### GoCD - -GoCD comes from the great minds at Thoughtworks, which is testimony enough for its capabilities and efficiency. To me, GoCD's main differentiator from the rest of the pack is its [Value Stream Map][22] (VSM) feature. In fact, pipelines can be chained together with one pipeline providing the "material" for the next pipeline. This allows for increased independence for different teams with different responsibilities in the deployment process. This may be a useful feature when introducing this type of system in older organizations that intend to keep these teams separate—but having everyone using the same tool will make it easier later to find bottlenecks in the VSM and reorganize the teams or work to increase efficiencies. - -It's incredibly valuable to have a VSM for each product in a company; that GoCD allows this to be [described in JSON or YAML][23] in version control and presented visually with all the data around wait times makes this tool even more valuable to an organization trying to understand itself better. Start by installing GoCD and mapping out your process with only manual approval gates. Then have each team use the manual approvals so you can start collecting data on where bottlenecks might exist. - -### Travis CI - -Travis CI was my first experience with a Software as a Service (SaaS) CI system, and it's pretty awesome. The pipelines are stored as YAML with your source code, and it integrates seamlessly with tools like GitHub. I don't remember the last time a pipeline failed because of Travis CI or the integration—Travis CI has a very high uptime. Not only can it be used as SaaS, but it also has a version that can be hosted. I haven't run that version—there were a lot of components, and it looked a bit daunting to install all of it. I'm guessing it would be much easier to deploy it all to Kubernetes with [Helm charts provided by Travis CI][26]. Those charts don't deploy everything yet, but I'm sure it will grow even more in the future. There is also an enterprise version if you don't want to deal with the hassle. - -However, if you're developing open source code, you can use the SaaS version of Travis CI for free. That is an awesome service provided by an awesome team! This alleviates a lot of overhead and allows you to use a fairly common platform for developing open source code without having to run anything. - -### Jenkins - -Jenkins is the original, the venerable, de facto standard in CI/CD. If you haven't already, you need to read "[Jenkins: Shifting Gears][27]" from Kohsuke, the creator of Jenkins and CTO of CloudBees. It sums up all of my feelings about Jenkins and the community from the last decade. What he describes is something that has been needed for several years, and I'm happy CloudBees is taking the lead on this transformation. Jenkins will be a bit overwhelming to most non-developers and has long been a burden on its administrators. However, these are items they're aiming to fix. - -[Jenkins Configuration as Code][28] (JCasC) should help fix the complex configuration issues that have plagued admins for years. This will allow for a zero-touch configuration of Jenkins masters through a YAML file, similar to other CI/CD systems. [Jenkins Evergreen][29] aims to make this process even easier by providing predefined Jenkins configurations based on different use cases. These distributions should be easier to maintain and upgrade than the normal Jenkins distribution. - -Jenkins 2 introduced native pipeline functionality with two types of pipelines, which [I discuss][30] in a LISA17 presentation. Neither is as easy to navigate as YAML when you're doing something simple, but they're quite nice for doing more complex tasks. - -[Jenkins X][31] is the full transformation of Jenkins and will likely be the implementation of Cloud Native Jenkins (or at least the thing most users see when using Cloud Native Jenkins). It will take JCasC and Evergreen and use them at their best natively on Kubernetes. These are exciting times for Jenkins, and I look forward to its innovation and continued leadership in this space. - -### Concourse CI - -I was first introduced to Concourse through folks at Pivotal Labs when it was an early beta version—there weren't many tools like it at the time. The system is made of microservices, and each job runs within a container. One of its most useful features that other tools don't have is the ability to run a job from your local system with your local changes. This means you can develop locally (assuming you have a connection to the Concourse server) and run your builds just as they'll run in the real build pipeline. Also, you can rerun failed builds from your local system and inject specific changes to test your fixes. - -Concourse also has a simple extension system that relies on the fundamental concept of resources. Basically, each new feature you want to provide to your pipeline can be implemented in a Docker image and included as a new resource type in your configuration. This keeps all functionality encapsulated in a single, immutable artifact that can be upgraded and modified independently, and breaking changes don't necessarily have to break all your builds at the same time. - -### Spinnaker - -Spinnaker comes from Netflix and is more focused on continuous deployment than continuous integration. It can integrate with other tools, including Travis and Jenkins, to kick off test and deployment pipelines. It also has integrations with monitoring tools like Prometheus and Datadog to make decisions about deployments based on metrics provided by these systems. For example, the canary deployment uses a judge concept and the metrics being collected to determine if the latest canary deployment has caused any degradation in pertinent metrics and should be rolled back or if deployment can continue. - -A couple of additional, unique features related to deployments cover an area that is often overlooked when discussing continuous deployment, and might even seem antithetical, but is critical to success: Spinnaker helps make continuous deployment a little less continuous. It will prevent a stage from running during certain times to prevent a deployment from occurring during a critical time in the application lifecycle. It can also enforce manual approvals to ensure the release occurs when the business will benefit the most from the change. In fact, the whole point of continuous integration and continuous deployment is to be ready to deploy changes as quickly as the business needs to change. - -### Screwdriver - -Screwdriver is an impressively simple piece of engineering. It uses a microservices approach and relies on tools like Nomad, Kubernetes, and Docker to act as its execution engine. There is a pretty good [deployment tutorial][34] for deploying to AWS and Kubernetes, but it could be improved once the in-progress [Helm chart][35] is completed. - -Screwdriver also uses YAML for its pipeline descriptions and includes a lot of sensible defaults, so there's less boilerplate configuration for each pipeline. The configuration describes an advanced workflow that can have complex dependencies among jobs. For example, a job can be guaranteed to run after or before another job. Jobs can run in parallel and be joined afterward. You can also use logical operators to run a job, for example, if any of its dependencies are successful or only if all are successful. Even better is that you can specify certain jobs to be triggered from a pull request. Also, dependent jobs won't run when this occurs, which allows easy segregation of your pipeline for when an artifact should go to production and when it still needs to be reviewed. - -This is only a brief description of these CI/CD tools—each has even more cool features and differentiators you can investigate. They are all open source and free to use, so go deploy them and see which one fits your needs best. - -### What to read next - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/cicd-tools-sysadmins - -作者:[Dan Barker][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/barkerd427 -[b]: https://github.com/lujun9972 -[1]: https://www.ansible.com/ -[2]: https://www.chef.io/ -[3]: https://puppet.com/ -[4]: https://github.com/test-kitchen/test-kitchen -[5]: https://www.merriam-webster.com/dictionary/ephemeral -[6]: https://en.wikipedia.org/wiki/Idempotence -[7]: https://mjml.io/ -[8]: https://gitlab.com/devopskc/newsletter/blob/master/.gitlab-ci.yml -[9]: https://gitlab.com/devopskc/newsletter/blob/master/index/index.html -[10]: https://gitlab.com/devopskc/newsletter/blob/master/html-to-pdf.js -[11]: https://gitlab.com/devopskc/newsletter/blob/master/populate-index.js -[12]: https://devopskc.com/ -[13]: https://en.wikipedia.org/wiki/Directed_acyclic_graph -[14]: https://www.spinnaker.io/ -[15]: https://jenkins.io/ -[16]: https://martinfowler.com/books/dsl.html -[17]: http://groovy-lang.org/ -[18]: https://about.gitlab.com/product/continuous-integration/ -[19]: https://gitlab.com/gitlab-org/gitlab-ce/ -[20]: https://about.gitlab.com/2017/09/27/gitlab-leader-continuous-integration-forrester-wave/ -[21]: https://github.com/gliderlabs/herokuish -[22]: https://www.gocd.org/getting-started/part-3/#value_stream_map -[23]: https://docs.gocd.org/current/advanced_usage/pipelines_as_code.html -[24]: https://docs.travis-ci.com/ -[25]: https://github.com/travis-ci/travis-ci -[26]: https://github.com/travis-ci/kubernetes-config -[27]: https://jenkins.io/blog/2018/08/31/shifting-gears/ -[28]: https://jenkins.io/projects/jcasc/ -[29]: https://github.com/jenkinsci/jep/blob/master/jep/300/README.adoc -[30]: https://danbarker.codes/talk/lisa17-becoming-plumber-building-deployment-pipelines/ -[31]: https://jenkins-x.io/ -[32]: https://concourse-ci.org/ -[33]: https://github.com/concourse/concourse -[34]: https://docs.screwdriver.cd/cluster-management/kubernetes -[35]: https://github.com/screwdriver-cd/screwdriver-chart diff --git a/sources/talk/20190121 Booting Linux faster.md b/sources/talk/20190121 Booting Linux faster.md index ef79351e0e..871efc1957 100644 --- a/sources/talk/20190121 Booting Linux faster.md +++ b/sources/talk/20190121 Booting Linux faster.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (alim0x) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md b/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md deleted file mode 100644 index 884d89ca42..0000000000 --- a/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md +++ /dev/null @@ -1,99 +0,0 @@ -translating by Cycoe -Cycoe 翻译中 -8 KDE Plasma Tips and Tricks to Improve Your Productivity -====== - -[#] leon-shi is translating -![](https://www.maketecheasier.com/assets/uploads/2018/01/kde-plasma-desktop-featured.jpg) - -KDE's Plasma is easily one of the most powerful desktop environments available for Linux. It's highly configurable, and it looks pretty good, too. That doesn't amount to a whole lot unless you can actually get things done. - -You can easily configure Plasma and make use of a lot of its convenient and time-saving features to boost your productivity and have a desktop that empowers you, rather than getting in your way. - -These tips aren't in any particular order, so you don't need to prioritize. Pick the ones that best fit your workflow. - - **Related** : [10 of the Best KDE Plasma Applications You Should Try][1] - -### 1. Multimedia Controls - -This isn't so much of a tip as it is something that's good to keep in mind. Plasma keeps multimedia controls everywhere. You don't need to open your media player every time you need to pause, resume, or skip a song; you can mouse over the minimized window or even control it via the lock screen. There's no need to scramble to log in to change a song or because you forgot to pause one. - -### 2. KRunner - -![KDE Plasma KRunner][2] - -KRunner is an often under-appreciated feature of the Plasma desktop. Most people are used to digging through the application launcher menu to find the program that they're looking to launch. That's not necessary with KRunner. - -To use KRunner, make sure that your focus is on the desktop itself. (Click on it instead of a window.) Then, start typing the name of the program that you want. KRunner will automatically drop down from the top of your screen with suggestions. Click or press Enter on the one you're looking for. It's much faster than remembering which category your program is under. - -### 3. Jump Lists - -![KDE Plasma Jump Lists][3] - -Jump lists are a fairly recent addition to the Plasma desktop. They allow you to launch an application directly to a specific section or feature. - -So if you have a launcher on a menu bar, you can right-click and get a list of places to jump to. Select where you want to go, and you're off. - -### 4. KDE Connect - -![KDE Connect Menu Android][4] - -[KDE Connect][5] is a massive help if you have an Android phone. It connects the phone to your desktop so you can share things seamlessly between the devices. - -With KDE Connect, you can see your [Android device's notification][6] on your desktop in real time. It also enables you to send and receive text messages from Plasma without ever picking up your phone. - -KDE Connect also lets you send files and share web pages between your phone and your computer. You can easily move from one device to the other without a lot of hassle or losing your train of thought. - -### 5. Plasma Vaults - -![KDE Plasma Vault][7] - -Plasma Vaults are another new addition to the Plasma desktop. They are KDE's simple solution to encrypted files and folders. If you don't work with encrypted files, this one won't really save you any time. If you do, though, vaults are a much simpler approach. - -Plasma Vaults let you create encrypted directories as a regular user without root and manage them from your task bar. You can mount and unmount the directories on the fly without the need for external programs or additional privileges. - -### 6. Pager Widget - -![KDE Plasma Pager][8] - -Configure your desktop with the pager widget. It allows you to easily access three additional workspaces for even more screen room. - -Add the widget to your menu bar, and you can slide between multiple workspaces. These are all the size of your screen, so you gain multiple times the total screen space. That lets you lay out more windows without getting confused by a minimized mess or disorganization. - -### 7. Create a Dock - -![KDE Plasma Dock][9] - -Plasma is known for its flexibility and the room it allows for configuration. Use that to your advantage. If you have programs that you're always using, consider setting up an OS X style dock with your most used applications. You'll be able to get them with a single click rather than going through a menu or typing in their name. - -### 8. Add a File Tree to Dolphin - -![Plasma Dolphin Directory][10] - -It's much easier to navigate folders in a directory tree. Dolphin, Plasma's default file manager, has built-in functionality to display a directory listing in the form of a tree on the side of the folder window. - -To enable the directory tree, click on the "Control" tab, then "Configure Dolphin," "View Modes," and "Details." Finally, select "Expandable Folders." - -Remember that these tips are just tips. Don't try to force yourself to do something that's getting in your way. You may hate using file trees in Dolphin. You may never use Pager. That's alright. There may even be something that you personally like that's not listed here. Do what works for you. That said, at least a few of these should shave some serious time out of your work day. - --------------------------------------------------------------------------------- - -via: https://www.maketecheasier.com/kde-plasma-tips-tricks-improve-productivity/ - -作者:[Nick Congleton][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.maketecheasier.com/author/nickcongleton/ -[1]:https://www.maketecheasier.com/10-best-kde-plasma-applications/ (10 of the Best KDE Plasma Applications You Should Try) -[2]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-krunner.jpg (KDE Plasma KRunner) -[3]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-jumplist.jpg (KDE Plasma Jump Lists) -[4]:https://www.maketecheasier.com/assets/uploads/2017/05/kde-connect-menu-e1494899929112.jpg (KDE Connect Menu Android) -[5]:https://www.maketecheasier.com/send-receive-sms-linux-kde-connect/ -[6]:https://www.maketecheasier.com/android-notifications-ubuntu-kde-connect/ -[7]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-vault.jpg (KDE Plasma Vault) -[8]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-pager.jpg (KDE Plasma Pager) -[9]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-dock.jpg (KDE Plasma Dock) -[10]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-dolphin.jpg (Plasma Dolphin Directory) diff --git a/sources/tech/20180307 3 open source tools for scientific publishing.md b/sources/tech/20180307 3 open source tools for scientific publishing.md index 0bbc3578e9..ffb844e5dc 100644 --- a/sources/tech/20180307 3 open source tools for scientific publishing.md +++ b/sources/tech/20180307 3 open source tools for scientific publishing.md @@ -1,3 +1,4 @@ +tomjlw is translating 3 open source tools for scientific publishing ====== @@ -51,7 +52,7 @@ We are always on the lookout for opportunities to engage with the best emerging via: https://opensource.com/article/18/3/scientific-publishing-software 作者:[Paul Shanno][a] -译者:[译者ID](https://github.com/译者ID) +译者:[tomjlw](https://github.com/tomjlw) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/sources/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md b/sources/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md deleted file mode 100644 index 6cbea61308..0000000000 --- a/sources/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md +++ /dev/null @@ -1,125 +0,0 @@ -Qalculate! – The Best Calculator Application in The Entire Universe -====== -I have been a GNU-Linux user and a [Debian][1] user for more than a decade. As I started using the desktop more and more, it seemed to me that apart from few web-based services most of my needs were being met with [desktop applications][2] within Debian itself. - -One of such applications was the need for me to calculate between different measurements of units. While there are and were many web-services which can do the same, I wanted something which could do all this and more on my desktop for both privacy reasons as well as not having to hunt for a web service for doing one thing or the other. My search ended when I found Qalculate!. - -### Qalculate! The most versatile calculator application - -![Qalculator is the best calculator app][3] - -This is what aptitude says about [Qalculate!][4] and I cannot put it in better terms: - -> Powerful and easy to use desktop calculator – GTK+ version -> -> Qalculate! is small and simple to use but with much power and versatility underneath. Features include customizable functions, units, arbitrary precision, plotting, and a graphical interface that uses a one-line fault-tolerant expression entry (although it supports optional traditional buttons). - -It also did have a KDE interface as well as in its previous avatar, but at least in Debian testing, it just shows only the GTK+ version which can be seen from the github [repo][5] as well. - -Needless to say that Qalculate! is available in Debian repository and hence can easily be installed [using apt command][6] or through software center in Debian based distributions like Ubuntu. It is also availale for Windows and macOS. - -#### Features of Qalculate! - -Now while it would be particularly long to go through the whole list of functionality it allows – allow me to list some of the functionality to be followed by a few screenshots of just a couple of functionalities that Qalculate! provides. The idea is basically to familiarize you with a couple of basic methods and then leave it up to you to enjoy exploring what all Qalculate! can do. - - * Algebra - * Calculus - * Combinatorics - * Complex_Numbers - * Data_Sets - * Date_&_Time - * Economics - * Exponents_&_Logarithms - * Geometry - * Logical - * Matrices_&_Vectors - * Miscellaneous - * Number_Theory - * Statistics - * Trigonometry - - - -#### Using Qalculate! - -Using Qalculate! is not complicated. You can even write in the simple natural language. However, I recommend [reading the manual][7] to utilize the full potential of Qalculate! - -![qalculate byte to gibibyte conversion ][8] - -![conversion from celcius degrees to fahreneit][9] - -#### qalc is the command line version of Qalculate! - -You can achieve the same results as Qalculate! with its command-line brethren qalc -``` -$ qalc 62499836 byte to gibibyte -62499836 * byte = approx. 0.058207508 gibibyte - -$ qalc 40 degree celsius to fahrenheit -(40 * degree) * celsius = 104 deg*oF - -``` - -I shared the command-line interface so that people who don’t like GUI interfaces and prefer command-line (CLI) or have headless nodes (no GUI) could also use qalculate, pretty common in server environments. - -If you want to use it in scripts, I guess libqalculate would be the way to go and seeing how qalculate-gtk, qalc depend on it seems it should be good enough. - -Just to share, you could also explore how to use plotting of series data but that and other uses will leave to you. Don’t forget to check the /usr/share/doc/qalculate/index.html to see all the different functionalities that Qalculate! has. - -Note:- Do note that though Debian prefers [gnuplot][10] to showcase the pretty graphs that can come out of it. - -#### Bonus Tip: You can thank the developer via command line in Debian - -If you use Debian and like any package, you can quickly thank the Debian Developer or maintainer maintaining the said package using: -``` -reportbug --kudos $PACKAGENAME - -``` - -Since I liked QaIculate!, I would like to give a big shout-out to the Debian developer and maintainer Vincent Legout for the fantastic work he has done. -``` -reportbug --kudos qalculate - -``` - -I would also suggest reading my detailed article on using reportbug tool for [bug reporting in Debian][11]. - -#### The opinion of a Polymer Chemist on Qalculate! - -Through my fellow author [Philip Prado][12], we contacted a Mr. Timothy Meyers, currently a student working in a polymer lab as a Polymer Chemist. - -His professional opinion on Qaclulate! is – - -> This looks like almost any scientist to use as any type of data calculations statistics could use this program issue would be do you know the commands and such to make it function -> -> I feel like there’s some Physics constants that are missing but off the top of my head I can’t think of what they are but I feel like there’s not very many [fluid dynamics][13] stuff in there and also some different like [light absorption][14] coefficients for different compounds but that’s just a chemist in me I don’t know if those are super necessary. [Free energy][15] might be one - -In the end, I just want to share this is a mere introduction to what Qalculate! can do and is limited by what you want to get done and your imagination. I hope you like Qalculate! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/qalculate/ - -作者:[Shirish][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://itsfoss.com/author/shirish/ -[1]:https://www.debian.org/ -[2]:https://itsfoss.com/essential-linux-applications/ -[3]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/qalculate-app-featured-1-800x450.jpeg -[4]:https://qalculate.github.io/ -[5]:https://github.com/Qalculate -[6]:https://itsfoss.com/apt-command-guide/ -[7]:https://qalculate.github.io/manual/index.html -[8]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/04/qalculate-byte-conversion.png -[9]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/04/qalculate-gtk-weather-conversion.png -[10]:http://www.gnuplot.info/ -[11]:https://itsfoss.com/bug-report-debian/ -[12]:https://itsfoss.com/author/phillip/ -[13]:https://en.wikipedia.org/wiki/Fluid_dynamics -[14]:https://en.wikipedia.org/wiki/Absorption_(electromagnetic_radiation) -[15]:https://en.wikipedia.org/wiki/Gibbs_free_energy diff --git a/sources/tech/20190104 Midori- A Lightweight Open Source Web Browser.md b/sources/tech/20190104 Midori- A Lightweight Open Source Web Browser.md index a2e31daf6c..fa1bd9c2c2 100644 --- a/sources/tech/20190104 Midori- A Lightweight Open Source Web Browser.md +++ b/sources/tech/20190104 Midori- A Lightweight Open Source Web Browser.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md b/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md new file mode 100644 index 0000000000..29d5f63d2a --- /dev/null +++ b/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md @@ -0,0 +1,514 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Desktop Setup · HookRace Blog) +[#]: via: (https://hookrace.net/blog/linux-desktop-setup/) +[#]: author: (Dennis Felsing http://felsin9.de/nnis/) + +Linux Desktop Setup +====== + + +My software setup has been surprisingly constant over the last decade, after a few years of experimentation since I initially switched to Linux in 2006. It might be interesting to look back in another 10 years and see what changed. A quick overview of what’s running as I’m writing this post: + +[![htop overview][1]][2] + +### Motivation + +My software priorities are, in no specific order: + + * Programs should run on my local system so that I’m in control of them, this excludes cloud solutions. + * Programs should run in the terminal, so that they can be used consistently from anywhere, including weak computers or a phone. + * Keyboard focused is nearly automatic by using terminal software. I prefer to use the mouse where it makes sense only, reaching for the mouse all the time during typing feels like a waste of time. Occasionally it took me an hour to notice that the mouse wasn’t even plugged in. + * Ideally use fast and efficient software, I don’t like hearing the fan and feeling the room heat up. I can also keep running older hardware for much longer, my 10 year old Thinkpad x200s is still fine for all the software I use. + * Be composable. I don’t want to do every step manually, instead automate more when it makes sense. This naturally favors the shell. + + + +### Operating Systems + +I had a hard start with Linux 12 years ago by removing Windows, armed with just the [Gentoo Linux][3] installation CD and a printed manual to get a functioning Linux system. It took me a few days of compiling and tinkering, but in the end I felt like I had learnt a lot. + +I haven’t looked back to Windows since then, but I switched to [Arch Linux][4] on my laptop after having the fan fail from the constant compilation stress. Later I also switched all my other computers and private servers to Arch Linux. As a rolling release distribution you get package upgrades all the time, but the most important breakages are nicely reported in the [Arch Linux News][5]. + +One annoyance though is that Arch Linux removes the old kernel modules once you upgrade it. I usually notice that once I try plugging in a USB flash drive and the kernel fails to load the relevant module. Instead you’re supposed to reboot after each kernel upgrade. There are a few [hacks][6] around to get around the problem, but I haven’t been bothered enough to actually use them. + +Similar problems happen with other programs, commonly Firefox, cron or Samba requiring a restart after an upgrade, but annoyingly not warning you that that’s the case. [SUSE][7], which I use at work, nicely warns about such cases. + +For the [DDNet][8] production servers I prefer [Debian][9] over Arch Linux, so that I have a lower chance of breakage on each upgrade. For my firewall and router I used [OpenBSD][10] for its clean system, documentation and great [pf firewall][11], but right now I don’t have a need for a separate router anymore. + +### Window Manager + +Since I started out with Gentoo I quickly noticed the huge compile time of KDE, which made it a no-go for me. I looked around for more minimal solutions, and used [Openbox][12] and [Fluxbox][13] initially. At some point I jumped on the tiling window manager train in order to be more keyboard-focused and picked up [dwm][14] and [awesome][15] close to their initial releases. + +In the end I settled on [xmonad][16] thanks to its flexibility, extendability and being written and configured in pure [Haskell][17], a great functional programming language. One example of this is that at home I run a single 40” 4K screen, but often split it up into four virtual screens, each displaying a workspace on which my windows are automatically arranged. Of course xmonad has a [module][18] for that. + +[dzen][19] and [conky][20] function as a simple enough status bar for me. My entire conky config looks like this: + +``` +out_to_console yes +update_interval 1 +total_run_times 0 + +TEXT +${downspeed eth0} ${upspeed eth0} | $cpu% ${loadavg 1} ${loadavg 2} ${loadavg 3} $mem/$memmax | ${time %F %T} +``` + +And gets piped straight into dzen2 with `conky | dzen2 -fn '-xos4-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*' -bg '#000000' -fg '#ffffff' -p -e '' -x 1000 -w 920 -xs 1 -ta r`. + +One important feature for me is to make the terminal emit a beep sound once a job is done. This is done simply by adding a `\a` character to the `PR_TITLEBAR` variable in zsh, which is shown whenever a job is done. Of course I disable the actual beep sound by blacklisting the `pcspkr` kernel module with `echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf`. Instead the sound gets turned into an urgency by urxvt’s `URxvt.urgentOnBell: true` setting. Then xmonad has an urgency hook to capture this and I can automatically focus the currently urgent window with a key combination. In dzen I get the urgent windowspaces displayed with a nice and bright `#ff0000`. + +The final result in all its glory on my Laptop: + +[![Laptop screenshot][21]][22] + +I hear that [i3][23] has become quite popular in the last years, but it requires more manual window alignment instead of specifying automated methods to do it. + +I realize that there are also terminal multiplexers like [tmux][24], but I still require a few graphical applications, so in the end I never used them productively. + +### Terminal Persistency + +In order to keep terminals alive I use [dtach][25], which is just the detach feature of screen. In order to make every terminal on my computer detachable I wrote a [small wrapper script][26]. This means that even if I had to restart my X server I could keep all my terminals running just fine, both local and remote. + +### Shell & Programming + +Instead of [bash][27] I use [zsh][28] as my shell for its huge number of features. + +As a terminal emulator I found [urxvt][29] to be simple enough, support Unicode and 256 colors and has great performance. Another great feature is being able to run the urxvt client and daemon separately, so that even a large number of terminals barely takes up any memory (except for the scrollback buffer). + +There is only one font that looks absolutely clean and perfect to me: [Terminus][30]. Since i’s a bitmap font everything is pixel perfect and renders extremely fast and at low CPU usage. In order to switch fonts on-demand in each terminal with `CTRL-WIN-[1-7]` my ~/.Xdefaults contains: + +``` +URxvt.font: -xos4-terminus-medium-r-normal-*-14-*-*-*-*-*-*-* +dzen2.font: -xos4-terminus-medium-r-normal-*-14-*-*-*-*-*-*-* + +URxvt.keysym.C-M-1: command:\033]50;-xos4-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-2: command:\033]50;-xos4-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-3: command:\033]50;-xos4-terminus-medium-r-normal-*-18-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-4: command:\033]50;-xos4-terminus-medium-r-normal-*-22-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-5: command:\033]50;-xos4-terminus-medium-r-normal-*-24-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-6: command:\033]50;-xos4-terminus-medium-r-normal-*-28-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-7: command:\033]50;-xos4-terminus-medium-r-normal-*-32-*-*-*-*-*-*-*\007 + +URxvt.keysym.C-M-n: command:\033]10;#ffffff\007\033]11;#000000\007\033]12;#ffffff\007\033]706;#00ffff\007\033]707;#ffff00\007 +URxvt.keysym.C-M-b: command:\033]10;#000000\007\033]11;#ffffff\007\033]12;#000000\007\033]706;#0000ff\007\033]707;#ff0000\007 +``` + +For programming and writing I use [Vim][31] with syntax highlighting and [ctags][32] for indexing, as well as a few terminal windows with grep, sed and the other usual suspects for search and manipulation. This is probably not at the same level of comfort as an IDE, but allows me more automation. + +One problem with Vim is that you get so used to its key mappings that you’ll want to use them everywhere. + +[Python][33] and [Nim][34] do well as scripting languages where the shell is not powerful enough. + +### System Monitoring + +[htop][35] (look at the background of that site, it’s a live view of the server that’s hosting it) works great for getting a quick overview of what the software is currently doing. [lm_sensors][36] allows monitoring the hardware temperatures, fans and voltages. [powertop][37] is a great little tool by Intel to find power savings. [ncdu][38] lets you analyze disk usage interactively. + +[nmap][39], iptraf-ng, [tcpdump][40] and [Wireshark][41] are essential tools for analyzing network problems. + +There are of course many more great tools. + +### Mails & Synchronization + +On my home server I have a [fetchmail][42] daemon running for each email acccount that I have. Fetchmail just retrieves the incoming emails and invokes [procmail][43]: + +``` +#!/bin/sh +for i in /home/deen/.fetchmail/*; do + FETCHMAILHOME=$i /usr/bin/fetchmail -m 'procmail -d %T' -d 60 +done +``` + +The configuration is as simple as it could be and waits for the server to inform us of fresh emails: + +``` +poll imap.1und1.de protocol imap timeout 120 user "dennis@felsin9.de" password "XXX" folders INBOX keep ssl idle +``` + +My `.procmailrc` config contains a few rules to backup all mails and sort them into the correct directories, for example based on the mailing list id or from field in the mail header: + +``` +MAILDIR=/home/deen/shared/Maildir +LOGFILE=$HOME/.procmaillog +LOGABSTRACT=no +VERBOSE=off +FORMAIL=/usr/bin/formail +NL=" +" + +:0wc +* ! ? test -d /media/mailarchive/`date +%Y` +| mkdir -p /media/mailarchive/`date +%Y` + +# Make backups of all mail received in format YYYY/YYYY-MM +:0c +/media/mailarchive/`date +%Y`/`date +%Y-%m` + +:0 +* ^From: .*(.*@.*.kit.edu|.*@.*.uka.de|.*@.*.uni-karlsruhe.de) +$MAILDIR/.uni/ + +:0 +* ^list-Id:.*lists.kit.edu +$MAILDIR/.uni-ml/ + +[...] +``` + +To send emails I use [msmtp][44], which is also great to configure: + +``` +account default +host smtp.1und1.de +tls on +tls_trust_file /etc/ssl/certs/ca-certificates.crt +auth on +from dennis@felsin9.de +user dennis@felsin9.de +password XXX + +[...] +``` + +But so far the emails are still on the server. My documents are all stored in a directory that I synchronize between all computers using [Unison][45]. Think of Unison as a bidirectional interactive [rsync][46]. My emails are part of this documents directory and thus they end up on my desktop computers. + +This also means that while the emails reach my server immediately, I only fetch them on deman instead of getting instant notifications when an email comes in. + +From there I read the mails with [mutt][47], using the sidebar plugin to display my mail directories. The `/etc/mailcap` file is essential to display non-plaintext mails containing HTML, Word or PDF: + +``` +text/html;w3m -I %{charset} -T text/html; copiousoutput +application/msword; antiword %s; copiousoutput +application/pdf; pdftotext -layout /dev/stdin -; copiousoutput +``` + +### News & Communication + +[Newsboat][48] is a nice little RSS/Atom feed reader in the terminal. I have it running on the server in a `tach` session with about 150 feeds. Filtering feeds locally is also possible, for example: + +``` +ignore-article "https://forum.ddnet.tw/feed.php" "title =~ \"Map Testing •\" or title =~ \"Old maps •\" or title =~ \"Map Bugs •\" or title =~ \"Archive •\" or title =~ \"Waiting for mapper •\" or title =~ \"Other mods •\" or title =~ \"Fixes •\"" +``` + +I use [Irssi][49] the same way for communication via IRC. + +### Calendar + +[remind][50] is a calendar that can be used from the command line. Setting new reminders is done by editing the `rem` files: + +``` +# One time events +REM 2019-01-20 +90 Flight to China %b + +# Recurring Holidays +REM 1 May +90 Holiday "Tag der Arbeit" %b +REM [trigger(easterdate(year(today()))-2)] +90 Holiday "Karfreitag" %b + +# Time Change +REM Nov Sunday 1 --7 +90 Time Change (03:00 -> 02:00) %b +REM Apr Sunday 1 --7 +90 Time Change (02:00 -> 03:00) %b + +# Birthdays +FSET birthday(x) "'s " + ord(year(trigdate())-x) + " birthday is %b" +REM 16 Apr +90 MSG Andreas[birthday(1994)] + +# Sun +SET $LatDeg 49 +SET $LatMin 19 +SET $LatSec 49 +SET $LongDeg -8 +SET $LongMin -40 +SET $LongSec -24 + +MSG Sun from [sunrise(trigdate())] to [sunset(trigdate())] +[...] +``` + +Unfortunately there is no Chinese Lunar calendar function in remind yet, so Chinese holidays can’t be calculated easily. + +I use two aliases for remind: + +``` +rem -m -b1 -q -g +``` + +to see a list of the next events in chronological order and + +``` +rem -m -b1 -q -cuc12 -w$(($(tput cols)+1)) | sed -e "s/\f//g" | less +``` + +to show a calendar fitting just the width of my terminal: + +![remcal][51] + +### Dictionary + +[rdictcc][52] is a little known dictionary tool that uses the excellent dictionary files from [dict.cc][53] and turns them into a local database: + +``` +$ rdictcc rasch +====================[ A => B ]==================== +rasch: + - apace + - brisk [speedy] + - cursory + - in a timely manner + - quick + - quickly + - rapid + - rapidly + - sharpish [Br.] [coll.] + - speedily + - speedy + - swift + - swiftly +rasch [gehen]: + - smartly [quickly] +Rasch {n} [Zittergras-Segge]: + - Alpine grass [Carex brizoides] + - quaking grass sedge [Carex brizoides] +Rasch {m} [regional] [Putzrasch]: + - scouring pad +====================[ B => A ]==================== +Rasch model: + - Rasch-Modell {n} +``` + +### Writing and Reading + +I have a simple todo file containing my tasks, that is basically always sitting open in a Vim session. For work I also use the todo file as a “done” file so that I can later check what tasks I finished on each day. + +For writing documents, letters and presentations I use [LaTeX][54] for its superior typesetting. A simple letter in German format can be set like this for example: + +``` +\documentclass[paper = a4, fromalign = right]{scrlttr2} +\usepackage{german} +\usepackage{eurosym} +\usepackage[utf8]{inputenc} +\setlength{\parskip}{6pt} +\setlength{\parindent}{0pt} + +\setkomavar{fromname}{Dennis Felsing} +\setkomavar{fromaddress}{Meine Str. 1\\69181 Leimen} +\setkomavar{subject}{Titel} + +\setkomavar*{enclseparator}{Anlagen} + +\makeatletter +\@setplength{refvpos}{89mm} +\makeatother + +\begin{document} +\begin{letter} {Herr Soundso\\Deine Str. 2\\69121 Heidelberg} +\opening{Sehr geehrter Herr Soundso,} + +Sie haben bei mir seit dem Bla Bla Bla. + +Ich fordere Sie hiermit zu Bla Bla Bla auf. + +\closing{Mit freundlichen Grüßen} + +\end{letter} +\end{document} +``` + +Further example documents and presentations can be found over at [my private site][55]. + +To read PDFs [Zathura][56] is fast, has Vim-like controls and even supports two different PDF backends: Poppler and MuPDF. [Evince][57] on the other hand is more full-featured for the cases where I encounter documents that Zathura doesn’t like. + +### Graphical Editing + +[GIMP][58] and [Inkscape][59] are easy choices for photo editing and interactive vector graphics respectively. + +In some cases [Imagemagick][60] is good enough though and can be used straight from the command line and thus automated to edit images. Similarly [Graphviz][61] and [TikZ][62] can be used to draw graphs and other diagrams. + +### Web Browsing + +As a web browser I’ve always used [Firefox][63] for its extensibility and low resource usage compared to Chrome. + +Unfortunately the [Pentadactyl][64] extension development stopped after Firefox switched to Chrome-style extensions entirely, so I don’t have satisfying Vim-like controls in my browser anymore. + +### Media Players + +[mpv][65] with hardware decoding allows watching videos at 5% CPU load using the `vo=gpu` and `hwdec=vaapi` config settings. `audio-channels=2` in mpv seems to give me clearer downmixing to my stereo speakers / headphones than what PulseAudio does by default. A great little feature is exiting with `Shift-Q` instead of just `Q` to save the playback location. When watching with someone with another native tongue you can use `--secondary-sid=` to show two subtitles at once, the primary at the bottom, the secondary at the top of the screen + +My wirelss mouse can easily be made into a remote control with mpv with a small `~/.config/mpv/input.conf`: + +``` +MOUSE_BTN5 run "mixer" "pcm" "-2" +MOUSE_BTN6 run "mixer" "pcm" "+2" +MOUSE_BTN1 cycle sub-visibility +MOUSE_BTN7 add chapter -1 +MOUSE_BTN8 add chapter 1 +``` + +[youtube-dl][66] works great for watching videos hosted online, best quality can be achieved with `-f bestvideo+bestaudio/best --all-subs --embed-subs`. + +As a music player [MOC][67] hasn’t been actively developed for a while, but it’s still a simple player that plays every format conceivable, including the strangest Chiptune formats. In the AUR there is a [patch][68] adding PulseAudio support as well. Even with the CPU clocked down to 800 MHz MOC barely uses 1-2% of a single CPU core. + +![moc][69] + +My music collection sits on my home server so that I can access it from anywhere. It is mounted using [SSHFS][70] and automount in the `/etc/fstab/`: + +``` +root@server:/media/media /mnt/media fuse.sshfs noauto,x-systemd.automount,idmap=user,IdentityFile=/root/.ssh/id_rsa,allow_other,reconnect 0 0 +``` + +### Cross-Platform Building + +Linux is great to build packages for any major operating system except Linux itself! In the beginning I used [QEMU][71] to with an old Debian, Windows and Mac OS X VM to build for these platforms. + +Nowadays I switched to using chroot for the old Debian distribution (for maximum Linux compatibility), [MinGW][72] to cross-compile for Windows and [OSXCross][73] to cross-compile for Mac OS X. + +The script used to [build DDNet][74] as well as the [instructions for updating library builds][75] are based on this. + +### Backups + +As usual, we nearly forgot about backups. Even if this is the last chapter, it should not be an afterthought. + +I wrote [rrb][76] (reverse rsync backup) 10 years ago to wrap rsync so that I only need to give the backup server root SSH rights to the computers that it is backing up. Surprisingly rrb needed 0 changes in the last 10 years, even though I kept using it the entire time. + +The backups are stored straight on the filesystem. Incremental backups are implemented using hard links (`--link-dest`). A simple [config][77] defines how long backups are kept, which defaults to: + +``` +KEEP_RULES=( \ + 7 7 \ # One backup a day for the last 7 days + 31 8 \ # 8 more backups for the last month + 365 11 \ # 11 more backups for the last year +1825 4 \ # 4 more backups for the last 5 years +) +``` + +Since some of my computers don’t have a static IP / DNS entry and I still want to back them up using rrb I use a reverse SSH tunnel (as a systemd service) for them: + +``` +[Unit] +Description=Reverse SSH Tunnel +After=network.target + +[Service] +ExecStart=/usr/bin/ssh -N -R 27276:localhost:22 -o "ExitOnForwardFailure yes" server +KillMode=process +Restart=always + +[Install] +WantedBy=multi-user.target +``` + +Now the server can reach the client through `ssh -p 27276 localhost` while the tunnel is running to perform the backup, or in `.ssh/config` format: + +``` +Host cr-remote + HostName localhost + Port 27276 +``` + +While talking about SSH hacks, sometimes a server is not easily reachable thanks to some bad routing. In that case you can route the SSH connection through another server to get better routing, in this case going through the USA to reach my Chinese server which had not been reliably reachable from Germany for a few weeks: + +``` +Host chn.ddnet.tw + ProxyCommand ssh -q usa.ddnet.tw nc -q0 chn.ddnet.tw 22 + Port 22 +``` + +### Final Remarks + +Thanks for reading my random collection of tools. I probably forgot many programs that I use so naturally every day that I don’t even think about them anymore. Let’s see how stable my software setup stays in the next years. If you have any questions, feel free to get in touch with me at [dennis@felsin9.de][78]. + +Comments on [Hacker News][79]. + +-------------------------------------------------------------------------------- + +via: https://hookrace.net/blog/linux-desktop-setup/ + +作者:[Dennis Felsing][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://felsin9.de/nnis/ +[b]: https://github.com/lujun9972 +[1]: https://hookrace.net/public/linux-desktop/htop_small.png +[2]: https://hookrace.net/public/linux-desktop/htop.png +[3]: https://gentoo.org/ +[4]: https://www.archlinux.org/ +[5]: https://www.archlinux.org/news/ +[6]: https://www.reddit.com/r/archlinux/comments/4zrsc3/keep_your_system_fully_functional_after_a_kernel/ +[7]: https://www.suse.com/ +[8]: https://ddnet.tw/ +[9]: https://www.debian.org/ +[10]: https://www.openbsd.org/ +[11]: https://www.openbsd.org/faq/pf/ +[12]: http://openbox.org/wiki/Main_Page +[13]: http://fluxbox.org/ +[14]: https://dwm.suckless.org/ +[15]: https://awesomewm.org/ +[16]: https://xmonad.org/ +[17]: https://www.haskell.org/ +[18]: http://hackage.haskell.org/package/xmonad-contrib-0.15/docs/XMonad-Layout-LayoutScreens.html +[19]: http://robm.github.io/dzen/ +[20]: https://github.com/brndnmtthws/conky +[21]: https://hookrace.net/public/linux-desktop/laptop_small.png +[22]: https://hookrace.net/public/linux-desktop/laptop.png +[23]: https://i3wm.org/ +[24]: https://github.com/tmux/tmux/wiki +[25]: http://dtach.sourceforge.net/ +[26]: https://github.com/def-/tach/blob/master/tach +[27]: https://www.gnu.org/software/bash/ +[28]: http://www.zsh.org/ +[29]: http://software.schmorp.de/pkg/rxvt-unicode.html +[30]: http://terminus-font.sourceforge.net/ +[31]: https://www.vim.org/ +[32]: http://ctags.sourceforge.net/ +[33]: https://www.python.org/ +[34]: https://nim-lang.org/ +[35]: https://hisham.hm/htop/ +[36]: http://lm-sensors.org/ +[37]: https://01.org/powertop/ +[38]: https://dev.yorhel.nl/ncdu +[39]: https://nmap.org/ +[40]: https://www.tcpdump.org/ +[41]: https://www.wireshark.org/ +[42]: http://www.fetchmail.info/ +[43]: http://www.procmail.org/ +[44]: https://marlam.de/msmtp/ +[45]: https://www.cis.upenn.edu/~bcpierce/unison/ +[46]: https://rsync.samba.org/ +[47]: http://www.mutt.org/ +[48]: https://newsboat.org/ +[49]: https://irssi.org/ +[50]: https://www.roaringpenguin.com/products/remind +[51]: https://hookrace.net/public/linux-desktop/remcal.png +[52]: https://github.com/tsdh/rdictcc +[53]: https://www.dict.cc/ +[54]: https://www.latex-project.org/ +[55]: http://felsin9.de/nnis/research/ +[56]: https://pwmt.org/projects/zathura/ +[57]: https://wiki.gnome.org/Apps/Evince +[58]: https://www.gimp.org/ +[59]: https://inkscape.org/ +[60]: https://imagemagick.org/Usage/ +[61]: https://www.graphviz.org/ +[62]: https://sourceforge.net/projects/pgf/ +[63]: https://www.mozilla.org/en-US/firefox/new/ +[64]: https://github.com/5digits/dactyl +[65]: https://mpv.io/ +[66]: https://rg3.github.io/youtube-dl/ +[67]: http://moc.daper.net/ +[68]: https://aur.archlinux.org/packages/moc-pulse/ +[69]: https://hookrace.net/public/linux-desktop/moc.png +[70]: https://github.com/libfuse/sshfs +[71]: https://www.qemu.org/ +[72]: http://www.mingw.org/ +[73]: https://github.com/tpoechtrager/osxcross +[74]: https://github.com/ddnet/ddnet-scripts/blob/master/ddnet-release.sh +[75]: https://github.com/ddnet/ddnet-scripts/blob/master/ddnet-lib-update.sh +[76]: https://github.com/def-/rrb/blob/master/rrb +[77]: https://github.com/def-/rrb/blob/master/config.example +[78]: mailto:dennis@felsin9.de +[79]: https://news.ycombinator.com/item?id=18979731 diff --git a/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md b/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md deleted file mode 100644 index 7ab67f5c22..0000000000 --- a/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md +++ /dev/null @@ -1,236 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (hopefully2333) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Evil-Twin Framework: A tool for improving WiFi security) -[#]: via: (https://opensource.com/article/19/1/evil-twin-framework) -[#]: author: (André Esser https://opensource.com/users/andreesser) - -The Evil-Twin Framework: A tool for improving WiFi security -====== -Learn about a pen-testing tool intended to test the security of WiFi access points for all types of threats. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-cloud-safe.png?itok=yj2TFPzq) - -The increasing number of devices that connect over-the-air to the internet over-the-air and the wide availability of WiFi access points provide many opportunities for attackers to exploit users. By tricking users to connect to [rogue access points][1], hackers gain full control over the users' network connection, which allows them to sniff and alter traffic, redirect users to malicious sites, and launch other attacks over the network.. - -To protect users and teach them to avoid risky online behaviors, security auditors and researchers must evaluate users' security practices and understand the reasons they connect to WiFi access points without being confident they are safe. There are a significant number of tools that can conduct WiFi audits, but no single tool can test the many different attack scenarios and none of the tools integrate well with one another. - -The **Evil-Twin Framework** (ETF) aims to fix these problems in the WiFi auditing process by enabling auditors to examine multiple scenarios and integrate multiple tools. This article describes the framework and its functionalities, then provides some examples to show how it can be used. - -### The ETF architecture - -The ETF framework was written in [Python][2] because the development language is very easy to read and make contributions to. In addition, many of the ETF's libraries, such as **[Scapy][3]** , were already developed for Python, making it easy to use them for ETF. - -The ETF architecture (Figure 1) is divided into different modules that interact with each other. The framework's settings are all written in a single configuration file. The user can verify and edit the settings through the user interface via the **ConfigurationManager** class. Other modules can only read these settings and run according to them. - -![Evil-Twin Framework Architecture][5] - -Figure 1: Evil-Twin framework architecture - -The ETF supports multiple user interfaces that interact with the framework. The current default interface is an interactive console, similar to the one on [Metasploit][6]. A graphical user interface (GUI) and a command line interface (CLI) are under development for desktop/browser use, and mobile interfaces may be an option in the future. The user can edit the settings in the configuration file using the interactive console (and eventually with the GUI). The user interface can interact with every other module that exists in the framework. - -The WiFi module ( **AirCommunicator** ) was built to support a wide range of WiFi capabilities and attacks. The framework identifies three basic pillars of Wi-Fi communication: **packet sniffing** , **custom packet injection** , and **access point creation**. The three main WiFi communication modules are **AirScanner** , **AirInjector** , and **AirHost** , which are responsible for packet sniffing, packet injection, and access point creation, respectively. The three classes are wrapped inside the main WiFi module, AirCommunicator, which reads the configuration file before starting the services. Any type of WiFi attack can be built using one or more of these core features. - -To enable man-in-the-middle (MITM) attacks, which are a common way to attack WiFi clients, the framework has an integrated module called ETFITM (Evil-Twin Framework-in-the-Middle). This module is responsible for the creation of a web proxy used to intercept and manipulate HTTP/HTTPS traffic. - -There are many other tools that can leverage the MITM position created by the ETF. Through its extensibility, ETF can support them—and, instead of having to call them separately, you can add the tools to the framework just by extending the Spawner class. This enables a developer or security auditor to call the program with a preconfigured argument string from within the framework. - -The other way to extend the framework is through plugins. There are two categories of plugins: **WiFi plugins** and **MITM plugins**. MITM plugins are scripts that can run while the MITM proxy is active. The proxy passes the HTTP(S) requests and responses through to the plugins where they can be logged or manipulated. WiFi plugins follow a more complex flow of execution but still expose a fairly simple API to contributors who wish to develop and use their own plugins. WiFi plugins can be further divided into three categories, one for each of the core WiFi communication modules. - -Each of the core modules has certain events that trigger the execution of a plugin. For instance, AirScanner has three defined events to which a response can be programmed. The events usually correspond to a setup phase before the service starts running, a mid-execution phase while the service is running, and a teardown or cleanup phase after a service finishes. Since Python allows multiple inheritance, one plugin can subclass more than one plugin class. - -Figure 1 above is a summary of the framework's architecture. Lines pointing away from the ConfigurationManager mean that the module reads information from it and lines pointing towards it mean that the module can write/edit configurations. - -### Examples of using the Evil-Twin Framework - -There are a variety of ways ETF can conduct penetration testing on WiFi network security or work on end users' awareness of WiFi security. The following examples describe some of the framework's pen-testing functionalities, such as access point and client detection, WPA and WEP access point attacks, and evil twin access point creation. - -These examples were devised using ETF with WiFi cards that allow WiFi traffic capture. They also utilize the following abbreviations for ETF setup commands: - - * **APS** access point SSID - * **APB** access point BSSID - * **APC** access point channel - * **CM** client MAC address - - - -In a real testing scenario, make sure to replace these abbreviations with the correct information. - -#### Capturing a WPA 4-way handshake after a de-authentication attack - -This scenario (Figure 2) takes two aspects into consideration: the de-authentication attack and the possibility of catching a 4-way WPA handshake. The scenario starts with a running WPA/WPA2-enabled access point with one connected client device (in this case, a smartphone). The goal is to de-authenticate the client with a general de-authentication attack then capture the WPA handshake once it tries to reconnect. The reconnection will be done manually immediately after being de-authenticated. - -![Scenario for capturing a WPA handshake after a de-authentication attack][8] - -Figure 2: Scenario for capturing a WPA handshake after a de-authentication attack - -The consideration in this example is the ETF's reliability. The goal is to find out if the tools can consistently capture the WPA handshake. The scenario will be performed multiple times with each tool to check its reliability when capturing the WPA handshake. - -There is more than one way to capture a WPA handshake using the ETF. One way is to use a combination of the AirScanner and AirInjector modules; another way is to just use the AirInjector. The following scenario uses a combination of both modules. - -The ETF launches the AirScanner module and analyzes the IEEE 802.11 frames to find a WPA handshake. Then the AirInjector can launch a de-authentication attack to force a reconnection. The following steps must be done to accomplish this on the ETF: - - 1. Enter the AirScanner configuration mode: **config airscanner** - 2. Configure the AirScanner to not hop channels: **config airscanner** - 3. Set the channel to sniff the traffic on the access point channel (APC): **set fixed_sniffing_channel = ** - 4. Start the AirScanner module with the CredentialSniffer plugin: **start airscanner with credentialsniffer** - 5. Add a target access point BSSID (APS) from the sniffed access points list: **add aps where ssid = ** - 6. Start the AirInjector, which by default lauches the de-authentication attack: **start airinjector** - - - -This simple set of commands enables the ETF to perform an efficient and successful de-authentication attack on every test run. The ETF can also capture the WPA handshake on every test run. The following code makes it possible to observe the ETF's successful execution. - -``` -███████╗████████╗███████╗ -██╔════╝╚══██╔══╝██╔════╝ -█████╗     ██║   █████╗   -██╔══╝     ██║   ██╔══╝   -███████╗   ██║   ██║     -╚══════╝   ╚═╝   ╚═╝     -                                        - -[+] Do you want to load an older session? [Y/n]: n -[+] Creating new temporary session on 02/08/2018 -[+] Enter the desired session name: -ETF[etf/aircommunicator/]::> config airscanner -ETF[etf/aircommunicator/airscanner]::> listargs -  sniffing_interface =               wlan1; (var) -              probes =                True; (var) -             beacons =                True; (var) -        hop_channels =               false; (var) -fixed_sniffing_channel =                  11; (var) -ETF[etf/aircommunicator/airscanner]::> start airscanner with -arpreplayer        caffelatte         credentialsniffer  packetlogger       selfishwifi         -ETF[etf/aircommunicator/airscanner]::> start airscanner with credentialsniffer -[+] Successfully added credentialsniffer plugin. -[+] Starting packet sniffer on interface 'wlan1' -[+] Set fixed channel to 11 -ETF[etf/aircommunicator/airscanner]::> add aps where ssid = CrackWPA -ETF[etf/aircommunicator/airscanner]::> start airinjector -ETF[etf/aircommunicator/airscanner]::> [+] Starting deauthentication attack -                    - 1000 bursts of 1 packets -                    - 1 different packets -[+] Injection attacks finished executing. -[+] Starting post injection methods -[+] Post injection methods finished -[+] WPA Handshake found for client '70:3e:ac:bb:78:64' and network 'CrackWPA' -``` - -#### Launching an ARP replay attack and cracking a WEP network - -The next scenario (Figure 3) will also focus on the [Address Resolution Protocol][9] (ARP) replay attack's efficiency and the speed of capturing the WEP data packets containing the initialization vectors (IVs). The same network may require a different number of caught IVs to be cracked, so the limit for this scenario is 50,000 IVs. If the network is cracked during the first test with less than 50,000 IVs, that number will be the new limit for the following tests on the network. The cracking tool to be used will be **aircrack-ng**. - -The test scenario starts with an access point using WEP encryption and an offline client that knows the key—the key for testing purposes is 12345, but it can be a larger and more complex key. Once the client connects to the WEP access point, it will send out a gratuitous ARP packet; this is the packet that's meant to be captured and replayed. The test ends once the limit of packets containing IVs is captured. - -![Scenario for capturing a WPA handshake after a de-authentication attack][11] - -Figure 3: Scenario for capturing a WPA handshake after a de-authentication attack - -ETF uses Python's Scapy library for packet sniffing and injection. To minimize known performance problems in Scapy, ETF tweaks some of its low-level libraries to significantly speed packet injection. For this specific scenario, the ETF uses **tcpdump** as a background process instead of Scapy for more efficient packet sniffing, while Scapy is used to identify the encrypted ARP packet. - -This scenario requires the following commands and operations to be performed on the ETF: - - 1. Enter the AirScanner configuration mode: **config airscanner** - 2. Configure the AirScanner to not hop channels: **set hop_channels = false** - 3. Set the channel to sniff the traffic on the access point channel (APC): **set fixed_sniffing_channel = ** - 4. Enter the ARPReplayer plugin configuration mode: **config arpreplayer** - 5. Set the target access point BSSID (APB) of the WEP network: **set target_ap_bssid ** - 6. Start the AirScanner module with the ARPReplayer plugin: **start airscanner with arpreplayer** - - - -After executing these commands, ETF correctly identifies the encrypted ARP packet, then successfully performs an ARP replay attack, which cracks the network. - -#### Launching a catch-all honeypot - -The scenario in Figure 4 creates multiple access points with the same SSID. This technique discovers the encryption type of a network that was probed for but out of reach. By launching multiple access points with all security settings, the client will automatically connect to the one that matches the security settings of the locally cached access point information. - -![Scenario for capturing a WPA handshake after a de-authentication attack][13] - -Figure 4: Scenario for capturing a WPA handshake after a de-authentication attack - -Using the ETF, it is possible to configure the **hostapd** configuration file then launch the program in the background. Hostapd supports launching multiple access points on the same wireless card by configuring virtual interfaces, and since it supports all types of security configurations, a complete catch-all honeypot can be set up. For the WEP and WPA(2)-PSK networks, a default password is used, and for the WPA(2)-EAP, an "accept all" policy is configured. - -For this scenario, the following commands and operations must be performed on the ETF: - - 1. Enter the APLauncher configuration mode: **config aplauncher** - 2. Set the desired access point SSID (APS): **set ssid = ** - 3. Configure the APLauncher as a catch-all honeypot: **set catch_all_honeypot = true** - 4. Start the AirHost module: **start airhost** - - - -With these commands, the ETF can launch a complete catch-all honeypot with all types of security configurations. ETF also automatically launches the DHCP and DNS servers that allow clients to stay connected to the internet. ETF offers a better, faster, and more complete solution to create catch-all honeypots. The following code enables the successful execution of the ETF to be observed. - -``` -███████╗████████╗███████╗ -██╔════╝╚══██╔══╝██╔════╝ -█████╗     ██║   █████╗   -██╔══╝     ██║   ██╔══╝   -███████╗   ██║   ██║     -╚══════╝   ╚═╝   ╚═╝     -                                        - -[+] Do you want to load an older session? [Y/n]: n -[+] Creating ne´,cxzw temporary session on 03/08/2018 -[+] Enter the desired session name: -ETF[etf/aircommunicator/]::> config aplauncher -ETF[etf/aircommunicator/airhost/aplauncher]::> setconf ssid CatchMe -ssid = CatchMe -ETF[etf/aircommunicator/airhost/aplauncher]::> setconf catch_all_honeypot true -catch_all_honeypot = true -ETF[etf/aircommunicator/airhost/aplauncher]::> start airhost -[+] Killing already started processes and restarting network services -[+] Stopping dnsmasq and hostapd services -[+] Access Point stopped... -[+] Running airhost plugins pre_start -[+] Starting hostapd background process -[+] Starting dnsmasq service -[+] Running airhost plugins post_start -[+] Access Point launched successfully -[+] Starting dnsmasq service -``` - -### Conclusions and future work - -These scenarios use common and well-known attacks to help validate the ETF's capabilities for testing WiFi networks and clients. The results also validate that the framework's architecture enables new attack vectors and features to be developed on top of it while taking advantage of the platform's existing capabilities. This should accelerate development of new WiFi penetration-testing tools, since a lot of the code is already written. Furthermore, the fact that complementary WiFi technologies are all integrated in a single tool will make WiFi pen-testing simpler and more efficient. - -The ETF's goal is not to replace existing tools but to complement them and offer a broader choice to security auditors when conducting WiFi pen-testing and improving user awareness. - -The ETF is an open source project [available on GitHub][14] and community contributions to its development are welcomed. Following are some of the ways you can help. - -One of the limitations of current WiFi pen-testing is the inability to log important events during tests. This makes reporting identified vulnerabilities both more difficult and less accurate. The framework could implement a logger that can be accessed by every class to create a pen-testing session report. - -The ETF tool's capabilities cover many aspects of WiFi pen-testing. On one hand, it facilitates the phases of WiFi reconnaissance, vulnerability discovery, and attack. On the other hand, it doesn't offer a feature that facilitates the reporting phase. Adding the concept of a session and a session reporting feature, such as the logging of important events during a session, would greatly increase the value of the tool for real pen-testing scenarios. - -Another valuable contribution would be extending the framework to facilitate WiFi fuzzing. The IEEE 802.11 protocol is very complex, and considering there are multiple implementations of it, both on the client and access point side, it's safe to assume these implementations contain bugs and even security flaws. These bugs could be discovered by fuzzing IEEE 802.11 protocol frames. Since Scapy allows custom packet creation and injection, a fuzzer can be implemented through it. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/evil-twin-framework - -作者:[André Esser][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/andreesser -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Rogue_access_point -[2]: https://www.python.org/ -[3]: https://scapy.net -[4]: /file/417776 -[5]: https://opensource.com/sites/default/files/uploads/pic1.png (Evil-Twin Framework Architecture) -[6]: https://www.metasploit.com -[7]: /file/417781 -[8]: https://opensource.com/sites/default/files/uploads/pic2.png (Scenario for capturing a WPA handshake after a de-authentication attack) -[9]: https://en.wikipedia.org/wiki/Address_Resolution_Protocol -[10]: /file/417786 -[11]: https://opensource.com/sites/default/files/uploads/pic3.png (Scenario for capturing a WPA handshake after a de-authentication attack) -[12]: /file/417791 -[13]: https://opensource.com/sites/default/files/uploads/pic4.png (Scenario for capturing a WPA handshake after a de-authentication attack) -[14]: https://github.com/Esser420/EvilTwinFramework diff --git a/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md b/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md deleted file mode 100644 index 6de6cd173f..0000000000 --- a/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md +++ /dev/null @@ -1,398 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Copy A File/Folder From A Local System To Remote System In Linux?) -[#]: via: (https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in-multiple-servers-using-shell-script/) -[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) - -How To Copy A File/Folder From A Local System To Remote System In Linux? -====== - -Copying a file from one server to another server or local to remote is one of the routine task for Linux administrator. - -If anyone says no, i won’t accept because this is one of the regular activity wherever you go. - -It can be done in many ways and we are trying to cover all the possible options. - -You can choose the one which you would prefer. Also, check other commands as well that may help you for some other purpose. - -I have tested all these commands and script in my test environment so, you can use this for your routine work. - -By default every one go with SCP because it’s one of the native command that everyone use for file copy. But commands which is listed in this article are be smart so, give a try if you would like to try new things. - -This can be done in below four ways easily. - - * **`SCP:`** scp copies files between hosts on a network. It uses ssh for data transfer, and uses the same authentication and provides the same security as ssh. - * **`RSYNC:`** rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. - * **`PSCP:`** pscp is a program for copying files in parallel to a number of hosts. It provides features such as passing a password to scp, saving output to files, and timing out. - * **`PRSYNC:`** prsync is a program for copying files in parallel to a number of hosts. It provides features such as passing a password to ssh, saving output to files, and timing out. - - - -### Method-1: Copy Files/Folders From A Local System To Remote System In Linux Using SCP Command? - -scp command allow us to copy files/folders from a local system to remote system. - -We are going to copy the `output.txt` file from my local system to `2g.CentOS.com` remote system under `/opt/backup` directory. - -``` -# scp output.txt root@2g.CentOS.com:/opt/backup - -output.txt 100% 2468 2.4KB/s 00:00 -``` - -We are going to copy two files `output.txt` and `passwd-up.sh` files from my local system to `2g.CentOS.com` remote system under `/opt/backup` directory. - -``` -# scp output.txt passwd-up.sh root@2g.CentOS.com:/opt/backup - -output.txt 100% 2468 2.4KB/s 00:00 -passwd-up.sh 100% 877 0.9KB/s 00:00 -``` - -We are going to copy the `shell-script` directory from my local system to `2g.CentOS.com` remote system under `/opt/backup` directory. - -This will copy the `shell-script` directory and associated files under `/opt/backup` directory. - -``` -# scp -r /home/daygeek/2g/shell-script/ [email protected]:/opt/backup/ - -output.txt 100% 2468 2.4KB/s 00:00 -ovh.sh 100% 76 0.1KB/s 00:00 -passwd-up.sh 100% 877 0.9KB/s 00:00 -passwd-up1.sh 100% 7 0.0KB/s 00:00 -server-list.txt 100% 23 0.0KB/s 00:00 -``` - -### Method-2: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using Shell Script with scp Command? - -If you would like to copy the same file into multiple remote servers then create the following small shell script to achieve this. - -To do so, get the servers list and add those into `server-list.txt` file. Make sure you have to update the servers list into `server-list.txt` file. Each server should be in separate line. - -Finally mention the file location which you want to copy like below. - -``` -# file-copy.sh - -#!/bin/sh -for server in `more server-list.txt` -do - scp /home/daygeek/2g/shell-script/output.txt [email protected]$server:/opt/backup -done -``` - -Once you done, set an executable permission to password-update.sh file. - -``` -# chmod +x file-copy.sh -``` - -Finally run the script to achieve this. - -``` -# ./file-copy.sh - -output.txt 100% 2468 2.4KB/s 00:00 -output.txt 100% 2468 2.4KB/s 00:00 -``` - -Use the following script to copy the multiple files into multiple remote servers. - -``` -# file-copy.sh - -#!/bin/sh -for server in `more server-list.txt` -do - scp /home/daygeek/2g/shell-script/output.txt passwd-up.sh [email protected]$server:/opt/backup -done -``` - -The below output shows all the files twice as this copied into two servers. - -``` -# ./file-cp.sh - -output.txt 100% 2468 2.4KB/s 00:00 -passwd-up.sh 100% 877 0.9KB/s 00:00 -output.txt 100% 2468 2.4KB/s 00:00 -passwd-up.sh 100% 877 0.9KB/s 00:00 -``` - -Use the following script to copy the directory recursively into multiple remote servers. - -``` -# file-copy.sh - -#!/bin/sh -for server in `more server-list.txt` -do - scp -r /home/daygeek/2g/shell-script/ [email protected]$server:/opt/backup -done -``` - -Output for the above script. - -``` -# ./file-cp.sh - -output.txt 100% 2468 2.4KB/s 00:00 -ovh.sh 100% 76 0.1KB/s 00:00 -passwd-up.sh 100% 877 0.9KB/s 00:00 -passwd-up1.sh 100% 7 0.0KB/s 00:00 -server-list.txt 100% 23 0.0KB/s 00:00 - -output.txt 100% 2468 2.4KB/s 00:00 -ovh.sh 100% 76 0.1KB/s 00:00 -passwd-up.sh 100% 877 0.9KB/s 00:00 -passwd-up1.sh 100% 7 0.0KB/s 00:00 -server-list.txt 100% 23 0.0KB/s 00:00 -``` - -### Method-3: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using PSCP Command? - -pscp command directly allow us to perform the copy to multiple remote servers. - -Use the following pscp command to copy a single file to remote server. - -``` -# pscp.pssh -H 2g.CentOS.com /home/daygeek/2g/shell-script/output.txt /opt/backup - -[1] 18:46:11 [SUCCESS] 2g.CentOS.com -``` - -Use the following pscp command to copy a multiple files to remote server. - -``` -# pscp.pssh -H 2g.CentOS.com /home/daygeek/2g/shell-script/output.txt ovh.sh /opt/backup - -[1] 18:47:48 [SUCCESS] 2g.CentOS.com -``` - -Use the following pscp command to copy a directory recursively to remote server. - -``` -# pscp.pssh -H 2g.CentOS.com -r /home/daygeek/2g/shell-script/ /opt/backup - -[1] 18:48:46 [SUCCESS] 2g.CentOS.com -``` - -Use the following pscp command to copy a single file to multiple remote servers. - -``` -# pscp.pssh -h server-list.txt /home/daygeek/2g/shell-script/output.txt /opt/backup - -[1] 18:49:48 [SUCCESS] 2g.CentOS.com -[2] 18:49:48 [SUCCESS] 2g.Debian.com -``` - -Use the following pscp command to copy a multiple files to multiple remote servers. - -``` -# pscp.pssh -h server-list.txt /home/daygeek/2g/shell-script/output.txt passwd-up.sh /opt/backup - -[1] 18:50:30 [SUCCESS] 2g.Debian.com -[2] 18:50:30 [SUCCESS] 2g.CentOS.com -``` - -Use the following pscp command to copy a directory recursively to multiple remote servers. - -``` -# pscp.pssh -h server-list.txt -r /home/daygeek/2g/shell-script/ /opt/backup - -[1] 18:51:31 [SUCCESS] 2g.Debian.com -[2] 18:51:31 [SUCCESS] 2g.CentOS.com -``` - -### Method-4: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using rsync Command? - -Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. - -Use the following rsync command to copy a single file to remote server. - -``` -# rsync -avz /home/daygeek/2g/shell-script/output.txt [email protected]:/opt/backup - -sending incremental file list -output.txt - -sent 598 bytes received 31 bytes 1258.00 bytes/sec -total size is 2468 speedup is 3.92 -``` - -Use the following pscp command to copy a multiple files to remote server. - -``` -# rsync -avz /home/daygeek/2g/shell-script/output.txt passwd-up.sh root@2g.CentOS.com:/opt/backup - -sending incremental file list -output.txt -passwd-up.sh - -sent 737 bytes received 50 bytes 1574.00 bytes/sec -total size is 2537 speedup is 3.22 -``` - -Use the following rsync command to copy a single file to remote server overh ssh. - -``` -# rsync -avzhe ssh /home/daygeek/2g/shell-script/output.txt root@2g.CentOS.com:/opt/backup - -sending incremental file list -output.txt - -sent 598 bytes received 31 bytes 419.33 bytes/sec -total size is 2.47K speedup is 3.92 -``` - -Use the following pscp command to copy a directory recursively to remote server over ssh. This will copy only files not the base directory. - -``` -# rsync -avzhe ssh /home/daygeek/2g/shell-script/ root@2g.CentOS.com:/opt/backup - -sending incremental file list -./ -output.txt -ovh.sh -passwd-up.sh -passwd-up1.sh -server-list.txt - -sent 3.85K bytes received 281 bytes 8.26K bytes/sec -total size is 9.12K speedup is 2.21 -``` - -### Method-5: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using Shell Script with rsync Command? - -If you would like to copy the same file into multiple remote servers then create the following small shell script to achieve this. - -``` -# file-copy.sh - -#!/bin/sh -for server in `more server-list.txt` -do - rsync -avzhe ssh /home/daygeek/2g/shell-script/ root@2g.CentOS.com$server:/opt/backup -done -``` - -Output for the above shell script. - -``` -# ./file-copy.sh - -sending incremental file list -./ -output.txt -ovh.sh -passwd-up.sh -passwd-up1.sh -server-list.txt - -sent 3.86K bytes received 281 bytes 8.28K bytes/sec -total size is 9.13K speedup is 2.21 - -sending incremental file list -./ -output.txt -ovh.sh -passwd-up.sh -passwd-up1.sh -server-list.txt - -sent 3.86K bytes received 281 bytes 2.76K bytes/sec -total size is 9.13K speedup is 2.21 -``` - -### Method-6: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using Shell Script with scp Command? - -In the above two shell script, we need to mention the file and folder location as a prerequiesties but here i did a small modification that allow the script to get a file or folder as a input. It could be very useful when you want to perform the copy multiple times in a day. - -``` -# file-copy.sh - -#!/bin/sh -for server in `more server-list.txt` -do -scp -r $1 root@2g.CentOS.com$server:/opt/backup -done -``` - -Run the shell script and give the file name as a input. - -``` -# ./file-copy.sh output1.txt - -output1.txt 100% 3558 3.5KB/s 00:00 -output1.txt 100% 3558 3.5KB/s 00:00 -``` - -### Method-7: Copy Files/Folders From A Local System To Multiple Remote System In Linux With Non-Standard Port Number? - -Use the below shell script to copy a file or folder if you are using Non-Standard port. - -If you are using `Non-Standard` port, make sure you have to mention the port number as follow for SCP command. - -``` -# file-copy-scp.sh - -#!/bin/sh -for server in `more server-list.txt` -do -scp -P 2222 -r $1 root@2g.CentOS.com$server:/opt/backup -done -``` - -Run the shell script and give the file name as a input. - -``` -# ./file-copy.sh ovh.sh - -ovh.sh 100% 3558 3.5KB/s 00:00 -ovh.sh 100% 3558 3.5KB/s 00:00 -``` - -If you are using `Non-Standard` port, make sure you have to mention the port number as follow for rsync command. - -``` -# file-copy-rsync.sh - -#!/bin/sh -for server in `more server-list.txt` -do -rsync -avzhe 'ssh -p 2222' $1 root@2g.CentOS.com$server:/opt/backup -done -``` - -Run the shell script and give the file name as a input. - -``` -# ./file-copy-rsync.sh passwd-up.sh -sending incremental file list -passwd-up.sh - -sent 238 bytes received 35 bytes 26.00 bytes/sec -total size is 159 speedup is 0.58 - -sending incremental file list -passwd-up.sh - -sent 238 bytes received 35 bytes 26.00 bytes/sec -total size is 159 speedup is 0.58 -``` --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in-multiple-servers-using-shell-script/ - -作者:[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 diff --git a/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md b/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md deleted file mode 100644 index e52673707c..0000000000 --- a/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md +++ /dev/null @@ -1,81 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Mind map yourself using FreeMind and Fedora) -[#]: via: (https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/) -[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) - -Mind map yourself using FreeMind and Fedora -====== -![](https://fedoramagazine.org/wp-content/uploads/2019/01/freemind-816x345.jpg) - -A mind map of yourself sounds a little far-fetched at first. Is this process about neural pathways? Or telepathic communication? Not at all. Instead, a mind map of yourself is a way to describe yourself to others visually. It also shows connections among the characteristics you use to describe yourself. It’s a useful way to share information with others in a clever but also controllable way. You can use any mind map application for this purpose. This article shows you how to get started using [FreeMind][1], available in Fedora. - -### Get the application - -The FreeMind application has been around a while. While the UI is a bit dated and could use a refresh, it’s a powerful app that offers many options for building mind maps. And of course it’s 100% open source. There are other mind mapping apps available for Fedora and Linux users, as well. Check out [this previous article that covers several mind map options][2]. - -Install FreeMind from the Fedora repositories using the Software app if you’re running Fedora Workstation. Or use this [sudo][3] command in a terminal: - -``` -$ sudo dnf install freemind -``` - -You can launch the app from the GNOME Shell Overview in Fedora Workstation. Or use the application start service your desktop environment provides. FreeMind shows you a new, blank map by default: - -![][4] -FreeMind initial (blank) mind map - -A map consists of linked items or descriptions — nodes. When you think of something related to a node you want to capture, simply create a new node connected to it. - -### Mapping yourself - -Click in the initial node. Replace it with your name by editing the text and hitting **Enter**. You’ve just started your mind map. - -What would you think of if you had to fully describe yourself to someone? There are probably many things to cover. How do you spend your time? What do you enjoy? What do you dislike? What do you value? Do you have a family? All of this can be captured in nodes. - -To add a node connection, select the existing node, and hit **Insert** , or use the “light bulb” icon for a new child node. To add another node at the same level as the new child, use **Enter**. - -Don’t worry if you make a mistake. You can use the **Delete** key to remove an unwanted node. There’s no rules about content. Short nodes are best, though. They allow your mind to move quickly when creating the map. Concise nodes also let viewers scan and understand the map easily later. - -This example uses nodes to explore each of these major categories: - -![][5] -Personal mind map, first level - -You could do another round of iteration for each of these areas. Let your mind freely connect ideas to generate the map. Don’t worry about “getting it right.” It’s better to get everything out of your head and onto the display. Here’s what a next-level map might look like. - -![][6] -Personal mind map, second level - -You could expand on any of these nodes in the same way. Notice how much information you can quickly understand about John Q. Public in the example. - -### How to use your personal mind map - -This is a great way to have team or project members introduce themselves to each other. You can apply all sorts of formatting and color to the map to give it personality. These are fun to do on paper, of course. But having one on your Fedora system means you can always fix mistakes, or even make changes as you change. - -Have fun exploring your personal mind map! - - - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/ - -作者:[Paul W. Frields][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/pfrields/ -[b]: https://github.com/lujun9972 -[1]: http://freemind.sourceforge.net/wiki/index.php/Main_Page -[2]: https://fedoramagazine.org/three-mind-mapping-tools-fedora/ -[3]: https://fedoramagazine.org/howto-use-sudo/ -[4]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-17-04-1024x736.png -[5]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-32-38-1024x736.png -[6]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-38-00-1024x736.png diff --git a/sources/tech/20190204 Top 5 open source network monitoring tools.md b/sources/tech/20190204 Top 5 open source network monitoring tools.md index 5b6e7f1bfa..afbcae9833 100644 --- a/sources/tech/20190204 Top 5 open source network monitoring tools.md +++ b/sources/tech/20190204 Top 5 open source network monitoring tools.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (sugarfillet) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md b/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md index a7b2c06a16..b55cbcd811 100644 --- a/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md +++ b/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( pityonline ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -180,7 +180,7 @@ via: https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[pityonline](https://github.com/pityonline) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md b/sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md index 24fc867ac0..0fadc0908d 100644 --- a/sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md +++ b/sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (An-DJ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md b/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md index 0633b0b3ab..8619feb6c2 100644 --- a/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md +++ b/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md b/sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md deleted file mode 100644 index 56e8bd0abc..0000000000 --- a/sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md +++ /dev/null @@ -1,103 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Grant And Remove Sudo Privileges To Users On Ubuntu) -[#]: via: (https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -How To Grant And Remove Sudo Privileges To Users On Ubuntu -====== -![](https://www.ostechnix.com/wp-content/uploads/2019/02/sudo-privileges-720x340.png) - -As you know already, the user can perform any administrative tasks with sudo privileges on Ubuntu systems. When creating a new users on your Linux box, they can’t do any administrative tasks until you make them to be a member of **‘sudo’ group**. In this brief tutorial, we explain how to add a regular user to sudo group and remove the given privileges to make it as just a normal user. - -**Grant Sudo Privileges To A regular User On Linux** - -Usually, we use **‘adduser’** command to create new user like below. - -``` -$ sudo adduser ostechnix -``` - -If you want the newly created user to perform any administrative tasks with sudo, just add him to the sudo group using command: - -``` -$ sudo usermod -a -G sudo hduser -``` - -The above command will make the user called **‘ostechnix’** to be the member of sudo group. - -You can also use this command too to add the users to sudo group. - -``` -$ sudo adduser ostechnix sudo -``` - -Now, log out and log in back as the new user for this change to take effect. The user has now become an administrative user. - -To verify it, just use ‘sudo’ as prefix in a any command. - -``` -$ sudo mkdir /test -[sudo] password for ostechnix: -``` - -### Remove sudo privileges of an User - -Sometimes, you might want to remove sudo privileges to a particular user without deleting it from your Linux box. To make any user as a normal user, just remove them from the sudo group. - -Say for example If you want to remove a user called **ostechnix** , from the sudo group, just run: - -``` -$ sudo deluser ostechnix sudo -``` - -**Sample output:** - -``` -Removing user `ostechnix' from group `sudo' ... -Done. -``` - -This command will only remove user ‘ostechnix’ from the sudo group, but it will not delete the user permanently from the system. Now, He becomes a regular user and can’t do any administrative tasks as sudo user. - -Also, you can use the following command to revoke the sudo access from an user: - -``` -$ sudo gpasswd -d ostechnix sudo -``` - -Please be careful while removing users from the sudo group. Do not remove the real administrator from the “sudo” group. - -Verify the user “ostechnix” has been really removed from sudo group using command: - -``` -$ sudo -l -U ostechnix -User ostechnix is not allowed to run sudo on ubuntuserver. -``` - -Yes, the user “ostechnix” has been removed from sudo group, and he can’t execute any administrative tasks. - -Please be careful while removing a user from a sudo group. If you have only one sudo user on your system and you remove him from the sudo group, you can’t perform any administrative stuffs such as installing, removing and updating programs on your system. So, please be careful. In our next, tutorial, we will explain how to restore sudo privileges to a user - -And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/ - -作者:[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 diff --git a/sources/tech/20190219 3 tools for viewing files at the command line.md b/sources/tech/20190219 3 tools for viewing files at the command line.md deleted file mode 100644 index bd666cc098..0000000000 --- a/sources/tech/20190219 3 tools for viewing files at the command line.md +++ /dev/null @@ -1,97 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (3 tools for viewing files at the command line) -[#]: via: (https://opensource.com/article/19/2/view-files-command-line) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -3 tools for viewing files at the command line -====== -Take a look at less, Antiword, and odt2txt, three utilities for viewing files in the terminal. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg) - -I always say you don't need to use the command line to use Linux effectively—I know many Linux users who never crack open a terminal window and are quite happy. However, even though I don't consider myself a techie, I spend about 20% of my computing time at the command line, manipulating files, processing text, and using utilities. - -One thing I often do in a terminal window is viewing files, whether text or word processor files. Sometimes it's just easier to use a command line utility than to fire up a text editor or a word processor. - -Here are three of the utilities I use to view files at the command line. - -### less - -The beauty of [less][1] is that it's easy to use and it breaks the files you're viewing down into discrete chunks (or pages), which makes them easier to read. You use it to view text files at the command line, such as a README, an HTML file, a LaTeX file, or anything else in plaintext. I took a look at less in a [previous article][2]. - -To use less, just type: - -``` -less file_name -``` - -![](https://opensource.com/sites/default/files/uploads/less.png) - -Scroll down through the file by pressing the spacebar or PgDn key on your keyboard. You can move up through a file by pressing the PgUp key. To stop viewing the file, press the Q key on your keyboard. - -### Antiword - -[Antiword][3] is great little utility that you can use to that can convert Word documents to plaintext. If you want, you can also convert them to [PostScript][4] or [PDF][5]. For this article, let's just stick with the conversion to text. - -Antiword can read and convert files created with versions of Word from 2.0 to 2003. It doesn't read DOCX files—if you try, Antiword displays an error message that what you're trying to read is a ZIP file. That's technically correct, but it's still frustrating. - -To view a Word document using Antiword, type the following command: - -``` -antiword file_name.doc -``` - -Antiword converts the document to text and displays it in the terminal window. Unfortunately, it doesn't break the document into pages in the terminal. You can, though, redirect Antiword's output to a utility like less or [more][6] to paginate it. Do that by typing the following command: - -``` -antiword file_name.doc | less -``` - -If you're new to the command line, the | is called a pipe. That's what does the redirection. - -![](https://opensource.com/sites/default/files/uploads/antiword.png) - -### odt2txt - -Being a good open source citizen, you'll want to use as many open formats as possible. For your word processing needs, you might deal with [ODT][7] files (used by such word processors as LibreOffice Writer and AbiWord) instead of Word files. Even if you don't, you might run into ODT files. And they're easy to view at the command line, even if you don't have Writer or AbiWord installed on your computer. - -How? With a little utility called [odt2txt][8]. As you've probably guessed, odt2txt converts an ODT file to plaintext. To use it, run the command: - -``` -odt2txt file_name.odt -``` - -Like Antiword, odt2txt converts the document to text and displays it in the terminal window. And, like Antiword, it doesn't page the document. Once again, though, you can pipe the output from odt2txt to a utility like less or more using the following command: - -``` -odt2txt file_name.odt | more -``` - -![](https://opensource.com/sites/default/files/uploads/odt2txt.png) - -Do you have a favorite utility for viewing files at the command line? Feel free to share it with the community by leaving a comment. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/view-files-command-line - -作者:[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://www.gnu.org/software/less/ -[2]: https://opensource.com/article/18/4/using-less-view-text-files-command-line -[3]: http://www.winfield.demon.nl/ -[4]: http://en.wikipedia.org/wiki/PostScript -[5]: http://en.wikipedia.org/wiki/Portable_Document_Format -[6]: https://opensource.com/article/19/1/more-text-files-linux -[7]: http://en.wikipedia.org/wiki/OpenDocument -[8]: https://github.com/dstosberg/odt2txt diff --git a/sources/tech/20190219 Logical - in Bash.md b/sources/tech/20190219 Logical - in Bash.md deleted file mode 100644 index 2c7e38dd32..0000000000 --- a/sources/tech/20190219 Logical - in Bash.md +++ /dev/null @@ -1,227 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (zero-mk) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Logical & in Bash) -[#]: via: (https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash) -[#]: author: (Paul Brown https://www.linux.com/users/bro66) - -Logical & in Bash -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand-brian-taylor-unsplash.jpg?itok=Iq6vxSNK) - -One would think you could dispatch `&` in two articles. Turns out you can't. While [the first article dealt with using `&` at the end of commands to push them into the background][1] and then diverged into explaining process management, the second article saw [`&` being used as a way to refer to file descriptors][2], which led us to seeing how, combined with `<` and `>`, you can route inputs and outputs from and to different places. - -This means we haven't even touched on `&` as an AND operator, so let's do that now. - -### & is a Bitwise Operator - -If you are at all familiar with binary operations, you will have heard of AND and OR. These are bitwise operations that operate on individual bits of a binary number. In Bash, you use `&` as the AND operator and `|` as the OR operator: - -**AND** - -``` -0 & 0 = 0 - -0 & 1 = 0 - -1 & 0 = 0 - -1 & 1 = 1 -``` - -**OR** - -``` -0 | 0 = 0 - -0 | 1 = 1 - -1 | 0 = 1 - -1 | 1 = 1 -``` - -You can test this by ANDing any two numbers and outputting the result with `echo`: - -``` -$ echo $(( 2 & 3 )) # 00000010 AND 00000011 = 00000010 - -2 - -$ echo $(( 120 & 97 )) # 01111000 AND 01100001 = 01100000 - -96 -``` - -The same goes for OR (`|`): - -``` -$ echo $(( 2 | 3 )) # 00000010 OR 00000011 = 00000011 - -3 - -$ echo $(( 120 | 97 )) # 01111000 OR 01100001 = 01111001 - -121 -``` - -Three things about this: - - 1. You use `(( ... ))` to tell Bash that what goes between the double brackets is some sort of arithmetic or logical operation. `(( 2 + 2 ))`, `(( 5 % 2 ))` (`%` being the [modulo][3] operator) and `((( 5 % 2 ) + 1))` (equals 3) will all work. - 2. [Like with variables][4], `$` extracts the value so you can use it. - 3. For once spaces don't matter: `((2+3))` will work the same as `(( 2+3 ))` and `(( 2 + 3 ))`. - 4. Bash only operates with integers. Trying to do something like this `(( 5 / 2 ))` will give you "2", and trying to do something like this `(( 2.5 & 7 ))` will result in an error. Then again, using anything but integers in a bitwise operation (which is what we are talking about now) is generally something you wouldn't do anyway. - - - -**TIP:** If you want to check what your decimal number would look like in binary, you can use _bc_ , the command-line calculator that comes preinstalled with most Linux distros. For example, using: - -``` -bc <<< "obase=2; 97" -``` - -will convert `97` to binary (the _o_ in `obase` stands for _output_ ), and ... - -``` -bc <<< "ibase=2; 11001011" -``` - -will convert `11001011` to decimal (the _i_ in `ibase` stands for _input_ ). - -### && is a Logical Operator - -Although it uses the same logic principles as its bitwise cousin, Bash's `&&` operator can only render two results: 1 ("true") and 0 ("false"). For Bash, any number not 0 is “true” and anything that equals 0 is “false.” What is also false is anything that is not a number: - -``` -$ echo $(( 4 && 5 )) # Both non-zero numbers, both true = true - -1 - -$ echo $(( 0 && 5 )) # One zero number, one is false = false - -0 - -$ echo $(( b && 5 )) # One of them is not number, one is false = false - -0 -``` - -The OR counterpart for `&&` is `||` and works exactly as you would expect. - -All of this is simple enough... until it comes to a command's exit status. - -### && is a Logical Operator for Command Exit Status - -[As we have seen in previous articles][2], as a command runs, it outputs error messages. But, more importantly for today's discussion, it also outputs a number when it ends. This number is called an _exit code_ , and if it is 0, it means the command did not encounter any problem during its execution. If it is any other number, it means something, somewhere, went wrong, even if the command completed. - -So 0 is good, any other number is bad, and, in the context of exit codes, 0/good means "true" and everything else means “false.” Yes, this is **the exact contrary of what you saw in the logical operations above** , but what are you gonna do? Different contexts, different rules. The usefulness of this will become apparent soon enough. - -Moving on. - -Exit codes are stored _temporarily_ in the [special variable][5] `?` \-- yes, I know: another confusing choice. Be that as it may, [remember that in our article about variables][4], and we said that you read the value in a variable using a the `$` symbol. So, if you want to know if a command has run without a hitch, you have to read `?` as soon as the command finishes and before running anything else. - -Try it with: - -``` -$ find /etc -iname "*.service" - -find: '/etc/audisp/plugins.d': Permission denied - -/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service - -/etc/systemd/system/dbus-org.freedesktop.ModemManager1.service - -[etcetera] -``` - -[As you saw in the previous article][2], running `find` over _/etc_ as a regular user will normally throw some errors when it tries to read subdirectories for which you do not have access rights. - -So, if you execute... - -``` -echo $? -``` - -... right after `find`, it will print a `1`, indicating that there were some errors. - -(Notice that if you were to run `echo $?` a second time in a row, you'd get a `0`. This is because `$?` would contain the exit code of `echo $?`, which, supposedly, will have executed correctly. So the first lesson when using `$?` is: **use`$?` straight away** or store it somewhere safe -- like in another variable, or you will lose it). - -One immediate use of `?` is to fold it into a list of chained commands and bork the whole thing if anything fails as Bash runs through it. For example, you may be familiar with the process of building and compiling the source code of an application. You can run them on after another by hand like this: - -``` -$ configure - -. - -. - -. - -$ make - -. - -. - -. - -$ make install - -. - -. - -. -``` - -You can also put all three on one line... - -``` -$ configure; make; make install -``` - -... and hope for the best. - -The disadvantage of this is that if, say, `configure` fails, Bash will still try and run `make` and `sudo make install`, even if there is nothing to make or, indeed, install. - -The smarter way of doing it is like this: - -``` -$ configure && make && make install -``` - -This takes the exit code from each command and uses it as an operand in a chained `&&` operation. - -But, and here's the kicker, Bash knows the whole thing is going to fail if `configure` returns a non-zero result. If that happens, it doesn't have to run `make` to check its exit code, since the result is going to be false no matter what. So, it forgoes `make` and just passes a non-zero result onto the next step of the operation. And, as `configure && make` delivers false, Bash doesn't have to run `make install` either. This means that, in a long chain of commands, you can join them with `&&`, and, as soon as one fails, you can save time as the rest of the commands get canceled immediately. - -You can do something similar with `||`, the OR logical operator, and make Bash continue processing chained commands if only one of a pair completes. - -In view of all this (along with the stuff we covered earlier), you should now have a clearer idea of what the command line we set at the beginning of [this article does][1]: - -``` -mkdir test_dir 2>/dev/null || touch backup/dir/images.txt && find . -iname "*jpg" > backup/dir/images.txt & -``` - -So, assuming you are running the above from a directory for which you have read and write privileges, what it does it do and how does it do it? How does it avoid unseemly and potentially execution-breaking errors? Next week, apart from giving you the solution, we'll be dealing with brackets: curly, curvy and straight. Don't miss it! - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash - -作者:[Paul Brown][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/bro66 -[b]: https://github.com/lujun9972 -[1]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux -[2]: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash -[3]: https://en.wikipedia.org/wiki/Modulo_operation -[4]: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise -[5]: https://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html diff --git a/sources/tech/20190220 Automation evolution.md b/sources/tech/20190220 Automation evolution.md new file mode 100644 index 0000000000..09167521c6 --- /dev/null +++ b/sources/tech/20190220 Automation evolution.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automation evolution) +[#]: via: (https://leancrew.com/all-this/2019/02/automation-evolution/) +[#]: author: (Dr.Drang https://leancrew.com) + +Automation evolution +====== + +In my experience, scripts and macros almost never end up the way they start. This shouldn’t be a surprise. Just as spending time performing a particular task makes you realize it should be automated, spending time working with the automation makes you realize how it can be improved. Contra [XKCD][3], this doesn’t mean the decision to automate a task puts you on an endless treadmill of tweaking that’s never worth the time you invest. It means you’re continuing to think about how you do things and how your methods can be improved. I have an example that I’ve been working on for years. + +Two of the essential but dull parts of my job involve sending out invoices to clients and following up when those invoices aren’t paid on time. I’ve gradually built up a system to handle both of these interrelated duties. I’ve written about certain details before, but here I want to talk about how and why the system has evolved. + +It started with [TextExpander][4] snippets. One was for the text of the email that accompanied the invoice when it was first sent, and it looked like this (albeit less terse): + +``` +Attached is invoice A for $B on project C. Payment is due on D. +``` + +where the A, B, C, and D were [fill-in fields][5]. Similarly, there was a snippet for the followup emails. + +``` +The attached invoice, X for $Y on project Z, is still outstanding +and is now E days old. Pay up. +``` + +While these snippets was certainly better than typing this boilerplate out again and again, they weren’t using the computer for what it’s good at: looking things up and calculating. The invoices are PDFs that came out of my company’s accounting system and contain the information for X, Y, Z, and D. The age of the invoice, E, can be calculated from D and the current date. + +So after a month or two of using the snippets, I wrote an invoicing script in Python that read the invoice PDF and created an email message with all of the parts filled in. It also added a subject line and used a project database to look up the client’s email address to put in the To field. A similar script created a dunning email message. Both of these scripts could be run from the Terminal and took the invoice PDF as their argument, e.g., + +``` +invoice 12345.pdf +``` + +and + +``` +dun 12345.pdf +``` + +I should mention that these scripts created the email messages, but they didn’t send them. Sometimes I need to add an extra sentence or two to handle particular situations, and these scripts stopped short of sending so I could do that. + +It didn’t take very long for me to realize that opening a Terminal window just to run a single command was itself a waste of time. I used Automator to add Quick Action workflows that run the `invoice` and `dun` scripts to the Services menu. That allowed me to run the scripts by right-clicking on an invoice PDF file in the Finder. + +This system lasted quite a while. Eventually, though, I decided it was foolish to rely on my memory (or periodic checking of my outstanding invoices) to decide when to send out the followup emails on unpaid bills. I added a section to the `invoice` script that created a reminder along with the invoicing email. The reminder went in the Invoices list of the Reminders app and was given a due date of the first Tuesday at least 45 days after the invoice date. My invoices are net 30, so 45 days seemed like a good starting time for followups. And rather than having the reminder pop up on any day of the week, I set it to Tuesday—early in the week but unlikely to be on a holiday.1 + +Changing the `invoice` script changed the behavior of the Services menu item that called it; I didn’t have to make any changes in Automator. + +This system was the state of the art until it hit me that I could write a script that checked Reminders for every invoice that was past due and run the `dun` script on all of them, creating a series of followup emails in one fell swoop. I wrote this script as a combination of Python and AppleScript and embedded it in a [Keyboard Maestro][6] macro. With this macro in place, I no longer had to hunt for the invoices to right-click on. + +A couple of weeks ago, after reading Federico Viticci’s article on [using a Mac from iOS][7], I began thinking about the hole in my followup system: I have to be at my Mac to run Keyboard Maestro. What if I’m traveling on Tuesday and want to send out followup emails from my iPhone or iPad? OK, sure, I could use Screens to connect to the Mac and run the Keyboard Maestro macro that way, but that’s very slow and clumsy over a cellular network connection, especially when trying to manipulate windows on a 27″ iMac screen as viewed through an iPhone-sized keyhole. + +The obvious solution, which wasn’t obvious to me until I’d thought of and rejected a few other ideas, was to change the `dun` script to create and save the followup email. Saving the email puts it in the Drafts folder, which I can get at from all of my devices. I also changed the Keyboard Maestro macro that executes the `dun` script on every overdue invoice to run every Tuesday morning at 5:00 am. When the reminders pop up later in the day, the emails are already written and waiting for me in the Drafts folder. + +Yesterday was the first “live” test of the new system. I was in an airport restaurant—nothing but the best cuisine for me—when my watch buzzed with reminders for two overdue invoices. I pulled out my phone, opened Mail, and there were the emails, waiting to be sent. In this case, I didn’t have to edit the messages before sending, but it wouldn’t have been a big deal if I had—no more difficult than writing any other email from my phone. + +Am I done with this? History suggests I’m not, and I’m OK with that. By getting rid of more scutwork, I’ve made myself better at following up on old invoices, and my average time-to-collection has improved. Even XKCD would think that’s worth the effort. + +-------------------------------------------------------------------------------- + +via: https://leancrew.com/all-this/2019/02/automation-evolution/ + +作者:[Dr.Drang][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://leancrew.com +[b]: https://github.com/lujun9972 +[1]: https://leancrew.com/all-this/2019/02/regex-groups-and-numerals/ +[2]: https://leancrew.com/all-this/2019/02/transparency/ +[3]: https://xkcd.com/1319/ +[4]: https://textexpander.com/ +[5]: https://textexpander.com/help/desktop/fillins.html +[6]: https://www.keyboardmaestro.com/main/ +[7]: https://www.macstories.net/ipad-diaries/ipad-diaries-using-a-mac-from-ios-part-1-finder-folders-siri-shortcuts-and-app-windows-with-keyboard-maestro/ diff --git a/sources/tech/20190223 Regex groups and numerals.md b/sources/tech/20190223 Regex groups and numerals.md new file mode 100644 index 0000000000..764ec1dfd5 --- /dev/null +++ b/sources/tech/20190223 Regex groups and numerals.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Regex groups and numerals) +[#]: via: (https://leancrew.com/all-this/2019/02/regex-groups-and-numerals/) +[#]: author: (Dr.Drang https://leancrew.com) + +Regex groups and numerals +====== + +A week or so ago, I was editing a program and decided I should change some variable names. I thought it would be a simple regex find/replace, and it was. Just not as simple as I thought. + +The variables were named `a10`, `v10`, and `x10`, and I wanted to change them to `a30`, `v30`, and `x30`, respectively. I brought up BBEdit’s Find window and entered this: + +![Mistaken BBEdit replacement pattern][2] + +I couldn’t just replace `10` with `30` because there were instances of `10` in the code that weren’t related to the variables. And because I think I’m clever, I didn’t want to do three non-regex replacements, one each for `a10`, `v10`, and `x10`. But I wasn’t clever enough to notice the blue coloring in the replacement pattern. Had I done so, I would have seen that BBEdit was interpreting my replacement pattern as “Captured group 13, followed by `0`” instead of “Captured group 1, followed by `30`,” which was what I intended. Since captured group 13 was blank, all my variable names were replaced with `0`. + +You see, BBEdit can capture up to 99 groups in the search pattern and, strictly speaking, we should use two-digit numbers when referring to them in the replacement pattern. But in most cases, we can use `\1` through `\9` instead of `\01` through `\09` because there’s no ambiguity. In other words, if I had been trying to change `a10`, `v10`, and `x10` to `az`, `vz`, and `xz`, a replacement pattern of `\1z` would have been just fine, because the trailing `z` means there’s no way to misinterpret the intent of the `\1` in that pattern. + +So after undoing the replacement, I changed the pattern to this, + +![Two-digit BBEdit replacement pattern][3] + +and all was right with the world. + +There was another option: a named group. Here’s how that would have looked, using `var` as the pattern name: + +![Named BBEdit replacement pattern][4] + +I don’t think I’ve ever used a named group in any situation, whether the regex was in a text editor or a script. My general feeling is that if the pattern is so complicated I have to use variables to keep track of all the groups, I should stop and break the problem down into smaller parts. + +By the way, you may have heard that BBEdit is celebrating its [25th anniversary][5] of not sucking. When a well-documented app has such a long history, the manual starts to accumulate delightful callbacks to the olden days. As I was looking up the notation for named groups in the BBEdit manual, I ran across this note: + +![BBEdit regex manual excerpt][6] + +BBEdit is currently on Version 12.5; Version 6.5 came out in 2001. But the manual wants to make sure that long-time customers (I believe it was on Version 4 when I first bought it) don’t get confused by changes in behavior, even when those changes occurred nearly two decades ago. + + +-------------------------------------------------------------------------------- + +via: https://leancrew.com/all-this/2019/02/regex-groups-and-numerals/ + +作者:[Dr.Drang][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://leancrew.com +[b]: https://github.com/lujun9972 +[1]: https://leancrew.com/all-this/2019/02/automation-evolution/ +[2]: https://leancrew.com/all-this/images2019/20190223-Mistaken%20BBEdit%20replacement%20pattern.png (Mistaken BBEdit replacement pattern) +[3]: https://leancrew.com/all-this/images2019/20190223-Two-digit%20BBEdit%20replacement%20pattern.png (Two-digit BBEdit replacement pattern) +[4]: https://leancrew.com/all-this/images2019/20190223-Named%20BBEdit%20replacement%20pattern.png (Named BBEdit replacement pattern) +[5]: https://merch.barebones.com/ +[6]: https://leancrew.com/all-this/images2019/20190223-BBEdit%20regex%20manual%20excerpt.png (BBEdit regex manual excerpt) diff --git a/translated/talk/20181220 7 CI-CD tools for sysadmins.md b/translated/talk/20181220 7 CI-CD tools for sysadmins.md new file mode 100644 index 0000000000..fe00691a9a --- /dev/null +++ b/translated/talk/20181220 7 CI-CD tools for sysadmins.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: (jdh8383) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 CI/CD tools for sysadmins) +[#]: via: (https://opensource.com/article/18/12/cicd-tools-sysadmins) +[#]: author: (Dan Barker https://opensource.com/users/barkerd427) + +系统管理员的 7 个 CI/CD 工具 +====== +本文是一篇简单指南:介绍一些常见的开源 CI/CD 工具。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc) + +虽然持续集成、持续交付和持续部署(CI/CD)在开发者社区里已经存在很多年,一些机构在运维部门也有实施经验,但大多数公司并没有做这样的尝试。对于很多机构来说,让运维团队能够像他们的开发同行一样熟练操作 CI/CD 工具,已经变得十分必要了。 + +无论是基础设施、第三方应用还是内部开发的应用,都可以开展 CI/CD 实践。尽管你会发现有很多不同的工具,但它们都有着相似的设计模型。而且可能最重要的一点是:通过带领你的公司进行这些实践,会让你在公司内部变得举足轻重,成为他人学习的榜样。 + +一些机构在自己的基础设施上已有多年的 CI/CD 实践经验,常用的工具包括 [Ansible][1]、[Chef][2] 或者 [Puppet][3]。另一些工具,比如 [Test Kitchen][4],允许在最终要部署应用的基础设施上运行测试。事实上,如果使用更高级的配置方法,你甚至可以将应用部署到有真实负载的仿真“生产环境”上,来运行应用级别的测试。然而,单单是能够测试基础设施就是一项了不起的成就了。配置管理工具 Terraform 可以通过 Test Kitchen 来快速创建[可复用][6]的基础设施配置,这比它的前辈要强不少。再加上 Linux 容器和 Kubernetes,在数小时内,你就可以创建一套类似于生产环境的配置参数和系统资源,来测试整个基础设施和其上部署的应用,这在以前可能需要花费几个月的时间。而且,删除和再次创建整个测试环境也非常容易。 + +当然,作为初学者,你也可以把网络配置和 DDL(数据定义语言)文件加入版本控制,然后开始尝试一些简单的 CI/CD 流程。虽然只能帮你检查一下语义语法,但实际上大多数用于开发的管道(pipeline)都是这样起步的。只要你把脚手架搭起来,建造就容易得多了。而一旦起步,你就会发现各种真实的使用场景。 + +举个例子,我经常会在公司内部写新闻简报,我使用 [MJML][7] 制作邮件模板,然后把它加入版本控制。我一般会维护一个 web 版本,但是一些同事喜欢 PDF 版,于是我创建了一个[管道][8]。每当我写好一篇新闻稿,就在 Gitlab 上提交一个合并请求。这样做会自动创建一个 index.html 文件,生成这篇新闻稿的 HTML 和 PDF 版链接。HTML 和 PDF 文件也会在管道里同时生成。除非有人来检查确认,这些文件不会被直接发布出去。使用 GitLab Pages 发布这个网站后,我就可以下载一份 HTML 版,用来发送新闻简报。未来,我会修改这个流程,当合并请求成功或者在某个审核步骤后,自动发出对应的新闻稿。这些处理逻辑并不复杂,但的确为我节省了不少时间。实际上这些工具最核心的用途就是替你节省时间。 + +关键是要在抽象层创建出工具,这样稍加修改就可以处理不同的问题。值得留意的是,我创建的这套流程几乎不需要任何代码,除了一些[轻量级的 HTML 模板][9],一些[把 HTML 文件转换成 PDF 的 nodejs 代码][10],还有一些[生成 index 页面的 nodejs 代码][11]。 + +这其中一些东西可能看起来有点复杂,但其中大部分都源自我使用的不同工具的教学文档。而且很多开发人员也会乐意跟你合作,因为他们在完工时会发现这些东西也挺有用。上面我提供的那些代码链接是给 [DevOps KC][12](一个地方性DevOps组织) 发送新闻简报用的,其中大部分用来创建网站的代码来自我在内部新闻简报项目上所作的工作。 + +下面列出的大多数工具都可以提供这种类型的交互,但是有些工具提供的模型略有不同。这一领域新兴的模型是用声明式的方法例如 YAML 来描述一个管道,其中的每个阶段都是短暂而幂等的。许多系统还会创建[有向无环图(DAG)][13],来确保管道上不同的阶段排序的正确性。 + +这些阶段一般运行在 Linux 容器里,和普通的容器并没有区别。有一些工具,比如 [Spinnaker][14],只关注部署组件,而且提供一些其他工具没有的操作特性。[Jenkins][15] 则通常把管道配置存成 XML 格式,大部分交互都可以在图形界面里完成,但最新的方案是使用[领域专用语言(DSL)][16]如[Groovy][17]。并且,Jenkins 的任务(job)通常运行在各个节点里,这些节点上会装一个专门的 Java 程序还有一堆混杂的插件和预装组件。 + +Jenkins 在自己的工具里引入了管道的概念,但使用起来却并不轻松,甚至包含一些禁区。最近,Jenkins 的创始人决定带领社区向新的方向前进,希望能为这个项目注入新的活力,把 CI/CD 真正推广开(译者注:详见后面的 Jenkins 章节)。我认为其中最有意思的想法是构建一个云原生 Jenkins,能把 Kubernetes 集群转变成 Jenkins CI/CD 平台。 + +当你更多地了解这些工具并把实践带入你的公司和运维部门,你很快就会有追随者,因为你有办法提升自己和别人的工作效率。我们都有多年积累下来的技术债要解决,如果你能给同事们提供足够的时间来处理这些积压的工作,他们该会有多感激呢?不止如此,你的客户也会开始看到应用变得越来越稳定,管理层会把你看作得力干将,你也会在下次谈薪资待遇或参加面试时更有底气。 + +让我们开始深入了解这些工具吧,我们将对每个工具做简短的介绍,并分享一些有用的链接。 + +### GitLab CI + +GitLab 可以说是 CI/CD 领域里新登场的玩家,但它却在 [Forrester(一个权威调研机构) 的调查报告][20]中位列第一。在一个高水平、竞争充分的领域里,这是个了不起的成就。是什么让 GitLab CI 这么成功呢?它使用 YAML 文件来描述整个管道。另有一个功能叫做 Auto DevOps,可以为较简单的项目自动生成管道,并且包含多种内置的测试单元。这套系统使用 [Herokuish buildpacks][21]来判断语言的种类以及如何构建应用。它和 Kubernetes 紧密整合,可以根据不同的方案将你的应用自动部署到 Kubernetes 集群,比如灰度发布、蓝绿部署等。 + +除了它的持续集成功能,GitLab 还提供了许多补充特性,比如:将 Prometheus 和你的应用一同部署,以提供监控功能;通过 GitLab 提供的 Issues、Epics 和 Milestones 功能来实现项目评估和管理;管道中集成了安全检测功能,多个项目的检测结果会聚合显示;你可以通过 GitLab 提供的网页版 IDE 在线编辑代码,还可以快速查看管道的预览或执行状态。 + +### GoCD + +GoCD 是由老牌软件公司 Thoughtworks 出品,这已经足够证明它的能力和效率。对我而言,GoCD 最具亮点的特性是它的[价值流视图(VSM)][22]。实际上,一个管道的输出可以变成下一个管道的输入,从而把管道串联起来。这样做有助于提高不同开发团队在整个开发流程中的独立性。比如在引入 CI/CD 系统时,有些成立较久的机构希望保持他们各个团队相互隔离,这时候 VSM 就很有用了:让每个人都使用相同的工具就很容易在 VSM 中发现工作流程上的瓶颈,然后可以按图索骥调整团队或者想办法提高工作效率。 + +为公司的每个产品配置 VSM 是非常有价值的;GoCD 可以使用 [JSON 或 YAML 格式存储配置][23],还能以可视化的方式展示等待时间,这让一个机构能有效减少学习它的成本。刚开始使用 GoCD 创建你自己的流程时,建议使用人工审核的方式。让每个团队也采用人工审核,这样你就可以开始收集数据并且找到可能的瓶颈点。 + +### Travis CI + +我使用的第一个软件既服务(SaaS)类型的 CI 系统就是 Travis CI,体验很不错。管道配置以源码形式用 YAML 保存,它与 GitHub 等工具无缝整合。我印象中管道从来没有失效过,因为 Travis CI 的在线率很高。除了 SaaS 版之外,你也可以使用自行部署的版本。我还没有自行部署过,它的组件非常多,要全部安装的话,工作量就有点吓人了。我猜更简单的办法是把它部署到 Kubernetes 上,[Travis CI 提供了 Helm charts][26],这些 charts 目前不包含所有要部署的组件,但我相信以后会越来越丰富的。如果你不想处理这些细枝末节的问题,还有一个企业版可以试试。 + +假如你在开发一个开源项目,你就能免费使用 SaaS 版的 Travis CI,享受顶尖团队提供的优质服务!这样能省去很多麻烦,你可以在一个相对通用的平台上(如 GitHub)研发开源项目,而不用找服务器来运行任何东西。 + +### Jenkins + +Jenkins在 CI/CD 界绝对是元老级的存在,也是事实上的标准。我强烈建议你读一读这篇文章:"[Jenkins: Shifting Gears][27]",作者 Kohsuke 是 Jenkins 的创始人兼 CloudBees 公司 CTO。这篇文章契合了我在过去十年里对 Jenkins 及其社区的感受。他在文中阐述了一些这几年呼声很高的需求,我很乐意看到 CloudBees 引领这场变革。长期以来,Jenkins 对于非开发人员来说有点难以接受,并且一直是其管理员的重担。还好,这些问题正是他们想要着手解决的。 + +[Jenkins 配置既代码][28](JCasC)应该可以帮助管理员解决困扰了他们多年的配置复杂性问题。与其他 CI/CD 系统类似,只需要修改一个简单的 YAML 文件就可以完成 Jenkins 主节点的配置工作。[Jenkins Evergreen][29] 的出现让配置工作变得更加轻松,它提供了很多预设的使用场景,你只管套用就可以了。这些发行版会比官方的标准版本 Jenkins 更容易维护和升级。 + +Jenkins 2 引入了两种原生的管道(pipeline)功能,我在 LISA(一个系统架构和运维大会) 2017 年的研讨会上已经[讨论过了][30]。这两种功能都没有 YAML 简便,但在处理复杂任务时它们很好用。 + +[Jenkins X][31] 是 Jenkins 的一个全新变种,用来实现云端原生 Jenkins(至少在用户看来是这样)。它会使用 JCasC 及 Evergreen,并且和 Kubernetes 整合的更加紧密。对于 Jenkins 来说这是个令人激动的时刻,我很乐意看到它在这一领域的创新,并且继续发挥领袖作用。 + +### Concourse CI + +我第一次知道 Concourse 是通过 Pivotal Labs 的伙计们介绍的,当时它处于早期 beta 版本,而且那时候也很少有类似的工具。这套系统是基于微服务构建的,每个任务运行在一个容器里。它独有的一个优良特性是能够在你本地系统上运行任务,体现你本地的改动。这意味着你完全可以在本地开发(假设你已经连接到了 Concourse 的服务器),像在真实的管道构建流程一样从你本地构建项目。而且,你可以在修改过代码后从本地直接重新运行构建,来检验你的改动结果。 + +Concourse 还有一个简单的扩展系统,它依赖于资源这一基础概念。基本上,你想给管道添加的每个新功能都可以用一个 Docker 镜像实现,并作为一个新的资源类型包含在你的配置中。这样可以保证每个功能都被封装在一个不易改变的独立工件中,方便对其单独修改和升级,改变其中一个时不会影响其他构建。 + +### Spinnaker + +Spinnaker 出自 Netflix,它更关注持续部署而非持续集成。它可以与其他工具整合,比如Travis 和 Jenkins,来启动测试和部署流程。它也能与 Prometheus、Datadog 这样的监控工具集成,参考它们提供的指标来决定如何部署。例如,在一次金丝雀发布(canary deployment)里,我们可以根据收集到的相关监控指标来做出判断:最近的这次发布是否导致了服务降级,应该立刻回滚;还是说看起来一切OK,应该继续执行部署。 + +谈到持续部署,一些另类但却至关重要的问题往往被忽略掉了,说出来可能有点让人困惑:Spinnaker 可以帮助持续部署不那么“持续”。在整个应用部署流程期间,如果发生了重大问题,它可以让流程停止执行,以阻止可能发生的部署错误。但它也可以在最关键的时刻让人工审核强制通过,发布新版本上线,使整体收益最大化。实际上,CI/CD 的主要目的就是在商业模式需要调整时,能够让待更新的代码立即得到部署。 + +### Screwdriver + +Screwdriver 是个简单而又强大的软件。它采用微服务架构,依赖像 Nomad、Kubernetes 和 Docker 这样的工具作为执行引擎。官方有一篇很不错的[部署教学文档][34],介绍了如何将它部署到 AWS 和 Kubernetes 上,但如果相应的 [Helm chart][35] 也完成的话,就更完美了。 + +Screwdriver 也使用 YAML 来描述它的管道,并且有很多合理的默认值,这样可以有效减少各个管道重复的配置项。用配置文件可以组织起高级的工作流,来描述各个 job 间复杂的依赖关系。例如,一项任务可以在另一个任务开始前或结束后运行;各个任务可以并行也可以串行执行;更赞的是你可以预先定义一项任务,只在特定的 pull request 请求时被触发,而且与之有依赖关系的任务并不会被执行,这能让你的管道具有一定的隔离性:什么时候被构造的工件应该被部署到生产环境,什么时候应该被审核。 + +以上只是我对这些 CI/CD 工具的简单介绍,它们还有许多很酷的特性等待你深入探索。而且它们都是开源软件,可以自由使用,去部署一下看看吧,究竟哪个才是最适合你的那个。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/cicd-tools-sysadmins + +作者:[Dan Barker][a] +选题:[lujun9972][b] +译者:[jdh8383](https://github.com/jdh8383) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/barkerd427 +[b]: https://github.com/lujun9972 +[1]: https://www.ansible.com/ +[2]: https://www.chef.io/ +[3]: https://puppet.com/ +[4]: https://github.com/test-kitchen/test-kitchen +[5]: https://www.merriam-webster.com/dictionary/ephemeral +[6]: https://en.wikipedia.org/wiki/Idempotence +[7]: https://mjml.io/ +[8]: https://gitlab.com/devopskc/newsletter/blob/master/.gitlab-ci.yml +[9]: https://gitlab.com/devopskc/newsletter/blob/master/index/index.html +[10]: https://gitlab.com/devopskc/newsletter/blob/master/html-to-pdf.js +[11]: https://gitlab.com/devopskc/newsletter/blob/master/populate-index.js +[12]: https://devopskc.com/ +[13]: https://en.wikipedia.org/wiki/Directed_acyclic_graph +[14]: https://www.spinnaker.io/ +[15]: https://jenkins.io/ +[16]: https://martinfowler.com/books/dsl.html +[17]: http://groovy-lang.org/ +[18]: https://about.gitlab.com/product/continuous-integration/ +[19]: https://gitlab.com/gitlab-org/gitlab-ce/ +[20]: https://about.gitlab.com/2017/09/27/gitlab-leader-continuous-integration-forrester-wave/ +[21]: https://github.com/gliderlabs/herokuish +[22]: https://www.gocd.org/getting-started/part-3/#value_stream_map +[23]: https://docs.gocd.org/current/advanced_usage/pipelines_as_code.html +[24]: https://docs.travis-ci.com/ +[25]: https://github.com/travis-ci/travis-ci +[26]: https://github.com/travis-ci/kubernetes-config +[27]: https://jenkins.io/blog/2018/08/31/shifting-gears/ +[28]: https://jenkins.io/projects/jcasc/ +[29]: https://github.com/jenkinsci/jep/blob/master/jep/300/README.adoc +[30]: https://danbarker.codes/talk/lisa17-becoming-plumber-building-deployment-pipelines/ +[31]: https://jenkins-x.io/ +[32]: https://concourse-ci.org/ +[33]: https://github.com/concourse/concourse +[34]: https://docs.screwdriver.cd/cluster-management/kubernetes +[35]: https://github.com/screwdriver-cd/screwdriver-chart diff --git a/translated/talk/20190123 Book Review- Fundamentals of Linux.md b/translated/talk/20190123 Book Review- Fundamentals of Linux.md deleted file mode 100644 index fc05d96fec..0000000000 --- a/translated/talk/20190123 Book Review- Fundamentals of Linux.md +++ /dev/null @@ -1,73 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (mySoul8012) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Book Review: Fundamentals of Linux) -[#]: via: (https://itsfoss.com/fundamentals-of-linux-book-review) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -书评:linux的基础知识 -====== -有很多很棒的书籍涵盖了Linux的基础知识以及它的工作原理,今天,我们将会书评这样一本书,讨论的主题为Oliver Pelz所写的[linux的基础知识][1],由[PacktPub][2]发布。 - -[Oliver Pelz][3] 是一位超过十年软件开发人员和系统管理员经验人员,同时拥有生物信息学学位证书。 - -### 什么是linux基础知识一书 - -![Fundamental of Linux books][4] -正如可以从标题中猜到那样,该书(Linux基础知识)的目标是为读者打下一个了解Linux命令行的坚实基础。这本书一共有两百多页。因此它专注于教授用户日常遇到的问题,以及任务。本书为想要成为Linux管理员的读者而书写。 - -第一章首先概述了虚拟化。本书作者指导了读者如何在[VirtualBox][6]中创建[CentOS][5]实例。如何克隆实例,如何使用快照。并且同时你也会学习到如何通过SSH命令连接到虚拟机。 - -第二章介绍了Linux的命令行的基础知识,包括shell GLOB模式,shell扩展,如何使用包含空格和特殊字符的文件名称。如何来获取命令手册的帮助页面。如何使用`sed`, `awk`这两个命令。如何浏览Linux的文件系统。 - -第三章更深入的介绍了Linux文件系统。您将了解如何在Linux中链接文件,以及如何搜索它们。您还将获得用户,组,以及文件权限的概述。由于本章的重点介绍了如何与文件进行交互。因此还将会介绍如何从命令行中读取文本文件,以及如何使用vim编辑器。 - -第四章重点介绍了如何使用命令行。以及涵盖的重要命令。如`cat`, `sort`, `awk`. `tee`, `tar`,`rsync`, `nmap`, `htop`等。您还将会了解这些命令的流程,以及如何相互使用,还将介绍Bash shell脚本。 - -第五章同时也是本书的最后一章,将会介绍Linux和其他高级命令,以及网络的概念。本书的作者讨论了Linux如何处理网络并提供使用多个虚拟机的示例。同时还将会介绍如何安装新的程序,如何设置防火墙。 - -### 关于这本书的想法 - -Linux的基础知识可能看起来很见到,但是涵盖了相当多的信息。同时也将会获得如何使用命令行所需要的知识的一切。 - -使用本书的时候,需要注意一件事情,即,本书专注于对命令行的关注,没有任何关于如何使用图形化的用户界面的任何教程。这是因为在Linux中有太多不同的桌面环境,以及很多的类似的操作系统。因此很难编写一本可以涵盖所有变量的书。部分原因还因为本书的面向的用户群体为Linux管理员。 - -当我看到作者使用Centos教授Linux的时候有点惊讶。我原本以为他会使用更为常见的Linux的发行版本,例如Ubuntu,Debian或者Fedora。原因在于Centos是为服务器设计的发行版本。随着时间的推移变化很小。能够为Linux的基础知识打下一个非常坚实的基础。 - -自己使用Linux已经操作五年了。我大部分时间都在使用桌面版本的Linux。我有些时候会使用命令行操作。但我并没有花太多的时间在哪里。我使用鼠标执行了本书中很多的操作。现在呢。我同时也知道了如何通过终端做出同样的事情。这种方式不会改变我完成任务的路径。但是会更加帮助自己理解幕后发生的事情。 - -如果您刚刚使用Linux,或者计划使用。我不会推荐您阅读这本书。这可能有点绝对化。但是如何您已经花了一些时间在Linux上。或者可以快速掌握某种技术语言。那么这本书很适合你。 - -如果您认为本书适合您的学习需求。您可以从以下链接获取到该书。 - -我们将在未来几个月内尝试查看更多Linux书籍,敬请关注我们。 - -你最喜欢的关于Linux的入门书籍是什么?请在下面的评论中告诉我们。 - -如果您发现这篇文章很有趣,请花一点时间在社交媒体,黑客新闻或[Reddit][8]上分享 - - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/fundamentals-of-linux-book-review - -作者:[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://www.packtpub.com/networking-and-servers/fundamentals-linux -[2]: https://www.packtpub.com/ -[3]: http://www.oliverpelz.de/index.html -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/fundamentals-of-linux-book-review.jpeg?resize=800%2C450&ssl=1 -[5]: https://centos.org/ -[6]: https://www.virtualbox.org/ -[7]: https://www.centos.org/ -[8]: http://reddit.com/r/linuxusersgroup diff --git a/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md b/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md index 0b3dc1ba7e..b50dea4644 100644 --- a/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md +++ b/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md @@ -1,28 +1,29 @@ -每个 Linux 平台上的玩家都从不想要的恼人经历 -============================================================ - [![Linux 平台上玩家的问题](https://itsfoss.com/wp-content/uploads/2016/09/Linux-Gaming-Problems.jpg)][10] +每个 Linux 游戏玩家都绝不想要的恼人体验 +=================== -[在 Linux 平台上玩游戏][12] 已经走了很远,现在有专门的 [Linux 游戏型发行版]。但是这不意味着在 Linux 上打游戏的感觉和在 Windows 上一样顺畅。 +[![Linux 平台上玩家的问题](https://itsfoss.com/wp-content/uploads/2016/09/Linux-Gaming-Problems.jpg)][10] -为了确保我们和 Windows 用户同样地享受游戏,什么是我们应该考虑的困难呢? +[在 Linux 平台上玩游戏][12] 并不是什么新鲜事,现在甚至有专门的 [Linux 游戏发行版][13],但是这不意味着在 Linux 上打游戏的体验和在 Windows 上一样顺畅。 -[Wine][14],[PlayOnLinux][15] 和其它类似软件不总是能够玩所有流行的 Windows 游戏。在这篇文章里,我想讨论一下为了拥有一个最好的 Linux 游戏体验所必须处理好的若干因素。 +为了确保我们和 Windows 用户同样地享受游戏乐趣,哪些问题是我们应该考虑的呢? -### #1 SteamOS 是一个开源平台,Steam for Linux 并不是 +[Wine][14]、[PlayOnLinux][15] 和其它类似软件不总是能够让我们玩所有流行的 Windows 游戏。在这篇文章里,我想讨论一下为了拥有最好的 Linux 游戏体验所必须处理好的若干因素。 -正如 [StemOS 主页][16]所说, 即便 SteamOS 是一个开源平台,Steam for Linux 仍然是专有的。如果 Steam for Linux 也开源,那么它从开源社区得到的支持将会是巨大的。既然它不是,那么 [Ascension 计划的诞生自然是不可避免的][17]: +### #1 SteamOS 是开源平台,但 Steam for Linux 并不是 + +正如 [StemOS 主页][16]所说, 即便 SteamOS 是一个开源平台,但 Steam for Linux 仍然是专有的软件。如果 Steam for Linux 也开源,那么它从开源社区得到的支持将会是巨大的。既然它不是,那么 [Ascension 计划的诞生自然是不可避免的][17]: [video](https://youtu.be/07UiS5iAknA) -Ascension 计划是一个开源的能够启动从任何平台购买、下载的游戏的游戏启动器。这些游戏可以是 Steam 平台的,[Origin 游戏]平台的,Uplay 平台的,以及直接从游戏开发者主页或者从 DVD、CD-ROM 拷下来的。 +Ascension 开源的游戏启动器,旨在能够启动从任何平台购买、下载的游戏。这些游戏可以是 Steam 平台的、[Origin 游戏][18]平台的、Uplay 平台的,以及直接从游戏开发者主页或者从 DVD、CD-ROM 下载下来的。 -这是 Ascension 计划如何开始的:[头脑风暴][19]激发了一场与游戏社区读者之间有趣的讨论,在这场讨论中读者们纷纷发表自己的观点并给出建议。 +这是 Ascension 计划如何开始的:[头脑风暴][19]激发了一场与游戏社区读者之间有趣的讨论,在这场讨论中读者们纷纷发表了自己的观点并给出建议。 ### #2 与 Windows 平台的性能比较 在 Linux 平台上运行 Windows 游戏并不总是一件轻松的任务。但是感谢一个叫做 [CSMT][20](多线程命令流)的特性,尽管离 Windows 级别的性能还有相当长的路要走,PlayOnLinux 现在依旧可以更好地解决这些性能方面的问题。 -原生态 Linux 对游戏的支持在过去发行的游戏中从未如人意。 +Linux 对游戏的原生支持在过去发行的游戏中从未如人意。 去年,有报道说 SteamOS 比 Windows 在游戏方面的表现要[差得多][21]。古墓丽影去年在 SteamOS 及 Steam for Linux 上发行,然而基准测试的结果与 Windows 上的性能无法抗衡。 @@ -34,63 +35,59 @@ Ascension 计划是一个开源的能够启动从任何平台购买、下载的 [视频](https://youtu.be/-IeY5ZS-LlA) -下面是另一个有趣的比较,它显示出使用 Wine+CSMT 带来的游戏性能比 Steam 上原生的 Linux 版游戏带来的游戏性能要好得多!这就是开源的力量! - -[推荐阅读:一个新 Linux 操作系统 "OSu",力争成为 Arch Linux 世界中的 Ubuntu][26] +下面是另一个有趣的比较,它显示出使用 Wine + CSMT 带来的游戏性能比 Steam 上原生的 Linux 版游戏带来的游戏性能要好得多!这就是开源的力量! [视频](https://youtu.be/sCJkC6oJ08A) 以防 FPS 损失,TressFX 已经被关闭。 -以下是另一个有关在 Linux 上最新发布的 “[Life is Strange][27]”在 Linux 与 Windows上的比较: +以下是另一个有关在 Linux 上最新发布的 “[Life is Strange][27]” 在 Linux 与 Windows 上的比较: [视频](https://youtu.be/Vlflu-pIgIY) -[_Steam for Linux_][28] 开始在这个游戏上展示出比 Windows 更好的游戏性能,这是一件好事。 +[Steam for Linux][28] 开始在这个新游戏上展示出比 Windows 更好的游戏性能,这是一件好事。 -在发布任何 Linux 版的游戏前,开发者应该考虑优化游戏,特别是基于 DirectX 并需要 OpenGL转换的游戏。我们十分希望[ Linux 上的杀出重围:人类分裂][29] 在正式发行时能有一个好的基准测试结果。由于它是基于 DirectX的游戏,我们希望它能良好地移植到 Linux 上。以下是[游戏执行总监不得不说的话][30]。 +在发布任何 Linux 版的游戏前,开发者应该考虑优化游戏,特别是基于 DirectX 并需要 OpenGL 转换的游戏。我们十分希望 Linux 上的[杀出重围:人类分裂][29]Deus Ex: Mankind Divided on Linux 在正式发行时能有一个好的基准测试结果。由于它是基于 DirectX 的游戏,我们希望它能良好地移植到 Linux 上。以下是该[游戏执行总监不得不说的话][30]。 ### #3 专有的 NVIDIA 驱动 -相比于 [NVIDIA][32],[AMD 对于开源的支持][31]绝对是值得称赞的。尽管 [AMD][33] 因其更好的开源驱动在 Linux 上的驱动支持挺不错,NVIDIA 显卡用户由于开源版本的 NVIDIA 显卡驱动 “Nouveau” 有限的能力,仍不得不用专有的 NVIDIA 驱动。 +相比于 [NVIDIA][32],[AMD 对于开源的支持][31]绝对是值得称赞的。尽管 [AMD][33] 因其更好的开源驱动在 Linux 上的驱动支持挺不错,而 NVIDIA 显卡用户由于开源版本的 NVIDIA 显卡驱动 “Nouveau” 有限的能力,仍不得不用专有的 NVIDIA 驱动。 -在过去,传奇般的 Linus Torvalds 同样分享了他关于“来自 NIVIDIA 的 Linux 支持完全不可接受”的想法。 +在过去,传奇般的 Linus Torvalds 同样分享了他关于“来自 NVIDIA 的 Linux 支持完全不可接受”的想法。 [视频](https://youtu.be/O0r6Pr_mdio) -你可以在这里观看完整的[讲话][35],尽管 NVIDIA 用 [承诺更好的 Linux 平台支持][36]作为回复,开源显卡驱动仍如之前一样毫无起色。 +你可以在这里观看完整的[谈话][35],尽管 NVIDIA 用 [承诺更好的 Linux 平台支持][36]作为回复,但其开源显卡驱动仍如之前一样毫无起色。 -### #4 需要 Uplay 和 Origin 在 Linux 平台上的 DRM 支持 +### #4 需要Linux 平台上的 Uplay 和 Origin 的 DRM 支持 [视频](https://youtu.be/rc96NFwyxWU) -以上的视频描述了如何在 Linux 上安装 [Uplay][37] DRM。上传者还建议使用 Wine 作为 Linux 上的主要的应用和游戏支持软件并不推荐。相反,使用原生的应用更值得鼓励。 +以上的视频描述了如何在 Linux 上安装 [Uplay][37] DRM。视频上传者还建议说并不推荐使用 Wine 作为 Linux 上的主要的应用和游戏支持软件。相反,使用原生的应用更值得鼓励。 以下视频是一个关于如何在 Linux 上安装 [Origin][38] DRM 的教程。 [视频](https://youtu.be/ga2lNM72-Kw) -数字版权管理软件给游戏运行又加了一层阻碍,使得在 Linux 上良好运行 Windows 游戏这一本就充满挑战性的任务更有难度。因此除了使游戏能够运行之外,W.I.N.E 不得不同时负责运行像 Uplay 或 Origin 之类的 DRM 软件。如果能像 Steam 一样,Linux 也能够有自己原生版本的 Uplay 和 Origin 那就好了。 - -[推荐阅读:Linux 基金会会长称 2017 是 Linux 桌面之年......尽管他自己正使用苹果的 macOS][39] +数字版权管理(DRM)软件给游戏运行又加了一层阻碍,使得在 Linux 上良好运行 Windows 游戏这一本就充满挑战性的任务更有难度。因此除了使游戏能够运行之外,W.I.N.E 不得不同时负责运行像 Uplay 或 Origin 之类的 DRM 软件。如果能像 Steam 一样,Linux 也能够有自己原生版本的 Uplay 和 Origin 那就好了。 ### #5 DirectX 11 对于 Linux 的支持 -尽管我们在 Linux 平台上有可以运行 Windows 应用的工具,每个游戏为了能在 Linux 上运行都带有自己的配套插件需求。尽管去年通过 Code Weavers 有一篇关于 [DirectX 11 对于 Linux 的支持][40] 的公告,在 Linux 上畅玩新发大作仍是长路漫漫。现在你可以[从 Codweavers 购买 Crossover][41] 以获得可得到的最佳 DirectX 11 支持。这个在 Arch Linux 论坛上的[频道][42]清楚展现了将这个梦想成真需要多少的努力。以下是一个 [Reddit 频道][44] 上的有趣[发现][43]。这个发现提到了[来自 Codeweavers 的 DirectX 11 补丁][45],现在看来这无疑是好消息。 +尽管我们在 Linux 平台上有可以运行 Windows 应用的工具,每个游戏为了能在 Linux 上运行都带有自己的配套调整需求。尽管去年通过 Code Weavers 有一篇关于 [DirectX 11 对于 Linux 的支持][40] 的公告,在 Linux 上畅玩新发大作仍是长路漫漫。现在你可以[从 Codweavers 购买 Crossover][41] 以获得可得到的最佳 DirectX 11 支持。这个在 Arch Linux 论坛上的[频道][42]清楚展现了将这个梦想成真需要多少的努力。以下是一个 [Reddit 频道][44] 上的有趣 [发现][43]。这个发现提到了[来自 Codeweavers 的 DirectX 11 补丁][45],现在看来这无疑是好消息。 -### #6 100%的 Steam 游戏在 Linux 上无法获得 +### #6 100% 的 Steam 游戏不适用于 Linux 随着 Linux 游戏玩家持续错过每一款主要游戏的发行,这是需要考虑的一个重点,因为大部分主要游戏都在 Windows 上发行。以下是[如何在 Linux 上安装 Windows 版的 Steam 的教程][46]。 -### #7 游戏发行商对OpenGL更好的支持 +### #7 游戏发行商对 OpenGL 更好的支持 目前开发者和发行商主要着眼于 DirectX 而不是 OpenGL 来开发游戏。现在随着 Steam 正式登录 Linux,开发者应该同样考虑在 OpenGL 下开发。 [Direct3D][47] 仅仅是为了 Windows 平台打造。而 OpenGL API 拥有开放性标准,并且它不仅能在 Windows 上同样也能在其它各种各样的平台上实现。 -尽管是一篇很老的文章,[这个很有价值的资源][48]分享了许多有关 OpenGL 和 DirectX 现状的很有想法的信息。所提出的观点确实十分明智,基于按时间排序的事件给予读者启迪。 +尽管是一篇很老的文章,[这个很有价值的资源][48]分享了许多有关 OpenGL 和 DirectX 现状的很有想法的信息。其所提出的观点确实十分明智,基于按时间排序的事件也能给予读者启迪。 -在 Linux 平台上发布大作的发行商绝不应该忽视一个事实:在 OpenGL 下直接开发游戏要比从 DirectX 移植到 OpenGL 合算得多。如果不得不转换平台,移植必须被仔细优化并谨慎研究。发布游戏可能会有延迟但这绝对值得。 +在 Linux 平台上发布大作的发行商绝不应该忽视一个事实:在 OpenGL 下直接开发游戏要比从 DirectX 移植到 OpenGL 合算得多。如果必须进行平台转制,移植必须被仔细优化并谨慎研究。发布游戏可能会有延迟,但这绝对值得。 有更多的烦恼要分享?务必在评论区让我们知道。 @@ -100,7 +97,7 @@ via: https://itsfoss.com/linux-gaming-problems/ 作者:[Avimanyu Bandyopadhyay ][a] 译者:[tomjlw](https://github.com/tomjlw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/tech/20190103 How to use Magit to manage Git projects.md b/translated/tech/20190103 How to use Magit to manage Git projects.md deleted file mode 100644 index e2f43323e6..0000000000 --- a/translated/tech/20190103 How to use Magit to manage Git projects.md +++ /dev/null @@ -1,93 +0,0 @@ -[#]:collector:(lujun9972) -[#]:translator:(lujun9972) -[#]:reviewer:( ) -[#]:publisher:( ) -[#]:url:( ) -[#]:subject:(How to use Magit to manage Git projects) -[#]:via:(https://opensource.com/article/19/1/how-use-magit) -[#]:author:(Sachin Patil https://opensource.com/users/psachin) - -如何使用 Magit 管理 Git 项目 -====== -Emacs 的 Magit 扩展插件使得使用 Git 进行版本控制变得简单起来。 -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e-) - -[Git][1] 是一个很棒的用于项目管理的 [版本控制 ][2] 工具,就是新人学习起来太难。Git 的命令行工具很难用,你不仅需要熟悉它的标志和选项还需要知道什么环境下使用他们。这使人望而生畏,因此不少人只在有限的几个场景中才使用它。 - -还在,现今大多数的集成开发环境 (IDE) 都包含了 Git 扩展,大大地简化了使用使用的难度。Emacs 中就有这么一款 Git 扩展名叫 [Magit][3]。 - -Magit 项目成立有差不多 10 年了,它将自己定义为 "一件 Emacs 内的 Git 瓷器。" 也就是说,它是一个操作界面,每个操作都能一键完成。本文会带你领略一下 Magit 的操作界面并告诉你如何使用它来管理 Git 项目。 - -若你还未 [安装 Emacs][4],则开始本教程之前请先 [安装 Magit][5]。 - -### Magit 的界面 - -首先用 Emacs 的 [Dired mode][6] 访问一个项目目录。比如我所有的 Emacs 配置存储在 **~/.emacs.d/** 目录中,就是用 Git 来进行管理的。 - -![](https://opensource.com/sites/default/files/uploads/visiting_a_git_project.png) - -若你在命令行下工作,则你需要输入 **git status** 来查看项目的当前状态。Magit 也有类似的函数:**magit-status**。你可以通过 **M-x magit-status** (快捷方式是 **Alt+x magit-status** )来调用该函数。结果看起来像下面这样: - -![](https://opensource.com/sites/default/files/uploads/magit_status.png) - -Magit 显示的信息比 **git status** 命令的要多得多。它分别列出了未追踪文件列表、未暂存文件列表以及已暂存文件列表。它还列出了储藏 (stash) 列表以及最近几次的提交—所有这些信息都在一个窗口中展示。 - -如果你想查看修改了哪些内容,按下 Tab 键。比如,我移动光标到未暂存文件 **custom_functions.org** 上然后按下 Tab 键,Magit 会显示修改了哪些内容: - -![](https://opensource.com/sites/default/files/uploads/show_unstaged_content.png) - -这跟运行命令 **git diff custom_functions.org** 类似。储藏文件更简单。只需要移动光标到文件上然后按下 **s** 键。该文件就会迅速移动到被储藏文件列表中: - -![](https://opensource.com/sites/default/files/uploads/staging_a_file.png) - -要反储藏 (unstage) 某个文件,使用 **u** 键。按下 **s** 和 **u** 键要比在命令行输入 **git add -u ** 和 **git reset HEAD ** 快的多也更有趣的多。 - -### 提交更改 - -在同一个 Magit 窗口中,按下 **c** 键会显示一个提交窗口,其中提供了许多标志,比如 **--all** 用来暂存所有文件或者 **--signoff** 来往提交信息中添加签名行。 - -![](https://opensource.com/sites/default/files/uploads/magit_commit_popup.png) - -将光标移动到想要启动的行,比如 signoff 标签行,然后按下回车。**--signoff** 文本会变成高亮,这说明该标志已经被启用。 - -![](https://opensource.com/sites/default/files/uploads/magit_signoff_commit.png) - -再次按下 **c** 键会显示一个窗口供你输入提交信息。 - -![](https://opensource.com/sites/default/files/uploads/magit_commit_message.png) - -最后,使用 **C-c C-c **(按键 Ctrl+cc 的缩写形式) 来提交更改。 - -![](https://opensource.com/sites/default/files/uploads/magit_commit_message_2.png) - -### 推送更改 - -更改提交后,提交行将会显示在 **Recent commits** 段中显示。 - -![](https://opensource.com/sites/default/files/uploads/magit_commit_log.png) - -将光标放到该提交处然后按下 **p** 来推送该变更。 - -若你想感受一下使用 Magit 的感觉,我已经在 YouTube 上上传了一段 [演示 ][7]。本文只涉及到 Magit 的一点皮毛。它有许多超酷的功能可以帮你使用 Git 分支,变基等功能。你可以在 Magit 的主页上找到 [文档,支持,以及更多 ][8] 链接。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/how-use-magit - -作者:[Sachin Patil][a] -选题:[lujun9972][b] -译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/psachin -[b]: https://github.com/lujun9972 -[1]: https://git-scm.com -[2]: https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control -[3]: https://magit.vc -[4]: https://www.gnu.org/software/emacs/download.html -[5]: https://magit.vc/manual/magit/Installing-from-Melpa.html#Installing-from-Melpa -[6]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired-Enter.html#Dired-Enter -[7]: https://youtu.be/Vvw75Pqp7Mc -[8]: https://magit.vc/ diff --git a/translated/tech/20190109 Configure Anaconda on Emacs - iD.md b/translated/tech/20190109 Configure Anaconda on Emacs - iD.md new file mode 100644 index 0000000000..09dcfd9a1c --- /dev/null +++ b/translated/tech/20190109 Configure Anaconda on Emacs - iD.md @@ -0,0 +1,117 @@ +[#]:collector:(lujun9972) +[#]:translator:(lujun9972) +[#]:reviewer:( ) +[#]:publisher:( ) +[#]:url:( ) +[#]:subject:(Configure Anaconda on Emacs – iD) +[#]:via:(https://idevji.com/configure-anaconda-on-emacs/) +[#]:author:(Devji Chhanga https://idevji.com/author/admin/) + +在 Emacs 上配置 Anaconda +====== + +也许我所最求的究极 IDE 就是 [Emacs][1] 了。我的目标是使 Emacs 成为一款全能的 Python IDE。本文描述了如何在 Emacs 上配置 Anaconda。 + +我的配置信息: + +``` +OS: Trisquel 8.0 +Emacs: GNU Emacs 25.3.2 +``` + +快捷键说明 [(参见完全指南 )][2]: + +``` +C-x = Ctrl + x +M-x = Alt + x +RET = ENTER +``` + +### 1。下载并安装 Anaconda + +#### 1.1 下载: +[从这儿 ][3] 下载 Anaconda。你应该下载 Python 3.x 版本因为 Python 2 在 2020 年就不再支持了。你无需预先安装 Python 3.x。安装脚本会自动进行安装。 + +#### 1.2 安装: + +``` + cd ~/Downloads +bash Anaconda3-2018.12-Linux-x86.sh +``` + + +### 2。将 Anaconda 添加到 Emacs + +#### 2.1 将 MELPA 添加到 Emacs +我们需要用到 _anaconda-mode_ 这个 Emacs 包。该包位于 MELPA 仓库中。Emacs25 需要手工添加该仓库。 + +[注意:点击本文查看如何将 MELPA 添加到 Emacs。][4] + +#### 2.2 为 Emacs 安装 anaconda-mode 包 + +``` +M-x package-install RET +anaconda-mode RET +``` + +#### 2.3 为 Emacs 配置 anaconda-mode + +``` +echo "(add-hook 'python-mode-hook 'anaconda-mode)" > ~/.emacs.d/init.el +``` + + +### 3。在 Emacs 上通过 Anaconda 运行你第一个脚本 + +#### 3.1 创建新 .py 文件 + +``` +C-x C-f +HelloWorld.py RET +``` + +#### 3.2 输入下面代码 + +``` +print ("Hello World from Emacs") +``` + +#### 3.3 运行之 + +``` +C-c C-p +C-c C-c +``` + +输出为 + +``` +Python 3.7.1 (default, Dec 14 2018, 19:46:24) +[GCC 7.3.0] :: Anaconda, Inc. on linux +Type "help", "copyright", "credits" or "license" for more information. +>>> python.el: native completion setup loaded +>>> Hello World from Emacs +>>> +``` + +我是受到 [Codingquark;][5] 的影响才开始使用 Emacs 的。 +有任何错误和遗漏请在评论中之处。干杯! + +-------------------------------------------------------------------------------- + +via: https://idevji.com/configure-anaconda-on-emacs/ + +作者:[Devji Chhanga][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://idevji.com/author/admin/ +[b]: https://github.com/lujun9972 +[1]: https://www.gnu.org/software/emacs/ +[2]: https://www.math.uh.edu/~bgb/emacs_keys.html +[3]: https://www.anaconda.com/download/#linux +[4]: https://melpa.org/#/getting-started +[5]: https://codingquark.com diff --git a/translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md b/translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md new file mode 100644 index 0000000000..2e2331e698 --- /dev/null +++ b/translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Mind map yourself using FreeMind and Fedora) +[#]: via: (https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +在 Fedora 中使用 FreeMind 制作自己的思维导图 +====== +![](https://fedoramagazine.org/wp-content/uploads/2019/01/freemind-816x345.jpg) + +你自己的思维导图一开始听起来有些牵强。它是关于神经通路么?还是心灵感应?完全不是。相反,自己的思维导图是一种在视觉上向他人描述自己的方式。它还展示了你拿来描述的特征之间的联系。这是一种以聪明的同时可控的与他人分享信息的有用方式。你可以使用任何思维导图应用来做到。本文向你展示如何使用 Fedora 中提供的 [FreeMind][1]。 + +### 获取应用 + +FreeMind 已经出现有一段时间了。虽然 UI 有点过时,你也可以使用新的,但它是一个功能强大的应用,提供了许多构建思维导图的选项。当然,它是 100% 开源的。还有其他思维导图应用可供 Fedora 和 Linux 用户使用。查看[此前一篇涵盖多个思维导图选择的文章][2]。 + +如果你运行的是 Fedora Workstation,请使用“软件”应用从 Fedora 仓库安装 FreeMind。或者在终端中使用这个 [sudo][3] 命令: + +``` +$ sudo dnf install freemind +``` + +你可以从 Fedora Workstation 中的 GNOME Shell Overview 启动应用。或者使用桌面环境提供的应用启动服务。默认情况下,FreeMind 会显示一个新的空白脑图: + +![][4] +FreeMind 初始(空白)思维导图 + +脑图由链接的项目或描述(节点)组成。当你想到与节点相关的内容时,只需创建一个与其连接的新节点即可。 + +### + +单击初始节点。编辑文本并点击**回车**将其替换为你的姓名。你就能开始你的思维导图。 + +如果你必须向某人充分描述自己,你会怎么想?可能会有很多东西。你平时做什么?你喜欢什么?你不喜欢什么?你有什么价值?你有家庭吗?所有这些都可以在节点中体现。 + +要添加节点连接,请选择现有节点,然后单击**插入**,或使用“灯泡”图标作为新的子节点。要在与新子级相同的层级添加另一个节点,请使用**回车**。 + +如果你弄错了,别担心。你可以使用 **Delete** 键删除不需要的节点。内容上没有规则。但是最好是短节点。它们能让你在创建导图时思维更快。简洁的节点还能让其他浏览者更轻松地查看和理解。 + +该示例使用节点规划了每个主要类别: + +![][5] +个人思维导图,第一级 + +你可以为这些区域中的每个区域另外迭代一次。让你的思想自由地连接想法以生成导图。不要担心“做得正确“。最好将所有内容从头脑中移到显示屏上。这是下一级导图的样子。 + +![][6] +个人思维导图,第二级 + +你可以以相同的方式扩展任何这些节点。请注意你在示例中可以了解多少有关 John Q. Public 的信息。 + +### 如何使用你的个人思维导图 + +这是让团队或项目成员互相介绍的好方法。你可以将各种格式和颜色应用于导图以赋予其个性。当然,这些在纸上做很有趣。但是在 Fedora 中安装一个就意味着你可以随时修复错误,甚至可以在你改变的时候做出修改。 + +祝你在探索个人思维导图上玩得开心! + + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/ + +作者:[Paul W. Frields][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: http://freemind.sourceforge.net/wiki/index.php/Main_Page +[2]: https://fedoramagazine.org/three-mind-mapping-tools-fedora/ +[3]: https://fedoramagazine.org/howto-use-sudo/ +[4]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-17-04-1024x736.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-32-38-1024x736.png +[6]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-38-00-1024x736.png diff --git a/translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md b/translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md new file mode 100644 index 0000000000..139301bcf9 --- /dev/null +++ b/translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Grant And Remove Sudo Privileges To Users On Ubuntu) +[#]: via: (https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +如何在 Ubuntu 上为用户授予和删除 sudo 权限 +====== +![](https://www.ostechnix.com/wp-content/uploads/2019/02/sudo-privileges-720x340.png) + +如你所知,用户可以在 Ubuntu 系统上使用 sudo 权限执行任何管理任务。在 Linux 机器上创建新用户时,他们无法执行任何管理任务,直到你将其加入 **“sudo” 组的成员**。在这个简短的教程中,我们将介绍如何将普通用户添加到 sudo 组以及删除给定的权限,使其成为普通用户。 + +**在 Linux 上向普通用户授予 sudo 权限** + +通常,我们使用 **“adduser”** 命令创建新用户,如下所示。 + +``` +$ sudo adduser ostechnix +``` + +如果你希望新创建的用户使用 sudo 执行管理任务,只需使用以下命令将它添加到 sudo 组: + +``` +$ sudo usermod -a -G sudo hduser +``` + +上面的命令将使名为 **“ostechnix”** 的用户成为 sudo 组的成员。 + +你也可以使用此命令将用户添加到 sudo 组。 + +``` +$ sudo adduser ostechnix sudo +``` + +现在,注销并以新用户身份登录,以使此更改生效。此时用户已成为管理用户。 + +要验证它,只需在任何命令中使用 “sudo” 作为前缀。 + +``` +$ sudo mkdir /test +[sudo] password for ostechnix: +``` + +### 删除用户的 sudo 权限 + +有时,你可能希望删除特定用户的 sudo 权限,而不用在 Linux 中删除它。要将任何用户设为普通用户,只需将其从 sudo 组中删除即可。 + +比如说如果要从 sudo 组中删除名为 **ostechnix** 的用户,只需运行: + +``` +$ sudo deluser ostechnix sudo +``` + +**示例输出:** + +``` +Removing user `ostechnix' from group `sudo' ... +Done. +``` + +此命令仅从 sudo 组中删除用户 “ostechnix”,但不会永久地从系统中删除用户。现在,它成为了普通用户,无法像 sudo 用户那样执行任何管理任务。 + +此外,你可以使用以下命令撤消用户的 sudo 访问权限: + +``` +$ sudo gpasswd -d ostechnix sudo +``` + +从 sudo 组中删除用户时请小心。不要从 “sudo” 组中删除真正的管理员。 + +使用命令验证用户 “ostechnix” 是否已从 sudo 组中删除: + +``` +$ sudo -l -U ostechnix +User ostechnix is not allowed to run sudo on ubuntuserver. +``` + +是的,用户 “ostechnix” 已从 sudo 组中删除,他无法执行任何管理任务。 + +从 sudo 组中删除用户时请小心。如果你的系统上只有一个 sudo 用户,并且你将它从 sudo 组中删除了,那么就无法执行任何管理操作,例如在系统上安装、删除和更新程序。所以,请小心。在我们的下一篇教程中,我们将解释如何恢复用户的 sudo 权限。 + +就是这些了。希望这篇文章有用。还有更多好东西。敬请期待! + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/ + +作者:[SK][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 diff --git a/translated/tech/20190219 Logical - in Bash.md b/translated/tech/20190219 Logical - in Bash.md new file mode 100644 index 0000000000..1b69e80e00 --- /dev/null +++ b/translated/tech/20190219 Logical - in Bash.md @@ -0,0 +1,229 @@ +[#]: collector: "lujun9972" +[#]: translator: "zero-mk" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Logical & in Bash" +[#]: via: "https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash" +[#]: author: "Paul Brown https://www.linux.com/users/bro66" + +Bash中的逻辑和(`&`) +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand-brian-taylor-unsplash.jpg?itok=Iq6vxSNK) + +有人可能会认为两篇文章中的`&`意思差不多,但实际上并不是。虽然 [第一篇文章讨论了如何在命令末尾使用`&`来将命令转到后台运行][1] 之后分解为解释流程管理, 第二篇文章将 [`&` 看作引用文件描述符的方法][2], 这些文章让我们知道了,与 `<` 和 `>` 结合使用后,你可以将输入或输出引导到别的地方。 + +但我们还没接触过作为 AND 操作符使用的`&`。所以,让我们来看看。 + +### & 是一个按位运算符 + +如果您完全熟悉二进制数操作,您肯定听说过 AND 和 OR 。这些是按位操作,对二进制数的各个位进行操作。在 Bash 中,使用`&`作为AND运算符,使用`|`作为 OR 运算符: + +**AND** + +``` +0 & 0 = 0 + +0 & 1 = 0 + +1 & 0 = 0 + +1 & 1 = 1 +``` + +**OR** + +``` +0 | 0 = 0 + +0 | 1 = 1 + +1 | 0 = 1 + +1 | 1 = 1 + +``` + + +您可以通过对任何两个数字进行 AND 运算并使用`echo`输出结果: + +``` +$ echo $(( 2 & 3 )) # 00000010 AND 00000011 = 00000010 + +2 + +$ echo $(( 120 & 97 )) # 01111000 AND 01100001 = 01100000 + +96 +``` + +OR(`|`)也是如此: + +``` +$ echo $(( 2 | 3 )) # 00000010 OR 00000011 = 00000011 + +3 + +$ echo $(( 120 | 97 )) # 01111000 OR 01100001 = 01111001 + +121 +``` + + +关于这个不得不说的三件事: + +1. 使用`(( ... ))`告诉 Bash 双括号之间的内容是某种算术或逻辑运算。`(( 2 + 2 ))`, `(( 5 % 2 ))` (`%`是[求模][3]运算符)和`((( 5 % 2 ) + 1))`(等于3)一切都会奏效。 + + 2. [像变量一样][4], 使用`$`提取值,以便你可以使用它。 + 3. 空格并没有影响: `((2+3))` 将等价于 `(( 2+3 ))` 和 `(( 2 + 3 ))`。 + 4. Bash只能对整数进行操作. 试试这样做: `(( 5 / 2 ))` ,你会得到"2";或者这样 `(( 2.5 & 7 ))` ,但会得到一个错误。然后,在按位操作中使用除整数之外的任何东西(这就是我们现在所讨论的)通常是你不应该做的事情。 + + + +**提示:** 如果您想看看十进制数字在二进制下会是什么样子,你可以使用 _bc_ ,这是一个大多数 Linux 发行版都预装了的命令行计算器。比如: + +``` +bc <<< "obase=2; 97" +``` + +这个操作将会把 `97`转换成十二进制(`obase` 中的 _o_ 代表 _output_ ,也即,_输出_)。 + +``` +bc <<< "ibase=2; 11001011" +``` +这个操作将会把 `11001011`转换成十进制(`ibase` 中的 _i_ 代表 _input_ ,也即,_输入_)。 + +### &&是一个逻辑运算符 + +虽然它使用与其按位表达相同的逻辑原理,但Bash的`&&`运算符只能呈现两个结果:1(“true”)和0(“false”)。对于Bash来说,任何不是0的数字都是“true”,任何等于0的数字都是“false”。什么也是false也不是数字: + +``` +$ echo $(( 4 && 5 )) # 两个非零数字, 两个为true = true + +1 + +$ echo $(( 0 && 5 )) # 有一个为零, 一个为false = false + +0 + +$ echo $(( b && 5 )) # 其中一个不是数字, 一个为false = false + +0 +``` + +与 `&&` 类似, OR 对应着 `||` ,用法正如你想的那样。 + +以上这些都很简单... 直到进入命令的退出状态。 + +### &&是命令退出状态的逻辑运算符 + +[正如我们在之前的文章中看到的][2],当命令运行时,它会输出错误消息。更重要的是,对于今天的讨论,它在结束时也会输出一个数字。此数字称为_exit code_(即_返回码_),如果为0,则表示该命令在执行期间未遇到任何问题。如果是任何其他数字,即使命令完成,也意味着某些地方出错了。 +所以 0 意味着非常棒,任何其他数字都说明有问题发生,并且,在返回码的上下文中,0 意味着“真”,其他任何数字都意味着“假”。对!这 **与您所熟知的逻辑操作完全相反** ,但是你能用这个做什么? 不同的背景,不同的规则。这种用处很快就会显现出来。 + +让我们继续! + +返回码 _临时_ 储存在 [特殊变量][5] `?` 中— 是的,我知道:这又是一个令人迷惑的选择。但不管怎样, [别忘了我们在讨论变量的文章中说过][4], 那时我们说你要用 `$` 符号来读取变量中的值,在这里也一样。所以,如果你想知道一个命令是否顺利运行,你需要在命令结束后,在运行别的命令之前马上用 `$?` 来读取 `?` 的值。 + +试试下面的命令: + +``` +$ find /etc -iname "*.service" + +find: '/etc/audisp/plugins.d': Permission denied + +/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service + +/etc/systemd/system/dbus-org.freedesktop.ModemManager1.service + +[等等内容] +``` + +[正如你在上一篇文章中看到的一样][2],普通用户权限在 _/etc_ 下运行 `find` 通常将抛出错误,因为它试图读取你没有权限访问的子目录。 + +所以,如果你在执行 `find` 后立马执行... + +``` +echo $? +``` + +...,,它将打印 `1`,表明存在错误。 + +注意:当你在一行中运行两遍 `echo $?` ,你将得到一个 `0` 。这是因为 `$?` 将包含 `echo $?` 的返回码,而这条命令按理说一定会执行成功。所以学习如何使用 `$?` 的第一课就是: **单独执行 `$?`** 或者将它保存在别的安全的地方 —— 比如保存在一个变量里,不然你会很快丢失它。) + +一个直接使用 `?` 的用法是将它并入一串链式命令列表,这样 Bash 运行这串命令时若有任何操作失败,后面命令将终止。例如,您可能熟悉构建和编译应用程序源代码的过程。你可以像这样手动一个接一个地运行它们: + +``` +$ configure + +. + +. + +. + +$ make + +. + +. + +. + +$ make install + +. + +. + +. +``` + +你也可以把这三行合并成一行... + +``` +$ configure; make; make install +``` + +... 但你要希望上天保佑。 + +为什么这样说呢?因为你这样做是有缺点的,比方说 `configure` 执行失败了, Bash 将仍会尝试执行 `make` 和 `sudo make install`——就算没东西可 make ,实际上,是没东西会安装。 + +聪明一点的做法是: + +``` +$ configure && make && make install +``` + +这将从每个命令中获取退出代码,并将其用作链式 `&&` 操作的操作数。 +但是,没什么好抱怨的,Bash 知道如果 `configure` 返回非零结果,整个过程都会失败。如果发生这种情况,不必运行 `make` 来检查它的退出代码,因为无论如何都会失败的。因此,它放弃运行 `make` ,只是将非零结果传递给下一步操作。并且,由于 `configure && make` 传递了错误,Bash 也不必运行`make install`。这意味着,在一长串命令中,您可以使用 `&&` 连接它们,并且一旦失败,您可以节省时间,因为其他命令会立即被取消运行。 + +你可以类似地使用 `||`,OR 逻辑操作符,这样就算只有一部分命令成功执行,Bash 也能运行接下来链接在一起的命令。 +鉴于所有这些(以及我们之前介绍过的内容),您现在应该更清楚地了解我们在 [本文开头][1] 开头设置的命令行: + +``` +mkdir test_dir 2>/dev/null || touch backup/dir/images.txt && find . -iname "*jpg" > backup/dir/images.txt & +``` + +因此,假设您从具有读写权限的目录运行上述内容,它做了什么以及如何做到这一点?它如何避免不合时宜且可能导致执行错误的错误?下周,除了给你这些答案的结果,我们将讨论 brackets: curly, curvy and straight. 不要错过了哟! + +因此,假设您在具有读写权限的目录运行上述内容,它会执行的操作以及如何执行此操作?它如何避免不合时宜且可能导致执行错误的错误?下周,除了给你解决方案,我们将处理包括:卷曲,曲线和直线。不要错过! + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash + +作者:[Paul Brown][a] +选题:[lujun9972][b] +译者:[zero-MK](https://github.com/zero-mk) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/bro66 +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux +[2]: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash +[3]: https://en.wikipedia.org/wiki/Modulo_operation +[4]: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise +[5]: https://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html