mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-12 01:40:10 +08:00
commit
2b94bd029a
@ -0,0 +1,76 @@
|
|||||||
|
修复 Linux / Unix / OS X / BSD 系统控制台上的显示乱码
|
||||||
|
======
|
||||||
|
|
||||||
|
有时我的探索会在屏幕上输出一些奇怪的东西。比如,有一次我不小心用 `cat` 命令查看了一下二进制文件的内容 —— `cat /sbin/*`。这种情况下你将无法再访问终端里的 bash/ksh/zsh 了。大量的奇怪字符充斥了你的终端。这些字符会隐藏你输入的内容和要显示的字符,取而代之的是一些奇怪的符号。要清理掉这些屏幕上的垃圾可以使用以下方法。本文就将向你描述在 Linux/ 类 Unix 系统中如何真正清理终端屏幕或者重置终端。
|
||||||
|
|
||||||
|
### clear 命令
|
||||||
|
|
||||||
|
`clear` 命令会清理掉屏幕内容,连带它的回滚缓存区一起也会被清理掉。(LCTT 译注:这种情况下你输入的字符回显也是乱码,不必担心,正确输入后回车即可生效。)
|
||||||
|
|
||||||
|
```
|
||||||
|
$ clear
|
||||||
|
```
|
||||||
|
|
||||||
|
你也可以按下 `CTRL+L` 来清理屏幕。然而,`clear` 命令并不会清理掉终端屏幕(LCTT 译注:这句话比较难理解,应该是指的运行 `clear` 命令并不是真正的把以前显示的内容删掉,你还是可以通过向上翻页看到之前显示的内容)。使用下面的方法才可以真正地清空终端,使你的终端恢复正常。
|
||||||
|
|
||||||
|
### 使用 reset 命令修复显示
|
||||||
|
|
||||||
|
下面图片中,控制台的屏幕上充满了垃圾信息:
|
||||||
|
|
||||||
|
[![Fig.01:Bash fix the display][1]][2]
|
||||||
|
|
||||||
|
要修复正常显示,只需要输入 `reset` 命令。它会为你再初始化一次终端:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ reset
|
||||||
|
```
|
||||||
|
|
||||||
|
或者:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ tput reset
|
||||||
|
```
|
||||||
|
|
||||||
|
如果 `reset` 命令还不行,那么输入下面命令来让绘画回复到正常状态:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ stty sane
|
||||||
|
```
|
||||||
|
|
||||||
|
按下 `CTRL + L` 来清理屏幕(或者输入 `clear` 命令):
|
||||||
|
|
||||||
|
```
|
||||||
|
$ clear
|
||||||
|
```
|
||||||
|
|
||||||
|
### 使用 ANSI 转义序列来真正地清空 bash 终端
|
||||||
|
|
||||||
|
另一种选择是输入下面的 ANSI 转义序列:
|
||||||
|
|
||||||
|
```
|
||||||
|
clear
|
||||||
|
echo -e "\033c"
|
||||||
|
```
|
||||||
|
|
||||||
|
下面是这两个命令的输出示例:
|
||||||
|
|
||||||
|
[![Animated gif 01:Fix Unix Console Gibberish Command Demo][3]][4]
|
||||||
|
|
||||||
|
更多信息请阅读 `stty` 和 `reset` 的 man 页: stty(1),reset(1),bash(1)。
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.cyberciti.biz/tips/bash-fix-the-display.html
|
||||||
|
|
||||||
|
作者:[Vivek Gite][a]
|
||||||
|
译者:[lujun9972](https://github.com/lujun9972)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://www.cyberciti.biz
|
||||||
|
[1]:https://www.cyberciti.biz/media/new/tips/2006/08/bash-fix-terminal.png
|
||||||
|
[2]:https://www.cyberciti.biz/media/uploads/tips/2006/08/bash-fix-terminal.png
|
||||||
|
[3]:https://www.cyberciti.biz/media/new/tips/2006/08/unix-linux-console-gibberish.gif
|
||||||
|
[4]:https://www.cyberciti.biz/tips/bash-fix-the-display.html/unix-linux-console-gibberish
|
105
published/201712/20170530 How to Improve a Legacy Codebase.md
Normal file
105
published/201712/20170530 How to Improve a Legacy Codebase.md
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
如何改善遗留的代码库
|
||||||
|
=================
|
||||||
|
|
||||||
|
在每一个程序员、项目管理员、团队领导的一生中,这都会至少发生一次。原来的程序员早已离职去度假了,给你留下了一坨几百万行屎一样的、勉强支撑公司运行的代码和(如果有的话)跟代码驴头不对马嘴的文档。
|
||||||
|
|
||||||
|
你的任务:带领团队摆脱这个混乱的局面。
|
||||||
|
|
||||||
|
当你的第一反应(逃命)过去之后,你开始去熟悉这个项目。公司的管理层都在关注着你,所以项目只能成功;然而,看了一遍代码之后却发现失败几乎是不可避免。那么该怎么办呢?
|
||||||
|
|
||||||
|
幸运(不幸)的是我已经遇到好几次这种情况了,我和我的小伙伴发现将这坨热气腾腾的屎变成一个健康可维护的项目是一个有丰厚利润的业务。下面这些是我们的一些经验:
|
||||||
|
|
||||||
|
### 备份
|
||||||
|
|
||||||
|
在开始做任何事情之前备份与之可能相关的所有文件。这样可以确保不会丢失任何可能会在另外一些地方很重要的信息。一旦修改了其中一些文件,你可能花费一天或者更多天都解决不了这个愚蠢的问题。配置数据通常不受版本控制,所以特别容易受到这方面影响,如果定期备份数据时连带着它一起备份了,还是比较幸运的。所以谨慎总比后悔好,复制所有东西到一个绝对安全的地方并不要轻易碰它,除非这些文件是只读模式。
|
||||||
|
|
||||||
|
### 重要的先决条件:必须确保代码能够在生产环境下构建运行并产出
|
||||||
|
|
||||||
|
之前我假设环境已经存在,所以完全丢了这一步,但 Hacker News 的众多网友指出了这一点,并且事实证明他们是对的:第一步是确认你知道在生产环境下运行着什么东西,也意味着你需要在你的设备上构建一个跟生产环境上运行的版本每一个字节都一模一样的版本。如果你找不到实现它的办法,一旦你将它投入生产环境,你很可能会遭遇一些预料之外的糟糕事情。确保每一部分都尽力测试,之后在你足够确信它能够很好的运行的时候将它部署生产环境下。无论它运行的怎么样都要做好能够马上切换回旧版本的准备,确保日志记录下了所有情况,以便于接下来不可避免的 “验尸” 。
|
||||||
|
|
||||||
|
### 冻结数据库
|
||||||
|
|
||||||
|
直到你修改代码结束之前尽可能冻结你的数据库,在你已经非常熟悉代码库和遗留代码之后再去修改数据库。在这之前过早的修改数据库的话,你可能会碰到大问题,你会失去让新旧代码和数据库一起构建稳固的基础的能力。保持数据库完全不变,就能比较新的逻辑代码和旧的逻辑代码运行的结果,比较的结果应该跟预期的没有差别。
|
||||||
|
|
||||||
|
### 写测试
|
||||||
|
|
||||||
|
在你做任何改变之前,尽可能多的写一些端到端测试和集成测试。确保这些测试能够正确的输出,并测试你对旧的代码运行的各种假设(准备好应对一些意外状况)。这些测试有两个重要的作用:其一,它们能够在早期帮助你抛弃一些错误观念,其二,这些测试在你写新代码替换旧代码的时候也有一定防护作用。
|
||||||
|
|
||||||
|
要自动化测试,如果你有 CI 的使用经验可以用它,并确保在你提交代码之后 CI 能够快速的完成所有测试。
|
||||||
|
|
||||||
|
### 日志监控
|
||||||
|
|
||||||
|
如果旧设备依然可用,那么添加上监控功能。在一个全新的数据库,为每一个你能想到的事件都添加一个简单的计数器,并且根据这些事件的名字添加一个函数增加这些计数器。用一些额外的代码实现一个带有时间戳的事件日志,你就能大概知道发生多少事件会导致另外一些种类的事件。例如:用户打开 APP 、用户关闭 APP 。如果这两个事件导致后端调用的数量维持长时间的不同,这个数量差就是当前打开的 APP 的数量。如果你发现打开 APP 比关闭 APP 多的时候,你就必须要知道是什么原因导致 APP 关闭了(例如崩溃)。你会发现每一个事件都跟其它的一些事件有许多不同种类的联系,通常情况下你应该尽量维持这些固定的联系,除非在系统上有一个明显的错误。你的目标是减少那些错误的事件,尽可能多的在开始的时候通过使用计数器在调用链中降低到指定的级别。(例如:用户支付应该得到相同数量的支付回调)。
|
||||||
|
|
||||||
|
这个简单的技巧可以将每一个后端应用变成一个像真实的簿记系统一样,而像一个真正的簿记系统,所有数字必须匹配,如果它们在某个地方对不上就有问题。
|
||||||
|
|
||||||
|
随着时间的推移,这个系统在监控健康方面变得非常宝贵,而且它也是使用源码控制修改系统日志的一个好伙伴,你可以使用它确认 BUG 引入到生产环境的时间,以及对多种计数器造成的影响。
|
||||||
|
|
||||||
|
我通常保持每 5 分钟(一小时 12 次)记录一次计数器,但如果你的应用生成了更多或者更少的事件,你应该修改这个时间间隔。所有的计数器公用一个数据表,每一个记录都只是简单的一行。
|
||||||
|
|
||||||
|
### 一次只修改一处
|
||||||
|
|
||||||
|
不要陷入在提高代码或者平台可用性的同时添加新特性或者是修复 BUG 的陷阱。这会让你头大,因为你现在必须在每一步操作想好要出什么样的结果,而且会让你之前建立的一些测试失效。
|
||||||
|
|
||||||
|
### 修改平台
|
||||||
|
|
||||||
|
如果你决定转移你的应用到另外一个平台,最主要的是跟之前保持一模一样。如果你觉得需要,你可以添加更多的文档和测试,但是不要忘记这一点,所有的业务逻辑和相互依赖要跟从前一样保持不变。
|
||||||
|
|
||||||
|
### 修改架构
|
||||||
|
|
||||||
|
接下来处理的是改变应用的结构(如果需要)。这一点上,你可以自由的修改高层的代码,通常是降低模块间的横向联系,这样可以降低代码活动期间对终端用户造成的影响范围。如果旧代码很庞杂,那么现在正是让它模块化的时候,将大段代码分解成众多小的部分,不过不要改变量和数据结构的名字。
|
||||||
|
|
||||||
|
Hacker News 的 [mannykannot][1] 网友指出,修改高层代码并不总是可行,如果你特别不幸的话,你可能为了改变一些架构必须付出沉重的代价。我赞同这一点也应该在这里加上提示,因此这里有一些补充。我想额外补充的是如果你修改高层代码的时候修改了一点点底层代码,那么试着只修改一个文件或者最坏的情况是只修改一个子系统,尽可能限制修改的范围。否则你可能很难调试刚才所做的更改。
|
||||||
|
|
||||||
|
### 底层代码的重构
|
||||||
|
|
||||||
|
现在,你应该非常理解每一个模块的作用了,准备做一些真正的工作吧:重构代码以提高其可维护性并且使代码做好添加新功能的准备。这很可能是项目中最消耗时间的部分,记录你所做的任何操作,在你彻底的记录并且理解模块之前不要对它做任何修改。之后你可以自由的修改变量名、函数名以及数据结构以提高代码的清晰度和统一性,然后请做测试(情况允许的话,包括单元测试)。
|
||||||
|
|
||||||
|
### 修复 bug
|
||||||
|
|
||||||
|
现在准备做一些用户可见的修改,战斗的第一步是修复很多积累了几年的 bug。像往常一样,首先证实 bug 仍然存在,然后编写测试并修复这个 bug,你的 CI 和端对端测试应该能避免一些由于不太熟悉或者一些额外的事情而犯的错误。
|
||||||
|
|
||||||
|
### 升级数据库
|
||||||
|
|
||||||
|
如果你在一个坚实且可维护的代码库上完成所有工作,你就可以选择更改数据库模式的计划,或者使用不同的完全替换数据库。之前完成的步骤能够帮助你更可靠的修改数据库而不会碰到问题,你可以完全的测试新数据库和新代码,而之前写的所有测试可以确保你顺利的迁移。
|
||||||
|
|
||||||
|
### 按着路线图执行
|
||||||
|
|
||||||
|
祝贺你脱离的困境并且可以准备添加新功能了。
|
||||||
|
|
||||||
|
### 任何时候都不要尝试彻底重写
|
||||||
|
|
||||||
|
彻底重写是那种注定会失败的项目。一方面,你在一个未知的领域开始,所以你甚至不知道构建什么,另一方面,你会把所有的问题都推到新系统马上就要上线的前一天。非常不幸的是,这也是你失败的时候。假设业务逻辑被发现存在问题,你会得到异样的眼光,那时您会突然明白为什么旧系统会用某种奇怪的方式来工作,最终也会意识到能将旧系统放在一起工作的人也不都是白痴。在那之后。如果你真的想破坏公司(和你自己的声誉),那就重写吧,但如果你是聪明人,你会知道彻底重写系统根本不是一个可选的选择。
|
||||||
|
|
||||||
|
### 所以,替代方法:增量迭代工作
|
||||||
|
|
||||||
|
要解开这些线团最快方法是,使用你熟悉的代码中任何的元素(它可能是外部的,也可能是内核模块),试着使用旧的上下文去增量改进。如果旧的构建工具已经不能用了,你将必须使用一些技巧(看下面),但至少当你开始做修改的时候,试着尽力保留已知的工作。那样随着代码库的提升你也对代码的作用更加理解。一个典型的代码提交应该最多两三行。
|
||||||
|
|
||||||
|
### 发布!
|
||||||
|
|
||||||
|
每一次的修改都发布到生产环境,即使一些修改不是用户可见的。使用最少的步骤也是很重要的,因为当你缺乏对系统的了解时,有时候只有生产环境能够告诉你问题在哪里。如果你只做了一个很小的修改之后出了问题,会有一些好处:
|
||||||
|
|
||||||
|
* 很容易弄清楚出了什么问题
|
||||||
|
* 这是一个改进流程的好位置
|
||||||
|
* 你应该马上更新文档展示你的新见解
|
||||||
|
|
||||||
|
### 使用代理的好处
|
||||||
|
|
||||||
|
如果你做 web 开发那就谢天谢地吧,可以在旧系统和用户之间加一个代理。这样你能很容易的控制每一个网址哪些请求定向到旧系统,哪些请求定向到新系统,从而更轻松更精确的控制运行的内容以及谁能够看到运行系统。如果你的代理足够的聪明,你可以使用它针对个别 URL 把一定比例的流量发送到新系统,直到你满意为止。如果你的集成测试也能连接到这个接口那就更好了。
|
||||||
|
|
||||||
|
### 是的,但这会花费很多时间!
|
||||||
|
|
||||||
|
这就取决于你怎样看待它了。的确,在按照以上步骤优化代码时会有一些重复的工作步骤。但是它确实有效,而这里介绍的任何一个步骤都是假设你对系统的了解比现实要多。我需要保持声誉,也真的不喜欢在工作期间有负面的意外。如果运气好的话,公司系统已经出现问题,或者有可能会严重影响到客户。在这样的情况下,我比较喜欢完全控制整个流程得到好的结果,而不是节省两天或者一星期。如果你更多地是牛仔的做事方式,并且你的老板同意可以接受冒更大的风险,那可能试着冒险一下没有错,但是大多数公司宁愿采取稍微慢一点但更确定的胜利之路。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://jacquesmattheij.com/improving-a-legacy-codebase
|
||||||
|
|
||||||
|
作者:[Jacques Mattheij][a]
|
||||||
|
译者:[aiwhj](https://github.com/aiwhj)
|
||||||
|
校对:[JianqinWang](https://github.com/JianqinWang), [wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://jacquesmattheij.com/
|
||||||
|
[1]:https://news.ycombinator.com/item?id=14445661
|
@ -0,0 +1,103 @@
|
|||||||
|
用 Ansible Container 去管理 Linux 容器
|
||||||
|
============================================================
|
||||||
|
|
||||||
|
> Ansible Container 解决了 Dockerfile 的不足,并对容器化项目提供了完整的管理。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Image by : opensource.com
|
||||||
|
|
||||||
|
我喜欢容器,并且每天都使用这个技术。即便如此,容器并不完美。不过,在过去几个月里,一系列项目已经解决了我遇到的一些问题。
|
||||||
|
|
||||||
|
我刚开始时,用 [Docker][11] 使用容器,这个项目使得这种技术非常流行。除了使用这个容器引擎之外,我学到了怎么去使用 [docker-compose][6] 以及怎么去用它管理我的项目。使用它使得我的生产力猛增!一个命令就可以运行我的项目,而不管它有多复杂。因此,我太高兴了。
|
||||||
|
|
||||||
|
使用一段时间之后,我发现了一些问题。最明显的问题是创建容器镜像的过程。Docker 工具使用一个定制的文件格式作为生成容器镜像的依据:Dockerfile。这个格式易于学习,并且很短的一段时间之后,你就可以自己制作容器镜像了。但是,一旦你希望进一步掌握它或者考虑到复杂场景,问题就会出现。
|
||||||
|
|
||||||
|
让我们打断一下,先去了解一个不同的东西:[Ansible][22] 的世界。你知道它吗?它棒极了,是吗?你不这么认为?好吧,是时候去学习一些新事物了。Ansible 是一个允许你通过写一些任务去管理你的基础设施,并在你选择的环境中运行它们的项目。不需要去安装和设置任何的服务;你可以从你的笔记本电脑中很容易地做任何事情。许多人已经接受 Ansible 了。
|
||||||
|
|
||||||
|
想像一下这样的场景:你在 Ansible 中,你写了很多的 Ansible <ruby>角色<rt>role</rt></ruby>和<ruby>剧本<rt>playbook</rt></ruby>,你可以用它们去管理你的基础设施,并且你想把它们运用到容器中。你应该怎么做?通过 shell 脚本和 Dockerfile 去写容器镜像定义?听起来好像不对。
|
||||||
|
|
||||||
|
来自 Ansible 开发团队的一些人问到这个问题,并且他们意识到,人们每天编写和使用的那些同样的 Ansible 角色和剧本也可以用来制作容器镜像。但是 Ansible 能做到的不止这些 —— 它可以被用于去管理容器化项目的完整生命周期。从这些想法中,[Ansible Container][12] 项目诞生了。它利用已有的 Ansible 角色转变成容器镜像,甚至还可以被用于生产环境中从构建到部署的完整生命周期。
|
||||||
|
|
||||||
|
现在让我们讨论一下,我之前提到过的在 Dockerfile 环境中的最佳实践问题。这里有一个警告:这将是非常具体且技术性的。出现最多的三个问题有:
|
||||||
|
|
||||||
|
### 1、 在 Dockerfile 中内嵌的 Shell 脚本
|
||||||
|
|
||||||
|
当写 Dockerfile 时,你可以指定会由 `/bin/sh -c` 解释执行的脚本。它类似如下:
|
||||||
|
|
||||||
|
```
|
||||||
|
RUN dnf install -y nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
这里 `RUN` 是一个 Dockerfile 指令,其它的都是参数(它们传递给 shell)。但是,想像一个更复杂的场景:
|
||||||
|
|
||||||
|
```
|
||||||
|
RUN set -eux; \
|
||||||
|
\
|
||||||
|
# this "case" statement is generated via "update.sh"
|
||||||
|
%%ARCH-CASE%%; \
|
||||||
|
\
|
||||||
|
url="https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz"; \
|
||||||
|
wget -O go.tgz "$url"; \
|
||||||
|
echo "${goRelSha256} *go.tgz" | sha256sum -c -; \
|
||||||
|
```
|
||||||
|
|
||||||
|
这仅是从 [golang 官方镜像][13] 中拿来的一段。它看起来并不好看,是不是?
|
||||||
|
|
||||||
|
### 2、 解析 Dockerfile 并不容易
|
||||||
|
|
||||||
|
Dockerfile 是一个没有正式规范的新格式。如果你需要在你的基础设施(比如,让构建过程自动化一点)中去处理 Dockerfile 将会很复杂。仅有的规范是 [这个代码][14],它是 **dockerd** 的一部分。问题是你不能使用它作为一个<ruby>库<rt>library</rt></ruby>来使用。最容易的解决方案是你自己写一个解析器,然后祈祷它运行的很好。使用一些众所周知的标记语言不是更好吗?比如,YAML 或者 JSON。
|
||||||
|
|
||||||
|
### 3、 管理困难
|
||||||
|
|
||||||
|
如果你熟悉容器镜像的内部结构,你可能知道每个镜像是由<ruby>层<rt>layer</rt></ruby>构成的。一旦容器被创建,这些层就使用联合文件系统技术堆叠在一起(像煎饼一样)。问题是,你并不能显式地管理这些层 — 你不能说,“这儿开始一个新层”,你被迫使用一种可读性不好的方法去改变你的 Dockerfile。最大的问题是,必须遵循一套最佳实践以去达到最优结果 — 新来的人在这个地方可能很困难。
|
||||||
|
|
||||||
|
### Ansible 语言和 Dockerfile 比较
|
||||||
|
|
||||||
|
相比 Ansible,Dockerfile 的最大缺点,也是 Ansible 的优点,作为一个语言,Ansible 更强大。例如,Dockerfile 没有直接的变量概念,而 Ansible 有一个完整的模板系统(变量只是它其中的一个特性)。Ansible 包含了很多更易于使用的模块,比如,[wait_for][15],它可以被用于服务就绪检查,比如,在处理之前等待服务准备就绪。在 Dockerfile 中,做任何事情都通过一个 shell 脚本。因此,如果你想去找出已准备好的服务,它必须使用 shell(或者独立安装)去做。使用 shell 脚本的其它问题是,它会变得很复杂,维护成为一种负担。很多人已经发现了这个问题,并将这些 shell 脚本转到 Ansible。
|
||||||
|
|
||||||
|
### 关于作者
|
||||||
|
|
||||||
|
[][18]
|
||||||
|
|
||||||
|
Tomas Tomecek - 工程师、Hacker、演讲者、Tinker、Red Hatter。喜欢容器、linux、开源软件、python 3、rust、zsh、tmux。[More about me][9]
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/17/10/dockerfiles-ansible-container
|
||||||
|
|
||||||
|
作者:[Tomas Tomecek][a]
|
||||||
|
译者:[qhwdw](https://github.com/qhwdw)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://opensource.com/users/tomastomecek
|
||||||
|
[1]:https://www.ansible.com/how-ansible-works?intcmp=701f2000000h4RcAAI
|
||||||
|
[2]:https://www.ansible.com/ebooks?intcmp=701f2000000h4RcAAI
|
||||||
|
[3]:https://www.ansible.com/quick-start-video?intcmp=701f2000000h4RcAAI
|
||||||
|
[4]:https://docs.ansible.com/ansible/latest/intro_installation.html?intcmp=701f2000000h4RcAAI
|
||||||
|
[5]:https://opensource.com/article/17/10/dockerfiles-ansible-container?imm_mid=0f9013&cmp=em-webops-na-na-newsltr_20171201&rate=Wiw_0D6PK_CAjqatYu_YQH0t1sNHEF6q09_9u3sYkCY
|
||||||
|
[6]:https://github.com/docker/compose
|
||||||
|
[7]:http://sched.co/BxIW
|
||||||
|
[8]:http://events.linuxfoundation.org/events/open-source-summit-europe
|
||||||
|
[9]:https://opensource.com/users/tomastomecek
|
||||||
|
[10]:https://opensource.com/user/175651/feed
|
||||||
|
[11]:https://opensource.com/tags/docker
|
||||||
|
[12]:https://www.ansible.com/ansible-container
|
||||||
|
[13]:https://github.com/docker-library/golang/blob/master/Dockerfile-debian.template#L14
|
||||||
|
[14]:https://github.com/moby/moby/tree/master/builder/dockerfile
|
||||||
|
[15]:http://docs.ansible.com/wait_for_module.html
|
||||||
|
[16]:http://events.linuxfoundation.org/events/open-source-summit-europe
|
||||||
|
[17]:http://events.linuxfoundation.org/events/open-source-summit-europe/program/schedule
|
||||||
|
[18]:https://opensource.com/users/tomastomecek
|
||||||
|
[19]:https://opensource.com/users/tomastomecek
|
||||||
|
[20]:https://opensource.com/users/tomastomecek
|
||||||
|
[21]:https://opensource.com/article/17/10/dockerfiles-ansible-container?imm_mid=0f9013&cmp=em-webops-na-na-newsltr_20171201#comments
|
||||||
|
[22]:https://opensource.com/tags/ansible
|
||||||
|
[23]:https://opensource.com/tags/containers
|
||||||
|
[24]:https://opensource.com/tags/ansible
|
||||||
|
[25]:https://opensource.com/tags/docker
|
||||||
|
[26]:https://opensource.com/tags/open-source-summit
|
||||||
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
|||||||
系统管理 101:补丁管理
|
系统管理 101:补丁管理
|
||||||
============================================================
|
============================================================
|
||||||
|
|
||||||
就在之前几篇文章,我开始了“系统管理 101”系列文章,用来记录现今许多初级系统管理员,DevOps 工程师或者“全栈”开发者可能不曾接触过的一些系统管理方面的基本知识。按照我原本的设想,该系列文章已经是完结了的。然而后来 WannaCry 恶意软件出现并在补丁管理不善的 Windows 主机网络间爆发。我能想象到那些仍然深陷 2000 年代 Linux 与 Windows 争论的读者听到这个消息可能已经面露优越的微笑。
|
就在之前几篇文章,我开始了“系统管理 101”系列文章,用来记录现今许多初级系统管理员、DevOps 工程师或者“全栈”开发者可能不曾接触过的一些系统管理方面的基本知识。按照我原本的设想,该系列文章已经是完结了的。然而后来 WannaCry 恶意软件出现,并在补丁管理不善的 Windows 主机网络间爆发。我能想象到那些仍然深陷 2000 年代 Linux 与 Windows 争论的读者听到这个消息可能已经面露优越的微笑。
|
||||||
|
|
||||||
我之所以这么快就决定再次继续“系统管理 101”文章系列,是因为我意识到在补丁管理方面一些 Linux 系统管理员和 Windows 系统管理员没有差别。实话说,在一些方面甚至做的更差(特别是以运行时间为豪)。所以,这篇文章会涉及 Linux 下补丁管理的基础概念,包括良好的补丁管理该是怎样的,你可能会用到的一些相关工具,以及整个补丁安装过程是如何进行的。
|
我之所以这么快就决定再次继续“系统管理 101”文章系列,是因为我意识到在补丁管理方面一些 Linux 系统管理员和 Windows 系统管理员没有差别。实话说,在一些方面甚至做的更差(特别是以持续运行时间为自豪)。所以,这篇文章会涉及 Linux 下补丁管理的基础概念,包括良好的补丁管理该是怎样的,你可能会用到的一些相关工具,以及整个补丁安装过程是如何进行的。
|
||||||
|
|
||||||
### 什么是补丁管理?
|
### 什么是补丁管理?
|
||||||
|
|
||||||
我所说的补丁管理,是指你部署用于升级服务器上软件的系统,不仅仅是把软件更新到最新最好的前沿版本。即使是像 Debian 这样为了“稳定性”持续保持某一特定版本软件的保守派发行版,也会时常发布升级补丁用于修补错误和安全漏洞。
|
我所说的补丁管理,是指你部署用于升级服务器上软件的系统,不仅仅是把软件更新到最新最好的前沿版本。即使是像 Debian 这样为了“稳定性”持续保持某一特定版本软件的保守派发行版,也会时常发布升级补丁用于修补错误和安全漏洞。
|
||||||
|
|
||||||
当然,因为开发者对最新最好版本的需求,你需要派生软件源码并做出修改,或者因为你喜欢给自己额外的工作量,你的组织可能会决定自己维护特定软件的版本,这时你就会遇到问题。理想情况下,你应该已经配置好你的系统,让它在自动构建和打包定制版本软件时使用其它软件所用的同一套持续集成系统。然而,许多系统管理员仍旧在自己的本地主机上按照维基上的文档(但愿是最新的文档)使用过时的方法打包软件。不论使用哪种方法,你都需要明确你所使用的版本有没有安全缺陷,如果有,那必须确保新补丁安装到你定制版本的软件上了。
|
当然,如果你的组织决定自己维护特定软件的版本,要么是因为开发者有最新最好版本的需求,需要派生软件源码并做出修改,要么是因为你喜欢给自己额外的工作量,这时你就会遇到问题。理想情况下,你应该已经配置好你的系统,让它在自动构建和打包定制版本软件时使用其它软件所用的同一套持续集成系统。然而,许多系统管理员仍旧在自己的本地主机上按照维基上的文档(但愿是最新的文档)使用过时的方法打包软件。不论使用哪种方法,你都需要明确你所使用的版本有没有安全缺陷,如果有,那必须确保新补丁安装到你定制版本的软件上了。
|
||||||
|
|
||||||
### 良好的补丁管理是怎样的
|
### 良好的补丁管理是怎样的
|
||||||
|
|
||||||
@ -17,17 +17,17 @@
|
|||||||
|
|
||||||
一些组织仍在使用手动方式管理补丁。在这种方式下,当出现一个安全补丁,系统管理员就要凭借记忆,登录到各个服务器上进行检查。在确定了哪些服务器需要升级后,再使用服务器内建的包管理工具从发行版仓库升级这些软件。最后以相同的方式升级剩余的所有服务器。
|
一些组织仍在使用手动方式管理补丁。在这种方式下,当出现一个安全补丁,系统管理员就要凭借记忆,登录到各个服务器上进行检查。在确定了哪些服务器需要升级后,再使用服务器内建的包管理工具从发行版仓库升级这些软件。最后以相同的方式升级剩余的所有服务器。
|
||||||
|
|
||||||
手动管理补丁的方式存在很多问题。首先,这么做会使补丁安装成为一个苦力活,安装补丁需要越多人力成本,系统管理员就越可能推迟甚至完全忽略它。其次,手动管理方式依赖系统管理员凭借记忆去跟踪他或她所负责的服务器的升级情况。这非常容易导致有些服务器被遗漏而未能及时升级。
|
手动管理补丁的方式存在很多问题。首先,这么做会使补丁安装成为一个苦力活,安装补丁越多就需要越多人力成本,系统管理员就越可能推迟甚至完全忽略它。其次,手动管理方式依赖系统管理员凭借记忆去跟踪他或她所负责的服务器的升级情况。这非常容易导致有些服务器被遗漏而未能及时升级。
|
||||||
|
|
||||||
补丁管理越快速简便,你就越可能把它做好。你应该构建一个系统,用来快速查询哪些服务器运行着特定的软件,以及这些软件的版本号,而且它最好还能够推送各种升级补丁。就个人而言,我倾向于使用 MCollective 这样的编排工具来完成这个任务,但是红帽提供的 Satellite 以及 Canonical 提供的 Landscape 也可以让你在统一的管理接口查看服务器上软件的版本信息,并且安装补丁。
|
补丁管理越快速简便,你就越可能把它做好。你应该构建一个系统,用来快速查询哪些服务器运行着特定的软件,以及这些软件的版本号,而且它最好还能够推送各种升级补丁。就个人而言,我倾向于使用 MCollective 这样的编排工具来完成这个任务,但是红帽提供的 Satellite 以及 Canonical 提供的 Landscape 也可以让你在统一的管理界面上查看服务器的软件版本信息,并且安装补丁。
|
||||||
|
|
||||||
补丁安装还应该具有容错能力。你应该具备在不下线的情况下为服务安装补丁的能力。这同样适用于需要重启系统的内核补丁。我采用的方法是把我的服务器划分为不同的高可用组,lb1,app1,rabbitmq1 和 db1 在一个组,而lb2,app2,rabbitmq2 和 db2 在另一个组。这样,我就能一次升级一个组,而无须下线服务。
|
补丁安装还应该具有容错能力。你应该具备在不下线的情况下为服务安装补丁的能力。这同样适用于需要重启系统的内核补丁。我采用的方法是把我的服务器划分为不同的高可用组,lb1、app1、rabbitmq1 和 db1 在一个组,而lb2、app2、rabbitmq2 和 db2 在另一个组。这样,我就能一次升级一个组,而无须下线服务。
|
||||||
|
|
||||||
所以,多快才能算快呢?对于少数没有附带服务的软件,你的系统最快应该能够在几分钟到一小时内安装好补丁(例如 bash 的 ShellShock 漏洞)。对于像 OpenSSL 这样需要重启服务的软件,以容错的方式安装补丁并重启服务的过程可能会花费稍多的时间,但这就是编排工具派上用场的时候。我在最近的关于 MCollective 的文章中(查看 2016 年 12 月和 2017 年 1 月的工单)给了几个使用 MCollective 实现补丁管理的例子。你最好能够部署一个系统,以具备容错性的自动化方式简化补丁安装和服务重启的过程。
|
所以,多快才能算快呢?对于少数没有附带服务的软件,你的系统最快应该能够在几分钟到一小时内安装好补丁(例如 bash 的 ShellShock 漏洞)。对于像 OpenSSL 这样需要重启服务的软件,以容错的方式安装补丁并重启服务的过程可能会花费稍多的时间,但这就是编排工具派上用场的时候。我在最近的关于 MCollective 的文章中(查看 2016 年 12 月和 2017 年 1 月的工单)给了几个使用 MCollective 实现补丁管理的例子。你最好能够部署一个系统,以具备容错性的自动化方式简化补丁安装和服务重启的过程。
|
||||||
|
|
||||||
如果补丁要求重启系统,像内核补丁,那它会花费更多的时间。再次强调,自动化和编排工具能够让这个过程比你想象的还要快。我能够在一到两个小时内在生产环境中以容错方式升级并重启服务器,如果重启之间无须等待集群同步备份,这个过程还能更快。
|
如果补丁要求重启系统,像内核补丁,那它会花费更多的时间。再次强调,自动化和编排工具能够让这个过程比你想象的还要快。我能够在一到两个小时内在生产环境中以容错方式升级并重启服务器,如果重启之间无须等待集群同步备份,这个过程还能更快。
|
||||||
|
|
||||||
不幸的是,许多系统管理员仍坚信过时的观点,把运行时间作为一种骄傲的象征——鉴于紧急内核补丁大约每年一次。对于我来说,这只能说明你没有认真对待系统的安全性。
|
不幸的是,许多系统管理员仍坚信过时的观点,把持续运行时间(uptime)作为一种骄傲的象征——鉴于紧急内核补丁大约每年一次。对于我来说,这只能说明你没有认真对待系统的安全性!
|
||||||
|
|
||||||
很多组织仍然使用无法暂时下线的单点故障的服务器,也因为这个原因,它无法升级或者重启。如果你想让系统更加安全,你需要去除过时的包袱,搭建一个至少能在深夜维护时段重启的系统。
|
很多组织仍然使用无法暂时下线的单点故障的服务器,也因为这个原因,它无法升级或者重启。如果你想让系统更加安全,你需要去除过时的包袱,搭建一个至少能在深夜维护时段重启的系统。
|
||||||
|
|
||||||
@ -41,9 +41,9 @@ Kyle Rankin 是高级安全与基础设施架构师,其著作包括: Linux H
|
|||||||
|
|
||||||
via: https://www.linuxjournal.com/content/sysadmin-101-patch-management
|
via: https://www.linuxjournal.com/content/sysadmin-101-patch-management
|
||||||
|
|
||||||
作者:[Kyle Rankin ][a]
|
作者:[Kyle Rankin][a]
|
||||||
译者:[haoqixu](https://github.com/haoqixu)
|
译者:[haoqixu](https://github.com/haoqixu)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -0,0 +1,118 @@
|
|||||||
|
一行命令轻松升级 Ubuntu
|
||||||
|
======
|
||||||
|
|
||||||
|
![Upgrade Ubuntu to a newer version with a single command][3]
|
||||||
|
|
||||||
|
[zzupdate][1] 是一个开源的命令行程序,通过将几个更新命令组合到一个命令中,使得将 Ubuntu 桌面和服务器版本升级到更新版本的任务变得容易一些。
|
||||||
|
|
||||||
|
将 Ubuntu 系统升级到更新的版本并不是一项艰巨的任务。无论是使用 GUI 还是使用几个命令,都可以轻松地将系统升级到最新版本。
|
||||||
|
|
||||||
|
另一方面,Gianluigi 'Zane' Zanettini 写的 `zzupdate` 只需一个命令就可以在 Ubuntu 中清理、更新、自动删除、版本升级、该工具自我更新。
|
||||||
|
|
||||||
|
它会清理本地缓存,更新可用的软件包信息,然后执行发行版升级。接着,它会更新该工具并删除未使用的软件包。
|
||||||
|
|
||||||
|
该脚本必须以 root 用户身份运行。
|
||||||
|
|
||||||
|
### 安装 zzupdate 将 Ubuntu 升级到更新的版本
|
||||||
|
|
||||||
|
要安装 `zzupdate`,请在终端中执行以下命令。
|
||||||
|
|
||||||
|
```
|
||||||
|
curl -s https://raw.githubusercontent.com/TurboLabIt/zzupdate/master/setup.sh | sudo sh
|
||||||
|
```
|
||||||
|
|
||||||
|
然后将提供的示例配置文件复制到 `zzupdate.conf` 并设置你的首选项。
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo cp /usr/local/turbolab.it/zzupdate/zzupdate.default.conf /etc/turbolab.it/zzupdate.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
完成后,只要使用下面的命令,它就会开始升级你的 Ubuntu 系统到一个更新的版本(如果有的话)。
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo zzupdate
|
||||||
|
```
|
||||||
|
|
||||||
|
请注意,在普通版本(非 LTS 版本)下,zzupdate 会将系统升级到下一个可用的版本。但是,当你运行 Ubuntu 16.04 LTS 时,它将尝试仅搜索下一个长期支持版本,而不是可用的最新版本。
|
||||||
|
|
||||||
|
如果你想退出 LTS 版本并升级到最新版本,你将需要更改一些选项。
|
||||||
|
|
||||||
|
对于 Ubuntu 桌面,打开 **软件和更新** 和下面 **更新** 选项卡,并更改通知我新的 Ubuntu 版本选项为 “**对于任何新版本**”。
|
||||||
|
|
||||||
|
![Software Updater in Ubuntu][4]
|
||||||
|
|
||||||
|
对于 Ubuntu 服务版,编辑 `release-upgrades` 文件。
|
||||||
|
|
||||||
|
```
|
||||||
|
vi /etc/update-manager/release-upgrades
|
||||||
|
|
||||||
|
Prompt=normal
|
||||||
|
```
|
||||||
|
|
||||||
|
### 配置 zzupdate [可选]
|
||||||
|
|
||||||
|
`zzupdate` 要配置的选项:
|
||||||
|
|
||||||
|
```
|
||||||
|
REBOOT=1
|
||||||
|
```
|
||||||
|
|
||||||
|
如果值为 1,升级后系统将重启。
|
||||||
|
|
||||||
|
```
|
||||||
|
REBOOT_TIMEOUT=15
|
||||||
|
```
|
||||||
|
|
||||||
|
将重启超时设置为 900 秒,因为某些硬件比其他硬件重启需要更长的时间。
|
||||||
|
|
||||||
|
```
|
||||||
|
VERSION_UPGRADE=1
|
||||||
|
```
|
||||||
|
|
||||||
|
如果升级可用,则执行版本升级。
|
||||||
|
|
||||||
|
```
|
||||||
|
VERSION_UPGRADE_SILENT=0
|
||||||
|
```
|
||||||
|
|
||||||
|
自动显示版本进度。
|
||||||
|
|
||||||
|
```
|
||||||
|
COMPOSER_UPGRADE=1
|
||||||
|
```
|
||||||
|
|
||||||
|
值为 “1” 会自动升级该工具。
|
||||||
|
|
||||||
|
```
|
||||||
|
SWITCH_PROMPT_TO_NORMAL=0
|
||||||
|
```
|
||||||
|
|
||||||
|
此功能将 Ubuntu 版本更新为普通版本,即如果你运行着 LTS 发行版,`zzupdate` 将不会将其升级到 Ubuntu 17.10(如果其设置为 0)。它将仅搜索 LTS 版本。相比之下,无论你运行着 LTS 或者普通版,“1” 都将搜索最新版本。
|
||||||
|
|
||||||
|
完成后,你要做的就是在控制台中运行一个完整的 Ubuntu 系统更新。
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo zzupdate
|
||||||
|
```
|
||||||
|
|
||||||
|
### 最后的话
|
||||||
|
|
||||||
|
尽管 Ubuntu 的升级过程本身就很简单,但是 zzupdate 将它简化为一个命令。不需要编码知识,这个过程完全是配置文件驱动。我个人发现这是一个很好的更新几个 Ubuntu 系统的工具,而无需单独关心不同的事情。
|
||||||
|
|
||||||
|
你愿意试试吗?
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/zzupdate-upgrade-ubuntu/
|
||||||
|
|
||||||
|
作者:[Ambarish Kumar][a]
|
||||||
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://itsfoss.com
|
||||||
|
[1]:https://github.com/TurboLabIt/zzupdate
|
||||||
|
[2]:data:image/gif;base64,R0lGODdhAQABAPAAAP///wAAACwAAAAAAQABAEACAkQBADs=
|
||||||
|
[3]:https://itsfoss.com/wp-content/uploads/2017/11/upgrade-ubuntu-single-command-featured-800x450.jpg
|
||||||
|
[4]:https://itsfoss.com/wp-content/uploads/2017/11/software-update-any-new-version-800x378.jpeg
|
@ -0,0 +1,77 @@
|
|||||||
|
Linux 下如何修改用户名(同时修改用户组名和家目录)
|
||||||
|
======
|
||||||
|
|
||||||
|
有时候,由于某些原因,我们可能会需要重命名用户名。我们可以很容易地修改用户名以及对应的家目录和 UID。
|
||||||
|
|
||||||
|
本教程将会讨论这些东西。让我们先从修改用户名开始。
|
||||||
|
|
||||||
|
### 修改用户名
|
||||||
|
|
||||||
|
我们使用 `usermod` 来修改用户名。其语法为,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ usermod -l new_username old_username
|
||||||
|
```
|
||||||
|
|
||||||
|
举个例子,假设我们有一个名叫 `dan` 的用户想要重命名为 `susan`,那么在终端下执行下面命令:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo usermod -l susan dan
|
||||||
|
```
|
||||||
|
|
||||||
|
这只会更改用户名,而其他的东西,比如用户组,家目录,UID 等都保持不变。
|
||||||
|
|
||||||
|
**注意:-** 你需要从要改名的帐号中登出并杀掉该用户的所有进程,要杀掉该用户的所有进程可以执行下面命令,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo pkill -u dan
|
||||||
|
$ sudo pkill -9 -u dan
|
||||||
|
```
|
||||||
|
|
||||||
|
### 修改家目录
|
||||||
|
|
||||||
|
要同时更改家目录,我们需要在执行 `usermod` 命令的同时加上 `-d` 选项,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo usermod -d /home/susan -m susan
|
||||||
|
```
|
||||||
|
|
||||||
|
### 更改用户 UID
|
||||||
|
|
||||||
|
执行下面命令修改用户 UID,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo usermod -u 2000 susan
|
||||||
|
```
|
||||||
|
|
||||||
|
这里 `2000` 就是用户的新 UID。
|
||||||
|
|
||||||
|
### 修改用户组名
|
||||||
|
|
||||||
|
要把用户组名从 `dan` 修改为 `susan`,我们需要使用 `groupmod` 命令。使用下面命令来修改用户组名,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ groupmod -n susan dan
|
||||||
|
```
|
||||||
|
|
||||||
|
做完修改后,可以使用 `id` 命令来检查,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ id susan
|
||||||
|
```
|
||||||
|
|
||||||
|
这篇教导如何修改用户名的指南就此结束了。有任何疑问或建议,欢迎给我们留言。
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: http://linuxtechlab.com/rename-user-in-linux-rename-home-directory/
|
||||||
|
|
||||||
|
作者:[Shusain][a]
|
||||||
|
译者:[lujun9972](https://github.com/lujun9972)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:http://linuxtechlab.com/author/shsuain/
|
||||||
|
[1]:http://linuxtechlab.com/use-of-find-command/
|
@ -0,0 +1,145 @@
|
|||||||
|
2018 年开源技术 10 大发展趋势
|
||||||
|
============================================================
|
||||||
|
|
||||||
|
> 你是否关注过开源技术的发展趋势? 这里是 10 个预测。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
*图片来源:[Mitch Bennett][10]. [Opensource.com][31] 修改*
|
||||||
|
|
||||||
|
技术一直在变革,诸如 OpenStack、<ruby>增强型网页应用<rt>Progressive Web App</rt></ruby>(PWA)、Rust、R、<ruby>认知云<rt>the cognitive cloud</rt></ruby>、人工智能(AI),物联网等一些新技术正在颠覆我们对世界的固有认知。以下概述了 2018 年最可能成为主流的开源技术。
|
||||||
|
|
||||||
|
### 1、 OpenStack 认可度持续高涨
|
||||||
|
|
||||||
|
[OpenStack][12] 本质上是一个云操作平台(系统),它为管理员提供直观友好的控制面板,以便对大量的计算、存储和网络资源进行配置和监管。
|
||||||
|
|
||||||
|
目前,很多企业运用 OpenStack 平台搭建和管理云计算系统。得益于其灵活的生态系统、透明度和运行速度,OpenStack 越来越流行。相比其他替代方案,OpenStack 只需更少的花费便能轻松支持任务关键型应用程序。
|
||||||
|
但是,其复杂的结构以及其对虚拟化、服务器和大量网络资源的严重依赖使得不少企业对使用 OpenStack 心存顾虑。另外,想要用好 OpenStack,好的硬件支持和高水平的员工二者缺一不可。
|
||||||
|
|
||||||
|
OpenStack 基金会一直在致力于完善他们的产品。一些功能创新,无论是已经发布的还是尚处于打造阶段,都将解决许多 OpenStack 潜在的问题。随着其结构复杂性降低,OpenStack 将获取更大认可。加之众多大型的软件开发及托管公司以及成千上万会员的支持, OpenStack 在云计算时代前途光明。
|
||||||
|
|
||||||
|
### 2、 PWA 或将大热
|
||||||
|
|
||||||
|
PWA,即 <ruby>[增强型网页应用][13]<rt>Progressive Web App</rt></ruby>,是对技术、设计和<ruby>网络应用程序接口<rt>Web API</rt></ruby>的整合,它能够在移动浏览器上提供类似应用的体验。
|
||||||
|
|
||||||
|
传统的网站有许多与生俱来的缺点。虽然应用(app)提供了比网站更加个性化、用户参与度更高的体验,但是却要占用大量的系统资源;并且要想使用应用,你还必须提前下载安装。PWA 则扬长避短,它可用浏览器访问、可被引擎搜索检索,并可响应式适应外在环境,为用户提供应用级体验。PWA 也能像应用一样自我更新,总是显示最新的实时信息,并且像网站一样,以极其安全的 HTTPS 模式递交信息。PWA 运行于标准容器中,无须安装,任何人只要输入 URL 即可访问。
|
||||||
|
|
||||||
|
现在的移动用户看重便利性和参与度,PWAs 的特性完美契合这一需求,所以 PWA 成为主流是必然趋势。
|
||||||
|
|
||||||
|
### 3、 Rust 成开发者新宠
|
||||||
|
|
||||||
|
大多数的编程语言都需在安全和控制二者之间折衷,但 [Rust][14] 是一个例外。Rust 使用广泛的编译时检查进行 100% 的控制而不影响程序安全性。上一次 [Pwn2Own][15] 竞赛找出了 Firefox C++ 底层实现的许多严重漏洞。如果 Firefox 是用 Rust 编写的,这些漏洞在产品发布之前的编译阶段就会被发现并解决。
|
||||||
|
|
||||||
|
Rust 独特的内建单元测试方式使开发者们考虑将其作为首选的开源语言。它是 C 和 Python 等其他编程语言有效的替代方案,Rust 可以在不损失程序可读性的情况下写出安全的代码。总之,Rust 前途光明。
|
||||||
|
|
||||||
|
### 4、 R 用户群在壮大
|
||||||
|
|
||||||
|
[R][16] 编程语言,是一个与统计计算和图像呈现相关的 [GUN 项目][32]。它提供了大量的统计和图形技术,并且可扩展增强。它是 [S][17] 语言的延续。S 语言早已成为统计方法学的首选工具,R 为数据操作、计算和图形显示提供了开源选择。R 语言的另一个优势是对细节的把控和对细微差别的关注。
|
||||||
|
|
||||||
|
和 Rust 一样,R 语言也处于上升期。
|
||||||
|
|
||||||
|
### 5、 广义的 XaaS
|
||||||
|
|
||||||
|
XaaS 是 “<ruby>一切皆服务<rt>anything as a service</rt></ruby>” 的缩写,是通过网络提供的各种线上服务的总称。XaaS 的外延正在扩大,软件即服务(SaaS)、基础设施即服务(IaaS) 和平台即服务(PaaS)等观念已深入人心,新兴的基于云的服务如网络即服务(NaaS)、存储即服务(SaaS 或 StaaS)、监控即服务(MaaS)以及通信即服务(CaaS)等概念也正在普及。我们正在迈向一个万事万物 “皆为服务” 的世界。
|
||||||
|
|
||||||
|
现在,XaaS 的概念已经延伸到实体企业。著名的例子有 Uber 、Lyft 和 Airbnb,前二者利用新科技提供交通服务,后者提供住宿服务。
|
||||||
|
|
||||||
|
高速网络和服务器虚拟化使得强大的计算能力成为可能,这加速了 XaaS 的发展,2018 年可能是 “XaaS 年”。XaaS 无与伦比的灵活性、可扩展性将推动 XaaS 进一步发展。
|
||||||
|
|
||||||
|
### 6、 容器技术越来越受欢迎
|
||||||
|
|
||||||
|
[容器技术][28],是用标准化方法打包代码的技术,它使得代码能够在任意环境中快速地 “接入并运行”。容器技术让企业可以削减经费、降低实施周期。尽管容器技术在 IT 基础结构改革方面的已经初显潜力,但事实上,运用好容器技术仍然比较复杂。
|
||||||
|
|
||||||
|
容器技术仍在发展中,技术复杂性随着各方面的进步在下降。最新的技术让容器使用起来像使用智能手机一样简单、直观,更不用说现在的企业需求:速度和灵活性往往能决定业务成败。
|
||||||
|
|
||||||
|
### 7、 机器学习和人工智能的更广泛应用
|
||||||
|
|
||||||
|
[机器学习和人工智能][18] 指在没有程序员给出明确的编码指令的情况下,机器具备自主学习并且积累经验自我改进的能力。
|
||||||
|
|
||||||
|
随着一些开源技术利用机器学习和人工智能实现尖端服务和应用,这两项技术已经深入人心。
|
||||||
|
|
||||||
|
[Gartner][19] 预测,2018 年机器学习和人工智能的应用会更广。其他一些领域诸如数据准备、集成、算法选择、学习方法选择、模块制造等随着机器学习的加入将会取得很大进步。
|
||||||
|
|
||||||
|
全新的智能开源解决方案将改变人们和系统交互的方式,转变由来已久的工作观念。
|
||||||
|
|
||||||
|
* 机器交互,像[聊天机器人][29]这样的对话平台,提供“问与答”的体验——用户提出问题,对话平台作出回应,成为人机之间默认的交互界面。
|
||||||
|
* 无人驾驶和无人机现在已经家喻户晓了,2018 年将会更司空见惯。
|
||||||
|
* 沉浸式体验的应用不再仅仅局限于视频游戏,在真实的生活场景比如设计、培训和可视化过程中都能看到沉浸式体验的身影。
|
||||||
|
|
||||||
|
### 8、 区块链将成为主流
|
||||||
|
|
||||||
|
自比特币应用区块链技术以来,其已经取得了重大进展,并且已广泛应用在金融系统、保密选举、学历验证等领域中。未来几年,区块链会在医疗、制造业、供应链物流、政府服务等领域中大展拳脚。
|
||||||
|
|
||||||
|
区块链分布式存储数据信息,这些数据信息依赖于数百万个共享数据库的节点。区块链不被任意单一所有者控制,并且单个损坏的节点不影响其正常运行,区块链的这两个特性让它异常健壮、透明、不可破坏。同时也规避了有人从中篡改数据的风险。区块链强大的先天优势足够支撑其成为将来主流技术。
|
||||||
|
|
||||||
|
### 9、 认知云粉墨登场
|
||||||
|
|
||||||
|
认识技术,比如前面所述的机器学习和人工智能,用于为多行业提供简单化和个性化服务。一个典型例子是金融行业的游戏化应用,其为投资者提供了严谨的投资建议,降低投资模块的复杂程度。数字信托平台使得金融机构的身份认证过程较以前精简 80%,提升了合规性,降低了诈骗比率。
|
||||||
|
|
||||||
|
认知云技术现在正向云端迁移,借助云,它将更加强大。[IBM Watson][33] 是认知云应用最知名的例子。IBM 的 UIMA 架构是开源的,由 Apache 基金会负责维护。DARPA(美国国防高级研究计划局)的 DeepDive 项目借鉴了 Watson 的机器学习能力,通过不断学习人类行为来增强决策能力。另一个开源平台 [OpenCog][34] ,为开发者和数据科学家开发人工智能应用程序提供支撑。
|
||||||
|
|
||||||
|
考虑到实现先进的、个性化的用户体验风险较高,这些认知云平台来年时机成熟时才会粉墨登场。
|
||||||
|
|
||||||
|
### 10、 物联网智联万物
|
||||||
|
|
||||||
|
物联网(IoT)的核心在于建立小到嵌入式传感器、大至计算机设备的相互连接,让其(“物”)相互之间可以收发数据。毫无疑问,物联网将会是科技界的下一个 “搅局者”,但物联网本身处于一个不断变化的状态。
|
||||||
|
|
||||||
|
物联网最广为人知的产品就是 IBM 和三星合力打造的去中心化 P2P 自动遥测系统([ADEPT][20])。它运用和区块链类似的技术来构建一个去中心化的物联网。没有中央控制设备,“物” 之间通过自主交流来进行升级软件、处理 bug、管理电源等等一系列操作。
|
||||||
|
|
||||||
|
### 开源推动技术创新
|
||||||
|
|
||||||
|
[数字化颠覆][30]是当今以科技为中心的时代的常态。在技术领域,开放源代码正在逐渐普及,其在 2018 将年成为大多数技术创新的驱动力。
|
||||||
|
|
||||||
|
此榜单对开源技术趋势的预测有遗漏?在评论区告诉我们吧!
|
||||||
|
|
||||||
|
|
||||||
|
### 关于作者
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
[**Sreejith Omanakuttan**][21] - 自 2000 年开始编程,2007年开始从事专业工作。目前在 [Fingent][6] 领导开源团队,工作内容涵盖不同的技术层面,从“无聊的工作”(?)到前沿科技。有一套 “构建—修复—推倒重来” 工作哲学。在领英上关注我: https://www.linkedin.com/in/futuregeek/
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/17/11/10-open-source-technology-trends-2018
|
||||||
|
|
||||||
|
作者:[Sreejith Omanakuttan][a]
|
||||||
|
译者:[wangy325](https://github.com/wangy25)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://opensource.com/users/sreejith
|
||||||
|
[1]:https://opensource.com/resources/what-is-openstack?intcmp=7016000000127cYAAQ
|
||||||
|
[2]:https://opensource.com/resources/openstack/tutorials?intcmp=7016000000127cYAAQ
|
||||||
|
[3]:https://opensource.com/tags/openstack?intcmp=7016000000127cYAAQ
|
||||||
|
[4]:https://www.rdoproject.org/?intcmp=7016000000127cYAAQ
|
||||||
|
[5]:https://opensource.com/article/17/11/10-open-source-technology-trends-2018?rate=GJqOXhiWvZh0zZ6WVTUzJ2TDJBpVpFhngfuX9V-dz4I
|
||||||
|
[6]:https://www.fingent.com/
|
||||||
|
[7]:https://www.linkedin.com/in/futuregeek/
|
||||||
|
[9]:https://opensource.com/user/185026/feed
|
||||||
|
[10]:https://www.flickr.com/photos/mitchell3417/9206373620
|
||||||
|
[11]:https://creativecommons.org/licenses/by-sa/4.0/
|
||||||
|
[12]:https://www.openstack.org/
|
||||||
|
[13]:https://developers.google.com/web/progressive-web-apps/
|
||||||
|
[14]:https://www.rust-lang.org/
|
||||||
|
[15]:https://en.wikipedia.org/wiki/Pwn2Own
|
||||||
|
[16]:https://en.wikipedia.org/wiki/R_(programming_language)
|
||||||
|
[17]:https://en.wikipedia.org/wiki/S_(programming_language)
|
||||||
|
[18]:https://opensource.com/tags/artificial-intelligence
|
||||||
|
[19]:https://sdtimes.com/gartners-top-10-technology-trends-2018/
|
||||||
|
[20]:https://insights.samsung.com/2016/03/17/block-chain-mobile-and-the-internet-of-things/
|
||||||
|
[21]:https://opensource.com/users/sreejith
|
||||||
|
[22]:https://opensource.com/users/sreejith
|
||||||
|
[23]:https://opensource.com/users/sreejith
|
||||||
|
[24]:https://opensource.com/article/17/11/10-open-source-technology-trends-2018#comments
|
||||||
|
[25]:https://opensource.com/tags/business
|
||||||
|
[26]:https://opensource.com/tags/yearbook
|
||||||
|
[27]:https://opensource.com/yearbook/2017
|
||||||
|
[28]:https://www.techopedia.com/2/31967/trends/open-source/container-technology-the-next-big-thing
|
||||||
|
[29]:https://en.wikipedia.org/wiki/Chatbot
|
||||||
|
[30]:https://cio-wiki.org/home/loc/home?page=digital-disruption
|
||||||
|
[31]:https://opensource.com/
|
||||||
|
[32]:https://en.wikipedia.org/wiki/GNU_Project
|
||||||
|
[33]:https://en.wikipedia.org/wiki/Watson_(computer)
|
||||||
|
[34]:https://en.wikipedia.org/wiki/OpenCog
|
@ -0,0 +1,61 @@
|
|||||||
|
如何为你的科技书籍找到出版商
|
||||||
|
============================================================
|
||||||
|
|
||||||
|
> 想去写一本科技书籍是一个好的想法,但你还需要去了解一下出版业的运作过程。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
你有一个写本科技书籍的想法,那么祝贺你!就像在阿巴拉契亚山脉徒步旅行,或者是去学做一种蛋奶酥,写书是人们经常讨论的话题之一,但是却都只停留在思考的初级阶段。那是可以理解的,因为失败的几率是很高的。要想实现它,你需要在把自己的想法阐述给出版商,去探讨是否已经做好充分的准备去写成一本书。要去实现这一步是相当困难的,但缺乏关于如何做这件事的信息会使事情变得复杂。
|
||||||
|
|
||||||
|
如果你想和一家传统的出版商合作,那么你需要在他们面前推销你的书稿以期望能够得到出版的机会。因为我是 [Pragmatci Bookshelf][4] 的总编,所以经常看到很多的选题,也去帮助作者制作出好的作品。这些选题中有些是好的,有些则不然,但我经常会看到许多不符合我们出版社风格的文稿。我会帮助你找到最适合的出版商,来让你的想法得到认可。
|
||||||
|
|
||||||
|
### 确定你的目标
|
||||||
|
|
||||||
|
你的第一步是要找出最适合你的想法的出版商。首先,想想你经常买书的以及你喜欢的出版商,你的书会被像你自己一样的人喜欢的几率是很高的,所以从你自己最喜欢的出版商开始,列出一个简短的列表将会大大缩小你的搜索范围。如果你自己所买的书籍并不多。那么可以去书店逛逛,或者在亚马逊网站上看看。 列一个你自己喜欢的几家出版商的清单出来。
下一步,筛选出你期望的出版商,尽管大多数技术类出版商看起来没什么差别,但他们通常各有不同的读者群体。有些出版商会选择广受欢迎的话题,如 C++ 或者 Java,那么你以 Elixir 为主题的书稿就可能不适合那个出版商;如果你的书稿是关于教授小孩学习编程的,那么你可能就不想让学术出版商来出版。
一旦确定了一些目标,你就可以在他们的商品目录、网站或者亚马逊上对其进行进一步的调查,去寻找有哪些书籍和你的思想是相符的。如果他们能有一本和你自己的书稿主题一样或很相近的书,那么你将很难说服他们和你签约。但那并不意味着已经可以把这样的出版商从你的列表中划掉,你可以将自己的书稿主题进行适当的修改以将它和已经发行的书区别开来:比如定位于不同的读者群体,或者不同层次的技能水平。也许已发行的那本书已经过时了,你就可以专注于该技术领域里的新方法,确保你的书稿能够弥补现有书的不足,更加完善,而不是单纯的竞争。
如果你锁定的出版商没有出版过类似的书籍,也许这将会是个好迹象,但也许是个坏迹象。有时候一些供应商不会选择去出版一些专业技术方面的书籍,或者是因为他们认为自己的读者不会感兴趣,也可能是因为他们曾经在这块领域遇到过麻烦。新的语言或者类库一直在不停地涌现出来,出版商们不得不去琢磨什么样的书籍内容将会吸引他们的读者群体。他们的评估标准可能和你的是不一样的。他们已经有了最终决定,也可能是还在等待合适的选题。判断究竟是哪一种的唯一方法就是提出文稿并找出答案。
|
||||||
|
|
||||||
|
### 建立起你自己的网络
|
||||||
|
|
||||||
|
确定一家出版商是第一步;现在你需要与其建立联系。不幸的是,出版需要的仍旧是你认识什么人,而不是你知道什么。你需要认识的那个人是一个去发现新市场、新作者和新选题的策划编辑。如果你认识某个和出版商有关系的人,请他给你介绍一位策划编辑。这些策划编辑往往负责一个专题板块,尤其是在较大的出版商,但你并非一定要找到符合你书稿的专题板块的编辑。各类板块的编辑通常都会很乐意将你介绍给合适的编辑。
|
||||||
|
有时候你也许能够在一个技术会议上找到一个策划编辑,特别是在出版商同时也是赞助商,而且还有一个展台时。即使当时并没有一个策划编辑在场,展台的其他工作人员也能够帮你和策划编辑建立联系。 如果会议不符合你的主题思想,那就需要你利用自己的社交网络来获得别人的推荐。比如使用 LinkedIn,或者其他非正式的联系方式,去和一个编辑建立联系。
对于小型的出版商,你可能会在公司网站上发现策划编辑的名单,如果你够幸运的话,还可以找到他们的联系信息。如果找不到联系方式的话,可以在推特上搜寻出版商的名字,试试能否找到他们的编辑的信息,在社交媒体上去寻找一位陌生的人,然后把自己的书稿推荐给他,这也许会让你有些紧张,但是你真的不必去担心这些,建立联系也是策划编辑的工作之一。最坏的结果只不过是他们忽视你而已。
一旦建立起联系,策划编辑将会协助你进行下一步。他们可能会立刻对你的书稿给予反馈,或者在他们可能想让你根据他们的指导来修改你的文章,使其变得更加充实。当你经过努力找到了一名策划编辑后,多听从他们的建议,因为他们比你更熟悉出版商的运作流程。
|
||||||
|
|
||||||
|
### 如果其他的方法都失败了
|
||||||
|
|
||||||
|
如果你无法联系到一名策划编辑,出版商通常会有一个<ruby>书稿盲投<rt>proposal alias</rt></ruby>的方式来接受投稿,通常是 `proposals@[publisher].com` 的格式。 查找他们网站的介绍,找到如何去发送书稿;有的出版商是有特殊的要求的。你需要遵循他们的要求,如果不这样做的话,你的书稿将会被丢弃,它不会被任何人阅读。如果你有疑问,或者不确定出版商的意图,那么你需要再尝试着去找一名编辑进一步地沟通,因为书稿并不能回答那些问题。整理他们对你的要求(一篇独立的主题文章),发给他们,然后你要做的就是期望能够得到满意的答复。
|
||||||
|
|
||||||
|
### 等待
|
||||||
|
|
||||||
|
无论你是如何与一个出版商取得联系的,你也得等待着。如果你已经投递了书稿,也许要过一段时间才有人去处理你的稿件,特别是在一些大公司。即使你已经找了一位策划编辑去处理你的投稿,你可能也只是他同时在处理的潜在目标之一,所以你可能不会很快得到答复。几乎所有的出版商都会在最终确认之前召开一次组委会来决定接受哪个稿件,所以即使你的书稿已经足够的优秀,并且可以出版了,你也仍然需要等待组委会开会讨论。你可能需要等待几周,甚至是一个月的时间。
|
||||||
|
几周过后,你可以和编辑再联系一下,看看他们是否需要更多的信息。在邮件中你要表现出足够的礼貌;如果他们仍然没有回复,也许是因为他们有太多的投稿需要处理,即使你不停地催促也不会让你的稿件被提前处理。一些出版商有可能永远不会回复你,也不会去发一份退稿的通知给你,但那种情况并不常见。在这种情况下你除了耐心地等待也没有别的办法,如果几个月后也没有人回复你邮件,你完全可以去接触另一个出版商或者干脆考虑自出版。
|
||||||
|
|
||||||
|
### 祝好运
|
||||||
|
|
||||||
|
如果你觉得这个过程看起来让你感觉有些混乱和不科学,这是很正常的。能够得到出版要在合适的时间地点,与合适的人沟通,而且还要期待他们此时有好的心情。你无法去控制这些不确定的因素,但是更好地了解行业的工作方式,以及出版商的需求,可以帮助你完善它们。
|
||||||
|
寻找一个出版商只是万里长征的第一步。你需要提炼你的思想,并创建选题,以及其他方面的考虑。在今年的 SeaGLS 上,我对整个过程做了[介绍][5]。查看[视频][6]可以获取更详细的信息。
|
||||||
|
|
||||||
|
### 关于作者
|
||||||
|
|
||||||
|
[][7]
|
||||||
|
|
||||||
|
麦克唐纳先生现在是 Pragmatic Bookshelf 的总编。过去 20 年在技术出版领域生涯中,他是一名编辑、一名作者,偶尔还去客串演讲者或者讲师。他现在把大量的时间都用来和新作者探讨如何更好地表达出他们的想法。你可以关注他的推特@bmac_editor。
如果这篇文章点燃你写书的热情,但又不知道如何找到合适的途径联系出版商,不如逛逛像异步社区这样的网站,按照上文的步骤尝试一下,也许能够发现新的希望。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/17/12/how-find-publisher-your-book
|
||||||
|
|
||||||
|
作者:[Brian MacDonald][a]
|
||||||
|
译者:[FelixYFZ](https://github.com/FelixYFZ)
|
||||||
|
校对:[wxy](https://github.com/wxy), 陈聪聪
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://opensource.com/users/bmacdonald
|
||||||
|
[1]:https://opensource.com/article/17/12/how-find-publisher-your-book?rate=o42yhdS44MUaykAIRLB3O24FvfWxAxBKa5WAWSnSY0s
|
||||||
|
[2]:https://opensource.com/users/bmacdonald
|
||||||
|
[3]:https://opensource.com/user/190176/feed
|
||||||
|
[4]:https://pragprog.com/
|
||||||
|
[5]:https://archive.org/details/SeaGL2017WritingTheNextGreatTechBook
|
||||||
|
[6]:https://archive.org/details/SeaGL2017WritingTheNextGreatTechBook
|
||||||
|
[7]:https://opensource.com/users/bmacdonald
|
||||||
|
[8]:https://opensource.com/users/bmacdonald
|
||||||
|
[9]:https://opensource.com/users/bmacdonald
|
||||||
|
[10]:https://opensource.com/article/17/12/how-find-publisher-your-book#comments
|
@ -1,8 +1,7 @@
|
|||||||
Ubuntu 18.04 – 新功能,发行日期和更多信息
|
Ubuntu 18.04 新功能、发行日期和更多信息
|
||||||
============================================================
|
============================================================
|
||||||
|
|
||||||
|
我们一直都在翘首以盼 —— 新的 Ubuntu 的 LTS 版本 —— 18.04。了解有关新功能,发行日期以及更多信息。
|
||||||
我们一直都在翘首以盼 - 新的 Ubuntu 的 LTS 版本 - 18.04。了解有关新功能,发行日期以及更多信息。
|
|
||||||
|
|
||||||
> 提示:我们将经常在这篇文章中更新新的信息,所以请为此页面添加书签,然后再回来查看。
|
> 提示:我们将经常在这篇文章中更新新的信息,所以请为此页面添加书签,然后再回来查看。
|
||||||
|
|
||||||
@ -10,9 +9,8 @@ Ubuntu 18.04 – 新功能,发行日期和更多信息
|
|||||||
|
|
||||||
让我们以一些基本信息开始。
|
让我们以一些基本信息开始。
|
||||||
|
|
||||||
* 这是一个新的 LTS(Long Term Support)版本。所以你得到了对桌面版和服务器版 5 年的支持。
|
* 这是一个新的 LTS(长期支持)版本。所以对桌面版和服务器版有 5 年的支持。
|
||||||
|
* 被命名为 “Bionic Beaver”(仿生河狸)。Canonical 的创始人 Mark Shuttleworth 解释了这个名字背后的含义。吉祥物是一个河狸,因为它充满活力,勤劳,并且是一个很棒工程师 —— 这完美地描述了一个典型的 Ubuntu 用户,以及新的 Ubuntu 发行版本身。使用 “Bionic”(仿生)这个形容词是由于在 Ubuntu Core 上运行的机器人数量的增加。
|
||||||
* 被命名为“Bionic Beaver”(仿生狐狸)。Canonical 的创始人 Mark Shuttleworth 解释了这个名字背后的含义。吉祥物是一个海狸,因为它充满活力,勤劳,并且是一个很棒工程师 - 这完美地描述了一个典型的 Ubuntu 用户,以及新的 Ubuntu 发行版本身。使用“Bionic”(仿生)这个形容词是由于在 Ubuntu Core 上运行的机器人数量的增加。
|
|
||||||
|
|
||||||
### Ubuntu 18.04 发行日期和日程
|
### Ubuntu 18.04 发行日期和日程
|
||||||
|
|
||||||
@ -21,48 +19,39 @@ Ubuntu 18.04 – 新功能,发行日期和更多信息
|
|||||||
对进一步的细节,这里是有关 Ubuntu 18.04 LTS 的重要日期和需要知道的:
|
对进一步的细节,这里是有关 Ubuntu 18.04 LTS 的重要日期和需要知道的:
|
||||||
|
|
||||||
* 2017 年 11 月 30 日 - 功能定义冻结。
|
* 2017 年 11 月 30 日 - 功能定义冻结。
|
||||||
|
|
||||||
* 2018 年 1 月 4 日 - 第一个 Alpha 版本。所以,如果您选择接收新的 Alpha 版本,那么您将在这天获得 Alpha 1 更新。
|
* 2018 年 1 月 4 日 - 第一个 Alpha 版本。所以,如果您选择接收新的 Alpha 版本,那么您将在这天获得 Alpha 1 更新。
|
||||||
|
|
||||||
* 2018 年 2 月 1 日 - 第二个 Alpha 版本。
|
* 2018 年 2 月 1 日 - 第二个 Alpha 版本。
|
||||||
|
|
||||||
* 2018 年 3 月 1 日 - 功能冻结。将不会引入或发布新功能。所以开发团队只会在改进现有功能和修复错误上努力。当然也有例外。如果您不是开发人员或有经验的用户,但仍想尝试新的 Ubuntu ASAP,那么我个人建议从此版本开始。
|
* 2018 年 3 月 1 日 - 功能冻结。将不会引入或发布新功能。所以开发团队只会在改进现有功能和修复错误上努力。当然也有例外。如果您不是开发人员或有经验的用户,但仍想尝试新的 Ubuntu ASAP,那么我个人建议从此版本开始。
|
||||||
|
* 2018 年 3 月 8 日 - 第一个 Bata 版本。如果您选择接收 Bata 版更新,则会在当天得到更新。
|
||||||
* 2018 年 3 月 8 日 - 第一次 Bata 版本。如果您选择接收 Bata 版更新,则会在当天得到更新。
|
* 2018 年 3 月 22 日 - 用户界面冻结。这意味着不会对实际的用户界面做进一步的更改或更新,因此,如果您编写文档,[教程][1],并使用屏幕截图,那时开始是可靠的。
|
||||||
|
|
||||||
* 2018 年 3 月 22 日 - 用户界面冻结。这意味着不会对实际的用户界面做进一步的更改或更新,因此,如果您编写文档,[教程][1],并使用屏幕截图,那时启动是安全的。
|
|
||||||
|
|
||||||
* 2018 年 3 月 29 日 - 文档字符串冻结。将不会有任何编辑或新的东西(字符串)添加到文档中,所以翻译者可以开始翻译文档。
|
* 2018 年 3 月 29 日 - 文档字符串冻结。将不会有任何编辑或新的东西(字符串)添加到文档中,所以翻译者可以开始翻译文档。
|
||||||
|
|
||||||
* 2018 年 4 月 5 日 - 最终 Beta 版本。这也是开始使用新版本的好日子。
|
* 2018 年 4 月 5 日 - 最终 Beta 版本。这也是开始使用新版本的好日子。
|
||||||
|
|
||||||
* 2018 年 4 月 19 日 - 最终冻结。现在一切都已经完成了。版本的图像被创建和分发,并且可能不会有任何更改。
|
* 2018 年 4 月 19 日 - 最终冻结。现在一切都已经完成了。版本的图像被创建和分发,并且可能不会有任何更改。
|
||||||
|
* 2018 年 4 月 26 日 - 官方最终版本的 Ubuntu 18.04。每个人都可以从这一天开始使用它,即使在生产服务器上。我们建议从 [Vultr][2] 获得 Ubuntu 18.04 服务器并测试新功能。[Vultr][3] 的服务器每月起价为 2.5 美元。(LCTT 译注:这是原文广告!)
|
||||||
* 2018 年 4 月 26 日 - 官方最终版本的 Ubuntu 18.04。每个人都应该从今天开始使用它,即使在生产服务器上。我们建议从[Vultr][2]获得 Ubuntu 18.04 服务器并测试新功能。[Vultr][3]的服务器每月起价为 2.5 美元。
|
|
||||||
|
|
||||||
### Ubuntu 18.04 的新功能
|
### Ubuntu 18.04 的新功能
|
||||||
|
|
||||||
在 Ubuntu 18.04 LTS 上的所有新功能:
|
在 Ubuntu 18.04 LTS 上的所有新功能:
|
||||||
|
|
||||||
### 彩色表情符号现已支持
|
#### 现已支持彩色表情符号
|
||||||
|
|
||||||
在以前的版本中,Ubuntu 只支持单色(黑和白)表情符号,坦白地说,它看起来不是太好。Ubuntu 18.04 将使用[Noto Color Emoji font][7]来支持彩色表情符号。随着 18.04,你可以在任何地方轻松查看和添加颜色表情符号。他们是本地支持的 - 所以你可以使用它们,而不使用第三方应用程序或安装/配置任何额外的东西。你可以随时通过删除字体来禁用彩色表情符号。
|
在以前的版本中,Ubuntu 只支持单色(黑和白)表情符号,坦白地说,它看起来不是太好。Ubuntu 18.04 将使用[Noto Color Emoji font][7] 来支持彩色表情符号。随着 18.04,你可以在任何地方轻松查看和添加颜色表情符号。它们是原生支持的 —— 所以你可以使用它们,而不用使用第三方应用程序或安装/配置任何额外的东西。你可以随时通过删除该字体来禁用彩色表情符号。
|
||||||
|
|
||||||
### GNOME 桌面环境
|
#### GNOME 桌面环境
|
||||||
|
|
||||||
[][8]
|
[][8]
|
||||||
|
|
||||||
Ubuntu 从 Ubuntu 17.10 开始使用的 GNOME 桌面环境,而不是默认的 Unity 环境。Ubuntu 18.04 将继续使用 GNOME。这是 Ubuntu 的一个重要的变化。
|
Ubuntu 从 Ubuntu 17.10 开始使用 GNOME 桌面环境,而不是默认的 Unity 环境。Ubuntu 18.04 将继续使用 GNOME。这是 Ubuntu 的一个重要的变化。
|
||||||
|
|
||||||
### Ubuntu 18.04 桌面将有一个新的默认主题
|
#### Ubuntu 18.04 桌面将有一个新的默认主题
|
||||||
|
|
||||||
Ubuntu 18.04 正在用新的 GTK 主题以告别旧的默认主题 “Ambience”。如果你想帮助新的主题,看看一些截图甚至更多,去[这里][9]。
|
Ubuntu 18.04 正在用新的 GTK 主题以告别旧的默认主题 “Ambience”。如果你想帮助新的主题,看看一些截图甚至更多,去[这里][9]。
|
||||||
|
|
||||||
到目前为止,有人猜测 Suru 将成 为 Ubuntu 18.04 的[新默认图标主题][10]。这里有一个截图:
|
到目前为止,有人猜测 Suru 将成 为 Ubuntu 18.04 的[新默认图标主题][10]。这里有一个截图:
|
||||||
|
|
||||||
[][11]
|
[][11]
|
||||||
|
|
||||||
> 值得注意的是:Ubuntu 16.10,17.04 和 17.10 中的所有新功能都将滚动到 Ubuntu 18.04 中。所以更新像右边的窗口按钮,更好的登录屏幕,改进的蓝牙支持等将推出到Ubuntu 18.04。我们不会包含一个特殊的部分,因为它对 Ubuntu 18.04 本身并不新鲜。如果您想了解更多关于从 16.04 到 18.04 的所有变化,请谷歌搜索它们之间的每个版本。
|
> 值得注意的是:Ubuntu 16.10,17.04 和 17.10 中的所有新功能都将滚动到 Ubuntu 18.04 中,这些更新,如右边的窗口按钮、更好的登录屏幕,改进的蓝牙支持等将推送到 Ubuntu 18.04。对此我们不会特别说明,因为它对 Ubuntu 18.04 本身并不新鲜。如果您想了解更多关于从 16.04 到 18.04 的所有变化,请谷歌搜索它们之间的每个版本。
|
||||||
|
|
||||||
### 下载 Ubuntu 18.04
|
### 下载 Ubuntu 18.04
|
||||||
|
|
||||||
@ -78,49 +67,46 @@ Ubuntu 18.04 正在用新的 GTK 主题以告别旧的默认主题 “Ambience
|
|||||||
|
|
||||||
现在是一些经常被问到的问题(附带答案),这应该能给你关于这一切的更多信息。
|
现在是一些经常被问到的问题(附带答案),这应该能给你关于这一切的更多信息。
|
||||||
|
|
||||||
### 什么时候切换到 Ubuntu 18.04 是安全的?
|
#### 什么时候切换到 Ubuntu 18.04 是安全的?
|
||||||
|
|
||||||
当然是在正式的最终发布日期。但是,如果您等不及,请开始使用 2018 年 3 月 1 日的桌面版本,并在 2018 年 4 月 5 日开始测试服务器版本。但是为了确保安全,您需要等待最终发布,甚至更长时间,使得您正在使用的第三方服务和应用程序经过测试,并在新版本上进行良好运行。
|
当然是在正式的最终发布日期。但是,如果您等不及,请开始使用 2018 年 3 月 1 日的桌面版本,并在 2018 年 4 月 5 日开始测试服务器版本。但是为了确保安全,您需要等待最终发布,甚至更长时间,使得您正在使用的第三方服务和应用程序经过测试,并在新版本上进行良好运行。
|
||||||
|
|
||||||
### 如何将我的服务器升级到 Ubuntu 18.04?
|
#### 如何将我的服务器升级到 Ubuntu 18.04?
|
||||||
|
|
||||||
这个过程相当简单,但潜在风险很大。我们可能会在不久的将来发布一个教程,但你基本上需要使用‘do-release-upgrade’。同样,升级你的服务器也有潜在的风险,并且如果在生产服务器上,我会在升级之前再三考虑。特别是如果你在 16.04 上剩有几年的支持。
|
这个过程相当简单,但潜在风险很大。我们可能会在不久的将来发布一个教程,但你基本上需要使用 `do-release-upgrade`。同样,升级你的服务器也有潜在的风险,并且如果在生产服务器上,我会在升级之前再三考虑。特别是如果你在 16.04 上还剩有几年的支持。
|
||||||
|
|
||||||
### 我怎样才能帮助 Ubuntu 18.04?
|
#### 我怎样才能帮助 Ubuntu 18.04?
|
||||||
|
|
||||||
即使您不是一个经验丰富的开发人员和 Ubuntu 用户,您仍然可以通过以下方式提供帮助:
|
即使您不是一个经验丰富的开发人员和 Ubuntu 用户,您仍然可以通过以下方式提供帮助:
|
||||||
|
|
||||||
* 宣传它。让人们了解Ubuntu 18.04。在社交媒体上的一个简单的分享也有点帮助。
|
* 宣传它。让人们了解 Ubuntu 18.04。在社交媒体上的一个简单的分享也有点帮助。
|
||||||
|
|
||||||
* 使用和测试版本。开始使用该版本并进行测试。同样,您不必是一个开发人员。您仍然可以查找和报告错误,或发送反馈。
|
* 使用和测试版本。开始使用该版本并进行测试。同样,您不必是一个开发人员。您仍然可以查找和报告错误,或发送反馈。
|
||||||
|
|
||||||
* 翻译。加入翻译团队,开始翻译文档或应用程序。
|
* 翻译。加入翻译团队,开始翻译文档或应用程序。
|
||||||
|
|
||||||
* 帮助别人。加入一些在线 Ubuntu 社区,并帮助其他人解决他们对 Ubuntu 18.04 的问题。有时候人们需要帮助,一些简单的事如“我在哪里可以下载 Ubuntu?”
|
* 帮助别人。加入一些在线 Ubuntu 社区,并帮助其他人解决他们对 Ubuntu 18.04 的问题。有时候人们需要帮助,一些简单的事如“我在哪里可以下载 Ubuntu?”
|
||||||
|
|
||||||
### Ubuntu 18.04 对其他发行版如 Lubuntu 意味着什么?
|
#### Ubuntu 18.04 对其他发行版如 Lubuntu 意味着什么?
|
||||||
|
|
||||||
所有基于 Ubuntu 的发行版都将具有相似的新功能和类似的发行计划。你需要检查你的发行版的官方网站来获取更多信息。
|
所有基于 Ubuntu 的发行版都将具有相似的新功能和类似的发行计划。你需要检查你的发行版的官方网站来获取更多信息。
|
||||||
|
|
||||||
### Ubuntu 18.04 是一个 LTS 版本吗?
|
#### Ubuntu 18.04 是一个 LTS 版本吗?
|
||||||
|
|
||||||
是的,Ubuntu 18.04 是一个 LTS(Long Term Support)版本,所以你将得到 5 年的支持。
|
是的,Ubuntu 18.04 是一个 LTS(长期支持)版本,所以你将得到 5 年的支持。
|
||||||
|
|
||||||
### 我能从 Windows/OS X 切换到 Ubuntu 18.04 吗?
|
#### 我能从 Windows/OS X 切换到 Ubuntu 18.04 吗?
|
||||||
|
|
||||||
当然可以!你很可能也会体验到性能的提升。从不同的操作系统切换到 Ubuntu 相当简单,有相当多的相关教程。你甚至可以设置一个双引导,来使用多个操作系统,所以 Windows 和 Ubuntu 18.04 你都可以使用。
|
当然可以!你很可能也会体验到性能的提升。从不同的操作系统切换到 Ubuntu 相当简单,有相当多的相关教程。你甚至可以设置一个双引导,来使用多个操作系统,所以 Windows 和 Ubuntu 18.04 你都可以使用。
|
||||||
|
|
||||||
### 我可以尝试 Ubuntu 18.04 而不安装它吗?
|
#### 我可以尝试 Ubuntu 18.04 而不安装它吗?
|
||||||
|
|
||||||
当然。你可以使用像[VirtualBox][14]这样的东西来创建一个“虚拟桌面” - 你可以在你的本地机器上安装它,并且使用 Ubuntu 18.04 而不需要真正地安装 Ubuntu。
|
当然。你可以使用像 [VirtualBox][14] 这样的东西来创建一个“虚拟桌面” —— 你可以在你的本地机器上安装它,并且使用 Ubuntu 18.04 而不需要真正地安装 Ubuntu。
|
||||||
|
|
||||||
或者你可以在[Vultr][15]上以每月 2.5 美元的价格尝试 Ubuntu 18.04 服务器。如果你使用一些[免费账户(free credits)][16],那么它本质上是免费的。
|
或者你可以在 [Vultr][15] 上以每月 2.5 美元的价格尝试 Ubuntu 18.04 服务器。如果你使用一些[免费账户(free credits)][16],那么它本质上是免费的。(LCTT 译注:广告!)
|
||||||
|
|
||||||
### 为什么我找不到 Ubuntu 18.04 的 32 位版本?
|
#### 为什么我找不到 Ubuntu 18.04 的 32 位版本?
|
||||||
|
|
||||||
因为没有 32 位版本。Ubuntu的 17.10 版本放弃了 32 位版本。如果你使用的是旧硬件,那么最好使用不同的[轻量级Linux发行版][17]而不是 Ubuntu 18.04。
|
因为没有 32 位版本。Ubuntu 的 17.10 版本便放弃了 32 位版本。如果你使用的是旧硬件,那么最好使用不同的[轻量级 Linux 发行版][17]而不是 Ubuntu 18.04。
|
||||||
|
|
||||||
### 还有其他问题吗?
|
#### 还有其他问题吗?
|
||||||
|
|
||||||
在下面留言!分享您的想法,我们会非常激动,并且一旦有新信息发布,我们就会更新这篇文章。敬请期待,耐心等待!
|
在下面留言!分享您的想法,我们会非常激动,并且一旦有新信息发布,我们就会更新这篇文章。敬请期待,耐心等待!
|
||||||
|
|
||||||
@ -128,9 +114,9 @@ Ubuntu 18.04 正在用新的 GTK 主题以告别旧的默认主题 “Ambience
|
|||||||
|
|
||||||
via: https://thishosting.rocks/ubuntu-18-04-new-features-release-date/
|
via: https://thishosting.rocks/ubuntu-18-04-new-features-release-date/
|
||||||
|
|
||||||
作者:[ thishosting.rocks][a]
|
作者:[thishosting.rocks][a]
|
||||||
译者:[kimii](https://github.com/kimii)
|
译者:[kimii](https://github.com/kimii)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -0,0 +1,212 @@
|
|||||||
|
10 个例子教你学会 ncat (nc) 命令
|
||||||
|
======
|
||||||
|
|
||||||
|
[][1]
|
||||||
|
|
||||||
|
`ncat` 或者说 `nc` 是一款功能类似 `cat` 的工具,但是是用于网络的。它是一款拥有多种功能的 CLI 工具,可以用来在网络上读、写以及重定向数据。 它被设计成可以被脚本或其他程序调用的可靠的后端工具。同时由于它能创建任意所需的连接,因此也是一个很好的网络调试工具。
|
||||||
|
|
||||||
|
`ncat`/`nc` 既是一个端口扫描工具,也是一款安全工具,还能是一款监测工具,甚至可以做为一个简单的 TCP 代理。 由于有这么多的功能,它被誉为是网络界的瑞士军刀。 这是每个系统管理员都应该知道并且掌握它。
|
||||||
|
|
||||||
|
在大多数 Debian 发行版中,`nc` 是默认可用的,它会在安装系统的过程中自动被安装。 但是在 CentOS 7 / RHEL 7 的最小化安装中,`nc` 并不会默认被安装。 你需要用下列命令手工安装。
|
||||||
|
|
||||||
|
```
|
||||||
|
[root@linuxtechi ~]# yum install nmap-ncat -y
|
||||||
|
```
|
||||||
|
|
||||||
|
系统管理员可以用它来审计系统安全,用它来找出开放的端口然后保护这些端口。 管理员还能用它作为客户端来审计 Web 服务器、telnet 服务器、邮件服务器等, 通过 `nc` 我们可以控制发送的每个字符,也可以查看对方的回应。
|
||||||
|
|
||||||
|
我们还可以用它捕获客户端发送的数据以此来了解这些客户端是做什么的。
|
||||||
|
|
||||||
|
在本文中,我们会通过 10 个例子来学习如何使用 `nc` 命令。
|
||||||
|
|
||||||
|
### 例子: 1) 监听入站连接
|
||||||
|
|
||||||
|
通过 `-l` 选项,`ncat` 可以进入监听模式,使我们可以在指定端口监听入站连接。 完整的命令是这样的:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat -l port_number
|
||||||
|
```
|
||||||
|
|
||||||
|
比如,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat -l 8080
|
||||||
|
```
|
||||||
|
|
||||||
|
服务器就会开始在 8080 端口监听入站连接。
|
||||||
|
|
||||||
|
### 例子: 2) 连接远程系统
|
||||||
|
|
||||||
|
使用下面命令可以用 `nc` 来连接远程系统,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat IP_address port_number
|
||||||
|
```
|
||||||
|
|
||||||
|
让我们来看个例子,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat 192.168.1.100 80
|
||||||
|
```
|
||||||
|
|
||||||
|
这会创建一个连接,连接到 IP 为 192.168.1.100 的服务器上的 80 端口,然后我们就可以向服务器发送指令了。 比如我们可以输入下面内容来获取完整的网页内容
|
||||||
|
|
||||||
|
```
|
||||||
|
GET / HTTP/1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
或者获取页面名称,
|
||||||
|
|
||||||
|
```
|
||||||
|
GET / HTTP/1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
或者我们可以通过以下方式获得操作系统指纹标识,
|
||||||
|
|
||||||
|
```
|
||||||
|
HEAD / HTTP/1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
这会告诉我们使用的是什么软件来运行这个 web 服务器的。
|
||||||
|
|
||||||
|
### 例子: 3) 连接 UDP 端口
|
||||||
|
|
||||||
|
默认情况下,`nc` 创建连接时只会连接 TCP 端口。 不过我们可以使用 `-u` 选项来连接到 UDP 端口,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat -l -u 1234
|
||||||
|
```
|
||||||
|
|
||||||
|
现在我们的系统会开始监听 UDP 的 1234 端口,我们可以使用下面的 `netstat` 命令来验证这一点,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ netstat -tunlp | grep 1234
|
||||||
|
udp 0 0 0.0.0.0:1234 0.0.0.0:* 17341/nc
|
||||||
|
udp6 0 0 :::1234 :::* 17341/nc
|
||||||
|
```
|
||||||
|
|
||||||
|
假设我们想发送或者说测试某个远程主机 UDP 端口的连通性,我们可以使用下面命令,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat -v -u {host-ip} {udp-port}
|
||||||
|
```
|
||||||
|
|
||||||
|
比如:
|
||||||
|
|
||||||
|
```
|
||||||
|
[root@localhost ~]# ncat -v -u 192.168.105.150 53
|
||||||
|
Ncat: Version 6.40 ( http://nmap.org/ncat )
|
||||||
|
Ncat: Connected to 192.168.105.150:53。
|
||||||
|
```
|
||||||
|
|
||||||
|
### 例子: 4) 将 `nc` 作为聊天工具
|
||||||
|
|
||||||
|
`nc` 也可以作为聊天工具来用,我们可以配置服务器监听某个端口,然后从远程主机上连接到服务器的这个端口,就可以开始发送消息了。 在服务器这端运行:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat -l 8080
|
||||||
|
```
|
||||||
|
|
||||||
|
在远程客户端主机上运行:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat 192.168.1.100 8080
|
||||||
|
```
|
||||||
|
|
||||||
|
之后开始发送消息,这些消息会在服务器终端上显示出来。
|
||||||
|
|
||||||
|
### 例子: 5) 将 `nc` 作为代理
|
||||||
|
|
||||||
|
`nc` 也可以用来做代理。比如下面这个例子,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat -l 8080 | ncat 192.168.1.200 80
|
||||||
|
```
|
||||||
|
|
||||||
|
所有发往我们服务器 8080 端口的连接都会自动转发到 192.168.1.200 上的 80 端口。 不过由于我们使用了管道,数据只能被单向传输。 要同时能够接受返回的数据,我们需要创建一个双向管道。 使用下面命令可以做到这点:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ mkfifo 2way
|
||||||
|
$ ncat -l 8080 0<2way | ncat 192.168.1.200 80 1>2way
|
||||||
|
```
|
||||||
|
|
||||||
|
现在你可以通过 `nc` 代理来收发数据了。
|
||||||
|
|
||||||
|
### 例子: 6) 使用 `nc` 拷贝文件
|
||||||
|
|
||||||
|
`nc` 还能用来在系统间拷贝文件,虽然这么做并不推荐,因为绝大多数系统默认都安装了 `ssh`/`scp`。 不过如果你恰好遇见个没有 `ssh`/`scp` 的系统的话, 你可以用 `nc` 来作最后的努力。
|
||||||
|
|
||||||
|
在要接受数据的机器上启动 `nc` 并让它进入监听模式:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat -l 8080 > file.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
现在去要被拷贝数据的机器上运行下面命令:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat 192.168.1.100 8080 --send-only < data.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
这里,`data.txt` 是要发送的文件。 `-–send-only` 选项会在文件拷贝完后立即关闭连接。 如果不加该选项, 我们需要手工按下 `ctrl+c` 来关闭连接。
|
||||||
|
|
||||||
|
我们也可以用这种方法拷贝整个磁盘分区,不过请一定要小心。
|
||||||
|
|
||||||
|
### 例子: 7) 通过 `nc` 创建后门
|
||||||
|
|
||||||
|
`nc` 命令还可以用来在系统中创建后门,并且这种技术也确实被黑客大量使用。 为了保护我们的系统,我们需要知道它是怎么做的。 创建后门的命令为:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat -l 10000 -e /bin/bash
|
||||||
|
```
|
||||||
|
|
||||||
|
`-e` 标志将一个 bash 与端口 10000 相连。现在客户端只要连接到服务器上的 10000 端口就能通过 bash 获取我们系统的完整访问权限:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat 192.168.1.100 10000
|
||||||
|
```
|
||||||
|
|
||||||
|
### 例子: 8) 通过 `nc` 进行端口转发
|
||||||
|
|
||||||
|
我们通过选项 `-c` 来用 `nc` 进行端口转发,实现端口转发的语法为:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat -u -l 80 -c 'ncat -u -l 8080'
|
||||||
|
```
|
||||||
|
|
||||||
|
这样,所有连接到 80 端口的连接都会转发到 8080 端口。
|
||||||
|
|
||||||
|
### 例子: 9) 设置连接超时
|
||||||
|
|
||||||
|
`nc` 的监听模式会一直运行,直到手工终止。 不过我们可以通过选项 `-w` 设置超时时间:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat -w 10 192.168.1.100 8080
|
||||||
|
```
|
||||||
|
|
||||||
|
这回导致连接 10 秒后终止,不过这个选项只能用于客户端而不是服务端。
|
||||||
|
|
||||||
|
### 例子: 10) 使用 `-k` 选项强制 `nc` 待命
|
||||||
|
|
||||||
|
当客户端从服务端断开连接后,过一段时间服务端也会停止监听。 但通过选项 `-k` 我们可以强制服务器保持连接并继续监听端口。 命令如下:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ncat -l -k 8080
|
||||||
|
```
|
||||||
|
|
||||||
|
现在即使来自客户端的连接断了也依然会处于待命状态。
|
||||||
|
|
||||||
|
自此我们的教程就完了,如有疑问,请在下方留言。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.linuxtechi.com/nc-ncat-command-examples-linux-systems/
|
||||||
|
|
||||||
|
作者:[Pradeep Kumar][a]
|
||||||
|
译者:[lujun9972](https://github.com/lujun9972)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://www.linuxtechi.com/author/pradeep/
|
||||||
|
[1]:https://www.linuxtechi.com/wp-content/uploads/2017/12/nc-ncat-command-examples-Linux-Systems.jpg
|
@ -1,10 +1,11 @@
|
|||||||
UC 浏览器最大的问题
|
UC 浏览器最大的问题
|
||||||
======
|
======
|
||||||
在我们开始谈论缺点之前,我要確定的事实是过去 3 年来,我一直是一个忠实的 UC 浏览器用户。我真的很喜欢它的下载速度,超时尚的用户界面和工具上引人注目的图标。我一开始是 Android 上的 Chrome 用户,但我在朋友的推荐下开始使用 UC。但在过去的一年左右,我看到了一些东西让我重新思考我的选择,现在我感觉我要重新回到 Chrome。
|
|
||||||
|
|
||||||
### 不需要的 **通知**
|
在我们开始谈论缺点之前,我要确定的事实是过去 3 年来,我一直是一个忠实的 UC 浏览器用户。我真的很喜欢它的下载速度,超时尚的用户界面和工具上引人注目的图标。我一开始是 Android 上的 Chrome 用户,但我在朋友的推荐下开始使用 UC。但在过去的一年左右,我看到了一些东西让我重新思考我的选择,现在我感觉我要重新回到 Chrome。
|
||||||
|
|
||||||
我相信我不是唯一一个每几个小时内就收到这些不需要的通知的人。这些欺骗点击文章真的很糟糕,最糟糕的部分是你每隔几个小时就会收到一次。
|
### 不需要的**通知**
|
||||||
|
|
||||||
|
我相信我不是唯一一个每几个小时内就收到这些不需要的通知的人。这些欺骗点击的文章真的很糟糕,最糟糕的部分是你每隔几个小时就会收到一次。
|
||||||
|
|
||||||
[![uc browser's annoying ads notifications][1]][1]
|
[![uc browser's annoying ads notifications][1]][1]
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ UC 浏览器在浏览器中集成了一个**音乐播放器**来播放音乐。
|
|||||||
|
|
||||||
[![uc browser adds uc music player][4]][4]
|
[![uc browser adds uc music player][4]][4]
|
||||||
|
|
||||||
它甚至不是在后台直接播放来自网络的音频。相反,它是一个播放离线音乐的音乐播放器。所以为什么要它?我的意思是,它甚至不够好到作为主要音乐播放器。即使它是,它不能独立于 UC 浏览器运行。所以为什么会有人运行将他/她的浏览器只是为了使用你的音乐播放器?
|
它甚至不是在后台直接播放来自网络的音频。相反,它是一个播放离线音乐的音乐播放器。所以为什么要它?我的意思是,它甚至没有好到可以作为主要音乐播放器。即使它足够好,它也不能独立于 UC 浏览器运行。所以为什么会有人运行将他/她的浏览器只是为了使用你的音乐播放器?
|
||||||
|
|
||||||
### **快速**访问栏
|
### **快速**访问栏
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ via: https://www.theitstuff.com/biggest-problems-uc-browser
|
|||||||
|
|
||||||
作者:[Rishabh Kandari][a]
|
作者:[Rishabh Kandari][a]
|
||||||
译者:[geekpi](https://github.com/geekpi)
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -1,63 +1,66 @@
|
|||||||
How to enable Nested Virtualization in KVM on CentOS 7 / RHEL 7
|
如何在 CentOS 7 / RHEL 7 的 KVM 上启用嵌套虚拟化
|
||||||
======
|
======
|
||||||
**Nested virtualization** means to configure virtualization environment inside a virtual machine. In other words we can say nested virtualization is a feature in the hypervisor which allows us to install & run a virtual machine inside a virtual server via hardware acceleration from the **hypervisor** (host).
|
|
||||||
|
|
||||||
In this article, we will discuss how to enable nested virtualization in KVM on CentOS 7 / RHEL 7. I am assuming you have already configured KVM hypervisor. In case you have not familiar on how to install and configure **KVM hypervisor** , then refer the following article
|
**嵌套虚拟化**意味着在虚拟机内配置虚拟化环境。换句话说,我们可以说嵌套虚拟化是<ruby>虚拟机管理程序<rt>hypervisor</rt></ruby>的一个特性,它允许我们通过**虚拟化管理程序**(宿主机)的硬件加速在虚拟服务器内安装和运行虚拟机。
|
||||||
|
|
||||||
Let's jump into the hypervisor and verify whether nested virtualization is enabled or not on your KVM host
|
在这篇文章中,我们将讨论如何在 CentOS 7 / RHEL 7 的 KVM 上启用嵌套虚拟化。我假定您已经配置过 KVM 管理程序。如果您不熟悉如何安装和配置 KVM 管理程序,请参考以下文章。
|
||||||
|
|
||||||
|
### 在 CentOS 7.x 和 RHEL 7.x 安装 KVM 管理程序
|
||||||
|
|
||||||
|
让我们进入虚拟化管理程序,验证您的 KVM 宿主机是否启用了嵌套虚拟化。
|
||||||
|
|
||||||
|
基于 Intel 的处理器运行以下命令:
|
||||||
|
|
||||||
For Intel based Processors run the command,
|
|
||||||
```
|
```
|
||||||
[root@kvm-hypervisor ~]# cat /sys/module/kvm_intel/parameters/nested
|
[root@kvm-hypervisor ~]# cat /sys/module/kvm_intel/parameters/nested
|
||||||
N
|
N
|
||||||
[root@kvm-hypervisor ~]#
|
|
||||||
```
|
```
|
||||||
|
|
||||||
For AMD based Processors run the command,
|
基于 AMD 的处理器运行以下命令:
|
||||||
|
|
||||||
```
|
```
|
||||||
[root@kvm-hypervisor ~]# cat /sys/module/kvm_amd/parameters/nested
|
[root@kvm-hypervisor ~]# cat /sys/module/kvm_amd/parameters/nested
|
||||||
N
|
N
|
||||||
[root@kvm-hypervisor ~]#
|
|
||||||
```
|
```
|
||||||
|
|
||||||
In the above command output 'N' indicates that Nested virtualization is disabled. If we get the output as 'Y' then it indicates that nested virtualization is enabled on your host.
|
上述命令输出 `N` 表示嵌套虚拟化是禁用的。如果我们得到的输出是 `Y` 则表示在您的宿主机已启用嵌套虚拟化。
|
||||||
|
|
||||||
|
现在启用嵌套虚拟化,使用以下内容创建一个文件名为 `/etc/modprobe.d/kvm-nested.conf` 的文件:
|
||||||
|
|
||||||
Now to enable nested virtualization, create a file with the name " **/etc/modprobe.d/kvm-nested.conf** " with the following content.
|
|
||||||
```
|
```
|
||||||
[root@kvm-hypervisor ~]# vi /etc/modprobe.d/kvm-nested.conf
|
[root@kvm-hypervisor ~]# vi /etc/modprobe.d/kvm-nested.conf
|
||||||
|
```
|
||||||
|
```
|
||||||
options kvm-intel nested=1
|
options kvm-intel nested=1
|
||||||
options kvm-intel enable_shadow_vmcs=1
|
options kvm-intel enable_shadow_vmcs=1
|
||||||
options kvm-intel enable_apicv=1
|
options kvm-intel enable_apicv=1
|
||||||
options kvm-intel ept=1
|
options kvm-intel ept=1
|
||||||
```
|
```
|
||||||
|
|
||||||
Save & exit the file
|
保存并退出文件。
|
||||||
|
|
||||||
|
现在移除 `kvm_intel` 模块然后通过 `modprobe` 命令添加同样的模块。在移除模块之前,确保虚拟机已关机,否则我们会得到像 “modprobe: FATAL: Module kvm_intel is in use” 这样的错误信息。
|
||||||
|
|
||||||
Now remove ' **kvm_intel** ' module and then add the same module with modprobe command. Before removing the module, make sure VMs are shutdown otherwise we will get error message like " **modprobe: FATAL: Module kvm_intel is in use** "
|
|
||||||
```
|
```
|
||||||
[root@kvm-hypervisor ~]# modprobe -r kvm_intel
|
[root@kvm-hypervisor ~]# modprobe -r kvm_intel
|
||||||
[root@kvm-hypervisor ~]# modprobe -a kvm_intel
|
[root@kvm-hypervisor ~]# modprobe -a kvm_intel
|
||||||
[root@kvm-hypervisor ~]#
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Now verify whether nested virtualization feature enabled or not.
|
现在验证嵌套虚拟化功能是否启用。
|
||||||
|
|
||||||
```
|
```
|
||||||
[root@kvm-hypervisor ~]# cat /sys/module/kvm_intel/parameters/nested
|
[root@kvm-hypervisor ~]# cat /sys/module/kvm_intel/parameters/nested
|
||||||
Y
|
Y
|
||||||
[root@kvm-hypervisor ~]#
|
|
||||||
```
|
```
|
||||||
|
|
||||||
####
|
### 测试嵌套虚拟化
|
||||||
|
|
||||||
Test Nested Virtualization
|
假设我们在 KVM 管理程序上有一台已经启用了嵌套虚拟化的名为 “director” 的虚拟机。在测试之前,确保 CPU 模式为 “host-modle” 或 “host-passthrough” ,使用 Virt-Manager 或 `virtsh` 编辑命令检查虚拟机的 CPU 模式。
|
||||||
|
|
||||||
Let's suppose we have a VM with name "director" on KVM hypervisor on which I have enabled nested virtualization. Before testing, make sure CPU mode for the VM is either as " **host-model** " or " **host-passthrough** " , to check cpu mode of a virtual machine use either Virt-Manager GUI or virsh edit command
|
|
||||||
|
|
||||||
![cpu_mode_vm_kvm][1]
|
|
||||||
|
|
||||||
![cpu_mode_vm_kvm][2]
|
![cpu_mode_vm_kvm][2]
|
||||||
|
|
||||||
Now login to the director VM and run lscpu and lsmod command
|
现在登录 director 这台虚拟机并运行 `lscpu` 和 `lsmod` 命令。
|
||||||
|
|
||||||
```
|
```
|
||||||
[root@kvm-hypervisor ~]# ssh 192.168.126.1 -l root
|
[root@kvm-hypervisor ~]# ssh 192.168.126.1 -l root
|
||||||
root@192.168.126.1's password:
|
root@192.168.126.1's password:
|
||||||
@ -66,15 +69,16 @@ Last login: Sun Dec 10 07:05:59 2017 from 192.168.126.254
|
|||||||
kvm_intel 170200 0
|
kvm_intel 170200 0
|
||||||
kvm 566604 1 kvm_intel
|
kvm 566604 1 kvm_intel
|
||||||
irqbypass 13503 1 kvm
|
irqbypass 13503 1 kvm
|
||||||
[root@director ~]#
|
```
|
||||||
|
|
||||||
|
```
|
||||||
[root@director ~]# lscpu
|
[root@director ~]# lscpu
|
||||||
```
|
```
|
||||||
|
|
||||||
![lscpu_command_rhel7_centos7][1]
|
|
||||||
|
|
||||||
![lscpu_command_rhel7_centos7][3]
|
![lscpu_command_rhel7_centos7][3]
|
||||||
|
|
||||||
Let's try creating a virtual machine either from virtual manager GUI or virt-install inside the director vm, in my case i am using virt-install command
|
让我们试着在 director 这台虚拟机的虚拟管理器 GUI 或 `virt-install` 命令创建一台虚拟机,在我的情况下我使用 `virt-install` 命令。
|
||||||
|
|
||||||
```
|
```
|
||||||
[root@director ~]# virt-install -n Nested-VM --description "Test Nested VM" --os-type=Linux --os-variant=rhel7 --ram=2048 --vcpus=2 --disk path=/var/lib/libvirt/images/nestedvm.img,bus=virtio,size=10 --graphics none --location /var/lib/libvirt/images/CentOS-7-x86_64-DVD-1511.iso --extra-args console=ttyS0
|
[root@director ~]# virt-install -n Nested-VM --description "Test Nested VM" --os-type=Linux --os-variant=rhel7 --ram=2048 --vcpus=2 --disk path=/var/lib/libvirt/images/nestedvm.img,bus=virtio,size=10 --graphics none --location /var/lib/libvirt/images/CentOS-7-x86_64-DVD-1511.iso --extra-args console=ttyS0
|
||||||
Starting install...
|
Starting install...
|
||||||
@ -91,21 +95,20 @@ Escape character is ^]
|
|||||||
………………………………………………
|
………………………………………………
|
||||||
```
|
```
|
||||||
|
|
||||||
![cli-installer-virt-install-command-kvm][1]
|
|
||||||
|
|
||||||
![cli-installer-virt-install-command-kvm][4]
|
![cli-installer-virt-install-command-kvm][4]
|
||||||
|
|
||||||
This confirms that nested virtualization has been enabled successfully as we are able to create virtual machine inside a virtual machine.
|
这证实了嵌套虚拟化已成功启用,因为我们能在虚拟机内创建虚拟机。
|
||||||
|
|
||||||
This Concludes the article, please do share your feedback and comments.
|
这篇文章到此结束,请分享您的反馈和意见。
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
via: https://www.linuxtechi.com/enable-nested-virtualization-kvm-centos-7-rhel-7/
|
via: https://www.linuxtechi.com/enable-nested-virtualization-kvm-centos-7-rhel-7/
|
||||||
|
|
||||||
作者:[Pradeep Kumar][a]
|
作者:[Pradeep Kumar][a]
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
译者:[zjon](https://github.com/zjon)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
@ -114,3 +117,5 @@ via: https://www.linuxtechi.com/enable-nested-virtualization-kvm-centos-7-rhel-7
|
|||||||
[2]:https://www.linuxtechi.com/wp-content/uploads/2017/12/cpu_mode_vm_kvm.jpg
|
[2]:https://www.linuxtechi.com/wp-content/uploads/2017/12/cpu_mode_vm_kvm.jpg
|
||||||
[3]:https://www.linuxtechi.com/wp-content/uploads/2017/12/lscpu_command_rhel7_centos7-1024x408.jpg
|
[3]:https://www.linuxtechi.com/wp-content/uploads/2017/12/lscpu_command_rhel7_centos7-1024x408.jpg
|
||||||
[4]:https://www.linuxtechi.com/wp-content/uploads/2017/12/cli-installer-virt-install-command-kvm.jpg
|
[4]:https://www.linuxtechi.com/wp-content/uploads/2017/12/cli-installer-virt-install-command-kvm.jpg
|
||||||
|
|
||||||
|
|
@ -0,0 +1,152 @@
|
|||||||
|
Bash 脚本:正则表达式基础篇
|
||||||
|
======
|
||||||
|
|
||||||
|
<ruby>正则表达式<rt>Regular expressions</rt></ruby>(简写为 regex 或者 regexp)基本上是定义一种搜索模式的字符串,可以被用来执行“搜索”或者“搜索并替换”操作,也可以被用来验证像密码策略等条件。
|
||||||
|
|
||||||
|
正则表达式是一个我们可利用的非常强大的工具,并且使用正则表达式的优点是它能在几乎所有计算机语言中被使用。所以如果你使用 Bash 脚本或者创建一个 python 程序时,我们可以使用正则表达式,或者也可以写一个单行搜索查询。
|
||||||
|
|
||||||
|
在这篇教程中,我们将会学习一些正则表达式的基本概念,并且学习如何在 Bash 中通过 `grep` 使用它们,但是如果你希望在其他语言如 python 或者 C 中使用它们,你只能使用正则表达式部分。那么让我们通过正则表达式的一个例子开始吧,
|
||||||
|
|
||||||
|
正则表达式看起来像 `/t[aeiou]l/` 这个样子。
|
||||||
|
|
||||||
|
但这是什么意思呢?它意味着所提到的正则表达式将寻找一个词,它以 `t` 开始,在中间包含字母 `a e i o u` 中任意一个,并且字母 `l` 最为最后一个字符。它可以是 `tel`,`tal` 或者 `til`,可以匹配一个单独的词或者其它单词像 `tilt`,`brutal` 或者 `telephone` 的一部分。
|
||||||
|
|
||||||
|
grep 使用正则表达式的语法是 `$ grep "regex_search_term" file_location`
|
||||||
|
|
||||||
|
如果不理解,不要担心,这只是一个例子,来展示可以利用正则表达式获取什么,相信我,这是最简单的例子。我们可以从正则表达式中获取更多。现在我们将从正则表达式基础的开始。
|
||||||
|
|
||||||
|
- 推荐阅读: [你应该知道的有用的 linux 命令][1]
|
||||||
|
|
||||||
|
### 基础的正则表示式
|
||||||
|
|
||||||
|
现在我们开始学习一些被称为<ruby>元字符<rt>MetaCharacters</rt></ruby>的特殊字符。它们可以帮助我们创建更复杂的正则表达式搜索项。下面提到的是基本元字符的列表,
|
||||||
|
|
||||||
|
- `.` 点将匹配任意字符
|
||||||
|
- `[ ]` 将匹配一个字符范围
|
||||||
|
- `[^ ]` 将匹配除了括号中提到的那个之外的所有字符
|
||||||
|
- `*` 将匹配零个或多个前面的项
|
||||||
|
- `+` 将匹配一个或多个前面的项
|
||||||
|
- `?` 将匹配零个或一个前面的项
|
||||||
|
- `{n}` 将匹配 n 次前面的项
|
||||||
|
- `{n,}` 将匹配 n 次或更多前面的项
|
||||||
|
- `{n,m}` 将匹配在 n 和 m 次之间的项
|
||||||
|
- `{,m}` 将匹配少于或等于 m 次的项
|
||||||
|
- `\` 是一个转义字符,当我们需要在我们的搜索中包含一个元字符时使用
|
||||||
|
|
||||||
|
现在我们将用例子讨论所有这些元字符。
|
||||||
|
|
||||||
|
#### `.` (点)
|
||||||
|
|
||||||
|
它用于匹配出现在我们搜索项中的任意字符。举个例子,我们可以使用点如:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ grep "d.g" file1
|
||||||
|
```
|
||||||
|
|
||||||
|
这个正则表达式意味着我们在名为 ‘file1’ 的文件中查找的词以 `d` 开始,以 `g`结尾,中间可以有 1 个字符的字符串。同样,我们可以使用任意数量的点作为我们的搜索模式,如 `T......h`,这个查询项将查找一个词,以 `T` 开始,以 `h` 结尾,并且中间可以有任意 6 个字符。
|
||||||
|
|
||||||
|
#### `[ ]`
|
||||||
|
|
||||||
|
方括号用于定义字符范围。例如,我们需要搜索一些特别的单词而不是匹配任何字符,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ grep "N[oen]n" file2
|
||||||
|
```
|
||||||
|
|
||||||
|
这里,我们正寻找一个单词,以 `N`开头,以 `n` 结尾,并且中间只能有 `o`、`e` 或者 `n` 中的一个。 在方括号中我们可以提到单个到任意数量的字符。
|
||||||
|
|
||||||
|
我们在方括号中也可以定义像 `a-e`或者 `1-18` 作为匹配字符的列表。
|
||||||
|
|
||||||
|
#### `[^ ]`
|
||||||
|
|
||||||
|
这就像正则表达式的 not 操作。当使用 `[^ ]` 时,它意味着我们的搜索将包括除了方括号内提到的所有字符。例如,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ grep "St[^1-9]d" file3
|
||||||
|
```
|
||||||
|
|
||||||
|
这意味着我们可以拥有所有这样的单词,它们以 `St` 开始,以字母 `d` 结尾,并且不得包含从 `1` 到 `9` 的任何数字。
|
||||||
|
|
||||||
|
到现在为止,我们只使用了仅需要在中间查找单个字符的正则表达式的例子,但是如果我们需要更多字符该怎么办呢。假设我们需要找到以一个字符开头和结尾的所有单词,并且在中间可以有任意数量的字符。这就是我们使用乘数元字符如 `+` `*` 与 `?` 的地方。
|
||||||
|
|
||||||
|
`{n}`、`{n,m}`、`{n,}` 或者 `{,m}` 也是可以在我们的正则表达式项中使用的其他乘数元字符。
|
||||||
|
|
||||||
|
#### `*` (星号)
|
||||||
|
|
||||||
|
以下示例匹配字母 `k` 的任意出现次数,包括一次没有:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ grep "lak*" file4
|
||||||
|
```
|
||||||
|
|
||||||
|
它意味着我们可以匹配到 `lake`、`la` 或者 `lakkkk`。
|
||||||
|
|
||||||
|
#### `+`
|
||||||
|
|
||||||
|
以下模式要求字符串中的字母 `k` 至少被匹配到一次:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ grep "lak+" file5
|
||||||
|
```
|
||||||
|
|
||||||
|
这里 `k` 在我们的搜索中至少需要发生一次,所以我们的结果可以为 `lake` 或者 `lakkkk`,但不能是 `la`。
|
||||||
|
|
||||||
|
#### `?`
|
||||||
|
|
||||||
|
在以下模式匹配中
|
||||||
|
|
||||||
|
```
|
||||||
|
$ grep "ba?b" file6
|
||||||
|
```
|
||||||
|
|
||||||
|
匹配字符串 `bb` 或 `bab`,使用 `?` 乘数,我们可以有一个或零个字符的出现。
|
||||||
|
|
||||||
|
#### 非常重要的提示
|
||||||
|
|
||||||
|
当使用乘数时这是非常重要的,假设我们有一个正则表达式
|
||||||
|
|
||||||
|
```
|
||||||
|
$ grep "S.*l" file7
|
||||||
|
```
|
||||||
|
|
||||||
|
我们得到的结果是 `small`、`silly`,并且我们也得到了 `Shane is a little to play ball`。但是为什么我们得到了 `Shane is a little to play ball`?我们只是在搜索中寻找单词,为什么我们得到了整个句子作为我们的输出。
|
||||||
|
|
||||||
|
这是因为它满足我们的搜索标准,它以字母 `s` 开头,中间有任意数量的字符并以字母 `l` 结尾。那么,我们可以做些什么来纠正我们的正则表达式来只是得到单词而不是整个句子作为我们的输出。
|
||||||
|
|
||||||
|
我们在正则表达式中需要增加 `?` 元字符,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ grep "S.*?l" file7
|
||||||
|
```
|
||||||
|
|
||||||
|
这将会纠正我们正则表达式的行为。
|
||||||
|
|
||||||
|
#### `\`
|
||||||
|
|
||||||
|
`\` 是当我们需要包含一个元字符或者对正则表达式有特殊含义的字符的时候来使用。例如,我们需要找到所有以点结尾的单词,所以我们可以使用:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ grep "S.*\\." file8
|
||||||
|
```
|
||||||
|
|
||||||
|
这将会查找和匹配所有以一个点字符结尾的词。
|
||||||
|
|
||||||
|
通过这篇基本正则表达式教程,我们现在有一些关于正则表达式如何工作的基本概念。在我们的下一篇教程中,我们将学习一些高级的正则表达式的概念。同时尽可能多地练习,创建正则表达式并试着尽可能多的在你的工作中加入它们。如果有任何疑问或问题,您可以在下面的评论区留言。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: http://linuxtechlab.com/bash-scripting-learn-use-regex-basics/
|
||||||
|
|
||||||
|
作者:[SHUSAIN][a]
|
||||||
|
译者:[kimii](https://github.com/kimii)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:http://linuxtechlab.com/author/shsuain/
|
||||||
|
[1]:http://linuxtechlab.com/useful-linux-commands-you-should-know/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,95 @@
|
|||||||
|
使用 pss 提升你的代码搜索能力
|
||||||
|
======
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
搜索代码库是开发者每天都要做的事情。从修改 bug 到学习新代码,或者查看如何调用某个 API,能快速在代码库中导航的能力都是一大助力。幸运的是,我们有专门的工具来搜索代码。[pss][1] 就是其中一个工具,让我们来看看如何安装和使用它吧。
|
||||||
|
|
||||||
|
### 什么是 pss?
|
||||||
|
|
||||||
|
`pss` 是一个帮你在源代码文件中进行搜索的命令行工具。`pss` 递归地在目录树中进行搜索,它能自动根据文件名和后缀判断哪些文件需要搜索,哪些文件不需搜索,并且会自动跳过那些你不会想搜索的目录(比如 `.svn` 和 `.git`),还能用色彩渲染输出以方便人们阅读,以及其他很多功能。
|
||||||
|
|
||||||
|
### 安装 pss
|
||||||
|
|
||||||
|
使用下面命令在 Fedora 上安装 `pss`:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ dnf install pss
|
||||||
|
```
|
||||||
|
|
||||||
|
安装好后就能在终端调用 `pss` 了:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pss
|
||||||
|
```
|
||||||
|
|
||||||
|
不带参数调用 `pss` 或者带上 `-h` 标志会输出详细的使用说明。
|
||||||
|
|
||||||
|
### 使用案例
|
||||||
|
|
||||||
|
现在你安装好 `pss` 了,下面来看一些例子吧。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pss foo
|
||||||
|
```
|
||||||
|
|
||||||
|
该命令只是简单的搜索 `foo`。你也可以限制 `pss` 让它只在 python 文件中搜索 `foo`:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pss foo --py
|
||||||
|
```
|
||||||
|
|
||||||
|
还能在非 python 文件中搜索 `bar`:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pss bar --nopy
|
||||||
|
```
|
||||||
|
|
||||||
|
而且,`pss` 支持大多数常见的源代码文件类型,要获取完整的支持列表,执行:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pss --help-types
|
||||||
|
```
|
||||||
|
|
||||||
|
你还能指定忽略某些目录不进行搜索。默认情况下,`pss` 会忽略类似 `.git`,`__pycache__`,`.metadata` 等目录。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pss foo --py --ignore-dir=dist
|
||||||
|
```
|
||||||
|
|
||||||
|
此外,`pss` 还能显示搜索结果的上下文。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pss -A 5 foo
|
||||||
|
```
|
||||||
|
|
||||||
|
会显示匹配结果的后面 5 行内容。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pss -B 5 foo
|
||||||
|
```
|
||||||
|
|
||||||
|
会显示匹配结果的前面 5 行内容。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pss -C 5 foo
|
||||||
|
```
|
||||||
|
|
||||||
|
会显示匹配结果的前后各 5 行内容。
|
||||||
|
|
||||||
|
如果你想知道如何使用 `pss ` 进行正则表达式搜索以及它的其他选项的话,可以在[这里][2]看到更多的例子。
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://fedoramagazine.org/improve-code-searching-skills-pss/
|
||||||
|
|
||||||
|
作者:[Clément Verna][a]
|
||||||
|
译者:[lujun9972](https://github.com/lujun9972)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://fedoramagazine.org
|
||||||
|
[1]:https://github.com/eliben/pss
|
||||||
|
[2]:https://github.com/eliben/pss/wiki/Usage-samples
|
@ -0,0 +1,141 @@
|
|||||||
|
Cheat : 一个实用 Linux 命令示例集合
|
||||||
|
======
|
||||||
|
|
||||||
|
我们中的许多人经常查看 [ man 页面][1] 来了解命令开关(选项),它会显示有关命令语法、说明、细节和可用的选项,但它没有任何实际的例子。因此,在组合成一个我们需要的完整命令时会遇到一些麻烦。
|
||||||
|
|
||||||
|
你确实遇到这个麻烦而想要一个更好的解决方案吗?我会建议你试一下 `cheat`。
|
||||||
|
|
||||||
|
### Cheat 是什么
|
||||||
|
|
||||||
|
[cheat][2] 允许你在命令行中创建和查看交互式的<ruby>速查表<rt>cheatsheet</rt></ruby>。它旨在帮助提醒 *nix 系统管理员他们经常使用但还没频繁到会记住的命令的选项。
|
||||||
|
|
||||||
|
### 如何安装 Cheat
|
||||||
|
|
||||||
|
`cheat` 是使用 python 开发的,所以可以用 `pip` 来在你的系统上安装 `cheat`。
|
||||||
|
|
||||||
|
`pip` 是一个与 `setuptools` 捆绑在一起的 Python 模块,它是在 Linux 中安装 Python 包推荐的工具之一。
|
||||||
|
|
||||||
|
对于 Debian/Ubuntu 用户,请使用 [apt-get 命令][3]或[apt 命令][4]来安装 `pip`。
|
||||||
|
|
||||||
|
```
|
||||||
|
[对于 Python2]
|
||||||
|
$ sudo apt install python-pip python-setuptools
|
||||||
|
[对于 Python3]
|
||||||
|
$ sudo apt install python3-pip
|
||||||
|
```
|
||||||
|
|
||||||
|
RHEL/CentOS 官方仓库中没有 pip,因此使用 [EPEL 仓库][5],并使用 [YUM 命令][6]安装 `pip`。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo yum install python-pip python-devel python-setuptools
|
||||||
|
```
|
||||||
|
|
||||||
|
对于 Fedora 系统,使用 [dnf 命令][7]来安装 `pip`。
|
||||||
|
|
||||||
|
```
|
||||||
|
[对于 Python2]
|
||||||
|
$ sudo dnf install python-pip
|
||||||
|
[对于 Python3]
|
||||||
|
$ sudo dnf install python3
|
||||||
|
```
|
||||||
|
|
||||||
|
对于基于 Arch Linux 的系统,请使用 [Pacman 命令][8] 来安装 `pip`。
|
||||||
|
|
||||||
|
```
|
||||||
|
[对于 Python2]
|
||||||
|
$ sudo pacman -S python2-pip python-setuptools
|
||||||
|
[对于 Python3]
|
||||||
|
$ sudo pacman -S python-pip python3-setuptools
|
||||||
|
```
|
||||||
|
|
||||||
|
对于 openSUSE 系统,使用 [Zypper 命令][9]来安装 `pip`。
|
||||||
|
|
||||||
|
```
|
||||||
|
[对于 Python2]
|
||||||
|
$ sudo pacman -S python-pip
|
||||||
|
[对于 Python3]
|
||||||
|
$ sudo pacman -S python3-pip
|
||||||
|
```
|
||||||
|
|
||||||
|
用 `pip` 来在你的系统上安装 `cheat`。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo pip install cheat
|
||||||
|
```
|
||||||
|
|
||||||
|
### 如何使用 Cheat
|
||||||
|
|
||||||
|
运行 `cheat`,然后按相应的`命令`来查看速查表,作为例子,我们要来看下 `tar` 命令的例子。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cheat tar
|
||||||
|
# To extract an uncompressed archive:
|
||||||
|
tar -xvf /path/to/foo.tar
|
||||||
|
|
||||||
|
# To create an uncompressed archive:
|
||||||
|
tar -cvf /path/to/foo.tar /path/to/foo/
|
||||||
|
|
||||||
|
# To extract a .gz archive:
|
||||||
|
tar -xzvf /path/to/foo.tgz
|
||||||
|
|
||||||
|
# To create a .gz archive:
|
||||||
|
tar -czvf /path/to/foo.tgz /path/to/foo/
|
||||||
|
|
||||||
|
# To list the content of an .gz archive:
|
||||||
|
tar -ztvf /path/to/foo.tgz
|
||||||
|
|
||||||
|
# To extract a .bz2 archive:
|
||||||
|
tar -xjvf /path/to/foo.tgz
|
||||||
|
|
||||||
|
# To create a .bz2 archive:
|
||||||
|
tar -cjvf /path/to/foo.tgz /path/to/foo/
|
||||||
|
|
||||||
|
# To extract a .tar in specified Directory:
|
||||||
|
tar -xvf /path/to/foo.tar -C /path/to/destination/
|
||||||
|
|
||||||
|
# To list the content of an .bz2 archive:
|
||||||
|
tar -jtvf /path/to/foo.tgz
|
||||||
|
|
||||||
|
# To create a .gz archive and exclude all jpg,gif,... from the tgz
|
||||||
|
tar czvf /path/to/foo.tgz --exclude=\*.{jpg,gif,png,wmv,flv,tar.gz,zip} /path/to/foo/
|
||||||
|
|
||||||
|
# To use parallel (multi-threaded) implementation of compression algorithms:
|
||||||
|
tar -z ... -> tar -Ipigz ...
|
||||||
|
tar -j ... -> tar -Ipbzip2 ...
|
||||||
|
tar -J ... -> tar -Ipixz ...
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
运行下面的命令查看可用的速查表。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cheat -l
|
||||||
|
```
|
||||||
|
|
||||||
|
进入帮助页面获取更多详细信息。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cheat -h
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.2daygeek.com/cheat-a-collection-of-practical-linux-command-examples/
|
||||||
|
|
||||||
|
作者:[Magesh Maruthamuthu][a]
|
||||||
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://www.2daygeek.com
|
||||||
|
[1]:https://www.2daygeek.com/linux-color-man-pages-configuration-less-most-command/
|
||||||
|
[2]:https://github.com/chrisallenlane/cheat
|
||||||
|
[3]:https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
|
||||||
|
[4]:https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
|
||||||
|
[5]:https://www.2daygeek.com/install-enable-epel-repository-on-rhel-centos-scientific-linux-oracle-linux/
|
||||||
|
[6]:https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/
|
||||||
|
[7]:https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/
|
||||||
|
[8]:https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/
|
||||||
|
[9]:https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
|
@ -0,0 +1,145 @@
|
|||||||
|
检查 Linux 文件系统中的错误:通过案例学习 FSCK 命令
|
||||||
|
======
|
||||||
|
|
||||||
|
FSCK 是一个很重要的 Linux/Unix 工具,它用于检测并修复文件系统中的错误。它类似于 Windows 操作系统中的 “chkdsk” 工具,但它是为 Linux、MacOS、FreeBSD 操作系统所准备的。
|
||||||
|
|
||||||
|
FSCK 全称为 File System Consistency Check。在大多数时候,它在系统启动时运行,但是如果需要的话,它也能被超级用户手工启动。
|
||||||
|
|
||||||
|
它可以进行三种模式的操作,
|
||||||
|
|
||||||
|
1. 查错并在发现错误时由用户决定如何处理,
|
||||||
|
2. 查错并自动修复,
|
||||||
|
3. 查错但在发现错误时只显示错误而不进行修复。
|
||||||
|
|
||||||
|
### FSCK 的语法
|
||||||
|
|
||||||
|
手工执行 FSCK 的语法为,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ fsck options drives
|
||||||
|
```
|
||||||
|
|
||||||
|
`fsck` 支持的选项有,
|
||||||
|
|
||||||
|
- `-p` 自动修复(不询问)
|
||||||
|
- `-n` 不对文件系统做出改动
|
||||||
|
- `-y` 对所有问题都回答 "yes"
|
||||||
|
- `-c` 检查所有的坏块并将之添加到坏块列表中
|
||||||
|
- `-f` 即使文件系统标记为 clean 也强制进行检查
|
||||||
|
- `-v` 输出详细信息
|
||||||
|
- `-b superblock` 使用替代的超级块
|
||||||
|
- `-B blocksize` 指定超级块的块大小
|
||||||
|
- `-j external_journal` 指定外部日志的位置
|
||||||
|
- `-l bad_blocks_file` 添加到指定的坏块列表(文件)
|
||||||
|
- `-L bad_blocks_file` 指定坏块列表(文件)
|
||||||
|
|
||||||
|
我们可以根据要做的操作任意指定这些选项。下面让我们来看一些例子。
|
||||||
|
|
||||||
|
### Fsck 命令的案例
|
||||||
|
|
||||||
|
注意: 在开始讨论案例之前,请先读完这段话。我们不应该用 `fsck` 检查已挂载的磁盘,这很可能会对磁盘造成永久性的伤害。因此在开始使用 `fsck` 之前,我们需要使用下面命令来卸载磁盘,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ umount drivename
|
||||||
|
```
|
||||||
|
|
||||||
|
比如像这样,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ umount /dev/sdb1
|
||||||
|
```
|
||||||
|
|
||||||
|
可以通过下面命令来查看分区编号,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ fdisk -l
|
||||||
|
```
|
||||||
|
|
||||||
|
另外,在运行 fsck 时,可能出错并返回一些错误码。下面是一些常见的错误及其意义的列表,
|
||||||
|
|
||||||
|
- `0` - 没有错误
|
||||||
|
- `1` - 修复了一些文件系统错误
|
||||||
|
- `2` - 系统需要被重启
|
||||||
|
- `4` - 文件系统错误未被修复
|
||||||
|
- `8` - 操作错
|
||||||
|
- `16` - 使用或语法错
|
||||||
|
- `32` - fsck 被用户取消
|
||||||
|
- `128` - 共享库出错
|
||||||
|
|
||||||
|
现在让我们来看一些 `fsck` 命令的例子,
|
||||||
|
|
||||||
|
### 在单个分区上进行错误检查
|
||||||
|
|
||||||
|
在终端运行下面过命令来对单个分区进行检查,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ umount /dev/sdb1
|
||||||
|
$ fsck /dev/sdb1
|
||||||
|
```
|
||||||
|
|
||||||
|
### 检查文件系统错误并自动修复
|
||||||
|
|
||||||
|
使用选项 `-a` 进行一致性检查并自动修复这些错误。也可以用 `-y` 替代 `-a` 选项。
|
||||||
|
|
||||||
|
```
|
||||||
|
$ fsck -a /dev/sdb1
|
||||||
|
```
|
||||||
|
|
||||||
|
### 检查文件系统错误但并不进行修复
|
||||||
|
|
||||||
|
若我们只想知道文件系统上有哪些错误而不想修复这些错误,那么可以使用选项 `-n`,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ fsck -n /dev/sdb1
|
||||||
|
```
|
||||||
|
|
||||||
|
### 检查所有分区中的错误
|
||||||
|
|
||||||
|
`-A` 选项一次性检查所有分区上的文件系统错误,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ fsck -A
|
||||||
|
```
|
||||||
|
|
||||||
|
若要禁止对根文件系统进行检查可以使用选项 `-R`,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ fsck -AR
|
||||||
|
```
|
||||||
|
|
||||||
|
### 只检查指定文件系统类型的分区
|
||||||
|
|
||||||
|
使用选项 `-t` 及文件系统类型,可以让 fsck 只检查指定文件系统类型的分区,比如指定文件系统类型为 “ext4”,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ fsck -t ext4 /dev/sdb1
|
||||||
|
```
|
||||||
|
|
||||||
|
或者,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ fsck -t -A ext4
|
||||||
|
```
|
||||||
|
|
||||||
|
### 只在卸载的磁盘上进行一致性检查
|
||||||
|
|
||||||
|
要保证 fsck 只在卸载的磁盘上操作,可以使用选项 `-M`,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ fsck -AM
|
||||||
|
```
|
||||||
|
|
||||||
|
这就是我们的案例教程了。有任何疑问欢迎在下面的留言框中留言。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: http://linuxtechlab.com/linux-filesystem-errors-fsck-command-with-examples/
|
||||||
|
|
||||||
|
作者:[Shusain][a]
|
||||||
|
译者:[lujun9972](https://github.com/lujun9972)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:http://linuxtechlab.com/author/shsuain/
|
||||||
|
[1]:http://linuxtechlab.com/learn-use-tcpdump-command-examples/
|
@ -1,56 +0,0 @@
|
|||||||
translating by lujun9972
|
|
||||||
Fix The Display and Console Gibberish on a Linux / Unix / OS X / BSD Systems
|
|
||||||
======
|
|
||||||
Sometimes my R & D result in the weird output on the screen。For example,accidentally I run cat command over binary file - cat /sbin/*。You will be not able to access your bash/ksh/zsh based terminal。It will be full of wired character sequences that can lock down your display。These characters will hide what you type or character displayed into strange symbols。To clear gibberish all over the screen use the following method。This article describes how to really clear the terminal screen or reset terminal in Linux or Unix-like system。
|
|
||||||
|
|
||||||
|
|
||||||
## The clear command
|
|
||||||
|
|
||||||
The clear command clears your screen including its scrollback buffer。
|
|
||||||
`$ clear`
|
|
||||||
You can press CTRL+L to clear screen too。However,clear command won't clear the terminal screen。Use the following methods to really clear the terminal so you get a get back a good working terminal。
|
|
||||||
|
|
||||||
## How to fix the display using the rest command
|
|
||||||
|
|
||||||
Here is my console with gibberish all over the screen:
|
|
||||||
[![Fig.01:Bash fix the display][1]][2]
|
|
||||||
|
|
||||||
To fix the display just type the reset command。It will initialization terminal again for you:
|
|
||||||
`$ reset`
|
|
||||||
OR
|
|
||||||
`$ tput reset`
|
|
||||||
|
|
||||||
If reset command failed to work type the following command to restore the session to a normal state:
|
|
||||||
`$ stty sane`
|
|
||||||
|
|
||||||
Press CTRL + L to clear the screen (or type the clear command):
|
|
||||||
`$ clear`
|
|
||||||
|
|
||||||
## Use ANSI escape sequence to really clear the bash terminal
|
|
||||||
|
|
||||||
Another option is to type the following ANSI escape sequence:
|
|
||||||
```
|
|
||||||
clear
|
|
||||||
echo -e "\033c"
|
|
||||||
```
|
|
||||||
|
|
||||||
Sample outputs from both commands:
|
|
||||||
[![Animated gif 01:Fix Unix Console Gibberish Command Demo][3]][4]
|
|
||||||
Read man pages of stty and reset for more information stty(1),reset(1),bash(1)
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://www.cyberciti.biz/tips/bash-fix-the-display.html
|
|
||||||
|
|
||||||
作者:[Vivek Gite][a]
|
|
||||||
译者:[lujun9972](https://github.com/lujun9972)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]:https://www.cyberciti.biz
|
|
||||||
[1]:https://www.cyberciti.biz/media/new/tips/2006/08/bash-fix-terminal.png
|
|
||||||
[2]:https://www.cyberciti.biz/media/uploads/tips/2006/08/bash-fix-terminal.png
|
|
||||||
[3]:https://www.cyberciti.biz/media/new/tips/2006/08/unix-linux-console-gibberish.gif
|
|
||||||
[4]:https://www.cyberciti.biz/tips/bash-fix-the-display.html/unix-linux-console-gibberish
|
|
238
sources/tech/20170213 Getting Started with Taskwarrior.md
Normal file
238
sources/tech/20170213 Getting Started with Taskwarrior.md
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
Getting Started with Taskwarrior
|
||||||
|
======
|
||||||
|
Taskwarrior is a flexible [command-line task management program][1]. In their [own words][2]:
|
||||||
|
|
||||||
|
Taskwarrior manages your TODO list from your command line. It is flexible, fast, efficient, unobtrusive, does its job then gets out of your way.
|
||||||
|
|
||||||
|
Taskwarrior is highly customizable, but can also be used "right out of the box." In this article, we'll show you the basic commands to add and complete tasks. Then we'll cover a couple more advanced commands. And finally, we'll show you some basic configuration settings to begin customizing your setup.
|
||||||
|
|
||||||
|
### Installing Taskwarrior
|
||||||
|
|
||||||
|
Taskwarrior is available in the Fedora repositories, so installing it is simple:
|
||||||
|
```
|
||||||
|
sudo dnf install task
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Once installed, run `task`. This first run will create a `~/.taskrc` file for you.
|
||||||
|
```
|
||||||
|
$ **task**
|
||||||
|
A configuration file could not be found in ~
|
||||||
|
|
||||||
|
Would you like a sample /home/link/.taskrc created, so Taskwarrior can proceed? (yes/no) yes
|
||||||
|
[task next]
|
||||||
|
No matches.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Adding Tasks
|
||||||
|
|
||||||
|
Adding tasks is fast and unobtrusive.
|
||||||
|
```
|
||||||
|
$ **task add Plant the wheat**
|
||||||
|
Created task 1.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Run `task` or `task list` to show upcoming tasks.
|
||||||
|
```
|
||||||
|
$ **task list**
|
||||||
|
|
||||||
|
ID Age Description Urg
|
||||||
|
1 8s Plant the wheat 0
|
||||||
|
|
||||||
|
1 task
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Let's add a few more tasks to round out the example.
|
||||||
|
```
|
||||||
|
$ **task add Tend the wheat**
|
||||||
|
Created task 2.
|
||||||
|
$ **task add Cut the wheat**
|
||||||
|
Created task 3.
|
||||||
|
$ **task add Take the wheat to the mill to be ground into flour**
|
||||||
|
Created task 4.
|
||||||
|
$ **task add Bake a cake**
|
||||||
|
Created task 5.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Run `task` again to view the list.
|
||||||
|
```
|
||||||
|
[task next]
|
||||||
|
|
||||||
|
ID Age Description Urg
|
||||||
|
1 3min Plant the wheat 0
|
||||||
|
2 22s Tend the wheat 0
|
||||||
|
3 16s Cut the wheat 0
|
||||||
|
4 8s Take the wheat to the mill to be ground into flour 0
|
||||||
|
5 2s Bake a cake 0
|
||||||
|
|
||||||
|
5 tasks
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Completing Tasks
|
||||||
|
|
||||||
|
To mark a task as complete, look up its ID and run:
|
||||||
|
```
|
||||||
|
$ **task 1 done**
|
||||||
|
Completed task 1 'Plant the wheat'.
|
||||||
|
Completed 1 task.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also mark a task done with its description.
|
||||||
|
```
|
||||||
|
$ **task 'Tend the wheat' done**
|
||||||
|
Completed task 1 'Tend the wheat'.
|
||||||
|
Completed 1 task.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
With `add`, `list` and `done`, you're all ready to get started with Taskwarrior.
|
||||||
|
|
||||||
|
### Setting Due Dates
|
||||||
|
|
||||||
|
Many tasks do not require a due date:
|
||||||
|
```
|
||||||
|
task add Finish the article on Taskwarrior
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
But sometimes, setting a due date is just the kind of motivation you need to get productive. Use the `due` modifier when adding a task to set a specific due date.
|
||||||
|
```
|
||||||
|
task add Finish the article on Taskwarrior due:tomorrow
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
`due` is highly flexible. It accepts specific dates ("2017-02-02"), or ISO-8601 ("2017-02-02T20:53:00Z"), or even relative time ("8hrs"). See the [Date & Time][3] documentation for all the examples.
|
||||||
|
|
||||||
|
Dates go beyond due dates too. Taskwarrior has `scheduled`, `wait`, and `until`.
|
||||||
|
```
|
||||||
|
task add Proof the article on Taskwarrior scheduled:thurs
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Once the date (Thursday in this example) passes, the task is tagged with the `READY` virtual tag. It will then show up in the `ready` report.
|
||||||
|
```
|
||||||
|
$ **task ready**
|
||||||
|
|
||||||
|
ID Age S Description Urg
|
||||||
|
1 2s 1d Proof the article on Taskwarrior 5
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
To remove a date, `modify` the task with a blank value:
|
||||||
|
```
|
||||||
|
$ task 1 modify scheduled:
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Searching Tasks
|
||||||
|
|
||||||
|
No task list is complete without the ability to search with regular expressions, right?
|
||||||
|
```
|
||||||
|
$ **task '/.* the wheat/' list**
|
||||||
|
|
||||||
|
ID Age Project Description Urg
|
||||||
|
2 42min Take the wheat to the mill to be ground into flour 0
|
||||||
|
1 42min Home Cut the wheat 1
|
||||||
|
|
||||||
|
2 tasks
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Customizing Taskwarrior
|
||||||
|
|
||||||
|
Remember that file we created back in the beginning (`~/.taskrc`). Let's take at the defaults:
|
||||||
|
```
|
||||||
|
# [Created by task 2.5.1 2/9/2017 16:39:14]
|
||||||
|
# Taskwarrior program configuration file.
|
||||||
|
# For more documentation, see http://taskwarrior.org or try 'man task', 'man task-color',
|
||||||
|
# 'man task-sync' or 'man taskrc'
|
||||||
|
|
||||||
|
# Here is an example of entries that use the default, override and blank values
|
||||||
|
# variable=foo -- By specifying a value, this overrides the default
|
||||||
|
# variable= -- By specifying no value, this means no default
|
||||||
|
# #variable=foo -- By commenting out the line, or deleting it, this uses the default
|
||||||
|
|
||||||
|
# Use the command 'task show' to see all defaults and overrides
|
||||||
|
|
||||||
|
# Files
|
||||||
|
data.location=~/.task
|
||||||
|
|
||||||
|
# Color theme (uncomment one to use)
|
||||||
|
#include /usr//usr/share/task/light-16.theme
|
||||||
|
#include /usr//usr/share/task/light-256.theme
|
||||||
|
#include /usr//usr/share/task/dark-16.theme
|
||||||
|
#include /usr//usr/share/task/dark-256.theme
|
||||||
|
#include /usr//usr/share/task/dark-red-256.theme
|
||||||
|
#include /usr//usr/share/task/dark-green-256.theme
|
||||||
|
#include /usr//usr/share/task/dark-blue-256.theme
|
||||||
|
#include /usr//usr/share/task/dark-violets-256.theme
|
||||||
|
#include /usr//usr/share/task/dark-yellow-green.theme
|
||||||
|
#include /usr//usr/share/task/dark-gray-256.theme
|
||||||
|
#include /usr//usr/share/task/dark-gray-blue-256.theme
|
||||||
|
#include /usr//usr/share/task/solarized-dark-256.theme
|
||||||
|
#include /usr//usr/share/task/solarized-light-256.theme
|
||||||
|
#include /usr//usr/share/task/no-color.theme
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
The only active option right now is `data.location=~/.task`. To view active configuration settings (including the built-in defaults), run `show`.
|
||||||
|
```
|
||||||
|
task show
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
To change a setting, use `config`.
|
||||||
|
```
|
||||||
|
$ **task config displayweeknumber no**
|
||||||
|
Are you sure you want to add 'displayweeknumber' with a value of 'no'? (yes/no) yes
|
||||||
|
Config file /home/link/.taskrc modified.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
These are just some of the things you can do with Taskwarrior.
|
||||||
|
|
||||||
|
Assign a project to your tasks:
|
||||||
|
```
|
||||||
|
task 'Fix leak in the roof' modify project:Home
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Use `start` to mark what you were working on. This can help you remember what you were working on after the weekend:
|
||||||
|
```
|
||||||
|
task 'Fix bug #141291' start
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Use relevant tags:
|
||||||
|
```
|
||||||
|
task add 'Clean gutters' +weekend +house
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Be sure to read the [complete documentation][4] to learn all the ways you can catalog and organize your tasks.
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://fedoramagazine.org/getting-started-taskwarrior/
|
||||||
|
|
||||||
|
作者:[Link Dupont][a]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://fedoramagazine.org/author/linkdupont/
|
||||||
|
[1]:https://taskwarrior.org/
|
||||||
|
[2]:https://taskwarrior.org/docs/start.html
|
||||||
|
[3]:https://taskwarrior.org/docs/dates.html
|
||||||
|
[4]:https://taskwarrior.org/docs/
|
@ -0,0 +1,213 @@
|
|||||||
|
9 Lightweight Linux Applications to Speed Up Your System
|
||||||
|
======
|
||||||
|
**Brief:** One of the many ways to [speed up Ubuntu][1] system is to use lightweight alternatives of the popular applications. We have already seen [must have Linux application][2] earlier. we'll see the lightweight alternative applications for Ubuntu and other Linux distributions.
|
||||||
|
|
||||||
|
![Use these Lightweight alternative applications in Ubuntu Linux][4]
|
||||||
|
|
||||||
|
## 9 Lightweight alternatives of popular Linux applications
|
||||||
|
|
||||||
|
Is your Linux system slow? Are the applications taking a long time to open? The best option you have is to use a [light Linux distro][5]. But it's not always possible to reinstall an operating system, is it?
|
||||||
|
|
||||||
|
So if you want to stick to your present Linux distribution, but want improved performance, you should use lightweight alternatives of the applications you are using. Here, I'm going to put together a small list of lightweight alternatives to various Linux applications.
|
||||||
|
|
||||||
|
Since I am using Ubuntu, I have provided installation instructions for Ubuntu-based Linux distributions. But these applications will work on almost all other Linux distribution. You just have to find a way to install these lightweight Linux software in your distro.
|
||||||
|
|
||||||
|
### 1. Midori: Web Browser
|
||||||
|
|
||||||
|
Midori is one of the most lightweight web browsers that have reasonable compatibility with the modern web. It is open source and uses the same rendering engine that Google Chrome was initially built on -- WebKit. It is super fast and minimal yet highly customizable.
|
||||||
|
|
||||||
|
![Midori Browser][6]
|
||||||
|
|
||||||
|
It has plenty of extensions and options to tinker with. So if you are a power user, it's a great choice for you too. If you face any problems browsing round the web, check the [Frequently Asked Question][7] section of their website -- it contains the common problems you might face along with their solution.
|
||||||
|
|
||||||
|
[Midori][8]
|
||||||
|
|
||||||
|
#### Installing Midori on Ubuntu based distributions
|
||||||
|
|
||||||
|
Midori is available on Ubuntu via the official repository. Just run the following commands for installing it:
|
||||||
|
```
|
||||||
|
sudo apt install midori
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Trojita: email client
|
||||||
|
|
||||||
|
Trojita is an open source robust IMAP e-mail client. It is fast and resource efficient. I can certainly call it one of the [best email clients for Linux][9]. If you can live with only IMAP support on your e-mail client, you might not want to look any further.
|
||||||
|
|
||||||
|
![Trojitá][10]
|
||||||
|
|
||||||
|
Trojita uses various techniques -- on-demand e-mail loading, offline caching, bandwidth-saving mode etc. -- for achieving its impressive performance.
|
||||||
|
|
||||||
|
[Trojita][11]
|
||||||
|
|
||||||
|
#### Installing Trojita on Ubuntu based distributions
|
||||||
|
|
||||||
|
Trojita currently doesn't have an official PPA for Ubuntu. But that shouldn't be a problem. You can install it quite easily using the following commands:
|
||||||
|
```
|
||||||
|
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/jkt-gentoo:/trojita/xUbuntu_16.04/ /' > /etc/apt/sources.list.d/trojita.list"
|
||||||
|
wget http://download.opensuse.org/repositories/home:jkt-gentoo:trojita/xUbuntu_16.04/Release.key
|
||||||
|
sudo apt-key add - < Release.key
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install trojita
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. GDebi: Package Installer
|
||||||
|
|
||||||
|
Sometimes you need to quickly install DEB packages. Ubuntu Software Center is a resource-heavy application and using it just for installing .deb files is not wise.
|
||||||
|
|
||||||
|
Gdebi is certainly a nifty tool for the same purpose, just with a minimal graphical interface.
|
||||||
|
|
||||||
|
![GDebi][12]
|
||||||
|
|
||||||
|
GDebi is totally lightweight and does its job flawlessly. You should even [make Gdebi the default installer for DEB files][13].
|
||||||
|
|
||||||
|
#### Installing GDebi on Ubuntu based distributions
|
||||||
|
|
||||||
|
You can install GDebi on Ubuntu with this simple one-liner:
|
||||||
|
```
|
||||||
|
sudo apt install gdebi
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. App Grid: Software Center
|
||||||
|
|
||||||
|
If you use software center frequently for searching, installing and managing applications on Ubuntu, App Grid is a must have application. It is the most visually appealing and yet fast alternative to the default Ubuntu Software Center.
|
||||||
|
|
||||||
|
![App Grid][14]
|
||||||
|
|
||||||
|
App Grid supports ratings, reviews and screenshots for applications.
|
||||||
|
|
||||||
|
[App Grid][15]
|
||||||
|
|
||||||
|
#### Installing App Grid on Ubuntu based distributions
|
||||||
|
|
||||||
|
App Grid has its official PPA for Ubuntu. Use the following commands for installing App Grid:
|
||||||
|
```
|
||||||
|
sudo add-apt-repository ppa:appgrid/stable
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install appgrid
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. Yarock: Music Player
|
||||||
|
|
||||||
|
Yarock is an elegant music player with a modern and minimal user interface. It is lightweight in design and yet it has a comprehensive list of advanced features.
|
||||||
|
|
||||||
|
![Yarock][16]
|
||||||
|
|
||||||
|
The main features of Yarock include multiple music collections, rating, smart playlist, multiple back-end option, desktop notification, scrobbling, context fetching etc.
|
||||||
|
|
||||||
|
[Yarock][17]
|
||||||
|
|
||||||
|
#### Installing Yarock on Ubuntu based distributions
|
||||||
|
|
||||||
|
You will have to install Yarock on Ubuntu via PPA using the following commands:
|
||||||
|
```
|
||||||
|
sudo add-apt-repository ppa:nilarimogard/webupd8
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install yarock
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. VLC: Video Player
|
||||||
|
|
||||||
|
Who doesn't need a video player? And who has never heard about VLC? It doesn't really need any introduction.
|
||||||
|
|
||||||
|
![VLC][18]
|
||||||
|
|
||||||
|
VLC is all you need to play various media files on Ubuntu and it is quite lightweight too. It works flawlessly on even on very old PCs.
|
||||||
|
|
||||||
|
[VLC][19]
|
||||||
|
|
||||||
|
#### Installing VLC on Ubuntu based distributions
|
||||||
|
|
||||||
|
VLC has official PPA for Ubuntu. Enter the following commands for installing it:
|
||||||
|
```
|
||||||
|
sudo apt install vlc
|
||||||
|
```
|
||||||
|
|
||||||
|
### 7. PCManFM: File Manager
|
||||||
|
|
||||||
|
PCManFM is the standard file manager from LXDE. As with the other applications from LXDE, this one too is lightweight. If you are looking for a lighter alternative for your file manager, try this one.
|
||||||
|
|
||||||
|
![PCManFM][20]
|
||||||
|
|
||||||
|
Although coming from LXDE, PCManFM works with other desktop environments just as well.
|
||||||
|
|
||||||
|
#### Installing PCManFM on Ubuntu based distributions
|
||||||
|
|
||||||
|
Installing PCManFM on Ubuntu will just take one simple command:
|
||||||
|
```
|
||||||
|
sudo apt install pcmanfm
|
||||||
|
```
|
||||||
|
|
||||||
|
### 8. Mousepad: Text Editor
|
||||||
|
|
||||||
|
Nothing can beat command-line text editors like - nano, vim etc. in terms of being lightweight. But if you want a graphical interface, here you go -- Mousepad is a minimal text editor. It's extremely lightweight and blazing fast. It comes with a simple customizable user interface with multiple themes.
|
||||||
|
|
||||||
|
![Mousepad][21]
|
||||||
|
|
||||||
|
Mousepad supports syntax highlighting. So, you can also use it as a basic code editor.
|
||||||
|
|
||||||
|
#### Installing Mousepad on Ubuntu based distributions
|
||||||
|
|
||||||
|
For installing Mousepad use the following command:
|
||||||
|
```
|
||||||
|
sudo apt install mousepad
|
||||||
|
```
|
||||||
|
|
||||||
|
### 9. GNOME Office: Office Suite
|
||||||
|
|
||||||
|
Many of us need to use office applications quite often. Generally, most of the office applications are bulky in size and resource hungry. Gnome Office is quite lightweight in that respect. Gnome Office is technically not a complete office suite. It's composed of different standalone applications and among them, **AbiWord** & **Gnumeric** stands out.
|
||||||
|
|
||||||
|
**AbiWord** is the word processor. It is lightweight and a lot faster than other alternatives. But that came to be at a cost -- you might miss some features like macros, grammar checking etc. It's not perfect but it works.
|
||||||
|
|
||||||
|
![AbiWord][22]
|
||||||
|
|
||||||
|
**Gnumeric** is the spreadsheet editor. Just like AbiWord, Gnumeric is also very fast and it provides accurate calculations. If you are looking for a simple and lightweight spreadsheet editor, Gnumeric has got you covered.
|
||||||
|
|
||||||
|
![Gnumeric][23]
|
||||||
|
|
||||||
|
There are some other applications listed under Gnome Office. You can find them in the official page.
|
||||||
|
|
||||||
|
[Gnome Office][24]
|
||||||
|
|
||||||
|
#### Installing AbiWord & Gnumeric on Ubuntu based distributions
|
||||||
|
|
||||||
|
For installing AbiWord & Gnumeric, simply enter the following command in your terminal:
|
||||||
|
```
|
||||||
|
sudo apt install abiword gnumeric
|
||||||
|
```
|
||||||
|
|
||||||
|
That's all for today. Would you like to add some other **lightweight Linux applications** to this list? Do let us know!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/lightweight-alternative-applications-ubuntu/
|
||||||
|
|
||||||
|
作者:[Munif Tanjim][a]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://itsfoss.com/author/munif/
|
||||||
|
[1]:https://itsfoss.com/speed-up-ubuntu-1310/
|
||||||
|
[2]:https://itsfoss.com/essential-linux-applications/
|
||||||
|
[4]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/03/Lightweight-alternative-applications-for-Linux-800x450.jpg
|
||||||
|
[5]:https://itsfoss.com/lightweight-linux-beginners/
|
||||||
|
[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/03/Midori-800x497.png
|
||||||
|
[7]:http://midori-browser.org/faqs/
|
||||||
|
[8]:http://midori-browser.org/
|
||||||
|
[9]:https://itsfoss.com/best-email-clients-linux/
|
||||||
|
[10]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/03/Trojit%C3%A1-800x608.png
|
||||||
|
[11]:http://trojita.flaska.net/
|
||||||
|
[12]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/03/GDebi.png
|
||||||
|
[13]:https://itsfoss.com/gdebi-default-ubuntu-software-center/
|
||||||
|
[14]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/03/AppGrid-800x553.png
|
||||||
|
[15]:http://www.appgrid.org/
|
||||||
|
[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/03/Yarock-800x529.png
|
||||||
|
[17]:https://seb-apps.github.io/yarock/
|
||||||
|
[18]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/03/VLC-800x526.png
|
||||||
|
[19]:http://www.videolan.org/index.html
|
||||||
|
[20]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/03/PCManFM.png
|
||||||
|
[21]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/03/Mousepad.png
|
||||||
|
[22]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/03/AbiWord-800x626.png
|
||||||
|
[23]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/03/Gnumeric-800x470.png
|
||||||
|
[24]:https://gnome.org/gnome-office/
|
@ -1,98 +0,0 @@
|
|||||||
translating---geekpi
|
|
||||||
|
|
||||||
Commands to check System & Hardware Information
|
|
||||||
======
|
|
||||||
Hello linux-fanatics, in this post i will be discussing some important that will make your life as System Administrator. As we all know being a good System Administrator means knowing everything about your IT Infrastructure & having all the information about your servers, whether its hardware or OS. So following commands will help you out in extracting out all the hardware & system information.
|
|
||||||
|
|
||||||
#### 1- Viewing system information
|
|
||||||
|
|
||||||
$ uname -a
|
|
||||||
|
|
||||||
![uname command][2]
|
|
||||||
|
|
||||||
It will provide you all the information about your system. It will provide you with Kernel name of system, Hostname, Kernel version, Kernel Release, Hardware name.
|
|
||||||
|
|
||||||
#### 2- Viewing Hardware information
|
|
||||||
|
|
||||||
$ lshw
|
|
||||||
|
|
||||||
![lshw command][4]
|
|
||||||
|
|
||||||
Using lshw will show you all the Hardware information on your screen.
|
|
||||||
|
|
||||||
#### 3- Viewing Block Devices(Hard disks, Flash drives) information
|
|
||||||
|
|
||||||
$ lsblk
|
|
||||||
|
|
||||||
![lsblk command][6]
|
|
||||||
|
|
||||||
lsblk command prints all the information regarding block devices on screen. Use lsblk -a to show all the block devices.
|
|
||||||
|
|
||||||
#### 4- Viewing CPU information
|
|
||||||
|
|
||||||
$ lscpu
|
|
||||||
|
|
||||||
![lscpu command][8]
|
|
||||||
|
|
||||||
lscpu shows all the CPU information on screen.
|
|
||||||
|
|
||||||
#### 5- Viewing PCI information
|
|
||||||
|
|
||||||
$ lspci
|
|
||||||
|
|
||||||
![lspci command][10]
|
|
||||||
|
|
||||||
All the network adapter cards, USB cards, Graphics cards are termed as PCIs. To view their information use lspci .
|
|
||||||
|
|
||||||
lspci -v will give detailed information regarding PCI cards.
|
|
||||||
|
|
||||||
lspci -t will show them in tree format.
|
|
||||||
|
|
||||||
#### 6- Viewing USB information
|
|
||||||
|
|
||||||
$ lsusb
|
|
||||||
|
|
||||||
![lsusb command][12]
|
|
||||||
|
|
||||||
To view information regarding all USB controllers & devices connected to them, we use lsusb
|
|
||||||
|
|
||||||
#### 7- Viewing SCSI information
|
|
||||||
|
|
||||||
$ lssci
|
|
||||||
|
|
||||||
![lssci][14]
|
|
||||||
|
|
||||||
To view SCSI information type lsscsi. lsscsi -s will also show the size of partition.
|
|
||||||
|
|
||||||
#### 8- Viewing file system information
|
|
||||||
|
|
||||||
$ fdisk -l
|
|
||||||
|
|
||||||
![fdisk command][16]
|
|
||||||
|
|
||||||
Using fdisk -l will show information regarding the file system. Although main function of fdisk utility is to modify a file system, you can create new partitions, delete old ones ( more on that in my future tutorial).
|
|
||||||
|
|
||||||
That's it for now my fellow Linux-fanatics . You are advised to check out my other posts regarding Linux commands **[HERE][17] & ** another one **[HERE][18]
|
|
||||||
**
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: http://linuxtechlab.com/commands-system-hardware-info/
|
|
||||||
|
|
||||||
作者:[Shusain][a]
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]:http://linuxtechlab.com/author/shsuain/
|
|
||||||
[2]:https://i0.wp.com/linuxtechlab.com/wp-content/uploads/2017/02/uname.jpg?resize=664%2C69
|
|
||||||
[4]:https://i2.wp.com/linuxtechlab.com/wp-content/uploads/2017/02/lshw.jpg?resize=641%2C386
|
|
||||||
[6]:https://i1.wp.com/linuxtechlab.com/wp-content/uploads/2017/02/lsblk.jpg?resize=646%2C162
|
|
||||||
[8]:https://i2.wp.com/linuxtechlab.com/wp-content/uploads/2017/02/lscpu.jpg?resize=643%2C216
|
|
||||||
[10]:https://i0.wp.com/linuxtechlab.com/wp-content/uploads/2017/02/lspci.jpg?resize=644%2C238
|
|
||||||
[12]:https://i2.wp.com/linuxtechlab.com/wp-content/uploads/2017/02/lsusb.jpg?resize=645%2C37
|
|
||||||
[14]:https://i2.wp.com/linuxtechlab.com/wp-content/uploads/2017/02/lsscsi.jpg?resize=639%2C110
|
|
||||||
[16]:https://i2.wp.com/linuxtechlab.com/wp-content/uploads/2017/02/fdisk.jpg?resize=656%2C335
|
|
||||||
[17]:http://linuxtechlab.com/linux-commands-beginners-part-1/
|
|
||||||
[18]:http://linuxtechlab.com/linux-commands-beginners-part-2/
|
|
@ -0,0 +1,62 @@
|
|||||||
|
Improve Your Mental Mettle with These Open Source Puzzle Games
|
||||||
|
======
|
||||||
|
### Tax Your Brain, Not Your Wallet
|
||||||
|
|
||||||
|
Puzzle video games are a type of game that focuses on puzzle solving. A puzzle is a problem or set of problems a player has to solve within the confines of the game.
|
||||||
|
|
||||||
|
The puzzle genre often tests problem-solving skills enhancing both analytical and critical thinking skills. Word completion, pattern recognition, logical reasoning, persistence, and sequence solving are some of the skills often required to prosper here. Some games offer unlimited time or attempts to solve a puzzle, others present time-limited exercises which increase the difficulty of the puzzle. Most puzzle games are basic in graphics but are very addictive.
|
||||||
|
|
||||||
|
This genre owes its origins to puzzles and brain teasers. Traditional thinking games such as Hangman, Mastermind, and the mathematical game Nim were early computer implementations.
|
||||||
|
|
||||||
|
Software developers can shape a gamer's brain in a multitude of directions -- cognitive awareness, logistics, reflexes, memory, to cite a selection -- puzzle games are appealing for all ages.
|
||||||
|
|
||||||
|
Many of the biggest computer games concentrate on explosion-filled genres. But there's still strong demand for compelling puzzle games. It's a neglected genre in the mainstream. Here are our picks of the best games. We only advocate open source games here. And we give preference to games that run on multiple operating systems.
|
||||||
|
|
||||||
|
|
||||||
|
**PUZZLE GAMES**
|
||||||
|
|
||||||
|
| --- | --- |
|
||||||
|
| **[Trackballs][1]** | Inspired by Marble Madness |
|
||||||
|
| **[Fish Fillets - Next Generation][2]** | Port of the Puzzle Game Fish Fillets |
|
||||||
|
| **[Frozen Bubble][3]** | A clone of the popular “Puzzle Bobble” game |
|
||||||
|
| **[Neverball][4]** | Tilt the Floor to Roll a Ball Game |
|
||||||
|
| **[Crack Attack!][5]** | Based on the Super Nintendo classic Tetris Attack
|
||||||
|
|
|
||||||
|
| **[Brain Workshop][6]** | Dual N-Back Game |
|
||||||
|
| **[Angry, Drunken Dwarves][7]** | “Falling Blocks” Puzzle Game |
|
||||||
|
| **[gbrainy][8]** | Brain Teaser Game for GNOME |
|
||||||
|
| **[Enigma][9]** | Huge Collection of Puzzle Games |
|
||||||
|
| **[Amoebax][10]** | Cute and Addictive Action-Puzzle Game |
|
||||||
|
| **[Dinothawr][11]** | Save your frozen friends by pushing them onto lava |
|
||||||
|
| **[Pingus][12]** | Lemmings Like Game |
|
||||||
|
| **[Kmahjongg][13]** | Remove Matching Mahjongg Tiles to Clear the Board |
|
||||||
|
|
||||||
|
|
||||||
|
For other games, check out our **[Games Portal page][14]**.
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.ossblog.org/improve-your-mental-mettle-with-these-open-source-puzzle-games/
|
||||||
|
|
||||||
|
作者:[Steve Emms][a]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://www.ossblog.org/author/steve/
|
||||||
|
[1]:https://www.ossblog.org/trackballs-inspired-marble-madness/
|
||||||
|
[2]:https://www.ossblog.org/fish-fillets-ng-port-puzzle-game-fish-fillets/
|
||||||
|
[3]:https://www.ossblog.org/frozen-bubble-puzzle-bobble-style-game/
|
||||||
|
[4]:https://www.ossblog.org/neverball-tilt-floor-roll-ball-game/
|
||||||
|
[5]:https://www.ossblog.org/crack-attack-based-super-nintendo-classic-tetris-attack/
|
||||||
|
[6]:https://www.ossblog.org/brain-workshop-dual-n-back-game/
|
||||||
|
[7]:https://www.ossblog.org/angry-drunken-dwarves-falling-blocks-puzzle-game/
|
||||||
|
[8]:https://www.ossblog.org/gbrainy-brain-teaser-game-gnome/
|
||||||
|
[9]:https://www.ossblog.org/enigma-huge-collection-puzzle-games/
|
||||||
|
[10]:https://www.ossblog.org/amoebax-cute-addictive-action-puzzle-game/
|
||||||
|
[11]:https://www.ossblog.org/dinothawr-save-frozen-friends/
|
||||||
|
[12]:https://www.ossblog.org/pingus-lemmings-like-game/
|
||||||
|
[13]:https://www.ossblog.org/kmahjongg-remove-matching-mahjongg-tiles-clear-board/
|
||||||
|
[14]:https://www.ossblog.org/free-games/
|
@ -0,0 +1,91 @@
|
|||||||
|
Four Hidden Costs and Risks of Sudo Can Lead to Cybersecurity Risks and Compliance Problems on Unix and Linux Servers
|
||||||
|
======
|
||||||
|
It is always a philosophical debate as to whether to use open source software in a regulated environment. Open source software is crowd sourced, and developers from all over the world contribute to packages that are later included in Operating System distributions. In the case of ‘sudo’, a package designed to provide privileged access included in many Linux distributions, the debate is whether it meets the requirements of an organization, and to what level it can be relied upon to deliver compliance information to auditors.
|
||||||
|
|
||||||
|
There are four hidden costs or risks that must be considered when evaluating whether sudo is meeting your organization’s cybersecurity and compliance needs on its Unix and Linux systems, including administrative, forensics and audit, business continuity, and vendor support. Although sudo is a low-cost solution, it may come at a high price in a security program, and when an organization is delivering compliance data to satisfy auditors. In this article, we will review these areas while identifying key questions that should be answered to measure acceptable levels of risk. While every organization is different, there are specific risk/cost considerations that make a strong argument for replacing sudo with a commercially-supported solution.
|
||||||
|
|
||||||
|
### Administrative Costs
|
||||||
|
|
||||||
|
There are several hidden administrative costs is using sudo for Unix and Linux privilege management. For example, with sudo, you also need to run a third-party automation management system (like CFEngine or Puppet) plus third party authentication modules on the box. And, if you plan to externalize the box at all, you’re going to have to replace sudo with that supplier’s version of sudo. So, you end up maintaining sudo, a third-party management system, a third-party automation system, and may have to replace it all if you want to authenticate against something external to the box. A commercial solution would help to consolidate this functionality and simplify the overall management of Unix and Linux servers.
|
||||||
|
|
||||||
|
Another complexity with sudo is that everything is local, meaning it can be extremely time-consuming to manage as environments grow. And as we all know, time is money. With sudo, you have to rely on local systems on the server to keep logs locally, rotate them, send them to an archival environment, and ensure that no one is messing with any of the other related subsystems. This can be a complex and time-consuming process. A commercial solution would combine all of this activity together, including binary pushes and retention, upgrades, logs, archival, and more.
|
||||||
|
|
||||||
|
Unix and Linux systems by their very nature are decentralized, so managing each host separately leads to administrative costs and inefficiencies which in turn leads to risks. A commercial solution centralizes management and policy development across all hosts, introducing enterprise level consistency and best practices to a privileged access management program.
|
||||||
|
|
||||||
|
### Forensics & Audit Risks
|
||||||
|
|
||||||
|
Administrative costs aside, let’s look at the risks associated with not being able to produce log data for forensic investigations. Why is this a challenge for sudo? The sudo package is installed locally on individual servers, and configuration files are maintained on each server individually. There are some tools such as Puppet or Chef that can monitor these files for changes, and replace files with known good copies when a change is detected, but those tools only work after a change takes place. These tools usually operate on a schedule, often checking once or twice per day, so if a system is compromised, or authorization files are changed, it may be several hours before the system is restored to a known good state. The question is, what can happen in those hours?
|
||||||
|
|
||||||
|
There is currently no keystroke logging within sudo, and since any logs of sudo activity are stored locally on servers, they can be tampered with by savvy administrators. Event logs are typically collected with normal system logs, but once again, this requires additional configuration and management of these tools. When advanced users are granted administrative access on servers, it is possible that log data can be modified, or deleted, and all evidence of their activities erased with very little indication that events took place. Now, the question is, has this happened, or is it continuing to happen?
|
||||||
|
|
||||||
|
With sudo, there is no log integrity – no chain of custody on logs – meaning logs can’t be non-repudiated and therefore can’t be used in legal proceedings in most jurisdictions. This is a significant risk to organizations, especially in criminal prosecution, termination, or other disciplinary actions. Third-party commercial solutions’ logs are tamper-proof, which is just not possible with sudo.
|
||||||
|
|
||||||
|
Large organizations typically collect a tremendous amount of data, including system logs, access information, and other system information from all their systems. This data is then sent to a SIEM for analytics, and reporting. SIEM tools do not usually deliver real-time alerting when uncharacteristic events happen on systems, and often configuration of events is difficult and time consuming. For this reason, SIEM solutions are rarely relied upon for alerting within an enterprise environment. Here the question is, what is an acceptable delay from the time an event takes place until someone is alerted?
|
||||||
|
|
||||||
|
Correlating log activity with other data to determine a broader pattern of abuse is also impossible with sudo. Commercial solutions gather logs into one place with searchable indices. Some commercial solutions even correlate this log data against other sources to identify uncharacteristic behavior that could be a warning that a serious security issue is afoot. Commercial solutions therefore provide greater forensic benefits than sudo.
|
||||||
|
|
||||||
|
Another gotcha with sudo is that change management processes can’t be verified. It is always a best practice to review change records, and to validate that what was performed during the change matches the implementation that was proposed. ITIL and other security frameworks require validation of change management practices. Sudo can’t do this. Commercial solutions can do this through reviewing session command recording history and file integrity monitoring without revealing the underlying session data.
|
||||||
|
|
||||||
|
There is no session recording with sudo. Session logs are one of the best forensic tools available for investigating what happened on servers. It’s human nature that people tend to be more cautious when they know they can be watched. Sudo doesn’t provide session recordings.
|
||||||
|
|
||||||
|
Finally, there is no segregation of duties with sudo. Most security and compliance frameworks require true separation of duties, and using a tool such as sudo just “skins” over the segregation of duties aspect. All of these deficiencies – lack of log integrity, lack of session monitoring, no change management – introduces risk when organizations must prove compliance or investigate anomalies.
|
||||||
|
|
||||||
|
### Business Continuity Risks
|
||||||
|
|
||||||
|
Sudo is open source. There is no indemnification if there is a critical error. Also, there is no rollback with sudo, so there is always the chance that mistakes will bring and entire system down with no one to call for support. Sure, it is possible to centralize sudo through a third-party tool such as Puppet or CFEngine, but you still end up managing multiple files across multiple groups of systems manually (or managed as one huge policy). With this approach, there is greater risk that mistakes will break every system at once. A commercial solution would have policy roll-back capability that would limit the damage done.
|
||||||
|
|
||||||
|
### Lack of Enterprise Support
|
||||||
|
|
||||||
|
Since sudo is an open source package, there is no official service level for when packages must be updated to respond to identified security flaws, or vulnerabilities. By mid-2017, there have already been two vulnerabilities identified in sudo with a CVSS score greater than six (CVE Sudo Vulnerabilities). Over the past several years, there have been a number of vulnerabilities discovered in sudo that took as many as three years to patch ([CVE-2013-2776][1] , [CVE-2013-2777][2] , [CVE-2013-1776][3]). The question here is, what exploits have been used in the past several months or years? A commercial solution that replaces sudo would eliminate this problem.
|
||||||
|
|
||||||
|
### Ten Questions to Measure Risk in Your Unix and Linux Environment
|
||||||
|
|
||||||
|
Unix and Linux systems present high-value targets for external attackers and malicious insiders. Expect to be breached if you share accounts, provide unfettered root access, or let files and sessions go unmonitored. Gaining root or other privileged credentials makes it easy for attackers to fly under the radar and access sensitive systems and data. And as we have reviewed, sudo isn’t going to help.
|
||||||
|
|
||||||
|
In balancing costs vs. an acceptable level of risk to your Unix and Linux environment, consider these 10 questions:
|
||||||
|
|
||||||
|
1. How much time are Unix/Linux admins spending just trying to keep up? Can your organization benefit from automation?
|
||||||
|
|
||||||
|
2. Are you able to keep up with the different platform and version changes to your Unix/Linux systems?
|
||||||
|
|
||||||
|
3. As you grow and more hosts are added, how much more time will admins need to keep up with policy? Is adding personnel an option?
|
||||||
|
|
||||||
|
4. What about consistency across systems? Modifying individual sudoers files with multiple admins makes that very difficult. Wouldn’t systems become siloed if not consistently managed?
|
||||||
|
|
||||||
|
5. What happens when you bring in new or different Linux or Unix platforms? How will that complicate the management of the environment?
|
||||||
|
|
||||||
|
6. How critical is it for compliance or legal purposes to know whether a policy file or log has been tampered with?
|
||||||
|
|
||||||
|
7. Do you have a way to verify that the sudoers file hasn’t been modified without permission?
|
||||||
|
|
||||||
|
8. How do you know what admins actually did once they became root? Do you have a command history for their activity?
|
||||||
|
|
||||||
|
9. What would it cost the business if a mission-critical Unix/Linux host goes down? With sudo, how quickly could the team troubleshoot and fix the problem?
|
||||||
|
|
||||||
|
10. Can you demonstrate to the board that you have a backup if there is a significant outage?
|
||||||
|
|
||||||
|
### Benefits of Using a Commercial Solution
|
||||||
|
|
||||||
|
Although they come at a higher cost than free open source solutions, commercial solutions provide an effective way to mitigate the general issues related to sudo. Solutions that offer centralized management ease the pressure on monitoring and maintaining remote systems, centralized logging of events, and keystroke recording are the cornerstone of audit expectations for most enterprises.
|
||||||
|
|
||||||
|
Commercial solutions usually have a regular release cycle, and can typically deliver patches in response to vulnerabilities in hours, or days from the time they’re reported. Commercial solutions like PowerBroker for Unix & Linux by BeyondTrust provide event logging on separate infrastructure that is inaccessible to privileged users, and this eliminates the possibility of log tampering. PowerBroker also provides strong, centralized policy controls that are managed within an infrastructure separate from systems under management; this eliminates the possibility of rogue changes to privileged access policies in server environments. Strong policy control also moves security posture from ‘Respond’ to ‘Prevent’, and advanced features provide the ability to integrate with other enterprise tools, and conditionally alert when privileged access sessions begin, or end.
|
||||||
|
|
||||||
|
### Conclusion
|
||||||
|
|
||||||
|
For organizations that are serious about incorporating a strong privileged access management program into their security program, there is no question that a commercial product delivers much better than an open source offering such as sudo. Eliminating the possibility of malicious behavior using strong controls, centralized log file collection, and centralized policy management is far better than relying on questionable, difficult to manage controls delivered within sudo. In calculating an acceptable level of risk to your tier-1 Unix and Linux systems, all of these costs and benefits must be considered.
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: http://www.linuxjournal.com/content/four-hidden-costs-and-risks-sudo-can-lead-cybersecurity-risks-and-compliance-problems-unix-a
|
||||||
|
|
||||||
|
作者:[Chad Erbe][a]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:http://www.linuxjournal.com/users/chad-erbe
|
||||||
|
[1]:https://www.cvedetails.com/cve/CVE-2013-2776/
|
||||||
|
[2]:https://www.cvedetails.com/cve/CVE-2013-2777/
|
||||||
|
[3]:https://www.cvedetails.com/cve/CVE-2013-1776/
|
@ -0,0 +1,347 @@
|
|||||||
|
Complete Guide for Using AsciiDoc in Linux
|
||||||
|
======
|
||||||
|
**Brief: This detailed guide discusses the advantages of using AsciiDoc and shows you how to install and use AsciiDoc in Linux.**
|
||||||
|
|
||||||
|
Over the years I used many different tools to write articles, reports or documentation. I think all started for me with Luc Barthelet's Epistole on Apple IIc from the French editor Version Soft. Then I switched to GUI tools with the excellent Microsoft Word 5 for Apple Macintosh, then the less convincing (to me) StarOffice on Sparc Solaris, that was already known as OpenOffice when I definitively switched to Linux. All these tools were really [word-processors][1].
|
||||||
|
|
||||||
|
But I was never really convinced by [WYSIWYG][2] editors. So I investigated many different more-or-less human-readable text formats: [troff][3], [HTML][4], [RTF][5], [TeX][6]/[LaTeX][7], [XML][8] and finally [AsciiDoc][9] which is the tool I use the most today. In fact, I am using it right now to write this article!
|
||||||
|
|
||||||
|
If I made that history, it was because somehow the loop is closed. Epistole was a word-processor of the text-console era. As far as I remember, there were menus and you can use the mouse to select text -- but most of the formatting was done by adding non-intrusive tags into the text. Just like it is done with AsciiDoc. Of course, it was not the first software to do that. But it was the first I used!
|
||||||
|
|
||||||
|
|
||||||
|
![Controlling text alignment in Luc Barthelet's Epistole \(1985-Apple II\) by using commands embedded into the text][11]
|
||||||
|
|
||||||
|
### Why AsciiDoc (or any other text file format)?
|
||||||
|
|
||||||
|
I see two advantages in using text formats for writing: first, there is a clear separation between the content and the presentation. This argument is open to discussion since some text formats like TeX or HTML require a good discipline to adhere to that separation. And on the other hand, you can somehow achieve some level of separation by using [templates and stylesheets][12] with WYSIWYG editors. I agree with that. But I still find presentation issues intrusive with GUI tools. Whereas, when using text formats, you can focus on the content only without any font style or widow line disturbing you in your writing. But maybe it's just me? However, I can't count the number of times I stopped my writing just to fix some minor styling issue -- and having lost my inspiration when I came back to the text. If you disagree or have a different experience, don't hesitate to contradict me using the comment section below!
|
||||||
|
|
||||||
|
Anyway, my second argument will be less subject to personal interpretation: documents based on text formats are highly interoperable. Not only you can edit them with any text editor on any platform, but you can easily manage text revisions with a tool such as [git][13] or [SVN][14], or automate text modification using common tools such as [sed][15], [AWK][16], [Perl][17] and so on. To give you a concrete example, when using a text-based format like AsciiDoc, I only need one command to produce highly personalized mailing from a master document, whereas the same job using a WYSIWYG editor would have required a clever use of "fields" and going through several wizard screens.
|
||||||
|
|
||||||
|
### What is AsciiDoc?
|
||||||
|
|
||||||
|
Strictly speaking, AsciiDoc is a file format. It defines syntactic constructs that will help a processor to understand the semantics of the various parts of your text. Usually in order to produce a nicely formatted output.
|
||||||
|
|
||||||
|
Even if that definition could seem abstract, this is something simple: some keywords or characters in your document have a special meaning that will change the rendering of the document. This is the exact same concept as the tags in HTML. But a key difference with AsciiDoc is the property of the source document to remain easily human readable.
|
||||||
|
|
||||||
|
Check [our GitHub repository][18] to compare how the same output can be produced using few common text files format: (coffee manpage idea courtesy of <http://www.linuxjournal.com/article/1158>)
|
||||||
|
|
||||||
|
* `coffee.man` uses the venerable troff processor (based on the 1964 [RUNOFF][19] program). It's mostly used today to write [man pages][20]. You can try it after having downloaded the `coffee.*` files by typing `man ./coffee.man` at your command prompt.
|
||||||
|
* `coffee.tex` uses the LaTeX syntax (1985) to achieve mostly the same result but for a PDF output. LaTeX is a typesetting program especially well suited for scientific publications because of its ability to nicely format mathematical formulae and tables. You can produce the PDF from the LaTeX source using `pdflatex coffee.tex`
|
||||||
|
* `coffee.html` is using the HTML format (1991) to describe the page. You can directly open that file with your favorite web browser to see the result.
|
||||||
|
* `coffee.adoc`, finally, is using the AsciiDoc syntax (2002). You can produce both HTML and PDF from that file:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
asciidoc coffee.adoc # HTML output
|
||||||
|
a2x --format pdf ./coffee.adoc # PDF output (dblatex)
|
||||||
|
a2x --fop --format pdf ./coffee.adoc # PDF output (Apache FOP)
|
||||||
|
```
|
||||||
|
|
||||||
|
Now you've seen the result, open those four files using your favorite [text editor][21] (nano, vim, SublimeText, gedit, Atom, … ) and compare the sources: there are great chances you will agree the AsciiDoc sources are easier to read -- and probably to write too.
|
||||||
|
|
||||||
|
|
||||||
|
![Who is who? Could you guess which of these example files is written using AsciiDoc?][22]
|
||||||
|
|
||||||
|
### How to install AsciiDoc in Linux?
|
||||||
|
|
||||||
|
AsciiDoc is relatively complex to install because of the many dependencies. I mean complex if you want to install it from sources. For most of us, using our package manager is probably the best way:
|
||||||
|
```
|
||||||
|
apt-get install asciidoc fop
|
||||||
|
```
|
||||||
|
|
||||||
|
or the following command:
|
||||||
|
```
|
||||||
|
yum install acsiidoc fop
|
||||||
|
```
|
||||||
|
|
||||||
|
(fop is only required if you need the [Apache FOP][23] backend for PDF generation -- this is the PDF backend I use myself)
|
||||||
|
|
||||||
|
More details about the installation can be found on [the official AsciiDoc website][24]. For now, all you need now is a little bit of patience, since, at least on my minimal Debian system, installing AsciiDoc require 360MB to be downloaded (mostly because of the LaTeX dependency). Which, depending on your Internet bandwidth, may give you plenty of time to read the rest of this article.
|
||||||
|
|
||||||
|
### AsciiDoc Tutorial: How to write in AsciiDoc?
|
||||||
|
|
||||||
|
|
||||||
|
![AsciiDoc tutorial for Linux][25]
|
||||||
|
|
||||||
|
I said it several times, AsciiDoc is a human-readable text file format. So, you can write your documents using the text editor of your choice. There are even dedicated text editors. But I will not talk about them here-- simply because I don't use them. But if are using one of them, don't hesitate to share your feedback using the comment section at the end of this article.
|
||||||
|
|
||||||
|
I do not intend to create yet another AsciiDoc syntax tutorial here: there are plenty of them already available on the web. So I will only mention the very basic syntactic constructs you will use in virtually any document. From the simple "coffee" command example quoted above, you may see:
|
||||||
|
|
||||||
|
* **titles** in AsciiDoc are identified by underlying them with `===` or `---` (depending on the title level),
|
||||||
|
* **bold** character spans are written between starts,
|
||||||
|
* and **italics** between underscores.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Those are pretty common convention probably dating back to the pre-HTML email era. In addition, you may need two other common constructs, not illustrated in my previous example: **hyperlinks** and **images** inclusion, whose syntax is pretty self-explanatory.
|
||||||
|
```
|
||||||
|
// HyperText links
|
||||||
|
link:http://dashing-kazoo.flywheelsites.com[ItsFOSS Linux Blog]
|
||||||
|
|
||||||
|
// Inline Images
|
||||||
|
image:https://itsfoss.com/wp-content/uploads/2017/06/itsfoss-text-logo.png[ItsFOSS Text Logo]
|
||||||
|
|
||||||
|
// Block Images
|
||||||
|
image::https://itsfoss.com/wp-content/uploads/2017/06/itsfoss-text-logo.png[ItsFOSS Text Logo]
|
||||||
|
```
|
||||||
|
|
||||||
|
But the AsciiDoc syntax is much richer than that. If you want more, I can point you to that nice AsciiDoc cheatsheet: <http://powerman.name/doc/asciidoc>
|
||||||
|
|
||||||
|
### How to render the final output?
|
||||||
|
|
||||||
|
I will assume here you have already written some text following the AsciiDoc format. If this is not the case, you can download [here][26] some example files copied straight out of the AsciiDoc documentation:
|
||||||
|
```
|
||||||
|
# Download the AsciiDoc User Guide source document
|
||||||
|
BASE='https://raw.githubusercontent.com/itsfoss/asciidoc-intro/master'
|
||||||
|
wget "${BASE}"/{asciidoc.txt,customers.csv}
|
||||||
|
```
|
||||||
|
|
||||||
|
Since AsciiDoc is human-readable, you can send the AsciiDoc source text directly to someone by email, and the recipient will be able to read that message without further ado. But, you may want to provide some more nicely formatted output. For example as HTML for web publication (just like I've done it for this article). Or as PDF for print or display usage.
|
||||||
|
|
||||||
|
In all cases, you need a processor. In fact, under the hood, you will need several processors. Because your AsciiDoc document will be transformed into various intermediate formats before producing the final output. Since several tools are used, the output of one being the input of the next one, we sometimes speak of a toolchain.
|
||||||
|
|
||||||
|
Even if I explain some inner working details here, you have to understand most of that will be hidden from you. Unless maybe when you initially have to install the tools-- or if you want to fine-tune some steps of the process.
|
||||||
|
|
||||||
|
#### In practice?
|
||||||
|
|
||||||
|
For HTML output, you only need the `asciidoc` tool. For more complicated toolchains, I encourage you to use the `a2x` tool (part of the AsciiDoc distribution) that will trigger the necessary processors in order:
|
||||||
|
```
|
||||||
|
# All examples are based on the AsciiDoc User Guide source document
|
||||||
|
|
||||||
|
# HTML output
|
||||||
|
asciidoc asciidoc.txt
|
||||||
|
firefox asciidoc.html
|
||||||
|
|
||||||
|
# XHTML output
|
||||||
|
a2x --format=xhtml asciidoc.txt
|
||||||
|
|
||||||
|
# PDF output (LaTeX processor)
|
||||||
|
a2x --format=pdf asciidoc.txt
|
||||||
|
|
||||||
|
# PDF output (FOP processor)
|
||||||
|
a2x --fop --format=pdf asciidoc.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Even if it can directly produce an HTML output, the core functionality of the `asciidoc` tool remains to transform the AsciiDoc document to the intermediate [DocBook][27] format. DocBook is a XML-based format commonly used for (but not limited to) technical documentation publishing. DocBook is a semantic format. That means it describes your document content. But not its presentation. So formatting will be the next step of the transformation. For that, whatever is the output format, the DocBook intermediate document is processed through an [XSLT][28] processor to produce either directly the output (e.g. XHTML), or another intermediate format.
|
||||||
|
|
||||||
|
This is the case when you generate a PDF document where the DocBook document will be (at your will) converted either as a LaTeX intermediate representation or as [XSL-FO][29] (a XML-based language for page description). Finally, a dedicated tool will convert that representation to PDF.
|
||||||
|
|
||||||
|
The extra steps for PDF generations are notably justified by the fact the toolchain has to handle pagination for the PDF output. Something this is not necessary for a "stream" format like HTML.
|
||||||
|
|
||||||
|
#### dblatex or fop?
|
||||||
|
|
||||||
|
Since there are two PDF backends, the usual question is "Which is the best?" Something I can't answer for you.
|
||||||
|
|
||||||
|
Both processors have [pros and cons][30]. And ultimately, the choice will be a compromise between your needs and your tastes. So I encourage you to take the time to try both of them before choosing the backend you will use. If you follow the LaTeX path, [dblatex][31] will be the backend used to produce the PDF. Whereas it will be [Apache FOP][32] if you prefer using the XSL-FO intermediate format. So don't forget to take a look at the documentation of these tools to see how easy it will be to customize the output to your needs. Unless of course if you are satisfied with the default output!
|
||||||
|
|
||||||
|
### How to customize the output of AsciiDoc?
|
||||||
|
|
||||||
|
#### AsciiDoc to HTML
|
||||||
|
|
||||||
|
Out of the box, AsciiDoc produces pretty nice documents. But sooner or later you will what to customize their appearance.
|
||||||
|
|
||||||
|
The exact changes will depend on the backend you use. For the HTML output, most changes can be done by changing the [CSS][33] stylesheet associated with the document.
|
||||||
|
|
||||||
|
For example, let's say I want to display all section headings in red, I could create the following `custom.css` file:
|
||||||
|
```
|
||||||
|
h2 {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
And process the document using the slightly modified command:
|
||||||
|
```
|
||||||
|
# Set the 'stylesheet' attribute to
|
||||||
|
# the absolute path to our custom CSS file
|
||||||
|
asciidoc -a stylesheet=$PWD/custom.css asciidoc.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also make changes at a finer level by attaching a role attribute to an element. This will translate into a class attribute in the generated HTML.
|
||||||
|
|
||||||
|
For example, try to modify our test document to add the role attribute to the first paragraph of the text:
|
||||||
|
```
|
||||||
|
[role="summary"]
|
||||||
|
AsciiDoc is a text document format ....
|
||||||
|
```
|
||||||
|
|
||||||
|
Then add the following rule to the `custom.css` file:
|
||||||
|
```
|
||||||
|
.summary {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Re-generate the document:
|
||||||
|
```
|
||||||
|
asciidoc -a stylesheet=$PWD/custom.css asciidoc.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
![AsciiDoc HTML output with custom CSS to display the first paragraph in italics and section headings in color][34]
|
||||||
|
|
||||||
|
1. et voila: the first paragraph is now displayed in italic. With a little bit of creativity, some patience and a couple of CSS tutorials, you should be able to customize your document at your wills.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### AsciiDoc to PDF
|
||||||
|
|
||||||
|
Customizing the PDF output is somewhat more complex. Not from the author's perspective since the source text will remain identical. Eventually using the same role attribute as above to identify the parts that need a special treatment.
|
||||||
|
|
||||||
|
But you can no longer use CSS to define the formatting for PDF output. For the most common settings, there are parameters you can set from the command line. Some parameters can be used both with the dblatex and the fop backends, others are specific to each backend.
|
||||||
|
|
||||||
|
For the list of dblatex supported parameters, see <http://dblatex.sourceforge.net/doc/manual/sec-params.html>
|
||||||
|
|
||||||
|
For the list of DocBook XSL parameters, see <http://docbook.sourceforge.net/release/xsl/1.75.2/doc/param.html>
|
||||||
|
|
||||||
|
Since margin adjustment is a pretty common requirement, you may also want to take a look at that: <http://docbook.sourceforge.net/release/xsl/current/doc/fo/general.html>
|
||||||
|
|
||||||
|
If the parameter names are somewhat consistent between the two backends, the command-line arguments used to pass those values to the backends differ between dblatex and fop. So, double check first your syntax if apparently, this isn't working. But to be honest, while writing this article I wasn't able to make the `body.font.family` parameter work with the dblatex backend. Since I usually use fop, maybe did I miss something? If you have more clues about that, I will be more than happy to read your suggestions in the comment section at the end of this article!
|
||||||
|
|
||||||
|
Worth mentioning using non-standard fonts-- even with fop-require some extra work. But it's pretty well documented on the Apache website: <https://xmlgraphics.apache.org/fop/trunk/fonts.html#bulk>
|
||||||
|
```
|
||||||
|
# XSL-FO/FOP
|
||||||
|
a2x -v --format pdf \
|
||||||
|
--fop \
|
||||||
|
--xsltproc-opts='--stringparam page.margin.inner 10cm' \
|
||||||
|
--xsltproc-opts='--stringparam body.font.family Helvetica' \
|
||||||
|
--xsltproc-opts='--stringparam body.font.size 8pt' \
|
||||||
|
asciidoc.txt
|
||||||
|
|
||||||
|
# dblatex
|
||||||
|
# (body.font.family _should_ work, but, apparently, it isn't ?!?)
|
||||||
|
a2x -v --format pdf \
|
||||||
|
--dblatex-opts='--param page.margin.inner=10cm' \
|
||||||
|
--dblatex-opts='--stringparam body.font.family Helvetica' \
|
||||||
|
asciidoc.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Fine-grained setting for PDF generation
|
||||||
|
|
||||||
|
Global parameters are nice if you just need to adjust some pre-defined settings. But if you want to fine-tune the document (or completely change the layout) you will need some extra efforts.
|
||||||
|
|
||||||
|
At the core of the DocBook processing there is [XSLT][28]. XSLT is a computer language, expressed in XML notation, that allows to write arbitrary transformation from an XML document to … something else. XML or not.
|
||||||
|
|
||||||
|
For example, you will need to extend or modify the [DocBook XSL stylesheet][35] to produce the XSL-FO code for the new styles you may want. And if you use the dblatex backend, this may require modifying the corresponding DocBook-to-LaTeX XSLT stylesheet. In that latter case you may also need to use a custom LaTeX package. But I will not focus on that since dblatex is not the backend I use myself. I can only point you to the [official documentation][36] if you want to know more. But once again, if you're familiar with that, please share your tips and tricks in the comment section!
|
||||||
|
|
||||||
|
Even while focusing only on fop, I don't really have the room here to detail the entire procedure. So, I will just show you the changes you could use to obtain a similar result as the one obtained with few CSS lines in HTML output above. That is: section titles in red and a summary paragraph in italics.
|
||||||
|
|
||||||
|
The trick I use here is to create a new XSLT stylesheet, importing the original DocBook stylesheet, but overriding the attribute sets or template for the elements we want to change:
|
||||||
|
```
|
||||||
|
<?xml version='1.0'?>
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:exsl="http://exslt.org/common" exclude-result-prefixes="exsl"
|
||||||
|
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||||
|
version='1.0'>
|
||||||
|
|
||||||
|
<!-- Import the default DocBook stylesheet for XSL-FO -->
|
||||||
|
<xsl:import href="/etc/asciidoc/docbook-xsl/fo.xsl" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
DocBook XSL defines many attribute sets you can
|
||||||
|
use to control the output elements
|
||||||
|
-->
|
||||||
|
<xsl:attribute-set name="section.title.level1.properties">
|
||||||
|
<xsl:attribute name="color">#FF0000</xsl:attribute>
|
||||||
|
</xsl:attribute-set>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
For fine-grained changes, you will need to write
|
||||||
|
or override XSLT templates just like I did it below
|
||||||
|
for 'summary' simpara (paragraphs)
|
||||||
|
-->
|
||||||
|
<xsl:template match="simpara[@role='summary']">
|
||||||
|
<!-- Capture inherited result -->
|
||||||
|
<xsl:variable name="baseresult">
|
||||||
|
<xsl:apply-imports/>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<!-- Customize the result -->
|
||||||
|
<xsl:for-each select="exsl:node-set($baseresult)/node()">
|
||||||
|
<xsl:copy>
|
||||||
|
<xsl:copy-of select="@*"/>
|
||||||
|
<xsl:attribute name="font-style">italic</xsl:attribute>
|
||||||
|
<xsl:copy-of select="node()"/>
|
||||||
|
</xsl:copy>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, you have to request `a2x` to use that custom XSL stylesheet to produce the output rather than the default one using the `--xsl-file` option:
|
||||||
|
```
|
||||||
|
a2x -v --format pdf \
|
||||||
|
--fop \
|
||||||
|
--xsl-file=./custom.xsl \
|
||||||
|
asciidoc.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
![AsciiDoc PDF output generated from Apache FOP using a custom XSLT to display the first paragraph in italics and section headings in color][37]
|
||||||
|
|
||||||
|
With a little bit of familiarity with XSLT, the hints given here and some queries on your favorite search engine, I think you should be able to start customizing the XSL-FO output.
|
||||||
|
|
||||||
|
But I will not lie, some apparently simple changes in the document output may require you to spend quite some times searching through the DocBook XML and XSL-FO manuals, examining the stylesheets sources and performing a couple of tests before you finally achieve what you want.
|
||||||
|
|
||||||
|
### My opinion
|
||||||
|
|
||||||
|
Writing documents using a text format has tremendous advantages. And if you need to publish to HTML, there is not much reason for not using AsciiDoc. The syntax is clean and neat, processing is simple and changing the presentation if needed, mostly require easy to acquire CSS skills.
|
||||||
|
|
||||||
|
And even if you don't use the HTML output directly, HTML can be used as an interchange format with many WYSIWYG applications today. As an example, this is was I've done here: I copied the HTML output of this article into the WordPress edition area, thus conserving all formatting, without having to type anything directly into WordPress.
|
||||||
|
|
||||||
|
If you need to publish to PDF-- the advantages remain the same for the writer. Things will be certainly harsher if you need to change the default layout in depth though. In a corporate environment, that probably means hiring a document designed skilled with XSLT to produce the set of stylesheets that will suit your branding or technical requirements-- or for someone in the team to acquire those skills. But once done it will be a pleasure to write text with AsciiDoc. And seeing those writings being automatically converted to beautiful HTML pages or PDF documents!
|
||||||
|
|
||||||
|
Finally, if you find AsciiDoc either too simplistic or too complex, you may take a look at some other file formats with similar goals: [Markdown][38], [Textile][39], [reStructuredText][40] or [AsciiDoctor][41] to name few. Even if based on concepts dating back to the early days of computing, the human-readable text format ecosystem is pretty rich. Probably richer it was only 20 years ago. As a proof, many modern [static web site generators][42] are based on them. Unfortunately, this is out of the scope for this article. So, let us know if you want to hear more about that!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/asciidoc-guide/
|
||||||
|
|
||||||
|
作者:[Sylvain Leroux][a]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://itsfoss.com/author/sylvain/
|
||||||
|
[1]:https://www.computerhope.com/jargon/w/wordssor.htm
|
||||||
|
[2]:https://en.wikipedia.org/wiki/WYSIWYG
|
||||||
|
[3]:https://en.wikipedia.org/wiki/Troff
|
||||||
|
[4]:https://en.wikipedia.org/wiki/HTML
|
||||||
|
[5]:https://en.wikipedia.org/wiki/Rich_Text_Format
|
||||||
|
[6]:https://en.wikipedia.org/wiki/TeX
|
||||||
|
[7]:https://en.wikipedia.org/wiki/LaTeX
|
||||||
|
[8]:https://en.wikipedia.org/wiki/XML
|
||||||
|
[9]:https://en.wikipedia.org/wiki/AsciiDoc
|
||||||
|
[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09//epistole-manual-command-example-version-soft-luc-barthelet-1985.png
|
||||||
|
[12]:https://wiki.openoffice.org/wiki/Documentation/OOo3_User_Guides/Getting_Started/Templates_and_Styles
|
||||||
|
[13]:https://en.wikipedia.org/wiki/Git
|
||||||
|
[14]:https://en.wikipedia.org/wiki/Apache_Subversion
|
||||||
|
[15]:https://en.wikipedia.org/wiki/Sed
|
||||||
|
[16]:https://en.wikipedia.org/wiki/AWK
|
||||||
|
[17]:https://en.wikipedia.org/wiki/Perl
|
||||||
|
[18]:https://github.com/itsfoss/asciidoc-intro/tree/master/coffee
|
||||||
|
[19]:https://en.wikipedia.org/wiki/TYPSET_and_RUNOFF
|
||||||
|
[20]:https://en.wikipedia.org/wiki/Man_page
|
||||||
|
[21]:https://en.wikipedia.org/wiki/Text_editor
|
||||||
|
[22]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09//troff-latex-html-asciidoc-compare-source-code.png
|
||||||
|
[23]:https://en.wikipedia.org/wiki/Formatting_Objects_Processor
|
||||||
|
[24]:http://www.methods.co.nz/asciidoc/INSTALL.html
|
||||||
|
[25]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/asciidoc-tutorial-linux.jpg
|
||||||
|
[26]:https://raw.githubusercontent.com/itsfoss/asciidoc-intro/master
|
||||||
|
[27]:https://en.wikipedia.org/wiki/DocBook
|
||||||
|
[28]:https://en.wikipedia.org/wiki/XSLT
|
||||||
|
[29]:https://en.wikipedia.org/wiki/XSL_Formatting_Objects
|
||||||
|
[30]:http://www.methods.co.nz/asciidoc/userguide.html#_pdf_generation
|
||||||
|
[31]:http://dblatex.sourceforge.net/
|
||||||
|
[32]:https://xmlgraphics.apache.org/fop/
|
||||||
|
[33]:https://en.wikipedia.org/wiki/Cascading_Style_Sheets
|
||||||
|
[34]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09//asciidoc-html-output-custom-role-italic-paragraph-color-heading.png
|
||||||
|
[35]:http://www.sagehill.net/docbookxsl/
|
||||||
|
[36]:http://dblatex.sourceforge.net/doc/manual/sec-custom.html
|
||||||
|
[37]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09//asciidoc-fop-output-custom-role-italic-paragraph-color-heading.png
|
||||||
|
[38]:https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet
|
||||||
|
[39]:https://txstyle.org/
|
||||||
|
[40]:http://docutils.sourceforge.net/docs/user/rst/quickstart.html
|
||||||
|
[41]:http://asciidoctor.org/
|
||||||
|
[42]:https://www.smashingmagazine.com/2015/11/modern-static-website-generators-next-big-thing/
|
@ -0,0 +1,52 @@
|
|||||||
|
3 ways robotics affects the CIO role
|
||||||
|
======
|
||||||
|

|
||||||
|
As 2017 comes to a close, many CIOs are solidifying their goals for 2018. Perhaps yours involve robotic process automation (RPA.) For years, RPA has been a distant concept for many companies. But as organizations are forced to become ever more nimble and efficient, the potential benefits of RPA bear examining.
|
||||||
|
|
||||||
|
According to a recent[ survey][1] by Redwood Software and Sapio Research, IT decision makers believe that 59 percent of business processes can be automated in the next five years, creating new speed and efficiency while relieving their human counterparts of repetitive manual workloads. However, 20 percent of companies with more than 1000 employees currently have no RPA strategy in place.
|
||||||
|
|
||||||
|
For CIOs, RPA has implications for your role in the business and for your team. Here are three ways that the role of the CIO and other IT decision makers can change as RPA gains prominence in 2018:
|
||||||
|
|
||||||
|
### Added opportunity to be strategic change agents
|
||||||
|
|
||||||
|
As the pressure grows to do more with less, internal processes matter greatly. In every enterprise, employees across departments are performing critical - yet mundane - tasks every single day. These tasks may be boring and repetitive, but they must be performed quickly, and often with no room for error.
|
||||||
|
|
||||||
|
**[ For advice on maximizing your automation strategy's ROI, see our related article,[How to improve ROI on automation: 4 tips][2]. ]**
|
||||||
|
|
||||||
|
From back-office operations in finance to procurement, supply chain, accounting, customer service, and human resources, nearly every position within an organization is plagued with at least some monotonous tasks. For CIOs, this opens up an opportunity to unite the business with IT and spearhead strategic change with RPA.
|
||||||
|
|
||||||
|
Having evolved far beyond screen-scraping technology of the past, robots are now customizable, plug-and-play solutions that can be built to an organization's specific needs. With such a process-centric approach, companies can automate not only tasks previously executed by humans, but also application and system-specific tasks, such as ERP and other enterprise applications.
|
||||||
|
|
||||||
|
Enabling a greater level of automation for end-to-end processes is where the value lies. CIOs will be on the front line of this opportunity.
|
||||||
|
|
||||||
|
### Renewed focus on people and training
|
||||||
|
|
||||||
|
Technology shifts can be unnerving to employees, especially when these changes involve automating substantial portions of their daily duties. The CIO should articulate how RPA will change roles and responsibilities for the better, and fuel data-driven, strategic decisions that will ultimately impact the bottom line.
|
||||||
|
|
||||||
|
When implementing RPA, it's important to convey that humans will always be critical to the success of the organization, and that success requires the right balance of technology and human skills.
|
||||||
|
|
||||||
|
CIOs should also analyze workflow and implement better processes that go beyond mimicking end-user specific tasks. Through end-to-end process automation, CIOs can enable employees to shine.
|
||||||
|
|
||||||
|
Because it will be important to upskill and retrain employees throughout the automation process, CIOs must be prepared to collaborate with the C-suite to determine training programs that help employees navigate the change with confidence.
|
||||||
|
|
||||||
|
### Demand for long-term thinking
|
||||||
|
|
||||||
|
To succeed with robotic process automation, brands must take a long-term approach. This will require a scalable solution, which in turn will benefit the entire business model, including customers. When Amazon introduced faster delivery options for Prime customers, for example, it didn't just retool the entire order fulfillment process in its warehouses; it automated its online customer experience to make it simpler, faster, and easier than ever for consumers to place orders.
|
||||||
|
|
||||||
|
In the coming year, CIOs can approach technology in the same way, architecting holistic solutions to change the way an organization operates. Reducing headcount will net only so much in bottom-line results, but process automation allows CIOs to think bigger through optimization and empowerment. This approach gives CIOs the opportunity to build credibility for the long haul, for themselves and for RPA. This in turn will enhance the CIO's role as a navigator and contributor to the organization's overall success.
|
||||||
|
|
||||||
|
For CIOs, taking a long-term, strategic approach to RPA success takes time and hard work. Nevertheless, CIOs who commit the time to create a strategy that balances manpower and technology will deliver value now and in the future.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://enterprisersproject.com/article/2017/11/3-ways-robotics-affects-cio-role
|
||||||
|
|
||||||
|
作者:[Dennis Walsh][a]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://enterprisersproject.com/user/dennis-walsh
|
||||||
|
[1]:https://www.redwood.com/press-releases/it-decision-makers-speak-59-of-business-processes-could-be-automated-by-2022/
|
||||||
|
[2]:https://enterprisersproject.com/article/2017/11/how-improve-roi-automation-4-tips?sc_cid=70160000000h0aXAAQ
|
@ -0,0 +1,52 @@
|
|||||||
|
translating---geekpi
|
||||||
|
|
||||||
|
Autorandr: automatically adjust screen layout
|
||||||
|
======
|
||||||
|
Like many laptop users, I often plug my laptop into different monitor setups (multiple monitors at my desk, projector when presenting, etc.) Running xrandr commands or clicking through interfaces gets tedious, and writing scripts isn't much better.
|
||||||
|
|
||||||
|
Recently, I ran across [autorandr][1], which detects attached monitors using EDID (and other settings), saves xrandr configurations, and restores them. It can also run arbitrary scripts when a particular configuration is loaded. I've packed it, and it is currently waiting in NEW. If you can't wait, the [deb is here][2] and the [git repo is here][3].
|
||||||
|
|
||||||
|
To use it, simply install the package, and create your initial configuration (in my case, undocked):
|
||||||
|
```
|
||||||
|
autorandr --save undocked
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
then, dock your laptop (or plug in your external monitor(s)), change the configuration using xrandr (or whatever you use), and save your new configuration (in my case, workstation):
|
||||||
|
```
|
||||||
|
autorandr --save workstation
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
repeat for any additional configurations you have (or as you find new configurations).
|
||||||
|
|
||||||
|
Autorandr has `udev`, `systemd`, and `pm-utils` hooks, and `autorandr --change` should be run any time that new displays appear. You can also run `autorandr --change` or `autorandr --load workstation` manually too if you need to. You can also add your own `~/.config/autorandr/$PROFILE/postswitch` script to run after a configuration is loaded. Since I run i3, my workstation configuration looks like this:
|
||||||
|
```
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
xrandr --dpi 92
|
||||||
|
xrandr --output DP2-2 --primary
|
||||||
|
i3-msg '[workspace="^(1|4|6)"] move workspace to output DP2-2;'
|
||||||
|
i3-msg '[workspace="^(2|5|9)"] move workspace to output DP2-3;'
|
||||||
|
i3-msg '[workspace="^(3|8)"] move workspace to output DP2-1;'
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
which fixes the dpi appropriately, sets the primary screen (possibly not needed?), and moves the i3 workspaces about. You can also arrange for configurations to never be run by adding a `block` hook in the profile directory.
|
||||||
|
|
||||||
|
Check it out if you change your monitor configuration regularly!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.donarmstrong.com/posts/autorandr/
|
||||||
|
|
||||||
|
作者:[Don Armstrong][a]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://www.donarmstrong.com
|
||||||
|
[1]:https://github.com/phillipberndt/autorandr
|
||||||
|
[2]:https://www.donarmstrong.com/autorandr_1.2-1_all.deb
|
||||||
|
[3]:https://git.donarmstrong.com/deb_pkgs/autorandr.git
|
@ -0,0 +1,237 @@
|
|||||||
|
How To Protect Server Against Brute Force Attacks With Fail2ban On Linux
|
||||||
|
======
|
||||||
|
One of the important task for Linux administrator is to protect server against illegitimate attack or access. By default Linux system comes with well-configured firewall such as Iptables, Uncomplicated Firewall (UFW), ConfigServer Security Firewall (CSF), etc, which will prevent many kinds of attacks.
|
||||||
|
|
||||||
|
Any machine which is connected to the internet is a potential target for malicious attacks. There is a tool called fail2ban is available to mitigate illegitimate access on server.
|
||||||
|
|
||||||
|
### What Is Fail2ban?
|
||||||
|
|
||||||
|
[Fail2ban][1] is an intrusion prevention software, framework which protect server against brute force attacks. It's Written in Python programming language. Fail2ban work based on auth log files, by default it will scan the auth log files such as `/var/log/auth.log`, `/var/log/apache/access.log`, etc.. and bans IPs that show the malicious signs, too many password failures, seeking for exploits, etc.
|
||||||
|
|
||||||
|
Generally fail2Ban is used to update firewall rules to reject the IP addresses for a specified amount of time. Also it will send mail notification too. Fail2Ban comes with many filters for various services such as ssh, apache, nginx, squid, named, mysql, nagios, etc,.
|
||||||
|
|
||||||
|
Fail2Ban is able to reduce the rate of incorrect authentications attempts however it cannot eliminate the risk that weak authentication presents. this is one of the security for server which will prevent brute force attacks.
|
||||||
|
|
||||||
|
### How to Install Fail2ban In Linux
|
||||||
|
|
||||||
|
Fail2ban is already packaged with most of the Linux distribution so, just use you distribution package manager to install it.
|
||||||
|
|
||||||
|
For **`Debian/Ubuntu`** , use [APT-GET Command][2] or [APT Command][3] to install tilda.
|
||||||
|
```
|
||||||
|
$ sudo apt install fail2ban
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
For **`Fedora`** , use [DNF Command][4] to install tilda.
|
||||||
|
```
|
||||||
|
$ sudo dnf install fail2ban
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
For **`CentOS/RHEL`** systems, enable [EPEL Repository][5] or [RPMForge Repository][6] and use [YUM Command][7] to install Terminator.
|
||||||
|
```
|
||||||
|
$ sudo yum install fail2ban
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
For **`Arch Linux`** , use [Pacman Command][8] to install tilda.
|
||||||
|
```
|
||||||
|
$ sudo pacman -S fail2ban
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
For **`openSUSE`** , use [Zypper Command][9] to install tilda.
|
||||||
|
```
|
||||||
|
$ sudo zypper in fail2ban
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### How To Configure Fail2ban
|
||||||
|
|
||||||
|
By default Fail2ban keeps all the configuration files in `/etc/fail2ban/` directory. The main configuration file is `jail.conf`, it contains a set of pre-defined filters. So, don't edit the file and it's not advisable because whenever new update comes the configuration get reset to default.
|
||||||
|
|
||||||
|
Just create a new configuration file called `jail.local` in the same directory and modify as per your wish.
|
||||||
|
```
|
||||||
|
# cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
By default most of the option was configured perfectly and if you want to enable access to any particular IP then you can add the IP address into `ignoreip` area, for more then one IP give a speace between the IP address.
|
||||||
|
|
||||||
|
The `DEFAULT` section contains the basic set of rules that Fail2Ban follow and you can adjust any parameter as per your wish.
|
||||||
|
```
|
||||||
|
# nano /etc/fail2ban/jail.local
|
||||||
|
|
||||||
|
[DEFAULT]
|
||||||
|
ignoreip = 127.0.0.1/8 192.168.1.100/24
|
||||||
|
bantime = 600
|
||||||
|
findtime = 600
|
||||||
|
maxretry = 3
|
||||||
|
destemail = 2daygeek@gmail.com
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
* **ignoreip :** This section allow us to whitelist the list of IP address and Fail2ban will not ban a host which matches an address in this list
|
||||||
|
* **bantime :** The number of seconds that a host is banned
|
||||||
|
* **findtime :** A host is banned if it has generated "maxretry" during the last "findtime" seconds
|
||||||
|
* **maxretry :** "maxretry" is the number of failures before a host get banned.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### How To Configure Service
|
||||||
|
|
||||||
|
Fail2ban comes with set of pre-defined filters for various servicess such as ssh, apache, nginx, squid, named, mysql, nagios, etc,. We don't want to make any changes on configuration file and just add following line `enabled = true` in the service area to enable jail to any services. To disable make the line to `false` instead of ture.
|
||||||
|
```
|
||||||
|
# SSH servers
|
||||||
|
[sshd]
|
||||||
|
enabled = true
|
||||||
|
port = ssh
|
||||||
|
logpath = %(sshd_log)s
|
||||||
|
backend = %(sshd_backend)s
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
* **enabled :** Determines whether the service is turned on or off.
|
||||||
|
* **port :** It's refering to the particular service. If using the default port, then the service name can be placed here. If using a non-traditional port, this should be the port number.
|
||||||
|
* **logpath :** Gives the location of the service's logs./li>
|
||||||
|
* **backend :** "backend" specifies the backend used to get files modification.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Restart Fail2Ban
|
||||||
|
|
||||||
|
After making changes restart Fail2Ban to take effect.
|
||||||
|
```
|
||||||
|
[For SysVinit Systems]
|
||||||
|
# service fail2ban restart
|
||||||
|
|
||||||
|
[For systemd Systems]
|
||||||
|
# systemctl restart fail2ban.service
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Verify Fail2Ban iptables rules
|
||||||
|
|
||||||
|
You can confirm whether Fail2Ban iptables rules are added into firewall using below command.
|
||||||
|
```
|
||||||
|
# iptables -L
|
||||||
|
Chain INPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
f2b-apache-auth tcp -- anywhere anywhere multiport dports http,https
|
||||||
|
f2b-sshd tcp -- anywhere anywhere multiport dports 1234
|
||||||
|
ACCEPT tcp -- anywhere anywhere tcp dpt:1234
|
||||||
|
|
||||||
|
Chain FORWARD (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain OUTPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain f2b-apache-auth (1 references)
|
||||||
|
target prot opt source destination
|
||||||
|
RETURN all -- anywhere anywhere
|
||||||
|
|
||||||
|
Chain f2b-sshd (1 references)
|
||||||
|
target prot opt source destination
|
||||||
|
RETURN all -- anywhere anywhere
|
||||||
|
```
|
||||||
|
|
||||||
|
### How To Test Fail2ban
|
||||||
|
|
||||||
|
I have made some failed attempts to test this. To confirm this, I'm going to verify the `/var/log/fail2ban.log` file.
|
||||||
|
```
|
||||||
|
2017-11-05 14:43:22,901 fail2ban.server [7141]: INFO Changed logging target to /var/log/fail2ban.log for Fail2ban v0.9.6
|
||||||
|
2017-11-05 14:43:22,987 fail2ban.database [7141]: INFO Connected to fail2ban persistent database '/var/lib/fail2ban/fail2ban.sqlite3'
|
||||||
|
2017-11-05 14:43:22,996 fail2ban.database [7141]: WARNING New database created. Version '2'
|
||||||
|
2017-11-05 14:43:22,998 fail2ban.jail [7141]: INFO Creating new jail 'sshd'
|
||||||
|
2017-11-05 14:43:23,002 fail2ban.jail [7141]: INFO Jail 'sshd' uses poller {}
|
||||||
|
2017-11-05 14:43:23,019 fail2ban.jail [7141]: INFO Initiated 'polling' backend
|
||||||
|
2017-11-05 14:43:23,019 fail2ban.filter [7141]: INFO Set maxRetry = 5
|
||||||
|
2017-11-05 14:43:23,020 fail2ban.filter [7141]: INFO Set jail log file encoding to UTF-8
|
||||||
|
2017-11-05 14:43:23,020 fail2ban.filter [7141]: INFO Added logfile = /var/log/auth.log
|
||||||
|
2017-11-05 14:43:23,021 fail2ban.actions [7141]: INFO Set banTime = 600
|
||||||
|
2017-11-05 14:43:23,021 fail2ban.filter [7141]: INFO Set findtime = 600
|
||||||
|
2017-11-05 14:43:23,022 fail2ban.filter [7141]: INFO Set maxlines = 10
|
||||||
|
2017-11-05 14:43:23,070 fail2ban.server [7141]: INFO Jail sshd is not a JournalFilter instance
|
||||||
|
2017-11-05 14:43:23,081 fail2ban.jail [7141]: INFO Jail 'sshd' started
|
||||||
|
2017-11-05 14:43:23,763 fail2ban.filter [7141]: INFO [sshd] Found 103.5.134.167
|
||||||
|
2017-11-05 14:43:23,763 fail2ban.filter [7141]: INFO [sshd] Found 103.5.134.167
|
||||||
|
2017-11-05 14:43:23,764 fail2ban.filter [7141]: INFO [sshd] Found 181.129.54.170
|
||||||
|
2017-11-05 14:43:23,764 fail2ban.filter [7141]: INFO [sshd] Found 181.129.54.170
|
||||||
|
2017-11-05 14:43:23,765 fail2ban.filter [7141]: INFO [sshd] Found 181.129.54.170
|
||||||
|
2017-11-05 14:43:23,765 fail2ban.filter [7141]: INFO [sshd] Found 181.129.54.170
|
||||||
|
2017-11-05 15:19:06,192 fail2ban.server [7141]: INFO Stopping all jails
|
||||||
|
2017-11-05 15:19:06,874 fail2ban.jail [7141]: INFO Jail 'sshd' stopped
|
||||||
|
2017-11-05 15:19:06,879 fail2ban.server [7141]: INFO Exiting Fail2ban
|
||||||
|
2017-11-05 15:19:07,123 fail2ban.server [8528]: INFO Changed logging target to /var/log/fail2ban.log for Fail2ban v0.9.6
|
||||||
|
2017-11-05 15:19:07,123 fail2ban.database [8528]: INFO Connected to fail2ban persistent database '/var/lib/fail2ban/fail2ban.sqlite3'
|
||||||
|
2017-11-05 15:19:07,126 fail2ban.jail [8528]: INFO Creating new jail 'sshd'
|
||||||
|
2017-11-05 15:19:07,129 fail2ban.jail [8528]: INFO Jail 'sshd' uses poller {}
|
||||||
|
2017-11-05 15:19:07,141 fail2ban.jail [8528]: INFO Initiated 'polling' backend
|
||||||
|
2017-11-05 15:19:07,142 fail2ban.actions [8528]: INFO Set banTime = 60
|
||||||
|
2017-11-05 15:19:07,142 fail2ban.filter [8528]: INFO Set findtime = 60
|
||||||
|
2017-11-05 15:19:07,142 fail2ban.filter [8528]: INFO Set jail log file encoding to UTF-8
|
||||||
|
2017-11-05 15:19:07,143 fail2ban.filter [8528]: INFO Set maxRetry = 3
|
||||||
|
2017-11-05 15:19:07,144 fail2ban.filter [8528]: INFO Added logfile = /var/log/auth.log
|
||||||
|
2017-11-05 15:19:07,144 fail2ban.filter [8528]: INFO Set maxlines = 10
|
||||||
|
2017-11-05 15:19:07,189 fail2ban.server [8528]: INFO Jail sshd is not a JournalFilter instance
|
||||||
|
2017-11-05 15:19:07,195 fail2ban.jail [8528]: INFO Jail 'sshd' started
|
||||||
|
2017-11-05 15:20:03,263 fail2ban.filter [8528]: INFO [sshd] Found 103.5.134.167
|
||||||
|
2017-11-05 15:20:05,267 fail2ban.filter [8528]: INFO [sshd] Found 103.5.134.167
|
||||||
|
2017-11-05 15:20:12,276 fail2ban.filter [8528]: INFO [sshd] Found 103.5.134.167
|
||||||
|
2017-11-05 15:20:12,380 fail2ban.actions [8528]: NOTICE [sshd] Ban 103.5.134.167
|
||||||
|
2017-11-05 15:21:12,659 fail2ban.actions [8528]: NOTICE [sshd] Unban 103.5.134.167
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
To Check list of jail enabled, run the following command.
|
||||||
|
```
|
||||||
|
# fail2ban-client status
|
||||||
|
Status
|
||||||
|
|- Number of jail: 2
|
||||||
|
`- Jail list: apache-auth, sshd
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
To get the blocked Ip address by running following command.
|
||||||
|
```
|
||||||
|
# fail2ban-client status ssh
|
||||||
|
Status for the jail: ssh
|
||||||
|
|- filter
|
||||||
|
| |- File list: /var/log/auth.log
|
||||||
|
| |- Currently failed: 1
|
||||||
|
| `- Total failed: 3
|
||||||
|
`- action
|
||||||
|
|- Currently banned: 1
|
||||||
|
| `- IP list: 192.168.1.115
|
||||||
|
`- Total banned: 1
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
To remove blocked IP address from Fail2Ban, run the following command.
|
||||||
|
```
|
||||||
|
# fail2ban-client set ssh unbanip 192.168.1.115
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.2daygeek.com/how-to-install-setup-configure-fail2ban-on-linux/#
|
||||||
|
|
||||||
|
作者:[Magesh Maruthamuthu][a]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://www.2daygeek.com/author/magesh/
|
||||||
|
[1]:https://github.com/fail2ban/fail2ban
|
||||||
|
[2]:https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
|
||||||
|
[3]:https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
|
||||||
|
[4]:https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/
|
||||||
|
[5]:https://www.2daygeek.com/install-enable-epel-repository-on-rhel-centos-scientific-linux-oracle-linux/
|
||||||
|
[6]:https://www.2daygeek.com/install-enable-repoforge-rpmforge-repository-on-rhel-centos-sl/
|
||||||
|
[7]:https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/
|
||||||
|
[8]:https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/
|
||||||
|
[9]:https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
|
||||||
|
[10]:/cdn-cgi/l/email-protection
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user