Merge branch 'master' of https://github.com/LCTT/TranslateProject into translating

This commit is contained in:
geekpi 2018-08-24 09:04:08 +08:00
commit 5f707d77a0
15 changed files with 1718 additions and 281 deletions

View File

@ -1,22 +1,24 @@
使用 Docker 的 User Namespaces 功能
使用 Docker 的用户名字空间功能
======
User Namespaces 于 Docker1.10 版正式纳入其中,该功能允许主机系统将自身的 `uid``gid` 映射为容器进程中的另一个其他 `uid``gid`。这对 Docker 的安全性来说是一项巨大的改进。下面我会通过一个案例来展示一下 User Namespaces 能够解决的问题,以及如何启用该功能。
<ruby>用户名字空间<rt>User Namespaces</rt></ruby> 于 Docker 1.10 版本正式纳入其中,该功能允许主机系统将自身的 `uid``gid` 映射为容器进程中的另一个 `uid``gid`。这对 Docker 的安全性来说是一项巨大的改进。下面我会通过一个案例来展示一下用户名字空间能够解决的问题,以及如何启用该功能。
### 创建一个 Docker Machine
如果你已经创建好了一台用来实验 User Namespaces 的 docker machine那么可以跳过这一步。我在自己的 Macbook 上安装了 Docker Toolbox因此我只需要使用 `docker-machine` 命令就很简单地创建一个基于 VirtualBox 的 Docker Machine( 这里假设主机名为 `host1`)
如果你已经创建好了一台用来试验用户名字空间的 docker <ruby>机器<rt>Machine</rt></ruby>,那么可以跳过这一步。我在自己的 Macbook 上安装了 Docker Toolbox因此我只需用 `docker-machine` 命令就很简单地创建一个基于 VirtualBox 的 Docker 机器(这里假设主机名为 `host1`
```
# Create host1
$ docker-machine create --driver virtualbox host1
# Login to host1
$ docker-machine ssh host1
```
### 理解在 User Napespaces 未启用的情况下,非 root 用户能够做什么
### 理解在用户名字空间未启用的情况下,非 root 用户能做什么
在启用用户名字空间前我们先来看一下会有什么问题。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 NamespacesDocker 可以让你避免这个问题。
你可以看到,步骤简单到难以置信,很明显 Docker 并不适用于运行在多人共享的电脑上。但是现在通过用户名字空间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. 内核默认并没有启用用户名字空间。运行下面命令并重启系统,可以启用该功能。
```
```
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

View File

@ -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/) 荣誉推出

View File

@ -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/) 荣誉推出

View File

@ -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 Im 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 were 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 havent 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

View File

@ -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 havent 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 doesnt 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 havent 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 commands 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 dont 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 dont 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.
Dont like it? Sorry about that. Go to the nms project folder and simply run the following command to remove it.
```
$ sudo make uninstall
```
And, thats 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/

View File

@ -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 havent 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 youre 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, thats 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/

View File

@ -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 dont 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 distributions 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 wont 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 distributions official website for more details.
For more details about xtrlock, refer man pages.
```
$ man xtrlock
```
And, thats 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

View File

@ -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 well discuss more about functions and recipes. For demonstration purpose Ill 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 well 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

View File

@ -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 youre 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 didnt 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 doesnt has any details related to Ubuntu server. Thats why I called them ads in the first place.
Even though most of us wont 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. Its 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, youll 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 dont 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, thats 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/

View File

@ -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 distributions 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, isnt 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 dont need to create a new file. Its 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 commands 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, thats 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

View File

@ -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 lets 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

View File

@ -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/

View File

@ -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 dont 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 doesnt 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 commands man pages.
```
$ man tty
$ man chvt
$ man fgconsole
$ man deallocvt
```
And, thats 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

View File

@ -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

View File

@ -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/LinuxMac 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/