Merge pull request #3 from LCTT/master

Update Repository
This commit is contained in:
joeren
2014-12-04 12:05:42 +08:00
87 changed files with 613 additions and 315 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
members.md
*.html
*.bak
.DS_Store

View File

@@ -40,6 +40,8 @@ LCTT的组成
- CORE [geekpi](https://github.com/geekpi),
- CORE [GOLinux](https://github.com/GOLinux),
- CORE [reinoir](https://github.com/reinoir),
- CORE [bazz2](https://github.com/bazz2),
- CORE [zpl1025](https://github.com/zpl1025),
- Senior [tinyeyeser](https://github.com/tinyeyeser),
- Senior [vito-L](https://github.com/vito-L),
- Senior [jasminepeng](https://github.com/jasminepeng),
@@ -47,66 +49,73 @@ LCTT的组成
- Senior [vizv](https://github.com/vizv),
- [runningwater](https://github.com/runningwater),
- [luoxcat](https://github.com/Luoxcat),
- [bazz2](https://github.com/bazz2),
- [Vic020](https://github.com/Vic020),
- [alim0x](https://github.com/alim0x),
- [KayGuoWhu](https://github.com/KayGuoWhu),
- [zpl1025](https://github.com/zpl1025),
- [blueabysm](https://github.com/blueabysm),
- [flsf](https://github.com/flsf),
- [crowner](https://github.com/crowner),
- [Linux-pdz](https://github.com/Linux-pdz),
- [Linchenguang](https://github.com/Linchenguang),
- [linuhap](https://github.com/linuhap),
- [alim0x](https://github.com/alim0x),
- [ZTinoZ](https://github.com/ZTinoZ),
- [2q1w2007](https://github.com/2q1w2007),
- [flsf](https://github.com/flsf),
- [blueabysm](https://github.com/blueabysm),
- [barney-ro](https://github.com/barney-ro),
- [su-kaiyao](https://github.com/su-kaiyao),
- [crowner](https://github.com/crowner),
- [Linchenguang](https://github.com/Linchenguang),
- [Linux-pdz](https://github.com/Linux-pdz),
- [linuhap](https://github.com/linuhap),
- [yechunxiao19](https://github.com/yechunxiao19),
- [woodboow](https://github.com/woodboow),
- [su-kaiyao](https://github.com/su-kaiyao),
- [SPccman](https://github.com/SPccman),
- [disylee](https://github.com/disylee),
- [cvsher](https://github.com/cvsher),
- [ThomazL](https://github.com/ThomazL),
- [Stevearzh](https://github.com/Stevearzh),
- [felixonmars](https://github.com/felixonmars),
- [scusjs](https://github.com/scusjs),
- [johnhoow](https://github.com/johnhoow),
- [hyaocuk](https://github.com/hyaocuk),
- [MikeCoder](https://github.com/MikeCoder),
- [ThomazL](https://github.com/ThomazL),
- [theo-l](https://github.com/theo-l),
- [wangjiezhe](https://github.com/wangjiezhe),
- [jiajia9linuxer](https://github.com/jiajia9linuxer),
- [SteveArcher](https://github.com/SteveArcher),
- [l3b2w1](https://github.com/l3b2w1),
- [NearTan](https://github.com/NearTan),
- [l3b2w1](https://github.com/l3b2w1),
- [shipsw](https://github.com/shipsw),
- [disylee](https://github.com/disylee),
- [Love-xuan](https://github.com/Love-xuan),
- [boredivan](https://github.com/boredivan),
- [cvsher](https://github.com/cvsher),
- [owen-carter](https://github.com/owen-carter),
- [Love-xuan](https://github.com/Love-xuan),
- [JonathanKang](https://github.com/JonathanKang),
- [tenght](https://github.com/tenght),
- [luoyutiantang](https://github.com/luoyutiantang),
- [owen-carter](https://github.com/owen-carter),
- [icybreaker](https://github.com/icybreaker),
- [liuaiping](https://github.com/liuaiping),
- [tenght](https://github.com/tenght),
- [rogetfan](https://github.com/rogetfan),
- [liuaiping](https://github.com/liuaiping),
- [nd0104](https://github.com/nd0104),
- [whatever1992](https://github.com/whatever1992),
- [szrlee](https://github.com/szrlee),
- [lfzark](https://github.com/lfzark),
- [CNprober](https://github.com/CNprober),
- [213edu](https://github.com/213edu),
- [johnhoow](https://github.com/johnhoow),
- [yujianxuechuan](https://github.com/yujianxuechuan),
- [ggaaooppeenngg](https://github.com/ggaaooppeenngg),
- [CNprober](https://github.com/CNprober),
- [coloka](https://github.com/coloka),
- [213edu](https://github.com/213edu),
- [guodongxiaren](https://github.com/guodongxiaren),
- [Tanete](https://github.com/Tanete),
- [zzlyzq](https://github.com/zzlyzq),
- [yujianxuechuan](https://github.com/yujianxuechuan),
- [ailurus1991](https://github.com/ailurus1991),
- [FineFan](https://github.com/FineFan),
- [shaohaolin](https://github.com/shaohaolin),
- [tomatoKiller](https://github.com/tomatoKiller),
- [CHINAANSHE](https://github.com/CHINAANSHE),
- [stduolc](https://github.com/stduolc),
- [Maclauring](https://github.com/Maclauring),
- [zsJacky](https://github.com/zsJacky),
- [Hao-Ding](https://github.com/Hao-Ding),
- [luoyutiantang](https://github.com/luoyutiantang),
- [zsJacky](https://github.com/zsJacky),
- [small-Wood](https://github.com/small-Wood),
- [CHINAANSHE](https://github.com/CHINAANSHE),
- [guodongxiaren](https://github.com/guodongxiaren),
- [cereuz](https://github.com/cereuz),
- [lijhg](https://github.com/lijhg),
- [fbigun](https://github.com/fbigun),
更新于2014/09/09
更新于2014/12/02以Github contributors列表排名
谢谢大家的支持!
@@ -124,5 +133,7 @@ LCTT的组成
* 2014/01/02 增加了Core Translators 成员: geekpi。
* 2014/05/04 更换了新的QQ群198889102
* 2014/05/16 增加了Core Translators 成员: will.qian、vizv。
* 2014/06/18 由于GOLinux令人惊叹的翻译速度和不错的翻译质量升级为Core Translators 成员。
* 2014/09/09 LCTT 一周年,做一年[总结](http://linux.cn/article-3784-1.html)。并将曾任 CORE 的成员分组为 Senior以表彰他们的贡献。
* 2014/06/18 由于GOLinux令人惊叹的翻译速度和不错的翻译质量升级为Core Translators成员。
* 2014/09/09 LCTT 一周年,做一年[总结](http://linux.cn/article-3784-1.html)。并将曾任 CORE 的成员分组为 Senior以表彰他们的贡献。
* 2014/10/08 提升bazz2为Core Translators成员。
* 2014/11/04 提升zpl1025为Core Translators成员。

View File

@@ -1,7 +1,9 @@
Linux系统管理员有帮助的命令行工具
Linux系统管理员的命令行工具箱目录
================================================================================
系统管理员sysadmins负责日常维护生产系统和服务。其中一个关键任务就是保证功能性服务能24小时工作。为了这个他们得很小心地计划备份方式灾难管理策略定时维护安全审查等等。和任意其他管理一样系统管理员也有他们的必备工具。在正确的时间正确的情况下使用合适的工具可以帮助维护操作系统的健壮达到最小的服务中断时间和最大的运行时间。
![](https://farm6.staticflickr.com/5563/14853747084_e14cf18e8f_z.jpg)
这篇文章会介绍一些系统管理员日常活动中最常用和有效的命令行工具。如果你想推荐其他没在这里列出来的好用的工具,别忘了在评论区里分享一下。
### 网络工具 ###
@@ -14,7 +16,7 @@
4. **mtr**traceroute的一个变种能根据运行时统计数据整理出每一跳的包丢失/抖动。用来评估路由路径延时很不错。
5. **[netcat][2]/[socat][3]**TCP/IP网络里的瑞士军刀可以读/写TCP/UDP协议字节流。用来调试防火墙策略和服务可用性很不错。
5. **[netcat][2]/[socat][3]**TCP/IP网络里的瑞士军刀可以读/写 TCP/UDP 协议字节流。用来调试防火墙策略和服务可用性很不错。
6. **dig**DNS调试工具可以生成正向查询反向查询搜索域名服务器检查CNAMEMX和其他DNS记录。可以在侦错的时候查询特定的DNS服务器。
@@ -68,7 +70,7 @@
29. **[parted][15]**另一个磁盘分区编辑器支持超过2TB的磁盘的GPTGUID分区表格式。gparted是parted的一个前端GTK+图形界面。
30. **df**:用来查看不同分区或文件路径的已用/可用存储空间和挂载点。存在一个用户友好的变种dfc。
30. **df**:用来查看不同分区或文件路径的已用/可用存储空间和挂载点。还有一个更易用的变种dfc。
31. **du**用来查看不同文件和目录的当前磁盘占用情况例如du -sh *)。
@@ -86,7 +88,7 @@
37. **tail**用来查看一个增长中的日志文件的尾部。有几个变种包括multitail多窗口查看和[ztail][16]支持inotify和正则表达式过滤以及颜色
38. **logrotate**:一个命令行工具,可以在根据设定的时间段拆分、压缩并邮寄旧的/大的日志文件。用来管理可能产生大量日志文件的繁忙主机很有用。
38. **logrotate**:一个命令行工具,可以在根据设定的时间段拆分、压缩并通过邮件发送旧的/大的日志文件。用来管理可能产生大量日志文件的繁忙主机很有用。
39. **grep/egrep**可以通过特定的模式或正则表达式过滤日志内容。变种包括用户更友好的ack和速度更快的ag。
@@ -96,7 +98,7 @@
### 备份工具 ###
42. **[rsync][17]**一个快速的单向增量备份和镜像工具。常用于复制一个数据仓库到线下存储可以选择通过SSH或stunnel的加密连接。
42. **[rsync][17]**:一个快速的单向增量备份和镜像工具LCTT 译注rsync 应是双向的)。常用于复制一个数据仓库到线下存储可以选择通过SSH或stunnel的加密连接。
43. **[rdiff-backup][18]**:另一个有效利用带宽的增量备份工具。管理两个连续快照之间的差分。
@@ -104,13 +106,13 @@
### 性能监视工具 ###
45. **top**一个命令行的进程查看程序。可以监视系统负载、进程状态、CPU和内存占用。有一个更用户友好的变种htop。
45. **top**一个命令行的进程查看程序。可以监视系统负载、进程状态、CPU和内存占用。有一个更用的变种htop。
46. **ps**显示系统所有运行中进程的一个快照。输出可以定制成显示PID、PPID、用户、负载、内存、积累的用户/系统时间、启动时间、以及更多。有一个变种pstree可以用树结构显示进程。
46. **ps**显示系统所有运行中进程的一个快照。输出可以定制成显示PID、PPID、用户、负载、内存、积累的用户/系统时间、启动时间、以及更多。有一个变种pstree可以用树结构显示进程。
47. **[nethogs][19]**:一个带宽监视工具,按进程来分组显示活动网络连接,实时汇报每个进程占用的(上传/下载)带宽。
48. **ngxtop**:一个网页服务器访问日志解析和监视工具,界面受top命令启发。它可以实时汇报整理过的页面请求列表包括频率、大小、HTTP返回值、IP地址等等。
48. **ngxtop**:一个网页服务器访问日志解析和监视工具,界面受到了top命令启发。它可以实时汇报整理过的页面请求列表包括频率、大小、HTTP返回值、IP地址等等。
49. **vmstat**一个简单的命令行工具可以显示多个实时系统特征例如进程数、剩余内存、分页状态、CPU占用、块设备I/O活动、中断/上下文切换统计、等等。
@@ -138,9 +140,9 @@
59. **dpkg**:一个用来手动安装.deb包的命令行工具。强烈建议尽可能的使用apt。
60. **yum**:基于红帽的系统的事实上的自动包管理工具比如RHEL、CentOS或Fedora。另一个救生圈
60. **yum**用于基于红帽的系统的自动包管理工具比如RHEL、CentOS或Fedora。这是另一个救生圈
61. **rpm**:通常我都是rpmyum一下。有很多有用的参数,比如-q、-f、-l可以分别用来查询、指定文件和路径。
61. **rpm**:通常我都是使用 rpm 来配合 yum 使用。有很多有用的参数,比如-q、-f、-l可以分别用来查询、指定文件和路径。
### 硬件工具 ###
@@ -158,7 +160,7 @@ via: http://xmodulo.com/2014/08/useful-cli-tools-linux-system-admins.html
作者:[Sarmed Rahman][a]
译者:[zpl1025](https://github.com/zpl1025)
校对:[校对者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 @@
Postfix的20个问答
20个关于Postfix的面试
================================================================================
### 问题1什么是 Postfix它的默认端口是多少 ###
@@ -10,19 +10,19 @@ Postfix的20个问答题
### 问题3什么是 MTA它在邮件系统中扮演什么角色 ###
MTA 是 Mail Transfer Agent 的缩写。MTA 负责接收和发送邮件、确定发送路径和地址重写LCTTaddress rewriting就是完善发送地址比如将“username”这个地址重写为“username@example.com”。本地转发就是将邮件发送给 MDA。Qmail、Postix、Sendmail 都是 MTA。
MTA 是 Mail Transfer Agent (邮件传输代理)的缩写。MTA 负责接收和发送邮件、确定发送路径和地址重写LCTT译注address rewriting就是完善发送地址比如将“username”这个地址重写为“username@example.com”。本地转发就是将邮件发送给 MDA。Qmail、Postix、Sendmail 都是 MTA。
### 问题4什么是 MDA ###
MDA 是 Mail Delivery Agent 的缩写。MDA 这个程序用于从 MTA 获取邮件并传送至本地接受者的邮箱。MDA 通常可以过滤邮件或为邮件分类。一个 MDA 也能决定一封邮件是否需要转发到另一个邮箱地址。Procmail 就是一个 MDA。
MDA 是 Mail Delivery Agent (邮件投递代理)的缩写。MDA 这个程序用于从 MTA 获取邮件并投递至本地收件人的邮箱。MDA 通常可以过滤邮件或为邮件分类。一个 MDA 也能决定一封邮件是否需要转发到另一个邮箱地址。Procmail 就是一个 MDA。
### 问题5什么是 MUA ###
MUA 是 Mail User Agent 的缩写。MUA 是一个邮件客户端软件,可以用来写邮件、发送邮件、接收邮件。发送邮件时使用的是 MTA接收邮件时可以从邮件存储区直接收取也可以通过 POP/IMAP 服务器间接收取。Outlook、Thunkerbird、Evolution 都是 MUA。
MUA 是 Mail User Agent (邮件用户代理)的缩写。MUA 是一个邮件客户端软件,可以用来写邮件、发送邮件、接收邮件。发送邮件时使用的是 MTA接收邮件时可以从邮件存储区直接收取也可以通过 POP/IMAP 服务器间接收取。Outlook、Thunkerbird、Evolution 都是 MUA。
### 问题6Mailserver 里 postmaster 的作用是什么? ###
### 问题6邮件服务器里 postmaster 的作用是什么? ###
答:邮件管理者一般就是 postmaster。一个 postmaster 的责任就是保证邮件系统正常工作、更新系统配置、添加/删除邮箱帐号,以及其他。每个域中必须存在一个 postmaster 的别名LCTTpostmaster 别名的作用就是能让你的邮件系统以外的用户往邮件系统里面的用户发邮件,当然也能接收来自系统内部用户发送出来的邮件),用于将邮件发往正确的用户。
答:邮件管理者一般就是 postmaster。一个 postmaster 的责任就是保证邮件系统正常工作、更新系统配置、添加/删除邮箱帐号,以及其他工作。每个域中必须存在一个 postmaster 的别名LCTT译注postmaster 别名用于接受一些其它服务器/用户对该邮件系统的沟通邮件如关于垃圾邮件拒收的投诉等通常都会直接被邮件服务器的管理员所接受。一些系统错误和提示的邮件也往往以postmaster 作为发件人),用于将邮件发往正确的用户。
### 问题7Postfix 都有些什么重要的进程? ###
@@ -31,10 +31,10 @@ Postfix的20个问答题
- **master**:这条进程是 Postfix 邮件系统的大脑,它产生所有其他进程。
- **smtpd**:作为服务器端程序处理所有外部连进来的请求。
- **smtp**:作为客户端程序处理所有对外发起连接的请求。
- **qmgr**:它是 Postfix 邮件系统的心脏,处理和控制邮件列里面的所有消息。
- **local**:这是 Postfix 自有的本地传送代理,就是它负责把邮件保存到邮箱里。
- **qmgr**:它是 Postfix 邮件系统的心脏,处理和控制邮件列里面的所有消息。
- **local**:这是 Postfix 自有的本地投递代理MDA,就是它负责把邮件保存到邮箱里。
### 问题8Postfix 服务器的配置什么是什么? ###
### 问题8Postfix 服务器的配置文件是什么? ###
答:有两个主要配置文件:
@@ -45,9 +45,9 @@ Postfix的20个问答题
答:使用这个命令重启:`service postfix restart`;使用这个命令设为开机启动:`chkconfig postfix on`
### 问题10怎么查看 Postfix 的邮件列 ###
### 问题10怎么查看 Postfix 的邮件列? ###
Postfix 维护两个列未决邮件队列pending mails queue和等待邮件队列deferred mail queue。等待队列包含了暂时发送失败、需要重新发送的邮件Postfix 会定期重发默认5分钟可自定义设置LCTT其实 Postfix 维护5个队列输入队列邮件进入 Postfix 系统的第一站活动队列qmgr 将输入队列的邮件移到活动队列;等待队列,保存暂时不能发送出去的邮件;故障队列,保存受损或无法解读的邮件;保留队列,将邮件无限期留在 Postfix 队列系统中。)
Postfix 维护两个未决邮件队列pending mails queue和等待邮件队列deferred mail queue。等待队列包含了暂时发送失败、需要重新发送的邮件Postfix 会定期重发默认5分钟可自定义设置LCTT译注:其实 Postfix 维护5个队列输入队列邮件进入 Postfix 系统的第一站活动队列qmgr 将输入队列的邮件移到活动队列;等待队列,保存暂时不能发送出去的邮件;故障队列,保存受损或无法解读的邮件;保留队列,将邮件无限期留在 Postfix 队列系统中。)
列出邮件队列里面所有邮件:
@@ -85,9 +85,9 @@ Postfix的20个问答题
# echo "Test mail from postfix" | mail -s "Plz ignore" info@something.com
### 问题15什么是“开放邮件转发” ###
### 问题15什么是“开放邮件转发Open Relay”? ###
答:开放邮件转发是 SMTP 服务器的一项设定,允许因特网上其他用户能通过该服务器转发邮件,而不是直接发送到某个帐号。过去,这项功能在许多邮件服务器中都是默认开启的,但是现在已经不再流行了,因为邮件转发会导致大量垃圾邮件和病毒邮件在网络上肆虐。
答:开放邮件转发是 SMTP 服务器的一项设定,允许因特网上任意的其他用户能通过该服务器转发邮件,而不是直接发送到某个帐号的服务器或只允许授权用户通过它来发送邮件。过去,这项功能在许多邮件服务器中都是默认开启的,但是现在已经不再流行了,因为邮件转发会导致大量垃圾邮件和病毒邮件在网络上肆虐。
### 问题16什么是 Postfix 上的邮件转发主机? ###
@@ -95,11 +95,11 @@ Postfix的20个问答题
### 问题17什么是灰名单 ###
灰名单LCTT介于白名单和黑名单之间用于拦截垃圾邮件。一个 MTA 使用灰名单时就会“暂时拒绝”未被识别的发送者发来的所有邮件。如果邮件是正当合理的发起者会在一段时间后重新发送然后这份邮件就能被接收。LCTT灰名单基于这样一个事实就是大多数的垃圾邮件服务器和僵尸网络的邮件只发送一次而会忽略要求它们在一定的时间间隔后再次发送的请求。
灰名单LCTT译注:介于白名单和黑名单之间)是一种用于拦截垃圾邮件的技术。一个 MTA 使用灰名单时就会“暂时拒绝”未被识别的发送者发来的所有邮件。如果邮件是正当合理的发起者会在一段时间后重新发送然后这份邮件就能被接收。LCTT译注:灰名单基于这样一个事实,就是大多数的垃圾邮件服务器和僵尸网络的邮件只发送一次,而会忽略要求它们在一定的时间间隔后再次发送的请求。)
### 问题18邮件系统中 SPF 记录有什么重要作用? ###
SPF 是 Sender Policy Framework 的缩写,用于帮助域的拥有者确认发送方是否来自他们的域,目的是其他邮件系统能够保证发送方在发送邮件时是否经过授权 —— 这种方法可以减小遇到邮件地址欺骗、网络钓鱼和垃圾邮件的风险。
SPF 是 Sender Policy Framework 的缩写,用于帮助邮件域的拥有者确认发送方是否来自他们的域,目的是其他邮件系统能够保证发送方在发送邮件时来自经过授权的来源 —— 这种方法可以减小遇到邮件地址欺骗、网络钓鱼和垃圾邮件的风险。
### 问题19邮件系统中 DKIM 有什么用处? ###
@@ -115,7 +115,7 @@ via: http://www.linuxtechi.com/postfix-interview-questions-answers/
作者:[Pradeep Kumar][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/) 荣誉推出

View File

@@ -1,6 +1,6 @@
如何在 Linux 系统中创建一个云端加密文件系统
如何在 Linux 系统中创建一个云端加密文件系统
================================================================================
[Amazon S3][1] 和 [Google Cloud Storage][2] 之类的商业云存储服务以能承受的价格提供了高可用性、可扩展、无限容量的对象存储服务。为了加速这些云产品的广泛采用,这些提供商为他们的产品基于明确的 API 和 SDK 培养了一个良好的开发者生态系统。而基于云的文件系统便是这些活跃的开发者社区中的典型产品,已经有了好几个开源的实现。
[Amazon S3][1] 和 [Google Cloud Storage][2] 之类的商业云存储服务以能承受的价格提供了高可用性、可扩展、无限容量的对象存储服务。为了加速这些云产品的广泛采用,这些提供商为他们的产品通过明确的 API 和 SDK 培养了一个良好的开发者生态系统。而基于云的文件系统便是这些活跃的开发者社区中的典型产品,已经有了好几个开源的实现。
[S3QL][3] 便是最流行的开源云端文件系统之一。它是一个基于 FUSE 的文件系统,提供了好几个商业或开源的云存储后端,比如 Amazon S3、Google Cloud Storage、Rackspace CloudFiles还有 OpenStack。作为一个功能完整的文件系统S3QL 拥有不少强大的功能:最大 2T 的文件大小、压缩、UNIX 属性、加密、基于写入时复制的快照、不可变树、重复数据删除,以及软、硬链接支持等等。写入 S3QL 文件系统任何数据都将首先被本地压缩、加密,之后才会传输到云后端。当你试图从 S3QL 文件系统中取出内容的时候,如果它们不在本地缓存中,相应的对象会从云端下载回来,然后再即时地解密、解压缩。
@@ -142,7 +142,7 @@ via: http://xmodulo.com/2014/09/create-cloud-based-encrypted-file-system-linux.h
作者:[Dan Nanni][a]
译者:[felixonmars](https://github.com/felixonmars)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@@ -1,24 +1,25 @@
Linux中的鉴别套接字/网络的ss工具示例
Linux中的使用 ss 命令检查套接字/网络连接
================================================================================
ss是iproute2包的一部分控制TCP/IP网络和流量的工具。iproute2目标是替代先前用于配置网络接口路由表和管理ARP表的标准Unix网络工具套装通常称之为“net-tools”。ss工具用于导出套接字统计它可以显示与netstat类似的信息且可以显示更多的TCP和状态信息。它也应该更加快因为它工作与内核空间。ss的操作和netstat很像所以这让它可以很容易就可以取代。
ss是iproute2包的一部分控制TCP/IP网络和流量的工具。iproute2目标是替代先前用于配置网络接口路由表和管理ARP表的标准Unix网络工具套装通常称之为“net-tools”。ss工具用于导出套接字统计它可以显示与netstat类似的信息且可以显示更多的TCP和状态信息。因为它直接从内核空间获取信息,所以会更快。ss的操作和netstat很像所以这让它可以很容易就可以取代。
### 使用和常见选项 ###
ss和netstat很像默认会显示已经建立连接的开放的非监听TCP套接字列表。并且你可以用下面的选项过滤输出
ss和netstat很像默认会显示已经建立连接的开放的非监听TCP套接字列表。并且你可以用下面的选项过滤输出
- **-n** - 尝试解析服务名。
- **-r** - 尝试解析数字地址/端口。
- **-n** - 不要尝试解析服务名。
- **-r** - 尝试解析数字地址/端口。
- **-a** - 显示所有套接字。
- **-l** - 显示监听套接字。
- **-p** - 显示进程人使用套接字。
- **-s** - 打印统计
- **-p** - 显示使用套接字的进程
- **-s** - 打印统计数据
- **-t** - 只显示TCP套接字。
- **-u** - 只显示UDP套接字。
- **-d** - 只显示DCCP套接字
- **-w** - 只显示原始套接字。
- **-w** - 只显示RAW套接字。
- **-x** - 只显示Unix域套接字
- **-f FAMILY** - 显示FAMILY套接字的类型。目前支持下面这些unix、inet、inet6、link、netlink。
- **-A QUERY** - 导出套接字列表通过逗号分隔。可以识别下面的标识符all、inet、tcp、udp、raw、unix、packet、netlink、unix_dgram、unix_stream、packet_raw、packet_dgram。
- **-f FAMILY** - 显示FAMILY套接字的类型。目前支持下面这些族unix、inet、inet6、link、netlink。
- **-A QUERY** - 指定要列出的套接字列表通过逗号分隔。可以识别下面的标识符all、inet、tcp、udp、raw、unix、packet、netlink、unix_dgram、unix_stream、packet_raw、packet_dgram。
- **-o STATUS** - 列出指定状态的套接字
### ss 命令示例 ###
@@ -34,13 +35,13 @@ ss和netstat很像默认他会显示已经建立连接的开放的非监听TC
![ss tnap6](http://blog.linoxide.com/wp-content/uploads/2014/09/ss-tnap6.jpg)
**3.** 跟上面的行为一样,你只需用n代替t就会显示所有开放的UDP端口。
**3.** 跟上面的行为一样,你只需用u代替t就会显示所有开放的UDP端口。
# ss -tnap
# ss -unap
![ss unap](http://blog.linoxide.com/wp-content/uploads/2014/09/ss-unap.jpg)
**4.** 你可以使用-s标志来打印不同的有用的统计:
**4.** 你可以使用-s标志来打印各种有用的统计数据
# ss -s
@@ -58,7 +59,7 @@ via: http://linoxide.com/linux-command/ss-sockets-network-connection/
作者:[Adrian Dinu][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,10 +1,10 @@
UbuTricks - 在ubuntu上安装几个最新游戏和应用的脚本
使用 UbuTricks 在ubuntu上安装最新游戏和应用
===
UbuTricks是一个可以帮助你在ubuntu上安装几个最新版本的游戏和应用的程序。
UbuTricks是一个有简单界面基于Zenity的图形脚本。虽然早期开发中它的目标是通过简单的界面操作来安装Ubuntu14.04 及以后发行版上应用程序的更新。
应用程序会自动下载安装。一些更新可能会需要ppa其它的将会通过编译源代码安装。编译过程可能会需要一些时间当从ppa或者deb文件安装应该会快一点取决于你的下载速度。
应用程序会自动下载安装。一些更新可能会需要ppa其它的将会通过编译源代码安装。编译过程可能会需要一些时间当从ppa或者deb文件安装应该会快一点取决于你的下载速度。
###一共有以下几种安装方式
@@ -29,7 +29,7 @@ UbuTricks是一个有简单界面基于Zenity的图形脚本。虽然早期
- PCManFM
###互联网
###互联网应用
- Geary
- HexChat
@@ -86,7 +86,7 @@ via: http://www.ubuntugeek.com/ubutricks-script-to-install-the-latest-versions-o
作者:[ruchi][a]
译者:[DoubleShit](https://github.com/DoubleShit)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@@ -1,6 +1,6 @@
怎么样称得上是Linux下优秀的命令行计算器
================================================================================
每个现代的Linux桌面发行版都预装着一个带有图形界面的计算器程序。不过如果你的工作区中全是命令行窗口那么你一定会在其中的一个命令行窗口中处理一些数字相关的问题。或许你在寻找一款基于命令行的计算器程序。如果是这样的话[GNU bc][1]“basic calculator”的缩写会是你不二的选择。当然Linux下很多基于命令行的计算器应用我认为GNU bc是功能最强大和最有用的。
每个现代的Linux桌面发行版都预装着一个带有图形界面的计算器程序。不过如果你的工作区中全是命令行窗口那么你一定会在其中的一个命令行窗口中处理一些数字相关的问题。或许你在寻找一款基于命令行的计算器程序。如果是这样的话[GNU bc][1]“basic calculator”的缩写会是你不二的选择。当然Linux下很多基于命令行的计算器应用我认为GNU bc是功能最强大和最有用的。
在GNU时代之前bc实际上是一个著名的精密计算语言。它的诞生要追溯到70年代的Unix时期了。最初bc作为一个语法和C语言相似的编程语言而著名。随着时间的改变最开始的bc演化成POSIX bc最后变成了今天的GNU bc。
@@ -8,19 +8,19 @@
现在的GNU bc是早期bc经过若干次改进和功能增强的结果。目前它被所有的主流GNU/Linux发行版所收纳。GNU bc支持高精度数字和多种数值类型例如二进制、十进制、十六进制的输入输出。
如果你对C语言很熟悉的话你会发现bc使用了和C语言一样或相似的算术操作符。支持的操作符包括算术运算符(+,-,*,/,%,++,--)、比较运算符(<,>,==,!=,<=,>=)、逻辑运算符(!,&&,||)、位运算符(&,|,^,~,<<,>>)和复合赋值运算符(+=,-=,*=,/=,%=,&=,|=,^=,&&=,||=,<<=,>>=。bc内置了很多有用的函数像是平方根、正弦、余弦、反正弦、自然对数、指数等。
如果你对C语言很熟悉的话你会发现bc使用了和C语言一样或相似的算术操作符。支持的操作符包括算术运算符(+, -, *, /, %, ++, --)、比较运算符(<, >, ==, !=, <=, >=)、逻辑运算符(!, &&, ||)、位运算符(&, |, ^, ~, <<, >>)和复合赋值运算符(+=, -=, *=, /=, %=, &=, |=, ^=, &&=, ||=, <<=, >>=。bc内置了很多有用的函数像是平方根、正弦、余弦、反正弦、自然对数、指数等。
### 如何使用GNU bc ###
作为一个基于命令行的计算器GNU bc的使用没有限制。在本文中我会向大家介绍bc命令的几个常用的特性。如果你想要更加详细的指导你可以查阅[官方指南][2]。
作为一个基于命令行的计算器GNU bc的使用没有限制。在本文中我会向大家介绍bc命令的几个常用的特性。如果你想要更加详细的指导你可以查阅[官方指南][2]。
如果你没有一个预先写好的bc脚本那么你需要在交互模式下运行bc。在这种模式下你输入的以回车结束的任何声明或者表达式会被立刻计算出结果。你需要输入以下命令来进入bc的交互界面。如果退出bc你可以输入'quit'并且按回车。
如果你没有一个预先写好的bc脚本那么你可以在交互模式下运行bc。在这种模式下你输入的以回车结束的任何声明或者表达式会被立刻计算出结果。你需要输入以下命令来进入bc的交互界面。如果退出bc你可以输入'quit'并且按回车。
$ bc
![](https://farm4.staticflickr.com/3939/15403325480_d0db97d427_z.jpg)
本文下面展示的例子应该在bc交互界面中输入。
本文下面展示的例子在bc交互界面中输入。
### 输入表达式 ###
@@ -28,15 +28,15 @@
![](https://farm6.staticflickr.com/5604/15403325460_b004b3f8da_o.png)
在一个bc的交互界面中存在没有个数限制的命令历史记录。使用上方向键来查看之前输入的命令。如果你想限制历史记录保存的命令数量你可以将一个名为history的特殊变量设置成你希望的数值。该变量默认为-1也就是“历史记录数量没有限制”。
在一个bc的交互界面中保存着没有个数限制的命令历史记录。使用上方向键来查看之前输入的命令。如果你想限制历史记录保存的命令数量你可以将一个名为history的特殊变量设置成你希望的数值。该变量默认为-1也就是“历史记录数量没有限制”。
### 输入输出进制切换 ###
经常会发生的是你输入一个表达式并且想使用二进制或者十六进制来显示结果。bc允许你在输入输出数字的进制间转换。输入和输出的数系基分别存储在ibase和obase变量中默认值为10有效的数值是2到16或者环境变量BC_BASE_MAX的值.你只需要更改ibase和obase的值就可以在不同进制之间转换了。下面是一个求两个十六进制/二进制数和的例子:
经常会发生的是你输入一个表达式并且想使用二进制或者十六进制来显示结果。bc允许你在输入输出数字的进制间转换。输入和输出的数系基分别存储在ibase和obase变量中默认值为10有效的数值是2到16或者环境变量BC_BASE_MAX的值你只需要更改ibase和obase的值就可以在不同进制之间转换了。下面是一个求两个十六进制/二进制数和的例子:
![](https://farm6.staticflickr.com/5604/15402320019_f01325f199_z.jpg)
需要注意的是我有意地将obase=16放到了ibase=16前面反过来则是不可以的。这个是因为如果我先输入ibase=16那么随后输入的obase=16中的16会被认为是16进制的数字也就是十进制的22。当然这个不是我们所期望的。
需要注意的是我有意地将obase=16放到了ibase=16前面**反过来则是不可以的**。这个是因为如果我先输入ibase=16那么随后输入的obase=16中的16会被认为是16进制的数字也就是十进制的22。当然这个不是我们所期望的。
### 调整精度 ###
@@ -76,7 +76,7 @@ X的指数对数
e(X)
### Other goodies as a language ###
### 当做语言来用 ###
作为一个计算语言GNU bc支持简单的声明变量赋值、中断、返回等、复合语句if、while、for loop等和自定义函数。在这里我不会涉及到这些特性的细节不过你可以通过[官方指南][2]来学习如何使用这些特性。下面是一个简单的函数示例:
@@ -98,7 +98,7 @@ X的指数对数
![](https://farm4.staticflickr.com/3943/15565252976_f50f453c7f_z.jpg)
总结GNU bc是一款强大并且通用的基于命令行的计算器应用因此它绝对不会让你失望。它预装在所有的现代Linux发行版中bc可以让你不用离开命令行就可以进行高效的数学计算。所以GNU bc一定会是你的最爱。
总结GNU bc是一款强大并且通用的基于命令行的计算器应用它绝对不会让你失望。它预装在所有的现代Linux发行版中bc可以让你不用离开命令行就可以进行高效的数学计算。所以GNU bc一定会是你的最爱。
--------------------------------------------------------------------------------
@@ -106,7 +106,7 @@ via: http://xmodulo.com/command-line-calculator-linux.html
作者:[Dan Nanni][a]
译者:[JonathanKang](https://github.com/JonathanKang)
校对:[校对者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 @@
磁盘写满或磁盘不可写解决Linux和UNIX系统这些硬盘问题的8个小贴士
解决八种Linux硬盘问题的技巧
================================================================================
不能在Linux或者类UNIX系统的硬盘上写入数据想解决服务器上磁盘损坏的问题吗想知道你为什么总是在屏幕上看到“磁盘已满”的字眼吗想学习处理这些问题的办法吗试试一下这8个解决Linux及UNIX服务器硬盘问题的小贴士吧。
@@ -95,6 +95,8 @@
# mount -o remount,rw /ftpusers/tmp
LCTT 译注:如果硬盘由于硬件故障而 fallback 到只读模式,建议不要强制变回读写模式,而是赶快替换硬盘)
另外,我是这样[用rw模式重新挂载FreeBSD 9.x服务器的根目录][7]的:
# mount -o rw /dev/ad0s1a /
@@ -111,11 +113,13 @@
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda8 6250496 11568 6238928 1% /ftpusers
所以 /ftpusers 下有总计62,50,496KB大小的索引节点但是只有11,568KB被使用。你可以在 /ftpusers 位置下另外创建62,38,928KB大小的文件。如果你的索引节点100%被使用了,试试看以下的选项:
如上 /ftpusers 下有总计62,50,496KB大小的索引节点但是只有11,568KB被使用。你可以在 /ftpusers 位置下另外创建62,38,928KB大小的文件。如果你的索引节点100%被使用了,试试看以下的选项:
- 找出不想要的文件并删除它,或者把它移动到其它服务器上。
- 找出不想要的大文件并删除它,或者把它移动到其它服务器上。
LCTT 译注:如果一个分区存储了太多的小文件,会出现 inode 用完而存储扇区还有空闲的情况,这种情况下要么清除小文件或在不需要独立访问的情况下将它们打包成一个大文件;要么将数据保存好之后重新分区,并设置分区的 -t news 属性,增加 inode 分配)
### #4 - 我的硬盘驱动器宕了吗? ###
[日志文件中的输入/输出错误(例如 /var/log/messages)][9]说明硬盘出了一些问题并且可能已经失效你可以用smartctl命令来查看硬盘的错误这是一个在类UNIX系统下控制和监控硬盘状态的一个命令。语法如下
@@ -130,15 +134,16 @@
图 01: Gnome磁盘工具(Applications > System Tools > Disk Utility)
> **注意**: 不要对SMART工具期望太高,它在某些状况下无法工作,我们要定期做备份。
> **注意**: 不要对S.M.A.R.T.工具期望太高,它在某些状况下无法工作,我们要定期做备份。
### #5 - 我的硬盘驱动器和服务器是不是太热了? ###
高温会引起服务器低效,所以你需要把服务器和磁盘维持在一个平稳适当的温度,高温甚至能导致服务器宕机或损坏文件系统和磁盘。[用hddtemp或smartctl功能通过从支持此特点的驱动上的SMART技术来读取数据的方式从而查出你的Linux或基于UNIX系统上的硬温度][11]只有现代硬驱动器有温度传感器。hddtemp功能也支持从SCSI驱动器读取SMART信息。hddtemp能作为一个简单的命令行工具或守护程序来从所有服务器中获取信息
高温会引起服务器低效,所以你需要把服务器和磁盘维持在一个平稳适当的温度,高温甚至能导致服务器宕机或损坏文件系统和磁盘。[用hddtemp或smartctl功能通过从支持S.M.A.R.T.功能的硬盘上读取数据的方式从而查出你的Linux或基于UNIX系统上的硬温度][11]只有现代硬驱动器有温度传感器。hddtemp功能也支持从SCSI驱动器读取S.M.A.R.T.信息。hddtemp能作为一个简单的命令行工具或守护程序来从所有服务器中获取信息
hddtemp /dev/DISK
hddtemp /dev/sg0
部分输出内容:
部分输出内容如下
[![](http://s0.cyberciti.org/uploads/cms/2014/10/hddtemp-on-rhel-300x85.jpg)][12]
@@ -150,7 +155,7 @@
#### 我怎么获取CPU的温度 ####
你可以使用Linux硬件监控工具例如像[用基于Linux系统的lm_sensor功能来获取CPU温度][13]
你可以使用Linux硬件监控工具例如像[用基于Linux系统的lm_sensor功能来获取CPU温度][13]
sensors
@@ -162,7 +167,7 @@ Debian服务器的部分输出内容
### #6 - 处理损坏的文件系统 ###
服务器上的文件系统可能会因为硬件重启或一些其它的错误比如坏区而损坏。你可以[用fsck命令来修复损坏的文件系统][15]
服务器上的文件系统可能会因为硬件重启或一些其它的错误比如坏的扇区而损坏。你可以[用fsck命令来修复损坏的文件系统][15]
umount /ftpusers
fsck -y /dev/sda8
@@ -251,7 +256,7 @@ via: http://www.cyberciti.biz/datacenter/linux-unix-bsd-osx-cannot-write-to-hard
作者:[nixCraft][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,14 +1,14 @@
Linux服务器监控和排障利器sysdig
系统之锹sysdigLinux服务器监控和排障利器
================================================================================
当你需要追踪某个进程产生和接收的系统调用时首先浮现在你脑海中的是什么你可能会想到strace那么你是对的。你会使用什么样的命令行工具来监控原始网络通信呢如果你想到了tcpdump你又作出了一个极佳的选择。而如果你碰到必须追踪打开的文件在Unix意义上一切皆文件的需求可能你会使用lsof。
strace、tcpdump以及lsof确实是些伟大的工具它们应该成为每个系统管理员工具集中的一部分而这也正是你为什么爱上[sysdig][1]的原因。它是一个强大的开源工具用于系统级别的勘察和排障它的创建者在介绍它时称之为“strace+tcpdump+lsof+上面点缀着lua樱桃的绝妙酱汁”。抛开幽默不说sysdig的最棒特性之一在于它不仅能分析Linux系统的“存活”状态也能将该状态保存为转储文件以供离线检查。更重要的是你可以自定义sysdig的行为或者甚至通过内建的你也可以自己编写名为凿子的小脚本增强其功能。单独的凿子可以脚本指定的各种风格分析sysdig捕获的事件流。
strace、tcpdump以及lsof确实是些伟大的工具它们应该成为每个系统管理员工具集中的一部分,而这也正是你为什么应该爱上[sysdig][1]的原因。它是一个强大的开源工具用于系统级别的勘察和排障它的创建者在介绍它时称之为“strace+tcpdump+lsof+上面点缀着lua樱桃的绝妙酱汁”。抛开幽默不说sysdig的最棒特性之一在于它不仅能分析Linux系统的“现场”状态也能将该状态保存为转储文件以供离线检查。更重要的是你可以自定义sysdig的行为或者甚至通过内建的你也可以自己编写名为凿子chisel的小脚本增强其功能。单独的凿子可以脚本指定的各种风格分析sysdig捕获的事件流。
在本教程中我们将探索sysdig的安装及其基本用法在Linux上实施系统监控和排障。
### 安装Sysdig ###
对于本教程,由于为了简便、缩短安装流程以及版本不可知,我们将选择使用官方网站提供的自动化安装过程。在自动化过程中,安装脚本会自动检测操作系统并安装必需的依赖包。
对于本教程,由于为了简便、缩短安装流程以及版本不可知,我们将选择使用官方网站提供的自动化安装过程。在自动化过程中,安装脚本会自动检测操作系统并安装必需的依赖包。
以root身份运行以下命令来从官方apt/yum仓库安装sysdig
@@ -20,7 +20,7 @@ strace、tcpdump以及lsof确实是些伟大的工具它们应该成为每
# sysdig
我们的屏幕将马上被系统上发生的所有事件填满,对于这些信息,我们不能做更多操作。要进一步处理,我们可以运行:
我们的屏幕将马上被系统上发生的所有事件填满,对于这些信息,不便于我们做更多操作。要进一步处理,我们可以运行:
# sysdig -cl | less
@@ -28,7 +28,6 @@ strace、tcpdump以及lsof确实是些伟大的工具它们应该成为每
![](https://farm4.staticflickr.com/3938/15334678610_e5956a26e8_z.jpg)
The following categories are available by default, each of which is populated by multiple built-in chisels.
默认有以下类目可用,各个类目中分布有多个内建的凿子。
- CPU UsageCPU使用量
@@ -43,7 +42,7 @@ The following categories are available by default, each of which is populated by
要显示指定凿子上的信息(包括详细的命令行用法),运行以下命令:
# sysdig -cl [chisel_name]
# sysdig -cl [凿子名称]
例如我们可以检查“网络”类目下关于spy_port凿子的信息
@@ -51,14 +50,14 @@ The following categories are available by default, each of which is populated by
![](https://farm4.staticflickr.com/3945/15521424095_0365bf20c3_z.jpg)
凿子可以通过过滤器(可同时应用于存活数据和记录文件)组合,以获取更多有用的输出。
凿子可以通过过滤器(可同时应用于实时数据和记录文件)组合,以获取更多有用的输出。
过滤器遵从“类.字段”结构。例如:
- **fd.cip**客户端IP地址。
- **evt.dir**:事件方向,可以是‘>’用于进入事件,或‘<’用于退出事件。
成得过滤器列表可以通过以下命令显示:
整的过滤器列表可以通过以下命令显示:
# sysdig -l
@@ -68,7 +67,7 @@ The following categories are available by default, each of which is populated by
假定你的服务器发生了性能问题没有回应或者重大的回应延迟。你可以使用瓶颈凿子来显示当前10个最慢系统调用的列表。
使用以下命令在存活服务器上进行实时检查。“-c”标识后跟凿子名告诉sysdig运行指定的凿子。
使用以下命令在存活服务器上进行实时检查。“-c”标识后跟凿子名告诉sysdig运行指定的凿子。
# sysdig -c bottlenecks
@@ -84,7 +83,7 @@ The following categories are available by default, each of which is populated by
![](https://farm6.staticflickr.com/5611/15334678670_ebbe93265e_z.jpg)
要关注栏#2#3和#4这些分别表示执行时间、进程名和PID。
要关注栏#2#3和#4这些分别表示执行时间、进程名和PID。
### Sysdig实例 监控交互用户活动 ###
@@ -130,7 +129,7 @@ The following categories are available by default, each of which is populated by
# sysdig -s 4096 -A -c echo_fds fd.cip=192.168.0.100 -r /mnt/sysdig/debian.scap.gz proc.name=apache2
如果你想要监控原生数据传输(二进制格式),请“-A”替换“-X”
如果你想要监控原生数据传输(二进制格式),请“-A”替换“-X”
# sysdig -s 4096 -X -c echo_fds fd.cip=192.168.0.100 -r /mnt/sysdig/debian.scap.gz proc.name=apache2
@@ -142,7 +141,7 @@ via: http://xmodulo.com/monitor-troubleshoot-linux-server-sysdig.html
作者:[Gabriel Cánepa][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@@ -1,18 +1,19 @@
Qshutdown 一个先进的关机神器
================================================================================
qshutdown是一个QT程序用于让计算机在指定时间或者在几分钟后关机/重启/挂起/睡眠。它会一直显示时间直到相应的请求被发送到Gnome或KDE会话管理器或者发送到HAL或DeviceKit。而如果这一切都没有发生将会使用sudo shutdown -P now进行关机。对于那些只在特定时间使用计算机工作的人而言,可能很有用。
qshutdown是一个QT程序用于让计算机在指定时间或者在几分钟后关机/重启/挂起/睡眠。对于那些只在特定时间使用计算机工作的人而言,可能很有用。
qshutdown将在最后70秒时显示3次警告提醒。如果设置了1分钟或者本地时间+1它只会显示一次。
![](http://www.ubuntugeek.com/wp-content/uploads/2014/11/12.png)
该程序使用qdbus来发送关机/重启/挂起/睡眠请求到gnome或kde会话管理器或者到HAL或DeviceKit而如果这些都没有工作那么就会使用sudo shutdown命令进行关机注意但发送请求到HAL或DeviceKit或者使用shutdown命令时会话不会被保存。如果使用shutdown命令该程序只会被关机或重启。所以如果在shutdown或reboot时间到时什么都没发生这就意味着用户缺少使用shutdown命令的权限。
qshutdown将在最后70秒时显示3次警告提醒。如果设置了1分钟或者“本地时间+1”它只会显示一次。
该程序使用qdbus来发送关机/重启/挂起/睡眠请求到gnome或kde会话管理器或者到HAL或DeviceKit而如果这些都没有工作那么就会使用sudo shutdown -P now命令进行关机注意当发送请求到HAL或DeviceKit或者使用shutdown命令时会话不会被保存。如果使用shutdown命令该程序只会被关机或重启。所以如果在shutdown或reboot时间到时却什么都没发生这就意味着用户缺少使用shutdown命令的权限。
在这种情况下,你可以进行以下操作:
粘贴以下信息到终端“EDITOR:nano sudo -E visudo”并添加此行“* ALL = NOPASSWD:/sbin/shutdown”这里*替换username或%groupname
粘贴以下信息到终端“EDITOR:nano sudo -E visudo”并添加此行“* ALL = NOPASSWD:/sbin/shutdown”这里*替换为你的“用户名”或“%组名”
配置文件qshutdown.conf
倒计时最大计数为1440分钟24小时。配置文件和日志文件位于~/.qshutdown。
倒计时最大计数为1440分钟24小时。配置文件和日志文件位于~/.qshutdown配置文件为qshutdown.conf
对于管理员:
@@ -26,7 +27,6 @@ qshutdown将在最后70秒时显示3次警告提醒。如果设置了1分钟
### 屏幕截图 ###
![](http://www.ubuntugeek.com/wp-content/uploads/2014/11/12.png)
![](http://www.ubuntugeek.com/wp-content/uploads/2014/11/23.png)
@@ -40,7 +40,7 @@ via: http://www.ubuntugeek.com/qshutdown-an-avanced-shutdown-tool.html
作者:[ruchi][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@@ -2,21 +2,21 @@
================================================================================
![](http://www.linuxinsider.com/ai/769827/microsoft-linux-open-source.jpg)
**开源.Net“这与Linux无关——它与SaaS相关也和一位并不偏执和狂热的90后CEO相关”SoylentNews博主hairyfeet道“纳德拉很明智而且意识到了编程语言的价值不在于专利或OS排他性而在于服务和对语言的支持……越多的平台使用该语言它就会越好。”**
**开源.Net“这与Linux无关——它与SaaS相关也和一位并不偏执和狂热的90后CEO相关”SoylentNews博主hairyfeet道“纳德拉很明智而且意识到了编程语言的价值不在于专利或OS排他性而在于服务和对语言的支持……越多的平台使用该语言它就会越好。”**
如果自由和开源软件迷们在过去的几天里感到有些许困惑的话,他们也许可能会被原谅的,头昏、头痛以及头晕也会显得司空见惯了
如果自由和开源软件迷们在过去的那些日子里感到有些许困惑的话,这也许是可以理解的,即便是头昏、头痛以及头晕也算是常见的
你或许会问,这又是什么新的病症?
好吧Linux女孩很高兴告诉你它不是什么病症。那个,然而它并不意味着它很容易治愈。
好吧Linux女孩很高兴告诉你它不是什么病症。不过,然而它并不意味着它很容易治愈。
原因无他,而是微软开源.Net并让它可以在Linux或Mac OS上运行的消息。
是的,你没听错:史蒂夫·鲍尔默曾经可能[称Linux为“癌症”][1],但今天雷蒙德有个新发现,曾经不被包容的[对Linux的“爱”][2]!
是的,你没听错:史蒂夫·鲍尔默曾经可能[称Linux为“癌症”][1],但今天雷蒙德(微软总部,代称微软)有个新发现,曾经不被包容的,但是却转头[“爱”上了Linux][2]!
它让微软表现出新的奇怪方式——它也驱使FOSS迷们聚拢到博客圈的破败的Broken Windows Lounge数量更是空前。
它让微软看起来很奇怪——它也驱使FOSS迷们聚拢到博客圈的破败的Broken Windows Lounge而去的人的数量更是空前
龙舌兰可以赋予它全部的意义么?这是现在众多调查的问题之一。
一杯龙舌兰可以让你不再头疼么?这是现在众多探究的问题之一。
### ‘繁荣的机遇’ ###
@@ -24,9 +24,9 @@
![](http://www.linuxinsider.com/images/article_images/linuxgirl_bg_pinkswirl_150x245.jpg)
“我们生活的世界中,即使没有大的商业公司支持,新的开源编程语言也很兴旺,而关闭的开源编程语言也仅仅在大的商业公司的帮助下摆脱了困境”特拉弗斯说“例如Bing闭源杀死了REBOL 2.x。”
“我们生活的世界中,即使没有大的商业公司支持,新的开源编程语言也很兴旺,而闭源的编程语言仅在大的商业公司的帮助下得到支持”特拉弗斯说“例如Bing闭源杀死了REBOL 2.x。”
“这项运动很明显酝酿已久——一家像微软这样庞大的公司没有突然开源这种复杂的东西——而我想在某种程度上微软一定看到了Sun开源OpenJDK时的不祥之兆了。”他暗示道。
“这项运动很明显酝酿已久——一家像微软这样庞大的公司不会有‘突然开源这种复杂的东西——而我想在某种程度上微软一定看到了Sun开源OpenJDK时的一些前兆了。”他暗示道。
同时“这也为诸如C#和F#这样的语言提供了比当前市场更为兴盛的机会,”特拉弗斯说。
@@ -40,7 +40,7 @@
此外,微软不会作出任何保证,保证.Net常年开源他指出。
“这意味着微软可以退出并让开发出来的应用程序成为跨平台的Windows专有软件”他警告道“我不会相信微软的承诺我会翘首期盼微软他们的突然而无可避免的背叛。”
“这意味着微软可以退出并让开发出来的应用程序成为跨平台的Windows专有软件”他警告道“我不会相信微软的承诺我会翘首期盼微软他们的突然而必然的背叛。”
### ‘留心不怀好意的礼物’ ###
@@ -48,7 +48,7 @@
“他们来得太晚了”埃伯索尔说“Java已经先下手为强了当.Net还是Windows/Microsoft专有产品时Java已经遍布四处了。试着让人采用希望好运吧。”
此外,“我只相信它被打上GPL烙印来保护代码创建者”他补充道“一个脆弱的MIT许可证任何时候都是逆天而行的。”
此外,“如果它打上GPL烙印来保护代码创建者的话我才会相信它”他补充道“一个脆弱的MIT许可证任何时候都是逆天而行的。”
无论如何“在该公司产生的对FLOSS社区的全部的敌意下他们会过河拆桥”埃伯索尔总结道“底线是送礼的希腊人也很可畏——仔细留心希腊人不怀好意的礼物……”
@@ -66,7 +66,7 @@
“在我的最后一份职业中大多数的程序员想要Eclipse而不是Visual Studio即使客户端软件是Windows专用的。用Windows做测试的开发者们迁移到Linux的数量在缓慢增长。”麦克回忆道。
“很要有人想被锁进一个平台中,因此更多的精神占有率正在从单一平台语言中逃离,”他补充道,“微软现在必须在适应与灭亡中作出选择。”
“很要有人想被固定在一个平台中,因此单一平台语言的份额会越来越少,”他补充道,“微软现在必须在适应与灭亡中作出选择。”
### 这里没有温暖的毛球 ###
@@ -84,7 +84,7 @@
总得来说一切都很明了那就是“微软帝国正在摇摇欲坠”Google+博主贡萨洛·维拉斯科 C说。
“我不知道或者不关心他们为什么会说谎说他们热爱Linux”他补充道“我只希望GNU/Linux社区变得比现今更聪明些Systemd),拒绝微软.Net和其它产生影响的东西。GNU/Linux必须只用FLOSS工具。”
“我不知道或者不关心他们为什么会说谎说他们热爱Linux”他补充道“我只希望GNU/Linux社区变得比现今更聪明些Systemd),拒绝微软.Net和其它产生影响的东西。GNU/Linux必须只用FLOSS工具。”
--------------------------------------------------------------------------------
@@ -92,7 +92,7 @@ via: http://www.linuxinsider.com/story/When-Microsoft-Went-A-Courting-81374.html
作者:[Katherine Noyes][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@@ -1,14 +1,14 @@
15条Linux下的pwd命令(打印工作目录)示例
菜鸟教程:全面学习 pwd 命令
================================================================================
对于那些使用Linux命令行的人来说**pwd**‘命令是非常有用的,它告诉你你现在在那个目录,从根目录(**/**)开始。特别对于或许会在目录的切换间容易糊涂的Linux新手而言**pwd** 可以拯救他们。
对于那些使用Linux命令行的人来说**pwd**‘命令是非常有用的,它告诉你你现在在那个目录,从根目录(**/**)如何到达。特别对于或许会在目录的切换间容易糊涂的Linux新手而言**pwd** 可以拯救他们。
![15 pwd Command Examples](http://www.tecmint.com/wp-content/uploads/2014/11/pwd-command.png)
15 pwd 命令示例
*15 pwd 命令示例*
### 什么是pwd? ###
**pwd** 代表的是‘**Print Working Directory**’(打印当前目录)。如它的名字那样,‘**pwd**’会打印出当前工作目录或仅是目录用户。它会打印出以root (**/**)为起的完整目录名。这条命令是一条shell内建命令并且在大多数shell中都可以使用如bash、Bourne shellksh、zsh等等。
**pwd** 代表的是‘**Print Working Directory**’(打印当前目录)。如它的名字那样,‘**pwd**’会打印出当前工作目录,或简单的来说就是当前用户所位于的目录。它会打印出以根目录 (**/**)为起的完整目录名(绝对目录)。这条命令是一条shell内建命令并且在大多数shell中都可以使用如bash、Bourne shellksh、zsh等等。
#### pwd的基本语法: ####
@@ -25,11 +25,11 @@
<td align="LEFT" style="border: 1px solid #000000;"><b><span style="font-size: small;">&nbsp;描述</span></b></td>
</tr>
<tr>
<td height="19" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Liberation Serif,Times New Roman; font-size: small;">&nbsp;-L (logical)</span></td>
<td height="19" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Liberation Serif,Times New Roman; font-size: small;">&nbsp;-L (即逻辑路径logical )</span></td>
<td align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Liberation Serif,Times New Roman; font-size: small;">&nbsp;使用环境中的路径,即使包含了符号链接</span></td>
</tr>
<tr>
<td height="19" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Liberation Serif,Times New Roman; font-size: small;">&nbsp;-P (physical)</span></td>
<td height="19" align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Liberation Serif,Times New Roman; font-size: small;">&nbsp;-P (即物理路径physical)</span></td>
<td align="LEFT" style="border: 1px solid #000000;"><span style="font-family: Liberation Serif,Times New Roman; font-size: small;">&nbsp;避免所有的符号链接</span></td>
</tr>
<tr>
@@ -56,7 +56,7 @@ pwd的退出状态:
<td align="CENTER" style="border: 1px solid #000000;"><span style="font-size: small;">成功</span></td>
</tr>
<tr>
<td height="19" align="CENTER" style="border: 1px solid #000000;"><span style="font-size: small;">Non-zero</span></td>
<td height="19" align="CENTER" style="border: 1px solid #000000;"><span style="font-size: small;">非零值</span></td>
<td align="CENTER" style="border: 1px solid #000000;"><span style="font-size: small;">失败</span></td>
</tr>
</tbody>
@@ -64,7 +64,7 @@ pwd的退出状态:
本篇的目的是采用例子让你对‘**pwd**‘有更深入的领悟。
**1.** 打印放钱工作目录.
**1.** 打印当前工作目录.
avi@tecmint:~$ /bin/pwd
@@ -72,7 +72,7 @@ pwd的退出状态:
![Print Working Directory](http://www.tecmint.com/wp-content/uploads/2014/11/pwd.gif)
打印工作目录
*打印工作目录*
**2.** 为文件夹创建一个符号链接比如说在home目录下创建一个**htm**链接指向**/var/www/html**)。进入新创建的目录并打印出含有以及不含符号链接的目录。
@@ -83,9 +83,9 @@ pwd的退出状态:
![Create Symbolic Link](http://www.tecmint.com/wp-content/uploads/2014/11/Create-Symbolic-Link.gif)
创建符号链接
*创建符号链接*
**3.** 从当前环境中答应目录即使它含有符号链接。
**3.** 从当前环境中打印目录即使它含有符号链接。
avi@tecmint:~$ /bin/pwd -L
@@ -93,7 +93,7 @@ pwd的退出状态:
![Print Current Working Directory](http://www.tecmint.com/wp-content/uploads/2014/11/Print-Working-Directory.gif)
打印工作目录
*打印工作目录*
**4.** 解析符号链接并打印出物理目录。
@@ -103,7 +103,7 @@ pwd的退出状态:
![Print Physical Working Directory](http://www.tecmint.com/wp-content/uploads/2014/11/Print-Physical-Working-Directory.gif)
打印物理工作目录
*打印物理工作目录*
**5.** 查看一下“**pwd**”和“**pwd -P**”的输出是否一致,也就是说,如果没有跟上选项,“**pwd**”时候会自动采用**-P**选项。
@@ -113,7 +113,7 @@ pwd的退出状态:
![Check pwd Output](http://www.tecmint.com/wp-content/uploads/2014/11/Check-pwd-Output.gif)
检查pwd输出
*检查pwd输出*
**结论:** 上面例子4和5的输出很明显结果相同当你“**pwd**”后面不带参数时pwd会使用“**-P**”选项。
@@ -131,7 +131,7 @@ pwd的退出状态:
![Check pwd Version](http://www.tecmint.com/wp-content/uploads/2014/11/Check-pwd-Version.gif)
检查pwd命令版本
*检查pwd命令版本*
**注意:** pwd 通常不带选项运行,且没有任何参数
@@ -148,9 +148,9 @@ pwd的退出状态:
![Print Executable Locations](http://www.tecmint.com/wp-content/uploads/2014/11/Print-Executable-Locations.gif)
打印可执行文件路径
*打印可执行文件路径*
**8.** 存储“**pwd**”命令的值到变量中(比如说:**a** ),并从中打印i变量的值对于观察shell脚本很重要
**8.** 存储“**pwd**”命令的值到变量中(比如说:**a** 并从中打印变量的值对于观察shell脚本很重要
avi@tecmint:~$ a=$(pwd)
avi@tecmint:~$ echo "Current working directory is : $a"
@@ -159,19 +159,19 @@ pwd的退出状态:
![Store Pwd Value in Variable](http://www.tecmint.com/wp-content/uploads/2014/11/Store-Pwd-Value-in-Variable.gif)
存储pwd的值到变量中
*存储pwd的值到变量中*
下面的例子中也可以用**printf**来替代。
**9.** 将工作路径切换到其他地方(比如说 **/home**),并在命令行中显示。通过执行命令(比如说 **ls**‘)来验证一切**OK**。
avi@tecmint:~$ cd /home
avi@tecmint:~$ PS1='$pwd> ' [Notice single quotes in the example]
avi@tecmint:~$ PS1='$pwd> ' [注意例子中的单引号]
> ls
![Change Current Working Directory](http://www.tecmint.com/wp-content/uploads/2014/11/Change-Current-Working-Directory.gif)
改变当前工作路径
*改变当前工作路径*
**10.** 设置多行显示 (就像下面这样),
@@ -190,7 +190,7 @@ pwd的退出状态:
![Set Multi Commandline Prompt](http://www.tecmint.com/wp-content/uploads/2014/11/Set-Multi-Commandline-Prompt.gif)
设置多行显示
*设置多行显示*
**11.** 一下子检查当前工作路径以及先前的工作路径。
@@ -200,8 +200,7 @@ pwd的退出状态:
![Check Present Previous Working Directory](http://www.tecmint.com/wp-content/uploads/2014/11/Check-Present-Previous-Working-Directory.gif)
Check Present Previous Working Directory
检查当前工作路径
*检查当前工作路径*
**12.** pwd文件的绝对路径以**/**开始)。
@@ -211,7 +210,7 @@ Check Present Previous Working Directory
/usr/include/pwd.h
**13.** 打印pwd手册的绝对路径以**/**开始)。
**13.** pwd手册的绝对路径以**/**开始)。
/usr/share/man/man1/pwd.1.gz
@@ -241,7 +240,7 @@ Check Present Previous Working Directory
}
fi
给予执行权限并运行。
给予执行权限并运行。
avi@tecmint:~$ chmod 755 pwd.sh
avi@tecmint:~$ ./pwd.sh
@@ -251,7 +250,7 @@ Check Present Previous Working Directory
#### 总结 ####
**pwd**是一个最简单且会广泛用到的命令。掌握好pwd是使用Linux终端的基础。就是这些了。我很快会再带来另外有趣的注意,请不要走开继续关注Tecmint
**pwd**是一个最简单且会广泛用到的命令。掌握好pwd是使用Linux终端的基础。就是这些了。我很快会再带来另外有趣的文章,请不要走开继续关注我们
--------------------------------------------------------------------------------
@@ -259,7 +258,7 @@ via: http://www.tecmint.com/pwd-command-examples/
作者:[Avishek Kumar][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,8 +1,8 @@
Linux 有问必答 -- 如何从VirtualBox中从主机访问NAT客户机
Linux 有问必答如何从VirtualBox中从主机访问NAT客户机
================================================================================
> **提问**: 我有一台运行在VirtualBox上的使用NAT的虚拟机因此虚拟机会被VirtualBox分配一个私有IP地址(10.x.x.x)。如果我想要从主机SSH到虚拟机中我该怎么做
> **提问**: 我有一台运行在VirtualBox上的使用NAT的虚拟机因此虚拟机会被VirtualBox分配一个私有IP地址(10.x.x.x)。如果我想要从主机SSH到虚拟机中我该怎么做
VirtualBox对虚拟机支持几种不同的网络方式其中一种是NAT网络。当虚拟机启用NAT后VirtualBox会自动在虚拟机和主机之间进行网络翻译因此你不必在虚拟机和主机之间配置任何东西。这也意味着NAT中的虚拟机对于外部网络以及主机本身是不可见的。这会在你想要从主机访问虚拟机时会产生问题比如SSH
VirtualBox对虚拟机支持几种不同的网络方式其中一种是NAT网络。当虚拟机启用NAT后VirtualBox会自动在虚拟机和主机之间进行网络翻译因此你不必在虚拟机和主机之间配置任何东西。这也意味着NAT中的虚拟机对于外部网络以及主机本身是不可见的。这会在你想要从主机访问虚拟机时会产生问题比如SSH
如果你想从VirtualBox的NAT环境的虚拟机你可以在GUI或者命令行下启用VirtualBox NAT的端口转发。本篇教程将会演示**如何通过启用22端口转发而从主机SSH连接到NAT环境的客户机**。如果你先想要从HTTP访问NAT的客户机用80端口代替22端口即可。
@@ -62,6 +62,6 @@ VirtualBox有一个称为VBoxManage的命令行管理工具。使用命令行工
via: http://ask.xmodulo.com/access-nat-guest-from-host-virtualbox.html
译者:[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,49 +1,48 @@
什么造就一个优秀的程序员?
什么造就一个优秀的程序员?
================================================================================
是什么造一个优秀的程序员?首先问问你自己吧,这会是个有趣的问题。它让你反思自己软件开发的能力。这个问题也适合问问你的同事。它可以带来一些关于如何协同工作的有趣讨论。下面是五个我认为成为一个优秀程序员必备的重要技能。
是什么造就了一个优秀的程序员?首先问问你自己吧,这会是个有趣的问题。它让你反思自己软件开发技术。这个问题也适合问问你的同事。它可以带来一些关于如何协同工作的有趣讨论。下面是我认为成为一个优秀程序员必备的五个重要技能。
### 1. 分解问题 ###
编程是为了解决问题,但在你开始写代码前,需要明白如何解决问题。优秀程序员的一项技能是把大的问题逐层分解成一个个更小的部分,直到每一部分都可以很容易解决。但找到解决问题的方式往往并没有那么简单。优秀程序员能找到方法去建立问题模型,这种方法使得输出结果的程序容易解释、实现和测试。
我写过的某些最复杂的程序在局部上都是难懂的,因为代码实现并不能很好地描述问题,也就导致了编写的代码难以理解。当问题很好建模的时候,我赞同伯尼·科赛尔所说的话(取自著名的[程序员在工作][1]中的访谈记录):
我写过的某些最复杂的程序在局部上都是难懂的,因为代码实现并不能很好地匹配这个问题,也就导致了编写的代码难以理解。当问题很好建模的时候,我赞同伯尼·科赛尔所说的话(取自著名的[程序员在工作][1]中的访谈记录):
> “……很少有本质上很难的程序。如果你盯着某一块代码,它看起来确实很难;如果你无法理解某件事情应该产生什么结果,这基本上就暗示这件事情很难思考清楚了。在这个时候,你不应该卷起袖子,尝试修复代码;你需要只是往回一步,再仔细考虑清楚。当你已经深思熟虑后,你会发现问题变得很简单”。
> “……很少有本质上很难的程序。如果你盯着某一块代码,它看起来确实很难;如果你无法理解这段代码应该产生什么结果,这基本上就暗示它很难被理解了。在这个时候,你不应该卷起袖子,尝试修复代码;你需要只是往回一步,再仔细考虑清楚。当你已经深思熟虑后,你会发现问题变得很简单”。
### 2. 场景分析 ###
优秀开发者能考虑到如何使程序适合多种不同的场景。这项能力既适用于处理程序本身的逻辑,又适用于处理发生的外部和内部事件。为了考虑逻辑上的不同思路,他们问自己这样的问题:如果这个参数为空会发生什么?如果所有条件都为假呢?这个方法在线程上是安全的吗?为了发现软件需要处理的各种类型的事件,他们问自己这样的问题:如果队列占满了会怎样?如果请求收不到响应会怎样?如果在这台服务器重启的同时另外一台服务器也重启了会怎样?
优秀开发者能考虑到如何使程序适合多种不同的场景。这项能力既适用于处理程序本身的逻辑,又适用于处理可能会发生的外部和内部事件。为了考虑逻辑上的不同思路,他们问自己这样的问题:如果这个参数为空会发生什么?如果所有条件都为假呢?这个方法在线程上是安全的吗?为了发现软件需要处理的各种类型的事件,他们问自己这样的问题:如果队列占满了会怎样?如果请求收不到响应会怎样?如果在这台服务器重启的同时另外一台服务器也重启了会怎样?
优秀程序员问他们自己:如何打破自己的程序?换句话说,他们有能力像测试人员一样思考。相反,缺少经验的程序员通常只考虑正确的路径——在一切都按照预期进行时正常的控制流(当然这也是程序在大部分时候做的事情)。当然,异常不可避免要发生,所以需要程序能处理这些情况。
优秀程序员问他们自己:如何发现程序的缺陷?换句话说,他们有能力像测试人员一样思考。相反,缺少经验的程序员通常只考虑正确的路径——在一切都按照预期进行时正常的控制流(当然这也是程序在大部分时候的情况)。当然,异常不可避免要发生,所以需要程序能处理这些情况。
### 3. 命名 ###
编程由大量的命名对象组成:类、方法和变量。当编码完成时,程序也具备了自我描述的能力,也就是说通过阅读源代码可以清楚地明白程序中函数的含义。自描述代码的一个好处就是很自然地产生许多体积更小的方法,而不是少数体积大的方法,因为你有更多空间去放置有意义的名字(还有[其它原因][2]解释为什么短小方法更好)。
编程由大量的命名对象组成:类、方法和变量。当编码完成得很好时,程序也具备了自我描述的能力,也就是说通过阅读源代码可以清楚地明白程序中函数的含义。自描述代码的一个好处就是很自然地产生许多更短的命名方法,而不是少数更长的方法,因为你有更多空间去放置有意义的名字(还有[其它原因][2]解释为什么短小方法更好)。
想出好的名字比它听起来更困难一些。我喜欢这段引用(来自菲尔·卡尔顿):“在计算机科学领域只有两件困难的事情:缓存失效和命名对象。”命名在一定程度上很困难是因为你需要清楚地明白每一个名字究竟要代表什么。有时候命名不是清楚,只有随着软件开发进展才会慢慢显现。因此,重命名和命名一样重要。
想出好的名字比它听起来更困难一些。我喜欢这段引用(来自菲尔·卡尔顿):“在计算机科学领域只有两件困难的事情:缓存失效和命名对象。”命名在一定程度上很困难是因为你需要清楚地明白每一个名字究竟要代表什么。有时候命名不是一下子就清晰明了,只有随着软件开发进展才会慢慢显现。因此,重命名和命名一样重要。
命名对象也包含提出要用的概念和这些概念该如何称呼。通过深思熟虑,清楚命名所使用的惯用概念(在程序中和与程序员、非程序员讨论时使用),这使得编写程序变得更加容易。
### 4. 一致性 ###
也许编程中最大的挑战是管理复杂性。保持一致性是处理复杂性的一种方法。它通过允许我们看到对象命名、使用和处理所采用的模式和推理来降低了某些复杂性。有了一致性,我们就无需用脑去记住异常和随机变量。取而代之,我们可以更关注[程序本身的复杂性,而不是偶然产生的复杂性][3]。
也许编程中最大的挑战是管理复杂性。保持一致性是处理复杂性的一种方法。它通过允许我们看到对象命名、使用和处理所采用的模式和推理来降低了某些复杂性。有了一致性,我们就无需用脑去记住异常和随机变量。取而代之,我们可以更关注[程序本身的复杂性,而不是偶然产生的复杂性][3]。
保持一致性是很重要的。它应用在变量名字和分组、方法命名、模块划分、目录结构、GUI、错误处理、日志输出和文档等很多方面。比如如果某些变量是的相关并一起出现在声明、方法调用或数据库中的列而且总是以相同的顺序使用它们。那么当其中一个消失或者整体被打乱时你就会很容易发现。对于一个操作如果在一个地方叫delete就不要在另一个地方叫remove务必使用相同的名字。史蒂夫·麦克奈尔在[代码大全][4]中对于使用相反命名有相同的建议。比如begin和end是相反的就如同start和stop一样。当使用相反对时不要混用不同对的名字比如使用begin和stop
保持一致性从整体看来是很重要的。它应用在变量名字和分组、方法命名、模块划分、目录结构、GUI、错误处理、日志输出和文档等很多方面。比如如果某些变量是的相关并一起出现在声明、方法调用或数据库中的列而且总是以相同的顺序使用它们。那么当其中一个消失或者整体被打乱时你就会很容易发现。对于一个操作如果在一个地方叫delete就不要在另一个地方叫remove务必使用相同的名字。史蒂夫·麦克奈尔在[代码大全][4]中对于使用相反命名有相同的建议。比如begin和end是相反的就如同start和stop一样。当使用相反对时不要混用不同对的名字比如使用begin和stop
当修改一段程序时可能会引入非一致性。粗心大意的程序员不会注意到他们添加的代码是否和已有的代码保持一致。优秀程序员会严苛地确保在这些看似很小的细节上都要做得恰到好处。他们知道保持一致性对于在软件开发的整个过程中处理复杂性是多么的重要。
当修改一段程序时可能会引入非一致性。粗心大意的程序员不会注意到他们添加的代码是否和已有的代码保持一致。优秀程序员会严苛地确保在这些看似很小的细节上都要做到精益求精。他们知道保持一致性对于在软件开发的整个过程中处理复杂性是多么的重要。
### 5. 学习能力 ###
作为一名软件开发者,你需要持续学习。在为软件添加一项新功能前,你必须明白为什么要这么做。在给一个已有程序添加代码前,你通常必须学习已有代码在做什么,以便合适地嵌入新功能。你还需要学习相关系统,以便正确地与它们交互。因此,快速学习的能力使你成为一名更加高效的开发者。
作为一名软件开发者,你需要持续学习。在为软件添加一项新功能前,你必须明白为什么要这么做。在给一个已有程序添加代码前,你通常必须知道已有代码在做什么,以便合适地嵌入新功能。你还需要学习相关系统,以便正确地与它们交互。因此,快速学习的能力使你成为一名更加高效的开发者。
而且,因为软件工程领域的开发速度是如此的快速,所以新的编程语言、工具、技术和框架需要学习层出不穷。这是好还是坏,就看你怎么看。佛瑞德·布鲁克斯把学习能力列为[技能的快乐之一][5],对此我深表赞同。学习新事物本身就是令人心满意足的,它也意味着开发者的生活从不无聊。
### 总结 ###
上面所有的技能都是通用的——它们中没有一项是针对某种语言、某个框架或某种技术。如果你拥有它们,你就能快速学习一门新的语言或工具,在新的环境下写出优秀的软件。而且,因为它们在本质上是通用的,所以不会在若干年以后变得不实用
上面所有的技能都是通用的——它们中没有一项是针对某种语言、某个框架或某种技术。如果你拥有它们,你就能快速学习一门新的语言或工具,在新的环境下写出优秀的软件。而且,因为它们在本质上是通用的,所以不会在若干年以后过时
这就是我对什么因素造就一个优秀程序员的回答。你认为造就一个优秀程序员的因素哪些?在评论里让我知道吧。
是什么造就一个优秀程序员?以上便是我的观点。你认为造就一个优秀程序员的因素哪些?在评论里告诉我吧。
--------------------------------------------------------------------------------
@@ -51,7 +50,7 @@ via: http://henrikwarne.com/2014/06/30/what-makes-a-good-programmer/
作者:[Henrik Warne][a]
译者:[KayGuoWhu](https://github.com/KayGuoWhu)
校对:[校对者ID](https://github.com/校对者ID)
校对:[Caroline](https://github.com/carolinewuyan)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@@ -1,3 +1,4 @@
mdjsjdqe translating...
11 Useful Utilities To Supercharge Your Ubuntu Experience
================================================================================
**Whether youre a relative novice or a seasoned pro, we all want to get the most from our operating system. Ubuntu, like most modern OSes, has more to offer than what is presented at first blush.**
@@ -151,4 +152,4 @@ via: http://www.omgubuntu.co.uk/2014/11/useful-tools-for-ubuntu-do-you-use-them
[7]:https://apps.ubuntu.com/cat/applications/laptop-mode-tools/
[8]:https://01.org/linuxgraphics/downloads/2014/intelr-graphics-installer-linux-1.0.7
[9]:https://launchpad.net/i-nex
[10]:https://apps.ubuntu.com/cat/applications/bleachbit/
[10]:https://apps.ubuntu.com/cat/applications/bleachbit/

View File

@@ -1,3 +1,4 @@
[Translating by Stevearzh]
Five Magnificent Linux Music Streaming Clients
================================================================================
Digital streams almost totally command my music listening these days. Over the years I have amassed a large collection of CDs at considerable expense; most of them now sit neglected gathering dust. Almost all music streaming services fall short of the audio quality of CDs, but their popularity has more to do with sheer convenience than high-fidelity sound reproduction. Music streaming has not only been to the detriment of CD sales; digital downloads have also experienced a slowing down of sales. This is only set to continue. Audiophiles may be tempted to embrace music streaming given that there are now services such as Tidal which offers high fidelity music streaming, 25 million tracks encoded with the FLAC format streamed at 1,411kbps.

View File

@@ -0,0 +1,156 @@
Docker: Present and Future
================================================================================
### Docker - the story so far ###
Docker is a toolset for Linux containers designed to build, ship and run distributed applications. It was first released as an open source project by DotCloud in March 2013. The project quickly became popular, leading to DotCloud rebranded as Docker Inc (and ultimately [selling off their original PaaS business][1]). [Docker 1.0][2] was released in June 2014, and the monthly release cadence that led up to the June release has been sustained since.
The 1.0 release marked the point where Docker Inc considered the platform sufficiently mature to be used in production (with the company and partners providing paid for support options). The monthly release of point updates shows that the project is still evolving quickly, adding new features, and addressing issues as they are found. The project has however successfully decoupled ship from run, so images sourced from any version of Docker can be used with any other version (with both forward and backward compatibility), something that provides a stable foundation for Docker use despite rapid change.
The growth of Docker into one of the most popular open source projects could be perceived as hype, but there is a great deal of substance. Docker has attracted support from many brand names across the industry, including Amazon, Canonical, CenturyLink, Google, IBM, Microsoft, New Relic, Pivotal, Red Hat and VMware. This is making it almost ubiquitously available wherever Linux can be found. In addition to the big names many startups are growing up around Docker, or changing direction to be better aligned with Docker. Those partnerships (large and small) are helping to drive rapid evolution of the core project and its surrounding ecosystem.
### A brief technical overview of Docker ###
Docker makes use of Linux kernel facilities such as [cGroups][3], namespaces and [SElinux][4] to provide isolation between containers. At first Docker was a front end for the [LXC][5] container management subsystem, but release 0.9 introduced [libcontainer][6], which is a native Go language library that provides the interface between user space and the kernel.
Containers sit on top of a union file system, such as [AUFS][7], which allows for the sharing of components such as operating system images and installed libraries across multiple containers. The layering approach in the filesystem is also exploited by the [Dockerfile][8] DevOps tool, which is able to cache operations that have already completed successfully. This can greatly speed up test cycles by taking out the wait time usually taken to install operating systems and application dependencies. Shared libraries between containers can also reduce RAM footprint.
A container is started from an image, which may be locally created, cached locally, or downloaded from a registry. Docker Inc operates the [Docker Hub public registry][9], which hosts official repositories for a variety of operating systems, middleware and databases. Organisations and individuals can host public repositories for images at Docker Hub, and there are also subscription services for hosting private repositories. Since an uploaded image could contain almost anything Docker Hub provides an automated build facility (that was previously called trusted build) where images are constructed from a Dockerfile that serves as a manifest for the contents of the image.
### Containers versus VMs ###
Containers are potentially much more efficient than VMs because theyre able to share a single kernel and share application libraries. This can lead to substantially smaller RAM footprints even when compared to virtualisation systems that can make use of RAM overcommitment. Storage footprints can also be reduced where deployed containers share underlying image layers. IBMs Boden Russel has done [benchmarking][10] that illustrates these differences.
Containers also present a lower systems overhead than VMs, so the performance of an application inside a container will generally be the same or better versus the same application running within a VM. A team of IBM researchers have published a [performance comparison of virtual machines and Linux containers][11].
One area where containers are weaker than VMs is isolation. VMs can take advantage of ring -1 [hardware isolation][12] such as that provided by Intels VT-d and VT-x technologies. Such isolation prevents VMs from breaking out and interfering with each other. Containers dont yet have any form of hardware isolation, which makes them susceptible to exploits. A proof of concept attack named [Shocker][13] showed that Docker versions prior to 1.0 were vulnerable. Although Docker 1.0 fixed the particular issue exploited by Shocker, Docker CTO Solomon Hykes [stated][14], “When we feel comfortable saying that Docker out-of-the-box can safely contain untrusted uid0 programs, we will say so clearly.”. Hykess statement acknowledges that other exploits and associated risks remain, and that more work will need to be done before containers can become trustworthy.
For many use cases the choice of containers or VMs is a false dichotomy. Docker works well within a VM, which allows it to be used on existing virtual infrastructure, private clouds and public clouds. Its also possible to run VMs inside containers, which is something that Google uses as part of its cloud platform. Given the widespread availability of infrastructure as a service (IaaS) that provides VMs on demand its reasonable to expect that containers and VMs will be used together for years to come. Its also possible that container management and virtualisation technologies might be brought together to provide a best of both worlds approach; so a hardware trust anchored micro virtualisation implementation behind libcontainer could integrate with the Docker tool chain and ecosystem at the front end, but use a different back end that provides better isolation. Micro virtualisation (such as Bromiums [vSentry][15] and VMwares [Project Fargo][16]) is already used in desktop environments to provide hardware based isolation between applications, so similar approaches could be used along with libcontainer as an alternative to the container mechanisms in the Linux kernel.
### Dockerizing applications ###
Pretty much any Linux application can run inside a Docker container. There are no limitations on choice of languages or frameworks. The only practical limitation is what a container is allowed to do from an operating system perspective. Even that bar can be lowered by running containers in privileged mode, which substantially reduces controls (and correspondingly increases risk of the containerised application being able to cause damage to the host operating system).
Containers are started from images, and images can be made from running containers. There are essentially two ways to get applications into containers - manually and Dockerfile..
#### Manual builds ####
A manual build starts by launching a container with a base operating system image. An interactive terminal can then be used to install applications and dependencies using the package manager offered by the chosen flavour of Linux. Zef Hemel provides a walk through of the process in his article [Using Linux Containers to Support Portable Application Deployment][17]. Once the application is installed the container can be pushed to a registry (such as Docker Hub) or exported into a tar file.
#### Dockerfile ####
Dockerfile is a system for scripting the construction of Docker containers. Each Dockerfile specifies the base image to start from and then a series of commands that are run in the container and/or files that are added to the container. The Dockerfile can also specify ports to be exposed, the working directory when a container is started and the default command on startup. Containers built with Dockerfiles can be pushed or exported just like manual builds. Dockerfiles can also be used in Docker Hubs automated build system so that images are built from scratch in a system under the control of Docker Inc with the source of that image visible to anybody that might use it.
#### One process? ####
Whether images are built manually or with Dockerfile a key consideration is that only a single process is invoked when the container is launched. For a container serving a single purpose, such as running an application server, running a single process isnt an issue (and some argue that containers should only have a single process). For situations where its desirable to have multiple processes running inside a container a [supervisor][18] process must be launched that can then spawn the other desired processes. There is no init system within containers, so anything that relies on systemd, upstart or similar wont work without modification.
### Containers and microservices ###
A full description of the philosophy and benefits of using a microservices architecture is beyond the scope of this article (and well covered in the [InfoQ eMag: Microservices][19]). Containers are however a convenient way to bundle and deploy instances of microservices.
Whilst most practical examples of large scale microservices deployments to date have been on top of (large numbers of) VMs, containers offer the opportunity to deploy at a smaller scale. The ability for containers to have a shared RAM and disk footprint for operating systems, libraries common application code also means that deploying multiple versions of services side by side can be made very efficient.
### Connecting containers ###
Small applications will fit inside a single container, but in many cases an application will be spread across multiple containers. Dockers success has spawned a flurry of new application compositing tools, orchestration tools and platform as a service (PaaS) implementations. Behind most of these efforts is a desire to simplify the process of constructing an application from a set of interconnected containers. Many tools also help with scaling, fault tolerance, performance management and version control of deployed assets.
#### Connectivity ####
Dockers networking capabilities are fairly primitive. Services within containers can be made accessible to other containers on the same host, and Docker can also map ports onto the host operating system to make services available across a network. The officially sponsored approach to connectivity is [libchan][20], which is a library that provides Go like [channels][21] over the network. Until libchan finds its way into applications theres room for third parties to provide complementary network services. For example, [Flocker][22] has taken a proxy based approach to make services portable across hosts (along with their underlying storage).
#### Compositing ####
Docker has native mechanisms for linking containers together where metadata about a dependency can be passed into the dependent container and consumed within as environment variables and hosts entries. Application compositing tools like [Fig][23] and [geard][24] express the dependency graph inside a single file so that multiple containers can be brought together into a coherent system. CenturyLinks [Panamax][25] compositing tool takes a similar underlying approach to Fig and geard, but adds a web based user interface, and integrates directly with GitHub so that applications can be shared.
#### Orchestration ####
Orchestration systems like [Decking][26], New Relics [Centurion][27] and Googles [Kubernetes][28] all aim to help with the deployment and life cycle management of containers. There are also numerous examples (such as [Mesosphere][29]) of [Apache Mesos][30] (and particularly its [Marathon][31] framework for long running applications) being used along with Docker. By providing an abstraction between the application needs (e.g. expressed as a requirement for CPU cores and memory) and underlying infrastructure, the orchestration tools provide decoupling thats designed to simplify both application development and data centre operations. There is such a variety of orchestration systems because many have emerged from internal systems previously developed to manage large scale deployments of containers; for example Kubernetes is based on Googles [Omega][32] system thats used to manage containers across the Google estate.
Whilst there is some degree of functional overlap between the compositing tools and the orchestration tools there are also ways that they can complement each other. For example Fig might be used to describe how containers interact functionally whilst Kubernetes pods might be used to provide monitoring and scaling.
#### Platforms (as a Service) ####
A number of Docker native PaaS implementations such as [Deis][33] and [Flynn][34] have emerged to take advantage of the fact that Linux containers provide a great degree of developer flexibility (rather than being opinionated about a given set of languages and frameworks). Other platforms such as CloudFoundry, OpenShift and Apcera Continuum have taken the route of integrating Docker based functionality into their existing systems, so that applications based on Docker images (or the Dockerfiles that make them) can be deployed and managed alongside of apps using previously supported languages and frameworks.
### All the clouds ###
Since Docker can run in any Linux VM with a reasonably up to date kernel it can run in pretty much every cloud offering IaaS. Many of the major cloud providers have announced additional support for Docker and its ecosystem.
Amazon have introduced Docker into their Elastic Beanstalk system (which is an orchestration service over underlying IaaS). Google have Docker enabled managed VMs, which provide a halfway house between the PaaS of App Engine and the IaaS of Compute Engine. Microsoft and IBM have both announced services based on Kubernetes so that multi container applications can be deployed and managed on their clouds.
To provide a consistent interface to the wide variety of back ends now available the Docker team have introduced [libswarm][35], which will integrate with a multitude of clouds and resource management systems. One of the stated aims of libswarm is to avoid vendor lock-in by swapping any service out with another. This is accomplished by presenting a consistent set of services (with associated APIs) that attach to implementation specific back ends. For example the Docker server service presents the Docker remote API to a local Docker command line tool so that containers can be managed on an array of service providers.
New service types based on Docker are still in their infancy. London based Orchard labs offered a Docker hosting service, but Docker Inc said that the service wouldnt be a priority after acquiring Orchard. Docker Inc has also sold its previous DotCloud PaaS business to cloudControl. Services based on older container management systems such as [OpenVZ][36] are already commonplace, so to a certain extent Docker needs to prove its worth to hosting providers.
### Docker and the distros ###
Docker has already become a standard feature of major Linux distributions like Ubuntu, Red Hat Enterprise Linux (RHEL) and CentOS. Unfortunately the distributions move at a different pace to the Docker project, so the versions found in a distribution can be well behind the latest available. For example Ubuntu 14.04 was released with Docker 0.9.1, and that didnt change on the point release upgrade to Ubuntu 14.04.1 (by which time Docker was at 1.1.2). There are also namespace issues in official repositories since Docker was also the name of a KDE system tray; so with Ubuntu 14.04 the package name and command line tool are both docker.io.
Things arent much different in the Enterprise Linux world. CentOS 7 comes with Docker 0.11.1, a development release that precedes Docker Incs announcement of production readiness with Docker 1.0. Linux distribution users that want the latest version for promised stability, performance and security will be better off following the [installation instructions][37] and using repositories hosted by Docker Inc rather than taking the version included in their distribution.
The arrival of Docker has spawned new Linux distributions such as [CoreOS][38] and Red Hats [Project Atomic][39] that are designed to be a minimal environment for running containers. These distributions come with newer kernels and Docker versions than the traditional distributions. They also have lower memory and disk footprints. The new distributions also come with new tools for managing large scale deployments such as [fleet][40] a distributed init system and [etcd][41] for metadata management. There are also new mechanisms for updating the distribution itself so that the latest versions of the kernel and Docker can be used. This acknowledges that one of the effects of using Docker is that it pushes attention away from the distribution and its package management solution, making the Linux kernel (and Docker subsystem using it) more important.
New distributions might be the best way of running Docker, but traditional distributions and their package managers remain very important within containers. Docker Hub hosts official images for Debian, Ubuntu, and CentOS. Theres also a semi-official repository for Fedora images. RHEL images arent available in Docker Hub, as theyre distributed directly from Red Hat. This means that the automated build mechanism on Docker Hub is only available to those using pure open source distributions (and willing to trust the provenance of the base images curated by the Docker Inc team).
Whilst Docker Hub integrates with source control systems such as GitHub and Bitbucket for automated builds the package managers used during the build process create a complex relationship between a build specification (in a Dockerfile) and the image resulting from a build. Non deterministic results from the build process isnt specifically a Docker problem - its a result of how package managers work. A build done one day will get a given version, and a build done another time may get a later version, which is why package managers have upgrade facilities. The container abstraction (caring less about the contents of a container) along with container proliferation (because of lightweight resource utilisation) is however likely to make this a pain point that gets associated with Docker.
### The future of Docker ###
Docker Inc has set a clear path on the development of core capabilities (libcontainer), cross service management (libswarm) and messaging between containers (libchan). Meanwhile the company has already shown a willingness to consume its own ecosystem with the Orchard Labs acquisition. There is however more to Docker than Docker Inc, with contributions to the project coming from big names like Google, IBM and Red Hat. With a benevolent dictator in the shape of CTO Solomon Hykes at the helm there is a clear nexus of technical leadership for both the company and the project. Over its first 18 months the project has shown an ability to move fast by using its own output, and there are no signs of that abating.
Many investors are looking at the features matrix for VMwares ESX/vSphere platform from a decade ago and figuring out where the gaps (and opportunities) lie between enterprise expectations driven by the popularity of VMs and the existing Docker ecosystem. Areas like networking, storage and fine grained version management (for the contents of containers) are presently underserved by the existing Docker ecosystem, and provide opportunities for both startups and incumbents.
Over time its likely that the distinction between VMs and containers (the run part of Docker) will become less important, which will push attention to the build and ship aspects. The changes here will make the question of what happens to Docker? much less important than what happens to the IT industry as a result of Docker?.
--------------------------------------------------------------------------------
via: http://www.infoq.com/articles/docker-future
作者:[Chris Swan][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.infoq.com/author/Chris-Swan
[1]:http://blog.dotcloud.com/dotcloud-paas-joins-cloudcontrol
[2]:http://www.infoq.com/news/2014/06/docker_1.0
[3]:https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt
[4]:http://selinuxproject.org/page/Main_Page
[5]:https://linuxcontainers.org/
[6]:http://blog.docker.com/2014/03/docker-0-9-introducing-execution-drivers-and-libcontainer/
[7]:http://aufs.sourceforge.net/aufs.html
[8]:https://docs.docker.com/reference/builder/
[9]:https://registry.hub.docker.com/
[10]:http://bodenr.blogspot.co.uk/2014/05/kvm-and-docker-lxc-benchmarking-with.html?m=1
[11]:http://domino.research.ibm.com/library/cyberdig.nsf/papers/0929052195DD819C85257D2300681E7B/$File/rc25482.pdf
[12]:https://en.wikipedia.org/wiki/X86_virtualization#Hardware-assisted_virtualization
[13]:http://stealth.openwall.net/xSports/shocker.c
[14]:https://news.ycombinator.com/item?id=7910117
[15]:http://www.bromium.com/products/vsentry.html
[16]:http://cto.vmware.com/vmware-docker-better-together/
[17]:http://www.infoq.com/articles/docker-containers
[18]:http://docs.docker.com/articles/using_supervisord/
[19]:http://www.infoq.com/minibooks/emag-microservices
[20]:https://github.com/docker/libchan
[21]:https://gobyexample.com/channels
[22]:http://www.infoq.com/news/2014/08/clusterhq-launch-flocker
[23]:http://www.fig.sh/
[24]:http://openshift.github.io/geard/
[25]:http://panamax.io/
[26]:http://decking.io/
[27]:https://github.com/newrelic/centurion
[28]:https://github.com/GoogleCloudPlatform/kubernetes
[29]:https://mesosphere.io/2013/09/26/docker-on-mesos/
[30]:http://mesos.apache.org/
[31]:https://github.com/mesosphere/marathon
[32]:http://static.googleusercontent.com/media/research.google.com/en/us/pubs/archive/41684.pdf
[33]:http://deis.io/
[34]:https://flynn.io/
[35]:https://github.com/docker/libswarm
[36]:http://openvz.org/Main_Page
[37]:https://docs.docker.com/installation/#installation
[38]:https://coreos.com/
[39]:http://www.projectatomic.io/
[40]:https://github.com/coreos/fleet
[41]:https://github.com/coreos/etcd

View File

@@ -1,129 +0,0 @@
forsil translating ...
How to use on-screen virtual keyboard on Linux
================================================================================
On-screen virtual keyboard is an alternative input method that can replace a real hardware keyboard. Virtual keyboard may be a necessity in various cases. For example, your hardware keyboard is just broken; you do not have enough keyboards for extra machines; your hardware does not have an available port left to connect a keyboard; you are a disabled person with difficulty in typing on a real keyboard; or you are building a touchscreen-based web kiosk.
On-screen keyboard can also be a protection mechanism against a hardware keylogger which silently records your keystrokes for sensitive information such as passwords. Some online banking sites actually force you to use a virtual keyboard for security-enhanced transactions.
In Linux environment, there are a couple of open-source virtual keyboard software available, e.g., [GOK (GNOME Onscreen Keyboard)][1], [kvkbd][2], [onboard][3], [Florence][4].
In this tutorial, I am going to focus on Florence, and show you **how to set up a virtual keyboard with Florence.**. Florence comes with a number of nice features such as flexible layout, multiple input methods, auto-hide, etc. As part of the tutorial, I will also demonstrate **how to use Ubuntu desktop with a mouse only**.
### Install Florence Virtual Keyboard on Linux ###
Fortunately, Florence is available on base repositories of most Linux distros.
On Debian, Ubuntu or Linux Mint:
$ sudo apt-get install florence
On Fedora, CentOS or RHEL ([EPEL repo][5] is required for CentOS/RHEL):
$ sudo yum install florence
On Mandriva or Mageia:
$ sudo urpmi florence
For Archlinux users, the package is available in [AUR][6].
Configure and Launch Virtual Keyboard
Once you install Florence, you can launch virtual keyboard simply by typing:
$ florence
By default, the virtual keyboard is always on top of other windows, allowing you to type on any active window easily.
To change default settings of Florence, click on tool key on the left side of the keyboard.
![](https://farm4.staticflickr.com/3923/14873468448_216c794244_z.jpg)
In "style" menu of Florence settings, you can customize keyboard style, and enable/disable sound effect.
![](https://farm6.staticflickr.com/5563/14873470478_de81aac39b_o.png)
In "window" menu, you can adjust keyboard background transparency and key opacity, as well as control keyboard ratio, taskbar, resizability and always-on-top features. Transparency and opacity adjustment can be useful if your screen resolution is not high enough, so the virtual keyboard is blocking other windows. In this example, I switch to transparent keyboard, and set opacity to 50%.
![](https://farm6.staticflickr.com/5556/15060050245_1534127d1c_z.jpg)
In "behaviour" menu, you can change an input method. Florence supports several different input methods: mouse, touch screen, timer and ramble. The default input is mouse method. The last two methods do not require button clicks. With timer method, key press is triggered by locating a pointer at the key for a certain amount of time. The ramble method works similar to **timer** input, but with dexterity and training, can type much faster than **timer** method.
![](https://farm4.staticflickr.com/3843/14873384900_82baef4c22_o.png)
In "layout" menu, you can change the keyboard layout. For example, you can extend the keyboard layout to include navigation keys, numeric keys, and function keys.
![](https://farm6.staticflickr.com/5556/15057015461_e611b6ee25_z.jpg)
### Use Ubuntu Desktop with Mouse Only ###
I am going to demonstrate how to integrate Florence with Ubuntu desktop, so that we can access the desktop without a hardware keyboard. While this tutorial is specific to Ubuntu desktop with LightDM (Ubuntu's default display manager), a similar environment can be set up for other desktop environments.
The initial setup requires a hardware keyboard, but once the setup is completed, you only need a mouse, but not the keyboard.
When you boot up Ubuntu desktop, the boot procedure ends with launch of a display manager (or login manager) with Greeter interface, where you type in your login info. By default, Ubuntu desktop uses LightDM with Unity Greeter interface. Without a hardware keyboard, you cannot enter username and password at the login screen.
To be able to launch a virtual keyboard at the login screen, install GTK+ Greeter, which comes with on-screen keyboard support.
$ sudo apt-get install lightdm-gtk-greeter
Then, open a Greeter configuration file (/etc/lightdm/lightdm-gtk-greeter.conf) with a text editor, and specify Florence as an on-screen keyboard to use. Instead of Florence, you could also use onboard, Ubuntu's default on-screen keyboard.
$ sudo vi /etc/lightdm/lightdm-gtk-greeter.conf
----------
[greeter]
keyboard=florence --no-gnome --focus &
![](https://farm6.staticflickr.com/5554/15056999361_180dc724b2_z.jpg)
Let's reboot Ubuntu desktop, and verify whether you can use virtual keyboard at the login screen.
When you see the GTK+ Greeter's login screen after boot, click on a human symbol icon on the top right corner. You will see "On Screen Keyboard" menu option as follows.
![](https://farm6.staticflickr.com/5554/14873314399_e48bd6eb84_z.jpg)
Click on this option, and a virtual keyboard will pop up on the login screen. Now you should be able to log in by tapping on the on-screen keyboard.
![](https://farm6.staticflickr.com/5572/14873460568_02480cccb7_z.jpg)
For those GDM2/GDM3 users, the Florence official site offers [documentation][7] on using virtual keyboard at GDM2/GDM3 screen.
The last step to make our Ubuntu desktop fully keyboard-less is to have virtual keyboard auto-start upon login, so that we can use our desktop without a hardware keyboard even after logging in. For that, create the following desktop file.
$ mkdir -p ~/.config/autostart
$ vi ~/.config/autostart/florence.desktop
----------
[Desktop Entry]
Type=Application
Name=Virtual Keyboard
Comment=Auto-start virtual keyboard
Exec=florence --no-gnome
This will make virtual keyboard appear as soon as you log in to the desktop.
![](https://farm4.staticflickr.com/3873/15037038376_f8359f3a65_z.jpg)
Hope this tutorial is useful to you. As you can see, Florence is quite powerful virtual keyboard which can be used for different purposes. Let me know if you have any use case for virtual keyboard.
--------------------------------------------------------------------------------
via: http://xmodulo.com/2014/08/onscreen-virtual-keyboard-linux.html
作者:[Dan Nanni][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/nanni
[1]:https://developer.gnome.org/gok/
[2]:http://homepage3.nifty.com/tsato/xvkbd/
[3]:https://launchpad.net/onboard
[4]:http://florence.sourceforge.net/
[5]:http://xmodulo.com/2013/03/how-to-set-up-epel-repository-on-centos.html
[6]:https://aur.archlinux.org/packages/florence/
[7]:http://florence.sourceforge.net/english/how-to.html

View File

@@ -1,3 +1,4 @@
Translating by JonathanKang
How to Install and Setup My Weather Indicator in Ubuntu 14.10
================================================================================
![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/10/my-weather-indicator.jpg)
@@ -23,7 +24,7 @@ To ensure youre always kept up-to-date with the latest release I recommend ad
How? **Open a new Terminal** window (Unity Dash > Terminal, or press Ctrl+Alt+T) and **enter the following two commands carefully**, entering your system password when prompted:
sudo add-apt-repository ppa:atareao/atareao
sudo apt-get update && sudo apt-get install my-weather-indicator
#### Setting Up My Weather Indicator ####
@@ -36,7 +37,7 @@ The first time you open the app the following Preferences window will open. From
![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/10/Screen-Shot-2014-10-27-at-17.39.07.jpeg)
If youre travelling (or in need of some small talk fodder) **you can monitor a second locale**, too. This is set up in the same way as the first but in the Second Location tab.
If youre travelling (or in need of some small talk fodder) **you can monitor a second locale**, too. This is set up in the same way as the first but in the Second Location tab.
Checking the **Show Widget** box in the “**Widget Options**” section adds a small forecast desklet to your desktop. There are a number of different skins included, so be sure to play around to find the one you like the most (note: widget changes are applied on clicking Ok).
@@ -72,4 +73,4 @@ via: http://www.omgubuntu.co.uk/2014/10/install-weather-indicator-ubuntu-14-10
[2]:https://launchpad.net/my-weather-indicator
[3]:https://launchpad.net/~atareao/+archive/ubuntu/atareao
[4]:http://openweathermap.org/
[5]:http://www.omgubuntu.co.uk/2014/02/get-weather-forecast-terminal-linux
[5]:http://www.omgubuntu.co.uk/2014/02/get-weather-forecast-terminal-linux

View File

@@ -1,3 +1,4 @@
[felixonmars translating...]
How To Use Emoji Anywhere With Twitter's Open Source Library
================================================================================
> Embed them in webpages and other projects via GitHub.
@@ -88,4 +89,4 @@ via: http://readwrite.com/2014/11/12/how-to-use-emoji-in-the-browser-window
[7]:http://ellekasai.github.io/twemoji-awesome/
[8]:https://github.com/ellekasai/twemoji-awesome/blob/gh-pages/twemoji-awesome.css
[9]:https://github.com/laurenorsini/Emoji-Everywhere
[10]:http://getemoji.com/
[10]:http://getemoji.com/

View File

@@ -1,4 +1,4 @@
(translating by runningwater)
Translating by ZTinoZ
10 SCP Commands to Transfer Files/Folders in Linux
================================================================================
Linux administrator should be familiar with **CLI** environment. Since **GUI** mode in Linux servers is not a common to be installed. **SSH** may the most popular protocol to enable Linux administrator to manage the servers via remote in secure way. Built-in with **SSH** command there is **SCP** command. **SCP** is used to copy file(s) between servers in secure way.
@@ -231,9 +231,9 @@ Thats all about **SCP**. You can see **man pages** of **SCP** for more detail
via: http://www.tecmint.com/scp-commands-examples/
作者:[Pungki Arianto][a]
译者:[runningwater](https://github.com/runningwater)
译者:[译者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/pungkiarianto/
[a]:http://www.tecmint.com/author/pungkiarianto/

View File

@@ -0,0 +1,120 @@
forsil translating ...
Undelete Files on Linux Systems
================================================================================
Often times, a computer user will delete a needed file accidentally and not have an easy way to regain or recreate the file. Thankfully, files can be undeleted. When a user deletes a file, it is not gone, only hidden for some time. Here is how it all works. On a filesystem, the system has what is called a file allocation list. This list keeps track of what files are where on the storage unit (hard-drive, MicroSD card, flash-drive, etc.). When a file is deleted, the filesystem will perform one of two tasks on the allocation table. The file's entry on the file allocation table marked as "free space" or the file's entry on the list is erased and then the space is marked as free. Now, if a file needs to be placed on the storage unit, the operating system will put the file in the space marked as empty. After the new file is written to the "empty space", the deleted file is now gone forever. When a deleted file is to be recovered, the user must not manipulate any files because if the "empty space" is used, then the file can never be retrieved.
### How do undelete programs work? ###
The majority of filesystems only mark the space as empty. With these filesystems, the undelete program looks at the file allocation list and copies the deleted file to another storage unit. If the files were copied to the same storage unit, then the user could lose other deleted files that are needed.
Rarely do filesystems erase the allocation table entry. If a filesystem does, this is how an undelete program undeletes the file. The program searches the storage unit for file headers. All files have a specific string of code that is at the very beginning of the file. This is called a magic number. For example, the magic number of a compiled JAVA class is the hex number "CAFEBABE". So, an undelete program would find "CAFEBABE" and copy that file to another storage unit. Some undelete programs can look for a specific file type. The user may want a PDF, so the program searches for the hex magic number "25504446" which is the ASCII code for "%PDF". Other undelete programs search for all magic numbers. Then, the user can select which deleted files to recover.
If a part of the file has been written over, then the whole file will be corrupted. The file can usually be recovered, but the contents will be useless. For instance, recovering a corrupted JPEG file will be pointless because the image viewer will not be able to generate an image from the file. So, the user has the file, but the file is useless.
### Device Locations: ###
Before we continue, here is some information that will aid in directing the undelete utilities to the correct storage unit. All devices are in the /dev/ folder. The name of each device (not the name that the admin gave each partition or device) that is given by the system follows a predictable scheme. The second partition on the first SATA hard-drive would be sda2. The first letter indicates the storage type, in this case SATA, but an "s" could also mean SCSI, FireWire, or USB. The second letter "d" means disk. The third letter indicates the device number, so an "a" would be the first SATA and a "b" would be the second. The number displays the partition. To name the whole device with all partitions type the letters without the number. For this example that would be sda. Other possible letters "h" as the first letter. This means PATA hard-drive (IDE). As some examples of this scheme, a user has a computer with one SATA hard-drive (sda). The drive has four partitions - sda1, sda2, sda3, and sda4. The user deletes the third one, but sda4 remains sda4 until sda4 is reformatted. The user then plugs in a usb memory card (sdb) with one partition - sdb1. The user then adds a IDE hard-drive with one partition - hda1. Next, the user adds a SCSI hard-drive - sdc1. Then, the user removes the USB memory card (sdb). Now, the SCSI remains sdc, but if the SCSI is removed and added back, it will be sdb. Even though other storage device existed, the IDE drive will have the "a" because it is the first IDE drive. IDE devices are numbered separately from SCSI, SATA, FireWire, and USB devices.
### Recovery: ###
Each undelete program has different abilities, features, and support for various filesystems. Below are some instructions for using TestDisk to recover files on a set of filesystems.
**FAT16, FAT32, exFAT (FAT64), NTFS, and ext2/3/4:**
TestDisk is an open-source, free program that works on Linux, *BSD, SunOS, Mac OS X, DOS, and Windows. TestDisk can be found here: [http://www.cgsecurity.org/wiki/TestDisk][1]. TestDisk can also be installed by typing "sudo apt-get install testdisk". TestDisk has many abilities, but this article is concerned with undeleting files.
Open TestDisk in a terminal using root privileges by typing “sudo testdisk”.
Now, the TestDisk command-line application will execute. The terminal appearance will change. TestDisk asks the user if it can keep logs. This is entirely up to the user. If the user is recovering files from the system storage, then do not keep a log. The choices are "Create", "Append", and "No Log". If the user wants a log, it is kept in that user's home folder.
![](http://www.linux.org/attachments/screen1-jpg.342/)
In the following screen, the storage devices are listed using the /dev/* method. For my system, the system's storage unit is /dev/sda. This means that my storage unit is a SATA hard-drive (sd) and it is the first hard-drive (a). The size of each storage unit is displayed in Gigabytes. Use the up and down arrows to select a storage device and hit enter.
![](http://www.linux.org/attachments/screen2-jpg.343/)
The next screen displays a list of partition table (also called partition map) types. Just as there is the file allocation table for files, there is a table for the partitions. Partitions are dividers on a storage device. For instance, on almost all Linux systems there is at least two partitions - EXT3/4 and Swap. Each partition table will be briefly described. TestDisk does not support all partition tables, so this is not a complete list.
![](http://www.linux.org/attachments/screen3-jpg.344/)
- **Intel** - This partition table is very common on Windows systems and many Linux systems. This table is also know as MBR.
- **EFI GPT** - This is usually used with Linux systems. This partition map is most recommended for Linux because the concept of logical/extended partitions does not apply to GPT (GUID Partition Table) tables. This means that a Linux user can multiboot many forms of Linux with one Linux OS on each partition. There are other advantages to using GPT, but that is beyond this article.
- **Humax** - Humax maps are used with device made by the South Korean company Humax.
- **Mac** - The Apple Partition Map (APM) is used by Apple devices.
- **None** - Some devices do not have a partition table. For instance, many Subor game consoles do not use a partition map. If a user tried to undelete a file on these devices thinking that the partition map was one of the other choices, the user will be confused by the fact that TestDisk does not find any filesystem or files.
- **Sun** - The Sun partition table is used by Sun systems.
- **Xbox** - The Xbox uses the Xbox partition map for its storage devices.
If a user selects "Xbox" even though their system uses GPT, TestDisk will not be able to find a partition or filesystem. If it does, then it will guess incorrectly. (The image below displays the output when the incorrect partition type)
![](http://www.linux.org/attachments/xbox-jpg.350/)
Once the user picks the correct choice for their device, on the next screen, select "Advanced".
![](http://www.linux.org/attachments/screen4-jpg.345/)
Now, the user should see a list of all of their filesystems/partitions on the storage unit. If the user had chosen the wrong partition map, then here is where they will know if they made the incorrect selection. If there are no errors, highlight the partition that contains the deleted file by placing the text-based cursor on it. Use the left and right arrows to highlight "List" on the bottom of the terminal. Now, hit enter.
![](http://www.linux.org/attachments/screen5-jpg.346/)
A new screen is displayed with a list of files and folders. The whitish files are current files that are not deleted. The red files have been deleted. On the far right column is the files' names. The next column over to the left is the creation date of the file. One column over to the left again is the files' sizes in bytes. To the far left is a column with dashes, "d"s, "r"s, "w"s, and "x"s. These are the file permissions. A "d" indicates that the item is a directory. The rest of the permission syntax is irrelevant to this article. The item on the top of the file list titled "." means the current directory. The second object titled ".." means go up one directory, so a user can move up a directory by selecting this line. For an example, I will go into the directory "Xaiml_Dataset". The folder is nearly full of deleted files. I will undelete "computers.xaiml" by pressing "c" on the keyboard. I am now asked to select a destination directory. Of course, I will put it on another partition. I am in my home folder, and I press "c". It does not matter what folder is highlighted. The current folder is the destination directory. Now, I am back to the list of files. At the top of the screen is a message that says "Copy Done!". In my home folder is a folder called "Xaiml_Dataset", and inside is the Xaiml file. If I press "c" on more deleted files, they will be placed in the new folder without a****g me for a destination.
![](http://www.linux.org/attachments/screen6-jpg.347/)
![](http://www.linux.org/attachments/screen7-jpg.348/)
![](http://www.linux.org/attachments/screen8-jpg.349/)
When finished press "q" repeatedly until the normal terminal is seen. The folder "Xaiml_Dataset" can only be accessed by the root. To fix this, use root privileges to change the folder permissions and the contained files. After that, the files have been recovered and accessible to the user.
### ReiserFS: ###
To undelete a file from a ReiserFS filesystem, make a backup of all of the files on the partition because this method can cause the file to be lost if something goes wrong. Next, execute the following command where DEVICE is the device in the form sda2. Some files will be put in the lost+found directory and other will remain where they were before deletion.
reiserfsck --rebuild-tree --scan-whole-partition /dev/DEVICE
### Recover Deleted File that is Open in a Program: ###
Assume a user accidentally deletes a file that a program has open. The file of the hard-drive was deleted, but the program is using a copy of the file that is on the RAM. Thankfully, there are two easy solutions.
If the program has save capabilities like a text editor, the user can resave the file. Thus, the file editor will write the file to the hard-drive.
Assume that this is an MP3 file in a music player. The music player cannot save the MP3 file. This task requires a little more time than the previous situation. Unfortunately, this method does not work on all systems and applications. To begin, type the following command.
lsof -c smplayer | grep mp3
This command LiSts all of the Open Files used by Smplayer. This list is piped (given) to grep which searches for mp3. The output looks like the following.
smplayer 10037 collier mp3 169r 8,1 676376 1704294 /usr/bin/smplayer
Now, type the following command to recover the file directly from the RAM (on Linux systems, /proc/ is the RAM) and copy it to a folder of choice. The "cp" is the copy command. The 10037 number comes from the process number given in the output. The 169 is the file descriptor shown in the output. The "~/Music/" is the destination directory. Lastly, "music.mp3" is the file name that the user wants for the file.
cp /proc/10037/fd/169 ~/Music/music.mp3
### Real Deletion: ###
To make for sure that a file can never be recovered, use a command that "wipes" the hard-drive. Wiping the hard-drive means writing meaningless data to the disk. For example, many wiping programs write zeros, random letters, or random data to the hard-drive. No space is taken up or lost. The wiping program just overwrites the "empty space". If the storage unit is ever full of files with no free space remaining, then all of the previously deleted files will be gone.
The purpose of wiping hard-drives is to make sure that private data is never seen. For illustration, a company may order new computers. The manager decides to sell the old computers. However, there is concern that the new owners may view company secrets or customer information like credit card numbers and addresses. Thankfully, a computer technician in the company can wipe the hard-drives before selling the old computers.
To install secure-delete, a wiping program, type "sudo apt-get install secure-delete". This installs a set of four commands that make sure that deleted files are never recovered.
- srm - permanently delete a file. Usage: srm -f ./secret_file.txt
- sfill - wipe the free space. Usage: sfill -f /mount/point/of/partition
- sswap - wipe swap space. Usage: sswap -f /dev/SWAP_DEVICE
If computers were to truly delete a file selected for deletion, then more time would be required to perform the task. It is quick and easy to mark some space as free, but to make the file gone forever requires time. Wiping a storage unit, for instance, takes a few hours to complete (depending on storage size). Overall, the current system works well because even when a user empties the recycle bin, they still have another chance to change their mind.
--------------------------------------------------------------------------------
via: http://www.linux.org/threads/undelete-files-on-linux-systems.4316/
作者:[DevynCJohnson][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.linux.org/members/devyncjohnson.4843/
[1]:http://www.cgsecurity.org/wiki/TestDisk

View File

@@ -0,0 +1,130 @@
如何在 Linux 中使用屏幕键盘
================================================================================
屏幕键盘可以作为实体键盘输入的替代方案. 在某些时候,屏幕键盘显得非常需要. 比如, 你的键盘刚好坏了; 你的机器太多, 没有足够的键盘; 你的机器没有多余的接口来连接键盘; 你是个残疾人, 打字有困难; 或者你正在组建基于触摸屏的信息服务站.
屏幕键盘也可以作为一种针对实体键盘背后记录按键来获取密码等敏感信息的情况的保护手段. 一些网上银行页面实际上会强制你使用屏幕键盘来增强交易的安全性.
在linux 中有几个可用的开源键盘软件, 比如 [GOK (Gnome 的屏幕键盘)][1], [kvkbd][2], [onboard][3], [Florence][4].
我会在这个教程中集中讲解 Florence, 告诉你 ** 如何用 Florence 配置屏幕键盘 **. Florence 有着布局方案灵活, 输入法多样, 自动隐藏等特性. 作为教程的一部分, 我也将会示范 ** 如何只使用鼠标来操作 Ubuntu 桌面 **.
### 在 Linux 中安装 Florence 屏幕键盘 ###
幸运的是, Florence 存在于大多数 Linux 发行版的基础仓库中.
在 Debian, Ubuntu 或者 Linux Mint 中:
$ sudo apt-get install florence
在 Fedora, CentOS 或者 RHEL (CentOS/RHEL 需要 [EPEL 仓库][5]) 中:
$ sudo yum install florence
在 Mandriva 或者 Mageia 中:
$ sudo urpmi florence
对于 Archlinux 用户, Florence 存在于 [AUR][6] 中.
### 配置和加载屏幕键盘 ###
当你安装好 Florence 之后, 你只需要简单的输入以下命令就能加载屏幕键盘:
$ florence
默认情况下, 屏幕键盘总是在其他窗口的顶部, 让你能够在任意活动窗口上进行输入.
在键盘的左侧点击工具按键来改变 Florence 的默认配置.
![](https://farm4.staticflickr.com/3923/14873468448_216c794244_z.jpg)
在 Florence 的 "样式 (style)" 菜单中, 你能够自定义键盘样式, 启用/取消声音效果.
![](https://farm6.staticflickr.com/5563/14873470478_de81aac39b_o.png)
在 "窗口 (window)" 菜单中, 你能够调整键盘背景透明度, 按键不透明度, 以及控制键盘比例, 工具栏, 大小和总是置顶等特性. 如果你的分辨率不是非常高, 透明度调整就显得非常有用. 因为屏幕键盘会挡住其他窗口. 在这个例子中, 我切换到透明键盘, 并且设置不透明度为 50%.
![](https://farm6.staticflickr.com/5556/15060050245_1534127d1c_z.jpg)
在 "行为 (behaviour)" 菜单中, 你能够改变输入方法. Florence 支持几种不同的输入法: 鼠标 (mouse), 触摸屏 (touch screen), 计时器 (timer) 和漫步 (ramble). 鼠标输入是默认输入法. 最后的两种输入法不需要按键. 计时器输入通过将指针滞留在按键上一定时间来触发按键. 漫步输入的原理跟 ** 计时器 ** 输入差不多, 但是经过训练和灵巧使用, 能够比 ** 计时器 ** 输入更加迅速.
![](https://farm4.staticflickr.com/3843/14873384900_82baef4c22_o.png)
在 "布局 (layout)" 菜单中, 你能够改变键盘布局. 比如, 你能够扩展键盘布局来增加导航键, 数字键和功能键.
![](https://farm6.staticflickr.com/5556/15057015461_e611b6ee25_z.jpg)
### 只使用鼠标来操作 Ubuntu 桌面
我将示范如何将 Florence 集成到 Ubuntu 桌面中, 然后我们不需要实体键盘就能够进入桌面. 这个教程使用 LightDM (Ubuntu 的默认显示管理器) 来进入 Ubuntu, 而类似的环境也能够设置为其他桌面环境.
初始设置需要实体键盘, 但是一旦设置完成, 你只需要一个鼠标, 而不是键盘.
当你启动 Ubuntu 桌面时, 启动程序最后会停在显示管理器 (或者登录管理器) 的问候界面. 在这个界面上你需要输入你的登录信息. 默认的情况下, Ubuntu 桌面会使用 LightDM 显示管理器和 Unity 问候界面. 如果没有实体键盘, 你就不能在登录界面输入用户名和密码.
为了能够在登录界面加载屏幕键盘, 安装配备了屏幕键盘支持的 GTK+ 问候界面.
$ sudo apt-get install lightdm-gtk-greeter
然后用编辑器打开问候界面配置文件 (/etc/lightdm/lightdm-gtk-greeter.conf), 指定 Florence 作为屏幕键盘来使用. 你也能够使用 Ubuntu 的默认屏幕键盘 onboard 来代替 Florence.
$ sudo vi /etc/lightdm/lightdm-gtk-greeter.conf
----------
[greeter]
keyboard=florence --no-gnome --focus &
![](https://farm6.staticflickr.com/5554/15056999361_180dc724b2_z.jpg)
重启 Ubuntu 桌面, 然后检查你是否能够在登录界面使用屏幕键盘.
启动之后当你看到 GTK+ 问候登录界面时, 点击右上角的人形符号. 你会看到 "使用屏幕键盘 (On Screen Keyboard)" 菜单选项, 如下
![](https://farm6.staticflickr.com/5554/14873314399_e48bd6eb84_z.jpg)
点击这个选项, 屏幕键盘就会在登录界面弹出. 现在你应该能够用屏幕键盘来登录了.
![](https://farm6.staticflickr.com/5572/14873460568_02480cccb7_z.jpg)
对于 GDM2/GDM3 用户怎么在 GDM2/GDM3 界面上使用屏幕键盘, Florence 官方网页提供了 [文档 (documentation)][7].
Ubuntu 桌面完全少键盘化的最后一步是让屏幕键盘在登录后自动启动, 然后我们在登录后能够不使用实体键盘就操作桌面. 为了做到这一点, 创建以下桌面文件.
$ mkdir -p ~/.config/autostart
$ vi ~/.config/autostart/florence.desktop
----------
[Desktop Entry]
Type=Application
Name=Virtual Keyboard
Comment=Auto-start virtual keyboard
Exec=florence --no-gnome
这样可以让你在登录到桌面的时候就看到屏幕键盘.
![](https://farm4.staticflickr.com/3873/15037038376_f8359f3a65_z.jpg)
希望这个教程对你有用. 与你所看到的一样, Florence 是非常强大的屏幕键盘, 可以用于不同目的. 让我知道你是否在任何情况下使用屏幕键盘.
--------------------------------------------------------------------------------
via: http://xmodulo.com/2014/08/onscreen-virtual-keyboard-linux.html
作者:[Dan Nanni][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/nanni
[1]:https://developer.gnome.org/gok/
[2]:http://homepage3.nifty.com/tsato/xvkbd/
[3]:https://launchpad.net/onboard
[4]:http://florence.sourceforge.net/
[5]:http://xmodulo.com/2013/03/how-to-set-up-epel-repository-on-centos.html
[6]:https://aur.archlinux.org/packages/florence/
[7]:http://florence.sourceforge.net/english/how-to.html