Merge pull request #48 from LCTT/master

Update
This commit is contained in:
joeren 2017-01-15 10:58:29 +08:00 committed by GitHub
commit 9612e7ac23
16 changed files with 2317 additions and 413 deletions

View File

@ -1,47 +1,44 @@
beyondworld 翻译中
Powerline - 给Vim和Bash提供更棒的状态行和提示信息
Powerline给 Vim 和 Bash 提供更棒的状态行和提示信息
=================================================
Powerline是[Vim editor][1]中一个很好的状态行插件这个插件是使用Python开发的主要用于显示状态行和提示信息适用于很多软件比如bashzshtmux等。
Powerline 是一个极棒的 [Vim 编辑器][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]
Powerline使Linux终端更具威力
*Powerline 使 Linux 终端更具威力*
#### 特色
### 特色
1. python编写使其更具扩展性且功能丰富
2. 稳定易测的代码基础兼容python2.6+和python3
3. 支持多种Linux版本及工具的提示和状态栏
4. 通过JSON保存配置和颜色方案
5. 快速、轻量级具有daemon支持提供更好的显示效果
1. 使用 python 编写使其更具扩展性且功能丰富
2. 稳定易测的代码库,兼容 python 2.6+ 和 python 3
3. 支持多种 Linux 功能及工具的提示和状态栏
4. 通过 JSON 保存配置和颜色方案
5. 快速、轻量级,具有后台守护进程支持,提供更佳的性能
#### Powerline截图效果
### Powerline 效果截图
[
![Powerline Vim Statuslines](http://www.tecmint.com/wp-content/uploads/2015/10/Powerline-Vim-Statuslines.png)
][3]
Vim中Powerline状态行效果
*Vim Powerline 状态行效果*
在本文中,我会介绍如何安装Powerline和相应字体以及如何在RedHat和Debian类的系统中使用Bash和Vim支持Powerline。
在本文中,我会介绍如何安装 Powerline 及其字体,以及如何在 RedHat 和 Debian 类的系统中使 Bash 和 Vim 支持 Powerline。
### 第一步准备好安装Powerline需的软件
### 第一步:准备好安装 Powerline需的软件
由于和其他不相干项目之间存在命名冲突因此powerline只能放在PyPI(Python Package Index)中的powerline-status包下.
由于和其它无关项目之间存在命名冲突,因此 powerline 只能放在 PyPIPython Package Index中的 `powerline-status` 包下.
为了从PyPI中安装该包需要先准备好pip(该工具专门用于Python包的管理)工具。所以首先要在Linux系统下安装好pip工具。
为了从 PyPI 中安装该包,需要先准备好 `pip`(该工具专门用于 Python 包的管理)工具。所以首先要在 Linux 系统下安装好 `pip` 工具。
#### 在Debian,Ubuntu和Linux Mint中安装Pip的方法
#### 在 Debian、Ubuntu 和 Linux Mint 中安装 pip
```
# apt-get install python-pip
```
##### 示例输出
**示例输出:**
```
Reading package lists... Done
@ -64,16 +61,16 @@ Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up python-pip (1.5.4-1ubuntu3) ...
```
#### 在CentOSRHEL和Fedora中安装Pip
#### 在 CentOS、RHEL 和 Fedora 中安装 pip
Fedora类系统中需要先打开[epel-repository][4]然后按照如下方法安装pip包。
Fedora 类系统中,需要先打开 [epel 仓库][4],然后按照如下方法安装 pip 包。
```
# yum install python-pip
# dnf install python-pip [On Fedora 22+ versions]
# dnf install python-pip [Fedora 22+ 以上]
```
##### 示例输出
**示例输出:**
```
Installing:
@ -97,9 +94,9 @@ python-pip.noarch 0:7.1.0-1.el7
Complete!
```
### 第二步在Linux中安装Powerline
### 第二步:在 Linux 中安装 Powerline
现在可以从Git仓库中安装Powerline的最新开发版。在此之前系统需要安装好Git工具以便可以从仓库拉下代码。
现在可以从 Git 仓库中安装 Powerline 的最新开发版。在此之前系统需要安装好 Git 工具以便可以从仓库拉下代码。
```
# apt-get install git
@ -107,15 +104,16 @@ Complete!
# dnf install git
```
然后你可以通过pip命令安装Powerline。
然后你可以通过 `pip` 命令安装 Powerline。
```
# pip install git+git://github.com/Lokaltog/powerline
```
##### 示例输出
**示例输出:**
```
Cloning git://github.com/Lokaltog/powerline to /tmp/pip-WAlznH-build
Cloning git://github.com/Lokaltog/powerline to /tmp/pip-WAlznH-build
Running setup.py (path:/tmp/pip-WAlznH-build/setup.py) egg_info for package from git+git://github.com/Lokaltog/powerline
warning: no previously-included files matching '*.pyc' found under directory 'powerline/bindings'
warning: no previously-included files matching '*.pyo' found under directory 'powerline/bindings'
@ -137,47 +135,51 @@ changing mode of /usr/local/bin/powerline-daemon to 755
Successfully installed powerline-status
Cleaning up...
```
### 第三步在Linux中安装Powerline的字体
Powerline使用特殊的符号来为开发者显示特殊的箭头效果和符号内容。因此你的系统中必须要有符号字体或者补丁字体。
### 第三步:在 Linux 中安装 Powerline 的字体
通过下面的[wget][5]命令下载最新的系统字体及字体配置文件。
Powerline 使用特殊的符号来为开发者显示特殊的箭头效果和符号内容。因此你的系统中必须要有符号字体或者补丁过的字体。
通过下面的 [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
```
然后你将下载的字体放到字体目录下/usr/share/fonts或者/usr/local/share/fonts或者你可以通过'xset q'命令找到一个有效的字体目录。
然后你将下载的字体放到字体目录下 `/usr/share/fonts` 或者 `/usr/local/share/fonts`,或者你可以通过 `xset q` 命令找到一个有效的字体目录。
```
# mv PowerlineSymbols.otf /usr/share/fonts/
```
接下来你需要通过如下命令更新你系统的字体缓存。
```
# fc-cache -vf /usr/share/fonts/
```
其次安装字体配置文件。
```
# mv 10-powerline-symbols.conf /etc/fonts/conf.d/
```
注意如果相应的符号没有出现可以尝试关闭终端会话并重启X window这样就会生效了。
### 步骤4给Bash Shell和Vim状态行设置Powerline
注意:如果相应的符号没有出现,可以尝试关闭终端会话并重启 X window这样就会生效了。
在这一节将介绍bash shell和vim editor中关于Powerline的配置。首先通过在~/.bashrc中添加如下内容以便设置终端为256色。
### 第四步:给 Bash Shell 和 Vim 状态行设置 Powerline
在这一节将介绍 bash shell 和 vim 编辑器中关于 Powerline 的配置。首先通过在 `~/.bashrc` 中添加如下内容以便设置终端为 256 色。
```
export TERM=”screen-256color”
export TERM="screen-256color"
```
#### 打开Bash Shell中的Powerline
#### 打开 Bash Shell 中的 Powerline
如果希望在bash shell中默认打开Powerline可以在~/.bashrc中添加如下内容。
如果希望在 bash shell 中默认打开 Powerline可以在 `~/.bashrc` 中添加如下内容。
首先通过如下命令获取powerline的安装位置。
首先通过如下命令获取 powerline 的安装位置。
```
# pip show powerline-status
@ -187,7 +189,7 @@ Location: /usr/local/lib/python2.7/dist-packages
Requires:
```
一旦找到powerline的真正位置后建议最好替换到下面的位置。
一旦找到 powerline 的具体位置后,根据你系统的情况替换到下列行中的 `/usr/local/lib/python2.7/dist-packages` 对应的位置。
```
powerline-daemon -q
@ -195,27 +197,28 @@ POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. /usr/local/lib/python2.7/dist-packages/powerline/bindings/bash/powerline.sh
```
然后退出后重新登录现在powerline的状态行应该如下显示了。
然后退出后重新登录,现在 powerline 的状态行应该如下显示了。
[
![Bash Powerline Statuslines](http://www.tecmint.com/wp-content/uploads/2015/10/Bash-Powerline-Statuslines.gif)
][6]
现在切换目录并注意显示你当前路径的面包屑提示的变化。
现在切换目录并注意显示你当前路径的面包屑导航提示的变化。
如果远程Linux服务器上安装了powerline当你用ssh登录上去查看当前正在后台运行的任务时,会看到主机名提示发生变化
如果远程 Linux 服务器上安装了 powerline你能看到后台挂起的任务,当你用 ssh 登录上去时,会看到该提示增加了主机名。
#### 在Vim中打开Powerline
#### 在 Vim 中打开 Powerline
如果你喜欢使用vim正好有一个vim的强力插件。可以在~/.vimrc中添加如下内容打开该插件。
如果你喜欢使用 vim正好有一个 vim 的强力插件。可以在 `~/.vimrc` 中添加如下内容打开该插件LCTT 译注:注意同样需要根据你的系统情况修改路径)
```
set rtp+=/usr/local/lib/python2.7/dist-packages/powerline/bindings/vim/
set rtp+=/usr/local/lib/python2.7/dist-packages/powerline/bindings/vim/
set laststatus=2
set t_Co=256
```
然后你打开vim后会看到一个新的状态行:
然后你打开 vim 后会看到一个新的状态行:
[
![Vim Powerline Statuslines](http://www.tecmint.com/wp-content/uploads/2015/10/Vim-Powerline-Statuslines.gif)
@ -223,7 +226,7 @@ set t_Co=256
### 总结
Powerline可以在某些软件中提供颜色鲜艳、很优美的状态行及提示内容这对编程环境有利。希望这篇指南对您有帮助如果您需要帮助或者有任何好的想法请留言给我。
Powerline 可以在某些软件中提供颜色鲜艳、很优美的状态行及提示内容,这对编程环境有利。希望这篇指南对您有帮助,如果您需要帮助或者有任何好的想法,请留言给我。
--------------------------------------------------------------------------------
@ -239,7 +242,7 @@ via: http://www.tecmint.com/powerline-adds-powerful-statuslines-and-prompts-to-v
作者:[Ravi Saive][a]
译者:[beyondworld](https://github.com/beyondworld)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
@ -247,7 +250,7 @@ via: http://www.tecmint.com/powerline-adds-powerful-statuslines-and-prompts-to-v
[1]:http://www.tecmint.com/vi-editor-usage/
[2]:http://www.tecmint.com/wp-content/uploads/2015/10/Install-Powerline-Statuslines-in-Linux.png
[3]:http://www.tecmint.com/wp-content/uploads/2015/10/Powerline-Vim-Statuslines.png
[4]:http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/
[4]:https://linux.cn/article-2324-1.html
[5]:http://www.tecmint.com/10-wget-command-examples-in-linux/
[6]:http://www.tecmint.com/wp-content/uploads/2015/10/Bash-Powerline-Statuslines.gif
[7]:http://www.tecmint.com/wp-content/uploads/2015/10/Vim-Powerline-Statuslines.gif

View File

@ -1,12 +1,11 @@
10 个 Linux 系统管理员新年决心
Linux 系统管理员 2017 年的 10 个新决心
============================================================
当我们准备告别 2016 时,也到时间定下我们的 **新年决心** 了。不管你身为 Linux 系统管理员的经验水平如何,我们认为,制定接下来 12 个月的成长目标是很值得的。
当我们告别 2016 时,也到时间定下我们的 **新年决心** 了。不管你身为 Linux 系统管理员的经验水平如何,我们认为,制定接下来 12 个月的成长目标是很值得的。
如果你还没什么想法,我们将会在这篇文章分享 10 个简单的专业提升决心,你可以为 2017 年考虑一下。
### 1. 决定更自动化
### 1 决定更自动化
你没必要忙得像头无头苍蝇,每天忙于解决可预见的问题。如果你发现自己每天都花费时间在执行重复的任务,你有必要现在就停下来。
@ -16,27 +15,27 @@
另外,帮自己一个忙,花费几分钟来浏览我们[免费的电子书][6]部分吧。
你将有机会下载[Bash shell 脚本编程][7]相关的书籍来提升你的技能。开心地自动化!
你将有机会下载[Bash shell 脚本编程][7]相关的书籍来提升你的技能。开心地自动化!
### 2\. 学习一门新的脚本语言
### 2 学习一门新的脚本语言
虽然每一个系统管理员应该熟练地使用 Bash 写脚本,但考虑一下其他更现代化、鲁棒性更强的工具也是很重要的,例如 Python。
虽然每一个系统管理员应该熟练地使用 Bash 写脚本,但考虑一下其它更现代化、健壮性更强的工具也是很重要的,例如 Python。
不要只是相信我们说的话 —— 看看不久前我们发布的[两篇关于 Python 的系列文章][9]。你将会意识到,与其他相比Python 带来了面向对象编程的力量,使您写出更短、鲁棒性更强的脚本。
不要只是相信我们说的话 —— 看看不久前我们发布的[两篇关于 Python 的系列文章][9]。你将会意识到,与其它语言相比Python 带来了面向对象编程的力量,使您写出更短、健壮性更强的脚本。
### 3\. 学习一门新的编程语言
### 3 学习一门新的编程语言
除了学习一门新的脚本语言,(你也可以)决定花费点时间来开始学习或者提升你的编程技能。不确定从何处开始?今年的 [Stackoverflow 开发者调查][10]表明 Javascript 连续第三年引领最流行语言的榜单。
其他经典例如 Java 和 C 也值得考虑。来看我们 [2016 年最好的编程课程][11]。
### 4\. 注册一个 Github 账户并且定期更新
### 4 注册一个 Github 账户并且定期更新
特别是如果你是一个编程新手,你应该考虑一下在 Github 上展示你的成果。通过允许别人去复刻你的脚本或者程序,你就能提高知识水平,并通过别人的帮助创造出更复杂的软件。
在[《如何安装和注册 Github 帐号》][12]一文中了解更多。
### 5\. 向一个开源项目做贡献
### 5 向一个开源项目做贡献
在 Github 上向一个开源项目做贡献,这是另一个学习或者提高一门新脚本语言或者编程语言能力的好办法。
@ -44,8 +43,7 @@
在此基础上,你将因回馈社区而获得满足感。
### 6\. 每月尝试一个新的发行版
### 6、 每月尝试一个新的发行版
经常会有新的发行版或者分支出现,你有不同的选项以供选择。谁知道你梦想中的发行版是否就在近前,而你还没发现它?每个月去一次 **Distrowatch** 然后选择一个新的发行版。
@ -57,17 +55,17 @@
- [2016年最值得期待的 Linux 发行版][2]
- [2015年最流行的 10个 Linux 发行版][3]
### 7\. 参加一个 Linux 或者开源会议。
### 7 参加一个 Linux 或者开源会议。
如果你住在由 Linux 基金会赞助的会议举办地附近,我强烈建议你去参加会议。
这不仅将会给你一个提高 Linux 知识的机会,而且将是个见见其他开源专家的机会。
### 8\. 从 Linux 基金会的免费或付费课程中学习
### 8 从 Linux 基金会的免费或付费课程中学习
Linux 基金会分别通过 **edX.org** 和他们自己的门户,不断地提供免费或付费课程。
免费课程的话题包括但不仅限于Linux 介绍云基础设施技术介绍和 OpenStack 介绍。
免费课程的话题包括但不仅限于Linux 介绍云基础设施技术介绍和 OpenStack 介绍。
另一方面,付费课程包括 [LFCS 认证][16] 和 [LFCE 认证][17] 考试的准备,给开发者的 Linux 内核内部构件Linux 安全,性能试验,高可用性及其他。
@ -75,13 +73,13 @@ Linux 基金会分别通过 **edX.org** 和他们自己的门户,不断地提
你也可以考虑下看看我们最棒的[在线 Linux 训练课程][18]。
### 9\. 每周在 Linux 论坛上回答特定数量的问题
### 9 每周在 Linux 论坛上回答特定数量的问题
另一个回馈社区的好方法是帮助那些刚开始使用 Linux 的人。你将会发现网上的 Linux 论坛上有许多人正在寻找着答复。
牢记你曾经也是像他们那样是个新手,试着换位思考。
### 10\. 教一个孩子或少年使用 Linux
### 10 教一个孩子或少年使用 Linux
如果我能回到 20 年前,我希望我能有台电脑,有个能[在青年时学习 Linux ][19]的机会。
@ -123,7 +121,7 @@ via: http://www.tecmint.com/linux-system-administrators-new-years-resolutions-id
[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/
[9]: https://linux.cn/article-7693-1.html
[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/

View File

@ -0,0 +1,146 @@
2017 is the year that front-end developers should go back and master the basics
============================================================
![](https://cdn-images-1.medium.com/max/1000/1*1Xsnx4_M8uJc2klBxEtGLQ.jpeg)
In our fast-paced ecosystem, we tend to spend our time trying out the latest inventions, then arguing about them on the internet.
Im not saying we shouldnt do that. But we should probably slow down a bit and take a look at the things that dont change all that much. Not only will this improve the quality of our work and the value we deliverit will actually help us learn these new tools faster.
This post is a mix of my experience and my wishes for the New Year. And I want to hear your suggestions in the comments just as much as I want to share my own.
### Learn how to write readable code
Most of our work lies not in writing new code, but maintaining existing code. That means you end up reading code much more often then writing it, so you need to optimize your code for _the next programmer_, not for the interpreter.
I recommend reading these three amazing booksin this order, from shortest to longest:
* [The Art of Readable Code][1] by Dustin Boswell
* [Clean Code: A Handbook of Agile Software Craftsmanship][2] by Robert C. Martin
* [Code Complete: A Practical Handbook of Software Construction][3] by Steve McConnell
![](https://cdn-images-1.medium.com/max/1000/1*YQGwR6skf705fovSLCbmXQ.jpeg)
### Learn JavaScript deeper
When every week we have a new JavaScript framework thats better than any older framework, its easy to spend most of your time learning frameworks rather than the language itself. If youre using a framework but dont understand how it works, _stop and start learning the language until you understand how the tools you use work_.
* A great start is [Kyle][4] Simpsons book series [You Dont Know JavaScript][5], which you can read online for free.
* [Eric Elliott][6] has a huge list of [JavaScript topics to learn in 2017][7].
* [Henrique Alves][8] has a list of [things you should know before using React][9](actually any framework).
* [JavaScript Developers: Watch Your Language][10] by Mike Pennisiunderstand TC-39 process for new ECMAScript features.
### Learn functional programming
For years we wanted classes in JavaScript. Now we finally have them but dont want to use them anymore. Functions are all we want! We even write HTML using functions (JSX).
* [Functional-Light JavaScript][11] by Kyle Simpson.
* Professor Frisbys [Mostly adequate guide to functional programming ebook][12] and [his free course][13].
![](https://cdn-images-1.medium.com/max/1000/1*Helkj3sq3oVOc-dtjRgrYQ.jpeg)
### Learn design basics
As front-end developers, were closer to users than anybody else on the teammaybe even closer than designers. And if designers have to verify every pixel you put on screen, youre doing something wrong.
* Design for Hackers: [a book][14] and [a free course][15] by [David Kadavy][16].
* [Design for Non-Designers][17] talk by [Tracy Osborn][18].
* [Design of Web Applications][19] by [Nathan Barry][20].
* [On Web Typography][21] by [Jason Santa Maria][22].
* [The Inmates Are Running the Asylum: Why High Tech Products Drive Us Crazy and How to Restore the Sanity][23] by Alan Cooper.
* A few articles on animation in UI: [How to Use Animation to Improve UX][24], [Transitional Interfaces][25].
### Learn how to work with humans
Some of us come to programming because we prefer to interact with computers more than with humans. Unfortunately, thats not how it works.
We rarely work in isolation: we have to talk to other developers, designers, managersand sometimes even users. Thats hard. But its important if you want to really understand what youre doing and why, because thats where the value in what we do lies.
* [Soft Skills: The software developers life manual][26] by [John Sonmez][27].
* [The Clean Coder: A Code of Conduct for Professional Programmers][28] by Robert C. Martin.
* [Start with No: The Negotiating Tools that the Pros Dont Want You to Know][29] by Jim Camp.
![](https://cdn-images-1.medium.com/max/1000/1*zv6BXllLujNl-vDqkXQMqw.jpeg)
### Learn how to write for humans
A big portion of communication with our colleagues and other people are textual: task descriptions and comments, code comments, Git commits, chat messages, emails, tweets, blog posts, etc.
Imagine how much time people spend reading and understanding all that. If you can reduce this time by writing more clearly and concisely, the world will be a better place to work.
* [On Writing Well: The Classic Guide to Writing Nonfiction][30] by William Zinsser.
* [The Elements of Style][31] by William Strunk and E. B. White.
* [Orwells rules on writing][32].
* In Russian: awesome [Glavred course][33].
### Learn the old computer science wisdom
Front-end development isnt just animated dropdown menus any more. Its more complicated than ever before. Part of that notorious “JavaScript fatigue” stems from the increased complexity of the tasks we have to solve.
This, however, means that its time to learn from all wisdom that non-front-end developers have built up over the decades. And this is where I want to hear your recommendations the most.
Here are a couple resources I personally would recommend on this:
* [Learn To Think Like A Computer Scientist][34] course at Coursera.
* [The five programming books that meant most to me][35] by [DHH][36]
* * *
What would you recommend? What are you going to learn in 2017?
--------------------------------------------------------------------------------
作者简介:
![](https://cdn-images-1.medium.com/fit/c/60/60/0*FXw8cxdKYar82R9X.jpeg)
Web developer, passionate photographer and owner of crazy dogs.
--------------------------------------------------------------------------------
via: https://medium.freecodecamp.com/what-to-learn-in-2017-if-youre-a-frontend-developer-b6cfef46effd#.ss9xbwrew
作者:[Artem Sapegin][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://medium.freecodecamp.com/@sapegin
[1]:https://www.amazon.com/gp/product/0596802293/
[2]:https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/
[3]:https://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670/
[4]:https://medium.com/u/5dccb9bb4625
[5]:https://github.com/getify/You-Dont-Know-JS
[6]:https://medium.com/u/c359511de780
[7]:https://medium.com/javascript-scene/top-javascript-frameworks-topics-to-learn-in-2017-700a397b711#.zhnbn4rvg
[8]:https://medium.com/u/b6c3841651ac
[9]:http://alves.im/blog/before-dive-into-react.html
[10]:https://bocoup.com/weblog/javascript-developers-watch-your-language
[11]:https://github.com/getify/Functional-Light-JS
[12]:https://github.com/MostlyAdequate/mostly-adequate-guide
[13]:https://egghead.io/courses/professor-frisby-introduces-composable-functional-javascript
[14]:https://www.amazon.com/Design-Hackers-Reverse-Engineering-Beauty-ebook/dp/B005J578EW
[15]:http://designforhackers.com/
[16]:https://medium.com/u/5377a93ef640
[17]:https://youtu.be/ZbrzdMaumNk
[18]:https://medium.com/u/e611097a5bd4
[19]:http://nathanbarry.com/webapps/
[20]:https://medium.com/u/ac3090433602
[21]:https://abookapart.com/products/on-web-typography
[22]:https://medium.com/u/8eddcb9e4ac4
[23]:https://www.amazon.com/Inmates-Are-Running-Asylum-Products-ebook/dp/B000OZ0N62/
[24]:http://babich.biz/how-to-use-animation-to-improve-ux/
[25]:https://medium.com/@pasql/transitional-interfaces-926eb80d64e3#.igcwawszz
[26]:https://www.amazon.com/Soft-Skills-software-developers-manual/dp/1617292397/
[27]:https://medium.com/u/56e8cba02b
[28]:https://www.amazon.com/Clean-Coder-Conduct-Professional-Programmers/dp/0137081073/
[29]:https://www.amazon.com/Start-No-Negotiating-Tools-that-ebook/dp/B003EY7JEE/
[30]:https://www.amazon.com/gp/product/0060891548/
[31]:https://www.amazon.com/Elements-Style-4th-William-Strunk/dp/0205313426/
[32]:http://www.economist.com/blogs/prospero/2013/07/george-orwell-writing
[33]:http://maximilyahov.ru/glvrd-pro/
[34]:https://www.coursera.org/specializations/algorithms
[35]:https://signalvnoise.com/posts/3375-the-five-programming-books-that-meant-most-to-me
[36]:https://medium.com/u/54bcbf647830

View File

@ -0,0 +1,123 @@
The Beginners Guide to Start Using Vim
============================================================
![](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2012/03/vim-beginner-guide-featured.jpg "The Beginner's Guide to Start Using Vims")
This article is part of the [VIM User Guide][12] series:
* The Beginners Guide to Start Using Vim
* [Vim Keyboard Shortcuts Cheatsheet][3]
* [5 Vim Tips and Tricks for Experienced Users][4]
* [3 Useful VIM Editor Tips and Tricks for Advanced Users][5]
Choosing a text editor is a very important decision for a programmer. This is partly because of the plethora of variables: graphical/non-graphical interfaces, different shortcuts, language specializations, plugins, customizations, etc. My advice is not to try to search for the best one. Instead, choose the one that corresponds best to your habits and your tasks. If you want to work in a group, its generally best to select the same editor as your co-worker. That way, if you have a problem, you will be able to find some help.
It is exactly for that reason that I started using Vim a few years ago. Traditionally, Vim is placed in conflict with the legendary Emacs. I confess that I know very little about Emacs, but what you have to know about these two text editors is that they can both be fully customized, and very confusing at first. This tutorial will not explain everything about Vim but will try to give you the basics to use it correctly in the first place, and then present a few tips that will (I hope) allow you to learn on your own.
Vim comes from “VI iMproved”. Vi is a non-graphical text editor widely distributed in Unix systems. It comes by default with Linux. Vim is an enhancement of this original editor. However, unlke Vi, Vim is not installed by default on every distribution.
### Installation
To install Vim on Ubuntu, use the command:
```
sudo apt-get install vim
```
If you are already interested in some plugins, use the command:
```
sudo apt-cache search vim
```
This will give you a long list of packages related to Vim. Among them are some for various programming languages, addon managers, etc.
For this tutorial, I will be using the latest version of Vim (7.3.154) on Ubuntu. You can use any other version though.
### Warming Up
Type the command `vim` in a terminal. You should see a nice welcome screen.
![vim-welcome](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2012/02/vim-welcome.jpg "vim-welcome")
And if youve never used Vi or Vim before, it is very likely that you dont even know how to exit… Yes, its true. **None of the shortcuts you normally use will work in Vim**.
First of all, to use any menu-type function like save or exit, your command should begin with a colon (:). Saving is `:w` and quitting is `:q`. If you want to quit a file without saving, use the force quit command `:q!`. A cool thing with Vim is that you dont have to type commands separately. In other words, if you want to save and then quit, you can directly use `:wq`.
So for now, quit Vim and open it on a sample text file. Simply add the name of the text file that you want to edit after the command:
```
vim [text file name]
```
![vim-file](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2012/02/vim-file.jpg "vim-file")
By default, when you open a text file, you are in visual mode. It is quite specific to Vim and confusing at the beginning. Vim is composed mainly of two modes: visual and editing. The visual mode is for viewing a text and using some commands. To go into editing mode, just press `i` to insert and `a` to add some text. To go back into the visual mode and access all the menu-type functions, press the “Escape” key. The difference between insertion and addition is simply whether you want the text you type to appear before or after the cursor in visual mode. To understand this fully, you should really try it yourself. My advice is: add at the end of lines, and insert in other cases.
To move the cursor within a text, whether you are in visual or editing mode, you can generally use the keyboard arrows. A real purist would tell you to use the keys _h_ for left, _j_for down, _k_ for up, and _l_ for right.
Now that you are warmed up and know how to control Vim at a basic level, lets go to the core.
### A few basic commands
Now that you master the transformation from visual to editing mode, here are a few commands that you can use in visual mode:
* _x_: to delete a character
* _u_: to undo an action (the equivalent of Ctrl+z)
* _dd_: to delete a line
* _dw_: to delete a word
* _yy_: to copy a line
* _yw_: to copy a word
* _p_: to paste the previously deleted or copied line or word
* _e _: to move to the next word (faster than just moving with the arrow keys)
* _r_: to replace a letter (press _r_, then the new letter)
And of course, there are more, but this is enough for now. If you master all of them, you will already be very fluent with Vim.
As a side note for those who always want more, you can type a number before any of these commands and the command will be executed that number of times. For example, _5x_ will delete five characters in a row, while _3p_ will paste three times.
### Advanced Commands
Finally, as a bonus and an appetizer for your own research, here are a few advanced and very useful commands:
* _/searched_word _: to search for a word within the text
* _:sp name_of_a_text_file_: will split the screen in half horizontally, showing the new text file in the other half. To shift the focus from the right to the left window, use the shortcut Ctrl+w
![vim-sp](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2012/02/vim-sp.jpg "vim-sp")
* _:vsp name_of_a_text_file_: same as before, but splits the screen vertically
* Ctrl+Shift+C and Ctrl+Shift+V: to copy and paste text in a terminal
* _:! name_of_a_command_: to launch a command external to Vim, directly into your shell. For example, `:! ls` will display the files within the directory you are currently working in, without quitting the editor
![vim-ls](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2012/02/vim-ls.jpg "vim-ls")
### Conclusion
I think you now have every tool you need to start using Vim. You can go even further by installing the various plugins, editing the _.vimrc_ file, or even using the interactive tutor by typing the command _vimtutor_.
If you have any other commands that you would like to share about Vim, please let us know in the comments.
--------------------------------------------------------------------------------
via: https://www.maketecheasier.com/start-with-vim-linux/
作者:[Himanshu Arora][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.maketecheasier.com/author/himanshu/
[1]:https://www.maketecheasier.com/author/adrienbrochard/
[2]:https://www.maketecheasier.com/start-with-vim-linux/#comments
[3]:https://www.maketecheasier.com/vim-keyboard-shortcuts-cheatsheet/
[4]:https://www.maketecheasier.com/vim-tips-tricks-for-experienced-users/
[5]:https://www.maketecheasier.com/vim-tips-tricks-advanced-users/
[6]:https://www.maketecheasier.com/category/linux-tips/
[7]:http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.maketecheasier.com%2Fstart-with-vim-linux%2F
[8]:http://twitter.com/share?url=https%3A%2F%2Fwww.maketecheasier.com%2Fstart-with-vim-linux%2F&text=The+Beginner%26%238217%3Bs+Guide+to+Start+Using+Vim
[9]:mailto:?subject=The%20Beginner%E2%80%99s%20Guide%20to%20Start%20Using%20Vim&body=https%3A%2F%2Fwww.maketecheasier.com%2Fstart-with-vim-linux%2F
[10]:https://www.maketecheasier.com/turn-dropbox-into-a-blogging-tool-with-scriptogram/
[11]:https://www.maketecheasier.com/4-sms-back-up-applications-to-keep-your-messages-safe-android/
[12]:https://www.maketecheasier.com/series/vim-user-guide/
[13]:https://support.google.com/adsense/troubleshooter/1631343

View File

@ -0,0 +1,216 @@
Vim Keyboard Shortcuts Cheatsheet
============================================================
![](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2013/12/vim-shortcut-cheatsheet-featured.jpg "Vim Keyboard Shortcuts Cheatsheets")
This article is part of the [VIM User Guide][12] series:
* [The Beginners Guide to Start Using Vim][3]
* Vim Keyboard Shortcuts Cheatsheet
* [5 Vim Tips and Tricks for Experienced Users][4]
* [3 Useful VIM Editor Tips and Tricks for Advanced Users][5]
The Vim editor is a command-line based tool thats an enhanced version of the venerable vi editor. Despite the abundance of graphical rich text editors, familiarity with Vim will help every Linux user — from an experienced system administrator to a newbie Raspberry Pi user.
The light-weight editor is a very powerful tool. In the hands of an experienced operator, it can do wonders. Besides regular text editing functions, the editor also supports advanced features such as find & replace based on regular expressions and encoding conversion as well as programming features such as syntax highlighting and code folding.
One important thing to note when using Vim, is that the function of a key depends on the “mode” the editor is in. For example, pressing the alphabet “j” will move the cursor down one line in the “command mode”. Youll have to switch to the “insert mode” to make the keys input the character they represent.
Heres a cheatsheet to help you get the most out of Vim.
### Main
| Shortcut Keys | Function |
| --- | --- |
| Escape key | Gets out of the current mode into the “command mode”. All keys are bound of commands. |
| i | “Insert mode” for inserting text. Keys behave as expected. |
| : | “Last-line mode” where Vim expects you to enter a command such as to save the document. |
### Navigation keys
| Shortcut Keys | Function |
| --- | --- |
| h | moves the cursor one character to the left. |
| j or Ctrl + J | moves the cursor down one line. |
| k or Ctrl + P | moves the cursor up one line. |
| l | moves the cursor one character to the right. |
| 0 | moves the cursor to the beginning of the line. |
| $ | moves the cursor to the end of the line. |
| ^ | moves the cursor to the first non-empty character of the line |
| w | move forward one word (next alphanumeric word) |
| W | move forward one word (delimited by a white space) |
| 5w | move forward five words |
| b | move backward one word (previous alphanumeric word) |
| B | move backward one word (delimited by a white space) |
| 5b | move backward five words |
| G | move to the end of the file |
| gg | move to the beginning of the file. |
### Navigate around the document
| Shortcut Keys | Function |
| --- | --- |
| ( | jumps to the previous sentence |
| ) | jumps to the next sentence |
| { | jumps to the previous paragraph |
| } | jumps to the next paragraph |
| [[ | jumps to the previous section |
| ]] | jumps to the next section |
| [] | jump to the end of the previous section |
| ][ | jump to the end of the next section |
### Insert text
| Shortcut Keys | Function |
| --- | --- |
| a | Insert text after the cursor |
| A | Insert text at the end of the line |
| i | Insert text before the cursor |
| o | Begin a new line below the cursor |
| O | Begin a new line above the cursor |
### Special inserts
| Shortcut Keys | Function |
| --- | --- |
| :r [filename] | Insert the file [filename] below the cursor |
| :r ![command] | Execute [command] and insert its output below the cursor |
### Delete text
| Shortcut Keys | Function |
| --- | --- |
| x | delete character at cursor |
| dw | delete a word. |
| d0 | delete to the beginning of a line. |
| d$ | delete to the end of a line. |
| d) | delete to the end of sentence. |
| dgg | delete to the beginning of the file. |
| dG | delete to the end of the file. |
| dd | delete line |
| 3dd | delete three lines |
### Simple replace text
| Shortcut Keys | Function |
| --- | --- |
| r{text} | Replace the character under the cursor with {text} |
| R | Replace characters instead of inserting them |
### Copy/Paste text
| Shortcut Keys | Function |
| --- | --- |
| yy | copy current line into storage buffer |
| ["x]yy | Copy the current lines into register x |
| p | paste storage buffer after current line |
| P | paste storage buffer before current line |
| ["x]p | paste from register x after current line |
| ["x]P | paste from register x before current line |
### Undo/Redo operation
| Shortcut Keys | Function |
| --- | --- |
| u | undo the last operation. |
| Ctrl+r | redo the last undo. |
### Search and Replace keys
| Shortcut Keys | Function |
| --- | --- |
| /search_text | search document for search_text going forward |
| ?search_text | search document for search_text going backward |
| n | move to the next instance of the result from the search |
| N | move to the previous instance of the result |
| :%s/original/replacement | Search for the first occurrence of the string “original” and replace it with “replacement” |
| :%s/original/replacement/g | Search and replace all occurrences of the string “original” with “replacement” |
| :%s/original/replacement/gc | Search for all occurrences of the string “original” but ask for confirmation before replacing them with “replacement” |
### Bookmarks
| Shortcut Keys | Function |
| --- | --- |
| m {a-z A-Z} | Set bookmark {a-z A-Z} at the current cursor position |
| :marks | List all bookmarks |
| `{a-z A-Z} | Jumps to the bookmark {a-z A-Z} |
### Select text
| Shortcut Keys | Function |
| --- | --- |
| v | Enter visual mode per character |
| V | Enter visual mode per line |
| Esc | Exit visual mode |
### Modify selected text
| Shortcut Keys | Function |
| --- | --- |
| ~ | Switch case |
| d | delete a word. |
| c | change |
| y | yank |
| > | shift right |
| < | shift left |
| ! | filter through an external command |
### Save and quit
| Shortcut Keys | Function |
| --- | --- |
| :q | Quits Vim but fails when file has been changed |
| :w | Save the file |
| :w new_name | Save the file with the new_name filename |
| :wq | Save the file and quit Vim. |
| :q! | Quit Vim without saving the changes to the file. |
| ZZ | Write file, if modified, and quit Vim |
| ZQ | Same as :q! Quits Vim without writing changes |
### Download VIM Keyboard Shortcuts Cheatsheet
Cant get enough of this? We have prepared a downloadable cheat sheet for you so you can access to it when you need it.
[Download it here!][14]
--------------------------------------------------------------------------------
via: https://www.maketecheasier.com/vim-keyboard-shortcuts-cheatsheet/
作者:[Himanshu Arora][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.maketecheasier.com/author/himanshu/
[1]:https://www.maketecheasier.com/author/mayank/
[2]:https://www.maketecheasier.com/vim-keyboard-shortcuts-cheatsheet/#comments
[3]:https://www.maketecheasier.com/start-with-vim-linux/
[4]:https://www.maketecheasier.com/vim-tips-tricks-for-experienced-users/
[5]:https://www.maketecheasier.com/vim-tips-tricks-advanced-users/
[6]:https://www.maketecheasier.com/category/linux-tips/
[7]:http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.maketecheasier.com%2Fvim-keyboard-shortcuts-cheatsheet%2F
[8]:http://twitter.com/share?url=https%3A%2F%2Fwww.maketecheasier.com%2Fvim-keyboard-shortcuts-cheatsheet%2F&text=Vim+Keyboard+Shortcuts+Cheatsheet
[9]:mailto:?subject=Vim%20Keyboard%20Shortcuts%20Cheatsheet&body=https%3A%2F%2Fwww.maketecheasier.com%2Fvim-keyboard-shortcuts-cheatsheet%2F
[10]:https://www.maketecheasier.com/locate-system-image-tool-in-windows-81/
[11]:https://www.maketecheasier.com/create-system-image-in-windows8/
[12]:https://www.maketecheasier.com/series/vim-user-guide/
[13]:https://support.google.com/adsense/troubleshooter/1631343
[14]:http://www.maketecheasier.com/cheatsheet/vim-keyboard-shortcuts-cheatsheet/

View File

@ -0,0 +1,130 @@
5 Vim Tips and Tricks for Experienced Users
============================================================
![](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2014/08/vim-tips-tricks-featured.jpg "5 Vim Tips and Tricks for Experienced Userss")
This article is part of the [VIM User Guide][12] series:
* [The Beginners Guide to Start Using Vim][3]
* [Vim Keyboard Shortcuts Cheatsheet][4]
* 5 Vim Tips and Tricks for Experienced Users
* [3 Useful VIM Editor Tips and Tricks for Advanced Users][5]
The Vim editor offers so many features that its very difficult to learn all of them. While, of course, spending more and more time on the command line editor always helps, there is no denying the fact that you learn new and productive things faster while interacting with fellow Vim users. Here are some Vim tips and tricks for you.
**Note**  To create the examples here, I used Vim version 7.4.52.
### 1\. Working with multiple files
If you are a software developer or someone who uses Vim as their primary editor, chances are that you have to work with multiple files simultaneously. Following are some useful tips that you can use while working with multiple files.
Instead of opening different files in different shell tabs, you can open multiple files in a single tab by passing their filenames as arguments to the vim command. For example:
```
vim file1 file2 file3
```
The first file (file1 in the example) will be the current file and read into the buffer.
Once inside the editor, use the `:next` or `:n` command to move to the next file, and the `:prev` or `:N` command to return to the previous one. To directly switch to the first or the last file, use `:bf` and `:bl` commands, respectively. To open and start editing another file, use the `:e` command with the filename as argument (use the complete path in case the file is not present in the current directory).
At any point if it is required to list down currently opened files, use the `:ls` command. See the screen shot shown below.
![vim-ls](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2014/08/vim-ls.png "vim-ls")
Note that “%a” represents the file in the current active window, while “#” represents the file in the previous active window.
### 2\. Save time with auto complete
Want to save time and improve accuracy? Use abbreviations. They come in handy while writing long, complex words that recur frequently throughout the file. The Vim command for abbreviations is `ab`. For example, after you run the command
```
:ab asap as soon as possible
```
each occurrence of the word “asap” will be automatically replaced by “as soon as possible”, as you type.
Similarly, you can also use abbreviations to correct common typing mistakes. For example, the command
```
:ab recieve receive
```
will automatically correct the spelling mistake as you type. If you want to prevent the expansion/correction from happening at a particular occurrence, just type “Ctrl + V” after the last character of the word and then press the space bar key.
If you want to save the abbreviation youve created so that it is available to you the next time you use the Vim editor, add the complete `ab` command (without the initial colon) to “/etc/vim/vimrc” file. To remove a particular abbreviation, you can use the `una`command. For example, `:una asap`.
### 3\. Split windows to easily copy/paste
There are times when you want to copy a piece of code or a portion of text from one file to another. While the process is easy when working with GUI editors, it gets a bit tedious and time-consuming while working with a command line editor. Fortunately, Vim provides a way to minimize the time and effort required to do this.
Open one of the two files and then split the Vim window to open the other file. This can be done by using the `split` command with the file name as argument. For example,
```
:split test.c
```
will split the window and open “test.c”.
![vim-split](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2014/08/vim-split.png "vim-split")
Observe that the command split the Vim window horizontally. In case you want to split the window vertically, you can do so using the `vsplit` command. Once both the files are opened, copy the stuff from one file, press “Ctrl + w” to switch the control to another file, and paste.
### 4\. Save a file you edited without the required permissions
There are times when you realize that a file is read-only only after making a bunch of changes to it.
![vim-sudo](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2014/08/vim-sudo.png "vim-sudo")
Although closing the file and reopening it with the required permissions is a way out, its a sheer waste of time if youve already made a lot of changes, as all of them will be lost during the process. Vim provides you a way to handle this situation by allowing you to change the file permissions from within the editor before you save it. The command for this is:
```
:w !sudo tee %
```
The command will ask you for the password, just like `sudo` does on the command line, and will then save the changes.
**A related tip**: To quickly access the command prompt while editing a file in Vim, run the `:sh` command from within the editor. This will place you in an interactive shell. Once you are done, run the `exit` command to quickly return to your Vim session.
### 5\. Preserve indentation during copy/paste
Most of the experienced programmers work on Vim with auto indentation enabled. Although its a time-saving practice, it creates a problem while pasting an already indented code. For example, this is what happened when I pasted an already indented code into a file opened in Vim editor with auto indent on.
![vim-indentation](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2014/08/vim-indentation.png "vim-indentation")
The solution to this problem is the `pastetoggle` option. Add the line
```
set pastetoggle=<F2>
```
to your vimrc file, and press F2 in insert mode just before pasting the code. This should preserve the original indentation. Note that you can replace F2 with any other key if its already mapped to some other functionality.
### Conclusion
The only way you can further improve your Vim editor skills is by using the command line editor for your day-to-day work. Just note down the actions that take time and then try to find out if there is an editor command that will do the actions more quickly.
--------------------------------------------------------------------------------
via: https://www.maketecheasier.com/vim-tips-tricks-for-experienced-users/
作者:[Himanshu Arora][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.maketecheasier.com/author/himanshu/
[1]:https://www.maketecheasier.com/author/himanshu/
[2]:https://www.maketecheasier.com/vim-tips-tricks-for-experienced-users/#comments
[3]:https://www.maketecheasier.com/start-with-vim-linux/
[4]:https://www.maketecheasier.com/vim-keyboard-shortcuts-cheatsheet/
[5]:https://www.maketecheasier.com/vim-tips-tricks-advanced-users/
[6]:https://www.maketecheasier.com/category/linux-tips/
[7]:http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.maketecheasier.com%2Fvim-tips-tricks-for-experienced-users%2F
[8]:http://twitter.com/share?url=https%3A%2F%2Fwww.maketecheasier.com%2Fvim-tips-tricks-for-experienced-users%2F&text=5+Vim+Tips+and+Tricks+for+Experienced+Users
[9]:mailto:?subject=5%20Vim%20Tips%20and%20Tricks%20for%20Experienced%20Users&body=https%3A%2F%2Fwww.maketecheasier.com%2Fvim-tips-tricks-for-experienced-users%2F
[10]:https://www.maketecheasier.com/enable-two-step-verification-apple-icloud-account/
[11]:https://www.maketecheasier.com/mistakes-wordpress-user-should-avoid/
[12]:https://www.maketecheasier.com/series/vim-user-guide/
[13]:https://support.google.com/adsense/troubleshooter/1631343

View File

@ -1,91 +0,0 @@
wcnnbdk1 translating
# Perl and the birth of the dynamic web
>The fascinating story of Perl's role in the dynamic web spans newsgroups and mailing lists, computer science labs, and continents.
![Perl and the birth of the dynamic web](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/osdc-lead-web-internet.png?itok=hq81pSDs "Perl and the birth of the dynamic web")
>Image by : [Internet Archive Book Images][30], modified by Opensource.com. [CC BY-SA 4.0][29].
The web's early history is generally remembered as a few seminal events: the day Tim Berners-Lee [announced][28] the WWW-project on Usenet, the document with which [CERN released the project's code][27] into the public domain, and of course [the first version of the NCSA Mosaic browser][26] in January 1993\. Although these individual moments were certainly crucial, the period is far richer and reveals that technological development is not a set of discrete events, but rather a range of interconnected stories.
One such story is how exactly the web became _dynamic_, which is to say, how we got web servers to do more than serve static HTML documents. This is a story that spans [newsgroups][25] and mailing lists, computer science labs, and continents—its focus is not so much one person as one programming language: Perl.
### CGI scripts and infoware
In the mid- to late-1990s, Perl and the dynamic web were nearly synonymous. As a relatively easy-to-learn interpreted language with powerful text-processing features, Perl made it easy to write scripts to connect a website to a database, handle form data sent by users, and of course create those unmistakeable icons of the '90s web, hit counters and guestbooks.
Such website features came in the form of CGI scripts, named for the Common Gateway Interface, [first implemented][24] by Rob McCool in the NCSA HTTPD server in November 1993\. CGI was designed to allow for drop-in functionality, and within a few years one could easily find archives of pre-cooked scripts written in Perl. An infamous case was [Matt's Scripts Archive][23], a popular source that unintentionally carried security flaws and inspired members of the Perl community to create a professional alternative called [Not Matt's Scripts][22].
At the same time that amateur and professional programmers took up Perl to create dynamic websites and applications, Tim O'Reilly [coined the term "infoware"][21] to describe how the web and Perl were part of a sea of change in the computing industry. With innovations by Yahoo! and Amazon in mind, O'Reilly wrote: "Traditional software embeds small amounts of information in a lot of software; infoware embeds small amounts of software in a lot of information." Perl was the perfect small-but-powerful tool—the Swiss Army Chainsaw—that powered informational media from large web directories to early platforms for user-generated content.
### Forks in the road
Although Perl's relationship to CGI is well-documented, the links between the programming language and the rise of the dynamic web go deeper. In the brief period between the appearance of [the first website][20] (just before Christmas 1990) and McCool's work on CGI in 1993, much of what defined the web in the 1990s and beyond—from forms to bitmaps and tables—was up in the air. Although Berners-Lee was often deferred to in these early years, different people saw different potential uses for the web, and pushed it in various directions. On the one hand, this resulted in famous disputes, such as questions of [how closely HTML should follow SGML][19], or [whether to implement an image tag][18]. On the other hand, change was a slower process without any straightforward cause. The latter best describes how the dynamic web developed.
In one sense, the first gateways can be traced to 1991 and 1992, when Berners-Lee and a handful of other computer scientists and hypertext enthusiasts [wrote servers][17] that connected to specific resources, such as particular CERN applications, general applications such as Oracle databases, and [wide area information servers (WAIS)][16]. (WAIS was the late 1980s precursor to the web developed by, among others, [Brewster Kahle][15], a digital librarian and founder of the [Internet Archive][14].) In this way, a gateway was a custom web server designed to do one thing: connect with another network, database, or application. Any dynamic feature meant running another daemon on a different port (read, for example, Berners-Lee's description of [how to add a search function][13] to a website). Berners-Lee intended the web to be a universal interface to diverse information systems, and encouraged a proliferation of single-purpose servers. He also [noted][12] that Perl was "a powerful (if otherwise incomprehensible) language with which to hack together" one.
However, another sense of "gateway" suggested not a custom machine but a script, a low-threshold add-on that wouldn't require a different server. The first of this kind was arguably Jim Davis's [Gateway to the U Mich Geography server][11], released to the WWW-talk mailing list in November 1992\. Davis's script, written in Perl, was a kind of proto-Web API, pulling in data from another server based on formatted user queries. Highlighting how these two notions of gateway differed, Berners-Lee [responded][10] to Davis requesting that he and the author of the Michigan server "come to some arrangement," as it would make more sense "from the network point of view" to only have one server providing this information. Berners-Lee, as might be expected of the person who invented the web, preferred an orderly information resource. Such drop-in gateways and scripts that pulled data in from other servers meant a potential qualitative shift in what the web could be, extending but also subtly transforming Berners-Lee's original vision.
### Going Wayback to the Perl HTTPD
An important step between Davis's geography gateway and the standardization of such low-threshold web scripting through CGI was the [Perl HTTPD][9], a web server written entirely in Perl by grad student Marc Van Heyningen at Indiana University in Bloomington in early 1993\. Among [the design principles][8] Van Heyningen laid out was easy extensibility—beyond the fact that using Perl meant no compiling was necessary, the server included "a feature to restart the server when new features are added to the code with zero downtime," making it "trivial" to add new functionality.
The Perl HTTPD stood in contrast to the idea that servers should have a single, dedicated purpose. Instead, it hinted at an incremental, permanently beta approach to software products that would eventually be considered common sense in web work. Van Heyningen [later wrote][7] that his reason for building a server from scratch was there was no easy way to create "virtual documents" (i.e., dynamically generated pages) with the CERN server, and joked that the easiest way to do this was to use "the language of the gods." Among the scripts he added early on was a web interface to Sun's man pages as well as a [a Finger Gateway][6] (an early protocol for sharing information about a computer system or user).
Although the Indiana University server used by Van Heyningen was primarily used to connect to existing information resources, Van Heyningen and fellow students also saw the potential for personal publishing. One of its more popular pages from 1993-1994 [published][5] documents, photographs, and news stories around a famous Canadian court case for which national media had been gagged.
The Perl HTTPD wasn't necessarily built to last. Today, Van Heyningen remembers it as a "hacked up prototype." Its original purpose was to demonstrate the web's usefulness to senior staff who had chosen Gopher to be the university's network interface. Van Heyningen's argument-in-code included an appeal to his professors' vanity in the form of [a web-based, searchable index of their publications][4]. In other words, a key innovation in server technology was created to win an argument, and in that sense the code did all that was asked of it.
Despite the servers's temporary nature, the ideas that accompanied the Perl HTTPD would stick around. Van Heyningen began to receive requests for the code and shared it online, with a note that one would need to know some Perl (or someone who did) to port the server to other systems. Soon after, Austin-based programmer Tony Sanders created a portable version called [Plexus][3]. Sanders's web server was a fully fledged product that cemented the kind of easy extensibility that the Perl HTTPD suggested, while adding a number of new features such as image decoding. Plexus in turn [directly inspired][2]Rob McCool to create an "htbin" for scripts on the NCSA HTTPD server, and soon after that the implementation of the Common Gateway Interface.
Alongside this historical legacy, the Perl HTTPD is also preserved in a more tangible form—thanks to the wonderful Internet Archive (the Wayback Machine), you can still [download the tarball][1] today.
### Future histories
For all the tech world's talk of disruption, technological change is in fact a contradictory process. Existing technologies are the basis for thinking about new ones. Archaic forms of programming inspire new ways of doing things today. Something as innovative as the web was very much an extension of older technologies—not least, Perl.
To go beyond simple timelines of seminal events, perhaps web historians could take a cue from Perl. Part of the challenge is material. Much of what must be done involves wrangling structure from the messy data that's available, gluing together such diverse sources as mailing lists, archived websites, and piles of books and magazines. And part of the challenge is conceptual—to see that web history is much more than the release dates of new technologies, that it encompasses personal memory, human emotion, and social processes as much as it does protocols and Initial Public Offerings, and that it is not one history but many. Or as the Perl credo goes, "There's More Than One Way To Do It."
--------------------------------------------------------------------------------
via: https://opensource.com/life/16/11/perl-and-birth-dynamic-web
作者:[Michael Stevenson][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/mstevenson
[1]:https://web.archive.org/web/20011126190051/http://www.cs.indiana.edu/perl-server/httpd.pl.tar.Z
[2]:http://1997.webhistory.org/www.lists/www-talk.1993q4/0516.html
[3]:https://web.archive.org/web/19990421192342/http://www.earth.com/server/doc/plexus.html
[4]:https://web.archive.org/web/19990428030253/http://www.cs.indiana.edu:800/cstr/search
[5]:https://web.archive.org/web/19970720205155/http://www.cs.indiana.edu/canada/karla.html
[6]:https://web.archive.org/web/19990429014629/http://www.cs.indiana.edu:800/finger/gateway
[7]:https://web.archive.org/web/19980122184328/http://www.cs.indiana.edu/perl-server/history.html
[8]:https://web.archive.org/web/19970720025822/http://www.cs.indiana.edu/perl-server/intro.html
[9]:https://web.archive.org/web/19970720025822/http://www.cs.indiana.edu/perl-server/code.html
[10]:https://lists.w3.org/Archives/Public/www-talk/1992NovDec/0069.html
[11]:https://lists.w3.org/Archives/Public/www-talk/1992NovDec/0060.html
[12]:http://info.cern.ch/hypertext/WWW/Provider/ShellScript.html
[13]:http://1997.webhistory.org/www.lists/www-talk.1993q1/0109.html
[14]:https://archive.org/index.php
[15]:http://brewster.kahle.org/about/
[16]:https://en.wikipedia.org/wiki/Wide_area_information_server
[17]:http://info.cern.ch/hypertext/WWW/Daemon/Overview.html
[18]:http://1997.webhistory.org/www.lists/www-talk.1993q1/0182.html
[19]:http://1997.webhistory.org/www.lists/www-talk.1993q1/0096.html
[20]:http://info.cern.ch/hypertext/WWW/TheProject.html
[21]:https://web.archive.org/web/20000815230603/http://www.edventure.com/release1/1198.html
[22]:http://nms-cgi.sourceforge.net/
[23]:https://web.archive.org/web/19980709151514/http://scriptarchive.com/
[24]:http://1997.webhistory.org/www.lists/www-talk.1993q4/0518.html
[25]:https://en.wikipedia.org/wiki/Usenet_newsgroup
[26]:http://1997.webhistory.org/www.lists/www-talk.1993q1/0099.html
[27]:https://tenyears-www.web.cern.ch/tenyears-www/
[28]:https://groups.google.com/forum/#!msg/alt.hypertext/eCTkkOoWTAY/bJGhZyooXzkJ
[29]:https://creativecommons.org/licenses/by-sa/4.0/
[30]:https://www.flickr.com/photos/internetarchivebookimages/14591826409/in/photolist-oeqVBX-xezHCD-otJDtG-whb6Qz-tohe9q-tCxH8y-xq4VfN-otJFfh-xEmn3b-tERUdv-oucUgd-wKDyLy-owgebW-xd6Wew-xGEvuT-toqHkP-oegBCj-xtDdzN-tF19ip-xGFbWP-xcQMJq-wxrrkN-tEYczi-tEYvCn-tohQuy-tEzFwN-xHikPT-oetG8V-toiGvh-wKEgAu-xut1qp-toh7PG-xezovR-oegRMa-wKN2eg-oegSRp-sJ29GF-oeqXLV-oeJTBY-ovLF3X-oeh2iJ-xcQBWs-oepQoy-ow4xoo-xknjyD-ovunVZ-togQaj-tEytff-xEkSLS-xtD8G1

View File

@ -1,252 +0,0 @@
Translating by zhb127
10 Interesting Linux Command Line Tricks and Tips Worth Knowing
============================================================
I passionately enjoy working with commands as they offer more control over a Linux system than GUIs(Graphical User Interfaces) applications, therefore am always on the look out to discover or figure out interesting ways and ideas to make [Linux so easy and fun to operate][1], primarily from the terminal.
It is always thrilling when we discover [new tricks or tips while using Linux][2] especially a command line geek like myself.
And the feeling of wanting to share newly learned practices or commands with millions of Linux users out there, particularly the newbies who are still getting their way around this exciting operating system normally sets in.
**Suggested Read:** [10 Useful Linux Command Line Tricks for Newbies Part 2][3]
In this article, we will review a number of [useful command line tricks and tips][4] that can significantly enhance your Linux usage skills.
### 1\. Lock or Hide a File or Directory in Linux
The simplest way of locking a file or directory is by using Linux file permissions. In case your the owner of a file or directory, you can block (remove read, write and execute privileges) other users and groups from accessing it as follows:
```
$ chmod 700 tecmint.info
OR
$ chmod go-rwx tecmint.info
```
To know more about Linux file permissions, read this article [Managing Users & Groups, File Permissions & Attributes in Linux][5].
To hide the file/directory from other system users, rename it with a `(.)` at the start of the file or directory:
```
$ mv filename .tecmint.info
```
### 2\. Translate rwx Permissions into Octal Format in Linux
By default, when you run the [ls command][6], it displays file permissions in `rwx` format, but to understand the equivalence of this format and the octal format, you can learn how to [translate rwx permissions into Octal format in Linux][7].
### 3\. How to Use su When sudo Fails
Although [sudo command][8] is used to execute commands with superuser privileges, there are moments when it fails to work as in the example below.
Here, I want to [empty the contents of a large file][9] named `uptime.log` but the operation has failed even when I used sudo.
```
$ cat /dev/null >/var/log/uptime.log
$ sudo cat /dev/null >/var/log/uptime.log
```
[
![Empty Large File Content in Linux](http://www.tecmint.com/wp-content/uploads/2016/12/Empty-Large-File-Content-in-Linux.png)
][10]
Empty Large File Content in Linux
In such as case, you need to switch to the root user account using su command to perform the operation like so:
```
$ su
$ sudo cat /dev/null >/var/log/uptime.log
$ cat /var/log/uptime.log
```
[
![Switch to Super User](http://www.tecmint.com/wp-content/uploads/2016/12/Switch-to-Super-User.png)
][11]
Switch to Super User
Try to understand the [difference between su and sudo][12], in addition, read through their man pages for more guidelines:
```
$ man sudo
$ man su
```
### 4\. Kill a Process in Linux
Sometimes when you want to [terminate a process using kill or killall or pkill][13] commands, it may fail to work, you realize that the process still continues to run on the system.
In order to destructively kill a process, send the `-KILL` siganl to it.
First [determine its process ID][14] and then kill it like so:
```
$ pidof vlc
$ sudo kill -KILL 10279
```
[
![Find and Kill Process in Linux](http://www.tecmint.com/wp-content/uploads/2016/12/Find-and-Kill-Process-in-Linux.png)
][15]
Find and Kill Process in Linux
Check the [kill command][16] for additional usage options and information.
### 5\. Delete File Permanently in Linux
Normally, we use the rm command to delete files from a Linux system, however, these files do not completely get deleted, they are simply stored and hidden on the hard disk and can still be [recovered these files in Linux][17]and viewed by another person.
To prevent this, we can use the shred command which overwrites the file content and optionally deletes the file as well.
```
$ shred -zvu tecmint.pdf
```
The options used in the above command:
1. `-z`  adds a final overwrite with zeros to hide shredding.
2. `-u`  helps to truncate and remove file after overwriting.
3. `-v`  shows progress.
[
![Delete File Permanently in Linux](http://www.tecmint.com/wp-content/uploads/2016/12/Delete-File-Permanently-in-Linux.png)
][18]
Delete File Permanently in Linux
Read through shred man page for additional usage instructions:
```
$ man shred
```
### 6\. Rename Multiple Files in Linux
You can [rename multiple files in Linux][19] on the go by invoking the rename command.
It renames the filenames supplied according to a rule specified in the first argument.
The command below renames all `.pdf` files to `.doc`, here `'s/\.pdf$/\.doc/'` is the rule:
```
$ rename -v 's/\.pdf$/\.doc/' *.pdf
```
[
![Rename Multiple Files in Linux](http://www.tecmint.com/wp-content/uploads/2016/12/Rename-Multiple-Files-in-Linux.png)
][20]
Rename Multiple Files in Linux
The next example renames all files matching `"*.bak"` to strip the extension, where `'s/\e.bak$//'` is the rule:
### 7\. Check for Spelling of Words in Linux
The look command displays lines beginning with a given string, it can help you to check for the spelling of word from within the command line. Although it is not so effective and reliable, look is still a useful alternative to other powerful spelling-checkers:
```
$ look linu
$ look docum
```
[
![Spell Checking in Linux](http://www.tecmint.com/wp-content/uploads/2016/12/Spell-Checking-in-Linux.png)
][21]
Spell Checking in Linux
### 8\. Search for Description of Keyword in Manual Page
The man command is used to display manual entry pages of commands, when used with the `-k` switch, it searches the short descriptions and manual page names for the keyword `printf` (such as adjust, apache and php in the commands below) as regular expression.
```
$ man -k adjust
$ man -k apache
$ man -k php
```
[
![Show Description of Keyword in Manual Pages](http://www.tecmint.com/wp-content/uploads/2016/12/Show-Description-of-Keyword-in-Manual-Pages.png)
][22]
Show Description of Keyword in Manual Pages
### 9\. Watch Logs in Real-Time in Linux
With watch command, you can run [another Linux command periodically][23] while displaying its output on fullscreen and alongside [tail command][24] which is used to view the last parts of a file, it is possible to watch the recording of log entries in a logfile.
In the example below, you will watch the system authentication logfile. Open two terminal windows, display the logfile for watching in real-time in the first window like so:
```
$ sudo watch tail /var/log/auth.log
```
You can also use [tail command][25] which shows the last parts of a file. Its `-f` flag enables watching changes in a file in real-time, therefore it is possible to watch the recording of log entries in a logfile.
```
$ sudo tail -f /var/log/auth.log
```
And run the commands below in the second terminal as you observe the logfile content from the first window:
```
$ sudo mkdir -p /etc/test
$ sudo rm -rf /etc/test
```
### 10\. List All Shell builtin Commands
A shell builtin is a command or a function, called from within and executed directly in the shell itself, instead of an external executable program which the shell would load from the hard disk and execute.
To list all shell builtins and their usage syntax, run:
```
$ help
```
As a concluding remark, [command line tricks and tips][26] always come in handy and make learning and using Linux easy and fun especially for newbies.
You can as well share with us other [useful and interesting command line tricks or tips][27] in Linux that you have come across via the comment form 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-command-line-tricks-and-tips-worth-knowing/
作者:[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/20-funny-commands-of-linux-or-linux-is-fun-in-terminal/
[2]:http://www.tecmint.com/tag/linux-tricks/
[3]:http://www.tecmint.com/10-useful-linux-command-line-tricks-for-newbies/
[4]:http://www.tecmint.com/10-useful-linux-command-line-tricks-for-newbies/
[5]:http://www.tecmint.com/manage-users-and-groups-in-linux/
[6]:http://www.tecmint.com/tag/linux-ls-command/
[7]:http://www.tecmint.com/check-linux-file-octal-permissions-using-stat-command/
[8]:http://www.tecmint.com/su-vs-sudo-and-how-to-configure-sudo-in-linux/
[9]:http://www.tecmint.com/empty-delete-file-content-linux/
[10]:http://www.tecmint.com/wp-content/uploads/2016/12/Empty-Large-File-Content-in-Linux.png
[11]:http://www.tecmint.com/wp-content/uploads/2016/12/Switch-to-Super-User.png
[12]:http://www.tecmint.com/su-vs-sudo-and-how-to-configure-sudo-in-linux/
[13]:http://www.tecmint.com/how-to-kill-a-process-in-linux/
[14]:http://www.tecmint.com/find-process-name-pid-number-linux/
[15]:http://www.tecmint.com/wp-content/uploads/2016/12/Find-and-Kill-Process-in-Linux.png
[16]:http://www.tecmint.com/how-to-kill-a-process-in-linux/
[17]:http://www.tecmint.com/recover-deleted-file-in-linux/
[18]:http://www.tecmint.com/wp-content/uploads/2016/12/Delete-File-Permanently-in-Linux.png
[19]:http://www.tecmint.com/rename-multiple-files-in-linux/
[20]:http://www.tecmint.com/wp-content/uploads/2016/12/Rename-Multiple-Files-in-Linux.png
[21]:http://www.tecmint.com/wp-content/uploads/2016/12/Spell-Checking-in-Linux.png
[22]:http://www.tecmint.com/wp-content/uploads/2016/12/Show-Description-of-Keyword-in-Manual-Pages.png
[23]:http://www.tecmint.com/run-repeat-linux-command-every-x-seconds/
[24]:http://www.tecmint.com/view-contents-of-file-in-linux/
[25]:http://www.tecmint.com/view-contents-of-file-in-linux/
[26]:http://www.tecmint.com/tag/linux-tricks/
[27]:http://www.tecmint.com/5-linux-command-line-tricks/

View File

@ -0,0 +1,79 @@
Block Ads on All Your Devices at Home with Pi-hole and an Orange Pi
============================================================
Do you find it irritating having to set up an ad blocker on your computer web browsers, smart phones, and tablets? I sure do.  And then there are some smart devices at home that dont appear to have ad blocking software of any kind.  Well, I learned about [Pi-hole][2] which is ad blocking software for your pi board and it blocks all the advertisements on your home network before they get to your various devices.  It gives you the ability to black list or white list any domain, plus it has a great dashboard that gives you insights into your home networks most accessed domains/web sites, most active devices, and most frequent advertisers.
Pi-hole was really targeted to run on the Raspberry Pi but I wanted to know if it would work on my inexpensive Orange Pi running Armbian Linux. Well, it absolutely does! Below is my process for getting Pi-hole up and running quickly.
### Installing Pi-hole
Installing Pi-hole is done using the terminal, so open a terminal on your Orange Pis desktop or ssh into the pi board.
You will be downloading the software, so navigate to a directory of your choosing, making sure that you have write privileges. Like this:
```
cd <your preferred directory>/
```
I deviated from the “one command” installation on the Pi-hole home page. I mean, they do say right underneath that command that “piping to bash can be dangerous” and that a local install is “safer.” So, heres my local installation steps:
```
git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole
cd Pi-hole/automated\ install/
./basic-install.sh
```
If you are not logged in as the root user, then the basic-install script will prompt you to enter your password before continuing. If needed, the script will download and install some prerequisite Linux packages. Then itll provide you with a simple blue/red graphical interface, prompting you to answer a few questions about how you want Pi-hole configured. In my experience, simply accepting the defaults was fine and I later discovered that the Pi-hole web application enables you to change settings like DNS provider.
The script will tell you what the password is for Pi-hole both in the graphical interface and in the terminal. Do take note of that password!
The script will also tell you the web address for Pi-hole, which should be like this:
```
http://<your pis IP address>/admin
```
or even something like:
```
http://orangepipc/admin
```
You will need enter your Pi-hole password, and then you should get a nice dashboard that looks something like this:
![Ph-hole](https://i1.wp.com/piboards.com/wp-content/uploads/2017/01/ph-hole.png?resize=640%2C532)
Remember to change the DNS setting on your home network router so it that uses the address of your pi board. Otherwise, the ads wont be filtered!
The instructions above are more or less the same as the alternative “safe” method as provided by the Pi-hole web site despite the fact that Armbian is not listed as an officially supported operating system. I believe that these instructions should work on a Raspberry Pi or other pi board running some form of Debian based Linux operating system. However, I havent tested that and I would be interested to hear your experience (just drop me a brief comment, please).
### Thoughts and Observations
After running Pi-hole for a while an studying the information in the Pi-hole dashboard, I found that there was a lot more network activity going on than I was aware of, not all of which did I approve of. For example, there were some interesting connections going out from my kids devices related to game apps that I wonder about, plus social networking apps were apparently sending some data continuously which bothered me. Altogether, whether it was benign traffic or not, I was glad to reduce the traffic load even if by a little…I mean, why should I be content to allow apps and ads to eat up my network traffic for things I dont want or care about? Well, now they are blocked. Period.
Setting up an Orange Pi for ad blocking like this is cheap, easy, and helps to put my mind at ease about limiting some unwanted traffic to/from my home network (especially where the kids are involved). If you are interested, you can see my previous post about how to [easily setting up an Orange Pi][3] and check out how cheap the Orange Pis are at the links below.  I believe that it is a worthwhile investment.
Orange Pi on Amazon (affiliate link):  [Orange Pi PC Single Board Computer Quad Core ARM Cortex-A7 1GB DDR3 4K Decode][4]
[Orange Pi store on AliExpress][5] (affiliate link).
EDIT:  The irony of this post is that if you successfully set up Pi-hole, then affiliate links on this site (s.click.aliexpress.com) gets blocked.  White list that if you like, you are in control.
--------------------------------------------------------------------------------
via: http://piboards.com/2017/01/07/block-ads-on-all-your-devices-at-home-with-pi-hole-and-an-orange-pi/
作者:[MIKE WILMOTH][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://piboards.com/author/piguy/
[1]:http://s.click.aliexpress.com/deep_link.htm?aff_short_key=N3VJQBY&dl_target_url=http://best.aliexpress.com
[2]:https://pi-hole.net/
[3]:http://piboards.com/2017/01/04/easy-set-up-orange-pi/
[4]:https://www.amazon.com/gp/product/B018W6OTIM/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B018W6OTIM&linkCode=as2&tag=piboards-20&linkId=ac292a536d58eabf1ee73e2c575e1111
[5]:http://s.click.aliexpress.com/e/bAMVj2R

View File

@ -0,0 +1,100 @@
3 Useful VIM Editor Tips and Tricks for Advanced Users
============================================================
![](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2017/01/vim-featured.jpg "3 Useful VIM Editor Tips and Tricks for Advanced Userss")
This article is part of the [VIM User Guide][12] series:
* [The Beginners Guide to Start Using Vim][3]
* [Vim Keyboard Shortcuts Cheatsheet][4]
* [5 Vim Tips and Tricks for Experienced Users][5]
* 3 Useful VIM Editor Tips and Tricks for Advanced Users
Vim is undoubtedly a very powerful text editor. It offers a plethora of features which means that studying and remembering every Vim functionality isnt practically possible. But what we can do at least is keep learning easier ways of doing things so that our experience with the editor keeps on getting better with time.
With that in mind, in this article we will discuss some Vim editor tips/tricks that are aimed at advanced users.
**Note**: If you are completely new to Vim, you can first go through our [getting started guide][14]. For those whove just started using the editor, Im sure our [Vim keyboard shortcuts cheatsheet][15] will be extremely useful to you. And if youre already an experienced user, you might also want to find out [some tips and tricks for experienced users][16].
Please note that all the tips mentioned in this article have been mostly explained using easy-to-understand coding situations, as they come in really handy while software development. But that does not mean normal users (who arent coders and use Vim for general text editing) cant use them in their work.
### 1\. Set file specific variables
There may be times when in a particular file you would want any tab character that you type to get replaced by spaces. Or you may want a source code file to use two spaces for indentation even if the editors default indentation is set to four spaces.
Basically were talking about file-specific changes here. Theres a feature that Vim provides which allows you to change certain settings only for a particular file. That feature is called “Modeline.”
For example, to make sure that each tab you type gets replaced by spaces, all you have to do is to add the following modeline in the first or last few lines of the file in question:
```
# vim: set expandtab:
```
And to change the indentation from default (4) to 2, use the following modeline in the source file:
```
// vim: noai:ts=2:sw=2
```
Here are some important points that you need to keep in mind when dealing with modelines:
* Modelines should only be added in the first or last five lines of the file.
* The “modeline” option must be set (`:set modeline`) in the “.vimrc” file order to take advantage of this feature.
* The feature is off by default when editing as root.
For more information, head to the features [official documentation][17].
### 2\. Keyword completion
As you start writing more and more complex code or start working on large source files, you deal with several variable names. Sometimes its not easy to remember all the names, so whenever you have to write a variable name you usually copy it from where its already used.
Thankfully, with Vim you can just write some initial letters of the variable. Without leaving the Insert mode, press “Ctrl + n” or “Ctrl + p” to get a list of matching keywords. While “Ctrl + n” is used to insert the next matching word, “Ctrl + p” gives you a list of previous matching words.
Heres this feature in action.
![vim-keyword-completion1](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2017/01/vim-keyword-completion1.jpg "vim-keyword-completion1")
As is clear from the screenshot above, the list that pops up also contains words from other source files. For more information on this feature, head [here][18].
### 3\. Searching
Suppose you are debugging your code, and as part of that you need to quickly see all the occurrences of a variable in a file. A commonly used way to do this is to come out of the Insert mode, write `/[var-name]`, press Enter, and then go back and forth using the “n” and “p” keys.
Theres no problem with the aforementioned approach, per se, but theres a slightly more easier and quicker way to do this kind of search. For that, first you have to make sure that you are out of Insert mode and that the cursor is under the word/variable youre trying to search, which isnt time consuming at all. And next, all you have to do is press “Shift + *.”
Do this repeatedly, and the editor will quickly take you to all the places where the word/variable is used in the file.
### Conclusion
Although aimed at advanced users, the tips/tricks discussed here arent difficult to understand and use. If your basics are clear, you can really benefit from them. Needless to say, as with any new feature or concept, you need to practice these tips to make them a habit.
--------------------------------------------------------------------------------
via: https://www.maketecheasier.com/vim-tips-tricks-advanced-users/
作者:[Himanshu Arora][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.maketecheasier.com/author/himanshu/
[1]:https://www.maketecheasier.com/author/himanshu/
[2]:https://www.maketecheasier.com/vim-tips-tricks-advanced-users/#respond
[3]:https://www.maketecheasier.com/start-with-vim-linux/
[4]:https://www.maketecheasier.com/vim-keyboard-shortcuts-cheatsheet/
[5]:https://www.maketecheasier.com/vim-tips-tricks-for-experienced-users/
[6]:https://www.maketecheasier.com/category/linux-tips/
[7]:http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.maketecheasier.com%2Fvim-tips-tricks-advanced-users%2F
[8]:http://twitter.com/share?url=https%3A%2F%2Fwww.maketecheasier.com%2Fvim-tips-tricks-advanced-users%2F&text=3+Useful+VIM+Editor+Tips+and+Tricks+for+Advanced+Users
[9]:mailto:?subject=3%20Useful%20VIM%20Editor%20Tips%20and%20Tricks%20for%20Advanced%20Users&body=https%3A%2F%2Fwww.maketecheasier.com%2Fvim-tips-tricks-advanced-users%2F
[10]:https://www.maketecheasier.com/opt-out-google-personalized-ads/
[11]:https://www.maketecheasier.com/wi-fi-vs-ethernet-vs-4g/
[12]:https://www.maketecheasier.com/series/vim-user-guide/
[13]:https://support.google.com/adsense/troubleshooter/1631343
[14]:https://www.maketecheasier.com/start-with-vim-linux/
[15]:https://www.maketecheasier.com/vim-keyboard-shortcuts-cheatsheet/
[16]:https://www.maketecheasier.com/vim-tips-tricks-for-experienced-users/
[17]:http://vim.wikia.com/wiki/Modeline_magic
[18]:http://vim.wikia.com/wiki/Any_word_completion

View File

@ -0,0 +1,433 @@
How to Install Nextcloud with Nginx and PHP7-FPM on CentOS 7
============================================================
### On this page
1. [Step 1 - Install Nginx and PHP7-FPM on CentOS 7][1]
2. [Step 2 - Configure PHP7-FPM][2]
3. [Step 3 - Install and Configure MariaDB][3]
4. [Step 4 - Generate a Self-signed SSL Certificate for Nextcloud][4]
5. [Step 5 - Download and Install Nextcloud][5]
6. [Step 6 - Configure Nextcloud Virtual Host in Nginx][6]
7. [Step 7 - Configure SELinux and FirewallD for Nextcloud][7]
8. [Step 8 - Nextcloud Installation Wizard][8]
9. [Reference][9]
Nextcloud is a free (Open Source) Dropbox-like software, a fork of the ownCloud project. Nextcloud is written in PHP and JavaScript, it supports many database systems such as, MySQL/MariaDB, PostgreSQL, Oracle Database and SQLite. In order to keep your files synchronized between Desktop and your own server, Nextcloud provides applications for Windows, Linux and Mac desktops and a mobile app for android and iOS. Nextcloud is not just a dropbox clone, it provides additional features like Calendar, Contacts, Schedule tasks, and streaming media with Ampache.
In this tutorial, I will show you how to install and configure the latest Nextcloud 10 release on a CentOS 7 server. I will run Nextcloud with a Nginx web server and PHP7-FPM and use MariaDB as the database system.
**Prerequisite**
* CentOS 7 64bit
* Root privileges on the server
### Step 1 - Install Nginx and PHP7-FPM on CentOS 7
Before we start with the Nginx and php7-fpm installation, we have to add the EPEL package repository. Install it with this yum command.
yum -y install epel-release
Now install Nginx from the EPEL repository.
yum -y install nginx
Then we have to add another repository for php7-fpm. There are several repositories available on the net that provide PHP 7 packages, I will use webtatic here.
Add the PHP7-FPM webtatic repository:
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Next, install PHP7-FPM and some additional packages for the Nextcloud installation.
yum -y install php70w-fpm php70w-cli php70w-gd php70w-mcrypt php70w-mysql php70w-pear php70w-xml php70w-mbstring php70w-pdo php70w-json php70w-pecl-apcu php70w-pecl-apcu-devel
Finally, check the PHP version from server terminal to verify that PHP installed correctly.
php -v
[
![Check the PHP version on CentOS](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/1.png)
][10]
### Step 2 - Configure PHP7-FPM
In this step, we will configure php-fpm to run with Nginx. Php7-fpm will run under user nginx and listen on port 9000.
Edit the default php7-fpm configuration file with vim.
vim /etc/php-fpm.d/www.conf
In line 8 and 10, change user and group to '**nginx**'.
user = nginx
group = nginx
In line 22, make sure php-fpm is running under server port.
listen = 127.0.0.1:9000
Uncomment line 366-370 to activate the php-fpm system environment variables.
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
Save the file and exit the vim editor.
Next, create a new directory for the session path in the '/var/lib/' directory, and change the owner to the 'nginx' user.
mkdir -p /var/lib/php/session
chown nginx:nginx -R /var/lib/php/session/
Now start php-fpm and Nginx, then enable the services to start at boot time.
sudo systemctl start php-fpm
sudo systemctl start nginx
sudo systemctl enable php-fpm
sudo systemctl enable nginx
[
![Start Nginx and PHP-FPM](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/2.png)
][11]
PHP7-FPM configuration is done.
### Step 3 - Install and Configure MariaDB
I will use MariaDB for the Nextcloud database. Install the mariadb-server package from the CentOS repository with yum.
yum -y install mariadb mariadb-server
Start the MariaDB service and add it to run at boot time.
systemctl start mariadb
systemctl enable mariadb
Now configure the MariaDB root password.
mysql_secure_installation
Type in your root password when requested.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
The MariaDB root password has been set, now we can login to the mysql shell to create a new database and a new user for Nextcloud. I will create a new database named '**nextcloud_db**' and a user '**nextclouduser**' with password '**nextclouduser@**'. Choose a secure password for your installation!
mysql -u root -p
Type Password
Type in the mysql query below to create a new database and a new user.
create database nextcloud_db;
create user nextclouduser@localhost identified by 'nextclouduser@';
grant all privileges on nextcloud_db.* to nextclouduser@localhost identified by 'nextclouduser@';
flush privileges;
[
![Create a Nextcloud database and user in MariaDB](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/3.png)
][12]
The nextcloud_db database with user 'nextclouduser' has been created.
### Step 4 - Generate a Self-signed SSL Certificate for Nextcloud
In this tutorial, I will run nextcloud with a https connection for the client. You can use free SSL such as let's encrypt or create  <g class="gr_ gr_207 gr-alert gr_gramm gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" id="207" data-gr-id="207">self signed</g> SSL certificate. I will create my own self-signed SSL certificate file with the OpenSSL command.
Create a new directory for the SSL file.
mkdir -p /etc/nginx/cert/
And generate a new SSL certificate file with the the openssl command below.
openssl req -new -x509 -days 365 -nodes -out /etc/nginx/cert/nextcloud.crt -keyout /etc/nginx/cert/nextcloud.key
Finally, change the permission of all certificate files to 600 with chmod.
chmod 700 /etc/nginx/cert
chmod 600 /etc/nginx/cert/*
[
![Generate new SSL Certificate file for Nextcloud](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/4.png)
][13]
### Step 5 - Download and Install Nextcloud
We will download Nextcloud with wget directly to the server, so we have to install wget first. Additionally, we need the unzip program. Install both applications with yum.
yum -y install wget unzip
Go to the /tmp directory and download latest stable Nextcloud 10 version from the Nextcloud web site with wget.
cd /tmp
wget https://download.nextcloud.com/server/releases/nextcloud-10.0.2.zip
Extract the nextcloud zip file and move it's content to the '/usr/share/nginx/html/' directory.
unzip nextcloud-10.0.2.zip
mv nextcloud/ /usr/share/nginx/html/
Next, go to the Nginx web root directory and create a new 'data' directory for Nextcloud.
cd /usr/share/nginx/html/
mkdir -p nextcloud/data/
Change the owner of the 'nextcloud' directory to the 'nginx' user and group.
chown nginx:nginx -R nextcloud/
### Step 6 - Configure Nextcloud Virtual Host in Nginx
In step 5 we've downloaded the Nextcloud source code and configured it to run under the Nginx web server. But we still need to configure a virtual host for Nextcloud. Create a new virtual host configuration file 'nextcloud.conf' in the Nginx 'conf.d' directory.
cd /etc/nginx/conf.d/
vim nextcloud.conf
Paste the Nextcloud virtual host configuration below.
```
upstream php-handler {
    server 127.0.0.1:9000;
    #server unix:/var/run/php5-fpm.sock;
}
server {
    listen 80;
    server_name cloud.nextcloud.co;
    # enforce https
    return 301 https://$server_name$request_uri;
}
server {
    listen 443 ssl;
    server_name cloud.nextcloud.co;
    ssl_certificate /etc/nginx/cert/nextcloud.crt;
    ssl_certificate_key /etc/nginx/cert/nextcloud.key;
    # Add headers to serve security related headers
    # Before enabling Strict-Transport-Security headers please read into this
    # topic first.
    add_header Strict-Transport-Security "max-age=15768000;
    includeSubDomains; preload;";
    add_header X-Content-Type-Options nosniff;
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Robots-Tag none;
    add_header X-Download-Options noopen;
    add_header X-Permitted-Cross-Domain-Policies none;
    # Path to the root of your installation
    root /usr/share/nginx/html/nextcloud/;
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    # The following 2 rules are only needed for the user_webfinger app.
    # Uncomment it if you're planning to use this app.
    #rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
    #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json
    # last;
    location = /.well-known/carddav {
      return 301 $scheme://$host/remote.php/dav;
    }
    location = /.well-known/caldav {
      return 301 $scheme://$host/remote.php/dav;
    }
    # set max upload size
    client_max_body_size 512M;
    fastcgi_buffers 64 4K;
    # Disable gzip to avoid the removal of the ETag header
    gzip off;
    # Uncomment if your server is build with the ngx_pagespeed module
    # This module is currently not supported.
    #pagespeed off;
    error_page 403 /core/templates/403.php;
    error_page 404 /core/templates/404.php;
    location / {
        rewrite ^ /index.php$uri;
    }
    location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
        deny all;
    }
    location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
        deny all;
    }
    location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
        include fastcgi_params;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param HTTPS on;
        #Avoid sending the security headers twice
        fastcgi_param modHeadersAvailable true;
        fastcgi_param front_controller_active true;
        fastcgi_pass php-handler;
        fastcgi_intercept_errors on;
        fastcgi_request_buffering off;
    }
    location ~ ^/(?:updater|ocs-provider)(?:$|/) {
        try_files $uri/ =404;
        index index.php;
    }
    # Adding the cache control header for js and css files
    # Make sure it is BELOW the PHP block
    location ~* \.(?:css|js)$ {
        try_files $uri /index.php$uri$is_args$args;
        add_header Cache-Control "public, max-age=7200";
        # Add headers to serve security related headers (It is intended to
        # have those duplicated to the ones above)
        # Before enabling Strict-Transport-Security headers please read into
        # this topic first.
        add_header Strict-Transport-Security "max-age=15768000;
        includeSubDomains; preload;";
        add_header X-Content-Type-Options nosniff;
        add_header X-Frame-Options "SAMEORIGIN";
        add_header X-XSS-Protection "1; mode=block";
        add_header X-Robots-Tag none;
        add_header X-Download-Options noopen;
        add_header X-Permitted-Cross-Domain-Policies none;
        # Optional: Don't log access to assets
        access_log off;
    }
    location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
        try_files $uri /index.php$uri$is_args$args;
        # Optional: Don't log access to other assets
        access_log off;
    }
}
```
Save the file and exit vim.
Now test the Nginx configuration to ensure that there are no error,s- Then restart the service.
nginx -t
systemctl restart nginx
[
![Nextcloud Virtual Host Nginx](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/5.png)
][14]
### Step 7 - Configure SELinux and FirewallD for Nextcloud
In this tutorial, we will leave SELinux on in enforcing mode, so we need a new package SELinux management tools to configure SELinux for Nextcloud.
Install the SELinux management tools with this command.
yum -y install policycoreutils-python
Then execute the commands below as root user to allow Nextcloud to run under SELinux. Remember to change the Nextcloud directory in case you use a different directory.
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/html/nextcloud/data(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/html/nextcloud/config(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/html/nextcloud/apps(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/html/nextcloud/assets(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/html/nextcloud/.htaccess'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/html/nextcloud/.user.ini'
restorecon -Rv '/usr/share/nginx/html/nextcloud/'
Next, we will enable the firewalld service and open the HTTP and HTTPS ports for Nextcloud.
Start firewalld and enable it to start at boot time.
systemctl start firewalld
systemctl enable firewalld
Now open the HTTP and HTTPS ports with the firewall-cmd command, then reload the firewall.
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
[
![Configure Firewalld for Nextcloud](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/6.png)
][15]
All the server configuration is done.
### Step 8 - Nextcloud Installation Wizard
Open your web browser and type in your Nextcloud domain name, mine is: cloud.nextcloud.co. You will be redirected to the secure https connection.
Type in your desired admin user name and password, and then type in your database credentials. Click '**Finish Setup**'.
[
![Nextcloud stup wizards on CentOS 7](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/7.png)
][16]
The Nextcloud Admin Dashboard (File Manager) appears.
[
![Nextcloud Admin Dashboard File Manager](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/8.png)
][17]
Nextcloud User Settings.
[
![Nextcloud user settings](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/9.png)
][18]
Admin Settings.
[
![The Nextcloud admin area](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/10.png)
][19]
Nextcloud has been installed with Nginx, PHP7-FPM, and MariaDB on a CentOS 7 Server.
--------------------------------------------------------------------------------
via: https://www.howtoforge.com/tutorial/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/
作者:[Muhammad Arul][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.howtoforge.com/tutorial/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/
[1]:https://www.howtoforge.com/tutorial/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/#step-install-nginx-and-phpfpm-on-centos-
[2]:https://www.howtoforge.com/tutorial/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/#step-configure-phpfpm
[3]:https://www.howtoforge.com/tutorial/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/#step-install-and-configure-mariadb
[4]:https://www.howtoforge.com/tutorial/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/#step-generate-a-selfsigned-ssl-certificate-for-nextcloud
[5]:https://www.howtoforge.com/tutorial/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/#step-download-and-install-nextcloud
[6]:https://www.howtoforge.com/tutorial/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/#step-configure-nextcloud-virtual-host-in-nginx
[7]:https://www.howtoforge.com/tutorial/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/#step-configure-selinux-and-firewalld-for-nextcloud
[8]:https://www.howtoforge.com/tutorial/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/#step-nextcloud-installation-wizard
[9]:https://www.howtoforge.com/tutorial/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/#reference
[10]:https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/big/1.png
[11]:https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/big/2.png
[12]:https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/big/3.png
[13]:https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/big/4.png
[14]:https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/big/5.png
[15]:https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/big/6.png
[16]:https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/big/7.png
[17]:https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/big/8.png
[18]:https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/big/9.png
[19]:https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/big/10.png

View File

@ -0,0 +1,114 @@
Best Linux Distributions for New Users
============================================================
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/distros-new-users.jpg?itok=Prp88H71)
Jack Wallen considers which Linux distributions are best designed for new users coming from different environments.[Creative Commons Zero][5]Pixabay
Ah, the age-old question...one that holds far more importance than simply pointing out which Linux distribution is a fan-favorite. Why is that?
Let me set the stage: You have a user—one who has, most likely, spent the majority of their time in front of either a Windows or Mac machine—and theyve come to you for an alternative. You want to point them in a direction that will bring about the least amount of hiccups along the way and highlight the power and flexibility of Linux.
But, remember, the single most important aspect is that they must _get it_, out of the box.
Thats why we often take the time to point out which distributions are best designed for new users -- because bringing new users into the mix is the best way to spread the word and grow the base. 
With that said, what are the best distributions for new users? Im going to take a bit of a different approach this time and point out which distributions would be best for users coming from different environments. You can also check out my list of [best distros for 2017][11].
[
![Advertisement for Intro to Linux](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/introtolinux_1_800x200.jpg?itok=VV8GZold "Advertisement for Intro to Linux")
][12]
### From Windows 7 to Linux: ZorinOS
When Windows 8 rolled out, there was a reason so many wanted to stick with Windows 7—familiarity. Users had been working with the same desktop metaphor for decades and they had no desire to migrate to the more touchscreen-centric platform of Windows 8\. So, what distribution do you turn to for that? You first must consider desktop environment. Why? Because that is where you immediately hook those Windows 7 users. And what better distribution for such a task than [ZorinOS][13]?
ZorinOS was designed specifically as a replacement for Windows (and Mac) computers, so it goes a very long way to replicate the look and feel of those desktops. In fact, youd be hard-pressed to find a Linux distribution that does as good a job of making the transition from Windows 7 to Linux—while still retaining that which makes Linux such a powerful, flexible platform.
Beyond the desktop environment (Figure 1), ZorinOS is based on Ubuntu, so under the hood, everything is going to just work (so theres little need to worry their hardware wont be detected). Couple that with the readily available software and you have the perfect distribution for new users coming from Windows 7.
### [zorinos.jpg][6]
![ZorinOS](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zorinos.jpg?itok=i970f1Id "ZorinOS")
Figure 1: The ZorinOS Windows 7-like desktop ready to serve.[Used with permission][1]
Do note, however, there are two versions of ZorinOS: Zorin Ultimate and Zorin Core. While Core is free, it doesnt include nearly the amount of software that youll find in Ultimate. If you want an out of the box distribution that will please anyone coming from Windows 7, I highly recommend purchasing [Zorin Ultimate][14] (for approximately $20.00 USD). Of course, if you dont want to splurge for the Ultimate edition, you can always install nearly everything you need from the included Software package management tool.
[
![Advertisement for New Year&#039;s resolution to be a Linux sysadmin](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/newyearsresolution_1_800x200.jpg?itok=BeGasy1I "Advertisement for New Year&#039;s resolution to be a Linux sysadmin")
][15]
### From Windows 8 to Linux: Ubuntu GNOME
The shift to Windows 8, brought about a very touchscreen-centric environment that changed the way users interact with their machines. The old metaphor of Star Menu/Panel/System tray was replaced with an interface that shined in a touchscreen environment. If youre looking for the best environment to give a new-to-Linux user something different, yet still function as a best-in-breed should, look no further than [Ubuntu GNOME][16].
Ubuntu GNOME is a best of two worlds amalgamation between Ubuntu and GNOME (Figure 2). Replacing the Unity interface with a desktop that is equal parts modern elegance and user-friendly simplicity, Ubuntu GNOME shouldnt cause much in the way of issues for any user coming from Windows 8\. Not only does this distribution lay its foundation on the latest LTS release of Ubuntu (so support will last), it makes use of the latest stable release of the GNOME desktop—which means the user will enjoy an incredibly solid experience.  
### [ubuntugnome.jpg][7]
![Ubuntu GNOME](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ubuntugnome.jpg?itok=SNjA3y7T "Ubuntu GNOME")
Figure 2: Simplicity at its elegant best can be found in Ubuntu GNOME.[Used with permission][2]
### From Mac to Linux: Elementary OS
Without a doubt, the hands-down winner for this category is [Elementary OS][17]. Although Elementary does an incredible job of looking and feeling like an OS X desktop, it is much more than that. Elementary OS is, at its very heart, Linux—it just happens to have taken a cue from OS X for many of the design elements.
Any Mac user would feel immediately at home on the desktop environment (Figure 3). With an all-too familiar doc and the inclusion of an applications menu, Elementary OS always stands at the top of my best-of distribution list. And, if were talking about Mac users, there is no better drop-in replacement than Elementary OS.
### [elementaryos.jpg][8]
![Elementary OS](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/elementaryos.jpg?itok=qaXRClRM "Elementary OS")
Figure 3: The glory that is the Elementary OS desktop.[Used with permission][3]
One thing that Mac users will greatly appreciate is how great a job the Elementary OS developers have done keeping design consistency throughout the desktop. From the dock, panel, menus, and included applications, you will not find a single element that doesnt look and feel like it belongs.
There is one caveat that I would add to Elementary OS. Youll need to install a sufficient browser (as it “ships” with Epiphany—a browser not widely supported by many necessary sites) and youll want to install LibreOffice from the downloadable package from the official [LibreOffice site][18] (as the package found in the Elementary OS AppCenter is a bit out of date).
### From Android to Linux: Ubuntu 
This may seem like a bit of a stretch, but considering how dominant Android is within the global market, you will come across users who might need a Linux desktop that would make them feel instantly at home, after coming from a more mobile-centric interface. For me, there is no clearer winner than [Ubuntu][19]. Why? Ubuntu Unity does an outstanding job of making the desktop feel more like an all-encompassing interface than any other. If you want, you can include online search results (now disabled by default), which is something found in nearly every mobile environment. Also, the Unity HUD menu system (Figure 4) is one of the most unique menu systems found in any interface. With this, users can depend less on the mouse (as they would on a mobile device powered by Android).
### [ubuntu.jpg][9]
![Ubuntu Unity](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ubuntu.jpg?itok=HsvBJAIN "Ubuntu Unity")
Figure 4: The Unity Heads Up Display in action.[Used with permission][4]
Of course, Ubuntu also offers one of the most stable desktop platforms on the market, so the user experience will be nearly flawless.
### Theres a distribution for everyone
One of the important things to remember is that there is a distribution of Linux that is sure to please everyone. But for those coming from specific environments, I highly recommend finding a flavor of Linux that will help make the transition seamless. Give one of these a try and see if you find yourself humming along smoothly with the power of Linux and open source at your fingertips.
--------------------------------------------------------------------------------
via: https://www.linux.com/news/best-linux-distributions-new-users
作者:[JACK WALLEN][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.linux.com/users/jlwallen
[1]:https://www.linux.com/licenses/category/used-permission
[2]:https://www.linux.com/licenses/category/used-permission
[3]:https://www.linux.com/licenses/category/used-permission
[4]:https://www.linux.com/licenses/category/used-permission
[5]:https://www.linux.com/licenses/category/creative-commons-zero
[6]:https://www.linux.com/files/images/zorinosjpg
[7]:https://www.linux.com/files/images/ubuntugnomejpg
[8]:https://www.linux.com/files/images/elementaryosjpg-1
[9]:https://www.linux.com/files/images/ubuntujpg
[10]:https://www.linux.com/files/images/distros-new-usersjpg
[11]:https://www.linux.com/news/learn/sysadmin/best-linux-distributions-2017
[12]:http://bit.ly/2jJgK0Q
[13]:https://zorinos.com/
[14]:https://zorinos.com/download/#ultimate
[15]:https://training.linuxfoundation.org/certification/lfcs?utm_source=linux-inline-ad&utm_campaign=new-users-2017&utm_medium=online-advertising&utm_content=new-year
[16]:https://ubuntugnome.org/
[17]:https://elementary.io/
[18]:http://www.libreoffice.org/download/libreoffice-fresh/
[19]:https://www.ubuntu.com/

View File

@ -0,0 +1,463 @@
How to install a Ceph Storage Cluster on Ubuntu 16.04
============================================================
### On this page
1. [Step 1 - Configure All Nodes][1]
2. [Step 2 - Configure the SSH Server][2]
3. [Step 3 - Configure the Ubuntu Firewall][3]
4. [Step 4 - Configure the Ceph OSD Nodes][4]
5. [Step 5 - Build the Ceph Cluster][5]
6. [Step 6 - Testing Ceph][6]
7. [Reference][7]
Ceph is an open source storage platform, it provides high performance, reliability, and scalability. It's a free distributed storage system that provides an interface for object, block, and file-level storage and can operate without a single point of failure.
In this tutorial, I will guide you to install and build a Ceph cluster on Ubuntu 16.04 server. A Ceph cluster consists of these components:
* **Ceph OSDs (ceph-osd)** - Handles the data storage, data replication, and recovery. A Ceph cluster needs at least two Ceph OSD servers. We will use three Ubuntu 16.04 servers in this setup.
* **Ceph Monitor (ceph-mon)** - Monitors the cluster state and runs the OSD map and CRUSH map. We will use one server here.
* **Ceph Meta Data Server (ceph-mds)** - this is needed if you want to use Ceph as a File System.
### **Prerequisites**
* 6 server nodes with Ubuntu 16.04 server installed
* Root privileges on all nodes
I will use the following hostname / IP setup:
**hostname**        **IP address**
_ceph-admin        10.0.15.10
mon1                 10.0.15.11
osd1                  10.0.15.21
osd2                  10.0.15.22
osd3                  10.0.15.23
client                 10.0.15.15_
### Step 1 - Configure All Nodes
In this step, we will configure all 6 nodes to prepare them for the installation of the Ceph Cluster software. So you have to follow and run the commands below on all nodes. And make sure that ssh-server is installed on all nodes.
**Create the Ceph User**
Create a new user named '**cephuser**' on all nodes.
useradd -m -s /bin/bash cephuser
passwd cephuser
After creating the new user, we need to configure **cephuser** for passwordless sudo privileges. This means that 'cephuser' can run and get sudo privileges without having to enter a password first.
Run the commands below to achieve that.
echo "cephuser ALL = (root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/cephuser
chmod 0440 /etc/sudoers.d/cephuser
sed -i s'/Defaults requiretty/#Defaults requiretty'/g /etc/sudoers
**Install and Configure NTP**
Install NTP to synchronize date and time on all nodes. Run the ntpdate command to set the date and time via NTP. We will use the US pool NTP servers. Then start and enable NTP server to run at boot time.
sudo apt-get install -y ntp ntpdate ntp-doc
ntpdate 0.us.pool.ntp.org
hwclock --systohc
systemctl enable ntp
systemctl start ntp
**Install Open-vm-tools
**
If you are running all nodes inside VMware, you need to install this virtualization utility.
sudo apt-get install -y open-vm-tools
**Install Python and parted
**
In this tutorial, we need python packages for building the ceph-cluster. Install python and python-pip.
sudo apt-get install -y python python-pip parted
**Configure the Hosts File**
Edit the hosts file on all nodes with vim editor.
vim /etc/hosts
Paste the configuration below:
```
10.0.15.10        ceph-admin
10.0.15.11        mon1
10.0.15.21        ceph-osd1
10.0.15.22        ceph-osd2
10.0.15.23        ceph-osd3
10.0.15.15        ceph-client
```
Save the hosts file and exit the vim editor.
Now you can try to ping between the server hostnames to test the network connectivity.
ping -c 5 mon1
[
![Ceph cluster Installation on Ubuntu 16.04](https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/1.png)
][8]
### Step 2 - Configure the SSH Server
In this step, we will configure the **ceph-admin node**. The admin node is used for configuring the monitor node and osd nodes. Login to the ceph-admin node and access the '**cephuser**'.
ssh root@ceph-admin
su - cephuser
The admin node is used for installing and configuring all cluster node, so the user on the ceph-admin node must have privileges to connect to all nodes without a password. We need to configure password-less SSH access for 'cephuser' on the 'ceph-admin' node.
Generate the ssh keys for '**cephuser**'.
ssh-keygen
Leave passphrase is blank/empty.
Next, create a configuration file for the ssh config.
vim ~/.ssh/config
Paste the configuration below:
```
Host ceph-admin
        Hostname ceph-admin
        User cephuser
Host mon1
        Hostname mon1
        User cephuser
Host ceph-osd1
        Hostname ceph-osd1
        User cephuser
Host ceph-osd2
        Hostname ceph-osd2
        User cephuser
Host ceph-osd3
        Hostname ceph-osd3
        User cephuser
Host ceph-client
        Hostname ceph-client
        User cephuser
```
Save the file and exit vim.
[
![Ceph-admin configuration](https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/2.png)
][9]
Change the permission of the config file to 644.
chmod 644 ~/.ssh/config
Now add the key to all nodes with the ssh-copy-id command.
ssh-keyscan ceph-osd1 ceph-osd2 ceph-osd3 ceph-client mon1 >> ~/.ssh/known_hosts
ssh-copy-id ceph-osd1
ssh-copy-id ceph-osd2
ssh-copy-id ceph-osd3
ssh-copy-id mon1
Type in your cephuser password when requested.
[
![Ceph-admin deploy ssh key to all cluster nodes](https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/3.png)
][10]
Now try to access the osd1 server from the ceph-admin node to test if the password-less login works.
ssh ceph-osd1
[
![SSH Less password from ceph-admin to all nodes cluster](https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/4.png)
][11]
### Step 3 - Configure the Ubuntu Firewall
For security reasons, we need to turn on the firewall on the servers. Preferably we use Ufw (Uncomplicated Firewall), the default Ubuntu firewall, to protect the system. In this step, we will enable ufw on all nodes, then open the ports needed by ceph-admin, ceph-mon and ceph-osd.
Login to the ceph-admin node and install the ufw packages.
ssh root@ceph-admin
sudo apt-get install -y ufw
Open port 80, 2003 and 4505-4506, then reload firewalld.
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 2003/tcp
sudo ufw allow 4505:4506/tcp
Start and enable ufw to start at boot time.
sudo ufw enable
[
![UFW Firewall with Ceph service](https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/5.png)
][12]
From the ceph-admin node, login to the monitor node 'mon1' and install ufw.
ssh mon1
sudo apt-get install -y ufw
Open the ports for the ceph monitor node and start ufw.
sudo ufw allow 22/tcp
sudo ufw allow 6789/tcp
sudo ufw enable
Finally, open these ports on each osd node: ceph-osd1, ceph-osd2 and ceph-osd3 - port 6800-7300.
Login to each of the ceph-osd nodes from the ceph-admin, and install ufw.
ssh ceph-osd1
sudo apt-get install -y ufw
Open the ports on the osd nodes and reload firewalld.
sudo ufw allow 22/tcp
sudo ufw allow 6800:7300/tcp
sudo ufw enable
The ufw firewall configuration is finished.
### Step 4 - Configure the Ceph OSD Nodes
In this tutorial, we have 3 OSD nodes, each of these nodes has two hard disk partitions.
1. **/dev/sda** for root partition
2. **/dev/sdb** is empty partition - 20GB
We will use **/dev/sdb** for the ceph disk. From the ceph-admin node, login to all OSD nodes and format the /dev/sdb partition with **XFS** file system.
ssh ceph-osd1
ssh ceph-osd2
ssh ceph-osd3
Check the partition scheme with the fdisk command.
sudo fdisk -l /dev/sdb
Format the /dev/sdb partition with an XFS filesystem and with a GPT partition table by using the parted command.
sudo parted -s /dev/sdb mklabel gpt mkpart primary xfs 0% 100%
Next, format the partition in XFS format with the mkfs command.
sudo mkfs.xfs -f /dev/sdb
Now check the partition, and you will see a XFS /dev/sdb partition.
sudo fdisk -s /dev/sdb
sudo blkid -o value -s TYPE /dev/sdb
[
![Format partition ceph OSD nodes](https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/6.png)
][13]
### Step 5 - Build the Ceph Cluster
In this step, we will install Ceph on all nodes from the ceph-admin. To get started, login to the ceph-admin node.
ssh root@ceph-admin
su - cephuser
**Install ceph-deploy on ceph-admin node**
In the first step we've already installed python and python-pip on to the system. Now we need to install the Ceph deployment tool '**ceph-deploy**' from the pypi python repository.
Install ceph-deploy on the ceph-admin node with the pip command.
sudo pip install ceph-deploy
Note: Make sure all nodes are updated.
After the ceph-deploy tool has been installed, create a new directory for the Ceph cluster configuration.
**Create a new Cluster**
Create a new cluster directory.
mkdir cluster
cd cluster/
Next, create a new cluster with the '**ceph-deploy**' command by defining the monitor node '**mon1**'.
ceph-deploy new mon1
The command will generate the Ceph cluster configuration file 'ceph.conf' in cluster directory.
[
![Generate new ceph cluster configuration](https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/7.png)
][14]
Edit the ceph.conf file with vim.
vim ceph.conf
Under the [global] block, paste the configuration below.
```
# Your network address
public network = 10.0.15.0/24
osd pool default size = 2
```
Save the file and exit the editor.
**Install Ceph on All Nodes**
Now install Ceph on all nodes from the ceph-admin node with a single command.
ceph-deploy install ceph-admin ceph-osd1 ceph-osd2 ceph-osd3 mon1
The command will automatically install Ceph on all nodes: mon1, osd1-3 and ceph-admin - The installation will take some time.
Now deploy the monitor node on the mon1 node.
ceph-deploy mon create-initial
The command will create a monitor key, check the key with this ceph command.
ceph-deploy gatherkeys mon1
[
![Deploy key ceph](https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/8.png)
][15]
**Adding OSDS to the Cluster**
After Ceph has been installed on all nodes, now we can add the OSD daemons to the cluster. OSD Daemons will create the data and journal partition on the disk /dev/sdb.
Check the available disk /dev/sdb on all osd nodes.
ceph-deploy disk list ceph-osd1 ceph-osd2 ceph-osd3
[
![disk list of osd nodes](https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/9.png)
][16]
You will see /dev/sdb with the XFS format that we created before.
Next, delete the partition tables on all nodes with the zap option.
ceph-deploy disk zap ceph-osd1:/dev/sdb ceph-osd2:/dev/sdb ceph-osd3:/dev/sdb
The command will delete all data on /dev/sdb on the Ceph OSD nodes.
Now prepare all OSD nodes and ensure that there are no errors in the results.
ceph-deploy osd prepare ceph-osd1:/dev/sdb ceph-osd2:/dev/sdb ceph-osd3:/dev/sdb
When you see the ceph-osd1-3 is ready for OSD use in the result, then the command was successful.
[
![Prepare the ceph-osd nodes](https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/10.png)
][17]
Activate the OSD'S with the command below:
ceph-deploy osd activate ceph-osd1:/dev/sdb ceph-osd2:/dev/sdb ceph-osd3:/dev/sdb
Now you can check the sdb disk on OSDS nodes again.
ceph-deploy disk list ceph-osd1 ceph-osd2 ceph-osd3
[
![Ceph osds activated](https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/11.png)
][18]
The result is that /dev/sdb has two partitions now:
1. **/dev/sdb1** - Ceph Data
2. **/dev/sdb2** - Ceph Journal
Or you check it directly on the OSD node.
ssh ceph-osd1
sudo fdisk -l /dev/sdb
[
![Ceph OSD nodes were created](https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/12.png)
][19]
Next, deploy the management-key to all associated nodes.
ceph-deploy admin ceph-admin mon1 ceph-osd1 ceph-osd2 ceph-osd3
Change the permission of the key file by running the command below on all nodes.
sudo chmod 644 /etc/ceph/ceph.client.admin.keyring
The Ceph Cluster on Ubuntu 16.04 has been created.
### Step 6 - Testing Ceph
In step 4, we've installed and created a new Ceph cluster, and added OSDS nodes to the cluster. Now we should test the cluster to make sure that it works as intended.
From the ceph-admin node, log in to the Ceph monitor server '**mon1**'.
ssh mon1
Run the command below to check the cluster health.
sudo ceph health
Now check the cluster status.
sudo ceph -s
You can see results below:
[
![Ceph Cluster Status](https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/13.png)
][20]
Make sure the Ceph health is **OK** and there is a monitor node '**mon1**' with IP address '**10.0.15.11**'. There are **3 OSD** servers and all are **up** and running, and there should be an available disk space of **45GB** - 3x15GB Ceph Data OSD partition.
We build a new Ceph Cluster on Ubuntu 16.04 successfully.
--------------------------------------------------------------------------------
via: https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/
作者:[Muhammad Arul][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/
[1]:https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/#step-configure-all-nodes
[2]:https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/#step-configure-the-ssh-server
[3]:https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/#step-configure-the-ubuntu-firewall
[4]:https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/#step-configure-the-ceph-osd-nodes
[5]:https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/#step-build-the-ceph-cluster
[6]:https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/#step-testing-ceph
[7]:https://www.howtoforge.com/tutorial/how-to-install-a-ceph-cluster-on-ubuntu-16-04/#reference
[8]:https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/big/1.png
[9]:https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/big/2.png
[10]:https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/big/3.png
[11]:https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/big/4.png
[12]:https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/big/5.png
[13]:https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/big/6.png
[14]:https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/big/7.png
[15]:https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/big/8.png
[16]:https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/big/9.png
[17]:https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/big/10.png
[18]:https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/big/11.png
[19]:https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/big/12.png
[20]:https://www.howtoforge.com/images/how-to-install-a-ceph-cluster-on-ubuntu-16-04/big/13.png

View File

@ -0,0 +1,96 @@
Translating by Hymantin
Set Date and Time for Each Command You Execute in Bash History
============================================================
By default, all commands executed by Bash on the command line are stored in history buffer or recorded in a file called ~/.bash_history. This means that a system administrator can view a list of commands executed by users on the system or a user can view his/her command history using the [history command][1] like so.
```
$ history
```
[
![Linux History Command](http://www.tecmint.com/wp-content/uploads/2017/01/Linux-History-Command.png)
][2]
Linux History Command
From the output of the [history command][3] above, the date and time when a command was executed is not shown. This is the default setting on most if not all Linux distributions.
In this article, we will explain how you can configure time stamp information when each command in the Bash history was executed to be displayed.
The date and time associated with each history entry can be written to the history file, marked with the history comment character by setting the HISTTIMEFORMAT variable.
There are two possible ways of doing this: one does it temporarily while the other makes it permanent.
To set HISTTIMEFORMAT variable temporarily, export it as below on the command line:
```
$ export HISTTIMEFORMAT='%F %T'
```
In the export command above, the time stamp format:
1. `%F`  expands to full date same, as %Y-%m-%d (year-month-date).
2. `%T`  expands to time; same as %H:%M:%S (hour:minute:seconds).
Read through the [date command][4] man page for additional usage information:
```
$ man date
```
Then check your command history as follows:
```
$ history
```
[
![Display Linux Command History with Date and Time](http://www.tecmint.com/wp-content/uploads/2017/01/Set-Date-and-Time-on-Linux-Commands-History.png)
][5]
Display Linux Command History with Date and Time
However, if you want to configure this variable permanently, open the file `~/.bashrc` with your favorite editor:
```
$ vi ~/.bashrc
```
And add the line below in it (you mark it with a comment as your own configuration):
```
#my config
export HISTTIMEFORMAT='%F %T'
```
Save the file and exit, afterwards, run the command below to effect the changes made to the file:
```
$ source ~/.bashrc
```
Thats all! Do share with us any interesting history command tips and tricks or your thoughts about this guide via the comment section below.
--------------------------------------------------------------------------------
作者简介:
![](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/display-linux-command-history-with-date-and-time/
作者:[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/history-command-examples/
[2]:http://www.tecmint.com/wp-content/uploads/2017/01/Linux-History-Command.png
[3]:http://www.tecmint.com/history-command-examples/
[4]:http://www.tecmint.com/sort-ls-output-by-last-modified-date-and-time/
[5]:http://www.tecmint.com/wp-content/uploads/2017/01/Set-Date-and-Time-on-Linux-Commands-History.png

View File

@ -0,0 +1,90 @@
# Perl 与动态网站的诞生
>在新闻组和邮件列表,计算机科学实验室,各大陆之间流传着一个关于 Perl 对于动态网站的作用的迷人故事。
![Perl and the birth of the dynamic web](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/osdc-lead-web-internet.png?itok=hq81pSDs "Perl and the birth of the dynamic web")
>图片来源 : [Internet Archive Book Images][30], 由 Opensource.com 修改. [CC BY-SA 4.0][29].
人们记得这样一些早期互联网历史中的一系列的萌芽事件:如 Tim Berners-Lee 在邮件组上 [述说][28] WWW-project 的那天,[CERN][27] 将项目代码及文档释出到公共域的时刻,以及 1993 年 1 月的[第一版 NCSA Mosaic 浏览器][26]。虽然这些独立的时刻是相当重要的,但是当时的技术的开发已经更为丰富而不再是由一组的孤立事件组成,更像是一系列有内在联系的故事。
其中的一个故事描述的是网站是如何变成_动态的_通俗说来就是我们如何使服务器比在提供静态 HTML 文档的状态下做更多的事。这是个流传在新闻组和邮件列表计算机科学实验室各大陆之间的故事专注于一个人一种编程语言Perl。
### CGI 脚本和信息套件(这里将 infoware 翻译成了信息套件件不确定是否合适)
在上世纪 90 年代中后期Perl 几乎和动态网站是同义词。Perl 是一种相对来说容易学习的解释型语言并且有强大的文本处理特性,使得它能够很容易的编写脚本来连接网站的数据库,处理由用户发送的格式化数据,同时生成这些上世纪 90 年代的网站图标,点击量和用户手册。
类似的网站特性渐渐的变成了格式话的 CGI 脚本全称为通用网关接口Common Gateway Interface[第一次实现][24]由 Rob McCool 于 1993 年 11 月在 NCSA HTTPD 上完成。CGI 被设计成允许功能话的访问接入,并且在短短几年之内任何人都可以很容易的找到一些由 Perl 写的预制脚本存档。有一个声名狼籍的案例就是 [Matt's Scripts Archive][23],这是一种流行的包含安全缺陷的源使得 Perl 社区成员创建了一种被称为 [Not Matts Scripts][22] 的更为专业的替换选项。
在当时爱好者和职业程序员都采用 Perl 来制作动态网站和应用Tim OReilly [创造了词汇“信息套件”][21] 来描述网站和 Perl 处于变化中的计算机工业的哪一部分。考虑到 Yahoo 和 Amazon 带来的创新OReilly 写道:“传统软件在大量的软件中仅仅包含了少量的信息;信息套件则在少量的软件中包含了大量的信息。” Perl 是一种像瑞士军刀一样的完美的小而强大的工具支撑了信息媒体从巨大的网站目录向早期的用户生成内容平台的转变。
### 题外话
尽管我们可以很溜的使用 Perl 来制作 CGI但是编程语言和不断提升中的动态网站之间的关系变得更加的密切与深入。在[第一个网站][20](在 1990 年的圣诞节前)出现到 1993 年 McCool 实现 CGI 的大多数时间里,对于上世纪 90 年代和更早以前的网站定义为格式化的位图和让人云里雾里的表格。尽管 Berners-Lee 也对这些早期的岁月产生了影响,但是不同的人看到的是网络不同的潜在作用,并将它推向各自不同的方向。一方面,这样的结果来自一些著名的辩论,例如 [HTML 应该和 SGML 保持多近的关系][19], [是否应该实现一个图像标签][18]。在另一方面,在没有直接因素影响的情况下改变是及其缓慢的。后者已经很好的描述了动态网站是如何被开发的。
从某种意义上说,第一个网关的诞生可以追溯到 1991 至 1992 年之间,当时 Berners-Lee 和一些计算及科学家与超文本爱好者编写服务程序使得一些特定的资源能够连接到一起,例如 CERN 的内部应用程序,通用的应用程序如 Oracle 数据库,[广域信息查询系统WAIS][16]。WAIS 是由互联网的先驱在上世纪 80 年代后期开发的,其中,[Brewster Kahle][15],是一个数字化图书管理员和 [Internet Archive][14] 的创始人。)这样的话,网关就是一个被设计用来连接其它网络,数据库或者应用程序的客户网络服务器。任何的动态特性就是意味着在不同的端口上运行另外的守护进程(参考阅读,例如 Berners-Lee 对于在网站上 [如何添加一个搜索功能][13] 的描述。Berners-Lee 期望万维网将这里的web翻译成了万维网不知是否合适可以成为不同信息系统之间的通用接口并且鼓励单一目的服务的扩展。他也提到 Perl 是一种强大的(甚至是不可思议)可以将各种东西组合起来的语言。
然而,另一种对“网关”的理解指出它不一定是一个客户端设备可能只是一个脚本,一个不需要额外服务器的低吞吐量的附加脚本。这种形式的首次出现是有争议性的 Jim Davis 的 [Gateway to the U Mich Geography server][11],在 1992 年的 11 月被发布在了 WWW-talk 邮件列表中。Davis 的脚本是使用 Perl 编写的,是一种网络 API 的原型基于用户格式化的查询从另外的服务器拉取数据。我们来说明一下这两种对于网关的理解的不同之处Berners-Lee [回复了][10] Davis 的邮件期望他和 Michigan 服务器的作者“能够达成一些共识”“从网络的角度来看的话”使用一台服务器这里将one server翻译成了一台服务器不知是否合理似乎也可能是一类服务器程序来提供这样的信息可能会更有意义。Berners-Lee可能是期待着网络这里将web翻译成了网络可能有点不妥的发明者可以提出一种有秩序的信息资源访问方式。这样的不断增加的从不同服务器上拉取数据的网关和脚本意味着一种潜在的网络的质的变化这里扩展了当然也可能有点偏离了 Berners-Lee 的原始观点。
### 回到 Perl HTTPD
在 Davis 的地理服务器上的网关向标准化的低吞吐量的通过 CGI 方式实现的脚本化的网关之间Perl HTTPD 的出现是很重要的事件,在 1993 初由印地安纳大学的研究生 Marc Van Heyningen 在布卢明顿Bloomington完全使用 Perl 语言实现了一个网络服务器程序。从 Van Heyningen 给出的[设计原则][8]来看,基于使用 Perl 就不需要任何的编译过程这样一种事实,使得它能够成为一种极易扩展的服务器程序,这个服务器包含了一个特性,只要简单的重启一下就可以添加新特性到服务器程序中并且不会有任何的宕机时间,使得这个服务器程序可以频繁的加入新功能(这里似乎有点敏捷开发的样子,不太确定该如何描述更好)。
Perl HTTPD 代表了那种服务器程序应该是单一特定目的相对观点。相应的这种模式似乎暗示了在网络发展中像这样持续不断提高测试软件产品可能会最终变成一种共识。Van Heyningen 在后来[提到过][7]他从头编写这样一个服务器程序的初衷是当时没有一种简便的方式使用 CERN 服务器程序来生成“虚拟文件”(例如,动态生成的页面),他打趣说使用 Perl 这样像天书一样的语言来写可能是最简单的方式了。在他编写的众多脚本的初期就是一个连接 Sun 用户手册的网络接口同时也是一个 [Finger Gateway][6](一种用来共享计算机系统信息或者是用户信息的早期协议)。
虽然 Van Heyningen 将印地安纳大学的服务器主要用来连接现存的信息资源,他和研究生们同时也看见了作为个出版形式的潜在可能。其中一件广为人知事件是在 1993-1994 年之间围绕着一个著名的加拿大案件而[公布][5]的一系列的文件,照片和新闻故事,与此同时所有的全国性媒体保持了沉默。
Perl HTTPD 没有必要保持持久的活力。今天Van Heyningen 回忆起这个程序的时候认为这个程序只是当时的一个原型产品。它的原始目的只是向那些已经选择了 Gopher 作为大需网络接口的高级职员们展示网络的另一种利用方式。Van Heyningen 用代码回应了他导师们自豪的[一种基于网络的索引搜索的原型][4]。就是说,在服务器程序技术方面关键创新是为了赢得争论的胜利而诞生的,在这个角度上来看代码做到了所有呼唤它所做的事。
不管服务器程序是否是短暂的,伴随者 Perl HTTPD 一起出现的理念已经传播到了各个角落。Van Heyningen 开始收到代码请求并且将它分享到了网上,总之就是如果想要将服务器与其它系统相连接就需要了解一些 Perl。不久之后居住在奥斯汀Austin的程序员 Tony Sanders 开发了一个被称为 [Plexus][3] 的轻便版本。Sander 的服务器程序是一款全功能的产品并且同样包含了 Perl HTTPD 所建议的以扩展性当你需要的时候可以添加一些新的特性如图片解码等。Plexus [直接影响了][2] Rob McCool 给 NCSA HTTPD 服务器上的脚本开发的“htbin”并且同样影响到了不久之后诞生的通用网关接口CGI
在这些历史遗产之外,感谢妙不可言的 Internet Archive互联网时光机使得 Perl HTTPD 在今天保留在一种我们依然可以获取的形式,你可以从[这里下载][1]。
### 历史展望
对于技术世界的颠覆来说,技术的改变总是在一个相互对立的过程中。现有的技术是思考新技术的基础与起点。过时的编程形式启迪了今天人们做事的新方式。网络世界的创新可能看起来更像是对于就技术的扩展,不仅仅是 Perl。
在简单枯燥的萌芽事件时间轴之外,网络历史学者也许可以从 Perl 获取更多的线索。其中一部份的挑战在于材料的获取。更多需要作的事情包括从可获得的大量杂乱的数据中梳理出它的结构,将分散在邮件列表,归档网站,书本和杂志中的信息内容组合在一起。还有一部分的挑战是需要认识到互联网的历史不仅仅是新技术发布的日子,它同时包括了个人记忆,人类情感与社会进程等,并且这不仅仅是单一的历史线而是有许许多多条相似的历史线组合而成的。就如 Perl 的信条一样“殊途同归。There's More Than One Way To Do It.)”
--------------------------------------------------------------------------------
via: https://opensource.com/life/16/11/perl-and-birth-dynamic-web
作者:[Michael Stevenson][a]
译者:[wcnnbdk1](https://github.com/wcnnbdk1)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/mstevenson
[1]:https://web.archive.org/web/20011126190051/http://www.cs.indiana.edu/perl-server/httpd.pl.tar.Z
[2]:http://1997.webhistory.org/www.lists/www-talk.1993q4/0516.html
[3]:https://web.archive.org/web/19990421192342/http://www.earth.com/server/doc/plexus.html
[4]:https://web.archive.org/web/19990428030253/http://www.cs.indiana.edu:800/cstr/search
[5]:https://web.archive.org/web/19970720205155/http://www.cs.indiana.edu/canada/karla.html
[6]:https://web.archive.org/web/19990429014629/http://www.cs.indiana.edu:800/finger/gateway
[7]:https://web.archive.org/web/19980122184328/http://www.cs.indiana.edu/perl-server/history.html
[8]:https://web.archive.org/web/19970720025822/http://www.cs.indiana.edu/perl-server/intro.html
[9]:https://web.archive.org/web/19970720025822/http://www.cs.indiana.edu/perl-server/code.html
[10]:https://lists.w3.org/Archives/Public/www-talk/1992NovDec/0069.html
[11]:https://lists.w3.org/Archives/Public/www-talk/1992NovDec/0060.html
[12]:http://info.cern.ch/hypertext/WWW/Provider/ShellScript.html
[13]:http://1997.webhistory.org/www.lists/www-talk.1993q1/0109.html
[14]:https://archive.org/index.php
[15]:http://brewster.kahle.org/about/
[16]:https://en.wikipedia.org/wiki/Wide_area_information_server
[17]:http://info.cern.ch/hypertext/WWW/Daemon/Overview.html
[18]:http://1997.webhistory.org/www.lists/www-talk.1993q1/0182.html
[19]:http://1997.webhistory.org/www.lists/www-talk.1993q1/0096.html
[20]:http://info.cern.ch/hypertext/WWW/TheProject.html
[21]:https://web.archive.org/web/20000815230603/http://www.edventure.com/release1/1198.html
[22]:http://nms-cgi.sourceforge.net/
[23]:https://web.archive.org/web/19980709151514/http://scriptarchive.com/
[24]:http://1997.webhistory.org/www.lists/www-talk.1993q4/0518.html
[25]:https://en.wikipedia.org/wiki/Usenet_newsgroup
[26]:http://1997.webhistory.org/www.lists/www-talk.1993q1/0099.html
[27]:https://tenyears-www.web.cern.ch/tenyears-www/
[28]:https://groups.google.com/forum/#!msg/alt.hypertext/eCTkkOoWTAY/bJGhZyooXzkJ
[29]:https://creativecommons.org/licenses/by-sa/4.0/
[30]:https://www.flickr.com/photos/internetarchivebookimages/14591826409/in/photolist-oeqVBX-xezHCD-otJDtG-whb6Qz-tohe9q-tCxH8y-xq4VfN-otJFfh-xEmn3b-tERUdv-oucUgd-wKDyLy-owgebW-xd6Wew-xGEvuT-toqHkP-oegBCj-xtDdzN-tF19ip-xGFbWP-xcQMJq-wxrrkN-tEYczi-tEYvCn-tohQuy-tEzFwN-xHikPT-oetG8V-toiGvh-wKEgAu-xut1qp-toh7PG-xezovR-oegRMa-wKN2eg-oegSRp-sJ29GF-oeqXLV-oeJTBY-ovLF3X-oeh2iJ-xcQBWs-oepQoy-ow4xoo-xknjyD-ovunVZ-togQaj-tEytff-xEkSLS-xtD8G1

View File

@ -0,0 +1,256 @@
10 个有趣的 Linux 命令行小技巧值得了解
============================================================
我非常喜欢使用命令,因为他们比 GUIs图形用户界面应用程序对 Linux 系统提供更多的控制。因此,我一直在寻找一些有趣的方法[让 Linux 的操作变得简单好玩][1],主要是基于终端操作。
当我们发现[使用 Linux 的新技巧][2]时,尤其是像我这样的命令行极客,我们总会感到非常来劲。
而且我们也会很想与数百万 Linux 用户分享新学到的实践或命令,特别是那些还在使用自己的方式操作这个令人兴奋的操作系统的新手们。
**建议阅读:** [10 个对新手有用的 Linux 命令行技巧 - 第二部分][3]
在这篇文章中,我们将回顾一系列[有用的命令行小技巧][4],他们可以显著地提高你的 Linux 使用技能。
### 1\. 在 Linux 中锁定或隐藏文件或目录
锁定文件或目录最简单的方法是使用 Linux 文件权限。如果你是文件或目录的所有者,你可以阻止其他用户和组访问(删除、读取、写入、执行)它,如下所示:
```
$ chmod 700 tecmint.info
OR
$ chmod go-rwx tecmint.info
```
想要了解更多有关 Linux 文件权限的内容,请阅读这篇文章[在 Linux 中管理用户和组,文件权限和属性][5]。
为了实现对系统中的其他用户隐藏文件或目录,可以通过在文件或目录开头添加 `(.)` 的方式重命名:
```
$ mv filename .tecmint.info
```
### 2\. 在 Linux 中将 rwx 权限转为八进制格式
默认情况下,当你运行 [ls 命令][6]之后,它会使用 `rwx` 格式显示文件权限,为了了解 rwx 格式和八进制格式的等同性,你可以学习如何[在 Linux 中将 rwx 权限转为八进制格式][7]。
### 3\. 当 `sudo` 命令执行失败时怎么使用 `su` 命令
虽然 [sudo 命令][8]是用来执行具有超级用户权限的命令,但是在某些情况下它也会执行失败,如下所示。
在这里,我想[清空一个大文件的内容][9],其文件名为 `uptime.log`,但是即便我是使用 sudo 命令也执行失败了。
```
$ cat /dev/null >/var/log/uptime.log
$ sudo cat /dev/null >/var/log/uptime.log
```
[
![在 Linux 中清空大文件的内容](http://www.tecmint.com/wp-content/uploads/2016/12/Empty-Large-File-Content-in-Linux.png)
][10]
在 Linux 中清空大文件的内容
遇到这种情况,你需要使用 su 命令切换到 root 用户,然后像下面这样去执行清空操作:
```
$ su
$ sudo cat /dev/null >/var/log/uptime.log
$ cat /var/log/uptime.log
```
[
![切换到超级用户](http://www.tecmint.com/wp-content/uploads/2016/12/Switch-to-Super-User.png)
][11]
切换到超级用户
尝试理解 [su 和 sudo 之间的区别][12],另外,通过阅读他们的手册页以了解更多的使用指南:
```
$ man sudo
$ man su
```
### 4\. 在 Linux 中结束一个进程
有些时候,当你想[使用 kill、killall、pkill 命令结束一个进程][13]时,它们有可能无法生效,你可以看到该进程仍然还在系统上运行。
如果要强制结束一个进程,可以发送 `-KILL` 信号给该进程。
首先[获取指定进程 ID][14],然后像下面这样结束该进程:
```
$ pidof vlc
$ sudo kill -KILL 10279
```
[
![在 Linux 中查找和结束进程](http://www.tecmint.com/wp-content/uploads/2016/12/Find-and-Kill-Process-in-Linux.png)
][15]
在 Linux 中查找和结束进程
查看 [kill 命令][16]以获取更多的使用选项和信息。
### 5\. 在 Linux 中永久删除文件
一般情况下,我们通过使用 rm 命令将文件从 Linux 系统中删除。然而,这些文件并没有被真正的删除,它们只是被简单地隐藏存放在硬盘中,其他用户仍然可以[在 Linux 中恢复删除的文件][17]并查看。
为了防止这种情况发生,我们可以使用 shred 命令来重复覆盖文件内容,并在覆盖完成后选择删除文件。
```
$ shred -zvu tecmint.pdf
```
上述命令中所使用的选项说明:
1. `-z` 最后一次使用 0 进行覆盖以隐藏覆盖动作。
2. `-u` 覆盖后截断并移除文件。
3. `-v` 显示详细过程。
[
![在 Linux 中永久删除文件](http://www.tecmint.com/wp-content/uploads/2016/12/Delete-File-Permanently-in-Linux.png)
][18]
在 Linux 中永久删除文件
阅读 shred 手册以获取更多的使用信息。
```
$ man shred
```
### 6\. 在 Linux 中重命名多个文件
你可以通过使用 rename 命令随时[在 Linux 中重命名多个文件][19]。
rename 命令会根据第一个参数中的规则重命名指定文件。
以下命令会将所有 `.pdf` 文件重命名为 `.doc` 文件,使用的规则为 `'s/\.pdf$/\.doc/'`
```
$ rename -v 's/\.pdf$/\.doc/' *.pdf
```
[
![在 Linux 中重命名多个文件](http://www.tecmint.com/wp-content/uploads/2016/12/Rename-Multiple-Files-in-Linux.png)
][20]
在 Linux 中重命名多个文件
在接下来的例子中,我们将通过重命名所有匹配 `"*.bak"` 的文件来移除其拓展名,使用的规则是 `'s/\e.bak$//'`
```
$ rename -v 's/\e.bak$//' *.bak
```
### 7\. 在 Linux 中检查单词拼写
look 命令用于显示文件中以指定字符串为前缀的任意行,同时它也可以帮你检查命令行中给定单词的拼写。尽管它并不是那么有效和可靠,但它仍然算得上是其他强大的拼写检查工具的有用替代品。
```
$ look linu
$ look docum
```
[
![在 Linux 中检查单词拼写](http://www.tecmint.com/wp-content/uploads/2016/12/Spell-Checking-in-Linux.png)
][21]
在 Linux 中检查单词拼写
### 8\. 查找关键字在手册页中的简介
man 命令用于显示命令的手册页,当使用 `-k` 选项时,它会将关键字 `printf`(或者如下命令中的关键字 adjust、apache、php )作为正则表达式,来搜索所有名称匹配的命令的手册页简介。
```
$ man -k adjust
$ man -k apache
$ man -k php
```
[
![显示关键字在手册页中的简介](http://www.tecmint.com/wp-content/uploads/2016/12/Show-Description-of-Keyword-in-Manual-Pages.png)
][22]
显示关键字在手册页中的简介
### 9\. 在 Linux 中实时监测日志
watch 命令可以[定期执行另一个 Linux 命令][23]并全屏显示该命令的执行结果。当 watch 命令与 [tail 命令][24](用于查看文件结尾的 Linux 命令)配合使用时,可以监测到日志的生成情况。
在以下示例中,你将实时监测系统认证日志文件。打开两个终端窗口,在第一个窗口中实时监测该日志文件,如下:
```
$ sudo watch tail /var/log/auth.log
```
你也可以使用 [tail 命令][25](显示文件结尾的 Linux 命令)的 `-f` 选项实时监测文件变化。这样,我们就可以在日志文件中看到日志的生成情况。
```
$ sudo tail -f /var/log/auth.log
```
接着,在第二个终端窗口中运行以下命令,之后,你就可以在第一个终端窗口中观察日志文件内容:
```
$ sudo mkdir -p /etc/test
$ sudo rm -rf /etc/test
```
### 10\. 列出所有 Shell 内置命令
shell 内置命令是一个命令或者函数,从内部调用并直接在 shell 里执行,而不是从硬盘加载外部的可执行程序来执行。
列出所有 shell 内置命令及其语法,执行如下命令:
```
$ help
```
作为结束语,[命令行小技巧][26]不仅能派得上用场,而且让学习和使用 Linux 变得更加简单有趣,尤其是对新手来讲。
你也可以通过留言给我们分享其他在 Linux 中[有用有趣的命令行小技巧][27]。
--------------------------------------------------------------------------------
作者简介:
![](http://1.gravatar.com/avatar/4e444ab611c7b8c7bcb76e58d2e82ae0?s=128&d=blank&r=g)
Aaron Kili 是一名 Linux 和 F.O.S.S 的爱好者,未来的 Linux 系统管理员、网站开发人员,目前是 TecMint 的写作者,他喜欢用电脑工作,并且乐忠于分享知识。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/linux-command-line-tricks-and-tips-worth-knowing/
作者:[Aaron Kili][a]
译者:[zhb127](https://github.com/zhb127)
校对:[校对者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/20-funny-commands-of-linux-or-linux-is-fun-in-terminal/
[2]:http://www.tecmint.com/tag/linux-tricks/
[3]:http://www.tecmint.com/10-useful-linux-command-line-tricks-for-newbies/
[4]:http://www.tecmint.com/10-useful-linux-command-line-tricks-for-newbies/
[5]:http://www.tecmint.com/manage-users-and-groups-in-linux/
[6]:http://www.tecmint.com/tag/linux-ls-command/
[7]:http://www.tecmint.com/check-linux-file-octal-permissions-using-stat-command/
[8]:http://www.tecmint.com/su-vs-sudo-and-how-to-configure-sudo-in-linux/
[9]:http://www.tecmint.com/empty-delete-file-content-linux/
[10]:http://www.tecmint.com/wp-content/uploads/2016/12/Empty-Large-File-Content-in-Linux.png
[11]:http://www.tecmint.com/wp-content/uploads/2016/12/Switch-to-Super-User.png
[12]:http://www.tecmint.com/su-vs-sudo-and-how-to-configure-sudo-in-linux/
[13]:http://www.tecmint.com/how-to-kill-a-process-in-linux/
[14]:http://www.tecmint.com/find-process-name-pid-number-linux/
[15]:http://www.tecmint.com/wp-content/uploads/2016/12/Find-and-Kill-Process-in-Linux.png
[16]:http://www.tecmint.com/how-to-kill-a-process-in-linux/
[17]:http://www.tecmint.com/recover-deleted-file-in-linux/
[18]:http://www.tecmint.com/wp-content/uploads/2016/12/Delete-File-Permanently-in-Linux.png
[19]:http://www.tecmint.com/rename-multiple-files-in-linux/
[20]:http://www.tecmint.com/wp-content/uploads/2016/12/Rename-Multiple-Files-in-Linux.png
[21]:http://www.tecmint.com/wp-content/uploads/2016/12/Spell-Checking-in-Linux.png
[22]:http://www.tecmint.com/wp-content/uploads/2016/12/Show-Description-of-Keyword-in-Manual-Pages.png
[23]:http://www.tecmint.com/run-repeat-linux-command-every-x-seconds/
[24]:http://www.tecmint.com/view-contents-of-file-in-linux/
[25]:http://www.tecmint.com/view-contents-of-file-in-linux/
[26]:http://www.tecmint.com/tag/linux-tricks/
[27]:http://www.tecmint.com/5-linux-command-line-tricks/