mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
commit
7dc4ee739b
@ -1,10 +1,10 @@
|
||||
初识 HTTP/2(第二部分)
|
||||
初识 HTTP/2(二)
|
||||
============================================================
|
||||
![](https://static.viget.com/_284x284_crop_center-center/ben-t-http-blog-thumb-01_360.png?mtime=20160928234634)
|
||||
|
||||
首先制定一个坚定的 HTTP/2 前端开发目标。
|
||||
> HTTP/2 时代的开启为前端开发带来了最佳体验。
|
||||
|
||||
如果你对 HTTP/2 有所了解,那你可能用过它,或者至少想过怎样能把它融入你的项目中。尽管有很多关于它如何改变工作流程,提高 Web 速度和效率等方面的猜想,但最好的使用方式还没有定下来。这里我想讲的就是我在之前的项目中所发现的 HTTP/2 的最佳实践。
|
||||
如果你对 HTTP/2 有所了解,那你可能用过它,或者至少想过怎样能把它融入你的项目中。尽管有很多关于它如何改变工作流程,提高 Web 速度和效率等方面的猜想,但最佳使用方式还没有定下来。这里我想讲的就是我在之前的项目中所发现的 HTTP/2 的最佳实践。
|
||||
|
||||
如果你还不确定什么是 HTTP/2,或者为什么它能改进你的工作,可以先看看我[介绍背景方面的第一篇文章][4]。
|
||||
|
||||
@ -12,118 +12,116 @@
|
||||
|
||||
### 🙏 [热身工作]
|
||||
|
||||
首先组织好你的文件。看一看下面的文件树结构,作为组织样式表的起点:
|
||||
首先组织好你的文件。看一看下面的文件树结构,作为组织你的样式表的起点:
|
||||
|
||||
```
|
||||
`/styles
|
||||
/styles
|
||||
|── /setup
|
||||
| /* variables, mixins and functions */
|
||||
| /* 变量、混入(minin)和函数 */
|
||||
|── /global
|
||||
| /* reusable components that could be within any component or section */
|
||||
| /* 能放在任何组件和部分中的可重用组件 */
|
||||
|── /components
|
||||
| /* specific components and sections */
|
||||
|── setup.scss // index for setup styles
|
||||
|── global.scss // index for global styles`
|
||||
| /* 特殊组件和部分 */
|
||||
|── setup.scss // setup 样式索引
|
||||
|── global.scss // 全局样式索引
|
||||
```
|
||||
|
||||
这会把你的样式分到三个目录下面:Setup,Global 和 Componenets。接下来我会说明这些目录对你的项目有什么用。
|
||||
这会把你的样式分到三个目录下面:`setup`、`global` 和 `componenets`。接下来我会说明这些目录对你的项目有什么用。
|
||||
|
||||
### Setup 目录
|
||||
### setup 目录
|
||||
|
||||
Setup 目录保存所有的变量,函数,mixins 以及其它文件正常编译需要的任意定义。要想让这个目录物尽其用,把这个目录下所有内容导入到 `setup.scss` 文件中是个很不错的主意,这样这个文件就会像下面所展示的一样:
|
||||
`setup` 目录保存所有的变量、函数、混入(minin)以及一些正常编译需要的其它文件的定义。要想让这个目录物尽其用,把这个目录下所有内容导入到 `setup.scss` 文件中是个很不错的主意,这样这个文件就会像下面所展示的一样:
|
||||
|
||||
```
|
||||
`/* setup.scss */
|
||||
/* setup.scss */
|
||||
|
||||
/* variables */
|
||||
/* 变量 */
|
||||
@import "setup/variables/colors";
|
||||
|
||||
/* mixins */
|
||||
/* 混入 */
|
||||
@import "setup/mixins/color";
|
||||
|
||||
/* functions */
|
||||
/* 函数 */
|
||||
@import "setup/functions/color";
|
||||
|
||||
... etc`
|
||||
... 等等
|
||||
```
|
||||
|
||||
现在我们能快速引用这个站点中的所有定义,应该确保在所有的样式文件顶部包含我们这里创建的这个文件。
|
||||
|
||||
### Global 目录
|
||||
### global 目录
|
||||
|
||||
接下来的目录,Global (全局)目录,应该包含可在当前站点的多个部分或者每一个页面中重复使用的组件。像按钮、文本、主要样式以及你的浏览器默认设置应该放在这里。我不建议把 <ruby>头部<rt>header</rt></ruby> 或 <ruby>底部样式<rt>footer styles</rt></ruby> 放在这儿,因为某些项目中没有头部,或者不同页面头部不同。而且,底部永远是页面的最后一个元素,所以在用户加载完当前站点的其它东西前,不必过分优先考虑加载底部样式。
|
||||
接下来的目录,global 目录,应该包含可在当前站点的多个部分或者每一个页面中重复使用的组件。像按钮、文本、主要样式,以及你的浏览器默认设置应该放在这里。我不建议把页面的头部或底部样式放在这儿,因为某些项目中没有头部,或者不同页面头部不同。而且,底部永远是页面的最后一个元素,所以在用户加载完当前站点的其它东西前,不必过分优先考虑加载底部样式。
|
||||
|
||||
记住,如果没有那些定义在 Setup 目录下的东西,你的 Global 样式就可能没有作用,你的 Global 文件看起来应该像这样:
|
||||
记住,如果没有那些定义在 setup 目录下的东西,你的 global 样式就可能没有作用,你的 global 文件看起来应该像这样:
|
||||
|
||||
```
|
||||
`/* global.scss */
|
||||
/* global.scss */
|
||||
|
||||
/* application definitions */
|
||||
/* 应用定义 */
|
||||
@import "setup";
|
||||
|
||||
/* global styles */
|
||||
/* 全局样式 */
|
||||
@import "global/reset";
|
||||
@import "global/buttons";
|
||||
@import "global/typography";
|
||||
@import "global/grid";
|
||||
|
||||
... etc`
|
||||
... 等等
|
||||
```
|
||||
|
||||
注意,首先要做的就是导入 Setup 样式。这样的话,这个样式里定义的所有文件都能够获得引用。
|
||||
注意,首先要做的就是导入 setup 样式。这样的话,之后的文件都可以引用这个样式里的定义。
|
||||
|
||||
由于 Global 样式需要存在于每个页面中,我们可以用典型的方式加载它们,在 `<head>` 标签内用一个 `<link>` 标签。你所看到的将是一个十分小巧的 css 文件,或者说理论上小巧的,这取决于你需要多少全局样式。
|
||||
由于站点内的每个页面都需要 global 样式,我们可以用典型的方式,在 `<head>` 标签内用一个 `<link>` 标签来加载它们。你所看到的将是一个十分小巧的 css 文件,或者说理论上小巧的,这取决于你需要多少全局样式。
|
||||
|
||||
### 最后,你的组件
|
||||
|
||||
注意,我没有在上述文件树中的 Components(组件)目录里包含索引文件。这是 HTTP/2 所带来的效用。直到现在,我们已经按照标准步骤构建了一个典型的站点,包含 <ruby>相当简单的结构<rt>fairly lean infrastructure</rt></ruby>,选择仅仅全局化那些最重要的样式。组件充当他们自己的索引文件。
|
||||
注意,我没有在上述目录树中的 components 目录里包含索引文件。这是 HTTP/2 所带来的效用。直到现在,我们已经按照标准步骤构建了一个典型的站点,保持相当简单的结构,仅选择全局化那些最重要的样式。组件充当它们自己的索引文件。
|
||||
|
||||
大多数开发者有独特的组织组件的方式,因此我并不想影响你的策略。但是,你所有的组件看起来应该像这样:
|
||||
|
||||
```
|
||||
`/* header.scss */
|
||||
/* header.scss */
|
||||
|
||||
/* application definitions */
|
||||
/* 应用定义 */
|
||||
@import "../setup";
|
||||
|
||||
header {
|
||||
// styles
|
||||
// 样式
|
||||
}
|
||||
|
||||
... etc`
|
||||
... 等等
|
||||
```
|
||||
|
||||
同样的,你要把 Setup 样式包含进来,确保所有东西在编译时都有定义。除了编译这些文件,以及可能要把他们放到 /assets 目录,以便很容易找到模版,对这些文件你不必 <ruby>链接 <rt>concatenate</rt></ruby>、<ruby>压缩<rt>minify</rt></ruby> 或者改变什么。
|
||||
同样的,你要把 setup 样式包含进来,确保所有东西在编译时都定义过。除了编译这些文件,以及可能要把他们放到 `/assets` 目录,以便很容易找到模版,对这些文件你不必 <ruby>拼接<rt>concatenate</rt></ruby>、<ruby>压缩<rt>minify</rt></ruby> 它们或者改变什么。
|
||||
|
||||
现在样式表已经差不多了,构建站点应该很简单。
|
||||
|
||||
|
||||
### 构建组件
|
||||
|
||||
或许对于模板语言你有自己的选择,这取决于你的项目,有可能是 Twig, Rails, Jade 或者 Handlebars。我认为考虑组件最好的方式是它是否有自己的模版文件,它该有个与名字相应的样式。这样你的项目中,模版和样式的比例就会是个不错的 1:1 的比例,而且你知道哪个文件有哪些东西,哪里有哪个文件,因为它们的命名是有规律的。
|
||||
或许对于模板语言你有自己的选择,这取决于你的项目,有可能是 Twig、Rails、Jade 或者 Handlebars。我认为考虑组件最好的方式是它是否有自己的模版文件,它该有个与名字相应的样式。这样你的项目中,模版和样式的比例就会是个不错的 1:1 的比例,而且你知道哪个文件有哪些东西,哪里有哪个文件,因为它们的命名是有规律的。
|
||||
|
||||
现在它正步入正轨,用好 HTTP/2 的多种功能十分简单,让我们做一个模版:
|
||||
|
||||
```
|
||||
`{# header.html #}
|
||||
{# header.html #}
|
||||
|
||||
{# compiled header styles #}
|
||||
<link href="assets/components/header.css" rel="stylesheet" media="all">
|
||||
|
||||
<header>
|
||||
<h1>This Awesome HTTP/2 Site</h1>
|
||||
... etc`
|
||||
... 等等
|
||||
```
|
||||
|
||||
非常好!在模版里你可能有更简单的方式链接资源,但这里显示你所要做的仅是在开始构建时,在模版文件中链接一个小小的头部样式。这将允许你的站点仅仅加载特定资源到任意给定页面的组件中,而且,能够设定页面从头到脚的组件的优先级。
|
||||
|
||||
非常好!在模版里你可能有更简单的方式链接到资源,但这里显示你所要做的仅是在开始构建时,在模版文件中链接一个小小的头部样式。这将允许你的站点仅仅加载特定资源到任意给定页面的组件中,而且,能够设定页面从头到脚的组件的优先级。
|
||||
|
||||
### 结合在一起
|
||||
|
||||
现在所有的组件都有结构,浏览器将会类似以下来渲染它们:
|
||||
现在所有的组件都有结构,浏览器将会类似以下方式来渲染它们:
|
||||
|
||||
```
|
||||
`<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" media="all" href="/assets/global.css">
|
||||
@ -156,11 +154,10 @@ header {
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>`
|
||||
</html>
|
||||
```
|
||||
|
||||
这是一个高级别方法,但你的项目中可能有调整的<ruby>更细致的<rt>finer-tuned</rt></ruby>组件。例如,在头部的 `<nav>` 组件可能要加载自己的样式表。尽你所能地自由发挥,让组件更有作用 - HTTP/2 不会因这些需求而阻碍你!
|
||||
|
||||
这是一个高级别方法,但你的项目中可能有调整的更细致的组件。例如,在头部的 `<nav>` 组件可能要加载自己的样式表。尽你所能地自由发挥,让组件更有作用 - HTTP/2 不会因这些需求而阻碍你!
|
||||
|
||||
### 结论
|
||||
|
||||
@ -180,5 +177,5 @@ via: https://www.viget.com/articles/getting-started-with-http-2-part-2
|
||||
[1]:https://twitter.com/home?status=Firmly%20planting%20a%20flag%20in%20the%20sand%20for%20HTTP%2F2%20best%20practices%20for%20front%20end%20development.%20https%3A%2F%2Fwww.viget.com%2Farticles%2Fgetting-started-with-http-2-part-2
|
||||
[2]:https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwww.viget.com%2Farticles%2Fgetting-started-with-http-2-part-2
|
||||
[3]:http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.viget.com%2Farticles%2Fgetting-started-with-http-2-part-2
|
||||
[4]:https://www.viget.com/articles/getting-started-with-http-2-part-1
|
||||
[4]:https://linux.cn/article-8111-1.html
|
||||
[5]:https://github.com/http2/http2-spec/wiki/Tools
|
@ -1,33 +1,34 @@
|
||||
5个找出“二进制命令”描述和系统中位置的方法
|
||||
5 个找出“二进制命令”描述和系统中位置的方法
|
||||
============================================================
|
||||
|
||||
在数千个[ Linux 系统可用的命令/程序][1]中,知道给定命令的类型和目的以及其在系统上的位置(绝对路径)对于新手来说可能是一个挑战。
|
||||
在数千个 [Linux 系统上的命令/程序][1]中,知道给定命令的类型和目的以及其在系统上的位置(绝对路径)对于新手来说可能是一个挑战。
|
||||
|
||||
知道命令/程序的一些细节不仅有助于[ Linux 用户掌握大量命令][2],还能使用户理解命令行或脚本在系统上的操作。
|
||||
知道命令/程序的一些细节不仅有助于 [Linux 用户掌握大量命令][2],还能使用户理解命令行或脚本在系统上的操作。
|
||||
|
||||
因此,在本文中我们将向你解释五个有用的命令,用于显示给定命令的简短描述和位置。
|
||||
|
||||
要在系统上发现新命令,请查看 PATH 环境变量中的所有目录。这些目录存储系统上安装的所有命令/程序。
|
||||
|
||||
一旦你找到一个有趣的命令名,在继续阅读更多关于它的手册页之前,请尝试如下收集一些简要的信息。
|
||||
一旦你找到一个有趣的命令,在继续阅读更多关于它的手册页之前,请尝试如下收集一些简要的信息。
|
||||
|
||||
假设你输出了 PATH 的值,并进到目录 /usr/local/bin,注意到一个名为[ fswatch(监视文件修改更改)][3]的新命令:
|
||||
假设你输出了 `PATH` 的值,然后进到其中的一个目录 `/usr/local/bin`,注意到一个名为 [`fswatch`(监视文件修改更改)][3]的新命令:
|
||||
|
||||
```
|
||||
$ echo $PATH
|
||||
$ cd /usr/local/bin
|
||||
```
|
||||
|
||||
[
|
||||
![Find New Commands in Linux](http://www.tecmint.com/wp-content/uploads/2017/01/Find-New-Commands-in-Linux.png)
|
||||
][4]
|
||||
|
||||
*在 Linux 中找出新命令*
|
||||
|
||||
现在让我们在 Linux 中用不同的方法找出 fswatch 命令的描述和位置。
|
||||
现在让我们在 Linux 中用不同的方法找出 `fswatch` 命令的描述和位置。
|
||||
|
||||
### 1\. whatis 命令
|
||||
### 1、 whatis 命令
|
||||
|
||||
whatis 用于显示你作为参数输入的命令名的单行描述(例如下面命令中的fswatch)。
|
||||
`whatis` 用于显示你作为参数输入的命令名的单行描述(例如下面命令中的 `fswatch`)。
|
||||
|
||||
如果描述太长,一些部分在默认情况下会被省略,使用 `-l` 标志来显示完整的描述。
|
||||
|
||||
@ -41,9 +42,9 @@ $ whatis -l fswatch
|
||||
|
||||
*Linux whatis 命令示例*
|
||||
|
||||
### 2\. apropos 命令
|
||||
### 2、 apropos 命令
|
||||
|
||||
**apropos** 会搜索手册页名称和关键字描述(命令名作为正则)。
|
||||
`apropos` 会搜索手册页名称和关键字描述(以命令名作为正则表达式搜索)。
|
||||
|
||||
使用 `-l` 标志来显示完整的描述。
|
||||
|
||||
@ -51,13 +52,14 @@ $ whatis -l fswatch
|
||||
$ apropos fswatch
|
||||
$ apropos -l fswatch
|
||||
```
|
||||
|
||||
[
|
||||
![Linux apropos Command Example](http://www.tecmint.com/wp-content/uploads/2017/01/Linux-apropos-Command-Example.png)
|
||||
][6]
|
||||
|
||||
*Linux apropos 命令示例*
|
||||
|
||||
默认上,apropos 会如示例那样输出所有匹配的行。你可以使用 `-e` 选项来精确匹配:
|
||||
默认上,`apropos` 会如示例那样输出所有匹配的行。你可以使用 `-e` 选项来精确匹配:
|
||||
|
||||
```
|
||||
$ apropos fmt
|
||||
@ -69,54 +71,57 @@ $ apropos -e fmt
|
||||
|
||||
*Linux apropos 命令根据关键词显示*
|
||||
|
||||
### 3\. type 命令
|
||||
### 3、 type 命令
|
||||
|
||||
**type** 命令会输出给定命令的完整路径名,此外,如果输入的命令名不是做为独立磁盘文件存在的程序,type 还会告诉你命令分类:
|
||||
`type` 命令会输出给定命令的完整路径名,此外,如果输入的命令名不是做为独立存储在磁盘的文件的程序,`type` 还会告诉你命令分类:
|
||||
|
||||
- shell 内置命令 或
|
||||
- shell 关键字或保留字 或
|
||||
- 别名
|
||||
- shell 内置命令
|
||||
- shell 关键字或保留字
|
||||
- 别名
|
||||
|
||||
```
|
||||
$ type fswatch
|
||||
```
|
||||
|
||||
[
|
||||
![Linux type Command Example](http://www.tecmint.com/wp-content/uploads/2017/01/Linux-type-Command-Example.png)
|
||||
][8]
|
||||
|
||||
*Linux type 命令示例*
|
||||
|
||||
当命令是另外一个命令的别名时,**type** 会显示运行别名时执行的命令。使用 **alias** 命令查看你系统上创建的所有别名:
|
||||
当命令是另外一个命令的别名时,`type` 会显示运行别名时所执行的命令。使用 `alias` 命令可以查看你系统上创建的所有别名:
|
||||
|
||||
```
|
||||
$ alias
|
||||
$ type l
|
||||
$ type ll
|
||||
```
|
||||
|
||||
[
|
||||
![Show All Aliases in Linux](http://www.tecmint.com/wp-content/uploads/2017/01/Show-All-Aliases-in-Linux.png)
|
||||
][9]
|
||||
|
||||
*显示 Linux 中所有别名*
|
||||
|
||||
### 4\. which 命令
|
||||
### 4、 which 命令
|
||||
|
||||
**which** 帮助命令定位,它打印出命令的绝对路径:
|
||||
`which` 可以帮助命令定位命令,它会打印出命令的绝对路径:
|
||||
|
||||
```
|
||||
$ which fswatch
|
||||
```
|
||||
|
||||
[
|
||||
![Find Linux Command Location](http://www.tecmint.com/wp-content/uploads/2017/01/Find-Linux-Command-Location.png)
|
||||
][10]
|
||||
|
||||
*找出 Linux 命令位置*
|
||||
|
||||
一些二进制文件存在于 PATH 中的多个目录,使用 `-a` 标志来找出所有匹配的路径名。
|
||||
一些二进制文件存在于 `PATH` 环境变量中的多个目录,使用 `-a` 标志来找出所有匹配的路径名。
|
||||
|
||||
### 5\. whereis 命令
|
||||
### 5、 whereis 命令
|
||||
|
||||
**whereis** 定位指定命令名的二进制、源和帮助页文件,如下所示:
|
||||
`whereis` 定位指定命令名的二进制、源和帮助页文件,如下所示:
|
||||
|
||||
```
|
||||
$ whereis fswatch
|
||||
@ -148,7 +153,7 @@ Aaron Kili 是 Linux 和 F.O.S.S 爱好者,将来的 Linux SysAdmin、web 开
|
||||
--------------------------------------------------------------------------------
|
||||
via: http://www.tecmint.com/find-linux-command-description-and-location/
|
||||
|
||||
作者:[Aaron Kili ][a]
|
||||
作者:[Aaron Kili][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[jasminepeng](https://github.com/jasminepeng)
|
||||
|
@ -1,3 +1,5 @@
|
||||
# rusking translating
|
||||
|
||||
What engineers and marketers can learn from each other
|
||||
============================================================
|
||||
|
||||
|
@ -0,0 +1,89 @@
|
||||
Tips for non-native English speakers working on open source projects
|
||||
============================================================
|
||||
![Tips for non-native English speakers working on open source projects](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/world_hands_diversity.png?itok=LMT5xbxJ "Tips for non-native English speakers working on open source projects")
|
||||
Image by :
|
||||
|
||||
opensource.com
|
||||
|
||||
The primary language of most open source projects is English, but open source users and contributors span the globe. Non-native speakers face many communication and cultural challenges when participating in the ecosystem.
|
||||
|
||||
In this article, we will share challenges, how to overcome them, and best practices for easing onboarding of non-native speakers, as non-native English speakers and contributors to OpenStack. We are based in Japan, Brazil, and China, and work daily with the huge OpenStack community that is spread around the world.
|
||||
|
||||
The official language of OpenStack is English, which means we communicate daily as non-native speakers.
|
||||
|
||||
### Challenges
|
||||
|
||||
Non-native English speakers face specific communication challenges when starting out in open source communities: they are related to limited language skills and cultural disparity.
|
||||
|
||||
### Language skills
|
||||
|
||||
Let's focus on the specific language skills behind reading, writing, listening, and speaking.
|
||||
|
||||
Reading: This is the easiest but also the most important skill. It is the easiest because if you can't understand what is written you have the opportunity to read it again, or as many times as needed. If you encounter an uncommon phrase, expression, or abbreviation, you can use a dictionary or translator. On the other hand, it is the most important skill because for most open source projects the main means of communication are mailing lists and IRC.
|
||||
|
||||
Writing: English grammar is an issue especially for languages that structure sentences differently. This may pose a problem for communication in writing emails and communicating via IRC channels. For some, writing long and beautiful sentences is difficult, and the reliance on simpler sentences is prevalent because these are easy to write and convey understanding.
|
||||
|
||||
Listening: This is more problematic than reading and writing for non-native speakers. Normally, conversation between native English speakers is very fast, which makes following the discussions for those still learning difficult and limits their participation in those discussions. Furthermore, trying to understand the variety of accents in a globally spread community adds to the complexity. Interestingly, American pronunciation is often easier to understand than others.
|
||||
|
||||
Speaking: Speaking is more difficult than listening because the participant's vocabulary may a bit limited. Furthermore, English's phonemes and grammar are often very different from a non-native speaker's mother language, making an interaction even more difficult to understand.
|
||||
|
||||
### Cultural differences
|
||||
|
||||
Each culture has different norms when interacting with other people in the open source community. For example, the Japanese tend not to say yes or no clearly as a way to respect others and to avoid fighting each other. This is often very different from other cultures and may cause misunderstanding of what was expressed.
|
||||
|
||||
In Chinese culture, people prefer to just say yes, instead of saying no or trying to negotiate. In a globally distributed community as OpenStack, this often leads to the lack of confidence when expressing opinions. Furthermore, Chinese people like to list the facts first and give the thesis at the end, and this can cause confusion for people from other cultures because it is not what they expect.
|
||||
|
||||
A Brazilian, for instance, may find that discussions are driven in a similar way; however, some cultures are very short and direct in responses, which may sound a bit rude.
|
||||
|
||||
### Overcoming obstacles
|
||||
|
||||
Challenges related to language skills are easier to overcome than cultural ones. Cultural differences need to be respected, while English skills can always be improved.
|
||||
|
||||
In order to brush up on your language skills, be in contact with the language as much as you can. Do not think about your limitations. Just do your best and you will improve eventually.
|
||||
|
||||
Read as much as you can, because this will help you gather vocabulary. Communicating through chat and mailing lists daily helps, too. Some tools, such as real-time dictionaries and translators, are very useful with these platforms.
|
||||
|
||||
Talking to others or yourself helps you become comfortable speaking out more frequently. Having one-on-one conversations to express your ideas is easier than discussing in larger groups.
|
||||
|
||||
### Onboarding newcomers
|
||||
|
||||
A few initiatives from both newcomers and native speakers may positively affect the onboarding process.
|
||||
|
||||
### Newcomers
|
||||
|
||||
Speak and write your opinion, and ask your questions; this participation is always a good opportunity to exercise your English. Do not be afraid.
|
||||
|
||||
For meetings, make sure you prepare yourself in advance so you will be comfortable with the subject and more confident about the opinions you are expressing.
|
||||
|
||||
Make friends who are English speakers and talk more to practice your English skills.
|
||||
|
||||
Writing blogs and technical articles in English are also great ideas.
|
||||
|
||||
### Tips for native English speakers
|
||||
|
||||
Please speak slowly and use simple words and sentences. Don't make fun of non-native English speakers if you find something wrong about the English they used. Try to encourage newcomers to express their opinions, and make them comfortable enough to do so.
|
||||
|
||||
_This article was co-written by Masayuki Igawa, Dong Ma, and Samuel de Medeiros Queiroz. Learn more in their talk at linux.conf.au 2017 ([#lca2017][1]) in Hobart: [Non-native English speakers in Open Source communities: A True Story.][2]_
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/profile_pictures/public/pictures/myface_s.jpg?itok=-dy9_LQd)
|
||||
|
||||
Masayuki Igawa - Masayuki Igawa is a software engineer for over 15 years on a wide range of software projects, and developing open source software related to Linux kernel and virtualization. He's been an active technical contributor to OpenStack since 2013. He is a core member of some OpenStack QA projects such as Tempest, subunit2sql, openstack-health and stackviz. He currently works for HPE's Upstream OpenStack team to make OpenStack better for everyone. He has previously been a speaker at OpenStack Summits,
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
via: https://opensource.com/article/17/1/non-native-speakers-take-open-source-communities
|
||||
|
||||
作者:[Masayuki Igawa][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/masayukig
|
||||
[1]:https://twitter.com/search?q=%23lca2017&src=typd
|
||||
[2]:https://linux.conf.au/schedule/presentation/70/
|
@ -0,0 +1,409 @@
|
||||
Installing, Obtaining, and Making GTK Themes
|
||||
----------------
|
||||
|
||||
Many Linux desktops supporting themes. A theme is a particular appearance or "****" for the GUI. Users can change the theme to make the desktop look different. Usually, users also change the icons. However, the theme and icon-pack are two separate entities. Numerous people want to make their own theme, so here is an article about making GTK themes as well as various essential information.
|
||||
|
||||
**NOTE:** This article primarily focuses on GTK3, but it will discuss a little about GTK2, Metacity, and others. Cursors and icons will not be discussed in this article.
|
||||
|
||||
**Basic Concepts**
|
||||
The GIMP ToolKit (GTK) is a widget-toolkit used to create GUIs on a variety of systems (thus making GTK cross-platform). GTK ([http://www.gtk.org/][17]) is commonly and incorrectly thought to stand for "GNOME ToolKit", but is actually stands for "GIMP ToolKit" because it was first created to design an user interface for GIMP. GTK is an object-oriented toolkit written in C (GTK itself is not a language). GTK is entirely open-source under the LGPL license. GTK is a widely used toolkit for GUIs and many tools are available for GTK.
|
||||
|
||||
Themes made for GTK will not work in Qt-based applications. A Qt-theme is needed to apply a theme to Qt applications.
|
||||
|
||||
The themes use Cascading Style-Sheets (CSS) to generate the theme's appearance. This is the same CSS that web-developers use on web-pages. However, instead of HTML tags being referenced, GTK widgets are specified. It is important that theme developers learn CSS.
|
||||
|
||||
**Theme Location**
|
||||
Themes may be stored in "~/.themes" or "/usr/share/themes". Themes that are in "~/.themes" are only accessible to the owner of that home folder. While themes in "/usr/share/themes" are global-themes that are accessible by all users. When a GTK application executes, it has a list of possible theme files that it checks in a specific order. If the theme file is not found, then it will try the next file on the list. Below is the list in the order that GTK3 applications try to use.
|
||||
$XDG_CONFIG_HOME/gtk-3.0/gtk.css (typically ~/.config/gtk-3.0/gtk.css)
|
||||
~/.themes/NAME/gtk-3.0/gtk.css
|
||||
$datadir/share/themes/NAME/gtk-3.0/gtk.css (typically /usr/share/themes/name/gtk-3.0/gtk.css)
|
||||
|
||||
**NOTE:** "NAME" is a placeholder for the name of the current theme.
|
||||
|
||||
If there are two themes with the same name, then the one in the user's home folder (~/.themes) will be used. Developers can take advantage of GTK's theme-seeking algorithm by testing new themes in their local home's theme directory.
|
||||
|
||||
**Theme Engines**
|
||||
A "Theme engine" is a piece of software that changes the look of the GUI's widgets. The engine reads and uses the theme's files to know how the various widgets should be drawn. Some engines come with themes of their own. Each engine has its advantages and disadvantages, and some engines add special properties and features.
|
||||
|
||||
Many theme-engines can be obtained from the default repositories. Debian-based Linux distros can execute "apt-get install gtk2-engines-murrine gtk2-engines-pixbuf gtk3-engines-unico" to install three different engines. Many engines are available for both GTK2 and GTK3\. Below is a small list of examples.
|
||||
|
||||
* gtk2-engines-aurora - Aurora GTK2 engine
|
||||
* gtk2-engines-pixbuf - Pixbuf GTK2 engine
|
||||
* gtk3-engines-oxygen - Engine port of the Oxygen widget style to GTK
|
||||
* gtk3-engines-unico - Unico GTK3 engine
|
||||
* gtk3-engines-xfce - GTK3 engine for Xfce
|
||||
|
||||
**Creating GTK3 Themes**
|
||||
To create a GTK3 theme, developers can start with an empty file or they can use a pre-existing theme as a template. It may help beginners to start with a pre-existing theme. For instance, a theme can be copied to the user's home folder and then the developer can start editing the files.
|
||||
|
||||
The general format for a GTK3 theme is to create a folder named after the theme. Then, create a sub-directory called "gtk-3.0" and create a file inside of it named "gtk.css". In the "gtk.css" file, use CSS code to control how the theme will look. Move the theme to ~/.themes for testing purposes. Use the newly created theme and make changes as necessary. If desired, developers can add additional components to the theme for GTK2, Openbox, Metacity, Unity, etc.
|
||||
|
||||
To explain how to create themes, we will study the "Ambiance" theme, which is usually found at /usr/share/themes/Ambiance. This directory contains the below listed sub-directories and a file named "index.theme".
|
||||
|
||||
* gtk-2.0
|
||||
* gtk-3.0
|
||||
* metacity-1
|
||||
* unity
|
||||
|
||||
"**index.theme**" contains metadata (such as the theme's name) and some important settings (such as the button layout). Below is the "index.theme" file for "Ambiance".
|
||||
|
||||
Code:
|
||||
```
|
||||
[Desktop Entry]
|
||||
Type=X-GNOME-Metatheme
|
||||
Name=Ambiance
|
||||
Comment=Ubuntu Ambiance theme
|
||||
Encoding=UTF-8
|
||||
|
||||
[X-GNOME-Metatheme]
|
||||
GtkTheme=Ambiance
|
||||
MetacityTheme=Ambiance
|
||||
IconTheme=ubuntu-mono-dark
|
||||
CursorTheme=DMZ-White
|
||||
ButtonLayout=close,minimize,maximize:
|
||||
X-Ubuntu-UseOverlayScrollbars=true
|
||||
```
|
||||
|
||||
The "**gtk-2.0**" directory contains files for GTK2 such as a "gtkrc" file and an "apps" directory that contains application-specific GTK settings. The "gtkrc" file is the main CSS-file for the GTK2 portion of the theme. Below are the contents of /usr/share/themes/Ambiance/gtk-2.0/apps/nautilus.rc
|
||||
|
||||
Code:
|
||||
```
|
||||
# ==============================================================================
|
||||
# NAUTILUS SPECIFIC SETTINGS
|
||||
# ==============================================================================
|
||||
|
||||
style "nautilus_info_pane" {
|
||||
bg[NORMAL] = @bg_color
|
||||
}
|
||||
|
||||
widget_class "*Nautilus*<GtkNotebook>*<GtkEventBox>" style "nautilus_info_pane"
|
||||
widget_class "*Nautilus*<GtkButton>" style "notebook_button"
|
||||
widget_class "*Nautilus*<GtkButton>*<GtkLabel>" style "notebook_button"
|
||||
```
|
||||
|
||||
The "**gtk-3.0**" directory contains files for GTK3\. Instead of "gtkrc", GTK3 uses "gtk.css" as the main theme file. In the Ambiance theme, the file contains one line - '@import url("gtk-main.css");'. The "settings.ini" file contains important theme-wide settings. GTK3 themes use an "apps" directory for the same purpose as GTK2\. The "assets" directory contains images for radio buttons, check-boxes, etc. Below are the contents of /usr/share/themes/Ambiance/gtk-3.0/gtk-main.css
|
||||
|
||||
Code:
|
||||
```
|
||||
/*default color scheme */
|
||||
@define-color bg_color #f2f1f0;
|
||||
@define-color fg_color #4c4c4c;
|
||||
@define-color base_color #ffffff;
|
||||
@define-color text_color #3C3C3C;
|
||||
@define-color selected_bg_color #f07746;
|
||||
@define-color selected_fg_color #ffffff;
|
||||
@define-color tooltip_bg_color #000000;
|
||||
@define-color tooltip_fg_color #ffffff;
|
||||
|
||||
/* misc colors used by gtk+
|
||||
*
|
||||
* Gtk doesn't currently expand color variables for style properties. Thus,
|
||||
* gtk-widgets.css uses literal color names, but includes a comment containing
|
||||
* the name of the variable. Please remember to change values there as well
|
||||
* when changing one of the variables below.
|
||||
*/
|
||||
@define-color info_fg_color rgb (181, 171, 156);
|
||||
@define-color info_bg_color rgb (252, 252, 189);
|
||||
@define-color warning_fg_color rgb (173, 120, 41);
|
||||
@define-color warning_bg_color rgb (250, 173, 61);
|
||||
@define-color question_fg_color rgb (97, 122, 214);
|
||||
@define-color question_bg_color rgb (138, 173, 212);
|
||||
@define-color error_fg_color rgb (235, 235, 235);
|
||||
@define-color error_bg_color rgb (223, 56, 44);
|
||||
@define-color link_color @selected_bg_color;
|
||||
@define-color success_color #4e9a06;
|
||||
@define-color error_color #df382c;
|
||||
|
||||
/* theme common colors */
|
||||
@define-color button_bg_color shade (@bg_color, 1.02); /*shade (#cdcdcd, 1.08);*/
|
||||
@define-color notebook_button_bg_color shade (@bg_color, 1.02);
|
||||
@define-color button_insensitive_bg_color mix (@button_bg_color, @bg_color, 0.6);
|
||||
@define-color dark_bg_color #3c3b37;
|
||||
@define-color dark_fg_color #dfdbd2;
|
||||
|
||||
@define-color backdrop_fg_color mix (@bg_color, @fg_color, 0.8);
|
||||
@define-color backdrop_text_color mix (@base_color, @text_color, 0.8);
|
||||
@define-color backdrop_dark_fg_color mix (@dark_bg_color, @dark_fg_color, 0.75);
|
||||
/*@define-color backdrop_dark_bg_color mix (@dark_bg_color, @dark_fg_color, 0.75);*/
|
||||
@define-color backdrop_selected_bg_color shade (@bg_color, 0.92);
|
||||
@define-color backdrop_selected_fg_color @fg_color;
|
||||
|
||||
@define-color focus_color alpha (@selected_bg_color, 0.5);
|
||||
@define-color focus_bg_color alpha (@selected_bg_color, 0.1);
|
||||
|
||||
@define-color shadow_color alpha(black, 0.5);
|
||||
|
||||
@define-color osd_fg_color #eeeeec;
|
||||
@define-color osd_bg_color alpha(#202526, 0.7);
|
||||
@define-color osd_border_color alpha(black, 0.7);
|
||||
|
||||
@import url("gtk-widgets-borders.css");
|
||||
@import url("gtk-widgets-assets.css");
|
||||
@import url("gtk-widgets.css");
|
||||
@import url("apps/geary.css");
|
||||
@import url("apps/unity.css");
|
||||
@import url("apps/baobab.css");
|
||||
@import url("apps/gedit.css");
|
||||
@import url("apps/nautilus.css");
|
||||
@import url("apps/gnome-panel.css");
|
||||
@import url("apps/gnome-terminal.css");
|
||||
@import url("apps/gnome-system-log.css");
|
||||
@import url("apps/unity-greeter.css");
|
||||
@import url("apps/glade.css");
|
||||
@import url("apps/california.css");
|
||||
@import url("apps/software-center.css");
|
||||
@import url("public-colors.css");
|
||||
```
|
||||
|
||||
The "**metacity-1**" folder contains images that the Metacity window-manager uses for buttons (such as the "close window" button). This directory also contains a file named "metacity-theme-1.xml" that contain's the theme's metadata (like the developer's name) and styling. However, the Metacity portion of the theme uses XML rather than CSS.
|
||||
|
||||
The "**unity**" directory contains SVG files that Unity uses for buttons. Besides the SVG files, there are no other files in this folder.
|
||||
|
||||
Some themes may contain other directories. For instance, "Clearlooks-Phenix" has a folder named "**openbox-3**" and "**xfwm4**". The "openbox-3" folder only contains a "themerc" file that declares the settings and appearance (a sample is seen below). The "xfwm4" directory contains *.xpm files, *.png images (in the "png" folder), a "README" file, and a "themerc" file which contains settings (as seen below).
|
||||
/usr/share/themes/Clearlooks-Phenix/xfwm4/themerc
|
||||
|
||||
Code:
|
||||
```
|
||||
# Clearlooks XFWM4 by Casey Kirsle
|
||||
|
||||
show_app_icon=true
|
||||
active_text_color=#FFFFFF
|
||||
inactive_text_color=#939393
|
||||
title_shadow_active=frame
|
||||
title_shadow_inactive=false
|
||||
button_layout=O|HMC
|
||||
button_offset=2
|
||||
button_spacing=2
|
||||
full_width_title=true
|
||||
maximized_offset=0
|
||||
title_vertical_offset_active=1
|
||||
title_vertical_offset_inactive=1
|
||||
```
|
||||
|
||||
/usr/share/themes/Clearlooks-Phenix/openbox-3/themerc
|
||||
|
||||
Code:
|
||||
```
|
||||
!# Clearlooks-Evolving
|
||||
!# Clearlooks as it evolves in gnome-git...
|
||||
!# Last updated 09/03/10
|
||||
|
||||
# Fonts
|
||||
# these are really halos, but who cares?
|
||||
|
||||
*.font: shadow=n
|
||||
window.active.label.text.font:shadow=y:shadowtint=30:shadowoffset=1
|
||||
window.inactive.label.text.font:shadow=y:shadowtint=00:shadowoffset=0
|
||||
menu.items.font:shadow=y:shadowtint=0:shadowoffset=1
|
||||
|
||||
!# general stuff
|
||||
|
||||
border.width: 1
|
||||
padding.width: 3
|
||||
padding.height: 2
|
||||
window.handle.width: 3
|
||||
window.client.padding.width: 0
|
||||
menu.overlap: 2
|
||||
*.justify: center
|
||||
|
||||
!# lets set our damn shadows here, eh?
|
||||
|
||||
*.bg.highlight: 50
|
||||
*.bg.shadow: 05
|
||||
|
||||
window.active.title.bg.highlight: 35
|
||||
window.active.title.bg.shadow: 05
|
||||
|
||||
window.inactive.title.bg.highlight: 30
|
||||
window.inactive.title.bg.shadow: 05
|
||||
|
||||
window.*.grip.bg.highlight: 50
|
||||
window.*.grip.bg.shadow: 30
|
||||
|
||||
window.*.handle.bg.highlight: 50
|
||||
window.*.handle.bg.shadow: 30
|
||||
|
||||
!# Menu settings
|
||||
|
||||
menu.border.color: #aaaaaa
|
||||
menu.border.width: 1
|
||||
|
||||
menu.title.bg: solid flat
|
||||
menu.title.bg.color: #E6E7E6
|
||||
menu.title.text.color: #111111
|
||||
|
||||
menu.items.bg: Flat Solid
|
||||
menu.items.bg.color: #ffffff
|
||||
menu.items.text.color: #111111
|
||||
menu.items.disabled.text.color: #aaaaaa
|
||||
|
||||
menu.items.active.bg: Flat Gradient splitvertical border
|
||||
|
||||
menu.items.active.bg.color: #97b8e2
|
||||
menu.items.active.bg.color.splitTo: #a8c5e9
|
||||
|
||||
menu.items.active.bg.colorTo: #91b3de
|
||||
menu.items.active.bg.colorTo.splitTo: #80a7d6
|
||||
menu.items.active.bg.border.color: #4b6e99
|
||||
menu.items.active.text.color: #ffffff
|
||||
|
||||
menu.separator.width: 1
|
||||
menu.separator.padding.width: 0
|
||||
menu.separator.padding.height: 3
|
||||
menu.separator.color: #aaaaaa
|
||||
|
||||
!# set handles here and only the once?
|
||||
|
||||
window.*.handle.bg: Raised solid
|
||||
window.*.handle.bg.color: #eaebec
|
||||
|
||||
window.*.grip.bg: Raised solid
|
||||
window.*.grip.bg.color: #eaebec
|
||||
|
||||
!# Active
|
||||
|
||||
window.*.border.color: #585a5d
|
||||
|
||||
window.active.title.separator.color: #4e76a8
|
||||
|
||||
*.title.bg: Raised Gradient splitvertical
|
||||
*.title.bg.color: #8CB0DC
|
||||
*.title.bg.color.splitTo: #99BAE3
|
||||
*.title.bg.colorTo: #86ABD9
|
||||
*.title.bg.colorTo.splitTo: #7AA1D1
|
||||
|
||||
window.active.label.bg: Parentrelative
|
||||
window.active.label.text.color: #ffffff
|
||||
|
||||
window.active.button.*.bg: Flat Gradient splitvertical Border
|
||||
|
||||
window.active.button.*.bg.color: #92B4DF
|
||||
window.active.button.*.bg.color.splitTo: #B0CAEB
|
||||
window.active.button.*.bg.colorTo: #86ABD9
|
||||
window.active.button.*.bg.colorTo.splitTo: #769FD0
|
||||
|
||||
window.active.button.*.bg.border.color: #49678B
|
||||
window.active.button.*.image.color: #F4F5F6
|
||||
|
||||
window.active.button.hover.bg.color: #b5d3ef
|
||||
window.active.button.hover.bg.color.splitTo: #b5d3ef
|
||||
window.active.button.hover.bg.colorTo: #9cbae7
|
||||
window.active.button.hover.bg.colorTo.splitTo: #8caede
|
||||
window.active.button.hover.bg.border.color: #4A658C
|
||||
window.active.button.hover.image.color: #ffffff
|
||||
|
||||
window.active.button.pressed.bg: Flat solid Border
|
||||
window.active.button.pressed.bg.color: #7aa1d2
|
||||
|
||||
window.active.button.hover.bg.border.color: #4A658C
|
||||
|
||||
!# inactive
|
||||
|
||||
!#window.inactive.border.color: #7e8285
|
||||
window.inactive.title.separator.color: #96999d
|
||||
|
||||
window.inactive.title.bg: Raised Gradient splitvertical
|
||||
window.inactive.title.bg.color: #E3E2E0
|
||||
window.inactive.title.bg.color.splitTo: #EBEAE9
|
||||
window.inactive.title.bg.colorTo: #DEDCDA
|
||||
window.inactive.title.bg.colorTo.splitTo: #D5D3D1
|
||||
|
||||
window.inactive.label.bg: Parentrelative
|
||||
window.inactive.label.text.color: #70747d
|
||||
|
||||
window.inactive.button.*.bg: Flat Gradient splitVertical Border
|
||||
window.inactive.button.*.bg.color: #ffffff
|
||||
window.inactive.button.*.bg.color.splitto: #ffffff
|
||||
window.inactive.button.*.bg.colorTo: #F9F8F8
|
||||
window.inactive.button.*.bg.colorTo.splitto: #E9E7E6
|
||||
window.inactive.button.*.bg.border.color: #928F8B
|
||||
window.inactive.button.*.image.color: #6D6C6C
|
||||
|
||||
!# osd (pop ups and what not, dock?)
|
||||
|
||||
osd.border.width: 1
|
||||
osd.border.color: #aaaaaa
|
||||
|
||||
osd.bg: flat border gradient splitvertical
|
||||
osd.bg.color: #F0EFEE
|
||||
osd.bg.color.splitto: #f5f5f4
|
||||
osd.bg.colorTo: #EAEBEC
|
||||
osd.bg.colorTo.splitto: #E7E5E4
|
||||
|
||||
osd.bg.border.color: #ffffff
|
||||
|
||||
osd.active.label.bg: parentrelative
|
||||
osd.active.label.bg.color: #efefef
|
||||
osd.active.label.bg.border.color: #9c9e9c
|
||||
osd.active.label.text.color: #444
|
||||
|
||||
osd.inactive.label.bg: parentrelative
|
||||
osd.inactive.label.text.color: #70747d
|
||||
|
||||
!# yeah whatever, this is fine anyhoo?
|
||||
osd.hilight.bg: flat vertical gradient
|
||||
osd.hilight.bg.color: #9ebde5
|
||||
osd.hilight.bg.colorTo: #749dcf
|
||||
osd.unhilight.bg: flat vertical gradient
|
||||
osd.unhilight.bg.color: #BABDB6
|
||||
osd.unhilight.bg.colorTo: #efefef
|
||||
```
|
||||
|
||||
**Testing Themes**
|
||||
When creating themes, it may be helpful to test it and tweak the code to get the desired appearance. Such developers may want to use some type of "theme-previewer". Thankfully, some exist.
|
||||
|
||||
* GTK+ Change Theme - This program can change the GTK theme and allow developers to preview the theme. The program is composed of one window that contains many widgets, thus providing a complete preview for the theme. To install this program, type "apt-get install gtk-chtheme".
|
||||
* GTK Theme Switch - This program allows users to easily change the user's theme. Be sure to have some applications open to view and test the theme. To install this program, type "apt-get install gtk-theme-switch" and type "gtk-theme-switch2" in a terminal to run it.
|
||||
* LXappearance - This program can change themes, icons, and fonts.
|
||||
* PyWF - This is a Python-based alternative to "The Widget Factory". PyWF can be obtained at [http://gtk-apps.org/content/show.php/PyTWF?content=102024][1]
|
||||
* The Widget Factory - This is an old GTK-previewer. To install this program, type "apt-get install thewidgetfactory" and type "twf" in a terminal to run it.
|
||||
|
||||
**Theme Downloads**
|
||||
|
||||
* Cinnamon - [http://gnome-look.org/index.php?xcontentmode=104][2]
|
||||
* Compiz - [http://gnome-look.org/index.php?xcontentmode=102][3]
|
||||
* GNOME Shell - [http://gnome-look.org/index.php?xcontentmode=191][4]
|
||||
* GTK2 - [http://gnome-look.org/index.php?xcontentmode=100][5]
|
||||
* GTK3 - [http://gnome-look.org/index.php?xcontentmode=167][6]
|
||||
* KDE/Qt - [http://kde-look.org/index.php?xcontentmode=8x9x10x11x12x13x14x15x16][7]
|
||||
* Linux Mint Themes - [http://linuxmint-art.org/index.php?xcontentmode=9x14x100][8]
|
||||
* Metacity - [http://gnome-look.org/index.php?xcontentmode=101][9]
|
||||
* Ubuntu Themes - [http://www.ubuntuthemes.org/][10]
|
||||
|
||||
**Further Reading**
|
||||
|
||||
* Graphical User Interface (GUI) Reading Guide - [http://www.linux.org/threads/gui-reading-guide.6471/][11]
|
||||
* GTK - [http://www.linux.org/threads/understanding-gtk.6291/][12]
|
||||
* Introduction to Glade - [http://www.linux.org/threads/introduction-to-glade.7142/][13]
|
||||
* Desktop Environment vs Window Managers - [http://www.linux.org/threads/desktop-environment-vs-window-managers.7802/][14]
|
||||
* Official GTK+ 3 Reference Manual - [https://developer.gnome.org/gtk3/stable/][15]
|
||||
* GtkCssProvider - [https://developer.gnome.org/gtk3/stable/GtkCssProvider.html][16]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linux.org/threads/installing-obtaining-and-making-gtk-themes.8463/
|
||||
|
||||
作者:[DevynCJohnson][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.linux.org/members/devyncjohnson.4843/
|
||||
[1]:http://gtk-apps.org/content/show.php/PyTWF?content=102024
|
||||
[2]:http://gnome-look.org/index.php?xcontentmode=104
|
||||
[3]:http://gnome-look.org/index.php?xcontentmode=102
|
||||
[4]:http://gnome-look.org/index.php?xcontentmode=191
|
||||
[5]:http://gnome-look.org/index.php?xcontentmode=100
|
||||
[6]:http://gnome-look.org/index.php?xcontentmode=167
|
||||
[7]:http://kde-look.org/index.php?xcontentmode=8x9x10x11x12x13x14x15x16
|
||||
[8]:http://linuxmint-art.org/index.php?xcontentmode=9x14x100
|
||||
[9]:http://gnome-look.org/index.php?xcontentmode=101
|
||||
[10]:http://www.ubuntuthemes.org/
|
||||
[11]:http://www.linux.org/threads/gui-reading-guide.6471/
|
||||
[12]:http://www.linux.org/threads/understanding-gtk.6291/
|
||||
[13]:http://www.linux.org/threads/introduction-to-glade.7142/
|
||||
[14]:http://www.linux.org/threads/desktop-environment-vs-window-managers.7802/
|
||||
[15]:https://developer.gnome.org/gtk3/stable/
|
||||
[16]:https://developer.gnome.org/gtk3/stable/GtkCssProvider.html
|
||||
[17]:http://www.gtk.org/
|
@ -1,3 +1,5 @@
|
||||
# rusking translating
|
||||
|
||||
How Linux got to be Linux: Test driving 1993-2003 distros
|
||||
============================================================
|
||||
|
||||
|
@ -1,109 +0,0 @@
|
||||
Best 4 Command Line Download Managers/Accelerators for Linux
|
||||
============================================================
|
||||
|
||||
We all very often uses download manager to download files from internet for different requirements, it’s one of the major contributor for me as well as others too. We all want a super fast download manager to complete the download as much possible, so that we can save our time and move forward for further work. There are a lot of download managers and accelerators available (GUI & CLI) which speeds up your download.
|
||||
|
||||
All the download utility doing the same task but they way of handling & feature is differ like, Single threaded and multi-threaded, interactive and non-interactive. Here, we are going to list best four command line download accelerators which we uses regularly for day to day work.
|
||||
|
||||
#### #1 Aria2
|
||||
|
||||
[Aria2][1] is a lightweight multi-protocol & multi-source command-line download manager/utility for Linux, Windows & Mac OSX. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink. aria2 can be manipulated via built-in JSON-RPC and XML-RPC interfaces.
|
||||
|
||||
It supports multi-threading and uses multiple sources/protocols to download files which really speeds up your download and complete the download as much as possible.
|
||||
|
||||
It’s very lightweight and doesn’t require much memory and CPU. We can use as a BitTorrent Client because it has all the features you want in BitTorrent client.
|
||||
|
||||
#### Aria2 Features
|
||||
|
||||
* HTTP/HTTPS GET support
|
||||
* HTTP Proxy support
|
||||
* HTTP BASIC authentication support
|
||||
* HTTP Proxy authentication support
|
||||
* FTP support(active, passive mode)
|
||||
* FTP through HTTP proxy(GET command or tunneling)
|
||||
* Segmented download
|
||||
* Cookie support
|
||||
* It can run as a daemon process.
|
||||
* BitTorrent protocol support with fast extension.
|
||||
* Selective download in multi-file torrent
|
||||
* Metalink version 3.0 support(HTTP/FTP/BitTorrent).
|
||||
* Limiting download/upload speed
|
||||
|
||||
Refer the following article for further usage of Aria2.
|
||||
|
||||
[How to Install & use Aria2 in Linux][2]
|
||||
|
||||
#### #2 Axel
|
||||
|
||||
[Axel][3] is a lightweight download utility, it does the same thing how other accelerator does. It opens multiple connections for one file and each connections download separate file fragment to complete the download more quickly.
|
||||
|
||||
Axel supports HTTP, HTTPS, FTP and FTPS protocols. It can also use multiple mirrors for single file download. So, Axel can speed up a download up to 40% (approximately, i personally realized). It’s very lightweight because no dependencies and uses very less CPU & RAM.
|
||||
|
||||
Axel downloads all the data directly to the destination file, using one single thread.
|
||||
|
||||
Note : There is no option to download the two file in single command
|
||||
|
||||
Refer the following article for further usage of Axel.
|
||||
|
||||
[How to Install & use Axel in Linux][4]
|
||||
|
||||
#### #3 Wget
|
||||
|
||||
[Wget][5] (formerly known as Geturl) is a Free, open source, command line downloader which is retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive command line tool and Its name is derived from World Wide Web and get.
|
||||
|
||||
Wget handle download pretty much good compared with other tools, even it doesn’t support multi-threading and futures included working in background, recursive download, multiple file downloads, resume downloads, non-interactive downloads & large file downloads.
|
||||
|
||||
By default all the Linux Distribution included wget, so we can install easily from official repository, also we can install to windows and Mac OS too.
|
||||
|
||||
Wget has been designed for robustness over slow or unstable network connections, if a download fails due to a network problem, it will keep retrying until the whole file has been retrieved. If the server supports regetting, it will instruct the server to continue the download from where it left off.
|
||||
|
||||
#### Wget Features
|
||||
|
||||
* Can resume aborted downloads, using REST and RANGE
|
||||
* Can use filename wild cards and recursively mirror directories
|
||||
* NLS-based message files for many different languages
|
||||
* Optionally converts absolute links in downloaded documents to relative, so that downloaded documents may link to each other locally
|
||||
* Runs on most UNIX-like operating systems as well as Microsoft Windows
|
||||
* Supports HTTP proxies
|
||||
* Supports HTTP cookies
|
||||
* Supports persistent HTTP connections
|
||||
* Unattended / background operation
|
||||
* Uses local file timestamps to determine whether documents need to be re-downloaded when mirroring
|
||||
|
||||
Refer the following article for further usage of Wget.
|
||||
|
||||
[How to Install & use Wget in Linux][6]
|
||||
|
||||
#### #4 Curl
|
||||
|
||||
[Curl][7] is similar to wget and doesn’t support multi-threading but surprisingly make the download much faster compare with wget.
|
||||
|
||||
curl is a tool to transfer data from a server or to server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP).
|
||||
|
||||
The command is designed to work without user interaction. Also curl support proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume, Metalink, and more. curl is powered by libcurl for all transfer-related features.
|
||||
|
||||
If you specify URL without `protocol://` prefix, curl will attempt to guess what protocol you might want. For example, host names starting with “ftp.”curl will assume you want to speak FTP. If it’s not find specific protocol, then do default to HTTP.
|
||||
|
||||
Refer the following article for further usage of Curl.
|
||||
|
||||
[How to Install & use Curl in Linux][8]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.2daygeek.com/best-4-command-line-download-managers-accelerators-for-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]:http://www.2daygeek.com/author/magesh/
|
||||
[1]:https://aria2.github.io/
|
||||
[2]:http://www.2daygeek.com/aria2-command-line-download-utility-tool/
|
||||
[3]:https://axel.alioth.debian.org/
|
||||
[4]:http://www.2daygeek.com/axel-command-line-downloader-accelerator-for-linux/
|
||||
[5]:https://www.gnu.org/software/wget/
|
||||
[6]:http://www.2daygeek.com/wget-command-line-download-utility-tool/
|
||||
[7]:https://curl.haxx.se/
|
||||
[8]:http://www.2daygeek.com/curl-command-line-download-manager/
|
@ -1,3 +1,4 @@
|
||||
**translating by [erlinux](https://github.com/erlinux)**
|
||||
Minecraft Server on Linux
|
||||
=============================
|
||||
|
||||
|
@ -1,137 +0,0 @@
|
||||
translating by ypingcn
|
||||
|
||||
10 Linux System Administrators New Year’s Resolutions (2017)
|
||||
============================================================
|
||||
|
||||
As we prepare to bid 2016 a more than deserved farewell, it is a time to make our New Year’s resolutions. Regardless of your experience level as a Linux system administrator, we think it is worthy and well to set goals for growth for the next 12 months.
|
||||
|
||||
In case you are out of ideas, in this post we will share 10 simple professional resolutions that you may want to consider for 2017.
|
||||
|
||||
### 1.: Decide to Automate More
|
||||
|
||||
You don’t need to run like a chicken with its head cut off trying to solve foreseeable problems every day. If you find yourself spending time performing repetitive tasks on a daily basis, you need to stop here and now.
|
||||
|
||||
With all the [Linux-based and open source tools][4] at your disposal, you can give yourself some leisure time by [automating as many of your Linux tasks][5] as possible.
|
||||
|
||||
You will find that several of the following resolutions will help you work towards this goal, so keep reading.
|
||||
|
||||
Additionally, do yourself a favor and take a couple of minutes to browse through our [Free eBooks][6] section.
|
||||
|
||||
Chances are you will want to download the books related to [Bash shell scripting][7] and brush up your skills. Happy automating!
|
||||
|
||||
### 2\. Learn a New Scripting Language
|
||||
|
||||
Although every system administrator should be comfortable using Bash for scripting, it is important to consider other modern and robust tools such as [Python][8].
|
||||
|
||||
But don’t just take our word for it – check this [2-article series on Python][9] that we published not long ago. You will realize that, among other things, Python brings the power of Object-oriented programming and allows you to write shorter and more robust scripts.
|
||||
|
||||
### 3\. Learn a New Programming Language
|
||||
|
||||
In addition to learning a new scripting language, decide to take some time to start or brush up your programming skills. Not sure where to start? This year’s [Stackoverflow Developer Survey][10] reveals that Javascriptcontinues to lead the list of most popular languages for third year in a row.
|
||||
|
||||
Other all-time favorites such as Java and C are also worthy of your consideration. Do check out our [Best Programming Courses of 2016][11].
|
||||
|
||||
### 4\. Create a GitHub Account and Update it Regularly
|
||||
|
||||
Especially if you are new to programming, you should consider showcasing your work on GitHub. By allowing others to fork your scripts or programs, you will be able to improve your knowledge and create more sophisticated software through the help of others.
|
||||
|
||||
Learn more on [how to install and create GitHub Account][12].
|
||||
|
||||
### 5\. Contribute to an Open Source Project
|
||||
|
||||
Another great way to learn (or improve your knowledge about) a new scripting or programming language is by contributing to an open source project on GitHub.
|
||||
|
||||
If this sounds like something that may interest you, check the [Explore GitHub][13] pages. There you can browse repositories by popularity or by language, so you will be able to find something interesting to work on.
|
||||
|
||||
On top of this, you’ll get the satisfaction that comes from giving back to the community.
|
||||
|
||||
### 6\. Try Out a New Distribution Each Month
|
||||
|
||||
With new distributions or spin-offs coming out regularly, you have several options to choose from. Who knows that your dream distribution is just around the corner and you have not discovered it yet? Head to Distrowatchand pick a new distribution each month.
|
||||
|
||||
Also, don’t forget to [subscribe to Tecmint][14] to stay informed about new distros hitting the streets, so to speak.
|
||||
|
||||
Hopefully our reviews will help you to determine if you want to give a new distribution a try. Also do check out our articles on top Linux distributions here:
|
||||
|
||||
1. [Top 5 Best Security-Centric Linux Distributions Of 2016][1]
|
||||
2. [Top Linux Distributions To look Forward To In 2016][2]
|
||||
3. [10 Top Most Popular Linux Distributions of 2015][3]
|
||||
|
||||
### 7\. Attend a Linux or Open Source Conference
|
||||
|
||||
If you live near a place where a conference sponsored by the [Linux Foundation][15] is scheduled to take place, I strongly encourage you to attend.
|
||||
|
||||
This will not only provide the opportunity to enhance your knowledge about Linux but also give you the chance to meet other open source professionals.
|
||||
|
||||
### 8\. Learn Free or Paid Course from Linux Foundation
|
||||
|
||||
The Linux Foundation continually offers free and paid courses through edX.org and via their own portal, respectively.
|
||||
|
||||
Topics for free courses include (but may not be limited to) Introduction to Linux, Introduction to Cloud Infrastructure Technologies, and Introduction to OpenStack.
|
||||
|
||||
On the other hand, paid options include preparation for the [LFCS Certification][16] and [LFCE certification][17] exams, Linux for developers, Kernel internals, Linux Security, Performance testing, High Availability, and more.
|
||||
|
||||
As a plus, they offer discounts for enterprise courses, so try to convince your boss to pay for your and your colleagues’ training. Additionally, free webinars are offered on a periodic basis so don’t forget to subscribe to< their newsletters!
|
||||
|
||||
You may also consider checking out our best [Online Linux Training Courses][18].
|
||||
|
||||
### 9\. Answer X Questions in a Linux Forum Per Week
|
||||
|
||||
Another great way to give back to the community is by helping others who are just starting off with their Linux journey. You will find lots of people looking for answers in Linux forums all over the web.
|
||||
|
||||
Keep in mind that you were once a newbie just like them, and try to put yourself in their shoes.
|
||||
|
||||
### 10\. Teach a Kid or Teenager to Use Linux
|
||||
|
||||
If I could go back 20 years, I wish I had a computer back then and the chance to [learn Linux as a teenager][19].
|
||||
|
||||
I also wish I had to start off with programming much earlier than I did. Without a doubt, things would have been a whole lot easier. That kind of gives me the perspective that teaching at least basic Linux and programming skills to kids or teenagers (I do it with my own kids) is an important endeavor.
|
||||
|
||||
Educating the raising generation on how to effectively use open source technologies will give them the freedom of choice, and they will thank you forever for it.
|
||||
|
||||
##### Summary
|
||||
|
||||
In this article we have shared 10 prospective New Year’s resolutions for system administrators. The [Tecmint.com][20] wishes you the best of luck as you work towards your goals and hope to keep you as a frequent reader in 2017.
|
||||
|
||||
As always, don’t hesitate to use the form below if you have questions or comments about this article. We look forward to hearing from you!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
作者简介:
|
||||
|
||||
![](http://1.gravatar.com/avatar/d9d14c5b51331864398e6288cb0c2091?s=128&d=blank&r=g)
|
||||
|
||||
Gabriel Cánepa is a GNU/Linux sysadmin and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/linux-system-administrators-new-years-resolutions-ideas/
|
||||
|
||||
作者:[Gabriel Cánepa][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/gacanepa/
|
||||
[1]:http://www.tecmint.com/best-security-centric-linux-distributions-of-2016/
|
||||
[2]:http://www.tecmint.com/top-linux-distributions-to-look-forward-in-2016/
|
||||
[3]:http://www.tecmint.com/10-top-most-popular-linux-distributions-of-2015/
|
||||
[4]:http://www.tecmint.com/category/top-tools/
|
||||
[5]:http://www.tecmint.com/using-shell-script-to-automate-linux-system-maintenance-tasks/
|
||||
[6]:http://tecmint.tradepub.com/category/information-technology-servers-and-linux-server-os/806/
|
||||
[7]:http://tecmint.tradepub.com/free/w_syst05/?p=w_syst05
|
||||
[8]:http://www.tecmint.com/category/python/
|
||||
[9]:http://www.tecmint.com/learn-python-programming-and-scripting-in-linux/
|
||||
[10]:http://stackoverflow.com/research/developer-survey-2016#technology
|
||||
[11]:https://deals.tecmint.com/collections/best-of-bundles-2016
|
||||
[12]:http://www.tecmint.com/install-git-centos-fedora-redhat/
|
||||
[13]:https://help.github.com/articles/where-can-i-find-open-source-projects-to-work-on/
|
||||
[14]:http://subscribe.tecmint.com/newsletter
|
||||
[15]:http://events.linuxfoundation.org/
|
||||
[16]:http://www.tecmint.com/sed-command-to-create-edit-and-manipulate-files-in-linux/
|
||||
[17]:http://www.tecmint.com/installing-network-services-and-configuring-services-at-system-boot/
|
||||
[18]:http://www.tecmint.com/linux-online-training-courses/
|
||||
[19]:http://www.tecmint.com/free-online-linux-learning-guide-for-beginners/
|
||||
[20]:http://tecmint.com/
|
@ -1,178 +0,0 @@
|
||||
#rusking translating
|
||||
|
||||
PhotoRec – Recover Deleted or Lost Files in Linux
|
||||
============================================================
|
||||
|
||||
When you delete a file accidentally or intentionally on your system using ‘shift + delete‘ or delete option or empty Trash, the file content is not destroyed from the hard disk (or any storage media).
|
||||
|
||||
It is simply removed from the the directory structure and you cannot see the file in the directory where you deleted it, but it still remains somewhere in your hard drive.
|
||||
|
||||
If you have the appropriate tools and knowledge, you can [recover lost files from your computer][1]. However, as you store more files on your hard disk, the deleted files are overwritten, you may only recover recently deleted files.
|
||||
|
||||
In this tutorial, we will explain how to recover lost or deleted files on a hard disk in Linux using Testdisk, is a remarkable recovery tool ships in with a free tool called PhotoRec.
|
||||
|
||||
PhotoRec is used to recover lost files from storage media such as hard drives, digital camera and cdrom.
|
||||
|
||||
### Install Testdisk (PhotoRec) in Linux Systems
|
||||
|
||||
To install Testdisk by running the relevant command below for your distribution:
|
||||
|
||||
```
|
||||
------- On Debian/Ubuntu/Linux Mint -------
|
||||
$ sudo apt-get install testdisk
|
||||
------- On CentOS/RHEL/Fedora -------
|
||||
$ sudo yum install testdisk
|
||||
------- On Fedora 22+ -------
|
||||
$ sudo dnf install testdisk
|
||||
------- On Arch Linux -------
|
||||
$ pacman -S testdisk
|
||||
------- On Gentoo -------
|
||||
$ emerge testdisk
|
||||
```
|
||||
|
||||
In case it is not available on your Linux distribution’s repositories, download it from [here][2] and run it on a Live CD.
|
||||
|
||||
It can also be found in rescue CD such as Gparted LiveCD, Parted Magic, Ubuntu Boot CD, Ubuntu-Rescue-Remix and many more.
|
||||
|
||||
Once the installation is complete, start PhotoRec in a text window as follows with root privileges and specify the partition from which the files where deleted:
|
||||
|
||||
```
|
||||
$ sudo photorec /dev/sda3
|
||||
```
|
||||
|
||||
You’ll see the interface below:
|
||||
|
||||
[
|
||||
![PhotoRec Data Recovery Tool for Linux](http://www.tecmint.com/wp-content/uploads/2017/01/PhotoRec-Data-Recovery-Tool.png)
|
||||
][3]
|
||||
|
||||
PhotoRec Data Recovery Tool for Linux
|
||||
|
||||
Use the `right` and `left` arrow keys to select a menu item, and press Enter. To continue with the recovery operation, select `[Proceed]` and hit Enter.
|
||||
|
||||
You will be at the following interface:
|
||||
|
||||
[
|
||||
![Select Partition to Proceed File Recovery](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Partition-to-Proceed-File-Recovery.png)
|
||||
][4]
|
||||
|
||||
Select Partition to Proceed File Recovery
|
||||
|
||||
Select `[Options]` to view available recovery operation options as in the interface below:
|
||||
|
||||
[
|
||||
![Linux File Recovery Options](http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Options.png)
|
||||
][5]
|
||||
|
||||
Linux File Recovery Options
|
||||
|
||||
Press `Q` to move back, at the interface below, you can specify the file extensions you want to search and recover. Therefore, select `[File Opt]` and press Enter.
|
||||
|
||||
Press `s` to disable/enable all file extensions, and in case you have disabled all file extensions, only choose types of files you want to recover by selecting them using `right` arrow keys (or `left` arrow key to deselect).
|
||||
|
||||
For instance, I want to recover all `.mov` files that I lost on my system.
|
||||
|
||||
[
|
||||
![Specify Recovery File Type](http://www.tecmint.com/wp-content/uploads/2017/01/Specify-Recovery-File-Type.png)
|
||||
][6]
|
||||
|
||||
Specify Recovery File Type
|
||||
|
||||
Then press `b` to save the setting, you should see the message below after pressing it. Move back by hitting Enter (or simply press `Q` button), then press `Q` again to go back to the main menu.
|
||||
|
||||
[
|
||||
![Save File Recovery Settings](http://www.tecmint.com/wp-content/uploads/2017/01/Save-File-Recovery-Settings.png)
|
||||
][7]
|
||||
|
||||
Save File Recovery Settings
|
||||
|
||||
Now select `[Search]` to start the recovery process. In the interface below, choose the filesystem type where the file(s) were stored and hit Enter.
|
||||
|
||||
[
|
||||
![Select Filesystem to Recover Deleted Files](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Recover-Files.png)
|
||||
][8]
|
||||
|
||||
Select Filesystem to Recover Deleted Files
|
||||
|
||||
Next, choose if only free space or the whole partition needs to be analyzed as below. Note that choosing whole partition will make the operation slower and longer. Once you have selected the appropriate option, press Enterto proceed.
|
||||
|
||||
[
|
||||
![Choose Filesystem to Analyze](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Analyze.png)
|
||||
][9]
|
||||
|
||||
Choose Filesystem to Analyze
|
||||
|
||||
Closely select a directory where recovered files will be stored, if the destination is correct, press `C` button to continue. Choose a directory on a different partition to avoid deleted files being overwritten when more data is stored on the partition.
|
||||
|
||||
To move back until the root partition, use the `left` arrow key.
|
||||
|
||||
[
|
||||
![Select Directory to Save Recovered Files](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Directory-to-Save-Recovered-Files.png)
|
||||
][10]
|
||||
|
||||
Select Directory to Save Recovered Files
|
||||
|
||||
The screenshot below shows deleted files of the specified type being recovered. You can stop the operation by pressing Enter.
|
||||
|
||||
Note: Your system may become slow, and possibly freeze at certain moments, so you need to be patient until when the process is complete.
|
||||
|
||||
[
|
||||
![Recovering Deleted Files in Linux](http://www.tecmint.com/wp-content/uploads/2017/01/Recover-Deleted-Files-in-Linux.png)
|
||||
][11]
|
||||
|
||||
Recovering Deleted Files in Linux
|
||||
|
||||
At the end of the operation, Photorec will show you the number and the location of files recovered.
|
||||
|
||||
[
|
||||
![Linux File Recovery Summary](http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Summary.png)
|
||||
][12]
|
||||
|
||||
Linux File Recovery Summary
|
||||
|
||||
The recovered files will be stored with root privileges by default, therefore open your file manager with elevated privileges to access the files.
|
||||
|
||||
Use the command below (specify your file manager):
|
||||
|
||||
```
|
||||
$ gksudo nemo
|
||||
or
|
||||
$ gksudo nautilus
|
||||
```
|
||||
|
||||
For more information, visit PhotoRec homepage: [http://www.cgsecurity.org/wiki/PhotoRec][13].
|
||||
|
||||
That’s all! In this tutorial, we explained the necessary steps to recover deleted or lost files from hard disk using PhotoRec. This is so far the most reliable and effective recovery tool I have ever used, if you know any other similar tool, do share with us in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
![](http://1.gravatar.com/avatar/4e444ab611c7b8c7bcb76e58d2e82ae0?s=128&d=blank&r=g)
|
||||
|
||||
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/photorec-recover-deleted-lost-files-in-linux/
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/aaronkili/
|
||||
[1]:http://www.tecmint.com/recover-deleted-file-in-linux/
|
||||
[2]:http://www.cgsecurity.org/wiki/TestDisk_Download
|
||||
[3]:http://www.tecmint.com/wp-content/uploads/2017/01/PhotoRec-Data-Recovery-Tool.png
|
||||
[4]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Partition-to-Proceed-File-Recovery.png
|
||||
[5]:http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Options.png
|
||||
[6]:http://www.tecmint.com/wp-content/uploads/2017/01/Specify-Recovery-File-Type.png
|
||||
[7]:http://www.tecmint.com/wp-content/uploads/2017/01/Save-File-Recovery-Settings.png
|
||||
[8]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Recover-Files.png
|
||||
[9]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Analyze.png
|
||||
[10]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Directory-to-Save-Recovered-Files.png
|
||||
[11]:http://www.tecmint.com/wp-content/uploads/2017/01/Recover-Deleted-Files-in-Linux.png
|
||||
[12]:http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Summary.png
|
||||
[13]:http://www.cgsecurity.org/wiki/PhotoRec
|
@ -1,3 +1,4 @@
|
||||
**translating by [erlinux](https://github.com/erlinux)**
|
||||
inxi – A Great Tool to Check Hardware Information on Linux
|
||||
============================================================
|
||||
|
||||
|
@ -1,86 +0,0 @@
|
||||
4 open source alternatives to Trello that you can self-host
|
||||
============================================================
|
||||
|
||||
Trello is a visual team collaboration platform that was recently acquired by Atlassian. And by that, I mean as _recently_ as today Monday, January 9 2017.
|
||||
|
||||
I’ve been using Trello as a board member of DigitalOcean’s community authors and started using it to manage a small team project for a non-profit organization a couple of days ago. It’s a nice piece of software that any team, including those with non-geeky members, can use comfortable.
|
||||
|
||||
If you like [Trello][6], but now want a similar software that you can self-host, or run on your own server, I’ve found four that you can choose from. Keep in mind that I’ve not installed any of these on my own server, but from the information I’ve gathered about them, the ones I’m most likely to use are Kanboard and Restyaboard.
|
||||
|
||||
And that’s because their installation requirements are familiar.. Their installation process are also relatively simpler. Restyaboard seems to have a more polished UI, so it will probably be my first option, though one of it’s requirements (Elasticsearch) makes me think that the server requirements will be more than for others. In any case, I’ll be posting my attempt to self-host both Kanboard and Restyaboard soon, so check back often.
|
||||
|
||||
Until then, the top four alternatives for Trello that I’ve found, are:
|
||||
|
||||
### Kanboard
|
||||
|
||||
Aside form the fact that it is free and open source, Kanban features integrations with third party tools and services like Amazon S3 Storage, Hipchat, Jabber, RabbitMQ, Slack, and many more. Kanboard can be installed on a Microsoft operating system, but for installation on free and open source components, you’ll need the following:
|
||||
|
||||
* PHP >= 5.3.9
|
||||
* MariaDB/MySQL, Postgres, or Sqlite
|
||||
* Apache or Nginx
|
||||
* CentOS 6/7, Debian 8, FreeBSD 10, or Ubuntu 14.04/16.04
|
||||
|
||||
[Related Post: Five Reasons to Switch to Software for Load Balancing][7]
|
||||
|
||||
From just a very cursory assessment of the project, the UI seems to be less polished than that of others mentioned in this article. And in the event that you change your mind about self-hosting, there’s a managed, or hosted Kanboard that you can register for. The project’s GitHub page is available at [https://github.com/kanboard/kanboard][8]
|
||||
|
||||
![kanboard interface](http://linuxbsdos.com/wp-content/uploads/2017/01/kanboard-700x312.png "kanboard interface")
|
||||
|
||||
### Restyaboard
|
||||
|
||||
With a polished UI and ability to import data from Trello, Restyaboard is a very attractive Trello alternative. And the installation requirements seem modest; you’ll need the following to install Restyaboard on your server:
|
||||
|
||||
* PHP-FPM
|
||||
* Postgres
|
||||
* Nginx
|
||||
* Elasticsearch
|
||||
|
||||
Even with those few requirements, installation is made even simpler with a script that will auto-install all you need on your server. Also there’s an AMI for installation on Amazon AWS. For Docker fans, there’s an unofficial Docker image you can use to run Restyaboard containers. I don’t encourage running Docker containers using unofficial Docker images, but it’s an option if you wish to go that route. Details at the project’s [GitHub page][9].
|
||||
|
||||
![Restyaboard project management software](http://linuxbsdos.com/wp-content/uploads/2017/01/restyaboard-646x460.png "Restyaboard project management software")
|
||||
|
||||
### Taiga
|
||||
|
||||
A Taiga deployment is made up of three components – taiga-back (backend/api), taiga-front-dist (frontend), taiga-events – each with its own requirements. In general, you need the following to install Taiga on your server:
|
||||
|
||||
[Related Post: Dual-boot Fedora 25, Windows 10 on a computer with UEFI firmware][10]* Python >= 3.4* PostgreSQL >= 9.3* RabbitMQ (optional as long as you don’t want async notifications)* gcc and development headers* Ruby >= 2.1 (only for compiling sass)* NodeJS >= 5.0 (with npm, gulp and bower for downloading dependencies and compiling coffeescript)
|
||||
|
||||
The installation requirements seem to be a bit more involved than the others, so if that’s going to be an issue for you, there’s an hosted platform that’s free to use. Extra features on that hosted platform are fee-based. Visit the project’s [GitHub page][1] for details.
|
||||
|
||||
![Taiga project management software](http://linuxbsdos.com/wp-content/uploads/2017/01/Taiga-700x440.jpg "Taiga project management software")
|
||||
|
||||
### Wekan
|
||||
|
||||
Wekan is built with Meteor, a JavaScript framework for building web applications, and is hosted at [https://github.com/wekan/wekan][2]. The project offers a 1-click installation on Heroku, Sandstorm, and verified Docker images for running it on Docker containers. It can also be installed on Scalingo, IndieHosters and Cloudron, but I couldn’t find installation instructions for deploying it on other Cloud hosting providers like [Vultr][3]and [DigitalOcean][4].
|
||||
|
||||
So it seems that your best bet, and the easiest route to installing Wekan, is to use one of the supported Cloud hosting platforms.
|
||||
|
||||
![Wekan project management software](http://linuxbsdos.com/wp-content/uploads/2017/01/Wekan-700x363.jpeg "Wekan project management software")
|
||||
|
||||
As promised, check back soon for the publication of my guide on how to install Kanboard and Restyaboard on your server.
|
||||
|
||||
### UPDATE
|
||||
|
||||
Just after publishing this article, I came across [Tuleap][5]. It seems to be very polished, but a production installation is supported only on CentOS 6 and Red Hat 6\. Containerized installation using Docker is supported, but not recommended for production.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linuxbsdos.com/2017/01/09/4-open-source-alternatives-to-trello-that-you-can-self-host/
|
||||
|
||||
作者:[linuxbsdos.com][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linuxbsdos.com
|
||||
[1]:https://github.com/taigaio/
|
||||
[2]:https://github.com/wekan/wekan
|
||||
[3]:http://www.vultr.com/?ref=6827794
|
||||
[4]:https://www.digitalocean.com/?refcode=900fe177d075
|
||||
[5]:https://www.tuleap.org/
|
||||
[6]:https://trello.com/
|
||||
[7]:http://linuxbsdos.com/2016/07/11/five-reasons-to-switch-to-software-for-load-balancing/
|
||||
[8]:https://github.com/kanboard/kanboard
|
||||
[9]:https://github.com/RestyaPlatform/board
|
||||
[10]:http://linuxbsdos.com/2016/12/01/dual-boot-fedora-25-windows-10-on-a-computer-with-uefi-firmware/
|
@ -1,3 +1,5 @@
|
||||
Martin translating…
|
||||
|
||||
Explore climate data with open source tools
|
||||
============================================================[up][1]
|
||||
![Explore climate data with open source tools](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/bus-cloud.png?itok=bdROR1aE "Explore climate data with open source tools")
|
||||
|
@ -0,0 +1,96 @@
|
||||
Let Sudo Insult You When You Enter Incorrect Password
|
||||
============================================================
|
||||
|
||||
Sudoers is the default sudo security policy plugin in Linux, however, experienced system administrators can specify a custom security policy as well as input and output logging plugins. It is driven by the `/etc/sudoers`file or alternatively in LDAP.
|
||||
|
||||
You can define sudoers insults option or several others in the file above. It is set under defaults entries section. Read through our last article that explains [10 Useful Sudoers Configurations for Setting ‘sudo’ in Linux][1].
|
||||
|
||||
In this article, we will explain a sudoers configuration parameter to enable an individual or system administrator set [sudo command][2] to insult system users who enter wrong password.
|
||||
|
||||
Start by opening the file `/etc/sudoers` like so:
|
||||
|
||||
```
|
||||
$ sudo visudo
|
||||
```
|
||||
|
||||
Go to the defaults section and add the following line:
|
||||
|
||||
```
|
||||
Defaults insults
|
||||
```
|
||||
|
||||
Below is a sample of /etc/sudoers file on my system showing defaults entries.
|
||||
|
||||
[
|
||||
![Set sudo Insults Parameter](http://www.tecmint.com/wp-content/uploads/2017/01/Set-sudo-Insults-Parameter.png)
|
||||
][3]
|
||||
|
||||
Set sudo Insults Parameter
|
||||
|
||||
From the screenshot above, you can see that there are many other defaults defined such as send mail to root when each time a user enters a bad password, set a secure path, configure a custom sudo log file and more.
|
||||
|
||||
Save the file and close it.
|
||||
|
||||
Run a command with sudo and enter the wrong password, then observe how insults option works:
|
||||
|
||||
```
|
||||
$ sudo visudo
|
||||
```
|
||||
[
|
||||
![sudo Insult in Action](http://www.tecmint.com/wp-content/uploads/2017/01/How-sudo-Insult-Works.png)
|
||||
][4]
|
||||
|
||||
sudo Insult in Action
|
||||
|
||||
Note: When you configure the insults parameter, it disables the `badpass_message` parameter which prints a specific message on the command line (the default message is “sorry, try again”) in case a user enters a wrong password.
|
||||
|
||||
To modify the message, add the `badpass_message` parameter to the /etc/sudoers file as shown below.
|
||||
|
||||
```
|
||||
Defaults badpass_message="Password is wrong, please try again" #try to set a message of your own
|
||||
```
|
||||
[
|
||||
![Set sudo badpassword Message](http://www.tecmint.com/wp-content/uploads/2017/01/Set-sudo-badpassword-Message.png)
|
||||
][5]
|
||||
|
||||
Set sudo badpassword Message
|
||||
|
||||
Save the file and close it, then invoke sudo and see how it works, the message you set as the value of badpass_message will be printed every time you or any system user types a wrong password.
|
||||
|
||||
```
|
||||
$ sudo visudo
|
||||
```
|
||||
[
|
||||
![Sudo badpassword Message](http://www.tecmint.com/wp-content/uploads/2017/01/sudo-badpassword-Message.png)
|
||||
][6]
|
||||
|
||||
Sudo badpassword Message
|
||||
|
||||
That’s all, in this article we reviewed how to set sudo to print insults when users type a wrong password. Do share your thoughts via the comment section below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
![](http://1.gravatar.com/avatar/4e444ab611c7b8c7bcb76e58d2e82ae0?s=128&d=blank&r=g)
|
||||
|
||||
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
via: http://www.tecmint.com/sudo-insult-when-enter-wrong-password/
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/aaronkili/
|
||||
[1]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/
|
||||
[2]:http://www.tecmint.com/su-vs-sudo-and-how-to-configure-sudo-in-linux/
|
||||
[3]:http://www.tecmint.com/wp-content/uploads/2017/01/Set-sudo-Insults-Parameter.png
|
||||
[4]:http://www.tecmint.com/wp-content/uploads/2017/01/How-sudo-Insult-Works.png
|
||||
[5]:http://www.tecmint.com/wp-content/uploads/2017/01/Set-sudo-badpassword-Message.png
|
||||
[6]:http://www.tecmint.com/wp-content/uploads/2017/01/sudo-badpassword-Message.png
|
142
sources/tech/20170113 3 open source music players.md
Normal file
142
sources/tech/20170113 3 open source music players.md
Normal file
@ -0,0 +1,142 @@
|
||||
3 open source music players: Aqualung, Lollypop, and GogglesMM
|
||||
============================================================
|
||||
![3 open source music players: Aqualung, Lollypop, and GogglesMM](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/music-birds-recording-520.png?itok=wvh1g4Lw "3 open source music players: Aqualung, Lollypop, and GogglesMM")
|
||||
Image by :
|
||||
|
||||
[Internet Archive][2] book images; modified by Opensource.com. [CC BY-SA 4.0][3]
|
||||
|
||||
Music is a part of life. [Wikipedia's article on the history of music][4] contains this great phrase: "Since all people of the world, including the most isolated tribal groups, have a form of music...." Well, we open source folk form a tribe—that's for sure. I propose that our "form of music" includes open music players. Over the past year, I've been taking a look at the various players available; in [December 2016][5] I summarized my ongoing evaluation of open music players using these six criteria:
|
||||
|
||||
1. Must be configurable to pass the music through unchanged to [ALSA][1]. (max 5 marks)
|
||||
2. Should have a good "smart playlist" feature. (1 mark)
|
||||
3. Should not force the user to always interact through playlists. (1 mark)
|
||||
4. Should provide a simple approach to cover art—use the embedded cover art or fall back to cover.jpg (or .png) in the music directory. (1 mark)
|
||||
5. Should show the signal level and effective bit rate as the music plays. (1 mark)
|
||||
6. Should present good-to-great overall organization, layout, and performance. (1 mark)
|
||||
|
||||
Three players suggested to me by kind readers were not available in my repositories: [Aqualung][6], [Lollypop][7], and [GogglesMM][8]. Not wanting to install stuff from the wild on my work computer, I promised to configure a "test bed" for this purpose and detail the results.
|
||||
|
||||
### Aqualung
|
||||
|
||||
[Aqualung][9] has a clearly written website that explains its various features. One of the comments there I found interesting was this one:
|
||||
|
||||
"You can (and should) organize your music into a tree of Artists/Records/Tracks, thereby making life easier than with the all-in-one Winamp/XMMS playlist."
|
||||
|
||||
This puzzled me because I think I have always had my music organized into a tree of artists, albums, and tracks. But maybe this explains why I find the XMMS-derived players to be a bit odd in terms of their music browsing capability.
|
||||
|
||||
According to the Aqualung download page, the official release is source-only. While the comments there suggest that most major Linux distributions include a built copy of Aqualung, this is not the case with the distro I'm currently using on my work computer, Ubuntu 16.10. [Launchpad.net][10] does have personal package archives (PPAs), but they seem a bit out of date, so why not build from source?
|
||||
|
||||
I installed **pkgconf** and dev versions of **libasound**, **libflac**, **libmp3lame**, **libvorbis**, **libxml2**, **libglib2.0**, and **libgtk+-2.0**, generally following the suggestions of the compiling page on the site and the usual "hints" from the configure script. Next, I was able to **configure** cleanly and do a **make** and a **make install**. And from there, I was able to execute **/usr/local/bin/aqualung**.
|
||||
|
||||
![Aqualung](https://opensource.com/sites/default/files/aqualung.png "Aqualung")
|
||||
|
||||
Aqualung, unable to switch resolution.
|
||||
|
||||
Once Aqualung was up and running, I saw a straightforward and relatively barebones two-window user interface, the player itself and the "Music Store." I opened Preferences by right-clicking on the music pane of the player and looked around to see where I could select my AudioQuest DragonFly digital-to-analog converter, but I saw no sign of anything there. However, the site notes that you can specify the output device on the command line. I ended up needing to use the **plughw** device to get Aqualung to start.
|
||||
|
||||
At that point, I was disappointed to discover that Aqualung seems to require a fixed output sample rate. I could play my 44.1-KHz files just fine with the default setting, but to play my 96-KHz files, I had to stop and restart with that sample rate. Aqualung will not pass the bit stream unchanged through to the digital-to-analog converter. With that, I did not bother to continue my evaluation.
|
||||
|
||||
**Not rated.**
|
||||
|
||||
### Lollypop
|
||||
|
||||
![Lollypop interface](https://opensource.com/sites/default/files/lollypop_interface.png "Lollypop interface")
|
||||
|
||||
The lovely Lollypop user interface.
|
||||
|
||||
[Lollypop][11] has a gorgeous website. Although it's not in my work computer's repositories, there is a "Download Ubuntu/Debian" link that points to an [up-to-date PPA on launchpad.net][12]. The site offers other downloads for Flatpak, Arch Linux, Fedora, FreeBSD, and OpenSUSE. Out of curiosity, I took a look at the [Fedora link on Fedora COPR][13], and it also looks quite up-to-date, offering builds for Fedora 23–26.
|
||||
|
||||
One build from source was enough excitement for that day, so I decided to try the PPA. I was able to execute Lollypop from the command line. The Settings menu was obvious in the upper right of the screen. After updating my music, I went looking for my output device configuration, but after some poking around, I couldn't find how to select the output device. Even executing on the command line with **–help** did not enlighten me.
|
||||
|
||||
After some searching on the Internet I found a Lollypop developer stating that I needed **gstreamer libav** to get Lollypop to work. From this I have tentatively concluded that there may be a **gstreamer** configuration possibility to make this work, but I'm not going to pursue that for now, at least.
|
||||
|
||||
Lollypop has a lovely user interface to match its lovely web page, but for now, I did not rate it. I have another reason to learn more about **gstreamer**.
|
||||
|
||||
**Not rated.**
|
||||
|
||||
### GogglesMM
|
||||
|
||||
[Goggles Music Manager][14] also has an [up-to-date PPA on launchpad.net][15]; the installation was straightforward and I was able to execute **gogglesmm** from the command line.
|
||||
|
||||
GogglesMM, out of the box, looks somewhat like Rhythmbox. I found the Audio tab under Settings > Preferences, which let me select ALSA and set my output device. I confirmed that I can play MP3, 44.1-KHz / 24-bit and 96-KHz / 24-bit music by looking at **/proc/asound/DragonFly/stream0** and the LED color on the DragonFly itself; therefore, 5 points for "rate/depth passthrough."
|
||||
|
||||
![GogglesMM](https://opensource.com/sites/default/files/gogglesmm.png "GogglesMM")
|
||||
|
||||
GogglesMM playing at 96/24, showing output device.
|
||||
|
||||
The documentation for GogglesMM is not largely detailed at this point, but as far as I am able to tell, the developers use filters to implement something like "smart playlists." I reviewed the functioning of filters as best as I could with the three albums installed on my test bed, and while I like what I see (especially being able to define selection criteria for songs based on a broad range of criteria), this is not what I mean when I use the term "smart playlists," which I think of as using some kind of community database of "songs like the current one." Maybe I should call this "automatic DJ" instead, but as far as I am able to determine, this feature does not exist in the current version of GogglesMM, so 0 points for "smart playlist."
|
||||
|
||||
As for the queue versus playlist operation, the application supports either playing through the selected songs both in order or randomly or putting songs in a playlist, so 1 for "queue option to playlist."
|
||||
|
||||
Similarly, it seemed to manage my cover art well without extra intervention (each album contained the appropriate cover art, which was recognized automatically by GogglesMM), so 1 for "embedded cover art or cover.jpg."
|
||||
|
||||
I could not find any way to show signal level or effective bit rate. Nor could I find any way of seeing the bit rate and bit depth; although the application can display a "format" column, it doesn't show anything in that field on my music, so 0 for "signal level and effective bit rate."
|
||||
|
||||
With respect to overall organization, GogglesMM hits all the right buttons for me. I can see what's in the play queue, the time and proportion of song played and left to play, album cover, song name, album title, and artist. Also, the available display column list seems quite large and useful, including composer for example. Finally, a really wonderful thing, the volume control actually controls the ALSA volume. If I bring up alsamixer and adjust the volume in either GogglesMM or alsamixer, the other's volume control moves and the volume adjusts. This is pretty cool and surprisingly not all that common, so 1 for overall organization.
|
||||
|
||||
In total, then, GogglesMM merits an 8\. Excellent performance indeed.
|
||||
|
||||
**Rating: 8**
|
||||
|
||||
### The ratings so far
|
||||
|
||||
As I've mentioned in the past, my favorite player is [Guayadeque][16], which gets a perfect 10, according to my ranking. Take a look at a summary of my ratings to date (N/R meaning "not rated," because I was unable to determine how to configure those players to work in bit-perfect, passthrough mode so that my digital-to-analog converter receives the PCM data at the bit rate and bit depth of the source):
|
||||
|
||||
![Open source audio players](https://opensource.com/sites/default/files/open_source_audio.png "Open source audio players")
|
||||
|
||||
Please note that my ranking scheme is not for everyone. In particular, many people don't find value in music files at higher-than-CD resolution, and many people are happy with proprietary formats that promise better audio quality.
|
||||
|
||||
Meanwhile, I will continue to evaluate some of the promising non-rated options. I especially like the look of Lollypop, and I feel that there is a secret spell for **gstreamer** just waiting to be unlocked that will let **gstreamer**-based players pass their data through without conversions.
|
||||
|
||||
### And the music...
|
||||
|
||||
My vinyl buying spree continues, and I have some great recommendations.
|
||||
|
||||
First is Nils Frahm's album, [Felt][17], which was a very thoughtful gift from my daughter. I really, really like this album, which was largely recorded late at night with microphones very close to the piano strings and lots of interesting ambient piano noise—really beautiful music. Like other Nils Frahm music, the vinyl comes with a download code that allows the downloading of the album in up to 96-KHz, 24-bit FLAC format.
|
||||
|
||||
The second is [Mad Professor's remix][18] of Massive Attack's album, Protection, titled No Protection. You can [get an idea of it here][19], and if you would like to try out the original, [here is what it's all about][20]. Originally released in the 1990s, this album is back on vinyl and it sounds fantastic. Unfortunately, no download code accompanies it.
|
||||
|
||||
The third is [Primitives][21] by Bayonne. [Here is an idea][22] of what it's like. The Guardian newspaper has lumped this in with "the new boring," how's that for a genre? Really, if it's all so boring, maybe it's time for a career change, Anyway, give this one a whirl; maybe you'll find it boring, or maybe, like me, you'll like it!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
作者简介:
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/profile_pictures/public/clh_portrait2.jpg?itok=V1V-YAtY)
|
||||
|
||||
Chris Hermansen - Engaged in computing since graduating from the University of British Columbia in 1978, I have been a full-time Linux user since 2005 and a full-time Solaris, SunOS and UNIX System V user before that. On the technical side of things, I have spent a great deal of my career doing data analysis; especially spatial data analysis. I have a substantial amount of programming experience in relation to data analysis, using awk, Python, PostgreSQL, PostGIS and lately Groovy
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/17/1/open-source-music-players
|
||||
|
||||
作者:[Chris Hermansen][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/clhermansen
|
||||
[1]:http://www.alsa-project.org/main/index.php/Main_Page
|
||||
[2]:https://www.flickr.com/photos/internetarchivebookimages/14565158187/in/photolist-ocoBRG-ocqdPM-ot9YYX-ovb7SE-oroqfj-ot8Sfi-of1HoD-oc5c28-otBk3B-foZxvq-ocoUvo-4TqEKE-otsG7t-oeYo4w-ornGMQ-orpD9y-wLDBUf-outZV7-oc26Ui-ortZpW-ocpWLH-ocoK6c-ocYDY1-od6ADb-xxAKyY-ocofDx-oc4Jr5-otyT2E-ocpUyu-xqTAb6-oc8gK1-otdsK5-ovhkz2-ocpcHj-oc8xwk-otgmZG-otr595-otnv4o-otvdRs-ovfYEt-ovDXUV-obUPJ6-oc2MuJ-oc4zLE-oruPbN-oc1P2H-ouRk93-otaGd3-otTmwB-oc5f62
|
||||
[3]:http://creativecommons.org/licenses/by-sa/4.0/
|
||||
[4]:https://en.wikipedia.org/wiki/History_of_music
|
||||
[5]:https://opensource.com/article/16/12/soundtrack-open-source-music-players
|
||||
[6]:http://aqualung.jeremyevans.net/
|
||||
[7]:https://gnumdk.github.io/lollypop-web/
|
||||
[8]:https://gogglesmm.github.io/
|
||||
[9]:http://aqualung.jeremyevans.net/
|
||||
[10]:https://launchpad.net/+search?field.text=aqualung+ppa
|
||||
[11]:https://gnumdk.github.io/lollypop-web/
|
||||
[12]:https://launchpad.net/~gnumdk/+archive/ubuntu/lollypop
|
||||
[13]:https://copr.fedorainfracloud.org/coprs/gnumdk/lollypop/
|
||||
[14]:https://gogglesmm.github.io/
|
||||
[15]:https://launchpad.net/~s.jansen/+archive/ubuntu/gogglesmm
|
||||
[16]:http://www.guayadeque.org/
|
||||
[17]:http://www.nilsfrahm.com/works/felt/
|
||||
[18]:https://en.wikipedia.org/wiki/No_Protection_(Massive_Attack_album)
|
||||
[19]:https://www.youtube.com/watch?v=9TvgRb4wiB0
|
||||
[20]:https://www.youtube.com/watch?v=LCUv-hLN71c
|
||||
[21]:https://musicglue.com/bayonne/products/primitives---vinyl--/
|
||||
[22]:https://www.youtube.com/watch?v=WZ6xl6CKITE
|
@ -0,0 +1,228 @@
|
||||
Learn The Basics of How Linux I/O (Input/Output) Redirection Works
|
||||
============================================================
|
||||
|
||||
One of the most important and [interesting topics under Linux administration][4] is I/O redirection. This feature of the command line enables you to redirect the input and/or output of commands from and/or to files, or join multiple commands together using pipes to form what is known as a “command pipeline”.
|
||||
|
||||
All the commands that we run fundamentally produce two kinds of output:
|
||||
|
||||
1. the command result – data the program is designed to produce, and
|
||||
2. the program status and error messages that informs a user of the program execution details.
|
||||
|
||||
In Linux and other Unix-like systems, there are three default files named below which are also identified by the shell using file descriptor numbers:
|
||||
|
||||
1. stdin or 0 – it’s connected to the keyboard, most programs read input from this file.
|
||||
2. stdout or 1 – it’s attached to the screen, and all programs send their results to this file and
|
||||
3. stderr or 2 – programs send status/error messages to this file which is also attached to the screen.
|
||||
|
||||
Therefore, I/O redirection allows you to alter the input source of a command as well as where its output and error messages are sent to. And this is made possible by the `“<”` and `“>”` redirection operators.
|
||||
|
||||
### How To Redirect Standard Output to File in Linux
|
||||
|
||||
You can redirect standard output as in the example below, here, we want to store the output of the [top command][5]for later inspection:
|
||||
|
||||
```
|
||||
$ top -bn 5 >top.log
|
||||
```
|
||||
|
||||
Where the flags:
|
||||
|
||||
1. `-b` – enables top to run in batch mode, so that you can redirect its output to a file or another command.
|
||||
2. `-n` – specifies the number of iterations before the command terminates.
|
||||
|
||||
You can view the contents of `top.log` file using [cat command][6] as follows:
|
||||
|
||||
```
|
||||
$ cat top.log
|
||||
```
|
||||
|
||||
To append the output of a command, use the `“>>”` operator.
|
||||
|
||||
For instance to append the output of [top command][7] above in the top.log file especially within a script (or on the command line), enter the line below:
|
||||
|
||||
```
|
||||
$ top -bn 5 >>top.log
|
||||
```
|
||||
|
||||
Note: Using the file descriptor number, the output redirect command above is the same as:
|
||||
|
||||
```
|
||||
$ top -bn 5 1>top.log
|
||||
```
|
||||
|
||||
### How To Redirect Standard Error to File in Linux
|
||||
|
||||
To redirect standard error of a command, you need to explicitly specify the file descriptor number, `2` for the shell to understand what you are trying to do.
|
||||
|
||||
For example the [ls command][8] below will produce an error when executed by a normal system user without root privileges:
|
||||
|
||||
```
|
||||
$ ls -l /root/
|
||||
```
|
||||
|
||||
You can redirect the standard error to a file as below:
|
||||
|
||||
```
|
||||
$ ls -l /root/ 2>ls-error.log
|
||||
$ cat ls-error.log
|
||||
```
|
||||
[
|
||||
![Redirect Standard Error to File](http://www.tecmint.com/wp-content/uploads/2017/01/Redirect-Standard-Error-in-Linux.png)
|
||||
][9]
|
||||
|
||||
Redirect Standard Error to File
|
||||
|
||||
In order to append the standard error, use the command below:
|
||||
|
||||
```
|
||||
$ ls -l /root/ 2>>ls-error.log
|
||||
```
|
||||
|
||||
### How To Redirect Standard Output/ Error To One File
|
||||
|
||||
It is also possible to capture all the output of a command (both standard output and standard error) into a single file. This can be done in two possible ways by specifying the file descriptor numbers:
|
||||
|
||||
1. The first is a relatively old method which works as follows:
|
||||
|
||||
```
|
||||
$ ls -l /root/ >ls-error.log 2>&1
|
||||
```
|
||||
|
||||
The command above means the shell will first send the output of the [ls command][10] to the file ls-error.log (using `>ls-error.log`), and then writes all error messages to the file descriptor 2 (standard output) which has been redirected to the file ls-error.log (using `2>&1`). Implying that standard error is also sent to the same file as standard output.
|
||||
|
||||
2. The second and direct method is:
|
||||
|
||||
```
|
||||
$ ls -l /root/ &>ls-error.log
|
||||
```
|
||||
|
||||
You can as well append standard output and standard error to a single file like so:
|
||||
|
||||
```
|
||||
$ ls -l /root/ &>>ls-error.log
|
||||
```
|
||||
|
||||
### How To Redirect Standard Input to File
|
||||
|
||||
Most if not all commands get their input from standard input, and by default standard input is attached to the keyboard.
|
||||
|
||||
To redirect standard input from a file other than the keyboard, use the `“<”` operator as below:
|
||||
|
||||
```
|
||||
$ cat <domains.list
|
||||
```
|
||||
[
|
||||
![Redirect Standard Input to File](http://www.tecmint.com/wp-content/uploads/2017/01/Redirect-Standard-Input-to-File.png)
|
||||
][11]
|
||||
|
||||
Redirect Standard Input to File
|
||||
|
||||
### How To Redirect Standard Input/Output to File
|
||||
|
||||
You can perform standard input, standard output redirection at the same time using [sort command][12] as below:
|
||||
|
||||
```
|
||||
$ sort <domains.list >sort.output
|
||||
```
|
||||
|
||||
### How to Use I/O Redirection Using Pipes
|
||||
|
||||
To redirect the output of one command as input of another, you can use pipes, this is a powerful means of building useful command lines for complex operations.
|
||||
|
||||
For example, the command below will [list the top five recently modified files][13].
|
||||
|
||||
```
|
||||
$ ls -lt | head -n 5
|
||||
```
|
||||
|
||||
Here, the options:
|
||||
|
||||
1. `-l` – enables long listing format
|
||||
2. `-t` – [sort by modification time with the newest files][1] are shown first
|
||||
3. `-n` – specifies the number of header lines to show
|
||||
|
||||
### Important Commands for Building Pipelines
|
||||
|
||||
Here, we will briefly review two important commands for building command pipelines and they are:
|
||||
|
||||
xargs which is used to build and execute command lines from standard input. Below is an example of a pipeline which uses xargs, this command is used to [copy a file into multiple directories in Linux][14]:
|
||||
|
||||
```
|
||||
$ echo /home/aaronkilik/test/ /home/aaronkilik/tmp | xargs -n 1 cp -v /home/aaronkilik/bin/sys_info.sh
|
||||
```
|
||||
[
|
||||
![Copy Files to Multiple Directories](http://www.tecmint.com/wp-content/uploads/2017/01/Copy-Files-to-Multiple-Directories.png)
|
||||
][15]
|
||||
|
||||
Copy Files to Multiple Directories
|
||||
|
||||
And the options:
|
||||
|
||||
1. `-n 1` – instructs xargs to use at most one argument per command line and send to the [cp command][2]
|
||||
2. `cp` – copies the file
|
||||
3. `-v` – [displays progress of copy command][3].
|
||||
|
||||
For more usage options and info, read through the xargs man page:
|
||||
|
||||
```
|
||||
$ man xargs
|
||||
```
|
||||
|
||||
A tee command reads from standard input and writes to standard output and files. We can demonstrate how teeworks as follows:
|
||||
|
||||
```
|
||||
$ echo "Testing how tee command works" | tee file1
|
||||
```
|
||||
[
|
||||
![tee Command Example](http://www.tecmint.com/wp-content/uploads/2017/01/tee-command-example.png)
|
||||
][16]
|
||||
|
||||
tee Command Example
|
||||
|
||||
[File or text filters][17] are commonly used with pipes for [effective Linux file operations][18], to process information in powerful ways such as restructuring output of commands (this can be vital for [generation of useful Linux reports][19]), modifying text in files plus several other [Linux system administration tasks][20].
|
||||
|
||||
To learn more about Linux filters and pipes, read this article [Find Top 10 IP Addresses Accessing Apache Server][21], shows a useful example of using filters and pipes.
|
||||
|
||||
In this article, we explained the fundamentals of I/O redirection in Linux. Remember to share your thoughts via the feedback section below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
![](http://1.gravatar.com/avatar/4e444ab611c7b8c7bcb76e58d2e82ae0?s=128&d=blank&r=g)
|
||||
|
||||
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
via: http://www.tecmint.com/linux-io-input-output-redirection-operators/
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/aaronkili/
|
||||
[1]:http://www.tecmint.com/find-and-sort-files-modification-date-and-time-in-linux/
|
||||
[2]:http://www.tecmint.com/progress-monitor-check-progress-of-linux-commands/
|
||||
[3]:http://www.tecmint.com/monitor-copy-backup-tar-progress-in-linux-using-pv-command/
|
||||
[4]:http://www.tecmint.com/how-to-setup-and-configure-static-network-routing-in-rhel/
|
||||
[5]:http://www.tecmint.com/12-top-command-examples-in-linux/
|
||||
[6]:http://www.tecmint.com/13-basic-cat-command-examples-in-linux/
|
||||
[7]:http://www.tecmint.com/12-top-command-examples-in-linux/
|
||||
[8]:http://www.tecmint.com/tag/linux-ls-command/
|
||||
[9]:http://www.tecmint.com/wp-content/uploads/2017/01/Redirect-Standard-Error-in-Linux.png
|
||||
[10]:http://www.tecmint.com/15-basic-ls-command-examples-in-linux/
|
||||
[11]:http://www.tecmint.com/wp-content/uploads/2017/01/Redirect-Standard-Input-to-File.png
|
||||
[12]:http://www.tecmint.com/sort-command-linux/
|
||||
[13]:http://www.tecmint.com/find-recent-modified-files-in-linux/
|
||||
[14]:http://www.tecmint.com/copy-file-to-multiple-directories-in-linux/
|
||||
[15]:http://www.tecmint.com/wp-content/uploads/2017/01/Copy-Files-to-Multiple-Directories.png
|
||||
[16]:http://www.tecmint.com/wp-content/uploads/2017/01/tee-command-example.png
|
||||
[17]:http://www.tecmint.com/linux-file-operations-commands/
|
||||
[18]:http://www.tecmint.com/linux-file-operations-commands/
|
||||
[19]:http://www.tecmint.com/linux-performance-monitoring-and-file-system-statistics-reports/
|
||||
[20]:http://www.tecmint.com/automating-linux-system-administration-tasks/
|
||||
[21]:http://www.tecmint.com/find-top-ip-address-accessing-apache-web-server/
|
@ -1,49 +1,47 @@
|
||||
|
||||
beyondworld 翻译中
|
||||
|
||||
Powerline - 给Vim和Bash提供更棒的状态行和提示信息
|
||||
=================================================
|
||||
|
||||
Powerline – Adds Powerful Statuslines and Prompts to Vim Editor and Bash Terminal
|
||||
============================================================
|
||||
|
||||
Powerline is a great statusline plugin for [Vim editor][1], which is developed in Python and provides statuslines and prompts for many other applications such as bash, zsh, tmux and many more.
|
||||
Powerline是[Vim editor][1]中一个很好的状态行插件,这个插件是使用Python开发的,主要用于显示状态行和提示信息,适用于很多软件,比如bash,zsh,tmux等。
|
||||
|
||||
[
|
||||
![Install Powerline Statuslines in Linux](http://www.tecmint.com/wp-content/uploads/2015/10/Install-Powerline-Statuslines-in-Linux-620x297.png)
|
||||
][2]
|
||||
|
||||
Add Power to Linux Terminal with Powerline Tool
|
||||
Powerline使Linux终端更具威力
|
||||
|
||||
#### Features
|
||||
#### 特色
|
||||
|
||||
1. It is written in Python, which makes it extensible and feature rich.
|
||||
2. Stable and testable code base, which works well with Python 2.6+ and Python 3.
|
||||
3. It also supports prompts and statuslines in several Linux utilities and tools.
|
||||
4. It has configurations and decorator colors developed using JSON.
|
||||
5. Fast and lightweight, with daemon support, which provides even more better performance.
|
||||
1. python编写使其更具扩展性且功能丰富
|
||||
2. 稳定易测的代码基础,兼容python2.6+和python3
|
||||
3. 支持多种Linux版本及工具的提示和状态栏
|
||||
4. 通过JSON保存配置和颜色方案
|
||||
5. 快速、轻量级,具有daemon支持,提供更好的显示效果
|
||||
|
||||
#### Powerline Screenshots
|
||||
#### Powerline截图效果
|
||||
|
||||
[
|
||||
![Powerline Vim Statuslines](http://www.tecmint.com/wp-content/uploads/2015/10/Powerline-Vim-Statuslines.png)
|
||||
][3]
|
||||
|
||||
Powerline Vim Statuslines
|
||||
Vim中Powerline状态行效果
|
||||
|
||||
In this article, I will show you how to install Powerline and Powerline fonts and how to use with Bash and Vimunder RedHat and Debian based systems.
|
||||
在本文中,我会介绍如何安装Powerline和相应字体,以及如何在RedHat和Debian类的系统中使用Bash和Vim支持Powerline。
|
||||
|
||||
### Step 1: Installing Generic Requirements for Powerline
|
||||
### 第一步:准备好安装Powerline需要的软件
|
||||
|
||||
Due to a naming conflict with some other unrelated projects, powerline program is available on PyPI (Python Package Index) under the package name as powerline-status.
|
||||
由于和其他不相干项目之间存在命名冲突,因此powerline只能放在PyPI(Python Package Index)中的powerline-status包下.
|
||||
|
||||
To install packages from PyPI, we need a ‘pip‘ (package management tool for installing Python packages). So, let’s first install pip tool under our Linux systems.
|
||||
为了从PyPI中安装该包,需要先准备好pip(该工具专门用于Python包的管理)工具。所以首先要在Linux系统下安装好pip工具。
|
||||
|
||||
#### Install Pip on Debian, Ubuntu and Linux Mint
|
||||
#### 在Debian,Ubuntu和Linux Mint中安装Pip的方法
|
||||
|
||||
```
|
||||
# apt-get install python-pip
|
||||
```
|
||||
|
||||
##### Sample Output
|
||||
##### 示例输出
|
||||
|
||||
```
|
||||
Reading package lists... Done
|
||||
@ -66,16 +64,16 @@ Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
|
||||
Setting up python-pip (1.5.4-1ubuntu3) ...
|
||||
```
|
||||
|
||||
#### Install Pip on CentOS, RHEL and Fedora
|
||||
#### 在CentOS,RHEL和Fedora中安装Pip
|
||||
|
||||
Under Fedora-based systems, you need to first [enable epel-repository][4] and then install pip package as shown.
|
||||
在Fedora类系统中,需要先打开[epel-repository][4]然后按照如下方法安装pip包。
|
||||
|
||||
```
|
||||
# yum install python-pip
|
||||
# dnf install python-pip [On Fedora 22+ versions]
|
||||
```
|
||||
|
||||
##### Sample Output
|
||||
##### 示例输出
|
||||
|
||||
```
|
||||
Installing:
|
||||
@ -99,9 +97,9 @@ python-pip.noarch 0:7.1.0-1.el7
|
||||
Complete!
|
||||
```
|
||||
|
||||
### Step 2: Installing Powerline Tool in Linux
|
||||
### 第二步:在Linux中安装Powerline
|
||||
|
||||
Now it’s’ time to install Powerline latest development version from the Git repository. For this, your system must have git package installed in order to fetch the packages from Git.
|
||||
现在可以从Git仓库中安装Powerline的最新开发版。在此之前系统需要安装好Git工具以便可以从仓库拉下代码。
|
||||
|
||||
```
|
||||
# apt-get install git
|
||||
@ -109,13 +107,12 @@ Now it’s’ time to install Powerline latest development version from the G
|
||||
# dnf install git
|
||||
```
|
||||
|
||||
Next you can install Powerline with the help of pip command as shown.
|
||||
然后你可以通过pip命令安装Powerline。
|
||||
|
||||
```
|
||||
# pip install git+git://github.com/Lokaltog/powerline
|
||||
```
|
||||
|
||||
##### Sample Output
|
||||
##### 示例输出
|
||||
|
||||
```
|
||||
Cloning git://github.com/Lokaltog/powerline to /tmp/pip-WAlznH-build
|
||||
@ -140,51 +137,47 @@ changing mode of /usr/local/bin/powerline-daemon to 755
|
||||
Successfully installed powerline-status
|
||||
Cleaning up...
|
||||
```
|
||||
### 第三步:在Linux中安装Powerline的字体
|
||||
|
||||
### Step 3: Installing Powerline Fonts in Linux
|
||||
Powerline使用特殊的符号来为开发者显示特殊的箭头效果和符号内容。因此你的系统中必须要有符号字体或者补丁字体。
|
||||
|
||||
Powerline uses special glyphs to show special arrow effect and symbols for developers. For this, you must have a symbol font or a patched font installed on your systems.
|
||||
|
||||
Download the most recent version of the symbol font and fontconfig configuration file using following [wget command][5].
|
||||
通过下面的[wget][5]命令下载最新的系统字体及字体配置文件。
|
||||
|
||||
```
|
||||
# wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
|
||||
# wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
|
||||
```
|
||||
|
||||
Then you need to move the font to your fonts directory, /usr/share/fonts/ or /usr/local/share/fonts as follows or you can get the valid font paths by using command `xset q`.
|
||||
然后你将下载的字体放到字体目录下/usr/share/fonts或者/usr/local/share/fonts,或者你可以通过'xset q'命令找到一个有效的字体目录。
|
||||
|
||||
```
|
||||
# mv PowerlineSymbols.otf /usr/share/fonts/
|
||||
```
|
||||
|
||||
Next, you need to update your system’s font cache as follows.
|
||||
接下来你需要通过如下命令更新你系统的字体缓存。
|
||||
|
||||
```
|
||||
# fc-cache -vf /usr/share/fonts/
|
||||
```
|
||||
|
||||
Now install the fontconfig file.
|
||||
其次安装字体配置文件。
|
||||
|
||||
```
|
||||
# mv 10-powerline-symbols.conf /etc/fonts/conf.d/
|
||||
```
|
||||
注意:如果相应的符号没有出现,可以尝试关闭终端会话并重启X window,这样就会生效了。
|
||||
|
||||
Note: If custom symbols doesn’t appear, then try to close all terminal sessions and restart X window for the changes to take effect.
|
||||
### 步骤4:给Bash Shell和Vim状态行设置Powerline
|
||||
|
||||
### Step 4: Setting Powerline for Bash Shell and Vim Statuslines
|
||||
|
||||
In this section we shall look at configuring Powerline for bash shell and vim editor. First make your terminal to support 256color by adding the following line to ~/.bashrc file as follows.
|
||||
在这一节将介绍bash shell和vim editor中关于Powerline的配置。首先通过在~/.bashrc中添加如下内容以便设置终端为256色。
|
||||
|
||||
```
|
||||
export TERM=”screen-256color”
|
||||
```
|
||||
|
||||
#### Enable Powerline on Bash Shell
|
||||
#### 打开Bash Shell中的Powerline
|
||||
|
||||
To enable Powerline in bash shell by default, you need to add the following snippet to your ~/.bashrc file.
|
||||
如果希望在bash shell中默认打开Powerline,可以在~/.bashrc中添加如下内容。
|
||||
|
||||
First get the location of installed powerline using following command.
|
||||
首先通过如下命令获取powerline的安装位置。
|
||||
|
||||
```
|
||||
# pip show powerline-status
|
||||
@ -194,7 +187,7 @@ Location: /usr/local/lib/python2.7/dist-packages
|
||||
Requires:
|
||||
```
|
||||
|
||||
Once you know the actual location of powerline, make sure to replace the location in the below line as per your system suggested.
|
||||
一旦找到powerline的真正位置后,建议最好替换到下面的位置。
|
||||
|
||||
```
|
||||
powerline-daemon -q
|
||||
@ -202,20 +195,19 @@ POWERLINE_BASH_CONTINUATION=1
|
||||
POWERLINE_BASH_SELECT=1
|
||||
. /usr/local/lib/python2.7/dist-packages/powerline/bindings/bash/powerline.sh
|
||||
```
|
||||
|
||||
Now try to logout and login back again, you will see powerline statuesline as shown below.
|
||||
然后退出后重新登录,现在powerline的状态行应该如下显示了。
|
||||
|
||||
[
|
||||
![Bash Powerline Statuslines](http://www.tecmint.com/wp-content/uploads/2015/10/Bash-Powerline-Statuslines.gif)
|
||||
][6]
|
||||
|
||||
Try changing or switching to different directories and keep a eye on “breadcrumb” prompt changes to show your current location.
|
||||
现在切换目录并注意显示你当前路径的面包屑提示的变化。
|
||||
|
||||
You will also be able to watch pending background jobs and if powerline is installed on a remote Linux machine, you can notice that the prompt adds the hostname when you connect via SSH.
|
||||
如果远程Linux服务器上安装了powerline,当你用ssh登录上去查看当前正在后台运行的任务时,会看到主机名提示发生变化。
|
||||
|
||||
#### Enable Powerline for Vim
|
||||
#### 在Vim中打开Powerline
|
||||
|
||||
If vim is your favorite editor, luckily there is a powerful plugin for vim, too. To enable this plugin, add these lines to `~/.vimrc` file.
|
||||
如果你喜欢使用vim,正好有一个vim的强力插件。可以在~/.vimrc中添加如下内容打开该插件。
|
||||
|
||||
```
|
||||
set rtp+=/usr/local/lib/python2.7/dist-packages/powerline/bindings/vim/
|
||||
@ -223,15 +215,15 @@ set laststatus=2
|
||||
set t_Co=256
|
||||
```
|
||||
|
||||
Now you can launch vim and see a spiffy new status line:
|
||||
然后你打开vim后会看到一个新的状态行:
|
||||
|
||||
[
|
||||
![Vim Powerline Statuslines](http://www.tecmint.com/wp-content/uploads/2015/10/Vim-Powerline-Statuslines.gif)
|
||||
][7]
|
||||
|
||||
### Summary
|
||||
### 总结
|
||||
|
||||
Powerline helps to set colorful and beautiful statuslines and prompts in several applications, good for coding environments. I hope you find this guide helpful and remember to post a comment if you need any help or have additional ideas.
|
||||
Powerline可以在某些软件中提供颜色鲜艳、很优美的状态行及提示内容,这对编程环境有利。希望这篇指南对您有帮助,如果您需要帮助或者有任何好的想法,请留言给我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -239,14 +231,14 @@ Powerline helps to set colorful and beautiful statuslines and prompts in severa
|
||||
|
||||
![](http://1.gravatar.com/avatar/7badddbc53297b2e8ed7011cf45df0c0?s=128&d=blank&r=g)
|
||||
|
||||
I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+
|
||||
我是Ravi Saive,TecMint的作者。一个喜欢分享诀窍和想法的电脑极客及Linux专家。我的大部分服务都运行在开源平台Linux中。关注我的Twitter,Facebook和Google+。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/powerline-adds-powerful-statuslines-and-prompts-to-vim-and-bash/
|
||||
|
||||
作者:[Ravi Saive][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[beyondworld](https://github.com/beyondworld)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
@ -0,0 +1,109 @@
|
||||
Linux 下 4 个最好的命令行下载管理器/加速器
|
||||
============================================================
|
||||
|
||||
我们经常由于不同需求使用下载管理器从互联网下载文件,这是对我和其他人的主要贡献者之一。我们都想要一个超级快速的下载管理器来完成下载尽可能多的任务,以便我们可以节省时间来进一步地工作。这里有很多可以加速下载的下载管理器和加速器可用(GUI和CLI)。
|
||||
|
||||
所有的下载工具做着同样的任务,但它们的处理和功能是不同的,单线程和多线程、交互和非交互。 在这里,我们将列出四个最好的我们日常工作使用的命令行下载加速器,。
|
||||
|
||||
#### #1 Aria2
|
||||
|
||||
[Aria2][1]是一个用于 Linux、Windows 和 Mac OSX 的轻量级多协议和多来源的命令行下载管理器/实用程序。它支持HTTP/HTTPS、FTP、SFTP、BitTorrent 和 Metalink。aria2 可以通过内置的 JSON-RPC 和 XML-RPC 接口操作。
|
||||
|
||||
它支持多线程,并使用多个源/协议下载文件,它可以真的加速你的下载,并尽可能完成下载。
|
||||
|
||||
它非常轻量级,不需要太多的内存和 CPU。我们可以使用它作为 BitTorrent 客户端,因为它有所有你想要的 BitTorrent 客户端的功能。
|
||||
|
||||
#### Aria2 功能
|
||||
|
||||
* HTTP/HTTPS GET支持
|
||||
* HTTP 代理支持
|
||||
* 支持 HTTP BASIC 认证
|
||||
* HTTP 代理认证支持
|
||||
* FTP 支持(主动、被动模式)
|
||||
* FTP 通过 HTTP 代理(GET 命令或隧道)
|
||||
* 分段下载
|
||||
* Cookie 支持
|
||||
* 它可以作为守护进程运行。
|
||||
* BitTorrent 协议支持与快速扩展。
|
||||
* 在含有多个文件的 torrent 中的选择性下载
|
||||
* Metalink 版本 3.0 支持(HTTP/FTP/BitTorrent)。
|
||||
* 限制下载/上传速度
|
||||
|
||||
有关 Aria2 的进一步用法,请参阅以下文章。
|
||||
|
||||
[如何在Linux中安装和使用 Aria2][2]
|
||||
|
||||
#### #2 Axel
|
||||
|
||||
[Axel][3] 是一个轻量级下载程序,它如其他加速器那样做着同样的事情。它为一个文件打开多个连接,每个连接下载单独的文件片段以更快地完成下载。
|
||||
|
||||
Axel 支持 HTTP、HTTPS、FTP和 FTPS 协议。它也可以使用多个镜像下载单个文件。 所以,Axel 可以加速下载高达40%(大约,我个人认为)。 它非常轻量级,因为没有依赖和使用非常少的CPU和RAM。
|
||||
|
||||
Axel 使用一个单线程将所有数据直接下载到目标文件。
|
||||
|
||||
注意:没有选项可以在单条命令中下载两个文件
|
||||
|
||||
有关 Axel 的更多使用,请参阅以下文章。
|
||||
|
||||
[如何在 Linux 中安装和使用 Axel][4]
|
||||
|
||||
#### #3 Wget
|
||||
|
||||
[wget][5](以前称为 Geturl)是一个免费的、开源的命令行下载程序,它使用HTTP、HTTPS 和 FTP 这些最广泛使用的Internet协议检索文件。它是一个非交互式命令行工具并且它的名称是从万维网派生的并获取的。
|
||||
|
||||
wget 相比其他工具处理得相当好,即使它不支持多线程和包括后台工作、递归下载、多个文件下载、恢复下载、非交互式下载和大文件下载等功能。
|
||||
|
||||
默认情况下,所有的Linux发行版都包含 wget,所以我们可以从官方仓库轻松安装,也可以安装到 windows 和 Mac 操作系统。
|
||||
|
||||
wget 已被设计为可在慢速或不稳定的网络连接下保持鲁棒性,如果由于网络问题下载失败,它将继续重试,直到整个文件下载完成。如果服务器支持重新获取,它将指示服务器从中断的地方继续下载。
|
||||
|
||||
#### wget 功能
|
||||
|
||||
* 可以使用 REST 和 RANGE 恢复中止的下载
|
||||
* 可以使用文件名通配符和递归镜像目录
|
||||
* 为许多不同语言的基于NLS的消息文件
|
||||
* 可选将下载的文档中的绝对链接转换为相对链接,以便下载的文档可以在本地链接到彼此
|
||||
* 可在大多数类 UNIX 操作系统以及 Microsoft Windows 上运行
|
||||
* 支持 HTTP 代理
|
||||
* 支持 HTTP cookie
|
||||
* 支持持久 HTTP 连接
|
||||
* 无人值守/后台操作
|
||||
* 使用本地文件时间戳来确定是否需要在镜像时重新下载文档
|
||||
|
||||
有关 wget 的进一步用法,请参阅以下文章。
|
||||
|
||||
[如何在 Linux 中安装和使用 wget][6]
|
||||
|
||||
#### #4 Curl
|
||||
|
||||
[curl][7]类似于 wget,但是不支持多线程,但令人惊讶的是,与 wget 相比,它的下载速度更快。
|
||||
|
||||
curl 是一个使用支持的协议(DICT、FILE、FTP、FTPS、GOPHER、HTTP、HTTPS、IMAP、IMAPS、LDAP、LDAPS、POP3、POP3S、RTMP、RTSP、SCP、SFTP、SMTP、SMTPS、TELNET和TFTP)传输数据到服务器上或传输到本地的工具。
|
||||
|
||||
该命令旨在无需用户交互即可工作。此外,curl 支持代理、用户身份验证、FTP 上传、HTTP POST、SSL 连接、Cookie、恢复文件传输、Metalink 等。curl 由 libcurl 为所有相关传输功能提供支持。
|
||||
|
||||
如果指定的 URL 没有 `protocol://` 前缀,curl 将尝试猜测你可能需要什么协议。例如,以 “ftp.” 开头的主机名 curl 将假定你要使用FTP。如果没有找到特定的协议,那么默认为HTTP。
|
||||
|
||||
参考下面的文章来进一步使用 curl。
|
||||
|
||||
[如何在 Linux 中安装和使用 curl] [8]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.2daygeek.com/best-4-command-line-download-managers-accelerators-for-linux/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.2daygeek.com/author/magesh/
|
||||
[1]:https://aria2.github.io/
|
||||
[2]:http://www.2daygeek.com/aria2-command-line-download-utility-tool/
|
||||
[3]:https://axel.alioth.debian.org/
|
||||
[4]:http://www.2daygeek.com/axel-command-line-downloader-accelerator-for-linux/
|
||||
[5]:https://www.gnu.org/software/wget/
|
||||
[6]:http://www.2daygeek.com/wget-command-line-download-utility-tool/
|
||||
[7]:https://curl.haxx.se/
|
||||
[8]:http://www.2daygeek.com/curl-command-line-download-manager/
|
@ -0,0 +1,137 @@
|
||||
|
||||
10 个 Linux 系统管理员新年决心
|
||||
============================================================
|
||||
|
||||
当我们准备告别 2016 时,也到时间定下我们的 **新年决心** 了。不管你身为 Linux 系统管理员的经验水平如何,我们认为,制定接下来 12 个月的成长目标是很值得的。
|
||||
|
||||
如果你还没什么想法,我们将会在这篇文章分享 10 个简单的专业提升决心,你可以为 2017 年考虑一下。
|
||||
|
||||
### 1. 决定更自动化
|
||||
|
||||
你没必要忙得像头无头苍蝇,每天忙于解决可预见的问题。如果你发现自己每天都花费时间在执行重复的任务,你有必要现在就停下来。
|
||||
|
||||
在了解了所有[基于 Linux 而且开源的工具][4]后,你可以尽可能地[自动化你的 Linux 任务][5]来给自己一些休闲的时间。
|
||||
|
||||
你会发现,接下来的几个决心会帮你在工作上朝着这个目标前进。所以继续看下去吧。
|
||||
|
||||
另外,帮自己一个忙,花费几分钟来浏览我们[免费的电子书][6]部分吧。
|
||||
|
||||
你将有机会下载跟[Bash shell 脚本编程][7]相关的书籍来提升你的技能。开心地自动化!
|
||||
|
||||
### 2\. 学习一门新的脚本语言
|
||||
|
||||
虽然每一个系统管理员应该熟练地使用 Bash 写脚本,但考虑一下其他更现代化、鲁棒性更强的工具也是很重要的,例如 Python。
|
||||
|
||||
不要只是相信我们说的话 —— 看看不久前我们发布的[两篇关于 Python 的系列文章][9]。你将会意识到,与其他相比,Python 带来了面向对象编程的力量,使您写出更短、鲁棒性更强的脚本。
|
||||
|
||||
### 3\. 学习一门新的编程语言
|
||||
|
||||
除了学习一门新的脚本语言,(你也可以)决定花费点时间来开始学习或者提升你的编程技能。不确定从何处开始?今年的 [Stackoverflow 开发者调查][10]表明 Javascript 连续第三年引领最流行语言的榜单。
|
||||
|
||||
其他经典例如 Java 和 C 也值得考虑。来看我们 [2016 年最好的编程课程][11]。
|
||||
|
||||
### 4\. 注册一个 Github 账户并且定期更新
|
||||
|
||||
特别是如果你是一个编程新手,你应该考虑一下在 Github 上展示你的成果。通过允许别人去复刻你的脚本或者程序,你就能提高知识水平,并通过别人的帮助创造出更复杂的软件。
|
||||
|
||||
在[《如何安装和注册 Github 帐号》][12]一文中了解更多。
|
||||
|
||||
### 5\. 向一个开源项目做贡献
|
||||
|
||||
在 Github 上向一个开源项目做贡献,这是另一个学习或者提高一门新脚本语言或者编程语言能力的好办法。
|
||||
|
||||
如果这吸引到了你的兴趣,点击 [Explore Github][13] 页面。这里你能按热度或者编程语言浏览仓库,你能在这里面找到一些有趣的事情来做。
|
||||
|
||||
在此基础上,你将因回馈社区而获得满足感。
|
||||
|
||||
|
||||
### 6\. 每月尝试一个新的发行版
|
||||
|
||||
经常会有新的发行版或者分支出现,你有不同的选项以供选择。谁知道你梦想中的发行版是否就在近前,而你还没发现它?每个月去一次 **Distrowatch** 然后选择一个新的发行版。
|
||||
|
||||
也别忘了[订阅 Techmint][14] 来获取新发行版的消息。
|
||||
|
||||
如果你想要尝试一个新的发行版,希望我们的评论能帮你做出决定。也可以点击我们这里关于最好的 Linux 发行版的文章:
|
||||
|
||||
- [2016年最好的 5 个注重安全的 Linux 发行版][1]
|
||||
- [2016年最值得期待的 Linux 发行版][2]
|
||||
- [2015年最流行的 10个 Linux 发行版][3]
|
||||
|
||||
### 7\. 参加一个 Linux 或者开源会议。
|
||||
|
||||
如果你住在由 Linux 基金会赞助的会议举办地附近,我强烈建议你去参加会议。
|
||||
|
||||
这不仅将会给你一个提高 Linux 知识的机会,而且将是个见见其他开源专家的机会。
|
||||
|
||||
### 8\. 从 Linux 基金会的免费或付费课程中学习
|
||||
|
||||
Linux 基金会分别通过 **edX.org** 和他们自己的门户,不断地提供免费或付费课程。
|
||||
|
||||
免费课程的话题包括(但不仅限于)Linux 介绍,云基础设施技术介绍和 OpenStack 介绍。
|
||||
|
||||
另一方面,付费课程包括 [LFCS 认证][16] 和 [LFCE 认证][17] 考试的准备,给开发者的 Linux ,内核内部构件,Linux 安全,性能试验,高可用性及其他。
|
||||
|
||||
另外,他们对企业课程有折扣,所以尝试去说服你上司来为你和你同事的训练付费。还有,也会提供周期性的免费在线研讨会,所以别忘了订阅他们的 newsletters!
|
||||
|
||||
你也可以考虑下看看我们最棒的[在线 Linux 训练课程][18]。
|
||||
|
||||
### 9\. 每周在 Linux 论坛上回答特定数量的问题
|
||||
|
||||
另一个回馈社区的好方法是帮助那些刚开始使用 Linux 的人。你将会发现网上的 Linux 论坛上有许多人正在寻找着答复。
|
||||
|
||||
牢记你曾经也是像他们那样是个新手,试着换位思考。
|
||||
|
||||
### 10\. 教一个孩子或少年使用 Linux
|
||||
|
||||
如果我能回到 20 年前,我希望我能有台电脑,有个能[在青年时学习 Linux ][19]的机会。
|
||||
|
||||
我也希望我能比当年还早很多地开始编程。毫无疑问,这样事情就会简单许多。我认为给孩子和青年教授至少是基础的 Linux 和编程技巧(我对我的孩子这样做)是个重要的尝试。
|
||||
|
||||
教育成长中的一代如何有效地使用开源技术将会给他们选择的自由,而他们会因此永远感激你。
|
||||
|
||||
##### 总结
|
||||
|
||||
在这篇文章里我们分享了 10 个适合系统管理员的可能新年决心。[Tecmint.com][20] 祝你在朝着目标的工作顺顺利利,希望你能在 2017 年成为我们网站的常客。
|
||||
|
||||
如果你有关于这篇文章的问题或者评论,请不要犹豫使用下面的表格提交。我们期待着收到您的信息。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
作者简介:
|
||||
|
||||
![](http://1.gravatar.com/avatar/d9d14c5b51331864398e6288cb0c2091?s=128&d=blank&r=g)
|
||||
|
||||
Gabriel Cánepa 是个 GNU/Linux 系统管理员和网页开发者,他来自阿根廷圣路易斯的 Villa Mercedes 。他供职于全球领先的消费品公司,享受在日常工作的方方面面使用 FOSS(自由及开源软件) 工具来提高生产效率。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/linux-system-administrators-new-years-resolutions-ideas/
|
||||
|
||||
作者:[Gabriel Cánepa][a]
|
||||
译者:[ypingcn](https://github.com/ypingcn)
|
||||
校对:[jasminepeng](https://github.com/jasminepeng)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: http://www.tecmint.com/author/gacanepa/
|
||||
[1]: http://www.tecmint.com/best-security-centric-linux-distributions-of-2016/
|
||||
[2]: http://www.tecmint.com/top-linux-distributions-to-look-forward-in-2016/
|
||||
[3]: http://www.tecmint.com/10-top-most-popular-linux-distributions-of-2015/
|
||||
[4]: http://www.tecmint.com/category/top-tools/
|
||||
[5]: http://www.tecmint.com/using-shell-script-to-automate-linux-system-maintenance-tasks/
|
||||
[6]: http://tecmint.tradepub.com/category/information-technology-servers-and-linux-server-os/806/
|
||||
[7]: http://tecmint.tradepub.com/free/w_syst05/?p=w_syst05
|
||||
[8]: http://www.tecmint.com/category/python/
|
||||
[9]: http://www.tecmint.com/learn-python-programming-and-scripting-in-linux/
|
||||
[10]: http://stackoverflow.com/research/developer-survey-2016#technology
|
||||
[11]: https://deals.tecmint.com/collections/best-of-bundles-2016
|
||||
[12]: http://www.tecmint.com/install-git-centos-fedora-redhat/
|
||||
[13]: https://help.github.com/articles/where-can-i-find-open-source-projects-to-work-on/
|
||||
[14]: http://subscribe.tecmint.com/newsletter
|
||||
[15]: http://events.linuxfoundation.org/
|
||||
[16]: http://www.tecmint.com/sed-command-to-create-edit-and-manipulate-files-in-linux/
|
||||
[17]: http://www.tecmint.com/installing-network-services-and-configuring-services-at-system-boot/
|
||||
[18]: http://www.tecmint.com/linux-online-training-courses/
|
||||
[19]: http://www.tecmint.com/free-online-linux-learning-guide-for-beginners/
|
||||
[20]: http://tecmint.com/
|
@ -1,18 +1,18 @@
|
||||
如何用 shell 跟踪跟踪命令在 shell 中的执行
|
||||
如何用 Shell Tracing 跟踪 shell 脚本中命令的执行
|
||||
============================================================
|
||||
|
||||
在本文的[ shell 脚本调试系列][3]中,我们将解释第三种 shell 脚本调试模式,即 shell 跟踪,并查看一些示例来演示它如何工作以及如何使用它。
|
||||
在[ shell 脚本调试系列][3] 中,本文将解释第三种 shell 脚本调试模式,即 shell tracing,并查看一些示例来演示它如何工作以及如何使用它。
|
||||
|
||||
本系列的前面部分清晰地阐明了另外两种 shell 脚本调试模式:verbose 模式和语法检查模式,以及如何在这些模式下启用 shell 脚本调试的易于理解的示例。
|
||||
|
||||
1. [如何在 Linux 中启用 shell 脚本调试模式 - 第1部分][1]
|
||||
2. [如何在 shell 脚本中执行语法检查调试模式 - 第2部分][2]
|
||||
|
||||
shell 跟踪只是跟踪 shell 脚本中的命令的执行。要打开 shell 跟踪,请使用 `-x` 调试选项。
|
||||
shell tracing 只是跟踪 shell 脚本中的命令的执行。要打开 shell tracing,请使用 `-x` 调试选项。
|
||||
|
||||
这让 shell 在终端上执行时显示所有命令及其参数。
|
||||
|
||||
我们将使用下面的 `sys_info.sh` shell 脚本,它会简要地打印你的系统日期和时间、登录的用户数和系统的运行时间。但是它包含我们需要查找和更正的语法错误。
|
||||
我们将使用下面的 `sys_info.sh` shell 脚本,它会简要地打印你的系统日期和时间、登录的用户数和系统的运行时间。脚本中包含我们需要查找和更正的语法错误。
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
@ -46,11 +46,11 @@ $ sudo bash -x sys_info.sh
|
||||
![Shell Tracing - Show Error in Script](http://www.tecmint.com/wp-content/uploads/2016/12/Shell-Tracing-Errors.png)
|
||||
][5]
|
||||
|
||||
shell 跟踪 - 显示脚本中的错误
|
||||
*shell 跟踪 - 显示脚本中的错误*
|
||||
|
||||
从上面的输出我们可以观察到,命令首先在其输出被替换为变量的值之前执行。
|
||||
从上面的输出我们可以观察到,首先执行命令,然后其输出做为一个变量的值。
|
||||
|
||||
例如,首次执行 date,其输出被替换为变量 DATE 的值。
|
||||
例如,先执行 date,其输出做为变量 DATE 的值。
|
||||
|
||||
我们可以执行语法检查,只显示语法错误,如下所示:
|
||||
|
||||
@ -61,9 +61,9 @@ $ sudo bash -n sys_info.sh
|
||||
![Syntax Checking in Script](http://www.tecmint.com/wp-content/uploads/2016/12/Syntax-Checking-in-Script.png)
|
||||
][6]
|
||||
|
||||
脚本中语法检查
|
||||
*脚本中语法检查*
|
||||
|
||||
如果我们批判地看这个 shell 脚本,我们就会发现 `if 语句`缺少了 `fi` 关键字。因此,让我们加上它,新的脚本应该看起来像这样:
|
||||
如果我们批判地看这个 shell 脚本,我们就会发现 `if 语句` 缺少了封闭条件的 `fi` 关键字。因此,让我们加上它,新的脚本应该看起来像这样:
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
@ -97,11 +97,11 @@ $ sudo bash -n sys_info.sh
|
||||
![Perform Syntax Check in Shell Scripts](http://www.tecmint.com/wp-content/uploads/2016/12/Syntax-Check-in-Shell-Scripts.png)
|
||||
][7]
|
||||
|
||||
在 shell 脚本中执行语法检查
|
||||
*在 shell 脚本中执行语法检查*
|
||||
|
||||
上面的语法检查操作的结果仍然显示在脚本的第 21 行还有一个错误。所以,我们仍然要纠正一些语法。
|
||||
|
||||
如果我们再分析一次脚本,第 21 行的错误是由于在 `print_sys_info` 函数内最后一个 [echo 命令][8]中没有闭合双引号`(”)`。
|
||||
再一次分析脚本,会发现第 21 行的错误是由于在 `print_sys_info` 函数内最后一个 [echo 命令][8]中没有闭合双引号`(”)`。
|
||||
|
||||
我们将在 echo 命令中添加闭合双引号并保存文件。修改过的脚本如下:
|
||||
|
||||
@ -128,7 +128,7 @@ print_sys_info
|
||||
exit 0
|
||||
```
|
||||
|
||||
现在在一次检查语法。
|
||||
现在再一次检查语法。
|
||||
|
||||
```
|
||||
$ sudo bash -n sys_info.sh
|
||||
@ -143,7 +143,7 @@ $ sudo bash -x sys_info.sh
|
||||
![Trace Shell Script Execution](http://www.tecmint.com/wp-content/uploads/2016/12/Trace-Shell-Execution.png)
|
||||
][9]
|
||||
|
||||
跟踪 shell 脚本执行
|
||||
*跟踪 shell 脚本执行*
|
||||
|
||||
现在运行脚本。
|
||||
|
||||
@ -154,7 +154,7 @@ $ sudo ./sys_info.sh
|
||||
![Shell Script to Show Date, Time and Uptime](http://www.tecmint.com/wp-content/uploads/2016/12/Script-to-Show-Date-and-Uptime.png)
|
||||
][10]
|
||||
|
||||
用 shell 脚本显示日期、时间和运行时间
|
||||
*用 shell 脚本显示日期、时间和运行时间*
|
||||
|
||||
### shell 跟踪执行的重要性
|
||||
|
||||
@ -169,9 +169,9 @@ fi
|
||||
}
|
||||
```
|
||||
|
||||
这里的魔法是由 `if 语句`表达式 `["$ UID" -ne "$ ROOT_ID"]` 控制的,一旦我们不使用合适的数字运算符(示例中为 `-ne`,这意味着不相等),我们最终会出现一个可能的逻辑错误。
|
||||
这里的魔法是由 `if 语句` 表达式 `["$ UID" -ne "$ ROOT_ID"]` 控制的,一旦我们不使用合适的数字运算符(示例中为 `-ne`,这意味着不相等),我们最终可能会出一个逻辑错误。
|
||||
|
||||
假设我们使用 `-eq` (意思等于),这将允许任何系统用户以及 root 用户运行脚本,因此是一个逻辑错误。
|
||||
假设我们使用 `-eq` (意思是等于),这将允许任何系统用户以及 root 用户运行脚本,因此是一个逻辑错误。
|
||||
|
||||
```
|
||||
check_root(){
|
||||
@ -182,9 +182,9 @@ fi
|
||||
}
|
||||
```
|
||||
|
||||
注意:我们在本系列开头介绍的到 set 这个 shell 内置命令可以在shell脚本的特定部分激活调试。
|
||||
注意:我们在本系列开头介绍过,set 这个 shell 内置命令可以在 shell 脚本的特定部分激活调试。
|
||||
|
||||
因此,下面的行将帮助我们通过跟踪它在函数中的执行找到这个逻辑错误:
|
||||
因此,下面的行将帮助我们通过跟踪脚本的执行在其中找到这个逻辑错误:
|
||||
|
||||
具有逻辑错误的脚本:
|
||||
|
||||
@ -212,7 +212,7 @@ print_sys_info
|
||||
exit 0
|
||||
```
|
||||
|
||||
保存文件并调用脚本,在输出中,我们可以看到一个普通的系统用户可以没有 sudo 运行脚本。 这是因为 USER_ID 的值为100,不等于 ROOT_ID 为 0 的 root。
|
||||
保存文件并调用脚本,在输出中,我们可以看到一个普通系统用户可以在未 sudo 的情况下运行脚本。 这是因为 **USER_ID** 的值为 100,不等于 **ROOT_ID** 为 **0** 的 root。
|
||||
|
||||
```
|
||||
$ ./sys_info.sh
|
||||
@ -221,9 +221,9 @@ $ ./sys_info.sh
|
||||
![Run Shell Script Without Sudo](http://www.tecmint.com/wp-content/uploads/2016/12/Run-Shell-Script-Without-Sudo.png)
|
||||
][11]
|
||||
|
||||
不用 sudo 运行 shell 脚本
|
||||
**未 sudo 的情况下运行 shell 脚本**
|
||||
|
||||
那么,现在我们已经到了[ shell 脚本调试系列][12]的末尾,可以在下面的反馈栏里给我们关于本篇或者本系列提出问题或反馈。
|
||||
那么,现在我们已经完成了[ shell 脚本调试系列][12],可以在下面的反馈栏里给我们关于本篇或者本系列提出问题或反馈。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -231,7 +231,7 @@ $ ./sys_info.sh
|
||||
|
||||
![](http://1.gravatar.com/avatar/4e444ab611c7b8c7bcb76e58d2e82ae0?s=128&d=blank&r=g)
|
||||
|
||||
Aaron Kili 是 Linux 和 F.O.S.S 爱好者,将来的 Linux SysAdmin、web开 发人员,目前是 TecMint 的内容创作者,他喜欢用电脑工作,并坚信分享知识。
|
||||
Aaron Kili 是 Linux 和 F.O.S.S 爱好者,将来的 Linux SysAdmin、web 开 发人员,目前是 TecMint 的内容创作者,他喜欢用电脑工作,并坚信分享知识。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -239,7 +239,7 @@ via: http://www.tecmint.com/trace-shell-script-execution-in-linux/
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[jasminepeng](https://github.com/jasminepeng)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
|
@ -33,9 +33,7 @@
|
||||
|
||||
通常,我们在准备职业生涯时所考虑的最后一件事是所谓的 *软技能* - 社交和沟通技巧 - 但是他们可能是最有可能决定你的成功的技能。无论你正在寻找一份新工作,还是试图适应当前职业生涯的变化,软技能是至关重要的。
|
||||
|
||||
划分 IT 各个领域的线是交错的,并且良好的沟通能力使得这些模糊的线成为一个优点,而不是绊脚石。我们生活在一个开发人员围绕着服务器,而操作团队正在编写 Ruby 代码来维护服务器农场的世界里。这些都是 IT 中的大胆的新思想,没有人能够在不同学科之间沟通,工作场所迅速变得敌对。此外,IT 人员总是需要与其他业务领域的人员进行有效沟通。如果有什么,现在比以往有更大的需求。
|
||||
|
||||
The lines dividing the various areas of IT are blending, and the ability to communicate well makes those blurred lines an advantage instead of a stumbling block. We live in a world in which developers are spinning up servers, and operations teams are writing Ruby code to maintain server farms. These are bold new ideas in IT, and without people able to communicate between disciplines, the workplace becomes hostile quickly. Plus, IT folks have always needed to communicate effectively with people in other areas of business. If anything, that need is greater now than ever.
|
||||
划分 IT 各个领域的线是交错的,并且良好的沟通能力使得这些模糊的线成为一个优点,而不是绊脚石。我们正生活在一个开发人员围绕着服务器,而运维团队编写 Ruby 代码来维护服务器农场的世界里。这些都是 IT 中的大胆的新思想,如果人们不能在不同部门间很好的沟通,工作场所将迅速有敌对气氛。此外,IT 人员总是需要与其他业务领域的人员进行有效沟通。而且,现在比以往有更大的需求。
|
||||
|
||||
|
||||
你计划在 2017 年里添加什么到你的技能中?在评论栏中让我们知道吧。
|
||||
|
@ -1,72 +1,72 @@
|
||||
How to change the Linux I/O scheduler to fit your needs
|
||||
如何更改Linux I/O 调度器来满足你的需求
|
||||
============================================================
|
||||
|
||||
In order to eek out as much performance from Linux servers as possible, learn how to change your I/O scheduler to meet your needs.
|
||||
|
||||
为了从 Linux 服务器尽可能多地榨取性能,请了解如何更改 I/O 调度器以满足你的需求。
|
||||
|
||||
![](http://tr1.cbsistatic.com/hub/i/r/2016/05/04/f765c3c7-ee08-4f3a-876a-66137ad4e6df/resize/770x/131c6931386ecf37104e8ada8d01e903/hackershero.jpg)
|
||||
|
||||
|
||||
The Linux I/O scheduler controls the way the kernel commits read and writes to disk. Since the 2.6 kernel, administrators have been able to change the scheduler, so they can customize their platforms to perfectly suit their needs.
|
||||
Linux I/O 调度器控制内核提交读取和写入磁盘的方式。自从 2.6 内核以来,管理员已经能够更改调度器,所以他们可以自定义他们的平台以完全适合他们的需要。
|
||||
|
||||
There are three schedulers to choose from, and each one has its benefits. Those schedulers are:
|
||||
有三个调度器可供选择,每个调度器都有其优点。这些调度器是:
|
||||
|
||||
* **CFQ (cfq):** the default scheduler for many Linux distributions; it places synchronous requests, submitted by processes, into a number of per-process queues and then allocates timeslices for each of the queues to access the disk.
|
||||
* **Noop scheduler (noop):** the simplest I/O scheduler for the Linux kernel based on the First In First Out (FIFO) queue concept. This scheduler is best suited for SSDs.
|
||||
* **Deadline scheduler (deadline):** attempts to guarantee a start service time for a request.
|
||||
* **CFQ(cfq):** 许多 Linux 发行版的默认调度器;它将由进程提交的同步请求放到多个进程队列中,然后为每个队列分配时间片以访问磁盘。
|
||||
* **Noop调度器(noop):** 基于先入先出(FIFO)队列概念的 Linux 内核最简单的 I/O 调度器。此调度程序最适合于SSD。
|
||||
* **截止时间调度器(deadline):** 尝试保证请求的开始服务时间。
|
||||
|
||||
|
||||
When you want to squeeze the most performance out of your Linux-powered machines, this might be one of the areas you turn. Fortunately, it is quite simple to change the scheduler that powers I/O. Let me show you how.
|
||||
当你想要利用 Linux 驱动的机器来获得最佳性能时,这可能是你所要做的事情之一。幸运的是,更改 I/O 调度器非常简单。让我告诉你怎么做。
|
||||
|
||||
### Finding out which scheduler you have
|
||||
### 找出你有的调度器
|
||||
|
||||
The first thing you need to do is find out which scheduler is handling I/O on your system. This is done from the command line, and you must know the name of your disk. For simplicity sake, I'll assume the disk is question is sda. With that information in hand, open a terminal window and issue the following command:
|
||||
你需要做的第一件事是找出哪个调度器正在处理系统上的 I/O。这是从命令行完成的,你必须知道磁盘的名称。为简单起见,我假设磁盘是 sda。使用该信息,打开终端窗口并输入以下命令:
|
||||
|
||||
```
|
||||
cat /sys/block/sda/queue/scheduler
|
||||
```
|
||||
|
||||
The results of the command will display the current running scheduler (**Figure A**).
|
||||
该命令的结果将显示当前运行的调度程序(**图 A**)。
|
||||
|
||||
**Figure A**
|
||||
**图 A**
|
||||
|
||||
![Figure A](http://tr3.cbsistatic.com/hub/i/2017/01/03/abba7f22-3252-4b76-91c0-bb15630fd42c/6b4a6d971202b70926b2d991e6c9afe3/schedulera.jpg)
|
||||
|
||||
Elementary OS Loki running the noop scheduler.
|
||||
Elementary OS Loki 运行 noop 调度器。
|
||||
|
||||
### Changing your scheduler
|
||||
### 更改你的调度器
|
||||
|
||||
You can change your scheduler in two ways: on the fly or persistently. If you change the scheduler on the fly, it can revert to the default scheduler (after a reboot). You might want to do an on the fly change first, to see which scheduler brings about the best performance for your needs.
|
||||
你可以通过两种方式更改你的调度器:即时或永久。如果你随时更改调度器,它可以恢复到默认调度器(重启后)。你可能希望首先进行即时更改,以查看哪个调度器能为你的需求带来最佳性能。
|
||||
|
||||
Say you want to change to the noop scheduler on the fly. To do this, you would issue the following command:
|
||||
说到你要即时改到 noop 调度器。 为此,输入以下命令:
|
||||
|
||||
```
|
||||
sudo echo noop > /sys/block/hda/queue/scheduler
|
||||
```
|
||||
|
||||
You can change _noop_ to _cfq_, or _deadline_.
|
||||
你可以将 _noop_ 更改为 _cfq_ 或 _deadline_。
|
||||
|
||||
This change can be done without having to reboot your machine. Once changed, the I/O scheduler will switch and (hopefully) you'll see a performance increase (again, depending upon your needs).
|
||||
此更改可以在不重新启动计算机的情况下完成。 一旦更改,I/O 调度器将会切换,(希望)你能看到性能提高(再说一次,根据你的需要而定)。
|
||||
|
||||
If you want to change the scheduler to be persistent, you must do this within the GRUB configuration file. To do that, issue the command sudo nano /etc/default/grub and then change the line:
|
||||
如果要将调度器更改为永久,则必须在 GRUB 配置文件中执行此操作。 为此,请输入 sudo nano /etc/default/grub,然后修改下面的行:
|
||||
|
||||
```
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
|
||||
```
|
||||
|
||||
to
|
||||
到
|
||||
|
||||
```
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop"
|
||||
```
|
||||
|
||||
Again, you can change noop to whatever scheduler you need. If you make this change after you do an on the fly change, you won't have to do a reboot to have the new scheduler take effect.
|
||||
同样,你可以改变 noop 到任何你需要的调度器。如果你用的是即时修改,则不必重新启动以使新调度器生效。
|
||||
|
||||
That's all there is to it.
|
||||
这些就是修改调度器的方法了。
|
||||
|
||||
### Choose wisely
|
||||
### 做出明智的选择
|
||||
|
||||
You should do research to find out what scheduler is best suited for your particular situation. To find out more about each scheduler, check out these Wiki pages: [CFS][7], [Noop][8], and [Deadline][9].
|
||||
你应该做研究,找出什么调度器最适合你的特殊情况。要了解每个调度器的更多信息,请查看这些 Wiki 页面:[CFS][7]、[Noop][8]和 [Deadline][9]。
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@ -74,7 +74,7 @@ You should do research to find out what scheduler is best suited for your partic
|
||||
via: http://www.techrepublic.com/article/how-to-change-the-linux-io-scheduler-to-fit-your-needs/
|
||||
|
||||
作者:[Jack Wallen ][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
@ -1,46 +1,46 @@
|
||||
Speed up your downloads with Axel command line downloader/accelerator
|
||||
使用 Axel 命令行下载器/加速器加速你的下载
|
||||
============================================================
|
||||
|
||||
[Axel][7] is a lightweight download utility, it does the same thing how other accelerator does. It opens multiple connections for one file and each connections download separate file fragment to complete the download more quickly.
|
||||
[Axel][7] 是一个轻量级下载程序,它如其他加速器那样做着同样的事情。它为一个文件打开多个连接,每个连接下载单独的文件片段以更快地完成下载。
|
||||
|
||||
Axel supports HTTP, HTTPS, FTP and FTPS protocols. It can also use multiple mirrors for single file download. So, Axel can speed up a download up to 40% (approximately, i personally realized). It’s very lightweight because no dependencies and uses very less CPU & RAM.
|
||||
Axel支持 HTTP】HTTPS、FTP和 FTPS 协议。它也可以使用多个镜像下载单个文件。所以,Axel 可以加速下载高达 40%(大约,我个人认为)。它非常轻量级,因为它没有依赖并且使用非常少的 CPU 和 RAM。
|
||||
|
||||
Axel downloads all the data directly to the destination file, using one single thread.
|
||||
Axel 使用一个单线程将所有数据直接下载到目标文件。
|
||||
|
||||
Note : There is no option to download the two file in single command
|
||||
注意:没有选项可以在单条命令中下载两个文件
|
||||
|
||||
You can also try alternative Command Line Download Managers/Accelerators
|
||||
你还可以尝试其他命令行下载管理器/加速器
|
||||
|
||||
* [aria2 – The ultra fast download utility][1]
|
||||
* [wget – Standard command line download utility][2]
|
||||
* [curl – command line download utility][3]
|
||||
* [Best 4 Command Line Download Managers/Accelerators for Linux][4]
|
||||
* [[aria2 - 超快速下载程序] [1]
|
||||
* [[wget - 标准命令行下载程序] [2]
|
||||
* [[curl - 命令行下载程序] [3]
|
||||
* [[Linux 下的最好的 4 个命令行下载管理器/加速器] [4]
|
||||
|
||||
Most of the distribution (Debian, Ubuntu, Mint, Fedora, suse, openSUSE, Arch Linux, Manjaro, Mageia, etc.) has the axel package so we can easily install it from distribution official repository. For CentOS/RHEL we need to enable [EPEL Repository][5].
|
||||
大多数发行版(Debian、Ubuntu、Mint、Fedora、suse、openSUSE、Arch Linux、Manjaro、Mageia等)都有 axel 包,所以我们可以从发行版官方仓库轻松安装。对于CentOS/RHEL,我们需要启用[EPEL Repository][5]。
|
||||
|
||||
```
|
||||
[Install Axel on Debian/Ubuntu/LinuxMint]
|
||||
[在 Debian/Ubuntu/LinuxMint 上安装 Axel]
|
||||
$ sudo apt-get install axel
|
||||
|
||||
[Install Axel on RHEL/CentOS]
|
||||
[在 RHEL/CentOS 上安装 Axel]
|
||||
$ sudo yum install axel
|
||||
|
||||
[Install Axel on Fedora]
|
||||
[在 Fedora 上安装 Axel]
|
||||
$ sudo dnf install axel
|
||||
|
||||
[Install Axel on openSUSE]
|
||||
[在 openSUSE 上安装 Axel]
|
||||
$ sudo zypper install axel
|
||||
|
||||
[Install Axel on Mageia]
|
||||
[在 Mageia 上安装 Axel]
|
||||
$ sudo urpmi axel
|
||||
|
||||
[Install Axel on Arch Linux based system]
|
||||
[在基于 Arch Linux 的发行版安装 Axel]
|
||||
$ sudo pacman -S axel
|
||||
```
|
||||
|
||||
#### 1) Download Single File
|
||||
#### 1) 下载单个文件
|
||||
|
||||
The below command will download the file from given URL and stores in current directory, while downloading the file we can see the (No of connection established, download speed, download progress, how much time it took to complete the download & where connection finished) of file.
|
||||
以下命令将从给定的 URL 下载文件并存储在当前目录中,而下载文件时,我们可以看到文件的信息(建立的连接数、下载速度、下载进度、完成下载所花费的时间以及连接完成的时间)。
|
||||
|
||||
```
|
||||
# axel https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2
|
||||
@ -74,9 +74,9 @@ Connection 1 finished
|
||||
Downloaded 21.6 megabytes in 3 seconds. (5755.94 KB/s)
|
||||
```
|
||||
|
||||
#### 2) Save the file with different name
|
||||
#### 2) 用不同的名称保存文件
|
||||
|
||||
You can save the file with different name while initiate downloading by adding -o (lowercase) option followed by file name. Here we are going to save the filename with owncloud.tar.bz2.
|
||||
你可以通过添加 -o(小写)选项和文件名来启动下载,并使用其他名称来保存文件。这里我们使用 owncloud.tar.bz2 作为保存文件名。
|
||||
|
||||
```
|
||||
# axel -o cloud.tar.bz2 https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2
|
||||
@ -112,9 +112,9 @@ Connection 1 finished
|
||||
Downloaded 21.6 megabytes in 3 seconds. (6001.05 KB/s)
|
||||
```
|
||||
|
||||
#### 3) Limit download speed
|
||||
#### 3) 限制下载速度
|
||||
|
||||
By default axel Set the maximum speed for downloading file in Bytes per Second. We can use this option when we have a slow network connection. Just add `-s` option followed by bytes value. Here we are going to download a file with `512KB/s`.
|
||||
默认上 axel 以字节/秒为单位设置下载文件的最大速度。当我们的网络连接速度较慢时,我们可以使用此选项。只需添加 `-s` 选项,后面跟字节值。这里我们要下载一个限速为 `512 KB/s` 的文件。
|
||||
|
||||
```
|
||||
# axel -s 512000 https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2
|
||||
@ -148,9 +148,9 @@ Connection 3 finished
|
||||
Downloaded 21.6 megabytes in 44 seconds. (494.54 KB/s)
|
||||
```
|
||||
|
||||
#### 4) Limit the Connections
|
||||
#### 4) 限制连接数
|
||||
|
||||
By default axel establish 4 connection to get the file from different mirrors. Additionally we can boost the download speed by adding more connection with `-n` option followed by connections count `8`. We have added eight connection for safer side but unfortunately it took much time to get the file downloaded.
|
||||
axel 默认建立 4 个连接以从不同的镜像获取文件。此外,我们可以通过使用 `-n` 选项添加更多的连接,后跟连接数 `8` 来提高下载速度。我们为了更安全新添加了八个连接,但不幸的是,它花了更多时间来下载文件。
|
||||
|
||||
```
|
||||
# axel -n 10 https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2
|
||||
@ -190,9 +190,9 @@ Connection 3 finished
|
||||
Downloaded 21.6 megabytes in 5 seconds. (4109.41 KB/s)
|
||||
```
|
||||
|
||||
#### 5) Resume Incomplete download
|
||||
#### 5) 恢复未完成的下载
|
||||
|
||||
By default axel have the behavior of Resume Incomplete download. Axel used to update the state file `(.st extension)` regularly while downloading the file. Due to some reason, the download get hang in middle ? don’t worry, just use the same axel command which will check `file` & `file.st`, if found, download is resumed where it stopped.
|
||||
axel 默认具有恢复未完成的下载的行为。Axel 在下载文件时定期更新状态文件(扩展名为 .st)。由于某些原因,下载中途停止了?不用担心,只要使用相同的 axel 命令,它将会检查 `file` 和 `file.st`,如果找到,它会从停止处恢复下载。
|
||||
|
||||
```
|
||||
# axel https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2
|
||||
@ -220,7 +220,7 @@ Starting download
|
||||
Downloaded 18.3 megabytes in 2 seconds. (7009.79 KB/s)
|
||||
```
|
||||
|
||||
The following output clearly showing two files `owncloud-9.0.0.tar.bz2` & `owncloud-9.0.0.tar.bz2.st` when we disconnect the download. When re initiating the download again, it starts exactly where it stopped before.
|
||||
上面的输出清晰地显示了在下载断开时有两个文件 `owncloud-9.0.0.tar.bz2` 和 `owncloud-9.0.0.tar.bz2.st`。当重新开始下载时,它会从停止处开始下载。
|
||||
|
||||
```
|
||||
# ls -lh
|
||||
@ -257,17 +257,17 @@ Connection 0 finished
|
||||
Downloaded 3415.4 kilobytes in 1 second. (2264.93 KB/s)
|
||||
```
|
||||
|
||||
#### 6) Get the file without progress
|
||||
#### 6) 不显示文件下载进度
|
||||
|
||||
If you don’t want to see the file download progress, simply add `-q` option with axel command.
|
||||
如果你不想要看到文件的下载进度,只要在 axel 命令中加入 `-q` 选项。
|
||||
|
||||
```
|
||||
# axel -q https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2
|
||||
```
|
||||
|
||||
#### 7) Alternate progress indicator
|
||||
#### 7) 替换进度条
|
||||
|
||||
If you don’t like the default progress bar, you can use alternate progress indicator by adding -a option with axel command.
|
||||
如果你不喜欢默认的进度条,你可以使用 -a 选项来替换进度条。
|
||||
|
||||
```
|
||||
# axel -a https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2
|
||||
@ -281,7 +281,7 @@ Starting download
|
||||
Downloaded 14.3 megabytes in 2 seconds. (5916.11 KB/s)
|
||||
```
|
||||
|
||||
We have interrupted the above download to show you the alternate progress indicator status clearly while downloading the file. Once the file get downloaded successfully you can see the same output like below.
|
||||
我们已经了中断上面的下载,以便在下载文件时能清楚地显示替代进度条状态。一旦文件成功下载后,你可以看到相同的输出,如下所示。
|
||||
|
||||
```
|
||||
# axel -a https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2
|
||||
@ -297,24 +297,24 @@ Connection 0 finished ]
|
||||
Downloaded 21.6 megabytes in 4 seconds. (5062.32 KB/s)
|
||||
```
|
||||
|
||||
#### 8) Read more about axel
|
||||
#### 8) 阅读更多关于 axel
|
||||
|
||||
If you want to know more option which is available for axel, simply navigate to man page.
|
||||
如果你想要了解更多关于 axel 的内容,只需要进入它的手册。
|
||||
|
||||
```
|
||||
# man axel
|
||||
or
|
||||
或者
|
||||
# axel --help
|
||||
```
|
||||
|
||||
Enjoy…)
|
||||
享受吧。。。)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.2daygeek.com/axel-command-line-downloader-accelerator-for-linux/
|
||||
|
||||
作者:[ MAGESH MARUTHAMUTHU][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
@ -0,0 +1,177 @@
|
||||
PhotoRec – Recover Deleted or Lost Files in Linux
|
||||
============================================================
|
||||
在 Linux 系统下使用 PhotoRec 工具来恢复已删除或丢失的文件
|
||||
|
||||
当你在系统中有意或无意地使用 'shift + delete‘ 组合键或者删除选项或是清空回收站的方式来删除一个文件时,该文件的内容并没有从硬盘(或是其它存储设备)上直接销毁。
|
||||
|
||||
它仅仅是从系统的目录结构中被移除,然后你在删除文件的目录下就看不到该文件了,但是这个文件仍然存在你磁盘中的某个位置上。
|
||||
|
||||
如果你有一个合适的工具和相关的专业知识,你就可以[从电脑中恢复已丢失的文件][1]。然而,随着你存储的文件越来越多,删除的文件将会被覆盖,你只能恢复最近删除的文件。
|
||||
|
||||
在这篇文章中,我们将阐明如何在 Linux 系统中使用磁盘分区修复工具来恢复硬盘上已删除或丢失的文件,这个非常优秀的免费修复工具叫做 PhotoRec 。
|
||||
|
||||
PhoteRec 工具用于从存储介质比如硬盘,数码相机和 cdrom 设备中恢复丢失的文件。
|
||||
|
||||
### 在 Linux 系统中安装磁盘分区修复工具(PhotoRec)
|
||||
|
||||
在系统中执行以下相关的命令来安装磁盘分区修复工具:
|
||||
|
||||
```
|
||||
------- On Debian/Ubuntu/Linux Mint -------
|
||||
$ sudo apt-get install testdisk
|
||||
------- On CentOS/RHEL/Fedora -------
|
||||
$ sudo yum install testdisk
|
||||
------- On Fedora 22+ -------
|
||||
$ sudo dnf install testdisk
|
||||
------- On Arch Linux -------
|
||||
$ pacman -S testdisk
|
||||
------- On Gentoo -------
|
||||
$ emerge testdisk
|
||||
```
|
||||
|
||||
如果你的 Linux 系统 yum 源仓库中没有这个安装包,可以从 [这里][2] 下载然后在 Live CD 中运行即可。
|
||||
|
||||
这个安装包也可以在其它应急修复 CD 工具中找到,比如 Gparted LiveCD 、 Parted Magic 、 Ubuntu Boot CD 、 Ubuntu-Rescue-Remix 及其它工具中也有。
|
||||
|
||||
安装完成之后,使用 root 账号权限打开控制台界面,启动 PhotoRec 工具,并指定已删除文件的分区:
|
||||
|
||||
```
|
||||
$ sudo photorec /dev/sda3
|
||||
```
|
||||
|
||||
你将会看到下面的交互界面:
|
||||
|
||||
[
|
||||
![PhotoRec Data Recovery Tool for Linux](http://www.tecmint.com/wp-content/uploads/2017/01/PhotoRec-Data-Recovery-Tool.png)
|
||||
][3]
|
||||
|
||||
Linux 系统 PhotoRec 数据恢复工具
|
||||
|
||||
使用左右箭头选择菜单选项,按 Enter 键确认。要继续恢复操作,选择 '[继续]' 并单击 Enter。
|
||||
|
||||
你将看到下面的界面:
|
||||
|
||||
[
|
||||
![Select Partition to Proceed File Recovery](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Partition-to-Proceed-File-Recovery.png)
|
||||
][4]
|
||||
|
||||
选择分区进行文件恢复
|
||||
|
||||
选择 '[选项]' 来查看可用的恢复选项,如下图所示:
|
||||
|
||||
[
|
||||
![Linux File Recovery Options](http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Options.png)
|
||||
][5]
|
||||
|
||||
Linux 系统文件恢复选项
|
||||
|
||||
按 `Q` 返回,在下图界面,你可以指定你想要查询并恢复的文件扩展名。因此,选择 '[文件选项]' ,按 Enter 键确认。
|
||||
|
||||
按 's' 停止或启用所有文件扩展名,如果你已经停止所有文件扩展,只需要使用向右箭头选择你想要恢复的文件类型即可(或者按向左箭头取消选择)。
|
||||
|
||||
例如,我想恢复所有系统中丢失的 ’.mov‘ 类型的文件:
|
||||
|
||||
[
|
||||
![Specify Recovery File Type](http://www.tecmint.com/wp-content/uploads/2017/01/Specify-Recovery-File-Type.png)
|
||||
][6]
|
||||
|
||||
指定恢复文件类型
|
||||
|
||||
按 ‘b’ 键保存设置,之后你应该看到如下图所示信息。单击 Enter 键返回(或者按 ‘Q' 键),再将按 ’Q' 键返回到主界面。
|
||||
|
||||
[
|
||||
![Save File Recovery Settings](http://www.tecmint.com/wp-content/uploads/2017/01/Save-File-Recovery-Settings.png)
|
||||
][7]
|
||||
|
||||
保存文件恢复设置
|
||||
|
||||
现在选择 '[查询]' 开始文件恢复。在下图中,选择存储文件分区的文件系统类型,然后按 Enter 键。
|
||||
|
||||
[
|
||||
![Select Filesystem to Recover Deleted Files](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Recover-Files.png)
|
||||
][8]
|
||||
|
||||
选择文件系统类型来恢复删除的文件
|
||||
|
||||
下一步,如下图所示,选择是否对空闲空间或者是整个分区进行分析。注意选择整个分区将会让操作过程变得更长更慢。选择合适的选项后,按 Enter 键继续。
|
||||
|
||||
[
|
||||
![Choose Filesystem to Analyze](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Analyze.png)
|
||||
][9]
|
||||
|
||||
选择文件系统进行分析
|
||||
|
||||
注意选择一个目录用于存储将要恢复的文件,选择完成之后,按 ’C' 键继续。选择不同分区的目录以避免当更多的文件存储在这个分区时覆盖掉已删除的文件。
|
||||
|
||||
按向左箭头返回到根分区下。
|
||||
|
||||
[
|
||||
![Select Directory to Save Recovered Files](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Directory-to-Save-Recovered-Files.png)
|
||||
][10]
|
||||
|
||||
选择要保存恢复文件的目录
|
||||
|
||||
下图显示正在被恢复的指定类型的已删除文件。你可以按 Enter 键来停止操作。
|
||||
|
||||
注意:在恢复的过程中,你的系统会变得很慢,很可能会卡住一段时间,请耐心等待直至恢复完成。
|
||||
|
||||
[
|
||||
![Recovering Deleted Files in Linux](http://www.tecmint.com/wp-content/uploads/2017/01/Recover-Deleted-Files-in-Linux.png)
|
||||
][11]
|
||||
|
||||
在 Linux 系统中恢复已删除的文件
|
||||
|
||||
最后, Photorec 工具将会显示出已恢复文件的数量及保存的路径。
|
||||
|
||||
[
|
||||
![Linux File Recovery Summary](http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Summary.png)
|
||||
][12]
|
||||
|
||||
Linux 文件恢复总结
|
||||
|
||||
默认情况下,已恢复的文件将会以 root 账号权限被保存,因此,你需要以提升权限的方式打开文件管理器来访问这些文件。
|
||||
|
||||
使用如下命令(指定你的文件管理器):
|
||||
|
||||
```
|
||||
$ gksudo nemo
|
||||
or
|
||||
$ gksudo nautilus
|
||||
```
|
||||
|
||||
想了解更多的信息,访问 PhotoRec 官网: [http://www.cgsecurity.org/wiki/PhotoRec][13]。
|
||||
|
||||
到此为止吧!在这篇文章中,我们阐明了使用 PhotoRec 工具来恢复磁盘中已删除或丢失文件每一个步骤。这是目前为止我使用过的最可靠和有效的恢复工具,如果你知道还有其它相似的工具,请在评论中跟大家分享。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
![](http://1.gravatar.com/avatar/4e444ab611c7b8c7bcb76e58d2e82ae0?s=128&d=blank&r=g)
|
||||
|
||||
Aaron Kili 是一个 Linux 系统及 F.O.S.S 爱好者,即将成为一名系统管理员及 Web 开发人员,他现在是 TecMint 网站的内容创建者,他喜欢使用电脑来工作,并且他坚信分享知识是一种美德。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/photorec-recover-deleted-lost-files-in-linux/
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
译者:[rusking](https://github.com/rusking)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/aaronkili/
|
||||
[1]:http://www.tecmint.com/recover-deleted-file-in-linux/
|
||||
[2]:http://www.cgsecurity.org/wiki/TestDisk_Download
|
||||
[3]:http://www.tecmint.com/wp-content/uploads/2017/01/PhotoRec-Data-Recovery-Tool.png
|
||||
[4]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Partition-to-Proceed-File-Recovery.png
|
||||
[5]:http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Options.png
|
||||
[6]:http://www.tecmint.com/wp-content/uploads/2017/01/Specify-Recovery-File-Type.png
|
||||
[7]:http://www.tecmint.com/wp-content/uploads/2017/01/Save-File-Recovery-Settings.png
|
||||
[8]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Recover-Files.png
|
||||
[9]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Analyze.png
|
||||
[10]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Directory-to-Save-Recovered-Files.png
|
||||
[11]:http://www.tecmint.com/wp-content/uploads/2017/01/Recover-Deleted-Files-in-Linux.png
|
||||
[12]:http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Summary.png
|
||||
[13]:http://www.cgsecurity.org/wiki/PhotoRec
|
@ -1,41 +1,40 @@
|
||||
yangmingming translating
|
||||
12 Useful Commands For Filtering Text for Effective File Operations in Linux
|
||||
为了在 Linux 下更有效的进行文件操作的 12 个有用的过滤文本的命令
|
||||
============================================================
|
||||
|
||||
In this article, we will review a number of command line tools that act as filters in Linux. A filter is a program that reads standard input, performs an operation upon it and writes the results to standard output.
|
||||
在这篇文章中,我们将会复习一些可以作为 Linux 中的过滤器的命令行工具。过滤器是一个程序,它从标准输入读取数据,在数据上执行一个操作,然后把输出结果输出到标准输出。
|
||||
|
||||
For this reason, it can be used to process information in powerful ways such as restructuring output to generate useful reports, modifying text in files and many other system administration tasks.
|
||||
出于这样的原因,它可以被用于以一种强大的方式处理信息,例如重新结构化输出以生成有用的报告,修改文件里面的文本,和其他的一些系统管理任务。
|
||||
|
||||
With that said, below are some of the useful file or text filters in Linux.
|
||||
说到这里,下面是 Linux 上的一些有用的文件或者文本过滤器。
|
||||
|
||||
### 1\. Awk Command
|
||||
### 1\. Awk 命令
|
||||
|
||||
Awk is a remarkable pattern scanning and processing language, it can be used to build useful filters in Linux. You can start using it by reading through our [Awk series Part 1 to Part 13][7].
|
||||
Awk 是一个卓越的模式扫描和处理语言,它可被用于在 Linux 下构造有用的过滤器。你可以通过阅读我们的 [Awk 系列从 1 到 13][7] 来开始使用它。
|
||||
|
||||
Additionally, also read through the awk man page for more info and usage options:
|
||||
另外,也可以通过阅读 awk 的 man 手册来获取更多的信息和使用选项。
|
||||
|
||||
```
|
||||
$ man awk
|
||||
```
|
||||
|
||||
### 2\. Sed Command
|
||||
### 2\. Sed 命令
|
||||
|
||||
sed is a powerful stream editor for filtering and transforming text. We’ve already written a two useful articles on sed, that you can go through it here:
|
||||
sed 是一款为了过滤和转换文本的强大的流编辑器。我们已经写了两篇关于 sed 的有用的文章,你可以通过这儿来了解:
|
||||
|
||||
1. [How to use GNU ‘sed’ Command to Create, Edit, and Manipulate files in Linux][1]
|
||||
2. [15 Useful ‘sed’ Command Tips and Tricks for Daily Linux System Administration Tasks][2]
|
||||
1. [如何使用 GNU ‘sed’ 命令在 Linux 下创建、编辑和处理文件][1]
|
||||
2. [日常 Linux 系统管理员任务使用的 15 个有用的 ‘sed’ 命令小贴士和技巧][2]
|
||||
|
||||
The sed man page has added control options and instructions:
|
||||
sed 的 man 手册已经添加控制选项和说明:
|
||||
|
||||
```
|
||||
$ man sed
|
||||
```
|
||||
|
||||
### 3\. Grep, Egrep, Fgrep, Rgrep Commands
|
||||
### 3\. Grep、 Egrep、 Fgrep、 Rgrep 命令行
|
||||
|
||||
These filters output lines matching a given pattern. They read lines from a file or standard input, and print all matching lines by default to standard output.
|
||||
这些过滤器输出匹配指定模式的行。他们从一个文件或者标准输入读取行,并且输出所有匹配的行,默认输出到标准输出。
|
||||
|
||||
Note: The main program is [grep][8], the variations are simply the same as [using specific grep options][9] as below (and they are still being used for backward compatibility):
|
||||
注意:主要的程序是 [grep][8],变化只是简单的类似于 [使用特殊的 grep 选项][9],如下所示(为了向后兼容性,它们依旧被使用):
|
||||
|
||||
```
|
||||
$ egrep = grep -E
|
||||
@ -43,7 +42,7 @@ $ fgrep = grep -F
|
||||
$ rgrep = grep -r
|
||||
```
|
||||
|
||||
Below are some basic grep commands:
|
||||
下面是一些基本的 grep 命令:
|
||||
|
||||
```
|
||||
tecmint@TecMint ~ $ grep "aaronkilik" /etc/passwd
|
||||
@ -52,11 +51,11 @@ tecmint@TecMint ~ $ cat /etc/passwd | grep "aronkilik"
|
||||
aaronkilik:x:1001:1001::/home/aaronkilik:
|
||||
```
|
||||
|
||||
You can read more about [What’s Difference Between Grep, Egrep and Fgrep in Linux?][10].
|
||||
你可以阅读更多的关于 [Linux 下的 grep、 egrep 和 fgrep 的差异?][10]。
|
||||
|
||||
### 4\. head Command
|
||||
### 4\. head 命令
|
||||
|
||||
head is used to display the first parts of a file, it outputs the first 10 lines by default. You can use the `-n` num flag to specify the number of lines to be displayed:
|
||||
head 被用于显示文件前面的部分,默认情况下它输出前面的 10 行。你可以使用 `-n` 行标志来指定显示的行数:
|
||||
|
||||
```
|
||||
tecmint@TecMint ~ $ head /var/log/auth.log
|
||||
@ -78,13 +77,13 @@ Jan 2 10:51:34 TecMint sudo: pam_unix(sudo:session): session opened for user ro
|
||||
Jan 2 10:51:39 TecMint sudo: pam_unix(sudo:session): session closed for user root
|
||||
```
|
||||
|
||||
Learn how to use [head command with tail and cat commands][11] for effective usage in Linux.
|
||||
学习如何 [搭配 tail 和 cat 命令使用 head 命令][11] 以便于在 Linux 下更有效的使用。
|
||||
|
||||
### 5\. tail Command
|
||||
### 5\. tail 命令
|
||||
|
||||
tail outputs the last parts (10 lines by default) of a file. Use the `-n` num switch to specify the number of lines to be displayed.
|
||||
tail 输出一个文件的后面的部分(默认10行)。使用 `-n` 行选项来指定显示的行数。
|
||||
|
||||
The command below will output the last 5 lines of the specified file:
|
||||
下面的命令将会输出指定文件的最后5行:
|
||||
|
||||
```
|
||||
tecmint@TecMint ~ $ tail -n 5 /var/log/auth.log
|
||||
@ -95,9 +94,9 @@ Jan 6 13:01:27 TecMint sshd[1269]: Server listening on 0.0.0.0 port 22.
|
||||
Jan 6 13:01:27 TecMint sshd[1269]: Server listening on :: port 22.
|
||||
```
|
||||
|
||||
Additionally, tail has a special option `-f` for [watching changes in a file in real-time][12] (especially log files).
|
||||
另外,tail 有一个特殊的选项 `-f` ,可以 [实时查看一个文件的变化][12] (尤其是日志文件)。
|
||||
|
||||
The following command will enable you monitor changes in the specified file:
|
||||
下面的命令将会使你能够监控指定文件的变化:
|
||||
|
||||
```
|
||||
tecmint@TecMint ~ $ tail -f /var/log/auth.log
|
||||
@ -113,17 +112,17 @@ Jan 6 13:01:27 TecMint sshd[1269]: Server listening on 0.0.0.0 port 22.
|
||||
Jan 6 13:01:27 TecMint sshd[1269]: Server listening on :: port 22.
|
||||
```
|
||||
|
||||
Read through the tail man page for a complete list of usage options and instructions:
|
||||
通过阅读 tail 的 man 手册,获取使用手册和说明的完整列表:
|
||||
|
||||
```
|
||||
$ man tail
|
||||
```
|
||||
|
||||
### 6\. sort Command
|
||||
### 6\. sort 命令
|
||||
|
||||
sort is used to sort lines of a text file or from standard input.
|
||||
sort 用于文本文件和标准输入的行进行排序。
|
||||
|
||||
Below is the content of a file named domains.list:
|
||||
下面是一个名为 domain.list 的文件的内容:
|
||||
|
||||
```
|
||||
tecmint@TecMint ~ $ cat domains.list
|
||||
@ -137,7 +136,7 @@ windowsmint.com
|
||||
windowsmint.com
|
||||
```
|
||||
|
||||
You can run a simple [sort command][13] to sort the file content like so:
|
||||
你可以像这样运行一个简单的 [sort 命令][13] 来排序文件内容:
|
||||
|
||||
```
|
||||
tecmint@TecMint ~ $ sort domains.list
|
||||
@ -151,20 +150,20 @@ windowsmint.com
|
||||
windowsmint.com
|
||||
```
|
||||
|
||||
You can use sort command in many ways, go through some of the useful articles on sort command as follows:
|
||||
你可以通过以下一些关于 sort 命令的有用的文章,以多种方式来使用 sort 命令。
|
||||
|
||||
1. [14 Useful Examples of Linux ‘sort’ Command – Part 1][3]
|
||||
2. [7 Interesting Linux ‘sort’ Command Examples – Part 2][4]
|
||||
3. [How to Find and Sort Files Based on Modification Date and Time][5]
|
||||
1. [14 个关于 Linux ‘sort’ 命令的有用的示例 – 第 1 部分][3]
|
||||
2. [7 个有趣的 Linux ‘sort’ 命令示例 – 第 2 部分][4]
|
||||
3. [如何基于修改日期和时间来查找和排序文件][5]
|
||||
4. [http://www.tecmint.com/sort-ls-output-by-last-modified-date-and-time/][6]
|
||||
|
||||
### 7\. uniq Command
|
||||
### 7\. uniq 命令
|
||||
|
||||
uniq command is used to report or omit repeated lines, it filters lines from standard input and writes the outcome to standard output.
|
||||
uniq 命令用于报告或者忽略重复行,它从标准输入过滤行,并且把结果写到标准输出。
|
||||
|
||||
After running sort on an input stream, you can remove repeated lines with uniq as in the example below.
|
||||
在一个输入流运行 sort 之后,你可以像下面的例子一样删除重复行。
|
||||
|
||||
To indicate the number of occurrences of a line, use the `-c` option and ignore differences in case while comparing by including the `-i` option:
|
||||
为了显示行出现的数目,使用 `-c` 选项,如果对比的时候包含 `-i` 选项的话将会忽略大小写的差异:
|
||||
|
||||
```
|
||||
tecmint@TecMint ~ $ cat domains.list
|
||||
@ -182,23 +181,23 @@ tecmint@TecMint ~ $ sort domains.list | uniq -c
|
||||
1 windowsmint.com
|
||||
```
|
||||
|
||||
Read through the uniq man page for further usage info and flags:
|
||||
通过阅读 uniq 的 man 手册来获取进一步的使用信息和选项:
|
||||
|
||||
```
|
||||
$ man uniq
|
||||
```
|
||||
|
||||
### 8\. fmt Command
|
||||
### 8\. fmt 命令行
|
||||
|
||||
fmt simple optimal text formatter, it reformats paragraphs in specified file and prints results to the standard output.
|
||||
fmt 是一款简单的最优的文本格式化器,它重新格式化指定文件的段落,并且打印结果到标准输出。
|
||||
|
||||
The following is the content extracted from the file domain-list.txt:
|
||||
以下是从文件 domain-list.txt 提取的内容:
|
||||
|
||||
```
|
||||
1.tecmint.com 2.news.tecmint.com 3.linuxsay.com 4.windowsmint.com
|
||||
```
|
||||
|
||||
To reformat the above content to a standard list, run the following command with `-w` switch is used to define the maximum line width:
|
||||
为了把上面的内容重新格式化成一个标准的清单,运行下面的命令,使用 `-w` 选项是用于定义最大行宽度:
|
||||
|
||||
```
|
||||
tecmint@TecMint ~ $ cat domain-list.txt
|
||||
@ -210,15 +209,15 @@ tecmint@TecMint ~ $ fmt -w 1 domain-list.txt
|
||||
4.windowsmint.com
|
||||
```
|
||||
|
||||
### 9\. pr Command
|
||||
### 9\. pr 命令
|
||||
|
||||
pr command converts text files or standard input for printing. For instance on Debian systems, you can list all installed packages as follows:
|
||||
pr 命令转换文本文件或者标准输入之后打印出来。例如在 Debian 系统上,你可以像下面这样显示所有的安装包:
|
||||
|
||||
```
|
||||
$ dpkg -l
|
||||
```
|
||||
|
||||
To organize the list in pages and columns ready for printing, issue the following command.
|
||||
为了组织在页面和列中准备打印的列表,发出以下命令。
|
||||
|
||||
```
|
||||
tecmint@TecMint ~ $ dpkg -l | pr --columns 3 -l 20
|
||||
@ -247,24 +246,24 @@ ii avahi-autoipd ii bc ii bluez-obexd
|
||||
.....
|
||||
```
|
||||
|
||||
The flags used here are:
|
||||
使用的标志如下:
|
||||
|
||||
1. `--column` defines number of columns created in the output.
|
||||
2. `-l` specifies page length (default is 66 lines).
|
||||
1. `--column` 定义在输出中创建的列数。
|
||||
2. `-l` 指定页面的长度(默认是 66 行)。
|
||||
|
||||
### 10\. tr Command
|
||||
### 10\. tr 命令行
|
||||
|
||||
This tool translates or deletes characters from standard input and writes results to standard output.
|
||||
这个命令从标准输入转换或者删除字符,然后输出结果到标准输出。
|
||||
|
||||
The syntax for using tr is as follows:
|
||||
使用 tr 的语法如下:
|
||||
|
||||
```
|
||||
$ tr options set1 set2
|
||||
```
|
||||
|
||||
Take a look at the examples below, in the first command, `set1( [:upper:] )` represents the case of input characters (all upper case).
|
||||
看一下下面的例子,在第一个命令,`set1( [:upper:] )` 代表指定输入字符的大小写(所有的大写字符)。
|
||||
|
||||
Then `set2([:lower:])` represents the case in which the resultant characters will be. It’s same thing in the second example and the escape sequence `\n` means print output on a new line:
|
||||
`set2([:lower:])` 代表期望结果字符的大小写。它和第二个例子做着类似的事情,转义字符 `\n` 表示在新的一行打印输出:
|
||||
|
||||
```
|
||||
tecmint@TecMint ~ $ echo "WWW.TECMINT.COM" | tr [:upper:] [:lower:]
|
||||
@ -273,11 +272,11 @@ tecmint@TecMint ~ $ echo "news.tecmint.com" | tr [:lower:] [:upper:]
|
||||
NEWS.TECMINT.COM
|
||||
```
|
||||
|
||||
### 11\. more Command
|
||||
### 11\. more 命令
|
||||
|
||||
more command is a useful file perusal filter created basically for certificate viewing. It shows file content in a page like format, where users can press [Enter] to view more information.
|
||||
more 命令是一个有用的文件过滤器,创建基本上用于证书的查看。它在一页中如同格式化之后那样显示文件内容,用户可以通过按 [Enter] 来显示更多的信息。
|
||||
|
||||
You can use it to view large files like so:
|
||||
你可以像这样使用它来显示大文件:
|
||||
|
||||
```
|
||||
tecmint@TecMint ~ $ dmesg | more
|
||||
@ -307,11 +306,11 @@ tecmint@TecMint ~ $ dmesg | more
|
||||
--More--
|
||||
```
|
||||
|
||||
### 12\. less Command
|
||||
### 12\. less 命令
|
||||
|
||||
less is the opposite of more command above but it offers extra features and it’s a little faster with large files.
|
||||
less 是和上面的 more 命令相反的一个命令,但是它提供了额外的特性,而且对于大文件,它会更快些。
|
||||
|
||||
Use it in the same way as more:
|
||||
按照 more 命令相同的方式使用它:
|
||||
|
||||
```
|
||||
tecmint@TecMint ~ $ dmesg | less
|
||||
@ -341,13 +340,13 @@ tecmint@TecMint ~ $ dmesg | less
|
||||
:
|
||||
```
|
||||
|
||||
Learn Why [‘less’ is Faster Than ‘more’ Command][14] for effective file navigation in Linux.
|
||||
学习为什么对于在 Linux 下进行有效的文件浏览, [‘less’ 比 ‘more’ 命令更快][14]。
|
||||
|
||||
That’s all for now, do let us know of any [useful command line tools][15] not mentioned here, that act as a text filters in Linux via the comment section below.
|
||||
基本上就这些了,如果你还知道其他本文没有提供的 Linux 下[有用的文本过滤命令行工具][15],可以在下面的评论部分通知我们。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.
|
||||
作者简介:Aaron Kili 是一名 Linux 和 F.O.S.S 爱好者、一名未来的 Linux 系统管理员、web 开发者,并且目前是一名 TecMint 上的内容创造者,他喜欢计算机相关的工作,并且坚信知识的分享。
|
||||
|
||||
![](http://1.gravatar.com/avatar/4e444ab611c7b8c7bcb76e58d2e82ae0?s=128&d=blank&r=g)
|
||||
|
||||
@ -356,7 +355,7 @@ That’s all for now, do let us know of any [useful command line tools][15] no
|
||||
via: http://www.tecmint.com/linux-file-operations-commands/
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[yangmingming](https://github.com/yangmingming)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
@ -0,0 +1,86 @@
|
||||
4 个开源的你可以自己托管的 Trello 替代品
|
||||
============================================================
|
||||
|
||||
Trello 是一个可视团队协作平台,最近被 Atlassian 收购了,这里我说的_最近_的意思是今天,2017 年 1 月 9 日,星期一。
|
||||
|
||||
我作为 DigitalOcean 社区作者的董事会成员之一一直在使用 Trello ,并在几天前开始使用它来管理一个非营利组织的小团队项目。这是一个很好的软件,任何团队,包括那些并不 geek 的成员,都能舒适地使用它。
|
||||
|
||||
如果你喜欢 [Trello][6],但现在想要一个类似的软件,你可以自己托管,或运行在自己的服务器上,我发现了四个你可以选择的工具。记住,我没有在我自己的服务器上安装其中任何一个,但从我收集的关于它们的信息上来看,我最可能使用的是 Kanboard 和 Restyaboard。
|
||||
|
||||
这是因为它们的安装要求是熟悉的。它们的安装过程也比较简单。Restyaboard 似乎有一个更好的UI,所以它可能是我的第一个选项,虽然其中的一个要求(Elasticsearch)让我认为它对服务器的要求将比其他的更多。不管怎样,我会很快发布尝试自己托管 Kanboard 和 Restyaboard 的文章,所以请经常回来看看。
|
||||
|
||||
在那之前,我发现 Trello 的前四个选择是:
|
||||
|
||||
### Kanboard
|
||||
|
||||
除此之外,Kanban 还提供与第三方工具和服务(如Amazon S3 Storage、Hipchat、Jabber、RabbitMQ、Slack等)的集成。Kanboard 可以安装在 Microsoft 操作系统上,但要在免费和开源组件上安装,你需要以下内容:
|
||||
|
||||
* PHP >= 5.3.9
|
||||
* MariaDB/MySQL、Postgres 或者 Sqlite
|
||||
* Apache 或者 Nginx
|
||||
* CentOS 6/7、 Debian 8、 FreeBSD 10 或者 Ubuntu 14.04/16.04
|
||||
|
||||
[相关文章:切换到软件负载平衡的五个原因] [7]
|
||||
|
||||
从对项目的一个非常粗略的评估,UI 似乎不如本文中提到的其他工具靓丽。 如果改变主意不想自己托管,有一个你可以注册的有管理的或托管的 Kanboard。该项目的 GitHub 页面可在[https://github.com/kanboard/kanboard][8]
|
||||
|
||||
![kanboard interface](http://linuxbsdos.com/wp-content/uploads/2017/01/kanboard-700x312.png "kanboard interface")
|
||||
|
||||
### Restyaboard
|
||||
|
||||
有了靓丽的用户界面和从 Trello 导入数据的能力,Restyaboard 是一个非常有吸引力的 Trello 替代品。安装要求似乎也不大; 你需要以下内容以在你的服务器上安装 Restyaboard:
|
||||
|
||||
* PHP-FPM
|
||||
* Postgres
|
||||
* Nginx
|
||||
* Elasticsearch
|
||||
|
||||
即使有这些少数需求,使用脚本将自动在你需要的所有服务器上安装会使安装变得更简单。还有一个 AMI 用于在 Amazon AWS 上安装。对于 Docker 的粉丝,有一个非官方的 Docker 镜像可以用来运行 Restyaboard 容器。我不鼓励使用非官方 Docker 镜像运行 Docker 容器,但如果你想要试试,那会是一个选项。 项目的详细信息的 [GitHub page][9]。
|
||||
|
||||
![Restyaboard project management software](http://linuxbsdos.com/wp-content/uploads/2017/01/restyaboard-646x460.png "Restyaboard project management software")
|
||||
|
||||
### Taiga
|
||||
|
||||
Taiga 部署由三个组件组成 - taiga-back(后端/ api)、taiga-front-dist(前端)、taiga-events - 每个都有自己的要求。一般来说,在你的服务器上安装 Taiga 你需要以下这些:
|
||||
|
||||
[相关文章:在带有 UEFI 固件的计算机上双引导 Fedora 25、Windows 10][10] * Python >= 3.4* PostgreSQL >= 9.3* RabbitMQ(可选,只要你不想要异步通知* gcc和开发头文件* Ruby >= 2.1(仅用于编译 sass* NodeJS >= 5.0(使用 npm、gulp和 bower 来下载依赖和编译 coffeescript)
|
||||
|
||||
安装要求似乎比其他人多一点,所以如果这是一个问题,有一个托管平台可以免费使用。该托管平台上的额外功能是收费的。有关详细信息,请访问项目的 [GitHub页面][1]。
|
||||
|
||||
![Taiga project management software](http://linuxbsdos.com/wp-content/uploads/2017/01/Taiga-700x440.jpg "Taiga project management software")
|
||||
|
||||
### Wekan
|
||||
|
||||
Wekan 是用 Meteor 构建的,这是一个用于构建 web 应用程序的 JavaScript 框架,托管在 [https://github.com/wekan/wekan][2]。该项目提供了在 Heroku、Sandstorm 和经验证的 Docker 镜像上的一键安装,以便在 Docker 容器上运行它。它也可以安装在 Scalingo、IndieHosters 和 Cloudron,但我找不到部署在其他云托管提供商如 [Vultr][3] 和 [DigitalOcean][4] 上的安装说明。
|
||||
|
||||
所以看来,你安装 Wekan 最简单的方式是使用一个支持的云托管平台。
|
||||
|
||||
![Wekan project management software](http://linuxbsdos.com/wp-content/uploads/2017/01/Wekan-700x363.jpeg "Wekan project management software")
|
||||
|
||||
如我之前承诺的,请稍后回来看看我发布的如何在你的服务器上安装 Kanboard 和 Restyaboard 指南。
|
||||
|
||||
### 更新
|
||||
|
||||
刚发布这篇文章,我就遇到了[Tuleap][5]。它似乎是非常精美,但只支持 CentOS 6 和 Red Hat 6的生产环境安装。使用 Docker 支持容器化安装,但不推荐用于生产。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linuxbsdos.com/2017/01/09/4-open-source-alternatives-to-trello-that-you-can-self-host/
|
||||
|
||||
作者:[linuxbsdos.com][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linuxbsdos.com
|
||||
[1]:https://github.com/taigaio/
|
||||
[2]:https://github.com/wekan/wekan
|
||||
[3]:http://www.vultr.com/?ref=6827794
|
||||
[4]:https://www.digitalocean.com/?refcode=900fe177d075
|
||||
[5]:https://www.tuleap.org/
|
||||
[6]:https://trello.com/
|
||||
[7]:http://linuxbsdos.com/2016/07/11/five-reasons-to-switch-to-software-for-load-balancing/
|
||||
[8]:https://github.com/kanboard/kanboard
|
||||
[9]:https://github.com/RestyaPlatform/board
|
||||
[10]:http://linuxbsdos.com/2016/12/01/dual-boot-fedora-25-windows-10-on-a-computer-with-uefi-firmware/
|
@ -1,452 +1,452 @@
|
||||
# rusking translating
|
||||
|
||||
Join an Additional Ubuntu DC to Samba4 AD DC for FailOver Replication – Part 5
|
||||
============================================================
|
||||
|
||||
This tutorial will show you how to add a second Samba4 domain controller, provisioned on Ubuntu 16.04 server, to the existing Samba AD DC forest in order to provide a degree of load balancing/failover for some crucial AD DC services, especially for services such as DNS and AD DC LDAP schema with SAM database.
|
||||
|
||||
#### Requirements
|
||||
|
||||
1. [Create an Active Directory Infrastructure with Samba4 on Ubuntu – Part 1][1]
|
||||
|
||||
This article is a Part-5 of Samba4 AD DC series as follows:
|
||||
|
||||
Part 2: [Manage Samba4 AD Infrastructure from Linux Command Line][2]Part 3: [Manage Samba4 Active Directory Infrastructure from Windows10 via RSAT][3]Part 4: [Manage Samba4 AD Domain Controller DNS and Group Policy from Windows][4]
|
||||
|
||||
### Step 1: Initial Configuration for Samba4 Setup
|
||||
|
||||
1. Before you start to actually perform domain joining for the second DC, you need to take care of few initial settings. First, make sure the hostname of the system which will be integrated into Samba4 AD DC contains a descriptive name.
|
||||
|
||||
Assuming that the hostname of the first provisioned realm is called `adc1`, you can name the second DC with `adc2` in order to provide a consistent naming scheme across your Domain Controllers.
|
||||
|
||||
To change the system hostname you can issue the below command.
|
||||
|
||||
```
|
||||
# hostnamectl set-hostname adc2
|
||||
```
|
||||
|
||||
else you can manually edit /etc/hostname file and add a new line with the desired name.
|
||||
|
||||
```
|
||||
# nano /etc/hostname
|
||||
```
|
||||
|
||||
Here add the hostname.
|
||||
|
||||
```
|
||||
adc2
|
||||
```
|
||||
|
||||
2. Next, open local system resolution file and add an entry with the IP address witch points to the short name and FQDN of the main domain controller, as illustrated in the below screenshot.
|
||||
|
||||
Through this tutorial, the primary DC name is `adc1.tecmint.lan` and it resolves to 192.168.1.254 IP address.
|
||||
|
||||
```
|
||||
# nano /etc/hosts
|
||||
```
|
||||
|
||||
Add the following line:
|
||||
|
||||
```
|
||||
IP_of_main_DC FQDN_of_main_DC short_name_of_main_DC
|
||||
```
|
||||
[
|
||||
![Set Hostname for Samba4 AD DC](http://www.tecmint.com/wp-content/uploads/2017/01/Set-Hostname-for-Samba4-AD-DC.jpg)
|
||||
][5]
|
||||
|
||||
Set Hostname for Samba4 AD DC
|
||||
|
||||
3. On the next step, open /etc/network/interfaces and assign a static IP address for your system as illustrated in the below screenshot.
|
||||
|
||||
Pay attention to dns-nameservers and dns-search variables. These values should be configured to point back to the IP address of the primary Samba4 AD DC and realm in order for DNS resolution to work correctly.
|
||||
|
||||
Restart the network daemon in order to reflect changes. Verify /etc/resolv.conf file to assure that both DNS values from your network interface are updated to this file.
|
||||
|
||||
```
|
||||
# nano /etc/network/interfaces
|
||||
```
|
||||
|
||||
Edit and replace with your custom IP settings:
|
||||
|
||||
```
|
||||
auto ens33
|
||||
iface ens33 inet static
|
||||
address 192.168.1.253
|
||||
netmask 255.255.255.0
|
||||
brodcast 192.168.1.1
|
||||
gateway 192.168.1.1
|
||||
dns-nameservers 192.168.1.254
|
||||
dns-search tecmint.lan
|
||||
```
|
||||
|
||||
Restart network service and confirm changes.
|
||||
|
||||
```
|
||||
# systemctl restart networking.service
|
||||
# cat /etc/resolv.conf
|
||||
```
|
||||
[
|
||||
![Configure DNS for Samba4 AD](http://www.tecmint.com/wp-content/uploads/2017/01/Configure-DNS-for-Samba4-AD.jpg)
|
||||
][6]
|
||||
|
||||
Configure DNS for Samba4 AD
|
||||
|
||||
The dns-search value will automatically append the domain name when you query a host by its short name (will form the FQDN).
|
||||
|
||||
4. In order to test if DNS resolution is working as expected, issue a series of ping commands against your domain short name, FQDN and realm as shown in the below screenshot.
|
||||
|
||||
In all these cases Samba4 AD DC DNS server should reply with the IP address of your main DC.
|
||||
|
||||
[
|
||||
![Verify DNS Resolution for Samba4 AD](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-DNS-Resolution-for-Samba4-AD.png)
|
||||
][7]
|
||||
|
||||
Verify DNS Resolution for Samba4 AD
|
||||
|
||||
5. The final additional step that you need to take care off is time synchronization with your main Domain Controller. This can be accomplished by installing NTP client utility on your system by issuing the below command:
|
||||
|
||||
```
|
||||
# apt-get install ntpdate
|
||||
```
|
||||
|
||||
6. Assuming that you want to manually force time synchronization with samba4 AD DC, run ntpdate command against the primary DC by issuing the following command.
|
||||
|
||||
```
|
||||
# ntpdate adc1
|
||||
```
|
||||
[
|
||||
![Time Synchronize with Samba4 AD](http://www.tecmint.com/wp-content/uploads/2017/01/Time-Synchronize-with-Samba4-AD.png)
|
||||
][8]
|
||||
|
||||
Time Synchronize with Samba4 AD
|
||||
|
||||
### Step 2: Install Samba4 with Required Dependencies
|
||||
|
||||
7. In order to enroll Ubuntu 16.04 system into your domain, first install Samba4, Kerberos client and a few other important packages for later use from Ubuntu official repositories by issuing the below command:
|
||||
|
||||
```
|
||||
# apt-get install samba krb5-user krb5-config winbind libpam-winbind libnss-winbind
|
||||
```
|
||||
[
|
||||
![Install Samba4 in Ubuntu](http://www.tecmint.com/wp-content/uploads/2017/01/Install-Samba4-in-Ubuntu.png)
|
||||
][9]
|
||||
|
||||
Install Samba4 in Ubuntu
|
||||
|
||||
8. During the installation you will need to provide Kerberos realm name. Write your domain name with upper cases and press [Enter] key to finish the installation process.
|
||||
|
||||
[
|
||||
![Configure Kerberos Authentication for Samba4](http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Kerberos-Authentication-for-Samba4.png)
|
||||
][10]
|
||||
|
||||
Configure Kerberos Authentication for Samba4
|
||||
|
||||
9. After the packages installation finishes, verify the settings by requesting a Kerberos ticket for a domain administrator using kinit command. Use klist command to list granted Kerberos ticket.
|
||||
|
||||
```
|
||||
# kinit domain-admin-user@YOUR_DOMAIN.TLD
|
||||
# klist
|
||||
```
|
||||
[
|
||||
![Verify Kerberos on Samba4 Domain](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Kerberos-on-Samba4-Domain.png)
|
||||
][11]
|
||||
|
||||
Verify Kerberos on Samba4 Domain
|
||||
|
||||
### Step 3: Join to Samba4 AD DC as a Domain Controller
|
||||
|
||||
10. Before integrating your machine into Samba4 DC, first make sure all Samba4 daemons running on your system are stopped and, also, rename the default Samba configuration file in order to start clean. While provisioning the domain controller, samba will create a new configuration file from scratch.
|
||||
|
||||
```
|
||||
# systemctl stop samba-ad-dc smbd nmbd winbind
|
||||
# mv /etc/samba/smb.conf /etc/samba/smb.conf.initial
|
||||
```
|
||||
|
||||
11. In order to start the domain joining process, first start only samba-ad-dc daemon, after which you will run samba-tool command to join the realm using an account with administrative privileges on your domain.
|
||||
|
||||
```
|
||||
# samba-tool domain join your_domain -U "your_domain_admin"
|
||||
```
|
||||
|
||||
Domain integration excerpt:
|
||||
|
||||
```
|
||||
# samba-tool domain join tecmint.lan DC -U"tecmint_user"
|
||||
```
|
||||
|
||||
##### Sample Output
|
||||
|
||||
```
|
||||
Finding a writeable DC for domain 'tecmint.lan'
|
||||
Found DC adc1.tecmint.lan
|
||||
Password for [WORKGROUP\tecmint_user]:
|
||||
workgroup is TECMINT
|
||||
realm is tecmint.lan
|
||||
checking sAMAccountName
|
||||
Deleted CN=ADC2,CN=Computers,DC=tecmint,DC=lan
|
||||
Adding CN=ADC2,OU=Domain Controllers,DC=tecmint,DC=lan
|
||||
Adding CN=ADC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=tecmint,DC=lan
|
||||
Adding CN=NTDS Settings,CN=ADC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=tecmint,DC=lan
|
||||
Adding SPNs to CN=ADC2,OU=Domain Controllers,DC=tecmint,DC=lan
|
||||
Setting account password for ADC2$
|
||||
Enabling account
|
||||
Calling bare provision
|
||||
Looking up IPv4 addresses
|
||||
Looking up IPv6 addresses
|
||||
No IPv6 address will be assigned
|
||||
Setting up share.ldb
|
||||
Setting up secrets.ldb
|
||||
Setting up the registry
|
||||
Setting up the privileges database
|
||||
Setting up idmap db
|
||||
Setting up SAM db
|
||||
Setting up sam.ldb partitions and settings
|
||||
Setting up sam.ldb rootDSE
|
||||
Pre-loading the Samba 4 and AD schema
|
||||
A Kerberos configuration suitable for Samba 4 has been generated at /var/lib/samba/private/krb5.conf
|
||||
Provision OK for domain DN DC=tecmint,DC=lan
|
||||
Starting replication
|
||||
Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan] objects[402/1550] linked_values[0/0]
|
||||
Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan] objects[804/1550] linked_values[0/0]
|
||||
Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan] objects[1206/1550] linked_values[0/0]
|
||||
Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan] objects[1550/1550] linked_values[0/0]
|
||||
Analyze and apply schema objects
|
||||
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[402/1614] linked_values[0/0]
|
||||
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[804/1614] linked_values[0/0]
|
||||
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[1206/1614] linked_values[0/0]
|
||||
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[1608/1614] linked_values[0/0]
|
||||
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[1614/1614] linked_values[28/0]
|
||||
Replicating critical objects from the base DN of the domain
|
||||
Partition[DC=tecmint,DC=lan] objects[97/97] linked_values[24/0]
|
||||
Partition[DC=tecmint,DC=lan] objects[380/283] linked_values[27/0]
|
||||
Done with always replicated NC (base, config, schema)
|
||||
Replicating DC=DomainDnsZones,DC=tecmint,DC=lan
|
||||
Partition[DC=DomainDnsZones,DC=tecmint,DC=lan] objects[45/45] linked_values[0/0]
|
||||
Replicating DC=ForestDnsZones,DC=tecmint,DC=lan
|
||||
Partition[DC=ForestDnsZones,DC=tecmint,DC=lan] objects[18/18] linked_values[0/0]
|
||||
Committing SAM database
|
||||
Sending DsReplicaUpdateRefs for all the replicated partitions
|
||||
Setting isSynchronized and dsServiceName
|
||||
Setting up secrets database
|
||||
Joined domain TECMINT (SID S-1-5-21-715537322-3397311598-55032968) as a DC
|
||||
```
|
||||
[
|
||||
![Join Domain to Samba4 AD DC](http://www.tecmint.com/wp-content/uploads/2017/01/Join-Domain-to-Samba4-AD-DC.png)
|
||||
][12]
|
||||
|
||||
Join Domain to Samba4 AD DC
|
||||
|
||||
12. After the Ubuntu with samba4 software has been integrated into the domain, open samba main configuration file and add the following lines:
|
||||
|
||||
```
|
||||
# nano /etc/samba/smb.conf
|
||||
```
|
||||
|
||||
Add following excerpt to smb.conf file.
|
||||
|
||||
```
|
||||
dns forwarder = 192.168.1.1
|
||||
idmap_ldb:use rfc2307 = yes
|
||||
template shell = /bin/bash
|
||||
winbind use default domain = true
|
||||
winbind offline logon = false
|
||||
winbind nss info = rfc2307
|
||||
winbind enum users = yes
|
||||
winbind enum groups = yes
|
||||
```
|
||||
|
||||
Replace dns forwarder IP address with your own DNS forwarder IP. Samba will forward all DNS resolution queries that are outside your domain authoritative zone to this IP address.
|
||||
|
||||
13. Finally, restart samba daemon to reflect changes and check active directory replication by executing the following commands.
|
||||
|
||||
```
|
||||
# systemctl restart samba-ad-dc
|
||||
# samba-tool drs showrepl
|
||||
```
|
||||
[
|
||||
![Configure Samba4 DNS](http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Samba4-DNS.png)
|
||||
][13]
|
||||
|
||||
Configure Samba4 DNS
|
||||
|
||||
14. Additionally, rename initial Kerberos configuration file from /etc path and replace it with the new krb5.confconfiguration file generated by samba while provisioning the domain.
|
||||
|
||||
The file is located in /var/lib/samba/private directory. Use Linux symlink to link this file to /etc directory.
|
||||
|
||||
```
|
||||
# mv /etc/krb6.conf /etc/krb5.conf.initial
|
||||
# ln -s /var/lib/samba/private/krb5.conf /etc/
|
||||
# cat /etc/krb5.conf
|
||||
```
|
||||
[
|
||||
![Configure Kerberos](http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Kerberos.jpg)
|
||||
][14]
|
||||
|
||||
Configure Kerberos
|
||||
|
||||
15. Also, verify Kerberos authentication with samba krb5.conf file. Request a ticket for an administrator user and list the cached ticket by issuing the below commands.
|
||||
|
||||
```
|
||||
# kinit administrator
|
||||
# klist
|
||||
```
|
||||
[
|
||||
![Verify Kerberos Authentication with Samba](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Kerberos-Authentication-with-Samba.jpg)
|
||||
][15]
|
||||
|
||||
Verify Kerberos Authentication with Samba
|
||||
|
||||
### Step 4: Additional Domain Services Validations
|
||||
|
||||
16. The first test you need to perform is Samba4 DC DNS resolution. To validate your domain DNS resolution, query the domain name using host command against a few crucial AD DNS records as presented on the below screenshot.
|
||||
|
||||
The DNS server should replay by now with a pair of two IP addresses for each query.
|
||||
|
||||
```
|
||||
# host your_domain.tld
|
||||
# host -t SRV _kerberos._udp.your_domain.tld # UDP Kerberos SRV record
|
||||
# host -t SRV _ldap._tcp.your_domain.tld # TCP LDAP SRV record
|
||||
```
|
||||
[
|
||||
![Verify Samba4 DC DNS](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Samba4-DC-DNS.png)
|
||||
][16]
|
||||
|
||||
Verify Samba4 DC DNS
|
||||
|
||||
17. These DNS records should also be visible from an enrolled [Windows machine with RSAT tools installed][17]. Open DNS Manager and expand to your domain tcp records as shown in the below image.
|
||||
|
||||
[
|
||||
![Verify DNS Records on Windows RSAT Tool](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-DNS-Records-on-Windows-RSAT-Tool.png)
|
||||
][18]
|
||||
|
||||
Verify DNS Records on Windows RSAT Tool
|
||||
|
||||
18. The next test should indicate if domain LDAP replication works as expected. Using samba-tool, create an account on the second domain controller and verify if the account is automatically replicated on the first Samba4 AD DC.
|
||||
|
||||
##### On adc2:
|
||||
|
||||
```
|
||||
# samba-tool user add test_user
|
||||
```
|
||||
|
||||
##### On adc1:
|
||||
|
||||
```
|
||||
# samba-tool user list | grep test_user
|
||||
```
|
||||
[
|
||||
![Create User Account on Samba4 AD](http://www.tecmint.com/wp-content/uploads/2017/01/Create-User-Account-on-Samba4-AD.jpg)
|
||||
][19]
|
||||
|
||||
Create User Account on Samba4 AD
|
||||
|
||||
[
|
||||
![Verify Replication on Samba4 AD](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Replication-on-Samba4-AD.jpg)
|
||||
][20]
|
||||
|
||||
Verify Replication on Samba4 AD
|
||||
|
||||
19. You can also create an account from a Microsoft AD UC console and verify if the account appears on both domain controllers.
|
||||
|
||||
By default, the account should be automatically created on both samba domain controllers. Query the account name from `adc1` using wbinfo command.
|
||||
|
||||
[
|
||||
![Create Account from Microsoft AD UC](http://www.tecmint.com/wp-content/uploads/2017/01/Create-Account-from-Microsoft-AD-UC.png)
|
||||
][21]
|
||||
|
||||
Create Account from Microsoft AD UC
|
||||
|
||||
[
|
||||
![Verify Account Replication On Samba4 AD](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Account-Replication-On-Samba4-AD.png)
|
||||
][22]
|
||||
|
||||
Verify Account Replication On Samba4 AD
|
||||
|
||||
20. As a fact, open AD UC console from Windows, expand to Domain Controllers and you should see both enrolled DC machines.
|
||||
|
||||
[
|
||||
![Verify Samba4 Domain Controllers](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Samba4-Domain-Controllers.png)
|
||||
][23]
|
||||
|
||||
Verify Samba4 Domain Controllers
|
||||
|
||||
### Step 5: Enable Samba4 AD DC Service
|
||||
|
||||
21. In order to enable samba4 AD DC services system-wide, first disable some old and unused Samba daemons and enable only samba-ad-dc service by running the below commands:
|
||||
|
||||
```
|
||||
# systemctl disable smbd nmbd winbind
|
||||
# systemctl enable samba-ad-dc
|
||||
```
|
||||
[
|
||||
![Enable Samba4 AD DC Services](http://www.tecmint.com/wp-content/uploads/2017/01/Enable-Samba4-AD-DC-Services.png)
|
||||
][24]
|
||||
|
||||
Enable Samba4 AD DC Services
|
||||
|
||||
22. If you remotely administer Samba4 domain controller from a Microsoft client or you have other Linux or Windows clients integrated into your domain, make sure you mention the IP address of the `adc2` machine to their network interface DNS server IP settings in order to gain a level of redundancy.
|
||||
|
||||
The below screenshots illustrates the configurations required for a Windows or a Debian/Ubuntu client.
|
||||
|
||||
[
|
||||
![Configure Client to Administer Samba4 DC](http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Client-to-Administer-Samba4-DC.png)
|
||||
][25]
|
||||
|
||||
Configure Client to Administer Samba4 DC
|
||||
|
||||
[
|
||||
![Configure Linux Client to Administer Samba4 DC](http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Linux-Client-to-Administer-Samba4-DC.png)
|
||||
][26]
|
||||
|
||||
Configure Linux Client to Administer Samba4 DC
|
||||
|
||||
Assuming that the first DC with 192.168.1.254 goes offline, reverse the order of the DNS server IP addresses in the configuration file so it won’t try to query first an unavailable DNS server.
|
||||
|
||||
Finally, in case you want to perform local authentication on a Linux system with a Samba4 Active Directory account or grant root privileges for AD LDAP accounts in Linux, read the steps 2 and 3 from the tutorial [Manage Samba4 AD Infrastructure from Linux Command Line][27].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
![](http://1.gravatar.com/avatar/7badddbc53297b2e8ed7011cf45df0c0?s=128&d=blank&r=g)
|
||||
|
||||
I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/join-additional-ubuntu-dc-to-samba4-ad-dc-failover-replication/
|
||||
|
||||
作者:[Ravi Saive][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/admin/
|
||||
[1]:http://www.tecmint.com/install-samba4-active-directory-ubuntu/
|
||||
[2]:http://www.tecmint.com/manage-samba4-active-directory-linux-command-line/
|
||||
[3]:http://www.tecmint.com/manage-samba4-ad-from-windows-via-rsat/
|
||||
[4]:http://www.tecmint.com/manage-samba4-dns-group-policy-from-windows/
|
||||
[5]:http://www.tecmint.com/wp-content/uploads/2017/01/Set-Hostname-for-Samba4-AD-DC.jpg
|
||||
[6]:http://www.tecmint.com/wp-content/uploads/2017/01/Configure-DNS-for-Samba4-AD.jpg
|
||||
[7]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-DNS-Resolution-for-Samba4-AD.png
|
||||
[8]:http://www.tecmint.com/wp-content/uploads/2017/01/Time-Synchronize-with-Samba4-AD.png
|
||||
[9]:http://www.tecmint.com/wp-content/uploads/2017/01/Install-Samba4-in-Ubuntu.png
|
||||
[10]:http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Kerberos-Authentication-for-Samba4.png
|
||||
[11]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Kerberos-on-Samba4-Domain.png
|
||||
[12]:http://www.tecmint.com/wp-content/uploads/2017/01/Join-Domain-to-Samba4-AD-DC.png
|
||||
[13]:http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Samba4-DNS.png
|
||||
[14]:http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Kerberos.jpg
|
||||
[15]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Kerberos-Authentication-with-Samba.jpg
|
||||
[16]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Samba4-DC-DNS.png
|
||||
[17]:http://www.tecmint.com/manage-samba4-ad-from-windows-via-rsat/
|
||||
[18]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-DNS-Records-on-Windows-RSAT-Tool.png
|
||||
[19]:http://www.tecmint.com/wp-content/uploads/2017/01/Create-User-Account-on-Samba4-AD.jpg
|
||||
[20]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Replication-on-Samba4-AD.jpg
|
||||
[21]:http://www.tecmint.com/wp-content/uploads/2017/01/Create-Account-from-Microsoft-AD-UC.png
|
||||
[22]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Account-Replication-On-Samba4-AD.png
|
||||
[23]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Samba4-Domain-Controllers.png
|
||||
[24]:http://www.tecmint.com/wp-content/uploads/2017/01/Enable-Samba4-AD-DC-Services.png
|
||||
[25]:http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Client-to-Administer-Samba4-DC.png
|
||||
[26]:http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Linux-Client-to-Administer-Samba4-DC.png
|
||||
[27]:http://www.tecmint.com/manage-samba4-active-directory-linux-command-line/
|
||||
Join an Additional Ubuntu DC to Samba4 AD DC for FailOver Replication – Part 5
|
||||
============================================================
|
||||
将另一台 Ubuntu DC 服务器加入到 Samba4 AD DC 实现双域控主机模式——(五)
|
||||
|
||||
这篇文章将讲解如何使用 Ubuntu 16.04 服务器版系统来创建第二台 Samba4 域控制器,并将其加入到已创建好的 Samba AD DC 林环境中,以便为一些关键的 AD DC 服务提供负载均衡及故障切换功能,尤其是为那些重要的服务,比如 DNS 服务和使用 SAM 数据库的 AD DC LDAP 模式提供这种功能。
|
||||
|
||||
#### 需求
|
||||
|
||||
1、 [在 Ubuntu16.04 系统上使用 Samba4 软件来创建活动目录架构(一)][1]
|
||||
|
||||
这篇文章是 Samba4 AD DC 序列文章中的第五篇,前边几篇如下:
|
||||
|
||||
[在 Linux 命令行下管理 Samba4 AD 架构(二)][2]
|
||||
[使用 Windows 10 系统的 RSAT 工具来管理 Samba4 活动目录架构 (三)][3]
|
||||
[在 Windows 系统下管理 Samba4 AD 域管制器 DNS 和组策略(四)][4]
|
||||
|
||||
### 第一步:为设置 Samba4 进行初始化配置
|
||||
|
||||
1、在开始把第二个 DC 服务器加入到 Samba4 AD DC 域环境之前,你需要注意一些初始化设置信息,首先,确保这个新系统的主机名符合命名规范要求。
|
||||
|
||||
假设第一个域服务器的主机名叫做 ’adc1‘ ,你可以把第二个域服务器命名为 'adc2',以保持域控制器名称的一致性。
|
||||
|
||||
执行下面的命令来修改系统主机名:
|
||||
|
||||
```
|
||||
# hostnamectl set-hostname adc2
|
||||
```
|
||||
|
||||
或者你也可以手动编辑 /etc/hostname 文件,在新的一行输入你想设置的主机名。
|
||||
|
||||
```
|
||||
# nano /etc/hostname
|
||||
```
|
||||
|
||||
设置主机名。
|
||||
|
||||
```
|
||||
adc2
|
||||
```
|
||||
|
||||
2、下一步,打开本地系统解析文件并添加一个条目,包含主域控制器的 IP 地址, FQDN 名称和简写名称。如下图所示:
|
||||
|
||||
在这篇教程中,主域控服务器的主机名为 `adc1.tecmint.lan` ,其对应的 IP 地址为 192.168.1.254 。
|
||||
|
||||
```
|
||||
# nano /etc/hosts
|
||||
```
|
||||
|
||||
添加如下行:
|
||||
|
||||
```
|
||||
IP_of_main_DC FQDN_of_main_DC short_name_of_main_DC
|
||||
```
|
||||
[
|
||||
![Set Hostname for Samba4 AD DC](http://www.tecmint.com/wp-content/uploads/2017/01/Set-Hostname-for-Samba4-AD-DC.jpg)
|
||||
][5]
|
||||
|
||||
为 Samba4 AD DC 服务器设置主机名
|
||||
|
||||
3、下一步,打开 /etc/network/interfaces 配置文件并设置一个静态 IP 地址,如下图所示:
|
||||
|
||||
注意 dns-nameservers 和 dns-search 这两个参数的值。为了能够正常解析 DNS ,需要把这两个值都设置成主 Samba4 AD DC 服务器的 IP 地址和域名。
|
||||
|
||||
重启网卡服务以让修改的配置生效。检查 /etc/resolv.conf 文件确保该网卡上配置的这两个 DNS 的值已更新到这个文件。
|
||||
|
||||
```
|
||||
# nano /etc/network/interfaces
|
||||
```
|
||||
|
||||
编辑并替换你自定义的 IP 设置:
|
||||
|
||||
```
|
||||
auto ens33
|
||||
iface ens33 inet static
|
||||
address 192.168.1.253
|
||||
netmask 255.255.255.0
|
||||
brodcast 192.168.1.1
|
||||
gateway 192.168.1.1
|
||||
dns-nameservers 192.168.1.254
|
||||
dns-search tecmint.lan
|
||||
```
|
||||
|
||||
重启网卡服务并确认生效
|
||||
|
||||
```
|
||||
# systemctl restart networking.service
|
||||
# cat /etc/resolv.conf
|
||||
```
|
||||
[
|
||||
![Configure DNS for Samba4 AD](http://www.tecmint.com/wp-content/uploads/2017/01/Configure-DNS-for-Samba4-AD.jpg)
|
||||
][6]
|
||||
|
||||
配置 Samba4 AD 服务器的 DNS
|
||||
|
||||
当你通过简写名称(来自 FQDN 名)查询主机名时, dns-search 值将会自动把域名添加上。
|
||||
|
||||
4、为了测试 DNS 解析是否正常,使用 ping 命令加上简写名, FQDN 名和域名进行测试,如下图所示:
|
||||
|
||||
在所有 ping 命令的测试过程中,Samba4 AD DC DNS 服务器都应该返回主域控服务器的 IP地址。
|
||||
|
||||
[
|
||||
![Verify DNS Resolution for Samba4 AD](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-DNS-Resolution-for-Samba4-AD.png)
|
||||
][7]
|
||||
|
||||
验证 Samba4 AD 环境 DNS 解析是否正常
|
||||
|
||||
5、最后你需要注意的是确保这个主机跟域控服务器时间同步。你可以通过下面的命令在系统上安装 NTP 客户端工具来实现时间同步功能:
|
||||
|
||||
```
|
||||
# apt-get install ntpdate
|
||||
```
|
||||
|
||||
6、假设你想手动强制本地服务器与 samba4 AD DC 服务器时间同步,使用 ntpdate 命令加上主域控服务器的主机名,如下所示:
|
||||
|
||||
```
|
||||
# ntpdate adc1
|
||||
```
|
||||
[
|
||||
![Time Synchronize with Samba4 AD](http://www.tecmint.com/wp-content/uploads/2017/01/Time-Synchronize-with-Samba4-AD.png)
|
||||
][8]
|
||||
|
||||
与 Samba4 AD 服务器进行时间同步
|
||||
|
||||
### 第 2 步:安装 Samba4 必须的依赖包
|
||||
|
||||
7、为了让 Ubuntu 16.04 系统加入到你的域中,你需要通过下面的命令从 Ubuntu 官方软件库中安装 Samba4 套件, Kerberos 客户端和其它一些重要的软件包以便将来使用:
|
||||
|
||||
```
|
||||
# apt-get install samba krb5-user krb5-config winbind libpam-winbind libnss-winbind
|
||||
```
|
||||
[
|
||||
![Install Samba4 in Ubuntu](http://www.tecmint.com/wp-content/uploads/2017/01/Install-Samba4-in-Ubuntu.png)
|
||||
][9]
|
||||
|
||||
在 Ubuntu 系统中安装 Samba4
|
||||
|
||||
8、在安装的过程中,你需要提供 Kerberos 域名。输入大写的域名然后按 [Enter] 键完成安装过程。
|
||||
|
||||
[
|
||||
![Configure Kerberos Authentication for Samba4](http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Kerberos-Authentication-for-Samba4.png)
|
||||
][10]
|
||||
|
||||
为 Samba4 配置 Kerberos 认证
|
||||
|
||||
9、所有依赖包安装完成后,通过使用 kinit 命令请求一个 Kerberos 票据以验证设置是否正确。使用 klist 命令来列出已授权的 kerberos 票据信息。
|
||||
|
||||
```
|
||||
# kinit domain-admin-user@YOUR_DOMAIN.TLD
|
||||
# klist
|
||||
```
|
||||
[
|
||||
![Verify Kerberos on Samba4 Domain](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Kerberos-on-Samba4-Domain.png)
|
||||
][11]
|
||||
|
||||
在 Samba4 域环境中验证 Kerberos
|
||||
|
||||
### 第 3 步:以域控制器的身份加入到 Samba4 AD DC
|
||||
|
||||
10、在把你的机器集成到 Samba4 DC 环境之前,先把系统中所有运行着的 Samba4 服务停止,并且重命名默认的 Samba 配置文件。在域控制器配置的过程中, Samba 将会创建一个新的配置文件。
|
||||
|
||||
```
|
||||
# systemctl stop samba-ad-dc smbd nmbd winbind
|
||||
# mv /etc/samba/smb.conf /etc/samba/smb.conf.initial
|
||||
```
|
||||
|
||||
11、在准备加入域前,先启动 samba-ad-dc 服务,之后使用域管理员账号运行 samba-tool 命令将服务器加入到域。
|
||||
|
||||
```
|
||||
# samba-tool domain join your_domain -U "your_domain_admin"
|
||||
```
|
||||
|
||||
加入域过程部分截图:
|
||||
|
||||
```
|
||||
# samba-tool domain join tecmint.lan DC -U"tecmint_user"
|
||||
```
|
||||
|
||||
##### Sample Output
|
||||
|
||||
```
|
||||
Finding a writeable DC for domain 'tecmint.lan'
|
||||
Found DC adc1.tecmint.lan
|
||||
Password for [WORKGROUP\tecmint_user]:
|
||||
workgroup is TECMINT
|
||||
realm is tecmint.lan
|
||||
checking sAMAccountName
|
||||
Deleted CN=ADC2,CN=Computers,DC=tecmint,DC=lan
|
||||
Adding CN=ADC2,OU=Domain Controllers,DC=tecmint,DC=lan
|
||||
Adding CN=ADC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=tecmint,DC=lan
|
||||
Adding CN=NTDS Settings,CN=ADC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=tecmint,DC=lan
|
||||
Adding SPNs to CN=ADC2,OU=Domain Controllers,DC=tecmint,DC=lan
|
||||
Setting account password for ADC2$
|
||||
Enabling account
|
||||
Calling bare provision
|
||||
Looking up IPv4 addresses
|
||||
Looking up IPv6 addresses
|
||||
No IPv6 address will be assigned
|
||||
Setting up share.ldb
|
||||
Setting up secrets.ldb
|
||||
Setting up the registry
|
||||
Setting up the privileges database
|
||||
Setting up idmap db
|
||||
Setting up SAM db
|
||||
Setting up sam.ldb partitions and settings
|
||||
Setting up sam.ldb rootDSE
|
||||
Pre-loading the Samba 4 and AD schema
|
||||
A Kerberos configuration suitable for Samba 4 has been generated at /var/lib/samba/private/krb5.conf
|
||||
Provision OK for domain DN DC=tecmint,DC=lan
|
||||
Starting replication
|
||||
Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan] objects[402/1550] linked_values[0/0]
|
||||
Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan] objects[804/1550] linked_values[0/0]
|
||||
Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan] objects[1206/1550] linked_values[0/0]
|
||||
Schema-DN[CN=Schema,CN=Configuration,DC=tecmint,DC=lan] objects[1550/1550] linked_values[0/0]
|
||||
Analyze and apply schema objects
|
||||
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[402/1614] linked_values[0/0]
|
||||
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[804/1614] linked_values[0/0]
|
||||
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[1206/1614] linked_values[0/0]
|
||||
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[1608/1614] linked_values[0/0]
|
||||
Partition[CN=Configuration,DC=tecmint,DC=lan] objects[1614/1614] linked_values[28/0]
|
||||
Replicating critical objects from the base DN of the domain
|
||||
Partition[DC=tecmint,DC=lan] objects[97/97] linked_values[24/0]
|
||||
Partition[DC=tecmint,DC=lan] objects[380/283] linked_values[27/0]
|
||||
Done with always replicated NC (base, config, schema)
|
||||
Replicating DC=DomainDnsZones,DC=tecmint,DC=lan
|
||||
Partition[DC=DomainDnsZones,DC=tecmint,DC=lan] objects[45/45] linked_values[0/0]
|
||||
Replicating DC=ForestDnsZones,DC=tecmint,DC=lan
|
||||
Partition[DC=ForestDnsZones,DC=tecmint,DC=lan] objects[18/18] linked_values[0/0]
|
||||
Committing SAM database
|
||||
Sending DsReplicaUpdateRefs for all the replicated partitions
|
||||
Setting isSynchronized and dsServiceName
|
||||
Setting up secrets database
|
||||
Joined domain TECMINT (SID S-1-5-21-715537322-3397311598-55032968) as a DC
|
||||
```
|
||||
[
|
||||
![Join Domain to Samba4 AD DC](http://www.tecmint.com/wp-content/uploads/2017/01/Join-Domain-to-Samba4-AD-DC.png)
|
||||
][12]
|
||||
|
||||
把域加入到 Samba4 AD DC
|
||||
|
||||
12、在已安装了 Samba4 套件的 Ubuntu 系统加入域之后,打开 Samba 主配置文件添加如下行:
|
||||
|
||||
```
|
||||
# nano /etc/samba/smb.conf
|
||||
```
|
||||
|
||||
添加以下内容到 smb.conf 配置文件中。
|
||||
|
||||
```
|
||||
dns forwarder = 192.168.1.1
|
||||
idmap_ldb:use rfc2307 = yes
|
||||
template shell = /bin/bash
|
||||
winbind use default domain = true
|
||||
winbind offline logon = false
|
||||
winbind nss info = rfc2307
|
||||
winbind enum users = yes
|
||||
winbind enum groups = yes
|
||||
```
|
||||
|
||||
使用你自己的 DNS 转发器 IP 地址替换掉上面的 dns forwarder ip 地址。 Samba 将会把域认证区之外的所有 DNS 解析查询转发到这个 IP 地址。
|
||||
|
||||
13、最后,重启 samba 服务以使修改的配置生效,然后执行如下命令来检查活动目录复制功能是否正常。
|
||||
|
||||
```
|
||||
# systemctl restart samba-ad-dc
|
||||
# samba-tool drs showrepl
|
||||
```
|
||||
[
|
||||
![Configure Samba4 DNS](http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Samba4-DNS.png)
|
||||
][13]
|
||||
|
||||
配置 Samba4 DNS
|
||||
|
||||
14、另外,还需要重命名原来的 kerberos 配置文件,并使用在加入域的过程中 Samba 生成的新配置文件 krb5.conf 替换 /etc 目录下的那个文件。
|
||||
|
||||
Samba 生成的新配置文件在 /var/lib/samba/private 目录下。使用 Linux 的符号链接命令对该文件创建一个软链接指向 /etc 目录。
|
||||
|
||||
```
|
||||
# mv /etc/krb6.conf /etc/krb5.conf.initial
|
||||
# ln -s /var/lib/samba/private/krb5.conf /etc/
|
||||
# cat /etc/krb5.conf
|
||||
```
|
||||
[
|
||||
![Configure Kerberos](http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Kerberos.jpg)
|
||||
][14]
|
||||
|
||||
配置 Kerberos
|
||||
|
||||
15、同样,使用 samba 的 krb5.conf 配置文件验证 Kerberos 认证是否正常。通过以下命令来请求一个管理员账号的票据并且列出已缓存的票据信息。
|
||||
|
||||
```
|
||||
# kinit administrator
|
||||
# klist
|
||||
```
|
||||
[
|
||||
![Verify Kerberos Authentication with Samba](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Kerberos-Authentication-with-Samba.jpg)
|
||||
][15]
|
||||
|
||||
使用 Samba 验证 Kerberos 认证是否正常
|
||||
|
||||
### 第 4 步:验证其它域服务
|
||||
|
||||
16、你首先要做的一个测试就是验证 Samba4 DC DNS 解析服务是否正常。要验证域环境中的 DNS 解析情况,使用 host 命令查询域名,或者加上其它一些重要的 AD DNS 记录进行查询,如下图所示:
|
||||
|
||||
每一次查询,DNS 服务器都应该返回两个 IP 地址。
|
||||
|
||||
```
|
||||
# host your_domain.tld
|
||||
# host -t SRV _kerberos._udp.your_domain.tld # UDP Kerberos SRV record
|
||||
# host -t SRV _ldap._tcp.your_domain.tld # TCP LDAP SRV record
|
||||
```
|
||||
[
|
||||
![Verify Samba4 DC DNS](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Samba4-DC-DNS.png)
|
||||
][16]
|
||||
|
||||
验证 Samba4 DC DNS
|
||||
|
||||
17、这些 DNS 记录也可以从注册过的[已安装了 RSAT 工具的 Windows 机器][17]上查询到。打开 DNS 管理器,展开到你的域 tcp 记录,如下图所示:
|
||||
|
||||
[
|
||||
![Verify DNS Records on Windows RSAT Tool](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-DNS-Records-on-Windows-RSAT-Tool.png)
|
||||
][18]
|
||||
|
||||
通过 Windows RSAT 工具来验证 DNS 记录
|
||||
|
||||
18、下一个验证是检查域 LDAP 同步是否正常。使用 samba-tool 工具,在第二个域控制器上创建一个主账号,然后检查该账号是否自动同步到第一个 Samba4 AD DC 服务器上。
|
||||
|
||||
##### On adc2:
|
||||
|
||||
```
|
||||
# samba-tool user add test_user
|
||||
```
|
||||
|
||||
##### On adc1:
|
||||
|
||||
```
|
||||
# samba-tool user list | grep test_user
|
||||
```
|
||||
[
|
||||
![Create User Account on Samba4 AD](http://www.tecmint.com/wp-content/uploads/2017/01/Create-User-Account-on-Samba4-AD.jpg)
|
||||
][19]
|
||||
|
||||
在 Samba4 AD 服务器上创建主账号
|
||||
|
||||
[
|
||||
![Verify Replication on Samba4 AD](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Replication-on-Samba4-AD.jpg)
|
||||
][20]
|
||||
|
||||
在 Samba4 AD 服务器上验证同步功能
|
||||
|
||||
19、你也可以从 Microsoft AD DC 控制台创建一个账号,然后验证该账号是否都出现在两个域控服务器上。
|
||||
|
||||
默认情况下,这个账号都应该在两个 samba 域控制器上自动创建完成。在 'adc1' 服务器上使用 wbinfo 命令查询该账号的名字。
|
||||
|
||||
[
|
||||
![Create Account from Microsoft AD UC](http://www.tecmint.com/wp-content/uploads/2017/01/Create-Account-from-Microsoft-AD-UC.png)
|
||||
][21]
|
||||
|
||||
从 Microsoft AD UC 创建账号
|
||||
|
||||
[
|
||||
![Verify Account Replication On Samba4 AD](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Account-Replication-On-Samba4-AD.png)
|
||||
][22]
|
||||
|
||||
在 Samba4 AD 服务器上验证账号同步功能
|
||||
|
||||
20、实际上,打开 Windows 机器上的 AD DC 控制台,展开到域控制器,你应该看到两个已注册的 DC 服务器。
|
||||
|
||||
[
|
||||
![Verify Samba4 Domain Controllers](http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Samba4-Domain-Controllers.png)
|
||||
][23]
|
||||
|
||||
验证 Samba4 域控制器
|
||||
|
||||
### 第 5 步:启用 Samba4 AD DC 服务
|
||||
|
||||
21、要启用 Samba4 AD DC 的服务 system-wide ,首先你得禁用原来的不需要的 Samba 服务,然后执行如下命令启用 samba-ad-dc 服务:
|
||||
|
||||
```
|
||||
# systemctl disable smbd nmbd winbind
|
||||
# systemctl enable samba-ad-dc
|
||||
```
|
||||
[
|
||||
![Enable Samba4 AD DC Services](http://www.tecmint.com/wp-content/uploads/2017/01/Enable-Samba4-AD-DC-Services.png)
|
||||
][24]
|
||||
|
||||
启用 Samba4 AD DC 服务
|
||||
|
||||
22、如果你从 Microsoft 客户端远程管理 Samba4 域控制器,或者有其它 Linux 或 Windows 机器集成到当前域中,请确保把其它机器网卡的 DNS 地址设置成 'adc2' 服务器的 IP 地址,以实现某种程序上的冗余。
|
||||
|
||||
下图显示 Windows 和 Debian/Ubuntu 客户机的网卡配置要求。
|
||||
|
||||
[
|
||||
![Configure Client to Administer Samba4 DC](http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Client-to-Administer-Samba4-DC.png)
|
||||
][25]
|
||||
|
||||
配置 Windows 客户端来管理 Samba4 DC
|
||||
|
||||
[
|
||||
![Configure Linux Client to Administer Samba4 DC](http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Linux-Client-to-Administer-Samba4-DC.png)
|
||||
][26]
|
||||
|
||||
配置 Linux 客户端来管理 Samba4 DC
|
||||
|
||||
假设第一台 DC 服务器 192.168.1.254 网络不通,则调整配置文件中 DNS 服务器 IP 地址的顺序,以防止优先查询这台不可用的 DNS 服务器。
|
||||
|
||||
最后,如果你想在 Linux 系统上使用 Samba4 活动目录账号来进行本地认证,或者为 AD LDAP 账号授予 root 权限,请查看[在 Linux 命令行下管理 Samba4 AD 架构][27] 这篇教程的 第 2 节和第 3 节。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
![](http://1.gravatar.com/avatar/7badddbc53297b2e8ed7011cf45df0c0?s=128&d=blank&r=g)
|
||||
|
||||
我叫 Ravi Saive,TecMint 网站博主。一个喜欢在网上分享技术知识及经验的电脑极客和 Linux 系统专家。我的大多数的服务器都运行在 Linux 开源平台上。关注我:Twitter ,Facebook 和 Google+ 。
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/join-additional-ubuntu-dc-to-samba4-ad-dc-failover-replication/
|
||||
|
||||
作者:[Ravi Saive][a]
|
||||
译者:[rusking](https://github.com/rusking)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/admin/
|
||||
[1]:http://www.tecmint.com/install-samba4-active-directory-ubuntu/
|
||||
[2]:http://www.tecmint.com/manage-samba4-active-directory-linux-command-line/
|
||||
[3]:http://www.tecmint.com/manage-samba4-ad-from-windows-via-rsat/
|
||||
[4]:http://www.tecmint.com/manage-samba4-dns-group-policy-from-windows/
|
||||
[5]:http://www.tecmint.com/wp-content/uploads/2017/01/Set-Hostname-for-Samba4-AD-DC.jpg
|
||||
[6]:http://www.tecmint.com/wp-content/uploads/2017/01/Configure-DNS-for-Samba4-AD.jpg
|
||||
[7]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-DNS-Resolution-for-Samba4-AD.png
|
||||
[8]:http://www.tecmint.com/wp-content/uploads/2017/01/Time-Synchronize-with-Samba4-AD.png
|
||||
[9]:http://www.tecmint.com/wp-content/uploads/2017/01/Install-Samba4-in-Ubuntu.png
|
||||
[10]:http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Kerberos-Authentication-for-Samba4.png
|
||||
[11]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Kerberos-on-Samba4-Domain.png
|
||||
[12]:http://www.tecmint.com/wp-content/uploads/2017/01/Join-Domain-to-Samba4-AD-DC.png
|
||||
[13]:http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Samba4-DNS.png
|
||||
[14]:http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Kerberos.jpg
|
||||
[15]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Kerberos-Authentication-with-Samba.jpg
|
||||
[16]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Samba4-DC-DNS.png
|
||||
[17]:http://www.tecmint.com/manage-samba4-ad-from-windows-via-rsat/
|
||||
[18]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-DNS-Records-on-Windows-RSAT-Tool.png
|
||||
[19]:http://www.tecmint.com/wp-content/uploads/2017/01/Create-User-Account-on-Samba4-AD.jpg
|
||||
[20]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Replication-on-Samba4-AD.jpg
|
||||
[21]:http://www.tecmint.com/wp-content/uploads/2017/01/Create-Account-from-Microsoft-AD-UC.png
|
||||
[22]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Account-Replication-On-Samba4-AD.png
|
||||
[23]:http://www.tecmint.com/wp-content/uploads/2017/01/Verify-Samba4-Domain-Controllers.png
|
||||
[24]:http://www.tecmint.com/wp-content/uploads/2017/01/Enable-Samba4-AD-DC-Services.png
|
||||
[25]:http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Client-to-Administer-Samba4-DC.png
|
||||
[26]:http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Linux-Client-to-Administer-Samba4-DC.png
|
||||
[27]:http://www.tecmint.com/manage-samba4-active-directory-linux-command-line/
|
Loading…
Reference in New Issue
Block a user