This commit is contained in:
KayGuoWhu 2015-05-28 11:00:32 +08:00
commit 785c7e639d
99 changed files with 7499 additions and 4804 deletions

View File

@ -0,0 +1,320 @@
五款 Linux 文本编辑器测评
================================================================================
> Mayank Sharma 测试了5款不仅仅是能处理文字的超强文本编辑器。
如果你使用Linux已经有很长一段时间你知道不管是编辑一款app的配置文件还是修改shell脚本或者编写/查看代码类似LibreOffice的工具并不适合。尽管字面上看起来都是一样但是你并不需要一个文字处理器来完成这些任务你需要的是一个文本编辑器。
在这个测评中我们将着眼于5款更能胜任繁重文本工作的轻量级的文本编辑器。他们支持语法高亮像拼写检查一样轻松处理代码缩进。你可以像你复制/粘贴文本那样容易地使用它们记录宏以及管理代码片段。
得益于它们的插件,使得它们足以抗衡其它的以文本为中心的应用程序,一些简单的文本编辑器甚至超出了它们的设计目标。它们能胜任一个源代码编辑器的任务,甚至就是一个集成开发环境。
Emacs和Vim是两款最流行和强大的纯文本编辑器。但是由于一些原因我们在这个测评中并没有包括它们。首先如果你使用它们中的任何一个那么恭喜你你不需要更换了。其次它们都有陡峭的学习曲线尤其是那些熟悉了桌面环境的用户他们很更愿意投入其他有图形界面的文本编辑器。
### 目录: ###
#### Gedit ####
- URL:http://projects.gnome.org/gedit/
- 版本: 3.10
- 许可证: GPL
- Gnome的默认文本编辑器准备好挑战了吗?
#### Kate ####
- URL: www.kate-editor.org
- 版本: 3.11
- 许可证: LGPL/GPL
- Kate会挑战命运吗?
#### Sublime Text ####
- URL: www.sublimetext.com
- 版本: 2.0.2
- 许可证: Proprietary
- 在自由的土地上的带有黄金般的心脏的专利软件。
#### UltraEdit ####
- URL: www.ultraedit.com
- 版本: 4.1.0.4
- 许可证: Proprietary
- 足够证明它的价值了吗?
#### jEdit ####
- URL: www.jedit.org
- 版本: 5.1.0
- 许可证: GPL
- 基于Java的编辑器是否会毁掉其他编辑器的世界?
### 关键标准 ###
除了Gedit和jEdit以外的所有工具都是通过其推荐的安装方法安装在Fedora和Ubuntu上。前者已经兼容默认的Gnome桌面后者仍然固执地反对安装在Fedora上。由于这些是相对简单的应用程序他们没有复杂的依赖唯一例外的是jEdit它要求要有Oracle Java。
得益于Gnome和KDE持续的努力所有编辑器无论在哪个桌面上的外观看起来很好功能也很正常。这不仅是作为评价的标准也意味着你不再受制于你的桌面环境兼容的工具。
除了它们独特的功能,我们也对所有候选者测试了常规的文本编辑功能。然而,它们并没有被设计为模仿现代字处理器的所有功能,我们也不以此评判。
### 编程语言支持 ###
UltraEdit 能进行语法高亮、代码折叠以及拥有项目管理的能力。也有一个罗列源文件中所有函数的功能列表但并不适用于我们测试的任何代码文件。UltraEdit也支持HTML5有一个能添加常用HTML标记的HTML工具栏。
即使Gnome的默认文本编辑器Gedit也有几个面向编码的功能特性例如括号匹配、自动缩进以及为包括C, C++, Java, HTML, XML, Python, Perl, 以及许多其它编程语言进行语法高亮。
如果你需要更多的编程辅助功能看一下Sublime和Kate。
Sublime支持多种编程语言并且能为(那些流行的)C#, D, Dylan, Erlang, Groovy, Haskell, Lisp, Lua, MATLAB, OCaml, R, 甚至 SQL 进行语法高亮。如果这还不够你可以下载插件以支持更多的语言。另外它的语法高亮功能提供了多个可定制选项。这个应用程序也会进行括号匹配确保代码段都正确Sublime的自动补全功能也支持用户创建的变量。就像Komodo IDESublime也可以显示一个全部源代码的滚动预览图这对于长代码文件导航和在文件中的不同部分跳转很方便。Sublime最好的功能之一就是能在编辑器内部运行特定语言例如C++, Python, Ruby等的代码当然假设在你的电脑上安装有编译器以及其它系统工具。省时间而且不用再开终端.
你也可以用插件在Kate中开启构建系统功能。另外你可以为GDB调试器添加一个简单的前端。Kate能和GitSubversion以及Mercurial版本控制系统一起工作也提供了一些项目管理的功能。除了能为超过180种语言进行语法高亮它支持所有的这些辅助功能例如括号匹配自动补全和自动缩进。它也支持代码折叠甚至在一个程序中折叠函数。
唯一的遗憾的是jEdit它声称自己是一个程序员的文本编辑器但它缺少其他的基本功能例如代码折叠它甚至不能提示或者补全函数.
**评分:**
- Gedit3/5
- Kate5/5
- Sublime5/5
- UltraEdit3/5
- jEdit1/5
### 键盘控制 ###
高级文本编辑器的用户希望能完全通过键盘控制和操作,一些应用程序甚至支持用户自定义快捷方式的键盘绑定。
你可以轻松的使用Gedit的扩展键盘快捷键。可以在编辑文件时通过工具的快捷键调用工具例如对一个文档进行拼写检查。你可以看到应用程序内部的一系列默认快捷键但并没有图形化的方式去自定义它们。相似的在Sublime中自定义键盘绑定你需要修改它的XML的键盘映射文件。Sublime由于缺少定义键盘快捷键的图形化界面而饱受批评但长期使用的用户支持当前的基于文件的机制这给了他们更多的控制能力。
UltraEdit为它"一切都可自定义"的座右铭感到自豪,这也包括键盘快捷键。你可以自定义菜单导航的热键,以及定义你自己的访问大量功能的组合键映射。
除了完全可自定义的键盘快捷键以外jEdit也有为Emacs预定义的键映射。Kate在这方面尤其令人映像深刻。它有简单可访问的自定义键绑定窗口。你可以更改默认的键或者定义替代的键。另外Kate也有一个能使用户使用Vi键操作Kate的Vi模式。
**评分:**
- Gedit2/5
- Kate5/5
- Sublime3/5
- UltraEdit4/5
- jEdit5/5
### 片段和宏 ###
宏通过自动化重复的步骤帮助你降低花费在编辑和组织数据上的时间,而代码片段通过创建可重用的源代码块为程序员扩展类似的功能。这两者都能节省你的时间。
标准的Gedit安装没有这两种功能中的任何一种但是你可以通过独立的插件启用这些功能。片段插件随Gedit一起发布但在Gedit内启用宏插件则需要你手动下载和安装(被称为gedit-macropy托管在GitHub上)。
Kate也同样通过插件的形式启用片段功能。一旦加入插件也增加了PHPBash和Java的片段库。你可以在侧边栏中显示片段列表以便于访问。可以通过右击片段或者快捷键组合方式编辑它的内容。然而令人惊讶的是它不支持宏-尽管用户从2002年就不断要求
jEdit也有一个启用片段的插件。它还可以从用户行为中记录宏或者你也可以用BeanShell 脚本语言(BeanShell支持像Perl和JavaScript那样将脚本对象封装为简单的方法)中写宏。jEdit也有一个可以从jEdit的网站中下载多种宏的插件。
Sublime有创建片段和宏的内建功能也有为大多数编程语言经常使用的函数多种片段。
在UltraEdit中片段被称为智能模板就像Sublime中一样你可以根据正在编辑的源代码文件类型插入片段。要完成宏记录功能UltraEdit还有集成了一个基于JavaScript的脚本语言引擎来完成自动任务。你也可以从该编辑器的网站中下载用户提交的宏和脚本。
**评分:**
- Gedit3/5
- Kate1/5
- Sublime5/5
- UltraEdit5/5
- jEdit5/5
### 易用性 ###
不像那些简陋的文本编辑器,这些文本编辑器在这方面可以适应从文档写作者到程序员的各种用户的需要。与精简应用程序相反,他们的开发者在寻找添加更多功能的途径。
尽管第一眼看上去这次测评中的大部分应用有一个很相似的布局,经过仔细的检查,你会发现一些可用性的差异。我们通过用户界面的合理使用来介绍它们的功能和特性,而不是铺天盖地地告诉读者。
#### Gedit: 4/5 ####
Gedit的外观很普通它有一个带有很少的菜单和按钮的简单界面。这是一把双刃剑因为有些用户可能不会发现它真正的潜能。
Gedit可以在选项卡中打开多个文件这些选项卡可以重排和在多个 Gedit窗口之间移动。用户可以选择通过插件来启用侧边栏来浏览文件或者在底部面板显示工具输出内容。这个应用程序会检测到被其它应用程序更改的文件并可以重新加载该文件。
为了适配Gnome在应用程序的最新版本中做了大量的 UI 修改。然而修改还还不稳定,尽管包括了所有的功能,但是菜单交互的一些插件还需要升级。
![在展示一个有功能的应用程序和将它们所有的东西曝光给用户之间有一个很好的平衡。Geddit隐藏了它的大部分功能。](http://www.linuxvoice.com/wp-content/uploads/2014/07/gedit-web.png)
*在功能与界面之间取得了良好的平衡Gedit将其大部分功能隐藏在背后。*
#### Kate: 5/5 ####
尽管用户界面的主要部分和Gedit相似Kate可以在两边显示选项卡并且它的菜单更加丰富。该应用程序平易近人吸引用户来挖掘它的其它功能。
Kate可以在KDE的KIO支持的所有协议上透明地打开和保存文件包括通过HTTP, FTP, SSH, SMB 和 WebDAV。你可以用这个应用同时处理多个文件。但不同于大部分应用程序传统的水平选项卡选择栏Kate在屏幕的两个方向都有选项卡。左侧的侧边栏显示打开的文件列表。需要同时查看一个文件不同部分的程序员也会感激它可以水平或者竖直分隔界面的能力。
![Kate能搭建为功能丰富的集成开发环境](http://www.linuxvoice.com/wp-content/uploads/2014/08/kate-web.png)
*Kate能搭建为功能丰富的集成开发环境。*
#### Sublime: 5/5 ####
Sublime支持你在不同方式同时查看多达四个文件。当你在集中精力编程时它也有一个只显示文件和菜单的全屏无扰模式。
这个编辑器还在右边有个缩略地图,这在长文件中导航非常有用。应用程序为多种编程语言提供多种常用函数的片段,这使得它对于开发者非常有用。另一个精巧的功能是,无论你使用都是文本文档或者代码,都可以任意选择和替换。
![如果你不喜欢Sublime的Charcoal外观你可以选择它包含的其它22种主题。](http://www.linuxvoice.com/wp-content/uploads/2014/08/sublime-web.png)
*如果你不喜欢Sublime的Charcoal外观你可以选择它包含的其它22种主题。*
#### UltraEdit: 3/5 ####
UltraEdit在界面的顶部和底部加载了多种工具栏。加上切换文档的选项卡、两边的面板以及分隔区域使得只剩下一点空间给编辑窗口。
使用HTML的网络开发者有很多唾手可得的帮助。你可以通过FTP和SFTP访问远程文件。高级功能例如记录一个宏以及比较文件也简单易用。
使用应用程序的偏好设置窗口,你可以调整应用程序的多个方面,包括颜色主题和类似语法高亮的其它功能。
![UltraEdit的用户界面是高度可配置的 — 你可以像改变其它许多方面那样简单的自定义工具栏和菜单的布局。](http://www.linuxvoice.com/wp-content/uploads/2014/08/ultraedit-web.png)
*UltraEdit的用户界面是高度可配置的 — 你可以像改变其它许多方面那样简单的自定义工具栏和菜单的布局。*
#### jEdit: 3/5 ####
在可用性方面首先一个不好就是jEdit不能在基于RPM的发行版上安装。导航编辑器需要一些时间来适应因为它的菜单和其它流行的应用程序顺序不同而且有些普通桌面用户不熟悉的名字。但是该应用程序有详细的内部帮助这有利于缓解学习曲线。
jEdit会高亮你所在的当前行并使你能以多种查看方式分隔窗口。你可以简单地从应用程序中安装和管理插件除了使用完整的宏jEdit也支持你快速记录一个临时的宏。
![由于它的Java基础jEdit在任何桌面环境中都不能给人宾至如归的感觉](http://www.linuxvoice.com/wp-content/uploads/2014/08/jedit-web.png)
*由于它的Java基础jEdit在任何桌面环境中都不能给人宾至如归的感觉*
### 可用性和支持 ###
在Gedit和Kate之间有很多相似性。两个应用程序都得益于他们各自的父项目Gnome和KDE捆绑在各种主流的发行版中。另外两个项目都是跨平台的有Windows和Mac OS X版本以及原生的Linux版本。
Gedit托管在Gnome的网站上并有一个简单的用户指南、关于多种插件的信息以及包括邮件列表和IRC通道在内的常用联系方式。你也可以在其它基于Gnome的发行版例如Ubuntu中找到使用信息。相似地Kate得益于KDE的资源并包括详细的用户信息以及邮件列表和IRC通道。你也可以从应用程序中获取相应的离线用户指南。
除了LinuxUltraEdit在Windows和Mac OS X中也可用虽然在应用程序中并没有包括但在启动时也有详细的用户指南。为了辅助用户的使用UltraEdit保存了一个常见问题的数据库一系列关于多种特定功能的详细介绍用户还可以在论坛版块彼此帮助。另外付费用户也可以通过邮件从开发者中获取支持。
Sublime支持一样多的平台但是你需要单独为每种平台购买许可证。开发者通过博客让用户了解正在进行的开发并积极参加它的论坛。这个项目支持设施的亮点是提供免费的详细教程和视频课程。Sublime非常漂亮。
由于jEdit是用java编写的所以它在多种平台中都可用。在它的网站上你可以找到一个详细的用户指南以及一些插件帮助文档的链接。然而这里没有能使用户和其他用户或者开发者交流的途径。
**评分:**
- Gedit4/5
- Kate4/5
- Sublime5/5
- UltraEdit3/5
- jEdit2/5
### 附加组件和插件 ###
不同的用户有不同的需求,一个简单的轻量级应用程序只能做到这么多。这就是为什么需要插件的原因。应用程序依赖于这些小部件来扩展它们的功能集并让更多的用户使用。
UltraEdit是一个例外。它没有第三方插件但开发者将例如HtmlTidy这样的第三方工具集成到了UltraEdit。
Gedit附带了好多已安装的插件你可以下载更多的更多gedit插件包。基于和Gedit版本的兼容性项目网站也有到多个第三方插件的链接。
三个对程序员非常有用的插件是Code Comment、在底部面板增加一个终端的Terminal Plugin以及Session Saver。当你用多个文件开发项目的时候Session Saver相当有用。你可以在选项卡中打开文件保存会话你可以用一键恢复就可以按照你保存时的选项卡顺序打开所有的文件。
类似的你可以通过用内部的插件管理器增加插件来扩展Kate。除了令人映像深刻的项目插件一些开发者使用的插件包括嵌入式终端它能编译和调试代码以及对数据库执行SQL查询。
Sublime的插件是用Python写的文本编辑器包括了一个类似于apt-get能使用户查找安装升级和移除插件包的名为Package Control的工具。通过插件你可以在Sublime中使用Git版本控制以及美化JavaScript代码的JSLint工具。Sublime Linter能指出你代码中的错误是编码人员必备的插件。
jEdit拥有最令人印象深刻的插件设施。该应用有超过200个插件可以在它们自己的专用网站中浏览。网站通过不同的类型列出了插件例如文件管理版本控制文本等。你可以在每个类型下找到很多的插件。
一些最好的插件是Android插件它们提供了和Android项目协同工作的工具你可以使用TomcatSwitch插件创建和控制外部Jakarta Tomcat服务器进程以及类似于Vi功能的Vimulator插件。你可以通过使用jEdit的插件管理器安装这些插件。
**评分:**
- Gedit3/5
- Kate4/5
- Sublime4/5
- UltraEdit1/5
- jEdit5/5
### 纯文本编辑 ###
尽管它们强大的额外功能甚至可能会取代几种完全成熟的应用程序,有时候可能只需要使用这些庞大的文本编辑器读、写或者编辑简单的纯文本。虽然你可以使用它们中的任何一个输入文本,我们通过普通文本编辑的方便性评价它们。
Gnome的默认文本编辑器Gedit支持取消和重做机制以及搜索和替换。它可以对多种语言进行拼写检查并能通过使用Gnome GVFS库访问和编辑远程文件。
你也可以使用Kate进行拼写检查它也可以让你对任何高亮文本进行Google搜索。它还有一个能可视化告知用户文件中更改过但没有保存的行的行修改系统。另外它通过允许用户在文件中使用书签简化长文档的导航。
Sublime有很多可选择的编辑命令例如缩进文本和格式化段落。它的自动保存功能帮助防止用户丢失他们的更改。高级用户还会喜欢基于正则表达式的递归查找和替换功能以及选择多个不连续的文本块并执行统一操作。
UltraEdit也允许用户在查找和替换功能中使用正则表达式并能通过FTP编辑远程文件。
JEdit一个独特的功能是它支持被称为寄存器的不限数目的剪切板。你可以复制文本片段到这些寄存器中在编辑会话过程中都可用。
**评分:**
- Gedit4/5
- Kate5/5
- Sublime5/5
- UltraEdit4/5
- jEdit4/5
### 我们的评比 ###
在这里的所有编辑器都足以替换你已有的文本编辑器,来编辑文本和调整配置文件。事实上,没准它们会组合起来作为你的集成开发环境。这些应用程序都有各种各样功能,它们的开发者不会考虑剥离功能,而是增加越来越多的功能。
jEdit排在这次测试的最后面。因为它不仅坚持使用专有的Oracle Java运行时环境不能在你的Fedora机器上安装而且开发者并不积极和用户交互。
UltraEdit做的稍微好一点。这个商业专用工具专注于网络开发者不为非开发者的高级用户提供任何功能使得它不值得推荐为免费软件的替代品。
排在第三的是Gedit。作为Gnome的默认编辑器它没有任何内在的问题但尽管有很多积极的方面它还是略微被Sublime和Kate超越。开诚布公地说Kate是比Gedit更通用的编辑器甚至考虑到他们的插件系统评分也优于Gnome的默认编辑器。
Sublime和Kate都相当好。他们在我们的大多数测试中表现同样出色。Kate由于不支持宏而落后于Sublime但键盘友好和能简单定义自定义键绑定又使Kate找回优势。
Kate成功的原因可以归结为它通过最小化学习曲线提供了最大化的功能。尽管使用它吧不仅作为简单文本编辑器使用或者容易使用语法高亮编辑配置文件甚至得益于其项目管理能力能使用它协作一个复杂的编程项目。
我们不是选择Kate去替换一个类似“[XX在这里插入你最喜欢的专业工具]”的全面的集成开发环境。但是它是一个专业工具理想的、全面的、以及完美的垫脚石。
Kate为能快速响应你的需要而设计它的界面并不会使你茫然并且和那些过于复杂的应用一样的有用。
### 1st Kate ###
- Licence LGPL/GPL Version 3.11
- www.kate-editor.org
- 拥有超能力,态度温和的文本编辑器。
- Kate是KDE项目中最有用的应用程序之一。
### 2nd Sublime Text ###
- Licence 专利 Version 2.0.2
- www.sublimetext.com
- 值得你每分钱的专业文本编辑器 - 简单易用,功能全面而且看起来很棒。
### 3rd Gedit ###
- Licence GPL Version 3.10
- http://projects.gnome.org/gedit
- 在Gnome中就用它吧。这是一个奇妙的文本编辑器确实令人钦佩的工作但这里的竞争实在太大了。
### 4th UltraEdit ###
- Licence Proprietary Version 4.1.0.4
- www.ultraedit.com
- 关注于为网络开发者提供各种便利,而不为普通用户提供任何特殊功能。
### 5th jEdit ###
- Licence GPL Version 5.1.0
- www.jedit.org
- 缺乏支持不支持Fedora缺乏好看的界面jEdit被贬低到最后。
### 你也许希望尝试… ###
随你发行版发布的默认文本编辑器也能帮助你一些高级任务。例如KDE的KWrite和Raspbian的Nano。得益于KDE的katepart组件KWrite继承了一些Kate的功能得益于在树莓派上的可用性Nano也开始重现风头。
如果你希望跟随Linux大师的脚步你总是可以尝试高大上的文本编辑器Emacs和Vim。想尝试Vim强大的用户首先可以考虑gVim它通过图形界面展现了Vim的强大。
除了jEdit和Kate这里还有其他模仿Emacs和Vim之类的旧式高级编辑器的编辑器比如JED 编辑器和Joe's Own Editor这两者都有Emacs的模拟模式。另一方面如果你在寻找轻量级的代码编辑器可以看看Bluefish和Geany。他们的存在是为了填补文本编辑器和全面集成的开发平台之间的空隙。
--------------------------------------------------------------------------------
via: http://www.linuxvoice.com/text-editors/
作者:[Ben Everard][a]
译者:[ictlyh](https://github.com/ictlyh)
校对:[royaso](https://github.com/royaso),[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.linuxvoice.com/author/ben_everard/

View File

@ -0,0 +1,58 @@
Unity Greeter Badges将丢失的会话图标带回Ubuntu登录屏幕
================================================================================
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/unity-greeter-badges-750x321.jpg)
新出现在**Ubuntu 15.04中的一个软件包解决了我对Unity 欢迎屏的微词像Cinnamon这样的其它Linux桌面会话没有徽章图标。**
我知道这有点吹毛求疵了这只是对大多数人而言几乎毫无影响的视觉瑕疵罢了。但是这种不一致性时时刻刻缠绕着我让我不胜其烦因为Ubuntu的一些会话带有徽章图标包括Unity、GNOME和KDE。而剩下的其它桌面环境包括它自己的一些旁系产品像Xubuntu只会在会话切换列表和主用户界面显示了一个不能再简单的白点。
这些点点们造成的这种不一致性刺激着我的神经,即使它只是稍纵即逝,但这种刺激不仅仅来自设计,也来自可用性方面。标牌式的标志符号对于让我们知道我们即将登陆到哪个会话很有帮助。
例如,你能告诉我们这个是个什么会话呢?
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/what-session-is-this-750x247.jpg)
Budgie? 也许是 MATE? 也能是 Cinnamon……我必须点开它才能知道。
没有必要这样做啊。构建Unity Greeter就是为了让桌面环境开发者能够部署徽章到欢迎屏幕中有些确实这样做了。但在许多情况下像MATE它的包来自上游的Debian想要移植一个“Ubuntu专用的补丁包”不太可取也不太可能。
### 一个解决方案出炉了 ###
一位有经验的Debian维护者[Doug Torrance][1]有了修复该可用性瑕疵的解决方案。与其依赖桌面制造者自己来添加品牌式徽章到他们的包中与其给Ubuntu增加维护它的责任重担Torrance还不如自己创建了一个独立的unity-greeter-badges包来收容它们。
承担起了直接提供会话标志的假定责任后,该包确保能同时迎合新旧窗口管理器、会话和桌面。
在30个左右的桌面环境列表中它为以下桌面捆绑了新的会话徽章
- Xubuntu
- Cinnamon
- MATE
- Cairo-Dock
- Xmonad
- Awesome
- OpenBox
- Pantheon
最重要的是,‘**Unity-Greeter-Badges**已经被Ubuntu 15.04收录进去。这就意味着Torrance的包将可以直接安装不需要PPA也不需要下载。没有像Unity Greeter一样成为核心包的一部分它可以以更高效和更及时的方式更新新的图标。
如果你真运行着Ubuntu 15.04,在不久的将来,你就可以从软件中心获取并安装该包了。
不想等到15.04Torrance已经为Ubuntu 14.04和Ubuntu 14.10用户做了个.deb安装器。
- [下载用于Ubuntu 14.04的unity-greeter-badges][2]
- [下载用于Ubuntu 14.10的unity-greeter-badges][3]
--------------------------------------------------------------------------------
via: http://www.omgubuntu.co.uk/2015/01/unity-greeter-badges-brings-missing-session-icons-ubuntu-login-screen
作者:[Joey-Elijah Sneddon][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:https://plus.google.com/117485690627814051450/?rel=author
[1]:https://launchpad.net/~profzoom
[2]:https://launchpad.net/~profzoom/+archive/ubuntu/misc/+files/unity-greeter-badges_0.1-0ubuntu1%7E201412111501%7Eubuntu14.04.1_all.deb
[3]:https://launchpad.net/~profzoom/+archive/ubuntu/misc/+files/unity-greeter-badges_0.1-0ubuntu1%7E201412111501%7Eubuntu14.10.1_all.deb

View File

@ -1,9 +1,9 @@
如何在Linux下创建一个不可变更的文件
================================================================================
假如你想对Linux中的一些重要文件做写保护这样它们就不能被删除或者被篡改成之前的版本或者其他东西。或者在其他情况,你可能想避免某些配置文件被软件自动修改。使用`chown`和`chmod`命令修改文件的归属关系或者权限位是处理这种情况的一个解决方法但这并不完美因为这样无法避免有root权限的操作。这时`chattr`就派上用场了。
假如你想对Linux中的一些重要文件做写保护这样它们就不能被删除或者被篡改成之前的版本或者其他东西,或者在其他情况下,你可能想避免某些配置文件被软件自动修改。使用`chown`和`chmod`命令修改文件的归属关系或者权限位是处理这种情况的一个解决方法但这并不完美因为这样无法避免有root权限的操作。这时`chattr`就派上用场了。
`chattr`是一个可以设置或取消文件的标志位的Linux命令它和标准的文件权限读、写、执行是分离的。与此相关的另一个命令是`lsattr`它可以显示文件的哪些标志位被设置上了。最初只有EXT文件系统EXT2/3/4支持`chattr`和`lsattr`所管理的标志位,但现在很多其他的本地Linux文件系统都支持了比如XFS、Btrfs、ReiserFS等等。
`chattr`是一个可以设置或取消文件的标志位的Linux命令它和标准的文件权限读、写、执行是分离的。与此相关的另一个命令是`lsattr`它可以显示文件的哪些标志位被设置上了。最初只有EXT文件系统EXT2/3/4支持`chattr`和`lsattr`所管理的标志位,但现在很多其他的原生的Linux文件系统都支持了比如XFS、Btrfs、ReiserFS等等。
在这个教程中,我会示范如果使用`chattr`来让Linux中的文件不可变更。
@ -22,7 +22,7 @@
- **c**: 当被写入磁盘时被自动压缩。
- **C**: 关掉“写时复制”。
- **i**: 不可变更。
- **s**: 通过自动归零来安全删除。译注一般情况文件被删后内容不会被修改改标志位会使得文件被删后原有内容被0取代
- **s**: 通过自动归零来安全删除。(LCTT 译注:一般情况文件被删后内容不会被修改,改标志位会使得文件被删后原有内容被0取代)
### “不可变更”标志位 ###
@ -30,11 +30,11 @@
$ sudo chattr +i /etc/passwd
注意设置或取消一个文件的“不可变更”标志位是需要用户权限的。现在检查该文件“不可变更”标志位是否被添加上了。
注意设置或取消一个文件的“不可变更”标志位是需要root用户权限的。现在检查该文件“不可变更”标志位是否被添加上了。
$ lsattr /etc/passwd
一旦文件被设置为不可变更,任何用户都将无法修改该文件。即使是用户也不可以修改、删除、覆盖、移动或者重命名这个文件。如果你想再次修改这个文件,需要先把“不可变更”标志位取消了。
一旦文件被设置为不可变更,任何用户都将无法修改该文件。即使是root用户也不可以修改、删除、覆盖、移动或者重命名这个文件。如果你想再次修改这个文件,需要先把“不可变更”标志位取消了。
用如下命令取消“不可变更”标志位:
@ -54,11 +54,11 @@
$ sudo chattr +a /var/log/syslog
注意当你复制一个“不可变更”或者“只可追加”的文件到其他地方后,新文件不会保留这些标志位
注意当你复制一个“不可变更”或者“只可追加”的文件到其他地方后,新文件不会保留这些标志位
### 结论 ###
在这个教程中,我展示了如何使用`chattr`和`lsattr`命令来管理额外的文件标志位,来避免文件被篡改(意外或者其他情况)的方法。注意你不能将`chattr`作为一个安全措施,因为“不可变更”标志位可以很容易被取消掉。解决这个问题的一个可能的方式是限制`chattr`命令自身的可用性,或者剥夺CAP_LINUX_IMMUTABLE内核权能标志。关于`chattr`以及可用的标志位的更多细节请参考它的man手册。
在这个教程中,我展示了如何使用`chattr`和`lsattr`命令来管理额外的文件标志位,来避免文件被篡改(意外或者其他情况)的方法。注意你不能将`chattr`作为一个安全措施,因为“不可变更”标志位可以很容易被取消掉。解决这个问题的一个可能的方式是限制`chattr`命令自身的可用性,或者去掉CAP_LINUX_IMMUTABLE内核权能标志。关于`chattr`以及可用的标志位的更多细节请参考它的man手册。
--------------------------------------------------------------------------------
@ -66,7 +66,7 @@ via: http://xmodulo.com/make-file-immutable-linux.html
作者:[Dan Nanni][a]
译者:[goreliu](https://github.com/goreliu)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,7 +1,7 @@
Inxi——获取Linux的系统和硬件信息
Inxi获取Linux的系统和硬件信息
================================================================================
我们已经展示了一些不同的[应用程序][1]和方法来获取Linux的系统和硬件信息。在这一系列我们将看到如何使用**inxi**来获取这些详情信息。在论坛技术支持中,它可以作为调试工具,迅速确定用户的系统配置和硬件信息。
我们已经展示了一些不同的[应用程序][1]和方法来获取Linux的系统和硬件信息。在这一系列,我们将看到如何使用**inxi**来获取这些详情信息。在论坛技术支持中,它可以作为调试工具,迅速确定用户的系统配置和硬件信息。
**Inxi**是一个可以获取完整的系统和硬件详情信息的命令行工具,内容包括:
@ -86,7 +86,7 @@ Inxi在多数现代GNU/Linux操作系统的默认软件仓库中。所以我们
Machine: System: Dell (portable) product: Inspiron N5050
Mobo: Dell model: 01HXXJ version: A05 Bios: Dell version: A05 date: 08/03/2012
只有硬性详情信息,它也可以显示我们系统中的**可用软件仓库列表**。
仅是硬性详情信息,它也可以显示我们系统中的**可用软件仓库列表**。
inxi -r
@ -110,7 +110,7 @@ Inxi还可以显示你所在位置的天气信息。感到意外吗是的
inxi -W Erode,Tamilnadu
这里**Erode**是区,**Tamilnadu**是印度的一个邦。
这里**Erode**是区,**Tamilnadu**是印度的一个邦。
示例输出:
@ -118,7 +118,7 @@ Inxi还可以显示你所在位置的天气信息。感到意外吗是的
### 查看完整的硬件详情信息 ###
厌倦了获取每种硬件的信息?你可以使用如下命令将所有信息一次列出:
厌倦了逐一获取每种硬件的信息?你可以使用如下命令将所有信息一次列出:
inxi -F
@ -164,9 +164,9 @@ via: http://www.unixmen.com/inxi-find-system-hardware-information-linux/
作者:[SK][a]
译者:[goreliu](https://github.com/goreliu)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.unixmen.com/author/sk/
[1]:http://www.unixmen.com/screenfetch-bash-screenshot-information-tool/
[1]:https://linux.cn/article-1947-1.html

View File

@ -1,6 +1,6 @@
zBackup——一个通用的重复数据备份工具
zBackup:一个多功能的去重备份工具
================================================================================
zbackup是一个基于rsync思想的全局重数据备份工具。给它传入一个大的tar文件后它会存储该文件的重复区域(仅进行一次)然后对结果进行压缩并根据参数确定是否对其加密。传入另一个tar文件后它会从之前的已备份文件中复用重复数据。只有新的改动会被保存,并且只要文件变动不是很大,需要的存储空间非常少。任何时候之前的已备份文件都可以被完整地读出来。
zbackup是一个基于rsync思想的全局重数据备份工具。给它传入一个大的tar文件后它会仅存储一次该文件的重复部分然后对结果进行压缩并根据参数确定是否对其加密。传入另一个tar文件后它会从之前的已备份文件中复用重复数据。只有新的改动会被保存并且只要文件差异不是很大,需要的存储空间非常少。无论何时,之前的已备份文件都可以被完整地读出来。
### zBackup特性 ###
@ -8,7 +8,7 @@ zbackup是一个基于rsync思想的全局重复数据备份工具。给它传
- 使用内置的AES加密算法加密已备份数据
- 可以删除旧的已备份数据
- 使用一个64位滚动哈希保持软碰撞数量为0
- 已备份数据由不可更改的文件组成。任何现有文件都没有被更改过
- 备份库由不可更改的文件组成,只有库中不存在的文件才能修改
- 使用C++语言编写,并且只有适量的依赖库
- 可以在生产环境安全使用
- 可以在不同备份库中交换数据而无需重新压缩
@ -25,7 +25,7 @@ zbackup是一个基于rsync思想的全局重复数据备份工具。给它传
zbackup init [--non-encrypted] [--password-file ~/.my_backup_password ] /my/backup/repo
`zbackup backup`命令备份一个由`tar c`创建的tar文件到刚才使用`zbackup init`初始化的备份库。译注实际使用时类似这样tar c files | zbackup ...
`zbackup backup`命令备份一个由`tar c`命令创建的tar文件到刚才使用`zbackup init`初始化的备份库。(LCTT 译注实际使用时类似这样tar c files | zbackup ...
zbackup [--password-file ~/.my_backup_password ] [--threads number_of_threads ] backup /my/backup/repo/backups/backup-`date +%Y-%m-%d'`
@ -37,18 +37,15 @@ zbackup是一个基于rsync思想的全局重复数据备份工具。给它传
- -non-encrypted -- 不加密备份库。
- --password-file ~/.my_backup_password -- 使用位于~/.my_backup_password的口令文件来加密备份库和待备份文件以及解密已备份文件。
- --threads number_of_threads -- 限制并行LZMA压缩的线程数number_of_threads。建议在32位的系统平台使用。
- --threads number_of_threads -- 限制并行LZMA压缩的线程数number_of_threads。建议在32位的系统平台使用。
- --cache-size cache_size_in_mb -- 使用cache_size_in_mb中的缓存大小来加速恢复文件的过程。
### zBackup相关文件 ###
### 上述命令中 zBackup 相关文件 ###
~/.my_backup_password 用来加密备份库和待备份文件以及解密已备份文件。更多细节见zbackup。
/my/backup/repo 存放备份库的目录。
/my/precious/restored-tar 用来恢复已备份文件的tar文件。
/my/backup/repo/backups/backup-`date +%Y-%m-%d'` 指定的之前已备份文件的文件名。
- ~/.my_backup_password 用来加密备份库和待备份文件以及解密已备份文件。更多细节见zbackup。
- /my/backup/repo 存放备份库的目录。
- /my/precious/restored-tar 用来恢复已备份文件的tar文件。
- /my/backup/repo/backups/backup-`date +%Y-%m-%d'` 指定的之前已备份文件的文件名。
--------------------------------------------------------------------------------
@ -56,7 +53,7 @@ via: http://www.ubuntugeek.com/zbackup-a-versatile-deduplicating-backup-tool.htm
作者:[ruchi][a]
译者:[goreliu](https://github.com/goreliu)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -0,0 +1,300 @@
指南使用Trickle限制应用程序带宽占用
================================================================================
有没有遇到过系统中的某个应用程序独占了你所有的网络带宽的情形如果你有过这样的遭遇那么你就会感受到Trickle这种带宽调整应用的价值。不管你是一个系统管理员还只是普通Linux用户都需要学习如何控制应用程序的上下行速度来确保你的网络带宽不会被某个程序霸占。
![Install Trickle Bandwidth Limit in Linux](http://www.tecmint.com/wp-content/uploads/2013/11/Bandwidth-limit-trickle.png)
*在 Linux 上安装 Trickle 带宽限制*
### 什么是 Trickle? ###
Trickle是一个网络带宽调整工具可以让我们管理应用程序的网络上下行速度使得可以避免其中的某个应用程序霸占了全部或大部分可用的带宽。换句话说Trickle可以让你基于单个应用程序来控制网络流量速率而不是仅仅针对与单个用户——这是在客户端网络环境中经典的带宽调整情况。
### Trickle 是如何工作的?###
另外trickle 可以帮助我们基于应用来定义优先级所以当对整个系统进行了全局限制设定高优先级的应用依然会自动地获取更多的带宽。为了实现这个目标trickle 对 TCP 连接上的套接字的数据发送、接收设置流量限制。我们必须注意到除了影响传输速率之外在这个过程中trickle任何时候都不会以任何方式来改变其中的数据。
### Trickle不能做什么 ###
这么说吧唯一的限制就是trickle不支持静态链接的应用程序或者具有SUID或SGID位设置的二进制程序因为它使用动态链接的方式将其载入到需要调整的进程和其关联的网络套接字之间。 Trickle此时会在这两种软件组件之间扮演代理的角色。
由于trickle并不需要超级用户的权限来运行所以用户可以设置他们自己的流量限制。可能这并不是你想要的我们会探索如何使用全局设定来限制系统中的所有用户的流量限制。也即是说此时系统中的每个用户具有管理各自的流量速率但是无论如何都会受到系统管理员给他们设置的总体限制。
在这篇文章中我们会描述如何通过trickle在linux平台上管理应用程序使用的网络带宽。为了生成所需的流量在此会在客户端(CentOS 7 server dev1: 192.168.0.17)上使用 ncftpput 和 ncftpget 在服务器(Debian Wheezy 7.5 dev2: 192.168.0.15)上使用vsftpd 来进行演示。 相同的指令也可以在RedHatFedora和Ubuntu等系统使用。
#### 前提条件 ####
1. 对于 RHEL/CentOS 7/6 [开启EPEL仓库][1]。这些用于企业版 Linux 的额外软件包是一个由Fedora项目维护的高质量、开源的软件仓库而且百分之百与其衍生产品相兼容如企业版本Linux和CentOS。 在这个仓库中trickle和ncftp两者都是可用的。
2. 按照如下方式安装ncftp
# yum update && sudo yum install ncftp [基于 RedHat 的系统]
# aptitude update && aptitude install ncftp [基于 Debian 的系统]
3. 在单独的服务器上设置一个FTP服务器。需要注意的是尽管FTP天生就不安全但是仍然被广泛应用在安全性无关紧要的文件上传下载中。 在这篇文章中我们使用它来演示trickle的优点同时它也会在客户端的标准输出流中显示传输速率。我们将是否在其它时间使用它放在一边讨论。
# yum update && yum install vsftpd [基于 RedHat 的系统]
# aptitude update && aptitude install vsftpd [基于 Debian 的系统]
现在在FTP服务器上按照以下方式编辑 /etc/vsftpd/vsftpd.conf 文件。
anonymous_enable=NO
local_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
在此之后确保在你的当前会话中启动了vsftpd并在之后的启动中让其自动启动。
# systemctl start vsftpd [基于 systemd 的系统]
# systemctl enable vsftpd
# service vsftpd start [基于 init 的系统]
# chkconfig vsftpd on
4. 如果你选择在一个使用 SSH 密钥进行远程访问的 CentOS/RHEL 7中搭建FTP服务器你需要一个密码受保护的用户账户它能访问**root目录之外**的某个目录,并有能在其中上传和下载文件的权限。
你可以通过在你的浏览器中输入以下的URL来浏览你的家目录。一个登录窗口会弹出来提示你输入FTP服务器中的有效的用户名和密码。
ftp://192.168.0.15
如果验证成功,你就会看到你的家目录中的内容。该教程的稍后部分中,你将可以刷新页面来显示在你之前上传过的文件。
![FTP Directory Tree](http://www.tecmint.com/wp-content/uploads/2013/11/FTP-Directory-Tree.png)
*FTP 目录树*
### 如何在Linux中安装 trickle ###
1. 通过yum或aptitude来安装trickle.
为了确保能够成功安装,最好在安装工具之前,保证当前的安装包是最新的版本。
# yum -y update && yum install trickle [基于 RedHat 的系统]
# aptitude -y update && aptitude install trickle [基于 Debian 的系统]
2. 确认trickle是否对特定的二进制包有用。
之前我们解释过trickle只对使用动态或共享的库的二进制包有用。为了确认我们是否可以对某个特定的应用使用trickle我们可以使用著名的ldd列出动态依赖工具。 特别地我们会查看任何给定程序的动态依赖中其当前使用的glibc因为其准确地定义了通过套接字通讯所使用的系统调用。
对一个给定的二进制包执行以下命令来查看是否能对其使用trickle进行带宽调整
# ldd $(which [binary]) | grep libc.so
例如,
# ldd $(which ncftp) | grep libc.so
其输出是:
# libc.so.6 => /lib64/libc.so.6 (0x00007efff2e6c000)
输出中的括号中的字符可能在不同的系统平台有所不同,甚至相同的命令在不同的时候运行也会不同,因为其代表包加载到物理内存中的地址。
如果上面的命令没有返回任何的结果就说明这个二进制包没有使用libc包因此trickle对其不能起到带宽调整的作用。
### 学习如何使用Trickle###
最基本的用法就是使用其独立模式通过这种方式trickle用来显式地定义给定应用程序的上传下载速率。如前所述为了简单我们会使用相同的应用来进行上传下载测试。
#### 在独立模式下运行trickle####
我们会比较在有无trickle的情况下的上传下载速率 -d选项指示下载速率KB/s单位而'-u'选项指示相同单位的上传速率。另外我们会使用到‘-s选项来指定trickle应该以独立模式运行。
以独立模式运行trickle的基本语法如下
# trickle -s -d [下载速率KB/s] -u [上传速率KB/s]
为了能够让你自己运行以下样例确保你在自己的客户端安装了trickle和ncftp我的是192.168.0.17)。
**样例1在有无trickle的情况下上传一个2.8 MB的PDF文件。**
我们使用一个自由发布的[LInux基础知识PDF文件][2]来进行下面的测试。
你可以首先使用下面的命令将这个文件下载到你当前的工作目录中:
# wget http://linux-training.be/files/books/LinuxFun.pdf
下面是在没有trickle的情况下将一个文件上传到我们的FTP服务器的语法
# ncftpput -u username -p password 192.168.0.15 /remote_directory local-filename
其中的 /remote_directory 是相对于该用户的家目录的上传路径而local-filename是一个你当前工作目录中的文件。
特别的是在没有trickle的情形下我们可以得到上传峰值速率52.02MB/s(请注意,这个不是真正的平均上传速率,而是峰值开始的瞬时值),而且这个文件几乎在瞬间就完成了上传。
# ncftpput -u username -p password 192.168.0.15 /testdir LinuxFun.pdf
输出:
LinuxFun.pdf: 2.79 MB 52.02 MB/s
在使用trickle的情况下我们会限制上传速率在5KB/s。在第二次上传文件之前我们需要在目标目录中删除这个文件否则ncftp就会通知我们在目标目录中已经存在了与上传文件相同的文件从而不会执行文件的传输
# rm /absolute/path/to/destination/directory/LinuxFun.pdf
然后:
# trickle -s -u 5 ncftpput -u username -p password 111.111.111.111 /testdir LinuxFun.pdf
输出:
LinuxFun.pdf: 2.79 MB 4.94 kB/s
在上面的样例中我们看到平均的上传速率下降到了5KB/s。
**样例2在有无trickle的情况下下载相同的2.8MB的PDF文件**
首先记得从原来的源目录中删除这个PDF
# rm /absolute/path/to/source/directory/LinuxFun.pdf
请注意下面的样例中将远程的文件下载到客户端机器的当前目录下这是由FTP服务器的IP地址后面的“.”决定的。
没有trickle的情况下
# ncftpget -u username -p password 111.111.111.111 . /testdir/LinuxFun.pdf
输出:
LinuxFun.pdf: 2.79 MB 260.53 MB/s
在有trickle的情况下限制下载速率在20KB/s
# trickle -s -d 30 ncftpget -u username -p password 111.111.111.111 . /testdir/LinuxFun.pdf
输出:
LinuxFun.pdf: 2.79 MB 17.76 kB/s
### 在监督[非托管]模式下运行Trickle ###
trickle也可以按照/etc/trickled.conf文件中定义的一系列参数运行在非托管模式下。 这个文件定义了守护线程 trickled的行为以及如何管理trickle。
另外如果你想要全局设置被所有的应用程序使用的话我们就会需要使用trickle命令。 这个命令运行守护进程并允许我们通过trickle定义所有应用程序共享的上传下载限制不需要我们每次来进行指定。
例如,运行:
# trickled -d 50 -u 10
会导致任何通过trickle运行的应用程序的上传下载速率分别限制在30kb/s和10kb/s。
请注意你可以在任何时间都能确认守护线程trickled是否正在运行以及其运行参数
# ps -ef | grep trickled | grep -v grep
输出:
root 16475 1 0 Dec24 ? 00:00:04 trickled -d 50 -u 10
**样例3在使用/不使用trickle的情形下上传一个 19MB 的mp4文件到我们的FTP服务器。**
在这个样例中我们会使用“He is the gift”的自由分发视频可以通过这个[链接][3]下载。
我们将会在开始时通过以下的命令将这个文件下载到你的当前工作目录中:
# wget http://media2.ldscdn.org/assets/missionary/our-people-2014/2014-00-1460-he-is-the-gift-360p-eng.mp4
首先我们会使用之前列出的命令来开启守护进程trickled:
# trickled -d 30 -u 10
在不使用trickle时:
# ncftpput -u username -p password 192.168.0.15 /testdir 2014-00-1460-he-is-the-gift-360p-eng.mp4
输出:
2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 36.31 MB/s
在使用trickle时
# trickle ncftpput -u username -p password 192.168.0.15 /testdir 2014-00-1460-he-is-the-gift-360p-eng.mp4
输出:
2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 9.51 kB/s
我们可以看到上面的输出,上传的速率下降到了约 10KB/s。
** 样例4在使用/不使用trickle的情形下下载这个相同的视频 **
与样例2一样我们会将该文件下载到当前工作目录中。
在没有trickle时:
# ncftpget -u username -p password 192.168.0.15 . /testdir/2014-00-1460-he-is-the-gift-360p-eng.mp4
输出:
2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 108.34 MB/s
有trickle的时
# trickle ncftpget -u username -p password 111.111.111.111 . /testdir/2014-00-1460-he-is-the-gift-360p-eng.mp4
输出:
2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 29.28 kB/s
上面的结果与我们之前设置的下载限速相对应(30KB/s)。
**注意:** 一旦守护进程开启之后就没有必要使用trickle来为每个应用程序来单独设置限制。
如前所述人们可以进一步地通过trickled.conf来客制化trickle的带宽速率调整该文件的一个典型的分段有以下部分组成
[service]
Priority = <value>
Time-Smoothing = <value>
Length-Smoothing = <value>
其中,
- [service] 用来指示我们想要对其进行带宽使用调整的应用程序名称
- Priority 用来让我们为某个服务制定一个相对于其他服务高的优先级,这样就不允许守护进程管理中的一个单独的应用程序来占用所有的带宽。越小的数字代表更高的优先级。
- Time-Smoothing [以秒计]: 定义了trickled让各个应用程序传输或接收数据的时间间隔。小的间隔值(0.1-1秒)对于交互式应用程序是理想的,因为这样会具有一个更加平滑的会话体验,而一个相对较大的时间间隔值(1-10秒)对于需要批量传输应用程序就会显得更好。如果没有指定该值默认是5秒。
- Length-smoothing [KB 单位]: 该想法与Time-Smoothing如出一辙但是是基于I/O操作而言。如果没有指定值会使用默认的10KB。
上述平滑值Time-Smoothing、 Length-smoothing的改变会被翻译为将指定的服务的使用一个间隔值而不是一个固定值。不幸的是没有一个特定的公式来计算间隔值的上下限主要依赖于特定的应用场景。
下面是一个在CentOS 7 客户端中的trickled.conf 样例文件192.168.0.17
[ssh]
Priority = 1
Time-Smoothing = 0.1
Length-Smoothing = 2
[ftp]
Priority = 2
Time-Smoothing = 1
Length-Smoothing = 3
使用该设置trickled会为SSH赋予比FTP较高的传输优先级。值得注意的是一个交互进程例如SSH使用了一个较小的时间间隔值然而一个处理批量数据传输的服务如FTP则使用一个较大的时间间隔来控制之前的样例中的上传下载速率尽管不是百分百的由trickled指定的值但是也已经非常接近了。
### 总结 ###
在该文章中,我们探索了使用trickle在基于Fedora发行版和Debian衍生版平台上来限制应用程序的带宽使用。也包含了其他的可能用法但是不对以下情形进行限制:
- 限制系统工具的下载速度,例如[wget][4],或 BT客户端.
- 限制你的系统的包管理工具[`yum`][5]更新的速度 (如果是基于Debian系统的话其包管理工具为[`aptitude`][6])。
- 如果你的服务器是在一个代理或防火墙后面(或者其本身即是代理或防火墙的话)你可以使用trickle来同时设定下载和上传速率或者客户端或外部通讯的速率。
欢迎提问或留言。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/manage-and-limit-downloadupload-bandwidth-with-trickle-in-linux/
作者:[Gabriel Cánepa][a]
译者:[theo-l](https://github.com/theo-l)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/gacanepa/
[1]:https://linux.cn/article-2324-1.html
[2]:http://linux-training.be/files/books/LinuxFun.pdf
[3]:http://media2.ldscdn.org/assets/missionary/our-people-2014/2014-00-1460-he-is-the-gift-360p-eng.mp4
[4]:http://www.tecmint.com/10-wget-command-examples-in-linux/
[5]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/
[6]:http://www.tecmint.com/dpkg-command-examples/

View File

@ -0,0 +1,174 @@
使用Observium来监控你的网络和服务器
================================================================================
### 简介###
在监控你的服务器、交换机或者设备时遇到过问题吗?**Observium** 可以满足你的需求。这是一个免费的监控系统它可以帮助你远程监控你的服务器。它是一个由PHP编写的基于自动发现 SNMP 的网络监控平台,支持非常广泛的网络硬件和操作系统,包括 Cisco、Windows、Linux、HP、NetApp 等等。在此我会给出在 Ubuntu 12.04 上一步步地设置一个 **Observium** 服务器的介绍。
![](http://www.unixmen.com/wp-content/uploads/2015/03/Capture1.png)
目前有两种不同的 **observium** 版本。
- Observium 社区版本是一个在 QPL 开源许可证下的免费工具这个版本是对于较小部署的最好解决方案。该版本每6个月进行一次安全性更新。
- 第2个版本是 Observium 专业版,该版本采用基于 SVN 的发布机制。 会得到每日安全性更新。 该工具适用于服务提供商和企业级部署。
更多信息可以通过其[官网][1]获得。
### 系统需求###
要安装 **Observium** 需要具有一个最新安装的服务器。**Observium** 是在 Ubuntu LTS 和 Debian 系统上进行开发的,所以推荐在 Ubuntu 或 Debian 上安装 **Observium**,因为可能在别的平台上会有一些小问题。
该文章会引导你在 Ubuntu 12.04 上安装 **Observium**。对于小型的 **Observium** 安装,建议使用 256MB 内存和双核处理器的配置。
### 安装需求 ###
在安装 **Observuim** 之前,你需要确认安装所有的依赖关系包。
首先,使用下面的命令更新你的服务器:
sudo apt-get update
然后你需要安装下列运行 Observuim 所需的全部软件包。
Observium 需要使用下面所列出的软件才能正确的运行:
- LAMP 服务器
- fping
- Net-SNMP 5.4+
- RRDtool 1.3+
- Graphviz
对于可选特性的要求:
- Ipmitool - 仅在当你想要获取服务器上的 IPMIIntelligent Platform Management Interface 智能平台管理接口)基板控制器时。
- Libvirt-bin - 仅在当你想要使用 libvirt 进行远程 VM 主机监控时。
sudo apt-get install libapache2-mod-php5 php5-cli php5-mysql php5-gd php5-mcrypt php5-json php-pear snmp fping mysql-server mysql-client python-mysqldb rrdtool subversion whois mtr-tiny ipmitool graphviz imagemagick libvirt ipmitool
### 为 Observium 创建 MySQL 数据库及其用户。
现在你需要登录到 MySQL 中并为 **Observium** 创建数据库:
mysql -u root -p
在用户验证成功之后,你需要按照下面的命令创建该数据库。
CREATE DATABASE observium;
数据库名为 **Observium**,稍后你会需要这个信息。
现在你需要创建数据库管理员用户。
CREATE USER observiumadmin@localhost IDENTIFIED BY 'observiumpassword';
接下来,你需要给该管理员用户相应的权限来管理创建的数据库。
GRANT ALL PRIVILEGES ON observium.* TO observiumadmin@localhost;
你需要将权限信息写回到磁盘中来激活新的 MySQL 用户:
FLUSH PRIVILEGES;
exit
### 下载并安装 Observium###
现在我们的系统已经准备好了, 可以开始Observium的安装了。
第一步,创建 Observium 将要使用的文件目录:
mkdir -p /opt/observium && cd /opt
按本教程的目的,我们将会使用 Observium 的社区/开源版本。使用下面的命令下载并解压:
wget http://www.observium.org/observium-community-latest.tar.gz
tar zxvf observium-community-latest.tar.gz
现在进入到 Observium 目录。
cd observium
将默认的配置文件 '**config.php.default**' 复制到 '**config.php**',并将数据库配置选项填充到配置文件中:
cp config.php.default config.php
nano config.php
----------
/ Database config
$config['db_host'] = 'localhost';
$config['db_user'] = 'observiumadmin';
$config['db_pass'] = 'observiumpassword';
$config['db_name'] = 'observium';
现在为 MySQL 数据库设置默认的数据库模式:
php includes/update/update.php
现在你需要创建一个文件目录来存储 rrd 文件,并修改其权限以便让 apache 能将写入到文件中。
mkdir rrd
chown apache:apache rrd
为了在出现问题时排错,你需要创建日志文件。
mkdir -p /var/log/observium
chown apache:apache /var/log/observium
现在你需要为 Observium 创建虚拟主机配置。
<VirtualHost *:80>
DocumentRoot /opt/observium/html/
ServerName observium.domain.com
CustomLog /var/log/observium/access_log combined
ErrorLog /var/log/observium/error_log
<Directory "/opt/observium/html/">
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>
下一步你需要让你的 Apache 服务器的 rewrite (重写)功能生效。
为了让 'mod_rewrite' 生效,输入以下命令:
sudo a2enmod rewrite
该模块在下一次 Apache 服务重启之后就会生效。
sudo service apache2 restart
###配置 Observium###
在登入 Web 界面之前,你需要为 Observium 创建一个管理员账户级别10
# cd /opt/observium
# ./adduser.php admin adminpassword 10
User admin added successfully.
下一步为发现和探寻任务设置一个 cron 任务,创建一个新的文件 **/etc/cron.d/observium** 并在其中添加以下的内容。
33 */6 * * * root /opt/observium/discovery.php -h all >> /dev/null 2>&1
*/5 * * * * root /opt/observium/discovery.php -h new >> /dev/null 2>&1
*/5 * * * * root /opt/observium/poller-wrapper.py 1 >> /dev/null 2>&1
重载 cron 进程来增加新的任务。
# /etc/init.d/cron reload
好啦,你已经完成了 Observium 服务器的安装拉! 使用你的浏览器登录到 **http://\<Server IP>**,然后上路吧。
![](http://www.unixmen.com/wp-content/uploads/2015/03/Capture.png)
尽情享受吧!
--------------------------------------------------------------------------------
via: http://www.unixmen.com/monitoring-network-servers-observium/
作者:[anismaj][a]
译者:[theo-l](http://github.com/theo-l)
校对:[wxy](http://github.com/wxy)
本文由 [LCTT](http://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.unixmen.com/author/anis/
[1]:http://www.observium.org/

View File

@ -1,10 +1,10 @@
局域网中实现Ubuntu和Windows共享文件夹
如何在局域网中将Ubuntu文件夹共享给Windows
================================================================================
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_Folder_Ubuntu_windows.jpeg)
本文全面详细地向你描述了**在Ubuntu中如何实现局域网内的文件夹共享**。
你的家中是不是有多台电脑当你需要从一台Ubuntu电脑向另一台电脑传输数据时是不是必须用到U盘或SD卡你是否也觉得这个方法很烦人我想肯定是。本文的目的就是使你在局域网内快速方便地传输文件、文档和其它较大的数据节省你的宝贵时间。只需一次设置,然后轻点鼠标,你就可以自由地**在Ubuntu和Windows之间共享文件**当然这对其它Linux系统同样使用。不要担心这很容易操作不会花费太多时间。
你的家中是不是有多台电脑当你需要从一台Ubuntu电脑向另一台电脑传输数据时是不是必须用到U盘或SD卡你是否也觉得这个方法很烦人我想肯定是。本文的目的就是使你在局域网内快速方便地传输文件、文档和其它较大的数据节省你的宝贵时间。只需一次设置,然后轻点鼠标,你就可以自由地**在Ubuntu和Windows之间共享文件**当然这对其它Linux系统同样使用。不要担心这很容易操作,不会花费太多时间。
除此之外尽管本文是在Ubuntu上进行实践但这个教程在其它Linux系统上同样有用。
@ -21,11 +21,11 @@
#### 步骤一:####
为了在Ubuntu上实现局域网共享文件夹右键点击打算共享的文件夹并选择“Local Network Share”
为了在Ubuntu上实现局域网共享文件夹右键点击打算共享的文件夹并选择“Local Network Share(本地网络共享)”:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Share_Folder_Ubuntu.jpeg)
**可能有用的故障方案**如果在右键菜单中看不到“Local Network Share”的选项那就新建一个终端使用下面的命令去安装nautlius-share
**可能有用的故障解决方案**如果在右键菜单中看不到“Local Network Share”的选项那就新建一个终端使用下面的命令去安装nautlius-share插件
sudo apt-get install nautilus-share
@ -35,17 +35,17 @@
#### 步骤二:####
一旦点击“Local Network Share”就会出现共享文件夹的选项。只需选中“Share this folder”这一项
一旦点击“Local Network Share”就会出现共享文件夹的选项。只需选中“Share this folder(共享该文件夹)”这一项:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_Folder_Ubuntu_1.jpeg)
可能的故障方案:如果提示共享服务还未安装,就像下图所示,那就点击安装服务,按照提示操作。
**可能的故障解决方案**:如果提示共享服务还未安装,就像下图所示,那就点击安装服务,按照提示操作。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_Folder_Ubuntu_2.jpeg)
#### 步骤三:####
一旦选中“Share this folder”的选项就会看到按钮“Create Share”变成可用了。你也可以允许其他用户在共享文件夹中编辑文件。选项“Guest access”也是如此。
当选中“Share this folder”的选项就会看到按钮“Create Share创建共享”变得可以点击了。你也可以“Allow others to create and delete fies in this folder允许其他用户在共享文件夹中编辑文件)”。选项“Guest access(允许访客访问)”也是如此。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_folder_Ubuntu_3.png)
@ -55,13 +55,13 @@
### 2. 在Ubuntu上使用密码保护实现局域网共享文件夹###
为了达到目的首先需要配置Samba服务器。事实上在这篇教程的前一部分我们已经用到了Samba只是我们没有刻意强调。在介绍如何在Ubuntu上搭建Samba服务器实现局域网共享的方法之前先快速预览一下[Samba][1]到底是什么。
为了达到这个目的首先需要配置Samba服务器。事实上在这篇教程的前一部分我们已经用到了Samba只是我们没有刻意强调。在介绍如何在Ubuntu上搭建Samba服务器实现局域网共享的方法之前先快速预览一下[Samba][1]到底是什么。
#### Samba是什么 ####
Samba是一个允许用户通过网络共享文件、文档和打印机的软件包无论是在Linux、Windows还是Mac上。它适用于所有的主流平台可以在所有支持系统上流畅运行。下面是维基百科的介绍
> Samba是一款重新实现SMB/CIFS网络协议的自由软件最初由安德鲁·垂鸠开发。在第三版中Smaba不仅支持通过不同的Windows客户端访问及分享SMB的文件夹及打印机还可以集成到Windows Server域作为主要域名控制站PDC或者域名成员。它也可以作为Active Directory域名的一部分。
> Samba是一款重新实现SMB/CIFS网络协议的自由软件最初由安德鲁·垂鸠开发。在第三版中Smaba不仅支持通过不同的Windows客户端访问及分享SMB的文件夹及打印机还可以集成到Windows Server域作为主域控制器PDC或者域成员。它也可以作为活动目录域的一部分。
#### 在Ubuntu上安装Samba服务器 ####
@ -77,7 +77,7 @@ Samba是一个允许用户通过网络共享文件、文档和打印机的软件
#### 在Ubuntu上配置Samba服务器 ####
从dash打开Samba配置工具
从dash打开Samba配置工具
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Setup-Samba.png)
@ -86,7 +86,7 @@ Samba是一个允许用户通过网络共享文件、文档和打印机的软件
在Server Setting中可以看到两个选项卡BasicSecurity。在Basic选项卡下的选项含义如下
- 工作组 - 用户要连接的电脑所在工作组的名字。比如如果你想连接到一台Windows电脑你就要输入Windows电脑的工作组名字。在Windows的Samba服务器设置中已经默认设置好统一的工作组名字。但如果你有不同的工作组名字就在这个字段中输入自定义的工作组名字。在Windows 7中获取工作组名字右击计算机图标进到属性就能看到Windows工作组名字。
- 描述 - 其他用户看到的你的电脑名字。不要使用空格或计算机不支持(望更正!)的字符。
- 描述 - 其他用户看到的你的电脑名字。不要使用空格或不适用于网络的字符。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/samba-server-settings.png)
@ -101,14 +101,14 @@ Samba是一个允许用户通过网络共享文件、文档和打印机的软件
现在我们需要为网络共享文件创建一个系统用户。下面是非常简单的步骤:
- 在Systems Settings下点击**User Accounts**。
- 点击**unlock**使其可用,以及+**plus**)图标。
- 点击+plus)图标,创建一个新的系统用户。
- 点击**unlock**使其可用,以及+**加号**)图标。
- 点击+加号)图标,创建一个新的系统用户。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/create-system-user1.jpg)
如上图所示需要输入Full name。当你输入Full nameUsername会自动填充为Full name。因为创建这个用户是为了共享文件所以还要指定Account Type为**Standard**’。
完成上述步骤点击添加你就创建好一个系统用户。这个用户还没有被激活所以需要为其设置密码来激活。确保Users accounts界面已经解锁。点击Account disabled。输入一个新密码然后确认密码点击Change。
完成上述步骤点击添加你就创建好一个系统用户。这个用户还没有被激活所以需要为其设置密码来激活。确保Users accounts界面已经解锁。点击尚不可用的账户,输入一个新密码然后确认密码点击Change。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/activate-system-user.jpg)
@ -132,7 +132,7 @@ Samba是一个允许用户通过网络共享文件、文档和打印机的软件
#### 通过网络共享文件夹或文件 ####
在图形用户界面下通过Samba共享文件是很简单的。点击Plus图标,会看到如图所示的对话框:
在图形用户界面下通过Samba共享文件是很简单的。点击加号图标,会看到如图所示的对话框:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/share-files-and-folders.jpg)
@ -157,9 +157,8 @@ Samba是一个允许用户通过网络共享文件、文档和打印机的软件
全部搞定我们也可以使用终端进行网络文件共享但这样没有本文介绍的方法这么容易。如果你确实想知道命令行操作我会再写一篇关于在Linux上使用命令行实现网络文件共享的文章。
所以,你是怎么找到这篇教程的呢?我希望看了这篇教程你可以**很容易地在Ubuntu和Windows之间共享文件**。如果你有任何问题或建议,请评论里说出来。
所以,你是怎么找到这篇教程的呢?我希望看了这篇教程你可以**很容易地在Ubuntu和Windows之间共享文件**。如果你有任何问题或建议,请评论里说出来。
这篇教程是在Kalc的请求下写出的。如果你也想你可以[请求你自己的教程][2]。我们很乐意帮助你和面临同样问题的读者解决问题。
--------------------------------------------------------------------------------
@ -167,7 +166,7 @@ via: http://itsfoss.com/share-folders-local-network-ubuntu-windows/
作者:[Mohd Sohail][a]
译者:[KayGuoWhu](https://github.com/KayGuoWhu)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -0,0 +1,82 @@
Windows 下的免费 SSH 客户端工具
================================================================================
如果你的操作系统是 Windows而你想要连接 Linux 服务器相互传送文件,那么你需要一个简称 SSH 的 Secure Shell 软件。实际上SSH 是一个网络协议,它允许你通过网络连接到 Linux 和 Unix 服务器。SSH 使用公钥加密来认证远程的计算机。你可以有多种途径使用 SSH无论是自动连接还是使用密码认证登录。
本篇文章介绍了几种可以连接 Linux 服务器 SSH 客户端。
让我们开始。
### Putty ###
**Putty** 是最有名的 SSH 和 telnet 客户端,最初由 Simon Tatham 为 Windows 平台开发。Putty 是一款开源软件,有可用的源代码,和一群志愿者的开发和支持。
![](http://www.unixmen.com/wp-content/uploads/2015/03/putty.png)
Putty 非常易于安装和使用,通常大部分的配置选项你都不需要修改。你只需要输入少量基本的参数,就可以开始很简单地建立连接会话。[点此下载][1] Putty。
### Bitvise SSH Client ###
**Bitvise SSH** 是一款支持 SSH 和 SFTP 的 Windows 客户端。由 Bitvise 开发和提供专业支持。这款 SSH 客户端性能强悍易于安装、便于使用。Bitvise SSH 客户端拥有功能丰富的图形界面,通过一个有自动重连功能的内置代理进行动态端口转发。
![](http://www.unixmen.com/wp-content/uploads/2015/03/bitvise.png)
Bitvise SSH 客户端对**个人用户使用是免费的**,同时对于在组织内部的个人商业使用也一样。你可以[在这里下载 Bitvise SSH 客户端][2]。
### MobaXterm ###
**MobaXterm** 是你的**远程计算的终极工具箱**。在一个 Windows 应用里它为程序员、网管、IT 管理员及其它用户提供了精心裁剪的一揽子功能,让他们的远程操作变得简约时尚。
![](http://www.unixmen.com/wp-content/uploads/2015/03/mobaxterm.png)
MobaXterm 提供了所有重要的**远程网络工具** 如SSH、 X11、 RDP、 VNC、 FTP、 MOSH 等等),以及 Windows 桌面上的 **Unix 命令**bash、 ls、 cat、sed、 grep、 awk、 rsync等等而这些都是由一个开箱即用的**单一的便携程序**所提供。MobaXterm 对**个人使用免费**,你可以[在这里][3]下载 MobaXterm。
### DameWare SSH ###
我认为 **DameWare SSH** 是最好的免费SSH客户端。
![](http://www.unixmen.com/wp-content/uploads/2015/03/ssh.png)
这个免费工具是一个终端模拟器,可以让你从一个易用的控制台建立多个 telnet 和 SSH 连接。
-用一个带标签的控制台界面管理多个会话
-将常用的会话保存在 Windows 文件系统中
-使用多套保存的证书来轻松登录不同的设备
-使用 telnet、SSH1 和 SSH2 协议连接计算机和设备
你可以从[这个链接][4]下载 **DameWare SSH**
### SmarTTY ###
 
SmarTTY 是一款免费的多标签 SSH 客户端,支持使用 SCP 命令随时复制文件和目录。
![](http://www.unixmen.com/wp-content/uploads/2015/03/smart.png)
大多数 SSH 服务器每个连接支持最多10个子会话SmarTTY 在这方面做得很好:没有烦人的多个窗口,不需要重新登录,仅仅打开一个新的标签页就可以开始了!
### Cygwin ###
Cygwin 是一款 GNU 和开源工具的大杂烩,提供的功能近似于一个 Windows 平台下的 Linux。
![](http://www.unixmen.com/wp-content/uploads/2015/03/cyq.png)
**Cygwin** 包括了一个称为模拟库的 Unix 系统cygwin.dll集成了大量的 GNU 和其它的免费软件以大量的可选包方式组织而成。在这些安装包中有高质量的编译器和其他软件开发工具、一个X11服务器、一套完整的X11开发套件、GNU emacs 编辑器、Tex 和 LaTeX、openSSH客户端和服务器除此之外还有很多包括在微软 Windows 下需要编译和使用 PhysioToolkit 软件的每一样东西。
读完我们的文章后,不知你中意哪一款 SSH 客户端?你可以留下你的评论,描述你喜欢的系统和选择的原因。当然,如果有另外的 SSH 客户端没有被本文列举出来,你可以帮助我们补充。
--------------------------------------------------------------------------------
via: http://www.unixmen.com/list-free-windows-ssh-client-tools-connect-linux-server/
作者:[anismaj][a]
译者:[wi-cuckoo](http://github.com/wi-cuckoo)
校对:[wxy](http://github.com/wxy)
本文由 [LCTT](http://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.unixmen.com/author/anis/
[1]:http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
[2]:http://www.bitvise.com/download-area
[3]:http://mobaxterm.mobatek.net/download.html
[4]:http://www.dameware.com/downloads/registration.aspx?productType=ssh&AppID=17471&CampaignID=70150000000PcNM
[5]:http://cygwin.com/packages/

View File

@ -0,0 +1,132 @@
5个有趣的Linux命令行技巧
================================================================================
你有将Linux物尽其用吗对很多Linux用户来说有很多看起来是技巧的有用特性。有些时候你会需要这些技巧。本文会帮助你更好得使用一些命令发挥其更强大的功能。
![5个命令行技巧](http://www.tecmint.com/wp-content/uploads/2015/03/5-Command-Line-Tips.jpg)
*图15个命令行技巧*
我们开始一个新的系列,在这里我们还会写一些技巧,并且用尽量小的篇幅写清楚。
### 1. 我们可以使用[`history`命令][1]来查看曾经运行过的命令。 ###
这里是一个`history`命令的示例输出。
# history
![history命令例子](http://www.tecmint.com/wp-content/uploads/2015/03/history-command.gif)
*图2history命令例子*
从`history`命令输出看,很明显,命令的执行时间没有被打出来。有解决方法吗?有的!运行如下命令:
# HISTTIMEFORMAT="%d/%m/%y %T "
# history
如果你想让这个修改永久生效,添加如下的一行内容到`~/.bashrc`文件中:
export HISTTIMEFORMAT="%d/%m/%y %T "
然后,在终端中运行:
# source ~/.bashrc
命令和选项的解释:
- history 查看运行过的命令
- HISTIMEFORMAT 设置时间格式的环境变量
- %d
- %m
- %y
- %T 时间戳
- source 简而言之就是将文件内容发送给shell来执行
- .bashrc BASH以交互方式启动时运行的脚本文件
![history命令输出的日志](http://www.tecmint.com/wp-content/uploads/2015/03/History-Command-Logs.gif)
*图3`history`命令输出的日志*
### 2. 如何测试磁盘写入速度?###
一行`dd`命令脚本就可以实现。
# dd if=/dev/zero of=/tmp/output.img bs=8k count=256k conv=fdatasync; rm -rf /tmp/output.img
![dd命令例子](http://www.tecmint.com/wp-content/uploads/2015/03/dd-Command-Example.gif)
*图4`dd`命令例子*
命令和选项的解释:
- dd 转换和复制文件
- if=/dev/zero 指定输入文件默认为stdin标准输入
- of=/tmp/output.img 指定输出文件默认为stdout标准输出
- bs 一次读和写的块大小最大可以以MB为单位
- count 复制次数
- conv 使用逗号分隔的策略来转换文件LCTT 译注比如将大写字母转换成小写echo AA | dd conv=lcase
- rm 删除文件和目录
- -rf -r 递归地删除目录和其中的内容,(-f强行删除而不输出确认信息
### 3. 你如何获取吃掉你磁盘空间的最大的6个文件###
一个使用[`du`命令][2]的简单单行脚本即可实现,`du`命令主要用于获取文件的空间使用情况。
# du -hsx * | sort -rh | head -6
![获取磁盘空间使用情况的方法](http://www.tecmint.com/wp-content/uploads/2015/03/check-disk-space-usage.gif)
*图5获取磁盘空间使用情况的方法*
命令和选项的解释:
- du 估计文件的空间使用情况
- -hsx -h更易读的格式-s汇总输出-x跳过其他文件系统的文件
- sort 对文本文件按行排序
- -rf -r将比较的结果逆序输出-f忽略大小写
- head 输出文件的头几行
### 4. 获取一个文件的详细状态信息###
可以使用`stat`命令
# stat filename_ext 例如stat abc.pdf
![获取文件的详细信息](http://www.tecmint.com/wp-content/uploads/2015/03/Check-File-Statistics.gif)
*图6获取文件的详细信息*
### 5. 显示帮助 ###
最后一个技巧是为那些入门者准备的如果你是有经验的用户可能不需要它除非你想从中寻找乐趣。入门者可能有Linux命令行恐惧症下面的命令会随机显示一个man手册页。对入门者来说好处是总会学到新的东西而且不会厌倦。
# man $(ls /bin | shuf | head -1)
![查看随机的man手册页](http://www.tecmint.com/wp-content/uploads/2015/03/Generate-Random-Man-Pages.gif)
*图7查看随机的man手册页*
命令和选项的解释:
- man Linux man手册
- ls 列出文件
- /bin 系统可执行文件的路径
- shuf 把输入内容按行随机打乱并输出
- head 输出文件的头几行
这就是所有的内容了。如果你知道任何类似的技巧,可以分享给我们,我们会用你的语言在网站上发表出来。
不要忘记在下边评论框中留下有价值的反馈。保持联系。可以点赞或者将本文分享来帮助我们更好地传播内容。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/5-linux-command-line-tricks/
作者:[Avishek Kumar][a]
译者:[goreliu](https://github.com/goreliu)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/avishek/
[1]:https://linux.cn/article-1143-1.html
[2]:http://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/

View File

@ -1,12 +1,13 @@
如何在 Linux 中使用 Alpine 在命令行里获取 Gmail
如何在 Linux 中使用 Alpine 在命令行里访问 Gmail
================================================================================
假如你是一个命令行爱好者,我很确信你将张开双臂欢迎任何可以使你使用这个强大的工作环境来执行哪怕一项日常任务的工具,例如从 [安排日程][1] 、 [管理财务][2] 到 获取 [Facebook][3] 、[Twitter][4]等任务。
在这个帖子中,我将为你展示 Linux 命令行的另一个漂亮干练的使用案例:**获取 Google 的 Gmail 服务**,为此,我们将使用 Alpine一个基于 ncurses 的多功能命令行邮件客户端(不要和 Alpine Linux 搞混淆)。我们将在 Alphine 中配置 Gmail 的 IMAP 和 SMTP 设定来通过 Google 的邮件服务器在终端环境中收取和发送邮件。在这个教程的最后,你将意识到只需几步就可以在 Alpine 中使用其他的邮件服务。
假如你是一个命令行爱好者,我很确信你会使用这个强大的工作环境来执行哪怕是一项日常任务的工具,并为之欢呼,例如从 [安排日程][1] 、 [管理财务][2] 到 获取 [Facebook][3] 、[Twitter][4]等任务。LCTT 译注:阅读本文的另一个前提是,假如你还能访问 Gmail 或者知道 Gmail 是什么的话。)
诚然,已有许多卓越的基于 GUI 的邮件客户端存在,例如 Thunderbird Evolution 或者甚至是 Web 界面,那么为什么还有人对使用命令行的邮件客户端来收取 Gmail 这样的事感兴趣呢?答案很简单。假如你需要快速地处理好事情并想避免使用不必要系统资源;或者你正工作在一个最小化安装(注:这里我感觉自己翻译有误)的服务器上,而它没有安装 X 服务(注:这里也需要更改);又或者是 X 服务在你的桌面上崩溃了,而你需要在解决这个问题之前急切地发送一些邮件。在上述所有的情况下, Alpine 都可以派上用场并在任何时间满足你的需求
在这个帖子中,我将为你展示 Linux 命令行的另一个漂亮干练的使用案例:**访问 Google 的 Gmail 服务**,为此,我们将使用 Alpine一个基于 ncurses 的多功能命令行邮件客户端(不要和 Alpine Linux 搞混淆)。我们将在 Alphine 中配置 Gmail 的 IMAP 和 SMTP 设定,通过 Google 的邮件服务器在终端环境中收取和发送邮件。在这个教程的最后,你将发现只需几步就可以在 Alpine 中使用其他的邮件服务
除了简单的编辑,发送和接收文本类的邮件信息等功能外, Alpine 还可以进行加密,解密和对邮件信息进行数字签名,以及与 TLS(注Transport Layer Security) 无缝集成。
诚然,已有许多卓越的基于 GUI 的邮件客户端存在,例如 Thunderbird Evolution 或者甚至是 Web 界面,那么为什么还有人对使用命令行的邮件客户端来收取 Gmail 这样的事感兴趣呢?答案很简单。假如你需要快速地处理好事情并想避免浪费不必要系统资源;或者你正工作在一个精简安装无操作台的服务器上,它没有安装用于图形显示的 X 服务;又或者是 X 服务在你的桌面上崩溃了,而你需要在解决这个问题之前急切地发送一些邮件。在上述所有的情况下, Alpine 都可以派上用场并在任何时间满足你的需求。
除了简单的编辑,发送和接收文本类的邮件信息等功能外, Alpine 还可以进行加密,解密和对邮件信息进行数字签名,以及与 TLSTransport Layer Security传输层加密无缝集成。
### 在 Linux 上安装 Alpine ###
@ -22,16 +23,13 @@
# alpine
在你第一次启用 Alpine 时,它将在当前用户的家目录下创建一个邮件文件夹(`~/mail`),并显现出主界面,正如下面的截屏所显示的那样:
youtube视频发布的时候做个链接吧(注:这里我不知道该如何操作,不过我已经下载了该视频,如有需要,可以发送)
<iframe width="615" height="346" frameborder="0" allowfullscreen="" src="http://www.youtube.com/embed/kuKiv3uze4U?feature=oembed"></iframe>
在你第一次启用 Alpine 时,它将在当前用户的家目录下创建一个邮件文件夹(`~/mail`)并显现出主界面正如下面的视频所显示的那样YOUTUBU 视频 - http://www.youtube.com/kuKiv3uze4U 。
它的用户界面有下列几个模块:
![](https://farm9.staticflickr.com/8724/16618079590_6c236ce2c2_c.jpg)
请随意地浏览操作来熟悉 Alpine。你总是可以在任何时候通过敲 'Q' 来回到命令提示符界面。请注意,所有的字符界面下方都有与操作相关的帮助。
请随意地浏览操作来熟悉 Alpine。你总是可以在任何时候通过敲 'Q' 来回到命令提示符界面。请注意,所有的字符界面下方都有与操作相关的帮助。
在进一步深入之前,我们将为 Alpine 创建一个默认的配置文件。为此,请关闭 Alpine然后在命令行中执行下面的命令
@ -39,9 +37,9 @@
### 配置 Alpine 来使用 Gmail 账号 ###
一旦你安装了 Alpine 并至少花费了几分钟的时间来熟悉它的界面和菜单,下面便是实际配置它来使用一个已有的 Gmail 账户的时候了。
你安装了 Alpine 并至少花费了几分钟的时间来熟悉它的界面和菜单,下面便是实际配置它来使用一个已有的 Gmail 账户的时候了。
在 Alpine 中执行下面的步骤之前,记得要通过你的 Web 邮件界面,在你的 Gmail 设定里启用 IMAP 协议。一旦在你的 Gmail 账户中 IMAP 被启用,执行下面的步骤来在 Alpine 中启用阅读 Gmail 信息的功能。
在 Alpine 中执行下面的步骤之前,记得首先要通过你的 Web 邮件界面,在你的 Gmail 设定里启用 IMAP 协议。一旦在你的 Gmail 账户中启用了 IMAP ,执行下面的步骤来在 Alpine 中启用阅读 Gmail 信息的功能。
首先,启动 Alpine。
@ -51,12 +49,12 @@
按 'A' 来新建一个文件夹并填写必要的信息:
- **昵称**: 填写任何你想写的名字;
- **服务器**: imap.gmail.com/ssl/user=yourgmailusername@gmail.com
- **Nickname**: 填写任何你想写的名字;
- **Server**: imap.gmail.com/ssl/user=yourgmailusername@gmail.com
你可以将 `Path``View` 留白不填。
然后按 `Ctrl+X` 并在提示时输入你的 Gmail 密码:
然后按 `Ctrl+X` 并在提示时输入你的 Gmail 密码:
![](https://farm9.staticflickr.com/8611/16618079640_6f7dca336a_b.jpg)
@ -64,7 +62,7 @@
![](https://farm8.staticflickr.com/7598/16804355052_10c1a6c5bd_b.jpg)
为了验证,你可以比较在 Alpine 中显示的 "Gmail Sent" 信箱和在 Web 界面下的信箱:
要验证的话,你可以比较在 Alpine 中显示的 "Gmail Sent" 信箱和在 Web 界面下的信箱:
![](https://farm8.staticflickr.com/7602/16619323939_d2eab3e162_c.jpg)
@ -73,7 +71,7 @@
# The approximate number of seconds between checks for new mail
mail-check-interval=10
最后,我们需要配置一个 SMTP 服务器来通过 Alpine 发送邮件信息。回到先前解释过的 Alpine 的设置界面,然后按 'C' 来设定一个 Google 的 SMTP 服务器地址,你需要像下面这样编辑 `SMTP Server`(为了发送) 这一行内容:
最后,我们需要配置一个 SMTP 服务器来通过 Alpine 发送邮件。回到先前解释过的 Alpine 的设置界面,然后按 'C' 来设定一个 Google 的 SMTP 服务器地址,你需要像下面这样编辑 `SMTP Server`(用于发送邮件)这一行内容:
smtp.gmail.com:587/tls/user=yourgmailusername@gmail.com
@ -81,7 +79,7 @@
### 总结 ###
在这个帖子里,我们讨论了在终端环境中如何通过一个名为 Alpha 的轻量且强大的命令行邮件客户端来获取 Gmail。 Alpine 是一个发布在 Apache Software License 2.0 协议下的自由软件,该协议与 GPL 协议相兼容。 Alpine 引以自豪的是:它不仅对新手友好,同时还做到了让那些经验丰富的系统管理员认为它是强大的。我希望在你阅读完这篇文章后,你能意识到我最后一个论断是多么的正确。
在这个帖子里,我们讨论了在终端环境中如何通过一个名为 Alpine 的轻量且强大的命令行邮件客户端来访问 Gmail。 Alpine 是一个发布在 Apache Software License 2.0 协议下的自由软件,该协议与 GPL 协议相兼容。 Alpine 引以自豪的是:它不仅对新手友好,同时还做到了让那些经验丰富的系统管理员认为它是强大的。我希望在你阅读完这篇文章后,你能意识到我最后一个论断是多么的正确。
非常欢迎使用下面的输入框来留下你的评论或问题。我期待着你们的反馈!
@ -91,7 +89,7 @@ via: http://xmodulo.com/gmail-command-line-linux-alpine.html
作者:[Gabriel Cánepa][a]
译者:[FSSlc](https://github.com/FSSlc)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
@ -100,4 +98,4 @@ via: http://xmodulo.com/gmail-command-line-linux-alpine.html
[2]:http://xmodulo.com/manage-personal-expenses-command-line.html
[3]:http://xmodulo.com/access-facebook-command-line-linux.html
[4]:http://xmodulo.com/access-twitter-command-line-linux.html
[5]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html
[5]:https://linux.cn/article-2324-1.html

View File

@ -1,19 +1,19 @@
Square 2.0图标包更漂亮了
更漂亮的 Square 2.0图标包
================================================================================
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Square_Icon_Pack_Linux_3.jpeg)
优雅、现代的[Square图标主题][1]最近更新到了2.0版,这让它比以前更漂亮了。Square图标包与其他主要的桌面环境如**Unity、 GNOME、KDE、 MATE等等**兼容。这意味着你可以在所有的流行Linux发行版如Ubuntu、Fedora、Linux Mint、elementary OS等等中使用它。 这个图标包估计包含超过了15000个图标。
优雅、现代的[Square图标主题][1]最近更新到了2.0版它比以前更漂亮了。Square图标包与其他主要的桌面环境如**Unity、 GNOME、KDE、 MATE等等**兼容。这意味着你可以在所有的流行Linux发行版如Ubuntu、Fedora、Linux Mint、elementary OS等等中使用它。 这个图标包估计包含超过了15000个图标。
### 在Linux中安装Square 2.0图标包 ###
有两种不同的Square图标暗色和亮色。基于你的洗好,你可以选择二者之一。出于实验,我建议你两个主题包都下载。
有两种不同的Square图标暗色和亮色。基于你的喜好,你可以选择二者之一。出于体验的目的,我建议你两个主题包都下载。
你可以用下面的链接下载图标包。文件存储在Google Drive因此如果你没有看见像[SourceForge][2]这样标准的下载网站时怀疑。
你可以用下面的链接下载图标包。文件存储在Google Drive因此如果你没有看见像[SourceForge][2]这样标准的下载网站时不要怀疑。
- [Square Dark Icons][3]
- [Square Light Icons][4]
要使用图标主题,解压下载的文件到~/.icons文件夹下。如果它不存在就创建它。当你在正确的地方有这些文件后,基于你的桌面环境,使用一个工具来改变图标主题。我以前写了一些关于这个主题的教程。如果你需要额外的帮助,那么欢迎指出来:
要使用图标主题,解压下载的文件到~/.icons文件夹下。如果它不存在就创建它。当这些文件放好后,基于你的桌面环境,使用一个工具来改变图标主题。我以前写了一些关于这个主题的教程。如果你需要额外的帮助,那么欢迎指出来:
- [如何在Ubuntu Unity中改变主题][5]
- [如何在GNOME Shell中改变主题][6]
@ -30,8 +30,7 @@ Square主题中几个图标的样子
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Square_Icon_Pack_Linux.jpeg)
你怎么找到它的?你认为它是[Ubuntu 14.04中最佳的图标主题][10]之一么你会分享它病期待更多关于自定义Linux桌面的文章么
你觉得怎么样?你认为它是[Ubuntu 14.04中最佳的图标主题][10]之一么你会分享它并期待更多关于自定义Linux桌面的文章么
--------------------------------------------------------------------------------
@ -39,7 +38,7 @@ via: http://itsfoss.com/square-2-0-icon-pack-linux/
作者:[Abhishek][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,12 +1,13 @@
# Linux 下四种安全删除文件的工具 #
Linux 下四种安全删除文件的工具
===============
任何一个普通水平的计算机用户都知道,从计算机系统中删除的任意数据都可以稍通过一些努力恢复出来。当你不小心删除了你的重要数据,这是一个不错的方案。但是大多数情况,你不希望你的隐私数据被轻易地恢复。不论何时,我们删除任意文件,操作系统删除的仅仅是特定数据的索引。这就意味着,数据仍然保存在磁盘的某块地方,这种方法是不安全的,任何一个聪明的计算机黑客可以使用任意不错的数据恢复工具来恢复你删除的数据。Linux 用户利用我们都知晓的 "rm" 命令来从他们的操作系统中删除数据,但是 "rm" 命令在约定俗成的场景下工作。从这个命令删除的数据也可以使用特殊的文件恢复工具恢复。
任何一个普通水平的计算机用户都知道,从计算机系统中删除的任意数据都可以稍通过一些努力恢复出来。当你不小心删除了你的重要数据,这是一个不错的方案。但是大多数情况,你不希望你的隐私数据被轻易地恢复。不论何时,我们删除任意文件,操作系统删除的仅仅是特定数据的索引。这就意味着,数据仍然保存在磁盘的某块地方,这种方法是不安全的,任何一个聪明的计算机黑客可以使用各种不错的数据恢复工具来恢复你删除的数据。Linux 用户利用我们都知晓的 "rm" 命令来从他们的操作系统中删除数据,但是 "rm" 命令也是像上面说的那样删除文件。从这个命令删除的数据也可以使用特殊的文件恢复工具恢复。
让我们看看怎样安全并且完整地从你地 Linux 系统中删除文件或者文件夹。以下提到的工具可以完全地删除数据,因此那些恢复工具很难找到真实数据的痕迹然后恢复它。
让我们看看怎样安全并完整地从你的 Linux 系统中删除文件或者文件夹。以下提到的工具可以完全地删除数据,因此那些恢复工具很难找到真实数据的痕迹然后恢复它。
### Secure-Delete ###
Secure-Delete 是一组为 Linux 操作系统而生的工具集合,他们为永久删除文件提供高级的技术支持。一旦 Secure-Delete 安装在任意的 Linux 系统,它会提供如下的四个命令:
Secure-Delete 是一组为 Linux 操作系统而生的工具集合,他们为永久删除文件提供了先进的技术支持。一旦 Secure-Delete 安装在各种 Linux 系统上,就提供了如下的四个命令:
- srm
- smem
@ -45,13 +46,13 @@ Secure-Delete 是一组为 Linux 操作系统而生的工具集合,他们为
sudo sswap /dev/sda5
“**smem**” 用来清理在内存中的内容,它保证当系统重启或者关机时随机存取存储器RAM中的内容被清理但是残余的数据痕迹仍然保存在内存。这个命令提供安全的内存清理,简单地在终端中运行 smem 命令。
“**smem**” 用来清理在内存中的内容,虽然当系统重启或者关机时会清理随机存取存储器RAM中的内容但是内存中仍然会保留一些数据的残留痕迹。这个命令提供安全的内存清理,简单地在终端中运行 smem 命令即可
smem
### Shred ###
"shred" 命令销毁文件或者文件夹的内容,在某种程度上,不可能恢复。它使用随机生成的数据模式来持续重写文件因此很难恢复任意的被销毁的数据即使是那些黑客或者窃贼使用高水平的数据恢复工具或者设备。Shred 在 Linux 发行版中时默认安装的,如果你想,你可以运行如下命令来找到它的安装目录:
"shred" 命令以一种不可恢复的方式来销毁文件或者文件夹的内容。它使用随机生成的数据模式来持续覆写文件因此很难恢复任意的被销毁的数据即使是那些黑客或者窃贼使用高水平的数据恢复工具或者设备。Shred 默认安装所有 Linux 发行版中,如果你想,你可以运行如下命令来找到它的安装目录:
aun@eagle:~$ whereis shred
@ -75,17 +76,17 @@ Shred 默认情况下使用随机内容重写数据 25 次。如果你想它重
### dd ###
这个命令起初是用于磁盘克隆的。它用于一个分区或者一个磁盘复制到另一个分区或者磁盘。但是它还用于安全地清除硬盘或者分区的内容。运行如下命令使用随机数据来重写你的当前数据。你不需要安装 dd 命令,所有的 Linux 分发版都已经包含了此命令。
这个命令起初是用于磁盘克隆的。它用于一个分区或者一个磁盘复制到另一个分区或者磁盘。但是它还用于安全地清除硬盘或者分区的内容。运行如下命令使用随机数据来重写你的当前数据。你不需要安装 dd 命令,所有的 Linux 分发版都已经包含了此命令。
sudo dd if=/dev/random of=/dev/sda
你也可以写磁盘或者分区中的内容,只需要简单地将所有替换为 “zero”。
你也可以写磁盘或者分区中的内容,只需要简单地将所有替换为 “zero”。
sudo dd if=/dev/zero of=/dev/sda
### Wipe ###
Wipe 起初开发的目的是从磁媒体中安全地擦除文件。这个命令行工具使用特殊的模式来重复地写文件。它使用 fsync() 调用和或 O_SYNC 位来强制访问磁盘,并且使用 Gutmann 算法来重复地写。你可以使用此命令删除单个文件文件夹或者整个磁盘的内容,但是使用 wipe 命令来删除整个磁盘的模式会耗费大量的时间。另外,安装和使用这个工具相当容易。
Wipe 起初开发的目的是从磁性介质中安全地擦除文件。这个命令行工具使用特殊的模式来重复地写文件。它使用 fsync() 调用和/或 O_SYNC 位来强制访问磁盘,并且使用 Gutmann 算法来重复地写。你可以使用此命令删除单个文件文件夹或者整个磁盘的内容,但是使用 wipe 命令来删除整个磁盘的模式会耗费大量的时间。另外,安装和使用这个工具相当容易。
在 ubuntu 的终端中运行如下命令来安装 wipe。
@ -123,7 +124,7 @@ via: http://linoxide.com/security/delete-files-permanatly-linux/
作者:[Aun Raza][a]
译者:[dbarobin](https://github.com/dbarobin)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -0,0 +1,163 @@
Linux用户应知应会的7个ls命令的独特技巧
================================================================================
在前面我们系列报道的两篇文章中我们已经涵盖了关于ls命令的绝大多数内容。本文时ls命令系列的最后一部分。如果你还没有读过该系列的其它两篇文章你可以访问下面的链接。
- [Linux中的15个基本ls命令示例][1]
- [15 个ls命令的面试问题][2]
- [10 个ls命令面试的问题][3]
![7 Quirky ls Command Tricks](http://www.tecmint.com/wp-content/uploads/2015/03/ls-command-tricks.jpg)
*7个ls命令独特技巧*
### 1. 以各种时间格式附带时间戳列出目录中的内容 ###
要以时间格式列出目录内容,我们需要选择以下两种方法中的任何一种。
# ls -l time-style=[STYLE] (方法 A)
**注意** - 上面的开关`--time`的格式必须和`-l`开关同时使用,否则达不到目的。
# ls -full-time (方法 B)
可以用以下任何一个选项替换`[STYLE]`。
full-iso
long-iso
iso
locale
+%H:%M:%S:%D
**注意** - 在上面行中HMSD的顺序可以任意调整。此外你只需选择那些相关的选项而不是所有选项。例如`ls -l --time-style=+%H`将只显示小时。`ls -l --time-style=+%H:%M:%D`将显示小时、分钟和日。
# ls -l --time-style=full-iso
![ls Command Full Time Style](http://www.tecmint.com/wp-content/uploads/2015/03/ls-Command-Full-Time-Style.gif)
*ls命令的完整 ISO时间格式*
# ls -l --time-style=long-iso
![Long Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Long-Time-Listing-Format.gif)
*长时间格式列表*
# ls -l --time-style=iso
![Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Local-Time-Style-Listing.gif)
*时间格式列表*
# ls -l --time-style=locale
![Locale Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Hour-Mintue-Time-Style-Listing.gif)
*本地时间格式列表*
# ls -l --time-style=+%H:%M:%S:%D
![Date and Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Full-Time-Style-Listing.gif)
*日期和时间格式列表*
# ls --full-time
![Full Style Time Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Full-Style-Time-Listing.gif)
*完整格式时间列表*
### 2. 以多种格式列出目录内容,如以逗号分隔、水平格式、长格式、垂直格式、交叉格式等列出。 ###
目录内容可以用以下建议的ls命令各种格式列出
# ls --format=across # 交叉
# ls --format=comma # 逗号
# ls --format=horizontal # 水平
# ls --format=long # 长格式
# ls --format=single-column # 单栏
# ls --format=verbose # 详情
# ls --format=vertical # 垂直
![Listing Formats of ls Command](http://www.tecmint.com/wp-content/uploads/2015/03/ls-command-Listing-Formats.gif)
*ls命令的列出格式*
### 3. 使用ls命令为目录内容输出结果添加像/=@|)这样的指示符。 ###
带有`-p`选项的ls命令将实现该目的。它会根据文件类型添加上面这些指示符其中之一。
# ls -p
![Append Indicators to Content](http://www.tecmint.com/wp-content/uploads/2015/03/Append-Indicators.gif)
*添加指示符到内容*
### 4. 根据扩展名、大小、时间和版本对目录内容排序。 ###
我们可以使用`--extension`选项来按照扩展名对输出结果排序,`--size`扩展选项按照大小排序,`-t`扩展选项按照时间排序,`-v`扩展选项对版本排序。
我们也可以使用`--none`选项,它会以常规方式输出结果而不会进行排序。
# ls --sort=extension
# ls --sort=size
# ls --sort=time
# ls --sort=version
# ls --sort=none
![Sort Listing of Content by Options](http://www.tecmint.com/wp-content/uploads/2015/03/Sort-Content-by-Extensions.gif)
*通过选项对内容排序列出*
### 5. 使用ls命令打印目录中各个项的数字UID和GID。 ###
上面的环境可以通过使用带有-n标识的ls命令来实现。
# ls -n
![Print Listing of Content by UID and GID](http://www.tecmint.com/wp-content/uploads/2015/03/Print-UID-GID-of-Contents.gif)
*通过UID和GID对打印内容列表*
### 6. 标准输出结果中打印目录内容中比默认指定的更多栏目。 ###
好吧ls命令根据屏幕大小自动输出目录内容。
然而,我们可以手动分配屏幕宽度的值和出现的栏目的控制数。这可以通过使用‘`--width`’开关实现。
# ls --width 80
# ls --width 100
# ls --width 150
![List Content Based on Window Sizes](http://www.tecmint.com/wp-content/uploads/2015/03/List-Content-By-More-Column.gif)
*根据窗口大小列出内容*
**注意** 你可以试验你可以给width标识传递什么值。
### 7. 通过ls命令为列出的目录内容手动指定的制表符大小而不是默认的8。 ###
# ls --tabsize=[value]
![List Content by Table Size](http://www.tecmint.com/wp-content/uploads/2015/03/List-Content-by-Table-Size.gif)
*按表尺寸列出内容*
**注意** 指定`[Value]`的数值。
到目前为止,都讲完了。保持连线,我们会推出下一篇文章。别忘了在下面的评论中为我们提供有价值的反馈。为我们点赞并分享,帮我们推广。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/linux-ls-command-tricks/
作者:[Avishek Kumar][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/avishek/
[1]:https://linux.cn/article-5109-1.html
[2]:https://linux.cn/article-5349-1.html
[3]:https://linux.cn/article-5350-1.html

View File

@ -0,0 +1,100 @@
如何交互式地创建一个Docker容器
===============================================================================
大家好今天我们来学习如何使用一个docker镜像交互式地创建一个Docker容器。当我们从镜像中启动一个Docker进程Docker就会获取该镜像及其父镜像并重复这个过程直到到达基础镜像。然后联合文件系统UFS会在其顶层添加一个读写层。读写层被称之为容器它包含了一些关于父镜像信息及一些其他的信息如唯一ID网络配置和资源限制等。容器是有状态的其状态可以从 **运行态** 切换到 **退出态**。一个处于 **运行态**的容器包含了在CPU上面运行的进程树于其它在该主机上运行的进程相隔离而**退出态**是指文件系统的状态,并保留了其退出值。你可以使用它来启动,停止和重启一个容器。
Docker技术为IT界带来了巨大的改变它使得云服务可以用来共享应用和工作流程自动化使得应用可以用组件快速组合消除了开发、品质保证、产品环境间的摩擦。在这篇文章中我们将会建立CentOS环境然后用Apache网络服务器提供一个网站服务。
这是一个快速且容易的教程讨论我们怎样使用交互的shell以交互的方式来创建一个容器。
### 1. 运行一个Docker实例 ###
Docker首先会尝试从本地取得并运行所需的镜像如果在本地主机上没有发现它就会从[Docker公共注册中心][1]拉取。这里,我们将会拉取镜像并在 Docker 容器中创建一个fedora实例并连接到它的 tty 上的bash shell。
# docker run -i -t fedora bash
![Downloading Fedora Base Image](http://blog.linoxide.com/wp-content/uploads/2015/03/downloading-fedora-base-image.png)
### 2.安装Apache网络服务器 ###
现在在我们的Fedora基本镜像实例准备好后我们将会开始交互式地安装Apache网络服务器而不是为它创建Dockerfile。为了做到这点我们需要在终端或者shell运行以下命令。
# yum update
![Installing httpd](http://blog.linoxide.com/wp-content/uploads/2015/03/installing-httpd2.png)
# yum install httpd
![Installing httpd](http://blog.linoxide.com/wp-content/uploads/2015/03/installing-httpd2.png)
# exit
### 3.保存镜像 ###
现在我们要去保存在Fedora实例里做的修改。要做到这个我们首先需要知道实例的容器ID。而为了得到ID我们又需要运行以下命令LCTT 译注:在容器外执行该命令)。
# docker ps -a
![Docker Running Container](http://blog.linoxide.com/wp-content/uploads/2015/03/docker-running-container.png)
然后,我们会保存这些改变为一个新的镜像,请运行以下命令。
# docker commit c16378f943fe fedora-httpd
![committing fedora httpd](http://blog.linoxide.com/wp-content/uploads/2015/03/committing-fedora-httpd.png)
这里修改已经通过使用容器ID保存起来了镜像名字叫fedora-httpd。为了确认新的镜像是否在运行我们将运行以下命令。
# docker images
![view docker images](http://blog.linoxide.com/wp-content/uploads/2015/03/view-docker-images.png)
### 4. 添加内容到新的镜像 ###
我们自己新的Fedora Apache镜像正成功的运行现在我们想添加一些我们网站的网页内容到Apache网络服务器使得网站能够开箱即用。为做到这点我们需要创建一个新的Dockerfile它会处理从复制网页内容到启用80端口的所有操作。要达到这样的目的我们需要使用我们最喜欢的文本编辑器创建Dockerfile文件像下面演示的一样。
# nano Dockerfile
现在,我们需要添加以下的命令行到文件中。
FROM fedora-httpd
ADD mysite.tar /tmp/
RUN mv /tmp/mysite/* /var/www/html
EXPOSE 80
ENTRYPOINT [ "/usr/sbin/httpd" ]
CMD [ "-D", "FOREGROUND" ]
![configuring Dockerfile](http://blog.linoxide.com/wp-content/uploads/2015/03/configuring-Dockerfile.png)
这里上述的Dockerfile中放在mysite.tar里的网页内容会自动解压到/tmp/文件夹里。然后整个站点会被移动到Apache的网页根目录/var/www/html/命令expose 80会打开80端口这样网站就能正常访问了。其次入口点放在了/usr/sbin/https里面保证Apache服务器能够执行。
### 5. 构建并运行一个容器 ###
现在我们要用刚刚创建的Dockerfile创建我们的容器以便将我们的网站添加到上面。为做到这我们需要运行以下命令。
# docker build -rm -t mysite .
![Building mysite Image](http://blog.linoxide.com/wp-content/uploads/2015/03/building-mysite-image.png)
建立好我们的新容器后,我们需要要用下面的命令来运行容器。
# docker run -d -P mysite
![Running mysite Container](http://blog.linoxide.com/wp-content/uploads/2015/03/running-mysite-container.png)
### 总结 ###
最后我们已经成功的以交互式的方式建立了一个Docker容器。在本节方法中我们是直接通过交互的shell命令建立我们的容器和镜像。在建立与配置镜像与容器时这种方法十分简单且快速。如果你有任何问题建议和反馈请在下方的评论框里写下来以便我们可以提升或者更新我们的文章。谢谢祝生活快乐 :-)
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-how-to/interactively-create-docker-container/
作者:[Arun Pyasi][a]
译者:[wi-cuckoo](https://github.com/wi-cuckoo)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/arunp/
[1]:https://registry.hub.docker.com/

View File

@ -1,10 +1,10 @@
使用 SSH 和一次性密码安全登录 Linux
使用一次性密码本通过 SSH 安全登录 Linux
================================================================================
有人说安全不是一个产品而是一个过程LCTT 注:安全公司 McAfee 认为,安全风险管理是一个方法论,而不是安全产品的堆叠)。虽然 SSH 协议被设计成使用加密技术来确保安全,但如果使用不当,别人还是能够破坏你的系统:比如弱密码、密钥泄露、使用的 SSH 客户端过时等,都能引发安全问题。
有人说安全不是一个产品而是一个过程LCTT 注:安全公司 McAfee 认为,安全风险管理是一个方法论,而不是安全产品的堆叠)。虽然 SSH 协议被设计成使用加密技术来确保安全,但如果使用不当,别人还是能够破坏你的系统:比如弱密码、密钥泄露、使用过时的 SSH 客户端等,都能引发安全问题。
在考虑 SSH 认证方案时,大家普遍认为[公钥认证][1]比密码认证更安全。然而,公钥认证技术并不是为公共环境设置的,如果你在一台公用电脑上使用公钥认证登录 SSH 服务器,你的服务器已经毫无安全可言了,公用的电脑可能会记录你的公钥,或从你的内存中读取公钥。如果你不信任本地电脑,那你最好还是使用其他方式登录服务器。现在就是“一次性密码”派上用场的时候了,就像名字所示,一次性密码只能被使用一次。这种一次性密码非常合适在不安全的环境下发挥作用,就算它被窃取,也无法再次使用。
在考虑 SSH 认证方案时,大家普遍认为[公钥认证][1]比密码认证更安全。然而,公钥认证技术并不是为公共环境设置的,如果你在一台公用电脑上使用公钥认证登录 SSH 服务器,你的服务器已经毫无安全可言了,公用的电脑可能会记录你的公钥,或从你的内存中读取公钥。如果你不信任本地电脑,那你最好还是使用其他方式登录服务器。现在就是“一次性密码OTP”派上用场的时候了,就像名字所示,一次性密码只能被使用一次。这种一次性密码非常合适在不安全的环境下发挥作用,就算它被窃取,也无法再次使用。
有个一次性密码方案叫[谷歌认证][2],但在本文中,我要介绍的是另一种 SSH 登录方案:[OTPW][3]它是个一次性密码登录的软件包。不像谷歌认证OTPW 不需要依赖任何第三方库。
有个生成一次性密码的方法是通过[谷歌认证器][2],但在本文中,我要介绍的是另一种 SSH 登录方案:[OTPW][3]它是个一次性密码登录的软件包。不像谷歌认证OTPW 不需要依赖任何第三方库。
### OTPW 是什么 ###
@ -39,7 +39,7 @@ OTPW 由一次性密码生成器和 PAM 认证规则组成。在 OTPW 中一次
$ git clone https://www.cl.cam.ac.uk/~mgk25/git/otpw
$ cd otpw
打开 Makefile 文件编辑以“PAMLIB”开头的那行配置:
打开 Makefile 文件编辑以“PAMLIB=”开头的那行配置:
64 位系统:
@ -49,12 +49,12 @@ OTPW 由一次性密码生成器和 PAM 认证规则组成。在 OTPW 中一次
PAMLIB=/usr/lib/security
编译安装。需要注意的是安装过程会把 SSH 服务重启一下,所以如果你是使用 SSH 连接到服务器,做好被断开连接的准备吧。
编译安装。需要注意的是安装过程会自动重启 SSH 服务一下,所以如果你是使用 SSH 连接到服务器,做好被断开连接的准备吧LCTT 译注:也许不会被断开连接,即便被断开连接,请使用原来的方式重新连接即可,现在还没有换成一次性口令方式。)
$ make
$ sudo make install
现在你需要更新 SELinux 策略,因为 /usr/sbin/sshd 会往你的 home 目录写数据,而 SELinux 默认是不允许这么做的。如果你使用了 SELinux 服务LCTT 注:使用 getenforce 命令查看结果,如果是 enforcing就是打开了 SELinux 服务),如果没有使用 SELinux 服务,请跳过这一步。
现在你需要更新 SELinux 策略,因为 /usr/sbin/sshd 会往你的 home 目录写数据,而 SELinux 默认是不允许这么做的。如果没有使用 SELinux 服务LCTT 注:使用 getenforce 命令查看结果,如果是 enforcing就是打开了 SELinux 服务),请跳过这一步。
$ sudo grep sshd /var/log/audit/audit.log | audit2allow -M mypol
$ sudo semodule -i mypol.pp
@ -90,6 +90,8 @@ Debian, Ubuntu 或 Linux Mint 发行版:
Fedora 或 CentOS/RHEL 7 发行版:
$ sudo systemctl restart sshd
LCTT 译注:虽然这里重启了 sshd 服务,但是你当前的 ssh 连接应该不受影响,只是在你完成下述步骤之前,无法按照原有方式建立新的连接了。因此,保险起见,要么多开一个 ssh 连接,避免误退出当前连接;要么将重启 sshd 服务器步骤放到步骤3完成之后。
#### 步骤3使用 OTPW 产生一次性密码 ####
@ -102,7 +104,7 @@ Fedora 或 CentOS/RHEL 7 发行版:
这个命令会让你输入密码前缀,当你以后登录的时候,你需要同时输入这个前缀以及一次性密码。密码前缀是另外一层保护,就算你的一次性密码表被泄漏,别人也无法通过暴力破解你的 SSH 密码。
设置好密码前缀后,这个命令会产生 280 个一次性密码,并将它们保存在一个文本文件中(如 temporary_password.txt。每个密码默认是 8 个字符)由一个 3 位十进制数索引。你需要将这个密码表打印出来,并随身携带。
设置好密码前缀后,这个命令会产生 280 个一次性密码LCTT 译注:保存到 ~/.otpw 下),并将它们导出到一个文本文件中(如 temporary_password.txt。每个密码默认是 8 个字符)由一个 3 位十进制数索引。你需要将这个密码表打印出来,并随身携带。
![](https://farm8.staticflickr.com/7281/16962594055_c2696d5ae1_b.jpg)
@ -160,7 +162,7 @@ Fedora 或 CentOS/RHEL 7 发行版:
### 总结 ###
在这个教程中,我介绍了如何使用 OTPW 工具来设置一次性登录密码。你也许意识到了在这种两个因子的认证方式中,打印一张密码表让人感觉好 low但是这种方式是最简单的并且不用依赖任何第三方软件。无论你用哪种方式创建一次性密码在你需要在一个不信任的环境登录 SSH 服务器的时候,它们都很有用。你可以就这个主题来分享你的经验和观点。
在这个教程中,我介绍了如何使用 OTPW 工具来设置一次性登录密码。你也许意识到了在这种因子的认证方式中,打印一张密码表让人感觉好 low但是这种方式是最简单的并且不用依赖任何第三方软件。无论你用哪种方式创建一次性密码在你需要在一个不信任的环境登录 SSH 服务器的时候,它们都很有用。你可以就这个主题来分享你的经验和观点。
--------------------------------------------------------------------------------
@ -168,11 +170,11 @@ via: http://xmodulo.com/secure-ssh-login-one-time-passwords-linux.html
作者:[Dan Nanni][a]
译者:[bazz2](https://github.com/bazz2)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://xmodulo.com/author/nanni
[1]:http://xmodulo.com/how-to-force-ssh-login-via-public-key-authentication.html
[2]:http://xmodulo.com/two-factor-authentication-ssh-login-linux.html
[1]:https://linux.cn/article-5444-1.html
[2]:https://linux.cn/article-2642-1.html
[3]:http://www.cl.cam.ac.uk/~mgk25/otpw.html

View File

@ -1,8 +1,8 @@
Linux有问必答-- 如何在Ubuntu中升级Docker
Linux有问必答如何在Ubuntu中升级Docker
================================================================================
> **提问**: 我使用了Ubuntu的标准仓库安装了Docker。然而默认安装的Docker不能满足我另外一个依赖Docker程序的版本需要。我该如何在Ubuntu中升级到Docker的最新版本
Docker第一次在2013年发布它快速地演变成了一个针对分布式程序的开发平台。为了满足工业期望Docker正在紧密地开发并持续地带来新特性的升级。这样Ubuntu发行版中的Docker版本可能很快就会过时。比如, Ubuntu 14.10 Utopic 中的Docker版本是1.2.0 然而最新的Docker版本是1.5.0。
Docker第一次在2013年发布它快速地演变成了一个针对分布式程序的开发平台。为了满足工业期望Docker正在紧密地开发并持续地带来新特性的升级。这样Ubuntu发行版中的Docker版本可能很快就会过时。比如 Ubuntu 14.10 Utopic 中的Docker版本是1.2.0 然而最新的Docker版本是1.6.0。
![](https://farm9.staticflickr.com/8730/16351300024_9acb9086da_b.jpg)
@ -28,7 +28,7 @@ via: http://ask.xmodulo.com/upgrade-docker-ubuntu.html
作者:[Dan Nanni][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,11 +1,11 @@
Conky - 终极的 X 视窗系统监视器应用
================================================================================
Conky 是一个用 C 语言写就的系统监视器,并在 GNU 通用公共许可协议和 BSD 许可协议下发布,在 Linux 和 BSD 操作系统中都可以获取到它。这个应用是基于 X 视窗系统的,原本 fork 至 [Torsmo][1]
Conky 是一个用 C 语言写就的系统监视器,并在 GNU GPL 和 BSD 许可协议下发布,在 Linux 和 BSD 操作系统中都可以获取到它。这个应用是基于 X 视窗系统的,原本由 [Torsmo][1] 分支而来
#### 特点 ####
- 简洁的用户界面;
- 高配置;
- 高度可配置;
- 它既可使用内置的部件(超过 300 多个) 也可使用外部脚本,来在桌面或其自有容器中展示系统的状态;
- 低资源消耗;
- 它可显示范围广泛的系统参数,包括但不限于 CPU内存swap 分区 ,温度,进程,磁盘使用情况,网络状态,电池电量,邮件收发,系统消息,音乐播放器的控制,天气信息,最新新闻,升级信息等等;
@ -15,7 +15,7 @@ Conky 是一个用 C 语言写就的系统监视器,并在 GNU 通用公
- conky 这个名称来自于一个加拿大电视节目;
- 它已被移植到 Nokia N900 上;
- 它已不再被官方维护
- 官方已经不再维护它了
### 在 Linux 中 Conky 的安装和使用 ###
@ -57,7 +57,8 @@ Conky 既可以从软件仓库中安装,也可从源代码编译得到:
$ conky &
![正在运行的 Conky 监视器](http://www.tecmint.com/wp-content/uploads/2015/03/Start-Conkey.jpeg)
正在运行的 Conky 监视器
*正在运行的 Conky 监视器*
这使得 conky 以一个弹窗的形式运行,并使用位于 `/etc/conky/conky.conf` 的 conky 基本配置文件。
@ -72,29 +73,31 @@ Conky 既可以从软件仓库中安装,也可从源代码编译得到:
$ killall -SIGUSR1 conky
![Conky 监视器窗口](http://www.tecmint.com/wp-content/uploads/2015/03/Restart-Conky.jpeg)
Conky 监视器窗口
你可能想编辑位于你家目录的 conky 的配置文件,这个配置文件的内容是非常容易理解的。
*Conky 监视器窗口*
你可能想编辑位于你的家目录的 conky 的配置文件,这个配置文件的内容是非常容易理解的。
下面是 conky 配置文件的一个样例:
![Conky 的配置](http://www.tecmint.com/wp-content/uploads/2015/03/Conky-Configuration.jpeg)
Conky 的配置
从上面的窗口中,你可以更改颜色,边框,大小,缩放比例,背景,对齐方式及几个其他属性。通过为不同的 conky 窗口设定不同的对齐方式,我们可以同时运行超过一个 conky 脚本。
*Conky 的配置*
从上面的窗口中,你可以更改颜色,边框,大小,缩放比例,背景,对齐方式及几个其他属性。通过为不同的 conky 窗口设定不同的对齐方式,我们可以同时运行几个 conky 脚本。
**为 conky 使用脚本而不是默认配置以及如何找到这些脚本?**
**让 conky 使用其它脚本而不是默认配置,以及如何找到这些脚本?**
你可以编写你自己的 conky 脚本或使用来自于互联网的脚本;我们并不建议你使用从互联网中找到的具有潜在危险的任何脚本,除非你清楚你正在做什么。然而,有一些著名的主题和网页包含可信赖的 conky 脚本,例如下面所提及的:
你可以编写你自己的 conky 脚本或使用来自于互联网的脚本;我们并不建议你使用从互联网中找到的具有潜在危险的任何脚本,除非你清楚你正在做什么。然而,有一些著名的主题和网页包含可信赖的 conky 脚本,例如下面所提及的:
- [http://ubuntuforums.org/showthread.php?t=281865][3]
- [http://conky.sourceforge.net/screenshots.html][4]
在上面的 URL 地址中,你将发现每个截图都有一个超链接,它们将重定向到脚本文件。
在上面的 URL 地址中,你将发现其中每个截图都有一个超链接,它们将指向到脚本文件。
#### 测试 Conky 脚本 ####
这里我将在我的 Debian Jessie 机子中运行一个由第三方写的 conky 脚本,以此来进行测试:
这里我将在我的 Debian Jessie 系统中运行一个由第三方写的 conky 脚本,以此来进行测试:
$ wget https://github.com/alexbel/conky/archive/master.zip
$ unzip master.zip
@ -107,39 +110,41 @@ Conky 的配置
$ mv secrets.yml.example secrets.yml
在你能够运行这个(ruby)脚本之前安装 Ruby
在你需要运行这个(ruby)脚本之前安装 Ruby
$ sudo apt-get install ruby
$ ruby starter.rb
![华丽的 conky 外观](http://www.tecmint.com/wp-content/uploads/2015/03/Conky-Fancy-Look.jpeg)
华丽的 conky 外观
**注**: 这个脚本可以被修改以展示你当前的天气,温度等;
*华丽的 conky 外观*
**注**: 可以修改这个脚本以展示你当前的天气,温度等;
假如你想让 conky 开机自启,请在开机启动应用设置(startup Applications) 中添加如下的几行命令:
conky --pause 10
save and exit.
最后。。。 如此轻量级且吸引眼球的实用 GUI 软件包不再处于活状态且官方不再进行维护了。最新的稳定发布版本为 conky 1.9.0 于 2012 年 5 月 3 号发布。在 Ubuntu 论坛上,一个有关用户分享 conky 配置的主题已经超过了 2000 多页。(这个论坛主题的链接为: [http://ubuntuforums.org/showthread.php?t=281865/][5])
最后如此轻量级且吸引眼球的实用 GUI 软件包不再处于活状态且官方不再进行维护了。最新的稳定发布版本为 conky 1.9.0 于 2012 年 5 月 3 号发布。在 Ubuntu 论坛上,一个有关用户分享 conky 配置的主题已经超过了 2000 多页。(这个论坛主题的链接为: [http://ubuntuforums.org/showthread.php?t=281865/][5])
- [Conky 主页][6]
这就是全部内容了。保持联系,保持评论。请在下面的评论框里分享你的想法和配置。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/install-conky-in-ubuntu-debian-fedora/
作者:[Avishek Kumar][a]
译者:[FSSlc](https://github.com/FSSlc)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/avishek/
[1]:http://torsmo.sourceforge.net/
[2]:http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/
[2]:https://linux.cn/article-2324-1.html
[3]:http://ubuntuforums.org/showthread.php?t=281865
[4]:http://conky.sourceforge.net/screenshots.html
[5]:http://ubuntuforums.org/showthread.php?t=281865/

View File

@ -2,42 +2,45 @@
================================================================================
我们一直积极地提供有关 Linux 技巧的系列文章,如果你错过了这个系列的最新文章,你或许可以去访问下面的链接。
注:此篇文章做过原文
- [Linux 中 5 个有趣的命令行技巧][1] (注:这篇文章还没有被翻译,在 20150316 选的题)
- [Linux 中 5 个有趣的命令行技巧][1]
在这篇文章中,我们将分享一些有趣 Linux 技巧,内容是有关如何产生随机密码以及加密或解密这些经过加盐或没有加盐处理的密码。
安全是数字时代中的一个主要话题。在电脑email云端手机文档和其他的场合中我们都会使用到密码。众所周知选择密码的基本原则是 “易记难猜”。考虑过使用基于机器自动生成的密码吗相信我Linux 非常擅长这方面的工作。
**1. 使用命令 `pwgen` 来生成一个长度为 10 个字符的唯一的随机密码。假如你还没有安装 pwgen请使用 Apt 或 YUM 等包管理器来安装它。**
**1. 使用命令 `pwgen` 来生成一个长度为 10 个字符的独特的随机密码。假如你还没有安装 pwgen请使用 Apt 或 YUM 等包管理器来安装它。**
$ pwgen 10 1
![生成一个唯一的随机密码](http://www.tecmint.com/wp-content/uploads/2015/03/Generate-Random-Unique-Password-in-Linux.gif)
生成一个唯一的随机密码
![生成一个独特的随机密码](http://www.tecmint.com/wp-content/uploads/2015/03/Generate-Random-Unique-Password-in-Linux.gif)
*生成一个独特的随机密码*
一口气生成若干组长度为 50 个字符的唯一的随机密码!
$ pwgen 50
![生成多组随机密码](http://www.tecmint.com/wp-content/uploads/2015/03/Generate-Multiple-Random-Passwords.gif)
生成多组随机密码
**2. 你还可以使用 `makepasswd` 来每次生成一个给定长度的唯一的随机密码。在你把玩 makepasswd 命令之前,请确保你已经安装了它。如若没有安装它,试试使用 Apt 或 YUM 包管理器来安装 `makepasswd`这个软件包。**
*生成多组随机密码*
**2. 你还可以使用 `makepasswd` 来每次生成一个给定长度的独特的随机密码。在你把玩 makepasswd 命令之前,请确保你已经安装了它。如若没有安装它,试试使用 Apt 或 YUM 包管理器来安装 `makepasswd`这个软件包。**
生成一个长度为 10 个字符的随机密码。该命令产生的密码的长度默认为 10。
$ makepasswd
![使用 makepasswd 生成唯一的密码](http://www.tecmint.com/wp-content/uploads/2015/03/mkpasswd-generate-unique-password.gif)
使用 makepasswd 生成唯一的密码
![使用 makepasswd 生成独特的密码](http://www.tecmint.com/wp-content/uploads/2015/03/mkpasswd-generate-unique-password.gif)
*使用 makepasswd 生成独特的密码*
生成一个长度为 50 个字符的随机密码。
$ makepasswd --char 50
![生成长度为 50 的密码](http://www.tecmint.com/wp-content/uploads/2015/03/Random-Password-Generate.gif)
生成长度为 50 的密码
*生成长度为 50 的密码*
生成 7 个长度为 20 个字符的随机密码。
@ -47,9 +50,7 @@
**3. 使用带“盐”的 Crypt(注:这里应该指的是一个函数,可以参考[这里](http://man7.org/linux/man-pages/man3/crypt.3.html) ) 来加密一个密码。提供手动或自动添加 “盐”。**
对于那些不清楚 **盐** 的意义的人,
这里的 “盐” 指的是一个随机数据,它作为密码生成函数的一个额外的输入, 目的是保护密码免受词典攻击。
对于那些不清楚 **盐** 的意义的人,这里的 “盐” 指的是一个随机数据,它作为密码生成函数的一个额外的输入, 目的是保护密码免受词典攻击。
在执行下面的操作前,请确保你已经安装了 `mkpasswd`
@ -58,46 +59,51 @@
$ mkpasswd tecmint
![使用 Crypt 来加密密码](http://www.tecmint.com/wp-content/uploads/2015/03/Encrypt-Password-in-Linux.gif)
使用 Crypt 来加密密码
*使用 Crypt 来加密密码*
现在让我们来手动定义 “盐” 的值。每次它将产生相同的结果。请注意你可以输入任何你想输入的值来作为 “盐” 的值。
$ mkpasswd tecmint -s tt
![带“盐”加密密码](http://www.tecmint.com/wp-content/uploads/2015/03/Encrypt-Password-Using-Salt.gif)
带“盐”加密密码
*带“盐”加密密码*
另外, mkpasswd 还是交互式的,假如你在命令中没有提供密码,它将主动询问你来输入密码。
**4. 使用 aes-256-cbc 加密算法并使用密码(如 “tecmint”) 并带“盐” 加密一个字符串(如 “Tecmint-is-a-Linux-Community”)。**
**4. 使用 aes-256-cbc 加密算法并使用带“盐”的密码(如 “tecmint”) 加密一个字符串(如 “Tecmint-is-a-Linux-Community”)。**
# echo Tecmint-is-a-Linux-Community | openssl enc -aes-256-cbc -a -salt -pass pass:tecmint
![在 Linux 中加密一个字符串](http://www.tecmint.com/wp-content/uploads/2015/03/Encrypt-A-String-in-Linux.gif)
在 Linux 中加密一个字符串
在上面例子中, [echo 命令][2](注:此篇原文也做过,这里是链接 http://linux.cn/article-3948-1.html) 的输出通过管道传递给了 openssl 命令,使得该输出被 Cipher(enc) 所加密,这个过程中使用了 aes-256-cbc 加密算法,并附带了密码 (tecmint) 和 “盐” 。
*在 Linux 中加密一个字符串*
在上面例子中, [echo 命令][2]的输出通过管道传递给了 openssl 命令,使得该输出通过加密编码方式(encEncoding with Cipher ) 所加密,这个过程中使用了 aes-256-cbc 加密算法,并附带了密码 (tecmint) 和 “盐” 。
**5. 使用 openssl 命令的 -aes-256-cbc 解密选项来解密上面的字符串。**
# echo U2FsdGVkX18Zgoc+dfAdpIK58JbcEYFdJBPMINU91DKPeVVrU2k9oXWsgpvpdO/Z | openssl enc -aes-256-cbc -a -d -salt -pass pass:tecmint
![在 Linux 中解密字符串](http://www.tecmint.com/wp-content/uploads/2015/03/Decrypt-String-in-Linux.gif)
在 Linux 中解密字符串
现在就是这些内容了。假如你知道任何这类的技巧,请将你的技巧发送到 admin@tecmint.com 邮箱中,你的技巧将会以你的名义来发表,同时我们也将在我们将来的文章中把它包含进去。
*在 Linux 中解密字符串*
现在就是这些内容了。
保持联系,保持连接,敬请关注。不要忘了在下面的评论中提供给我们您有价值的反馈。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/generate-encrypt-decrypt-random-passwords-in-linux/
作者:[Avishek Kumar][a]
译者:[FSSlc](https://github.com/FSSlc)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/avishek/
[1]:http://www.tecmint.com/5-linux-command-line-tricks/
[2]:http://www.tecmint.com/echo-command-in-linux/
[1]:https://linux.cn/article-5485-1.html
[2]:http://linux.cn/article-3948-1.html

View File

@ -1,29 +1,30 @@
现在值得去尝试一下在CentOS 7.x或Fedora 21上面安装PHP 7.0
在CentOS 7.x / Fedora 21 上面体验 PHP 7.0
===============================================================================
PHP是一种为我们熟知的通用的服务器网页脚本语言。超大量的在线网站都是用PHP编写的。PHP过去一直在更新丰富功能易于使用而且很好组织的脚本语言。目前PHP的开发团队正筹备下一个PHP版本的发行名字是PHP 7。现在的PHP版本为PHP 5.6可能你清楚PHP 6已经流产了PHP 7的支持者们不希望下一个重要的版本被其他分支混淆即过去已经停止很久的PHP 6。所以决定下一个PHP主要的发行版本叫PHP 7而不是PHP 6。PHP 7.0预计在今年十一月份发行。
在下一个主要的PHP发行版里有一些不错的功能
PHP是一种为我们熟知的通用服务器网页脚本语言。非常多的在线网站都是用PHP编写的。PHP这些年来一直在持续进化丰富其功能变得易于使用更好地组织的脚本语言。目前PHP的开发团队正筹备下一个PHP版本的发行名字是PHP 7。现在的PHP版本为PHP 5.6可能你清楚PHP 6已经流产了PHP 7的支持者们不希望下一个重要的版本被其他分支混淆即过去已经停止很久的PHP 6。所以决定下一个PHP主要的发行版本叫PHP 7而不是PHP 6。PHP 7.0预计在今年十一月份发行
- 为了提升执行效率与记忆痕迹PHPNG功能被添加到新的发行版中。
- JIT引擎被收入来动态编译Zend操作码为自然机器码以此来达到更快的处理性能。这项功能允许随后的程序调用同一份代码这样会运行快很多。
在下一代主要PHP版本里有一些不错的功能
- 为了改善执行效率与内存占用新的版本添加了PHPNG功能。
- 引入了JIT引擎来动态编译Zend操作码为自然机器码以此来达到更快的处理性能。这项功能允许随后的程序调用同一份代码这样会运行快很多。
- AST抽象语法树是最新添加的功能它可以增强支持PHP的扩展性和用户应用。
- 异步编程功能会添加支持并行任务,在同样的需求下。
-新的版本会支持独立多线程网页服务,这样可以使用一个单独的存储块处理很多并发的请求。
- 添加异步编程功能以支持同一个请求中的并行任务
- 新的版本会支持独立的多线程网页服务器,这样可以使用一个单独的存储池处理很多并发的请求。
### 在CcentOS/Fedora上安装PHP 7 ###
### 在CentOS/Fedora上安装PHP 7 ###
让我们来看看怎样在CentOS 7和Fedora 21安装PHP7。为了安装PHP7我们首先需要克隆php-src 仓库。当克隆工作完成,我们配置和编译它。进行下一步之前我们要确保已经在LInux系统下安装了如下的东西否则PHP编译会返回错误然后流产
让我们来看看怎样在CentOS 7和Fedora 21安装PHP7。为了安装PHP7我们首先需要克隆php-src 仓库。当克隆工作完成,我们配置和编译它。进行下一步之前我们要确保已经在LInux系统下安装了如下的组件否则PHP编译会返回错误中止
- Git
- autoconf
- gcc
- bison
所有上面提到的要求可以使用Yum软件包管理器安装。用连续的一个命令应该这样
所有上面提到的要求可以使用Yum软件包管理器安装。以下一条命令即可完成
yum install git autoconf gcc bison
准备好开始安装PHP7了吗让我们先创建一个PHP7目录作为你的工作目录。
准备好开始安装PHP7了吗让我们先创建一个PHP7目录作为你的当前工作目录。
mkdir php7
@ -143,7 +144,7 @@ PHP是一种为我们熟知的通用的服务器网页脚本语言。超大
--with-mysqli=/usr/bin/mysql_config
这会花去不少的时间,一旦完成,你应该会看到如下面的输出:
这会花去不少的时间,当完成后你应该会看到如下面的输出:
creating libtool
@ -206,9 +207,9 @@ PHP是一种为我们熟知的通用的服务器网页脚本语言。超大
运行下面的命令,完成编译过程。
manke
make
“make”命令过后的样例输出如下所示:
“make”命令的样例输出如下所示
Generating phar.php
@ -294,7 +295,7 @@ PHP是一种为我们熟知的通用的服务器网页脚本语言。超大
cd sapi/cli
在这里验证PHP的版本。
验证一下PHP的版本。
[root@localhost cli]# ./php -v
@ -306,7 +307,7 @@ PHP是一种为我们熟知的通用的服务器网页脚本语言。超大
### 总结 ###
PHP 7也[添加到了remi仓库][1],即将到来的版本主要关注执行效率的提升,新特性致力于使PHP较好满足现代编程的需求和趋势。PHP 7.0将会有许多新的特性丢弃一些老版本的东西。在接下来的日子里,我们希望看到新特性和弃用功能的具体情况。尽情享受吧
PHP 7也[添加到了remi仓库][1]这个即将到来的版本主要关注执行效率的提升,它的新特性致力于使PHP较好满足现代编程的需求和趋势。PHP 7.0将会有许多新的特性丢弃一些老版本的东西。在接下来的日子里,我们希望看到新特性和弃用功能的具体情况。希望你喜欢
--------------------------------------------------------------------------------
@ -314,7 +315,7 @@ via: http://linoxide.com/linux-how-to/install-php-7-centos-7-fedora-21/
作者:[Aun Raza][a]
译者:[wi-cuckoo](https://github.com/wi-cuckoo)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,20 +1,21 @@
Linux Email应用 Geary 更新了 — 如何在Ubuntu上安装
Linux Email应用 Geary 更新了
================================================================================
**GearyLinux上流行的桌面email客户端更新到版本0.10了 — 并且有了很多新的功能。**
![elementary OS上运行的旧版本的Geary](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/geary.jpg)
elementary OS上运行的旧版本的Geary
Geary 0.10有一些可惜的用户界面改进以及额外的UI选项包括
*elementary OS上运行的旧版本的Geary*
- 新增: 可以对归档,删除以及移动做'Undo'操作
Geary 0.10有一些不错的用户界面改进以及额外的UI功能包括
- 新增: 可以撤销归档、删除以及移动等操作
- 新增: 在2列或者2列布局之间切换
- 新的 “split header bar” — 改进邮件列表,发件人布局
- 新的快捷键 — 使用j/k切换到上/下一封邮件
根据Yorba介绍这次更新还提出了一个 **全新的全文检索算法** 用来改进Geary的搜索体验。
根据Yorba介绍这次更新还引入了一个**全新的全文检索算法** 用来改进Geary的搜索体验。
这个更新应该能平息一下对应用搜索能力的抱怨那些经常觉得Geary返回的搜索结果仅仅是包装软件自身"看起来和查询语句毫不相关"的观点
这个更新应该能平息一下对该应用的搜索能力的抱怨Geary返回的搜索结果就如同软件自己所宣称的“看起来和查询语句毫不相关”
> Yorba 建议所有这个软件客户端的用户升级到这个版本’
@ -36,7 +37,7 @@ Yorba的最新版本可以从GNOME的Git账户下载可编译的源代码。但
Ubuntu用户想知道如何在 **14.04,14.10** 以及 **15.04**(那些更新爱好者) 上安装Geary 0.10。
官方的Youba PPA包括了 **Geary最新版本** 以及Shotwell(照片管理器)和[California][2](日历应用)。请注意添加这个PPA会使你电脑上任何已经安装的这些应用更新到最近的版本。
官方的Youba PPA包括了 **Geary 最新版本** 以及Shotwell(照片管理器)和[California][2](日历应用)。请注意添加这个PPA会使你电脑上任何已经安装的这些应用更新到最近的版本。
Capiche? Coolio.
@ -52,7 +53,7 @@ Capiche? Coolio.
完成后打开你的桌面环境应用启动面板并查找Geary图标。点击它添加你的账户并查看[通过信息高速公路下载了什么][3],开始使用简单的图形界面吧。
**别忘记:你可以通过电子邮件告诉我们你想看的新闻,应用建议,以及任何你想我们包括的东西直接点击joey@oho.io**
**别忘记:你可以通过电子邮件告诉我们你想看的新闻,应用建议,以及任何你想我们包括的东西**
--------------------------------------------------------------------------------
@ -60,7 +61,7 @@ via: http://www.omgubuntu.co.uk/2015/03/install-geary-ubuntu-linux-email-update
作者:[Joey-Elijah Sneddon][a]
译者:[ictlyh](https://github.com/ictlyh)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,62 +1,61 @@
如何在CentOS上面安装CentOS网页面板
如何在CentOS上面安装CentOS网页面板
===========================================================================
![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/04/centos-790x427.jpg)
### 关于CentOS网页面板 ###
目前有很多免费的或者付费的控制面板。今天,我们来讨论[CentOS网页面板CWP][1],这是特别为基于如CentOSRHEL科研用Linux系统等发行版的RPM设计的。**CWP** 是免费且开源的控制面板,可以被广泛用于简单地配置一个网页集群环境。不同于其他的控制面板CWP是自动用高速缓存来配置LAMP的栈区
目前有很多免费的或者付费的控制面板。今天,我们来讨论[CentOS网页面板CWP][1],这是特别为基于RPM 的发行版如CentOSRHELScientific Linux等设计的。**CWP** 是免费且开源的控制面板,可以被广泛用于简单地配置一个网页托管环境。不同于其他的控制面板CWP能自动部署LAMP的软件栈及Varnish 缓存服务器
### 特性 ###
CWP有很多的特性和免费的服务。如我前面提到的一样CWP自动在你的服务器上安装全套LAMP服务apachephpphpmyadminwebmailmailserver等等
CWP有很多的特性和免费的服务。如我前面提到的一样CWP会在你的服务器上自动安装全套的LAMP服务apachephpphpmyadminwebmailmailserver等等
### CWP安装过程中会安装和配置的软件列表 ###
- Apache Web Server
- Apache 网页服务器
- PHP 5.4
- MySQL + phpMyAdmin
- Postfix + Dovecot + roundcube webmail
- CSF Firewall
- File System Lock (no more website hacking, all your files are locked from changes)
- Backups; AutoFixer for server configuration
- CSF 防火墙
- File System Lock (不需要修改网站,你的所有文件都会被锁定修改)
- Backups; AutoFixer ,用于服务器配置
### 第三方应用: ###
- CloudLinux + CageFS + PHP Selector
- Softaculous Script Installer (Free and Premium)
- Softaculous 脚本安装器 (免费版和白金版)
#### 网页服务器: ####
- Varnish Cache server
- Compiles Apache from source
- Apache reCompiler + Additional modules
- Apache server status, configuration
- Edit apache vhosts, vhosts templates, include configuration
- Rebuild all apache Virtual hosts
- Varnish 缓存服务器
- 从代码编译 Apache
- Apache 重新编译+附加模块
- Apache 服务器状态,配置
- 编辑 Apache 虚拟主机、虚拟主机模版,包括配置
- 重建所有 Apache 虚拟主机
- suPHP & suExec
- Mod Security + OWASP rules
- Tomcat 8 server management
- DoS protection
- Perl cgi script support
- Mod Security + OWASP 规则
- Tomcat 8 服务器管理
- DoS 防护
- Perl cgi 脚本支持
#### PHP: ####
- PHP 切换器 (在PHP版本如: 5.2, 5.3, 5.4, 5.5之间切换)
- PHP选择器选择每个用户或者每个文件的PHP版本PHP 4.4, 5.2, 5.3, 5.4, 5.5, 5.6)
- 简单的php编辑软件
- PHP 切换器 (在PHP版本如: 5.2、 5.3、 5.4、 5.5之间切换)
- PHP选择器选择每个用户或者每个文件的PHP版本PHP 4.4、 5.2、 5.3、 5.4、5.5、 5.6)
- 简单的php编辑
- 在用户面板下简单的php.ini生成器
- PHP 插件
- PHP.ini editor & PHP info & List modules
- PHP.ini 编辑器 & PHP 信息 和列出模块
- 每个帐号一个php.ini
- FFMPEG,用于视频流网站
- FFMPEG用于视频流网站
- CloudLinux + PHP 选择器
#### 用户管理 ####
- 添加,列举,编辑和移除用户
- 添加、列出、编辑和移除用户
- 用户监管
- Shell接入管理
- Shell访问管理
- 用户限制管理
- 限制进程
- 限制访问文件
@ -67,85 +66,85 @@ CWP有很多的特性和免费的服务。如我前面提到的一样CWP自
#### DNS: ####
- FreeDNS
- 添加,编辑,列举和移除DNS区块
- 添加、编辑、列出和移除DNS区块
- 编辑域名服务的IP
- DNS区块模板编辑器
- 新的易用DNS区块管理器 (用ajax)
- 新的DNS区块列表带有额外的修复信息 (同时检测 rDNS, 域名服务….)
- 新的DNS区块列表带有额外的google解析信息 (同时检测 rDNS 域名服务…)
#### Email: ####
- Postfix & dovecot
- MailBoxes, Alias
- 邮箱、别名
- Roundcube webmail
- Postfix Mail queue
- rDNS Checker Module
- Postfix 邮件队列
- rDNS 检查器模块
- 垃圾邮件拦截
- SPF & DKIM集成
- Re-Build Postfix/Dovecot Mail server with AntiVirus, AntiSpam Protection
- Email Auto Responder
- 重构带有反病毒、反垃圾邮件防护的 Postfix/Dovecot 的邮件服务器
- Email 自动应答器
#### 系统: ####
- CPU核心和时钟信息
- 内存使用信息
- 详细的磁盘状态
- 软件信息如内核版本,正常运行时间等等.
- 软件信息如内核版本正常运行时间等等.
- 服务器状态
- 检查配置管理
- ChkConfig管理
- 网络端口使用
- 网络配置
- SSHD配置
- sshd 配置
- 自动修复(检查重要的配置并尝试自动修复问题)
#### 监控: ####
- 监控服务 eg. top, apache stats, mysql etc.
- 在面板内使用Java SSH Terminal/Console
- 服务器配置 (eg. Apache, PHP, MySQL etc)
- 监控服务,例如 top、 apache 状态、 mysql 等
- 在面板内使用Java SSH 终端/控制台
- 服务器配置 (例如 Apache、 PHP、 MySQL 等)
- 在屏幕/后台运行命令行
#### 安全: ####
- CSF防火墙
- SSL生器
- SSL生
- SSL证书管理
- CloudLinux + CageFS
#### SQL: ####
- MySQL 数据库管理
- 添加本地或者远程接入用户
- 添加本地或者远程访问的用户
- 实时监控MySQL进程列表
- 创建,移除数据库
- 为每个数据库添加额外的用户
- MySQL服务器配置
- PhpMyAdmin(这个不知道要不要译过来)
- PhpMyAdmin
- PostgreSQL, phpPgAdmin支持
#### 额外功能: ####
- 语言通话3 管理
- 网络电台管理
- TeamSpeak 3 管理器
- Shoutcast 管理器
- 自动更新
- 备份管理
- 文件管理
- 备份管理
- 文件管理
- 每个域名的虚拟FTP用户
- 控制面板帐号移植 (恢复文件,数据库和数据库用户)
- 还有更多.
- cPanel帐号迁移 (恢复文件,数据库和数据库用户)
- 还有更多
### 在CentOS 6上安装CentOS网页面板 ###
写这篇教程的时候CWP仅仅支持最高CentOS 6.x版本。在CentOS 7和更高的版本中是行不通的。
写这篇教程的时候CWP仅仅支持最高CentOS 6.x版本。在CentOS 7和更高的版本中是不支持的。
#### 前期准备: ####
**安装CWP之前必须知道以下的信息:**
**安装CWP之前必须知道以下的信息:**
- CWP 仅支持静态IP地址。它并不支持动态的固定的,或者内部的IP地址。
- CWP 并没有卸载程序。当你安装CWP后必须重新安装服务器来移除它。
- 之安装CWP在一个新装的还没做任何配置改变的操作系统上。
- 对32位操作系统至少需要512MB RAM。
- CWP 仅支持静态IP地址。它并不支持动态的或者内部的IP地址。
- CWP 并没有卸载程序。当你安装CWP后必须重新安装服务器来移除它。
- 只能在一个新装的还没做任何配置改变的操作系统上安装CWP
- 对32位操作系统至少需要512MB RAM。
- 64位系统需要1024MB RAM。
- 要求至少20GB的硬盘空间。
@ -175,7 +174,7 @@ CWP有很多的特性和免费的服务。如我前面提到的一样CWP自
如果上面的URL出现错误用下面的链接代替。
wget http://dll.centos-webpanle.com/files/cwp-latest
wget http://dl1.centos-webpanle.com/files/cwp-latest
然后用命令开始安装CWP
@ -189,8 +188,7 @@ CWP有很多的特性和免费的服务。如我前面提到的一样CWP自
安装过程会持续到30分钟或者更多取决于你的网速。
最后,你会看到如下安装完成的信息。
记下一些详细信息如mysql超级用户密码和CWP的登录URLs。你随后会需要。然后按下回车Enter重启系统。
最后你会看到如下安装完成的信息。记下一些详细信息如mysql超级用户密码和CWP的登录URL你随后会需要它们。然后按下回车Enter重启系统。
![](http://www.unixmen.com/wp-content/uploads/2015/04/root@server-usr-local-src_004.png)
@ -200,7 +198,7 @@ CWP有很多的特性和免费的服务。如我前面提到的一样CWP自
#### 调整防火墙/路由: ####
CWP的默认网络控制接口是**2030http**和**2031https**。你应该通过防火墙/路由允许使用这两个端口以便远程接入CWP网络控制台。
CWP的默认网页控制界面的端口是**2030http**和**2031https**。你应该通过防火墙/路由允许使用这两个端口以便远程接入CWP网络控制台。
编辑iptables文件
@ -242,43 +240,42 @@ CWP的默认网络控制接口是**2030http**和**2031https**。你
接下来,我们得做一些事,比如:
1.建立域名服务
1.建立ip共享必须是你的公共IP地址
1.建立至少一个集合包(或者编辑默认的包)
1.建立root电子邮件,等等。
1. 设置域名服务器
1. 设置 ip 共享必须是你的公共IP地址
1. 设置至少一个托管包(或者编辑默认的包)
1. 设置 root 电子邮件,等等。
#### 建立域名服务 ####
#### 设置域名服务器 ####
为建立域名服务,找到**DNS Functions -> Edit nameservers IPs**。
为建立域名服务,找到**DNS Functions -> Edit nameservers IPs**。
![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_009.png)
设置你的域名服务器,点击保存按钮。
![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_010.png)
#### 建立共享IP和Root邮箱ID ####
#### 建立共享IP和Root邮件地址 ####
在你的主机上管网站这是非常重要的一步。为了建立共享IP进入**CWP Setting -> Edit settings**。
在你的主机上管网站这是非常重要的一步。为了建立共享IP进入**CWP Setting -> Edit settings**。
![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_011.png)
输入你的静态IP和邮箱ID,然后点击保存设置按钮。
输入你的静态IP和邮件地址,然后点击保存设置按钮。
![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_012.png)
现在CWP可以进行网站维护了。
#### 建立主机包 ####
#### 建立托管包 ####
一个主机包什么都没有除了一个网站托管计划包括允许访问的磁盘空间带宽但没有FTP帐号邮箱IDs和数据库等等。你可以建立任意数量的网站托管计划,只要你喜欢。
一个托管包就是一个网站托管计划包括允许访问的磁盘空间带宽但没有FTP帐号邮箱地址和数据库等等。你可以建立任意数量的网站托管计划,只要你喜欢。
添加一个包从CWP的控制台进入**Packages — Add a Package**
添加一个包从CWP的控制台进入**Packages — Add a Package**
![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_013.png)
输入包的名字,允许访问的磁盘配额/RAM数量FTP/Email帐号数据库和子域名等等。点击保设置按钮,建立一个网站托管计划。
输入包的名字,允许访问的磁盘配额/RAM数量FTP/Email帐号数据库和子域名等等。点击保设置按钮,建立一个网站托管计划。
![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_014.png)
@ -290,7 +287,7 @@ CWP的默认网络控制接口是**2030http**和**2031https**。你
而添加一个用户,请进入**User Account -> New Account**。
输入域名(ex.unixmen.com),用户名,密码和邮箱id等等。最后,点击**Create**。
输入域名(ex.unixmen.com),用户名,密码和邮箱地址等等。最后,点击**Create**。
![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_016.png)
@ -312,12 +309,11 @@ CWP的默认网络控制接口是**2030http**和**2031https**。你
---------------------------------------------------------------------------
via: http://www.unixmen.com/how-to-install-centos-web-panel-in-centos/
作者:[SK][a]
译者:[wi-cuckoo](https://github.com/wi-cuckoo)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -0,0 +1,86 @@
Quagga上使用验证加固BGP会话安全
================================================================================
BGP协议运行于TCP之上因而它也继承了TCP连接的所有漏洞。例如在一个BGP会话内攻击者可以冒充一个合法的BGP邻居然后说服另一端的BGP路由器共享路由信息给攻击者。在攻击者通告并向邻居路由注入伪造的路由时就会发生这个问题。毫无戒备的邻居路由器就会开始向攻击者发送通信实况实际上这些信息并没有去向任何地方仅仅只是被丢弃了。回到2008年YouTube实际上也[受害于][1]这样的BGP路由中毒并遭受了长达一个小时的视频服务大量中断。一个更加糟糕的情况是如果攻击者是个足够懂行的人他们可以伪装成一台透明路由器然后嗅探经过的通信以获取敏感数据。你可以想象这会造成深远的影响。
要保护活跃的BGP会话不受攻击许多服务提供商在BGP会话中使用[MD5校验和及预共享密钥][2]。在受保护的BGP会话中一台发送包的BGP路由器通过使用预共享的密钥生成MD5散列值、部分IP和TCP头以及有效载荷。然后MD5散列作为一个TCP选项字段存储。在收到包后接受路由器用同样的方法使用预共享密钥生成它的MD5版本。它会将它的MD5散列和接收到的某个包的值进行对比以决定是否接受该包。对于一个攻击者而言几乎不可能猜测到校验和或其密钥。对于BGP路由器而言它们能在使用包的内容前确保每个包的合法性。
在本教程中我们将为大家演示如何使用MD5校验和以及预共享密钥来加固两个邻居间的BGP会话的安全。
### 准备 ###
加固BGP会话安全是相当简单而直截了当的我们会使用以下路由器。
<table id="content">
<tbody><tr>
<td><b>路由器名称</b></td>
<td><b>AS 号</b></td>
<td><b>IP地址</b></td>
</tr>
<tr>
<td>router-A</td>
<td>100</td>
<td>10.10.12.1/30</td>
</tr>
<tr>
<td>router-B</td>
<td>200</td>
<td>10.10.12.2/30</td>
</tr>
</tbody></table>
常用的Linux内核原生支持IPv4和IPv6的TCP MD5选项。因此如果你从全新的[Linux机器][3]构建了一台Quagga路由器TCP的MD5功能会自动启用。剩下来的事情仅仅是配置Quagga以使用它的功能。但是如果你使用的是FreeBSD机器或者为Quagga构建了一个自定义内核请确保内核开启了TCP的MD5支持Linux中的CONFIG_TCP_MD5SIG选项
### 配置Router-A验证功能 ###
我们将使用Quagga的CLI Shell来配置路由器我们将使用的唯一的一个新命令是password
[root@router-a ~]# vtysh
router-a# conf t
router-a(config)# router bgp 100
router-a(config-router)# network 192.168.100.0/24
router-a(config-router)# neighbor 10.10.12.2 remote-as 200
router-a(config-router)# neighbor 10.10.12.2 password xmodulo
本例中使用的预共享密钥是xmodulo。很明显在生产环境中你需要选择一个更健壮的密钥。
**注意** 在Quagga中service password-encryption命令被用做加密配置文件中所有明文密码登录密码。然而当我使用该命令时我注意到BGP配置中的预共享密钥仍然是明文的。我不确定这是否是Quagga的限制还是版本自身的问题。
### 配置Router-B验证功能 ###
我们将以类似的方式配置router-B。
[root@router-b ~]# vtysh
router-b# conf t
router-b(config)# router bgp 200
router-b(config-router)# network 192.168.200.0/24
router-b(config-router)# neighbor 10.10.12.1 remote-as 100
router-b(config-router)# neighbor 10.10.12.1 password xmodulo
### 验证BGP会话 ###
如果一切配置正确那么BGP会话就应该起来了两台路由器应该能交换路由表。这时候TCP会话中的所有流出包都会携带一个MD5摘要的包内容和一个密钥而摘要信息会被另一端自动验证。
我们可以像平时一样通过查看BGP的概要来验证活跃的BGP会话。MD5校验和的验证在Quagga内部是透明的因此你在BGP级别是无法看到的。
![](https://farm8.staticflickr.com/7621/16837774368_e9ff66b370_c.jpg)
如果你想要测试BGP验证你可以配置一个邻居路由设置其密码为空或者故意使用错误的预共享密钥然后查看发生了什么。你也可以使用包嗅探器像tcpdump或者Wireshark等来分析通过BGP会话的包。例如带有“-M <secret>”选项的tcpdump将验证TCP选项字段的MD5摘要。
###小结###
在本教程中我们演示了怎样简单地加固两台路由间的BGP会话安全。相对于其它协议而言配置过程非常简明。强烈推荐你加固BGP会话安全尤其是当你用另一个AS配置BGP会话的时候。预共享密钥也应该安全地保存。
--------------------------------------------------------------------------------
via: http://xmodulo.com/bgp-authentication-quagga.html
作者:[Sarmed Rahman][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://xmodulo.com/author/sarmed
[1]:http://research.dyn.com/2008/02/pakistan-hijacks-youtube-1/
[2]:http://tools.ietf.org/html/rfc2385
[3]:https://linux.cn/article-4232-1.html

View File

@ -0,0 +1,261 @@
4个可以发送完整电子邮件的命令行工具
================================================================================
今天的文章里我们会讲到一些使用Linux命令行工具来发送带附件的电子邮件的方法。它有很多用处比如在应用程序所在服务器上使用电子邮件发送一个文件过来或者你可以在脚本中使用这些命令来做一些自动化操作。在本文的例子中我们会使用foo.tar.gz文件作为附件。
有不同的命令行工具可以发送邮件,这里我分享几个多数用户会使用的工具,如`mailx`、`mutt`和`swaks`。
我们即将呈现的这些工具都是非常有名的并且存在于多数Linux发行版默认的软件仓库中你可以使用如下命令安装
**Debian / Ubuntu** 系统
apt-get install mutt
apt-get install swaks
apt-get install mailx
apt-get install sharutils
在基于Red Hat的系统**CentOS** 或者 **Fedora**
yum install mutt
yum install swaks
yum install mailx
yum install sharutils
### 1) 使用 mail / mailx ###
`mailx`工具在多数Linux发行版中是默认的邮件程序现在已经支持发送附件了。如果它不在你的系统中你可以使用上边的命令安装。有一点需要注意老版本的mailx可能不支持发送附件运行如下命令查看是否支持。
$ man mail
第一行看起来是这样的:
mailx [-BDdEFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr] [-r from-addr] [-h hops] [-A account] [-S variable[=value]] to-addr . . .
如果你看到它支持`-a`的选项(-a 文件名,将文件作为附件添加到邮件)和`-s`选项(-s 主题,指定邮件的主题),那就是支持的。可以使用如下的几个例子发送邮件。
**a) 简单的邮件**
运行`mail`命令,然后`mailx`会等待你输入邮件内容。你可以按回车来换行。当输入完成后按Ctrl + D`mailx`会显示EOT表示结束。
然后`mailx`会自动将邮件发送给收件人。
$ mail user@example.com
HI,
Good Morning
How are you
EOT
**b) 发送有主题的邮件**
$ echo "Email text" | mail -s "Test Subject" user@example.com
`-s`的用处是指定邮件的主题。
**c) 从文件中读取邮件内容并发送**
$ mail -s "message send from file" user@example.com < /path/to/file
**d) 将从管道获取到的`echo`命令输出作为邮件内容发送**
$ echo "This is message body" | mail -s "This is Subject" user@example.com
**e) 发送带附件的邮件**
$ echo “Body with attachment "| mail -a foo.tar.gz -s "attached file" user@example.com
`-a`选项用于指定附件。
### 2) mutt ###
Mutt是类Unix系统上的一个文本界面邮件客户端。它有20多年的历史在Linux历史中也是一个很重要的部分它是最早支持进程打分和多线程处理的客户端程序之一。按照如下的例子来发送邮件。
**a) 带有主题,从文件中读取邮件的正文,并发送**
$ mutt -s "Testing from mutt" user@example.com < /tmp/message.txt
**b) 通过管道获取`echo`命令输出作为邮件内容发送**
$ echo "This is the body" | mutt -s "Testing mutt" user@example.com
**c) 发送带附件的邮件**
$ echo "This is the body" | mutt -s "Testing mutt" user@example.com -a /tmp/foo.tar.gz
**d) 发送带有多个附件的邮件**
$ echo "This is the body" | mutt -s "Testing" user@example.com -a foo.tar.gz a bar.tar.gz
### 3) swaks ###
SwaksSwiss Army Knife瑞士军刀是SMTP服务上的瑞士军刀它是一个功能强大、灵活、可编程、面向事务的SMTP测试工具由John Jetmore开发和维护。你可以使用如下语法发送带附件的邮件
$ swaks -t "foo@bar.com" --header "Subject: Subject" --body "Email Text" --attach foo.tar.gz
关于Swaks一个重要的地方是它会为你显示整个邮件发送过程所以如果你想调试邮件发送过程它是一个非常有用的工具。
它会给你提供了邮件发送过程的所有细节,包括邮件接收服务器的功能支持、两个服务器之间的每一步交互。
### 4) uuencode ###
邮件传输系统最初是被设计来传送7位编码类似ASCII的内容的。这就意味这它是用来发送文本内容而不能发会使用8位的二进制内容如程序文件或者图片。`uuencode`“UNIX to UNIX encoding”UNIX之间使用的编码方式程序用来解决这个限制。使用`uuencode`,发送端将二进制格式的转换成文本格式来传输,接收端再转换回去。
我们可以简单地使用`uuencode`和`mailx`或者`mutt`配合,来发送二进制内容,类似这样:
$ uuencode example.jpeg example.jpeg | mail user@example.com
### Shell脚本解释如何发送邮件 ###
#!/bin/bash
FROM=""
SUBJECT=""
ATTACHMENTS=""
TO=""
BODY=""
# 检查文件名对应的文件是否存在
function check_files()
{
output_files=""
for file in $1
do
if [ -s $file ]
then
output_files="${output_files}${file} "
fi
done
echo $output_files
}
echo "*********************"
echo "E-mail sending script."
echo "*********************"
echo
# 读取用户输入的邮件地址
while [ 1 ]
do
if [ ! $FROM ]
then
echo -n -e "Enter the e-mail address you wish to send mail from:\n[Enter] "
else
echo -n -e "The address you provided is not valid:\n[Enter] "
fi
read FROM
echo $FROM | grep -E '^.+@.+$' > /dev/null
if [ $? -eq 0 ]
then
break
fi
done
echo
# 读取用户输入的收件人地址
while [ 1 ]
do
if [ ! $TO ]
then
echo -n -e "Enter the e-mail address you wish to send mail to:\n[Enter] "
else
echo -n -e "The address you provided is not valid:\n[Enter] "
fi
read TO
echo $TO | grep -E '^.+@.+$' > /dev/null
if [ $? -eq 0 ]
then
break
fi
done
echo
# 读取用户输入的邮件主题
echo -n -e "Enter e-mail subject:\n[Enter] "
read SUBJECT
echo
if [ "$SUBJECT" == "" ]
then
echo "Proceeding without the subject..."
fi
# 读取作为附件的文件名
echo -e "Provide the list of attachments. Separate names by space.
If there are spaces in file name, quote file name with \"."
read att
echo
# 确保文件名指向真实文件
attachments=$(check_files "$att")
echo "Attachments: $attachments"
for attachment in $attachments
do
ATTACHMENTS="$ATTACHMENTS-a $attachment "
done
echo
# 读取完整的邮件正文
echo "Enter message. To mark the end of message type ;; in new line."
read line
while [ "$line" != ";;" ]
do
BODY="$BODY$line\n"
read line
done
SENDMAILCMD="mutt -e \"set from=$FROM\" -s \"$SUBJECT\" \
$ATTACHMENTS -- \"$TO\" <<< \"$BODY\""
echo $SENDMAILCMD
mutt -e "set from=$FROM" -s "$SUBJECT" $ATTACHMENTS -- $TO <<< $BODY
** 脚本输出 **
$ bash send_mail.sh
*********************
E-mail sending script.
*********************
Enter the e-mail address you wish to send mail from:
[Enter] test@gmail.com
Enter the e-mail address you wish to send mail to:
[Enter] test@gmail.com
Enter e-mail subject:
[Enter] Message subject
Provide the list of attachments. Separate names by space.
If there are spaces in file name, quote file name with ".
send_mail.sh
Attachments: send_mail.sh
Enter message. To mark the end of message type ;; in new line.
This is a message
text
;;
### 总结 ###
有很多方法可以使用命令行/Shell脚本来发送邮件这里我们只分享了其中4个类Unix系统可用的工具。希望你喜欢我们的文章并且提供您的宝贵意见让我们知道您想了解哪些新工具。
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-shell-script/send-email-subject-body-attachment-linux/
作者:[Bobbin Zachariah][a]
译者:[goreliu](https://github.com/goreliu)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/bobbin/

View File

@ -1,8 +1,8 @@
安装Inkscape - 开源适量图形编辑器
Inkscape - 开源适量图形编辑器
================================================================================
Inkscape是一款开源矢量图形编辑工具它使用可缩放矢量图形(SVG)图形格式并不同于它的竞争对手如Xara X、Corel Draw和Adobe Illustrator等等。SVG是一个广泛部署、免版税使用的图形格式由W3C SVG工作组开发和维护。这是一个跨平台工具完美运行于Linux、Windows和Mac OS上。
Inkscape是一款开源矢量图形编辑工具并不同于Xara X、Corel Draw和Adobe Illustrator等竞争对手它使用的是可缩放矢量图形(SVG)图形格式。SVG是一个广泛部署、免版税使用的图形格式由W3C SVG工作组开发和维护。这是一个跨平台工具完美运行于Linux、Windows和Mac OS上。
Inkscape始于2003年起初它的bug跟踪系统托管于Sourceforge上但是 后来迁移到了Launchpad上。当前它最新的一个稳定版本是0.91,它不断地在发展和修改中。我们将在本文里了解一下它的突出特点和安装过程。
Inkscape始于2003年起初它的bug跟踪系统托管于Sourceforge上但是后来迁移到了Launchpad上。当前它最新的一个稳定版本是0.91,它不断地在发展和修改中。我们将在本文里了解一下它的突出特点和安装过程。
### 显著特性 ###
@ -12,30 +12,30 @@ Inkscape始于2003年起初它的bug跟踪系统托管于Sourceforge上但是
- 用铅笔工具来画出不同颜色、大小和形状的手绘线,用贝塞尔曲线(笔式)工具来画出直线和曲线,通过书法工具来应用到手写的书法笔画上等等
- 用文本工具来创建、选择、编辑和格式化文本。在纯文本框、在路径上或在形状里操作文本
- 有效绘制各种形状,像矩形、椭圆形、圆形、弧线、多边形、星形和螺旋形等等并调整其大小、旋转并修改(圆角化)它们
- 方便绘制各种形状,像矩形、椭圆形、圆形、弧线、多边形、星形和螺旋形等等并调整其大小、旋转并修改(圆角化)它们
- 用简单地命令创建并嵌入位图
#### 对象处理 ####
- 通过交互式操作和调整数值来扭曲、移动、测量、旋转目标
- 执行力提升并减少了Z-order操作。
- 对象群组化或取消群组化可以去创建一个虚拟层阶用来编辑或处理
- 图层采用层次结构树的结构并且能锁定或以各式各样的处理方式来重新布置
- 通过交互式操作和调整参量来扭曲、移动、测量、旋转目标
- 可以对 Z 轴进行提升或降低操作。
- 通过对象组合和取消组合可以创建一个虚拟层用来编辑或处理
- 图层采用层次结构树的结构并且能锁定或以各式各样的处理方式来重新布置
- 分布与对齐指令
#### 填充与边框 ####
- 复制/粘贴风格
- 可以复制/粘贴不同风格
- 取色工具
- 用RGB, HSL, CMS, CMYK和色盘这四种不同的方式选色
- 渐层编辑器能创建和管理多停点渐层
- 定义一个图像或其它选择用来进行花纹填充
- 用一些预定义泼洒花纹可对边框进行花纹泼洒
- 通过路径标示器来开始、对折和结束标示
- 渐层编辑器能创建和管理多停点渐
- 使用图像或其它选择区作为花纹填充
- 用一些预定义点状花纹进行笔触填充
- 通过路径标示器标示开始、对折和结束点
#### 路径上的操作 ####
- 节点编辑:移动节点和贝塞尔曲线控,节点的对齐和分布等等
- 节点编辑:移动节点和贝塞尔曲线控制点,节点的对齐和分布等等
- 布尔运算(是或否)
- 运用可变的路径起迄点可简化路径
- 路径插入和增设连同动态和链接偏移对象
@ -43,9 +43,9 @@ Inkscape始于2003年起初它的bug跟踪系统托管于Sourceforge上但是
#### 文本处理 ####
- 所有安装好的框字体都能用甚至可以从右至左对齐对象
- 所有安装好的框线字体都能用甚至可以从右至左对齐对象
- 格式化文本、调整字母间距、行间距或列间距
- 路径上的文本和形状上的文本和路径或形状都可以被编辑和修改
- 路径上和形状上的文本中的文本、路径或形状都可以被编辑和修改
#### 渲染 ####
@ -78,7 +78,7 @@ PPA添加到APT库中后我们要用以下命令进行更新
### 结论 ###
Inkscape是一款特点鲜明的图形编辑工具它给予用户充分发挥自己艺术力的权利。它还是一款自由安装和自定义开源应用并且支持大范围文件类型包括JPEG, PNG, GIF和PDF且不仅这些。访问它的 [官方网站][2] 来获取更多新闻和应用更新。
Inkscape是一款特点鲜明的图形编辑工具它给予用户充分发挥自己艺术力的权利。它还是一款自由安装和自定义的开源应用并且支持各种文件类型包括JPEG, PNG, GIF和PDF及更多。访问它的 [官方网站][2] 来获取更多新闻和应用更新。
--------------------------------------------------------------------------------
@ -86,7 +86,7 @@ via: http://linoxide.com/tools/install-inkscape-open-source-vector-graphic-edito
作者:[Aun Raza][a]
译者:[ZTinoZ](https://github.com/ZTinoZ)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,12 +1,13 @@
Linux 上 wget 或 curl 的更佳替代品
用腻了 wget 或 curl有什么更好的替代品吗
================================================================================
如果你经常需要通过终端以非交互模式访问网络服务器(例如,从网络上下载文件,或者是测试 RESTful 网络服务接口),可能你会选择的工具是 wget 或 curl。通过大量的命令行选项这两种工具都可以处理很多非交互网络访问的情况比如[这里][1][这里][2],还有[这里][3])。然而,即使像这些一样的强大的工具,也只是与你对如何使用它们的了解程度等同。除非你很精通那些又多又笨(原文是 nitty and gritty的语法细节这些工具对于你来说只不过是简单的网络下载器。
就像宣传的那样,“为人类着想的类 curl 工具”,[HTTPie][4] 设计用来增强 wget 和 curl 的可用性。它的主要目标是使通过命令行与网络服务器进行交互的过程变得尽可能的人性化。为此HTTPie 支持具有表现力,但又很简单很直观的语法。它以彩色模式显示响应,并且还有一些不错的优点,比如对 JSON 的良好支持,和持久性会话用以作业流程化
如果你经常需要通过终端以非交互模式访问网络服务器(例如,从网络上下载文件,或者是测试 RESTful 网络服务接口),可能你会选择的工具是 wget 或 curl。通过大量的命令行选项这两种工具都可以处理很多非交互网络访问的情况比如[这里][1]、[这里][2],还有[这里][3])。然而,即使像这些一样的强大的工具,你也只能发挥你所了解的那些选项的功能。除非你很精通那些繁冗的语法细节,这些工具对于你来说只不过是简单的网络下载器而已
我知道很多人对把像 wget 和 curl 这样的无处不在的可用的完美工具换成完全没听说过的软件心存怀疑。这种观点是好的,特别是如果你是一个系统管理员、要处理很多不同的硬件的话。然而,对于开发者和终端用户来说,重要的是效率。如果我发现了一个工具的用户友好替代,我没有看到任何问题如果你采用易于使用的版本来节省你宝贵的时间。没有必要对替换掉的工具保持信仰忠诚。毕竟,对于 Linux 来说,最好的事情是可以选择
就像其宣传的那样,“给人用 curl 类工具”,[HTTPie][4] 设计用来增强 wget 和 curl 的可用性。它的主要目标是使通过命令行与网络服务器进行交互的过程变得尽可能的人性化。为此HTTPie 支持具有表现力、但又很简单很直观的语法。它以彩色模式显示响应,并且还有一些不错的优点,比如对 JSON 的良好支持,和持久性会话用以作业流程化
在这篇文章中,让我们来回顾并展示一下我所说的 HTTPie一个用户友好的 wget 和 curl 的替代。
我知道很多人对把像 wget 和 curl 这样的无处不在的、可用的、完美的工具换成完全没听说过的软件心存疑虑。这种观点是好的,特别是如果你是一个系统管理员、要处理很多不同的硬件的话。然而,对于开发者和终端用户来说,重要的是效率。如果我发现了一个工具的用户更佳替代品,那么我认为采用易于使用的版本来节省宝贵的时间是毫无疑问的。没有必要对替换掉的工具保持信仰忠诚。毕竟,对于 Linux 来说,最好的事情就是可以选择。
在这篇文章中,让我们来了解并展示一下我所说的 HTTPie一个用户友好的 wget 和 curl 的替代。
![](https://farm8.staticflickr.com/7633/16849137018_bcc7a616fc_b.jpg)
@ -40,10 +41,9 @@ HTTPie 是用 Python 写的所以你可以在几乎所有地方LinuxMac
你可以使用 &lt;header:value&gt; 的格式来定制头部。例如,我们发送一个 HTTP GET 请求到 www.test.com 使用定制用户代理user-agent和来源referer还有定制头部比如 MyParam
$ http www.test.com User-Agent:Xmodulo/1.0 Referer:http://xmodulo.com MyParam:Foo
注意到当使用 HTTP GET 方法时,你无需指定任何 HTTP 方法。
注意到当使用 HTTP GET 方法时,就无需明确指定 HTTP 方法。
这个 HTTP 请求看起来如下:
@ -121,7 +121,7 @@ HTTPie 的另外一个用户友好特性是输入重定向,你可以使用缓
### 结束语 ###
在这篇文章中,我介绍了 HTTPie一个 wget 和 curl 的可能替代工具。除了这里展示的几个简单的例子,你可以在[官方网站][7]上找到 HTTPie 的很多有趣的应用。再次重复一遍,一款强大的工具也只相当于你对它的了解程度。从个人而言,我更热衷于 HTTPie因为我在寻找一种更简洁的测试复杂网络接口的方法。
在这篇文章中,我介绍了 HTTPie一个 wget 和 curl 的可能替代工具。除了这里展示的几个简单的例子,你可以在[官方网站][7]上找到 HTTPie 的很多有趣的应用。再次重复一遍,一款再强大的工具也取决于你对它的了解程度。从个人而言,我更倾向于 HTTPie因为我在寻找一种更简洁的测试复杂网络接口的方法。
你怎么看?
@ -131,15 +131,15 @@ via: http://xmodulo.com/wget-curl-alternative-linux.html
作者:[Dan Nanni][a]
译者:[wangjiezhe](https://github.com/wangjiezhe)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://xmodulo.com/author/nanni
[1]:http://xmodulo.com/how-to-download-multiple-files-with-wget.html
[2]:http://xmodulo.com/how-to-use-custom-http-headers-with-wget.html
[3]:http://ask.xmodulo.com/custom-http-header-curl.html
[3]:https://linux.cn/article-4957-1.html
[4]:https://github.com/jakubroztocil/httpie
[5]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html
[5]:https://linux.cn/article-2324-1.html
[6]:http://ask.xmodulo.com/install-pip-linux.html
[7]:https://github.com/jakubroztocil/httpie

View File

@ -1,4 +1,4 @@
Linux有问必答--如何在Linux中修改环境变量PATH
Linux有问必答如何在Linux中修改环境变量PATH
================================================================================
> **提问**: 当我试着运行一个程序时它提示“command not found”。 但这个程序就在/usr/local/bin下。我该如何添加/usr/local/bin到我的PATH变量下这样我就可以不用指定路径来运行这个命令了。
@ -38,7 +38,7 @@ Linux有问必答--如何在Linux中修改环境变量PATH
/usr/lib64/qt-3.3/bin:/bin:/usr/bin:/usr/sbin:/sbin:/home/xmodulo/bin:/usr/local/bin
更新的PATH会在当前的PATH一直有效。然而,更改将在新的会话中失效。
更新后的PATH会在当前的会话一直有效。然而,更改将在新的会话中失效。
如果你想要永久更改PATH变量用编辑器打开~/.bashrc (或者 ~/.bash_profile),接着在最后添加下面这行。
@ -46,7 +46,7 @@ Linux有问必答--如何在Linux中修改环境变量PATH
接着运行下面这行永久激活更改:
$ source ~/.bashrc (or source ~/.bash_profile)
$ source ~/.bashrc (或者 source ~/.bash_profile)
### 改变系统级的环境变量 ###
@ -66,7 +66,7 @@ via: http://ask.xmodulo.com/change-path-environment-variable-linux.html
作者:[Dan Nanni][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,4 +1,4 @@
[已解决] Ubuntu下不能记住亮度设置问题
如何解决 Ubuntu 下不能记住亮度设置的问题
================================================================================
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/04/Fix_Ubuntu_Brightness_Issue.jpg)
@ -22,7 +22,7 @@ via: http://itsfoss.com/ubuntu-mint-brightness-settings/
作者:[Abhishek][a]
译者:[ZTinoZ](https://github.com/ZTinoZ)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,22 +1,26 @@
如何在 CentOS Linux 中配置 MariADB 复制
如何在 CentOS Linux 中配置 MariaDB 复制
================================================================================
这是一个创建数据库重复版本的过程。复制过程不仅仅是复制一个数据库,同时也包括从主节点到一个从节点的更改同步。但这并不意味着从数据库就是和主数据库完全相同的副本,因为复制可以配置为只有表或者行或者列的一个模式将被复制,例如,局部复制。复制保证了特定的配置对象在不同的数据库之间保持同步
这是一个创建数据库重复版本的过程。复制过程不仅仅是复制一个数据库,同时也包括从主节点到一个从节点的更改同步。但这并不意味着从数据库就是和主数据库完全相同的副本,因为复制可以配置为只复制表结构、行或者列,这叫做局部复制。复制保证了特定的配置对象在不同的数据库之间保持一致
### Mariadb 复制概念 ###
**备份** :复制可以用来进行数据库备份。例如,你有主->从复制。如果主节点丢失(比如hdd损坏),你可以从从节点中恢复你的数据库。
**备份** :复制可以用来进行数据库备份。例如,当你做了主->从复制。如果主节点数据丢失(比如硬盘损坏),你可以从从节点中恢复你的数据库。
**扩展** :你可以使用主->从复制作为扩展解决方案。例如如果你有一些大的数据库以及SQL查询使用复制你可以将这些查询单独分到每个复制节点。写SQL应该只在主节点进行而只读查询可以在从节点上进行。
**扩展** :你可以使用主->从复制作为扩展解决方案。例如如果你有一些大的数据库以及SQL查询使用复制你可以将这些查询分到每个复制节点。写入操作的SQL应该只在主节点进行而只读查询可以在从节点上进行。
**传播解决方案** :你可以用复制来进行分发。例如,你可以将不同的销售数据分发到不同的数据库。
**分发解决方案** :你可以用复制来进行分发。例如,你可以将不同的销售数据分发到不同的数据库。
**故障解决方案** : 假如你有主节点->从节点1->从节点2->从节点3的复制。你可以为主节点写脚本监控如果主节点出故障了脚本可以快速的将从节点1作为新的主节点,有主节点->从节点1->从节点2你的应用可以继续工作而不会停机。
**故障解决方案** : 假如你建立有主节点->从节点1->从节点2->从节点3的复制结构。你可以为主节点写脚本监控如果主节点出故障了脚本可以快速的将从节点1切换为新的主节点,这样复制结构变成了主节点->从节点1->从节点2你的应用可以继续工作而不会停机。
### 复制的简单图解示范 ###
![mysql 复制原理](http://blog.linoxide.com/wp-content/uploads/2015/04/mysql-replication-principle.png)
开始之前,你应该知道什么是**二进制日志文件**以及 Ibdata1。二进制日志文件中包括关于数据库数据和结构的所有更改的记录以及每条语句的执行时间。二进制日志文件包括设置日志文件和一个索引。这意味着主要的SQL语句例如CREATE, ALTER, INSERT, UPDATE 和 DELETE 会放到这个日志文件中而例如SELECT语句就不会被记录。这些信息可以被记录到普通的query.log文件。简单的说 **Ibdata1** 是一个包括所有表和所有数据库信息的文件。
开始之前,你应该知道什么是**二进制日志文件**以及 Ibdata1。
二进制日志文件中包括关于数据库数据和结构的所有更改的记录以及每条语句的执行了多长时间。二进制日志文件包括一系列日志文件和一个索引文件。这意味着主要的SQL语句例如CREATE, ALTER, INSERT, UPDATE 和 DELETE 会放到这个日志文件中而例如SELECT这样的语句就不会被记录它们可以被记录到普通的query.log文件中。
**Ibdata1** 简单的说据是一个包括所有表和所有数据库信息的文件。
### 主服务器配置 ###
@ -39,7 +43,7 @@
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
输出:
输出如下:
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'
@ -51,7 +55,7 @@
sudo systemctl is-active mariadb.service
输出:
输出如下:
Redirecting to /bin/systemctl status mariadb.service
mariadb.service - MariaDB database server
@ -65,11 +69,11 @@
mysql> flush privileges;
mysql> exit
SOME_ROOT_PASSWORD - 你的 root 密码。 例如我用"q"作为密码,然后尝试登陆
这里 SOME_ROOT_PASSWORD 是你的 root 密码。 例如我用"q"作为密码,然后尝试登录
sudo mysql -u root -pSOME_ROOT_PASSWORD
输出:
输出如下:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
@ -89,7 +93,7 @@ SOME_ROOT_PASSWORD - 你的 root 密码。 例如我用"q"作为密码,然后
test_repl - 将要被复制的模式的名字
输出:
输出:如下
Query OK, 1 row affected (0.00 sec)
@ -105,7 +109,7 @@ SOME_ROOT_PASSWORD - 你的 root 密码。 例如我用"q"作为密码,然后
City varchar(255)
);
输出:
输出如下:
mysql> MariaDB [test_repl]> CREATE TABLE Persons (
-> PersonID int,
@ -124,7 +128,7 @@ SOME_ROOT_PASSWORD - 你的 root 密码。 例如我用"q"作为密码,然后
mysql> INSERT INTO Persons VALUES (4, "LastName4", "FirstName4", "Address4", "City4");
mysql> INSERT INTO Persons VALUES (5, "LastName5", "FirstName5", "Address5", "City5");
输出:
输出如下:
Query OK, 5 row affected (0.00 sec)
@ -132,7 +136,7 @@ SOME_ROOT_PASSWORD - 你的 root 密码。 例如我用"q"作为密码,然后
mysql> select * from Persons;
输出:
输出如下:
+----------+-----------+------------+----------+-------+
| PersonID | LastName | FirstName | Address | City |
@ -145,9 +149,9 @@ SOME_ROOT_PASSWORD - 你的 root 密码。 例如我用"q"作为密码,然后
| 5 | LastName5 | FirstName5 | Address5 | City5 |
+----------+-----------+------------+----------+-------+
### 配置 MariaDB 复 ###
### 配置 MariaDB 复 ###
你需要在主点服务器上编辑 my.cnf文件来启用二进制日志以及设置服务器id。我会使用vi文本编辑器但你可以使用任何你喜欢的例如nanojoe。
你需要在主点服务器上编辑 my.cnf文件来启用二进制日志以及设置服务器id。我会使用vi文本编辑器但你可以使用任何你喜欢的例如nanojoe。
sudo vi /etc/my.cnf
@ -159,7 +163,7 @@ SOME_ROOT_PASSWORD - 你的 root 密码。 例如我用"q"作为密码,然后
binlog-format=row
server_id=1
输出:
输出如下:
![mariadb 配置主节点](http://blog.linoxide.com/wp-content/uploads/2015/04/mariadb-config.png)
@ -173,7 +177,7 @@ sudo mysql -u root -pq test_repl
mysql> SHOW MASTER STATUS;
输出:
输出如下:
+--------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
@ -183,12 +187,12 @@ mysql> SHOW MASTER STATUS;
**记住** : "File" 和 "Position" 的值。在从节点中你需要使用这些值
创建用来复的用户
创建用来复的用户
mysql> GRANT REPLICATION SLAVE ON *.* TO replication_user IDENTIFIED BY 'bigs3cret' WITH GRANT OPTION;
mysql> flush privileges;
输出:
输出如下:
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
@ -197,7 +201,7 @@ mysql> SHOW MASTER STATUS;
mysql> select * from mysql.user WHERE user="replication_user"\G;
输出:
输出如下:
mysql> select * from mysql.user WHERE user="replication_user"\G;
*************************** 1. row ***************************
@ -220,11 +224,11 @@ mysql> SHOW MASTER STATUS;
### 从节点配置 ###
所有这些命令需要在从节点中进行
所有这些命令需要在从节点中进行
假设我们已经更新/升级了包括有最新的MariaDB服务器的 CentOS 7.x而且你可以用root账号登陆到MariaDBs服务器(这在这篇文章的第一部分已经介绍过)
假设我们已经更新/升级了包括有最新的MariaDB服务器的 CentOS 7.x而且你可以用root账号登陆到MariaDB服务器(这在这篇文章的第一部分已经介绍过)
到Maria 数据库控制台并创建数据库
到Maria 数据库控制台并创建数据库
mysql -u root -pSOME_ROOT_PASSWORD;
mysql> create database test_repl;
@ -264,7 +268,7 @@ full-dump.sql - 你在测试服务器中创建的DB Dump。
mysql> slave start;
输出:
输出如下:
Query OK, 0 rows affected (0.00 sec)
@ -272,7 +276,7 @@ full-dump.sql - 你在测试服务器中创建的DB Dump。
mysql> show slave status\G;
输出:
输出如下:
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
@ -352,7 +356,7 @@ via: http://linoxide.com/how-tos/configure-mariadb-replication-centos-linux/
作者:[Bobbin Zachariah][a]
译者:[ictlyh](https://github.com/ictlyh)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,9 +1,8 @@
sshuttle - 一个使用ssh的基于VPN的透明代理
sshuttle一个使用ssh的基于VPN的透明代理
================================================================================
sshuttle允许你通过ssh创建一条从你电脑连接到任何远程服务器的VPN连接只要你的服务器支持python2.3 或则更高的版本, 你必须有本机的root权限但是你可以在服务端有普通账户即可。
你可以在一台机器上同时运行多次sshuttle来连接到不同的服务器上这样你就可以一次使用多个VPN sshuttle可以转发你子网所有流量到VPN中。
sshuttle 允许你通过 ssh 创建一条从你电脑连接到任何远程服务器的 VPN 连接,只要你的服务器支持 python2.3 或则更高的版本。你必须有本机的 root 权限,但是你可以在服务端有普通账户即可。
你可以在一台机器上同时运行多次 sshuttle 来连接到不同的服务器上,这样你就可以同时使用多个 VPN sshuttle可以转发你子网中所有流量到VPN中。
### 在Ubuntu中安装sshuttle ###
@ -17,7 +16,7 @@ sshuttle允许你通过ssh创建一条从你电脑连接到任何远程服务器
sshuttle [options...] [-r [username@]sshserver[:port]] [subnets]
#### Option 细节 ####
#### 选项细节 ####
-r, —remote=[username@]sshserver[:port]
@ -29,9 +28,9 @@ sshuttle允许你通过ssh创建一条从你电脑连接到任何远程服务器
sudo sshuttle -r username@sshserver 0.0.0.0/0 -vv
当开始后sshuttle会创建一个ssh会话到通过-r指定的服务器。如果-r被忽略了,它会在本地运行客户端和服务端,这个有时会在测试时有用。
当开始后sshuttle会创建一个ssh会话到由-r指定的服务器。如果-r被丢了,它会在本地运行客户端和服务端,这个有时会在测试时有用。
连接到远程服务器后sshuttle会上传它的python源码到远程服务器并执行。那么你就不需要在远程服务器上安装sshuttle并且客户端和服务器端间不会存在sshuttle版本冲突。
连接到远程服务器后sshuttle会上传它的python源码到远程服务器并执行。所以你就不需要在远程服务器上安装sshuttle并且客户端和服务器端间不会存在sshuttle版本冲突。
#### 手册中的更多例子 ####
@ -86,7 +85,7 @@ via: http://www.ubuntugeek.com/sshuttle-a-transparent-proxy-based-vpn-using-ssh.
作者:[ruchi][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,22 +1,22 @@
Docker 1.6 发布 - 如何在Fedora / CentOS上面升级
如何在Fedora / CentOS上面升级Docker 1.6
=============================================================================
Docker一个为软件打包的流行开源容器平台有了新的发行版1.6增加了许多新的特性。该版本在Docker注册引擎云集组合和机器方面都有更新。这次发行旨在提升体验开发者和系统管理员的经验这里不太确定。让我们来快速看看有哪些新特性吧。
Docker一个流行的将软件打包的开源容器平台已经有了新的1.6版增加了许多新的特性。该版本主要更新了Docker Registry、Engine、 Swarm、 Compose 和 Machine等方面。这次发布旨在提升性能、改善开发者和系统管理员的体验。让我们来快速看看有哪些新特性吧。
**Docker Registry (2.0)**是一项推送Docker镜像用于存储和分享的服务经历过架构的改变因为面临加载下的体验问题。它仍然向下兼容。Docker Registry的编写语言现在从Python改为Google的Go语言了为了提升表现力。与Docker引擎1.6结合后,拉取镜像的能力更快了。早先的镜像被队列式地输送,而现在是并行的啦。
**Docker Registry (2.0)**是一项推送Docker镜像用于存储和分享的服务因为面临加载下的体验问题而经历了架构的改变。它仍然向后兼容。Docker Registry的编写语言现在从Python改为Google的Go语言了以提升性能。与Docker Engine 1.6结合后,拉取镜像的能力更快了。早先的镜像是队列式输送的,而现在是并行的啦。
**Docker Engine (1.6)**相比之前的版本有很大的提高。目前支持容器与镜像标签。通过标签,你可以附加用户自定义的元数据到镜像和容器上,而镜像和容器反过来可以被其他工具使用。标签对正在运行的应用是不可见的,可以用来加速搜索容器和镜像。
**Docker Engine (1.6)**相比之前的版本有很大的提高。目前支持容器与镜像标签。通过标签,你可以附加用户自定义的元数据到镜像和容器上,而镜像和容器反过来可以被其他工具使用。标签对正在运行的应用是不可见的,可以用来加速搜索容器和镜像。
Windows版本的Docker客户端可以连接一个远程的运行linux的Docker引擎
Windows版本的Docker客户端可以连接到远程的运行在linux上的Docker Engine
Docker目前支持日志驱动API这允许我们发送容器日志给系统如Syslog或者第三方。这将会使得系统管理员受益。
**Swarm (0.2)**是一个Docker集群工具将一个Docker主机池转换为一个虚拟主机。在新特性里容器甚至被放在了可用的节点上。通过添加更多的Docker命令所有的努力都朝着支持完整的Docker API。将来使用第三方驱动来集群会成为可能。
**Swarm (0.2)**是一个Docker集群工具可以将一个Docker主机池转换为一个虚拟主机。在新特性里容器甚至被放在了可用的节点上。通过添加更多的Docker命令努力支持完整的Docker API。将来使用第三方驱动来集群会成为可能。
**Compose (1.2)** 是一个Docker里定义和运行复杂应用的工具, 也得到了升级。在新版本里,一个可以创建多个子文件,而不是一个没有结构的文件描述一个多容器应用。
**Compose (1.2)** 是一个Docker里定义和运行复杂应用的工具, 也得到了升级。在新版本里,可以创建多个子文件,而不是一个没有结构的文件描述一个多容器应用。
通过**Machine (0.2)**,我们可以很容易地在本地计算机云和数据中心上搭建Docker主机。新的发行版为开发者提供了一个相对干净地驱动界面来写驱动。供应被Machine牢牢地掌握而不是每个独立的驱动。新的命令被添加可以用来生成主机的TLS证书以提高安全性。
通过**Machine (0.2)**,我们可以很容易地在本地计算机、云和数据中心上搭建Docker主机。新的发布版本为开发者提供了一个相对干净地驱动界面来编写驱动。Machine集中控制供给而不是每个独立的驱动。增加了新的命令可以用来生成主机的TLS证书以提高安全性。
### 在Fedora / CentOS 上升级架构 ###
### 在Fedora / CentOS 上的升级指导 ###
在这一部分里我们将会学习如何在Fedora和CentOS上升级已有的docker到最新版本。请注意目前的Docker仅运行在64位的架构上Fedora和CentOS都源于RedHat命令的使用是差不多相同的除了在Fedora20和CentOS6.5里Docker包被叫做“docker-io”。
@ -28,7 +28,7 @@ Docker目前支持日志驱动API这允许我们发送容器日志给系统
在升级之前备份一下docker镜像和容器卷是个不错的主意。
参考[filesystem to a tar archive][1]与[volumes backups, restores or migrations options][2],获取更多信息。
参考[“将文件系统打成 tar 包”][1]与[“卷备份、恢复或迁移”][2],获取更多信息。
目前测试系统安装了Docker1.5。样例输出显示是来自一个Fedora20的系统。
@ -42,7 +42,7 @@ Docker目前支持日志驱动API这允许我们发送容器日志给系统
[root@TestNode1 ~]# sudo systemctl stop docker
升级到最新版使用yum update。但是写这篇文章的时候仓库并不是最新版本(1.6)。因此你需要使用二进制的升级方法。
使用yum update升级到最新版但是写这篇文章的时候仓库并不是最新版本(1.6)因此你需要使用二进制的升级方法。
[root@TestNode1 ~]#sudo yum -y update docker-io
@ -66,7 +66,7 @@ Docker目前支持日志驱动API这允许我们发送容器日志给系统
2015-04-19 13:40:50 (8.72 MB/s) - /usr/bin/docker saved
检查更新版本
检查更新后的版本
[root@TestNode1 ~]#sudo docker -v
@ -88,7 +88,7 @@ Docker目前支持日志驱动API这允许我们发送容器日志给系统
Hello World
CentOS安装时需要**注意**在CentOS上安装完Docker后当你试图启动Docker服务的时候你可能会得到错误的信息如下所示
CentOS安装时需要**注意**在CentOS上安装完Docker后当你试图启动Docker服务的时候你可能会得到错误的信息如下所示
docker.service - Docker Application Container Engine
@ -116,7 +116,7 @@ CentOS安装时需要**注意**在CentOS上安装完Docker后当你试图
Apr 20 03:24:24 centos7 systemd[1]: Unit docker.service entered failed state.
这是一个熟知的bug[https://bugzilla.redhat.com/show_bug.cgi?id=1207839][3]),需要一个设备映射的升级,到最新的水平
这是一个已知的bug[https://bugzilla.redhat.com/show_bug.cgi?id=1207839][3]),需要将设备映射升级到最新
[root@centos7 ~]# rpm -qa device-mapper
@ -132,7 +132,7 @@ CentOS安装时需要**注意**在CentOS上安装完Docker后当你试图
### 总结 ###
尽管docker技术出现时间不长当很快获得了流行。它使得开发者的生活变得容易运维团队可以快速独立地创建和部署应用。通过公司发布快速的Docker更新来提升产品质量满足用户需求未来对于Docker来说一片光明。
尽管docker技术出现时间不长但很快就变得非常流行了。它使得开发者的生活变得轻松运维团队可以快速独立地创建和部署应用。通过该公司的发布Docker的快速更新产品质量的提升满足用户需求未来对于Docker来说一片光明。
--------------------------------------------------------------------------------
@ -140,7 +140,7 @@ via: http://linoxide.com/linux-how-to/docker-1-6-features-upgrade-fedora-centos/
作者:[B N Poornima][a]
译者:[wi-cuckoo](https://github.com/wi-cuckoo)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,21 +1,16 @@
Translating by H-mudcup
Synfig Studio 1.0 —— 开源动画动真格的了
Synfig Studio 1.0:开源动画动真格的了
================================================================================
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/04/synfig-free-animations-750x467.jpg)
**现在可以下载 Synfig Studio 这个自由、开源的2D动画软件的全新版本了。 **
第一次发行这个跨平台的软件一年以后Synfig Studio 1.0 带着一套全新改和改进过的功能,实现它所承诺的“创造电影级别的动画的产业级解决方案”。
这个跨平台的软件首次发行一年之后Synfig Studio 1.0 带着一套全新改进过的功能,实现它所承诺的“创造电影级的动画的工业级解决方案”。
在众多功能之上的是一个改进过的用户界面,据工程开发者说那是个用起来‘更简单’、‘更直观’的界面。客户端添加了新的**单窗口模式**,让界面更整洁,而且**为了使用最新的 GTK3 库而被**。
在众多功能之上的是一个改进过的用户界面,据项目开发者说那是个用起来‘更简单’、‘更直观’的界面。客户端添加了新的**单窗口模式**,让界面更整洁,而且**使用最新的 GTK3 库重制**。
在功能方面有几个值得注意的变化,包括新加的全功能骨骼系统。
这套**关节和转轴的‘骨骼’构架**非常适合2D剪纸动画再配上这个版本新加的复杂的变形控制系统或是 Synfig 受欢迎的‘关键帧自动插入’(阅读:画面与画面间的变形)应该会变得非常有效率的。
youtube视频
<iframe width="750" height="422" frameborder="0" allowfullscreen="" src="https://www.youtube.com/embed/M8zW1qCq8ng?feature=oembed"></iframe>
这套**关节和转轴的‘骨骼’构架**非常适合2D剪纸动画再配上这个版本新加的复杂的变形控制系统或是 Synfig 受欢迎的关键帧自动插入帧到帧之间的变形应该会变得非常有效率的。youtube视频 https://www.youtube.com/M8zW1qCq8ng
新的无损剪切工具,摩擦力效果和对逐帧位图动画的支持,可能会有助于释放开源动画师们的创造力,更别说新加的用于同步动画的时间线和声音的声效层!
@ -23,18 +18,18 @@ Synfig Studio 1.0 —— 开源动画动真格的了
Synfig Studio 并不是任何人都能用的工具套件,这最新发行版的最新一批改进应该能吸引一些动画制作者试一试这个软件。
If you want to find out what open-source animation software is like for yourself, you can grab an installer for Ubuntu for the latest release direct from the projects page using the links below. 如果你想看看开源动画制作软件是什么样的,你可以通过下面的链接直接从工程的 Sourceforge 页下载一个适用于 Ubuntu 的最新版本的安装器。
如果你想看看开源动画制作软件是什么样的,你可以通过下面的链接直接从工程的 Sourceforge 页下载一个适用于 Ubuntu 的最新版本的安装器。
- [Download Synfig 1.0 (64bit) .deb Installer][1]
- [Download Synfig 1.0 (32bit) .deb Installer][2]
- [下载 Synfig 1.0 (64bit) .deb 安装器][1]
- [下载 Synfig 1.0 (32bit) .deb 安装器][2]
--------------------------------------------------------------------------------
via: http://www.omgubuntu.co.uk/2015/04/synfig-studio-new-release-features
作者:[oey-Elijah Sneddon][a]
作者:[Joey-Elijah Sneddon][a]
译者:[H-mudcup](https://github.com/H-mudcup)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,25 +1,26 @@
Bodhi Linux引入Moksha桌面
Bodhi Linux引入 Moksha 桌面
================================================================================
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Bodhi_Linux.jpg)
基于Ubuntu的轻量级Linux发行版[Bodhi Linux][1]致力于构建其自家的桌面环境这个全新桌面环境被称之为Moksha梵文意为完全自由。Moksha将替换常用的[Enlightenment桌面环境][2]。
基于Ubuntu的轻量级Linux发行版[Bodhi Linux][1]致力于构建其自家的桌面环境这个全新桌面环境被称之为Moksha梵文意为完全自由。Moksha将替换其原来的[Enlightenment桌面环境][2]。
### 为何用Moksha替换Englightenment ###
Bodhi Linux的Jeff Hoogland最近[表示][3]了他对新版Enlightenment的不满。直到E17,Enlightenment都十分稳定并且能满足轻量级Linux的部署需求。而E18则到处都充满了问题Bodhi Linux只好弃之不用了。
Bodhi Linux的Jeff Hoogland最近[表示][3]了他对新版Enlightenment的不满。直到E17Enlightenment都十分稳定并且能满足轻量级Linux的部署需求。而E18则到处都充满了问题Bodhi Linux只好弃之不用了。
虽然最新的[Bodhi Linux 3.0发行版][4]仍然使用了E19作为其桌面除传统模式外这意味着对于旧的硬件仍然会使用E17Jeff对E19也十分不满。他说道
>除了性能问题外对于我个人而言E19并没有给我带来与E17下相同的工作流程因为它移除了很多E17的特性。鉴于此我不得不将我所有的3台Bodhi计算机桌面改成E17——这3台机器都是我高端的了。这不由得让我想到我们还有多少现存的Bodhi用户也怀着和我同样的感受所以我[在我们的用户论坛上开启一个与此相关的讨论][5]。
> 除了性能问题外对于我个人而言E19并没有给我带来与E17下相同的工作流程因为它移除了很多E17的特性。鉴于此我不得不将我所有的3台Bodhi计算机桌面改成E17——这3台机器都是我高端的了。这不由得让我想到我们还有多少现存的Bodhi用户也怀着和我同样的感受所以我[在我们的用户论坛上开启一个与此相关的讨论][5]。
### Moksha是E17桌面的延续 ###
Moksha将会是Bodhi所热衷的E17桌面的延续。Jeff进一步提到
>我们将从整合所有Bodhi修改开始。多年来我们一直都只是给源代码打补丁并修复桌面所具有的问题。如果该工作完成我们将开始移植一些E18和E19引入的更为有用的特性最后我们将引入一些我们认为会改善最终用户体验的东西。
> 我们将从整合所有Bodhi修改开始。多年来我们一直都只是给源代码打补丁并修复桌面所带有的问题。如果该工作完成我们将开始移植一些E18和E19引入的更为有用的特性最后我们将引入一些我们认为会改善最终用户体验的东西。
### Moksha何时发布 ###
下一个Bodhi更新将会是Bodhi 3.1.0,就在今年八月。这个新版本将为所有其缺省ISO带来Moksha。让我们拭目以待看看Moksha是否是一个好的决定。
下一个Bodhi更新将会是Bodhi 3.1.0,就在今年八月。这个新版本将为所有其默认安装镜像带来Moksha。让我们拭目以待看看Moksha是否是一个好的决定。
--------------------------------------------------------------------------------
@ -27,7 +28,7 @@ via: http://itsfoss.com/bodhi-linux-introduces-moksha-desktop/
作者:[Abhishek][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,121 @@
一个用于Gnome桌面的下拉式终端 Guake 0.7.0 发布
================================================================================
Linux的命令行是最好、最强大的东西它使新手着迷并为老手和极客的提供极其强大的功能。那些在服务器和生产环境下工作的人早已认识到了这个事实。有趣的是Linux终端是Linus Torvald在1991年写内核时实现的第一批功能之一。
终端是个强大的工具由于它没有什么可调整的部分所以十分可靠。终端介于控制台环境和GUI环境之间。终端自身作为一个GUI程序运行在桌面环境下。有许多终端是适用于特定的桌面环境的其它的则是通用的。Terminator, Konsole, Gnome-Terminal, Terminology, XFCE terminal, xterm都是些常用的终端模拟器。
您可以从下面的链接中获得一份使用最广泛的终端模拟器的列表。
- [20 Useful Terminals for Linux][1]
前几日上网时我偶遇了名为Guake的终端程序它是用于gnome的终端模拟器。尽管这并不是我第一次听到Guake。实际上我在大约一年前便知道了这个应用程序但不知怎么搞的我那时没有写写Guake再后来我便渐渐忘掉了Guake直到我再一次听到Guake。所以最终这篇文章诞生了。我将给你讲讲Guake的功能在Debian、Ubuntu、Fedora上的安装过程以及一些测试。
#### 什么是Guake ####
Guake是应用于Gnome环境的下拉式终端。主要由Python编写使用了一些C它以GPL2+许可证发布适用于Linux以及类似的系统。Guake的灵感来源于电脑游戏Quake雷神之锤中的终端Quake的终端能通过按下特定按键默认为F12从屏幕上滑下来并在按下同样的键后滑上去。
值得注意的是Guake并不是第一个这样的应用。YakuakeYet Another Kuake是一个运行于KDE的终端模拟器Tilda是一个用GTK+写成的终端模拟器。它们的灵感都来自于雷神之锤那上下滑动的终端。
#### Guake的功能 ####
- 轻量级
- 简单而优雅
- 功能众多
- 强大
- 美观
- 将终端平滑地集成于GUI中
- 在按下预定义的键后出现/消失
- 支持热键、标签、透明化背景这使得它适合所有Gnome用户
- 可配置各种方面
- 包括许多颜色的调色板
- 设定透明度的快捷方式
- 通过Guake配置可在启动时运行一个脚本
- 可以在多个显示器上运行
Guake 0.7.0最近发布,它带来了一些修正以及上面提到的一些功能。完整的版本历史和源代码包可以在[这里][2]找到。
### 在Linux中安装Guake终端 ###
如果您对从源码编译Guake感兴趣您可以从上面的链接处下载Guake并在安装前进行编译。
然而Guake可以在许多的发行版中通过添加额外的仓库来安装。这里我们将在Debian、Ubuntu、Linux Mint和Fedora下安装Guake。
首先从仓库获取最新的软件包列表并从默认的仓库安装Guake如下所示
---------------- 在 Debian, Ubuntu 和 Linux Mint 上 ----------------
$ sudo apt-get update
$ apt-get install guake
----------
---------------- 在 Fedora 19 及其以后版本 ----------------
# yum update
# yum install guake
安装后可以从另一个终端中启动Guake
$ guake
在启动它后便可以在Gnome桌面中使用F12默认配置来拉下、收回终端。
看起来非常漂亮,尤其是透明背景。滑下来...滑上去...滑下来...滑上去...执行命令,打开另一个标签,执行命令,滑上去...滑下来...(作者已沉迷其中)
![Guake Terminal in Action](http://www.tecmint.com/wp-content/uploads/2015/05/Guake.png)
*Guake实战*
如果您的壁纸或活动窗口的颜色和Guake的颜色有些不搭。您可以改变您的壁纸减少透明度或者改变Guake的颜色。
下一步便是进入Guake的配置根据每个人的需求修改设置。可以通过应用菜单或者下面的命令来运行Guake的配置。
$ guake --preferences
![Guake Terminal Properties](http://www.tecmint.com/wp-content/uploads/2015/05/Guake-Properties.png)
*Guake终端配置*
设置滚动
![Guake Scrolling Settings](http://www.tecmint.com/wp-content/uploads/2015/05/Guake-Scrolling.png)
*Guake滚动配置*
外观设置 - 在这里您可以修改文字颜色和背景色以及透明度。
![Appearance Properties](http://www.tecmint.com/wp-content/uploads/2015/05/Appearance-Properties.png)
*外观设置*
键盘快捷键 - 在这里您可以修改Guake显示的开关快捷键。
![Keyboard Shortcuts](http://www.tecmint.com/wp-content/uploads/2015/05/Keyboard-Shortcuts.png)
*键盘快捷键*
兼容性设置 - 基本上不必设置它。
![Compatibility Setting](http://www.tecmint.com/wp-content/uploads/2015/05/Compatibility-Setting.png)
*兼容性设置*
### 结论 ###
这个项目即不是太年轻也不是太古老因此它已经达到了一定的成熟度足够可靠可以开箱即用。像我这样需要在GUI和终端间频繁切换的人来说Guake是一个福利。我不需要管理一个多余的窗口频繁的打开和关闭使用tab在大量打开的应用程序中寻找终端或切换到不同的工作区来管理终端现在我需要的只有F12。
我认为对任何同时使用GUI和终端的Linux用户来说Guake都是必须的工具。同样的我会向任何想要在系统中结合使用GUI和终端的人推荐它因为它既平滑又没有任何障碍。
上面就是我要说的全部了。如果在安装和使用时有任何问题请告诉我我们会帮助您。也请您告诉我您使用Guake的经验。在下面的评论区反馈您宝贵的经验。点赞和分享以帮助我们宣传。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/install-guake-terminal-ubuntu-mint-fedora/
作者:[Avishek Kumar][a]
译者:[wwy-hust](https://github.com/wwy-hust)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/avishek/
[1]:http://www.tecmint.com/linux-terminal-emulators/
[2]:https://github.com/Guake/guake/releases/tag/0.7.0

View File

@ -0,0 +1,105 @@
初来乍到Linux? 你需要知道的5款好应用
================================================================================
![](http://cdn.makeuseof.com/wp-content/uploads/2015/05/linux-apps-840x420.jpg?92a7a3)
当你刚刚迈入linux的世界时你会立马动身开始使用那些知名的浏览器、云客户端、音乐播放器、邮件客户端也许还有图形编辑器对吗可是你却错过了几个非常重要的生产工具。这里将介绍给你5个应该安装的不容错过的应用。
### [Synergy][1] ###
Synergy 简直就是多桌面用户的福音。这是一个开源软件,它可以让你用一个鼠标和键盘跨越几台电脑、显示器和操作系统。在桌面之间切换鼠标和键盘非常简单,你只要把鼠标从一个桌面的边缘移向另一个桌面即可。
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/multiple-monitors-640x431.jpg?92a7a3)
当你第一次打开 Synergy它会引导你完成设置。你的主桌面就是你将与其它桌面共享输入设备的那个。将主桌面设为服务端将其它桌面设置为客户端。
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/synergy-setup-wizard-640x480.jpg?92a7a3)
Synergy 在互连的各个桌面间维持同一张粘贴板。它也将锁屏功能融合到了一起,例如,你可以跳过锁屏一次登录到所有桌面。你可以在 **Edit 菜单的 Setting** 下调整更多的设置,比如设置密码或者将 Synergy 设置成开机自启动。
LCTT 译注:这是个[自由而开源][15]的好软件,但是如果你从它的网站下载,由于商业支持的缘故,是需要付费的;当然你可以自己[下载源代码并编译][15]。)
### [BasKet Note Pads][2] ###
从某种意义上来讲,用 BasKet Note Pads就像把你的大脑刻画进计算机里一样。它把我们不经意间的想法记录下来然后任由我们去把它们组织起来。你可以在各种任务中用到 BasKet Note Pads比如记录笔记、制作脑图、记录代办事项、保存链接、管理你的发现、或者追踪项目数据。
在 BasKet Note Pads 中每个放到一个区域的主要的想法或项目被称作一个篮子basket。你可以进一步拆分成一个或多个子篮或者兄弟篮。篮子进一步分成笔记这些零零碎碎的笔记组成了一个项目。你可以自由组织它们给它们打标签和筛选它们。
该应用的双面板结构的左侧以树形结构显示了你创建的所有篮子。
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/basket-note-pads-640x480.jpg?92a7a3)
BasKet Note Pads 第一次用起来可能有点复杂,但是如果你经常用它的话,你会觉得相当顺手。当你暂时不用它时,它会退出到系统托盘,方便你下次快速打开它。
如果在 Linux 上想要一个[更简单的笔记本替代品][3]?可以试试[Springseed][4]。
### [Caffeine咖啡因][5]###
你怎样确保你的电脑不会在放一部[精彩的电影][6]中途突然休眠呢Caffeine 会帮助你解决这个问题。当然,你并不需要为你的电脑泡一杯咖啡。你只需要安装一个轻量级的指示器 —— Caffeine。只要当前你是全屏模式它就会禁用你的屏幕保护程序、锁屏程序让你的电脑不会因为没有在任务中而进入睡眠模式。
[点击下载][7]安装最新版本的 Caffeine。如果你想以[PPA的方式][8]安装,使用如下命令:
$ sudo add-apt-repository ppa:caffeine-developers/ppa
$ sudo apt-get update
$ sudo apt-get install caffeine
如果你的Ubuntu版本是14.10或者15.04(或者其它衍生版本),你还需要安装下面的依赖包:
$ sudo apt-get install libappindicator3-1 gir1.2-appindicator3-0.1
完成安装以后,将**Caffeine指示器**设置成开机自启动这样可以使指示器显示在系统托盘里。你可以右键点击托盘图标打开应用的关联菜单来开启或关闭Caffeine
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/caffeine-indicator-640x480.jpg?92a7a3)
### Easystroke ###
Easystroke 是一个将[鼠标潜力][9]开发出来的应用。通过一系列的设置,用鼠标、触摸屏、手写笔的手势来完成敲击键盘、执行命令和滚动屏幕等通用操作。在 Easystroke 里能够设置的手势相当多,而且当你看到应用的界面时,你会发现应用的引导非常清晰。
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/easystroke-record-640x480.jpg?92a7a3)
选择一个你喜欢的鼠标键开始设置手势。如果你喜欢你还可以设置辅助功能键。通过Perferences>Behavior>Gesture Button 来设置。现在到**Action**选项卡里面,把你最常用的动作记录成手势吧。
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/easytroke-actions-640x480.jpg?92a7a3)
在 Preferences 和 Advanced 选项卡中,你可以做一些其它的调整,比如将 EasyStroke 设置成自动启动,在系统托盘中显示图标,改变滚动速度。
### Guake ###
我把我最喜欢的应用放在最后。Guake 是根据第一人称射击视屏游戏 [Quake][10] 模仿而来的下拉式命令行终端。不管你是否在[学习命令行终端][11]或者是有一定的基础Guake 都可以将终端变得更加方便。你可以一键将它呼出,也可以一键将它隐藏。
就像下面这张图当打开时Guake 的界面会覆盖在当前的屏幕上。你可以在终端中右键点击,调出 Preference 来改变 Guake 的界面,滚动方式,快捷键等等。
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/guake-terminal-640x480.jpg?92a7a3)
如果[你的桌面][12]是 KDE你可以选择一个类似的工具——[Yakuake][13].
### 写下你最喜欢的Linux新发现###
还有更多[超级实用的 Linux 应用][14]等待被发现。放心,我们将一直关注,并把它们带到你们的生活中。
哪一个应用是你最喜欢研究的呢?哪一个是你觉得必不可少的呢?在评论里告诉给我们吧。
--------------------------------------------------------------------------------
via: http://www.makeuseof.com/tag/new-linux-5-apps-didnt-know-missing/
作者:[Akshata][a]
译者:[sevenot](https://github.com/sevenot)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.makeuseof.com/tag/author/akshata/
[1]:http://synergy-project.org/
[2]:http://basket.kde.org/
[3]:http://www.makeuseof.com/tag/try-these-3-beautiful-note-taking-apps-that-work-offline/
[4]:http://getspringseed.com/
[5]:https://launchpad.net/caffeine
[6]:http://www.makeuseof.com/tag/popular-apps-movies-according-google/
[7]:http://ppa.launchpad.net/caffeine-developers/ppa/ubuntu/pool/main/c/caffeine/
[8]:http://www.makeuseof.com/tag/ubuntu-ppa-technology-explained/
[9]:http://www.makeuseof.com/tag/4-astounding-linux-mouse-hacks/
[10]:http://en.wikipedia.org/wiki/Quake_%28video_game%29
[11]:http://www.makeuseof.com/tag/4-ways-teach-terminal-commands-linux-si/
[12]:http://www.makeuseof.com/tag/10-top-linux-desktop-environments-available/
[13]:https://yakuake.kde.org/
[14]:http://www.makeuseof.com/tag/linux-treasures-x-sublime-native-linux-apps-will-make-want-switch/

View File

@ -0,0 +1,115 @@
Linux有问必答nginx网络服务器上如何阻止特定用户代理UA
================================================================================
> **问题** 我注意到有一些机器人经常访问我的nginx驱动的网站并且进行一些攻击性的扫描导致消耗掉了我的网络服务器的大量资源。我一直尝试着通过用户代理符串来阻挡这些机器人。我怎样才能在nginx网络服务器上阻挡掉特定的用户代理呢
现代互联网滋生了大量各种各样的恶意机器人和网络爬虫,比如像恶意软件机器人、垃圾邮件程序或内容刮刀,这些恶意工具一直偷偷摸摸地扫描你的网站,干些诸如检测潜在网站漏洞、收获电子邮件地址,或者只是从你的网站偷取内容。大多数机器人能够通过它们的“用户代理”签名字符串来识别。
作为第一道防线你可以尝试通过将这些机器人的用户代理字符串添加入robots.txt文件来阻止这些恶意软件机器人访问你的网站。但是很不幸的是该操作只针对那些“行为良好”的机器人这些机器人被设计遵循robots.txt的规范。许多恶意软件机器人可以很容易地忽略掉robots.txt然后随意扫描你的网站。
另一个用以阻挡特定机器人的途径,就是配置你的网络服务器,通过特定的用户代理字符串拒绝要求提供内容的请求。本文就是说明如何**在nginx网络服务器上阻挡特定的用户代理**。
### 在Nginx中将特定用户代理列入黑名单 ###
要配置用户代理阻挡列表请打开你的网站的nginx配置文件找到`server`定义部分。该文件可能会放在不同的地方这取决于你的nginx配置或Linux版本`/etc/nginx/nginx.conf`,`/etc/nginx/sites-enabled/<your-site>`,`/usr/local/nginx/conf/nginx.conf`,`/etc/nginx/conf.d/<your-site>`)。
server {
listen 80 default_server;
server_name xmodulo.com;
root /usr/share/nginx/html;
....
}
在打开该配置文件并找到 `server` 部分后,添加以下 if 声明到该部分内的某个地方。
server {
listen 80 default_server;
server_name xmodulo.com;
root /usr/share/nginx/html;
# 大小写敏感的匹配
if ($http_user_agent ~ (Antivirx|Arian) {
return 403;
}
#大小写无关的匹配
if ($http_user_agent ~* (netcrawl|npbot|malicious)) {
return 403;
}
....
}
如你所想,这些 if 声明使用正则表达式匹配了任意不良用户字符串并向匹配的对象返回403 HTTP状态码。
`$http_user_agent`是HTTP请求中的一个包含有用户代理字符串的变量。~’操作符针对用户代理字符串进行大小写敏感匹配,而‘~*’操作符则进行大小写无关匹配。‘|’操作符是逻辑或,因此,你可以在 if 声明中放入众多的用户代理关键字,然后将它们全部阻挡掉。
在修改配置文件后你必须重新加载nginx以激活阻挡
$ sudo /path/to/nginx -s reload
你可以通过使用带有 “--user-agent” 选项的 wget 测试用户代理阻挡。
$ wget --user-agent "malicious bot" http://<nginx-ip-address>
![](https://farm6.staticflickr.com/5333/17434036358_ef139a6b59_b.jpg)
### 管理Nginx中的用户代理黑名单 ###
目前为止我已经展示了在nginx中如何阻挡一些用户代理的HTTP请求。如果你有许多不同类型的网络爬虫机器人要阻挡又该怎么办呢
由于用户代理黑名单会增长得很大所以将它们放在nginx的server部分不是个好点子。取而代之的是你可以创建一个独立的文件在该文件中列出所有被阻挡的用户代理。例如让我们创建/etc/nginx/useragent.rules并定义以下面的格式定义所有被阻挡的用户代理的图谱。
$ sudo vi /etc/nginx/useragent.rules
----------
map $http_user_agent $badagent {
default 0;
~*malicious 1;
~*backdoor 1;
~*netcrawler 1;
~Antivirx 1;
~Arian 1;
~webbandit 1;
}
与先前的配置类似,‘~*’将匹配以大小写不敏感的方式匹配关键字,而‘~将使用大小写敏感的正则表达式匹配关键字。“default 0”行所表达的意思是任何其它文件中未被列出的用户代理将被允许。
接下来打开你的网站的nginx配置文件找到里面包含 http 的部分,然后添加以下行到 http 部分某个位置。
http {
.....
include /etc/nginx/useragent.rules
}
注意,该 include 声明必须出现在 server 部分之前(这就是为什么我们将它添加到了 http 部分里)。
现在打开nginx配置定义你的服务器的部分添加以下 if 声明:
server {
....
if ($badagent) {
return 403;
}
....
}
最后重新加载nginx。
$ sudo /path/to/nginx -s reload
现在,任何包含有`/etc/nginx/useragent.rules`中列出的关键字的用户代理将被nginx自动禁止。
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/block-specific-user-agents-nginx-web-server.html
作者:[Dan Nanni][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni

View File

@ -0,0 +1,33 @@
如何修复 “fatal error: security/pam_modules.h: No such file or directory”
================================================================================
> **问题**: 我尝试在 [某某 Linux 发行版] 上编译程序,但是出现下面的编译错误:
>
> "pam_otpw.c:27:34: fatal error: security/pam_modules.h: No such file or directory"
>
> 我怎样才能修复这个错误?
缺失的头文件 'security/pam_modules.h' 是 libpam 开发版的一部分,一个 PAM(Pluggable Authentication Modules:插入式验证模块)库。因此要修复这个错误,你需要安装 libpam 开发包,如下所示。
对于 Debian、 Ubuntu 或者 Linux Mint:
$ sudo apt-get install libpam0g-dev
对与 CentOS、 Fedora 或者 RHEL:
$ sudo yum install gcc pam-devel
现在验证缺失的头文件是否安装到了 /usr/include/security。
![](https://farm8.staticflickr.com/7751/16819069693_fa961f0d40_b.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/fatal-error-security-pam-modules.html
作者:[Dan Nanni][a]
译者:[ictlyh](https://github.com/ictlyh)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni

View File

@ -0,0 +1,26 @@
微软开源了WCF框架
================================================================================
微软于今日2015/5/20宣布了针对 .NET Core 重大开源WCFWindows Communication Foundation
如[MSDN][1]中的描述:“WCF是一个构建面向服务应用的框架。使用WCF你可以从一个服务终端给另一个发送异步消息。服务终端可以是托管在IIS中连续可用的服务的一部分也可以是托管在某个程序上的服务。服务终端可以是请求服务端数据的客户端。消息可以是一个字符或者XML也可以是复杂的二进制流。”
它的[代码放在GitHub][2]“包含了Window桌面中完整WCF框架的一部分它支持已经可用于构建Window Store上的WCF应用的库。这些主要是基于客户端方便移动设备和中间层服务器使用WCF进行通信。”
更多的关于微软开源 WCF 的细节查看[dotNETFoundation.org blog][3]的公告。
WCF听上去有点像Linux中用于进程/服务之间的进程间通讯的D-BUS。
--------------------------------------------------------------------------------
via: http://www.phoronix.com/scan.php?page=news_item&px=Microsoft-Open-Source-WCF
作者:[Michael Larabel][a]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.michaellarabel.com/
[1]:https://msdn.microsoft.com/en-us/library/ms731082%28v=vs.110%29.aspx
[2]:https://github.com/dotnet/wcf
[3]:http://www.dotnetfoundation.org/blog/wcf-is-open-source

View File

@ -0,0 +1,33 @@
Ubuntu Community Council Asks the Kubuntu Project Leader to Step Down
================================================================================
> Jonathan Riddell refuses to step down as Kubuntu leader
![](http://i1-news.softpedia-static.com/images/news2/Ubuntu-Community-Council-Asks-the-Kubuntu-Project-Leader-to-Step-Down-482384-2.jpg)
**So this just happened. Scott Kitterman, a Debian developer and member of the Kubuntu Council, decided to make public some emails where it would appear that members of the Ubuntu Community Council asks Jonathan Riddell to step down from his position as a Kubuntu Project leader.**
Jonathan Riddell, which is both a KDE and Kubuntu developer, as well as an important member of the Ubuntu community for many years now, is being accused by several members of the Ubuntu and Kubuntu community about his confrontational and aggressive behavior towards them, as [the email exchanges exposed today][1] by Scott Kitterman suggest.
Long story short, after several email exchanges, the final decision of the Ubuntu Community Council, which is also backed by Canonical and Ubuntu founder Mark Shuttleworth, was for Jonathan Riddell to step down from all his positions as a leader within the Ubuntu and Kubuntu communities, for at least 12 months, but still being able to participate to discussions as any other member.
"It is with regret that we write this email to discuss an issue that we feel is negatively impacting the Ubuntu Community. Over a long period of time Jonathan Riddell has become increasingly difficult to deal with. Jonathan raised valid issues and concerns, but reacted poorly when he received answers he did not agree with," reads the first email send to the Ubuntu Community Council regarding the "nasty" behavior of Jonathan Riddell.
### Jonathan Riddell refuses to step down as a Kubuntu Project leader ###
From the email exchanges exposed today by Scott Kitterman, who decided to write a second post on his blog, suggesting that he wants to resign from its position in the Ubuntu and Kubuntu community, it would appear that Jonathan Riddell refused to step down as a Kubuntu Project leader.
As expected, Jonathan Riddell is being backed by members of the Kubuntu Community Council, who fired back at the Ubuntu Community Council's decision to take down the Kubuntu Project leader. "Id like to thank all the Kubuntu members who just voted to re-affirm me on the Kubuntu Council," says Jonathan Riddell on [his blog][2].
--------------------------------------------------------------------------------
via: http://news.softpedia.com/news/Ubuntu-Community-Council-Asks-the-Kubuntu-Project-Leader-to-Step-Down-482384.shtml
作者:[Marius Nestor][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://news.softpedia.com/editors/browse/marius-nestor
[1]:https://skitterman.wordpress.com/
[2]:http://jriddell.org/

View File

@ -1,103 +0,0 @@
New to Linux? 5 Apps You Didnt Know You Were Missing
================================================================================
![](http://cdn.makeuseof.com/wp-content/uploads/2015/05/linux-apps-840x420.jpg?92a7a3)
When you moved to Linux, you went straight for the obvious browsers, cloud clients, music players, email clients, and perhaps image editors, right? As a result, youve missed several vital, productive tools. Heres a roundup of five umissable Linux apps that you really need to install.
### [Synergy][1] ###
Synergy is a godsend if you use multiple desktops. Its an open-source app that allows you to use a single mouse and keyboard across multiple computers, displays, and operating systems. Switching the mouse and keyboard functionality between the desktops is easy. Just move the mouse out the edge of one screen and into another.
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/multiple-monitors-640x431.jpg?92a7a3)
When you open Synergy for the first time, it will run you through the setup wizard. The primary desktop is the one whose input devices youll be sharing with the other desktops. Configure that as the server. Add the remaining computers as clients.
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/synergy-setup-wizard-640x480.jpg?92a7a3)
Synergy maintains a common clipboard across all connected desktops. It also merges the lock screen setup, i.e. you need to bypass the lock screen just once to log in to all the computers together. Under **Edit > Settings**, you can make a few more tweaks such as adding a password and setting Synergy to launch on startup.
### [BasKet Note Pads][2] ###
Using BasKet Note Pads is somewhat like mapping your brain onto a computer. It helps make sense of all the ideas floating around in your head by allowing you to organize them in digestible chunks. You can use BasKet Note Pads for various tasks such as taking notes, creating idea maps and to-do lists, saving links, managing research, and keeping track of project data.
Each main idea or project goes into a section called a basket. To split ideas further, you can have one or more sub-baskets or sibling baskets. The baskets are further broken down into notes, which hold all the bits and pieces of a project. You can group them, tag them, and filter them.
The left pane in the applications two-pane structure displays a tree-like view of all the baskets you have created.
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/basket-note-pads-640x480.jpg?92a7a3)
BasKet Note Pads might seem a little complex on day one, but youll get the hang of it soon. When youre not using it, the app sits in the system tray, ready for quick access.
Want a [simpler note-taking alternative][3] on Linux? Try [Springseed][4].
### [Caffeine][5]###
How do you ensure that your computer doesnt go to sleep right in the middle of an [interesting movie][6]? Caffeine is the answer. No, you dont need to brew a cup of coffee for your computer. You just need to install a lightweight indicator applet called Caffeine. It prevents the screen-saver, lock screen, or the Sleep mode from being activated when the computer is idle, only if the current window is in full-screen mode.
To install the applet, [download its latest version][7]. If you want to go [the ppa way][8], heres how you can:
$ sudo add-apt-repository ppa:caffeine-developers/ppa
$ sudo apt-get update
$ sudo apt-get install caffeine
On Ubuntu versions 14.10 and 15.04 (and their derivatives), youll also need to install certain dependency packages:
$ sudo apt-get install libappindicator3-1 gir1.2-appindicator3-0.1
After finishing the installation, add **caffeine-indicator** to your list of startup applications to make the indicator appear in the system tray. You can turn Caffeines functionality on and off via the apps context menu, which pops up when you right-click on the tray icon.
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/caffeine-indicator-640x480.jpg?92a7a3)
### Easystroke ###
Easystroke makes an excellent [Linux mouse hack][9]. Use it to set up a series of customized mouse/touchpad/pen gestures to simulate common actions such as keystrokes, commands, and scrolls. Setting up Easystroke gestures is straightforward enough, thanks to the clear instructions that appear at all the right moments when youre navigating the UI.
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/easystroke-record-640x480.jpg?92a7a3)
Begin by choosing the mouse button youd like to use for performing gestures. Throw in a modifier if you like. Youll find this setting under **Preferences > Behavior > Gesture Button**. Now head to the **Actions** tab and record strokes for your most commonly used actions.
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/easytroke-actions-640x480.jpg?92a7a3)
Using the **Preferences** and **Advanced** tabs, you can make other tweaks like setting Easystroke to autostart, adding a system tray icon, and changing scroll speed.
### Guake ###
I saved my favorite Linux find for last. Guake is a dropdown command line modeled after the one in the first-person shooter video game [Quake][10]. Whether youre [learning about terminal commands][11] or executing them on a regular basis, Guake is a great way to keep the terminal handy. You can bring it up or hide it in a single keystroke.
As you can see in the image below, when in action, Guake appears as an overlay on the current window. Right-click within the terminal to access the **Preferences** section, from where you can change Guakes appearance, its scroll action, keyboard shortcuts, and more.
![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/guake-terminal-640x480.jpg?92a7a3)
If KDE is your [Linux desktop of choice][12], do check out [Yakuake][13], which provides a similar functionality.
### Name Your Favorite Linux Discovery! ###
There are many more [super useful Linux apps][14] waiting to be discovered. Rest assured that well keep introducing you to them.
Which Linux app were you happiest to learn about? Which one do you consider a must-have? Tell us in the comments.
--------------------------------------------------------------------------------
via: http://www.makeuseof.com/tag/new-linux-5-apps-didnt-know-missing/
作者:[Akshata][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.makeuseof.com/tag/author/akshata/
[1]:http://synergy-project.org/
[2]:http://basket.kde.org/
[3]:http://www.makeuseof.com/tag/try-these-3-beautiful-note-taking-apps-that-work-offline/
[4]:http://getspringseed.com/
[5]:https://launchpad.net/caffeine
[6]:http://www.makeuseof.com/tag/popular-apps-movies-according-google/
[7]:http://ppa.launchpad.net/caffeine-developers/ppa/ubuntu/pool/main/c/caffeine/
[8]:http://www.makeuseof.com/tag/ubuntu-ppa-technology-explained/
[9]:http://www.makeuseof.com/tag/4-astounding-linux-mouse-hacks/
[10]:http://en.wikipedia.org/wiki/Quake_%28video_game%29
[11]:http://www.makeuseof.com/tag/4-ways-teach-terminal-commands-linux-si/
[12]:http://www.makeuseof.com/tag/10-top-linux-desktop-environments-available/
[13]:https://yakuake.kde.org/
[14]:http://www.makeuseof.com/tag/linux-treasures-x-sublime-native-linux-apps-will-make-want-switch/

View File

@ -1,71 +0,0 @@
This Ubuntu App Applies Instagram Style Filters to Your Photos
================================================================================
**Looking for an Ubuntu app to apply Instagram style filters to your photos in Ubuntu?**
Grab your selfie stick and step this way…
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/instagram-app.jpg)
XnRetro is a photo editing app
### XnRetro Photo Editor ###
**XnRetro** is a simple image editing application that lets you quickly add “Instagram like” effects to your photos.
You know the sort of effects Im talking about: scratches, noises, and frames, over processing, vintage washes and nostalgic tints (because in this age of digital transience we must know that endless selfies and sandwich snaps are unlikely to ever become nostalgic of themselves).
Whether you consider such effects to be of asinine artistic value or shortcut to being creative, these kinds of filters are popular and can help add a splash of personality to an otherwise so-so photo.
#### XnRetro Features ####
**XnRetro features the following:**
- 20 color filters
- 15 light effects (bokeh, leaks, etc)
- 28 frames and borders
- 5 Vignettes (with strength control)
- Image adjustments for contrast, gamma, saturation, etc
- Square crop option
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/Screen-Shot-2015-05-10-at-23.30.01-e1431297068833.png)
Small tweak to make light effects work
You can save edited images (in theory) as .jpg or .png files and share them straight to social media from within the app.
I say “in theory” because .jpg saving doesnt actually work in the Linux version of the app (you can save edited images as .png files though). Similarly, most of the built-in social networking links are borked or just flat out fail on export.
To get the **15 light leaks** to work you will need to re-save each .jpg image in XnRetro light folder as a .png file. Edit the light.xml to match the new file names, hit save and the light effects will load up in XnRetro without issue.
> For user-friendly image editing XnRetro is hard to beat — once you make it work.
**Is XnRetro Worth Installing?**
XnRetro is not perfect. Its is pretty old-looking, difficult to properly install and has not been updated for several years.
It does still work, barring .jpg saving, and is a nimble alternative to an advanced app like The Gimp or Shotwells set of serious image adjustment tools.
While web apps and Chrome Apps¹ like [Pixlr Touch Up][1] and [Polarr][2] offer similar features you may be looking for a truly native solution.
And for that, for user-friendly image editing based around easy-to-apply filters, XnRetro is hard to beat.
### Download XnRetro for Ubuntu ###
XnRetro is not available as an installable .deb package. It is distributed as a binary file, meaning you need to double-click on the program file run it each and every time. Its also 32-bit only.
You can download XnRetro using the link below. Once completed you need to extract the archive and enter the folder it creates. Double-click on the xnretro program binary inside.
- [Download XnRetro for Linux (32bit, tar.gz)][3]
--------------------------------------------------------------------------------
via: http://www.omgubuntu.co.uk/2015/05/instagram-photo-filters-ubuntu-desktop-app
作者:[Joey-Elijah Sneddon][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://plus.google.com/117485690627814051450/?rel=author
[1]:http://www.omgchrome.com/?s=pixlr
[2]:http://www.omgchrome.com/the-best-chrome-apps-of-2014/
[3]:http://www.xnview.com/en/xnretro/#downloads

View File

@ -0,0 +1,99 @@
3 Open Source Python Shells
================================================================================
Python is a high-level, general-purpose, structured, powerful, open source programming language that is used for a wide variety of programming tasks. It features a fully dynamic type system and automatic memory management, similar to that of Scheme, Ruby, Perl, and Tcl, avoiding many of the complexities and overheads of compiled languages. The language was created by Guido van Rossum in 1991, and continues to grow in popularity.
Python is a very useful and popular computer language. One of the benefits of using an interpreted language such as Python is exploratory programming with its interactive shell. You can try out code without having to write a script. But there are limitations with the Python shell. Fortunately, there are some excellent alternative Python shells that extend on the basic shell. They each offer an excellent interactive Python experience.
----------
### bpython ###
![](http://www.linuxlinks.com/portal/content/reviews/Programming/Screenshot-bpython.png)
bpython is a fancy interface to the Python interpreter for Linux, BSD, OS X and Windows.
The idea is to provide the user with all the features in-line, much like modern IDEs, but in a simple, lightweight package that can be run in a terminal window.
bpython doesn't seek to create anything new or groundbreaking. Instead, it brings together a few neat ideas and focuses on practicality and usefulness.
Features include:
- In-line syntax highlighting - uses Pygments for lexing the code as you type, and colours appropriately
- Readline-like autocomplete with suggestions displayed as you type
- Expected parameter list for any Python function - seeks to display a list of parameters for any function you call
- "Rewind" function to pop the last line of code from memory and re-evaluate
- Send the code you've entered off to a pastebin
- Save the code you've entered to a file
- Auto-indentation
- Python 3 support
- Website: [www.bpython-interpreter.org][1]
- Developer: Bob Farrell and contributors
- License: MIT License
- Version Number: 0.14.1
----------
### IPython ###
![](http://www.linuxlinks.com/portal/content/reviews/Programming/Screenshot-ipython.png)
IPython is an enhanced interactive Python shell. It provides a rich toolkit to help you make the most out of using Python interactively.
IPython can be used as a replacement for the standard Python shell, or it can be used as a complete working environment for scientific computing (like Matlab or Mathematica) when paired with the standard Python scientific and numerical tools. It supports dynamic object introspections, numbered input/output prompts, a macro system, session logging, session restoring, complete system shell access, verbose and colored traceback reports, auto-parentheses, auto-quoting, and is embeddable in other Python programs.
Features include:
- Powerful interactive shells (terminal and Qt-based)
- A browser-based notebook with support for code, rich text, mathematical expressions, inline plots and other rich media
- Support for interactive data visualization and use of GUI toolkits
- Flexible, embeddable interpreters to load into your own projects
- Easy to use, high performance tools for parallel computing
- Website: [ipython.org][2]
- Developer: The IPython Development Team
- License: BSD
- Version Number: 3.1
----------
### DreamPie ###
![](http://www.linuxlinks.com/portal/content/reviews/Programming/Screenshot-DreamPie.png)
DreamPie is a Python shell which is designed to be reliable and fun.
DreamPie can use just about any Python interpreter (Jython, IronPython, PyPy).
Features include:
- New concept for an interactive shell: the window is divided into the history box, which lets you view previous commands and their output, and the code box, where you write your code. This allows you to edit any amount of code, just like in your favorite editor, and execute it when it's ready. You can also copy code from anywhere, edit it and run it instantly
- The Copy code only command will copy the code you want to keep, so you can save it in a file. The code is already formatted nicely with a four-space indentation
- Automatic completion of attributes and file names
- Automatically displays function arguments and documentation
- Keeps your recent results in the result history, for later use
- Can automatically fold long outputs, so you can concentrate on what's important
- Save the history of the session as an HTML file, for future reference. You can then load the history file into DreamPie, and quickly redo previous commands
- Automatically adds parentheses and optionally quotes when you press space after functions and methods. For example, type execfile fn and get execfile("fn")
- Supports interactive plotting with matplotlib
- Xupport for Python 2.5, Python 2.6, Python 3.1, Jython 2.5, IronPython 2.6, and PyPy
- Extremely fast and responsive.
- Website: [www.dreampie.org][3]
- Developer: Noam Yorav-Raphael
- License: GNU GPL v3
- Version Number: 1.2.1
--------------------------------------------------------------------------------
via: http://www.linuxlinks.com/article/20150523032756576/PythonShells.html
作者Frazer Kline
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[1]:http://www.bpython-interpreter.org/
[2]:http://ipython.org/
[3]:http://www.dreampie.org/

View File

@ -0,0 +1,113 @@
Animated Wallpaper Adds Live Backgrounds To Linux Distros
================================================================================
**We know a lot of you love having a stylish Ubuntu desktop to show off.**
![Live Wallpaper](http://i.imgur.com/9JIUw5p.gif)
Live Wallpaper
And as Linux makes it so easy to create a stunning workspace with a minimal effort, thats understandable!
Today, were highlighting — [re-highlighting][2] for those of you with long memories — a free, open-source tool that can add extra bling your OS screenshots and screencasts.
Its called **Live Wallpaper** and (as you can probably guess) it will replace the standard static desktop background with an animated alternative powered by OpenGL.
And the best bit: it can be installed in Ubuntu very easily.
### Animated Wallpaper Themes ###
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/animated-wallpaper-ubuntu-750x383.jpg)
Live Wallpaper is not the only app of this type, but it is one of the the best.
It comes with a number of different themes out of the box.
These range from the subtle (noise) to frenetic (nexus), and caters to everything in between. Theres even the obligatory clock wallpaper inspired by the welcome screen of the Ubuntu Phone:
- Circles — Clock inspired by Ubuntu Phone with evolving circle aura
- Galaxy — Spinning galaxy that can be resized/repositioned
- Gradient Clock — A polar clock overlaid on basic gradient
- Nexus — Brightly colored particles fire across screen
- Noise — A bokeh design similar to the iOS dynamic wallpaper
- Photoslide — Grid of photos from folder (default ~/Photos) animate in/out
Live Wallpaper is **fully open-source** so theres nothing to stop imaginative artists with the know-how (and patience) from creating some slick themes of their own.
### Settings & Features ###
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/live-wallpaper-gui-settings.jpg)
Each theme can be configured or customised in some way, though certain themes have more options than others.
For example, in Nexus (pictured above) you can change the number and colour of the the pulse particles, their size, and their frequency.
The preferences app also provides a set of **general options** that will apply to all themes. These include:
- Setting live wallpaper to run on log-in
- Setting a custom background that the animation sits on
- Adjusting the FPS (including option to show FPS on screen)
- Specifying the multi-monitor behaviour
With so many options available it should be easy to create a background set up that suits you.
### Drawbacks ###
#### No Desktop Icons ####
You cant add, open or edit files or folders on the desktop while Live Wallpaper is On.
The Preferences app does list an option that will, supposedly, let you do this. It may work on really older releases but in our testing, on Ubuntu 14.10, it does nothing.
One workaround that seems to work for some users of the app on Ubuntu is setting a .png image as the custom background. It doesnt have to be a transparent .png, simply a .png.
#### Resource Usage ####
Animated wallpapers use more system resources than standard background images.
Were not talking about 50% load at all times —at least not with this app in our testing— but those on low-power devices and laptops will want to use apps like this cautiously. Use a [system monitoring tool][2] to keep an eye on CPU and GPU load.
#### Quitting the app ####
The biggest “bug” for me is the absolute lack of “quit” option.
Sure, the animated wallpaper can be turned off from the Indicator Applet and the Preferences tool but quitting the app entirely, quitting the indicator applet? Nope. To do that I have to use the pkill livewallpaper command in the Terminal.
### How to Install Live Wallpaper in Ubuntu 14.04 LTS + ###
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/terminal-command-750x146.jpg)
To install Live Wallpaper in Ubuntu 14.04 LTS and above you will first need to add the official PPA for the app to your Software Sources.
The quickest way to do this is using the Terminal:
sudo add-apt-repository ppa:fyrmir/livewallpaper-daily
sudo apt-get update && sudo apt-get install livewallpaper
You should also install the indicator applet, which lets you quickly and easily turn on/off the animated wallpaper and switch theme from the menu area, and the GUI settings tool so that you can configure each theme based on your tastes.
sudo apt-get install livewallpaper-config livewallpaper-indicator
When everything has installed you will be able to launch the app and its preferences tool from the Unity Dash.
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/live-wallpaper-app-launcher.png)
Annoyingly, the Indicator Applet wont automatically open after you install it. It does add itself to the start up list, so a quick log out > log in will get it to show.
### Summary ###
If you fancy breathing life into a dull desktop, give it a spin — and let us know what you think of it and what animated wallpapers youd love to see added!
--------------------------------------------------------------------------------
via: http://www.omgubuntu.co.uk/2015/05/animated-wallpaper-adds-live-backgrounds-to-linux-distros
作者:[Joey-Elijah Sneddon][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://plus.google.com/117485690627814051450/?rel=author
[1]:http://www.omgubuntu.co.uk/2012/11/live-wallpaper-for-ubuntu
[2]:http://www.omgubuntu.co.uk/2011/11/5-system-monitoring-tools-for-ubuntu

View File

@ -0,0 +1,65 @@
How to Develop Own Custom Linux Distribution From Scratch
================================================================================
Have you ever thought of making your own Linux Distribution? Every Linux user in their journey to Linux thought of making their own Linux distribution, at-least once. Even I was not an exception as a newbie to Linux land and have given my considerable time developing my own Linux Distribution. Developing a Linux Distribution from scratch is called Linux From Scratch (LFS)
Before starting, I concluded a few things about LFS which can be described as:
### 1. Those who want to develop their own Linux Distribution should understand the difference between Developing a Linux distribution from scratch (by scratch means starting from the beginning) or all you want is just to tweak an already available Linux Distro. ###
If you just want to tweak flash screen, customize login and preferably work on the look and feel of Linux OS, you can choose any fair Linux Distribution and customize it the way you want. Moreover a lots of tweaking tools there will help.
If you want to put all the necessary files and boot-loaders and kernel and choose what to include and what not to include and then compile everything yourselves you need to develop Linux From Scratch (LFS).
**Note**: If you just want to customize the look and feel of a Linux OS, this guide is not for you. If you really want to develop a Linux distribution from scratch and want to know where to start and other basic information, here is the guide for you.
### 2. Pros of Developing own Linux Distribution (LFS): ###
- You get to know the internal working of Linux OS.
- You develop a very flexible OS as per your need.
- Your developed OS (LFS) will be very compact as you have full control over what to include/exclude.
- You Development (LFS) will have added security.
### 3. Cons of Developing own Linux Distribution (LFS): ###
Developing a Linux OS from scratch means putting all the necessary things together and compile. This requires a lot of reading, patience and time. Also you should have a working Linux System to develop LFS and fairly enough disk space.
### 4. Interesting to know, that Gentoo/GNU Linux is closest to LFS to certain extent. Both Gentoo and LFS is the customized Linux System built entirely out from compilation of Source. ###
### 5. You should be experienced Linux user having good knowledge of package compilation, resolving dependencies, and pro in shell scripting language. Knowledge of a programming language (Preferably C) will ease things for you. Even if you are a newbie but a good learner and grasp the things quickly, you may start as well. The most important part is you should not loose your enthusiasm throughout the process of LFS development. ###
If you are not determined enough, I fear you may leave building your LFS in the middle.
### 6. Now you need a step-by-step guide, So that Linux can be developed from scratch. LFS is the official guide to develop Linux From Scratch. Our partner site tradepub has made available LFS guide to our readers and that too for free. ###
You can download the Linux From Scratch book from the below link:
[![](http://www.tecmint.com/wp-content/uploads/2015/05/Linux-From-Scratch.gif)][1]
Download: [Linux From Scratch][1]
### About: Linux From Scratch ###
This book is created by Gerard Beekmans, who is the Project Leader of LFS and Edited by Matthew Burgess and Bruse Dubbs, both of whom are Co-leader of the Project. This book is extensive and expands over 338 pages.
Having covered Introduction to LFS, Preparing for the build, Build LFS from Scratch, Setting up of Boot scripts, Making LFS Bootable followed by Appendices, it has all you want to know on LFS Project.
Also this book gives you the estimated time required for the compilation of a package. The estimated time are calculated based upon the reference of the compilation time of the first package. All the details are presented in a manner easy to understand and implement, even for newbies.
If you have plenty of time and really interested in developing your own Linux Distribution you would never want to miss a chance to download this ebook and that too for free. All you need is, to start developing your own Linux OS using this ebook along with a working Linux OS (Any Linux Distribution with enough Disk Space), Time and Enthusiasm.
If Linux fascinates you, if you want to understand Linux from scratch and want to develop your own Linux Distribution, then this is all you should know at this stage, for most of other things you may like to refer to the book, in the above link.
Also let me know your experience with the book. How ease it was to get along the elaborated LFS guide? Also if you have already Developed a LFS and want to give some tips to our readers, your feedbacks are welcome.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/create-custom-linux-distribution-from-scratch/
作者:[Avishek Kumar][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/avishek/
[1]:http://tecmint.tradepub.com/free/w_linu01/prgm.cgi

View File

@ -1,3 +1,5 @@
translating by wwy-hust
FAQ: BSD
================================================================================
![](http://www.linuxvoice.com/wp-content/uploads/2015/02/faq1-large1.png)
@ -78,4 +80,4 @@ via: http://www.linuxvoice.com/faq-bsd-2/
[1]:http://www.openbsd.org/
[2]:http://www.freebsd.org/
[3]:http://www.netbsd.org/
[4]:http://www.pcbsd.org/
[4]:http://www.pcbsd.org/

View File

@ -0,0 +1,57 @@
Is Linux Better than OS X? GNU, Open Source and Apple in History
================================================================================
> Tensions between the free software/open source community and Apple date back to the 1980s, Linux's founder called the core of Mac OS X "a piece of crap" and other anecdotes from software history.
![](http://thevarguy.com/site-files/thevarguy.com/files/imagecache/medium_img/uploads/2015/05/untitled_2.png)
Open source fans have long had a rocky relationship with Microsoft. Everyone knows that. But, in many ways, the tension between Apple and supporters of free or open source software is even starker—even if it receives much less attention in the press.
To be sure, not all open source advocates have an aversion to Apple. Anecdotally, I've seen plenty of Linux hackers sporting iPhones and iPads. In fact, some Linux users like Apple's OS X so much that they've [created a number of Linux distributions][1] designed to look just like it. (So has the [North Korean government][2], incidentally.)
But relations between the Cult of Mac and the Cult of Tux—that is, the Linux community (not to mention the other, smaller segments of the free and open source software world)—have not always been completely peaceable. And that's by no means a new phenomenon, as I'm discovering as I research the history of Linux and the Free Software Foundation.
### GNU vs. Apple ###
The ill will dates to at least the late 1980s. By June 1988, [GNU][3], the project launched by Richard Stallman to build a completely free Unix-like operating system whose source code would be freely shared, was [strongly criticizing][4] Apple's lawsuit against [Hewlett-Packard][5] (HPQ) and [Microsoft][6] (MSFT) over what Apple claimed was improper copying of the "look and feel" of the Macintosh operating system. If Apple prevailed, GNU warned, the company "will use this new power over the public to put an end to free software that could substitute for commercial software."
At the time, GNU fought against the lawsuit (which meant, ironically, that GNU was supporting Microsoft, though those were different times) by distributing "[Keep Your Lawyers Off My Computer" buttons][7]. It also urged GNU supporters to boycott Apple, warning that, even if Macintoshes seemed like good computers, Apple's success in the lawsuit could provide the company with a monopoly in the market that would greatly increase the price of computers.
Apple eventually [lost the lawsuit][8], but not until 1994, after which GNU [dropped its Apple boycott][9]. In the interim, GNU remained critical of the company. In the early 1990s, even after it began promoting GNU software programs for use on other personal computing platforms, including MS-DOS PCs, [GNU affirmed][10] that, until Apple ceased pursuing a "monopoly" over computers with user interfaces similar to those of the Macintosh, "we will not provide any support for Apple machines." (It's therefore ironic that a fair amount of the software that made it into OS X, the Unix-like operating system that Apple introduced later in the 1990s, came from GNU. But that's another story.)
### Torvalds on Jobs ###
Despite his more laissez-faire attitude toward most issues, Linus Torvalds, the creator of the Linux kernel, was no less charitable in his attitudes toward Apple than Stallman and GNU had been. In his 2001 book "Just for Fun: The Story of an Accidental Revolutionary," Torvalds described meeting with Steve Jobs circa 1997, at the latter's invitation, to discuss Mac OS X, which Apple was then developing but had not yet released publicly.
"Basically, Jobs started off by trying to tell me that on the desktop there were just two players, Microsoft and Apple, and that he thought that the best thing I could do for Linux was to get in bed with Apple and try to get the open source people behind Mac OS X," Torvalds wrote.
This courting apparently turned Torvalds off quite a bit. One point of disagreement centered on Torvalds's technical disdain for Mach, the kernel on which Apple was then building its new OS X operating system, which Torvalds called "a piece of crap. It contains all the design mistakes you can make, and managed to even make up a few of its own."
But more off-putting, apparently, was the way Jobs was approaching open source in developing OS X (which had many open source programs at its core): "He sort of played down the flaw in the setup: Who cares if the basic operating system, the real low-core stuff, is open source if you then have the Mac layer on top, which is not open source?"
All in all, Torvalds concluded, Jobs "didn't use very many arguments. He just basically took it for granted that I would be interested" in collaborating with Apple. "He was clueless, unable to imagine that there could be entire segments of the human race who weren't the least bit concerned about increasing the Mac's market share. I think he was truly surprised at how little I cared about how big a market the Mac had—or how big a market Microsoft has."
Torvalds doesn't speak for all Linux users, of course. And his views on OS X and Apple may have softened since 2001. But the fact that, in the early 2000s, the Linux community's leading figure exhibited so much disdain for Apple and the hubris of its chief says something significant about how deeply seated tensions between the Apple world and the open source/free software world are.
Both of these historical tidbits offer insight into the great debate regarding the actual value of Apple's products—whether the company thrives on the quality of the hardware and software it creates, or merely benefits from exceptional marketing acumen that allows it to sell products for much more than their non-Apple functional equivalents are worth. But I'll stay out of that debate, for now.
--------------------------------------------------------------------------------
via: http://thevarguy.com/open-source-application-software-companies/051815/linux-better-os-x-gnu-open-source-and-apple-
作者:[Christopher Tozzi][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://thevarguy.com/author/christopher-tozzi
[1]:https://www.linux.com/news/software/applications/773516-the-mac-ifying-of-the-linux-desktop/
[2]:http://thevarguy.com/open-source-application-software-companies/010615/north-koreas-red-star-linux-os-made-apples-image
[3]:http://gnu.org/
[4]:https://www.gnu.org/bulletins/bull5.html
[5]:http://www.hp.com/
[6]:http://www.microsoft.com/
[7]:http://www.duntemann.com/AppleSnakeButton.jpg
[8]:http://www.freibrun.com/articles/articl12.htm
[9]:https://www.gnu.org/bulletins/bull18.html#SEC6
[10]:https://www.gnu.org/bulletins/bull12.html

View File

@ -1,58 +0,0 @@
Unity Greeter Badges Brings Missing Session Icons to Ubuntu Login Screen
================================================================================
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/unity-greeter-badges-750x321.jpg)
**A new package available in Ubuntu 15.04 solves a petty gripe I have with the Unity Greeter: the lack of branded icons for alternative desktop sessions like Cinnamon.**
I know its a minor quibble; its a visual paper cut with minimal impact for most. But the inconsistency niggles me because Ubuntu ships with icons for a number of sessions, including Unity, GNOME and KDE. Other DEs, including some of its own flavors like Xubuntu, default to showing a plain white dot in the session switcher list and the main user pod.
The inconsistency these dots create jars, even if it is only for a fleeting moment, not just in design. Its in usability too. Branded glyphs are helpful in letting us know what session were about to log in to.
For instance, can you tell what session this is?
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/what-session-is-this-750x247.jpg)
Budgie? Maybe MATE? Could be Cinnamon…Id have to click on it and check first.
It doesnt have to be this way. The Unity Greeter is built such that the developers of desktop environments can ship badges that appear in the Greeter (and some do). But in many cases, like MATE whose packages are imported from upstream Debian, the inclination to carry an “Ubuntu-specific patch” is either not desirable or not possible.
### A Solution Is Badged ###
Experienced Debian maintainer [Doug Torrance][1] has a solution to fix this usability paper cut. Rather than rely on desktop makers themselves to add branded badges to their packages, and rather than burden Ubuntu with the responsibility of maintaining it, Torrance has created a separate unity-greeter-badges package to house them.
In assuming responsibility for providing the session glyphs directly, this package ensure that new and old window managers, session and desktops alike are catered for.
Among the 30 or so desktop environments it bundles new session badges for are:
- Xubuntu
- Cinnamon
- MATE
- Cairo-Dock
- Xmonad
- Awesome
- OpenBox
- Pantheon
The best part is that **Unity-Greeter-Badges** has been accepted into Ubuntu 15.04. That means Torrances package will be available to install directly, no PPAs or downloads needed. In not being part of a core package like the Unity Greeter it can be updated with newer icons in a more efficient and timely manner.
If youre running Ubuntu 15.04 you will find the package available to install from the Software Center in the coming days.
Dont want to wait until 15.04? Torrance has made .deb installers for Ubuntu 14.04 LTS and Ubuntu 14.10 users.
- [Download unity-greeter-badges for Ubuntu 14.04][2]
- [Download unity-greeter-badges for Ubuntu 14.10][3]
--------------------------------------------------------------------------------
via: http://www.omgubuntu.co.uk/2015/01/unity-greeter-badges-brings-missing-session-icons-ubuntu-login-screen
作者:[Joey-Elijah Sneddon][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:https://plus.google.com/117485690627814051450/?rel=author
[1]:https://launchpad.net/~profzoom
[2]:https://launchpad.net/~profzoom/+archive/ubuntu/misc/+files/unity-greeter-badges_0.1-0ubuntu1%7E201412111501%7Eubuntu14.04.1_all.deb
[3]:https://launchpad.net/~profzoom/+archive/ubuntu/misc/+files/unity-greeter-badges_0.1-0ubuntu1%7E201412111501%7Eubuntu14.10.1_all.deb

View File

@ -1,117 +0,0 @@
Translating by goreliu ...
5 Interesting Command Line Tips and Tricks in Linux Part 1
================================================================================
Are you making most out of the Linux? There are lots of helpful features which appears to be Tips and Tricks for many of Linux Users. Sometimes Tips and Tricks become the need. It helps you get productive with the same set of commands yet with enhanced functionality.
![5 Command Line Tips and Tricks](http://www.tecmint.com/wp-content/uploads/2015/03/5-Command-Line-Tips.jpg)
5 Command Line Tips and Tricks
Here we are starting a new series, where we will be writing some tips and tricks and will try to yield as more as we can in small time.
### 1. To audit the commands wed run in past, we use [history command][1]. Here is a sample output of history command. ###
# history
![history command example](http://www.tecmint.com/wp-content/uploads/2015/03/history-command.gif)
history command example
Obvious from output, the history command do not output the time stamp with the log of last executed commands. Any solution for this? Yeah! Run the below command.
# HISTTIMEFORMAT="%d/%m/%y %T "
# history
If you want to permanently append this change, add the below line to `~/.bashrc`.
export HISTTIMEFORMAT="%d/%m/%y %T "
and then, from terminal run,
# source ~/.bashrc
Explanation of commands and switches.
- history GNU History Library
- HISTIMEFORMAT Environmental Variable
- %d Day
- %m Month
- %y Year
- %T Time Stamp
- source in short send the contents of file to shell
- .bashrc is a shell script that BASH runs whenever it is started interactively.
![history Command Logs](http://www.tecmint.com/wp-content/uploads/2015/03/History-Command-Logs.gif)
history Command Logs
### 2. The next gem in the list is how to check disk write speed? Well one liner dd command script serves the purpose. ###
# dd if=/dev/zero of=/tmp/output.img bs=8k count=256k conv=fdatasync; rm -rf /tmp/output.img
![dd Command Example](http://www.tecmint.com/wp-content/uploads/2015/03/dd-Command-Example.gif)
dd Command Example
Explanation of commands and switches.
- dd Convert and Copy a file
- if=/dev/zero Read the file and not stdin
- of=/tmp/output.img Write to file and not stdout
- bs Read and Write maximum upto M bytes, at one time
- count Copy N input block
- conv Convert the file as per comma separated symbol list.
- rm Removes files and folder
- -rf (-r) removes directories and contents recursively and (-f) Force the removal without prompt.
### 3. How will you check the top six files that are eating out your space? A simple one liner script made from [du command][2], which is primarily used as file space usages. ###
# du -hsx * | sort -rh | head -6
![Check Disk Space Usage](http://www.tecmint.com/wp-content/uploads/2015/03/check-disk-space-usage.gif)
Check Disk Space Usage
Explanation of commands and switches.
- du Estimate file space usages
- -hsx (-h) Human Readable Format, (-s) Summaries Output, (-x) One File Format, skip directories on other file format.
- sort Sort text file lines
- -rf (-r) Reverse the result of comparison, (-f) Ignore case
- head output first n lines of file.
### 4. The next step involves statistics in terminal of a file of every kind. We can output the statistics related to a file with the help of stat (output file/fileSystem status) command. ###
# stat filename_ext (viz., stat abc.pdf)
![Check File Statistics](http://www.tecmint.com/wp-content/uploads/2015/03/Check-File-Statistics.gif)
Check File Statistics
### 5. The next and last but not the least, this one line script is for those, who are newbies. If you are an experienced user you probably dont need it, unless you want some fun out of it. Well newbies are Linux-command-line phobic and the below one liner will generate random man pages. The benefit is as a newbie you always get something to learn and never get bored. ###
# man $(ls /bin | shuf | head -1)
![Generate Random Man Pages](http://www.tecmint.com/wp-content/uploads/2015/03/Generate-Random-Man-Pages.gif)
Generate Random Man Pages
Explanation of commands and switches.
- man Linux Man pages
- ls Linux Listing Commands
- /bin System Binary file Location
- shuf Generate Random Permutation
- head Output first n line of file.
Thats all for now. If you know any such tips and tricks you may share with us and we will post the same in your words on our reputed Tecmint.com website.
If you want to share any tips and tricks that you cannot make into article you may share it at tecmint[dot]com[at]gmail[dot]com and we will include it in our article. Dont forget to provide us with your valuable feedback in the comments below. Keep connected. Like and share us and help us get spread.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/5-linux-command-line-tricks/
作者:[Avishek Kumar][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/avishek/
[1]:http://www.tecmint.com/history-command-examples/
[2]:http://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/

View File

@ -1,144 +0,0 @@
How to share a directory with Samba on Fedora or CentOS
================================================================================
Nowadays sharing data across different computers is not something new at home or many work places. Riding on this trend, modern operating systems make it easy to share and exchange data transparently across computers via network file systems. If your work environment involves a mix of Microsoft Windows and Linux computers, one way to share files and folders among them is via SMB/CIFS, a cross-platform network file sharing protocol. Windows Microsoft natively supports SMB/CIFS, while Linux offers free software implementation of SMB/CIFS network protocol in Samba.
In this article, we will demonstrate **how to share a directory using Samba**. The Linux platform we will use is **Fedora or CentOS**. This article is dividied into four parts. First, we will install Samba under Fedora/CentOS environment. Next, we discuss how to adjust SELinux and firewall configurations to allow file sharing with Samba. Finally, we cover how to enable Samba to share a directory.
### Step One: Install Samba on Fedora or CentOS ###
First thing first. Let's install Samba and configure basic settings.
Check whether Samba application is already installed on your system by running:
$ rpm -q samba samba-common samba-client
If the above command doesn't show anything at all, it means that Samba is not installed. In that case, install Samba using the command below.
$ sudo yum install samba samba-common samba-client
Next, creates a local directory which will share data over network. This directory will be exported to remote users as a Samba share. In this tutorial, we will create this directory in the top-level directory '/', so make sure that you have the privileges to do it.
$ sudo mkdir /shared
If you want to create a shared directory inside your home directory (e.g., ~/shared), you must activate Samba home directory sharing in the SELinux options, which will be described below in more detail.
After creating /shared directory, set the privileges of the directory so other users can access it.
$ sudo chmod o+rw /shared
If you don't want other users to be able to have write to the directory, just remove the 'w' option in chmod command as follows.
$ sudo chmod o+r /shared
Next, create one empty file as a test. This file will be used to verify that he Samba share is mounted properly.
$ sudo touch /shared/file1
### Step Two: Configure SELinux for Samba ###
Next, we need to re-configure SELinux which is enabled by default in Fedora and CentOS distributions. SELinux allows Samba to read and modify files or directories only when they have the right security context (e.g., labeled with the 'samba_share_t' attribute).
The following command adds the necessary label to file-context configuration:
$ sudo semanage fcontext -a -t samba_share_t "<directory>(/.*)?"
Replace the <directory> with the local directory we created earlier for Samba share (e.g., /shared):
$ sudo semanage fcontext -a -t samba_share_t "/shared(/.*)?"
To activate the label change, we then must run the restorecon command like below.
$ sudo restorecon -R -v /shared
![](https://farm9.staticflickr.com/8584/16652774078_2055f45f70_b.jpg)
To share a directory inside our home directory via Samba, we must enable sharing home directory option in SELinux because it is disabled by default. The following command achieves the desired effect. Skip this step if you are not sharing your home directory.
$ sudo setsebool -P samba_enable_home_dirs 1
### Step Three: Configure Firewall for Samba ###
The next step is to open necessary TCP/UDP ports in the firewall settings for Samba to operate.
If you are using firewalld (e.g., on Fedora or CentOS 7), the following command will take care of permanent firewall rule change for Samba service.
$ sudo firewall-cmd --permanent --add-service=samba
If you are using iptables for your firewall (e.g., CentOS 6 or earlier), use the following commands to open up necessary Samba ports to the world.
$ sudo vi /etc/sysconfig/iptables
----------
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 445 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
Then restart iptables service:
$ sudo service iptables restart
### Step Four: Change Samba Configuration ###
The last step is to configure Samba to export a created local directory as a Samba-share.
Open the Samba configuration file with a text editor, and add the following lines at the bottom of the file.
$ sudo nano /etc/samba/smb.conf
----------
[myshare]
comment=my shared files
path=/shared
public=yes
writeable=yes
In the above the text inside a pair of brackets (e.g., "myshare") is the name of the Samba-shared resource, which will be used to access the Samba share from a remote host.
Create a Samba user account which is required to mount and export the Samba file system. To create a Samba user, use the smbpasswd tool. Note that the Samba user account must be the same as any existing Linux user. If you try to add a non-existing user with smbpasswd, it will give an error message.
If you don't want to use any existing Linux user as a Samba user, you can create a new dedicated user in your system. For safety, set the new user's login shell to /sbin/nologin, and do not create its home directory.
In this example, we are creating a new user named "sambaguest" as follows.
$ sudo useradd -M -s /sbin/nologin sambaguest
$ sudo passwd sambaguest
![](https://farm9.staticflickr.com/8702/16814479366_53f540d3ba_b.jpg)
After creating a new user, add the user as a Samba user using smbpasswd command. When this command asks a password, you can type a different password than the user's password.
$ sudo smbpasswd -a sambaguest
4. Activate the Samba service, and check whether the Samba service is running or not.
$ sudo systemctl enable smb.service
$ sudo systemctl start smb.service
$ sudo systemctl is-active smb
![](https://farm8.staticflickr.com/7607/16652984770_622f24bccc_b.jpg)
To see the list of shared directories in Samba, type the following command.
$ smbclient -U sambaguest -L localhost
![](https://farm8.staticflickr.com/7281/16220411103_06bf585901_b.jpg)
The following is a screenshot of accessing the Samba-shared directory on Thunar file manager, and doing copy-paste of file1. Note that the Samba share is accessible via "smb://<samba-server-IP-address>/myshare" address on Thunar.
![](https://farm8.staticflickr.com/7644/16218011174_c8b34fcedc_b.jpg)
--------------------------------------------------------------------------------
via: http://xmodulo.com/share-directory-samba-fedora-centos.html
作者:[Kristophorus Hadiono][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://xmodulo.com/author/kristophorus

View File

@ -1,159 +0,0 @@
Sleuth Kit - Open Source Forensic Tool to Analyze Disk Images and Recover Files
================================================================================
SIFT is a Ubuntu based forensics distribution provided by SANS Inc. It consist of many forensics tools such as Sleuth kit / Autopsy etc . However, Sleuth kit/Autopsy tools can be installed on Ubuntu/Fedora distribution instead of downloading complete distribution of SIFT.
Sleuth Kit /Autopsy is open source digital forensics investigation tool which is used for recovering the lost files from disk image and analysis of images for incident response. Autopsy tool is a web interface of sleuth kit which supports all features of sleuth kit. This tool is available for both Windows and Linux Platforms.
### Install Sleuth kit ###
First of all, download Sleuth kit software from [sleuthkit][1] website. Use wget command to download it in terminal which is shown in the figure.
# wget http://cznic.dl.sourceforge.net/project/sleuthkit/sleuthkit/4.1.3/sleuthkit-4.1.3.tar.gz
![Download Sleuth Kit](http://blog.linoxide.com/wp-content/uploads/2015/03/download-sleuthkeit.png)
Extract the sleuthkit-4.1.3.tar.gz using following command and go inside the extracted directory
# tar -xvzf sleuthkit-4.1.3.tar.gz
![Extraction Process](http://blog.linoxide.com/wp-content/uploads/2015/03/extract.png)
Run following command which perform the requirement check before sleuth kit installation
#./configure
![configure](http://blog.linoxide.com/wp-content/uploads/2015/03/configure.png)
Make command compile the sleuth kit code.
#make
![make](http://blog.linoxide.com/wp-content/uploads/2015/03/make.png)
Finally following command install it under **/usr/local** path.
#make install
![make install](http://blog.linoxide.com/wp-content/uploads/2015/03/make-install.png)
### Install Autopsy Tool ###
Sleuth kit installation is complete and now we will install autopsy interface. Download Autopsy software from [sleuthkit's autopsy page][2] . Use wget command to download it in terminal which is shown in the figure.
# wget http://kaz.dl.sourceforge.net/project/autopsy/autopsy/2.24/autopsy-2.24.tar.gz
![Autpsy download link](http://blog.linoxide.com/wp-content/uploads/2015/03/autopsy.png)
Extract the autopsy-2.24.tar.gz using following command and go inside the extracted directory
# tar -xvzf autopsy-2.24.tar.gz
![Autopsy Extraction](http://blog.linoxide.com/wp-content/uploads/2015/03/Autopsy-extraction.png)
Configuration script of autopsy asks for NSRL (National Software Reference Library) and path of **Evidence_Locker** folder.
Enter "n" for NSRL prompt and create Evidence_Locker folder under **/usr/local** directory. Autopsy stores the configuration files, audit logs and output under Evidence_Locker folder.
#mkdir /usr/local/Evidence_Locker
#cd autopsy-2.24
#./configure
![Autopsy Configuration Script](http://blog.linoxide.com/wp-content/uploads/2015/03/autopsy-configuration.png)
After adding Evidence_Locker path in installation process , autopsy stores configuration files in it and shows a following message to run the autopsy program.
![Start Autopsy](http://blog.linoxide.com/wp-content/uploads/2015/03/start-autopsy.png)
Type **./autopsy** command in terminal to start the graphical interface of Sleuth kit tool.
![Autopsy Started](http://blog.linoxide.com/wp-content/uploads/2015/03/autopsy-started.png)
Type following address in the web browser to access the interface of autopsy .
http://localhost:9999/autopsy
Main web page of autopsy plugin is shown int the following figure.
![Main Page](http://blog.linoxide.com/wp-content/uploads/2015/03/main-interface.png)
Click on the **New Case** button to start analysis in autopsy tool. Enter the case name, description about the investigation and name of agent which is shown in the following figure.
![create new case](http://blog.linoxide.com/wp-content/uploads/2015/03/create-new-case1.png)
Following web page will appear after entering the details in the above page. Click on **Add Host** button to add details for the analyst machine.
![add host](http://blog.linoxide.com/wp-content/uploads/2015/03/add-host1.png)
Enter host name, description and time zone setting of analyst machine on the next page.
![add host-detial](http://blog.linoxide.com/wp-content/uploads/2015/03/add-host-detial.png)
Click on the **Add Image** button to add image file for forensics analysis.
![add image](http://blog.linoxide.com/wp-content/uploads/2015/03/add-image.png)
Click on the **Add Image File** button on the following web page. It opens new web page which require Path of image file and select type & importing method.
![Add image file](http://blog.linoxide.com/wp-content/uploads/2015/03/Add-image-file.png)
As shown in the following figure, we have entered path of Linux image file. In our case, image file is partition of disk.
![add image parition](http://blog.linoxide.com/wp-content/uploads/2015/03/add-image-parition.png)
Click on the next button and select **Calculate hash** option in the next page which is shown in the following figure. It also detect the file system type of the given image.
![image and file system detail](http://blog.linoxide.com/wp-content/uploads/2015/03/image-and-file-system-detail.png)
Following window shows the MD5 hash of the image file before static analysis .
![hash](http://blog.linoxide.com/wp-content/uploads/2015/03/hash1.png)
On the next web page, autopsy shows following information about the image file.
- mount point for the image
- name of image
- file system type of given image
Click on the **details** button to get more information about the given image file. It also offer extraction of unallocated fragments and strings from the volume of image file which is shown in the following figure.
![Image detail](http://blog.linoxide.com/wp-content/uploads/2015/03/image-details.png)
Click on **Analyze** button which is shown in the below figure to start analysis on given image . It opens another page which shows the multiple options for image analysis.
![analysis](http://blog.linoxide.com/wp-content/uploads/2015/03/analysis1.png)
Autopsy offer following features during image analysis process.
- File Analysis
- Keyword Search
- File Type
- Image Details
- Data Unit
File Analysis on given image of Linux partition is shown in the following figure.
![Analysis of image](http://blog.linoxide.com/wp-content/uploads/2015/03/Analysis-of-image.png)
It extracts all files and folders from the given image . Extraction of deleted files are shown int he figure.
![Deleted Files](http://blog.linoxide.com/wp-content/uploads/2015/03/deleted.png)
### Conclusion ###
Hopefully this article will be useful for the beginner in static forensics analysis of disk image. Autopsy is web interface for sleuth kit which provides features such as extraction of strings , recovery of deleted files, timeline analysis, extraction of web surfing history, keyword search and email analysis on windows and linux disk images.
--------------------------------------------------------------------------------
via: http://linoxide.com/ubuntu-how-to/autopsy-sleuth-kit-installation-ubuntu/
作者:[nido][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/naveeda/
[1]:http://www.sleuthkit.org/sleuthkit/download.php
[2]:http://www.sleuthkit.org/autopsy/download.php

View File

@ -1,163 +0,0 @@
7 Quirky ls Command Tricks Every Linux User Should Know
================================================================================
We have covered most of the things on ls command in last two articles of our Interview series. This article is the last part of the ls command series. If you have not gone through last two articles of this series you may visit the links below.
注:以下三篇都做过源文,看看翻译了没有,如果发布了可适当改链接地址
- [15 Basic ls Command Examples in Linux][]
- [15 Interview Questions on Linux “ls” Command Part 1][]
- [10 Useful ls Command Interview Questions Part 2][]
![7 Quirky ls Command Tricks](http://www.tecmint.com/wp-content/uploads/2015/03/ls-command-tricks.jpg)
7 Quirky ls Command Tricks
### 1. List the contents of a directory with time using various time styles. ###
To list the contents of a directory with times using style, we need to choose any of the below two methods.
# ls -l time-style=[STYLE] (Method A)
**Note** The above switch (`--time` style must be run with switch `-l`, else it wont serve the purpose).
# ls full-time (Method B)
Replace `[STYLE]` with any of the below option.
full-iso
long-iso
iso
locale
+%H:%M:%S:%D
**Note** In the above line H(Hour), M(Minute), S(Second), D(Date) can be used in any order.
Moreover you just choose those relevant and not all options. E.g., `ls -l --time-style=+%H` will show only hour.
`ls -l --time-style=+%H:%M:%D` will show Hour, Minute and date.
# ls -l --time-style=full-iso
![ls Command Full Time Style](http://www.tecmint.com/wp-content/uploads/2015/03/ls-Command-Full-Time-Style.gif)
ls Command Full Time Style
# ls -l --time-style=long-iso
![Long Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Long-Time-Listing-Format.gif)
Long Time Style Listing
# ls -l --time-style=iso
![Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Local-Time-Style-Listing.gif)
Time Style Listing
# ls -l --time-style=locale
![Locale Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Hour-Mintue-Time-Style-Listing.gif)
Locale Time Style Listing
# ls -l --time-style=+%H:%M:%S:%D
![Date and Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Full-Time-Style-Listing.gif)
Date and Time Style Listing
# ls --full-time
![Full Style Time Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Full-Style-Time-Listing.gif)
Full Style Time Listing
### 2. Output the contents of a directory in various formats such as separated by commas, horizontal, long, vertical, across, etc. ###
Contents of directory can be listed using ls command in various format as suggested below.
- across
- comma
- horizontal
- long
- single-column
- verbose
- vertical
# ls -format=across
# ls --format=comma
# ls --format=horizontal
# ls --format=long
# ls --format=single-column
# ls --format=verbose
# ls --format=vertical
![Listing Formats of ls Command](http://www.tecmint.com/wp-content/uploads/2015/03/ls-command-Listing-Formats.gif)
Listing Formats of ls Command
### 3. Use ls command to append indicators like (/=@|) in output to the contents of the directory. ###
The option `-p` with ls command will server the purpose. It will append one of the above indicator, based upon the type of file.
# ls -p
![Append Indicators to Content](http://www.tecmint.com/wp-content/uploads/2015/03/Append-Indicators.gif)
Append Indicators to Content
### 4. Sort the contents of directory on the basis of extension, size, time and version. ###
We can use options like `--extension` to sort the output by extension, size by extension `--size`, time by using extension `-t` and version using extension `-v`.
Also we can use option `--none` which will output in general way without any sorting in actual.
# ls --sort=extension
# ls --sort=size
# ls --sort=time
# ls --sort=version
# ls --sort=none
![Sort Listing of Content by Options](http://www.tecmint.com/wp-content/uploads/2015/03/Sort-Content-by-Extensions.gif)
Sort Listing of Content by Options
### 5. Print numeric UID and GID for every contents of a directory using ls command. ###
The above scenario can be achieved using flag -n (Numeric-uid-gid) along with ls command.
# ls -n
![Print Listing of Content by UID and GID](http://www.tecmint.com/wp-content/uploads/2015/03/Print-UID-GID-of-Contents.gif)
Print Listing of Content by UID and GID
### 6. Print the contents of a directory on standard output in more columns than specified by default. ###
Well ls command output the contents of a directory according to the size of the screen automatically.
We can however manually assign the value of screen width and control number of columns appearing. It can be done using switch `--width`.
# ls --width 80
# ls --width 100
# ls --width 150
![List Content Based on Window Sizes](http://www.tecmint.com/wp-content/uploads/2015/03/List-Content-By-More-Column.gif)
List Content Based on Window Sizes
**Note**: You can experiment what value you should pass with width flag.
### 7. Include manual tab size at the contents of directory listed by ls command instead of default 8. ###
# ls --tabsize=[value]
![List Content by Table Size](http://www.tecmint.com/wp-content/uploads/2015/03/List-Content-by-Table-Size.gif)
List Content by Table Size
**Note**: Specify the `[Value]=` Numeric value.
Thats all for now. Stay tuned to Tecmint till we come up with next article. Do not forget to provide us with your valuable feedback in the comments below. Like and share us and help us get spread.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/linux-ls-command-tricks/
作者:[Avishek Kumar][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/avishek/
[1]:http://www.tecmint.com/15-basic-ls-command-examples-in-linux/
[2]:http://www.tecmint.com/ls-command-interview-questions/
[3]:http://www.tecmint.com/ls-interview-questions/

View File

@ -1,252 +0,0 @@
How to set up server monitoring system with Monit
================================================================================
Many Linux admins rely on a centralized remote monitoring system (e.g., [Nagios][1] or [Cacti][2]) to check the health of their network infrastructure. While centralized monitoring makes an admin's life easy when dealing with many hosts and devices, a dedicated monitoring box obviously becomes a single point of failure; if the monitoring box goes down or becomes unreachable for whatever reason (e.g., bad hardware or network outage), you will lose visibility on your entire infrastructure.
One way to add redundancy to your monitoring system is to install standalone monitoring software (as a fallback) at least on any critical/core servers on your network. In case a centralized monitor is down, you will still be able to maintain visibility on your core servers from their backup monitor.
### What is Monit? ###
[Monit][3] is a cross-platform open-source tool for monitoring Unix/Linux systems (e.g., Linux, BSD, OSX, Solaris). Monit is extremely easy to install and reasonably lightweight (with only 500KB in size), and does not require any third-party programs, plugins or libraries. Yet, Monit lends itself to full-blown monitoring, capable of process status monitoring, filesystem change monitoring, email notification, customizable actions for core services, and so on. The combination of ease of setup, lightweight implementation and powerful features makes Monit an ideal candidate for a backup monitoring tool.
I have been using Monit for several years on multiple hosts, and I am very pleased how reliable it has been. Even as a full-blown monitoring system, Monit is very useful and powerful for any Linux admin. In this tutorial, let me demonstrate how to set up Monit on a local server (as a backup monitor) to monitor common services. With this setup, I will only scrach the surface of what Monit can do for us.
### Installation of Monit on Linux ###
Most Linux distributions already include Monit in their repositories.
Debian, Ubuntu or Linux Mint:
$ sudo aptitude install monit
Fedora or CentOS/RHEL:
On CentOS/RHEL, you must enable either [EPEL][4] or [Repoforge][5] repository first.
# yum install monit
Monit comes with a very well documented configuration file with a lots of examples. The main configuration file is located in /etc/monit.conf in Fedora/CentOS/RHEL, or /etc/monit/monitrc in Debian/Ubuntu/Mint. Monit configuration has two parts: "Global" and "Services" sections.
Gl### ###obal Configuration: Web Status Page
Monit can use several mail servers for notifications, and/or an HTTP/HTTPS status page. Let's start with the web status page with the following requirements.
- Monit listens on port 1966.
- Access to the web status page is encrypted with SSL.
- Login requires monituser/romania as user/password.
- Login is permitted from localhost, myhost.mydomain.ro, and internal LAN (192.168.0.0/16) only.
- Monit stores an SSL certificate in a pem format.
For subsequent steps, I will use a Red Hat based system. Similar steps will be applicable on a Debian based system.
First, generate and store a self-signed certificate (monit.pem) in /var/cert.
# mkdir /var/certs
# cd /etc/pki/tls/certs
# ./make-dummy-cert monit.pem
# cp monit.pem /var/certs
# chmod 0400 /var/certs/monit.pem
Now put the following snippet in the Monit's main configuration file. You can start with an empty configuration file or make a copy of the original file.
set httpd port 1966 and
SSL ENABLE
PEMFILE /var/certs/monit.pem
allow monituser:romania
allow localhost
allow 192.168.0.0/16
allow myhost.mydomain.ro
### Global Configuration: Email Notification ###
Next, let's set up email notification in Monit. We need at least one active [SMTP server][6] which can send mails from the Monit host. Something like the following will do (adjust it for your case):
- Mail server hostname: smtp.monit.ro
- Sender email address used by monit (from): monit@monit.ro
- Who will receive mail from monit daemon: guletz@monit.ro
- SMTP port used by mail server: 587 (default is 25)
With the above information, email notification would be configured like this:
set mailserver smtp.monit.ro port 587
set mail-format {
from: monit@monit.ro
subject: $SERVICE $EVENT at $DATE on $HOST
message: Monit $ACTION $SERVICE $EVENT at $DATE on $HOST : $DESCRIPTION.
Yours sincerely,
Monit
}
set alert guletz@monit.ro
As you can see, Monit offers several built-in variables ($DATE, $EVENT, $HOST, etc.), and you can customize your email message for your needs. If you want to send mails from the Monit host itself, you need a sendmail-compatible program (e.g., postfix or ssmtp) already installed.
### Global Configuration: Monit Daemon ###
The next part is setting up monit daemon. We will set it up as follows.
- Performs the first check after 120 seconds.
- Checks services once every 3 minutes.
- Use syslog for logging.
Place the following snippet to achieve the above setting.
set daemon 120
with start delay 240
set logfile syslog facility log_daemon
We must also define "idfile", a unique ID used by monit demon, and "eventqueue", a path where mails sent by monit but undelivered due to SMTP/network errors. Verifiy that path (/var/monit) already exists. The following configuration will do.
set idfile /var/monit/id
set eventqueue
basedir /var/monit
### Test Global Configuration ###
Now the "Global" section is finished. The Monit configuration file will look like this:
# Global Section
# status webpage and acl's
set httpd port 1966 and
SSL ENABLE
PEMFILE /var/certs/monit.pem
allow monituser:romania
allow localhost
allow 192.168.0.0/16
allow myhost.mydomain.ro
# mail-server
set mailserver smtp.monit.ro port 587
# email-format
set mail-format {
from: monit@monit.ro
subject: $SERVICE $EVENT at $DATE on $HOST
message: Monit $ACTION $SERVICE $EVENT at $DATE on $HOST : $DESCRIPTION.
Yours sincerely,
Monit
}
set alert guletz@monit.ro
# delay checks
set daemon 120
with start delay 240
set logfile syslog facility log_daemon
# idfile and mail queue path
set idfile /var/monit/id
set eventqueue
basedir /var/monit
Now it is time to check what we have done. You can test an existing configuration file (/etc/monit.conf) by running:
# monit -t
----------
Control file syntax OK
If Monit complains about any error, please review the configuration file again. Fortunately, error/warnings messages are informative. For example:
monit: Cannot stat the SSL server PEM file '/var/certs/monit.pem' -- No such file or directory
/etc/monit/monitrc:10: Warning: hostname did not resolve 'smtp.monit.ro'
Once you verify the syntax of configuration, start monit daemon, and wait 2 to 3 minutes:
# service monit start
If you are using systemd, run:
# systemctl start monit
Now open a browser window, and go to https://<monit_host>:1966. Replace &<monit_host> with your Monit hostname or IP address.
Note that if you have a self-signed SSL certificate, you will see a warning message in your browser.
![](https://farm8.staticflickr.com/7596/16737206479_96b9f7dfdb_c.jpg)
After you have completed login, you must see the following page.
![](https://farm8.staticflickr.com/7594/16303369973_6019482dea_c.jpg)
In the rest of the tutorial, let me show how we can monitor a local server and common services. You will see a lot of useful examples on the [official wiki page][7]. Most of them are copy-and-pastable!
### Service Configuration: CPU/Memory Monitoring ###
Let start with monitoring a local server's CPU/memory usage. Copy the following snippet in the configuration file.
check system localhost
if loadavg (1min) > 10 then alert
if loadavg (5min) > 6 then alert
if memory usage > 75% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 60% then alert
if cpu usage (wait) > 75% then alert
You can easily interpret the above configuration. The above checks are performed on local host for every monitoring cycle (which is set to 120 seconds in the Global section). If any condition is met, monit daemon will send an alert with an email.
If certain properties do not need to be monitored for every cycle, you can use the following format. For example, this will monitor average load every other cycle (i.e., every 240 seconds).
if loadavg (1min) > 10 for 2 cycles then alert
### Service Configuration: SSH Service Monitoring ###
Let's check if we have sshd binary installed in /usr/sbin/sshd:
check file sshd_bin with path /usr/sbin/sshd
We also want to check if the init script for sshd exist:
check file sshd_init with path /etc/init.d/sshd
Finally, we want to check if sshd daemon is up an running, and listens on port 22:
check process sshd with pidfile /var/run/sshd.pid
start program "/etc/init.d/sshd start"
stop program "/etc/init.d/sshd stop"
if failed port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
More specifically, we can interpret the above configuration as follows. We check if a process named sshd and a pidfile (/var/run/sshd.pid) exist. If either one does not exist, we restart sshd demon using init script. We check if a process listening on port 22 can speak SSH protocol. If not, we restart sshd daemon. If there are at least 5 restarts within the last 5 monitoring cycles (i.e., 5x120 seconds), sshd daemon is declared non-functional, and we do not try to check again.
![](https://farm9.staticflickr.com/8685/16735725998_62c26a24bc_c.jpg)
### Service Configuration: SMTP Service Monitoring ###
Now let's set up a check on a remote SMTP mail server (e.g., 192.168.111.102). Let's assume that the SMTP server is running SMTP, IMAP and SSH on its LAN interface.
check host MAIL with address 192.168.111.102
if failed icmp type echo within 10 cycles then alert
if failed port 25 protocol smtp then alert
else if recovered then exec "/scripts/mail-script"
if failed port 22 protocol ssh then alert
if failed port 143 protocol imap then alert
We check if the remote host responds to ICMP. If we haven't received ICMP response within 10 cycles, we send out an alert. If testing for SMTP protocol on port 25 fails, we send out an alert. If testing succeeds again after a failed test, we run a script (/scripts/mail-script). If testing for SSH and IMAP protocols fail on port 22 and 143, respectively, we send out an alert.
### Conclusion ###
In this tutorial, I demonstrate how to set up Monit on a local server. What I showed here is just the tip of the iceberg, as far as Monit's capabilities are concerned. Take your time and read the man page about Monit (a very good one). Monit can do a lot for any Linux admin with a very nice and easy to understand syntax. If you put together a centralized remote monitor and Monit to work for you, you will have a more reliable monitoring system. What is your thought on Monit?
--------------------------------------------------------------------------------
via: http://xmodulo.com/server-monitoring-system-monit.html
作者:[Iulian Murgulet][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://xmodulo.com/author/iulian
[1]:http://xmodulo.com/monitor-common-services-nagios.html
[2]:http://xmodulo.com/monitor-linux-servers-snmp-cacti.html
[3]:http://mmonit.com/monit/
[4]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html
[5]:http://xmodulo.com/how-to-set-up-rpmforge-repoforge-repository-on-centos.html
[6]:http://xmodulo.com/mail-server-ubuntu-debian.html
[7]:http://mmonit.com/wiki/Monit/ConfigurationExamples

View File

@ -1,103 +0,0 @@
translating by wwy-hust
How to Serve Git Repositories Using Gitblit Tool in Linux
================================================================================
Hi friends, today we'll be learning how to install Gitblit in your Linux Server or PC. So, lets check out what is a Git, its features and steps to install Gitblit. [Git is a distributed revision control system][1] with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. It was initially designed and developed by Linus Torvalds for Linux kernel under the terms of the GNU General Public License version 2 development in 2005, and has since become the most widely adopted version control system for software development.
[Gitblit is a free and open source][2] built on a pure Java stack designed to handle everything from small to very large projects with speed and efficiency for serving Git repositories. It is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
#### Features of Gitblit ####
- It can be used as a dumb repository viewer with no administrative controls or user accounts.
- It can be used as a complete Git stack for cloning, pushing, and repository access control.
- It can be used without any other Git tooling (including actual Git) or it can cooperate with your established tools.
### 1. Creating Gitblit install directory ###
First of all we'll gonna to create a directory in our server in which we'll be installing our latest gitblit in.
$ sudo mkdir -p /opt/gitblit
$ cd /opt/gitblit
![creating directory gitblit](http://blog.linoxide.com/wp-content/uploads/2015/01/creating-directory-gitblit.png)
### 2. Downloading and Extracting ###
Now, we will want to download the latest gitblit from the official site. Here, the current version of gitblit we are gonna install is 1.6.2 . So, please change it as the version you are gonna install in your system.
$ sudo wget http://dl.bintray.com/gitblit/releases/gitblit-1.6.2.tar.gz
![downloading gitblit package](http://blog.linoxide.com/wp-content/uploads/2015/01/downloading-gitblit.png)
Now, we'll be extracting our downloaded tarball package to our current folder ie /opt/gitblit/
$ sudo tar -zxvf gitblit-1.6.2.tar.gz
![extracting gitblit tar](http://blog.linoxide.com/wp-content/uploads/2015/01/extracting-gitblit-tar.png)
### 3. Configuring and Running ###
Now, we'll configure our Gitblit configuration. If you want to customize the behavior of Gitblit server, you can do it by modifying `gitblit/data/gitblit.properties` . Now, after you are done configuring the configuration. We finally wanna run our gitblit. We have two options on running gitblit, first is that we run it manually by the command below:
$ sudo java -jar gitblit.jar --baseFolder data
And next is to add and use gitblit as service. Here are the steps that we'll need to follow to use gitblit as service in linux.
So, As I am running Ubuntu, the command below will be sudo cp service-ubuntu.sh /etc/init.d/gitblit so please change the file name service-ubuntu.sh to the distribution you are currently running.
$ sudo ./install-service-ubuntu.sh
$ sudo service gitblit start
![starting gitblit service](http://blog.linoxide.com/wp-content/uploads/2015/01/starting-gitblit-service.png)
Open your browser to http://localhost:8080 or https://localhost:8443 or replace "localhost" with the ip-address of the machine depending on your system configuration. Enter the default administrator credentials: admin / admin and click the Login button.
![gitblit welcome](http://blog.linoxide.com/wp-content/uploads/2015/01/gitblit-welcome.png)
Now, we'll wanna add a new user. First you'll need to login to the admin with default administrator credentials: username = **admin** and password = **admin** .
Then, Goto user icon > users > (+) new user. And create a new user like as shown in the figure below.
![add new user](http://blog.linoxide.com/wp-content/uploads/2015/01/add-user.png)
Now, we'll create a new repo out of the box. Go to repositories > (+) new repository . Then, add new repository as shown below.
![add new repository](http://blog.linoxide.com/wp-content/uploads/2015/01/add-new-repository.png)
#### Create a new repository on the command-line ####
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git
git push -u origin master
Please replace the username arunlinoxide with the user you add.
#### Push an existing repository from the command-line ####
git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git
git push -u origin master
**Note**: It is highly recommended to everyone to change the password of username "admin" as it comes by default.
### Conclusion ###
Hurray, we finally installed our latest Gitblit in our Linux Computer. We can now enjoy such a beautiful version controlling system for our projects whether its small or large, no matter. With Gitblit, version controlling has been too easy. It is easy to learn and has a tiny footprint with lightning fast performance. So, if you have any questions, suggestions, feedback please write them in the comment box below.
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-how-to/serve-git-repositories-gitblit/
作者:[Arun Pyasi][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/arunp/
[1]:http://git-scm.com/
[2]:http://gitblit.com/

View File

@ -1,85 +0,0 @@
How to secure BGP sessions using authentication on Quagga
================================================================================
The BGP protocol runs over TCP, and as such, it inherits all the vulnerabilities of a TCP connection. For example, within a BGP session, an attacker may impersonate a legitimate BGP neighbor, and convince the BGP routers on the other end to share their routing information with the attacker. The problem occurs when the attacker advertises and injects bogus routes towards neighboring routers. The unsuspecting neighboring routers may then start sending live traffic towards the attacker, which in most cases goes nowhere and simply gets dropped. Back in 2008, YouTube actually [fell victim][1] to such BGP route poisoning, and suffered major outage on their video service for more than an hour. In a far worse case, if the attacker is savvy enough, they can falsely act as a transparent transit router and sniff the transit traffic for any sensitive data. As you can imagine, this can have far reaching consequences.
To protect active BGP sessions against such attacks, many service providers leverage [MD5 checksum and a pre-shared key][2] for their BGP sessions. In a protected BGP session, a BGP router which sends a packet generates an MD5 hash value by using a pre-shared key, portions of the IP and TCP headers and the payload. The MD5 hash is then stored as a TCP option field. Upon receipt of the packet, a receiving router uses the same method to generate its version of the MD5 hash using a pre-shared key. It compares the hash with the one of the received packet to decide whether to accept the packet. For an attacker, it is almost impossible to guess the checksum or the key. For BGP routers, they can be assured that each packet is validated before its content is consumed.
In this tutorial, we will see how we can secure a BGP session between two neighbors using MD5 checksum and a pre-shared key.
### Preparation ###
Securing a BGP session is fairly straightforward. We will use the following routers.
注:表格
<table id="content">
<tbody><tr>
<td><b>Router name</b></td>
<td><b>AS</b></td>
<td><b>IP address</b></td>
</tr>
<tr>
<td>router-A</td>
<td>100</td>
<td>10.10.12.1/30</td>
</tr>
<tr>
<td>router-B</td>
<td>200</td>
<td>10.10.12.2/30</td>
</tr>
</tbody></table>
The stock Linux kernel supports TCP MD5 option natively for IPv4 and IPv6. Thus if you built Quagga router from a brand new [Linux box][3], TCP MD5 capability will be automatically available for Quagga. It'll be just a matter of configuring Quagga to take advantage of the capability. But if you are using a FreeBSD box or built a custom kernel for Quagga, make sure that you enable TCP MD5 support on the kernel (e.g., CONFIG_TCP_MD5SIG kernel option in Linux).
### Configuring Router-A for Authentication ###
We will use the CLI shell of Quagga to configure the routers. The only new command that we will use is 'password'.
[root@router-a ~]# vtysh
router-a# conf t
router-a(config)# router bgp 100
router-a(config-router)# network 192.168.100.0/24
router-a(config-router)# neighbor 10.10.12.2 remote-as 200
router-a(config-router)# neighbor 10.10.12.2 password xmodulo
The pre-shared key in this example is 'xmodulo'. Obviously, in a production environment you need to select a strong key.
**Note**: in Quagga, the 'service password-encryption command is supposed to encrypt all plain-text passwords (e.g., login password) in its configuration file. However, when I use this command, I notice that the pre-shared key in BGP configuration still remains in clear text. I am not sure whether it's a limitation of Quagga, or whether it's a version issue.
### Configuring Router-B for Authentication ###
We will configure router-B in a similar fashion.
[root@router-b ~]# vtysh
router-b# conf t
router-b(config)# router bgp 200
router-b(config-router)# network 192.168.200.0/24
router-b(config-router)# neighbor 10.10.12.1 remote-as 100
router-b(config-router)# neighbor 10.10.12.1 password xmodulo
### Verifying a BGP session ###
If everything has been configured correctly, the BGP session should be up, and both routers should be exchanging routes. At this point, every outgoing packet in a TCP session carries a MD5 digest of the packet contents and a secret key, and the digest is automatically validated by the other end point.
We can verify the active BGP session by viewing BGP summary as usual. MD5 checksum verification occurs transparently within Quagga, so you don't see it at the BGP level.
![](https://farm8.staticflickr.com/7621/16837774368_e9ff66b370_c.jpg)
If you want to test BGP authentication, you can configure one neighbor without a password or deliberately use a wrong pre-shared key and see what happens. You can also use a packet sniffer like tcpdump or Wireshark to analyze the packets that go through the BGP session. For example, tcpdump with "-M <secret>" option will validate the MD5 digests found in TCP option field.
To sum up, in this tutorial we demonstrate how we can easily secure the BGP session between two routers. The process is very straightforward compared to other protocols. It is always recommended to secure your BGP session, especially if you are setting up the BGP session with another AS. The pre-shared key should also be kept safe.
--------------------------------------------------------------------------------
via: http://xmodulo.com/bgp-authentication-quagga.html
作者:[Sarmed Rahman][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://xmodulo.com/author/sarmed
[1]:http://research.dyn.com/2008/02/pakistan-hijacks-youtube-1/
[2]:http://tools.ietf.org/html/rfc2385
[3]:http://xmodulo.com/centos-bgp-router-quagga.html

View File

@ -1,261 +0,0 @@
4 Tools Send Email with Subject, Body and Attachment in Linux
================================================================================
In today's article we will cover a few ways you can use to send emails with attachments from the command line interface on Linux. It can have quite a few uses, for example to send an archive with an application from an application server to email or you can use the commands in scripts to automate some process. For our examples,we will use the file foo.tar.gz as our attachment.
There are various ways to send emails from command line using different mail clients but here I am sharing few mail client utility used by most users like mailx, mutt and swaks.
All the tools we will present to you are very popular and present in the repositories of most Linux distributions, you can install them using the following commands:
For **Debian / Ubuntu** systems
apt-get install mutt
apt-get install swaks
apt-get install mailx
apt-get install sharutils
For Red Hat based systems like **CentOS** or **Fedora**
yum install mutt
yum install swaks
yum install mailx
yum install sharutils
### 1) Using mail / mailx ###
The mailx utility found as the default mailer application in most Linux distributions now includes the support to attach file. If it is not available you can easily install using the following commands please take note that this may not be supported in older versions, to check this you can use the command:
$ man mail
And the first line should look like this:
mailx [-BDdEFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr] [-r from-addr] [-h hops] [-A account] [-S variable[=value]] to-addr . . .
As you can see it supports the -a attribute to add a file to the email and -s attribute to subject to the email. Use few of below examples to send mails.
**a) Simple Mail**
Run the mail command, and then mailx would wait for you to enter the message of the email. You can hit enter for new lines. When done typing the message, press Ctrl+D and mailx would display EOT.
After than mailx automatically delivers the email to the destination.
$ mail user@example.com
HI,
Good Morning
How are you
EOT
**b) To send email with subject**
$ echo "Email text" | mail -s "Test Subject" user@example.com
-s is used for defining subject for email.
**c) To send message from a file**
$ mail -s "message send from file" user@example.com < /path/to/file
**d) To send message piped using the echo command**
$ echo "This is message body" | mail -s "This is Subject" user@example.com
**e) To send email with attachment**
$ echo “Body with attachment "| mail -a foo.tar.gz -s "attached file" user@example.com
-a is used for attachments
### 2) mutt ###
Mutt is a text-based email client for Unix-like systems. It was developed over 20 years ago and it's an important part of Linux history, one of the first clients to support scoring and threading capabilities. Use few of below examples to send email.
**a) Send email with subject & body message from a file**
$ mutt -s "Testing from mutt" user@example.com < /tmp/message.txt
**b) To send body message piped using the echo command**
$ echo "This is the body" | mutt -s "Testing mutt" user@example.com
**c) To send email with attachment**
$ echo "This is the body" | mutt -s "Testing mutt" user@example.com -a /tmp/foo.tar.gz
**d) To send email with multiple attachments**
$ echo "This is the body" | mutt -s "Testing" user@example.com -a foo.tar.gz a bar.tar.gz
### 3) swaks ###
Swaks stands for Swiss Army Knife for SMTP and it is a featureful, flexible, scriptable, transaction-oriented SMTP test tool written and maintained by John Jetmore. You can use the following syntax to send an email with attachment:
$ swaks -t "foo@bar.com" --header "Subject: Subject" --body "Email Text" --attach foo.tar.gz
The important thing about Swaks is that it will also debug the full mail transaction for you, so it is a very useful tool if you also wish to debug the mail sending process:
As you can see it gives you full details about the sending process including what capabilities the receiving mail server supports, each step of the transaction between the 2 servers.
### 4) uuencode ###
Email transport systems were originally designed to transmit characters with a seven-bit encoding -- like ASCII. This meant they could send messages with plain text but not "binary" text, such as program files or image files that used all of an eight-bit byte. The program is used to solve this limitation is “uuencode”( "UNIX to UNIX encoding") which encode the mail from binary format to text format that is safe to transmit & program is used to decode the data is called “uudecode”
We can easily send binary text such as a program files or image files using uuencode with mailx or mutt email client is shown by following example:
$ uuencode example.jpeg example.jpeg | mail user@example.com
### Shell Script : Explain how to send email ###
#!/bin/bash
FROM=""
SUBJECT=""
ATTACHMENTS=""
TO=""
BODY=""
# Function to check if entered file names are really files
function check_files()
{
output_files=""
for file in $1
do
if [ -s $file ]
then
output_files="${output_files}${file} "
fi
done
echo $output_files
}
echo "*********************"
echo "E-mail sending script."
echo "*********************"
echo
# Getting the From address from user
while [ 1 ]
do
if [ ! $FROM ]
then
echo -n -e "Enter the e-mail address you wish to send mail from:\n[Enter] "
else
echo -n -e "The address you provided is not valid:\n[Enter] "
fi
read FROM
echo $FROM | grep -E '^.+@.+$' > /dev/null
if [ $? -eq 0 ]
then
break
fi
done
echo
# Getting the To address from user
while [ 1 ]
do
if [ ! $TO ]
then
echo -n -e "Enter the e-mail address you wish to send mail to:\n[Enter] "
else
echo -n -e "The address you provided is not valid:\n[Enter] "
fi
read TO
echo $TO | grep -E '^.+@.+$' > /dev/null
if [ $? -eq 0 ]
then
break
fi
done
echo
# Getting the Subject from user
echo -n -e "Enter e-mail subject:\n[Enter] "
read SUBJECT
echo
if [ "$SUBJECT" == "" ]
then
echo "Proceeding without the subject..."
fi
# Getting the file names to attach
echo -e "Provide the list of attachments. Separate names by space.
If there are spaces in file name, quote file name with \"."
read att
echo
# Making sure file names are poiting to real files
attachments=$(check_files "$att")
echo "Attachments: $attachments"
for attachment in $attachments
do
ATTACHMENTS="$ATTACHMENTS-a $attachment "
done
echo
# Composing body of the message
echo "Enter message. To mark the end of message type ;; in new line."
read line
while [ "$line" != ";;" ]
do
BODY="$BODY$line\n"
read line
done
SENDMAILCMD="mutt -e \"set from=$FROM\" -s \"$SUBJECT\" \
$ATTACHMENTS -- \"$TO\" <<< \"$BODY\""
echo $SENDMAILCMD
mutt -e "set from=$FROM" -s "$SUBJECT" $ATTACHMENTS -- $TO <<< $BODY
**Script Output**
$ bash send_mail.sh
*********************
E-mail sending script.
*********************
Enter the e-mail address you wish to send mail from:
[Enter] test@gmail.com
Enter the e-mail address you wish to send mail to:
[Enter] test@gmail.com
Enter e-mail subject:
[Enter] Message subject
Provide the list of attachments. Separate names by space.
If there are spaces in file name, quote file name with ".
send_mail.sh
Attachments: send_mail.sh
Enter message. To mark the end of message type ;; in new line.
This is a message
text
;;
### Conclusion ###
There are many ways of send emails from command line / shell script but here we have shared 4 tools available for unix / linux based distros. Hope you enjoyed reading our article and please provide your valuable comments and also let us know if you know about any new tools.
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-shell-script/send-email-subject-body-attachment-linux/
作者:[Bobbin Zachariah][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/bobbin/

View File

@ -1,237 +0,0 @@
20 Awesome Docker Containers for a Desktop User
================================================================================
Greetings to everyone, today we'll list out some awesome Desktop Apps that we can run using Docker Containers in our very own Desktop running Docker. Docker is an Open Source project that provides an open platform to pack, ship and run any application as a lightweight container. It has no boundaries of Language support, Frameworks or packaging system and can be run anywhere, anytime from a small home computers to high-end servers. It makes them great building blocks for deploying and scaling web apps, databases, and back-end services without depending on a particular stack or provider. It is basically used by the developers, Ops and Engineers as it is easy, fast and handy tool for testing or deploying their products but we can also use Docker for our Desktop usage to run a desktop apps out of the box.
So here are some awesome 10 Desktop Application Docker images that we can run with Docker.
### 1. Lynx ###
Lynx is a all time favorite text-based web browser which is a lot familiar to most of the people running Linux. It is the oldest web browser currently in general use and development. To run Lynx, run the following command.
$ docker run -it \
--name lynx \
jess/lynx
### 2. Irssi ###
Irssi is an awesome IRC Client which is based on Text Interface. To run Irssi using docker, we'll need to run the following commands in a docker installed desktop computer.
docker run -it --name my-irssi -e TERM -u $(id -u):$(id -g) \
-v $HOME/.irssi:/home/user/.irssi:ro \
-v /etc/localtime:/etc/localtime:ro \
irssi
### 3. Chrome ###
Chrome is an awesome GUI-based web browser developed by Google and is based on Open Source Project Chromium. Google Chrome is widely used, fast and secure web browser that are very much familiar to most of the people who surf internet. We can run Chrome using docker by running the following command.
$ docker run -it \
--net host \
--cpuset 0 \
--memory 512mb \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v $HOME/Downloads:/root/Downloads \
-v $HOME/.config/google-chrome/:/data \
-v /dev/snd:/dev/snd --privileged \
--name chrome \
jess/chrome
### 4. Tor Browser ###
Tor Browser is a web browser which support anonymous features. It enables us freedom to surf website or services blocked by a particular organization or ISPs. It prevents somebody watching our Internet connection from learning what we do on internet and our exact location. To run Tor Browser, run the following command.
$ docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v /dev/snd:/dev/snd --privileged \
--name tor-browser \
jess/tor-browser
### 5. Firefox Browser ###
Firefox Browser is a free and open source web browser which is developed by Mozilla Foundation. It is run by Gecko and SpiderMonkey engines. Firefox Browser has a lot of new features and is specially known for its performance and security.
$ docker run -d \
--name firefox \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
kennethkl/firefox
### 6. Rainbow Stream ###
Rainbow Stream is a terminal based Twitter Client featuring real time tweetstream, compose, search , favorite and much more fun directly from terminal. To run Rainbow Stream, run the following command.
$ docker run -it \
-v /etc/localtime:/etc/localtime \
-v $HOME/.rainbow_oauth:/root/.rainbow_oauth \
-v $HOME/.rainbow_config.json:/root/.rainbow_config.json \
--name rainbowstream \
jess/rainbowstream
### 7. Gparted ###
Gparted is an open source software which allows us to partition disks. Now enjoy partitioning from a docker container. To run gparted, we'll need to run the following command.
$ docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
--device /dev/sda:/dev/sda \ # mount the device to partition
--name gparted \
jess/gparted
### 8. GIMP Editor ###
GIMP stands for Gnu Image Manipulation Program which is an awesome tool on Linux for graphics, image editing platform. It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring.
$ docker run -it \
--rm -e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
jarfil/gimp-git
### 9. Thunderbird ###
Thunderbird is also a free and open source email application which is developed and maintained by Mozilla Foundation. It has tons of features that an email application software should have. Thunderbird is really easy to setup and customize. To run Thunderbird in a Docker environment, run the following command.
$ docker run -d \
-e DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-u docker \
-v $HOME/docker-data/thunderbird:/home/docker/.thunderbird/ \
yantis/thunderbird thunderbird
### 10. Mutt ###
Mutt is a text based email client which has bunches of cool features including color support, IMAP, POP3, SMTP support, mail storing support and much more. To run Mutt out of the box using docker, we'll need to run the following command.
$ docker run -it \
-v /etc/localtime:/etc/localtime \
-e GMAIL -e GMAIL_NAME \
-e GMAIL_PASS -e GMAIL_FROM \
-v $HOME/.gnupg:/home/user/.gnupg \
--name mutt \
jess/mutt
### 11. Skype ###
Skype is an instant messaging, video calling software which is not open source but can be run awesome in linux. We can run Skype using Docker Containers too. To run Skype using a docker, run the following command.
$ docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-v /dev/snd:/dev/snd --privileged \
-e DISPLAY="unix$DISPLAY" \
tianon/skype
### 12. Cathode ###
Cathode is a beautiful fully customizable terminal app with a look inspired by classic computers. We can run Cathode by running the below command.
$ docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
--name cathode \
jess/1995
### 13. LibreOffice ###
LibreOffice is a powerful office suite which is free and open source and is maintained by The Document Foundation. It has clean interface and is a powerful tools that lets us unleash our creativity and grow our productivity. LibreOffice embeds several applications that make it the most powerful Free & Open Source Office suite on the market.
$docker run \
-v $HOME/Documents:/home/libreoffice/Documents:rw \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e uid=$(id -u) -e gid=$(id -g) \
-e DISPLAY=unix$DISPLAY --name libreoffice \
chrisdaish/libreoffice
### 14. Spotify ###
Spotify gives us instant access to millions of songs from old favorites to the latest hits. To listen our favorite songs using docker, run the following command.
$ docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v /dev/snd:/dev/snd --privileged \
--name spotify \
jess/spotify
### 15. Audacity ###
Audacity is free and open source cross-platform software for recording and editing sounds. Audacity can be used for post-processing of all types of audio, including podcasts by adding effects such as normalization, trimming, and fading in and out. To run Audacity, we'll need to run the following command in a terminal or shell.
$ docker run --rm \
-u $(id -u):$(id -g) \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-v /dev/snd:/dev/snd \
-v "$HOME:$HOME" \
-w "$HOME" \
-e DISPLAY="unix$DISPLAY" \
-e HOME \
$(find /dev/snd/ -type c | sed 's/^/--device /') \
knickers/audacity
### 16. Eclipse ###
Eclipse is an integrated development environment (IDE). It contains a base workspace and an extensible plug-in system for customizing the environment. It is mostly used to develop Java Based Applications.
$ docker run -v ~/workspace/:/home/eclipse/workspace/ \
-e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-d leesah/eclipse
### 17. VLC Media Player ###
VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVDs, Audio CDs, VCDs, and various streaming protocols. VLC Media Player is developed and maintained by VideoLAN Organization. To run VLC in docker environment, run the following command.
$ docker run -v\
$HOME/Documents:/home/vlc/Documents:rw \
-v /dev/snd:/dev/snd --privileged \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e uid=$(id -u) -e gid=$(id -g) \
-e DISPLAY=unix$DISPLAY --name vlc \
chrisdaish/vlc
### 18. Vim Editor ###
Vim is a highly configurable text-based text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems.
$ docker run -i -t --name my-vim -v ~/:/home/dev/src haron/vim
### 19. Inkscape ###
Inkscape is a free and open-source vector graphics editor. It can create, edit vector graphics such as illustrations, diagrams, line arts, charts, logos and even complex paintings. Inkscape's primary vector graphics format is Scalable Vector Graphics (SVG) version 1.1. It can import from or export to several other formats as well but all editing workflow must inevitably occur within the constraints of SVG format.
$docker build -t rasch/inkscape --rm .
$ docker run --rm -e DISPLAY \
-u inkscaper
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/.Xauthority:/home/inkscaper/.Xauthority \
--net=host rasch/inkscape
### 20. Filezilla ###
Filezilla is a free FTP solution application software. It supports FTP, SFTP, FTPS protocols. It is a powerful file management tool for client side. It is an awesome open source FTP project which is highly reliable and easy to use.
$ xhost +si:localuser:$(whoami)
$ docker run \
-d \
-e DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-u docker \
-v /:/host \
-v $HOME/docker-data/filezilla:/home/docker/.config/filezilla/ \
yantis/filezilla filezilla
### Conclusion ###
Running desktop application software using Docker is really an awesome experience. Docker is really an awesome platform for fast and easy development, shipping and deployment of software and packages in any place from home to office to production areas. Running desktop apps with docker is a cool way to try out the apps without really installing it into the host filesystem. So, if you have any questions, comments, feedback please do write on the comment box below and let us know what stuffs needs to be added or improved. Thank You! Enjoy with Docker :-)
--------------------------------------------------------------------------------
via: http://linoxide.com/how-tos/20-docker-containers-desktop-user/
作者:[Arun Pyasi][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/arunp/

View File

@ -1,299 +0,0 @@
Translating by ZTinoZ
15 Things to Do After Installing Ubuntu 15.04 Desktop
================================================================================
This tutorial is intended for beginners and covers some basic steps on what to do after you have installed Ubuntu 15.04 “Vivid Vervet” Desktop version on your computer in order to customize the system and install basic programs for daily usage.
![Things to Do After Installing Ubuntu 15.04](http://www.tecmint.com/wp-content/uploads/2015/04/things-to-do-after-installing-ubuntu-15.04.jpeg)
15 Things to Do After Installing Ubuntu 15.04
### 1. Enable Ubuntu Extra Repositories and Update the System ###
The first thing you should take care of after a fresh installation of Ubuntu is to enable Ubuntu Extra Repositories provided by official Canonical Partners and keep an up-to-date system with the last security patches and software updates.
In order to accomplish this step, open from the left Launcher System Settings -> Software and Updates utility and check all Ubuntu Software and Other Software (Canonical Partners) repositories. After you finish hit the Close button and wait for the utility to Reload the cache sources tree.
![Software Updates](http://www.tecmint.com/wp-content/uploads/2015/04/Software-Updates.jpg)
Software Updates
![Other Software (Canonical Partners)](http://www.tecmint.com/wp-content/uploads/2015/04/Other-Software.jpg)
Other Software (Canonical Partners)
For a fast and smooth update process, open a Terminal and issue the following command in order to update the system using the new software repositories:
$ sudo apt-get update
$ sudo apt-get upgrade
![Ubuntu Upgrade](http://www.tecmint.com/wp-content/uploads/2015/04/Ubuntu-Upgrade.jpg)
Ubuntu Upgrade
### 2. Install Additional Drivers ###
In order for the system to scan and install additional hardware proprietary drivers, open Software and Updates utility from System Settings, go to Additional Drivers tab and wait for the utility to scan for drivers.
If some drivers matching your hardware are found, check the drivers you want to install and hit the Apply Changes button to install it. In case the proprietary drivers are not working as expected, uninstall them using the Revert button or check Do not use the device and Apply Changes.
![Install Drivers in Ubuntu](http://www.tecmint.com/wp-content/uploads/2015/04/install-drivers.jpg)
Install Drivers
### 3. Install Synaptic and Gdebi Package Tools ###
Besides Ubuntu Software Center, Synaptic is a Graphical utility for apt command line through which you can manage repositories or install, remove, search, upgrade and configure software packages. Similar way, Gdebi has the same functionality for local .deb packages. To install this two package managers on your system issue the following command on Terminal:
$ sudo apt-get install synaptic gdebi
![Install Synaptic and Gdebi](http://www.tecmint.com/wp-content/uploads/2015/04/install-synaptic-gdebi.jpg)
Install Synaptic and Gdebi
![Synaptic Package Manager](http://www.tecmint.com/wp-content/uploads/2015/04/synaptic-package-manager.jpg)
Synaptic Package Manager
### 4. Change System Appearance and Behavior ###
If you want to change Desktop Background or Launcher Icon Size, open System Settings > Appearance > Look and personalize the desktop. To move the menu to window title bar, enable workspaces and desktop icons or auto-hide the Launcher visit Behavior tab.
![System Appearances](http://www.tecmint.com/wp-content/uploads/2015/04/system-appearance.jpg)
System Appearances
### 5. Improve System Security and Privacy ###
![System Security Enhancement](http://www.tecmint.com/wp-content/uploads/2015/04/system-security-1.jpg)
System Security Enhancement
![System Security Options](http://www.tecmint.com/wp-content/uploads/2015/04/system-security-2.jpg)
System Security Options
### 5. Disable Unneeded Startup Applications ###
To improve system login speed, reveal hidden Startup Applications by issuing the below command on Terminal, open Startup Applications utility by searching it in Dash and uncheck the unneeded applications during login process.
$ sudo sed -i s/NoDisplay=true/NoDisplay=false/g /etc/xdg/autostart/*.desktop
![Disable Unwanted Applications](http://www.tecmint.com/wp-content/uploads/2015/04/disable-unwanted-applications.jpg)
Disable Unwanted Applications
### 6. Add Extended Multimedia Support ###
By default, Ubuntu comes with a minimal support for media files. In order to play various media formats or manipulate video files, install the following multimedia applications:
- VLC
- Smplayer
- Audacious
- QMMP
- Mixxx
- XBMC
- Handbrake
- Openshot
Use the following command line to install all with one shot:
$ sudo apt-get install vlc smplayer audacious qmmp mixxx xbmc handbrake openshot
![Install Media Players](http://www.tecmint.com/wp-content/uploads/2015/04/install-media-players.jpg)
Install Media Players
![Media Player Playlist](http://www.tecmint.com/wp-content/uploads/2015/04/media-playllist.jpg)
Media Player Playlist
Besides this multimedia players also install ubuntu-restricted-extras and Java support packages in order to decode and support other restricted media formats.
$ sudo apt-get install ubuntu-restricted-extras openjdk-8-jdk
![Install Ubuntu Extras](http://www.tecmint.com/wp-content/uploads/2015/04/install-ubuntu-extras.jpg)
Install Ubuntu Extras
To enable DVD Playback and other multimedia codecs issue the following command on Terminal:
$ sudo apt-get install ffmpeg gstreamer0.10-plugins-bad lame libavcodec-extra
$ sudo /usr/share/doc/libdvdread4/install-css.sh
![Enable Video Codes](http://www.tecmint.com/wp-content/uploads/2015/04/enable-video-playbacks.jpg)
Enable Video Codes
### 7. Install Image Applications ###
If you are a photography enthusiast and you want to handle and manipulate images on Ubuntu, probably you want to install the following imaging programs:
- GIMP (alternative for Adobe Photoshop)
- Darktable
- Rawtherapee
- Pinta
- Shotwell
- Inkscape (alternative for Adobe Illustrator)
- Digikam
- Cheese
This applications can be installed from Ubuntu Software Center or all at once by using the following command line on Terminal:
$ sudo apt-get install gimp gimp-plugin-registry gimp-data-extras darktable rawtherapee pinta shotwell inkscape
![Install Image Applications](http://www.tecmint.com/wp-content/uploads/2015/04/install-image-applications.jpg)
Install Image Applications
![Rawtherapee Tool](http://www.tecmint.com/wp-content/uploads/2015/04/rawtherapee.jpg)
Rawtherapee Tool
### 8. Install Media Burners ###
To mount ISO images or burn a CDs or a DVD, you can choose and install from the following software:
- Brasero Disk Burner
- K3b
- Xfburn
- Furius ISO Mount
$ sudo apt-get install brasero
$ sudo apt-get install k3b
$ sudo apt-get install xfburn
$ sudo apt-get install furiusisomount
![Install Media Burners](http://www.tecmint.com/wp-content/uploads/2015/04/install-media-burners.jpg)
Install Media Burners
### 9. Install Archive Applications ###
To handle most of archive formatted files (zip, tar.gz, zip, 7zip rar etc) install the following packages by issuing the below command:
$ sudo apt-get install unace unrar zip unzip p7zip-full p7zip-rar sharutils rar uudeview mpack arj cabextract file-roller
![Install Archive Applications](http://www.tecmint.com/wp-content/uploads/2015/04/install-archive-apps.jpg)
Install Archive Applications
### 10. Install Chat Application ###
If you want to talk to people all over the world, here is a list of the most popular chat applications for Linux:
- Pidgin
- Skype
- Xchat
- Telegram
- aMSN
- Viber
You can install most of them from Ubuntu Software Center or by using the command line:
$ sudo apt-get install pidgin
$ sudo apt-get install skype
$ sudo apt-get install xchat
$ sudo apt-get install amsn
$ sudo add-apt-repository ppa:atareao/telegram -y
$ sudo apt-get update
$ sudo apt-get install telegram
![Install Chat Applications](http://www.tecmint.com/wp-content/uploads/2015/04/install-chat-apps.jpg)
Install Chat Applications
To install Viber application on Ubuntu visit [Viber official webpage][1], download the Debian package locally and install the viber.deb application using Gdebi package manager (left click > Open with -> GDebi Package Installer).
![Install Viber in Ubuntu](http://www.tecmint.com/wp-content/uploads/2015/04/install-viber.jpg)
Install Viber
### 11. Install Torrent Software ###
The most popular torrent applications and peer-to-peer file sharing programs for Ubuntu are:
- Deluge
- Transmission
- Qbittorrent
- LinuxDC++
To install your favorite peer-to-peer file sharing application on Ubuntu issue the following command on Terminal.
$ sudo apt-get install deluge
$ sudo apt-get install transmission
$ sudo apt-get install qbittorrent
$ sudo apt-get install linuxdcpp
![Install Torrent](http://www.tecmint.com/wp-content/uploads/2015/04/install-torrent.jpg)
Install Torrent
### 12. Install Windows Emulator -Wine and Gaming Support Steam ###
Wine emulator allows you to install and run Windows applications on Linux. On the other hand, Steam is a popular gaming platform for Linux based systems developed by Valve. To install both of them on your machine issue the following command on Terminal or use Ubuntu Software Center.
$ sudo apt-get install steam wine winetricks
![Install Wine](http://www.tecmint.com/wp-content/uploads/2015/04/install-wine.jpg)
Install Wine
### 13. Install Cairo-Dock and Enable Desktop Visual Effects ###
Cairo-Dock is a beautiful and flexible launcher bar for Linux desktops similar to the Mac OS X dock. To install it on Ubuntu, run the following command on Terminal.
$ sudo apt-get install cairo-dock cairo-dock-plug-ins
![Install Cairo Dock](http://www.tecmint.com/wp-content/uploads/2015/04/install-cairo-dock.jpg)
Install Cairo Dock
![Add Cairo Dock at Startup](http://www.tecmint.com/wp-content/uploads/2015/04/add-cairo-dock-startup.jpg)
Add Cairo Dock at Startup
To enable a set of Desktop Effects, such as Cube effect, install Compiz package with the following command:
$ sudo apt-get install compiz compizconfig-settings-manager compiz-plugins-extra
To activate the Desktop Cube effect, search for ccsm on Dash, open CompizConfig Settings Manager, go to General Options > Desktop Size and set Horizontal Virtual Size value to 4 and Vertical Virtual Size to 1. Then go back and check Desktop Cube (Disable Desktop Wall) and Rotate Cube boxes (Resolve Conflicts ->Disable Switch to Viewport 1) and press Ctrl+Alt+Left Mouse Click to view the cube effect.
![Enable Compiz](http://www.tecmint.com/wp-content/uploads/2015/04/enable-compiz.jpg)
Enable Compiz
![Compiz Settings](http://www.tecmint.com/wp-content/uploads/2015/04/compiz-settings.jpg)
Compiz Settings
![Compiz Settings Addons](http://www.tecmint.com/wp-content/uploads/2015/04/compiz-settings-1.jpg)
Compiz Settings Addons
![Desktop Window Rotating](http://www.tecmint.com/wp-content/uploads/2015/04/desktop-cube.jpg)
Desktop Window Rotating
### 14. Add Extra Browser Support ###
Ubuntu 15.04 comes by default with Mozilla Firefox Web Browser. To install other browsers such as Google Chrome or Opera, visit their official web pages, download the provided .deb packages and install them on your system using the Gdebi Package Installer.
![Enable Browser Support](http://www.tecmint.com/wp-content/uploads/2015/04/enable-browser-support.jpg)
Enable Browser Support
![Opera Browser Support](http://www.tecmint.com/wp-content/uploads/2015/04/opera.jpg)
Opera Browser Support
To install Chromium Open Source browser issue the following command on Terminal.
$ sudo apt-get install chromium-browser
### 15. Install Tweak Tools ###
Want extra applications for customizing Ubuntu? Then install Unity Tweak Tool and Gnome Tweak Tool by issuing the following commands on Terminal.
$ sudo apt-get install unity-tweak-tool gnome-tweak-tool
![Install Tweak Tool](http://www.tecmint.com/wp-content/uploads/2015/04/install-tweak-tool.jpg)
Install Tweak Tool
![Tweak Tool Settings](http://www.tecmint.com/wp-content/uploads/2015/04/tweak-settings.jpg)
Tweak Tool Settings
Another interesting tweak tool is represented by the Ubuntu Tweak package which can be obtained and installed by visiting the webpage: [http://ubuntu-tweak.com/][2].
![Tweak Tool: System Information](http://www.tecmint.com/wp-content/uploads/2015/04/tweak-system-info.jpg)
Tweak Tool: System Information
After you have installed all this bunch of software, you might want to clean your system in order to free some space on the hard drive, by issuing the following commands:
$ sudo apt-get -y autoremove
$ sudo apt-get -y autoclean
$ sudo apt-get -y clean
This are just a few tweaks and programs that an average user might install and use on Ubuntu 15.04 Desktop for daily basic utilization. For more advanced programs, features and utilities use Ubuntu Software Center or consult Ubuntu Wiki webpage.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/things-to-do-after-installing-ubuntu-15-04-desktop/
作者:[Matei Cezar][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/cezarmatei/
[1]:http://www.viber.com/en/products/linux
[2]:http://ubuntu-tweak.com/

View File

@ -1,193 +0,0 @@
10 Amazing and Mysterious Uses of (!) Symbol or Operator in Linux Commands
================================================================================
The `'!'` symbol or operator in Linux can be used as Logical Negation operator as well as to fetch commands from history with tweaks or to run previously run command with modification. All the commands below have been checked explicitly in bash Shell. Though I have not checked but a major of these wont run in other shell. Here we go into the amazing and mysterious uses of `'!'` symbol or operator in Linux commands.
### 1. Run a command from history by command number. ###
You might not be aware of the fact that you can run a command from your history command (already/earlier executed commands). To get started first find the command number by running history command.
$ history
![Find Last Executed Commands with History Command](http://www.tecmint.com/wp-content/uploads/2015/05/history-Command.gif)
Now run a command from history just by the number at which it appears, in the output of history. Say run a command that appears at number 1551 in the output of history command.
$ !1551
![Run Last Executed Commands by Number ID](http://www.tecmint.com/wp-content/uploads/2015/05/Run-Commands-By-number.gif)
And, it runs the command ([top command][1] in the above case), that was listed at number 1551. This way to retrieving already executed command is very helpful specially in case of those commands which are long. You just need to call it using **![Number at which it appears in the output of history command]**.
### 2. Run previously executed command as 2nd last command, 7th last command,etc. ###
You may run those commands which you have run previously by their running sequence being the last run command will be represented as -1, second last as -2, seventh last as -7,….
First run history command to get a list of last executed command. It is necessary to run history command, so that you can be sure that there is no command like `rm command > file` and others just to make sure you do not run any dangerous command accidentally. And then check Sixth last command, Eight last command and Tenth last command.
$ history
$ !-6
$ !-8
$ !-10
![Run Last Executed Commands By Numbers](http://www.tecmint.com/wp-content/uploads/2015/05/3.gif)
Run Last Executed Commands By Numbers
### 3. Pass arguments of last command that we run to the new command without retyping ###
I need to list the content of directory /home/$USER/Binary/firefox so I fired.
$ ls /home/$USER/Binary/firefox
Then I realized that I should have fired ls -l to see which file is executable there? So should I type the whole command again! No I dont need. I just need to carry the last argument to this new command as:
$ ls -l !$
Here `!$` will carry arguments passed in last command to this new command.
![Pass Arguments of Last Executed Command to New](http://www.tecmint.com/wp-content/uploads/2015/05/4.gif)
Pass Arguments of Last Executed Command to New
### 4. How to handle two or more arguments using (!) ###
Lets say I created a text file 1.txt on the Desktop.
$ touch /home/avi/Desktop/1.txt
and then copy it to /home/avi/Downloads using complete path on either side with cp command.
$ cp /home/avi/Desktop/1.txt /home/avi/downloads
Now we have passed two arguments with cp command. First is /home/avi/Desktop/1.txt and second is /home/avi/Downloads, lets handle them differently, just execute `echo [arguments]` to print both arguments differently.
$ echo “1st Argument is : !^”
$ echo “2nd Argument is : !cp:2”
Note 1st argument can be printed as `“!^”` and rest of the arguments can be printed by executing `“![Name_of_Command]:[Number_of_argument]”`.
In the above example the first command was cp and 2nd argument was needed to print. Hence `“!cp:2”`, if any command say xyz is run with 5 arguments and you need to get 4th argument, you may use `“!xyz:4”`, and use it as you like. All the arguments can be accessed by `“!*”`.
![Handle Two or More Arguments](http://www.tecmint.com/wp-content/uploads/2015/05/5.gif)
Handle Two or More Arguments
### 5. Execute last command on the basis of keywords ###
We can execute the last executed command on the basis of keywords. We can understand it as follows:
$ ls /home > /dev/null [Command 1]
$ ls -l /home/avi/Desktop > /dev/null [Command 2]
$ ls -la /home/avi/Downloads > /dev/null [Command 3]
$ ls -lA /usr/bin > /dev/null [Command 4]
Here we have used same command (ls) but with different switches and for different folders. Moreover we have sent to output of each command to /dev/null as we are not going to deal with the output of the command also the console remains clean.
Now Execute last run command on the basis of keywords.
$ ! ls [Command 1]
$ ! ls -l [Command 2]
$ ! ls -la [Command 3]
$ ! ls -lA [Command 4]
Check the output and you will be astonished that you are running already executed commands just by `ls` keywords.
![Run Commands Based on Keywords](http://www.tecmint.com/wp-content/uploads/2015/05/6.gif)
Run Commands Based on Keywords
### 6. The power of !! Operator ###
You can run/alter your last run command using `(!!)`. It will call the last run command with alter/tweak in the current command. Lets show you the scenario
Last day I run a one-liner script to get my private IP so I run,
$ ip addr show | grep inet | grep -v 'inet6'| grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d/
Then suddenly I figured out that I need to redirect the output of the above script to a file ip.txt, so what should I do? Should I retype the whole command again and redirect the output to a file? Well an easy solution is to use `UP` navigation key and add `'> ip.txt'` to redirect the output to a file as.
$ ip addr show | grep inet | grep -v 'inet6'| grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d/ > ip.txt
Thanks to the life Savior `UP` navigation key here. Now consider the below condition, the next time I run below one-liner script.
$ ifconfig | grep "inet addr:" | awk '{print $2}' | grep -v '127.0.0.1' | cut -f2 -d:
As soon as I run script, the bash prompt returned an error with the message `“bash: ifconfig: command not found”`, It was not difficult for me to guess I run this command as user where it should be run as root.
So whats the solution? It is difficult to login to root and then type the whole command again! Also (UP Navigation Key) in last example didnt came to rescue here. So? We need to call `“!!”` without quotes, which will call the last command for that user.
$ su -c “!!” root
Here su is switch user which is root, `-c` is to run the specific command as the user and the most important part `!!` will be replaced by command and last run command will be substituted here. Yeah! You need to provide root password.
![The Power of !! Key](http://www.tecmint.com/wp-content/uploads/2015/05/7.gif)
The Power of !! Key
I make use of `!!` mostly in following scenarios,
1. When I run apt-get command as normal user, I usually get an error saying you dont have permission to execute.
$ apt-get upgrade && apt-get dist-upgrade
Opps error…dont worry execute below command to get it successful..
$ su -c !!
Same way I do for,
$ service apache2 start
or
$ /etc/init.d/apache2 start
or
$ systemctl start apache2
OOPS User not authorized to carry such task, so I run..
$ su -c 'service apache2 start'
or
$ su -c '/etc/init.d/apache2 start'
or
$ su -c 'systemctl start apache2'
### 7. Run a command that affects all the file except ![FILE_NAME] ###
The `!` (Logical NOT) can be used to run the command on all the files/extension except that is behind `'!'`.
A. Remove all the files from a directory except the one the name of which is 2.txt.
$ rm !(2.txt)
B. Remove all the file type from the folder except the one the extension of which is pdf.
$ $ rm !(*.pdf)
### 8. Check if a directory (say /home/avi/Tecmint)exist or not? Printf if the said directory exist or not. ###
Here we will use `'! -d'` to validate if the directory exist or not followed by Logical AND Operator `(&&)` to print that directory does not exist and Logical OR Operator `(||)` to print the directory is present.
Logic is, when the output of `[ ! -d /home/avi/Tecmint ]` is 0, it will execute what lies beyond Logical AND else it will go to Logical OR `(||)` and execute what lies beyond Logical OR.
$ [ ! -d /home/avi/Tecmint ] && printf '\nno such /home/avi/Tecmint directory exist\n' || printf '\n/home/avi/Tecmint directory exist\n'
### 9. Check if a directory exist or not? If not exit the command. ###
Similar to the above condition, but here if the desired directory doesnt exist it will exit the command.
$ [ ! -d /home/avi/Tecmint ] && exit
### 10. Create a directory (say test) in your home directory if it does not exist. ###
A general implementation in Scripting Language where if the desired directory does not exist, it will create one.
[ ! -d /home/avi/Tecmint ] && mkdir /home/avi/Tecmint
Thats all for now. If you know or come across any other use of `'!'` which is worth knowing, you may like to provide us with your suggestion in the feedback. Keep connected!
--------------------------------------------------------------------------------
via: http://www.tecmint.com/mysterious-uses-of-symbol-or-operator-in-linux-commands/
作者:[Avishek Kumar][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/avishek/
[1]:http://www.tecmint.com/12-top-command-examples-in-linux/

View File

@ -1,114 +0,0 @@
Linux FAQs with Answers--How to block specific user agents on nginx web server
================================================================================
> **Question**: I notice that some robots often visit my nginx-powered website and scan it aggressively, ending up wasting a lot of my web server resources. I am trying to block those robots based on their user-agent string. How can I block specific user agent(s) on nginx web server?
The modern Internet is infested with various malicious robots and crawlers such as malware bots, spambots or content scrapers which are scanning your website in surreptitious ways, for example to detect potential website vulnerabilities, harvest email addresses, or just to steal content from your website. Many of these robots can be identified by their signature "user-agent" string.
As a first line of defense, you could try to block malicious bots from accessing your website by blacklisting their user-agents in robots.txt file. However, unfortunately this works only for "well-behaving" robots which are designed to obey robots.txt. Many malicious bots can simply ignore robots.txt and scan your website at will.
An alternative way to block particular robots is to configure your web server, such that it refuses to serve content to requests with certain user-agent strings. This post explains how to **block certain user-agent on nginx web server**.
### Blacklist Certain User-Agents in Nginx ###
To configure user-agent block list, open the nginx configuration file of your website, where the server section is defined. This file can be found in different places depending on your nginx setup or Linux distribution (e.g., /etc/nginx/nginx.conf, /etc/nginx/sites-enabled/<your-site>, /usr/local/nginx/conf/nginx.conf, /etc/nginx/conf.d/<your-site>).
server {
listen 80 default_server;
server_name xmodulo.com;
root /usr/share/nginx/html;
....
}
Once you open the config file with the server section, add the following if statement(s) somewhere inside the section.
server {
listen 80 default_server;
server_name xmodulo.com;
root /usr/share/nginx/html;
# case sensitive matching
if ($http_user_agent ~ (Antivirx|Arian) {
return 403;
}
# case insensitive matching
if ($http_user_agent ~* (netcrawl|npbot|malicious)) {
return 403;
}
....
}
As you can guess, these if statements match any bad user-string with regular expressions, and return 403 HTTP status code when a match is found. $http_user_agent is a variable that contains the user-agent string of an HTTP request. The '~' operator does case-sensitive matching against user-agent string, while the '~' operator does case-insensitive matching. The '|' operator is logical-OR, so you can put as many user-agent keywords in the if statements, and block them all.
After modifying the configuration file, you must reload nginx to activate the blocking:
$ sudo /path/to/nginx -s reload
You can test user-agent blocking by using wget with "--user-agent" option.
$ wget --user-agent "malicious bot" http://<nginx-ip-address>
![](https://farm6.staticflickr.com/5333/17434036358_ef139a6b59_b.jpg)
### Manage User-Agent Blacklist in Nginx ###
So far, I have shown how to block HTTP requests with a few user-agents in nginx. What if you have many different types of crawling bots to block?
Since the user-agent blacklist can grow very big, it is not a good idea to put them all inside your nginx's server section. Instead, you can create a separate file which lists all blocked user agents. For example, let's create /etc/nginx/useragent.rules, and define a map with all blocked user agents in the following format.
$ sudo vi /etc/nginx/useragent.rules
----------
map $http_user_agent $badagent {
default 0;
~*malicious 1;
~*backdoor 1;
~*netcrawler 1;
~Antivirx 1;
~Arian 1;
~webbandit 1;
}
Similar to the earlier setup, '~*' will match a keyword in case-insensitive manner, while '~' will match a keyword using a case-sensitive regular expression. The line that says "default 0" means that any other user-agent not listed in the file will be allowed.
Next, open an nginx configuration file of your website, which contains http section, and add the following line somewhere inside the http section.
http {
.....
include /etc/nginx/useragent.rules
}
Note that this include statement must appear before the server section (this is why we add it inside http section).
Now open an nginx configuration where your server section is defined, and add the following if statement:
server {
....
if ($badagent) {
return 403;
}
....
}
Finally, reload nginx.
$ sudo /path/to/nginx -s reload
Now any user-agent which contains a keyword listed in /etc/nginx/useragent.rules will be automatically banned by nginx.
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/block-specific-user-agents-nginx-web-server.html
作者:[Dan Nanni][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni

View File

@ -1,45 +0,0 @@
Linux FAQs with Answers--How to fix “404 Not Found” error with “apt-get update” on old Ubuntu
================================================================================
> **Question**: I have old Ubuntu 13.04 (Raring Ringtail) installation on my PC. When I run "sudo apt-get update" on it, it throws a bunch of "404 Not Found" errors, and I cannot install or update any package using apt-get or aptitude. Due to this error I cannot even upgrade it to a newer release. How can I fix this problem?
![](https://farm6.staticflickr.com/5460/17634085636_996b2a8ab5_b.jpg)
Every Ubuntu release has its end-of-life (EOL) time; regular Ubuntu releases are supported for 18 months, while LTS (Long Term Support) versions are supported up to 3 years (server edition) and 5 years (desktop edition). Once a Ubuntu release has reached EOL, its repositories will no longer be accessible, and you won't get any maintenance updates and security patches from Canonical. As of this writing, Ubuntu 13.04 (Raring Ringtail) has already reached EOL.
If the Ubuntu system you are using is EOL-ed, you will get the following 404 errors from apt-get or aptitude as its repositories have been deprecated.
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-backports/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/raring/main/binary-amd64/Packages 404 Not Found
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/universe/binary-i386/Packages 404 Not Found [IP: 91.189.88.149 80]
E: Some index files failed to download. They have been ignored, or old ones used instead
For those users who are using old versions of Ubuntu, Canonical maintains old-releases.ubuntu.com, which is an archive of EOL-ed repositories. Thus, when Canonical's support for your Ubuntu installation ends, you need to switch to repositories at old-releases.ubuntu.com (unless you want to upgrade it before EOL).
Here is a quick way to fix "404 Not Found" errors on old Ubuntu by switching to old-releases repositories.
First, replace main/security repositories with old-releases versions as follows.
$ sudo sed -i -r 's/([a-z]{2}\.)?archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
$ sudo sed -i -r 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
Then open /etc/apt/sources.list with a text editor, and look for extras.ubuntu.com. This repository is also no longer supported for 13.04. So you need to comment out extras.ubuntu.com by prepending '#' sign.
#deb http://extras.ubuntu.com/ubuntu raring main
#deb-src http://extras.ubuntu.com/ubuntu raring main
Now you should be able to install or update packages on an old unsupported Ubuntu release.
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/404-not-found-error-apt-get-update-ubuntu.html
作者:[Dan Nanni][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni

View File

@ -1,33 +0,0 @@
Linux FAQs with Answers--How to fix “fatal error: security/pam_modules.h: No such file or directory”
================================================================================
> **Question**: I was trying to compile a program on [insert your Linux distro], but was getting the following compile error:
>
> "pam_otpw.c:27:34: fatal error: security/pam_modules.h: No such file or directory"
>
> How can I fix this error?
The missing header file 'security/pam_modules.h' is part of development files for libpam, a PAM (Pluggable Authentication Modules) library. Thus to fix this error, you need to install libpam development package, as described below.
On Debian, Ubuntu or Linux Mint:
$ sudo apt-get install libpam0g-dev
On CentOS, Fedora or RHEL:
$ sudo yum install gcc pam-devel
Now verify that the missing header file is installed under /usr/include/security.
![](https://farm8.staticflickr.com/7751/16819069693_fa961f0d40_b.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/fatal-error-security-pam-modules.html
作者:[Dan Nanni][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni

View File

@ -1,58 +0,0 @@
Translating by GOLinux
Linux FAQs with Answers--How to view threads of a process on Linux
================================================================================
> **Question**: My program creates and executes multiple threads in it. How can I monitor individual threads of the program once they are created? I would like to see the details (e.g., CPU/memory usage) of individual threads with their names.
Threads are a popular programming abstraction for parallel execution on modern operating systems. When threads are forked inside a program for multiple flows of execution, these threads share certain resources (e.g., memory address space, open files) among themselves to minimize forking overhead and avoid expensive IPC (inter-process communication) channel. These properties make threads an efficient mechanism for concurrent execution.
In Linux, threads (also called Lightweight Processes (LWP)) created within a program will have the same "thread group ID" as the program's PID. Each thread will then have its own thread ID (TID). To the Linux kernel's scheduler, threads are nothing more than standard processes which happen to share certain resources. Classic command-line tools such as ps or top, which display process-level information by default, can be instructed to display thread-level information.
Here are several ways to **show threads for a process on Linux**.
### Method One: PS ###
In ps command, "-T" option enables thread views. The following command list all threads created by a process with <pid>.
$ ps -T -p <pid>
![](https://farm8.staticflickr.com/7749/17350561110_94cacfc456_c.jpg)
The "SID" column represents thread IDs, and "CMD" column shows thread names.
### Method Two: Top ###
The top command can show a real-time view of individual threads. To enable thread views in the top output, invoke top with "-H" option. This will list all Linux threads. You can also toggle on or off thread view mode while top is running, by pressing 'H' key.
$ top -H
![](https://farm9.staticflickr.com/8824/17350561070_3dfe447974_c.jpg)
To restrict the top output to a particular process <pid> and check all threads running inside the process:
$ top -H -p <pid>
![](https://farm8.staticflickr.com/7797/17538002751_c8a3d574d8_c.jpg)
### Method Three: Htop ###
A more user-friendly way to view threads per process is via htop, an ncurses-based interactive process viewer. This program allows you to monitor individual threads in tree views.
To enable thread views in htop, launch htop, and press <F2> to enter htop setup menu. Choose "Display option" under "Setup" column, and toggle on "Three view" and "Show custom thread names" options. Presss <F10> to exit the setup.
![](https://farm6.staticflickr.com/5338/17350364568_59bce22e7b_b.jpg)
Now you will see the follow threaded view of individual processes.
![](https://farm9.staticflickr.com/8885/17350560930_98952d5350_c.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/view-threads-process-linux.html
作者:[Dan Nanni][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni

View File

@ -1,81 +0,0 @@
Linux FAQs with Answers--What is the Apache error log location on Linux
================================================================================
> **Question**: I am trying to troubleshoot Apache web server errors on my Linux system. Where is the Apache error log file located on [insert your Linux distro]?
Error log and access log files are a useful piece of information for system admins, for example to troubleshoot their web server, [protect][1] it from various malicious activities, or just to run [various][2] [analytics][3] for HTTP server monitoring. Depending on your web server setup, its error/access logs may be found in different places on your system.
This post may help you **find Apache error log location on Linux**.
![](https://farm8.staticflickr.com/7664/16958522954_4852ab5ea5_c.jpg)
### Apache Error Log Location on Debian, Ubuntu or Linux Mint ###
#### Default Error Log ####
On Debian-based Linux, the system-wide default location of Apache error log is **/var/log/apache2/error.log**. The default location can be customized by editing Apache configuration file.
#### Custom Error Log ####
To find a custom error log location, open /etc/apache2/apache2.conf with a text editor, and look for a line that starts with ErrorLog. This line specifies a custom location of Apache error log file. For example, the unmodified Apache configuration file has the following line:
ErrorLog ${APACHE_LOG_DIR}/error.log
In this case, the location is configured using APACHE_LOG_DIR environment variable, which is defined in /etc/apache2/envvars.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
In reality, ErrorLog may point to any arbitrary path on your Linux system.
#### Custom Error Log with VirtualHost ####
If VirtualHost is used in Apache web server, ErrorLog directive can be specified within VirtualHost container, in which case the system-wide error log location described above will be ignored.
With VirtualHost enabled, each VirtualHost can define its own custom error log location. To find out the error log location of a particular VirtualHost, you can open /etc/apache2/sites-enabled/<your-site>.conf, and look for ErrorLog directive, which will show a site-specific error log file.
### Apache Error Log Location on CentOS, Fedora or RHEL ###
#### Default Error Log ####
On Red Hat based Linux, a system-wide Apache error log file is by default placed in **/var/log/httpd/error_log**. This default location can be customized by editing Apache configuration file.
#### Custom Error Log ####
To find out the custom location of Apache error log, open /etc/httpd/conf/httpd.conf with a text editor, and look for ServerRoot, which shows the top of the Apache server directory tree, under which log files and configurations are located. For example:
ServerRoot "/etc/httpd"
Now look for a line that starts with ErrorLog, which indicates where Apache web server is writing its error logs. Note that the specified location is relative to the ServerRoot value. For example:
ErrorLog "log/error_log"
Combine the above two directives to obtain the full path of an error log, which is by default /etc/httpd/logs/error_log. This is a symlink to /var/log/httpd/error_log with freshly installed Apache.
In reality, ErrorLog may point to any arbitrary location on your Linux system.
#### Custom Error Log with VirtualHost ####
If you enabled VirtualHost, you can find the error log location of individual VirtualHosts by checking /etc/httpd/conf/httpd.conf (or any file where VirtualHost is defined). Look for ErrorLog inside individual VirtualHost sections. For example, in the following VirtualHost section, an error log is found in /var/www/xmodulo.com/logs/error_log.
<VirtualHost *:80>
ServerAdmin webmaster@xmodulo.com
DocumentRoot /var/www/xmodulo.com/public_html
ServerName www.xmodulo.com
ServerAlias xmodulo.com
ErrorLog /var/www/xmodulo.com/logs/error_log
CustomLog /var/www/xmodulo.com/logs/access_log
<VirtualHost>
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/apache-error-log-location-linux.html
作者:[Dan Nanni][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni
[1]:http://xmodulo.com/configure-fail2ban-apache-http-server.html
[2]:http://xmodulo.com/interactive-apache-web-server-log-analyzer-linux.html
[3]:http://xmodulo.com/sql-queries-apache-log-files-linux.html

View File

@ -0,0 +1,182 @@
translating by zhangboyue
Analyzing Linux Logs
================================================================================
Theres a great deal of information waiting for you within your logs, although its not always as easy as youd like to extract it. In this section we will cover some examples of basic analysis you can do with your logs right away (just search whats there). Well also cover more advanced analysis that may take some upfront effort to set up properly, but will save you time on the back end. Examples of advanced analysis you can do on parsed data include generating summary counts, filtering on field values, and more.
Well show you first how to do this yourself on the command line using several different tools and then show you how a log management tool can automate much of the grunt work and make this so much more streamlined.
### Searching with Grep ###
Searching for text is the most basic way to find what youre looking for. The most common tool for searching text is [grep][1]. This command line tool, available on most Linux distributions, allows you to search your logs using regular expressions. A regular expression is a pattern written in a special language that can identify matching text. The simplest pattern is to put the string youre searching for surrounded by quotes
#### Regular Expressions ####
Heres an example to find authentication logs for “user hoover” on an Ubuntu system:
$ grep "user hoover" /var/log/auth.log
Accepted password for hoover from 10.0.2.2 port 4792 ssh2
pam_unix(sshd:session): session opened for user hoover by (uid=0)
pam_unix(sshd:session): session closed for user hoover
It can be hard to construct regular expressions that are accurate. For example, if we searched for a number like the port “4792” it could also match timestamps, URLs, and other undesired data. In the below example for Ubuntu, it matched an Apache log that we didnt want.
$ grep "4792" /var/log/auth.log
Accepted password for hoover from 10.0.2.2 port 4792 ssh2
74.91.21.46 - - [31/Mar/2015:19:44:32 +0000] "GET /scripts/samples/search?q=4972HTTP/1.0" 404 545 "-" "-”
#### Surround Search ####
Another useful tip is that you can do surround search with grep. This will show you what happened a few lines before or after a match. It can help you debug what lead up to a particular error or problem. The B flag gives you lines before, and A gives you lines after. For example, we can see that when someone failed to login as an admin, they also failed the reverse mapping which means they might not have a valid domain name. This is very suspicious!
$ grep -B 3 -A 2 'Invalid user' /var/log/auth.log
Apr 28 17:06:20 ip-172-31-11-241 sshd[12545]: reverse mapping checking getaddrinfo for 216-19-2-8.commspeed.net [216.19.2.8] failed - POSSIBLE BREAK-IN ATTEMPT!
Apr 28 17:06:20 ip-172-31-11-241 sshd[12545]: Received disconnect from 216.19.2.8: 11: Bye Bye [preauth]
Apr 28 17:06:20 ip-172-31-11-241 sshd[12547]: Invalid user admin from 216.19.2.8
Apr 28 17:06:20 ip-172-31-11-241 sshd[12547]: input_userauth_request: invalid user admin [preauth]
Apr 28 17:06:20 ip-172-31-11-241 sshd[12547]: Received disconnect from 216.19.2.8: 11: Bye Bye [preauth]
#### Tail ####
You can also pair grep with [tail][2] to get the last few lines of a file, or to follow the logs and print them in real time. This is useful if you are making interactive changes like starting a server or testing a code change.
$ tail -f /var/log/auth.log | grep 'Invalid user'
Apr 30 19:49:48 ip-172-31-11-241 sshd[6512]: Invalid user ubnt from 219.140.64.136
Apr 30 19:49:49 ip-172-31-11-241 sshd[6514]: Invalid user admin from 219.140.64.136
A full introduction on grep and regular expressions is outside the scope of this guide, but [Ryans Tutorials][3] include more in-depth information.
Log management systems have higher performance and more powerful searching abilities. They often index their data and parallelize queries so you can quickly search gigabytes or terabytes of logs in seconds. In contrast, this would take minutes or in extreme cases hours with grep. Log management systems also use query languages like [Lucene][4] which offer an easier syntax for searching on numbers, fields, and more.
### Parsing with Cut, AWK, and Grok ###
#### Command Line Tools ####
Linux offers several command line tools for text parsing and analysis. They are great if you want to quickly parse a small amount of data but can take a long time to process large volumes of data
#### Cut ####
The [cut][5] command allows you to parse fields from delimited logs. Delimiters are characters like equal signs or commas that break up fields or key value pairs.
Lets say we want to parse the user from this log:
pam_unix(su:auth): authentication failure; logname=hoover uid=1000 euid=0 tty=/dev/pts/0 ruser=hoover rhost= user=root
We can use the cut command like this to get the text after the eighth equal sign. This example is on an Ubuntu system:
$ grep "authentication failure" /var/log/auth.log | cut -d '=' -f 8
root
hoover
root
nagios
nagios
#### AWK ####
Alternately, you can use [awk][6], which offers more powerful features to parse out fields. It offers a scripting language so you can filter out nearly everything thats not relevant.
For example, lets say we have the following log line on an Ubuntu system and we want to extract the username that failed to login:
Mar 24 08:28:18 ip-172-31-11-241 sshd[32701]: input_userauth_request: invalid user guest [preauth]
Heres how you can use the awk command. First, put a regular expression /sshd.*invalid user/ to match the sshd invalid user lines. Then print the ninth field using the default delimiter of space using { print $9 }. This outputs the usernames.
$ awk '/sshd.*invalid user/ { print $9 }' /var/log/auth.log
guest
admin
info
test
ubnt
You can read more about how to use regular expressions and print fields in the [Awk Users Guide][7].
#### Log Management Systems ####
Log management systems make parsing easier and enable users to quickly analyze large collections of log files. They can automatically parse standard log formats like common Linux logs or web server logs. This saves a lot of time because you dont have to think about writing your own parsing logic when troubleshooting a system problem.
Here you can see an example log message from sshd which has each of the fields remoteHost and user parsed out. This is a screenshot from Loggly, a cloud-based log management service.
![](http://www.loggly.com/ultimate-guide/wp-content/uploads/2015/05/Screen-Shot-2015-03-12-at-11.25.09-AM.png)
You can also do custom parsing for non-standard formats. A common tool to use is [Grok][8] which uses a library of common regular expressions to parse raw text into structured JSON. Here is an example configuration for Grok to parse kernel log files inside Logstash:
filter{
grok {
match => {"message" => "%{CISCOTIMESTAMP:timestamp} %{HOST:host} %{WORD:program}%{NOTSPACE} %{NOTSPACE}%{NUMBER:duration}%{NOTSPACE} %{GREEDYDATA:kernel_logs}"
}
}
And here is what the parsed output looks like from Grok:
![](http://www.loggly.com/ultimate-guide/wp-content/uploads/2015/05/Screen-Shot-2015-03-12-at-11.30.37-AM.png)
### Filtering with Rsyslog and AWK ###
Filtering allows you to search on a specific field value instead of doing a full text search. This makes your log analysis more accurate because it will ignore undesired matches from other parts of the log message. In order to search on a field value, you need to parse your logs first or at least have a way of searching based on the event structure.
#### How to Filter on One App ####
Often, you just want to see the logs from just one application. This is easy if your application always logs to a single file. Its more complicated if you need to filter one application among many in an aggregated or centralized log. Here are several ways to do this:
1. Use the rsyslog daemon to parse and filter logs. This example writes logs from the sshd application to a file named sshd-messages, then discards the event so its not repeated elsewhere. You can try this example by adding it to your rsyslog.conf file.
:programname, isequal, “sshd” /var/log/sshd-messages
&~
2. Use command line tools like awk to extract the values of a particular field like the sshd username. This example is from an Ubuntu system.
$ awk '/sshd.*invalid user/ { print $9 }' /var/log/auth.log
guest
admin
info
test
ubnt
3. Use a log management system that automatically parses your logs, then click to filter on the desired application name. Here is a screenshot showing the syslog fields in a log management service called Loggly. We are filtering on the appName “sshd” as indicated by the Venn diagram icon.
![](http://www.loggly.com/ultimate-guide/wp-content/uploads/2015/05/Screen-Shot-2015-03-12-at-11.05.02-AM.png)
#### How to Filter on Errors ####
One of the most common thing people want to see in their logs is errors. Unfortunately, the default syslog configuration doesnt output the severity of errors directly, making it difficult to filter on them.
There are two ways you can solve this problem. First, you can modify your rsyslog configuration to output the severity in the log file to make it easier to read and search. In your rsyslog configuration you can add a [template][9] with pri-text such as the following:
"<%pri-text%> : %timegenerated%,%HOSTNAME%,%syslogtag%,%msg%n"
This example gives you output in the following format. You can see that the severity in this message is err.
<authpriv.err> : Mar 11 18:18:00,hoover-VirtualBox,su[5026]:, pam_authenticate: Authentication failure
You can use awk or grep to search for just the error messages. In this example for Ubuntu, were including some surrounding syntax like the . and the > which match only this field.
$ grep '.err>' /var/log/auth.log
<authpriv.err> : Mar 11 18:18:00,hoover-VirtualBox,su[5026]:, pam_authenticate: Authentication failure
Your second option is to use a log management system. Good log management systems automatically parse syslog messages and extract the severity field. They also allow you to filter on log messages of a certain severity with a single click.
Here is a screenshot from Loggly showing the syslog fields with the error severity highlighted to show we are filtering for errors:
![](http://www.loggly.com/ultimate-guide/wp-content/uploads/2015/05/Screen-Shot-2015-03-12-at-11.00.36-AM.png)
--------------------------------------------------------------------------------
via: http://www.loggly.com/ultimate-guide/logging/analyzing-linux-logs/
作者:[Jason Skowronski][a] [Amy Echeverri][b] [ Sadequl Hussain][c]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.linkedin.com/in/jasonskowronski
[b]:https://www.linkedin.com/in/amyecheverri
[c]:https://www.linkedin.com/pub/sadequl-hussain/14/711/1a7
[1]:http://linux.die.net/man/1/grep
[2]:http://linux.die.net/man/1/tail
[3]:http://ryanstutorials.net/linuxtutorial/grep.php
[4]:https://lucene.apache.org/core/2_9_4/queryparsersyntax.html
[5]:http://linux.die.net/man/1/cut
[6]:http://linux.die.net/man/1/awk
[7]:http://www.delorie.com/gnu/docs/gawk/gawk_26.html#IDX155
[8]:http://logstash.net/docs/1.4.2/filters/grok
[9]:http://www.rsyslog.com/doc/v8-stable/configuration/templates.html

View File

@ -0,0 +1,301 @@
Translating by ZTinoZ
20 Useful Terminal Emulators for Linux
================================================================================
A Terminal emulator is a computer program that reproduces a video terminal within some other display structure. In other words the Terminal emulator has an ability to make a dumb machine appear like a client computer networked to the server. The terminal emulator allows an end user to access console as well as its applications such as text user interface and command line interface.
![Linux Terminal Emulators](http://www.tecmint.com/wp-content/uploads/2014/01/Linux-Terminal-Emulators1.jpeg)
20 Linux Terminal Emulators
You may find huge number of terminal emulators to choose from this open source world. Some of them offers large range of features while others offers less features. To give a better understanding to the quality of software that are available, we have gathered a list of marvelous terminal emulator for Linux. Each title provides its description and feature along with screenshot of the software with relevant download link.
### 1. Terminator ###
Terminator is an advanced and powerful terminal emulator which supports multiple terminals windows. This emulator is fully customizable. You can change the size, colour, give different shapes to the terminal. Its very user friendly and fun to use.
#### Features of Terminator ####
- Customize your profiles and colour schemes, set the size to fit your needs.
- Use plugins to get even more functionality.
- Several key-shortcuts are available to speed up common activities.
- Split the terminal window into several virtual terminals and re-size them as needed.
![Terminator Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Terminator-Emulator.jpeg)
Terminator Terminal
- [Terminator Homepage][1]
- [Download and Installation Instructions][2]
### 2. Tilda ###
Tilda is a stylish drop-down terminal based on GTK+. With the help of a single key press you can launch a new or hide Tilda window. However, you can add colors of your choice to change the look of the text and Terminal background.
#### Features of Tilda ####
Interface with Highly customization option.
You can set the transparency level for Tilda window.
Excellent built-in colour schemes.
![Tilda Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Tilda-Emulator.jpeg)
Tilda Terminal
- [Tilda Homepage][3]
### 3. Guake ###
Guake is a python based drop-down terminal created for the GNOME Desktop Environment. It is invoked by pressing a single keystroke, and can make it hidden by pressing same keystroke again. Its design was determined from FPS (First Person Shooter) games such as Quake and one of its main target is be easy to reach.
Guake is very much similar to Yakuaka and Tilda, but its an experiment to mix the best of them into a single GTK-based program. Guake has been written in python from scratch using a little piece in C (global hotkeys stuff).
![Guake Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Guake-Terminal.jpeg)
Guake Terminal
- [Guake Homepage][4]
### 4. Yakuake ###
Yakuake (Yet Another Kuake) is a KDE based drop-down terminal emulator very much similar to Guake terminal emulator in functionality. Its design was inspired from fps consoles games such as Quake.
Yakuake is basically a KDE application, which can be easily installed on KDE desktop, but if you try to install Yakuake in GNOME desktop, it will prompt you to install huge number of dependency packages.
#### Yakuake Features ####
- Fluently turn down from the top of your screen
- Tabbed interface
- Configurable dimensions and animation speed
- Customizable
![Yakuake Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Yakuake-Terminal.jpeg)
Yakuake Terminal
- [Yakuake Homepage][5]
### 5. ROXTerm ###
ROXterm is yet another lightweight terminal emulator designed to provide similar features to gnome-terminal. It was originally constructed to have lesser footprints and faster start-up time by not using the Gnome libraries and by using a independent applet to bring the configuration interface (GUI), but over the time its role has shifted to bringing a higher range of features for power users.
However, it is more customizable than gnome-terminal and anticipated more at “power” users who make excessive use of terminals. It is easily integrated with GNOME desktop environment and provides features like drag & drop of items into terminal.
![Roxterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Roxterm-Terminal.jpeg)
Roxterm Terminal
- [ROXTerm Homepage][6]
### 6. Eterm ###
Eterm is a lightest color terminal emulator designed as a replacement for xterm. It is developed with a Freedom of Choice ideology, leaving as much power, flexibility, and freedom as workable in the hands of the user.
![Eterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Eterm-Terminal.jpeg)
Eterm Terminal
- [Eterm Homepage][7]
### 7. Rxvt ###
Rxvt stands for extended virtual terminal is a color terminal emulator application for Linux intended as an xterm replacement for power users who dont need to have a feature such as Tektronix 4014 emulation and toolkit-style configurability.
![Rxvt Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Rxvt-Terminal.jpeg)
Rxvt Terminal
- [Rxvt Homepage][8]
### 8. Wterm ###
Wterm is a another light weight color terminal emulator based on rxvt project. It includes features such as background images, transparency, reverse transparency and an considerable set or runtime options are accessible resulting in a very high customizable terminal emulator.
![wterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/wterm-Terminal-.jpeg)
wterm Terminal
- [Wterm Homepage][9]
### 9. LXTerminal ###
LXTerminal is a default VTE-based terminal emulator for LXDE (Lightweight X Desktop Environment) without any unnecessary dependency. The terminal has got some nice features such as.
LXTerminal Features
- Multiple tabs support
- Supports common commands like cp, cd, dir, mkdir, mvdir.
- Feature to hide the menu bar for saving space
- Change the color scheme.
![lxterminal Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/lxterminal-Terminal.jpeg)
lxterminal Terminal
- [LXTerminal Homepage][10]
### 10. Konsole ###
Konsole is yet another powerful KDE based free terminal emulator was originally created by Lars Doelle.
Konsole Features
- Multiple Tabbed terminals.
- Translucent backgrounds.
- Support for Split-view mode.
- Directory and SSH bookmarking.
- Customizable color schemes.
- Customizable key bindings.
- Notification alerts about activity in a terminal.
- Incremental search
- Support for Dolphin file manager
- Export of output in plain text or HTML format.
![Konsole Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Konsole-Terminal.jpeg)
Konsole Terminal
- [Konsole Homepage][11]
### 11. TermKit ###
TermKit is a elegant terminal that aims to construct aspects of the GUI with the command line based application using WebKit rendering engine mostly used in web browsers like Google Chrome and Chromium. TermKit is originally designed for Mac and Windows, but due to TermKit fork by Floby which you can now able to install it under Linux based distributions and experience the power of TermKit.
![TermKit Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/TermKit-Terminal.jpeg)
TermKit Terminal
- [TermKit Homepage][12]
12. st
st is a simple terminal implementation for X Window.
![st terminal](http://www.tecmint.com/wp-content/uploads/2014/01/st-terminal.png)
st terminal
- [st Homepage][13]
### 13. Gnome-Terminal ###
GNOME terminal is a built-in terminal emulator for GNOME desktop environment developed by Havoc Pennington and others. It allow users to run commands using a real Linux shell while remaining on the on the GNOME environment. GNOME Terminal emulates the xterm terminal emulator and brings a few similar features.
The Gnome terminal supports multiple profiles, where users can able to create multiple profiles for his/her account and can customize configuration options such as fonts, colors, background image, behavior, etc. per account and define a name to each profile. It also supports mouse events, url detection, multiple tabs, etc.
![Gnome Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Gnome-terminal.jpg)
Gnome Terminal
- [Gnome Terminal][14]
### 14. Final Term ###
Final Term is a open source stylish terminal emulator that has some exciting capabilities and handy features into one single beautiful interface. It is still under development, but provides significant features such as Semantic text menus, Smart command completion, GUI terminal controls, Omnipotent keybindings, Color support and many more. The following animated screen grab demonstrates some of their features. Please click on image to view demo.
![FinalTerm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/FinalTerm.gif)
FinalTerm Terminal
- [Final Term][15]
### 15. Terminology ###
Terminology is yet another new modern terminal emulator created for the Enlightenment desktop, but also can be used in different desktop environments. It has some awesome unique features, which do not have in any other terminal emulator.
Apart features, terminology offers even more things that you wouldnt assume from a other terminal emulators, like preview thumbnails of images, videos and documents, it also allows you to see those files directly from Terminology.
You can watch a following demonstrations video created by the Terminology developer (the video quality isnt clear, but still its enough to get the idea about Terminology).
<iframe width="630" height="480" frameborder="0" allowfullscreen="" src="//www.youtube.com/embed/ibPziLRGvkg"></iframe>
- [Terminology][16]
### 16. Xfce4 terminal ###
Xfce terminal is a lightweight modern and easy to use terminal emulator specially designed for Xfce desktop environment. The latest release of xfce terminal has some new cool features such as search dialog, tab color changer, drop-down console like Guake or Yakuake and many more.
![Xfce Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/xfce-terminal.jpg)
Xfce Terminal
- [Xfce4 Terminal][17]
### 17. xterm ###
The xterm application is a standard terminal emulator for the X Window System. It maintain DEC VT102 and Tektronix 4014 compatible terminals for applications that cant use the window system directly.
![xterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/xterm.jpg)
xterm Terminal
- [xterm][18]
### 18. LilyTerm ###
The LilyTerm is a another less known open source terminal emulator based off of libvte that desire to be fast and lightweight. LilyTerm also include some key features such as:
- Support for tabbing, coloring and reordering tabs
- Ability to manage tabs through keybindings
- Support for background transparency and saturation.
- Support for user specific profile creation.
- Several customization options for profiles.
- Extensive UTF-8 support.
![Lilyterm Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/Lilyterm.jpg)
Lilyterm Terminal
- [LilyTerm][19]
### 19. Sakura ###
The sakura is a another less known Unix style terminal emulator developed for command line purpose as well as text-based terminal programs. Sakura is based on GTK and livte and provides not more advanced features but some customization options such as multiple tab support, custom text color, font and background images, speedy command processing and few more.
![Sakura Terminal](http://www.tecmint.com/wp-content/uploads/2014/01/sakura.jpg)
Sakura Terminal
- [Sakura][20]
### 20. rxvt-unicode ###
The rxvt-unicode (also known as urxvt) is a yet another highly customizable, lightweight and fast terminal emulator with xft and unicode support was developed by Marc Lehmann. It got some outstanding features such as support for international language via Unicode, the ability to display multiple font types and support for Perl extensions.
![rxvt unicode](http://www.tecmint.com/wp-content/uploads/2014/01/rxvt-unicode.png)
rxvt unicode
- [rxvt-unicode][21]
If you know any other capable Linux terminal emulators that Ive not included in the above list, please do share with me using our comment section.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/linux-terminal-emulators/
作者:[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]:https://launchpad.net/terminator
[2]:http://www.tecmint.com/terminator-a-linux-terminal-emulator-to-manage-multiple-terminal-windows/
[3]:http://tilda.sourceforge.net/tildaabout.php
[4]:https://github.com/Guake/guake
[5]:http://extragear.kde.org/apps/yakuake/
[6]:http://roxterm.sourceforge.net/index.php?page=index&lang=en
[7]:http://www.eterm.org/
[8]:http://sourceforge.net/projects/rxvt/
[9]:http://sourceforge.net/projects/wterm/
[10]:http://wiki.lxde.org/en/LXTerminal
[11]:http://konsole.kde.org/
[12]:https://github.com/unconed/TermKit
[13]:http://st.suckless.org/
[14]:https://help.gnome.org/users/gnome-terminal/stable/
[15]:http://finalterm.org/
[16]:http://www.enlightenment.org/p.php?p=about/terminology
[17]:http://docs.xfce.org/apps/terminal/start
[18]:http://invisible-island.net/xterm/
[19]:http://lilyterm.luna.com.tw/
[20]:https://launchpad.net/sakura
[21]:http://software.schmorp.de/pkg/rxvt-unicode

View File

@ -0,0 +1,79 @@
3 Useful Hacks Every Linux User Must Know
================================================================================
The world of Linux is filled with so much fun and interesting stuffs, the more we go in, the more we find stuffs. In our efforts to bring those little hacks and tips for you that makes you different from others, here we have came up with three little tricks.
### 1. How to Schedule a Linux Job Without Cron ###
Scheduling a job/command in Linux is acronym to cron. Whenever we need to schedule a job, we call cron, but do you know we can schedule a job at a later time without corn? You can do it as suggested below..
Run a command (say date) every 5 sec and write the output to a file (say date.txt). To achieve this scenario, we need to run the below one liner script directly on the command prompt.
$ while true; do date >> date.txt ; sleep 5 ; done &
Anatomy of the above one liner script:
- while true Ask script to run while the condition is true, it acts as a loop which makes the command to run again-and-again or say in a loop.
- do do perform what follows, ie., execute command or set of commands that lies ahead of do statement.
- date >> date.txt here the output of date command is being written to a file date.txt. Also note that we have used >> and not >.
- >> ensures that the file (date.txt) is not overwritten every time the script execute. It just append the changes. Whereas > overwrite the file again and again.
- sleep 5 It ask the shell to keep a time difference of 5 seconds before it executed again. Note the time here is always measured in seconds. Say if you want to execute the command every 6 minutes, you should use (6*60) 360, in succession of sleep.
- done marks the end of while loop.
- & Put the whole process in loop to background.
Similarly, we can execute any script in the same manner. Here is the command to call a script after certain interval (say 100 sec) and the name of script is `script_name.sh`.
Also worth mentioning that the script above should be run in the directory where the script to be called lies, else you need to provide full path (`/home/$USER/…/script_name.sh`). The syntax for calling script at above described interval is:
$ while true; do /bin/sh script_name.sh ; sleep 100 ; done &
**Conclusion**: The above one liner is not a replacement of Cron, because Cron utility supports a whole lots of options, as compared and is very flexible as well as customizable. However if we want to run certain test cases or I/O benchmark, then the above singe command will serve the purpose.
Read Also: [11 Linux Cron Job Scheduling Examples][1]
### 2. How to Clear Terminal without Using clear Command ###
What we do to clear the screen? Well you may think how silly it is to ask such question. Well, we all know its clear command. However if we make a habit of using key combination ctrl+l to clear terminal, we will save a lot of time of ours.
Key combination Ctrl+l has the same effect as clear command. So from next time use ctrl+l to clear your Linux Command Line Interface.
**Conclusion**: Since ctrl+l is a key combination, so we can not use it inside a script. If we need to clear screen inside a shell script, call command clear, for all other cases I could think of now, ctrl+l is more than sufficient.
### 3. Run a command and come back to the current working directory automatically. ###
Well this is an amazing hack not many people know. You may run a command no matter what it return back to the current directory. All you need to do is to run the command in parentheses i.e., in between `( and )`.
Let see the example,
avi@deb:~$ (cd /home/avi/Downloads/)
#### Sample Output ####
avi@deb:~
First it cd to directory Downloads and then again return back to home directory in one go. May be you believe that the command didnt executed and for some reason one or another it is not throwing error, since there is no change in prompt. Lets do a little more tweak..
avi@deb:~$ (cd /home/avi/Downloads/ && ls -l)
#### Sample Output ####
-rw-r----- 1 avi avi 54272 May 3 18:37 text1.txt
-rw-r----- 1 avi avi 54272 May 3 18:37 text2.txt
-rw-r----- 1 avi avi 54272 May 3 18:37 text3.txt
avi@deb:~$
So in the above command it first changed the current directory to Downloads and then list the content of that directory before returning back to current directory. Also, it proves that command executed successfully. You may run any sort of command in the parentheses and return back to your current working directory without a hitch.
Thats all for now, if you know any such Linux hacks or tricks you may share with us via our comment section and dont forget to share this article with your friends….
--------------------------------------------------------------------------------
via: http://www.tecmint.com/useful-linux-hacks-commands/
作者:[Avishek Kumar][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/avishek/
[1]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/

View File

@ -0,0 +1,82 @@
How To Check Laptop CPU Temperature In Ubuntu
================================================================================
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Monitor_temperature_Ubuntu.png)
Overheating of laptops is a common issue one faces these days. Monitoring hardware temperature may help you to diagnose why laptop is getting overheated. In this article, well see **how to check CPU temperature in Ubuntu**.
We are going to use a GUI tool [Psensor][1] that allows you to monitor hardware temperature in Linux. With Psensor you can:
- monitor the temperature of the motherboard and CPU sensors
- monitor the temperature of the NVidia GPUs
- monitor the temperature of the Hard Disk Drives
- monitor the rotation speed of the fans
- monitor the CPU usage
Latest version of Psensor also provides applet indicator for Ubuntu and thus it makes the monitoring of hardware temperature even easier in Ubuntu. You can choose to display the temperature right in the top panel itself. It even sends a desktop notification when the temperature exceeds the limit.
### How to install Psensor in Ubuntu 15.04 and 14.04 ###
Before you install Psensor, you need to install and configure [lm-sensors][2], a command line utility for hardware monitoring. If you want to measure hard disk temperature, you need to install [hddtemp][3] as well. To install these tools, run the following command in a terminal:
sudo apt-get install lm-sensors hddtemp
Then start the detection of your hardware sensors:
sudo sensors-detect
To make sure that it works, run the command below:
sensors
It will give you an output like:
acpitz-virtual-0
Adapter: Virtual device
temp1: +43.0°C (crit = +98.0°C)
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +44.0°C (high = +100.0°C, crit = +100.0°C)
Core 0: +41.0°C (high = +100.0°C, crit = +100.0°C)
Core 1: +40.0°C (high = +100.0°C, crit = +100.0°C)
If everything seems alright, proceed with the installation of Psensor by using the command below:
sudo apt-get install psensor
Once installed, run the application by looking for it in Unity Dash. At first run, you should configure on what stats do you want to collect in Psensor.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Psensor_Ubuntu.jpeg)
### Display temperature in the panel ###
If you want to show the temperature in the top panel, go to **Sensor Preferences**:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Psensor_Ubuntu_1.jpeg)
Then under the **Application Indicator** menu, select the component for which you want to display the temperature and then check the **Display sensor in the label** option.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Psensor_Ubuntu_2.jpeg)
### Start Psensor at each start up ###
Go to **Preferences->Startup** and the check **Launch on session startup** to start Psensor at each boot.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Psensor_Ubuntu_3.jpeg)
Thats it. All you need to monitor the CPU temperature is here. You can keep an eye on it and it may help you find out which process is overheating your computer.
--------------------------------------------------------------------------------
via: http://itsfoss.com/check-laptop-cpu-temperature-ubuntu/
作者:[Abhishek][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://itsfoss.com/author/abhishek/
[1]:http://wpitchoune.net/blog/psensor/
[2]:http://www.lm-sensors.org/
[3]:https://wiki.archlinux.org/index.php/Hddtemp

View File

@ -0,0 +1,225 @@
How to Create Own Online Shopping Store Using “OpenCart” in Linux
================================================================================
In the Internet world we are doing everything using a computer. Electronic Commerce aka e-commerce is one one of them. E-Commerce is nothing new and it started in the early days of ARPANET, where ARPANET used to arrange sale between students of Massachusetts Institute of Technology and Stanford Artificial Intelligence Laboratory.
These days there are some 100s of E-Commerce site viz., Flipcart, eBay, Alibaba, Zappos, IndiaMART, Amazon, etc. Have you thought of making your own Amazon and Flipcart like web-based Application Server? If yes! This article is for you.
Opencart is a free and open source E-Commerce Application written in PHP, which can be used to develop a shopping cart system similar to Amazon and Flipcart. If you want to sell your products online or want to serve your customers even when you are closed Opencart is for you. You can build a successful online store (for online merchants) using reliable and professional Opencart Application.
### OpenCart Web Panel Demo ###
- Store Front [http://demo.opencart.com/][1]
- Admin Login [http://demo.opencart.com/admin/][2]
------------------ Admin Login ------------------
Username: demo
Password: demo
#### Features of Opencart ####
Opencart is an application that meets all the requirements of an online merchant. It has all the features (see below) using which you can make your own E-Commerce Website.
- It is a Free (as in beer) and Open Source (as in speech) Application released under GNU GPL License.
- Everything is well documented, means you dont need to Google and shout for help.
- Free Life time support and updates.
- Unlimited number of categories, Products and manufacturer supported.
- Everything is Template based.
- Multi-Language and Multi-Currency Supported. It ensures your product gets a global reach.
- Built-in Product Review and Rating Features.
- Downloadable Products (viz., ebook) supported.
- Automatic Image Resizing supported.
- Features like Multi tax Rates (as in various country), Viewing Related Products, Information Page, Shipping Weight Calculation, Availing Discount Coupons, etc are well implemented by default.
- Built-in Backup and Restore tools.
- Well implemented SEO.
- Invoice Printing, Error Log and sales report are supported as well.
#### System Requirements ####
- Web Server (Apache HTTP Server Preferred)
- PHP (5.2 and above).
- Database (MySQLi Preferred but I am using MariaDB).
#### Required PHP Libraries and Modules ####
These extensions must be installed and enabled on your system to install Opencart properly on the web server.
- Curl
- Zip
- Zlib
- GD Library
- Mcrypt
- Mbstrings
### Step 1: Installing Apache, PHP and MariaDB ###
1. As I said, OpenCart requires certain technical requirements such as Apache, PHP with extensions and Database (MySQL or MariaDB) to be installed on the system, in order to run Opencart properly.
Lets install Apache, PHP and MariaDB using following Command.
**Install Apache**
# apt-get install apache2 (On Debian based Systems)
# yum install httpd (On RedHat based Systems)
**Install PHP and Extensions**
# apt-get install php5 libapache2-mod-php5 php5-curl php5-mcrypt (On Debian based Systems)
# yum install php php-mysql php5-curl php5-mcrypt (On RedHat based Systems)
**Install MariaDB**
# apt-get install mariadb-server mariadb-client (On Debian based Systems)
# yum install mariadb-server mariadb (On RedHat based Systems)
2. After installing all the above required things, you can start the Apache and MariaDB services using following commands.
------------------- On Debian based Systems -------------------
# systemctl restart apache2.service
# systemctl restart mariadb.service
----------
------------------- On RedHat based Systems -------------------
# systemctl restart httpd.service
# systemctl restart mariadb.service
### Step 2: Downloading and Setting OpenCart ###
3. The most recent version of OpenCart (2.0.2.0) can be obtained from [OpenCart website][3] or directly from github.
Alternatively, you may use following wget command to download the latest version of OpenCart directly from github repository as shown below.
# wget https://github.com/opencart/opencart/archive/master.zip
4. After downloading zip file, copy to Apache Working directory (i.e. /var/www/html) and unzip the master.zip file.
# cp master.zip /var/www/html/
# cd /var/www/html
# unzip master.zip
5. After extracting master.zip file, cd to extracted directory and move the content of upload directory to the root of the application folder (opencart-master).
# cd opencart-master
# mv -v upload/* ../opencart-master/
6. Now you need to rename or copy OpenCart configuration files as shown below.
# cp /var/www/html/opencart-master/admin/config-dist.php /var/www/html/opencart-master/admin/config.php
# cp /var/www/html/opencart-master/config-dist.php /var/www/html/opencart-master/config.php
7. Next, set correct Permissions to the files and folders of /var/www/html/opencart-master. You need to provide RWX permission to all the files and folders there, recursively.
# chmod 777 -R /var/www/html/opencart-master
**Important**: Setting permission 777 may be dangerous, so as soon as you finish setting up everything, revert back to permission 755 recursively on the above folder.
### Step 3: Creating OpenCart Database ###
8. Next step is to create a database (say opencartdb) for the E-Commerce site to store data on the database. Connect to databaser server and create a database, user and grant correct privileges on the user to have full control over the database.
# mysql -u root -p
CREATE DATABASE opencartdb;
CREATE USER 'opencartuser'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEDGES ON opencartdb.* TO 'opencartuser'@'localhost' IDENTIFIED by 'mypassword';
### Step 4: OpenCart Web Installation ###
9. Once everything set correctly, navigate to the web browser and type `http://<web server IP address>` to access the OpenCart web installation.
Click CONTINUE to Agree the License Agreement.
![Accept OpenCart License](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-License.png)
Accept OpenCart License
10. The next screen is Pre-installation Server Setup Check, to see that the server has all the required modules are installed properly and have correct permission on the OpenCart files.
If any red marks are highlighted on #1 or #2, that means you need to install those components properly on the server to meet web server requirements.
If there are any red marks on #3 or #4, that means there is issue with your files. If everything is correctly configured you should see all green marks are visible (as seen below), you may press “Continue“.
![Server Requirement Check](http://www.tecmint.com/wp-content/uploads/2015/05/Server-Checkup.png)
Server Requirement Check
11. On the next screen enter your Database Credentials like Database Driver, Hostname, User-name, Password, database. You should not touch db_port and Prefix, until and unless you know what you are doing.
Also Enter User_name, Password and Email Address for Administrative account. Note these credentials will be used for logging in to Opencart Admin Panel as root, so keep it safe. Click continue when done!
![OpenCart Database Details](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Database.png)
OpenCart Database Details
12. The next screen shows message like “Installation Complete” with the Tag Line Ready to Start Selling. Also it warns to delete the installation directory, as everything required to setup using this directory has been accomplished.
![OpenCart Installation Completes](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Installation-Completes.png)
OpenCart Installation Completes
To Remove install directory, you may like to run the below command.
# rm -rf /var/www/html/opencart-master/install
### Step 4: Access OpenCart Web and Admin ###
13. Now point your browser to `http://<web server IP address>/opencart-master/` and you would see something like the below screenshot.
![OpenCart Product Showcase](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart.jpg)
OpenCart Product Showcase
14. In order to login to Opencart Admin Panel, point your browser to http://<web server IP address>/opencart-master/admin and fill the Admin Credentials you input, while setting it up.
![OpenCart Admin Login](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Admin-Login.png)
OpenCart Admin Login
15. If everything ok! You should be able to see the Admin Dashboard of Opencart.
![OpenCart Dashboard](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Dashboard.png)
OpenCart Dashboard
Here in Admin Dashboard you may set up a lots of options like categories, product, options, Manufacturers, Downloads, Review, Information, Extension Installer, Shipping, Payment options, order totals, gift voucher, Paypal, Coupons, Affiliates, marketing, mails, Design and Settings, Error logs, in-built analytics and what not.
#### What after testing the tools? ####
If you have already tested the Application and finds it customizable, flexible, Rock Solid, Easy to maintain and use, you may need a good hosting provider to host OpenCart application, that remains live 24X7 support. Though there are a lot of options for hosting providers we recommend Hostgator.
Hostgator is a Domain Registrant and Hosting Provider that is very well known for the service and feature it provides. It Provides you with UNLIMITED Disk Space, UNLIMITED Bandwidth, Easy to install (1-click install script), 99.9% Uptime, Award winning 24x7x365 Technical Support and 45 days money back guarantee, which means if you didnt like the product and service you get your money back within 45 days of purchasing and mind it 45 days is a long time to Test.
So if you have something to sell you can do it for free (by free I mean, Think of the cost you would spend on getting a physical store and then compare it with virtual store setting-up cost. You will feel its free).
**Note**: When you buy hosting (and/or Domain) from Hostgator you will get a **Flat 25% OFF**. This offer is valid only for the readers of Tecmint Site.
All you have to do is to Enter Promocode “**TecMint025**” during the payment of hosting. For reference see the preview of payment screen with promo code.
![Hostgator 25% Discount - TecMint025](http://www.tecmint.com/wp-content/uploads/2015/05/Hostgator-Discount-Code.png)
[Sign up for Hostgator][4] (Coupon code: TecMint025)
**Note**: Also worth mentioning, that for each hosting you buy from Hostgator to host OpenCart, we will get a small amount of commission, just to keep Tecmint Live (by Paying Bandwidth and hosting charges of server).
So If you buy it using the above code, you get discount and we will get a small amount. Also note that you wont pay anything extra, infact you will be paying 25% less on total bill.
### Conclusion ###
OpenCart is an application that performs out-of-the box. It is easy to install and you have the option to choose best suited templates, add your products and you become an online merchant.
A lots of community made extensions(free and paid) makes it rich. It is a wonderful application for those who want to setup a virtual store and remain accessible to their customer 24X7. Let me know yours experience with the application. Any suggestion and feedback is welcome as well.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/create-e-commerce-online-shopping-store-using-opencart-in-linux/
作者:[Avishek Kumar][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/avishek/
[1]:http://demo.opencart.com/
[2]:http://demo.opencart.com/admin/
[3]:http://www.opencart.com/index.php?route=download/download/
[4]:http://secure.hostgator.com/%7Eaffiliat/cgi-bin/affiliates/clickthru.cgi?id=tecmint

View File

@ -0,0 +1,92 @@
How to Kill Linux Processes/Unresponsive Applications Using xkill Command
================================================================================
How do we kill a resource/process in Linux? Obviously we find the PID of the resource and then pass the PID to the kill command.
Speaking more accurately, we can find PID of a resource (say terminal) as:
$ ps -A | grep -i terminal
6228 ? 00:00:00 gnome-terminal
In the above output, the number 6228 is the PID of process (gnome-terminal), use the kill command to kill the process as shown below.
$ kill 6228
The kill command sends a signal to a process, whose PID is passed along with the command.
Alternatively, we can use pkill command, which kills a process based upon name and other attributes of a process. To kill a process say whose name is terminal, we need to execute:
$ pkill terminal
**Note**: The process name length in pkill is limited to 15 characters.
pkill seems more handy as you can kill a process without have to find out its PID. But if you want to have a better control on your system nothing beats kill command. Using kill you will have better insight of what process you are killing.
We have already covered a detailed guide on [kill, pkill and killall commands][1].
For those who are running X server there is another tool called xkill which can kill a process from its X window without passing process name or its PID.
xkill utility forces X server to close communications to its client which results into killing of client by its X resource. xkill which is a part of X11 utilities is very handy in killing unnecessary windows.
It support options like connect to specific X Server (-display displayname) using display number when multiple X Servers are running on a host simultaneously and kill all the client (-all, not recommended) with top-level windows on the screen as well as take frame (-frame) into account.
To get a list of all the clients you may run:
$ xlsclients
#### Sample Output ####
' ' /usr/lib/libreoffice/program/soffice
deb gnome-shell
deb Docky
deb google-chrome-stable
deb soffice
deb gnome-settings-daemon
deb gnome-terminal-server
If no resource identifier is passed with id, xkill turns the mouse Pointer into special Symbol, similar to X. Just click on the window you want to kill and this will kill its communication with server or say the program gets killed.
$ xkill
![Xkill Command](http://www.tecmint.com/wp-content/uploads/2015/05/Xkill.png)
Kill Process Using xkill
It is important to notice that xkill do not guarantee that closing its communication will kill/abort it successfully. Most of the application will get killed when its communication to server is closed. However a few may still be running.
Points Needed to be mentioned here:
- This tool works only when X11 server is running, as xkill is a part of X11 utility.
- Dont confuse with Closing and killing a resource. While killing a resource you may expect it not to exit cleanly.
- This is not a replacement of kill utility.
**Do I need to go to Linux command line to invoke xkill?**
No, you dont need to fire xkill from Linux Command Line. You may set a keyboard shortcut and call xkill just by punching same key combination.
Here is how to setup a keyboard shortcut on a typical gnome3 Desktop Environment.
Go to Settings > Select Keyboard, click on + and add name and command. Click on the new entry and press the key you want to use as shortcut key combination. I did Ctrl+Alt+Shift+x.
![Gnome Settings](http://www.tecmint.com/wp-content/uploads/2015/05/22.png)
Gnome Settings
![Add Shortcut Key](http://www.tecmint.com/wp-content/uploads/2015/05/31.png)
Add Shortcut Key
The next time you want to kill a X resource just call the key combination (Ctrl+Alt+Shift+x), and you will notice your mouse pointer changed into x. Click on x resource you want to kill and all done!
--------------------------------------------------------------------------------
via: http://www.tecmint.com/kill-processes-unresponsive-programs-in-ubuntu/
作者:[Avishek Kumar][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/avishek/
[1]:http://www.tecmint.com/how-to-kill-a-process-in-linux/

View File

@ -0,0 +1,122 @@
How to edit your documents collaboratively on Linux
================================================================================
> "Developed many years before by some high-strung, compulsive assistant, the Bulletin was simply a Word document that lived in a shared folder both Emily and I could access. Only one of us could open it at a time and add a new message, thought, or question to the itemized list. Then we'd print out the updated version and place it on the clipboard that sat on the shelf over my desk, removing the old ones as we went." ("The Devil Wears Prada" by Lauren Weisberger)
Even today such a "collaborative editing" is in use where only one person can open a shared file, make changes to it, and then inform others about what and when was modified.
ONLYOFFICE is an open source online office suite integrated with different management tools for documents, emails, events, tasks and client relations.
Using ONLYOFFICE office suite, a group of people can edit text, spreadsheet or presentation within a browser simultaneously. Leave comments directly in their document and interact with each other using the integrated chat. And, finally, save the document as a PDF file for further printing. As an added bonus, it gives the possibility to view the document history and restore the previous revision/version if needed.
In this tutorial, I will describe how to deploy your own online office suite using [ONLYOFFICE Free Edition][1], an ONLYOFFICE self-hosted version distributed under GNU AGPL v3.
### Installing ONLYOFFICE on Linux ###
ONLYOFFICE installation requires the presence of mono (version 4.0.0 or later), nodejs, libstdc++6, nginx and mysql-server in your Linux system. To simplify the installation process and avoid dependency errors, I install ONLYOFFICE using Docker. In this case there is only one dependency to be installed - [Docker][2].
Just to remind, Docker is an open-source project that automates the deployment of applications inside software containers. If Docker is not available on your Linux system, install it first by referring to Docker installation instructions for [Debian-based][3] or [Red-Hat based][4] systems.
Note that you will need Docker 1.4.1 or later. To check the installed Docker version, use the following command.
$ docker version
To try ONLYOFFICE inside a Docker container, simply execute the following commands:
$ sudo docker run -i -t -d --name onlyoffice-document-server onlyoffice/documentserver
$ sudo docker run -i -t -d -p 80:80 -p 443:443 --link onlyoffice-document-server:document_server onlyoffice/communityserver
These commands will download the [official ONLYOFFICE Docker image][5] with all dependencies needed for its correct work.
It's also possible to install [ONLYOFFICE Online Editors][6] separately on a Linux server, and easily integrate it into your website or cloud application via API provided.
### Running a Self-Hosted Online Office ###
To open your online office, enter localhost (http://IP-Address/) in the address bar of your browser. The Welcome page will open:
![](https://farm9.staticflickr.com/8815/18116525656_795821c73b_c.jpg)
Enter a password and specify the email address you will use to access your office the next time.
### Editing Your Documents Online ###
First, click the Documents link to open **the My Documents** folder.
![](https://farm8.staticflickr.com/7781/17956640089_d3df0b18cd_c.jpg)
#### STEP 1. Select a Document to Edit ####
To create a new document right there, click on the **Create** button in the upper left corner, and choose the file type from the drop-down list. To edit a file stored on your hard disk drive, upload it to **Documents** clicking the **Upload** button next to **Create** button.
![](https://farm9.staticflickr.com/8836/17956640109_ed8be735df_c.jpg)
#### STEP 2. Share your Document ####
Use the **Share** button to the right side if you are in the **My Documents** folder, or follow **File >> Document Info ... >> Change Access Rights** if you are inside your document.
In the opened **Sharing Settings** window, click on the **People outside portal** link on the left, open the access to the document, and give full access to it by enabling the **Full Access** radio button.
Finally, choose a way to share the link to your document, send it via email or one of the available social networks: Google+, Facebook, or Twitter.
![](https://farm8.staticflickr.com/7766/17522306273_c8a9022c75_c.jpg)
#### STEP 3. Start the Collaborative Editing ####
To start co-editing the document, the invited person just needs to follow the provided link.
The text passages edited by your co-editors will be automatically marked with dashed lines of different colors.
![](https://farm8.staticflickr.com/7790/18139370292_7ef57aae8f_c.jpg)
As soon as one of your collaborators saves his/her changes, you will see a note appearing in the left upper corner of the top toolbar, indicating that there areupdates.
![](https://farm8.staticflickr.com/7778/18143984831_3dd42a9672_c.jpg)
To save your changes and get updates, click on the **Save** icon. All the updates will then be highlighted.
![](https://farm8.staticflickr.com/7796/17955172970_e53460b8a6_c.jpg)
#### STEP 4. Interact with your Co-editors ####
To leave some comments, select a text passage with the mouse, right-click on it and, and choose the **Add comment** option from the context menu.
![](https://farm8.staticflickr.com/7771/17956640359_c4e2858dc8_c.jpg)
To interact with co-editors in real time, use the integrated chat instead. All the users who currently edit the document will be listed on the **Chat** panel. To open it, click on the **Chat** icon at the left-side bar. To start a discussion, enter your message into an appropriate field on the **Chat** panel.
![](https://farm8.staticflickr.com/7794/18116394026_d93b00e4f8_c.jpg)
### Useful Tips ###
As final notes, here are some useful tips for you to take full advantage of ONLYOFFICE.
#### Tip #1. Editing your Docs from Cloud Storage Services, Like ownCloud ####
If you store your documents in other web resources like Box, Dropbox, Google Drive, OneDrive, SharePoint or ownCloud, you can easily synchronize them with the ONLYOFFICE.
In the opened 'Documents' module, click one of the icons under the **Add the account** caption: Google, Box, DropBox, OneDrive, ownCloud or 'Add account', and enter the requested data.
#### Tip #2. Editing Your Docs on iPad ####
To add some changes to your document on the go, I use ONLYOFFICE Documents app for iPad. You can download and install it from [iTune][7], then you need to enter your ONLYOFFICE portal address, email and password to access your documents. The feature set is almost the same.
To evaluate ONLYOFFICE Online Editors features, you can use the [cloud version][8] for personal use.
--------------------------------------------------------------------------------
via: http://xmodulo.com/edit-documents-collaboratively-linux.html
作者:[Tatiana Kochedykova][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://xmodulo.com/author/tatiana
[1]:http://www.onlyoffice.org/
[2]:http://xmodulo.com/recommend/dockerbook
[3]:http://xmodulo.com/manage-linux-containers-docker-ubuntu.html
[4]:http://xmodulo.com/docker-containers-centos-fedora.html
[5]:https://registry.hub.docker.com/u/onlyoffice/communityserver/
[6]:http://onlyoffice.org/sources#document
[7]:https://itunes.apple.com/us/app/onlyoffice-documents/id944896972
[8]:https://personal.onlyoffice.com/

View File

@ -0,0 +1,113 @@
Howto Manage Host Using Docker Machine in a VirtualBox
================================================================================
Hi all, today we'll learn how to create and manage a Docker host using Docker Machine in a VirtualBox. Docker Machine is an application that helps to create Docker hosts on our computer, on cloud providers and inside our own data center. It provides easy solution for creating servers, installing Docker on them and then configuring the Docker client according the users configuration and requirements. This API works for provisioning Docker on a local machine, on a virtual machine in the data center, or on a public cloud instance. Docker Machine is supported on Windows, OSX, and Linux and is available for installation as one standalone binary. It enables us to take full advantage of ecosystem partners providing Docker-ready infrastructure, while still accessing everything through the same interface. It makes people able to deploy the docker containers in the respective platform pretty fast and in pretty easy way with just a single command.
Here are some easy and simple steps that helps us to deploy docker containers using Docker Machine.
### 1. Installing Docker Machine ###
Docker Machine supports awesome on every Linux Operating System. First of all, we'll need to download the latest version of Docker Machine from the [Github site][1] . Here, we'll use curl to download the latest version of Docker Machine ie 0.2.0 .
**For 64 Bit Operating System**
# curl -L https://github.com/docker/machine/releases/download/v0.2.0/docker-machine_linux-amd64 > /usr/local/bin/docker-machine
**For 32 Bit Operating System**
# curl -L https://github.com/docker/machine/releases/download/v0.2.0/docker-machine_linux-i386 > /usr/local/bin/docker-machine
After downloading the latest release of Docker Machine, we'll make the file named **docker-machine** under **/usr/local/bin/** executable using the command below.
# chmod +x /usr/local/bin/docker-machine
After doing the above, we'll wanna ensure that we have successfully installed docker-machine. To check it, we can run the docker-machine -v which will give output of the version of docker-machine installed in our system.
# docker-machine -v
![Installing Docker Machine](http://blog.linoxide.com/wp-content/uploads/2015/05/installing-docker-machine.png)
To enable Docker commands on our machines, make sure to install the Docker client as well by running the command below.
# curl -L https://get.docker.com/builds/linux/x86_64/docker-latest > /usr/local/bin/docker
# chmod +x /usr/local/bin/docker
### 2. Creating VirualBox VM ###
After we have successfully installed Docker Machine in our Linux running machine, we'll definitely wanna go for creating a Virtual Machine using VirtualBox. To get started, we need to run docker-machine create command followed by --driver flag with string as virtualbox as we are trying to deploy docker inside of Virtual Box running VM and the final argument is the name of the machine, here we have machine name as "linux". This command will download [boot2docker][2] iso which is a light-weighted linux distribution based on Tiny Core Linux with the Docker daemon installed and will create and start a VirtualBox VM with Docker running as mentioned above.
To do so, we'll run the following command in a terminal or shell in our box.
# docker-machine create --driver virtualbox linux
![Creating Docker Machine](http://blog.linoxide.com/wp-content/uploads/2015/05/creating-docker-machine.png)
Now, to check whether we have successfully create a Virtualbox running Docker or not, we'll run the command **docker-machine** ls as shown below.
# docker-machine ls
![Docker Machine List](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-list.png)
If the host is active, we can see * under the ACTIVE column in the output as shown above.
### 3. Setting Environment Variables ###
Now, we'll need to make docker talk with the machine. We can do that by running docker-machine env and then the machine name, here we have named **linux** as above.
# eval "$(docker-machine env linux)"
# docker ps
This will set environment variables that the Docker client will read which specify the TLS settings. Note that we'll need to do this every time we reboot our machine or start a new tab. We can see what variables will be set by running the following command.
# docker-machine env linux
export DOCKER_TLS_VERIFY=1
export DOCKER_CERT_PATH=/Users/<your username>/.docker/machine/machines/dev
export DOCKER_HOST=tcp://192.168.99.100:2376
### 4. Running Docker Containers ###
Finally, after configuring the environment variables and Virtual Machine, we are able to run docker containers in the host running inside the Virtual Machine. To give it a test, we'll run a busybox container out of it run running **docker run busybox** command with **echo hello world** so that we can get the output of the container.
# docker run busybox echo hello world
![Running Docker Container](http://blog.linoxide.com/wp-content/uploads/2015/05/running-docker-container.png)
### 5. Getting Docker Host's IP ###
We can get the IP Address of the running Docker Host's using the **docker-machine ip** command. We can see any exposed ports that are available on the Docker hosts IP address.
# docker-machine ip
![Docker IP Address](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-ip-address.png)
### 6. Managing the Hosts ###
Now we can manage as many local VMs running Docker as we desire by running docker-machine create command again and again as mentioned in above steps
If you are finished working with the running docker, we can simply run **docker-machine stop** command to stop the whole hosts which are Active and if wanna start again, we can run **docker-machine start**.
# docker-machine stop
# docker-machine start
You can also specify a host to stop or start using the host name as an argument.
$ docker-machine stop linux
$ docker-machine start linux
### Conclusion ###
Finally, we have successfully created and managed a Docker host inside a VirtualBox using Docker Machine. Really, Docker Machine enables people fast and easy to create, deploy and manage Docker hosts in different platforms as here we are running Docker hosts using Virtualbox platform. This virtualbox driver API works for provisioning Docker on a local machine, on a virtual machine in the data center. Docker Machine ships with drivers for provisioning Docker locally with Virtualbox as well as remotely on Digital Ocean instances whereas more drivers are in the work for AWS, Azure, VMware, and other infrastructure. If you have any questions, suggestions, feedback please write them in the comment box below so that we can improve or update our contents. Thank you ! Enjoy :-)
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-how-to/host-virtualbox-docker-machine/
作者:[Arun Pyasi][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/arunp/
[1]:https://github.com/docker/machine/releases
[2]:https://github.com/boot2docker/boot2docker

View File

@ -1,320 +0,0 @@
组测试: Linux 文本编辑器
================================================================================
> Mayank Sharma 测试了5款不仅仅是能处理字的超级文本编辑器。
如果你使用Linux已经有很长一段时间你知道不管是编辑一款app的配置文件一起用shell脚本骇客或者编写/查看代码类似LobreOffice的工具并不能满足。尽管字面上看起来意思一样你不需要一个字处理器来完成这些任务你需要一个文本编辑器。
在这个组测试中我们将着眼于5款不仅仅是能胜任繁重文本任务的简陋的文本编辑器。他们能高亮语法像拼写检查一样轻松处理代码缩进。你可以像你复制/粘贴文本那样容易地使用他们记录宏以及管理代码片段。
得益于能向它们注入足以抗衡其它类型的以文本为中心的应用程序能力的插件,一些简单的文本编辑器甚至超过了它们的设计目标。它们能胜任一个源代码编辑器的任务,甚至是一个集成开发环境。
Emacs和Vim是两款最流行和强大的纯文本编辑器。但是由于一些原因我们在这个组测试中并没有包括它们。首先如果你使用它们中的任何一个那么恭喜你你不需要更换了。其次它们都有陡峭的学习曲线尤其是那些熟悉了桌面环境的用户:他们很更愿意投入其他有图形界面的文本编辑器。
### 目录: ###
#### Gedit ####
- URL:http://projects.gnome.org/gedit/
- 版本: 3.10
- 许可证: GPL
- Gnome的默认文本编辑器准备好挑战了?
#### Kate ####
- URL: www.kate-editor.org
- 版本: 3.11
- 许可证: LGPL/GPL
- Kate会挑战命运吗?
#### Sublime Text ####
- URL: www.sublimetext.com
- 版本: 2.0.2
- 许可证: Proprietary
- 在自由与黄金心脏土地上的私有软件。
#### UltraEdit ####
- URL: www.ultraedit.com
- 版本: 4.1.0.4
- 许可证: Proprietary
- 它做的足够多去证明它的价值了吗?
#### jEdit ####
- URL: www.jedit.org
- 版本: 5.1.0
- 许可证: GPL
- 基于Java的编辑器是否会扰乱其他编辑器的世界?
![在展示一个有功能的应用程序和将它们所有的东西曝光给用户之间有一个很好的平衡。Geddit隐藏了它的大部分功能。](http://www.linuxvoice.com/wp-content/uploads/2014/07/gedit-web.png)
在展示一个有功能的应用程序和将它们所有的东西曝光给用户之间有一个很好的平衡。Geddit隐藏了它的大部分功能。
### 关键标准 ###
除了Gedit和jEdit以外的所有工具都是通过推荐的安装方法安装在Fedora和Ubuntu上。前者已经兼容默认的Gnome桌面后者仍然固执地反对安装在Fedora上。由于这些是相对简单的应用程序他们没有复杂的依赖唯一例外的是jEdit它要求要有Oracle Java。
得益于Gnome和KDE持续的努力不论他们运行的桌面环境所有编辑器看起来很好功能也很正常。这不仅是作为评价的标准也意味着你不再受制于要找到和你的桌面环境兼容的工具。
除了它们奇特的功能,我们也对所有候选者测试了通用文本编辑功能。然而,它们并没有被设计为模仿现代字处理器的所有功能,我们也不以此评判。
![Kate能搭建为功能丰富的集成开发环境](http://www.linuxvoice.com/wp-content/uploads/2014/08/kate-web.png)
Kate能搭建为功能丰富的集成开发环境。
### 编程语言支持 ###
UltraEdit 能进行语法高亮代码折叠以及拥有项目管理的能力。这也有一个罗列源文件中所有函数的功能列表但并不适用于我们任何的测试代码文件。UltraEdit也支持HTML5有能添加常用HTML标记的HTML工具栏。
即使Gnome的默认文本编辑器Gedit也有几个面向编码的功能特性例如括号匹配自动缩进以及为包括C, C++, Java, HTML, XML, Python, Perl, 以及许多其它编程语言进行语法高亮。
如果你需要更多的编程辅助看一下Sublime和Kate。Sublime支持多种编程语言并且(正如流行的那些)能为C#, D, Dylan, Erlang, Groovy, Haskell, Lisp, Lua, MATLAB, OCaml, R, 甚至 SQL 进行语法高亮。如果这还不够,你可以下载插件以支持更多的语言。
另外它的语法高亮功能提供了多个可定制选项。这个应用程序也会进行括号匹配确保代码段都正确Sublime的自动补全功能也支持用户创建的变量。
正如Komodo IDESublime也可滚动浏览显示完整的代码这对于长代码文件导航和在文件中的不同部分跳转很方便。
Sublime最好的功能之一就是能在编辑器内部为特定语言例如C++, Python, Ruby等运行代码当然假设在你的电脑上安装有编译器以及其它系统工具。省时间而且不用再开终端.
你也可以用插件在Kate中开启构建系统功能。另外你可以为GDB调试器添加一个简单的前端。Kate能和GitSubversion以及Mercurial版本控制系统一起工作也提供了一些项目管理的功能。
除了能为超过180中语言进行语法高亮它支持所有的这些辅助功能例如括号匹配自动补全和自动缩进。它也支持代码折叠甚至在一个程序中折叠函数。
唯一的遗憾的是jEdit它声称自己是一个程序员的文本编辑器但它缺少其他的基本功能例如代码折叠它甚至不能提示或者不全函数.
**评分:**
- Gedit:3/5
- Kate:5/5
- Sublime:5/5
- UltraEdit3/5
- jEdit:1/5
![如果你不喜欢Sublime的Charcoal外观你可以选择它包含的其它22中主题。](http://www.linuxvoice.com/wp-content/uploads/2014/08/sublime-web.png)
如果你不喜欢Sublime的Charcoal外观你可以选择它包含的其它22中主题。
### 键盘控制 ###
高级文本编辑器用户希望能完全通过键盘控制和操作,一些应用程序甚至运行他们的用户自定义快捷方式的键盘绑定。
你可以轻松的使用Gedit的扩展键盘快捷键。这里有编辑文件为普通任务例如对一个文档进行拼写检查唤起工具的快捷键。你可以获取应用程序内部的一系列默认快捷键但并没有图形化的方式去自定义它们。相似的在Sublime中自定义键绑定你需要修改他的XML键映射文件。Sublime由于缺少定义键盘快捷键的图形化界面而饱受批评但长期使用的用户支持当前的基于文件的机制:这给他们更多的控制能力。
UltraEdit为它"一切都可自定义"的座右铭感到自豪,这也包括键盘快捷键。你可以自定义菜单导航的热键,以及定义你自己的访问大量函数的多键键映射。
除了完全可自定义的键盘快捷键以外jEdit也有为Emacs预定义的键映射。Kate在这方面尤其令人映像深刻。它有简单可访问的自定义键绑定窗口。你可以更改默认的键或者定义替代的键。另外Kate也有一个能使用户使用Vi键操作Kate的Vi模式。
**Verdict:**
- Gedit:2/5
- Kate:5/5
- Sublime:3/5
- UltraEdit:4/5
- jEdit:5/5
### 片段和宏 ###
宏通过自动化重复的步骤帮助你降低花费在编辑和组织数据上的时间,而代码片段通过创建可重用的源代码块为程序员扩展类似的功能。这两者都能节省你的时间。
标准的Gedit安装没有这两种功能中的任何一种但是你可以通过独立的插件启用这些功能。片段插件随Gedit一起发布但在Gedit内部启用宏插件之前你需要手动下载和安装(被称为gedit-macropy托管在GitHub上)。
Kate也同样通过插件的形式启用片段功能。一旦加入插件也增加了片段的PHPBash和Java库。你可以在侧边栏中显示片段列表以便于访问。可以通过右击片段或者快捷键组合方式编辑它的内容。然而令人惊讶的是它不支持宏-尽管用户从2002年开始重复要求
jEdit也有一个启用片段的插件。但是它可以从用户行为中记录宏或者你也可以在BeanShell 脚本语言(BeanShell支持像Perl和JavaScript那样将脚本对象封锁为简单的方法)中写宏。jEdit也有一个可以从jEdit的网站中下载多种宏的插件。
Sublime有创建片段和宏的内建功能也有为大多数编程语言经常使用的函数多种片段。
在UltraEdit中片段被称为智能模板正如Sublime你可以根据正在编辑的源代码文件类型插入片段。要完成宏记录功能UltraEdit还有一个基于JavaScript的集成脚本语言来完成自动任务。你也可以从编辑器的网站中下载用户提交的宏和脚本。
**Verdict:**
- Gedit:3/5
- Kate:1/5
- Sublime:5/5
- UltraEdit:5/5
- jEdit:5/5
![UltraEdit的用户界面是高度可配置的 — 你可以正如改变其它许多方面那样简单的自定义工具栏和菜单的布局。](http://www.linuxvoice.com/wp-content/uploads/2014/08/ultraedit-web.png)
UltraEdit的用户界面是高度可配置的 — 你可以正如改变其它许多方面那样简单的自定义工具栏和菜单的布局。]
### 易用性 ###
不像一个准系统文本编辑器,文本编辑器的这个功能洋溢着适应大范围用户的功能 - 从文档写作者到程序员。从应用程序剥离相反,他们的开发者在寻找添加更多功能的途径。
尽管第一眼看上去这次组测试中的大部分应用有一个很相似的布局,经过仔细的检查,你会发现一些可用性差异。我们通过用户界面的合理使用来介绍它们的功能和特性,而不是铺天盖地地告诉读者。
### Gedit: 4/5 ###
Gedit有很普通的外观。通过最小化菜单和按钮有一个简单的界面。但这也是一种双刃剑因为有些用户可能不会发现它真正的潜能。
Gedit可以通过在窗口中能重排和移动的选项卡打开多个文件。用户可以通过使用一个插件选择性地启用旁边或者底部用来显示文件浏览和工具输出的面板。这个应用程序会检测到被其它应用程序更改的文件并可以重新加载这个文件。
为了适配Gnome在应用程序的最后一个版本中考虑了大量的用户界面。然而它还并不稳定尽管包括了所有的功能和菜单交互的一些插件还需要升级。
### Kate: 5/5 ###
尽管用户界面的主要部分和Gedit的相似Kate可以在两边显示选项卡并且它的菜单更加丰富。该应用程序平易近人让用户可以挖掘其它功能。
Kate可以在KDE的KIO支持的所有协议上透明地打开和保存文件包括HTTP, FTP, SSH, SMB 和 WebDAV。你可以用这个应用同时处理多个文件。但不同于大部分应用程序传统的水平选项卡选择栏Kate在屏幕的两个方向都有选项卡。左侧的侧边栏显示打开文件的索引。需要同时查看一个文件不同部分的程序员也会感激它可以水平或者竖直分隔界面的能力。
### Sublime: 5/5 ###
Sublime支持你在不同方式同时查看多达四个文件。当你在zone下这里也有一个只显示文件和菜单的全屏模式。
这个编辑器还在右边有个小地图,这在长文件中导航非常有用。应用程序为多种编程语言提供多种流行功能的片段,这使得它对于开发者非常有用。另一个精巧的功能是,无论你使用都是文本文档或者代码,都可以交换和随机选择。
### UltraEdit: 3/5 ###
UltraEdit在界面的顶部和底部加载了多种工具栏。由于有在文档中跳转的选项卡两边的面板以及复杂区别使得只剩下一点空间给编辑窗口。
使用HTML的网络开发者有很多唾手可得的帮助。你可以通过FTP和SFTP访问远程文件。高级功能例如记录一个宏以及比较文件也简单易用。
使用应用程序的Preference窗口你可以调整应用程序的多个方面包括颜色主题和类似语法高亮的其它功能。
### jEdit: 3/5 ###
在可用性方面首先一个不好就是jEdit不能在基于RPM的发行版上安装。导航编辑器需要一些时间来适应因为它的菜单和其它流行的应用程序顺序不同而且有些普通桌面用户不熟悉的名字。但是该应用程序有详细的内部帮助这有利于缓解学习曲线。
jEdit高亮你所在的当前行并使你能一多种查看方式分隔窗口。你可以简单地从应用程序中安装和管理插件除了全宏jEdit也支持你记录快速临时的宏。
![由于它的Java基础jEdit在任何桌面环境中都不能给人宾至如归的感觉](http://www.linuxvoice.com/wp-content/uploads/2014/08/jedit-web.png)
由于它的Java基础jEdit在任何桌面环境中都不能给人宾至如归的感觉
### 可用性和支持 ###
在Gedit和Kate之间有很多相似性。两个应用程序都得益于他们各自的父项目Gnome和KDE并绑定在各种主流的发行版中。另外两个项目都是交叉平台的有Windows和Mac OS X版本以及本来的Linux版本。
Gedit托管在Gnome的网络设施上并有一个简单的用户指南关于多种插件的信息以及包括邮件列表和IRC通道的常用保持联系方式。你也可以在其它基于Gnome的发行版例如Ubuntu中找到使用信息。相似地Kate得益于KDE的资源并包括详细的用户信息以及邮件列表和IRC通道。你也可以从应用程序中获取相应的离线用户指南。
除了LinuxUltraEdit在Windows和Mac OS X中也可用虽然在应用程序中并没有包括但在启动时也有详细的用户指南。为了辅助用户UltraEdit保存了一个常见问题的数据库一系列关于多种特定功能的详细信息的有用提示用户还可以在论坛版块彼此帮助。另外付费用户也可以通过邮件从开发者中获取支持。
Sublime支持相同数目的平台但是你需要单独为每种平台购买许可证。开发者通过博客使用户了解正在进行的开发并积极参加了主持论坛。这个项目支持设施的亮点是提供免费的详细教程和视频课程。Sublime非常可爱。
由于是用java编写的jEdit在多种平台中都可用。在它的网站上你可以找到一个详细的用户指南以及一些插件帮助文档的链接。然而这里没有能使用户和其他用户或者开发者交流的途径。
**判定:**
- Gedit: 4/5
- Kate: 4/5
- Sublime: 5/5
- UltraEdit: 3/5
- jEdit: 2/5
### 附加和插件 ###
不同的用户有不同的需求,一个简单的轻量级应用程序只能做到这么多。这就是为什么需要插件的原因。应用程序依赖于这些小部件来扩展它们的功能集并让更多的用户使用。
UltraEdit是一个另外。它没有第三方插件但开发者确实支出了例如HtmlTidy的第三方工具已经安装到了UltraEdit。
Gedit附带了好多已安装的插件你可以从gedit-插件包下载更多的插件。基于和Gedit版本的兼容性项目网站也有到多个第三方插件的链接。
三个对程序员非常有用的插件是Code Comment在底部面板增加一个终端的Terminal Plugin以及Session Saver。当你用多个文件开发项目的时候Session Saver相当有用。你可以在选项卡中打开文件保存会话当你用一个单击回复的时候可以按照你保存时的选项卡顺序打开所有的文件。
类似的你可以通过用内部的插件管理器增加插件来扩展Kate。除了令人映像深刻的项目插件一些开发者使用的插件包括嵌入式终端能编译和调试代码以及对数据库执行SQL查询。
Sublime的插件是用Python写的文本编辑器包括了一个类似于apt-get能使用户查找安装升级和移除插件包的名为Package Control的工具。通过插件你可以在Sublime中使用Git版本控制以及改进JavaScript的JSLint工具。Sublime Linter能指出你代码中的错误是编码人员必备的插件。
jEdit拥有最令人映像深刻的插件设施。该应用有超过200个插件可以在它们自己的专用网站中浏览。网站通过不同的类型列举了插件例如文件管理版本控制文本等。你可以在每个类型下找到很多的插件。
一些最好的插件是Android插件它们提供了和Android项目协同工作的工具你可以使用TomcatSwitch插件创建和控制外部Jakarta Tomcat服务器进程以及类似于Vi功能的Vimulator插件。你可以通过使用jEdit的插件管理器安装这些插件。
**评定**
- Gedit: 3/5
- Kate: 4/5
- Sublime: 4/5
- UltraEdit: 1/5
- jEdit: 5/5
### 纯文本编辑 ###
尽管它们强大的额外功能甚至可能会取代几个流派完全成熟的应用程序,有时候可能只需要使用这些庞大的文本编辑器读写或者编辑简单的纯文本。虽然你可以使用它们中的任何一个输入文本,我们通过普通文本编辑的方便性评价它们。
Gnome的默认文本编辑器Gedit支持取消和重做机制以及搜索和替换。它可以对多种语言进行拼写检查并能通过使用Gnome GVFS库访问和编辑远程文件。
你也可以使用Kate进行拼写检查它也可以让你对任何高亮文本进行Google搜索。它还有一个能可视化告知用户文件中更改过但没有保存的行的行修改系统。另外它通过允许用户在文件中使用书签简化长文档的导航。
Sublime有很多可选择的编辑命令例如缩进文本和格式化段落。它的自动保存功能帮助防止用户丢失他们的更改。高级用户还会喜欢基于正则表达式的递归查找和替换功能以及选择多个不连续的文本块并执行统一操作。
UltraEdit也允许用户在查找和替换功能中使用正则表示并能通过FTP编辑远程文件。JEdit一个独特的功能是它支持被称为寄存器的不限数目的剪切板。你可以复制文本片段到这些寄存器中在编辑会话过程中都可用。
**评定:**
- Gedit: 4/5
- Kate: 5/5
- Sublime: 5/5
- UltraEdit: 4/5
- jEdit: 4/5
### 我们的评比 ###
在这里的所有编辑器都足以替换你已有的文本编辑器去用来编辑文本和调整配置文件。事实上,没准它们会组合起来作为你的集成开发环境。这些应用程序都有各种各样功能,它们的开发者不会考虑剥离功能,而是增加越来越多的功能。
jEdit排在这次测试的最后面。因为它不仅坚持使用专有的Oracle Java运行环境不能在你的Fedora机器上安装而且开发者不积极的和用户交互。
UltraEdit做的稍微好一点。这个商业专用工具专注于网络开发者不为非开发者高级用户提供任何功能使得它不值得推荐为免费软件的替代品。
排在第三的是Gedit。作为Gnome的默认编辑器它没有任何内在的错误但尽管有很多积极的方面它还是略微被Sublime和Kate超越。开诚布公地说Kate是比Gedit更通用的编辑器甚至考虑到他们的插件系统评分也优于Gnome的默认编辑器。
Sublime和Kate都相当好。他们在我们的大多数测试中表现同样出色。由于不支持宏而落后于Sublime但键盘友好和能简单定义自定义键绑定又使Kate找回优势。
Kate成功的原因可以归结为它通过最小化学习曲线提供了最大化数目的功能。尽量使用它吧不仅作为简单文本编辑器使用或者容易使用语法高亮编辑配置文件甚至得益于项目管理能力能使用它协作一个复杂的编程项目。
我们不是选择Kate去替换一个类似[在这里插入你最喜欢的专业工具]的全面的集成开发环境。但是它是一个专业工具理想的全面的以及完美的垫脚石。
Kate为能快速响应你的需要而设计它的界面并不会使你茫然并且和那些过于复杂的应用一样的有用。
### 1st Kate ###
- Licence LGPL/GPL Version 3.11
- www.kate-editor.org
- 拥有超能力,最终温和的文本编辑器。
- Kate是KDE项目中最有用的应用程序之一。
### 2nd Sublime Text ###
- Licence Proprietary Version 2.0.2
- www.sublimetext.com
- 值得你每分钱的专业文本编辑器 - 简单易用,功能全面而且看起来很棒。
### 3rd Gedit ###
- Licence GPL Version 3.10
- http://projects.gnome.org/gedit
- 从Gnome中完成。这是一个奇妙的文本编辑器确实令人钦佩的工作但这里的竞争实在太大了。
### 4th UltraEdit ###
- Licence Proprietary Version 4.1.0.4
- www.ultraedit.com
- 关注于为网络开发者绑定便利,而不为普通用户提供任何特殊功能。
### 5th jEdit ###
- Licence GPL Version 5.1.0
- www.jedit.org
- 缺乏支持不支持Fedora缺乏好看的界面jEdit被贬低到最后。
### 你也许希望尝试… ###
随你发行版发布的默认文本编辑器也能帮助你一些高级任务。例如KDE的KWrite和Raspbian的Nano。得益于KDE的katepart组件KWrite继承了一些Kate的功能得益于在树莓派上的可用性Nano也开始重现风头。
如果你希望跟随Linux大师的脚步你总是可以尝试崇高的文本编辑机Emacs和Vim。想尝试Vim强大的用户首先可以考虑gVim它通过图形界面展现了Vim的强大。
除了jEdit和Kate这里还有其他模仿例如Emacs和Vim之类的老派高级编辑器的编辑器比如JED 编辑器和Joe's Own Editor这两者都有Emacs的模拟模式。另一方面如果你在寻找轻量级的代码编辑器可以看看Bluefish和Geany。他们的存在是为了填补文本编辑器和全面集成的开发平台之间的空隙。
--------------------------------------------------------------------------------
via: http://www.linuxvoice.com/text-editors/
作者:[Ben Everard][a]
译者:[ictlyh](https://github.com/ictlyh)
校对:[royaso](https://github.com/royaso)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.linuxvoice.com/author/ben_everard/

View File

@ -1,115 +0,0 @@
Guake 0.7.0 已发布 - 一个用于Gnome桌面的下拉式终端
================================================================================
Linux的命令行是最好、最强大的东西它使新手着迷并为老手和极客的提供极端强大的功能。那些在服务器和生产环境下工作的人早已认识到了这个事实。有趣的是Linux终端是Linus Torvald在1991年写内核时实现的第一批功能之一。
终端是个强大的工具由于它没有可移动的部分所以十分可靠。终端介于控制台环境和GUI环境之间。终端自身作为一个GUI程序运行在桌面环境下。有许多终端是适用于特定的桌面环境的而其余是通用的。Terminator, Konsole, Gnome-Terminal, Terminology, XFCE terminal, xterm都是些常用的终端模拟器。
您可以从下面的链接中获得一份使用最广泛的终端模拟器的列表。
- [20 Useful Terminals for Linux][1]
前几日上网时我偶遇了名为Guake它是用于gnome的终端模拟器。尽管这并不是我第一次听到Guake。实际上我在大约一年前便知道了这个应用程序但不知怎么搞的我那时没有写写Guake再后来我便渐渐忘掉了Guake直到我再一次听到Guake。所以最终这篇文章诞生了。我将给你讲讲Guake的功能在Debian、Ubuntu、Fedora上的安装过程以及一些测试。
#### 什么是Guake ####
Guake是应用于Gnome环境的下拉式终端。主要由Python编写使用了一些C它以GPL2+证书发布适用于Linux以及类似的系统。Guake的灵感来源于电脑游戏Quake雷神之锤的终端Quake的终端能通过按下特定按键默认为F12从屏幕上滑下来并在按下同样的键后滑上去。
值得注意的是Guake并不是第一个这样的应用。YakuakeYet Another Kuake是一个运行于KDE的终端模拟器Tilda是一个用GTK+写成的终端模拟器。它们的灵感都来自于雷神之锤那上下滑动的终端。
#### Guake的功能 ####
- 轻量级
- 简单而优雅
- 众多功能
- 强大的
- 好看的
- 平滑的集成于GUI
- 在按下预定义的键后出现/消失
- 支持热键、标签、透明化背景这使得它适合所有Gnome用户
- 极端地可配置
- 包括许多颜色的调色板
- 设定透明度的快捷方式
- 通过Guake配置可在启动时运行一个脚本
- 可以在多个监视器上运行
Guake 0.7.0最近发布,它带来了一些修正以及上面提到的一些功能。完整的版本历史和源代码包可以在[这里][2]找到。
### 在Linux中安装Guake终端 ###
如果您对从源码编译Guake感兴趣您可以从上面的链接处下载Guake并在安装前进行编译。
然而Guake可以在许多的发行版中通过添加额外的仓库来安装。这里我们将在Debian、Ubuntu、Linux Mint和Fedora下安装Guake。
首先从仓库获取最新的软件包列表并从默认的仓库安装Guake如下所示
---------------- On Debian, Ubuntu and Linux Mint ----------------
$ sudo apt-get update
$ apt-get install guake
----------
---------------- On Fedora 19 Onwards ----------------
# yum update
# yum install guake
安装后可以从另一个终端中启动Guake
$ guake
在启动它后便可以在Gnome桌面中使用F12默认配置来下滑、上滑终端。
看起来非常漂亮,尤其是透明背景。滑下来...滑上去...滑下来...滑上去...执行命令,打开另一个标签,执行命令,滑上去...滑下来...(作者已沉迷其中)
![Guake Terminal in Action](http://www.tecmint.com/wp-content/uploads/2015/05/Guake.png)
Guake实战
如果您的壁纸或活动窗口的颜色和Guake的颜色有些不搭。您可以改变您的壁纸减少透明度或者改变Guake的颜色。
下一步便是进入Guake的配置根据每个人的需求修改设置。可以通过应用菜单或者下面的命令来运行Guake的配置。
$ guake --preferences
![Guake Terminal Properties](http://www.tecmint.com/wp-content/uploads/2015/05/Guake-Properties.png)
Guake终端配置
滚动配置
![Guake Scrolling Settings](http://www.tecmint.com/wp-content/uploads/2015/05/Guake-Scrolling.png)
Guake滚动配置
外观设置 - 在这里您可以修改文字颜色和背景色以及透明度。
![Appearance Properties](http://www.tecmint.com/wp-content/uploads/2015/05/Appearance-Properties.png)
外观设置
键盘快捷键 - 在这里您可以修改Guake显示的开关快捷键。
![Keyboard Shortcuts](http://www.tecmint.com/wp-content/uploads/2015/05/Keyboard-Shortcuts.png)
键盘快捷键
兼容性设置 - 基本上不必设置它。
![Compatibility Setting](http://www.tecmint.com/wp-content/uploads/2015/05/Compatibility-Setting.png)
兼容性设置
### 结论 ###
这个项目即不是太年轻也不是太古老因此它已经达到了一定的成熟度足够可靠可以开箱即用。像我这样需要在GUI和终端间频繁切换的人来说Guake是一个福利。我不需要管理一个多余的窗口频繁的打开和关闭使用tab在大量打开的应用程序中寻找终端或切换到不同的工作区来管理终端现在我需要的只有F12。
我认为对任何同时使用GUI和终端的Linux用户来说Guake都是必须的工具。同样的我会向任何想要在系统中结合使用GUI和终端的人推荐它因为它既平滑又没有任何障碍。
上面就是我要说的全部了。如果在安装和使用时有任何问题请告诉我我们会帮助您。也请您告诉我您使用Guake的经验。在下面的评论区反馈您宝贵的经验。点赞和分享以帮助我们宣传。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/install-guake-terminal-ubuntu-mint-fedora/
作者:[Avishek Kumar][a]
译者:[wwy-hust](https://github.com/wwy-hust)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/avishek/
[1]:http://www.tecmint.com/linux-terminal-emulators/
[2]:https://github.com/Guake/guake/releases/tag/0.7.0

View File

@ -0,0 +1,74 @@
一个Ubuntu中给你的照片加Instagram风格滤镜的程序
================================================================================
**在Ubuntu中寻找一个给你的照片加Instagram风格的滤镜程序么**
拿起你的自拍棒跟着这个来。
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/instagram-app.jpg)
XnRetro是一个照片编辑应用
### XnRetro 照片编辑器 ###
**XnRetro** 是一个可以让你快速给你照片添加“类Instagram”效果的程序。
你知道我说的这些效果:划痕、噪点、框架、过处理、复古和怀旧色调(因为在这个数字时代,我们必须知道无尽的自拍不能称为怀旧的自己。)
无论你认为这些效果是愚蠢的艺术价值或者创作的捷径,这些滤镜非常流行切可以帮助那些平平照片添加个性。
#### XnRetro的功能 ####
**XnRetro有下面那些功能**
- 20色彩滤镜
- 15中光效果(虚化、泄露等等)
- 28框架和边框
- 5中插图 (带力度控制)
- Image adjustments for contrast, gamma, saturation, etc
- 对比度、伽马、饱和度等图像调整
- 矩形修剪选项
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/Screen-Shot-2015-05-10-at-23.30.01-e1431297068833.png)
灯光效果调整
你可以理论上编辑。jpg或者.png文件并且直接在app中等想到社交媒体上。
我说“理论”上的意思是保存.jpg图像无法正常在linux版的程序上工作你可以保存.png的图像。相似的大多数内置的社交链接失效或者无法导出。
要使用**15中光影效果**你需要在XnRetro的light文件夹下重新保存.jpg文件成.png文件。编辑light.xml来匹配新的文件名点击保存那没灯光效果就可以没有问题的加载进XnRetro了。
> 用户友好的XnRetro很难打败-一旦你用顺之后。’
**XnRetro值得安装么**
XnRetro并不是完美的。它看上去很丑、很难正确的安装并且已经纪念没有更新了。
它还可以使用,输了保存.jpg文件外。同时也是那些像Gimp或者Shotwell的那些正规图片调整工具的一个灵活替代品。
While web apps and Chrome Apps¹ like [Pixlr Touch Up][1] and [Polarr][2] offer similar features you may be looking for a truly native solution.
虽然web应用和Chrome Apps¹像[Pixlr Touch Up][1] 和 [Polarr][2]提供另外相似的功能,而你也许正在寻找真正原生的解决方案。
对于此用户友好带有容易使用滤镜的XnRetro很难被打败。
### 下载Ubuntu下的XnRetro ###
XnRetro没有可用的.deb安装包。它以二进制文件的形式发型这意味着你需要每次双击程序来运行。它也只有32位的版本。
你可以使用下面的XnRetro下载链接。下载完成后你需要解压压缩包并进入。双击里面的xnretro程序。
- [下载Linux版XnRetro (32位, tar.gz)][3]
--------------------------------------------------------------------------------
via: http://www.omgubuntu.co.uk/2015/05/instagram-photo-filters-ubuntu-desktop-app
作者:[Joey-Elijah Sneddon][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://plus.google.com/117485690627814051450/?rel=author
[1]:http://www.omgchrome.com/?s=pixlr
[2]:http://www.omgchrome.com/the-best-chrome-apps-of-2014/
[3]:http://www.xnview.com/en/xnretro/#downloads

View File

@ -0,0 +1,38 @@
Ubuntu会在今年达到2亿用户么
================================================================================
距离Mark Shuttleworth表达他的目标“在4年内Ubuntu的用户达到2亿”已经过去了四年零两周。尽管Ubuntu的用户数量在过去的四年中一直在上升但这个目标目前并未实现并且看起来不会在今年年底实现。
那是2011年5月在[UDS 布达佩斯][1]Shuttleworth表示Ubuntu将在4年内达到2亿用户。
![](http://www.phoronix.net/image.php?id=uds_budapest&image=budapest_phoronix_03_show&w=1920)
上一次我听到Ubuntu有“1千万”用户但是并没有任何可靠的报道表明Ubuntu的用户数接近2亿。来自Valve最近的统计表明相比于Windows和OS X的用户[使用Linux的游戏用户的比重少于1%][2]。大多数基于Web计量和其他统计方式的数据倾向于表明Linux的用户总数只占很少的部分。
撇开桌面版不谈Ubuntu在过去的四年来至少在云和服务器部署方面得到了大量的占有率并且被证明是Red Hat Enterprise的有力竞争者。Ubuntu还证明了它对基于ARM的硬件十分友好。当Mark在四年前提出他的目标时他可能考虑到Ubuntu Phone/Touch会比目前的状况更好。可是Ubuntu Phone/Touch目前仅仅在欧洲和[中国][3]可用,并且[Ubuntu Touch软件依旧在成熟的路上][4][仍需要大量的关键应用程序方面的工作][5]等。
![](http://www.phoronix.net/image.php?id=0x2015&image=shuttleworth_200_million_show&w=1920)
距离Canonical宣布[Ubuntu不久将登陆5%的PC][6]也已过去了3年。5%的目标是全球的PC装机量但哪怕再过3年我依旧很难相信这个目标会实现。至少在美国和欧洲我仍难以在实体店看到Ubuntu作为预装的系统主要的网络零售商/OEM厂商仍倾向于在特定的PC型号中提供Linux比如Chrome OS、Android设备。
另一个由开源社区提出的高傲地、落空的目标便是[GNOME将在2010年占有全球桌面市场10%的份额][7]。五年前没有任何迹象表明他们接近了那10%的里程碑。
在今天您认为Ubuntu用户有多少呢在未来的几年里Ubuntu或者Linux的用户会有多大增长呢通过评论来与我们分享您的想法吧。
--------------------------------------------------------------------------------
via: http://www.phoronix.com/scan.php?page=news_item&px=2015-200-Million-Goal-Retro
作者:[Michael Larabel][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.michaellarabel.com/
[1]:http://www.phoronix.com/vr.php?view=16002
[2]:http://www.phoronix.com/scan.php?page=news_item&px=Steam-April-2015-1-Drop
[3]:http://www.phoronix.com/scan.php?page=news_item&px=Ubuntu-MX4-In-China
[4]:http://www.phoronix.com/scan.php?page=news_item&px=Ubuntu-Calculator-Reboot
[5]:http://www.phoronix.com/scan.php?page=news_item&px=MTgzOTM
[6]:http://www.phoronix.com/scan.php?page=news_item&px=MTA5ODM
[7]:https://www.phoronix.com/scan.php?page=news_item&px=Nzg1Mw

View File

@ -1,314 +0,0 @@
如何在linux上使用Trickle来限制应用程序的网络宽带使用
================================================================================
有没有遇到过系统中的某个应用程序独占了你所有的网络宽带的情形如果你有过这样的遭遇那么你就会感受到Trickle宽带调整应用角色的价值不管你是一个系统管理员还是仅仅Linux用户,都需要学习如何控制应用程序的上下行速度,来确保你的网络宽带不会被某个程序
霸占.
![Install Trickle Bandwidth Limit in Linux](http://www.tecmint.com/wp-content/uploads/2013/11/Bandwidth-limit-trickle.png)
Install Trickle Bandwidth Limit in Linux
### 什么是 Trickle? ###
Trickle是一个网络宽带调整工具可以让我们管理应用程序的网络上下行速度使得可以避免其中的某个应用程序吃掉了全部或大部分可用的宽带换句话说Trickle可以让你基于单个应用程序来控制
网络流量速率,而不是仅仅针对与单个用户--在客户端网络环境中经典的宽带调整样例,
### Trickle是如何工作的###
另外tricle可以帮助我们基于应用来定义优先级所以当对整个系统进行了全局限制设定高优先级的应用依然会自动地获取更多的宽带。为了实现这个目标tricle设置通过TCP连接的套接字对数
据发送、数据接收路径的流量限制。我们必须注意到除了影响传输速率之外tricle任何时候都不会以任何方式来改变其处理过程。
### Trickle不能做什么 ###
这么说吧唯一的限制就是tricle静态连接的应用或者具有SUID或SGID位设置的二进制--因为他们使用动态链接并且将其自身加载到调整过程以及其关联的网络套接字之间。 Trickle此时会在这两种软件
组件之间扮演代理的角色。
由于trickle并不会需要超级用户的权限来运行所以用户可以设置用户独立的流量限制,可能这并不是你想要的,我们会探索如何使用全局设定来限制系统中的所有用户的流量限制。也即是说,此时系统中的每个用户具有管理
各自的流量速率,但是无论如何,都会受到系统管理员给他们设置的边界限制。
在这边文章中我们会描述如何通过trickle在linux平台上管理应用程序使用的网络宽带。为了生成必要流量在此会在客户端(CentOS 7 server dev1: 192.168.0.17)上使用 ncftpput 和
ncftpget, 在服务器(Debian Wheezy 7.5 dev2: 192.168.0.15)上使用vsftpd 来进行演示。 相同的指令也可以在RedHatFedora和Ubuntu等系统使用。
#### 前提条件 ####
1. 对于 RHEL/CentOS 7/6 [开启EPEL仓库][1]。EPEL的Extra Packages是一个 有Fedora项目维护的高质量、开源的软件仓库而且百分之百与其衍生产品相兼容
企业版本Linux和CentOS. 在这个仓库中trickle和ncftp两者都是可用的。
2. 按照如下方式安装ncftp:
# yum update && sudo yum install ncftp [On RedHat based systems]
# aptitude update && aptitude install ncftp [On Debian based systems]
3. 在单独的服务器上设置一个FTP服务器。需要注意的是尽管FTP天生就不安全但是
仍然被广泛应用在安全性无关紧要的文件上传下载中。 在这篇文章中我们使用它来演示
trickle的优点同时它也会在客户端的标准输出流中显示传输速率我们将是否在另外
的日期时间中使用放在一边讨论。
# yum update && yum install vsftpd [On RedHat based systems]
# aptitude update && aptitude install vsftpd [On Debian based systems]
现在在FTP服务器上按照以下方式编辑 /etc/vsftpd/vsftpd.conf 文件。
anonymous_enable=NO
local_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
在此之后确保在你的当前会话中开启了vsftpd并在之后的启动中让其自动启动。
# systemctl start vsftpd [For systemd-based systems]
# systemctl enable vsftpd
# service vsftpd start [For init-based systems]
# chkconfig vsftpd on
4. 如果你选在在一个CentOS/RHEL 7中为FTP服务器的远程访问配备SSH秘钥你需要
一个具有适合访问root目录之外的目录和文件内容上传下载权限并密码受保护的用户账户。
你可以通过在你的浏览器中输入以下的URL来浏览你的Home目录。一个登陆窗口会弹出来
提示你输入FTP服务器中的有效的用户名和密码。
ftp://192.168.0.15
如果验证成功你就会看到你的home目录中的内容。该教程的稍后部分中你将可以刷新
页面来显示在你之前上传过的文件。
![FTP Directory Tree](http://www.tecmint.com/wp-content/uploads/2013/11/FTP-Directory-Tree.png)
FTP Directory Tree
### 如何在Linux中安装 Tricle ###
1. 通过yum或aptitude来安装tricle.
为了确保能够成功安装,最好在安装工具之前,保证当前的安装包是最新的版本。
# yum -y update && yum install trickle [On RedHat based systems]
# aptitude -y update && aptitude install trickle [On Debian based systems]
2. 确认trickle是否对特定的二进制包有用。
之前我们解释过trickle只对使用动态或共享包的二进制包有用。为了确认我们是否可以对某个特定的应用使用trickle我们可以使用著名的ldd
列出动态依赖)工具。 特别地我们会查看任何给定程序的动态依赖中检查其当前使用的glibc因为其准确地定义了使用套接字交流中使用的系统调用。
对一个给定的二进制包执行以下命令来查看是否能对其使用trickle进行宽带调整
# ldd $(which [binary]) | grep libc.so
例如,
# ldd $(which ncftp) | grep libc.so
其输出是:
# libc.so.6 => /lib64/libc.so.6 (0x00007efff2e6c000)
输出中的括号中的字符可能在不同的系统平台中发生改变,甚至相同的命令在不同的时候运行也会,因为其代表包加载到物理内存中的地址。
如果上面的命令没有返回任何的结果就说明这个二进制包没有使用libc包因此tricle对其不能起到宽带调整的作用。
### 学习如何使用Trickle###
最基本的用法就是使用其单模式通过这种方式trickle用来显示地定义给定应用程序的上传下载速率。如前所述为了简单性我们会使用相同的应用
来进行上传下载测试。
#### 在单模式下运行trickle####
我们会比较在有无trickle的情况下的上传下载速率 -d选项指示下载速率KB/s单位而'-u'选项指示相同单位的上传速率。另外我们会使用到‘-s
选项来指定trickle应该以单模式运行。
以单模式运行trickle的基本语法如下
# trickle -s -d [download rate in KB/s] -u [upload rate in KB/s]
为了能够让你自己运行以下样例确保你在自己的客户端安装了trickle和ncftp我的是192.168.0.17)。
**样例1在有无trickle的情况下上传一个2.8 MB的PDF文件。**
我们使用一个自由发布的LInux基础知识PDF文件来进行下面的测试[文件链接][2]。
你可以首先使用下面的命令将这个文件下载到你当前的工作目录中:
# wget http://linux-training.be/files/books/LinuxFun.pdf
下面是在没有trickle的情况下将一个文件上传到我们的FTP服务器的语法
# ncftpput -u username -p password 192.168.0.15 /remote_directory local-filename
其中的 /remote_directory 是相对于用户名的Home目录的上传路径而local-filename是一个你当前工作目录中的文件。
特别的是在没有trickle的情形下我们可以得到上传峰值速率52.02MB/s(请注意,这个不是真正的平均上传速率,而是峰值开始的瞬时值),而且这个文件几乎
在瞬间就完成了上传。
# ncftpput -u username -p password 192.168.0.15 /testdir LinuxFun.pdf
输出:
LinuxFun.pdf: 2.79 MB 52.02 MB/s
在使用trickle的情况下我们会限制上传速率在5KB/s。在第二次上传文件之前我们需要在目标目录中删除这个文件否则ncftp就会通知我们在目标
目录中已经存在了与上传文件相同的文件,从而不会执行文件的传输:
# rm /absolute/path/to/destination/directory/LinuxFun.pdf
然后:
# trickle -s -u 5 ncftpput -u username -p password 111.111.111.111 /testdir LinuxFun.pdf
输出:
LinuxFun.pdf: 2.79 MB 4.94 kB/s
在上面的样例中我们看到平均的上传速率下降到了5KB/s。
**样例2在有无trickle的情况下下载相同过得2.8MB的PDF文件**
首先记得从原来的源文目录中删除这个PDF
# rm /absolute/path/to/source/directory/LinuxFun.pdf
请注意下面的样例中将远程的文件下载到客户端机器的当前目录下这是由FTP服务器的IP地址后面的·.·决定的。
没有trickle的情况下
# ncftpget -u username -p password 111.111.111.111 . /testdir/LinuxFun.pdf
输出:
LinuxFun.pdf: 2.79 MB 260.53 MB/s
在有trickle的情况下限制下载速率在20KB/s
# trickle -s -d 30 ncftpget -u username -p password 111.111.111.111 . /testdir/LinuxFun.pdf
输出:
LinuxFun.pdf: 2.79 MB 17.76 kB/s
### 在有监督的模式下运行Trickle [未管理的]###
Tricle也可以在未管理的模式下运行通过跟随在/etc/tricled.conf文件中定义的一系列参数。 这个文件定义了守护线程 trickled的行为以及如何管理tricle。
另外如果你想要全局设置被所有的应用程序使用的话我们就会需要使用tricle命令。 这个命令运行守护线程并允许我们通过trickle定义所有应用程序共享的上传下载限制不需要我们每次来进行指定。
例如,运行:
# trickled -d 50 -u 10
会导致任何通过tricle运行的应用程序的上传下载速率分别限制在30kb/s和10kb/s。
请注意你可以在任何时间都能确认守护线程tricled是否正在运行以及其运行参数
# ps -ef | grep trickled | grep -v grep
输出:
root 16475 1 0 Dec24 ? 00:00:04 trickled -d 50 -u 10
**样例3在是否使用tricle的情形下上传一个 19MB 的mp4文件到我们的FTP服务器。**
在这个样例中我们会使用“He is the gift”的自由分布视频可以通过这个[链接][3]下载。
我们将会在开始通过以下的命令将这个文件下载到你的当前工作目录中:
# wget http://media2.ldscdn.org/assets/missionary/our-people-2014/2014-00-1460-he-is-the-gift-360p-eng.mp4
首先我们会使用之前列出的命令来开启守护进程trickled:
# trickled -d 30 -u 10
在没有trickle时:
# ncftpput -u username -p password 192.168.0.15 /testdir 2014-00-1460-he-is-the-gift-360p-eng.mp4
输出:
2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 36.31 MB/s
有trickle的时
# trickle ncftpput -u username -p password 192.168.0.15 /testdir 2014-00-1460-he-is-the-gift-360p-eng.mp4
输出:
2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 9.51 kB/s
我们可以看到上面的输出,上传的速率下降到了约 10KB/s。
** 样例4在有无trickle的情形下下载这个相同的视频 **
与样例2一样我们会将该文件下载到当前工作目录中。
在没有trickle时:
# ncftpget -u username -p password 192.168.0.15 . /testdir/2014-00-1460-he-is-the-gift-360p-eng.mp4
输出:
2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 108.34 MB/s
有trickle的时
# trickle ncftpget -u username -p password 111.111.111.111 . /testdir/2014-00-1460-he-is-the-gift-360p-eng.mp4
输出:
2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 29.28 kB/s
上面的结果与我们之前设置的下载限速相对应(30KB/s)。
**注意:** 一旦守护进程开启之后没有必要使用trickle来为每个应用程序来单独设置限制。
如前所述每个人都可以进一步地通过tricled.conf来客制化tricle的宽带速率调整,该文件的一个典型的分区有以下部分组成:
[service]
Priority = <value>
Time-Smoothing = <value>
Length-Smoothing = <value>
其中,
- [service] 用来指示我们想要对其进行宽带使用调整的应用程序名称
- Priority 用来让我们为某个服务制定一个相对于其他服务高的优先级,这样就不允许守护进程管理中的一个单独的应用程序来占用所有的宽带。越小的数字代表更高的优先级。
- Time-Smoothing [以秒计]: 定义了trickled让各个应用程序传输或接收数据的时间间隔。小的间隔值(0.1-1秒)对于交互式应用程序是理想的,因为这样会具有一个更加平滑的会话体验,而一个相对较大
的时间间隔值(1-10秒)对于需要批量传输应用程序就会显得更好。如果没有指定该值默认是5秒。
- Length-smoothing [KB 单位]: 该想法与Time-Smoothing如出一辙但是是基于I/O操作而言。如果没有指定值会使用默认的10KB。
平滑值的改变会被翻译为将指定的服务的使用一个间隔值而不是一个固定值。不幸的是,没有一个特定的公式来计算间隔值的上下限,主要依赖于特定的应用场景。
下面是一个在CentOS 7 客户端中的tricled.conf 样例文件192.168.0.17
[ssh]
Priority = 1
Time-Smoothing = 0.1
Length-Smoothing = 2
[ftp]
Priority = 2
Time-Smoothing = 1
Length-Smoothing = 3
使用该设置tricled会为SSH赋予比FTP较高的传输优先级。值得注意的是一个交互进程例如SSH使用了一个较小的时间间隔值然而一个处理批量数据传输的服务如FTP使用一个较大的时间
间隔来负责之前的样例中的上传下载速率尽管不是百分百的有trickled指定的值但是也已经非常接近了。
### 总结 ###
在该文章中,我们探索了任何使用trickle在基于Fedora发行版和Debian衍生版平台上来限制应用程序的宽带使用.也包含了其他的可能用法,但是不对以下情形进行限制:
- 限制系统下载工具的下载速度,例如[wget][4],或 BT客户端.
- 限制你的系统的包管理工具`[yun][5]`更新的速度 (如果是基于Debian系统的话其包管理工具为`[aptitude][6]`)。
- 如果你的服务器是在一个代理或防火墙后面(或者其本身即是代理或防火墙的话)你可以使用trickle来同时设定下载和上传速率或者与客户端或外部交流速率。
欢迎提问或留言.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/manage-and-limit-downloadupload-bandwidth-with-trickle-in-linux/
作者:[Gabriel Cánepa][a]
译者:[theo-l](https://github.com/theo-l)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/gacanepa/
[1]:http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/
[2]:http://linux-training.be/files/books/LinuxFun.pdf
[3]:http://media2.ldscdn.org/assets/missionary/our-people-2014/2014-00-1460-he-is-the-gift-360p-eng.mp4
[4]:http://www.tecmint.com/10-wget-command-examples-in-linux/
[5]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/
[6]:http://www.tecmint.com/dpkg-command-examples/

View File

@ -1,81 +0,0 @@
在windows下,连接你的Linux服务器的ssh免费客户端工具列举\
================================================================================
你的操作系统是Windows,而你想要连接Linux服务器相互传送文件.于是你需要一个Secure Shell,简称SSH.实际上,SSH是一个网络协议,允许你通过网络连接到Linux和Unix服务器.SSH使用公钥加密来认证远程的计算机.你可以有多种途径使用SSH,要么自动地连接,或者使用密码认证登录.
本篇文章讲述了几种SSH客户端,供选择使用来连接你的Linux服务器.
我们开始.
### Putty ###
**Putty**是最有名的SSH和telnet客户端,最初由Simon Tatham为Windows平台开发.Putty是一款开源软件,有可用的源代码,和一群志愿者的发展和支持.
![](https://www.unixmen.com/wp-content/uploads/2015/03/putty.png)
Putty非常易于安装和使用,通常你不需要改大部分的配置选项.你只需要输入少量基本的参赛,就可以开始最简单的对话连接[here][1].
### Bitvise SSH Client ###
**Bitvise SSH **是一款支持SSH和SFTP的Windows客户端.由Bitvise专业地提供支持和发展.这款SSH客户端性能强悍,易于安装和使用.Bitvise SSH客户端功能丰富,拥有图形界面,通过一个有自动重连能力的内置代理允许用户动态端口运行.
![](https://www.unixmen.com/wp-content/uploads/2015/03/bitvise.png)
Bitvise SSH客户端对个人用户使用**是**免费的,同时对于在组织内部的单独商业使用也一样.你可以[在这里下载Bitvise SSH客户端][2]
### MobaXterm ###
**M偶吧Xterm**是你的**终极工具箱,解决远程计算**.在单一的Windows应用里,它提供了许多裁剪过的的功能,针对程序员,网络管理者,IT管理员和相当一部分需要在更简单界面(此处原文为in a more simple fashion,有点费解)远程作业的用户.
![](https://www.unixmen.com/wp-content/uploads/2015/03/mobaxterm.png)
MobaXterm提供了所有重要的**远程网络工具** (如SSH, X11, RDP, VNC, FTP, MOSH 等等),和**Unix 命令**bash, ls, cat, sed, grep, awk, rsync等等适用于Windows桌面在一个**单独便于携带的可执行文件里**其工作独立于工具箱MobaXterm对**个人使用免费**.你可以下载MobaXterm[在这里][3].
### DameWare SSH ###
我认为**DameWare SSH**是最好的免费SSH客户端
![](https://www.unixmen.com/wp-content/uploads/2015/03/ssh.png)
这个免费工具是一个终端模拟器可以让你实现从一个易用控制台的多种telnet和SSH连接
-用一个带标签的控制台界面管理多方会话
在Windows文件系统中保存喜欢的会话
-获取多个保存的证书集合,用于轻松登录不同的设备
使用telnet,SSH1和SSH2协议连接计算机和设备
你可以从[这个链接][4]下载 **DameWare SSH**
### SmarTTY ###
 
SmarTTY是一款免费的多标签SSH客户端支持使用SCP命令及时复制文件和目录
![](https://www.unixmen.com/wp-content/uploads/2015/03/smart.png)
大多数SSH服务器每次连接支持最多10个子会话SmarTTY在这方面做得很好没有烦人的多个窗口不需要重新登录仅仅打开一个新的标签页就可以开始了
### Cygwin ###
Cygwin是一款GNU和开源工具的大杂烩提供的功能近似一个Windows平台下的Linux.
![](https://www.unixmen.com/wp-content/uploads/2015/03/cyq.png)
**Cygwin**包括了一个Unix系统集模拟库cygwin.dll,GNU大量集合和其他被归类了的大量可选免费应用软件包在这些安装包中有高质量的编译器和其他软件开发工具一个X11服务器一套完整的X11开发套件GNU emacs编辑器Tex和LaTeX,openSSH(客户端和服务器),除此之外还有很多包括在微软Windows下需要编译和使用PhysioToolkit软件的每一样东西
读完我们的文章后不知你中意哪一款SSH客户端你可以留下你的评论描述你喜欢的系统和选择的原因当然如果有另外的SSH客户端没有被本文列举出来你可以帮助我们补充
--------------------------------------------------------------------------------
via: https://www.unixmen.com/list-free-windows-ssh-client-tools-connect-linux-server/
作者:[anismaj][a]
译者:[wi-cuckoo](https://github.com/wi-cuckoo)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:https://www.unixmen.com/author/anis/
[1]:http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
[2]:http://www.bitvise.com/download-area
[3]:http://mobaxterm.mobatek.net/download.html
[4]:http://www.dameware.com/downloads/registration.aspx?productType=ssh&AppID=17471&CampaignID=70150000000PcNM
[5]:http://cygwin.com/packages/

View File

@ -0,0 +1,144 @@
如何在Fedora或CentOS上使用Samba共享文件夹
================================================================================
如今无论在家里或者是办公场所不同的电脑之间共享文件夹已不是什么新鲜事了。在这种趋势下现代操作系统通过网络文件系统的方式使得电脑间数据的交换变得简单而透明。如果您工作的环境中既有微软的Windows又有Linux那么一个共享文件及目录的方式便是通过一个跨平台网络文件共享协议,SMB/CIFS。Windows天然的支持SMB/CIFSLinux也通过开源的软件Samba实现了SMB/CIFS协议。
在这篇文章中,我们将展示**如何使用Samba共享文件夹**。我们使用的Linux平台是**Fedora或CentOS**。这篇文章分为四部分。首先我们在Fedora/CentOS环境下安装Sambe。接着我们讨论如何调整SELinux和防火墙配置以允许Samba的文件共享。最后我们介绍如何使用Samba来共享文件夹。
### 步骤1在Fedora和CentOS上安装Samba ###
首先安装Samba以及进行一些基本的配置。
检验Samba是否已经安装在您的系统中
$ rpm -q samba samba-common samba-client
如果上面的命令没有任何输出这意味着Samba并未安装。这时应使用下面的命令来安装Samba。
$ sudo yum install samba samba-common samba-client
接下来创建一个用于在网络中共享的本地文件夹。这个文件夹应该以Samba共享的方式导出到远程的用户。在这个指南中我们会在顶层文件夹'/'中创建这个文件夹,因此,请确保您有相应的权限。
$ sudo mkdir /shared
如果您想在您的home文件夹内创建共享文件夹例如~/shared您必须激活SELinux中Samba的home文件夹共享选项具体将在后面提到。
在创建/shared文件夹后设置文件夹权限以保证其余用户可以访问它。
$ sudo chmod o+rw /shared
如果您不想其他用户对该文件夹拥有写权限,您需要移除命令中的'w'选项。
$ sudo chmod o+r /shared
接下来创建一个空文件来测试。这个文件可以被用来验证Samba的共享已经被挂载。
$ sudo touch /shared/file1
### 步骤2为Samba配置SELinux ###
接下来我们需要再次配置SELinux。在Fedora和CentOS发行版中SELinux是默认开启的。SELinux仅在正确的安全配置下才允许Samba读取和修改文件或文件夹。例如加上'samba_share_t'属性标签)。
下面的命令为文件的配置添加必要的标签:
$ sudo semanage fcontext -a -t samba_share_t "<directory>(/.*)?"
<directory>替换为我们之前为Samba共享创建的本地文件夹例如/shared
$ sudo semanage fcontext -a -t samba_share_t "/shared(/.*)?"
我们必须执行restorecon命令来激活修改的标签命令如下
$ sudo restorecon -R -v /shared
![](https://farm9.staticflickr.com/8584/16652774078_2055f45f70_b.jpg)
为了通过Samba共享在我们home文件夹内的文件夹我们必须在SELinux中开启共享home文件夹的选项该选项默认被关闭。下面的命令能达到该效果。如果您并未共享您的home文件夹那么您可以跳过该步骤。
$ sudo setsebool -P samba_enable_home_dirs 1
### 步骤3为Samba配置防火墙 ###
下面的命令用来打开防火墙中Samba为共享需要的TCP/UDP端口。
如果您在使用firewalld例如在Fedora和CentOS7下接下来的命令将会永久的修改Samba相关的防火墙规则。
$ sudo firewall-cmd --permanent --add-service=samba
如果您在防火墙中使用iptables例如CentOS6或者更早的版本可以使用下面的命令来打开Samba必要的向外的端口。
$ sudo vi /etc/sysconfig/iptables
----------
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 445 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
然后重启iptables服务
$ sudo service iptables restart
### 步骤4更改Samba配置 ###
后面的步骤用来配置Samba以将本地文件夹导出为Samba共享文件夹。
使用文件编辑器打开Samba配置文件并将下面的行添加到文件的末尾。
$ sudo nano /etc/samba/smb.conf
----------
[myshare]
comment=my shared files
path=/shared
public=yes
writeable=yes
上面在括号内的文本(例如,"myshare"是Samba共享的资源的名字它被用来从远程主机存取Samba共享。
创建Samba用户帐户这是挂载和导出Samba文件系统所必须的。我们可以使用smbpasswd工具来创建一个Samba用户。注意Samba用户帐户必须是Linux用户管理中已存在的。如果您尝试使用smbpasswd添加一个不存在的用户它会返回一个错误的消息。
如果您不想使用任何已存在的Linux用户作为Samba用户您可以在您的系统中创建一个新的用户。为安全起见设置新用户的登录脚本为/sbin/nologin并且不创建该用户的home文件夹。
在这个例子中,我们正在创建一个名叫"sambaguest"的用户,如下:
$ sudo useradd -M -s /sbin/nologin sambaguest
$ sudo passwd sambaguest
![](https://farm9.staticflickr.com/8702/16814479366_53f540d3ba_b.jpg)
在创建一个新用户后使用smbpasswd命令添加Samba用户。当这个命令询问一个密码时您可以键入一个不同于该用户的密码。
$ sudo smbpasswd -a sambaguest
4. 激活Samba服务并检测Samba服务是否在运行。
$ sudo systemctl enable smb.service
$ sudo systemctl start smb.service
$ sudo systemctl is-active smb
![](https://farm8.staticflickr.com/7607/16652984770_622f24bccc_b.jpg)
使用下面的命令来查看Samba中共享的文件夹列表。
$ smbclient -U sambaguest -L localhost
![](https://farm8.staticflickr.com/7281/16220411103_06bf585901_b.jpg)
接下来是在Thunar文件管理器中存取Samba共享文件夹以及对file1进行拷贝复制的截图。注意Samba的共享内容可以通过在Thunar中通过"smb://<samba-server-IP-address>/myshare"这个地址来存取。
![](https://farm8.staticflickr.com/7644/16218011174_c8b34fcedc_b.jpg)
--------------------------------------------------------------------------------
via: http://xmodulo.com/share-directory-samba-fedora-centos.html
作者:[Kristophorus Hadiono][a]
译者:[wwy-hust](https://github.com/wwy-hust)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://xmodulo.com/author/kristophorus

View File

@ -0,0 +1,159 @@
Sleuth Kit -- 一个用来分析磁盘映像和恢复文件的开源取证工具
================================================================================
SIFT 是一个由 SANS 公司提供的基于 Ubuntu 的取证发行版本。它包含许多取证工具,如 Sleuth kit/Autopsy 。但 Sleuth kit / Autopsy 可以直接在 Ubuntu 或 Fedora 发行版本上直接安装,而不必下载 SIFT 的整个发行版本。
Sleuth Kit/Autopsy 是一个开源的电子取证调查工具,它被用于从磁盘映像中恢复丢失的文件,基于事件响应的磁盘映像的分析。 Autopsy 工具是 sleuth kit 的一个网页接口,支持 sleuth kit 的所有功能。这个工具在 Windows 和 Linux 平台下都可获取到。
### 安装 Sleuth kit ###
首先,从 [sleuthkit][1] 的网站下载 Sleuth kit 软件。使用下面的命令在虚拟终端下使用 wget 命令来下载它,下图展示了这个过程。
# wget http://cznic.dl.sourceforge.net/project/sleuthkit/sleuthkit/4.1.3/sleuthkit-4.1.3.tar.gz
![下载 Sleuth Kit](http://blog.linoxide.com/wp-content/uploads/2015/03/download-sleuthkeit.png)
使用下面的命令解压 sleuthkit-4.1.3.tar.gz 并进入解压后的目录:
# tar -xvzf sleuthkit-4.1.3.tar.gz
![解压过程](http://blog.linoxide.com/wp-content/uploads/2015/03/extract.png)
在安装 sleuth kit 之前,运行下面的命令来执行所需的检查:
#./configure
![configure](http://blog.linoxide.com/wp-content/uploads/2015/03/configure.png)
然后使用 Make 命令来编译 sleuth kit
#make
![make](http://blog.linoxide.com/wp-content/uploads/2015/03/make.png)
最后,使用下面的命令将它安装到 **/usr/local** 目录下:
#make install
![make install](http://blog.linoxide.com/wp-content/uploads/2015/03/make-install.png)
### 安装 Autopsy 工具 ###
Sleuth kit 已经安装完毕,现在我们将为它安装 autopsy 界面。从 [sleuthkit 的 autopsy 页面][2] 下载 Autopsy 软件。使用下面的命令在虚拟终端下使用 wget 命令来下载它,下图展示了这个过程。
# wget http://kaz.dl.sourceforge.net/project/autopsy/autopsy/2.24/autopsy-2.24.tar.gz
![Autpsy 的下载链接](http://blog.linoxide.com/wp-content/uploads/2015/03/autopsy.png)
使用下面的命令解压 autopsy-2.24.tar.gz 并进入解压后的目录:
# tar -xvzf autopsy-2.24.tar.gz
![Autopsy 的解压](http://blog.linoxide.com/wp-content/uploads/2015/03/Autopsy-extraction.png)
autopsy 的配置脚本将询问 NSRL (National Software Reference Library) 和 **Evidence_Locker** 文件夹的路径。
当弹窗问及 NSRL 时,输入 "n",并在 **/usr/local** 目录下创建名为 Evidence_Locker 的文件夹。Autopsy 将在 Evidence_Locker 文件夹下存储配置文件,审计记录和输出文件。
#mkdir /usr/local/Evidence_Locker
#cd autopsy-2.24
#./configure
![Autopsy 配置脚本](http://blog.linoxide.com/wp-content/uploads/2015/03/autopsy-configuration.png)
在安装过程中添加完 Evidence_Locker 的安装路径后, autopsy 在那里存储配置文件并展现如下的信息来运行 autopsy 程序。
![启动 Autopsy](http://blog.linoxide.com/wp-content/uploads/2015/03/start-autopsy.png)
在虚拟终端中键入 **./autopsy** 命令来启动 Sleuth kit 工具的图形界面:
![Autopsy](http://blog.linoxide.com/wp-content/uploads/2015/03/autopsy-started.png)
在浏览器中键入下面的地址来获取 autopsy 的界面:
http://localhost:9999/autopsy
下图展现了 autopsy 插件的主页面:
![主页](http://blog.linoxide.com/wp-content/uploads/2015/03/main-interface.png)
在 autopsy 工具中,点击 **新案例** 按钮来开始进行分析。键入案例名称,此次调查的描述和检查人的姓名,下图有具体的展示:
![创建新事件](http://blog.linoxide.com/wp-content/uploads/2015/03/create-new-case1.png)
在接下来的网页中,将展示在上一个的网页中键入的详细信息。接着点击 **增加主机** 按钮来添加有关要分析的机器的详细信息。
![增加主机](http://blog.linoxide.com/wp-content/uploads/2015/03/add-host1.png)
在下一个网页中键入主机名,相关的描述和要分析的机器的时区设置。
![添加主机的详细信息](http://blog.linoxide.com/wp-content/uploads/2015/03/add-host-detial.png)
点击 **增加映像** 按钮来为取证分析添加映像文件。
![添加映像](http://blog.linoxide.com/wp-content/uploads/2015/03/add-image.png)
在接下来的网页中点击 **增加映像文件** 按钮。它将打开一个新的网页,来询问映像文件的路径和选择映像的类型以及导入的方法。
![添加映像文件](http://blog.linoxide.com/wp-content/uploads/2015/03/Add-image-file.png)
正如下图中展示的那样,我们已经键入了 Linux 映像文件的路径。在我们这个例子中,映像文件是磁盘的分区。
![添加映像分区](http://blog.linoxide.com/wp-content/uploads/2015/03/add-image-parition.png)
点击 下一步 按钮并在下一页中选择 **计算散列值** 的选项,这在下图中有展示。它也将检测所给映像的文件系统类型。
![映像和文件系统详情](http://blog.linoxide.com/wp-content/uploads/2015/03/image-and-file-system-detail.png)
下面的图片展示了静态分析之前映像文件的 MD5 散列值。
![散列值](http://blog.linoxide.com/wp-content/uploads/2015/03/hash1.png)
在下一个网页中, autopsy 展现了有关映像文件的如下信息:
- 映像的挂载点
- 映像的名称
- 所给映像的文件系统类型
点击 **详情** 按钮来获取更多有关所给映像文件的信息。它还提供了从映像文件的卷中导出未分配的片段和字符串的数据信息,这在下图中有展现。
![映像的详细信息](http://blog.linoxide.com/wp-content/uploads/2015/03/image-details.png)
在下图中那样,点击 **分析** 按钮来开始分析所给映像。它将开启另一个页面,其中包含了映像分析的多个选项。
![分析](http://blog.linoxide.com/wp-content/uploads/2015/03/analysis1.png)
在映像分析过程中Autopsy 提供了如下的功能:
- 文件分析
- 关键字搜索
- 文件类型
- 映像详情
- 数据单元
下图展示的是在给定的 Linux 分区映像上进行文件分析:
![映像的分析](http://blog.linoxide.com/wp-content/uploads/2015/03/Analysis-of-image.png)
它将从所给映像中提取所有的文件和文件夹。在下图中也展示了已被删除的文件的提取:
![已被删除的文件](http://blog.linoxide.com/wp-content/uploads/2015/03/deleted.png)
### 结论 ###
希望这篇文章能够给那些进入磁盘映像的静态分析领域的新手提供帮助。Autopsy 是 sleuth kit 的网页界面,提供了在 Windows 和 Linux 磁盘映像中进行诸如字符串提取,恢复被删文件,时间线分析,网络浏览历史,关键字搜索和邮件分析等功能。
--------------------------------------------------------------------------------
via: http://linoxide.com/ubuntu-how-to/autopsy-sleuth-kit-installation-ubuntu/
作者:[nido][a]
译者:[FSSlc](https://github.com/FSSlc)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/naveeda/
[1]:http://www.sleuthkit.org/sleuthkit/download.php
[2]:http://www.sleuthkit.org/autopsy/download.php

View File

@ -1,99 +0,0 @@
如何交互式地创建一个Docker容器
===============================================================================
大家好今天我们来学习如何使用一个docker镜像交互式地创建一个Docker容器。一旦我们从镜像中启动一个Docker进程Docker就会在父镜像与子镜像间来回搬运重复工作直到到达子镜像。然后联合文件系统会在顶层添加一个读写层。读写层又叫一个 **Container** 包含一些信息关于它的父镜像和一些其他的信息如单独的ID网络配置和资源限制。容器已经声明他们可以从 **running** 切换到 **exited** 状态。一个处于 **running** 状态的容器包含了很多分支在CPU上面运行独立于其他在主机上运行的进程而主机上 **exited** 是文件系统的状态,它的退出变量值是保留的。你可以使用读写层来启动,停止和重启一个容器。
Docker技术为IT界带来了巨大的改变它使得云服务可以用来共享应用和工作流程自动化使得应用可以从组件快速组合消除了开发与品质保证和产品环境间的摩擦。在这篇文章中我们将会建立CentOS环境然后维护一个网站在Apache网络服务器下运行。
这是快速且容易的教程讨论我们怎样使用一个交互的shell以一个交互的方式来创建一个容器。
### 1. 运行一个Docker实例 ###
Docker一开始尝试从本地取得和运行所需的镜像如果在本地主机上没有发现它就会从[Docker公共注册中心][1]拉取。这里我们将会在一个DOcker容器里取得并创建一个fedora实例附加一个bash shell到tty
# docker run -i -t fedora bash
![Downloading Fedora Base Image](http://blog.linoxide.com/wp-content/uploads/2015/03/downloading-fedora-base-image.png)
### 2.安装Apache网络服务器 ###
现在在我们的Fedora基本镜像准备好后我们将会开始交互式地安装Apache网络服务器而不必为它创建Dockerfile。为了做到这点我们需要在终端或者shell运行以下命令。
# yum update
![Installing httpd](http://blog.linoxide.com/wp-content/uploads/2015/03/installing-httpd2.png)
# yum install httpd
![Installing httpd](http://blog.linoxide.com/wp-content/uploads/2015/03/installing-httpd2.png)
# exit
### 3.Saving the Image ###
现在我们要去保存在Fedora实例里做的修改。要做到这个我们首先需要知道实例的容器ID。而为了得到ID我们又需要运行以下命令。
# docker ps -a
![Docker Running Container](http://blog.linoxide.com/wp-content/uploads/2015/03/docker-running-container.png)
然后,我们会保存这些改变为一个新的镜像,请运行以下命令。
# docker commit c16378f943fe fedora-httpd
![committing fedora httpd](http://blog.linoxide.com/wp-content/uploads/2015/03/committing-fedora-httpd.png)
这里修改已经通过使用容器ID保存起来了镜像名字叫fedora-httpd。为了确认新的镜像时候在运行我们将运行以下命令
# docker images
![view docker images](http://blog.linoxide.com/wp-content/uploads/2015/03/view-docker-images.png)
### 4. 添加内容到新的镜像 ###
我们自己新的Fedora Apache镜像正成功的运行现在我们想添加一些网页内容到Apache网络服务器包括我们的网站使得网站能够脱离盒子正确运行。为做到这点我们需要创建一个新的Dockerfile它会处理从复制网页内容到使用80端口的所有操作。而为做到这我们又需要使用我们最喜欢的文本编辑器创建Dockerfile文件像下面演示的一样。
# nano Dockerfile
现在,我们需要添加以下的命令行到文件中。
FROM fedora-httpd
ADD mysite.tar /tmp/
RUN mv /tmp/mysite/* /var/www/html
EXPOSE 80
ENTRYPOINT [ "/usr/sbin/httpd" ]
CMD [ "-D", "FOREGROUND" ]
![configuring Dockerfile](http://blog.linoxide.com/wp-content/uploads/2015/03/configuring-Dockerfile.png)
这里运行Dockerfilemysite.tar里的网页内容会自动解压到/temp/文件夹里。然后整个文件会被转移到Apache网页根目录/var/www/html/命令expose 80会打开80端口这样网站就能正常访问。其次入口点放在了/usr/sbin/https里面保证Apache服务器能够执行。
### 5. 建立并运行一个容器 ###
现在为了添加我们网站在上面我们要用刚刚创建的Dockerfile创建我们的容器为做到这我们需要运行以下命令。
# docker build -rm -t mysite .
![Building mysite Image](http://blog.linoxide.com/wp-content/uploads/2015/03/building-mysite-image.png)
我们建立自己的容器后,我们想要用下面的命令来运行容器。
# docker run -d -P mysite
![Running mysite Container](http://blog.linoxide.com/wp-content/uploads/2015/03/running-mysite-container.png)
### 总结 ###
最后我们已经成功的以交互式的方式建立了一个Docker容器。在本节方法中我们是直接通过交互的shell命令建立我们的容器和镜像。这种方法十分简单且快速在建立与配置镜像与容器方面。如果你有任何问题建议和反馈请在下方的评论框里写下来以便我们可以提升或者更新我们的文章。谢谢祝生活快乐 :-)
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-how-to/interactively-create-docker-container/
作者:[Arun Pyasi][a]
译者:[wi-cuckoo](https://github.com/wi-cuckoo)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/arunp/
[1]:https://registry.hub.docker.com/

View File

@ -0,0 +1,250 @@
如何使用Monit部署服务器监控系统
================================================================================
很多Linux系统管理员依赖一个集中式的远程监控系统比如[Nagios][1]或者[Cacti][2])来检查他们网络基础设备的健康状况。虽然集中式监控让管理员的生活更简单了,然而处理很多机器和服务时,专用的监控中心显然成为了一个单点故障,如果监控中心挂了或者因为什么原因(比如硬件或者网络故障)不可访问了,你就会失去整个网络基础设备情况的任何信息。
一个给你的监控系统增加冗余度的方法是安装独立的监控软件(作为后备),至少在网络中的关键/核心服务器上。这样在集中式监控系统挂掉的情况,你还有能力通过后备的监控方式来获取核心服务器的运行状况。
### Monit是什么 ###
[Monit][3]是一个跨平台的用来监控Unix/linux系统比如Linux、BSD、OSX、Solaris的工具。Monit特别易于安装而且非常轻量级只有500KB大小并且不依赖任何第三方程序、插件或者库。然而Monit可以胜任全面监控、进程状态监控、文件系统变动监控、邮件通知和对核心服务的自定义回调等场景。易于安装、轻量级的实现以及强大的功能让Monit成为一个理想的后备监控工具。
我已经在一些机器使用Monit几年了而且我对它的可靠性非常满意。甚至作为全面的监控系统对任何Linux系统管理员来说Monit也是非常有用和强大的。在这篇教程中我会展示如何在一个本地服务器部署Monit作为后备监控系统来监控常见的服务。在部署过程中我只会展示我们用到的部分。
### 在Linux安装Monit ###
Monit已经被包含在多数Linux发行版的软件仓库中了。
Debian、Ubuntu或者Linux Mint
$ sudo aptitude install monit
Fedora或者CentOS/RHEL
在CentOS/RHEL中你必须首先启用[EPEL][4]或者[Repoforge][5]软件仓库.
# yum install monit
Monit自带一个文档完善的配置文件其中包含了很多例子。主配置文件在/etc/monit.confFedora/CentOS/RHEL或者/etc/monit/monitrcDebian/Ubuntu/Mint。Monit配置文件有两部分“Global”全局和“Services”服务
### Global Configuration: Web Status Page 全局配置Web状态页面。LCTT 译注:保留原文是因为和配置文件中的字段对应) ###
Monit可以使用邮件服务来发送通知也可以使用HTTP/HTTPS页面来展示。我们先使用符合以下要求的web状态页面吧
- Monit监听1966端口。
- 对web状态页面的访问是通过SSL加密的。
- 使用monituser/romania作为用户名/口令登录。
- 只允许使用localhost、myhost.mydomain.ro和在局域网内部192.168.0.0/16访问。
- Monit使用pem格式的SSL证书。
之后的步骤我会使用一个基于Red Hat的系统。在基于Debian的系统中的步骤也是类似的。
首先,在/var/cert生成一个自签名的证书monit.pem
# mkdir /var/certs
# cd /etc/pki/tls/certs
# ./make-dummy-cert monit.pem
# cp monit.pem /var/certs
# chmod 0400 /var/certs/monit.pem
现在将下列代码片段放到Monit的主配置文件中。你可以创建一个空配置文件或者基于自带的配置文件修改。
set httpd port 1966 and
SSL ENABLE
PEMFILE /var/certs/monit.pem
allow monituser:romania
allow localhost
allow 192.168.0.0/16
allow myhost.mydomain.ro
### Global Configuration: Email Notification (全局配置:邮件通知) ###
然后我们来设置Monit的邮件通知。我们至少需要一个可用的[SMTP服务器][6]来让Monit发送邮件。这样就可以按照你的实际情况修改
- 邮件服务器的机器名smtp.monit.ro
- Monit使用的发件人monit@monit.ro
- 邮件的收件人guletz@monit.ro
- 邮件服务器使用的SMTP端口587默认是25
有了以上信息,邮件通知就可以这样配置:
set mailserver smtp.monit.ro port 587
set mail-format {
from: monit@monit.ro
subject: $SERVICE $EVENT at $DATE on $HOST
message: Monit $ACTION $SERVICE $EVENT at $DATE on $HOST : $DESCRIPTION.
Yours sincerely,
Monit
}
set alert guletz@monit.ro
就像你看到的Monit会提供几个内部变量`$DATE`、`$EVENT`、`$HOST`等你可以按照你的需求自定义邮件内容。如果你想要从Monit所在机器发送邮件就需要一个已经安装的与sendmail兼容的程序如postfix或者ssmtp
### Global Configuration: Monit Daemon 全局配置Monit守护进程###
接下来就该配置Monit守护进程了。可以将其设置成这样
- 在120秒后进行第一次检测。
- 每3分钟检测一次服务。
- 使用syslog来记录日志。
如下代码段可以满足上述需求。
set daemon 120
with start delay 240
set logfile syslog facility log_daemon
我们必须定义“idfile”Monit守护进程的一个独一无二的ID文件以及“eventqueue”当monit的邮件因为SMTP或者网络故障发不出去邮件会暂存在这里以及确保/var/monit路径是存在的。然后使用下边的配置就可以了。
set idfile /var/monit/id
set eventqueue
basedir /var/monit
### 测试Global Configuration全局配置 ###
现在“Global”部分就完成了。Monit配置文件看起来像这样
# Global Section
# status webpage and acl's
set httpd port 1966 and
SSL ENABLE
PEMFILE /var/certs/monit.pem
allow monituser:romania
allow localhost
allow 192.168.0.0/16
allow myhost.mydomain.ro
# mail-server
set mailserver smtp.monit.ro port 587
# email-format
set mail-format {
from: monit@monit.ro
subject: $SERVICE $EVENT at $DATE on $HOST
message: Monit $ACTION $SERVICE $EVENT at $DATE on $HOST : $DESCRIPTION.
Yours sincerely,
Monit
}
set alert guletz@monit.ro
# delay checks
set daemon 120
with start delay 240
set logfile syslog facility log_daemon
# idfile and mail queue path
set idfile /var/monit/id
set eventqueue
basedir /var/monit
现在是时候验证我们的工作了,你可以通过运行如下命令来验证存在的配置文件(/etc/monit.conf
# monit -t
Control file syntax OK
如果monit提示任何错误请再检查下配置文件。幸运的是错误/警告信息是可以帮助你发现问题的,比如:
monit: Cannot stat the SSL server PEM file '/var/certs/monit.pem' -- No such file or directory
/etc/monit/monitrc:10: Warning: hostname did not resolve 'smtp.monit.ro'
一旦你确认配置文件没问题了可以启动monit守护进程然后等2到3分钟
# service monit start
如果你使用的是systemd运行
# systemctl start monit
现在打开一个浏览器窗口,然后访问`https://<monit_host>:1966`。将`<monit_host>`替换成Monit所在机器的机器名或者IP地址。
如果你使用的是自签名的SSL证书你会在浏览器中看到一个警告信息。
![](https://farm8.staticflickr.com/7596/16737206479_96b9f7dfdb_c.jpg)
你完成登录后,一定要看这个页面。
![](https://farm8.staticflickr.com/7594/16303369973_6019482dea_c.jpg)
在这个教程的其余部分,我们演示监控一个本地服务器和常见服务的方法。你会在[官方wiki页面][7]看到很多有用的例子。其中的多数是可以直接复制粘贴的!
### Service Configuration: CPU/Memory Monitoring 服务配置CPU、内存监控 ###
我们先来监控本地服务器的CPU、内存占用。复制如下代码段到配置文件中。
check system localhost
if loadavg (1min) > 10 then alert
if loadavg (5min) > 6 then alert
if memory usage > 75% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 60% then alert
if cpu usage (wait) > 75% then alert
你可以很容易理解上边的配置。最上边的check是指每个监控周期全局配置里设置的120秒都对本机进行下面的操作。如果满足了任何条件monit守护进程就会使用邮件发送一条报警。
如果某个监控项不需要每个周期都检查可以使用如下格式它会每240秒检查一次平均负载。
if loadavg (1min) > 10 for 2 cycles then alert
### Service Configuration: SSH Service Monitoring 服务配置SSH服务监控 ###
先检查我们的sshd是否安装在/usr/sbin/sshd
check file sshd_bin with path /usr/sbin/sshd
我们还想检查sshd的启动脚本是否存在
check file sshd_init with path /etc/init.d/sshd
最后我们还想检查sshd守护进程是否存活并且在监听22端口
check process sshd with pidfile /var/run/sshd.pid
start program "/etc/init.d/sshd start"
stop program "/etc/init.d/sshd stop"
if failed port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
我们可以这样解释上述配置。我们检查是否存在名为sshd的进程并且有一个保存pid的文件存在/var/run/sshd.pid。如果任何一个不存在我们就使用启动脚本重启sshd。我们检查是否有进程在监听22端口并且使用的是SSH协议。如果没有我们还是重启sshd。如果在最近的5个监控周期5x120秒至少重启5次了sshd就被认为是不能用的我们就不再检查了。
![](https://farm9.staticflickr.com/8685/16735725998_62c26a24bc_c.jpg)
### Service Configuration: SMTP Service Monitoring 服务配置SMTP服务监控 ###
现在我们来设置一个检查远程SMTP服务器如192.168.111.102的监控。假定SMTP服务器运行着SMTP、IMAP、SSH服务。
check host MAIL with address 192.168.111.102
if failed icmp type echo within 10 cycles then alert
if failed port 25 protocol smtp then alert
else if recovered then exec "/scripts/mail-script"
if failed port 22 protocol ssh then alert
if failed port 143 protocol imap then alert
我们检查远程主机是否响应ICMP协议。如果我们在10个周期内没有收到ICMP回应就发送一条报警。如果监测到25端口上的SMTP协议是异常的就发送一条报警。如果在一次监测失败后又监测成功了就运行一个脚本/scripts/mail-script。如果检查22端口上的SSH或者143端口上的IMAP协议不正常同样发送报警。
### 总结 ###
在这个教程我演示了如何在本地服务器设置Monit当然这只是Monit功能的冰山一角。你可以花些时间阅读Monit的man手册写得很好。Monit可以为任何Linux系统管理员做很多事情并且具有非常优美和易于理解的语法。如果你将一个集中式的远程监控系统和Monit一同使用你会得到一个更可靠的监控系统。你感觉Monit怎么样
--------------------------------------------------------------------------------
via: http://xmodulo.com/server-monitoring-system-monit.html
作者:[Iulian Murgulet][a]
译者:[goreliu](https://github.com/goreliu)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://xmodulo.com/author/iulian
[1]:http://xmodulo.com/monitor-common-services-nagios.html
[2]:http://xmodulo.com/monitor-linux-servers-snmp-cacti.html
[3]:http://mmonit.com/monit/
[4]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html
[5]:http://xmodulo.com/how-to-set-up-rpmforge-repoforge-repository-on-centos.html
[6]:http://xmodulo.com/mail-server-ubuntu-debian.html
[7]:http://mmonit.com/wiki/Monit/ConfigurationExamples

View File

@ -0,0 +1,101 @@
如何在Linux下使用Gitblit工具创建Git仓库服务
================================================================================
朋友今天我们将学习如何在你的Linux服务器或者PC上安装Gitblit工具。首先我们看看什么是Git它的功能以及安装Gitblit的步骤。[Git是分布式版本控制系统][1]它强调速度、数据一致性并且支持分布式、非线性工作流。它最初由Linus Torvalds在2005年为Linux内核设计和开发使用GPL2证书并因此成为软件开发中使用最广泛的版本控制系统。
[Gitblit是完全开源的软件][2]它基于纯粹的Java堆栈被设计以在Git仓库速度和效率方面胜任从小型到极大型的项目。它很容易学习和上手并有着闪电般的性能。它在廉价的本地分支、便于staging、多工作流等方面远胜过一些SCM版本控制工具比如Subversion、CVS、Perforce和ClearCase。
#### Gitblit的功能 ####
- 它可以做为一个无声的仓库视图,没有管理控制以及用户账户。
- 它可以做为完整的Git堆栈拥有clone, pushing和仓库存取控制。
- 它能独立于其他Git工具使用包括实际的Git它能和您已创建的工具合作。
### 1.创建Gitblit安装目录 ###
首先我们将在我们的服务器上建立一个目录我们将在该目录下安装最新的Gitblit。
$ sudo mkdir -p /opt/gitblit
$ cd /opt/gitblit
![创建gitblit目录](http://blog.linoxide.com/wp-content/uploads/2015/01/creating-directory-gitblit.png)
### 2. 下载并解压 ###
现在我们将从Gitblit官方站点下载最新版的Gitblit。这里我们将安装1.6.2版本。所以,请在安装时根据具体的版本对命令进行修改。
$ sudo wget http://dl.bintray.com/gitblit/releases/gitblit-1.6.2.tar.gz
![下载gitblit安装包](http://blog.linoxide.com/wp-content/uploads/2015/01/downloading-gitblit.png)
接下来我们将解压下载到的tarball压缩包至之前创建的目录 /opt/gitblit/
$ sudo tar -zxvf gitblit-1.6.2.tar.gz
![解压gitblit压缩包](http://blog.linoxide.com/wp-content/uploads/2015/01/extracting-gitblit-tar.png)
### 3.配置并运行 ###
现在我们将对Gitblit进行配置。如果你想要定制Gitblit的行为你可以修改`gitblit/data/gitblit.properties`。在完成配置后我们将运行安装好的gitblit。有两种方式来运行gitblit第一种是通过下面的命令手动运行
$ sudo java -jar gitblit.jar --baseFolder data
另一种是将gitblit添加为服务。下面是在linux下将gitblit添加为服务的步骤。
由于我在使用Ubuntu下面的命令将是 sudo cp service-ubuntu.sh /etc/init.d/gitblit。所以请根据你的发行版修改文件名service-ubuntu.sh为相应的你运行的发行版。
$ sudo ./install-service-ubuntu.sh
$ sudo service gitblit start
![启动gitblit服务](http://blog.linoxide.com/wp-content/uploads/2015/01/starting-gitblit-service.png)
在你的浏览器中打开http://localhost:8080或https://localhost:8443也可以将localhost根据本地配置替换为IP地址。输入默认的管理员凭证admin/admin并点击login按钮。
![gitblit欢迎页面](http://blog.linoxide.com/wp-content/uploads/2015/01/gitblit-welcome.png)
现在我们将添加一个新的用户。首先你需要以admin用户登录username = **admin**password = **admin**
然后,点击 user icon > users > (+) new user 来创建一个新用户,如下图所示。
![添加新用户](http://blog.linoxide.com/wp-content/uploads/2015/01/add-user.png)
现在,我们将创建一个开箱可用的仓库。点击 repositories > (+) new repository。然后如下图所示添加新的仓库。
![添加新的仓库](http://blog.linoxide.com/wp-content/uploads/2015/01/add-new-repository.png)
#### 使用命令行创建一个新的仓库 ####
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git
git push -u origin master
请将用户名arunlinoxide替换为你添加的用户名。
#### 在命令行中push一个已存在的仓库 ####
git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git
git push -u origin master
**注意**强烈建议所有人修改用户名“admin”的密码。
### 结论 ###
欢呼吧我们已经在Linux电脑中安装好了最新版本的Gitblit。接下来我们便可以在我们的大小工程中享受这样一个优美的版本控制系统。有了Gitblit版本控制便再容易不过了。它有易于学习、轻量级、高性能的特点。因此如果你有任何的问题、建议和反馈请在留言处留言。
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-how-to/serve-git-repositories-gitblit/
作者:[Arun Pyasi][a]
译者:[wwy-hust](https://github.com/wwy-hust)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/arunp/
[1]:http://git-scm.com/
[2]:http://gitblit.com/

View File

@ -0,0 +1,236 @@
20个为桌面用户准备的令人惊叹的Docker容器
================================================================================
大家好今天我们会列出一些很棒的运行在Docker容器中的桌面软件我们可以在自己的桌面系统中运行它们。Docker是一个开源的项目它提供可以将应用程序作为一个轻量级容器来打包、传送和运行的开放平台。它没有语言支持、框架或打包系统的限制可以运行在任何地方从小型的家用电脑到高端的服务器。它可以使部署和扩展web应用程序、数据库和后端服务像搭积木一样容易而不依赖特定技术栈或提供商。它主要是由开发、运维工程师使用的因为它简单、快速和方便可以用来测试和辅助开发他们产品但是我们也可以在桌面环境使用Docker这样一些桌面程序可以开箱即用。
下边是20个非常棒的桌面软件docker镜像我们可以使用Docker来运行。
### 1. Lynx ###
Lynx是一个一直以来最受欢迎的文本界面网页浏览器它对多数Linux用户来说都很熟悉。它应该是现在还在日常和开发环境中被使用的最古老的网页浏览器了。可以使用如下命令运行Lync。
$ docker run -it \
--name lynx \
jess/lynx
### 2. Irssi ###
Irssi是一个非常棒的文本界面IRC客户端。可以使用如下命令运行Irssi。
docker run -it --name my-irssi -e TERM -u $(id -u):$(id -g) \
-v $HOME/.irssi:/home/user/.irssi:ro \
-v /etc/localtime:/etc/localtime:ro \
irssi
### 3. Chrome ###
Chrome是一个令人惊叹的图形界面网页浏览器由Google开发它基于开源的Chromium项目。Google Chrome是一个被广泛使用的、快速安全的网页浏览器经常上网的人会非常熟悉它。我们可以使用如下命令在Docker中运行Chrome。
$ docker run -it \
--net host \
--cpuset 0 \
--memory 512mb \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v $HOME/Downloads:/root/Downloads \
-v $HOME/.config/google-chrome/:/data \
-v /dev/snd:/dev/snd --privileged \
--name chrome \
jess/chrome
### 4. Tor浏览器 ###
Tor浏览器是一个支持匿名访问的网页浏览器。它让我们可以自由地在网络世界遨游或者浏览被特定组织或者网络服务提供商封锁的网站。它会阻止有人通过监视我们的网络连接来窃取我们在网络上的一举一动以及我们的确切位置。运行如下命令运行Tor浏览器。
$ docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v /dev/snd:/dev/snd --privileged \
--name tor-browser \
jess/tor-browser
### 5. Firefox浏览器 ###
Firefox浏览器是一个自由并且开源的网页浏览器它由Mozilla基金会开发。它使用Gecko和SpiderMonkey引擎。Firefox浏览器有很多新特性并且它以性能和安全性著称。
$ docker run -d \
--name firefox \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
kennethkl/firefox
### 6. Rainbow Stream ###
Rainbow Stream是一个文本界面的Twitter客户端有实时显示tweetstream、搜索、喜欢和更多其他特性可以直接在终端使用。使用如下命令运行Rainbow Stream。
$ docker run -it \
-v /etc/localtime:/etc/localtime \
-v $HOME/.rainbow_oauth:/root/.rainbow_oauth \
-v $HOME/.rainbow_config.json:/root/.rainbow_config.json \
--name rainbowstream \
jess/rainbowstream
### 7. Gparted ###
Gparted是一个用来给磁盘分区的开源软件。现在可以在Docker容器里享受分区的乐趣。可以使用如下命令运行gparted。
$ docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
--device /dev/sda:/dev/sda \ # mount the device to partition
--name gparted \
jess/gparted
### 8. GIMP图片编辑器 ###
GIMPGnu Image Manipulation Program是一个令人惊叹的Linux图片编辑软件。它是一个可以自由分发的可以处理照片修正、图像合成和图像创作等任务的工具。
$ docker run -it \
--rm -e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
jarfil/gimp-git
### 9. Thunderbird ###
Thunderbird是一个自由并且开源的电子邮件软件它由Mozilla基金会开发和维护。它有众多一个电子邮件软件应该具有的功能。Thunderbird非常易于安装和定制。使用如下命令在Docker中运行Thunderbird。
$ docker run -d \
-e DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-u docker \
-v $HOME/docker-data/thunderbird:/home/docker/.thunderbird/ \
yantis/thunderbird thunderbird
### 10. Mutt ###
Mutt是一个文本界面的电子邮件客户端有很多很酷的功能如颜色支持IMAP、POP3、SMTP支持邮件存储支持等。 使用如下命令运行Mutt。
$ docker run -it \
-v /etc/localtime:/etc/localtime \
-e GMAIL -e GMAIL_NAME \
-e GMAIL_PASS -e GMAIL_FROM \
-v $HOME/.gnupg:/home/user/.gnupg \
--name mutt \
jess/mutt
### 11. Skype ###
Skype是一个支持文字、语音和视频的即时通讯软件它不是开源的但在Linux下可以很棒地运行。我们同样可以在Docker中运行Skype使用如下命令。
$ docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-v /dev/snd:/dev/snd --privileged \
-e DISPLAY="unix$DISPLAY" \
tianon/skype
### 12. Cathode ###
Cathode是一个漂亮并且高度可定制的终端模拟器灵感来自经典的计算机。使用如下命令运行Cathode。
$ docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
--name cathode \
jess/1995
### 13. LibreOffice ###
LibreOffice是一个功能强大的办公套件它是自由和开源的现在由The Document基金会维护。它有干净的界面和强大的功能让我们释放创造力和提升生产力。LibreOffice将数个应用程序集成在一起是市面上最强大的自由并且开源的办公套件。
$docker run \
-v $HOME/Documents:/home/libreoffice/Documents:rw \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e uid=$(id -u) -e gid=$(id -g) \
-e DISPLAY=unix$DISPLAY --name libreoffice \
chrisdaish/libreoffice
### 14. Spotify ###
Spotify可以即时访问数百万的歌曲从经典老歌到最新单曲。可以使用如下命令在Docker中听我们最喜欢的歌曲。
$ docker run -it \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY \
-v /dev/snd:/dev/snd --privileged \
--name spotify \
jess/spotify
### 15. Audacity ###
Audacity是一个自由并且开源的跨平台软件用来录制和编辑音频。Audacity可以用来做所有类型音频例如podcast的后期处理如归一化、调整、淡入淡出。使用如下命令来运行Audacity。
$ docker run --rm \
-u $(id -u):$(id -g) \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-v /dev/snd:/dev/snd \
-v "$HOME:$HOME" \
-w "$HOME" \
-e DISPLAY="unix$DISPLAY" \
-e HOME \
$(find /dev/snd/ -type c | sed 's/^/--device /') \
knickers/audacity
### 16. Eclipse ###
Eclipse是一个集成开发环境。它包含基本的工作区和用来定制环境的可扩展插件系统。它在Java开发者中很流行。
$ docker run -v ~/workspace/:/home/eclipse/workspace/ \
-e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-d leesah/eclipse
### 17. VLC媒体播放器 ###
VLC是一个自由并且开源的跨平台多媒体播放器可以播放本地文件、DVD、CD、VCD和各种流媒体。VLC由VideoLAN组织开发和维护。使用如下命令运行VLC。
$ docker run -v\
$HOME/Documents:/home/vlc/Documents:rw \
-v /dev/snd:/dev/snd --privileged \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e uid=$(id -u) -e gid=$(id -g) \
-e DISPLAY=unix$DISPLAY --name vlc \
chrisdaish/vlc
### 18. Vim编辑器 ###
Vim是一个高度可配置的文本界面文字编辑器为高效的文本编辑而生。它是预装在多数UNIX系统中的vi编辑器的改进版本。
$ docker run -i -t --name my-vim -v ~/:/home/dev/src haron/vim
### 19. Inkscape ###
Inkscape是一个自由并且开源的矢量图形编辑器。它可以创建、编辑矢量图形如插图、图示、线条艺术、图表、徽标以及更复杂的绘画。Inkscape使用的主要矢量图形格式是SVG 1.1版本。它也可以导入和导出一些其他的格式但实际编辑使用的还是SVG格式。
$docker build -t rasch/inkscape --rm .
$ docker run --rm -e DISPLAY \
-u inkscaper
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/.Xauthority:/home/inkscaper/.Xauthority \
--net=host rasch/inkscape
### 20. Filezilla ###
Filezilla是一个自由的FTP解决方案支持FTP、SFTP、FTPS协议。它的客户端是一个功能强大的文件管理工具。它是一个很棒的高度可靠和易用的开源FTP解决方案。
$ xhost +si:localuser:$(whoami)
$ docker run \
-d \
-e DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-u docker \
-v /:/host \
-v $HOME/docker-data/filezilla:/home/docker/.config/filezilla/ \
yantis/filezilla filezilla
### 总结 ###
使用Docker运行桌面软件真的是很棒的体验。Docker是一个快速、简单的开发平台适合从家里、办公室到生产环境里传送和开发软件的场景。使用Docker运行桌面软件是试用而不将其安装到自己实体机文件系统中的很酷的方法。如果你有任何问题、评论或者反馈清写在下方的评论框中让我们知道哪些是需要增加或者改进的。谢谢享受Docker吧 :-)
--------------------------------------------------------------------------------
via: http://linoxide.com/how-tos/20-docker-containers-desktop-user/
作者:[Arun Pyasi][a]
译者:[goreliu](https://github.com/goreliu)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/arunp/

View File

@ -0,0 +1,298 @@
安装完Ubuntu 15.04桌面后要做的15件事
================================================================================
本教程适用于新手和在自己的电脑上安装好Ubuntu 15.04 “Vivid Vervet” 桌面之后为了自定义自己的系统并安装一些基本程序作为日常使用的已经做了一些准备的人。
![Things to Do After Installing Ubuntu 15.04](http://www.tecmint.com/wp-content/uploads/2015/04/things-to-do-after-installing-ubuntu-15.04.jpeg)
安装完Ubuntu 15.04桌面后要做的15件事
### 1. 启用Ubuntu额外软件库并更新系统 ###
在刚装好Ubuntu之后你应该要关心的第一件事是启用官方合作伙伴提供的Ubuntu额外软件库并且通过最近一次的安全补丁和软件更新来保持系统是最新状态。
要完成这一步依次从左边菜单中打开System Settings -> Software and Updates工具并检查所有Ubuntu软件和其他软件库官方合作伙伴所提供点击关闭按钮并等待重新加载缓存源树。
![Software Updates](http://www.tecmint.com/wp-content/uploads/2015/04/Software-Updates.jpg)
Software Updates
![Other Software (Canonical Partners)](http://www.tecmint.com/wp-content/uploads/2015/04/Other-Software.jpg)
Other Software (Canonical Partners)
经过一系列快速平滑的更新过程之后,打开终端并输入以下命令来让系统使用新软件库:
$ sudo apt-get update
$ sudo apt-get upgrade
![Ubuntu Upgrade](http://www.tecmint.com/wp-content/uploads/2015/04/Ubuntu-Upgrade.jpg)
Ubuntu Upgrade
### 2. 安装额外驱动 ###
为了能让系统扫描并安装额外的硬件专有驱动我们依然从System Settings打开Software and Updates工具选择Additional Drivers标签并等待该工具扫描驱动。
如果有驱动匹配到了你的硬件查看你想要安装的驱动并点击Apply按钮来安装它以防专有驱动没有如期工作用Revert按钮就能卸载它们或勾选Do not use the device后点击Apply按钮。
![Install Drivers in Ubuntu](http://www.tecmint.com/wp-content/uploads/2015/04/install-drivers.jpg)
Install Drivers
### 3. 安装Synaptic和Gdebi工具 ###
除了Ubuntu Software CenterSynaptic是一个apt图形化工具通过它你能管理、安装、卸载、搜索和升级软件库并配置软件包。同样的Gdebi在功能上也有相同的地方。在终端上输入以下命令来安装这两个包
$ sudo apt-get install synaptic gdebi
![Install Synaptic and Gdebi](http://www.tecmint.com/wp-content/uploads/2015/04/install-synaptic-gdebi.jpg)
Install Synaptic and Gdebi
![Synaptic Package Manager](http://www.tecmint.com/wp-content/uploads/2015/04/synaptic-package-manager.jpg)
Synaptic Package Manager
### 4. 更改系统外观和运行状态 ###
如果你想要更改桌面背景或图标大小依次打开System Settings > Appearance > Look并对桌面进行个性化设置把菜单移动到窗口标题栏在Behavior标签中启动workspaces和desktop icons或开关auto-hide the Launcher。
![System Appearances](http://www.tecmint.com/wp-content/uploads/2015/04/system-appearance.jpg)
System Appearances
### 5. 提升系统安全性和隐私性 ###
![System Security Enhancement](http://www.tecmint.com/wp-content/uploads/2015/04/system-security-1.jpg)
System Security Enhancement
![System Security Options](http://www.tecmint.com/wp-content/uploads/2015/04/system-security-2.jpg)
System Security Options
### 6. 禁用不需要开机自启动的应用程序 ###
要提高登录系统的速度通过输入以下命令来显示被隐藏的开机启动应用程序在Dash中搜索它就能打开Startup Applications工具并反选不需要再登录系统的过程中启动的程序。
$ sudo sed -i s/NoDisplay=true/NoDisplay=false/g /etc/xdg/autostart/*.desktop
![Disable Unwanted Applications](http://www.tecmint.com/wp-content/uploads/2015/04/disable-unwanted-applications.jpg)
Disable Unwanted Applications
### 7. 添加扩展多媒体支持 ###
默认情况下Ubuntu对多媒体文件支持不是很好。为了能播放各种不同的多媒体格式或解析视频文件可以安装以下多媒体应用程序
- VLC
- Smplayer
- Audacious
- QMMP
- Mixxx
- XBMC
- Handbrake
- Openshot
用以下命令来一次性安装所有的这些应用程序:
$ sudo apt-get install vlc smplayer audacious qmmp mixxx xbmc handbrake openshot
![Install Media Players](http://www.tecmint.com/wp-content/uploads/2015/04/install-media-players.jpg)
Install Media Players
![Media Player Playlist](http://www.tecmint.com/wp-content/uploads/2015/04/media-playllist.jpg)
Media Player Playlist
除了多媒体播放器安装ubuntu-restricted-extras和Java支持包也可以解码并支持其它受约束的多媒体格式。
$ sudo apt-get install ubuntu-restricted-extras openjdk-8-jdk
![Install Ubuntu Extras](http://www.tecmint.com/wp-content/uploads/2015/04/install-ubuntu-extras.jpg)
Install Ubuntu Extras
在终端上输入以下命令来启用DVD Playback和其它多媒体解码器
$ sudo apt-get install ffmpeg gstreamer0.10-plugins-bad lame libavcodec-extra
$ sudo /usr/share/doc/libdvdread4/install-css.sh
![Enable Video Codes](http://www.tecmint.com/wp-content/uploads/2015/04/enable-video-playbacks.jpg)
Enable Video Codes
### 8. 安装图像处理应用程序 ###
如果你是一个摄影爱好者想在Ubuntu上处理调整图像或许需要安装一下图像处理程序
- GIMP (alternative for Adobe Photoshop)
- Darktable
- Rawtherapee
- Pinta
- Shotwell
- Inkscape (alternative for Adobe Illustrator)
- Digikam
- Cheese
这些应用程序能从Ubuntu Software Center中安装或者立刻在终端上使用以下命令
$ sudo apt-get install gimp gimp-plugin-registry gimp-data-extras darktable rawtherapee pinta shotwell inkscape
![Install Image Applications](http://www.tecmint.com/wp-content/uploads/2015/04/install-image-applications.jpg)
Install Image Applications
![Rawtherapee Tool](http://www.tecmint.com/wp-content/uploads/2015/04/rawtherapee.jpg)
Rawtherapee Tool
### 9. 安装媒体烧录软件 ###
如果要挂载ISO镜像或烧录一张CD或DVD你可以选择并安装以下软件中的一款
- Brasero Disk Burner
- K3b
- Xfburn
- Furius ISO Mount
$ sudo apt-get install brasero
$ sudo apt-get install k3b
$ sudo apt-get install xfburn
$ sudo apt-get install furiusisomount
![Install Media Burners](http://www.tecmint.com/wp-content/uploads/2015/04/install-media-burners.jpg)
Install Media Burners
### 10. 安装压缩应用程序 ###
如果要处理大多数归档格式的文件(zip, tar.gz, zip, 7zip rar等等),输入以下命令来安装这些包:
$ sudo apt-get install unace unrar zip unzip p7zip-full p7zip-rar sharutils rar uudeview mpack arj cabextract file-roller
![Install Archive Applications](http://www.tecmint.com/wp-content/uploads/2015/04/install-archive-apps.jpg)
Install Archive Applications
### 11. 安装聊天应用程序 ###
如果你想要和世界各地的人们聊天这里有一份最流行的Linux聊天应用程序列表
- Pidgin
- Skype
- Xchat
- Telegram
- aMSN
- Viber
你可以从Ubuntu Software Center中安装它们或使用以下命令
$ sudo apt-get install pidgin
$ sudo apt-get install skype
$ sudo apt-get install xchat
$ sudo apt-get install amsn
$ sudo add-apt-repository ppa:atareao/telegram -y
$ sudo apt-get update
$ sudo apt-get install telegram
![Install Chat Applications](http://www.tecmint.com/wp-content/uploads/2015/04/install-chat-apps.jpg)
Install Chat Applications
想要在Ubuntu上安装Viber可以访问[Viber官方网站][1]下载Debian安装包到本地并用Gdebi包管理工具来安装viber.deb应用程序(右击 > 打开 -> GDebi Package Installer).
![Install Viber in Ubuntu](http://www.tecmint.com/wp-content/uploads/2015/04/install-viber.jpg)
Install Viber
### 12. 安装种子软件 ###
在Ubuntu最流行的种子应用程序和P2P文件共享程序是
- Deluge
- Transmission
- Qbittorrent
- LinuxDC++
想要在Ubuntu上安装你最喜欢的P2P文件共享应用程序可以在终端上输入以下命令
$ sudo apt-get install deluge
$ sudo apt-get install transmission
$ sudo apt-get install qbittorrent
$ sudo apt-get install linuxdcpp
![Install Torrent](http://www.tecmint.com/wp-content/uploads/2015/04/install-torrent.jpg)
Install Torrent
### 13. 安装Windows仿真器-Wine和游戏支持平台-Steam ###
Wine仿真器允许你在Linux上安装并运行Window应用程序。在另一方面Steam是一款Valve开发的流行于Linux系统的游戏平台。想要在你的机器上安装它们可以输入以下命令或使用Ubuntu Software Center。
$ sudo apt-get install steam wine winetricks
![Install Wine](http://www.tecmint.com/wp-content/uploads/2015/04/install-wine.jpg)
Install Wine
### 14. 安装Cairo-Dock并启用桌面视觉效果 ###
Cairo-Dock是一款漂亮且灵巧的用于Linux桌面上的启动条类似于Mac OS X dock。想要在Ubuntu上安装它可以在终端上运行以下命令
$ sudo apt-get install cairo-dock cairo-dock-plug-ins
![Install Cairo Dock](http://www.tecmint.com/wp-content/uploads/2015/04/install-cairo-dock.jpg)
Install Cairo Dock
![Add Cairo Dock at Startup](http://www.tecmint.com/wp-content/uploads/2015/04/add-cairo-dock-startup.jpg)
Add Cairo Dock at Startup
想要启用某一套桌面效果例如Cube效果可以使用以下命令来安装Compiz包
$ sudo apt-get install compiz compizconfig-settings-manager compiz-plugins-extra
想要激活桌面Cube效果在Dash上查找ccsm打开CompizConfig Settings Manager找到General Options > Desktop Size并设置Horizontal Virtual Size的值为4Vertical Virtual Size的值为1。然后返回检查Desktop Cube框(禁用Desktop Wall)和Rotate Cube框(解决冲突 -> 禁止切换视图1)并Ctrl+Alt+鼠标左击来查看cube效果。
![Enable Compiz](http://www.tecmint.com/wp-content/uploads/2015/04/enable-compiz.jpg)
Enable Compiz
![Compiz Settings](http://www.tecmint.com/wp-content/uploads/2015/04/compiz-settings.jpg)
Compiz Settings
![Compiz Settings Addons](http://www.tecmint.com/wp-content/uploads/2015/04/compiz-settings-1.jpg)
Compiz Settings Addons
![Desktop Window Rotating](http://www.tecmint.com/wp-content/uploads/2015/04/desktop-cube.jpg)
Desktop Window Rotating
### 15. 添加额外浏览器支持 ###
Ubuntu 15.04默认浏览器是Mozilla Firefox。想要安装其它浏览器比如Google Chrome或Opera可以访问它们的官方网站下载所提供的.deb包并用Gdebi Package Installer在你的系统上安装它们。
![Enable Browser Support](http://www.tecmint.com/wp-content/uploads/2015/04/enable-browser-support.jpg)
Enable Browser Support
![Opera Browser Support](http://www.tecmint.com/wp-content/uploads/2015/04/opera.jpg)
Opera Browser Support
想要安装Chromium开源浏览器请在终端上输入以下命令
$ sudo apt-get install chromium-browser
### 16. 安装Tweak工具 ###
想要用额外的应用程序来自定义Ubuntu吗在终端上输入以下命令来安装Unity Tweak工具和Gnome Tweak工具
$ sudo apt-get install unity-tweak-tool gnome-tweak-tool
![Install Tweak Tool](http://www.tecmint.com/wp-content/uploads/2015/04/install-tweak-tool.jpg)
Install Tweak Tool
![Tweak Tool Settings](http://www.tecmint.com/wp-content/uploads/2015/04/tweak-settings.jpg)
Tweak Tool Settings
另一个有趣的tweak工具主要是Ubuntu Tweak包可以通过访问官方网站来获取并安装 [http://ubuntu-tweak.com/][2].
![Tweak Tool: System Information](http://www.tecmint.com/wp-content/uploads/2015/04/tweak-system-info.jpg)
Tweak Tool: System Information
在你安装好这一连串软件之后,你或许想要清理一下你的系统来释放一点硬盘上的空间,输入以下命令即可:
$ sudo apt-get -y autoremove
$ sudo apt-get -y autoclean
$ sudo apt-get -y clean
这只是tweaks工具中的其中一些和普通用户日常生活中可能会在Ubuntu 15.04桌面上安装使用的程序。想要了解更多高级的程序特性和功能请使用Ubuntu Software Center或查阅Ubuntu Wiki主页。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/things-to-do-after-installing-ubuntu-15-04-desktop/
作者:[Matei Cezar][a]
译者:[ZTinoZ](https://github.com/ZTinoZ)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/cezarmatei/
[1]:http://www.viber.com/en/products/linux
[2]:http://ubuntu-tweak.com/

View File

@ -1,45 +1,44 @@
How to Install and Configure PowerDNS (with MariaDB) and PowerAdmin in RHEL/CentOS 7
RHEL/CentOS 7中安装并配置PowerDNS与MariaDB搭配PowerAdmin
================================================================================
PowerDNS is a DNS server running on many Linux/Unix derivatives. It can be configured with different backends including BIND style zone files, relational databases or load balancing/failover algorithms. It can also be setup as a DNS recursor running as a separate process on the server.
PowerDNS是一个运行在许多Linux/Unix衍生版上的DNS服务器它可以使用不同的后端进行配置包括BIND类型的区域文件、相关的数据库或者负载均衡/失效转移算法。它也可以被配置成一台DNS递归器作为服务器上的一个独立进程运行。
The latest version of PowerDNS Authoritative server is 3.4.4, but the one available in the EPEL repository right now is 3.4.3. I would recommend installing the one for the EPEL repository due to the fact that this version is tested in CentOS and Fedora. That way you will also be able to easily update PowerDNS in future.
PowerDNS授权服务器的最新版本是3.4.4但是当前EPEL仓库中可以获得的版本是3.4.3。我推荐安装EPEL仓库中提供的那一个因为该版本已经在CentOS和Fedora中测试过。那样你也可以在今后很容易地更新PowerDNS。
This article intends to show you how to install and setup master PowerDNS server with a MariaDB backend and the PowerAdmin a friendly web interface managing tool for PowerDNS.
本文倾向于向你演示如何安装并配置以MariaDB作为后端的PowerDNS和
出于本文的写作目的,我将使用以下服务器:
For the purpose of this article I will be using server with:
主机名: centos7.localhost
IP地址 192.168.0.102
Hostname: centos7.localhost
IP Address 192.168.0.102
### 步骤 1 安装带有MariaDB后端的PowerDNS ###
### Step 1: Installing PowerDNS with MariaDB Backend ###
#### 1. First you need to enable the EPEL repository for your server simply use: ####
#### 1. 首先你需要为你的系统启用EPEL仓库只需使用 ####
# yum install epel-release.noarch
![Enable Epel Repository](http://www.tecmint.com/wp-content/uploads/2015/04/Enable-Epel-Repository.png)
Enable Epel Repository
启用Epel仓库
#### 2. The next step is to install the MariaDB server. This can be easily done by running the following command: ####
#### 2. 下一步是安装MariaDB服务器。运行以下命令即可达成 ####
# yum -y install mariadb-server mariadb
![Install MariaDB Server](http://www.tecmint.com/wp-content/uploads/2015/04/Install-MariaDB-Server.png)
Install MariaDB Server
安装MariaDB服务器
#### 3. Next we will configure MySQL to enable and start upon system boot: ####
#### 3. 接下来我们将配置并启用MySQL并设置开机启动 ####
# systemctl enable mariadb.service
# systemctl start mariadb.service
![Enable Start MariaDB System Boot](http://www.tecmint.com/wp-content/uploads/2015/04/Enable-Start-MariaDB-System-Boot.png)
Enable Start MariaDB System Boot
启用MariaDB开机启动
#### 4. Now that the MySQL service is running, we will secure and setup a password for MariaDB by running: ####
#### 4. 由于MySQL服务正在运行我们将为MariaDB设置密码进行安全加固运行以下命令 ####
# mysql_secure_installation
#### Follow Instructions ####
#### 按照指示做 ####
/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
@ -103,33 +102,33 @@ Enable Start MariaDB System Boot
Thanks for using MariaDB!
#### 5. Once MariaDB configuration done successfully, we can proceed further with the installation of PowerDNS. This is easily completed by running: ####
#### 5. MariaDB配置成功后我们可以继续去安装PowerDNS。运行以下命令即可轻易完成 ####
# yum -y install pdns pdns-backend-mysql
![Install PowerDNS with MariaDB Backend](http://www.tecmint.com/wp-content/uploads/2015/04/Install-PowerDNS-with-MariaDB-Backend.png)
Install PowerDNS with MariaDB Backend
安装带有MariaDB后端的PowerDNS
#### 6. The configuration file for PowerDNS is located in `/etc/pdns/pdns`, but before editing it, we will setup a MySQL database for PowerDNS service. First we will connect to the MySQL server and will create a database with name powerdns: ####
#### 6. PowerDNS的配置文件位于`/etc/pdns/pdns`在编辑之前我们将为PowerDNS服务配置一个MySQL数据库。首先我们将连接到MySQL服务器并创建一个名为powerdns的数据库 ####
# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE powerdns;
![Create PowerDNS Database](http://www.tecmint.com/wp-content/uploads/2015/04/Create-PowerDNS-Database.png)
Create PowerDNS Database
创建PowerDNS数据库
#### 7. Next, we will create a database user called powerdns: ####
#### 7. 接下来我们将创建一个名为powerdns的数据库用户 ####
MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'powerdns'@'localhost' IDENTIFIED BY tecmint123;
MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'powerdns'@'centos7.localdomain' IDENTIFIED BY 'tecmint123';
MariaDB [(none)]> FLUSH PRIVILEGES;
![Create PowerDNS User](http://www.tecmint.com/wp-content/uploads/2015/04/Create-PowerDNS-User.png)
Create PowerDNS User
创建PowerDNS用户
**Note**: Replace “tecmint123” with the actual password that you want to use for your setup.
**注意** 请将“tecmint123”替换为你想要设置的实际密码。
#### 8. We proceed by creating the database tables used by PowerDNS. Execute those block by block: ####
#### 8. 我们继续创建PowerDNS要使用的数据库表。像堆积木一样执行以下这些 ####
MariaDB [(none)]> USE powerdns;
MariaDB [(none)]> CREATE TABLE domains (
@ -144,7 +143,7 @@ Create PowerDNS User
);
![Create Table Domains for PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Table-Domains-for-PowerDNS.png)
Create Table Domains for PowerDNS
创建用于PowerDNS的表域
MariaDB [(none)]> CREATE UNIQUE INDEX name_index ON domains(name);
MariaDB [(none)]> CREATE TABLE records (
@ -160,14 +159,14 @@ Create Table Domains for PowerDNS
);
![Create Index Domains for PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Index-Domains-for-PowerDNS.png)
Create Index Domains for PowerDNS
创建用于PowerDNS的索引域
MariaDB [(none)]> CREATE INDEX rec_name_index ON records(name);
MariaDB [(none)]> CREATE INDEX nametype_index ON records(name,type);
MariaDB [(none)]> CREATE INDEX domain_id ON records(domain_id);
![Create Index Records](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Records.png)
Create Index Records
创建索引记录
MariaDB [(none)]> CREATE TABLE supermasters (
ip VARCHAR(25) NOT NULL,
@ -176,24 +175,24 @@ Create Index Records
);
![Create Table Supermaster](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Table-Supermaster.png)
Create Table Supermaster
创建表的超主
You can now exit the MySQL console by typing:
你现在可以输入以下命令退出MySQL控制台
MariaDB [(none)]> quit;
#### 9. Finally we can proceed with configuring our PowerDNS in a way that, it will use MySQL as backend. For that purpose open PowerDNS configuration file located at: ####
#### 9. 最后我们可以继续以MySQL作为后台的方式配置PowerDNS。请打开PowerDNS的配置文件 ####
# vim /etc/pdns/pdns.conf
In that file look for the lines looking like this:
在该文件中查找像下面这样的行:
#################################
# launch Which backends to launch and order to query them in
#
# launch=
Just after that put the following code:
在这后面放置以下代码:
launch=gmysql
gmysql-host=localhost
@ -201,101 +200,101 @@ Just after that put the following code:
gmysql-password=user-pass
gmysql-dbname=powerdns
Change “user-pass” with the actual password that you set earlier. Here is how my configuration looks like:
修改“user-pass”为你先前设置的实际密码配置如下
![Configure PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-PowerDNS.png)
Configure PowerDNS
配置PowerDNS
Save your change and exit from.
保存修改并退出。
#### 10. Now we will start and add PowerDNS to the list of services starting at system boot: ####
#### 10. 现在我们将启动并添加PowerDNS到系统开机启动列表 ####
# systemctl enable pdns.service
# systemctl start pdns.service
![Enable and Start PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Enable-and-Start-PowerDNS.png)
Enable and Start PowerDNS
启用并启动PowerDNS
At this point your PowerDNS server is up and running. For more information about PowerDNS you can refer to the manual available at [http://downloads.powerdns.com/documentation/html/index.html][1]
到这一步你的PowerDNS服务器已经起来并运行了。要获取更多关于PowerDNS的信息你可以参考手册[http://downloads.powerdns.com/documentation/html/index.html][1]
### Step 2: Installing PowerAdmin to Manage PowerDNS ###
### 步骤 2 安装PowerAdmin来管理PowerDNS ###
#### 11. Now we will install PowerAdmin a friendly web interface designed to manager PowerDNS servers. Since it is written in PHP, we will need to install PHP and a web server (Apache): ####
#### 11. 现在我们将安装PowerAdmin——一个友好的网页接口PowerDNS服务器管理器。由于它是用PHP写的我们将需要安装PHP和一台网络服务器Apache ####
# yum install httpd php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mhash gettext
![Install Apache PHP](http://www.tecmint.com/wp-content/uploads/2015/04/Install-Apache-PHP.jpeg)
Install Apache PHP
安装Apache PHP
PowerAdmin also requires two PEAR packages:
PowerAdmin也需要两个PEAR包
# yum -y install php-pear-DB php-pear-MDB2-Driver-mysql
![Install Pear](http://www.tecmint.com/wp-content/uploads/2015/04/Install-Pear.jpeg)
Install Pear
安装Pear
You can also refer to the following article for complete instructions how to install LAMP stack in CentOS 7:
你也可以参考一下文章了解CentOS 7中安装LAMP堆栈的完整指南
- [Install LAMP in CentOS 7][2]
- [CentOS 7中安装LAMP][2]
Once the install is complete, we will need to start and set Apache to start at system boot:
安装完成后我们将需要启动并设置Apache开机启动
# systemctl enable httpd.service
# systemctl start httpd.service
![Enable Start Apache System Boot](http://www.tecmint.com/wp-content/uploads/2015/04/Enable-Start-Apache-System-Boot.png)
Enable Start Apache System Boot
启用Apache开机启动
#### 12. Now that all system requirements for running PowerAdmn are met, we can proceed and download the package. Since the default web directory for Apache is /var/www/html/, we will download the package in there. ####
#### 12. 由于已经满足PowerAdmin的所有系统要求我们可以继续下载软件包。因为Apache默认的网页目录位于/var/www/html/,我们将下载软件包到这里。 ####
# cd /var/www/html/
# wget http://downloads.sourceforge.net/project/poweradmin/poweradmin-2.1.7.tgz
# tar xfv poweradmin-2.1.7.tgz
![Download PowerAdmin](http://www.tecmint.com/wp-content/uploads/2015/04/Download-PowerAdmin.jpeg)
Download PowerAdmin
下载PowerAdmin
#### 13. Now, we can now start the web installer of PowerAdmin. Simply open: ####
#### 13. 现在我们可以启动PowerAdmin的网页安装器了只需打开 ####
http://192.168.0.102/poweradmin-2.1.7/install/
This should bring the first step of the installation:
这会进入安装过程的第一步:
![Select Installation Language](http://www.tecmint.com/wp-content/uploads/2015/04/Select-Installation-Language.png)
Select Installation Language
选择安装语言
The above page will ask you to choose the language for your PowerAdmin. Select the one you wish to use and click the “Go to step 2” button.
上面的页面会要求你为PowerAdmin选择语言请选择你想要使用的那一个然后点击“进入步骤 2”按钮。
#### 14. The installer will expect you to have a PowerDNS database: ####
#### 14. 安装器需要PowerDNS数据库 ####
![PowerDNS Database](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Database.png)
PowerDNS Database
PowerDNS数据库
#### 15. Since we already created one, we can proceed to the next step. You will be asked to enter the database details you setup earlier. You will also need to setup Poweradmin administrator password: ####
#### 15. 因为我们已经创建了一个所以我们可以继续进入下一步。你会被要求提供先前配置的数据库详情你也需要为Poweradmin设置管理员密码 ####
![Enter PowerDNS Database Settings](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS.png)
Enter PowerDNS Database Settings
输入PowerDNS数据库配置
#### 16. Once you have input those, go to step 4. You will create a new user with a limited rights for Poweradmin. The fields that you need to enter here are: ####
#### 16. 输入这些信息后,进入步骤 4。你将创建为Poweradmin创建一个受限用户。这里你需要输入的字段是 ####
- Username - username for hte PowerAdmin.
- Password password for the above user.
- Hostmaster - When creating SOA records and you have not specified hostmaster, this value will be used.
- Secondary nameserver the value will be used as primary name server when creating new DNS zones.
- 用户名 - PowerAdmin用户名。
- 密码 上述用户的密码。
- 注册人 - 当创建SOA记录而你没有制定注册人时该值会被使用。
- 辅助域名服务器 该值在创建新的DNS区域时会被用于作为主域名服务器。
![PowerDNS Configuration Settings](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Configuration-Settings.png)
PowerDNS Configuration Settings
PowerDNS配置设置
#### 17. On the next step Poweradmin will ask you to create new database user with limited rights on the database tables. It will provide you with the code that you will need to put in a MySQL console: ####
#### 17. 在下一步中Poweradmin会要求你在数据库表中创建新的受限数据库用户它会提供你需要在MySQL控制台输入的代码 ####
![Create New Database User](http://www.tecmint.com/wp-content/uploads/2015/04/Create-New-Database-User.png)
Create New Database User
创建新的数据库用户
#### 18. Now open a terminal and run: ####
#### 18. 现在打开终端并运行: ####
# mysql -u root -p
Provide your password and execute the code provided by Poweradmin:
提供你的密码并执行由Poweradmin提供的代码
MariaDB [(none)]> GRANT SELECT, INSERT, UPDATE, DELETE
ON powerdns.*
@ -303,116 +302,116 @@ Provide your password and execute the code provided by Poweradmin:
IDENTIFIED BY '123qweasd';
![Grant Mysql Permissions to User](http://www.tecmint.com/wp-content/uploads/2015/04/Grant-Mysql-Permissions-to-User.png)
Grant Mysql Permissions to User
为用户授予Mysql权限
#### 19. Now go back to your browser and proceed to the next step. The installer will attempt to create its configuration file in /var/www/html/poweradmin-2.1.7/inc. ####
#### 19. 现在,回到浏览器中并继续下一步。安装器将尝试创建配置文件到/var/www/html/poweradmin-2.1.7/inc。 ####
The file name is config.inc.php. In case the script is not able to write that file you can create it manually by copying the text and putting it in above mentioned file:
文件名是config.inc.php。为防止该脚本没有写权限你可以手动复制这些内容到上述文件中
![Configuration Settings of PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Configuration.png)
Configuration Settings of PowerDNS
配置PowerDNS设置
#### 20. Now go to the last page where you will be informed that the installation is complete and will receive information how to access your Poweradmin install: ####
#### 20. 现在进入最后页面该页面会告知你安装已经完成以及如何访问安装好的Poweradmin ####
![PowerDNS Installation Completed](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Installation-Completed.png)
PowerDNS Installation Completed
PowerDNS安装完成
You can enable URLs used by other dynamic DNS providers by running:
你可以通过运行以下命令来启用其他动态DNS提供商的URL
# cp install/htaccess.dist .htaccess
For that purpose you will need to have mod_rewrite enabled in Apaches configuration.
出于该目的你将需要在Apache的配置中启用mod_rewrite。
#### 21. Now it is important to remove the “install” folder from Poweradmins root directory with the following command: ####
#### 21. 现在需要移除从Poweradmin的根目录中移除“install”文件夹这一点很重要。使用以下命令 ####
# rm -fr /var/www/html/poweradmin/install/
After that you can access your poweradmin at:
在此之后你可以通过以下方式访问PowerAdmin
http://192.168.0.102/poweradmin-2.1.7/
![PowerDNS Login](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Login.png)
PowerDNS Login
PowerDNS登录
After logging you should see the Poweradmin main page:
在登录后你应该会看到Poweradmin的主页
![PowerDNS Dashboard](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Dashboard.png)
PowerDNS Dashboard
PowerDNS仪表盘
At this point your installation is complete and you are now ready to start managing your DNS zones.
到这里安装已经完成了你也可以开始管理你的DNS区域了。
### Step 3: How to Add, Edit and Delete DNS Zones in PowerDNS ###
### 步骤 3 PowerDNS中添加、编辑和删除DNS区域 ###
#### 22. To add new master zone, simply click on the “Add master zone”: ####
#### 22. 要添加新的主区域,只需点击“添加主区域”: ####
![Add Master Zone](http://www.tecmint.com/wp-content/uploads/2015/04/Add-Master-Zone.png)
Add Master Zone
添加主区域
On the next page there are few things that you need to fill:
在下一页中,你需要填写一些东西:
- Domain domain for which you will be adding the zone.
- Owner sets the owner of the DNS zone.
- Template DNS template leave to none.
- DNSSEC Donany Name System Security Extensions (optional -check if you need it).
- 你要添加区域的域。
- 所有者 设置DNS区域的所有者。
- 模板 DNS模板 留空。
- DNSSEC Donany名称系统安全扩展(可选——检查你是否需要)。
Click the “Add zone” button to add the DNS zone.
点击“添加区域”按钮来添加DNS区域。
![Master DNS Zone](http://www.tecmint.com/wp-content/uploads/2015/04/Master-DNS-Zone.png)
Master DNS Zone
主DNS区域
Now you can go back to the index page of Poweradmin by clicking the “Index” link. To review all existing DNS zones simply go to “List zones”:
现在你可以点击“首页”链接回到Poweradmin的首页。要查看所有现存的DNS区域只需转到“列出区域”
![Check List of Zones](http://www.tecmint.com/wp-content/uploads/2015/04/Check-List-Zones.png)
Check List of Zones
检查区域列表
You should now see a list of available DNS zones:
你现在应该看到一个可用DNS区域列表
![Check List of DNS Zones](http://www.tecmint.com/wp-content/uploads/2015/04/DNS-Zones.png)
Check List of DNS Zones
检查DNS区域列表
#### 23. To edit an existing DNS zone or add new records click the edit icon: ####
#### 23. 要编辑现存DNS区域或者添加新的记录点击编辑图标 ####
![Edit DNS Zone](http://www.tecmint.com/wp-content/uploads/2015/04/Edit-DNS-Zone.png)
Edit DNS Zone
编辑DNS区域
On the next page you will see the entries for the DNS zone you have chosen:
在接下来的页面你会看到你选择的DNS区域的条目
![Domain DNS Zone Entries](http://www.tecmint.com/wp-content/uploads/2015/04/Domain-DNS.png)
Domain DNS Zone Entries
主DNS区域条目
#### 24. In here to add new DNS zone you will need to set the following information: ####
#### 24. 在此处添加新的DNS区域你需要设置以下信息 ####
- Name name for the entry. Only add the first part of the domain/subdomain, the rest will be added by Poweradmin.
- Type choose the record type.
- Priority priority of the record.
- TTL Time To Live in seconds.
- 名称 条目名称。只需添加域/子域的第一部分Poweradmin会添加剩下的。
- 类型 选择记录类型。
- 优先级 记录优先级。
- TTL 存活时间,以秒计算。
For the purpose of this article, I will add an A record for subdomain new.example.com that will resolve on IP address 192.168.0.102 with time to live 14400 seconds:
出于本文目的我将为子域new.example.com添加一个A记录用于解析IP地址192.168.0.102设置存活时间为14400秒
![Add New DNS Record](http://www.tecmint.com/wp-content/uploads/2015/04/Add-New-DNS-Record.png)
Add New DNS Record
添加新DNS记录
Finally click the “Add record” button.
最后,点击“添加记录”按钮。
#### 25. If you wish to delete a DNS zone you can go back to the “List zone” page and click on the “Trash” icon next to the DNS zone which you wish to delete: ####
#### 25. 如果你想要删除DNS区域你可以回到“列出区域”页面然后点击你想要删除的DNS区域旁边“垃圾桶”图标 ####
![Delete DNS Zone](http://www.tecmint.com/wp-content/uploads/2015/04/Delete-DNS-Zone.png)
Delete DNS Zone
删除DNS区域
Poweradmin will ask you if you are sure you want to delete the DNS zone. Simply click “Yes” to finish the deletion.
Poweradmin将问你是否确定想要删除DNS区域。只需点击“是”来完成删除。
For more detailed instructions how to create, edit and delete zones you can refer to Poweradmins documentation at:
如要获取更多关于怎样创建、编辑和删除区域的说明你可以参与Poweradmin的文档
[https://github.com/poweradmin/poweradmin/wiki/Documentation][3]
I hope you have find this article interesting and useful. As always if you have any questions or comments please do not hesitate to submit them in the comment section below.
我希望你已经发现本文很有趣,也很有用。一如既往,如果你有问题或要发表评论,请别犹豫,在下面评论区提交你的评论吧。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/install-powerdns-poweradmin-mariadb-in-centos-rhel/
作者:[Marin Todorov][a]
译者:[译者ID](https://github.com/译者ID)
译者:[GOLinux](https://github.com/GOLinux)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
@ -420,4 +419,4 @@ via: http://www.tecmint.com/install-powerdns-poweradmin-mariadb-in-centos-rhel/
[a]:http://www.tecmint.com/author/marintodorov89/
[1]:http://downloads.powerdns.com/documentation/html/index.html
[2]:http://www.tecmint.com/install-lamp-in-centos-7/
[3]:https://github.com/poweradmin/poweradmin/wiki/Documentation
[3]:https://github.com/poweradmin/poweradmin/wiki/Documentation

View File

@ -0,0 +1,193 @@
10个!符号在Linux命令行下惊人和奇妙的用法
================================================================================
`'!'`符号在Linux中不但可以用作否定符号还可以用来从历史命令记录中取出命令或不加修改的执行之前运行的命令。下面的所有命令都已经在Bash Shell中经过确切地检查。尽管我没有试过但大多都不能在别的Shell中运行。这里我们介绍下Linux命令行中符号`'!'`那惊人和奇妙的用法。
### 1. 使用数字从历史命令列表中找一条命令来执行 ###
您也许没有意识到您可以从历史命令列表(之前已经执行的命令集)中找出一条来运行。首先,通过"history"命令查找之前命令的序号。
$ history
![使用history命令找到最后执行的命令](http://www.tecmint.com/wp-content/uploads/2015/05/history-Command.gif)
现在,只需要使用历史命令输出中显示在该命令前面的数字便可以运行这个命令。例如,运行一个在`history`输出中编号是1551的命令。
$ !1551
![使用命令ID来执行最后运行的命令](http://www.tecmint.com/wp-content/uploads/2015/05/Run-Commands-By-number.gif)
这样编号为1551的命令上面的例子是[top命令][1]便运行了。这种通过ID号来执行之前的命令的方式很有用尤其是在这些命令都很长的情况下。您只需要使用**![history命令输出的序号]**便可以调用它。
### 2. 运行之前的倒数第二个、第七个命令等 ###
您可以以另一种方式来运行之前执行的命令,通过使用-1代表最后的命令-2代表倒数第二个命令-7代表倒数第七个命令等。
首先使用history命令来获得执行过的命令的列表。history命令的执行很有必要因为您可以通过它来确保没有`rm command > file`或其他会导致危险的命令。接下来执行倒数第六个、第八个、第十个命令。
$ history
$ !-6
$ !-8
$ !-10
![通过负数序号运行之前执行的命令](http://www.tecmint.com/wp-content/uploads/2015/05/3.gif)
通过负数序号运行之前执行的命令
### 3. 向最后的命令传递参数,以方便的运行新的命令 ###
我需要显示`/home/$USER/Binary/firefox`文件夹的内容,因此我执行:
$ ls /home/$USER/Binary/firefox
接下来,我意识到我应该执行'ls -l'来查看哪个文件是可执行文件。因此我应该重新输入整个命令么?不,我不需要。我仅需要在新的命令中带上最后的参数,类似:
$ ls -l !$
这里`!$`将把最后执行的命令的参数传递到这个新的命令中。
![将上一个命令的参数传递给新命令](http://www.tecmint.com/wp-content/uploads/2015/05/4.gif)
将上一个命令的参数传递给新命令
### 4. 如何使用!来处理两个或更多的参数 ###
比如说我在桌面创建了一个文本文件file1.txt。
$ touch /home/avi/Desktop/1.txt
然后在cp命令中使用绝对路径将它拷贝到`/home/avi/Downloads`。
$ cp /home/avi/Desktop/1.txt /home/avi/downloads
现在我们给cp命令传递了两个参数。第一个是`/home/avi/Desktop/1.txt`,第二个是`/home/avi/Downloads`。让我们分别处理他们,使用`echo [arguments]`来打印两个不同的参数。
$ echo "1st Argument is : !^"
$ echo "2nd Argument is : !cp:2"
注意第一个参数可以使用`"!^"`进行打印,其余的命令可以通过`"![命令名]:[参数编号]"`打印。
在上面的例子中,第一个命令是`cp`,第二个参数也需要被打印。因此是`"!cp:2"`如果任何命令比如xyz运行时有5个参数而您需要获得第四个参数您可以使用`"!xyz:4"`。所有的参数都可以通过`"!*"`来获得。
![处理两个或更多的参数](http://www.tecmint.com/wp-content/uploads/2015/05/5.gif)
处理两个或更多的参数
### 5. 以关键字为基础执行上个的命令 ###
我们可以以关键字为基础执行上次执行的命令。可以从下面的例子中理解:
$ ls /home > /dev/null [命令1]
$ ls -l /home/avi/Desktop > /dev/null [命令2]
$ ls -la /home/avi/Downloads > /dev/null [命令3]
$ ls -lA /usr/bin > /dev/null [命令4]
上面我们使用了同样的命令ls但有不同的开关和不同的操作文件夹。而且我们还将输出传递到`/dev/null`,我们并未处理输出,因而终端依旧很干净。
现在以关键字为基础执行上个的命令。
$ ! ls [命令1]
$ ! ls -l [命令2]
$ ! ls -la [命令3]
$ ! ls -lA [命令4]
检查输出,您将惊奇发现您仅仅使用关键字`ls`便执行了您已经执行过的命令。
![以关键字为基础执行命令](http://www.tecmint.com/wp-content/uploads/2015/05/6.gif)
以关键字为基础执行命令
### 6. !!操作符的威力 ###
您可以使用`(!!)`运行/修改您上个运行的命令。它将附带一些修改/调整并调用上个命令。让我给您展示一些实际情境。
昨天我运行了一行脚本来获得我的私密IP因此我执行了
$ ip addr show | grep inet | grep -v 'inet6'| grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d/
接着我突然发现我需要将上面脚本的输出重定向到一个ip.txt的文件因此我改怎么办呢我改重新输入整个命令并重定向到一个文件么一个简单的解决方案是使用向上导航键并添加`'> ip.txt'`来将输出重定向到文件。
$ ip addr show | grep inet | grep -v 'inet6'| grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d/ > ip.txt
在这里感谢救世主"向上导航键"。现在,考虑下面的情况,这次我运行了下面这一行脚本。
$ ifconfig | grep "inet addr:" | awk '{print $2}' | grep -v '127.0.0.1' | cut -f2 -d:
一旦我运行了这个脚本Bash提示符便返回了错误消息`"bash: ifconfig: command not found"`。原因并不难猜我运行了本应以root权限的运行的命令。
所以怎么解决呢我们很难以root用户登录并且再次键入整个命令而且向上导航键也不管用了。因此我们需要调用`"!!"`(去掉引号),它将为那个用户调用上个命令。
$ su -c "!!" root
这里su是用来切换到root用户的`-c`用来以某用户运行特定的命令,最重要的部分是`!!`它将被替换为上次运行的命令。对的您需要提供root密码。
![!!操作符的威力](http://www.tecmint.com/wp-content/uploads/2015/05/7.gif)
!!操作符的威力
我通常在下面的情景中使用`!!`。
1.当我用普通用户来运行apt-get我通常收到提示说我没有权限来执行。
$ apt-get upgrade && apt-get dist-upgrade
好吧,有错误。但别担心,使用下面的命令来成功的执行...
$ su -c !!
同样的适用于:
$ service apache2 start
$ /etc/init.d/apache2 start
$ systemctl start apache2
普通用户不被授权执行那些任务,所以我运行:
$ su -c 'service apache2 start'
$ su -c '/etc/init.d/apache2 start'
$ su -c 'systemctl start apache2'
### 7.运行一个影响所有除了![FILE_NAME]的文件命令 ###
`!`(逻辑非)能用来对除了`'!'`后的文件的所有的文件/扩展执行命令。
A.从文件夹移除所有文件2.txt除外。
$ rm !(2.txt)
B.从文件夹移除所有的文件类型pdf类型除外。
$ rm !(*.pdf)
### 8.检查某个文件夹(比如/home/avi/Tecmint是否存在并打印 ###
这里,我们使用`'! -d'`来验证文件夹是否存在当文件夹不存在时将使用其后跟随AND操作符`(&&)`进行打印当文件夹存在时将使用OR操作符`(||)`进行打印。
逻辑上,当`[ ! -d /home/avi/Tecmint ]`的输出为0时它将执行AND逻辑符后面的内容否则它将执行OR逻辑符`(||)`后面的内容。
$ [ ! -d /home/avi/Tecmint ] && printf '\nno such /home/avi/Tecmint directory exist\n' || printf '\n/home/avi/Tecmint directory exist\n'
### 9.检查某文件夹是否存在?如果不存在则退出该命令 ###
类似于上面的情况,但这里当期望的文件夹不存在时,该命令会退出。
$ [ ! -d /home/avi/Tecmint ] && exit
### 10.如果您的home文件夹内不存在一个文件夹比方说test则创建它 ###
这是脚本语言中的一个常用的实现,当期望的文件夹不存在时,创建一个。
[ ! -d /home/avi/Tecmint ] && mkdir /home/avi/Tecmint
这便是全部了。如果您知道或偶尔遇到其他值得了解的`'!'`使用方法,请您在反馈的地方给我们提建议。保持联系!
--------------------------------------------------------------------------------
via: http://www.tecmint.com/mysterious-uses-of-symbol-or-operator-in-linux-commands/
作者:[Avishek Kumar][a]
译者:[wwy-hust](https://github.com/wwy-hust)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/avishek/
[1]:http://www.tecmint.com/12-top-command-examples-in-linux/

View File

@ -0,0 +1,45 @@
Linux有问必答——在旧的Ubuntu上如何修复“apt-get update”的“404 Not Found”错误
================================================================================
> **问题** 我的PC上安装了旧版的Ubuntu 13.04急切的浣熊。当我在上面运行“sudo apt-get update”时它丢给了我一大堆“404 Not Found”错误结果是我不能使用apt-get或aptitude来安装或更新任何软件包了。由于该错误的原因我甚至不能将它升级到更新的版本。我怎样才能修复这个问题啊
>
![](https://farm6.staticflickr.com/5460/17634085636_996b2a8ab5_b.jpg)
每个Ubuntu版本都有生命结束周期EOL时间常规的Ubuntu发行版提供18个月的支持而LTS长期支持版本则长达3年服务器版本和5年桌面版本。当某个Ubuntu版本达到生命结束周期时其仓库就不能再访问了你也不能再从Canonical获取任何维护更新和安全补丁。在撰写本文时Ubuntu 13.04(急切的浣熊)已经达到了它的生命结束周期。
如果你所使用的Ubuntu系统已经被结束生命周期你就会从apt-get或aptitude得到以下404错误因为它的仓库已经被遗弃了。
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-backports/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/raring/main/binary-amd64/Packages 404 Not Found
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/universe/binary-i386/Packages 404 Not Found [IP: 91.189.88.149 80]
E: Some index files failed to download. They have been ignored, or old ones used instead
对于那些还在使用旧版本Ubuntu的用户Canonical维护了一个old-releases.ubuntu.com的网站这里包含了结束生命周期的仓库归档。因此当Canonical对你安装的Ubuntu版本结束支持时你需要将仓库切换到old-releases.ubuntu.com除非你在结束生命周期之前想要升级
这里通过切换到旧版本仓库提供了一个快速修复“404 Not Found”错误的便捷方式。
首先使用旧版本仓库替换main/security仓库就像下面这样。
$ sudo sed -i -r 's/([a-z]{2}\.)?archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
$ sudo sed -i -r 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
然后,使用文本编辑器打开/etc/apt/sources.list并查找extras.ubuntu.com。该仓库也不再支持Ubuntu 13.04了,所以你需要使用“#”号将extras.ubuntu.com注释掉。
#deb http://extras.ubuntu.com/ubuntu raring main
#deb-src http://extras.ubuntu.com/ubuntu raring main
现在你应该可以在旧版不受支持的Ubuntu上安装或更新软件包了。
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/404-not-found-error-apt-get-update-ubuntu.html
作者:[Dan Nanni][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni

View File

@ -1,18 +1,18 @@
Linux FAQs with Answers--How to fix “Encountered a section with no Package: header” error on Raspbian
Linux 有问必答--如何修复 Raspbian 上的 “Encountered a section with no Package: header” 错误
================================================================================
> **Question**: I installed fresh Rasbian on Raspberry Pi. But when I tried to update APT package index by running sudo apt-get update, it throws the following error:
> **问题**: 我在 Raspberry Pi 上安装新版的 Rasbian。但当我使用 sudo apt-get update 命令更新 APT 软件包索引的时候,它抛出下面的错误:
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/dpkg/status
E: The package lists or status file could not be parsed or opened.
> I then cannot install any package on Raspbian. How can I solve this error?
> 之后我不能在 Raspbian 上安装任何软件包。我怎样才能解决这个错误?
![](https://farm8.staticflickr.com/7704/17445484636_05ba81722f_c.jpg)
The error saying "Problem with MergeList /var/lib/dpkg/status" indicates that the status file got corrupted for some reason, and so cannot be parsed. This status file contains information about installed deb packages, and thus needs to be carefully backed up.
错误说 "Problem with MergeList /var/lib/dpkg/status" 表示由于某些原因状态文件损坏了,因此无法解释。这个状态文件包括了已经安装的 deb 软件包的信息,因此需要小心备份。
In this case, since this is freshly installed Raspbian, you can safely remove the status file, and re-generate it as follows.
在这种情况下,由于这是新安装的 Raspbian你可以安全地删除状态文件然后用下面的命令重新生成。
$ sudo rm /var/lib/dpkg/status
$ sudo touch /var/lib/dpkg/status
@ -23,7 +23,7 @@ In this case, since this is freshly installed Raspbian, you can safely remove th
via: http://ask.xmodulo.com/encountered-section-with-no-package-header-error.html
作者:[Dan Nanni][a]
译者:[译者ID](https://github.com/译者ID)
译者:[ictlyh](https://github.com/ictlyh)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,57 @@
Linux有问必答——Linux上如何查看某个进程的线程
================================================================================
> **问题** 我的程序创建并在它里头执行了多个线程我怎样才能在该程序创建线程后监控其中单个线程我想要看到带有它们名称的单个线程详细情况CPU/内存使用率)。
线程是现代操作系统上进行并行执行的一个流行的编程方面的抽象概念。当一个程序内有多个线程被叉分出用以执行多个流时这些线程就会在它们之间共享特定的资源内存地址空间、打开的文件以使叉分开销最小化并避免大量花销IPC进程间通信频道。这些功能让线程在并发执行时成为一个高效的机制。
在Linux中程序中创建的线程也称为轻量级进程LWP会具有和程序的PID相同的“线程组ID”。然后各个线程会获得其自身的线程IDTID。对于Linux内核调度器而言线程不过是恰好共享特定资源的标准的进程。经典的命令行工具如ps或top都可以用来显示线程级别的信息默认情况下它们会显示进程级别的信息。
这里提供了**在Linux上显示某个进程的线程**的几种方式。
### 方法一PS ###
在ps命令中“-T”选项可以开启线程查看。下面的命令列出了由进程号为<pid>的进程创建的所有线程。
$ ps -T -p <pid>
![](https://farm8.staticflickr.com/7749/17350561110_94cacfc456_c.jpg)
“SID”栏表示线程ID而“CMD”栏则显示了线程名称。
### 方法二: Top ###
top命令可以实时显示各个线程情况。要在top输出中开启线程查看请调用top命令的“-H”选项该选项会列出所有Linux线程。在top运行时你也可以通过按“H”键将线程查看模式切换为开或关。
$ top -H
![](https://farm9.staticflickr.com/8824/17350561070_3dfe447974_c.jpg)
要让top输出某个特定进程<pid>并检查该进程内运行的线程状况:
$ top -H -p <pid>
![](https://farm8.staticflickr.com/7797/17538002751_c8a3d574d8_c.jpg)
### 方法三: Htop ###
一个对用户更加友好的方式是通过htop查看单个进程的线程它是一个基于ncurses的交互进程查看器。该程序允许你在树状视图中监控单个独立线程。
要在htop中启用线程查看请开启htop然后按<F2>来进入htop的设置菜单。选择“设置”栏下面的“显示选项”然后开启“树状视图”和“显示自定义线程名”选项。按<F10>退出设置。
![](https://farm6.staticflickr.com/5338/17350364568_59bce22e7b_b.jpg)
现在,你就会看到下面这样单个进程的线程视图。
![](https://farm9.staticflickr.com/8885/17350560930_98952d5350_c.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/view-threads-process-linux.html
作者:[Dan Nanni][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni

View File

@ -0,0 +1,81 @@
Linux有问必答——Linux上Apache错误日志的位置在哪里
================================================================================
> **问题** 我尝试着解决我 Linux 系统上的 Apache 网络服务器的错误Apache的错误日志文件放在[你的 Linux 版本]的哪个位置呢?
错误日志和访问日志文件为系统管理员提供了有用的信息,比如,为网络服务器排障,[保护][1]系统不受各种各样的恶意活动侵犯,或者只是进行[各种各样的][2][分析][3]以监控 HTTP 服务器。根据你网络服务器配置的不同,其错误/访问日志可能放在你系统中不同位置。
本文可以帮助你**找到Linux上的Apache错误日志**。
![](https://farm8.staticflickr.com/7664/16958522954_4852ab5ea5_c.jpg)
### DebianUbuntu或Linux Mint上的Apache错误日志位置 ###
#### 默认的错误日志 ####
在基于Debian的Linux上系统范围的Apache错误日志默认位置是**/var/log/apache2/error.log**。默认位置可以通过编辑Apache的配置文件进行修改。
#### 自定义的错误日志 ####
要找到自定义的错误日志位置,请用文本编辑器打开 /etc/apache2/apache2.conf然后查找以 ErrorLog 开头的行,该行指定了自定义的 Apache 错误日志文件的位置。例如,在未经修改的 Apache 配置文件中可以找到以下行:
ErrorLog ${APACHE_LOG_DIR}/error.log
在本例中,该位置使用 APACHE_LOG_DIR 环境变量进行配置,该变量在 /etc/apache2/envvars 中已被定义。
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
在实际情况中, ErrorLog 可能会指向你 Linux 系统中任意路径。
#### 使用虚拟主机自定义的错误日志 ####
如果在 Apache 网络服务器中使用了虚拟主机, ErrorLog 指令可能会在虚拟主机容器内指定,在这种情况下,上面所说的系统范围的错误日志位置将被忽略。
启用了虚拟主机后,各个虚拟主机可以定义其自身的自定义错误日志位置。要找出某个特定虚拟主机的错误日志位置,你可以打开 /etc/apache2/sites-enabled/<your-site>.conf然后查找 ErrorLog 指令,该指令会显示站点指定的错误日志文件。
### CentOSFedora或RHEL上的Apache错误日志位置 ###
#### 默认的错误日志 ####
在基于 Red Hat 的Linux中系统范围的 Apache 错误日志文件默认被放置在**/var/log/httpd/error_log**。该默认位置可以通过修改 Apache 配置文件进行自定义。
#### 自定义的错误日志 ####
要找出 Apache 错误日志的自定义位置,请用文本编辑器打开 /etc/httpd/conf/httpd.conf然后查找 ServerRoot该参数显示了 Apache 服务器目录树的顶层,日志文件和配置都位于该目录树中。例如:
ServerRoot "/etc/httpd"
现在,查找 ErrorLog 开头的行,该行指出了 Apache 网络服务器将错误日志写到了哪里去。注意,指定的位置是 ServerRoot 值的相对位置。例如:
ErrorLog "log/error_log"
结合上面的两个指令,可以获得完整的错误日志路径,默认情况下该路径就是 /etc/httpd/logs/error_log。在全新安装的Apache中这是一个到 /var/log/httpd/error_log 的符号链接。
在实际情况中, ErrorLog 可能指向你 Linux 系统中的任意位置。
#### 使用虚拟主机自定义的错误日志 ####
如果你启用了虚拟主机,你可以通过检查 /etc/httpd/conf/httpd.conf或其它任何定义了虚拟主机的文件来找到各个虚拟主机的错误日志位置。在独立的虚拟主机部分查找 ErrorLog。如在下面的虚拟主机部分错误日志的位置是 /var/www/xmodulo.com/logs/error_log。
<VirtualHost *:80>
ServerAdmin webmaster@xmodulo.com
DocumentRoot /var/www/xmodulo.com/public_html
ServerName www.xmodulo.com
ServerAlias xmodulo.com
ErrorLog /var/www/xmodulo.com/logs/error_log
CustomLog /var/www/xmodulo.com/logs/access_log
<VirtualHost>
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/apache-error-log-location-linux.html
作者:[Dan Nanni][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni
[1]:http://xmodulo.com/configure-fail2ban-apache-http-server.html
[2]:http://xmodulo.com/interactive-apache-web-server-log-analyzer-linux.html
[3]:http://xmodulo.com/sql-queries-apache-log-files-linux.html

View File

@ -0,0 +1,148 @@
如何在云服务提供商的机器使用Docker Machine
================================================================================
大家好今天我们来学习如何使用Docker Machine在各种云服务提供商的平台部署Docker。Docker Machine是一个可以帮助我们在自己的电脑、云服务提供商的机器以及我们数据中心的机器上创建Docker机器的应用程序。它为创建服务器、在服务器中安装Docker、根据用户需求配置Docker客户端提供了简单的解决方案。驱动API对本地机器、数据中心的虚拟机或者公用云机器都适用。Docker Machine支持Windows、OSX和Linux并且提供一个独立的二进制文件可以直接使用。它让我们可以充分利用支持Docker的基础设施的生态环境合作伙伴并且使用相同的接口进行访问。它让人们可以使用一个命令来简单而迅速地在不同的云平台部署Docker容器。
### 1. 安装Docker Machine ###
Docker Machine可以很好地支持每一种Linux发行版。首先我们需要从Github网站下载最新版本的。这里我们使用curl来下载目前最新0.2.0版本的Docker Machine。
在64位操作系统运行
# curl -L https://github.com/docker/machine/releases/download/v0.2.0/docker-machine_linux-amd64 > /usr/local/bin/docker-machine
在32位操作系统运行
# curl -L https://github.com/docker/machine/releases/download/v0.2.0/docker-machine_linux-i386 > /usr/local/bin/docker-machine
下载最新版本的Docker Machine并将docker-machine文件放到了/usr/local/bin/后,添加执行权限:
# chmod +x /usr/local/bin/docker-machine
完成如上操作后我们需要确认已经成功安装docker-machine了。可以运行如下命令检查它会输出系统中docker-machine的版本
# docker-machine -v
![Installing Docker Machine](http://blog.linoxide.com/wp-content/uploads/2015/05/installing-docker-machine.png)
另外机器上需要有docker命令可以使用如下命令安装
# curl -L https://get.docker.com/builds/linux/x86_64/docker-latest > /usr/local/bin/docker
# chmod +x /usr/local/bin/docker
### 2. 创建机器 ###
在自己的Linux机器上安装好了Docker Machine之后我们想要将一个docker虚拟机部署到云服务器上。Docker Machine支持几个流行的云平台如igital Ocean、Amazon Web ServicesAWS、Microsoft Azure、Google Cloud Computing等等所以我们可以在不同的平台使用相同的接口来部署Docker。本文中我们会使用digitalocean驱动在Digital Ocean的服务器上部署Docker--driver选项指定digitalocean驱动--digitalocean-access-token选项指定[Digital Ocean Control Panel][1]提供的API Token命令最后的是我们创建的Docker虚拟机的机器名。运行如下命令
# docker-machine create --driver digitalocean --digitalocean-access-token <API-Token> linux-dev
# eval "$(docker-machine env linux-dev)"
![Docker Machine Digitalocean Cloud](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-digitalocean-cloud.png)
**注意**: 这里linux-dev是我们将要创建的机器的名称。`<API-Token>`是一个安全key可以在Digtal Ocean Control Panel生成。要找到这个key我们只需要登录到我们的Digital Ocean Control Panel然后点击API再点击Generate New Token填写一个名称选上Read和Write。然后我们就会得到一串十六进制的key那就是`<API-Token>`,简单地替换到上边的命令中即可。
运行如上命令后我们可以在Digital Ocean Droplet Panel中看到一个具有默认配置的droplet已经被创建出来了。
![DigitalOcean Droplet Panel](http://blog.linoxide.com/wp-content/uploads/2015/05/digitalocean-droplet-panel.png)
简便起见docker-machine会使用默认配置来部署Droplet。我们可以通过增加选项来定制我们的Droplet。这里是一些digitalocean相关的选项我们可以使用它们来覆盖Docker Machine所使用的默认配置。
--digitalocean-image "ubuntu-14-04-x64" 是选择Droplet的镜像
--digitalocean-ipv6 enable 是启用IPv6网络支持
--digitalocean-private-networking enable 是启用专用网络
--digitalocean-region "nyc3" 是选择部署Droplet的区域
--digitalocean-size "512mb" 是选择内存大小和部署的类型
如果你想在其他云服务使用docker-machine并且想覆盖默认的配置可以运行如下命令来获取Docker Mackine默认支持的对每种平台适用的参数。
# docker-machine create -h
### 3. 选择活跃机器 ###
部署Droplet后我们想马上运行一个Docker容器但在那之前我们需要检查下活跃机器是否是我们需要的机器。可以运行如下命令查看。
# docker-machine ls
![Docker Machine List](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-ls.png)
ACTIVE一列有“*”标记的是活跃机器。
现在,如果我们想将活跃机器切换到需要的机器,运行如下命令:
# docker-machine active linux-dev
**注意**这里linux-dev是机器名我们打算激活这个机器并且在其中运行Docker容器。
### 4. 运行一个Docker容器 ###
现在我们已经选择了活跃机器就可以运行Docker容器了。可以测试一下运行一个busybox容器来执行`echo hello word`命令,这样就可以得到输出:
# docker run busybox echo hello world
注意如果你试图在一个装有32位操作系统的宿主机部署Docker容器使用SSH来运行docker是个好办法。这样你就可以简单跳过这一步直接进入下一步。
### 5. SSH到Docker机器中 ###
如果我们想在机器或者Droplet上控制之前部署的Docker机器可以使用docker-machine ssh命令来SSH到机器上
# docker-machine ssh
![Docker Machine SSH](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-ssh.png)
SSH到机器上之后我们可以在上边运行任何Docker容器。这里我们运行一个nginx
# docker run -itd -p 80:80 nginx
操作完毕后我们需要运行exit命令来退出Droplet或者服务器。
# exit
### 5. 删除机器 ###
删除在运行的机器以及它的所有镜像和容器我们可以使用docker-machine rm命令
# docker-machine rm linux-dev
![Docker Machine Remove All](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-remove-machine.png)
使用docker-machine ls命令检查是否成功删除了
# docker-machine ls
![Docker Machine Remove Check](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-remove-check.png)
### 6. 在不使用驱动的情况新增一个机器 ###
我们可以在不使用驱动的情况往Docker增加一台机器只需要一个URL。它可以使用一个已有机器的别名所以我们就不需要每次在运行docker命令时输入完整的URL了。
$ docker-machine create --url=tcp://104.131.50.36:2376 custombox
### 7. 管理机器 ###
如果你已经让Docker运行起来了可以使用简单的**docker-machine stop**命令来停止所有正在运行的机器,如果需要再启动的话可以运行**docker-machine start**
# docker-machine stop
# docker-machine start
你也可以使用如下命令来使用机器名作为参数来将其停止或启动:
$ docker-machine stop linux-dev
$ docker-machine start linux-dev
### 总结 ###
Docker Machine是一个非常棒的工具可以使用Docker容器快速地部署服务。文中我们使用Digital Ocean Platform作演示但Docker Machine还支持其他平台如Amazon Web Service、Google Cloud Computing。使用Docker Machine快速、安全地在几种不同平台部署Docker容器变得很简单了。因为Docker Machine还是Beta版本不建议在生产环境使用。如果你有任何问题、建议、反馈请在下方的评论框中写下来我们会改进或者更新我们的内容。谢谢享受吧 :-)
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-how-to/use-docker-machine-cloud-provider/
作者:[Arun Pyasi][a]
译者:[goreliu](https://github.com/goreliu)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/arunp/
[1]:https://cloud.digitalocean.com/settings/applications

View File

@ -0,0 +1,64 @@
如何在RHEL/CentOS 7.0中使用tmpfs
================================================================================
7中的tmpfs这是一个将所有文件和文件夹写到虚拟内存中而不是实际写到磁盘中的虚拟文件系统。这意味中tmpfs中所有的内容都是临时的在取消挂载、系统重启或者电源切断后内容都将会丢失。技术的角度上来说tmpfs将搜有的内容放在内核内部缓存中并且会增大或者缩小来容纳文件并可从交换空间中交换处不需要的页。
CentOS默认使用tmpfs做的事可用df -h命令的输出来看
# df h
![df](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs1.jpg)
/dev - 含有针对所有设备的设备文件的目录
/dev/shm 包含共享内存分配
/run - 用于系统日志
/sys/fs/cgroup - 用于cgrpups 一个针对特定进程限制、管制和审计资源利用的内核特性
/tmp目录 你可以用下面的两种方法来做到:
### 使用systemctl来在/tmp中启用tmpfs ###
你可以使用systemctl命令在tmp目录启用tmpfs 首先用下面的命令来检查这个特性是否可用:
# systemctl is-enabled tmp.mount
这会显示当先的状态,你可以使用下面的命令来启用它:
# systemctl enable tmp.mount
![systemctl](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs3.jpg)
这会控制/tmp目录并挂载tmpfs。
### 手动挂载/tmp/文件系统 ###
你可以在/etc/fstab中添加下面这行在/tmp挂载tmpfs。
tmpfs /tmp tmpfs size=512m 0 0
接着运行这条命令
# mount a
![df](http://blog.linoxide.com/wp-content/uploads/2015/05/tmpfs2.jpg)
这应该就会在df -h中显示tmpfs了同样也会在你下次重启是会自动挂载。
### 立即创建tmpfs ###
如果由于一些原因你写昂立即创建tmpfs你可以使用下面的命令
# mount -t tmpfs -o size=1G tmpfs /mnt/mytmpfs
当然你可以在size选项中指定你希望的大小和希望的挂载点只要记住是有效的目录就行了。
--------------------------------------------------------------------------------
via: http://linoxide.com/file-system/use-tmpfs-rhel-centos-7-0/
作者:[Adrian Dinu][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/adriand/

View File

@ -0,0 +1,167 @@
如何在Ubuntu/Debian/Linux Mint中编译和安装wxWidgets
================================================================================
### wxWidgets ###
wxWidgets是一个程序开发框架/库, 允许你在Windows、Mac、Linux中使用相同的代码跨平台开发。
它主要用C++写成但也可以与其他语言绑定比如Python、Perl、Ruby。
本教程中我将向你展示如何在基于Debian的linux中如Ubuntu和Linux Mint中编译wxwidgets 3.0+。
从源码编译wxWidgets并不困难仅仅需要几分钟。
库可以按不同的方式来编译,比如静态或者动态库。
### 1. 下载 wxWidgets ###
第一步你需要从[wxwidgets.org][1]下载wxWidgets源码文件。
做完后,解压到目录。
### 2. 设置编译环境 ###
要编译wxwidgets我们需要一些工具包括C++编译器, 在Linux上是g++。所有这些可以通过apt-get工具从仓库中安装。
我们还需要wxWidgets依赖的GTK开发库。
$ sudo apt-get install libgtk-3-dev build-essential checkinstall
>checkinstall工具允许我们为wxwidgets创建一个安装包这样之后就可以轻松的使用包管理器来卸载。
### 3. 编译 wxWidgets ###
进入到wxWidgets解压后的目录。为了保持清洁创建一个编译用的目录。
$ mkdir gtk-build
$ cd gtk-build/
现在运行configure和make命令。每个将花费一些时间来完成。
$ ../configure --disable-shared --enable-unicode
$ make
"--disable-shared"选项将会编译静态库而不是动态库。
make命令完成后编译也成功了。是时候安装wxWidgets到正确的目录。
更多信息请参考install.txt和readme.txt这可在wxwidgets中的/docs/gtk/目录下找到。
### 4. 安装 checkinstall ###
现在我们不使用"make install"命令我们使用checkinstall命令来创建一个wxwidgets的deb安装包。运行命令
$ sudo checkinstall
checkinstall会询问几个问题请保证在提问后提供一个版本号否则将会失败。
完成这一切后wxWidgets就安装好了deb文件也会创建在相同的目录下。
### 5. 追踪安装的文件 ###
如果你想要检查文件安装的位置使用dpkg命令后面跟上checkinstall提供的报名。
$ dpkg -L package_name
/.
/usr
/usr/local
/usr/local/lib
/usr/local/lib/libwx_baseu-3.0.a
/usr/local/lib/libwx_gtk3u_propgrid-3.0.a
/usr/local/lib/libwx_gtk3u_html-3.0.a
/usr/local/lib/libwxscintilla-3.0.a
/usr/local/lib/libwx_gtk3u_ribbon-3.0.a
/usr/local/lib/libwx_gtk3u_stc-3.0.a
/usr/local/lib/libwx_gtk3u_qa-3.0.a
/usr/local/lib/libwx_baseu_net-3.0.a
/usr/local/lib/libwxtiff-3.0.a
### 6. 编译示例 ###
编译wxWidgets完成后就可以马上编译示例程序了。在相同的目录下一个新的sample目录已经创建了。
进入它并运行下面的命令
$ compile samples
$ cd samples/
$ make
make命令完成后进入sampl子目录这里就有一个可以马上运行的Demo程序了。
### 7. 编译你的第一个程序 ###
你完成编译demo程序后可以写你自己的程序来编译了。这个也很简单。
假设你用的是C++这样你可以使用编辑器的高亮特性。比如gedit、kate、kwrite等等。或者用全功能的IDE像Geany、Codelite、Codeblocks等等。
然而你的第一个程序只需要用一个文本编辑器来快速完成。
这里就是
#include <wx/wx.h>
class Simple : public wxFrame
{
public:
Simple(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150))
{
Centre();
}
};
class MyApp : public wxApp
{
public:
bool OnInit()
{
Simple *simple = new Simple(wxT("Simple"));
simple->Show(true);
return true;
}
};
wxIMPLEMENT_APP(MyApp);
现在保存并用下面的命令编译。
# compile
$ g++ basic.cpp `wx-config --cxxflags --libs std` -o program
# run
$ ./program
#### 和非标准的库一起编译 ####
面展示的wx-config命令默认只支持标准的库。如果你使用的是Aui库那么你需要指定额外用到的库。
$ g++ code.cpp `wx-config --cxxflags --libs std,aui` -o program
更多的信息参考这里[这里][2]。
### 资源 ###
下载wxWidgets的源码和帮助
[https://www.wxwidgets.org/downloads/][3]
wxWidgets编译的wiki页面
[https://wiki.wxwidgets.org/Compiling_and_getting_started][4]
使用wxWidgets最新版本(3.0+)的事项
[https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets][5]
--------------------------------------------------------------------------------
via: http://www.binarytides.com/install-wxwidgets-ubuntu/
作者:[Silver Moon][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://plus.google.com/117145272367995638274/posts
[1]:https://www.wxwidgets.org/downloads/
[2]:https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets#The_wx-config_script
[3]:https://www.wxwidgets.org/downloads/
[4]:https://wiki.wxwidgets.org/Compiling_and_getting_started
[5]:https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets

View File

@ -0,0 +1,170 @@
Shell脚本使用rsync备份文件/目录
================================================================================
本文我们带来了shell脚本用来使用rsync命令将你本地Linux机器上的文件/目录备份到远程Linux服务器上。使用该脚本实施备份会是一个交互的方式你需要提供远程备份服务器的主机名/ip地址和文件夹位置。我们保留了一个独立文件在这个文件中你需要提供需要备份的文件/目录。我们添加了两个脚本,**第一个脚本**在每次拷贝完一个文件后询问密码如果你启用了ssh验证密钥那么就不会询问密码而第二个脚本中则只会提示一次输入密码。
我们打算备份bckup.txtdataconfig.txtdocs和orcledb。
[root@Fedora21 tmp]# ls -l
total 12
-rw-r--r--. 1 root root 0 May 15 10:43 bckrsync.sh
-rw-r--r--. 1 root root 0 May 15 10:44 bckup.txt
-rw-r--r--. 1 root root 0 May 15 10:46 dataconfig.txt
drwxr-xr-x. 2 root root 4096 May 15 10:45 docs
drwxr-xr-x. 2 root root 4096 May 15 10:44 oracledb
该文件包含了备份文件/目录的详情
[root@Fedora21 tmp]# cat /tmp/bckup.txt
/tmp/oracledb
/tmp/dataconfig.txt
/tmp/docs
[root@Fedora21 tmp]#
### 脚本 1 ###
#!/bin/bash
#We will save path to backup file in variable
backupf='/tmp/bckup.txt'
#Next line just prints message
echo "Shell Script Backup Your Files / Directories Using rsync"
#next line check if entered value is not null, and if null it will reask user to enter Destination Server
while [ x$desthost = "x" ]; do
#next line prints what userd should enter, and stores entered value to variable with name desthost
read -p "Destination backup Server : " desthost
#next line finishes while loop
done
#next line check if entered value is not null, and if null it will reask user to enter Destination Path
while [ x$destpath = "x" ]; do
#next line prints what userd should enter, and stores entered value to variable with name destpath
read -p "Destination Folder : " destpath
#next line finishes while loop
done
#Next line will start reading backup file line by line
for line in `cat $backupf`
#and on each line will execute next
do
#print message that file/dir will be copied
echo "Copying $line ... "
#copy via rsync file/dir to destination
rsync -ar "$line" "$desthost":"$destpath"
#this line just print done
echo "DONE"
#end of reading backup file
done
#### 运行带有输出结果的脚本 ####
[root@Fedora21 tmp]# ./bckrsync.sh
Shell Script Backup Your Files / Directories Using rsync
Destination backup Server : 104.*.*.41
Destination Folder : /tmp
Copying /tmp/oracledb ...
The authenticity of host '104.*.*.41 (104.*.*.41)' can't be established.
ECDSA key fingerprint is 96:11:61:17:7f:fa:......
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '104.*.*.41' (ECDSA) to the list of known hosts.
root@104.*.*.41's password:
DONE
Copying /tmp/dataconfig.txt ...
root@104.*.*.41's password:
DONE
Copying /tmp/docs ...
root@104.*.*.41's password:
DONE
[root@Fedora21 tmp]#
### 脚本 2 ###
#!/bin/bash
#We will save path to backup file in variable
backupf='/tmp/bckup.txt'
#Next line just prints message
echo "Shell Script Backup Your Files / Directories Using rsync"
#next line check if entered value is not null, and if null it will reask user to enter Destination Server
while [ x$desthost = "x" ]; do
#next line prints what userd should enter, and stores entered value to variable with name desthost
read -p "Destination backup Server : " desthost
#next line finishes while loop
done
#next line check if entered value is not null, and if null it will reask user to enter Destination Path
while [ x$destpath = "x" ]; do
#next line prints what userd should enter, and stores entered value to variable with name destpath
read -p "Destination Folder : " destpath
#next line finishes while loop
done
#next line check if entered value is not null, and if null it will reask user to enter password
while [ x$password = "x" ]; do
#next line prints what userd should enter, and stores entered value to variable with name password. #To hide password we are using -s key
read -sp "Password : " password
#next line finishes while loop
done
#Next line will start reading backup file line by line
for line in `cat $backupf`
#and on each line will execute next
do
#print message that file/dir will be copied
echo "Copying $line ... "
#we will use expect tool to enter password inside script
/usr/bin/expect << EOD
#next line set timeout to -1, recommended to use
set timeout -1
#copy via rsync file/dir to destination, using part of expect — spawn command
spawn rsync -ar ${line} ${desthost}:${destpath}
#as result of previous command we expect “password” promtp
expect "*?assword:*"
#next command enters password from script
send "${password}\r"
#next command tells that we expect end of file (everything finished on remote server)
expect eof
#end of expect pard
EOD
#this line just print done
echo "DONE"
#end of reading backup file
done
#### 运行第二个带有输出结果的脚本的屏幕截图 ####
![rsync script](http://blog.linoxide.com/wp-content/uploads/2015/05/bckuprsync-script.png)
希望这些脚本对你备份会有帮助!!
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-shell-script/shell-script-backup-files-directories-rsync/
作者:[Yevhen Duma][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/yevhend/

View File

@ -0,0 +1,71 @@
Linux 有问必答--如何在桌面版 Ubuntu 中用命令行更改系统代理设置
================================================================================
> **问题**: 我经常需要在桌面版 Ubuntu 中更改系统代理设置,但我不想通过繁琐的 GUI 菜单链:"系统设置" -> "网络" -> "网络代理"。在命令行中有更方便的方法更改桌面版的代理设置吗?
在桌面版 Ubuntu 中,它的桌面环境设置,包括系统代理设置,都存储在 DConf 数据库,这是简单的键值对存储。如果你想通过系统设置菜单修改桌面属性,更改会持久保存在后端的 DConf 数据库。在 Ubuntu 中更改 DConf 数据库有基于图像用户界面和非图形用户界面的两种方式。系统设置或者 dconf-editor 是访问 DConf 数据库的图形方法,而 gsettings 或 dconf 就是能更改数据库的命令行工具。
下面介绍如何用 gsettings 从命令行更改系统代理设置。
![](https://farm6.staticflickr.com/5460/17872782271_68e5267a4a_c.jpg)
gsetting 读写特定 Dconf 设置的基本用法如下:
更改 DConf 设置:
$ gsettings set <schema> <key> <value>
读取 DConf 设置:
$ gsettings get <schema> <key>
### 通过命令行更改系统代理设置为手动 ###
桌面版 Ubuntu 中下面的命令会更改 HTTP 代理设置为 "my.proxy.com:8000"。
$ gsettings set org.gnome.system.proxy.http host 'my.proxy.com'
$ gsettings set org.gnome.system.proxy.http port 8000
$ gsettings set org.gnome.system.proxy mode 'manual'
如果你还想更改 HTTPS/FTP 代理为手动,用这些命令:
$ gsettings set org.gnome.system.proxy.https host 'my.proxy.com'
$ gsettings set org.gnome.system.proxy.https port 8000
$ gsettings set org.gnome.system.proxy.ftp host 'my.proxy.com'
$ gsettings set org.gnome.system.proxy.ftp port 8000
更改套接字主机设置为手动:
$ gsettings set org.gnome.system.proxy.socks host 'my.proxy.com'
$ gsettings set org.gnome.system.proxy.socks port 8000
上面的更改都只适用于当前的桌面用户。如果你想在系统范围内使用代理设置更改,在 gsettings 命令面前添加 sudo。例如
$ sudo gsettings set org.gnome.system.proxy.http host 'my.proxy.com'
$ sudo gsettings set org.gnome.system.proxy.http port 8000
$ sudo gsettings set org.gnome.system.proxy mode 'manual'
### 在命令行中更改系统代理设置为自动 ###
如果你正在使用 [自动配置代理][1] (proxy auto configurationPAC),输入以下命令更改为 PAC。
$ gsettings set org.gnome.system.proxy mode 'auto'
$ gsettings set org.gnome.system.proxy autoconfig-url http://my.proxy.com/autoproxy.pac
### 在命令行中清除系统代理设置 ###
最后,清除所有 手动/自动 代理设置,还原为无代理设置:
$ gsettings set org.gnome.system.proxy mode 'none'
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/change-system-proxy-settings-command-line-ubuntu-desktop.html
作者:[Dan Nanni][a]
译者:[ictlyh](https://github.com/ictlyh)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni
[1]:http://xmodulo.com/how-to-set-up-proxy-auto-config-on-ubuntu-desktop.html

View File

@ -0,0 +1,42 @@
Linux 有问必答--如何在桌面版 Ubuntu 中安装 Unity Tweak Tool
================================================================================
> **问题**: 我试着给刚安装的桌面版 Ubuntu 自定制桌面。我想使用 Unity Tweak Tool。我怎样才能在 Ubuntu 上安装 Unity Tweak Tool 呢?
[Unity Tweak Tool][1] 是个流行的 Unity 桌面自定制工具。顾名思义,该工具只适用于 Ubuntu 的默认桌面环境(例如,基于 Unity 的 GNOME 桌面)。这个多功能的工具允许你通过非常直观和简单易用的图形用户界面自定义多种 Unity 桌面特性。它的菜单看起来类似于 Ubuntu 的官方系统设置,但它的桌面自定制能力远远超过默认的系统设置。通过使用 Unity Tweak Tool你可以自定制外观、行为以及很多桌面组件的配置例如工作区、窗口、图标、主题、光标、字体、滑动、热键等等。如果你是 Unity 桌面用户Unity Tweak Tool 一定是个必不可少的应用程序。
![](https://farm6.staticflickr.com/5463/17684020389_25dc7f0db2_b.jpg)
尽管 Unity Tweak Tool 是桌面版 Ubuntu 的重要工具,并没有在桌面版 Ubuntu 中预安装。为了能自定制 Unity 桌面,下面介绍一下如何在桌面版 Ubuntu 中安装 Unity Tweak Tool。
### 在 Ubuntu 13.04 或更高版本中安装 Unity Tweak Tool ###
从 Ubuntu 13.04 开始, Ubuntu 的基础库中就有 Unity Tweak Tool 了。因此它的安装非常简单:
$ sudo apt-get install unity-tweak-tool
启动 Unity Tweak Tool
$ unity-tweak-tool
如果你想使用最新版本的 Unity Tweak Tool你可以从它的 PPA 中安装(如下所述)。
### 在 Ubuntu 12.10 中安装 Unity Tweak Tool ###
注意Unity Tweak Tool 要求 Ubuntu 12.10 或更高的版本。如果你想着 Ubuntu 上安装它,你可以安装下面方法使用 PPA。当你想测试最新的开发版的时候这个 PPA 库也非常有用。
$ sudo add-apt-repository ppa:freyja-dev/unity-tweak-tool-daily
$ sudo apt-get update
$ sudo apt-get install unity-tweak-tool
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/install-unity-tweak-tool-ubuntu-desktop.html
作者:[Dan Nanni][a]
译者:[ictlyh](https://github.com/ictlyh)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni
[1]:https://launchpad.net/unity-tweak-tool

View File

@ -0,0 +1,189 @@
Linux ntopng——网络监控工具的安装附截图
================================================================================
当今世界人们的计算机都相互连接互联互通。小到你的家庭局域网LAN大到最大的一个被我们称为的——互联网。当你管理一台联网的计算机时你就是在管理最关键的组件之一。由于大多数开发出的应用程序都基于网络网络就连接起了这些关键点。
这就是为什么我们需要网络监控工具。最好的网络监控工具之一它叫作ntop。来自[维基百科][1]的知识“ntop是一个网络探测器它以与top显示进程般类似的方式显示网络使用率。在交互模式中它显示了用户终端上的网络状态。在网页模式中它作为网络服务器创建网络状态的HTML转储文件。它支持NetFlow/sFlowemitter/collector这是一个基于HTTP的客户端界面用于创建ntop为中心的监控应用和RRD用于持续地存储通信数据”
15年后的今天你将见到ntopng——下一代ntop。
### ntopng是什么 ###
Ntopng是一个基于网页的高速通信分析器和流量收集器。Ntopng基于ntop它运行于所有Unix平台、MacOS X和Windows。
### 特性 ###
从[ntopng网站][2]上,我们可以看到他们说它有众多的特性。这里列出了其中一些:
- 按各种协议对网络通信排序
- 显示网络通信和IPv4/v6激活的主机
- 持续不断以RRD格式存储定位主机的通信数据到磁盘
- 通过nDPIntop的DPI框架发现应用协议
- 显示各种协议间的IP通信分布
- 分析IP通信并根据源/目的地址进行排序
- 显示IP通信子网的矩阵谁在和谁通信
- 报告按协议类型排序的IP协议使用率
- 生成HTML5/AJAX网络通信数据
### 安装 ###
Ntop为CentOS和**基于64位**Ubuntu预编译好了包你可以在[他们的下载页面][3]找到这些包。对于32位操作系统你必须从源代码编译。本文在**CentOS 6.4 32位**版本上**测试过**。但是它也可以在其它基于CentOS/RedHat的Linux版本上工作。让我们开始吧。
#### 先决条件 ####
#### 开发工具 ####
你必须确保你安装了编译ntopng所需的所有开发工具要安装开发工具你可以使用yum命令
# yum groupinstall Development Tools
#### 安装TCL ####
# yum install tcl
#### 安装libpcap ####
# yum install libpcap libcap-devel
#### 安装Redis ####
# wget http://redis.googlecode.com/files/redis-2.6.13.tar.gz
# tar zxfv redis-2.6.13.tar.gz
# cd redis-2.6.13
# make 32bit
# make test
# make install
### 安装ntopng ###
#### 方法 1 ####
# wget http://sourceforge.net/projects/ntop/files/ntopng/ntopng-1.1_6932.tgz/download
# tar zxfv ntopng-1.1_6932.tgz
# cd ntopng-1.1_6932
# ./configure
# make
# make install
#### 方法 2 ####
在我的CentOS 6.4上,我使用方法 1时收到了一个错误消息错误消息内容如下
./third-party/LuaJIT-2.0.2/src/libluajit.a : could not read symbols : File in wrong format
所以,我**切换**到了**SVN**来安装。对于此方法,需要联网,步骤如下:
# svn co https://svn.ntop.org/svn/ntop/trunk/ntopng/
# ./autogen.sh
# ./configure
# make
# make install
*由于ntopng是一个基于网页的应用你的系统必须安装有工作良好的网络服务器*
### 为ntopng创建配置文件 ###
如果一切都已安装完毕,那么我们该来运行它了。默认情况下,如果我们在./configure这一步没有明确修改安装文件夹的话redis和ntopng将安装到/usr/local/文件夹。接下来我们需要为ntopng创建配置文件。在本文中我们使用vi作为文本编辑器。你也可以使用你所中意的文本编辑器来创建ntopng的配置文件。
# cd /usr/local/etc
# mkdir ntopng
# cd ntopng
# vi ntopng.start
放入这些行:
--local-network “10.0.2.0/24”
--interface 1
# vi ntopng.pid
放入该行:
-G=/var/run/ntopng.pid
保存这些文件,然后继续下一步。
### 运行ntopng ###
我们假定你已正确安装了网络服务器那么下一步就是运行redis服务器。
# /usr/local/bin/redis-server
![Starting Redis Server](http://blog.linoxide.com/wp-content/uploads/2013/11/redis-server-start.png)
然后,**运行**ntopng
# /usr/local/bin/ntopng
![Starting Ntopng](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng-start.png)
### 测试ntopng ###
现在,你可以通过访问[http://yourserver.name:3000][4]来测试ntopng应用你将会看到ntopng登录页面。首次登录你可以使用用户**admin**’和密码‘**admin**’。
![Ntop Login page](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_login.png)
仪表盘相当简洁。当你登入后,你将看到关于最高流量通信者页面。
![Ntopng Flow Talker](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_talkers.png)
如果你点击右侧顶部的**流量菜单**ntopng将会显示活动流量的更多细节。
![Ntopng Flows](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_flows.png)
在**主机菜单**上,你可以看到连接到流的所有主机
![Ntopng Hosts List](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_hoslist.png)
如果你点击**主机 > 交互**ntop将显示一个漂亮的主机间的交互信息图表。
![Ntopng Hosts Interaction](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_hosts_interaction.png)
**仪表盘菜单**组成部分:
#### 顶级主机(发送+接收) ####
![Ntopng Hosts](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_hosts.png)
#### 顶级应用协议 ####
![Ntopng Apps](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_apps.png)
**界面菜单**将引领你进入更多内部菜单。
包菜单将给你显示包的分布大小。
![Ntopng packets](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_packets.png)
**协议菜单**将为你显示使用了多少协议及其使用百分比。
![Ntopng protocol](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_protocol.png)
![Ntopng protocols - detail](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_protocol_detail.png)
你也可以通过使用**历史活跃度菜单**查看活跃度
![Ntopng Historical Activity](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_historical.png)
![Ntopng Historical Activity detail](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_historical_detail.png)
最后一项要点是,你也可以通过顶部右侧区域的**设置菜单**齿轮图标的那一个管理哪些用户可以访问ntopng。
![Ntopng Users](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_users.png)
Ntopng为你提供了一个范围宽广的时间线从5分钟到1年都可以。你只需要点击你想要现实的时间线。图标本身是可以点击的你可以点击它来进行缩放。
当然ntopng能做的事比上面图片中展示的还要多得多。你也可以将定位和电子地图服务整合进来。在ntopng自己的网站上有已付费的模块可供使用如nprobe可以扩展ntopng可以提供给你的信息。更多关于ntopng的信息你可以访问[ntopng网站][5]。
--------------------------------------------------------------------------------
via: http://linoxide.com/monitoring-2/ntopng-network-monitoring-tool/
作者:[Pungki Arianto][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/pungki/
[1]:http://en.wikipedia.org/wiki/Ntop
[2]:http://www.ntop.org/products/ntop/
[3]:http://www.nmon.net/packages/
[4]:http://yourserver.name:3000/
[5]:http://www.ntop.org/

View File

@ -0,0 +1,89 @@
Linux有问必答 -- 如何在Linux中挂载LVM分区
================================================================================
> **提问**: 我有一个USB盘包含了LVM分区。 我想要在Linux中访问这些LVM分区。我该如何在Linux中挂载LVM分区
】LVM是逻辑卷管理工具它允许你使用逻辑卷和卷组的概念来管理磁盘空间。使用LVM相比传统分区最大的好处是弹性地位用户和程序分配空间而不用考虑每个物理磁盘的大小。
在LVM中那些创建了逻辑分区的物理存储是传统的分区比如/dev/sda2/dev/sdb1。这些分区必须被初始化位“物理卷”并被标签“Linux LVM”来使它们可以在LVM中使用。一旦分区被标记被LVM分区你不能直接用mount命令挂载。
如果你尝试挂载一个LVM分区比如/dev/sdb2, 你会得到下面的错误。
$ mount /dev/sdb2 /mnt
----------
mount: unknown filesystem type 'LVM2_member'
![](https://farm8.staticflickr.com/7696/17749902190_0a6d36821f_b.jpg)
要正确地挂载LVM分区你必须挂载分区创建的“逻辑分区”。下面就是如何做的。
=首先,用下面的命令检查可用的卷组:
$ sudo pvs
----------
PV VG Fmt Attr PSize PFree
/dev/sdb2 vg_ezsetupsystem40a8f02fadd0 lvm2 a-- 237.60g 0
![](https://farm8.staticflickr.com/7657/17938136831_d9320b7bfc_b.jpg)
物理卷的名字和卷组的名字分别在PV和VG列的下面。本例中只有一个创建在dev/sdb2下的组“vg_ezsetupsystem40a8f02fadd0”。
接下来检查卷组中存在的逻辑卷使用lvdisplay命令
$ sudo lvdisplay <volume-group-name>
使用lvdisplay显示了可用卷的信息设备名、卷名、卷大小等等
$ sudo lvdisplay /dev/vg_ezsetupsystem40a8f02fadd0
----------
--- Logical volume ---
LV Path /dev/vg_ezsetupsystem40a8f02fadd0/lv_root
LV Name lv_root
VG Name vg_ezsetupsystem40a8f02fadd0
LV UUID imygta-P2rv-2SMU-5ugQ-g99D-A0Cb-m31eet
LV Write Access read/write
LV Creation host, time livecd.centos, 2015-03-16 18:38:18 -0400
LV Status available
# open 0
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
![](https://farm8.staticflickr.com/7707/17938137591_cdb4cbfb43_b.jpg)
如果你想要挂载一个特定的逻辑卷使用“LV Path”下面的设备名/dev/vg_ezsetupsystem40a8f02fadd0/lv_home
$ sudo mount /dev/vg_ezsetupsystem40a8f02fadd0/lv_home /mnt
你可以用mount命令不带任何参数检查挂载状态这会显示所有已挂载的文件系统。
$ mount
![](https://farm6.staticflickr.com/5449/17749903670_2ee617445d_c.jpg)
如果你想在每次启动时自动挂载逻辑卷,在/etc/fstab中添加下面的行你可以指定卷的文件系统类型如 ext4它可以从mount命令的输出中找。
/dev/vg_ezsetupsystem40a8f02fadd0/lv_home /mnt ext4 defaults 0 0
现在逻辑卷会在每次启动时挂载到/mnt。
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/mount-lvm-partition-linux.html
作者:[Dan Nanni][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni