mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
8826bd50a9
@ -1,49 +1,37 @@
|
||||
Linux DNS 查询剖析 – 第一部分
|
||||
============================================================
|
||||
Linux DNS 查询剖析(第一部分)
|
||||
======
|
||||
|
||||
我经常与虚拟机集群打交道([文1][3], [文2][4], [文3][5], [文4][6], [文5][7], [文6][8]),期间花费了大量时间试图掌握 [DNS 查询][9]的工作原理。遇到问题时,我有时只是不求甚解的使用 StackOverflow 上的“解决方案”;甚至那些“解决方案”有时并不工作。
|
||||
我经常与虚拟机集群打交道([文1][3]、[文2][4]、[文3][5]、[文4][6]、[文5][7]、[文6][8]),因此最终花费了大量时间试图掌握 [DNS 查询][9]的工作原理。遇到问题时,我只是不求甚解的使用 StackOverflow 上的“解决方案”,而不知道它们为什么有时工作,有时不工作。
|
||||
|
||||
最终我决定改变这种情况,决定一并找出所有问题的原因。我没有在网上找到完整手册或类似的其它东西,我问过一些同事,他们也是如此。
|
||||
最终我对此感到了厌倦,决定一并找出所有问题的原因。我没有在网上找到完整的指南,我问过一些同事,他们不知所以然(或许是问题太具体了)。
|
||||
|
||||
既然如此,我开始自己写这样的手册。
|
||||
|
||||
_如果你在找第二部分, 点击 [这里][1]_
|
||||
|
||||
结果发现,“Linux 执行一次 DNS 查询”的背后有相当多的工作。
|
||||
|
||||
* * *
|
||||
结果发现,“Linux 执行一次 DNS 查询”这句话的背后有相当多的工作。
|
||||
|
||||
![linux-dns-0](https://zwischenzugs.files.wordpress.com/2018/06/linux-dns-0.png?w=121)
|
||||
|
||||
_“究竟有多难呢?”_
|
||||
|
||||
* * *
|
||||
**本系列文章试图将 Linux 主机上程序获取(域名对应的) IP 地址的过程及期间涉及的组件进行分块剖析。**如果不理解这些块的协同工作方式,调试解决 `dnsmasq`、`vagrant landrush` 和 `resolvconf` 等相关的问题会让人感到眼花缭乱。
|
||||
|
||||
本系列文章试图将 Linux 主机上程序获取(域名对应的) IP 地址的过程及期间涉及的组件进行分块剖析。如果不理解这些块的协同工作方式,调试并解决 `dnsmasq`,`vagrant landrush` 和 `resolvconf` 等相关的问题会让人感到眼花缭乱。
|
||||
|
||||
同时这也是一份有价值的说明,指出原本很简单的东西可以如何随着时间的推移变得相当复杂。在弄清楚 DNS 查询的原理的过程中,我了解了大量不同的技术及其发展历程。
|
||||
同时这也是一份有价值的说明,指出原本很简单的东西是如何随着时间的推移变得相当复杂。在弄清楚 DNS 查询的原理的过程中,我了解了大量不同的技术及其发展历程。
|
||||
|
||||
我甚至编写了一些[自动化脚本][10],可以让我在虚拟机中进行实验。欢迎读者参与贡献或勘误。
|
||||
|
||||
请注意,本系列主题并不是“DNS 工作原理”,而是与查询 Linux 主机配置的真实 DNS 服务器(这里假设查询了 DNS 服务器,但后面你会看到有时并不需要查询)相关的内容,以及如何确定使用哪个查询结果,或者何时使用其它方式确定 IP 地址。
|
||||
|
||||
* * *
|
||||
**请注意,本系列主题并不是“DNS 工作原理”**,而是与查询 Linux 主机配置的真实 DNS 服务器(这里假设查询了一台 DNS 服务器,但后面你会看到有时并不需要)相关的内容,以及如何确定使用哪个查询结果,或者如何使用其它方式确定 IP 地址。
|
||||
|
||||
### 1) 其实并没有名为“DNS 查询”的系统调用
|
||||
|
||||
* * *
|
||||
|
||||
![linux-dns-1](https://zwischenzugs.files.wordpress.com/2018/06/linux-dns-1.png?w=121)
|
||||
|
||||
_工作方式并非如此_
|
||||
_工作方式并非如此_
|
||||
|
||||
* * *
|
||||
**首先要了解的一点是,Linux 上并没有一个单独的方法可以完成 DNS 查询工作**;没有一个有这样的明确接口的核心<ruby>系统调用<rt>system call</rt></ruby>。
|
||||
|
||||
首先要了解的一点是,Linux 上并没有一个单独的方法可以完成 DNS 查询工作;至少没有如此<ruby>明确接口<rt>clean interface</rt></ruby>的核心<ruby>系统调用<rt>system call</rt></ruby>。
|
||||
不过,有一个标准 C 库函数调用 [`getaddrinfo`][2],不少程序使用了该调用;但不是所有程序或应用都使用该调用!
|
||||
|
||||
有一个标准 C 库函数调用 `[getaddrinfo][2]`,不少程序使用了该调用;但不是所有程序或应用都使用该调用!
|
||||
|
||||
我们只考虑两个简单的标准程序:`ping` 和 `host`:
|
||||
让我们看一下两个简单的标准程序:`ping` 和 `host`:
|
||||
|
||||
```
|
||||
root@linuxdns1:~# ping -c1 bbc.co.uk | head -1
|
||||
@ -100,17 +88,15 @@ google.com has address 216.58.204.46
|
||||
|
||||
下面我们依次查看这两个 `.conf` 扩展名的文件。
|
||||
|
||||
* * *
|
||||
|
||||
### 2) NSSwitch 与 `/etc/nsswitch.conf`
|
||||
|
||||
我们已经确认应用可以自主决定选用哪个 DNS 服务器。很多应用(例如 `ping`)通过配置文件 `/etc/nsswitch.conf` (根据具体实现 (*))参考 NSSwitch 完成选择。
|
||||
我们已经确认应用可以自主决定选用哪个 DNS 服务器。很多应用(例如 `ping`)通过配置文件 `/etc/nsswitch.conf` (根据具体实现[^1] )参考 NSSwitch 完成选择。
|
||||
|
||||
###### (*) ping 实现的变种之多令人惊叹。我 _不_ 希望在这里讨论过多。
|
||||
[^1]: `ping` 实现的变种之多令人惊叹。我 _不_ 希望在这里讨论过多。
|
||||
|
||||
NSSwitch 不仅用于 DNS 查询,例如,还用于密码与用户信息查询。
|
||||
|
||||
NSSwitch 最初是 Solaris OS 的一部分,可以让应用无需将查询所需的文件或服务硬编码,而是在其它集中式的、无需应用开发人员管理的配置文件中找到。
|
||||
NSSwitch 最初是 Solaris OS 的一部分,可以让应用无需硬编码查询所需的文件或服务,而是在其它集中式的、无需应用开发人员管理的配置文件中找到。
|
||||
|
||||
下面是我的 `nsswitch.conf`:
|
||||
|
||||
@ -130,12 +116,13 @@ netgroup: nis
|
||||
|
||||
我们需要关注的是 `hosts` 行。我们知道 `ping` 用到 `nsswitch.conf` 文件,那么我们修改这个文件(的 `hosts` 行),看看能够如何影响 `ping`。
|
||||
|
||||
|
||||
* ### 修改 `nsswitch.conf`, `hosts` 行仅保留 `files`
|
||||
#### 修改 `nsswitch.conf`, `hosts` 行仅保留 `files`
|
||||
|
||||
如果你修改 `nsswitch.conf`,将 `hosts` 行仅保留 `files`:
|
||||
|
||||
`hosts: files`
|
||||
```
|
||||
hosts: files
|
||||
```
|
||||
|
||||
此时, `ping` 无法获取 google.com 对应的 IP 地址:
|
||||
|
||||
@ -161,11 +148,13 @@ google.com has address 216.58.206.110
|
||||
|
||||
毕竟如我们之前看到的那样,`host` 不受 `nsswitch.conf` 影响。
|
||||
|
||||
* ### 修改 `nsswitch.conf`, `hosts` 行仅保留 `dns`
|
||||
#### 修改 `nsswitch.conf`, `hosts` 行仅保留 `dns`
|
||||
|
||||
如果你修改 `nsswitch.conf`,将 `hosts` 行仅保留 `dns`:
|
||||
|
||||
`hosts: dns`
|
||||
```
|
||||
hosts: dns
|
||||
```
|
||||
|
||||
此时,google.com 的解析恢复正常:
|
||||
|
||||
@ -184,13 +173,9 @@ ping: unknown host localhost
|
||||
|
||||
下图给出默认 NSSwitch 中 `hosts` 行对应的查询逻辑:
|
||||
|
||||
* * *
|
||||
|
||||
![linux-dns-2 (1)](https://zwischenzugs.files.wordpress.com/2018/06/linux-dns-2-11.png?w=525)
|
||||
|
||||
_我的 `hosts:` 配置是 `nsswitch.conf` 给出的默认值_
|
||||
|
||||
* * *
|
||||
_我的 `hosts:` 配置是 `nsswitch.conf` 给出的默认值_
|
||||
|
||||
### 3) `/etc/resolv.conf`
|
||||
|
||||
@ -221,16 +206,16 @@ $ ping -c1 google.com
|
||||
ping: unknown host google.com
|
||||
```
|
||||
|
||||
解析失败了,这是因为没有可用的 nameserver (*)。
|
||||
解析失败了,这是因为没有可用的名字服务器 [^2]。
|
||||
|
||||
|
||||
###### * 另一个需要注意的地方: `host` 在没有指定 nameserver 的情况下会尝试 127.0.0.1:53。
|
||||
[^2]: 另一个需要注意的地方: `host` 在没有指定 nameserver 的情况下会尝试 127.0.0.1:53。
|
||||
|
||||
该文件中还可以使用其它选项。例如,你可以在 `resolv.conf` 文件中增加如下行:
|
||||
|
||||
```
|
||||
search com
|
||||
```
|
||||
|
||||
然后执行 `ping google` (不写 `.com`)
|
||||
|
||||
```
|
||||
@ -248,10 +233,9 @@ PING google.com (216.58.204.14) 56(84) bytes of data.
|
||||
|
||||
* 操作系统中并不存在“DNS 查询”这个系统调用
|
||||
* 不同程序可能采用不同的策略获取名字对应的 IP 地址
|
||||
* 例如, `ping` 使用 `nsswitch`,后者进而使用(或可以使用) `/etc/hosts`,`/etc/resolv.conf` 以及主机名得到解析结果
|
||||
|
||||
* 例如, `ping` 使用 `nsswitch`,后者进而使用(或可以使用) `/etc/hosts`、`/etc/resolv.conf` 以及主机名得到解析结果
|
||||
* `/etc/resolv.conf` 用于决定:
|
||||
* 查询什么地址(LCTT 译注:这里可能指 search 带来的影响)
|
||||
* 查询什么地址(LCTT 译注:这里可能指 `search` 带来的影响)
|
||||
* 使用什么 DNS 服务器执行查询
|
||||
|
||||
如果你曾认为 DNS 查询很复杂,请跟随这个系列学习吧。
|
||||
@ -262,7 +246,7 @@ via: https://zwischenzugs.com/2018/06/08/anatomy-of-a-linux-dns-lookup-part-i/
|
||||
|
||||
作者:[dmatech][a]
|
||||
译者:[pinewall](https://github.com/pinewall)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -3,32 +3,36 @@
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/08/alt-tool-720x340.png)
|
||||
|
||||
几天前,我们曾经讨论如何[**如何在不同的 PHP 版本之间进行切换**][1]。在那篇文章中,我们使用 **update-alternatives** 命令实现从一个 PHP 版本切换到另一个 PHP 版本。也就是说,`update-alternatives` 命令可以将<ruby>系统范围<rt>system wide</rt></ruby>默认使用的 PHP 版本设置为我们希望的版本。通俗的来说,你可以通过 `update-alternatives` 命令从系统范围设置程序的版本。如果你希望可以在不同目录动态设置不同的程序版本,该如何完成呢?在这种情况下,**alt** 工具可以大显身手。`alt` 是一个命令行工具,可以让你在类 Unix 系统中切换相同程序的不同版本。该工具简单易用,是 **Rust** 语言编写的自由、开源软件。
|
||||
几天前,我们曾经讨论[如何在不同的 PHP 版本之间进行切换][1]。在那篇文章中,我们使用 `update-alternatives` 命令实现从一个 PHP 版本切换到另一个 PHP 版本。也就是说,`update-alternatives` 命令可以将<ruby>系统范围<rt>system wide</rt></ruby>默认使用的 PHP 版本设置为我们希望的版本。通俗的来说,你可以通过 `update-alternatives` 命令从系统范围设置程序的版本。如果你希望可以在不同目录动态设置不同的程序版本,该如何完成呢?在这种情况下,`alt` 工具可以大显身手。`alt` 是一个命令行工具,可以让你在类 Unix 系统中切换相同程序的不同版本。该工具简单易用,是 Rust 语言编写的自由、开源软件。
|
||||
|
||||
### 安装
|
||||
|
||||
安装 `alt` 工具十分简单。
|
||||
|
||||
运行如下命令,即可在 Linux 主机上安装 `alt`:
|
||||
|
||||
```
|
||||
$ curl -sL https://github.com/dotboris/alt/raw/master/install.sh | bash -s
|
||||
```
|
||||
|
||||
下一步,将 shims 目录添加到你的 PATH 环境变量中,具体操作取决于你使用的 Shell。
|
||||
下一步,将 `shims` 目录添加到你的 PATH 环境变量中,具体操作取决于你使用的 Shell。
|
||||
|
||||
对于 Bash:
|
||||
|
||||
```
|
||||
$ echo 'export PATH="$HOME/.local/alt/shims:$PATH"' >> ~/.bashrc
|
||||
$ source ~/.bashrc
|
||||
```
|
||||
|
||||
对于 Zsh:
|
||||
|
||||
```
|
||||
$ echo 'export PATH="$HOME/.local/alt/shims:$PATH"' >> ~/.zshrc
|
||||
$ source ~/.zshrc
|
||||
```
|
||||
|
||||
对于 Fish:
|
||||
|
||||
```
|
||||
$ echo 'set -x PATH "$HOME/.local/alt/shims" $PATH' >> ~/.config/fish/config.fish
|
||||
```
|
||||
@ -39,39 +43,41 @@ $ echo 'set -x PATH "$HOME/.local/alt/shims" $PATH' >> ~/.config/fish/config.fis
|
||||
|
||||
如我之前所述,alt 只影响当前目录。换句话说,当你进行版本切换时,只在当前目录生效,而不是整个系统范围。
|
||||
|
||||
下面举例说明。我在我的 Ubuntu 系统中安装了两个版本的 PHP,分别为 PHP 5.6 和 PHP 7.2;另外,在 **myproject** 目录中包含一些 PHP 应用。
|
||||
下面举例说明。我在我的 Ubuntu 系统中安装了两个版本的 PHP,分别为 PHP 5.6 和 PHP 7.2;另外,在 `myproject` 目录中包含一些 PHP 应用。
|
||||
|
||||
首先,通过命令查看系统范围默认的 PHP 版本:
|
||||
|
||||
```
|
||||
$ php -v
|
||||
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
示例输出:
|
||||
|
||||
![查找 PHP 版本][3]
|
||||
|
||||
如截图中所示,我系统中默认的 PHP 版本为 PHP7.2。
|
||||
如截图中所示,我系统中默认的 PHP 版本为 PHP 7.2。
|
||||
|
||||
然后,我将进入放置 PHP 应用的 `myproject` 目录。
|
||||
|
||||
然后,我将进入放置 PHP 应用的 "myproject" 目录。
|
||||
```
|
||||
$ cd myproject
|
||||
```
|
||||
|
||||
使用如下命令扫描可用的 PHP 版本:
|
||||
|
||||
```
|
||||
$ alt scan php
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
示例输出:
|
||||
|
||||
![扫描 PHP 版本][4]
|
||||
|
||||
可见,我有两个 PHP 版本,即 PHP5.6 和 PHP7.2。按下 **<空格>** 键选中当前可用的版本。选中全部可用版本后,你可以看到图中所示的<ruby>叉号<rt>cross mark</rt></ruby>。使用上下方向键在版本间移动,点击回车即可保存变更。
|
||||
可见,我有两个 PHP 版本,即 PHP 5.6 和 PHP 7.2。按下 `<空格>` 键选中当前可用的版本。选中全部可用版本后,你可以看到图中所示的<ruby>叉号<rt>cross mark</rt></ruby>。使用上下方向键在版本间移动,点击回车即可保存变更。
|
||||
|
||||
![选取 PHP 版本][5]
|
||||
|
||||
下面运行该命令并选取我们希望在 "myproject" 目录中使用的 PHP 版本:
|
||||
下面运行该命令并选取我们希望在 `myproject` 目录中使用的 PHP 版本:
|
||||
|
||||
```
|
||||
$ alt use php
|
||||
@ -81,22 +87,23 @@ $ alt use php
|
||||
|
||||
![设置 PHP 版本][6]
|
||||
|
||||
现在,你可以在 /home/sk/myproject 目录下使用 PHP5.6 版本啦。
|
||||
现在,你可以在 `/home/sk/myproject` 目录下使用 PHP 5.6 版本啦。
|
||||
|
||||
让我们检查一下,在 `myproject` 目录下是否默认使用 PHP 5.6 版本:
|
||||
|
||||
让我们检查一下,在 myproject 目录下是否默认使用 PHP5.6 版本:
|
||||
```
|
||||
$ php -v
|
||||
```
|
||||
|
||||
**示例输出:**
|
||||
示例输出:
|
||||
|
||||
![检查 PHP 版本][7]
|
||||
|
||||
只要你不设置成其它版本,(在该目录下)将一直使用 PHP5.6 版本。清楚了吗?很好!请注意,我们仅在这个目录下使用 PHP5.6 版本。在系统范围内(LCTT 译注:当然是没单独设置过其它版本的目录下),PHP7.2 仍是默认的版本。让我们检验一下,请看下图。
|
||||
只要你不设置成其它版本,(在该目录下)将一直使用 PHP 5.6 版本。清楚了吗?很好!请注意,我们仅在这个目录下使用 PHP 5.6 版本。在系统范围内(LCTT 译注:当然是没单独设置过其它版本的目录下),PHP 7.2 仍是默认的版本。让我们检验一下,请看下图。
|
||||
|
||||
![比对 PHP 版本][8]
|
||||
|
||||
从上面的截图中可以看出,我有两个版本的 PHP:在 "myproject" 目录下,使用的版本为 PHP5.6;在 myproject 外的其它目录,使用的版本为 PHP7.2。
|
||||
从上面的截图中可以看出,我有两个版本的 PHP:在 `myproject` 目录下,使用的版本为 PHP 5.6;在 `myproject` 外的其它目录,使用的版本为 PHP 7.2。
|
||||
|
||||
同理,你可以为每个目录设置你希望的程序版本。我这里使用 PHP 仅用于说明操作,但方法适用于任何你打算使用的软件,例如 NodeJS 等。
|
||||
|
||||
@ -117,7 +124,7 @@ via: https://www.ostechnix.com/how-to-switch-between-different-versions-of-comma
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[pinewall](https://github.com/pinewall)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,47 +0,0 @@
|
||||
LuuMing Translating
|
||||
Open Source Networking Jobs: A Hotbed of Innovation and Opportunities
|
||||
======
|
||||
|
||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/os-jobs-networking.jpg?itok=PgUzydn-)
|
||||
|
||||
As global economies move ever closer to a digital future, companies and organizations in every industry vertical are grappling with how to further integrate and deploy technology throughout their business and operations. While Enterprise IT largely led the way, the advantages and lessons learned are now starting to be applied across the board. While the national unemployment rate stands at 4.1%, the overall unemployment rate for tech professionals hit 1.9% in April and the future for open source jobs looks particularly bright. I work in the open source networking space and the innovations and opportunities I’m witnessing are transforming the way the world communicates.
|
||||
|
||||
Once a slower moving industry, the networking ecosystem of today -- made up of network operators, vendors, systems integrators, and developers -- is now embracing open source software and is shifting significantly towards virtualization and software defined networks running on commodity hardware. In fact, nearly 70% of global mobile subscribers are represented by network operator members of [LF Networking][1], an initiative working to harmonize projects that makes up the open networking stack and adjacent technologies.
|
||||
|
||||
### Demand for Skills
|
||||
|
||||
Developers and sysadmins working in this space are embracing cloud native and DevOps approaches and methods to develop new use cases and tackle the most pressing industry challenges. Focus areas like containers and edge computing are red hot and the demand for developers and sysadmins who can integrate, collaborate, and innovate in this space is exploding.
|
||||
|
||||
Open source and Linux makes this all possible, and per the recently published [2018 Open Source Jobs Report][2], fully 80% of hiring managers are looking for people with Linux skills **while 46% are looking to recruit in the networking area and a roughly equal equal percentage cite “Networking” as a technology most affecting their hiring decisions.**
|
||||
|
||||
Developers are the most sought-after position, with 72% of hiring managers looking for them, followed by DevOps skills (59%), engineers (57%) and sysadmins (49%). The report also measures the incredible growth in demand for containers skills which matches what we’re seeing in the networking space with the creation of cloud native virtual functions (CNFs) and the proliferation of Continuous Integration / Continuous Deployment approaches such as the [XCI initiative][3] in the OPNFV.
|
||||
|
||||
### Get Started
|
||||
|
||||
The good news for job seekers in that there are plenty of onramps into open source including the free [Introduction to Linux][4] course. Multiple certifications are mandatory for the top jobs so I encourage you to explore the range of training opportunities out there. Specific to networking, check out these new training courses in the [OPNFV][5] and [ONAP][6] projects, as well as this [introduction to open source networking technologies][7].
|
||||
|
||||
If you haven’t done so already, download the [2018 Open Source Jobs Report][2] now for more insights and plot your course through the wide world of open source technology to the exciting career that waits for you on the other side!
|
||||
|
||||
[Download the complete Open Source Jobs Report][8]now and[learn more about Linux certification here.][9]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/blog/os-jobs-report/2018/7/open-source-networking-jobs-hotbed-innovation-and-opportunities
|
||||
|
||||
作者:[Brandon Wick][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.linux.com/users/brandon-wick
|
||||
[1]:https://www.lfnetworking.org/
|
||||
[2]:https://www.linuxfoundation.org/publications/2018/06/open-source-jobs-report-2018/
|
||||
[3]:https://docs.opnfv.org/en/latest/submodules/releng-xci/docs/xci-overview.html
|
||||
[4]:https://www.edx.org/course/introduction-linux-linuxfoundationx-lfs101x-1
|
||||
[5]:https://training.linuxfoundation.org/training/opnfv-fundamentals/
|
||||
[6]:https://training.linuxfoundation.org/training/onap-fundamentals/
|
||||
[7]:https://www.edx.org/course/introduction-to-software-defined-networking-technologies
|
||||
[8]:https://www.linuxfoundation.org/publications/open-source-jobs-report-2018/
|
||||
[9]:https://training.linuxfoundation.org/certification
|
@ -0,0 +1,110 @@
|
||||
Recreate Famous Data Decryption Effect Seen On Sneakers Movie
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/08/sneakers-720x340.jpg)
|
||||
|
||||
A while ago, we published a guide that described how to [**turn your Ubuntu Linux console into a veritable Hollywood technical melodrama hacker interface**][1] using **Hollywood** utility which is written by **Dustin Kirkland** from Canonical. Today, I have stumbled upon a similar CLI utility named “ **N** o **M** ore **S** ecrets”, shortly **nms**. Like Hollywood utility, the nms utility is also **USELESS** (Sorry!). You can use it just for fun. The nms will recreate the famous data decryption effect seen on Sneakers, released in 1992.
|
||||
|
||||
[**Sneakers**][2] is a comedy and crime-thriller genre movie, starred by **Robert Redford** among other famous actors named **Dan Aykroyd** , **David Strathairn** and **Ben Kingsley**. This movie is one of the popular hacker movie released in 1990s. If you haven’t watched it already, there is [**a scene**][3] in Sneakers movie where a group of experts who specialize in testing security systems will recover a top secret black box that has the ability to decrypt all existing encryption systems around the world. The nms utility simply simulates how exactly the data decryption effect scene looks like on Sneakers movie in your Terminal.
|
||||
|
||||
### Installing Nms
|
||||
|
||||
The nms project has no dependencies, but it relies on ANSI/VT100 terminal escape sequences to recreate the effect. Most modern terminal programs support these sequences by default. Just in case, if your Terminal doesn’t support these sequences, install **ncurses**. Ncurses is available in the default repositories of most Linux distributions. We are going to compile and install nms from source. So, just make sure you have installed the development tools in your Linux box. If you haven’t installed them already, refer the following links.
|
||||
|
||||
After installing, git, make, and gcc development tools, run the following commands one by one to compile and install nms utility.
|
||||
```
|
||||
$ git clone https://github.com/bartobri/no-more-secrets.git
|
||||
$ cd ./no-more-secrets
|
||||
$ make nms
|
||||
$ make sneakers
|
||||
$ sudo make install
|
||||
|
||||
```
|
||||
|
||||
Finally, check if the installation was successful using command:
|
||||
```
|
||||
$ nms -v
|
||||
nms version 0.3.3
|
||||
|
||||
```
|
||||
|
||||
Alternatively, you can install nms using [**Linuxbrew**][4] package manager as shown below.
|
||||
```
|
||||
$ brew install no-more-secrets
|
||||
|
||||
```
|
||||
|
||||
Now it is time to run nms.
|
||||
|
||||
### Recreate Famous Data Decryption Effect Seen On Sneakers Movie Using Nms
|
||||
|
||||
The nms utility works on piped data. Pipe any Linux command’s output to nms tool like below and enjoy the effect right from your Terminal. Have a look at the following command:
|
||||
```
|
||||
$ ls -l | nms
|
||||
|
||||
```
|
||||
|
||||
By default, after the initial encrypted characters are displayed, the **nms** utility will wait for the user to press a key to start the decryption sequence. This is how the it is depicted in the Sneakers movie. Just press any key to start the decryption sequence to reveal the original plaintext characters.
|
||||
|
||||
If you don’t want to press any key, you can auto-initiate the decryption sequence using **-a** flag.
|
||||
```
|
||||
$ ls -l | nms -a
|
||||
|
||||
```
|
||||
|
||||
You can also set a foreground color, for example green, use **-f <color>** option as shown below.
|
||||
```
|
||||
$ ls -l | nms -f green
|
||||
|
||||
```
|
||||
|
||||
Remember If you don’t specify **-a** flag, you must press any key to initiate the decryption sequence.
|
||||
|
||||
To clear the screen before starting encryption and decryption processes, use **-c** flag.
|
||||
```
|
||||
$ ls -l | nms -c
|
||||
|
||||
```
|
||||
|
||||
To mask single blank space characters, use -s flag. Please note that other space characters such as tabs and newlines will not be masked.
|
||||
```
|
||||
$ ls -l | nms -s
|
||||
|
||||
```
|
||||
|
||||
You can also view the actual decryption effect scene in the Sneakers movie using the following command:
|
||||
```
|
||||
$ sneakers
|
||||
|
||||
```
|
||||
|
||||
Choose any option given to exit this utility.
|
||||
|
||||
Don’t like it? Sorry about that. Go to the nms project folder and simply run the following command to remove it.
|
||||
```
|
||||
$ sudo make uninstall
|
||||
|
||||
```
|
||||
|
||||
And, that’s all for now. More good stuffs to come. Stay tuned!
|
||||
|
||||
Cheers!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/no-more-secrets-recreate-famous-data-decryption-effect-seen-on-sneakers-movie/
|
||||
|
||||
作者:[SK][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.ostechnix.com/author/sk/
|
||||
[1]:https://www.ostechnix.com/turn-ubuntu-terminal-hollywood-technical-melodrama-hacker-interface/
|
||||
[2]:https://www.imdb.com/title/tt0105435/
|
||||
[3]:https://www.youtube.com/watch?v=F5bAa6gFvLs&t=35
|
||||
[4]:https://www.ostechnix.com/linuxbrew-common-package-manager-linux-mac-os-x/
|
@ -1,141 +0,0 @@
|
||||
pinewall translating
|
||||
|
||||
How To Record Terminal Sessions As SVG Animations In Linux
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/08/termtosvg-720x340.png)
|
||||
|
||||
Recording Terminal sessions may help in several cases. You can use those recording sessions to document everything that you did in Terminal and save them for future reference. You can use them to demonstrate different Linux commands and its use cases to your juniors, students and anyone who are willing to Learn Linux. Luckily, we have many tools to record Terminal sessions in Unix-like operating systems. We already have featured some of the tools/commands which helps you to record the Terminal sessions in the past. You can go through them in the links given below.
|
||||
|
||||
|
||||
+ [How To Record Everything You Do In Terminal][3]
|
||||
+ [Asciinema – Record Terminal Sessions And Share Them On The Web][4]
|
||||
|
||||
|
||||
Today, we are going to see yet another tool to record the Terminal activities. Say hello to **“Termtosvg”**. As the name implies, Termtosvg records your Terminal sessions as standalone SVG animations. It is a simple command line utility written in **Python** programming language. It generates lightweight and clean looking animations embeddable on a project page. It supports custom color themes, terminal UI and animation controls via [SVG templates][1]. It is also compatible with asciinema recording format. Termtosvg supports GNU/Linux, Mac OS and BSD OSes.
|
||||
|
||||
|
||||
### Installing Termtosvg
|
||||
|
||||
Termtosvg can be installed using PIP, a python package manager to install applications written using Python language. If you haven’t installed PIP already, refer the following guide.
|
||||
|
||||
After installing PIP, run the following command to install Termtosvg tool:
|
||||
```
|
||||
$ pip3 install --user termtosvg
|
||||
|
||||
```
|
||||
|
||||
And, install the following prerequisites to render the Terminal screen.
|
||||
```
|
||||
$ pip3 install pyte python-xlib svgwrite
|
||||
|
||||
```
|
||||
|
||||
Done. Let us go ahead and generate Terminal sessions in SVG format.
|
||||
|
||||
### Record Terminal Sessions As SVG Animations In Linux
|
||||
|
||||
Recording Terminal sessions using Termtosvg is very simple. Just open your Terminal window and run the following command to start recording it.
|
||||
```
|
||||
$ termtosvg
|
||||
|
||||
```
|
||||
|
||||
**Note:** If you termtosvg command is not available, restart your system once.
|
||||
|
||||
You will see the following output after running ‘termtosvg’ command:
|
||||
```
|
||||
Recording started, enter "exit" command or Control-D to end
|
||||
|
||||
```
|
||||
|
||||
You will now be in a sub-shell where you can execute the Linux commands as usual. Everything you do in the Terminal will be recorded.
|
||||
|
||||
Let me run a random commands.
|
||||
```
|
||||
$ mkdir mydirectory
|
||||
|
||||
$ cd mydirectory/
|
||||
|
||||
$ touch file.txt
|
||||
|
||||
$ cd ..
|
||||
|
||||
$ uname -a
|
||||
|
||||
```
|
||||
|
||||
Once you’re done, press **CTRL+D** or type **exit** to stop recording. The resulting recording will be saved in **/tmp** folder with a unique name.
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/08/Termtosvg-in-action-1-1.png)
|
||||
|
||||
You can then open the SVG file in any web browser of your choice from Terminal like below.
|
||||
```
|
||||
$ firefox /tmp/termtosvg_ddkehjpu.svg
|
||||
|
||||
```
|
||||
|
||||
You can also directly open the SVG file from browser ( **File - > <path-to-svg>**).
|
||||
|
||||
Here is the output of the above recording in my Firefox browser.
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/08/Termtosvg-in-browser.gif)
|
||||
|
||||
Here is some more examples on how to use Termtosvg to record Terminal sessions.
|
||||
|
||||
Like I mentioned already, Termtosvg will record a terminal session and save it as an SVG animation file in **/tmp** directory by default.
|
||||
|
||||
However, you can generate an SVG animation with a custom name, for example **animation.svg** , and save it in a custom location, for example **/home/sk/ostechnix/**.
|
||||
```
|
||||
$ termtosvg /home/sk/ostechnix/animation.svg
|
||||
|
||||
```
|
||||
|
||||
Record a terminal session and render it using a specific template:
|
||||
```
|
||||
$ termtosvg -t ~/templates/my_template.svg
|
||||
|
||||
```
|
||||
|
||||
Record a terminal session with a specific screen geometry:
|
||||
```
|
||||
$ termtosvg -g 80x24 animation.svg
|
||||
|
||||
```
|
||||
|
||||
Record a terminal session in asciicast v2 format:
|
||||
```
|
||||
$ termtosvg record recording.cast
|
||||
|
||||
```
|
||||
|
||||
Render an SVG animation from a recording in asciicast format:
|
||||
```
|
||||
$ termtosvg render recording.cast animation.svg
|
||||
|
||||
```
|
||||
|
||||
For more details, refer [**Termtosvg manual**][2].
|
||||
|
||||
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-record-terminal-sessions-as-svg-animations-in-linux/
|
||||
|
||||
作者:[SK][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.ostechnix.com/author/sk/
|
||||
[1]:https://nbedos.github.io/termtosvg/pages/templates.html
|
||||
[2]:https://github.com/nbedos/termtosvg/blob/develop/man/termtosvg.md
|
||||
[3]: https://www.ostechnix.com/record-everything-terminal/
|
||||
[4]: https://www.ostechnix.com/asciinema-record-terminal-sessions-share-web/
|
@ -1,55 +0,0 @@
|
||||
translating---geekpi
|
||||
|
||||
How the L1 Terminal Fault vulnerability affects Linux systems
|
||||
======
|
||||
|
||||
![](https://images.idgesg.net/images/article/2018/08/l1tf-copy-100768129-large.jpg)
|
||||
|
||||
Announced just yesterday in security advisories from Intel, Microsoft and Red Hat, a newly discovered vulnerability affecting Intel processors (and, thus, Linux) called L1TF or “L1 Terminal Fault” is grabbing the attention of Linux users and admins. Exactly what is this vulnerability and who should be worrying about it?
|
||||
|
||||
### L1TF, L1 Terminal Fault, and Foreshadow
|
||||
|
||||
The processor vulnerability goes by L1TF, L1 Terminal Fault, and Foreshadow. Researchers who discovered the problem back in January and reported it to Intel called it "Foreshadow". It is similar to vulnerabilities discovered in the past (such as Spectre).
|
||||
|
||||
This vulnerability is Intel-specific. Other processors are not affected. And like some other vulnerabilities, it exists because of design choices that were implemented to optimize kernel processing speed but exposed data in ways that allowed access by other processes.
|
||||
|
||||
**[ Read also:[22 essential Linux security commands][1] ]**
|
||||
|
||||
Three CVEs have been assigned to this issue:
|
||||
|
||||
* CVE-2018-3615 for Intel Software Guard Extensions (Intel SGX)
|
||||
* CVE-2018-3620 for operating systems and System Management Mode (SMM)
|
||||
* CVE-2018-3646 for impacts to virtualization
|
||||
|
||||
|
||||
|
||||
An Intel spokesman made this statement regarding this issue: _" L1 Terminal Fault is addressed by microcode updates released earlier this year, coupled with corresponding updates to operating system and hypervisor software that are available starting today. We’ve provided more information on our web site and continue to encourage everyone to keep their systems up-to-date, as it's one of the best ways to stay protected. We’d like to extend our thanks to the researchers at imec-DistriNet, KU Leuven, Technion- Israel Institute of Technology, University of Michigan, University of Adelaide and Data61 and our industry partners for their collaboration in helping us identify and address this issue."_
|
||||
|
||||
### Does L1TF affect your Linux system?
|
||||
|
||||
The short answer is "probably not." You should be safe if you’ve patched your system since the earlier [Spectre and Meltdown vulnerabilities][2] were exposed back in January. As with Spectre and Meltdown, Intel claims that no real-world cases of systems being affected have been reported or detected. They also have said that the changes are unlikely to incur noticeable performance hits on individual systems, but they might represent significant performance hits for data centers using virtualized operating systems.
|
||||
|
||||
Even so, frequent patches are always recommended. To check your current kernel level, use the **uname -r** command:
|
||||
```
|
||||
$ uname -r
|
||||
4.18.0-041800-generic
|
||||
|
||||
```
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3298157/linux/linux-and-l1tf.html
|
||||
|
||||
作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/
|
||||
[1]:https://www.networkworld.com/article/3272286/open-source-tools/22-essential-security-commands-for-linux.html
|
||||
[2]:https://www.networkworld.com/article/3245813/security/meltdown-and-spectre-exploits-cutting-through-the-fud.html
|
||||
[3]:https://www.facebook.com/NetworkWorld/
|
||||
[4]:https://www.linkedin.com/company/network-world
|
@ -0,0 +1,190 @@
|
||||
How To Lock The Keyboard And Mouse, But Not The Screen In Linux
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2017/09/Lock-The-Keyboard-And-Mouse-720x340.jpg)
|
||||
|
||||
My 4-years-old niece is a curious-kid. She loves “Avatar” movie very much. When the Avatar movie is on, she became so focused and her eyes are glued to the screen. But the problem is she often touches a key in the keyboard or move the mouse or click the mouse button while watching the movie. Sometimes, she accidentally close or pause the movie by pressing a key in the keyboard. So I was looking for a way to lock down both the keyboard and mouse, but not the screen. Luckily, I came across a perfect solution in Ubuntu forum. If you don’t want your cat or puppy walking on your keyboard or your kid messing up with the keyboard and mouse while you watching something important on the screen, I suggest you to try **“xtrlock”** utility. It is a simple, yet useful utility to lock the X display till the user enters their password at the keyboard. In this brief tutorial, I will show you how to lock the keyboard and mouse, but not the screen in Linux. This trick will work on all Linux operating systems.
|
||||
|
||||
### Install xtrlock
|
||||
|
||||
The xtrlock package is available in the default repositories of most Linux operating systems. So, you can install it using your distribution’s package manager.
|
||||
|
||||
On **Arch Linux** and derivatives, run the following command to install it.
|
||||
```
|
||||
$ sudo pacman -S xtrlock
|
||||
|
||||
```
|
||||
|
||||
On **Fedora** :
|
||||
```
|
||||
$ sudo dnf install xtrlock
|
||||
|
||||
```
|
||||
|
||||
On **RHEL, CentOS** :
|
||||
```
|
||||
$ sudo yum install xtrlock
|
||||
|
||||
```
|
||||
|
||||
On **SUSE/openSUSE** :
|
||||
```
|
||||
$ sudo zypper install xtrlock
|
||||
|
||||
```
|
||||
|
||||
On **Debian, Ubuntu, Linux Mint** :
|
||||
```
|
||||
$ sudo apt-get install xtrlock
|
||||
|
||||
```
|
||||
|
||||
### Lock the Keyboard and Mouse, but not the Screen using xtrlock
|
||||
|
||||
Once xtrlock installed, create a keyboard shortcut. You need this to lock the keyboard and mouse using the key combination of your choice.
|
||||
|
||||
Create a new file called **lockkbmouse** in **/usr/local/bin**.
|
||||
```
|
||||
$ sudo vi /usr/local/bin/lockkbmouse
|
||||
|
||||
```
|
||||
|
||||
Add the following lines into it.
|
||||
```
|
||||
#!/bin/bash
|
||||
sleep 1 && xtrlock
|
||||
|
||||
```
|
||||
|
||||
Save the file and close the file.
|
||||
|
||||
Make it as executable using the following command:
|
||||
```
|
||||
$ sudo chmod a+x /usr/local/bin/lockkbmouse
|
||||
|
||||
```
|
||||
|
||||
Next, we need to create keyboard a shortcut.
|
||||
|
||||
**In Arch Linux MATE desktop:**
|
||||
|
||||
Go to **System - > Preferences -> Hardware -> keyboard Shortcuts**.
|
||||
|
||||
Click **Add** to create a new shortcut.
|
||||
|
||||
![][2]
|
||||
|
||||
Enter the name for your shortcut and add the following line in the command box, and click **Apply** button.
|
||||
```
|
||||
bash -c "sleep 1 && xtrlock"
|
||||
|
||||
```
|
||||
|
||||
![][3]
|
||||
|
||||
To assign the shortcut key, just select or double click on it and type the key combination of your choice. For example, I use **Alt+k**.
|
||||
|
||||
![][4]
|
||||
|
||||
To clear the key combination, press BACKSPACE key. Once you finished, close the Keyboard Settings window.
|
||||
|
||||
**In Ubuntu GNOME DE:**
|
||||
|
||||
Go to **System Settings - > Devices -> Keyboard**. Click the **+** symbol at the end.
|
||||
|
||||
Enter the name for your shortcut and add the following line in the command box, and click **Add** button.
|
||||
```
|
||||
bash -c "sleep 1 && xtrlock"
|
||||
|
||||
```
|
||||
|
||||
![][5]
|
||||
|
||||
Next, assign the shortcut key to the newly created shortcut. To do so, just select or double click on it and click on **“Set shortcut”** button.
|
||||
|
||||
![][6]
|
||||
|
||||
You will now see the following screen.
|
||||
|
||||
![][7]
|
||||
|
||||
Type the key combination of your choice. For example, I use **Alt+k**.
|
||||
|
||||
![][8]
|
||||
|
||||
To clear the key combination, press BACKSPACE key. The shortcut key has been assigned. Once you finished, close the Keyboard Settings window.
|
||||
|
||||
From now on, whenever you press the keyboard shortcut key (ALT+k in our case), the mouse pointer will turn into a a padlock. Now, the keyboard and mouse have been locked, so you can freely watch the movies or whatever you want to. Even your kid or pet touches some keys on the keyboard or clicks a mouse button, they won’t work.
|
||||
|
||||
Here is xtrclock in action.
|
||||
|
||||
![][9]
|
||||
|
||||
Do you see the a small lock button? It means that the keyboard and mouse have been locked. Even if you move the lock button, nothing will happen. The task in the background will keep running until you unlock your screen and manually close the running task.
|
||||
|
||||
### Unlock keyboard and mouse
|
||||
|
||||
To unlock the keyboard and mouse, simply type your password and hit “Enter”. You will not see the password as you type it. Just type the password anyway and hit ENTER key. The mouse and keyboard will start to work after you entered the correct password. If you entered an incorrect password, you will hear a bell sound. Press **ESC** key to clear the incorrect password and re-enter the correct password again. To remove one character of a partially typed password, press either **BACKSPACE** or **DELETE** keys.
|
||||
|
||||
### What if I permanently get locked out of the screen?
|
||||
|
||||
The xtrclock tool may not work on some DEs, for example GDM. It may permanently lock you out of the screen. Please test it in a virtual machine and then try it in your personal or official desktop if it really works. I tested this on Arch Linux MATE desktop and Ubuntu 18.04 GNOME desktop. It worked just fine.
|
||||
|
||||
Just in case, you are locked out of the screen permanently, switch to the TTY (CTRL+ALT+F2) then run:
|
||||
```
|
||||
$ sudo killall xtrlock
|
||||
|
||||
```
|
||||
|
||||
Alternatively, you can use the **chvt** command to switch between TTY and X session.
|
||||
|
||||
For example, to switch to TTY1, run:
|
||||
```
|
||||
$ sudo chvt 1
|
||||
|
||||
```
|
||||
|
||||
To switch back to the X session again, type:
|
||||
```
|
||||
$ sudo chvt 7
|
||||
|
||||
```
|
||||
|
||||
Different distros uses different key combinations to switch between TTYs. Please refer your distribution’s official website for more details.
|
||||
|
||||
For more details about xtrlock, refer man pages.
|
||||
```
|
||||
$ man xtrlock
|
||||
|
||||
```
|
||||
|
||||
And, that’s all for now. Hope this helps. If you find our guides useful, please spend a moment to share them on your social, professional networks and support OSTechNix.
|
||||
|
||||
**Resource:**
|
||||
|
||||
* [**Ubuntu forum**][10]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/lock-keyboard-mouse-not-screen-linux/
|
||||
|
||||
作者:[SK][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.ostechnix.com/author/sk/
|
||||
[1]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[2]:http://www.ostechnix.com/wp-content/uploads/2017/09/Keyboard-Shortcuts_001.png
|
||||
[3]:http://www.ostechnix.com/wp-content/uploads/2017/09/Keyboard-Shortcuts_002.png
|
||||
[4]:http://www.ostechnix.com/wp-content/uploads/2017/09/Keyboard-Shortcuts_003.png
|
||||
[5]:http://www.ostechnix.com/wp-content/uploads/2018/01/Add-xtrlock-shortcut.png
|
||||
[6]:http://www.ostechnix.com/wp-content/uploads/2018/01/set-shortcut-key-1.png
|
||||
[7]:http://www.ostechnix.com/wp-content/uploads/2018/01/set-shortcut-key-2.png
|
||||
[8]:http://www.ostechnix.com/wp-content/uploads/2018/01/set-shortcut-key-3.png
|
||||
[9]:http://www.ostechnix.com/wp-content/uploads/2018/01/xtrclock-1.png
|
||||
[10]:https://ubuntuforums.org/showthread.php?t=993800
|
@ -0,0 +1,255 @@
|
||||
LuuMing Translating
|
||||
How to define and use functions in Linux Shell Script
|
||||
======
|
||||
Function is a reusable block of code. Often we put repeated code in a function and call that function from various places. Library is a collection of functions. We can define commonly used function in a library and other scripts can use them without duplicating code.
|
||||
|
||||
[![Functions-Linux-Shell-Script][1]![Functions-Linux-Shell-Script][2]][2]
|
||||
|
||||
In this article we’ll discuss more about functions and recipes. For demonstration purpose I’ll be using **Bourne Again SHell(Bash)** on Ubuntu machine.
|
||||
|
||||
#### Calling function
|
||||
|
||||
In Shell calling function is exactly same as calling any other command. For instance, if your function name is my_func then it can be execute as follows:
|
||||
```
|
||||
$ my_func
|
||||
|
||||
```
|
||||
|
||||
If any function accepts arguments then those can be provided from command line as follows:
|
||||
```
|
||||
$ my_func arg1 arg2 arg3
|
||||
|
||||
```
|
||||
|
||||
#### Defining function
|
||||
|
||||
We can use below syntax to define function:
|
||||
```
|
||||
function function_name {
|
||||
Body of function
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Body of function can contain any valid command, loop constrain, other function or script. Now let us create simple function which displays message on screen.
|
||||
```
|
||||
function print_msg {
|
||||
echo "Hello, World"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Now let us execute this function:
|
||||
```
|
||||
$ print_msg
|
||||
Hello, World
|
||||
|
||||
```
|
||||
|
||||
As expected, this function displays message on screen.
|
||||
|
||||
In above example we have created function directly on terminal. We can store this function in file as well. Below example demonstrates this.
|
||||
```
|
||||
#! /bin/bash
|
||||
function print_msg {
|
||||
echo "Hello, World"
|
||||
}
|
||||
print_msg
|
||||
|
||||
```
|
||||
|
||||
We have defined this function inside **function.sh** file. Now let us execute this script:
|
||||
```
|
||||
$ chmod +x function.sh
|
||||
$ ./function.sh
|
||||
Hello, World
|
||||
|
||||
```
|
||||
|
||||
If you observe, above output is exactly identical to previous one.
|
||||
|
||||
#### More about functions
|
||||
|
||||
In previous section we have defined very basic function. However during software development we need more advanced functions which can accept various parameters and return values. In this section we’ll discuss such functions.
|
||||
|
||||
**Passing arguments to function**
|
||||
|
||||
We can provide arguments to function same as other commands. We can access these arguments from function using dollar($) symbol. For instance, $1 represents first argument, $2 represents second argument and so on.
|
||||
|
||||
Let us modify above function to accept message as an argument. Our modified function will look like this:
|
||||
```
|
||||
function print_msg {
|
||||
echo "Hello $1"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
In above function we are accessing first argument using $1. Let us execute this function:
|
||||
```
|
||||
$ print_msg "LinuxTechi"
|
||||
|
||||
```
|
||||
|
||||
When you execute this function, it will generate following output:
|
||||
```
|
||||
Hello LinuxTechi
|
||||
|
||||
```
|
||||
|
||||
**Returning value from function**
|
||||
|
||||
Like other programming languages, Bash provides return statement using that we can return value to the caller. Let us understand this with example:
|
||||
```
|
||||
function func_return_value {
|
||||
return 10
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Above function returns value 10 to its caller. Let us execute this function:
|
||||
```
|
||||
$ func_return_value
|
||||
$ echo "Value returned by function is: $?"
|
||||
|
||||
```
|
||||
|
||||
When you execute above function, it will generate following output:
|
||||
```
|
||||
Value returned by function is: 10
|
||||
|
||||
```
|
||||
|
||||
**NOTE:** In bash we have to use $? to capture return value of function
|
||||
|
||||
#### Function recipes
|
||||
|
||||
So far we got fair idea about bash functions. Now let us create some useful bash functions which can be used to make our lives easier.
|
||||
|
||||
**Logger**
|
||||
|
||||
Let us create logger function which will print date and time along with log message.
|
||||
|
||||
Let us execute this function:
|
||||
```
|
||||
$ log_msg "This is sample log message"
|
||||
|
||||
```
|
||||
|
||||
When you execute this function, it will generate following output:
|
||||
```
|
||||
[ 2018-08-16 19:56:34 ]: This is sample log message
|
||||
|
||||
```
|
||||
|
||||
**Display system information**
|
||||
|
||||
Let us create a function to display information about GNU/Linux system
|
||||
```
|
||||
function system_info {
|
||||
echo "### OS information ###"
|
||||
lsb_release -a
|
||||
|
||||
echo
|
||||
echo "### Processor information ###"
|
||||
processor=`grep -wc "processor" /proc/cpuinfo`
|
||||
model=`grep -w "model name" /proc/cpuinfo | awk -F: '{print $2}'`
|
||||
echo "Processor = $processor"
|
||||
echo "Model = $model"
|
||||
|
||||
echo
|
||||
echo "### Memory information ###"
|
||||
total=`grep -w "MemTotal" /proc/meminfo | awk '{print $2}'`
|
||||
free=`grep -w "MemFree" /proc/meminfo | awk '{print $2}'`
|
||||
echo "Total memory: $total kB"
|
||||
echo "Free memory : $free kB"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
When you execute above function it will generate following output:
|
||||
```
|
||||
### OS information ###
|
||||
No LSB modules are available.
|
||||
Distributor ID: Ubuntu
|
||||
Description: Ubuntu 18.04.1 LTS
|
||||
Release: 18.04
|
||||
Codename: bionic
|
||||
|
||||
### Processor information ###
|
||||
Processor = 1
|
||||
Model = Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
|
||||
|
||||
### Memory information ###
|
||||
Total memory: 4015648 kB
|
||||
Free memory : 2915428 kB
|
||||
|
||||
```
|
||||
|
||||
Find file or directory from current directory
|
||||
|
||||
Below function searches file or directory from current directory:
|
||||
```
|
||||
function search {
|
||||
find . -name $1
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Let us search directory namely dir4 using below command:
|
||||
```
|
||||
$ search dir4
|
||||
|
||||
```
|
||||
|
||||
When you execute above command, it will generate following output:
|
||||
```
|
||||
./dir1/dir2/dir3/dir4
|
||||
|
||||
```
|
||||
|
||||
**Digital clock**
|
||||
|
||||
Below function creates a simple digital clock on terminal
|
||||
```
|
||||
function digital_clock {
|
||||
clear
|
||||
while [ 1 ]
|
||||
do
|
||||
date +'%T'
|
||||
sleep 1
|
||||
clear
|
||||
done
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
#### Creating library
|
||||
|
||||
Library is a collection of functions. To create library – define functions in a file and import that file in current environment.
|
||||
|
||||
Let us suppose we have defined all functions in utils.sh file then use below command to import functions in current environment:
|
||||
```
|
||||
$ source utils.sh
|
||||
|
||||
```
|
||||
|
||||
Hereafter you can execute any function from library just like any other bash command.
|
||||
|
||||
##### Conclusion
|
||||
|
||||
In this article we discussed few useful recipes which will improve your productivity. I hope this articles inspires you to create your own recipes.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/define-use-functions-linux-shell-script/
|
||||
|
||||
作者:[Pradeep Kumar][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]:http://www.linuxtechi.com/author/pradeep/
|
||||
[1]:https://www.linuxtechi.com/wp-content/plugins/lazy-load/images/1x1.trans.gif
|
||||
[2]:https://www.linuxtechi.com/wp-content/uploads/2018/08/Functions-Linux-Shell-Script.jpg
|
@ -0,0 +1,120 @@
|
||||
How To Disable Ads In Terminal Welcome Message In Ubuntu Server
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/08/disable-ads-in-Terminal-welcome-message-in-Ubuntu-720x340.jpg)
|
||||
|
||||
If you’re using any latest Ubuntu server edition, you might have noticed some promotional links in welcome message which are not relevant to Ubuntu server platform. As you might already know **MOTD** , abbreviation of **M** essage **O** f **T** he **D** ay, displays a welcome message at every login in Linux systems. Usually, the welcome message contains the version of your OS, basic system information, official documentation link, and the links to read about the latest security updates etc. This is what we usually see at every time we login either via SSH or on the local machine. However, there some additional links started to appear in the terminal welcome message lately. I have already noticed this link few times, but I didn’t care about it and never clicked it though. Here is the Terminal welcome message shown in my Ubuntu 18.04 LTS server.
|
||||
|
||||
![](http://www.ostechnix.com/wp-content/uploads/2018/08/Ubuntu-Terminal-welcome-message.png)
|
||||
|
||||
As you can see in the above screenshot, there is also a bit.ly link and Ubuntu wiki link in the welcome message. Some of you may surprise and wondering what this is. There is nothing to worry about the links in the welcome message. It may look sort of ad-like, but those are not really commercial ads. The links are actually pointing to [**Ubuntu official blog**][1] and [**Ubuntu wiki**][2]. As I said earlier, one of link is not relevant and doesn’t has any details related to Ubuntu server. That’s why I called them ads in the first place.
|
||||
|
||||
Even though most of us won’t visit bit.ly links, but some people may visit those links out of curiosity and ended up disappointed realizing that it simply points you to an external link. You can use any URL unshortners services, such as unshorten.it, to see where they lead before visiting the actual link. Alternatively, you can just type a plus sign ( **+** ) at the end of the bit.ly link to see where they lead and some statistics about the link.
|
||||
|
||||
![](http://www.ostechnix.com/wp-content/uploads/2018/08/shortlink.png)
|
||||
|
||||
### What is MOTD and how it works?
|
||||
|
||||
Back in 2009, **Dustin Kirkland** from Canonical introduced the concept of MOTD in Ubuntu. It’s a flexible framework that enables the administrators or distro packages to add executable scripts in /etc/update-motd.d/* location to generate informative, interesting messages displayed at login. It was originally implemented for Landscape (a commercial service from Canonical), however other distribution maintainers found it useful and adopted this feature in their own distributions as well.
|
||||
|
||||
If you look in **/etc/update-motd.d/** location in your Ubuntu system, you’ll see a set of scripts. One prints the generic “welcome” banner. The next one prints 3 links showing where to find help for the OS. The other one counts and displays the number of package updates available for the local system. Another one tells you if a reboot is required and so on.
|
||||
|
||||
From Ubuntu 17.04 onwards, the developers have added **/etc/update-motd.d/50-motd-news** , a script to include some additional information in the welcome message. They additional information are;
|
||||
|
||||
1. Important critical information, such as
|
||||
|
||||
ShellShock, Heartbleed etc.
|
||||
|
||||
2. End-of-Life (EOL) messages, new feature availability, etc.
|
||||
|
||||
3. Some fun and informative posts published in Ubuntu official blog and other news about Ubuntu.
|
||||
|
||||
|
||||
|
||||
|
||||
Asynchronously, about 60 seconds after boot, a systemd timer runs “/etc/update-motd.d/50-motd-news –force” script. It sources 3 config variables defined in /etc/default/motd-news script. The default values are: ENABLED=1, URLS=”<https://motd.ubuntu.com”>, WAIT=”5″.
|
||||
|
||||
Here is the contents of /etc/default/motd-news file:
|
||||
```
|
||||
$ cat /etc/default/motd-news
|
||||
# Enable/disable the dynamic MOTD news service
|
||||
# This is a useful way to provide dynamic, informative
|
||||
# information pertinent to the users and administrators
|
||||
# of the local system
|
||||
ENABLED=1
|
||||
|
||||
# Configure the source of dynamic MOTD news
|
||||
# White space separated list of 0 to many news services
|
||||
# For security reasons, these must be https
|
||||
# and have a valid certificate
|
||||
# Canonical runs a service at motd.ubuntu.com, and you
|
||||
# can easily run one too
|
||||
URLS="https://motd.ubuntu.com"
|
||||
|
||||
# Specify the time in seconds, you're willing to wait for
|
||||
# dynamic MOTD news
|
||||
# Note that news messages are fetched in the background by
|
||||
# a systemd timer, so this should never block boot or login
|
||||
WAIT=5
|
||||
|
||||
```
|
||||
|
||||
Good thing is MOTD is fully customizable, so you can disable it entirely (ENABLED=0), change or add scripts as per your wish, and change the wait time in seconds
|
||||
|
||||
If MOTD is enabled, that systemd timer job will loop over each of the URLS, trim them to 80 characters per line, and a maximum of 10 lines, and concatenate them to a cache file in /var/cache/motd-news. This systemd timer job will re-run and update the /var/cache/motd-news every 12 hours. Upon user login, the contents of /var/cache/motd-news is just printed to screen. This is how MOTD works.
|
||||
|
||||
Also, a custom user-agent string is included in **/etc/update-motd.d/50-motd-news** file to report information about your computer. If you look into **/etc/update-motd.d/50-motd-news** file, you will see the following code.
|
||||
```
|
||||
# Piece together the user agent
|
||||
USER_AGENT="curl/$curl_ver $lsb $platform $cpu $uptime"
|
||||
|
||||
```
|
||||
|
||||
That means, the MOTD retriever reports your **operating system release** , **hardware platform** , **CPU type** and **uptime** to Canonical.
|
||||
|
||||
Hope you got the basic idea about MOTD.
|
||||
|
||||
Let us now get back to the topic. I don’t want this feature. How do I disable it? If the promotional links in the welcome message still bothers you and you wanted to disable them permanently, here is a quick way to disable it.
|
||||
|
||||
### Disable Ads In Terminal Welcome Message In Ubuntu Server
|
||||
|
||||
To disable these ads, edit file:
|
||||
```
|
||||
$ sudo vi /etc/default/motd-news
|
||||
|
||||
```
|
||||
|
||||
Find the following line and set its value as 0 (zero).
|
||||
```
|
||||
[...]
|
||||
ENABLED=0
|
||||
[...]
|
||||
|
||||
```
|
||||
|
||||
Save and close the file. Now, reboot your system and see if the welcome message stills showing the links from Ubuntu blog.
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/08/Ubuntu-Terminal-welcome-message-1.png)
|
||||
|
||||
See? There are no links from Ubuntu blog and Ubuntu wiki now.
|
||||
|
||||
And, that’s all for now. Hope this helps. More good stuffs to come. Stay tuned!
|
||||
|
||||
Cheers!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/how-to-disable-ads-in-terminal-welcome-message-in-ubuntu-server/
|
||||
|
||||
作者:[SK][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.ostechnix.com/author/sk/
|
||||
[1]:https://blog.ubuntu.com/
|
||||
[2]:https://wiki.ubuntu.com/
|
@ -0,0 +1,321 @@
|
||||
A Collection Of More Useful Unix Utilities
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2017/08/Moreutils-720x340.png)
|
||||
|
||||
We all know about **GNU core utilities** that comes pre-installed with all Unix-like operating systems. These are the basic file, shell and text manipulation utilities of the GNU operating system. The GNU core utilities contains the commands, such as cat, ls, rm, mkdir, rmdir, touch, tail, wc and many more, for performing the day-to-day operations. Among these utilities, there are also some other useful collection of Unix utilities which are not included by default in the Unix-like operating systems. Meet **moreutilis** , a growing collection of more useful Unix utilities. The moreutils can be installed on GNU/Linux, and various Unix flavours such as FreeBSD, openBSD and Mac OS.
|
||||
|
||||
|
||||
As of writing this guide, Moreutils provides the following utilities:
|
||||
|
||||
* **chronic** – Runs a command quietly unless it fails.
|
||||
* **combine** – Combine the lines in two files using boolean operations.
|
||||
* **errno** – Look up errno names and descriptions.
|
||||
* **ifdata** – Get network interface info without parsing ifconfig output.
|
||||
* **ifne** – Run a program if the standard input is not empty.
|
||||
* **isutf8** – Check if a file or standard input is utf-8.
|
||||
* **lckdo** – Execute a program with a lock held.
|
||||
* **mispipe** – Pipe two commands, returning the exit status of the first.
|
||||
* **parallel** – Run multiple jobs at once.
|
||||
* **pee** – tee standard input to pipes.
|
||||
* **sponge** – Soak up standard input and write to a file.
|
||||
* **ts** – timestamp standard input.
|
||||
* **vidir** – Edit a directory in your text editor.
|
||||
* **vipe** – Insert a text editor into a pipe.
|
||||
* **zrun** – Automatically uncompress arguments to command.
|
||||
|
||||
|
||||
|
||||
### Install moreutils on Linux
|
||||
|
||||
The moreutils is packaged to many Linux distributions, so you can install it using the distribution’s package manager.
|
||||
|
||||
On **Arch Linux** and derivatives such as **Antergos** , **Manjaro Linux** , run the following command to install moreutils.
|
||||
```
|
||||
$ sudo pacman -S moreutils
|
||||
|
||||
```
|
||||
|
||||
On **Fedora** :
|
||||
```
|
||||
$ sudo dnf install moreutils
|
||||
|
||||
```
|
||||
|
||||
On **RHEL** , **CentOS** , **Scientific Linux** :
|
||||
```
|
||||
$ sudo yum install epel-release
|
||||
|
||||
$ sudo yum install moreutils
|
||||
|
||||
```
|
||||
|
||||
On **Debian** , **Ubuntu** , **Linux Mint** :
|
||||
```
|
||||
$ sudo apt-get install moreutils
|
||||
|
||||
```
|
||||
|
||||
### Moreutils – A Collection Of More Useful Unix Utilities
|
||||
|
||||
Let us see the usage details of some moreutils tools.
|
||||
|
||||
##### The “Combine” utility
|
||||
|
||||
As the name implies, the **Combine** utility of moreutils package combines the sets of lines from two files using boolean operations such as “and”, “not”, “or”, “xor”.
|
||||
|
||||
* **and** – Outputs lines that are in file1 if they are also present in file2.
|
||||
* **not** – Outputs lines that are in file1 but not in file2.
|
||||
* **or** – Outputs lines that are in file1 or file2.
|
||||
* **xor** – Outputs lines that are in either file1 or file2, but not in both files.
|
||||
|
||||
|
||||
|
||||
Let me show you an example, so you can understand what exactly this utility will do . I have two files namely **file1** and **file2**. Here is the contents of the those two files.
|
||||
```
|
||||
$ cat file1
|
||||
is
|
||||
was
|
||||
were
|
||||
where
|
||||
there
|
||||
|
||||
$ cat file2
|
||||
is
|
||||
were
|
||||
there
|
||||
|
||||
```
|
||||
|
||||
Now, let me combine them using “and” boolean operation.
|
||||
```
|
||||
$ combine file1 and file2
|
||||
is
|
||||
were
|
||||
there
|
||||
|
||||
```
|
||||
|
||||
As you see in the above example, the “and” Boolean operator outputs lines that are in file1 if they are also present in file2. To put this more clearly, it displays the common lines(Ex. is, were, there) which are present in both files.
|
||||
|
||||
Let us now use “not” operator and see the result.
|
||||
```
|
||||
$ combine file1 not file2
|
||||
was
|
||||
where
|
||||
|
||||
```
|
||||
|
||||
As you see in the above output, the “not” operator displays the lines that are only in file1, but not in file2.
|
||||
|
||||
##### The “ifdata” utility
|
||||
|
||||
The “ifdata” utility can be used to check for the existence of a network interface, to get information about the network interface, such as its IP address. Unlike the built-in commands such as “ifconfig” or “ip”, ifdata has simple to parse output that is designed to be easily used by a shell script.
|
||||
|
||||
To display IP address details of a network interface, say wlp9s0, run:
|
||||
```
|
||||
$ ifdata -p wlp9s0
|
||||
192.168.43.192 255.255.255.0 192.168.43.255 1500
|
||||
|
||||
```
|
||||
|
||||
To display the netmask only, run:
|
||||
```
|
||||
$ ifdata -pn wlp9s0
|
||||
255.255.255.0
|
||||
|
||||
```
|
||||
|
||||
To check hardware address of a NIC:
|
||||
```
|
||||
$ ifdata -ph wlp9s0
|
||||
A0:15:46:90:12:3E
|
||||
|
||||
```
|
||||
|
||||
To check if a NIC exists or not, use “-pe” flag.
|
||||
```
|
||||
$ ifdata -pe wlp9s0
|
||||
yes
|
||||
|
||||
```
|
||||
|
||||
##### The “Pee” command
|
||||
|
||||
It is somewhat similar to “tee” command.
|
||||
|
||||
Let us see an example of “tee” command usage.
|
||||
```
|
||||
$ echo "Welcome to OSTechNIx" | tee file1 file2
|
||||
Welcome to OSTechNIx
|
||||
|
||||
```
|
||||
|
||||
The above command will create two files namely **file1** and **file2**. Then, append the line “Welcome to OSTechNix” on both files. And finally prints the message “Welcome to OSTechNix” in your Terminal.
|
||||
|
||||
The “Pee” command performs a similar function, but slightly differs from “tee” command. Look at the following command:
|
||||
```
|
||||
$ echo "Welcome to OSTechNIx" | pee cat cat
|
||||
Welcome to OSTechNIx
|
||||
Welcome to OSTechNIx
|
||||
|
||||
```
|
||||
|
||||
As you see in the above output, the two instances of “cat” command receives the output from “echo” command and displays them twice in the Terminal.
|
||||
|
||||
##### The “Sponge” utility
|
||||
|
||||
This is yet another useful utility from moreutils package. **Sponge** reads standard input and writes it out to the specified file. Unlike a shell redirect, sponge soaks up all its input before writing the output file.
|
||||
|
||||
Have a look at the contents of following text file.
|
||||
```
|
||||
$ cat file1
|
||||
I
|
||||
You
|
||||
Me
|
||||
We
|
||||
Us
|
||||
|
||||
```
|
||||
|
||||
As you see, the file contains some random lines, particularly “not” in alphabetical order. You want to sort the contents in alphabetical order. What would you do?
|
||||
```
|
||||
$ sort file1 > file1_sorted
|
||||
|
||||
```
|
||||
|
||||
Correct, isn’t it? Of course! As you see in the above command, I have sorted the contents of the **file1** in alphabetical order and saved them in a new file called **“file1_sorted”**. But, You can do the same without creating a new (i.e file1_sorted) using “sponge” command as shown below.
|
||||
```
|
||||
$ sort file1 | sponge file1
|
||||
|
||||
```
|
||||
|
||||
Now, check if the contents are sorted in alphabetical order.
|
||||
```
|
||||
$ cat file1
|
||||
I
|
||||
Me
|
||||
Us
|
||||
We
|
||||
You
|
||||
|
||||
```
|
||||
|
||||
See? we don’t need to create a new file. It’s very useful in scripting. And the good thing is sponge preserves the permissions of the output file if it already exists.
|
||||
|
||||
##### The “ts” utility
|
||||
|
||||
As the name says, “ts” command adds a timestamp to the beginning of each line of input.
|
||||
|
||||
Look at the following command’s output:
|
||||
```
|
||||
$ ping -c 2 localhost
|
||||
PING localhost(localhost.localdomain (::1)) 56 data bytes
|
||||
64 bytes from localhost.localdomain (::1): icmp_seq=1 ttl=64 time=0.055 ms
|
||||
64 bytes from localhost.localdomain (::1): icmp_seq=2 ttl=64 time=0.079 ms
|
||||
|
||||
--- localhost ping statistics ---
|
||||
2 packets transmitted, 2 received, 0% packet loss, time 1018ms
|
||||
rtt min/avg/max/mdev = 0.055/0.067/0.079/0.012 ms
|
||||
|
||||
```
|
||||
|
||||
Now, run the same command with “ts” utlity as shown below.
|
||||
```
|
||||
$ ping -c 2 localhost | ts
|
||||
Aug 21 13:32:28 PING localhost(localhost (::1)) 56 data bytes
|
||||
Aug 21 13:32:28 64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.063 ms
|
||||
Aug 21 13:32:28 64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.113 ms
|
||||
Aug 21 13:32:28
|
||||
Aug 21 13:32:28 --- localhost ping statistics ---
|
||||
Aug 21 13:32:28 2 packets transmitted, 2 received, 0% packet loss, time 4ms
|
||||
Aug 21 13:32:28 rtt min/avg/max/mdev = 0.063/0.088/0.113/0.025 ms
|
||||
|
||||
```
|
||||
|
||||
As you see in the above output, ts adds a timestamp at the beginning of each line. Here is another example.
|
||||
```
|
||||
$ ls -l | ts
|
||||
Aug 21 13:34:25 total 120
|
||||
Aug 21 13:34:25 drwxr-xr-x 2 sk users 12288 Aug 20 20:05 Desktop
|
||||
Aug 21 13:34:25 drwxr-xr-x 2 sk users 4096 Aug 10 18:44 Documents
|
||||
Aug 21 13:34:25 drwxr-xr-x 24 sk users 12288 Aug 21 13:06 Downloads
|
||||
[...]
|
||||
|
||||
```
|
||||
|
||||
##### The “Vidir” utility
|
||||
|
||||
The “Vidir” utility allows you to edit the contents of a specified directory in **vi** editor (Or, whatever you have in **$EDITOR** ). If no directory is specified, it will edit your current working directory.
|
||||
|
||||
The following command edits the contents of the directory called “Desktop”.
|
||||
```
|
||||
$ vidir Desktop/
|
||||
|
||||
```
|
||||
|
||||
![vidir][2]
|
||||
|
||||
The above command will open the specified directory in your **vi** editor. Each item in the editing directory will contain a number. You can now edit the files as the way you do in vi editor. Say for example, delete lines to remove files from the directory, or edit filenames to rename files.
|
||||
|
||||
You can edit the sub directories as well. The following command edits the current working directory along with its sub-directories.
|
||||
```
|
||||
$ find | vidir -
|
||||
|
||||
```
|
||||
|
||||
Please note the “-” at the end of the command. If “-” is specified as the directory to edit, it reads a list of filenames from stdin and displays those for editing.
|
||||
|
||||
If you want to edit only the files in the current working directory, you can use the following command:
|
||||
```
|
||||
$ find -type f | vidir -
|
||||
|
||||
```
|
||||
|
||||
Want to edit a specific file types, say .PNG files? then you would use:
|
||||
```
|
||||
$ vidir *.png
|
||||
|
||||
```
|
||||
|
||||
This command edits only the .png files in the current directory.
|
||||
|
||||
##### The “Vipe” Utility
|
||||
|
||||
The “vipe” command allows you to run your default editor in the middle of a Unix pipeline and edit the data that is being piped between programs.
|
||||
|
||||
The following command opens the vi editor (my default editor, of course) and allows you to edit the input of the “echo” command (i.e Welcome To OSTechNix) and displays the final result.
|
||||
```
|
||||
$ echo "Welcome to OSTechNIx" | vipe
|
||||
Hello World
|
||||
|
||||
```
|
||||
|
||||
As you see in the above output, I passed the input “Welcome to OSTechNix” to vi editor and edited them as “Hello World” and displayed the final output.
|
||||
|
||||
And, that’s all for now. I have covered only few utilities. The “moreutils” has more useful utilities. I already have mentioned the currently included utilities in moreutils package in the introductory section. You can read the man pages for greater detail on the above commands. Say for example, to know more about “vidir” command, run:
|
||||
```
|
||||
$ man vidir
|
||||
|
||||
```
|
||||
|
||||
Hope this helps. I will be soon here with another interesting and useful guide. If you find our articles helpful, please share them on your social, professional networks and support OSTechNix.
|
||||
|
||||
Cheers!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/moreutils-collection-useful-unix-utilities/
|
||||
|
||||
作者:[SK][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.ostechnix.com/author/sk/
|
||||
[1]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[2]:http://www.ostechnix.com/wp-content/uploads/2017/08/sk@sk_001-1.png
|
@ -0,0 +1,170 @@
|
||||
A checklist for submitting your first Linux kernel patch
|
||||
======
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22)
|
||||
|
||||
One of the biggest—and the fastest moving—open source projects, the Linux kernel, is composed of about 53,600 files and nearly 20-million lines of code. With more than 15,600 programmers contributing to the project worldwide, the Linux kernel follows a maintainer model for collaboration.
|
||||
|
||||
![](https://opensource.com/sites/default/files/karnik_figure1.png)
|
||||
|
||||
In this article, I'll provide a quick checklist of steps involved with making your first kernel contribution, and look at what you should know before submitting a patch. For a more in-depth look at the submission process for contributing your first patch, read the [KernelNewbies First Kernel Patch tutorial][1].
|
||||
|
||||
### Contributing to the kernel
|
||||
|
||||
#### Step 1: Prepare your system.
|
||||
|
||||
Steps in this article assume you have the following tools on your system:
|
||||
|
||||
+ Text editor
|
||||
+ Email client
|
||||
+ Version control system (e.g., git)
|
||||
|
||||
#### Step 2: Download the Linux kernel code repository`:`
|
||||
```
|
||||
git clone -b staging-testing
|
||||
|
||||
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
|
||||
|
||||
```
|
||||
|
||||
### Copy your current config: ````
|
||||
```
|
||||
cp /boot/config-`uname -r`* .config
|
||||
|
||||
```
|
||||
|
||||
### Step 3: Build/install your kernel.
|
||||
```
|
||||
make -jX
|
||||
|
||||
sudo make modules_install install
|
||||
|
||||
```
|
||||
|
||||
### Step 4: Make a branch and switch to it.
|
||||
```
|
||||
git checkout -b first-patch
|
||||
|
||||
```
|
||||
|
||||
### Step 5: Update your kernel to point to the latest code base.
|
||||
```
|
||||
git fetch origin
|
||||
|
||||
git rebase origin/staging-testing
|
||||
|
||||
```
|
||||
|
||||
### Step 6: Make a change to the code base.
|
||||
|
||||
Recompile using `make` command to ensure that your change does not produce errors.
|
||||
|
||||
### Step 7: Commit your changes and create a patch.
|
||||
```
|
||||
git add <file>
|
||||
|
||||
git commit -s -v
|
||||
|
||||
git format-patch -o /tmp/ HEAD^
|
||||
|
||||
```
|
||||
|
||||
![](https://opensource.com/sites/default/files/karnik_figure2.png)
|
||||
|
||||
The subject consists of the path to the file name separated by colons, followed by what the patch does in the imperative tense. After a blank line comes the description of the patch and the mandatory signed off tag and, lastly, a diff of your patch.
|
||||
|
||||
Here is another example of a simple patch:
|
||||
|
||||
![](https://opensource.com/sites/default/files/karnik_figure3.png)
|
||||
|
||||
Next, send the patch [using email from the command line][2] (in this case, Mutt): ``
|
||||
```
|
||||
mutt -H /tmp/0001-<whatever your filename is>
|
||||
|
||||
```
|
||||
|
||||
To know the list of maintainers to whom to send the patch, use the [get_maintainer.pl script][11].
|
||||
|
||||
|
||||
### What to know before submitting your first patch
|
||||
|
||||
* [Greg Kroah-Hartman][3]'s [staging tree][4] is a good place to submit your [first patch][1] as he accepts easy patches from new contributors. When you get familiar with the patch-sending process, you could send subsystem-specific patches with increased complexity.
|
||||
|
||||
* You also could start with correcting coding style issues in the code. To learn more, read the [Linux kernel coding style documentation][5].
|
||||
|
||||
* The script [checkpatch.pl][6] detects coding style errors for you. For example, run:
|
||||
```
|
||||
perl scripts/checkpatch.pl -f drivers/staging/android/* | less
|
||||
|
||||
```
|
||||
|
||||
* You could complete TODOs left incomplete by developers:
|
||||
```
|
||||
find drivers/staging -name TODO
|
||||
```
|
||||
|
||||
* [Coccinelle][7] is a helpful tool for pattern matching.
|
||||
|
||||
* Read the [kernel mailing archives][8].
|
||||
|
||||
* Go through the [linux.git log][9] to see commits by previous authors for inspiration.
|
||||
|
||||
* Note: Do not top-post to communicate with the reviewer of your patch! Here's an example:
|
||||
|
||||
**Wrong way:**
|
||||
|
||||
Chris,
|
||||
_Yes let’s schedule the meeting tomorrow, on the second floor._
|
||||
> On Fri, Apr 26, 2013 at 9:25 AM, Chris wrote:
|
||||
> Hey John, I had some questions:
|
||||
> 1\. Do you want to schedule the meeting tomorrow?
|
||||
> 2\. On which floor in the office?
|
||||
> 3\. What time is suitable to you?
|
||||
|
||||
(Notice that the last question was unintentionally left unanswered in the reply.)
|
||||
|
||||
**Correct way:**
|
||||
|
||||
Chris,
|
||||
See my answers below...
|
||||
> On Fri, Apr 26, 2013 at 9:25 AM, Chris wrote:
|
||||
> Hey John, I had some questions:
|
||||
> 1\. Do you want to schedule the meeting tomorrow?
|
||||
_Yes tomorrow is fine._
|
||||
> 2\. On which floor in the office?
|
||||
_Let's keep it on the second floor._
|
||||
> 3\. What time is suitable to you?
|
||||
_09:00 am would be alright._
|
||||
|
||||
(All questions were answered, and this way saves reading time.)
|
||||
|
||||
* The [Eudyptula challenge][10] is a great way to learn kernel basics.
|
||||
|
||||
|
||||
To learn more, read the [KernelNewbies First Kernel Patch tutorial][1]. After that, if you still have any questions, ask on the [kernelnewbies mailing list][12] or in the [#kernelnewbies IRC channel][13].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/8/first-linux-kernel-patch
|
||||
|
||||
作者:[Sayli Karnik][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/sayli
|
||||
[1]:https://kernelnewbies.org/FirstKernelPatch
|
||||
[2]:https://opensource.com/life/15/8/top-4-open-source-command-line-email-clients
|
||||
[3]:https://twitter.com/gregkh
|
||||
[4]:https://www.kernel.org/doc/html/v4.15/process/2.Process.html
|
||||
[5]:https://www.kernel.org/doc/html/v4.10/process/coding-style.html
|
||||
[6]:https://github.com/torvalds/linux/blob/master/scripts/checkpatch.pl
|
||||
[7]:http://coccinelle.lip6.fr/
|
||||
[8]:linux-kernel@vger.kernel.org
|
||||
[9]:https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/
|
||||
[10]:http://eudyptula-challenge.org/
|
||||
[11]:https://github.com/torvalds/linux/blob/master/scripts/get_maintainer.pl
|
||||
[12]:https://kernelnewbies.org/MailingList
|
||||
[13]:https://kernelnewbies.org/IRC
|
@ -0,0 +1,186 @@
|
||||
9 flowchart and diagramming tools for Linux
|
||||
======
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_orgchart1.png?itok=tukiFj89)
|
||||
|
||||
Flowcharts are a great way to formalize the methodology for a new project. My team at work uses them as a tool in our brainstorming sessions and—once the ideation event wraps up—the flowchart becomes the project methodology (at least until someone changes it). My project methodology flowcharts are high-level and pretty straightforward—typically they contain just process, decision, and terminator objects—though they can be composed of many tens of these objects.
|
||||
|
||||
I work primarily in my Linux desktop environment, and most of my office colleagues use Windows. However, we're increasing our use of G Suite in part because it minimizes distractions related to our various desktop environments. Even so, I would prefer to find an open source tool—preferably a standalone app, rather than one that's part of another suite—that offers great support for flowcharts and is available on all the desktops our team uses.
|
||||
|
||||
It's been over four years since [Máirin Duffy reviewed Linux diagramming tools][1], so I decided to take a look at what's out there now for open source flowchart makers. I identified the following nine candidates:
|
||||
|
||||
| Candidate name | Linux desktop | Available for Windows? | Available for MacOS? |
|
||||
|-----------------------| --------------|------------------------|----------------------|
|
||||
| [Dia][2] | GNOME | Yes | Yes |
|
||||
| [LibreOffice Draw][3] | GNOME | Yes | Yes |
|
||||
| [Inkscape][4] | GNOME | Yes | Yes |
|
||||
| [Calligra Flow][5] | KDE | Preliminary | Preliminary |
|
||||
| [Diagramo][6] | Browser | Browser | Browser |
|
||||
| [Pencil][7] | ? | Yes | Yes |
|
||||
| [Graphviz][8] | CLI | Yes | Yes |
|
||||
| [Umbrello][9] | KDE | Yes | Yes |
|
||||
| [Draw.io][10] | Browser | Browser | Browser |
|
||||
|
||||
I'll share a bit of information about each below.
|
||||
|
||||
### Dia
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/flowcharting_dia.png)
|
||||
|
||||
I reviewed Dia 0.97.3 from the Ubuntu 18.04 repository; you can [download it here][2].
|
||||
|
||||
Dia is a standalone drawing tool. It offers some additional components, such as `dia-rib-network` for network diagrams and `dia2cod` for converting [UML][11] to code.
|
||||
|
||||
The installation process dragged in a few other packages, including: `dia-common`, `dia-shapes`, `gsfonts-x11`, `libpython-stdlib`, `python`, `python-cairo`, and `python-gobject2`.
|
||||
|
||||
[Dia's documentation][12] is quite thorough and available in English, German, French, Polish, and Basque. It includes information on related utilities; versions for Linux, Windows, and MacOS; a lot of stuff related to shapes; and much more. The bug tracker on the project's website is disabled, but bug reports are accepted on [GNOME Bugzilla][13].
|
||||
|
||||
Dia has complete support for making flowcharts—appropriate symbols, connectors, lots of connection points on objects, annotation for objects, etc. Even so, Dia's user experience (UX) feels unusual. For example, double-clicking on an object brings up properties and metadata, rather than the object's annotation; to edit annotation, you must select the object and click on Tools > Edit Text (or use the F2 key). The default text size, 22.68pt, or about 8mm, seems a bit weird. The text padding default is very large (0.50), and even when it's reduced by a factor of 10 (to 0.05), it still may leave a wide gap around the text (for example in the diamond decision object). You must also select the object before you can right-click on it. Cutting and pasting are somewhat limited—I couldn't copy text from my browser (with the standard Ctrl+C) and paste it into Dia. Dia launches ready to work with a multipage drawing, which is pretty handy if you need to make a 1x2 meter drawing and your printer accommodates only letter-size paper.
|
||||
|
||||
In general terms, performance is very snappy. Interaction can seem a bit odd (see above), but it doesn't require huge adjustments to get the hang of it. On the downside, the Help menu did not link properly to documentation, and I couldn't find a spell checker. Finally, from what I can tell, there is no active development on Dia.
|
||||
|
||||
### LibreOffice Draw
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/flowcharting_libreofficedraw.png)
|
||||
|
||||
I reviewed [LibreOffice Draw][3] version 6.0.4.2, which was installed by default on my Ubuntu 18.04 desktop.
|
||||
|
||||
Since LibreOffice Draw is part of the LibreOffice suite, the UX will be familiar to anyone who uses LibreOffice Writer, Calc, or Impress. However, if you are looking for a standalone flowcharting tool and don't already use LibreOffice, this is likely to be a large [install][14].
|
||||
|
||||
The application includes an extensive help facility that is accessible from the Help menu, and you can find a great deal of information by searching online.
|
||||
|
||||
LibreOffice Draw has a set of predefined flowchart shapes that support annotation as well as connectors. Connection points are limited—all the shapes I use have just four points. Draw's UX will feel familiar to LibreOffice users; for example, double-clicking an object opens the object's annotation. Text wraps automatically when its length exceeds the width of a text box. However, annotation entered in a drawing object does not wrap; you must manually break the lines. Default text size, spacing, etc. are reasonable and easily changed. Draw permits multiple pages (which are called slides), but it doesn't support multipage drawings as easily as Dia does.
|
||||
|
||||
In general terms, LibreOffice Draw provides good, basic flowcharting capability with no UX surprises. It performs well, at least on smaller flowcharts, and standard LibreOffice writing tools, such as spell check, are available.
|
||||
|
||||
### Inkscape
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/flowcharting_inkscape.png)
|
||||
|
||||
I reviewed [Inkscape][4] version 0.92.3 from the Ubuntu 18.04 repositories; you can [download it here][15].
|
||||
|
||||
Inkscape is a standalone tool, and it is waaaaaay more than a flowchart drawing utility.
|
||||
|
||||
The installation process dragged in several other packages, including: `fig2dev`, `gawk`, `libgtkspell0`, `libimage-magick-perl`, `libimage-magick-q16-perl`, `libmagick+±6.q16-7`, `libpotrace0`, `libsigsegv2`, `libwmf-bin`, `python-scour`, `python3-scour`, `scour`, and `transfig`.
|
||||
|
||||
There is a great deal of Inkscape documentation available, including the Inkscape Manual available from the Help menu. This [tutorial][16] made it easier to get started with my first Inkscape flowchart.
|
||||
|
||||
Getting my first rectangle on the screen was pretty straightforward with the Create Rectangles and Squares toolbar item. I changed the shape's background color by using the color swatches across the bottom of the screen. However, it seems text is separate from other objects, i.e., there doesn't appear to be a concept of geometric objects with annotation, so I created the text first, then added the surrounding object, and finally put in connectors. Default text sizes were odd (30pt, if I recall correctly) but you can change the default. Bottom line: I could make the diagram, but—based on what I could learn in a few minutes—it was more of a diagram than a flowchart.
|
||||
|
||||
In general terms, Inkscape is an extremely full-featured vector drawing program with a learning curve. It's probably not the best tool for users who just want to draw a quick flowchart. There seems to be a spell checker available, although I didn't try it.
|
||||
|
||||
### Calligra Flow
|
||||
|
||||
From [the Calligra website][5]:
|
||||
|
||||
> Calligra Flow is an easy to use diagramming and flowcharting application with tight integration to the other Calligra applications. It enables you to create network diagrams, organisation charts, flowcharts, and more.
|
||||
|
||||
I could not find Calligra Flow in my repositories. Because of that and its tight integration with Calligra, which is oriented toward KDE users, I decided not to review it now. Based on its website, it looks like it's geared toward flowcharting, which could make it a good choice if you're using KDE.
|
||||
|
||||
### Diagramo
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/flowcharting_diagramo.png)
|
||||
|
||||
I reviewed [Diagramo][6] build number 2.4.0-3c215561787f-2014-07-01, accessed through [Try It Now!][17] on the Diagramo website using the Firefox browser.
|
||||
|
||||
Diagramo is standalone, web-based flowcharting software. It claims to be pure HTML5 and GPL, but the [source code repository][18] states the code is available under the Apache License 2.0.
|
||||
|
||||
The tool is accessible through a web browser, so no installation is required. (I didn't download the source code and try to install it locally.)
|
||||
|
||||
I couldn't find any documentation for Diagramo. The application's Help button allows bug filing and turning on the debugger, and the build number is available under About.
|
||||
|
||||
Diagramo offers several collections of drawing objects: Basic, Experimental, Network, Secondary, and UML State Machine. I limited my testing to the Basic set, which contained enough objects for me. To create a chart, you drag objects from the menu on the left and drop them on the canvas. You can set the canvas size in the options panel on the right. Sizes are in pixels, which is OK, although I prefer to work in points. The default text attributes were: 12px, Arial font, center alignment, with options to underline and change the text color. You can see the attributes in a popup menu above the text by double-clicking the default annotation, which is set to Text. You have to manually break lines of text, similar to in LibreOffice Draw. Objects have multiple connection points (I counted 12 on the rectangles and five on the diamonds). Connectors are separate from shapes and appear in the top toolbar. I couldn't save my test flowchart to my computer.
|
||||
|
||||
In general terms, Diagramo provides good basic flowcharting capability with no UX surprises. It performs well, at least on smaller flowcharts, but doesn't seem to take advantage of Firefox's spell checker.
|
||||
|
||||
### Pencil
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/flowcharting_pencil.png)
|
||||
|
||||
I reviewed [Pencil][7] version 3.0.4, which I [downloaded][19] from the Pencil project website. I used `dpkg` to install the 64-bit .deb package file. It installed cleanly with no missing packages.
|
||||
|
||||
Pencil is a standalone drawing tool. Documentation and tutorials are available on [the project website][7].
|
||||
|
||||
To make my sample flowchart, I selected the flowchart shape set from the far-left menu panel. From there, I could drag Process, Decision, and Straight Connector shapes onto the page. I added annotation by double-clicking on the object and typing in the text. (Copy/paste also works.) You can drag the connector endpoints near the desired attachment point and they automatically attach. The default font setting (Arial, 12pt) is a good choice, but I couldn't find a spell check function.
|
||||
|
||||
In general, using Pencil is very simple and straightforward. It offers solid flowcharting capability with no UX surprises and performs well, at least on smaller flowcharts.
|
||||
|
||||
### Graphviz
|
||||
|
||||
According to the [Graphviz documentation][20]:
|
||||
|
||||
> The Graphviz layout programs take descriptions of graphs in a simple text language and make diagrams in useful formats, such as images and SVG for web pages; PDF or Postscript for inclusion in other documents; or display in an interactive graph browser. Graphviz has many useful features for concrete diagrams, such as options for colors, fonts, tabular node layouts, line styles, hyperlinks, and custom shapes.
|
||||
|
||||
I didn't do a full review of Graphviz. It looks like a very interesting package for converting text to graphical representations, and I might try it at some point. However, I don't see it as a good tool for people who are used to a more interactive UX. If you'd like to know more about it, [Stack Overflow][21] offers a quick overview of constructing a simple flowchart in Graphviz.
|
||||
|
||||
### Umbrello
|
||||
|
||||
I spotted [Umbrello][9] in my repositories, where I read:
|
||||
|
||||
> Umbrello UML Modeller is a Unified Modelling Language diagram editor for KDE. It can create diagrams of software and other systems in the industry-standard UML format, and can also generate code from UML diagrams in a variety of programming languages. This package is part of the KDE Software Development Kit module.
|
||||
|
||||
Because of its focus on UML rather than flowcharting and its KDE orientation, I decided to leave Umbrello to evaluate later.
|
||||
|
||||
### Draw.io
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/flowcharting_draw-io.png)
|
||||
|
||||
I reviewed [Draw.io][22] version 8.9.7, which I accessed through its website.
|
||||
|
||||
Draw.io is standalone, web-based drawing software, and a desktop version is available. Since it runs in the browser, there's no installation required.
|
||||
|
||||
[Documentation][23] is available on the Draw.io website.
|
||||
|
||||
Draw.io launches with a set of general flowchart drawing objects on the left and context-sensitive properties on the right. (It's reminiscent of the Properties window in LibreOffice.) Clicking on a shape makes it appear on the page. Text defaults to centered 12pt Helvetica. Double-clicking on the drawing object opens the annotation editor. Draw.io automatically splits long lines of text, but the splitting isn't perfect in the diamond object. Objects have a decent number of connection points (I count 12 on the rectangle and eight on the diamond). Similar to Google Draw, as objects are dragged around, alignment aids help square up the diagram. I saved my work to an .xml file on my computer, which is a cool option for a web-based service. Diagrams can also be shared.
|
||||
|
||||
In general terms, Draw.io provides solid flowcharting capability with no UX surprises, but no spell checker that I could find. It performs well, at least on smaller flowcharts, and the collaboration ability is nice.
|
||||
|
||||
### What's the verdict?
|
||||
|
||||
So, which of these flowcharting tools do I like best?
|
||||
|
||||
Bearing in mind that I was leaning toward a standalone tool that could operate on any desktop, Draw.io and Diagramo appealed to me for their simplicity and browser-based operation (which means no installation is necessary). I also really liked Pencil, although it must be installed.
|
||||
|
||||
Conversely, I felt Dia's UX was just a bit clunky and old-fashioned, although it certainly has great functionality.
|
||||
|
||||
LibreOffice Draw and Calligra Flow, due to their integration in their respective office suites, didn't achieve my goal for a standalone, lightweight tool.
|
||||
|
||||
Inkscape, Graphviz, and Umbrello seem like great tools in their own right, but trying to use them as simple, standalone flowchart creation tools seems like a real stretch.
|
||||
|
||||
Will any of these replace G Suite's drawing capability in our office? I think Draw.io, Diagramo and Pencil could. We shall see!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/8/flowchart-diagramming-linux
|
||||
|
||||
作者:[Chris Hermansen][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/clhermansen
|
||||
[1]:https://opensource.com/life/14/6/tools-diagramming-fedora
|
||||
[2]:http://dia-installer.de/
|
||||
[3]:https://www.libreoffice.org/discover/draw/
|
||||
[4]:https://inkscape.org/en/
|
||||
[5]:https://www.calligra.org/flow/
|
||||
[6]:http://diagramo.com/
|
||||
[7]:https://pencil.evolus.vn/
|
||||
[8]:http://graphviz.org/
|
||||
[9]:https://umbrello.kde.org/
|
||||
[10]:https://about.draw.io/about-us/
|
||||
[11]:https://en.wikipedia.org/wiki/Unified_Modeling_Language
|
||||
[12]:http://dia-installer.de/doc/index.html.en
|
||||
[13]:https://bugzilla.gnome.org/query.cgi?format=specific&product=dia&bug_status=__all__
|
||||
[14]:https://www.libreoffice.org/download/download/
|
||||
[15]:https://inkscape.org/en/release/0.92.3/
|
||||
[16]:http://goinkscape.com/create-beautiful-diagrams-in-inkscape/
|
||||
[17]:http://diagramo.com/editor/editor.php
|
||||
[18]:https://bitbucket.org/scriptoid/diagramo/src/33c88ca45ee942bf0b16f19879790c361fc9709d/LICENSE.txt?at=default&fileviewer=file-view-default
|
||||
[19]:https://pencil.evolus.vn/Downloads.html
|
||||
[20]:https://graphviz.gitlab.io/documentation/
|
||||
[21]:https://stackoverflow.com/questions/46365855/create-simple-flowchart-with-graphviz
|
||||
[22]:http://Draw.io
|
||||
[23]:https://about.draw.io/tag/user-documentation/
|
@ -0,0 +1,106 @@
|
||||
How To Switch Between TTYs Without Using Function Keys In Linux
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/08/Switch-Between-TTYs-720x340.png)
|
||||
|
||||
This brief guide describes how to switch between TTYs without function keys in Unix-like operating systems. Before going further, we will see what TTY is. As mentioned in an [**answer**][1] in AskUbuntu forum, the word **TTY** came from **T** ele **TY** pewriter. Back in the early days of Unix, the user terminals connected to computers were electromechanical teleprinters or teletypewriters( tty in short). Since then, the name TTY has continued to be used for text-only consoles. Nowadays, all text consoles represents virtual consoles, not physical consoles. The TTY command prints the file name of the terminal connected to standard input.
|
||||
|
||||
### Switch Between TTYs In Linux
|
||||
|
||||
By default, there are 7 ttys in Linux. They are known as tty1, tty2….. tty7. The 1 to 6 ttys are command line only. The 7th tty is GUI (your X desktop session). You can switch between different TTYs by using **CTRL+ALT+Fn** keys. For example to switch to tty1, we type CTRL+ALT+F1. This is how tty1 looks in Ubuntu 18.04 LTS server.
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/08/tty1.png)
|
||||
|
||||
If your system has no X session,
|
||||
|
||||
In some Linux editions (Eg. from Ubuntu 17.10 onwards), the login screen now uses virtual console 1 . So, you need to press CTRL+ALT+F3 up to CTRL+ALT+F6 for accessing the virtual consoles. To go back to desktop environment, press CTRL+ALT+F2 or CTRL+ALT+F7 on Ubuntu 17.10 and later.
|
||||
|
||||
What we have seen so far is we can easily switch between TTYs using CTRL+ALT+Function_Key(F1-F7). However, if you don’t want to use the functions keys for any reason, there is a simple command named **“chvt”** in Linux.
|
||||
|
||||
The “chvt N” command allows you to switch to foreground terminal N, the same as pressing CTRL+ALT+Fn. The corresponding screen is created if it did not exist yet.
|
||||
|
||||
Let us see print the current tty:
|
||||
```
|
||||
$ tty
|
||||
|
||||
```
|
||||
|
||||
Sample output from my Ubuntu 18.04 LTS server.
|
||||
|
||||
Now let us switch to tty2. To do so, type:
|
||||
```
|
||||
$ sudo chvt 2
|
||||
|
||||
```
|
||||
|
||||
Remember you need to use “sudo” with chvt command.
|
||||
|
||||
Now, check the current tty using command:
|
||||
```
|
||||
$ tty
|
||||
|
||||
```
|
||||
|
||||
You will see that the tty has changed now.
|
||||
|
||||
Similarly, you can switch to tty3 using “sudo chvt 3”, tty4 using “sudo chvt 4” and so on.
|
||||
|
||||
Chvt command can be useful when any one of your function keys doesn’t work.
|
||||
|
||||
To view the total number of active virtual consoles, run:
|
||||
```
|
||||
$ fgconsole
|
||||
2
|
||||
|
||||
```
|
||||
|
||||
As you can see, there are two active VTs in my system.
|
||||
|
||||
You can see the next unallocated virtual terminal using command:
|
||||
```
|
||||
$ fgconsole --next-available
|
||||
3
|
||||
|
||||
```
|
||||
|
||||
A virtual console is unused if it is not the foreground console, and no process has it open for reading or writing, and no text has been selected on its screen.
|
||||
|
||||
To get rid of unused VTs, just type:
|
||||
```
|
||||
$ deallocvt
|
||||
|
||||
```
|
||||
|
||||
The above command deallocates kernel memory and data structures for all unused virtual consoles. To put this simply, this command will free all resources connected to the unused virtual consoles.
|
||||
|
||||
For more details, refer the respective command’s man pages.
|
||||
```
|
||||
$ man tty
|
||||
|
||||
$ man chvt
|
||||
|
||||
$ man fgconsole
|
||||
|
||||
$ man deallocvt
|
||||
|
||||
```
|
||||
|
||||
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-switch-between-ttys-without-using-function-keys-in-linux/
|
||||
|
||||
作者:[SK][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.ostechnix.com/author/sk/
|
||||
[1]:https://askubuntu.com/questions/481906/what-does-tty-stand-for
|
@ -1,65 +1,65 @@
|
||||
逃离 Google,重获自由(与君共勉)
|
||||
============================================================
|
||||
======
|
||||
|
||||
原名:How I Fully Quit Google (And You Can, Too)
|
||||
|
||||
>寻求挣脱科技巨头的一次开创性尝试
|
||||
> 寻求挣脱科技巨头的一次开创性尝试
|
||||
|
||||
在过去的六个月里,难以想象我到底经历了些什么。时间密集,启发性质的探索,最终换来的只是完全摒弃一家公司——Google(谷歌)——的产品。本该是件简简单单的任务,但真要去做,花费在研究和测试上的又何止几个小时。但我成功了。现在,我已经不需要 Google 了,作为西方世界中极其少数的群体中的一份子,不再使用世界上最有价值的两家科技公司的产品(是的,我也不用 [Facebook(脸书)][6])。
|
||||
在过去的六个月里,难以想象我到底经历了些什么。艰难的、时间密集的、启发性的探索,为的只是完全摒弃一家公司 —— Google(谷歌)—— 的产品。本该是件简简单单的任务,但真要去做,花费在研究和测试上的又何止几个小时。但我成功了。现在,我已经不需要 Google 了,作为西方世界中极其少数的群体中的一份子,不再使用世界上最有价值的两家科技公司的产品(是的,我也不用 [Facebook(脸书)][6])。
|
||||
|
||||
本篇指南将向你展示我逃离 Google 生态的始末。以及根据本人的研究和个人需求,选择的替代方案。我不是技术方面的专家,或者说程序员,但作为记者,我的工作要求我对安全和隐私的问题保持关注。
|
||||
本篇指南将向你展示我逃离 Google 生态的始末。以及根据本人的研究和个人需求,选择的替代方案。我不是技术方面的专家,或者说程序员,但作为记者,我的工作要求我对安全和隐私的问题保持警惕。
|
||||
|
||||
我选择替代方案时,主要考察其本身的长处、可用性、成本、以及是否具备我需要的功能。我的选择并不是那么大众,仅反映我自身的需求和期许,也不牵涉任何商业利益。下面列出的所有替代方案都没有给我赞助,也从未试图花钱诱使我使用他们的服务。
|
||||
|
||||
### 首先我们需要知道:为什么?
|
||||
|
||||
你们说这事情整的,我和 Google 可无冤无仇。事实上,不久前我还是个忠实的 Google 粉。还是记得是 90 年代末,当时我还在读高中,我和 Google 搜索引擎的第一次邂逅,那一瞬的美简直惊为天人。那时候的 Google 可比 Yahoo、Altavista、Ask Jeeves 等公司前卫了好几年。实打实的去帮用户找到他们想在网络上找的东西,但同样是那个时代,乌七八糟的网站和糟糕的索引遍地横生。
|
||||
你们说这事情整的,我和 Google 可无冤无仇。事实上,不久前我还是个忠实的 Google 粉。还是记得是 90 年代末,当时我还在读高中,我和 Google 搜索引擎的第一次邂逅,那一瞬的美简直惊为天人。那时候的 Google 可是领先了 Yahoo、Altavista、Ask Jeeves 这些公司好几年。Google 实打实地去帮用户找到他们想在网络上找的东西,但同样是那个时代,乌七八糟的网站和糟糕的索引遍地横生。
|
||||
|
||||
Google 很快就从仅提供检索服务转向提供其他服务,其中的许多都是我欣然拥抱的服务。早在 2005 年,当时你们可能还只能 [通过邀请][7] 加入 Gmail 的时候,我就已经是早期使用者了。Gmail 采用了线程对话、归档、标签,毫无疑问是我使用过的最好的电子邮件服务。 当 Google 在 2006 年推出其日历工具时,那种对操作的改进绝对是革命性的。针对不同日历使用不同的颜色进行编排、检索事件、以及发送可共享的邀请,操作极其简单。2007 年登陆的 Google Docs 同样令人惊叹。在我的第一份全职工作期间,我还促成我们团队使用支持多人同时编辑的 Google 电子表格、文档和演示文稿来完成我们的日常工作。
|
||||
Google 很快就从仅提供检索服务转向提供其它服务,其中许多都是我欣然拥抱的服务。早在 2005 年,当时你们可能还只能[通过邀请][7]加入 Gmail 的时候,我就已经是早期使用者了。Gmail 采用了线程对话、归档、标签,毫无疑问是我使用过的最好的电子邮件服务。当 Google 在 2006 年推出其日历工具时,那种对操作的改进绝对是革命性的。针对不同日历使用不同的颜色进行编排、检索事件、以及发送可共享的邀请,操作极其简单。2007 年推出的 Google Docs 同样令人惊叹。在我的第一份全职工作期间,我还促成我们团队使用支持多人同时编辑的 Google 电子表格、文档和演示文稿来完成日常工作。
|
||||
|
||||
和许多人样,我也是 Google 开疆拓土过程中的受害者。从搜索(引擎)到电子邮件、文档、分析、再到照片,许多其他服务都建立在彼此之上,相互勾连。Google 从一家发布实用产品的公司转变成诱困用户公司,于此同时将整个互联网,转变为牟利和数据采集的设备。Google 在我们的数字生活中几乎无处不在,这种程度的存在远非其他公司可以比拟。与之相比使用其他科技巨头的产品想要抽身就相对容易。对于 Apple(苹果),你要么身处 iWorld 之中,要么是局外人。亚马逊亦是如此,甚至连 Facebook 也不过是拥有少数的几个平台,不用(Facebook)更多的是 [心理挑战][8] 实际上并没有多么困难。
|
||||
和许多人样,我也是 Google 开疆拓土过程中的受害者。从搜索(引擎)到电子邮件、文档、分析、再到照片,许多其它服务都建立在彼此之上,相互勾连。Google 从一家发布实用产品的公司转变成诱困用户公司,与此同时将整个互联网转变为牟利和数据采集的机器。Google 在我们的数字生活中几乎无处不在,这种程度的存在远非其他公司可以比拟。与之相比使用其他科技巨头的产品想要抽身就相对容易。对于 Apple(苹果),你要么身处 iWorld 之中,要么是局外人。亚马逊亦是如此,甚至连 Facebook 也不过是拥有少数的几个平台,不用(Facebook)更多的是[心理挑战][8],实际上并没有多么困难。
|
||||
|
||||
然而,Google 无处不在。 无论是笔记本电脑、智能手机或者平板电脑,我猜之中至少会有那么一个 Google 的应用程序。在大多数智能手机上,Google 就是搜索(引擎)、地图、电子邮件、浏览器和操作系统的代名词。甚至还有些应用有赖于其提供的 “[服务][9]” 和分析,比方说 Uber 便需要采用 Google Maps 来运营其乘车服务。
|
||||
然而,Google 无处不在。无论是笔记本电脑、智能手机或者平板电脑,我猜其中至少会有那么一个 Google 的应用程序。Google 就是搜索(引擎)、地图、电子邮件、浏览器和大多数智能手机操作系统的代名词。甚至还有些应用有赖于其提供的“[服务][9]”和分析,比方说 Uber 便需要采用 Google Maps 来运营其乘车服务。
|
||||
|
||||
Google 现在俨然已是许多语言中的单词,但彰显其超然全球统治地位的方面显然不止于此。可以说只要你不是极其注重个人隐私,那其庞大而成套的工具几乎没有多少众所周知或广泛使用的替代品。这恰好也是大家选择 Google 的原因,在很多方面能更好的替代现有的产品。但现在,使我们的难以割舍的主要原因其实是 Google 已经成为了默认选择,或者说由于其主导地位导致替代品无法对我们构成足够的吸引。
|
||||
|
||||
事实上,替代方案是存在的,这些年自 Edward Snowden(爱德华·斯诺登)披露 Google 涉事 [Prism(棱镜)][10] 以来,又陆续涌现了许多替代品。我从去年年底开始着手这个项目。经过六个月的研究,测试以及大量的尝试和失败,我终于找到了所有我正在使用的 Google 产品对应的注重个人隐的私替代品。令我感到吃惊的是,其中的一些替代品比 Google 的做的还要好。
|
||||
事实上,替代方案是存在的,这些年自 Edward Snowden(爱德华·斯诺登)披露 Google 涉事 [Prism(棱镜)][10]以来,又陆续涌现了许多替代品。我从去年年底开始着手这个项目。经过六个月的研究、测评以及大量的尝试和失败,我终于找到了所有我正在使用的 Google 产品对应的注重个人隐私的替代品。令我感到吃惊的是,其中的一些替代品比 Google 的做的还要好。
|
||||
|
||||
### 一些注意事项
|
||||
|
||||
过程中需要面临的几个挑战的之一便是,大多数的替代方案,特别是那些隐私空间开源的替代方案,确实对用户不太友好。我不是技术人员,但是自己有一个网站,了解如何管理 Wordpress,可以排除一些基本的故障,但我用不来命令行,也做不来任何需要编码的事。
|
||||
过程中需要面临的几个挑战之一便是,大多数的替代方案,特别是那些注重隐私空间的开源替代方案,确实对用户不太友好。我不是技术人员,但是自己有一个网站,了解如何管理 Wordpress,可以排除一些基本的故障,但我用不来命令行,也做不来任何需要编码的事。
|
||||
|
||||
提供的这些替代方案中的大多数,即便不能完整替代 Google 产品的功能,但至少可以轻松上手。不过有些还有需要你有自己的 Web 主机或服务器的。
|
||||
提供的这些替代方案中的大多数,即便不能完整替代 Google 产品的功能,但至少可以轻松上手。不过有些还是需要你有自己的 Web 主机或服务器的。
|
||||
|
||||
此外,[Google Takeout][11] 是你的好棒手。我通过它下载了我所有的电子邮件历史记录,并将其上传到我的计算机上,再通过 Thunderbird 访问,这意味着我可以轻松访问这十年间的电子邮件。关于日历还有文档也同样如此,我将后者转换为 ODT 格式,存在我的替代云上,下面我将进一步介绍其中的细节。
|
||||
此外,[Google Takeout][11] 是你的好帮手。我通过它下载了我所有的电子邮件历史记录,并将其上传到我的计算机上,再通过 Thunderbird 访问,这意味着我可以轻松访问这十几年的电子邮件。关于日历和文档也同样如此,我将后者转换为 ODT 格式,存在我的替代云上,下面我将进一步介绍其中的细节。
|
||||
|
||||
### 初级
|
||||
|
||||
#### 搜索引擎
|
||||
|
||||
[DuckDuckGo][12] 和 [startpage][13] 都是以保护个人隐私为中心的搜索引擎,不收集任何搜索数据。我用这两个搜索引擎来负责之前用 Google 检索的所有内容。
|
||||
[DuckDuckGo][12] 和 [startpage][13] 都是以保护个人隐私为中心的搜索引擎,不收集任何搜索数据。我用这两个搜索引擎来负责之前用 Google 搜索的所有需求。
|
||||
|
||||
其他的替代方案:实际上并不多, Google 坐拥全球 74% 的市场份额时,剩下的那些主要是因为中国的封锁。不过还有 Ask.com,以及 Bing……
|
||||
其它的替代方案:实际上并不多,Google 坐拥全球 74% 的市场份额时,剩下的那些主要是因为中国的封锁。不过还有 Ask.com,以及 Bing……
|
||||
|
||||
#### Chrome
|
||||
|
||||
[Mozilla Firefox][14] — 近期的 [一次大升级][15],是对早期版本的巨大改进。是一个由积极致力于保护隐私的非营利基金会打造的浏览器。它的存在让你觉得没有必要死守 Chrome。
|
||||
[Mozilla Firefox][14] —— 近期的[一次大升级][15],是对早期版本的巨大改进。是一个由积极致力于保护隐私的非营利基金会打造的浏览器。它的存在让你觉得没有必要死守 Chrome。
|
||||
|
||||
其他的替代方案:考虑到 Opera 和 Vivaldi 都基于 Chrome。[Brave][16] 浏览器是我的第二选择。
|
||||
其它的替代方案:考虑到 Opera 和 Vivaldi 都基于 Chrome。[Brave][16] 浏览器是我的第二选择。
|
||||
|
||||
#### Hangouts(环聊) 和 Google Chat
|
||||
#### Hangouts(环聊)和 Google Chat
|
||||
|
||||
[Jitsi Meet][17] — 一款 Google Hangouts 的开源免费替代方案。你可以直接在浏览器上使用或下载应用程序。快速,安全,几乎适用于所有平台。
|
||||
[Jitsi Meet][17] —— 一款 Google Hangouts 的开源免费替代方案。你可以直接在浏览器上使用或下载应用程序。快速,安全,几乎适用于所有平台。
|
||||
|
||||
其他的替代方案:Zoom 在专业领域受到欢迎,但大部分的特性需要付费。[Signal][18],一个开源、安全的用于发消息的应用程序,可以用来打电话,不过仅限于移动设备。不推荐 Skype,既耗流量,界面还糟。
|
||||
其它的替代方案:Zoom 在专业领域渐受青睐,但大部分的特性需要付费。[Signal][18],一个开源、安全的消息通讯类应用程序,可以用来打电话,不过仅限于移动设备。不推荐 Skype,既耗流量,界面还糟。
|
||||
|
||||
#### Google Maps(地图)
|
||||
|
||||
桌面端:[HERE WeGo][19] — 加载速度更快,所有你能在 Google Maps 找到的你几乎都能找到。不过由于某些原因,还缺了一些国家,如日本。
|
||||
桌面端:[HERE WeGo][19] —— 加载速度更快,所有能在 Google Maps 找到的几乎都能找到。不过由于某些原因,还缺了一些国家,如日本。
|
||||
|
||||
移动端:[MAPS.ME][20] — 我一开始用的就是这款地图,但是这款 APP 的导航模式有点鸡肋。MAPS.ME 还是相当不错的,并且具有比 Google 更好的离线功能,这对像我这样的经常旅行的人来说非常好用。
|
||||
移动端:[MAPS.ME][20] —— 我一开始用的就是这款地图,但是自从他们专注于导航模式后地图功能就有点鸡肋了。MAPS.ME 还是相当不错的,并且具有比 Google 更好的离线功能,这对像我这样的经常旅行的人来说非常好用。
|
||||
|
||||
其他的替代方案:[OpenStreetMap][21] 是我全面支持的一个项目,不过功能严重缺乏。甚至无法找到我在奥克兰的家庭住址。
|
||||
其它的替代方案:[OpenStreetMap][21] 是我全心支持的一个项目,不过功能严重缺乏。甚至无法找到我在奥克兰的家庭住址。
|
||||
|
||||
### 初级(需付费)
|
||||
|
||||
@ -67,152 +67,150 @@ Google 现在俨然已是许多语言中的单词,但彰显其超然全球统
|
||||
|
||||
请记住,虽说 Google 的许多服务都是免费的(更不必说包括 Facebook 在内的竞争对手的服务),那是因为他们正在积极地将我们的数据货币化。由于替代方案极力避免将数据货币化,这使他们不得不向我们收取费用。我愿意付钱来保护我的隐私,但也明白并非所有人都会做出这样的选择。
|
||||
|
||||
或许我们可以换一个方向来思考:可还曾记得以前寄信时也不得不支付邮票的费用吗?或者从商店购买周卡会员?从本质上讲,这就是使用以隐私为重的电子邮件或日历应用程序的成本。也没那么糟。
|
||||
或许我们可以换一个方向来思考:可还曾记得以前寄信时也不得不支付邮票的费用吗?或者从商店购买周卡会员?从本质上讲,这就是使用注重隐私的电子邮件或日历应用程序的成本。也没那么糟。
|
||||
|
||||
#### Gmail
|
||||
|
||||
[ProtonMail][22] — 由前 CERN(欧洲核子研究中心)的科学家创立,总部设在瑞士,一个拥有强大隐私保护的国家。 但 ProtonMail 真正吸引我的地方是,它与大多数其他注重隐私的电子邮件程序不同,用户体验友好。界面类似于 Gmail,带标签,有过滤器和文件夹,无需了解任何有关安全性或隐私的信息即可使用。
|
||||
[ProtonMail][22] —— 由前 CERN(欧洲核子研究中心)的科学家创立,总部设在瑞士,一个拥有强大隐私保护的国家。但 ProtonMail 真正吸引我的地方是,它与大多数其它注重隐私的电子邮件程序不同,用户体验友好。界面类似于 Gmail,带标签,有过滤器和文件夹,无需了解任何有关安全性或隐私的信息即可使用。
|
||||
|
||||
免费版只提供 500MB 的存储空间。而我选择的是付费 5GB 帐户及其 VPN 服务。
|
||||
|
||||
其他的替代方案:[Fastmail][23] 不仅面向注重隐私的用户,界面也很棒。还有 [Hushmail][24] 和 [Tutanota][25],两者都具有与 ProtonMail 相似的功能。
|
||||
其它的替代方案:[Fastmail][23] 不仅面向注重隐私的用户,界面也很棒。还有 [Hushmail][24] 和 [Tutanota][25],两者都具有与 ProtonMail 相似的功能。
|
||||
|
||||
#### Calendar(日历)
|
||||
|
||||
[Fastmail][26] 日历 — 这个决定异常艰难,也抛出了另一个问题。Google 的产品的存在在很多方面,可以用无处不在来形容,这导致初创公司甚至不再费心去创造替代品。在尝试了其他一些平庸的选项后,我最后还是推荐并选择 Fastmail 同时作为备用电子邮件和日历的选项。
|
||||
[Fastmail][26] 日历 —— 这个决定异常艰难,也抛出了另一个问题。Google 的产品存在于很多方面,可以用无处不在来形容,这导致初创公司甚至不再费心去创造替代品。在尝试了其它一些平庸的选项后,我最后还是推荐并选择 Fastmail 同时作为备用电子邮件和日历的选项。
|
||||
|
||||
### 进阶
|
||||
|
||||
这些需要一些技术知识,或者需要你自身具备 Web 主机。我尝试研究过更简单的替代方案,但最终都没能入围。
|
||||
这些需要一些技术知识,或者需要你自己有 Web 主机。我尝试研究过更简单的替代方案,但最终都没能入围。
|
||||
|
||||
#### Google Docs(文档)、Drive(云端硬盘)、Photos(照片)和 Contacts(联系人)
|
||||
|
||||
[Nextcloud][27] — 一个功能齐全、安全并且开源的云套件,具有直观、用户友好的界面。问题是你需要自己有主机才能使用 Nextcloud。我拥有一个用于部署自己网站的主机,并且能够使用 Softaculous 在我的主机的 C-Panel 上快速安装 Nextcloud。你需要一个 HTTPS 证书,我从 [Let's Encrypt][28] 上免费获得了一个。不似开通 Google Drive 帐户那般容易,但也不是很难。
|
||||
[Nextcloud][27] —— 一个功能齐全、安全并且开源的云套件,具有直观、友好的用户界面。问题是你需要自己有主机才能使用 Nextcloud。我有一个用于部署自己网站的主机,并且能够使用 Softaculous 在我主机的 C-Panel 上快速安装 Nextcloud。你需要一个 HTTPS 证书,我从 [Let's Encrypt][28] 上免费获得了一个。不似开通 Google Drive 帐户那般容易,但也不是很难。
|
||||
|
||||
我也同时在用 Nextcloud 作为 Google 的照片存储和联系人的替代方案,然后通过 CalDev 与手机同步。
|
||||
同时我也在用 Nextcloud 作为 Google 的照片存储和联系人的替代方案,然后通过 CalDev 与手机同步。
|
||||
|
||||
其他的替代方案:还有其他开源选项,如 [ownCloud][29] 或者 [Openstack][30]。一些营利的选项也很不错,因为作为首选的 Dropbox 和 Box 也没有采用从你的数据中牟利的运营模式。
|
||||
其它的替代方案:还有其它开源选项,如 [ownCloud][29] 或者 [Openstack][30]。一些营利的选项也很不错,因为作为首选的 Dropbox 和 Box 也没有采用从你的数据中牟利的运营模式。
|
||||
|
||||
#### Google Analytics(分析)
|
||||
|
||||
[Matomo][31] — 正式名为 Piwic,这是一个自托管的分析平台。虽然不像 Google 分析那样功能丰富,但可以很好地理解基本的网站流量,还有一个额外的好处,就是你无需为 Google 贡献流量数据了。
|
||||
[Matomo][31] —— 正式名为 Piwic,这是一个自托管的分析平台。虽然不像 Google 分析那样功能丰富,但可以很好地分析基本的网站流量,还有一个额外的好处,就是你无需为 Google 贡献流量数据了。
|
||||
|
||||
其他的替代方案:真的不多。[OpenWebAnalytics][32] 是另一个开源选项,还有一些营利性的选择,比如 GoStats 和 Clicky。
|
||||
其它的替代方案:真的不多。[OpenWebAnalytics][32] 是另一个开源选择,还有一些营利性的选择,比如 GoStats 和 Clicky。
|
||||
|
||||
#### Android(安卓)
|
||||
|
||||
[LineageOS][33] + [F-Droid App Store][34]。可悲的是,智能手机世界已成为一个字面上的双头垄断,Google 的 Android 和 Apple 的 iOS 控制着整个市场。几年前存在的几个可用的替代品,如 Blackberry OS 或 Mozilla 的 Firefox OS,也已不再维护。
|
||||
[LineageOS][33] + [F-Droid App Store][34]。可悲的是,智能手机世界已成为一个事实上的双头垄断,Google 的 Android 和 Apple 的 iOS 控制着整个市场。几年前存在的几个可用的替代品,如 Blackberry OS 或 Mozilla 的 Firefox OS,也已不再维护。
|
||||
|
||||
因此,只能选择次一级的 Lineage OS:一款注重隐私的、开源的 Android 版本,独立于 Google 服务及 APP,可单独安装。需要一些技术知识,因为安装的整个过程并不是那么一帆风顺,但运行状况良好,且不似大多数 Android 那般有大量预置软件。
|
||||
因此,只能选择次一级的 Lineage OS:一款注重隐私的、开源的 Android 版本,Google 服务及 APP 是选装的。这需要懂一些技术知识,因为安装的整个过程并不是那么一帆风顺,但运行状况良好,且不似大多数 Android 那般有大量预置软件。
|
||||
|
||||
其他的替代方案:emmm... Windows 10 Mobile? [PureOS][35] 看起来有那么点意思,[UbuntuTouch][36] 也差不多。
|
||||
其它的替代方案:呃…… Windows 10 Mobile?[PureOS][35] 看起来有那么点意思,[UbuntuTouch][36] 也差不多。
|
||||
|
||||
### 意想不到的挑战
|
||||
|
||||
首先,由于有关可用替代方案的优质资源匮乏,以及将数据从 Google 迁移到其他平台所面临的挑战,所以比我计划的时间要长许多。
|
||||
首先,由于有关可用替代方案的优质资源匮乏,以及将数据从 Google 迁移到其它平台所面临的挑战,所以比我计划的时间要长许多。
|
||||
|
||||
但最棘手的是电子邮件,这与 ProtonMail 或 Google 无关。
|
||||
|
||||
在我 2004 年加入 Gmail 之前,我可能每年都会切换一次电子邮件。我的第一个帐户是使用 Hotmail,然后我使用了 Mail.com,Yahoo Mail 以及像 Bigfoot 这样长期被遗忘的服务。当我在变更电子邮件提供商时,我未曾记得有这般麻烦。我会告诉所有朋友,更新他们的地址簿,并更改其他网络帐户的邮箱地址。以前定期更改邮箱地址非常必要——还记得曾几何时垃圾邮件是如何盘踞你旧收件箱的吗?
|
||||
在我 2004 年加入 Gmail 之前,我可能每年都会切换一次电子邮件。我的第一个帐户是使用 Hotmail,然后我使用了 Mail.com,Yahoo Mail 以及像 Bigfoot 这样被遗忘已久的服务。当我在变更电子邮件提供商时,我未曾记得有这般麻烦。我会告诉所有朋友,更新他们的地址簿,并更改其它网络帐户的邮箱地址。以前定期更改邮箱地址非常必要 —— 还记得曾几何时垃圾邮件是如何盘踞你旧收件箱的吗?
|
||||
|
||||
事实上,Gmail 最好的创新之一就是能够将垃圾邮件过滤掉。这意味着不需频繁更改邮箱地址。
|
||||
事实上,Gmail 最好的创新之一就是能够将垃圾邮件过滤掉。这意味着再也不用频繁更改邮箱地址了。
|
||||
|
||||
电子邮件是使用互联网的关键。你需要用它来开设 Facebook 帐户,使用网上银行,在留言板上发布等等。因此,当你决定切换帐户时,你就需要更新所有这些不同服务的邮箱地址。
|
||||
|
||||
令人惊讶的是,现在从 Gmail 迁出居然成为了最大的麻烦,因为遍地都需要通过邮箱地址来设置帐户。有几个站点不再允许你从后端执行此操作。有一些服务事实上就是让我注销现在的帐户,然后开通一个新的,只因他们无法更改我的邮箱地址,然后他们手动转移了我的帐户数据。另一些迫使我打电话给客户服务要求更改邮箱地址,无谓的浪费了很多时间。
|
||||
令人惊讶的是,现在从 Gmail 迁出居然成为了最大的麻烦,因为遍地都需要通过邮箱地址来设置帐户。有几个站点不再允许你从后台执行此操作。有个服务事实上就是让我注销现在的帐户,然后开通一个新的,只因他们无法更改我的邮箱地址,然后他们手动转移了我的帐户数据。另一些迫使我打电话给客服要求更改邮箱地址,无谓的浪费了很多时间。
|
||||
|
||||
更令人惊讶的是,另一些服务接受了我的更改,却仍继续向我原来的 Gmail 帐户发送邮件,就需要打一次电话了。另一些甚至更烦人,向我的新电子邮件发送了一些消息,但仍在使用我的旧帐户发送其他电子邮件。这事最后变得异常繁琐,迫使我不得不将我的 Gmail 帐户和我的新 ProtonMail 帐户一起开了几个月,以确保重要的电子邮件不会丢失。这是我花了六个月时间的主要元凶。
|
||||
更令人惊讶的是,另一些服务接受了我的更改,却仍继续向我原来的 Gmail 帐户发送邮件,就需要打一次电话了。另一些甚至更烦人,向我的新电子邮件发送了一些消息,但仍在使用我的旧帐户发送其它电子邮件。这事最后变得异常繁琐,迫使我不得不将我的 Gmail 帐户和我新的 ProtonMail 帐户同时开了几个月,以确保重要的电子邮件不会丢失。这是我花了六个月时间的主要元凶。
|
||||
|
||||
如今人们很少变更他们的邮箱地址,大多数公司的平台在设计时就没有考虑去处理这种可能性。这是表明当今网络糟糕状态的一个明显迹象,即便是在 2002 年更改邮箱地址都比 2018 年来的容易。技术也并不总是一成不变的向前发展。
|
||||
|
||||
### 那么,这些 Google 的替代方案都好用吗?
|
||||
|
||||
有些确实更好!Jitsi Meet 运行更顺畅,需要的带宽更少,并且比 Hangouts 更加平台友好。Firefox 比 Chrome 更稳定,占用的内存更少。Fastmail 的日历具有更好的时区集成。
|
||||
有些确实更好!Jitsi Meet 运行更顺畅,需要的带宽更少,并且比 Hangouts 跨平台支持好。Firefox 比 Chrome 更稳定,占用的内存更少。Fastmail 的日历具有更好的时区集成。
|
||||
|
||||
还有些旗鼓相当。ProtonMail 具有 Gmail 的大部分功能,但缺少一些好用的集成,例如我之前使用的 Boomerang 邮件调度程序。还缺少联系人界面,但我正在使用 Nextcloud。说到 Nextcloud,它非常适合托管文件,联系人,还包含了一个漂亮的笔记工具(以及诸多其他插件)。但它没有 Google Docs 丰富的多重编辑功能。在我的预算中,还没有找到可行的替代方案。虽然还有 Collabora Office,但这需要升级我的服务器,这对我来说不能算切实可行。
|
||||
还有些旗鼓相当。ProtonMail 具有 Gmail 的大部分功能,但缺少一些好用的集成,例如我之前使用的 Boomerang 邮件日程功能。还缺少联系人界面,但我正在使用 Nextcloud。说到 Nextcloud,它非常适合托管文件,联系人,还包含了一个漂亮的笔记工具(以及诸多其它插件)。但它没有 Google Docs 丰富的多人编辑功能。在我的预算中,还没有找到可行的替代方案。虽然还有 Collabora Office,但这需要升级我的服务器,这对我来说不能算切实可行。
|
||||
|
||||
一些取决于位置。在一些国家(如印度尼西亚),MAPS.ME 实际上比 Google 地图更好用,而在另一些国家(包括美国)就差了许多。
|
||||
|
||||
还有些人要求使用者牺牲一些特性或功能。Piwic 是一个穷人的 Google Analytics,缺乏前者的许多详细报告和搜索功能。DuckDuckGo 适用于一般搜索,但是在特定的搜索方面还存在问题,当我搜索非英文内容时,它和 startpage 时常都会检索失败。
|
||||
还有些要求用户牺牲一些特性或功能。Piwic 是一个穷人的 Google Analytics,缺乏前者的许多详细报告和搜索功能。DuckDuckGo 适用于一般搜索,但是在特定的搜索方面还存在问题,当我搜索非英文内容时,它和 startpage 时常都会检索失败。
|
||||
|
||||
### 最后,我不在心念 Google
|
||||
### 最后,我不再心念 Google
|
||||
|
||||
事实上,我感到自由。如此这般依赖单一公司的那么多产品是一种形式上奴役,特别是当你的数据经常为你买单的时候。而且,其中许多替代方案实际上更好。清楚自己正掌控自己数据的感觉真得很爽。
|
||||
事实上,我觉得我解放了。如此这般依赖单一公司的那么多产品是一种形式上奴役,特别是当你的数据经常为你买单的时候。而且,其中许多替代方案实际上更好。清楚自己正掌控自己数据的感觉真得很爽。
|
||||
|
||||
如果我们别无选择,只能使用 Google 的产品,那我们便失去了作为消费者的最后一丝力量。
|
||||
|
||||
我希望 Google,Facebook,Apple 和其他科技巨头在对待用户时不要这么理所当然,不要试图强迫我们进入其无所不包的生态系统。我也期待新选手能够出现并与之竞争,就像以前一样,Google 的新搜索工具可以与当时的行业巨头 Altavista 和 Yahoo 竞争,或者说 Facebook 的社交网络能够与 MySpace 和 Friendster 竞争。Google 给出了更好的搜索方案,使互联网变得更加美好。选择是个好东西。和便携性一样。
|
||||
我希望 Google,Facebook,Apple 和其他科技巨头在对待用户时不要这么理所当然,不要试图强迫我们进入其无所不包的生态系统。我也期待新选手能够出现并与之竞争,就像以前一样,Google 的新搜索工具可以与当时的行业巨头 Altavista 和 Yahoo 竞争,或者说 Facebook 的社交网络能够与 MySpace 和 Friendster 竞争。Google 给出了更好的搜索方案,使互联网变得更加美好。有选择是个好事,可移植也是。
|
||||
|
||||
如今,我们很少有人哪怕只是尝试其他产品,因为我们已经习惯了 Google。我们不再更改邮箱地址,因为这太难了。我们甚至不尝试使用 Facebook 以外的替代品,因为我们所有的朋友都在 Facebook 上。这些我明白。
|
||||
如今,我们很少有人哪怕只是尝试其它产品,因为我们已经习惯了 Google。我们不再更改邮箱地址,因为这太难了。我们甚至不尝试使用 Facebook 以外的替代品,因为我们所有的朋友都在 Facebook 上。这些我明白。
|
||||
|
||||
你不必完全脱离 Google。但最好给其他选择一个机会。到时候时你可能会感到惊讶,并想起那些年上网的初衷。
|
||||
你不必完全脱离 Google。但最好给其它选择一个机会。到时候时你可能会感到惊讶,并想起那些年上网的初衷。
|
||||
|
||||
* * *
|
||||
---
|
||||
|
||||
#### 其他资源
|
||||
### 其它资源
|
||||
|
||||
我并未打算让这篇文章成为包罗万象的指南,这只不过是一个关于我如何脱离 Google 的故事。以下的那些资源会向你展示其他替代方案。其中有一些对我来说过于专业,还有一些我还没有时间去探索。
|
||||
我并未打算让这篇文章成为包罗万象的指南,这只不过是一个关于我如何脱离 Google 的故事。以下的那些资源会向你展示其它替代方案。其中有一些对我来说过于专业,还有一些我还没有时间去探索。
|
||||
|
||||
* [Localization Lab][2] 一份开源或隐私技术的项目的详细清单 — 有些技术含量高,有些比较用户友好。
|
||||
* [Localization Lab][2] 一份开源或注重隐私技术的项目的详细清单 —— 有些技术含量高,有些用户友好度比较好。
|
||||
* [Framasoft][3] 有一整套针对 Google 的替代方案,大部分是开源的,虽然大部分是法语。
|
||||
* Restore Privacy 也[整理了一份替代方案的清单][4]。
|
||||
|
||||
* [Framasoft][3] 有一整套针对 Google 的替代方案,大部分是开源的,虽然大部分是法语。
|
||||
到你了。你可以直接回复或者通过 Twitter 来分享你喜欢的 Google 产品的替代方案。我确信我遗漏了许多,也非常乐意尝试。我并不打算一直固守我列出的这些方案。
|
||||
|
||||
* Restore Privacy 也 [整理了一份替代方案的清单][4].
|
||||
|
||||
到你了。你可以直接回复或者通过 Twitter 来分享你喜欢的 Google 制品的替代方案。我确信我遗漏了许多,也非常乐意尝试。我并不打算一直固守我列出的这些方案。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
---
|
||||
|
||||
作者简介:
|
||||
|
||||
Nithin Coca
|
||||
|
||||
自由撰稿人,涵盖政治,环境和人权以及全球科技的社会影响。 更多参考 http://www.nithincoca.com
|
||||
自由撰稿人,涵盖政治,环境和人权以及全球科技的社会影响。更多参考 http://www.nithincoca.com
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
---
|
||||
|
||||
via: https://medium.com/s/story/how-i-fully-quit-google-and-you-can-too-4c2f3f85793a
|
||||
|
||||
作者:[Nithin Coca][a]
|
||||
译者:[martin2011qi](https://github.com/martin2011qi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[pityonline](https://github.com/pityonline)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://medium.com/@excinit
|
||||
[1]:https://medium.com/@excinit
|
||||
[2]:https://www.localizationlab.org/projects/
|
||||
[3]:https://framasoft.org/?l=en
|
||||
[4]:https://restoreprivacy.com/google-alternatives/
|
||||
[5]:https://medium.com/@excinit
|
||||
[6]:https://www.nithincoca.com/2011/11/20/7-months-no-facebook/
|
||||
[7]:https://www.quora.com/How-long-was-Gmail-in-private-%28invitation-only%29-beta
|
||||
[8]:https://www.theverge.com/2018/4/28/17293056/facebook-deletefacebook-social-network-monopoly
|
||||
[9]:https://en.wikipedia.org/wiki/Google_Play_Services
|
||||
[10]:https://www.theguardian.com/world/2013/jun/06/us-tech-giants-nsa-data
|
||||
[11]:https://takeout.google.com/settings/takeout
|
||||
[12]:https://duckduckgo.com/
|
||||
[13]:https://www.startpage.com/
|
||||
[14]:https://www.mozilla.org/en-US/firefox/new/
|
||||
[15]:https://www.seattletimes.com/business/firefox-is-back-and-its-time-to-give-it-a-try/
|
||||
[16]:https://brave.com/
|
||||
[17]:https://jitsi.org/jitsi-meet/
|
||||
[18]:https://signal.org/
|
||||
[19]:https://wego.here.com/
|
||||
[20]:https://maps.me/
|
||||
[21]:https://www.openstreetmap.org/
|
||||
[22]:https://protonmail.com/
|
||||
[23]:https://www.fastmail.com/
|
||||
[24]:https://www.hushmail.com/
|
||||
[25]:https://tutanota.com/
|
||||
[26]:https://www.fastmail.com/
|
||||
[27]:https://nextcloud.com/
|
||||
[28]:https://letsencrypt.org/
|
||||
[29]:https://owncloud.org/
|
||||
[30]:https://www.openstack.org/
|
||||
[31]:https://matomo.org/
|
||||
[32]:http://www.openwebanalytics.com/
|
||||
[33]:https://lineageos.org/
|
||||
[34]:https://f-droid.org/en/
|
||||
[35]:https://puri.sm/posts/tag/pureos/
|
||||
[36]:https://ubports.com/
|
||||
[a]: https://medium.com/@excinit
|
||||
[1]: https://medium.com/@excinit
|
||||
[2]: https://www.localizationlab.org/projects/
|
||||
[3]: https://framasoft.org/?l=en
|
||||
[4]: https://restoreprivacy.com/google-alternatives/
|
||||
[5]: https://medium.com/@excinit
|
||||
[6]: https://www.nithincoca.com/2011/11/20/7-months-no-facebook/
|
||||
[7]: https://www.quora.com/How-long-was-Gmail-in-private-%28invitation-only%29-beta
|
||||
[8]: https://www.theverge.com/2018/4/28/17293056/facebook-deletefacebook-social-network-monopoly
|
||||
[9]: https://en.wikipedia.org/wiki/Google_Play_Services
|
||||
[10]: https://www.theguardian.com/world/2013/jun/06/us-tech-giants-nsa-data
|
||||
[11]: https://takeout.google.com/settings/takeout
|
||||
[12]: https://duckduckgo.com/
|
||||
[13]: https://www.startpage.com/
|
||||
[14]: https://www.mozilla.org/en-US/firefox/new/
|
||||
[15]: https://www.seattletimes.com/business/firefox-is-back-and-its-time-to-give-it-a-try/
|
||||
[16]: https://brave.com/
|
||||
[17]: https://jitsi.org/jitsi-meet/
|
||||
[18]: https://signal.org/
|
||||
[19]: https://wego.here.com/
|
||||
[20]: https://maps.me/
|
||||
[21]: https://www.openstreetmap.org/
|
||||
[22]: https://protonmail.com/
|
||||
[23]: https://www.fastmail.com/
|
||||
[24]: https://www.hushmail.com/
|
||||
[25]: https://tutanota.com/
|
||||
[26]: https://www.fastmail.com/
|
||||
[27]: https://nextcloud.com/
|
||||
[28]: https://letsencrypt.org/
|
||||
[29]: https://owncloud.org/
|
||||
[30]: https://www.openstack.org/
|
||||
[31]: https://matomo.org/
|
||||
[32]: http://www.openwebanalytics.com/
|
||||
[33]: https://lineageos.org/
|
||||
[34]: https://f-droid.org/en/
|
||||
[35]: https://puri.sm/posts/tag/pureos/
|
||||
[36]: https://ubports.com/
|
||||
|
@ -0,0 +1,46 @@
|
||||
开源网络工作: 创新与机遇的温床
|
||||
======
|
||||
|
||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/os-jobs-networking.jpg?itok=PgUzydn-)
|
||||
|
||||
随着全球经济更加靠近数字化未来,每个垂直行业的公司和组织都在紧抓如何进一步在业务与运营上整合与部署技术。虽然 IT 企业在很大程度上遥遥领先,但是他们的经验与教训已经应用在了各行各业。尽管全国失业率为 4.1%,但整个科技专业人员的整体的失业率在 4 月份为 1.9%,开源工作的未来看起来尤其光明。我在开源网络领域工作,并且目睹着创新和机遇正在改变世界交流的方式。
|
||||
|
||||
曾经是个发展缓慢的行业,现在由网络运营商、供应商、系统集成商和开发者所组成的网络生态系统正在采用开源软件,并且正在向商用硬件上运行的虚拟化和软件定义网络上转移。事实上,接近 70% 的全球移动用户由[低频网络][1]运营商成员所代表。该网络运营商成员致力于协调构成开放网络栈和相邻技术的项目。
|
||||
|
||||
### 技能需求
|
||||
|
||||
这一领域的开发者和系统管理员采用云原生和 DevOps 的方法开发新的使用案例,应对最紧迫的行业挑战。诸如容器、边缘计算等焦点领域大红大紫,并且在这一领域能够整合、协作、创新的开发者和系统管理员们的需求在日益增进。
|
||||
|
||||
开源软件与 Linux 使这一切成为可能,根据最近出版的[ 2018开源软件工作报告][2],高达 80% 的招聘经理寻找会 Linux 技能的应聘者,**而 46% 希望在网络领域招聘人才,可以说“网络技术”在他们的招聘决策中起到了至关重要的作用。**
|
||||
|
||||
开发人员相当抢手,72% 的招聘经理都在找他们,其次是 DevOps 开发者(59%),工程师(57%)和系统管理员(49%)。报告同时指出,对容器技能需求的惊人的增长符合了我们在网络领域所见到的,即创建云本地虚拟功能(CNFs)和在[ XCI倡议 ][3]的 OPNFV 中持续集成/持续部署方法的增长。
|
||||
|
||||
### 开始吧
|
||||
|
||||
对于求职者来说,好消息是有着大量的关于开源软件的内容,包括免费的[Linux 入门课程][4]。好的工作需要有多项证书,因此我鼓励你探索更多领域,去寻求培训的机会。计算机网络方面,在[OPNFV][5]上查看最新的培训课程或者是[ONAP][6]项目,也可以选择这门[开源网络技术简介][7]课程。
|
||||
|
||||
如果你还没有做好这些,下载 [2018开源软件工作报告][2] 以获得更多见解,在广阔的开放源码技术世界中规划你的课程,去寻找另一边等待你的令人兴奋的职业!
|
||||
|
||||
点击这里[下载完整的开源软件工作报告][8]并且[了解更多关于 Linux 的认证][9]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/blog/os-jobs-report/2018/7/open-source-networking-jobs-hotbed-innovation-and-opportunities
|
||||
|
||||
作者:[Brandon Wick][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/LuuMing)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.linux.com/users/brandon-wick
|
||||
[1]:https://www.lfnetworking.org/
|
||||
[2]:https://www.linuxfoundation.org/publications/2018/06/open-source-jobs-report-2018/
|
||||
[3]:https://docs.opnfv.org/en/latest/submodules/releng-xci/docs/xci-overview.html
|
||||
[4]:https://www.edx.org/course/introduction-linux-linuxfoundationx-lfs101x-1
|
||||
[5]:https://training.linuxfoundation.org/training/opnfv-fundamentals/
|
||||
[6]:https://training.linuxfoundation.org/training/onap-fundamentals/
|
||||
[7]:https://www.edx.org/course/introduction-to-software-defined-networking-technologies
|
||||
[8]:https://www.linuxfoundation.org/publications/open-source-jobs-report-2018/
|
||||
[9]:https://training.linuxfoundation.org/certification
|
@ -1,22 +1,24 @@
|
||||
使用 Docker 的 User Namespaces 功能
|
||||
======
|
||||
User Namespaces 于 Docker1.10 版正式纳入其中,该功能允许主机系统将自身的 `uid` 和 `gid` 映射为容器进程中的另一个其他 `uid` 和 `gid`。这对 Docker 的安全性来说是一项巨大的改进。下面我会通过一个案例来展示一下 User Namespaces 能够解决的问题,以及如何启用该功能。
|
||||
|
||||
User Namespaces 于 Docker 1.10 版本正式纳入其中,该功能允许主机系统将自身的 `uid` 和 `gid` 映射为容器进程中的另一个其他 `uid` 和 `gid`。这对 Docker 的安全性来说是一项巨大的改进。下面我会通过一个案例来展示一下 User Namespaces 能够解决的问题,以及如何启用该功能。
|
||||
|
||||
### 创建一个 Docker Machine
|
||||
|
||||
如果你已经创建好了一台用来实验 User Namespaces 的 docker machine,那么可以跳过这一步。我在自己的 Macbook 上安装了 Docker Toolbox,因此我只需要使用 `docker-machine` 命令就很简单地创建一个基于 VirtualBox 的 Docker Machine( 这里假设主机名为 `host1`):
|
||||
如果你已经创建好了一台用来试验 User Namespaces 的 docker machine,那么可以跳过这一步。我在自己的 Macbook 上安装了 Docker Toolbox,因此我只需用 `docker-machine` 命令就很简单地创建一个基于 VirtualBox 的 Docker Machine(这里假设主机名为 `host1`):
|
||||
|
||||
```
|
||||
# Create host1
|
||||
$ docker-machine create --driver virtualbox host1
|
||||
|
||||
# Login to host1
|
||||
$ docker-machine ssh host1
|
||||
|
||||
```
|
||||
|
||||
### 理解在 User Napespaces 未启用的情况下,非 root 用户能够做什么
|
||||
### 理解在 User Napespaces 未启用的情况下,非 root 用户能做什么
|
||||
|
||||
在启用 User Namespaces 前,我们先来看一下会有什么问题。Docker 到底哪个地方做错了?首先,使用 Docker 的一大优势在于用户在容器中可以拥有 root 权限,因此用户可以很方便地安装软件包。但是在 Linux 容器技术中这也是一把双刃剑。只要经过少许操作,非 root 用户就能以 root 的权限访问主机系统中的内容,比如 `/etc`。下面是操作步骤。
|
||||
|
||||
在启用 User Namespaces 前,我们先来看一下会有什么问题。Docker 到底哪个地方做错了?首先,使用 Docker 的一大优势在于用户在容器中可以拥有 root 权限,因此用户可以很方便地安装软件包。但是该项 Linux 容器技术是一把双刃剑。只要经过少许操作,非 root 用户就能以 root 的权限访问主机系统中的内容,比如 `/etc` . 下面是操作步骤。
|
||||
```
|
||||
# Run a container and mount host1's /etc onto /root/etc
|
||||
$ docker run --rm -v /etc:/root/etc -it ubuntu
|
||||
@ -29,12 +31,12 @@ root@34ef23438542:/# exit
|
||||
|
||||
# Check /etc/hosts
|
||||
$ cat /etc/hosts
|
||||
|
||||
```
|
||||
|
||||
你可以看到,步骤简单到难以置信,很明显 Docker 并不适用于运行在多人共享的电脑上。但是现在,通过 User Namespaces,Docker 可以让你避免这个问题。
|
||||
你可以看到,步骤简单到难以置信,很明显 Docker 并不适用于运行在多人共享的电脑上。但是现在,通过 User Namespaces,Docker 可以避免这个问题。
|
||||
|
||||
### 启用 User Namespaces
|
||||
|
||||
```
|
||||
# Create a user called "dockremap"
|
||||
$ sudo adduser dockremap
|
||||
@ -42,42 +44,39 @@ $ sudo adduser dockremap
|
||||
# Setup subuid and subgid
|
||||
$ sudo sh -c 'echo dockremap:500000:65536 > /etc/subuid'
|
||||
$ sudo sh -c 'echo dockremap:500000:65536 > /etc/subgid'
|
||||
|
||||
```
|
||||
|
||||
然后,打开 `/etc/init.d/docker`,并在 `/usr/local/bin/docker daemon` 后面加上 `--userns-remap=default`,像这样:
|
||||
|
||||
```
|
||||
$ sudo vi /etc/init.d/docker
|
||||
:
|
||||
:
|
||||
/usr/local/bin/docker daemon --userns-remap=default -D -g "$DOCKER_DIR" -H unix:// $DOCKER_HOST $EXTRA_ARGS >> "$DOCKER_LOGFILE" 2>&1 &
|
||||
:
|
||||
:
|
||||
|
||||
/usr/local/bin/docker daemon --userns-remap=default -D -g "$DOCKER_DIR" -H unix:// $DOCKER_HOST $EXTRA_ARGS >> "$DOCKER_LOGFILE" 2>&1 &
|
||||
```
|
||||
|
||||
然后重启 Docker:
|
||||
|
||||
```
|
||||
$ sudo /etc/init.d/docker restart
|
||||
|
||||
```
|
||||
|
||||
这就完成了!
|
||||
|
||||
**注意:** 若你使用的是 CentOS 7,则你需要了解两件事。
|
||||
**注意**:若你使用的是 CentOS 7,则你需要了解两件事。
|
||||
|
||||
**1。** 内核默认并没有启用 User Namespaces。运行下面命令并重启系统,可以启用该功能。
|
||||
```
|
||||
sudo grubby --args="user_namespace.enable=1" \
|
||||
--update-kernel=/boot/vmlinuz-3.10.0-XXX.XX.X.el7.x86_64
|
||||
1. 内核默认并没有启用 User Namespaces。运行下面命令并重启系统,可以启用该功能。
|
||||
|
||||
```
|
||||
```
|
||||
sudo grubby --args="user_namespace.enable=1" \
|
||||
--update-kernel=/boot/vmlinuz-3.10.0-XXX.XX.X.el7.x86_64
|
||||
```
|
||||
|
||||
**2。** CentOS 7 使用 systemctl 来管理服务,因此你需要编辑的文件是 `/usr/lib/systemd/system/docker.service`。
|
||||
2. CentOS 7 使用 systemctl 来管理服务,因此你需要编辑的文件是 `/usr/lib/systemd/system/docker.service`。
|
||||
|
||||
### 确认 User Namespaces 是否正常工作
|
||||
|
||||
若一切都配置妥当,则你应该无法再在容器中编辑 host1 上的 `/etc` 了。让我们来试一下。
|
||||
|
||||
```
|
||||
# Create a container and mount host1's /etc to container's /root/etc
|
||||
$ docker run --rm -v /etc:/root/etc -it ubuntu
|
||||
@ -90,8 +89,6 @@ drwx------ 3 root root 4096 Mar 21 23:50 ..
|
||||
lrwxrwxrwx 1 nobody nogroup 19 Mar 21 23:07 acpi -> /usr/local/etc/acpi
|
||||
-rw-r--r-- 1 nobody nogroup 48 Mar 10 22:09 boot2docker
|
||||
drwxr-xr-x 2 nobody nogroup 60 Mar 21 23:07 default
|
||||
:
|
||||
:
|
||||
|
||||
# Try creating a file in /root/etc
|
||||
root@d5802c5e670a:/# touch /root/etc/test
|
||||
@ -100,20 +97,19 @@ touch: cannot touch '/root/etc/test': Permission denied
|
||||
# Try deleting a file
|
||||
root@d5802c5e670a:/# rm /root/etc/hostname
|
||||
rm: cannot remove '/root/etc/hostname': Permission denied
|
||||
|
||||
```
|
||||
|
||||
好了,太棒了。这就是 User Namespaces 的工作方式。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
---
|
||||
|
||||
via: https://coderwall.com/p/s_ydlq/using-user-namespaces-on-docker
|
||||
|
||||
作者:[Koji Tanaka][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[lujun9972](https://github.com/lujun9972)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[pityonline](https://github.com/pityonline)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://coderwall.com/kjtanaka
|
||||
[a]: https://coderwall.com/kjtanaka
|
||||
|
@ -0,0 +1,134 @@
|
||||
将 Linux 终端会话录制成 SVG 动画
|
||||
======
|
||||
|
||||
![Banner 图](https://www.ostechnix.com/wp-content/uploads/2018/08/termtosvg-720x340.png)
|
||||
|
||||
录制终端会话可以满足我们不同类型的需求。通过录制终端会话,你可以完整记录你在终端中执行的操作,将其保存可供后续参考。通过录制终端会话,你还可以向青少年、学生或其它打算学习 Linux 的人展示各种 Linux 命令及其用例。值得庆幸的是,市面上已经有不少工具,可以帮助我们在类 Unix 操作系统下录制终端会话。我们已经介绍过一些可以帮助你录制终端会话的工具,可以在下面的链接中找到。
|
||||
|
||||
+ [如何录制你在终端中的所作所为][3]
|
||||
+ [Asciinema – 录制终端会话并在网上分享][4]
|
||||
|
||||
今天,我们要介绍另一款录制终端操作的工具,名字叫做 **Termtosvg**。从名字可以看出,Termtosvg 将你的终端会话录制成一个单独的 SVG 动画。它是一款简单的命令行工具,使用 **Python** 语言编写,可以生成轻量级、外观整洁的动画,可以嵌入到网页项目中。Termtosvg 支持自定义<ruby>色彩主题<rt>color themes</rt>、终端 UI,还可以通过 [SVG 模板][1]完成动画控制。它兼容 asciinema 录制格式,支持 GNU/Linux,Mac OS 和 BSD 等操作系统。
|
||||
|
||||
### 安装 Termtosvg
|
||||
|
||||
PIP 是一个面向 Python 语言编写的软件包的管理器,可以用于安装 Termtosvg。如果你没有安装 PIP,可以参考下面的指导:
|
||||
|
||||
[如何使用 PIP 管理 Python 软件包][5]
|
||||
|
||||
安装 PIP 后,运行如下命令安装 Termtosvg 工具:
|
||||
|
||||
```
|
||||
$ pip3 install --user termtosvg
|
||||
```
|
||||
|
||||
此外,还要安装渲染终端屏幕所需的依赖包:
|
||||
|
||||
```
|
||||
$ pip3 install pyte python-xlib svgwrite
|
||||
```
|
||||
|
||||
安装完毕,我们接下来生成 SVG 格式的终端会话。
|
||||
|
||||
### 将 Linux 终端会话录制成 SVG 动画
|
||||
|
||||
使用 Termtosvg 录制终端会话十分容易。打开终端窗口,运行如下命令即可开始录制:
|
||||
|
||||
```
|
||||
$ termtosvg
|
||||
```
|
||||
|
||||
**注意:** 如果 termtosvg 命令不可用,重启操作系统一次即可。
|
||||
|
||||
运行 termtosvg 命令后,可以看到如下命令输出:
|
||||
|
||||
```
|
||||
Recording started, enter "exit" command or Control-D to end
|
||||
|
||||
```
|
||||
|
||||
你目前位于一个子 Shell 中,在这里可以像平常那样输入命令。你在终端中的所作所为都会被录制。
|
||||
|
||||
不妨随便输入一些命令:
|
||||
|
||||
```
|
||||
$ mkdir mydirectory
|
||||
$ cd mydirectory/
|
||||
$ touch file.txt
|
||||
$ cd ..
|
||||
$ uname -a
|
||||
|
||||
```
|
||||
|
||||
操作完成后,使用组合键 **CTRL+D** 或者输入 **exit** 停止录制。录制结果将会保存在 **/tmp** 目录,(由于做了唯一性处理)文件名并不会重复。
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/08/Termtosvg-in-action-1-1.png)
|
||||
|
||||
现在,你可以在命令行运行命令,使用你的浏览器打开 SVG 文件:
|
||||
|
||||
```
|
||||
$ firefox /tmp/termtosvg_ddkehjpu.svg
|
||||
```
|
||||
|
||||
你也可以在(图形界面的)浏览器中直接打开这个 SVG 文件( **File -> <SVG 文件路径>** )。
|
||||
|
||||
我用 Firefox 浏览器打开的效果如下:
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/08/Termtosvg-in-browser.gif)
|
||||
|
||||
下面举例说明几种使用 Termtosvg 录制终端会话的方式。
|
||||
|
||||
我刚刚提到,Termtosvg 录制终端会话后默认保存成 **/tmp** 目录下的一个 SVG 动画文件。
|
||||
|
||||
但你可以指定 SVG 动画文件的文件名,例如 **animation.svg**;也可以指定一个存放路径,例如 **/home/sk/ostechnix/**。
|
||||
|
||||
```
|
||||
$ termtosvg /home/sk/ostechnix/animation.svg
|
||||
```
|
||||
|
||||
录制终端会话并使用特定模板进行渲染:
|
||||
```
|
||||
$ termtosvg -t ~/templates/my_template.svg
|
||||
```
|
||||
|
||||
使用指定的<ruby>屏幕参数<rt>screen geometry</rt></ruby>录制终端会话:
|
||||
|
||||
```
|
||||
$ termtosvg -g 80x24 animation.svg
|
||||
```
|
||||
|
||||
使用 asciicast v2 格式录制终端会话:
|
||||
|
||||
```
|
||||
$ termtosvg record recording.cast
|
||||
```
|
||||
|
||||
将 asciicast 格式的录制结果渲染成 SVG 动画:
|
||||
|
||||
```
|
||||
$ termtosvg render recording.cast animation.svg
|
||||
```
|
||||
|
||||
欲了解更多细节,请参考 [**Termtosvg 手册**][2]。
|
||||
|
||||
好了,本次分享就到这里,希望对你有帮助。更多精彩内容,敬请期待!
|
||||
|
||||
干杯!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/how-to-record-terminal-sessions-as-svg-animations-in-linux/
|
||||
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[pinewall](https://github.com/pinewall)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.ostechnix.com/author/sk/
|
||||
[1]:https://nbedos.github.io/termtosvg/pages/templates.html
|
||||
[2]:https://github.com/nbedos/termtosvg/blob/develop/man/termtosvg.md
|
||||
[3]:https://www.ostechnix.com/record-everything-terminal/
|
||||
[4]:https://www.ostechnix.com/asciinema-record-terminal-sessions-share-web/
|
||||
[5]:https://www.ostechnix.com/manage-python-packages-using-pip/
|
@ -0,0 +1,53 @@
|
||||
L1 终端错误漏洞如何影响 Linux 系统
|
||||
======
|
||||
|
||||
![](https://images.idgesg.net/images/article/2018/08/l1tf-copy-100768129-large.jpg)
|
||||
|
||||
昨天在英特尔、微软和红帽的安全建议中宣布,一个新发现的漏洞英特尔处理器(还有 Linux)的漏洞称为 L1TF 或 “L1 Terminal Fault”,引起了 Linux 用户和管理员的注意。究竟什么是这个漏洞,谁应该担心它?
|
||||
|
||||
### 1TF、 L1 Terminal Fault 和 Foreshadow
|
||||
|
||||
处理器漏洞由 L1TF、L1 Terminal Fault 和 Foreshadow 组成。研究人员在 1 月份发现了这个问题并向英特尔报告称其为 “Foreshadow”。它类似于过去发现的漏洞(例如 Spectre)。
|
||||
|
||||
此漏洞是特定于 Intel 的。其他处理器不受影响。与其他一些漏洞一样,它之所以存在,是因为设计时为了优化内核处理速度,但允许其他进程访问数据。
|
||||
|
||||
**[另请阅读:[22 个必要的 Linux 安全命令][1]]**
|
||||
|
||||
已为此问题分配了三个 CVE:
|
||||
|
||||
* CVE-2018-3615:英特尔软件保护扩展(英特尔 SGX)
|
||||
* CVE-2018-3620:操作系统和系统管理模式(SMM)
|
||||
* CVE-2018-3646:虚拟化的影响
|
||||
|
||||
|
||||
|
||||
英特尔发言人就此问题发表了这一声明:_“L1 Terminal Fault 通过今年早些时候发布的微代码更新得到解决,再加上从今天开始提供的操作系统和虚拟机管理程序软件的相应更新。我们在网上提供了更多信息,并继续鼓励每个人更新系统,因为这是受到保护的最佳方式之一。我们要感谢 imec-DistriNet、KU Leuven、以色列理工学院,密歇根大学,阿德莱德大学和 Data61 的研究人员以及我们的行业合作伙伴,他们帮助我们识别和解决了这个问题。“_
|
||||
|
||||
### L1TF 会影响你的 Linux 系统吗?
|
||||
|
||||
简短的回答是“可能不会”。如果你因为在今年 1 月爆出的[ Spectre 和 Meltdown 漏洞][2]修补过系统,那你应该是安全的。与 Spectre 和 Meltdown 一样,英特尔声称真实世界中还没有系统受到影响的报告或者检测到。他们还表示,这些变化不太可能在单个系统上产生明显的性能影响,但它们可能对使用虚拟化操作系统的数据中心产生大的影响。
|
||||
|
||||
即使如此,仍然推荐频繁地打补丁。要检查你当前的内核版本,使用 **uname -r** 命令:
|
||||
```
|
||||
$ uname -r
|
||||
4.18.0-041800-generic
|
||||
|
||||
```
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3298157/linux/linux-and-l1tf.html
|
||||
|
||||
作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/
|
||||
[1]:https://www.networkworld.com/article/3272286/open-source-tools/22-essential-security-commands-for-linux.html
|
||||
[2]:https://www.networkworld.com/article/3245813/security/meltdown-and-spectre-exploits-cutting-through-the-fud.html
|
||||
[3]:https://www.facebook.com/NetworkWorld/
|
||||
[4]:https://www.linkedin.com/company/network-world
|
Loading…
Reference in New Issue
Block a user