Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu.Wang 2018-11-15 17:51:48 +08:00
commit eaa2ef7f70
21 changed files with 960 additions and 646 deletions

View File

@ -1,86 +1,76 @@
6.828 中使用的工具
Caffeinated 6.828使用的工具
======
### 6.828 中使用的工具
在这个课程中你将使用两套工具:一个是 x86 模拟器 QEMU它用来运行你的内核另一个是编译器工具链包括汇编器、链接器、C 编译器以及调试器,它们用来编译和测试你的内核。本文有你需要去下载和安装你自己的副本相关信息。本课程假定你熟悉所有出现的 Unix 命令的用法。
在这个课程中你将使用两套工具:一个是 x86 模拟器 QEMU它用来运行你的内核另一个是编译器工具链包括汇编器、链接器、C 编译器以及调试器,它们用来编译和测试你的内核。本文有你需要去下载和安装你自己的副本相关信息。本课程假定你熟悉所有出现的 Unix 命令的用法。
我们强烈推荐你使用一个 Debathena 机器,比如 athena.dialup.mit.edu,去做你的实验。如果你使用 MIT 的运行在 Linux 上的 Athena 机器,那么本课程所需要的所有软件工具都在 6.828 的存储中:只需要输入 'add -f 6.828' 就可以访问它们。
我们强烈推荐你使用一个 Debathena 机器去做你的实验,比如 athena.dialup.mit.edu。如果你使用运行在 Linux 上的 MIT Athena 机器,那么本课程所需要的所有软件工具都在 6.828 的存储中:只需要输入 `add -f 6.828` 就可以访问它们。
如果你不使用一个 Debathena 机器,我们建议你使用一台 Linux 虚拟机。如果是这样,你可以在你的 Linux 虚拟机上构建和安装工具。我们将在下面介绍如何在 Linux 和 MacOS 计算上来构建和安装工具。
如果你不使用 Debathena 机器,我们建议你使用一台 Linux 虚拟机。如果是这样,你可以在你的 Linux 虚拟机上构建和安装工具。我们将在下面介绍如何在 Linux 和 MacOS 计算上来构建和安装工具。
在 [Cygwin][1] 的帮助下,在窗口中运行这个开发环境也是可行的。安装 cygwin并确保安装了 flex 和 bison 包(它们在开发下面)。
在 [Cygwin][1] 的帮助下,在 Windows 中运行这个开发环境也是可行的。安装 cygwin并确保安装了 flex 和 bison 包(它们在开发 header 软件包分类下面)。
对于 6.828 中使用的工具中的有用的命令,请参考[实验工具指南][2]。
#### 编译器工具链
### 编译器工具链
一个 “编译器工具链“ 是一套程序,包括一个 C 编译器、汇编器和链接器,使用它们来将代码转换成可运行的二进制文件。你需要一个能够生成在 32 位 Intel 架构x86 架构)上运行的 ELF 二进制格式程序的编译器工具链。
“编译器工具链“ 是一套程序,包括一个 C 编译器、汇编器和链接器,使用它们来将代码转换成可运行的二进制文件。你需要一个能够生成在 32 位 Intel 架构x86 架构)上运行的 ELF 二进制格式程序的编译器工具链。
##### 测试你的编译器工具链
#### 测试你的编译器工具链
现代的 Linux 和 BSD UNIX 发行版已经为 6.828 提供了一个合适的工具链。去测试你的发行版,可以输入如下的命令:
```
% objdump -i
```
第二行应该是 `elf32-i386`
```
% gcc -m32 -print-libgcc-file-name
```
这个命令应该会输出如 `/usr/lib/gcc/i486-linux-gnu/version/libgcc.a``/usr/lib/gcc/x86_64-linux-gnu/version/32/libgcc.a` 这样的东西。
如果这些命令都运行成功,说明你的工具链都已安装,你不需要去编译你自己的工具链。
如果 gcc 命令失败,你可能需要去安装一个开发环境。在 Ubuntu Linux 上,输入如下的命令:
如果 `gcc` 命令失败,你可能需要去安装一个开发环境。在 Ubuntu Linux 上,输入如下的命令:
```
% sudo apt-get install -y build-essential gdb
```
在 64 位的机器上,你可能需要去安装一个 32 位的支持库。链接失败的表现是有一个类似于 "`__udivdi3` not found" 和 "`__muldi3` not found” 的错误信息。在 Ubuntu Linux 上,输入如下的命令去尝试修复这个问题:
在 64 位的机器上,你可能需要去安装一个 32 位的支持库。链接失败的表现是有一个类似于 “`__udivdi3` not found” 和 “`__muldi3` not found” 的错误信息。在 Ubuntu Linux 上,输入如下的命令去尝试修复这个问题:
```
% sudo apt-get install gcc-multilib
```
##### 使用一个虚拟机
#### 使用一个虚拟机
获得一个兼容的工具链的最容易的另外的方法是,在你的计算机上安装一个现代的 Linux 发行版。使用虚拟化平台Linux 可以与你正常的计算环境和平共处。安装一个 Linux 虚拟机共有两步。首先,去下载一个虚拟化平台。
* [**VirtualBox**][3](对 Mac、Linux、Windows 免费)— [下载地址][3]
* [VirtualBox][3](对 Mac、Linux、Windows 免费)— [下载地址][3]
* [VMware Player][4](对 Linux 和 Windows 免费,但要求注册)
* [VMware Fusion][5](可以从 IS&T 免费下载)。
VirtualBox 有点慢并且灵活性欠佳,但它免费!
虚拟化平台安装完成后,下载一个你选择的 Linux 发行版的引导磁盘镜像。
* 我们使用的是 [Ubuntu 桌面版][6]。
这将下载一个命名类似于 `ubuntu-10.04.1-desktop-i386.iso` 的文件。启动你的虚拟化平台并创建一个新32 位)的虚拟机。使用下载的 Ubuntu 镜像作为一个引导磁盘;安装过程在不同的虚拟机上有所不同,但都很简单。就像上面一样输入 `objdump -i`,去验证你的工具是否已安装。你将在虚拟机中完成你的工作。
##### 构建你自己的编译器工具链
#### 构建你自己的编译器工具链
在设置上你将花一些时间但是比起一个虚拟机来说它的性能要稍好一些并且让你工作在你熟悉的环境中Unix/MacOS。对于 MacOS 命令,你可以快进到文章的末尾部分去看。
你需要花一些时间来设置但是比起一个虚拟机来说它的性能要稍好一些并且让你工作在你熟悉的环境中Unix/MacOS。对于 MacOS 命令,你可以快进到文章的末尾部分去看。
###### Linux
##### Linux
通过将下列行添加到 `conf/env.mk` 中去使用你自己的工具链:
```
GCCPREFIX=
```
我们假设你将工具链安装到了 `/usr/local` 中。你将需要大量的空间(大约 1 GB去编译工具。如果你空间不足在它的 `make install` 步骤之后删除它们的目录。
@ -94,7 +84,7 @@ GCCPREFIX=
+ http://ftpmirror.gnu.org/gcc/gcc-4.6.4/gcc-core-4.6.4.tar.bz2
+ http://ftpmirror.gnu.org/gdb/gdb-7.3.1.tar.bz2
(你可能也在使用这些包的最新版本。)解包并构建。绿色粗体文本显示如何安装到 `/usr/local` 中,它是我们建议的。要安装到不同的目录,$PFX注意高亮输入处的不同。如果有问题,可以看下面。
(你可能也在使用这些包的最新版本。)解包并构建。安装到 `/usr/local` 中,它是我们建议的。要安装到不同的目录,`$PFX`,注意相应修改。如果有问题,可以看下面。
```c
export PATH=$PFX/bin:$PATH
@ -166,39 +156,40 @@ cd gdb-7.3.1
make all
make install # This step may require privilege (sudo make install)
cd ..
```
###### Linux 排错
**Linux 排错:**
Q我不能运行 `make install`,因为我在这台机器上没有 root 权限。
A我们的指令假定你是安装到了 `/usr/local` 目录中。但是,在你的环境中可能并不是这样做的。如果你仅能够在你的家目录中安装代码。那么在上面的命令中,使用 `--prefix=$HOME` 去替换 `--prefix=/usr/local`。你也需要修改你的 `PATH``LD_LIBRARY_PATH` 环境变量,以通知你的 shell 这个工具的位置。例如:
* Q我不能运行 `make install`,因为我在这台机器上没有 root 权限。
A我们的指令假定你是安装到了 `/usr/local` 目录中。但是,在你的环境中可能并不是这样做的。如果你仅能够在你的 home 目录中安装代码。那么在上面的命令中,使用 `--prefix=$HOME`(并[点击这里][7] 去更新后面的命令)去替换 `--prefix=/usr/local`。你也需要修改你的 `PATH``LD_LIBRARY_PATH` 环境变量,以通知你的 shell 这个工具的位置。例如:
```
export PATH=$HOME/bin:$PATH
export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH
export PATH=$HOME/bin:$PATH
export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH
```
在你的 `~/.bashrc` 文件中输入这些行,以便于你登入后不需要每次都输入它们。
Q我构建失败了错误信息是 “library not found”。
* Q我构建失败了错误信息是 "library not found”。
A你需要去设置你的 `LD_LIBRARY_PATH`。环境变量必须包含 `PREFIX/lib` 目录(例如 `/usr/local/lib`)。
##### MacOS
#### MacOS
首先从 Mac OSX 上安装开发工具开始:
`xcode-select --install`
首先从 Mac OSX 上安装开发工具开始:`xcode-select --install` 。
你可以从 homebrew 上安装 qemu 的依赖,但是不能去安装 qemu因为我们需要安装打了 6.828 补丁的 qemu。
`brew install $(brew deps qemu)`
```
brew install $(brew deps qemu)
```
gettext 工具并不能把已安装的二进制文件添加到路径中,因此你需要去运行:
gettext 工具并不能把已安装的二进制文件添加到路径中,因此你需要去运行:
`PATH=${PATH}:/usr/local/opt/gettext/bin make install`
```
PATH=${PATH}:/usr/local/opt/gettext/bin make install
```
完成后,开始安装 qemu。
@ -208,13 +199,12 @@ gettext 工具并不能把已安装的二进制文件添加到路径中,因此
不幸的是QEMU 的调试功能虽然很强大,但是有点不成熟,因此我们强烈建议你使用我们打过 6.828 补丁的版本,而不是发行版自带的版本。这个安装在 Athena 上的 QEMU 版本已经打过补丁了。构建你自己的、打 6.828 补丁的 QEMU 版本的过程如下:
1. 克隆 IAP 6.828 QEMU 的 git 仓库:`git clone https://github.com/mit-pdos/6.828-qemu.git qemu`。
2. 在 Linux 上,你或许需要安装几个库。我们成功地在 Debian/Ubuntu 16.04 上构建 6.828 版的 QEMU 需要安装下列的库libsdl1.2-dev、libtool-bin、libglib2.0-dev、libz-dev和 libpixman-1-dev。
3. 配置源代码(方括号中是可选参考;用你自己的真实路径替换 PFX
1. 克隆 IAP 6.828 QEMU 的 git 仓库:`git clone https://github.com/mit-pdos/6.828-qemu.git qemu`。
2. 在 Linux 上,你或许需要安装几个库。我们成功地在 Debian/Ubuntu 16.04 上构建 6.828 版的 QEMU 需要安装下列的库libsdl1.2-dev、libtool-bin、libglib2.0-dev、libz-dev 和 libpixman-1-dev。
3. 配置源代码(方括号中是可选参数;用你自己的真实路径替换 `PFX`
1. Linux`./configure --disable-kvm --disable-werror [--prefix=PFX] [--target-list="i386-softmmu x86_64-softmmu"]`。
2. OS X`./configure --disable-kvm --disable-werror --disable-sdl [--prefix=PFX] [--target-list="i386-softmmu x86_64-softmmu"]`。`prefix` 参数指定安装 QEMU 的位置;如果不指定,将缺省安装 QEMU 到 `/usr/local` 目录中。`target-list` 参数将简单地简化 QEMU 所支持的架构。
4. 运行 `make && make install`
4. 运行 `make && make install`
--------------------------------------------------------------------------------
@ -224,7 +214,7 @@ via: https://pdos.csail.mit.edu/6.828/2018/tools.html
作者:[csail.mit][a]
选题:[lujun9972][b]
译者:[qhwdw](https://github.com/qhwdw)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,7 +1,7 @@
使用Python的toolz库开始函数式编程
使用 Python toolz 库开始函数式编程
======
toolz库允许你操作函数使其更容易理解更容易测试代码。
> toolz 库允许你操作函数,使其更容易理解,更容易测试代码。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy)
@ -20,7 +20,11 @@ def add_one_word(words, word):
这个函数假设它的第一个参数是一个不可变的类似字典的对象,它返回一个新的类似字典的在相关位置递增的对象:这就是一个简单的频率计数器。
但是,只有将它应用于单词流并做归纳时才有用。 我们可以使用内置模块 `functools` 中的归纳器。 `functools.reduce(function, stream, initializer)`
但是,只有将它应用于单词流并做*归纳*时才有用。 我们可以使用内置模块 `functools` 中的归纳器。
```
functools.reduce(function, stream, initializer)
```
我们想要一个函数,应用于流,并且能能返回频率计数。
@ -30,14 +34,12 @@ def add_one_word(words, word):
add_all_words = curry(functools.reduce, add_one_word)
```
使用此版本,我们需要提供初始化程序。 但是,我们不能只将 `pyrsistent.m` 函数添加到 `curry` 函数中; 因为这个顺序是错误的。
使用此版本,我们需要提供初始化程序。但是,我们不能只将 `pyrsistent.m` 函数添加到 `curry` 函数中; 因为这个顺序是错误的。
```
add_all_words_flipped = flip(add_all_words)
```
The `flip` higher-level function returns a function that calls the original, with arguments flipped.
`flip` 这个高阶函数返回一个调用原始函数的函数,并且翻转参数顺序。
```
@ -46,7 +48,7 @@ get_all_words = add_all_words_flipped(pyrsistent.m())
我们利用 `flip` 自动调整其参数的特性给它一个初始值:一个空字典。
现在我们可以执行 `get_all_words(word_stream)` 这个函数来获取频率字典。 但是,我们如何获得一个单词流呢? Python文件是行流的。
现在我们可以执行 `get_all_words(word_stream)` 这个函数来获取频率字典。 但是,我们如何获得一个单词流呢? Python 文件是流的。
```
def to_words(lines):
@ -60,9 +62,9 @@ def to_words(lines):
words_from_file = toolz.compose(get_all_words, to_words)
```
在这种情况下,组合只是使两个函数很容易阅读:首先将文件的行流应用于 `to_words`,然后将 `get_all_words` 应用于 `to_words` 的结果。 散文似乎与代码相反。
在这种情况下,组合只是使两个函数很容易阅读:首先将文件的行流应用于 `to_words`,然后将 `get_all_words` 应用于 `to_words` 的结果。 但是文字上读起来似乎与代码执行相反。
当我们开始认真对待可组合性时,这很重要。 有时可以将代码编写为一个单元序列,单独测试每个单元,最后将它们全部组合。 如果有几个组合元素时,组合的顺序可能就很难理解。
当我们开始认真对待可组合性时,这很重要。有时可以将代码编写为一个单元序列,单独测试每个单元,最后将它们全部组合。如果有几个组合元素时,组合的顺序可能就很难理解。
`toolz` 库借用了 Unix 命令行的做法,并使用 `pipe` 作为执行相同操作的函数,但顺序相反。
@ -70,17 +72,13 @@ words_from_file = toolz.compose(get_all_words, to_words)
words_from_file = toolz.pipe(to_words, get_all_words)
```
Now it reads more intuitively: Pipe the input into `to_words`, and pipe the results into `get_all_words`. On a command line, the equivalent would look like this:
现在读起来更直观了:将输入传递到 `to_words`,并将结果传递给 `get_all_words`。 在命令行上,等效写法如下所示:
```
$ cat files | to_words | get_all_words
```
The `toolz` library allows us to manipulate functions, slicing, dicing, and composing them to make our code easier to understand and to test.
`toolz` 库允许我们操作函数,切片,分割和组合,以使我们的代码更容易理解和测试。
`toolz` 库允许我们操作函数,切片、分割和组合,以使我们的代码更容易理解和测试。
--------------------------------------------------------------------------------
@ -89,10 +87,10 @@ via: https://opensource.com/article/18/10/functional-programming-python-toolz
作者:[Moshe Zadka][a]
选题:[lujun9972][b]
译者:[Flowsnow](https://github.com/Flowsnow)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/moshez
[b]: https://github.com/lujun9972
[1]: https://opensource.com/article/18/10/functional-programming-python-immutable-data-structures
[1]: https://linux.cn/article-10222-1.html

View File

@ -1,68 +0,0 @@
translating---geekpi
IssueHunt: A New Bounty Hunting Platform for Open Source Software
======
One of the issues that many open-source developers and companies struggle with is funding. There is an assumption, an expectation even, among the community that Free and Open Source Software must be provided free of cost. But even FOSS needs funding for continued development. How can we keep expecting better quality software if we dont create systems that enable continued development?
We already wrote an article about [open source funding platforms][1] out there that try to tackle this shortcoming, as of this July there is a new contender in the market that aims to help fill this gap: [IssueHunt][2].
### IssueHunt: A Bounty Hunting platform for Open Source Software
![IssueHunt website][3]
IssueHunt offers a service that pays freelance developers for contributing to open-source code. It does so through what are called bounties: financial rewards granted to whoever solves a given problem. The funding for these bounties comes from anyone who is willing to donate to have any given bug fixed or feature added.
If there is a problem with a piece of open-source software that you want fixed, you can offer up a reward amount of your choosing to whoever fixes it.
Do you want your own product snapped? Offer a bounty on IssueHunt to whoever snaps it. Its as simple as that.
And if you are a programmer, you can browse through open issues. Fix the issue (if you could), submit a pull request on the GitHub repository and if your pull request is merged, you get the money.
#### IssueHunt was originally an internal project for Boostnote
![IssueHunt][4]
The product came to be when the developers behind the note-taking app [Boostnote][5] reached out to the community for contributions to their own product.
In the first two years of utilizing IssueHunt, Boostnote received over 8,400 Github stars through hundreds contributors and overwhelming donations.
The product was so successful that the team decided to open it up to the rest of the community.
Today, [a list of projects utilize this service][6], offering thousands of dollars in bounties among them.
Boostnote boasts [$2,800 in total bounties][7], while Settings Sync, previously known as Visual Studio Code Settings Sync, offers [more than $1,600 in bounties.][8]
There are other services that provide something similar to what IssueHunt is offering here. Perhaps the most notable is [Bountysource][9], which offers a similar bounty service to IssueHunt, while also offering subscription payment processing similar to [Librepay][10].
#### What do you think of IssueHunt?
At the time of writing this article, IssueHunt is in its infancy, but I am incredibly excited to see where this project ends up in the comings years.
I dont know about you, but I am more than happy paying for FOSS. If the product is high quality and adds value to my life, then I will happily pay the developer the product. Especially since FOSS developers are creating products that respect my freedom in the process.
That being said, I will definitely keep my eye on IssueHunt moving forward for ways I can support the community either with my own money or by spreading the word where contribution is needed.
But what do you think? Do you agree with me, or do you think software should be Gratis free, and that contributions should be made on a volunteer basis? Let us know what you think in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/issuehunt/
作者:[Phillip Prado][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/phillip/
[1]: https://itsfoss.com/open-source-funding-platforms/
[2]: https://issuehunt.io
[3]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/issuehunt-website.png
[4]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/issuehunt.jpg
[5]: https://itsfoss.com/boostnote-linux-review/
[6]: https://issuehunt.io/repos
[7]: https://issuehunt.io/repos/53266139
[8]: https://issuehunt.io/repos/47984369
[9]: https://www.bountysource.com/
[10]: https://liberapay.com/

View File

@ -1,3 +1,7 @@
translating by belitex
translating by belitex
translating by belitex
translating by belitex
Directing traffic: Demystifying internet-scale load balancing
======
Common techniques used to balance network traffic come with advantages and trade-offs.

View File

@ -1,3 +1,4 @@
[ChiZelin翻译中]
7 reasons I love open source
======
Being a part of the open source community is a huge win for many reasons.

View File

@ -0,0 +1,93 @@
Have you seen these personalities in open source?
======
An inclusive community is a more creative and effective community. But how can you make sure you're accommodating the various personalities that call your community "home"?
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/diversity-inclusion-transformation-change_20180927.png?itok=2E-g10hJ)
When I worked with the Mozilla Foundation, long before the organization boasted more than a hundred and fifty staff members, we conducted a foundation-wide Myers-Briggs indicator. The [Myers-Briggs][1] is a popular personality assessment, one used widely in [career planning and the business world][2]. Created in the early twentieth century, it's the product of two women: Katharine Cook Briggs and her daughter Isabel Briggs Myers, who built the tool on Carl Jung's Theory of Psychological Types (which was itself based on clinical observations, as opposed to "controlled" scientific studies). Each of my co-workers (53 at the time) answered the questions. We were curious about what kind of insights we would gain into our individual personalities, and, by extension, about how we'd best work together.
Our team's report showed that the people working for the Mozilla Foundation, one of the biggest and oldest open source projects on the web, were people with the least common personality types. Where about 77% of the general population fit into the top 8 most common Myers-Briggs types, only 23% of the Mozilla Foundation team did. Our team was mostly composed of the rarer Myers-Briggs types. For example, 23% of the team shared my own individual personality type ("ENTP"), which is interesting to me, since people with that personality type only make up 3.2% of the general population. And 9% of the team were ENTJ, the second rarest personality type, at just 1.8% of the population.
I began to wonder: Do open source projects attract a certain type of personality? Or is this one assessment of full-time open sourcers just a fluke?
And if it's true, which aspects of personality can we tug on when encouraging community participation? How can we use our knowledge of personality and psychology to push our open source projects towards success?
### The personalities of open source
Thinking about personality types and open source communities is tricky. In short, when we're talking about personality, we see lots speculation.
Personality assessments and, indeed, the entire field of psychology are often considered "soft science." Academics in the field have long struggled to be seen as scientifically relevant. Other subjects, like physics and mathematics, can prove hard truths—this is the way it is, and if it's not like this, then it's not true.
Thinking about personality types and open source communities is tricky. In short, when we're talking about personality, we see lots speculation.
But people and their brains are fascinatingly complicated, and definitively proving a theory is impossible. Conducting controlled studies with human beings is difficult; there are ethical implications, physical needs, and no two people are alike—so there is no way to have a truly stable control group. Plus, there's always an outlier of some sort, because our backgrounds and experiences structure our personalities and the way we think. In psychology, the closest we can get to a "hard truth" is something like "This is mostly the way it is, except when it's not." Only in recent years (and with recent advancements in technology) have links between psychology and neurology provided us with some psychological "hard truths." For example, we know, definitively, which parts of the brain are responsible for certain functions.
Emotion and personality, however, are more elusive subjects; generalizations remain difficult and face relevant intellectual criticism. But when we're thinking about designing communities around personality types, we can work with some useful archetypes.
After all, anyone can find a place in open source. Millions of people participate in various projects and communities. Open source isn't just for engineers anymore; we've gone global. And while open source might not be as mainstream as, say, eggs, I'm confident that every personality type, gender identity, sexual orientation, age, and background is represented in the global open source community.
When designing open source projects, you want to ensure that you build [architectures of participation][3] for everyone. Successful projects have communities, and community-building happens intentionally. Community management takes time and effort, so if you're hoping to lead a successful open source project, don't spend all your resources on the product. Care for your people, and your people will help you with the rest of it.
Here's what to consider as you begin architecting an inclusive community.
#### Introverted versus extraverted
An introvert is someone who gains energy from solitude, while an extravert gains energy from being around other people. We all have a little of both. For example, an introvert teaching might be using his extravert mode of operation all day. To recharge after a day at work, he'd likely need to go into quiet mode, thinking internally. An extravert teacher would be just as tired from the same day, but to recharge he'd want to talk about the day. An extravert might happily have a dinner party and use that as a mode of recharging.
Another important difference is that those with an extravert preference tend to do a lot of their thinking out loud, whereas introverts think carefully before speaking. Thinking out loud can be difficult for an introvert to understand, as she might expect the things being said to have already been thought about. But for an extravert, verbalizing is a way of figuring stuff out. They don't mind saying things that are incorrect, because doing so helps them process information.
Introverts and extraverts have different comfort levels with regard to participation; they may need different pathways for getting involved in your project or community.
Some communities are accustomed to being marginalized, so being welcoming and encouraging becomes even more important if you want to have a diverse and inclusive project. Remember, diversity is also intentional, and inclusivity is one of [the principles of an open organization][4].
Not everyone feels comfortable speaking in a community call or posting to a public forum. Not everyone will respond to a public list. Personal outreach and communication strategies that are more private are important for ensuring inclusivity. In addition to transparent and public communication mechanisms, a well-designed open source project will point contributors to specific people they can reach directly.
#### Strict versus flexible
Did you know that some people need highly structured environments or workflows to be productive, while others would become incapacitated by such structures? For many creative types, an adaptive and flexible environment or workflow is essential. For a truly inclusive project, you'll need to provide for both. I recommend that you always document and detail your processes. Write up your approaches, make an overview, and share the process with your community. [I've done this][5] while working on Greenpeace's open source project, [Planet 4][6].
As a leader or community manager, you need to be flexible and kind when people don't follow your carefully planned processes. The approach might make sense to you and your team—it might make sense to a lot of people in the community—but it might be too strict for others. You should gently remind people of your processes, but you'll find that some people just won't follow it. Instead of creating a secondary process for those who need less structure, just be responsive to whatever the request might be. People will tell you what they need; they will ask the question they need answered. And then you can generate even greater participation by demonstrating your own adaptability.
#### Certainty versus ambiguity
Openly documenting everything, including meeting notes, is a common practice for open source projects and communities. I am, indeed, in the habit of making charts and slides to pair with written documentation. Different brains process information differently: For some, a drawing is more easily digestible than a document, and vice versa! A leader in this space needs to understand that when people read the notes, some will read the lines and others will read between them.
The preference for taking things at face value is not more correct than a preference for exploring the murky possibilities of differing kinds of information. People remember meetings and events in different ways, and their varying perspectives can cause uncertainty around decisions that have been made. In short, just because something is a "fact" doesn't mean that there aren't multiple perspectives of it.
Documenting decisions is an important practice in open source, but so is [helping people understand the context around those decisions][7]. Having to go back to something that's already finished can be frustrating, but being a leader in open source means being flexible and understanding the neurodiversity at work in your community.
#### Objective versus subjective
Nothing in the universe is certain—indeed, even gravity didn't always exist. Humans define the world around them; it's part of our nature. We're wonderful at rationalizing occurrences so things make sense to us.
And when it comes to personality, this means some people might see an objective reality (the facts defined and unshakeable, "gravity exists") while others might see a subjective world (facts are merely stories we tell ourselves to make sense of our reality, "we wanted a reason that we stick to the Earth"). One common personality conflict stems from how we view the concept of truth. While some people rely on objective fact to guide their perceptions of the ways they should be interacting with the world, others prefer to let their subjective feelings guide how they judge the facts. In any industry, conflicts between varying ways of thinking can be difficult to reconcile.
Open leaders need to ensure a healthy and sustainable environment for all community members. When conflict arises, be ready to "believe" everyone—because from each of their perspectives, they're most likely right. Note that "believing" everyone doesn't mean putting up with destructive behavior (there should never be room in your community for racism, sexism, ageism or outright trolling, no matter how people might frame these behaviors). It means creating a place that allows people to respectfully discuss and debate their perspectives. Be sure you put a code of conduct in place to help with this.
### Inclusivity at the fore
In open source, practicing inclusivity means seeking to bend your mind towards ways of thinking that might not come naturally to you. We can all become more empathetic towards other people, helping our communities grow to be more diverse. Learn to recognize your own preferences and understand how your brain works—but also remember that everyone's neural networks work a bit differently. Then, as a leader, make sure you're creating space for everyone by championing inclusivity, fairness, open-mindedness, and neurodiversity.
(Special thanks to [Adam Procter][8].)
--------------------------------------------------------------------------------
via: https://opensource.com/open-organization/18/11/design-communities-personality-types
作者:[Laura Hilliger][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/laurahilliger
[b]: https://github.com/lujun9972
[1]: https://en.wikipedia.org/wiki/Myers%E2%80%93Briggs_Type_Indicator
[2]: https://opensource.com/open-organization/16/7/personality-test-for-teams
[3]: https://opensource.com/business/12/6/architecture-participation
[4]: https://opensource.com/open-organization/resources/open-org-definition
[5]: https://medium.com/planet4/improving-p4-in-tandem-774a0d306fbc
[6]: https://medium.com/planet4
[7]: https://opensource.com/open-organization/16/3/what-it-means-be-open-source-leader
[8]: http://adamprocter.co.uk

View File

@ -0,0 +1,54 @@
What you need to know about the GPL Cooperation Commitment
======
The GPL Cooperation Commitment fosters innovation by freeing developers from fear of license termination.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Law_balance_open_source.png?itok=5c4JhuEY)
Imagine what the world would look like if growth, innovation, and development were free from fear. Innovation without fear is fostered by consistent, predictable, and fair license enforcement. That is what the [GPL Cooperation Commitment][1] aims to accomplish.
Last year, I wrote an article about licensing effects on downstream users of open source software. As I was conducting research for that article, it became apparent that license enforcement is infrequent and often unpredictable. In that article, I offered potential solutions to the need to make open source license enforcement consistent and predictable. However, I only considered "traditional" methods (e.g., through the court system or some form of legislative action) that a law student might consider.
In November 2017, Red Hat, IBM, Google, and Facebook proposed the the "non-traditional" solution I had not considered: the GPL Cooperation Commitment, which provides for fair and consistent enforcement of the GPL. I believe the GPL Cooperation Commitment is critical for two reasons: First, consistent and fair license enforcement is crucial for growth in the open source community; second, unpredictability is undesirable in the legal community.
### Understanding the GPL
To understand the GPL Cooperation Commitment, you must first understand the GPL's history. GPL is short for [GNU General Public License][2]. The GPL is a "copyleft" open source license, meaning that a software's distributor must make the source code available to downstream users. The GPL also prohibits placing restrictions on downstream use. These requirements keep individual users from denying freedoms (to use, study, share, and improve the software) to others. Under the GPL, a license to use the code is granted to all downstream users, provided they meet the requirements and conditions of the license. If a licensee does not meet the license's requirements, they are non-compliant.
Under the second version of the GPL (GPLv2), a license automatically terminates upon any non-compliance, which causes some software developers to shy away from using the GPL. However, the third version of the GPL (GPLv3) [added a "cure provision"][3] that gives a 30-day period for a licensee to remediate any GPL violation. If the violation is cured within 30 days following notification of non-compliance, the license is not terminated.
This provision eliminates the fear of termination due to an innocent mistake, thus fostering development and innovation by bringing peace of mind to users and distributors of the software.
### What the GPL Cooperation Commitment does
The GPL Cooperation Commitment applies the GPLv3's cure provisions to GPLv2-licensed software, thereby protecting licensees of GPLv2 code from the automatic termination of their license, consistent with the protections afforded by the GPLv3.
The GPL Cooperation Commitment is important because, while software engineers typically want to do the right thing and maintain compliance, they sometimes misunderstand how to do so. This agreement enables developers to avoid termination when they are non-compliant due to confusion or simple mistakes.
The GPL Cooperation Commitment spawned from an announcement in 2017 by the Linux Foundation Technical Advisory Board that the Linux kernel project would [adopt the cure provision from GPLv3][4]. With the GPL Cooperation Commitment, many major technology companies and individual developers made the same commitment and expanded it by applying the cure period to all of their software licensed under GPLv2 (and LGPLv2.1), not only to contributions to the Linux kernel.
Broad adoption of the GPL Cooperation Commitment will have a positive impact on the open source community because a significant amount of software is licensed under GPLv2. An increasing number of companies and individuals are expected to adopt the GPL Cooperation Commitment, which will lead to a significant amount of GPLv2 (and LGPLv2.1) code under license terms that promote fair and predictable approaches to license enforcement.
In fact, as of November 2018, more than 40 companies, including industry leaders IBM, Google, Amazon, Microsoft, Tencent, Intel, and Red Hat, have [signed onto the GPL Cooperation Commitment][5] and are working collaboratively to create a standard of fair and predictable enforcement within the open source community. The GPL Cooperation Commitment is just one example of how the community comes together to ensure the future of open source.
The GPL Cooperation Commitment tells downstream licensees that you respect their good intentions and that your GPLv2 code is safe for them to use. More information, including about how you can add your name to the commitment, is available on the [GPL Cooperation Commitment website][6].
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/11/gpl-cooperation-commitment
作者:[Brooke Driver][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/bdriver
[b]: https://github.com/lujun9972
[1]: https://gplcc.github.io/gplcc/
[2]: https://www.gnu.org/licenses/licenses.en.html
[3]: https://opensource.com/article/18/6/gplv3-anniversary
[4]: https://www.kernel.org/doc/html/v4.16/process/kernel-enforcement-statement.html
[5]: https://gplcc.github.io/gplcc/Company/Company-List.html
[6]: http://gplcc.github.io/gplcc

View File

@ -1,173 +0,0 @@
thecyanbird translating
Terminalizer A Tool To Record Your Terminal And Generate Animated Gif Images
======
This is know topic for most of us and i dont want to give you the detailed information about this flow. Also, we had written many article under this topics.
Script command is the one of the standard command to record Linux terminal sessions. Today we are going to discuss about same kind of tool called Terminalizer.
This tool will help us to record the users terminal activity, also will help us to identify other useful information from the output.
### What Is Terminalizer
Terminalizer allow users to record their terminal activity and allow them to generate animated gif images. Its highly customizable CLI tool that user can share a link for an online player, web player for a recording file.
**Suggested Read :**
**(#)** [Script A Simple Command To Record Your Terminal Session Activity][1]
**(#)** [Automatically Record/Capture All Users Terminal Sessions Activity In Linux][2]
**(#)** [Teleconsole A Tool To Share Your Terminal Session Instantly To Anyone In Seconds][3]
**(#)** [tmate Instantly Share Your Terminal Session To Anyone In Seconds][4]
**(#)** [Peek Create a Animated GIF Recorder in Linux][5]
**(#)** [Kgif A Simple Shell Script to Create a Gif File from Active Window][6]
**(#)** [Gifine Quickly Create An Animated GIF Video In Ubuntu/Debian][7]
There is no distribution official package to install this utility and we can easily install it by using Node.js.
### How To Install Noje.js in Linux
Node.js can be installed in multiple ways. Here, we are going to teach you the standard method.
For Ubuntu/LinuxMint use [APT-GET Command][8] or [APT Command][9] to install Node.js
```
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
$ sudo apt-get install -y nodejs
```
For Debian use [APT-GET Command][8] or [APT Command][9] to install Node.js
```
# curl -sL https://deb.nodesource.com/setup_8.x | bash -
# apt-get install -y nodejs
```
For **`RHEL/CentOS`** , use [YUM Command][10] to install tmux.
```
$ sudo curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
$ sudo yum install epel-release
$ sudo yum -y install nodejs
```
For **`Fedora`** , use [DNF Command][11] to install tmux.
```
$ sudo dnf install nodejs
```
For **`Arch Linux`** , use [Pacman Command][12] to install tmux.
```
$ sudo pacman -S nodejs npm
```
For **`openSUSE`** , use [Zypper Command][13] to install tmux.
```
$ sudo zypper in nodejs6
```
### How to Install Terminalizer
As you have already installed prerequisite package called Node.js, now its time to install Terminalizer on your system. Simple run the below npm command to install Terminalizer.
```
$ sudo npm install -g terminalizer
```
### How to Use Terminalizer
To record your session activity using Terminalizer, just run the following Terminalizer command. Once you started the recording then play around it and finally hit `CTRL+D` to exit and save the recording.
```
# terminalizer record 2g-session
defaultConfigPath
The recording session is started
Press CTRL+D to exit and save the recording
```
This will save your recording session as a YAML file, in this case my filename would be 2g-session-activity.yml.
![][15]
Just type few commands to verify this and finally hit `CTRL+D` to exit the current capture. When you hit `CTRL+D` on the terminal and you will be getting the below output.
```
# logout
Successfully Recorded
The recording data is saved into the file:
/home/daygeek/2g-session.yml
You can edit the file and even change the configurations.
```
![][16]
### How to Play the Recorded File
Use the below command format to paly your recorded YAML file. Make sure, you have to input your recorded file instead of us.
```
# terminalizer play 2g-session
```
Render a recording file as an animated gif image.
```
# terminalizer render 2g-session
```
`Note:` Below two commands are not implemented yet in the current version and will be available in the next version.
If you would like to share your recording to others then upload a recording file and get a link for an online player and share it.
```
terminalizer share 2g-session
```
Generate a web player for a recording file
```
# terminalizer generate 2g-session
```
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/terminalizer-a-tool-to-record-your-terminal-and-generate-animated-gif-images/
作者:[Prakash Subramanian][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.2daygeek.com/author/prakash/
[1]: https://www.2daygeek.com/script-command-record-save-your-terminal-session-activity-linux/
[2]: https://www.2daygeek.com/automatically-record-all-users-terminal-sessions-activity-linux-script-command/
[3]: https://www.2daygeek.com/teleconsole-share-terminal-session-instantly-to-anyone-in-seconds/
[4]: https://www.2daygeek.com/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds/
[5]: https://www.2daygeek.com/peek-create-animated-gif-screen-recorder-capture-arch-linux-mint-fedora-ubuntu/
[6]: https://www.2daygeek.com/kgif-create-animated-gif-file-active-window-screen-recorder-capture-arch-linux-mint-fedora-ubuntu-debian-opensuse-centos/
[7]: https://www.2daygeek.com/gifine-create-animated-gif-vedio-recorder-linux-mint-debian-ubuntu/
[8]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
[9]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
[10]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/
[11]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/
[12]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/
[13]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
[14]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[15]: https://www.2daygeek.com/wp-content/uploads/2018/10/terminalizer-record-2g-session-1.gif
[16]: https://www.2daygeek.com/wp-content/uploads/2018/10/terminalizer-play-2g-session.gif

View File

@ -1,106 +0,0 @@
Translating by Jamkr
Revisiting the Unix philosophy in 2018
======
The old strategy of building small, focused applications is new again in the modern microservices environment.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_data.png?itok=RH6NA32X)
In 1984, Rob Pike and Brian W. Kernighan published an article called "[Program Design in the Unix Environment][1]" in the AT&T Bell Laboratories Technical Journal, in which they argued the Unix philosophy, using the example of BSD's **cat -v** implementation. In a nutshell that philosophy is: Build small, focused programs—in whatever language—that do only one thing but do this thing well, communicate via **stdin** / **stdout** , and are connected through pipes.
Sound familiar?
Yeah, I thought so. That's pretty much the [definition of microservices][2] offered by James Lewis and Martin Fowler:
> In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.
While one *nix program or one microservice may be very limited or not even very interesting on its own, it's the combination of such independently working units that reveals their true benefit and, therefore, their power.
### *nix vs. microservices
The following table compares programs (such as **cat** or **lsof** ) in a *nix environment against programs in a microservices environment.
| | *nix | Microservices |
| ----------------------------------- | -------------------------- | ----------------------------------- |
| Unit of execution | program using stdin/stdout | service with HTTP or gRPC API |
| Data flow | Pipes | ? |
| Configuration & parameterization | Command-line arguments, | |
| environment variables, config files | JSON/YAML docs | |
| Discovery | Package manager, man, make | DNS, environment variables, OpenAPI |
Let's explore each line in slightly greater detail.
#### Unit of execution
**stdin** and writes output to **stdout**. A microservices setup deals with a service that exposes one or more communication interfaces, such as HTTP or gRPC APIs. In both cases, you'll find stateless examples (essentially a purely functional behavior) and stateful examples, where, in addition to the input, some internal (persisted) state decides what happens.
#### Data flow
The unit of execution in *nix (such as Linux) is an executable file (binary or interpreted script) that, ideally, reads input fromand writes output to. A microservices setup deals with a service that exposes one or more communication interfaces, such as HTTP or gRPC APIs. In both cases, you'll find stateless examples (essentially a purely functional behavior) and stateful examples, where, in addition to the input, some internal (persisted) state decides what happens.
Traditionally, *nix programs could communicate via pipes. In other words, thanks to [Doug McIlroy][3], you don't need to create temporary files to pass around and each can process virtually endless streams of data between processes. To my knowledge, there is nothing comparable to a pipe standardized in microservices, besides my little [Apache Kafka-based experiment from 2017][4].
#### Configuration and parameterization
How do you configure a program or service—either on a permanent or a by-call basis? Well, with *nix programs you essentially have three options: command-line arguments, environment variables, or full-blown config files. In microservices, you typically deal with YAML (or even worse, JSON) documents, defining the layout and configuration of a single microservice as well as dependencies and communication, storage, and runtime settings. Examples include [Kubernetes resource definitions][5], [Nomad job specifications][6], or [Docker Compose][7] files. These may or may not be parameterized; that is, either you have some templating language, such as [Helm][8] in Kubernetes, or you find yourself doing an awful lot of **sed -i** commands.
#### Discovery
How do you know what programs or services are available and how they are supposed to be used? Well, in *nix, you typically have a package manager as well as good old man; between them, they should be able to answer all the questions you might have. In a microservices setup, there's a bit more automation in finding a service. In addition to bespoke approaches like [Airbnb's SmartStack][9] or [Netflix's Eureka][10], there usually are environment variable-based or DNS-based [approaches][11] that allow you to discover services dynamically. Equally important, [OpenAPI][12] provides a de-facto standard for HTTP API documentation and design, and [gRPC][13] does the same for more tightly coupled high-performance cases. Last but not least, take developer experience (DX) into account, starting with writing good [Makefiles][14] and ending with writing your docs with (or in?) [**style**][15].
### Pros and cons
Both *nix and microservices offer a number of challenges and opportunities
#### Composability
It's hard to design something that has a clear, sharp focus and can also play well with others. It's even harder to get it right across different versions and to introduce respective error case handling capabilities. In microservices, this could mean retry logic and timeouts—maybe it's a better option to outsource these features into a service mesh? It's hard, but if you get it right, its reusability can be enormous.
#### Observability
In a monolith (in 2018) or a big program that tries to do it all (in 1984), it's rather straightforward to find the culprit when things go south. But, in a
```
yes | tr \\n x | head -c 450m | grep n
```
or a request path in a microservices setup that involves, say, 20 services, how do you even start to figure out which one is behaving badly? Luckily we have standards, notably [OpenCensus][16] and [OpenTracing][17]. Observability still might be the biggest single blocker if you are looking to move to microservices.
#### Global state
While it may not be such a big issue for *nix programs, in microservices, global state remains something of a discussion. Namely, how to make sure the local (persistent) state is managed effectively and how to make the global state consistent with as little effort as possible.
### Wrapping up
In the end, the question remains: Are you using the right tool for a given task? That is, in the same way a specialized *nix program implementing a range of functions might be the better choice for certain use cases or phases, it might be that a monolith [is the best option][18] for your organization or workload. Regardless, I hope this article helps you see the many, strong parallels between the Unix philosophy and microservices—maybe we can learn something from the former to benefit the latter.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/11/revisiting-unix-philosophy-2018
作者:[Michael Hausenblas][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/mhausenblas
[b]: https://github.com/lujun9972
[1]: http://harmful.cat-v.org/cat-v/
[2]: https://martinfowler.com/articles/microservices.html
[3]: https://en.wikipedia.org/wiki/Douglas_McIlroy
[4]: https://speakerdeck.com/mhausenblas/distributed-named-pipes-and-other-inter-services-communication
[5]: http://kubernetesbyexample.com/
[6]: https://www.nomadproject.io/docs/job-specification/index.html
[7]: https://docs.docker.com/compose/overview/
[8]: https://helm.sh/
[9]: https://github.com/airbnb/smartstack-cookbook
[10]: https://github.com/Netflix/eureka
[11]: https://kubernetes.io/docs/concepts/services-networking/service/#discovering-services
[12]: https://www.openapis.org/
[13]: https://grpc.io/
[14]: https://suva.sh/posts/well-documented-makefiles/
[15]: https://www.linux.com/news/improve-your-writing-gnu-style-checkers
[16]: https://opencensus.io/
[17]: https://opentracing.io/
[18]: https://robertnorthard.com/devops-days-well-architected-monoliths-are-okay/

View File

@ -1,3 +1,5 @@
Translating by Jamkr
How to partition and format a drive on Linux
======
Everything you wanted to know about setting up storage but were afraid to ask.

View File

@ -1,3 +1,5 @@
HankChow translating
Gitbase: Exploring git repos with SQL
======
Gitbase is a Go-powered open source project that allows SQL queries to be run on Git repositories.

View File

@ -1,3 +1,4 @@
translating by caixiangyue
How To Find The Execution Time Of A Command Or Process In Linux
======
![](https://www.ostechnix.com/wp-content/uploads/2018/11/time-command-720x340.png)

View File

@ -1,3 +1,5 @@
translating---geekpi
Choosing a printer for Linux
======
Linux offers widespread support for printers. Learn how to take advantage of it.

View File

@ -1,234 +0,0 @@
HankChow translating
The Difference Between more, less And most Commands
======
![](https://www.ostechnix.com/wp-content/uploads/2018/11/more-less-and-most-commands-720x340.png)
If youre a newbie Linux user, you might be confused with these three command like utilities, namely **more** , **less** and **most**. No problem! In this brief guide, I will explain the differences between these three commands, with some examples in Linux. To be precise, they are more or less same with slight differences. All these commands comes preinstalled in most Linux distributions.
First, we will discuss about more command.
### The more program
The **more** is an old and basic terminal pager or paging program that is used to open a given file for interactive reading. If the content of the file is too large to fit in one screen, it displays the contents page by page. You can scroll through the contents of the file by pressing **ENTER** or **SPACE BAR** keys. But one limitation is you can scroll in **forward direction only** , not backwards. That means, you can scroll down, but cant go up.
![](https://www.ostechnix.com/wp-content/uploads/2018/11/more-command-demo.gif)
**Update:**
A fellow Linux user has pointed out that more command do allow backward scrolling. The original version allowed only the forward scrolling. However, the newer implementations allows limited backward movement. To scroll backwards, just press **b**. The only limitation is that it doesnt work for pipes (ls|more for example).
To quit, press **q**.
**more command examples:**
Open a file, for example ostechnix.txt, for interactive reading:
```
$ more ostechnix.txt
```
To search for a string, type search query after the forward slash (/) like below:
```
/linux
```
To go to then next matching string, press **n**.
To open the file start at line number 10, simply type:
```
$ more +10 file
```
The above command show the contents of ostechnix.txt starting from 10th line.
If you want the more utility to prompt you to continue reading file by pressing the space bar key, just use **-d** flag:
```
$ more -d ostechnix.txt
```
![][2]
As you see in the above screenshot, the more command prompts you to press SPACE to continue.
To view the summary of all options and keybindings in the help section, press **h**.
For more details about **more** command, refer man pages.
```
$ man more
```
### The less program
The **less** command is also used to open a given file for interactive reading, allowing scrolling and search. If the content of the file is too large, it pages the output and so you can scroll page by page. Unlike the more command, it allows scrolling on both directions. That means, you can scroll up and down through a file.
![](https://www.ostechnix.com/wp-content/uploads/2018/11/less-command-demo.gif)
So, feature-wise, less has more advantages than more command. Here are some notable advantages of less command:
* Allows forward and backward scrolling,
* Search in forward and backward directions,
* Go to the end and start of the file immediately,
* Open the given file in an editor.
**less command examples:**
Open a file:
```
$ less ostechnix.txt
```
Press **SPACE BAR** or **ENTER** key to go down and press **b** to go up.
To perform a forward search, type search query after the forward slash ( **/** ) like below:
```
/linux
```
To go to then next matching string, press **n**. To go back to the previous matching string, press **N** (shift+n).
To perform a backward search, type search query after the question mark ( **?** ) like below:
```
?linux
```
Press **n/N** to go to **next/previous** match.
To open the currently opened file in an editor, press **v**. It will open your file in your default text editor. You can now edit, remove, rename the text in the file.
To view the summary of less commands, options, keybindings, press **h**.
To quit, press **q**.
For more details about less command, refer the man pages.
```
$ man less
```
### The most program
The most terminal pager has more features than more and less programs. Unlike the previous utilities, the most command can able to open more than one file at a time. You can easily switch between the opened files, edit the current file, jump to the **N** th line in the opened file, split the current window in half, lock and scroll windows together and so on. By default, it wont wrap the long lines, but truncates them and provides a left/right scrolling option.
**most command examples:**
Open a single file:
```
$ most ostechnix1.txt
```
![](https://www.ostechnix.com/wp-content/uploads/2018/11/most-command.png)
To edit the current file, press **e**.
To perform a forward search, press **/** or **S** or **f** and type the search query. Press **n** to find the next matching string in the current direction.
![][3]
To perform a backward search, press **?** and type the search query. Similarly, press **n** to find the next matching string in the current direction.
Open multiple files at once:
```
$ most ostechnix1.txt ostechnix2.txt ostechnix3.txt
```
If you have opened multiple files, you can switch to next file by typing **:n**. Use **UP/DOWN** arrow keys to select next file and hit **ENTER** key to view the chosen file.
![](https://www.ostechnix.com/wp-content/uploads/2018/11/most-2.gif)
To open a file at the first occurrence of given string, for example **linux** :
```
$ most file +/linux
```
To view the help section, press **h** at any time.
**List of all keybindings:**
Navigation:
* **SPACE, D** Scroll down one screen.
* **DELETE, U** Scroll Up one screen.
* **DOWN arrow** Move Down one line.
* **UP arrow** Move Up one line.
* **T** Goto Top of File.
* **B** Goto Bottom of file.
* **> , TAB** Scroll Window right.
* **<** Scroll Window left.
* **RIGHT arrow** Scroll Window left by 1 column.
* **LEFT arrow** Scroll Window right by 1 column.
* **J, G** Goto nth line. For example, to jump to the 10th line, simply type **“100j”** (without quotes).
* **%** Goto percent.
Window Commands:
* **Ctrl-X 2, Ctrl-W 2** Split window.
* **Ctrl-X 1, Ctrl-W 1** Make only one window.
* **O, Ctrl-X O** Move to other window.
* **Ctrl-X 0 (zero)** Delete Window.
Search through files:
* **S, f, /** Search forward.
* **?** Search Backward.
* **N** Find next match in current search direction.
Exit:
* **q** Quit MOST program. All opened files will be closed.
* **:N, :n** Quit this file and view next (Use UP/DOWN arrow keys to select next file).
For more details about most command, refer the man pages.
```
$ man most
```
### TL;DR
**more** An old, very basic paging program. Allows only forward navigation and limited backward navigation.
**less** It has more features than more utility. Allows both forward and backward navigation and search functionalities. It starts faster than text editors like **vi** when you open large text files.
**most** It has all features of above programs including additional features, like opening multiple files at a time, locking and scrolling all windows together, splitting the windows and more.
And, thats all for now. Hope you got the basic idea about these three paging programs. Ive covered only the basics. You can learn more advanced options and functionalities of these programs by looking into the respective programs man pages.
More good stuffs to come. Stay tuned!
Cheers!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/the-difference-between-more-less-and-most-commands/
作者:[SK][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[2]: http://www.ostechnix.com/wp-content/uploads/2018/11/more-1.png
[3]: http://www.ostechnix.com/wp-content/uploads/2018/11/most-1-1.gif

View File

@ -1,4 +1,4 @@
The alias And unalias Commands Explained With Examples
translating by dianbanjiu The alias And unalias Commands Explained With Examples
======
![](https://www.ostechnix.com/wp-content/uploads/2018/11/alias-command-720x340.png)

View File

@ -0,0 +1,101 @@
Meet TiDB: An open source NewSQL database
======
5 key differences between MySQL and TiDB for scaling in the cloud
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud-windows-building-containers.png?itok=0XvZLZ8k)
As businesses adopt cloud-native architectures, conversations will naturally lead to what we can do to make the database horizontally scalable. The answer will likely be to take a closer look at [TiDB][1].
TiDB is an open source [NewSQL][2] database released under the Apache 2.0 License. Because it speaks the [MySQL][3] protocol, your existing applications will be able to connect to it using any MySQL connector, and [most SQL functionality][4] remains identical (joins, subqueries, transactions, etc.).
Step under the covers, however, and there are differences. If your architecture is based on MySQL with Read Replicas, you'll see things work a little bit differently with TiDB. In this post, I'll go through the top five key differences I've found between TiDB and MySQL.
### 1. TiDB natively distributes query execution and storage
With MySQL, it is common to scale-out via replication. Typically you will have one MySQL master with many slaves, each with a complete copy of the data. Using either application logic or technology like [ProxySQL][5], queries are routed to the appropriate server (offloading queries from the master to slaves whenever it is safe to do so).
Scale-out replication works very well for read-heavy workloads, as the query execution can be divided between replication slaves. However, it becomes a bottleneck for write-heavy workloads, since each replica must have a full copy of the data. Another way to look at this is that MySQL Replication scales out SQL processing, but it does not scale out the storage. (By the way, this is true for traditional replication as well as newer solutions such as Galera Cluster and Group Replication.)
TiDB works a little bit differently:
* Query execution is handled via a layer of TiDB servers. Scaling out SQL processing is possible by adding new TiDB servers, which is very easy to do using Kubernetes [ReplicaSets][6]. This is because TiDB servers are [stateless][7]; its [TiKV][8] storage layer is responsible for all of the data persistence.
* The data for tables is automatically sharded into small chunks and distributed among TiKV servers. Three copies of each data region (the TiKV name for a shard) are kept in the TiKV cluster, but no TiKV server requires a full copy of the data. To use MySQL terminology: Each TiKV server is both a master and a slave at the same time, since for some data regions it will contain the primary copy, and for others, it will be secondary.
* TiDB supports queries across data regions or, in MySQL terminology, cross-shard queries. The metadata about where the different regions are located is maintained by the Placement Driver, the management server component of any TiDB Cluster. All operations are fully [ACID][9] compliant, and an operation that modifies data across two regions uses a [two-phase commit][10].
For MySQL users learning TiDB, a simpler explanation is the TiDB servers are like an intelligent proxy that translates SQL into batched key-value requests to be sent to TiKV. TiKV servers store your tables with range-based partitioning. The ranges automatically balance to keep each partition at 96MB (by default, but configurable), and each range can be stored on a different TiKV server. The Placement Driver server keeps track of which ranges are located where and automatically rebalances a range if it becomes too large or too hot.
This design has several advantages of scale-out replication:
* It independently scales the SQL Processing and Data Storage tiers. For many workloads, you will hit one bottleneck before the other.
* It incrementally scales by adding nodes (for both SQL and Data Storage).
* It utilizes hardware better. To scale out MySQL to one master and four replicas, you would have five copies of the data. TiDB would use only three replicas, with hotspots automatically rebalanced via the Placement Driver.
### 2. TiDB's storage engine is RocksDB
MySQL's default storage engine has been InnoDB since 2010. Internally, InnoDB uses a [B+tree][11] data structure, which is similar to what traditional commercial databases use.
By contrast, TiDB uses RocksDB as the storage engine with TiKV. RocksDB has advantages for large datasets because it can compress data more effectively and insert performance does not degrade when indexes can no longer fit in memory.
Note that both MySQL and TiDB support an API that allows new storage engines to be made available. For example, Percona Server and MariaDB both support RocksDB as an option.
### 3. TiDB gathers metrics in Prometheus/Grafana
Tracking key metrics is an important part of maintaining database health. MySQL centralizes these fast-changing metrics in Performance Schema. Performance Schema is a set of in-memory tables that can be queried via regular SQL queries.
With TiDB, rather than retaining the metrics inside the server, a strategic choice was made to ship the information to a best-of-breed service. Prometheus+Grafana is a common technology stack among operations teams today, and the included graphs make it easy to create your own or configure thresholds for alarms.
![](https://opensource.com/sites/default/files/uploads/tidb_metrics.png)
### 4. TiDB handles DDL significantly better
If we ignore for a second that not all data definition language (DDL) changes in MySQL are online, a larger challenge when running a distributed MySQL system is externalizing schema changes on all nodes at the same time. Think about a scenario where you have 10 shards and add a column, but each shard takes a different length of time to complete the modification. This challenge still exists without sharding, since replicas will process DDL after a master.
TiDB implements online DDL using the [protocol introduced by the Google F1 paper][12]. In short, DDL changes are broken up into smaller transition stages so they can prevent data corruption scenarios, and the system tolerates an individual node being behind up to one DDL version at a time.
### 5. TiDB is designed for HTAP workloads
The MySQL team has traditionally focused its attention on optimizing performance for online transaction processing ([OLTP][13]) queries. That is, the MySQL team spends more time making simpler queries perform better instead of making all or complex queries perform better. There is nothing wrong with this approach since many applications only use simple queries.
TiDB is designed to perform well across hybrid transaction/analytical processing ([HTAP][14]) queries. This is a major selling point for those who want real-time analytics on their data because it eliminates the need for batch loads between their MySQL database and an analytics database.
### Conclusion
These are my top five observations based on 15 years in the MySQL world and coming to TiDB. While many of them refer to internal differences, I recommend checking out the TiDB documentation on [MySQL Compatibility][4]. It describes some of the finer points about any differences that may affect your applications.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/11/key-differences-between-mysql-and-tidb
作者:[Morgan Tocker][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/morgo
[b]: https://github.com/lujun9972
[1]: https://www.pingcap.com/docs/
[2]: https://en.wikipedia.org/wiki/NewSQL
[3]: https://en.wikipedia.org/wiki/MySQL
[4]: https://www.pingcap.com/docs/sql/mysql-compatibility/
[5]: https://proxysql.com/
[6]: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
[7]: https://en.wikipedia.org/wiki/State_(computer_science)
[8]: https://github.com/tikv/tikv/wiki
[9]: https://en.wikipedia.org/wiki/ACID_(computer_science)
[10]: https://en.wikipedia.org/wiki/Two-phase_commit_protocol
[11]: https://en.wikipedia.org/wiki/B%2B_tree
[12]: https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/41344.pdf
[13]: https://en.wikipedia.org/wiki/Online_transaction_processing
[14]: https://en.wikipedia.org/wiki/Hybrid_transactional/analytical_processing_(HTAP)

View File

@ -0,0 +1,85 @@
ProtectedText A Free Encrypted Notepad To Save Your Notes Online
======
![](https://www.ostechnix.com/wp-content/uploads/2018/11/protected-text-720x340.png)
Note taking is an important skill to have for all of us. It will help us to remember and maintain permanent record of what we have read, learned and listened to. There are so many apps, tools and utilities available out there for note taking purpose. Today I am going to talk about one such application. Say hello to **ProtectedText** , a free, encrypted notepad to save the notes online. It is a free web service where you can write down your texts, encrypt them and access them from anywhere from any device. It is that simple. All you need is a web browser in an Internet-enabled device.
ProtectedText site doesnt require any personal information and doesnt store the passwords. There is no ads, no cookies, no user tracking and no registration. No one can view the notes except those who have the password to decrypt the text. Since there is no user registration required, you dont need to create any accounts on this site. Once you done typing the notes, just close the web browser and youre good to go!
### Let us save the notes in the encrypted notepad
Open ProtectedText site by clicking on the following button:
You will be landed in the home page where you can type your “site name” in the white box given at the center of the page. Alternatively, just write the site name directly in the address bar. Site name is just a custom name (E.g **<https://www.protectedtext.com/mysite>** ) you choose to access your private portal where you keep your notes.
![](https://www.ostechnix.com/wp-content/uploads/2018/11/Protected-Text-1.png)
If the site you chosen doesnt exist, you will see the following message. Click on the button says **“Create”** to create your notepad page.
![](https://www.ostechnix.com/wp-content/uploads/2018/11/Protected-Text-2.png)
Thats it. A dedicated private page has been created for you. Now, start typing the notes. The current maximum length is a bit more then 750,000 chars per page.
ProtectedText site uses **AES algorithm** to encrypt and decrypt your content and **SHA512 algorithm** for hashing.
Once youre done, click **Save** button on the top.
![](https://www.ostechnix.com/wp-content/uploads/2018/11/Protected-Text-3.png)
After you hit the Save button, you will be prompted to enter a password to protect your site. Enter the password twice and click **Save**.
![](https://www.ostechnix.com/wp-content/uploads/2018/11/Protected-Text-4.png)
You can use any password of your choice. However, it is recommended to use a long and complex password (inclusive of numbers, special characters) to prevent brute-force attacks. The longer the password, the better! Since ProtectedText servers wont save your password, **there is no way to recover the lost password**. So, please remember the password or use any password managers like [**Buttercup**][3] and [**KeeWeb**][4] to store your credentials.
You can access your notepad at anytime by visiting its URL from any device. When you access the URL, you will see the following message. Just type your password and start adding and/or updating the notes.
![](https://www.ostechnix.com/wp-content/uploads/2018/11/Protected-Text-5.png)
The site can be accessed only by you and others who know the password. If you want to make your site public, just add the password of your site like this: **ProtectedText.com/yourSite?yourPassword** which will automatically decrypt **yourSite** with **yourPassword**.
There is also an [**Android app**][6] available, which allows you to sync notes across all your devices, work offline, backup notes and lock/unlock your site.
**Pros**
* Simple, easy to use, fast and free!
* ProtectedText.com client side code is freely available [**here**][7]. You can analyze and check the code yourself to understand what is under the hood.
* There is no expiration date to your stored content. You can just leave them there as long as you want.
* It is possible to make your data both private (only you can view the data) and public (Data can be viewed by all).
**Cons**
* The client side code is open to everyone, however the server side code is not. So, you **cant self-host the service yourself**. You got to trust them. If you dont trust them, it is better to stay away from this site.
* Since the site doesnt store anything about yourself including the password, there is no way to recover your data if you forget the password. They claims that they dont even know who owns which data. So, dont lose the password.
If you ever wanted a simple way to store your notes online and access them wherever you go without installing any additional tools, ProtectedText service might be a good choice. If you know any similar services and applications, let me know them in the comment section below. I will check them out as well.
And, thats all for now. Hope this was useful. More good stuffs to come. Stay tuned!
Cheers!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/protectedtext-a-free-encrypted-notepad-to-save-your-notes-online/
作者:[SK][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[2]: http://www.ostechnix.com/wp-content/uploads/2018/11/Protected-Text-4.png
[3]: https://www.ostechnix.com/buttercup-a-free-secure-and-cross-platform-password-manager/
[4]: https://www.ostechnix.com/keeweb-an-open-source-cross-platform-password-manager/
[5]: http://www.ostechnix.com/wp-content/uploads/2018/11/Protected-Text-5.png
[6]: https://play.google.com/store/apps/details?id=com.protectedtext.android
[7]: https://www.protectedtext.com/js/main.js

View File

@ -0,0 +1,66 @@
IssueHunt一个新的开源软件打赏平台
======
许多开源开发者和公司都在努力解决的问题之一就是资金问题。社区中有一种假想,甚至是期望,必须免费提供自由和开源软件。但即使是 FOSS 也需要资金来继续开发。如果我们不建立让软件持续开发的系统,我们怎能期待更高质量的软件?
我们已经写了一篇关于[开源资金平台][1]的文章来试图解决这个缺点,截至今年 7 月,市场上出现了一个新的竞争者,旨在帮助填补这个空白:[IssueHunt][2] 。
### IssueHunt: 开源软件打赏平台
![IssueHunt website][3]
IssueHunt 提供了一种服务,支付自由开发者对开源代码的贡献。它通过所谓的赏金来实现:给予解决特定问题的任何人财务奖励。这些奖励的资金来自任何愿意捐赠以修复任何特定 bug 或添加功能的人。
如果你想修复的某个开源软件存在问题,你可以根据自己选择的方式提供奖励金额。
想要自己的产品被争抢解决么?在 IssueHunt 上向任何解决问题的人提供奖金就好了。就这么简单。
如果你是程序员,则可以浏览未解决的问题。解决这个问题(如果你可以的话),在 GitHub 存储库上提交 pull request如果你的 pull request 被合并,那么你就会得到了钱。
#### IssueHunt 最初是 Boostnote 的内部项目
![IssueHunt][4]
当笔记应用 [Boostnote][5] 背后的开发人员联系社区为他们的产品做出贡献时,该产品出现了。
在使用 IssueHunt 的前两年Boostnote 通过数百名贡献者和压倒性的捐款收到了超过 8,400 个 Github star。
该产品非常成功,团队决定将其开放给社区的其他成员。
今天,[列表中在使用这个服务的项目][6]提供了数千美元的赏金。
Boostnote 号称有 [$2,800 的总赏金] [7],而 Settings Sync以前称为 Visual Studio Code Settings Sync提供了[超过 $1,600 的赏金][8]。
还有其他服务提供类似于 IssueHunt 在此提供的内容。也许最引人注目的是 [Bountysource][9],它提供与 IssueHunt 类似的赏金服务,同时还提供类似于 [Librepay][10] 的订阅支付处理。
#### 你怎么看待 IssueHunt
在撰写本文时IssueHunt 还处于起步阶段,但我非常高兴看到这个项目在这些年里的成果。
我不了解你,但我非常乐意为 FOSS 付款。如果产品质量高,并为我的生活增添价值,那么我很乐意向开发者支付产品费用。特别是 FOSS 的开发者正在创造尊重我自由的产品。
话虽如此,我一定会关注 IssueHunt 的继续前进,我可以用自己的钱或者在需要贡献的地方传播这个它来支持社区。
但你怎么看?你是否同意我的看法,或者你认为软件应该免费提供,并且应该在志愿者的基础上做出贡献?请在下面的评论中告诉我们你的想法。
--------------------------------------------------------------------------------
via: https://itsfoss.com/issuehunt/
作者:[Phillip Prado][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/phillip/
[1]: https://itsfoss.com/open-source-funding-platforms/
[2]: https://issuehunt.io
[3]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/issuehunt-website.png
[4]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/issuehunt.jpg
[5]: https://itsfoss.com/boostnote-linux-review/
[6]: https://issuehunt.io/repos
[7]: https://issuehunt.io/repos/53266139
[8]: https://issuehunt.io/repos/47984369
[9]: https://www.bountysource.com/
[10]: https://liberapay.com/

View File

@ -0,0 +1,162 @@
Terminalizer - 一个记录您终端活动并且生成 Gif 图像的工具
====
今天我们要讨论一个广为人知的主题,我们也围绕这个主题写过许多的文章,因此我不会针对这个如何记录终端会话流程给出太多具体的资料。
我们可以使用脚本命令来记录 Linux 的终端会话,这也是大家公认的一种办法。不过今天我们将来介绍一个能起到相同作用的工具 —— Terminalizer。
这个工具可以帮助我们记录用户的终端活动,以帮助我们从输出的文件中找到有用的信息。
### 什么是 Terminlizer
用户可以用 Terminlizer 记录他们的终端活动并且生成一个 Gif 图像。它是一个允许高度定制的 CLI 工具。用户可以在网络播放器,在线播放器上用链接分享他们记录下的文件。
**推荐阅读:**<br>
**(#)** [Script 一个记录您终端对话的简单工具][1]<br>
**(#)** [在 Linux 上自动记录/捕捉所有用户的终端对话][2]<br>
**(#)** [Teleconsole 一个能立即与任何人分享您终端对话的工具][3]<br>
**(#)** [tmate 立即与任何人分享您的终端对话][4]<br>
**(#)** [Peek 在 Linux 里制造一个 Gif 记录器][5]<br>
**(#)** [Kgif 一个能生成 Gif 图片,以记录窗口活动的简单 Shell 脚本][6]<br>
**(#)** [Gifine 在 Ubuntu/Debian 里快速制造一个 Gif 视频][7]
目前没有发行版拥有官方软件包来安装此实用程序,不过我们可以用 Node.js 来安装它。
### 如何在 Linux 上安装 Node.js
安装 Node.js 有许多种方法。我们在这里将会教您一个常用的方法。
在 Ubuntu/LinuxMint 上可以使用 [APT-GET 命令][8] 或者 [APT 命令][9] 来安装 Node.js
```
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
$ sudo apt-get install -y nodejs
```
在 Debian 上使用 [APT-GET 命令][8] 或者 [APT 命令][9] 来安装 Node.js
```
# curl -sL https://deb.nodesource.com/setup_8.x | bash -
# apt-get install -y nodejs
```
**`RHEL/CentOS`** 上, 使用 [YUM 命令][10] 来安装.
```
$ sudo curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
$ sudo yum install epel-release
$ sudo yum -y install nodejs
```
**`Fedora`** 上, 用 [DNF 命令][11] 来安装 tmux.
```
$ sudo dnf install nodejs
```
**`Arch Linux`** 上, 用 [Pacman 命令][12] 来安装 tmux.
```
$ sudo pacman -S nodejs npm
```
**`openSUSE`** 上, 用 [Zypper Command][13] 来安装 tmux.
```
$ sudo zypper in nodejs6
```
### 如何安装 Terminalizer
您已经安装了 Node.js 这个先决软件包,现在是时候在您的系统上安装 Terminalizer 了。简单执行如下的 npm 命令即可安装。
```
$ sudo npm install -g terminalizer
```
### 如何使用 Terminalizer
您只需要执行如下的命令,即可使用 Terminalizer 记录您的终端会话活动。您可以敲击 `CTRL+D` 来结束并且保存记录。
```
# terminalizer record 2g-session
defaultConfigPath
The recording session is started
Press CTRL+D to exit and save the recording
```
这将会将您记录的会话保存成一个 YAML 文件, 在这个例子里,我的文件名将会是 2g-session-activity.yml。
![][15]
```
# logout
Successfully Recorded
The recording data is saved into the file:
/home/daygeek/2g-session.yml
You can edit the file and even change the configurations.
```
![][16]
### 如何播放记录下来的文件
使用以下命令来播放您记录的 YAML 文件。在以下操作中,请确保您已经用了您的文件名来替换 2g-session。
```
# terminalizer play 2g-session
```
将记录的文件渲染成 Gif 图像
```
# terminalizer render 2g-session
```
`注意:` 以下的两个命令在此版本尚且不可用,或许在下一版本这两个命令将会付诸使用。
如果您想要将记录的文件分享给其他人,您可以将您的文件上传到在线播放器,并且将链接分享给对方。
```
terminalizer share 2g-session
```
为记录的文件生成一个网络播放器
```
# terminalizer generate 2g-session
```
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/terminalizer-a-tool-to-record-your-terminal-and-generate-animated-gif-images/
作者:[Prakash Subramanian][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[thecyanbird](https://github.com/thecyanbird)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.2daygeek.com/author/prakash/
[1]: https://www.2daygeek.com/script-command-record-save-your-terminal-session-activity-linux/
[2]: https://www.2daygeek.com/automatically-record-all-users-terminal-sessions-activity-linux-script-command/
[3]: https://www.2daygeek.com/teleconsole-share-terminal-session-instantly-to-anyone-in-seconds/
[4]: https://www.2daygeek.com/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds/
[5]: https://www.2daygeek.com/peek-create-animated-gif-screen-recorder-capture-arch-linux-mint-fedora-ubuntu/
[6]: https://www.2daygeek.com/kgif-create-animated-gif-file-active-window-screen-recorder-capture-arch-linux-mint-fedora-ubuntu-debian-opensuse-centos/
[7]: https://www.2daygeek.com/gifine-create-animated-gif-vedio-recorder-linux-mint-debian-ubuntu/
[8]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
[9]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
[10]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/
[11]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/
[12]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/
[13]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
[14]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[15]: https://www.2daygeek.com/wp-content/uploads/2018/10/terminalizer-record-2g-session-1.gif
[16]: https://www.2daygeek.com/wp-content/uploads/2018/10/terminalizer-play-2g-session.gif

View File

@ -0,0 +1,104 @@
2018 重温 Unix 哲学
======
在现代微服务环境中,构建小型,集中应用程序的旧策略又再一次流行了起来。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_data.png?itok=RH6NA32X)
1984年Rob Pike 和 Brian W 在 AT&T 贝尔实验室技术期刊上发表了名为 “[Unix 环境编程][1]” 的文章,其中他们使用 BSD 的 **cat -v** 例子来认证 Unix 哲学。简而言之Unix 哲学是:构建小型,单一的应用程序——不管用什么语言——只做一件小而美的事情,用 **stdin** / **stdout** 进行通信,并通过管道进行连接。
听起来是不是有点耳熟?
是的,我也这么认为。这就是 James Lewis 和 Martin Fowler 给出的 [微服务的定义][2] 。
> 简单来说,微服务架构的风格是将应用程序开发为一套单一,小型服务的方法,每个服务都运行在它的进程中,并用轻量级机制进行通信,通常是 HTTP 资源 API 。
虽然一个 *nix 程序或者是一个微服务本身可能非常局限甚至不是很有趣,但是当这些独立工作的单元组合在一起的时候就显示出了它们真正的好处和强大。
### *nix程序 vs 微服务
下面的表格对比了 *nix 环境中的程序(例如 **cat** 或 **lsof**)与微服务环境中的程序。
| | *nix 程序 | 微服务 |
| ----------------------------------- | -------------------------- | ---------------------------------- |
| 执行单元 | 程序使用 `stdin/stdout` | 使用 HTTP 或 gRPC API |
| 数据流 | 管道 | |
| 可配置和参数化 | 命令行参数 | |
| 环境变量和配置文件 | JSON/YAML 文档 | |
| 发现 | 包管理器, man make | DNS, 环境变量, OpenAPI |
让我们详细的看看每一行。
#### 执行单元
*nix 系统(像 Linux中的执行单元是一个可执行的文件二进制或者是脚本理想情况下它们从 `stdin` 读取输入并将输出写入 `stdout`。而微服务通过暴露一个或多个通信接口来提供服务,比如 HTTP 和 gRPC APIs。在这两种情况下你都会发现无状态示例本质上是纯函数行为和有状态示例除了输入之外还有一些内部持久状态决定发生了什么。
#### 数据流
传统的,*nix 程序能够通过管道进行通信。换名话说,我们要感谢 [Doug McIlroy][3],你不需要创建临时文件来传递,而可以在每个进程之间处理无穷无尽的数据流。据我所知,除了 [2017 年做的基于 `Apache Kafka` 小实验][4],没有什么能比得上管道化的微服务了。
#### 可配置和参数化
你是如何配置程序或者服务的,无论是永久性的服务还是即时的服务?是的,在 *nix 系统上,你通常有三种方法:命令行参数,环境变量,或全面化的配置文件。在微服务架构中,典型的做法是用 YAML ( 或者甚至是worseJSON ) 文档,定制好一个服务的布局和配置以及依赖的组件和通信,存储,和运行时配置。例如 [ Kubernetes 资源定义][5][Nomad 工作规范][6],或 [Docker 组件][7] 文档。这些可能参数化也可能不参数化;也就是说,除非你知道一些模板语言,像 Kubernetes 中的 [Helm][8],否则你会发现你使用了很多 **sed -i** 这样的命令。
#### 发现
你怎么知道有哪些程序和服务可用,以及如何使用它们?在 *nix 系统中通常都有一个包管理器和一个很好用的 man 页面;使用他们,应该能够回答你所有的问题。在微服务的设置中,在寻找一个服务的时候会相对更自动化一些。除了像 [Airbnb 的 SmartStack][9] 或 [Netflix 的 Eureka][10] 等可以定制以外,通常还有基于环境变量或基于 DNS 的[方法][11],允许您动态的发现服务。同样重要的是,事实上 [OpenAPI][12] 为 HTTP API 提供了一套标准文档和设计模式,[gRPC][13] 为一些耦合性强的高性能项目也做了同样的事情。最后非常重要的一点是考虑到开发人员的经验DX应该从写一份好的 [Makefiles][14] 开始,并以编写符合 [**风格**][15] 的文档结束。
### 优点和缺点
*nix 系统和微服务都提供了许多挑战和机遇
#### 模块性
设计一个简洁,有清晰的目的并且能够很好的和其它模块配合是很困难的。甚至是在不同版本中实现并引入相应的异常处理流程都很困难的。在微服务中,这意味着重试逻辑和超时机制,或者将这些功能外包到服务网格( service mesh )是不是一个更好的选择呢?这确实比较难,可如果你做好了,那它的可重用性是巨大的。
#### Observability
#### 预测
在一个巨型2018年或是一个试图做任何事情的大型程序1984当事情开始变坏的时候应当能够直接的找到问题的根源。但是在一个
```
yes | tr \\n x | head -c 450m | grep n
```
或者在一个微服务设置中请求一个路径例如涉及20个服务你怎么弄清楚是哪个服务的问题幸运的是我们有很多标准特别是 [OpenCensus][16] 和 [OpenTracing][17]。如果您希望转向微服务,可预测性仍然可能是最大的问题。
#### 全局状态
对于 *nix 程序来说可能不是一个大问题,但在微服务中,全局状态仍然是一个需要讨论的问题。也就是说,如何确保有效的管理本地化(持久性)的状态以及尽可能在少做变更的情况下使全局保持一致。
### 总结一下
最后,问题仍然是:你是否在使用合适的工具来完成特定的工作?也就是说,以同样的方式实现一个特定的 *nix 程序在某些时候或者阶段会是一个更好的选择,它是可能在你的组织或工作过程中的一个[最好的选择][18]。无论如何,我希望这篇文章可以让你看到 Unix 哲学和微服务之间许多强有力的相似之处。也许我们可以从前者那里学到一些东西使后者受益。
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/11/revisiting-unix-philosophy-2018
作者:[Michael Hausenblas][a]
选题:[lujun9972][b]
译者:[Jamkr](https://github.com/Jamkr)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mhausenblas
[b]: https://github.com/lujun9972
[1]: http://harmful.cat-v.org/cat-v/
[2]: https://martinfowler.com/articles/microservices.html
[3]: https://en.wikipedia.org/wiki/Douglas_McIlroy
[4]: https://speakerdeck.com/mhausenblas/distributed-named-pipes-and-other-inter-services-communication
[5]: http://kubernetesbyexample.com/
[6]: https://www.nomadproject.io/docs/job-specification/index.html
[7]: https://docs.docker.com/compose/overview/
[8]: https://helm.sh/
[9]: https://github.com/airbnb/smartstack-cookbook
[10]: https://github.com/Netflix/eureka
[11]: https://kubernetes.io/docs/concepts/services-networking/service/#discovering-services
[12]: https://www.openapis.org/
[13]: https://grpc.io/
[14]: https://suva.sh/posts/well-documented-makefiles/
[15]: https://www.linux.com/news/improve-your-writing-gnu-style-checkers
[16]: https://opencensus.io/
[17]: https://opentracing.io/
[18]: https://robertnorthard.com/devops-days-well-architected-monoliths-are-okay/

View File

@ -0,0 +1,230 @@
more、less 和 most 的区别
======
![](https://www.ostechnix.com/wp-content/uploads/2018/11/more-less-and-most-commands-720x340.png)
如果你是一个 Linux 方面的新手,你可能会在 `more`、`less`、`most` 这三个命令行工具之间产生疑惑。在本文当中,我会对这三个命令行工具进行对比,以及展示它们各自在 Linux 中的一些使用例子。总的来说,这几个命令行工具之间都有相通和差异,而且它们在大部分 Linux 发行版上都有自带。
我们首先来看看 `more` 命令。
### more 命令
`more` 是一个较为传统的终端阅读工具,它可以用于打开指定的文件并进行交互式阅读。如果文件的内容太长,在一屏以内无法完整显示,就会逐页显示文件内容。使用回车键或者空格键可以滚动浏览文件的内容,但有一个限制,就是只能够单向滚动。也就是说只能按顺序往下翻页,而不能进行回看。
![](https://www.ostechnix.com/wp-content/uploads/2018/11/more-command-demo.gif)
**更新**
有的 Linux 用户向我指出,在 `more` 当中是可以向上翻页的。不过,最原始版本的 `more` 确实只允许向下翻页,在后续出现的较新的版本中也允许了有限次数的向上翻页,只需要在浏览过程中按 `b` 键即可向上翻页。唯一的限制是 `more` 不能搭配管道使用。(我使用 more 是可以搭配管道使用的,不知道原作者为什么要这样写,麻烦校对确认一下这一句是否需要去掉)
`q` 即可退出 `more`
**更多示例**
打开 ostechnix.txt 文件进行交互式阅读,可以执行以下命令:
```
$ more ostechnix.txt
```
在阅读过程中,如果需要查找某个字符串,只需要像下面这样在斜杠(/)之后输入需要查找的内容:
```
/linux
```
`n` 键可以跳转到下一个匹配的字符串。
如果需要在文件的第 10 行开始阅读,只需要执行:
```
$ more +10 file
```
就可以从文件的第 10 行开始显示文件的内容了。
如果你需要让 `more` 提示你按空格键来翻页,可以加上 `-d` 参数:
```
$ more -d ostechnix.txt
```
![][2]
如上图所示,`more` 会提示你可以按空格键翻页。
如果需要查看所有选项以及对应的按键,可以按 `h` 键。
要查看 `more` 的更多详细信息,可以参考手册:
```
$ man more
```
### less 命令
`less` 命令也是用于打开指定的文件并进行交互式阅读,它也支持翻页和搜索。如果文件的内容太长,也会对输出进行分页,因此也可以翻页阅读。比 `more` 命令更好的一点是,`less` 支持向上翻页和向下翻页,也就是可以在整个文件中任意阅读。
![](https://www.ostechnix.com/wp-content/uploads/2018/11/less-command-demo.gif)
在使用功能方面,`less` 比 `more` 命令具有更多优点,以下列出其中几个:
* 支持向上翻页和向下翻页
* 支持向上搜索和向下搜索
* 可以跳转到文件的末尾并立即从文件的开头开始阅读
* 在编辑器中打开指定的文件
**更多示例**
打开文件:
```
$ less ostechnix.txt
```
按空格键或回车键可以向下翻页,按 `b` 键可以向上翻页。
如果需要向下搜索,在斜杠(/)之后输入需要搜索的内容:
```
/linux
```
`n` 键可以跳转到下一个匹配的字符串,如果需要跳转到上一个匹配的字符串,可以按 `N` 键。
如果需要向上搜索,在问号(?)之后输入需要搜索的内容:
```
?linux
```
同样是按 `n` 键或 `N` 键跳转到下一个或上一个匹配的字符串。
只需要按 `v` 键,就会将正在阅读的文件在默认编辑器中打开,然后就可以对文件进行各种编辑操作了。
`h` 键可以查看 `less` 工具的选项和对应的按键。
`q` 键可以退出阅读。
要查看 `less` 的更多详细信息,可以参考手册:
```
$ man less
```
### most 命令
`most` 同样是一个终端阅读工具,而且比 `more``less` 的功能更为丰富。`most` 支持同时打开多个文件、编辑当前打开的文件、迅速跳转到文件中的某一行、分屏阅读、同时锁定或滚动多个屏幕等等功能。在默认情况下,对于较长的行,`most` 不会将其截断成多行显示,而是提供了左右滚动功能在同一行内显示。
**更多示例**
打开文件:
```
$ most ostechnix1.txt
```
![](https://www.ostechnix.com/wp-content/uploads/2018/11/most-command.png)
`e` 键可以编辑当前文件。
如果需要向下搜索,在斜杠(/)或 S 或 f 之后输入需要搜索的内容,按 `n` 键就可以跳转到下一个匹配的字符串。
![][3]
如果需要向上搜索,在问号(?)之后输入需要搜索的内容,也是通过按 `n` 键跳转到下一个匹配的字符串。
同时打开多个文件:
```
$ most ostechnix1.txt ostechnix2.txt ostechnix3.txt
```
在打开了多个文件的状态下,可以输入 `:n` 切换到其它文件,使用`↑` 或 `↓` 键选择需要切换到的文件,按回车键就可以查看对应的文件。
![](https://www.ostechnix.com/wp-content/uploads/2018/11/most-2.gif)
要打开文件并跳转到某个字符串首次出现的位置(例如 linux可以执行以下命令
```
$ most file +/linux
```
`h` 键可以查看帮助。
**按键操作列表**
移动:
* **空格键或 `D` 键** 向下滚动一屏
* **DELETE 键或 `U` 键** 向上滚动一屏
* **`↓` 键** 向下移动一行
* **`↑` 键** 向上移动一行
* **`T` 键** 移动到文件开头
* **`B` 键** 移动到文件末尾
* **`>` 键或 TAB 键** 向右滚动屏幕
* **`<` 键** 向左滚动屏幕
* **`→` 键** 向右移动一列
* **`←` 键** 向左移动一列
* **`J` 键或 `G` 键** 移动到某一行,例如 `10j` 可以移动到第 10 行
* **`%` 键** 移动到文件长度某个百分比的位置
窗口命令:
* **`Ctrl-X 2`、`Ctrl-W 2`** 分屏
* **`Ctrl-X 1`、`Ctrl-W 1`** 只显示一个窗口
* **`O` 键、`Ctrl-X O`** 切换到另一个窗口
* **`Ctrl-X 0`** 删除窗口
文件内搜索:
* **`S` 键或 `f` 键或 `/` 键** 向下搜索
* **`?` 键** 向上搜索
* **`n` 键** 跳转到下一个匹配的字符串
退出:
* **`q` 键** 退出 `most` ,且所有打开的文件都会被关闭
* **`:N`、`:n`** 退出当前文件并查看下一个文件(使用`↑` 键、`↓` 键选择下一个文件)
要查看 `most` 的更多详细信息,可以参考手册:
```
$ man most
```
### 总结
**`more`** 传统且基础的文件阅读工具,仅支持向下翻页和有限次数的向上翻页。
**`less`** `more` 功能丰富,支持向下翻页和向上翻页,也支持文本搜索。在打开大文件的时候,比 `vi` 这类文本编辑器启动得更快。
**`most`** 在上述两个工具功能的基础上,还加入了同时打开多个文件、同时锁定或滚动多个屏幕、分屏等等大量功能。
以上就是我的介绍,希望能让你通过我的文章对这三个工具有一定的认识。如果想了解这篇文章以外的关于这几个工具的详细功能,请参阅它们的 `man` 手册。
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/the-difference-between-more-less-and-most-commands/
作者:[SK][a]
选题:[lujun9972][b]
译者:[HankChow](https://github.com/HankChow)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[2]: http://www.ostechnix.com/wp-content/uploads/2018/11/more-1.png
[3]: http://www.ostechnix.com/wp-content/uploads/2018/11/most-1-1.gif