id
int64 2.05k
16.6k
| title
stringlengths 5
75
| fromurl
stringlengths 19
185
| date
timestamp[s] | tags
sequencelengths 0
11
| permalink
stringlengths 20
37
| content
stringlengths 342
82.2k
| fromurl_status
int64 200
526
⌀ | status_msg
stringclasses 339
values | from_content
stringlengths 0
229k
⌀ |
---|---|---|---|---|---|---|---|---|---|
4,313 | 教你在 Ubuntu 上使用 LXC 容器 | http://xmodulo.com/lxc-containers-ubuntu.html | 2014-11-27T07:56:00 | [
"LXC",
"Docker",
"容器"
] | https://linux.cn/article-4313-1.html | 使用“容器”来保证主机环境的安全性,这个概念早在十年前就已经存在(例如 FreeBSD 的 jail 虚拟化技术),但是直到最近,随着部署云架构需求越来越多,像 LXC 和 [Docker](http://xmodulo.com/docker-containers-centos-fedora.html) 这种 Linux 下的容器才成为被关注的焦点。当然,由于主流厂商(云服务商如亚马逊主推 AWS,微软主推 Azure;发行版如红帽、Ubuntu等)组成的强大靠山,[Docker](http://xmodulo.com/manage-linux-containers-docker-ubuntu.html) 已经被放在媒体的聚光灯下面,其实,Docker 里面所谓的“容器”技术是由 LXC 提供的。
你只是一个普通的 Linux 用户,那 Docker/LXC 能为你带来什么好处呢?容器可以将你的应用在不同的 Linux 发行版之间迁移。想像一下这个场景:你正在用的发行版是 Debian,你喜欢它的稳定性,同时你又想玩一款最新的 Ubuntu 游戏,你不需要在电脑上装双系统然后重启进入 Ubuntu,也不需要在 Debian 上跑一个耗资源的 Ubuntu 虚拟机,你只需要简单地生成一个 Ubuntu 容器就够了。

抛开 Docker 的好处不谈,让我们聊一下 LXC 容器的好处:我可以使用 libvirt 提供的接口来管理 LXC,这些接口和 Docker 没有任何关系。如果你有使用基于 libvirt 库的管理工具(例如 virt-manager 和 virsh),你就可以使用它们来管理 LXC 容器。
在这篇教程中,我只介绍标准 LXC 容器管理工具的命令行操作,来教你**如何在 Ubuntu 下创建和管理 LXC 容器**。
### Ubuntu 下安装 LXC
使用下面的命令安装 LXC 在用户态的工具:
```
$ sudo apt-get install lxc
```
然后检查当前内核是否支持 LXC。如果所有结果都是“enable”,说明内核支持:
```
$ lxc-checkconfig
```

安装完 LXC 工具后,就能看到 LXC 自动创建了一块桥接网卡(lxcbr0,可以在 /etc/lxc/default.conf 中设置)。

当你创建了 LXC 容器后,它的网口会自动链接到这个桥接网卡上,然后这个容器就能和外部世界通信了。
### 创建 LXC 容器
为了在指定环境下(比如 Debian Wheezy 64位)创建 LXC 容器,你需要一个相应的 LXC 模板。幸运的是 LXC 提供的工具集成了一整套现成的 LXC 模板,你可以在 /usr/share/lxc/templates 目录下找到它们。
```
$ ls /usr/share/lxc/templates
```

一个 LXC 模板实质上就是一个脚本,用于创建指定环境下的容器。当你创建 LXC 容器时,你需要用到它们。
比如你要新建 Ubuntu 容器,使用下面的命令即可:
```
$ sudo lxc-create -n <container-name> -t ubuntu
```

默认情况下,这个命令会创建一个最小的 Ubuntu 环境,版本号与你的宿主机一致,我这边是“活泼的蝾螈”(版本号是13.10),64位。
当然你也可以创建任何你喜欢的版本,只要在命令里面加一个版本参数即可。举个例子,创建 Ubuntu 14.10 的容器:
```
$ sudo lxc-create -n <container-name> -t ubuntu -- --release utopic
```
这个命令就会下载安装指定环境下的软件包,创建新容器。整个过程需要几分钟时间,与容器的类型有关,所以,你可能需要耐心等待。

下载安装完所有软件包后,LXC 容器镜像就创建完成了,你可以看到默认的登录界面。容器被放到 /var/lib/lxc/<容器名> 这个目录下,容器的根文件系统放在 /var/lib/lxc/<容器名>/rootfs 目录下。
创建过程中下载的软件包保存在 /var/cache/lxc 目录下面,当你想另外建一个一样的容器时,可以省去很多下载时间。
用下面的命令看看主机上所有的 LXC 容器:
```
$ sudo lxc-ls --fancy
```
---
```
NAME STATE IPV4 IPV6 AUTOSTART
------------------------------------
test-lxc STOPPED - - NO
```
使用下面的命令启动容器。参数“-d”将容器作为后台进程打开。如果没有指定这个参数,你可以在控制台界面上直接把容器的运行程序关闭(LCTT译注:Ctrl+C组合键)。
```
$ sudo lxc-start -n <container-name> -d
```
打开容器后,看看状态:
```
$ sudo lxc-ls --fancy
```
---
```
NAME STATE IPV4 IPV6 AUTOSTART
-----------------------------------------
lxc RUNNING 10.0.3.55 - NO
```
容器状态是“运行中”,容器 IP 是10.0.3.55。
你也可以看到容器的网络接口(比如我这里是 vethJ06SFL)自动与 LXC 内部网桥(lxcbr0)连上了:
```
$ brctl show lxcbr0
```

### 管理 LXC 容器
我们已经学习了怎么创建和启动 LXC 容器,现在来看看怎么玩一个正在运行着的容器。
第一步:打开容器控制台:
```
$ sudo lxc-console -n <container-name>
```

使用“Crtl+a q”组合键退出控制台。
停止、删除容器:
```
$ sudo lxc-stop -n <container-name>
$ sudo lxc-destroy -n <container-name>
```
复制容器,用下面的命令:
```
$ sudo lxc-stop -n <container-name>
$ sudo lxc-clone -o <container-name> -n <new-container-name>
```
### 常见问题
这个小节主要介绍你们在使用 LXC 过程中碰到过的问题。
1. 创建 LXC 容器时遇到下面的错误:
$ sudo lxc-create -n test-lxc -t ubuntu
---
```
lxc-create: symbol lookup error: /usr/lib/x86_64-linux-gnu/liblxc.so.1: undefined symbol: cgmanager_get_pid_cgroup_abs_sync
```
错误的原因是你运行了最新的 LXC,但是它所依赖的 libcgmanager 版本较老,两者不兼容。升级下 libcmanager 即可解决问题:
```
$ sudo apt-get install libcgmanager0
```
---
via: <http://xmodulo.com/lxc-containers-ubuntu.html>
作者:[Dan Nanni](http://xmodulo.com/author/nanni) 译者:[bazz2](https://github.com/bazz2) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,314 | CentOS 下安装 LEMP 服务(nginx、MariaDB/MySQL 和 php) | http://xmodulo.com/install-lemp-stack-centos.html | 2014-11-27T09:22:00 | [
"LEMP",
"CentOS"
] | https://linux.cn/article-4314-1.html | LEMP 组合包是一款日益流行的网站服务组合软件包,在许多生产环境中的核心网站服务上起着强有力的作用。正如其名称所暗示的, LEMP 包是由 Linux、nginx、MariaDB/MySQL 和 PHP 组成的。在传统的 LAMP 包中使用的 Apache HTTP 协议服务器性能低下而且难于大规模集群,相比来说 nginx 的高性能及轻量级等特性,正是其的替代方案。 MariaDB 是一款社区支持驱动的 MySQL 数据库的分支,其功能更多性能更佳。PHP,服务端编程语言,具体是由 PHP FastCGI 的增强版 PHP-FPM 组件来处理,生成网页动态内容。
(LCTT 译注:为何采用 LEMP 而不是 LNMP 的缩写?据 <https://lemp.io/> 的解释:Nginx 的发音是 Engine-X,重要的发音而不是首字母,而且 LEMP 实际上是可读的,而 LNMP 看起来只是字母表。)
这篇文章里,我们示范**如何在 CentOS 操作平台上安装 LEMP 包**。我们安装的目标是 CentOS 6 和 CentOS 7 两个操作平台,如有必要会指出它们的不同。

### 第一步: Nginx
让我们在 CentOS 上安装 nginx 作为第一步,然后对它作些基本的配置,比如使其能引导时启动和[对防火墙做个性化设置](http://linux.cn/article-4243-1.html)。
#### 安装 Nginx
让我们从它的官方的 RPM 源来安装一个预构建的稳定版本的 nginx 包。
在 CentOS 7 系统上:
```
$ sudo rpm --import http://nginx.org/keys/nginx_signing.key
$ sudo rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
$ sudo yum install nginx
```
在 CentOS 6 系统上:
```
$ sudo rpm --import http://nginx.org/keys/nginx_signing.key
$ sudo rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
$ sudo yum install nginx
```
注意在安装 nginx RPM 包之前,如果您没有导入 nginx 的官方 GPG 密钥的话,会出一如下所示的警告:
```
warning: /var/tmp/rpm-tmp.KttVHD: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY
```
#### 启动 Nginx
安装完成后,nginx 是不会自动启动的。现在让我们来启动它吧,还要做些配置让其可以随着操作系统启动而启动。我们也需要在防火墙里打开 TCP/80 端口,以使得可以远程访问 nginx 的 web 服务。所有这些操作、设置都只需要输入如下命令就可实现。
在 CentOS 7 系统上:
```
$ sudo systemctl start nginx
$ sudo systemctl enable nginx
$ sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
$ sudo firewall-cmd --reload
```
在 CentOS 6 系统上:
```
$ sudo service nginx start
$ sudo chkconfig nginx on
$ sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
$ sudo service iptables save
```
#### 测试 Nginx
nginx 的默认文档要目录是 /usr/share/nginx/html。默认的 index.html 文件一定已经在这目录下了。让我们检测下是否可以访问到这个测试 web 页,输入 http://nginx的ip地址/ 访问。

如果您看到的是如上所示的页面的话,说明 nginx 已经正常启动。继续往下。
### 第二步: MariaDB/MySQL
下一步就是安装 LEMP 包的数据库组件。CentOS/RHEL 6 或早期的版本中提供的是 MySQL 的服务器/客户端安装包,但 CentOS/RHEL 7 已使用了 MariaDB 替代了默认的 MySQL。作为 MySQL 的简单替代品,MariaDB 保证了与 MySQL 的 API 和命令行用法方面最大的兼容性。下面是关于怎么在 CentOS 上安装和配置 MaraDB/MySQL 的操作示例。
在 CentOS 7 系统上:
如下所示操作来安装 MariaDB 服务/客户端包以及启动 MariaDB 服务。
```
$ sudo yum install mariadb-server
$ sudo systemctl start mariadb
$ sudo systemctl enable mariadb
```
在 CentOS 6 系统上:
如下示,安装 MySQL 服务/客户端包并且启动 MySQL 服务。
```
$ sudo yum install mysql-server
$ sudo service mysqld start
$ sudo chkconfig mysqld on
```
在成功启动 MariaDB/MySQL 服务后,执行在 MariaDB/MySQL 服务包中的脚本。这一次的运行会为为数据库服务器进行一些安全强化措施,如设置(非空)的 root 密码、删除匿名用户、锁定远程访问。
```
$ sudo mysql_secure_installation
```

这就是数据库的设置。现在进行下一步。
### 第三步: PHP
PHP 是 LEMP 包中一个重要的组件,它负责把存储在 MariaDB/MySQL 服务器的数据取出生成动态内容。为了 LEMP 需要,您至少需要安装上 PHP-FPM 和 PHP-MySQL 两个模块。PHP-FPM(FastCGI 进程管理器)实现的是 nginx 服务器和生成动态内容的 PHP 应用程序的访问接口。PHP-MySQL 模块使 PHP 程序能访问 MariaDB/MySQL 数据库。
#### 安装 PHP 模块
在 CentOS 7 系统上:
```
$ sudo yum install php php-fpm php-mysql
```
在 CentOS 6 系统上:
首先,您需要从仓库中安装 REMI 库(参见[本指南](http://linux.cn/article-4192-1.html)),并安装软件包。
```
$ sudo yum --enablerepo=remi install php php-fpm php-mysql
```

在安装 PHP 时,得注意两个地方:
在 CentOS 6 系统中,安装 REMI仓库中最新的 php-mysql 模块时,MySQL 的服务端包和客户端包会被当做一部分依赖包而自动的更新。
在 CentOS 6 和 CentOS 7 中,在安装 PHP 包的同时会把 Apache web 服务器(即 httpd)当做它的依赖包一起安装。这会跟 nginx web 服务器起冲突。这个问题会在下一节来讨论。
取决于您的使用情况,可以使用 yum 命令来定制您的 PHP 引擎,也许会想安装下面的任意一个扩展 PHP 模块包。
* **php-cli**: PHP 的命令行界面。从命令行里测试 PHP 时非常有用。
* **php-gd**: PHP 的图像处理支持。
* **php-bcmath**: PHP 的数学支持。
* **php-mcrypt**: PHP 的加密算法支持 (例如 DES、Blowfish、CBC、 CFB、ECB ciphers 等)。
* **php-xml**: PHP 的 XML 解析和处理支持。
* **php-dba**: PHP 的数据抽象层支持。
* **php-pecl-apc**: PHP 加速器/缓存支持。
安装时,要查看可用的 PHP 模块的完整列表的话,可以运行:
```
$ sudo yum search php- (CentOS 7)
$ sudo yum --enablerepo=remi search php- (CentOS 6)
```
#### 启动 PHP-FPM
您需要启动 PHP-FPM ,然后把它放到自动启动服务列表。
在 CentOS 7 系统上:
```
$ sudo systemctl start php-fpm
$ sudo systemctl enable php-fpm
```
在 CentOS 6 系统上:
```
$ sudo chkconfig php-fpm on
$ sudo service php-fpm start
```
### 第四步: 配置 LEMP 组合包
本教程的最后一步是调整 LEMP 组合包的配置。
#### 使 Httpd 不可用
首先,让我们把早先随 PHP 包安装的 httpd 服务给禁用掉。
在 CentOS 7 系统上:
```
$ sudo systemctl disable httpd
```
在 CentOS 6 系统上:
```
$ sudo chkconfig httpd off
```
#### 配置 Nginx
接下来,让我们配置 nginx 虚拟主机,使得 nginx 可以通过 PHP-FPM 来处理 PHP 的任务。用文本编辑器打开 /etc/nginx/conf.d/default.conf ,然后按如下所示修改。
```
$ sudo vi /etc/nginx/conf.d/default.conf
```
---
```
server {
listen 80;
server_name www.server_domain.com;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
# nginx passes PHP scripts to FastCGI server via a TCP/9000 socket
# this setting much be consistent with /etc/php-fpm.d/www.conf
# try_files prevents nginx from passing bad scripts to FastCGI server
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
```
nginx 的默认工作线程数(在 /etc/nginx/nginx.conf 文件中指定的)是 1,让我们也来调整一下这个数字。通常来说我们创建的工作线程数应该和 CPU 核数相同。要确信您的 CPU 的核数,请运行下面这命令:
```
$ grep processor /proc/cpuinfo | wc -l
```
如果您的 CPU 是 4 核的,就如下所示修改 /etc/nginx/nginx.conf 文件。
```
$ sudo vi /etc/nginx/nginx.conf
```
---
```
worker_processes 4;
```
#### 配置 PHP
接下来,让我们对 PHP 的配置文件 /etc/php.ini 做自定义设置。更具体的就是在 /etc/php.ini 文件中增加以下两行。
```
cgi.fix_pathinfo=0
date.timezone = "PRC"
```
为了安全起见,我们希望的是 PHP 解释器只是处理指定文件路径的文件任务,而不是预测搜索一些并不存在的文件任务。上面的第一行起的就是这个作用。(LCTT 译注:原文用的时区是“America/New York”,根据国内情况,应该用 PRC或 Asia 下的中国城市。)
第二行定义的是 PHP 中日期/时间相关函数使用相关的默认时区。使用[本指南](http://ask.xmodulo.com/set-default-timezone-php.html),找出您所在的时区,并设置相应 **date.timezone 的值**。
#### 测试 PHP
最后,让我们来测试下 nginx 是否能处理 PHP 页面。在测试之前,请确保重启 nginx 和 PHP-FPM。
在 CentOS 7 系统上:
```
$ sudo systemctl restart nginx
$ sudo systemctl restart php-fpm
```
在 CentOS 6 系统上:
```
$ sudo service nginx restart
$ sudo service php-fpm restart
```
创建一个叫名叫 test.php 的文件,然后写入如下内容,并放入 /usr/share/nginx/html 目录。
```
<?php phpinfo(); ?>
```
打开浏览器,输入 http://nginx的IP地址/test.php 。

如果您能看到如上所示的页面,说明设置的 LEMP 完全成功!
---
via: <http://xmodulo.com/install-lemp-stack-centos.html>
作者:[Dan Nanni](http://xmodulo.com/author/nanni) 译者:[runningwater](https://github.com/runningwater) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,321 | 小技巧:如何修复Lubuntu中的Docky混合错误 | http://www.unixmen.com/quick-tip-fix-docky-compositing-error-lubuntu/ | 2014-11-27T13:03:33 | [
"Docky",
"Lubuntu"
] | https://linux.cn/article-4321-1.html | 总所周知,**Docky**是Unix/Linux类系统中的轻量级应用启动器。我是 Lubuntu 和 Docky 的忠实粉丝,因为它们不需要占用我的所有系统资源,这样就可以同时运行更多应用。我在笔记本上使用Docky应用启动器,系统为Lubuntu 14.04.
但是,如果你使用LXDE发行版,你也许肯定遇到过使用Docky时报混合的错误。看下面的截图。

如果不开启混合功能,就不能使用Docky一些特别功能,如3D背景、自动隐藏。如果你想开启这些Docky的功能,那么你需要在你的LXDE系统中开启混合功能。
就像这样,首先安装 **xcompmgr**包:
```
sudo apt-get install xcompmgr
```
然后,选择**菜单(Menu) -> 偏好(Preferences) -> LXSession默认程序(Default applications for LXSession)**。选择自动开始(Autostart)选项卡。 在**(+增加)+Add**框中输入“**@xcompmgr -n**”不带引号。最后点击增加按钮。

这样就搞定了。关掉LXSession配置窗口,注销或重启系统。之后,你就可以看见混合功能已经打开。

这时,你就可以使用3D背景和隐藏功能,如自动隐藏(Auto-hide),Intellihide和窗口闪烁(Window dodge)等。

搞定!干杯!
---
via: <http://www.unixmen.com/quick-tip-fix-docky-compositing-error-lubuntu/>
作者:[SK](http://www.unixmen.com/author/sk/) 译者:[Vic020/VicYu](http://www.vicyu.net) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,322 | Ubuntu也许能在中国给Windows以致命打击 | http://news.softpedia.com/news/Ubuntu-Could-Give-a-Fatal-Blow-to-Windows-in-China-463500.shtml | 2014-11-27T13:30:08 | [
"ubuntu",
"windows"
] | https://linux.cn/article-4322-1.html |
>
> Ubuntu Kylin也许能在中国用来替代Windows
>
>
>
**Windows操作系统将退出中国的前门,而它的位置将由一个Linux发行版替代,用于官方和政府部门。问题是目前还没有一个真正的可替代系统,尽管还是有一款操作系统也许已经准备接下这个任务,它就是Ubuntu Kylin。**
****
至少可以这么说,中国政府和微软目前的关系很紧张。[就像新闻里说的](http://news.softpedia.com/news/China-Starts-Windows-Eradication-15-of-Govt-PCs-to-Switch-to-Linux-Every-Year-463393.shtml),一个用Linux类似系统在全国逐步替换Windows的计划已经在准备了。还不清楚具体会采用哪个系统,因为情况很复杂而且这是一个非常大的国家。
通常,这种问题没有一个普适的解决方案,而且中国的行动确实看起来有点呆板。不管怎样,这为Ubuntu Keylin打开了一扇巨大的机会之窗,它是一个基于Ubuntu由中国开发者和Canonical共同开发的发行版。它已经稳定一段时间了,而且已经发布了几个连续版本。
### Ubuntu Kylin在敲Windows的大门
有趣的是,在这个关于中国意图的新闻冒出来的同一天里,发布了一篇对国防科技大学(NUDT)副教授Dr. Jonas Zhang的采访,关于[最新的14.10分支开发计划](http://news.softpedia.com/news/Ubuntu-Kylin-14-10-Utopic-Unicorn-Consolidates-Its-Position-in-China-463068.shtml)。
“在这次的14.10版本中,有许多很好的功能。比如,新手也可以轻松地通过Ubuntu Kylin软件中心找到Windows软件的替代;用户可以使用Ubuntu Kylin的SSO(Ubuntu Kylin的单一登录系统,我们叫它UKID)来登录到Ubuntu Kylin的软件和社区;Sogou输入法(一款世界知名的中文输入法,上个月已经在苹果的应用市场上线了)减少了40%的CPU和内存占用。”
“来自CSIP(中国政府的一个部门),超过50个 Canonical 和 NUDT(国防科技大学)的项目经理、工程师和社区管理员在为 Ubuntu Kylin 工作。大部分全职工程师来自NUDT。许多来自Ubuntu,Debian和其他社区的开发者也参与到Ubuntu Kylin的开发中了。”Dr. Jonas Zhang[说](http://news.softpedia.com/news/Ubuntu-Kylin-14-10-Utopic-Unicorn-Consolidates-Its-Position-in-China-463068.shtml)。
中国政府也许自己也正想办法搭建另一个Linux发行版(不是第一次尝试了),但是目前看来已经有一个很好的用来替代Windows的候选者了。这对于Canonical也是很好的商机,至少从被承认这个角度看。
如果Ubuntu,通过它和Kylin的联系,想在像中国这样的大国里取代Windows,对这家公司将会是个巨大的促进。让我们拭目以待,看看开发者们让Ubuntu Kylin变成一个有竞争力的操作系统所花费的努力是不是白费力气。
---
via: <http://news.softpedia.com/news/Ubuntu-Could-Give-a-Fatal-Blow-to-Windows-in-China-463500.shtml>
作者:[Silviu Stahie](http://news.softpedia.com/editors/browse/silviu-stahie) 译者:[zpl1025](https://github.com/zpl1025) 校对:[Caroline](https://github.com/carolinewuyan)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,323 | 在 Linux 中使用"avconv"工具录制计算机桌面视频和音频 | http://www.tecmint.com/record-ubuntu-desktop-screen-using-avconv/ | 2014-11-27T13:36:26 | [
"Libav",
"Avconv"
] | https://linux.cn/article-4323-1.html | **Libav**是一款跨平台的工具库,能够用来处理多媒体文件、流和协议。它最初是源自ffmpeg。Libav带有一些工具,比如:
* **Avplay**: 一款视频音频播放器。
* **Avconv**: 能够记录多个设备输入源的一个多媒体转换器和视频音频录制器。
* **Avprobe**: 一个连接多媒体文件流并且返回关于这个文件流的统计信息的工具。
* **Libavfilter**: 一个Libav工具的过滤器(filtering)API。
在这篇文章里面,我们就要展示如何通过'Avconv'程序在**Debian/Ubuntu/Linux Mint**发行版上录制Linux桌面视频音频。

### 第一步:下载 Avconv 工具
**1.** **avconv**是 “**libav-tools**” 的一部分, 可以通过官方的基于debian的仓库下载,比如Mint、Ubuntu。输入下面命令即可:
```
$ sudo apt-get update
$ sudo apt-get install libav-tools
```

*下载Avconv工具*
**注意**: 如果从默认仓库下载的话, ‘**avconv**’ 的版本可能比较老。 因此我们推荐你拉取最新的git官方版本。
```
$ sudo apt-get install yasm
$ git clone git://git.libav.org/libav.git
$ cd libav
$ ./configure
$ make
$ sudo make install
```
**注意**: 你应该运行 ‘**./configure –help**’ 来列出所有的可选配置选项并且安装相应的解码器和库,你还需要做很多工作来解决依赖问题。
也要注意,如果你是从源代码编译的,就需要使用**sudo avconv**而不是**avconv**来运行这个工具。
### 第二步:开始录制桌面视频
**2.**一切就绪,现在可以通过运行下面的命令录制你的视频了:
```
$ avconv -f x11grab -r 25 -s 1920x1080 -i :0.0 -vcodec libx264 -threads 4 $HOME/output.avi
```
简单解释一下这个命令:
* **avconv -f x11grab** 默认从X服务捕捉画面。
* **-r 25** 这是你需要的视频帧率,可以自行设置。
* **-s 1920×1080** 是你的系统的桌面分辨率,要设置成你当前桌面的分辨率,这一点非常重要。
* **-i :0.0** 我们要记录的位置(X 服务输出端口),设置成这样就可以了。
* **-vcodec libx264** 我们用来录制视频的编码器。
* **-threads 4** 线程数,可以根据情况更改。
* **$HOME/output** 输出的目标文件路径。
* **.avi** 使用的视频格式,可以换成 “flv”、“mp4″、 “wmv”、 “mov”、 “mkv”等。
**3.**在运行命令之后,就会在terminal上自动运行一个进程进行记录,按"Ctrl+C"键来终止记录。

*录制桌面视频*
**4.** 现在,你可以使用VLC或者其他的播放器,或者使用来自Libav包里的播放器"avplay"来播放你录制的视频。
```
$ avplay $HOME/output.avi
```
**注意:** 别忘了替换输出文件的路径为你自己的,录制效果还是很好的。

*播放录制的文件*
这有一段我用 “**avconv**” 录制的[视频](http://www.youtube.com/embed/g1FEh4wByGE) (墙外)。
### 第三步: 开始录制桌面的音频和视频
**5.** 如果也想同时录制音频,先运行这个命令,列出所有的音频输入源:
```
$ arecord -l
```
结果类似这样:

*检查音频输入源*
在我这里,我只有一个音频输入源,所以数量是**1**,这就是我使用如下命令来捕捉我的视频以及麦克风的音频的原因。
```
$ avconv -f alsa -i hw:1 -f x11grab -r 25 -s 1920x1080 -i :0.0 -vcodec libx264 -threads 4 output-file2.avi
```
我修改了部分地方,下面做个简短的解释:
* **-f** alsa 一个从alsa设备捕捉声音的选项。
* **-i** hw:1 是一个从 “hw:1” 设备捕捉音频的选项,这个设备是我电脑上仅有的一个音频输入设备。
**注意**: 如果你想用**arecord -l**显示的**1**之外的设备的话,别忘了替换 “**1**”。
结束录制,再来一次“**Ctrl + C**” 就可以。
### 第四步: 开始录制桌面音频
**6.** 如果只想录制音频的话,使用下面的命令。
```
$ avconv -f alsa -i hw:1 out.wav
```
**7.** 替换成 **.mp3** 等Libav支持的格式都可以,播放 **out.wav**就能听到你自己的声音了。

*录制桌面音频*
### 最后
“**avconv**” 工具可以用来做很多其他事情,不仅仅是录制桌面视频,更多的教程和文档请移步到官网。
* <https://libav.org/avconv.html>
你对"avconv"的体验如何,你使用过其他工具录制桌面视频么?在评论里面和我们分享吧。
---
via: <http://www.tecmint.com/record-ubuntu-desktop-screen-using-avconv/>
作者:[Hanny Helal](http://www.tecmint.com/author/hannyhelal/) 译者:[ggaaooppeenngg](https://github.com/ggaaooppeenngg) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,326 | iproute2 对决 net-tools | http://xmodulo.com/2014/09/linux-tcpip-networking-net-tools-iproute2.html | 2014-11-27T21:04:12 | [
"iproute2",
"net-tools",
"ifconfig",
"netstat"
] | https://linux.cn/article-4326-1.html | 如今很多系统管理员依然通过组合使用诸如ifconfig、route、arp和netstat等命令行工具(统称为net-tools)来配置网络功能,解决网络故障。net-tools起源于BSD的TCP/IP工具箱,后来成为老版本Linux内核中配置网络功能的工具。**但自2001年起,Linux社区已经对其停止维护。**同时,一些Linux发行版比如Arch Linux和CentOS/RHEL 7则已经完全抛弃了net-tools,只支持iproute2。
作为网络配置工具的一份子,iproute2的出现旨在从功能上取代net-tools。net-tools通过procfs(/proc)和ioctl系统调用去访问和改变内核网络配置,而iproute2则通过netlink套接字接口与内核通讯。抛开性能而言,iproute2的用户接口比net-tools显得更加直观。比如,各种网络资源(如link、IP地址、路由和隧道等)均使用合适的对象抽象去定义,使得用户可使用一致的语法去管理不同的对象。更重要的是,到目前为止,iproute2仍处在[持续开发](https://www.kernel.org/pub/linux/utils/net/iproute2/)中。
如果你仍在使用net-tools,而且尤其需要跟上新版Linux内核中的最新最重要的网络特性的话,那么是时候转到iproute2的阵营了。原因就在于使用iproute2可以做很多net-tools无法做到的事情。
对于那些想要转到使用iproute2的用户,有必要了解下面有关net-tools和iproute2的众多对比。

### 显示所有已连接的网络接口
下面的命令显示出所有可用网络接口的列表(无论接口是否激活)。
使用**net-tools**:
```
$ ifconfig -a
```
使用**iproute2**:
```
$ ip link show
```

### 激活或停用网络接口
使用这些命令来激活或停用某个指定的网络接口。
使用**net-tools**:
```
$ sudo ifconfig eth1 up
$ sudo ifconfig eth1 down
```
使用**iproute2**:
```
$ sudo ip link set down eth1
$ sudo ip link set up eth1
```
### 为网络接口分配IPv4地址
使用这些命令配置网络接口的IPv4地址。
使用**net-tools**:
```
$ sudo ifconfig eth1 10.0.0.1/24
```
使用**iproute2**:
```
$ sudo ip addr add 10.0.0.1/24 dev eth1
```
值得注意的是,可以使用iproute2给同一个接口分配多个IP地址,ifconfig则无法这么做。使用ifconfig的变通方案是使用[IP别名](http://xmodulo.com/2013/02/how-to-assign-multiple-ip-addresses-to-one-network-interface-on-centos.html)。
```
$ sudo ip addr add 10.0.0.1/24 broadcast 10.0.0.255 dev eth1
$ sudo ip addr add 10.0.0.2/24 broadcast 10.0.0.255 dev eth1
$ sudo ip addr add 10.0.0.3/24 broadcast 10.0.0.255 dev eth1
```
### 移除网络接口的IPv4地址
就IP地址的移除而言,除了给接口分配全0地址外,net-tools没有提供任何合适的方法来移除网络接口的IPv4地址。相反,iproute2则能很好地完全。
使用**net-tools**:
```
$ sudo ifconfig eth1 0
```
使用**iproute2**:
```
$ sudo ip addr del 10.0.0.1/24 dev eth1
```
### 显示网络接口的IPv4地址
按照如下操作可查看某个指定网络接口的IPv4地址。
使用**net-tools**:
```
$ ifconfig eth1
```
使用**iproute2**:
```
$ ip addr show dev eth1
```
同样,如果接口分配了多个IP地址,iproute2会显示出所有地址,而net-tools只能显示一个IP地址。

### 为网络接口分配IPv6地址
使用这些命令为网络接口添加IPv6地址。net-tools和iproute2都允许用户为一个接口添加多个IPv6地址。
使用**net-tools**:
```
$ sudo ifconfig eth1 inet6 add 2002:0db5:0:f102::1/64
$ sudo ifconfig eth1 inet6 add 2003:0db5:0:f102::1/64
```
使用**iproute2**:
```
$ sudo ip -6 addr add 2002:0db5:0:f102::1/64 dev eth1
$ sudo ip -6 addr add 2003:0db5:0:f102::1/64 dev eth1
```
### 显示网络接口的IPv6地址
按照如下操作可显示某个指定网络接口的IPv6地址。net-tools和iproute2都可以显示出所有已分配的IPv6地址。
使用**net-tools**:
```
$ ifconfig eth1
```
使用**iproute2**:
```
$ ip -6 addr show dev eth1
```

### 移除网络设备的IPv6地址
使用这些命令可移除接口中不必要的IPv6地址。
使用**net-tools**:
```
$ sudo ifconfig eth1 inet6 del 2002:0db5:0:f102::1/64
```
使用**iproute2**:
```
$ sudo ip -6 addr del 2002:0db5:0:f102::1/64 dev eth1
```
### 改变网络接口的MAC地址
使用下面的命令可[篡改网络接口的MAC地址](http://xmodulo.com/2014/02/spoof-mac-address-network-interface-linux.html),请注意在更改MAC地址前,需要停用接口。
使用**net-tools**:
```
$ sudo ifconfig eth1 hw ether 08:00:27:75:2a:66
```
使用**iproute2**:
```
$ sudo ip link set dev eth1 address 08:00:27:75:2a:67
```
### 查看IP路由表
net-tools中有两个选择来显示内核的IP路由表:route和netstat。在iproute2中,使用命令ip route。
使用**net-tools**:
```
$ route -n
```
---
```
$ netstat -rn
```
使用**iproute2**:
```
$ ip route show
```

### 添加和修改默认路由
这里的命令用来添加或修改内核IP路由表中的默认路由规则。请注意在net-tools中可通过添加新的默认路由、删除旧的默认路由来实现修改默认路由。在iproute2使用ip route命令来代替。
使用**net-tools**:
```
$ sudo route add default gw 192.168.1.2 eth0
$ sudo route del default gw 192.168.1.1 eth0
```
使用**iproute2**:
```
$ sudo ip route add default via 192.168.1.2 dev eth0
$ sudo ip route replace default via 192.168.1.2 dev eth0
```
### 添加和移除静态路由
使用下面命令添加或移除一个静态路由。
使用**net-tools**:
```
$ sudo route add -net 172.16.32.0/24 gw 192.168.1.1 dev eth0
$ sudo route del -net 172.16.32.0/24
```
使用**iproute2**:
```
$ sudo ip route add 172.16.32.0/24 via 192.168.1.1 dev eth0
$ sudo ip route del 172.16.32.0/24
```
### 查看套接字统计信息
这里的命令用来查看套接字统计信息(比如活跃或监听状态的TCP/UDP套接字)。
使用**net-tools**:
```
$ netstat
$ netstat -l
```
使用**iproute2**:
```
$ ss
$ ss -l
```

### 查看ARP表
使用这些命令显示内核的ARP表。
使用**net-tools**:
```
$ arp -an
```
使用**iproute2**:
```
$ ip neigh
```

### 添加或删除静态ARP项
按照如下操作在本地ARP表中添加或删除一个[静态ARP项](http://xmodulo.com/2013/02/how-to-add-or-remove-static-arp-entry-on-linux.html)。
使用**net-tools**:
```
$ sudo arp -s 192.168.1.100 00:0c:29:c0:5a:ef
$ sudo arp -d 192.168.1.100
```
使用**iproute2**:
```
$ sudo ip neigh add 192.168.1.100 lladdr 00:0c:29:c0:5a:ef dev eth0
$ sudo ip neigh del 192.168.1.100 dev eth0
```
### 添加、删除或查看多播地址
使用下面的命令配置或查看网络接口上的多播地址。
使用**net-tools**:
```
$ sudo ipmaddr add 33:44:00:00:00:01 dev eth0
$ sudo ipmaddr del 33:44:00:00:00:01 dev eth0
$ ipmaddr show dev eth0
$ netstat -g
```
使用**iproute2**:
```
$ sudo ip maddr add 33:44:00:00:00:01 dev eth0
$ sudo ip maddr del 33:44:00:00:00:01 dev eth0
$ ip maddr list dev eth0
```
---
via: <http://xmodulo.com/2014/09/linux-tcpip-networking-net-tools-iproute2.html>
作者:[Dan Nanni](http://xmodulo.com/author/nanni) 译者:[KayGuoWhu](https://github.com/KayGuoWhu) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,327 | Linux有问必答:如何检查Linux上的glibc版本 | http://ask.xmodulo.com/check-glibc-version-linux.html | 2014-11-27T21:33:46 | [
"glibc",
"版本"
] | /article-4327-1.html |
>
> **问题**:我需要找出我的Linux系统上的GNU C库(glibc)的版本,我怎样才能检查Linux上的glibc版本呢?
>
>
>
GNU C库(glibc)是标准C库的GNU实现。glibc是GNU工具链的关键组件,用于和二进制工具和编译器一起使用,为目标架构生成用户空间应用程序。
当从源码进行构建时,一些Linux程序可能需要链接到某个特定版本的glibc。在这种情况下,你可能想要检查已安装的glibc信息以查看是否满足依赖关系。
这里介绍几种简单的方法,方便你检查Linux上的glibc版本。

### 方法一
下面给出了命令行下检查GNU C库的简单命令。
```
$ ldd --version
```

在本例中,**glibc**版本是**2.19**。
### 方法二
另一个方法是在命令行“输入”**glibc 库的名称**(如,libc.so.6),就像命令一样执行。
输出结果会显示更多关于**glibc库**的详细信息,包括glibc的版本以及使用的GNU编译器,也提供了glibc扩展的信息。glibc变量的位置取决于Linux版本和处理器架构。
在基于Debian的64位系统上:
```
$ /lib/x86_64-linux-gnu/libc.so.6
```
在基于Debian的32位系统上:
```
$ /lib/i386-linux-gnu/libc.so.6
```
在基于Red Hat的64位系统上:
```
$ /lib64/libc.so.6
```
在基于Red Hat的32位系统上:
```
$ /lib/libc.so.6
```
下图中是输入glibc库后的输出结果样例。

---
via: <http://ask.xmodulo.com/check-glibc-version-linux.html>
译者:[GOLinux](https://github.com/GOLinux) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /check-glibc-version-linux.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275c5510>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)")) | null |
4,335 | DebianFork 将发布没有 systemd 的 Debian 分支 | http://debianfork.org/ | 2014-11-29T01:09:00 | [
"systemd",
"Debian",
"debianfork",
"Devuan"
] | https://linux.cn/article-4335-1.html | 编者按:Debian 8 Jessie的 init 系统默认使用 systemd,这一选择在社区引发了大量争议,导致了技术委员会的[多名成员辞职](http://linux.cn/article-4256-1.html)。现在,“老兵 Unix 管理员”宣布要创建一个新的不使用 sytemd 的 [Debian 分支](http://debianfork.org/)。这群 Unix 哲学拥护者们请求外界[捐赠](http://debianfork.org/donate.html)支持他们的新使命。
以下内容来自 debianfork.org 的相关内容:
---
// 更新: 项目名称正式命名为:[Devuan](https://devuan.org/)。

#### 我们是谁?!
我们是老兵 Unix 管理员(Veteran Unix Admins),我们非常关注 Debian GNU/Linux 在 systemd 上的分歧,并且决定分支(fork)Debian 项目。
#### 为什么我们要这样做?
我们中的一些人是上游开发者,一些人是专业的系统管理员:我们每天都要和 Debian 打各种交道。
我们不想被强迫使用 systemd 来替代传统的 UNIX sysvinit 初始化系统,因为 systemd 背离了 UNIX 哲学。
我们考虑采用贴近 sysvinit 的架构,而不是那种破坏了“做一件事,把它做好”的原则、带着数十个紧密耦合的二进制文件和不透明的日志的东西。
#### 有比创建分支更好的解决方案么?
不幸的是,目前没有!
在下一代的 Debian v.8 "Jessie" 发行版中,默认的初始化系统将是 systemd,它将挟裹着一堆紧密纠缠的东西来到。
我们需要分离这些依赖的牵扯,从所有受到影响的软件包中清除这些,并提供相应的替代品。我们所要创建的分支的稳定性是目前阶段所要考虑的首要重点。
#### 你觉得为什么会走到了这一步?
现在的 Debian 项目的领导者受到了 GNOME 开发者太多的影响,而且在项目中考虑了太多的桌面需求的因素,而 Debian 用户却大多数是精通技术的系统管理员。
而且,今天 Debian 正逐渐背离自己最初愿景,也是开源软件的基石:用户至上。这到底是怎么了?所谓的“do-ocracy”开发者和包维护者正在给用户强加他们的选择。
#### 你可以说一下你对 systemd 的意见吗?
套用一下 Eric S. Raymond 在这个问题上的看法,我们认为 systemd 很容易就会发生嬗变,进而臃肿不堪、最后变成了那种讨厌的纠结在一起的毛球。
我们希望能够用可以阅读的 shell 脚本来控制系统的启动,因为可读性能够给我们这些有能力的人更多的控制和洞悉。我们认为,在一个守护进程中集中控制服务、socket、设备、挂载等等,是对传统的 UNIX 哲学的一记响亮耳光。
某些支持 systemd 的人对此的快速回应可以在 [forkfedora.org](https://web.archive.org/web/20141020161905/http://forkfedora.org/) (已经关闭,需要翻墙才能看历史归档)上看到。这个页面突出了两者之间的根本不同:systemd 也许对于配置 init 来说很简单,但是它增加了 init 过程中的不透明度。在 systemd 中很明确是这样的:可以通过更少的变量来调整,而通过远超 sysvinit 大小的程序将大部分细节隐藏在一个巨大的二进制程序里面。
```
ls -lH /sbin/init
sysvinit: -rwxr-xr-x 1 root root 36992 Jul 14 2013 /sbin/init
systemd: -rwxr-xr-x 1 root root 1317632 Sep 1 14:41 /sbin/init
# 你也许认为我不够强大,但是你也太胖了!
```
可以说 systemd 的安全模式更多的依赖于开发者和包维护者,而不怎么指望系统管理员。作为 Debian 用户,我们只是希望不要被强迫必须如此,看看 [CTTE 关于这个问题的投票就会知道](https://news.ycombinator.com/item?id=7203364),我们相信这样下去会越来越多的听到用户要求:**放开那个 Init !不要和 systemd 和它的那堆零碎纠缠在一起。**
#### 你们能坚持多久?
这不是比谁的胡子更长,放心,毛茸茸的不总是绵羊!
#### 概括一下计划?
“放开那个 Init”( Init Freedom),这是我们的承诺,我们会建立一个 Debian 项目的分支,创建一个新的基础发行版。
这需要一些时间,我们会一步步来。
首先我们会配合 Debian 8 "Jessie" 的发布,给当前的 Debian 用户平滑升级提供一个完整的解决方案。
如果你也需要这个,请帮助我们: [捐赠](http://debianfork.org/donate.html) 或者参与进来。
#### 我们需要谈谈。
当然,您可以写电子邮件给 [[email protected]](mailto:[email protected]) 。
我们也有一些人聚集在 IRC , Freenode 频道号是 #debianfork ,欢迎加入。
[可以订阅邮件列表](https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng)。喜欢的话来发布意见吧,不管是什么。
#### 只有你们这些家伙吗?
不是,有很多用户都对 systemd 有意见。
有一篇文章是对这个问题的很好的介绍: [Systemd: Linux 世界末日的预兆](http://www.infoworld.com/article/2608798/data-center/systemd--harbinger-of-the-linux-apocalypse.html)。
有个 [boycott systemd](http://boycottsystemd.org/) 网站也有一些相关的资料。那里有个叫做 [uselessd](http://uselessd.darknedgy.net/) 的 “systemd 分支”,有些不错的地方和许多笑点(lulz)。
还有人提出了一个 [当世界 systemd 了](http://the-world-after-systemd.ungleich.ch/)之后的撤退战略。
在维基百科的 [systemd reception](http://en.m.wikipedia.org/wiki/Systemd#Reception) 章节也有一些对其提出的批评意见。
#### 谢谢你做的这些,我怎么帮助你们?
老兵 Unix 管理员(Veteran Unix Admins)的一个小型的核心小组正在积极建设分支的相关框架和一些用于开发的基础设施。
这时的捐赠有助于我们确定可以在基础架构上投入多少以及人们的对我们的预期。
如果你会捐赠,那么[来吧](http://debianfork.org/donate.html)。
如我们现在做的,我们会在此一直更新我们的项目进展。
#### 对于你做的这些,人们是怎么看的?
下面是我们收到的一些邮件(略,请参照[原链接](http://debianfork.org/)),我们会匿名发表这些信息,除非你申明不用。
我们会保密你的邮件地址,并会通知你我们的下一步进展。
| 301 | Moved Permanently | null |
4,336 | Systemd这个有争议的项目正在接管你身边的Linux发行版 | http://www.pcworld.com/article/2841873/meet-systemd-the-controversial-project-taking-over-a-linux-distro-near-you.html | 2014-11-30T10:04:00 | [
"systemd",
"sysvinit"
] | https://linux.cn/article-4336-1.html | 
Systemd 是目前为止在Linux平台上最有争议的项目之一。它到底有多大的争议?它的争议大到systemd的开发者之一Lennart Poettering 声称有人使用[比特币](http://www.pcworld.com/article/2033715/7-things-you-need-to-know-about-bitcoin.html)雇佣职业杀手要干掉他。但是还是有比较理智的做法的,有一个[抵制systemd网站](http://boycottsystemd.org/)在技术角度上提出了抵制systemd的原因。
如此强烈的抵制也反映了systemd的成功。它已经被或将要被Fedroa、OpenSUSE、Ubuntu、Debian、Arch Linux等众多发行版采用。随着时间推移,GNOME越来越依赖它,Debian[回归GNOME](http://www.pcworld.com/article/2691192/how-gnome-3-14-is-winning-back-disillusioned-linux-users.html)的原因之一就是它采用了systemd。systemd无处不在!
那么如此激烈的争论到底是关于什么呢?让我们近距离观察这场战争。
### Systemd是一个全新的init
[Systemd](http://www.freedesktop.org/wiki/Software/systemd/)的核心是取代老旧的[SysV init](http://en.wikipedia.org/wiki/Init#SysV-style)。init用来初始化你的操作系统,当你启动系统时,init负责加载需要的驱动,激活你的网络链接,启动众多的系统服务,最后进入图形登陆界面。而SysV init 是一个老旧的系统,它基本上仅运行**/etc/init.d**目录下的一些脚本。
Systemd是一个现代技术,用以取代老旧以及粗糙的SysV init。它可以在接收到事件响应时启动相关服务;比如,当你接入了一个USB打印机,systemd可以在接收到设备接入响应时启动打印服务。当它接收到某个网络端口的连接请求时,它可以启动在此端口上监听的服务并且传递这个连接。
获取更多关于SysV init 与 systemd的信息,可以参考Jorgen Schäfer的 “[Why systemd?](http://blog.jorgenschaefer.de/2014/07/why-systemd.html)”
### 但是systemd远不止此
systemd的反对者之中也有部分人认为SysV太老了,应该被取代掉。但是批评systemd的人发现Systemd是一个巨大的项目,其中包括了很多其他的功能。它是一个软件套件,而不仅仅是一个init。

*[维基共享资源](http://en.wikipedia.org/wiki/File:Systemd_components.svg) systemd 结构图解*
Systemd包括用于管理用户登陆的守护进程logind,还包括journald,并且journald 颇有争议的使用了二进制形式保存系统日志而不是以文本形式。systemd也采用了[udev](http://en.wikipedia.org/wiki/Udev)的思想及代码,它对**/dev/**目录下的虚拟设备文件进行管理,并且处理设备接入或推出时所产生的事件。除了这些还有很多其他的,如:systemd还包括了[cron](http://en.wikipedia.org/wiki/Cron)风格的任务调度器与网络守护进程networkd等等。
### 抨击者认为systemd不是类UNIX风格
多数的抱怨源于人们认为systemd项目太大以至于超出了它的工作范围,并且它从Linux系统接管的部分太多了。不要感到惊奇,systemd的抵制活动是以下面的抱怨开始的:
>
> "systemd文件是一大堆的复杂的高度耦合的二进制组成的,这违反了UNIX哲学:‘做一件事情,并把它做好’。它超出了一个init程序的职责范围,因为它还有电源管理,设备管理,挂载管理,cron(定时执行工具),磁盘加密,socket接口/inetd,syslog,网络配置,登陆/会话管理,文件预读,GPT分区发现,容器注册,hostname/locale/time管理,mDNS/DNS-SD等功能,它将Linux控制台以及其他的一些功能都包装在一个程序里面。
>
>
>
那么,systemd是好是坏?
---------------
到这里,我判断一下,到底谁是正确的。

systemd最初的想法是非常好的。Linux需要一个新的东西来替换老的 SysV init 和沉重的 SysV init 脚本,这个新的程序应该是灵活的,现代化的系统守护进程,它可以响应更多类型,并且智能化的管理众多的守护进程。然而,事实上systemd好像成为了**一个仅依赖Linux核心的完全统一的系统层**。
*但是*,尽管Linux是一个社区开发项目,但它不是为PC世界的专栏作家或者是一群网络评论者提供的,这些人都不能决定它的进化与发展。只有那些亲手贡献代码以及全身心投入的人才有这个资格。巧的是,Linux发行版以及那些参与者好像大部分都倾向与systemd。
>
> '我对于systemd本身并没有很强烈的个人看法。我与核心开发人员争论过它的bug与兼容性,并且我认为它的一些设计是愚蠢的(比如二进制的日志),但这只是细节,不是大问题。
>
>
>
如果 Linus Torvalds 对于systemd的设计没有什么反对意见,那么说明它可能还是不错的。如果你想平静的看下为什么Linux发行版要使用systemd的话,我推荐这篇文章,[Debian's systemd discussion document](http://www.markshuttleworth.com/archives/1295)。
你是如何看systemd的,可以在评论回复!但是请文明讨论。
*更新这篇文章以澄清之前的错误的消息,ubuntu 桌面版将在下一个版本中纳入systemd。之前我们错误的认为ubuntu已经使用了systemd*。
---
via: <http://www.pcworld.com/article/2841873/meet-systemd-the-controversial-project-taking-over-a-linux-distro-near-you.html>
作者:[Chris Hoffman](http://www.pcworld.com/article/2841873/meet-systemd-the-controversial-project-taking-over-a-linux-distro-near-you.html#chrishoffman) 译者:[SPccman](https://github.com/SPccman) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,337 | 安卓编年史(4):Android 0.9 Beta——嘿,这看起来很眼熟! | http://arstechnica.com/gadgets/2016/10/building-android-a-40000-word-history-of-googles-mobile-os/4/ | 2014-11-30T10:27:00 | [
"Android",
"Android编年史",
"安卓编年史"
] | https://linux.cn/article-4337-1.html | 

*安卓 0.9 显示着横屏的主屏幕——后续一些版本无法实现的一个特性 [Ron Amadeo供图]*
尽管从功能上很难将模拟器和操作系统区分开,但安卓 0.9 是第一个支持横屏显示的版本。更让人惊讶的是,几乎所有东西都支持横屏模式,在某些方面安卓 0.9 甚至做的比 KitKat 更好。在 Kiakat 中,主屏幕和拨号被锁定为竖向并且无法旋转。但在安卓 0.9 这里,对任何一个应用横向显示都不是问题。(有谁知道怎么把 Nexus 5 从 Kitkat 升/降级到安卓 0.9 吗?)
截图同样显示了安卓 0.9 中的新的音量显示设计。它抛弃了在 Milestone 3 中初次登场的旧铃铛式控制界面。那是一个巨大的,充满屏幕的界面。实际上,安卓 4.0 的重新设计中让它变得更小了,但它仍然是个问题。(你想增加音量却因此没法看到视频了这种情况特别烦人。)

*新通知面板,抛弃了应用快捷方式并添加了顶部部分 [Ron Amadeo供图]*
几乎每个安卓版本中的通知面板都有一定的调整,安卓 0.9 也不例外。电池电量图标进行了重绘,变成了黑底绿色图标,其它的状态栏图标变为黑色,白色以及灰色。状态栏左侧部分明智地选择在通知面板打开的时候显示日期。
通知面板加入了一个新的顶部部分,它能够显示运营商名称(在模拟器里显示“安卓”),以及一个巨大的写着“清除通知”的按钮,它能够让你不用打开应用而彻底清除通知。应用程序图标被取消了,替换为通知到达的时间,“最新事件”文字被更换为简单的“通知”。面板的空白部分现在是灰色的而不是之前的白色,底部的滑动条也进行了重新设计。上面两张图片的底部看起来并没有对齐,但这是因为 Milestone 5 的通知面板在面板底部有一圈空白。安卓 0.9 的通知面板是完全直达底部边缘的。

*安卓 0.9 和 0.5 的浏览器,展现出新的无色彩菜单 [Ron Amadeo供图]*
浏览器主页现在是加载一个真正的网站,而不是像 Milestone 5 中那样的本地存储的假 Google 页面。Webkit 的版本升至 525.10,但是看起来它似乎没法正确渲染更现代的 Google.com 搜索按钮。纵观安卓 0.9,Milestone 5 中的菜单设计已经被抛弃,取而代之的是重新设计的灰色图标。这些截图的区别十分的明显,因为所有的颜色都被去除了。
“更趋向于”列表式的菜单变得更高了一点,并且只是一个没有图标的列表而已。安卓 0.9 已经获得了其它搜索方式,这次是在浏览器菜单里。和主屏幕小部件,主屏幕菜单按钮,以及浏览器主页,它们共同组成了四个搜索框。谷歌从未隐藏它的主要业务是什么,就连在它的操作系统中也是这样。

*从左到右:安卓 0.9 的浏览器缩放控件,页面内搜索界面,浏览器窗口,以及设置 [Ron Amadeo供图]*
安卓 0.9 带来了许多浏览器改进。谢天谢地缩放控件又能正常使用了,而且从疯狂的垂直控制变成了简单的加减按钮。谷歌做了个符合常识的决定,将缩放控制从屏幕中间移到了屏幕底部。在这些缩放控件中,安卓在一致性方面的努力显而易见。这些看起来是系统中唯一的圆形按钮。
安卓 0.9 中的新特性“页面内查找”会高亮显示页面内的关键词。但总的来说,UI 还是十分粗糙的——文本框比它应有的高度高了许多,“完成”按钮带的勾选框对这个页面来说只是一种图标而已。“完成”基本上是个“关闭”按钮,这意味着它也许应该是个右对齐的“X”按钮。
这个版本的系统没有设置界面,但是浏览器最终还是有了自己的设置界面。它会有个桌面式选项的弹窗,Javascript,隐私和 cookie,保存的密码以及表单数据。甚至还有 Google Gears 整合(还记得 Google Gears 吗?)。

*拨号盘以及打开菜单的正在通话界面 [Ron Amadeo供图]*
拨号和联系人在安卓0.9中实际上是同一个应用——两个图标只是打开不同的标签而已。将联系人像这样附到拨号盘表明了智能手机联系人的第一目的还是通话,不是短信,电子邮件,即时通讯或查找地址。最终谷歌还是会完全接受非传统的智能手机沟通,将联系人和拨号分为两个独立的应用程序。
Milestone 5中大多数拨号盘的缺陷在安卓0.9中得到了修复。“最小化”标签被一组正常的亮/暗标签替代。对话气泡式的退格键被替换为正常的退格图标并集成到了拨号数字显示界面。数字键变成了圆形,尽管这个系统的其它东西是圆角矩形的(至少这次文本是垂直对齐的)。谷歌还修复了Milestone 5中“-”键,“\*”键和“#”键不平衡的问题。
在安卓0.9中点击显示的号码会开始一个通话。这是十分重要的,因为这是摆脱安卓设备硬件实体“拨号”和“结束”键的一大步。另一方面,来电界面却走的是完全相反的道路,去除了在安卓0.5中显示于屏幕之上的“接听”和“拒绝”按键。谷歌会花上接下来几个版本的时间去摸索在特定的显示之下是否需要硬件实体拨号键。但是直到安卓2.0和摩托罗拉Droid面世,实体拨号按钮才最终变成了可选选项。
来电界面的所有选项隐藏在目录按钮之后。Milestone 5不支持距离传感器,所以它采取了简单粗暴的路线,在通话过程中禁用触摸屏。安卓0.9为G1开发,它有个距离传感器。最终谷歌没有在通话的时候禁用触摸传感器。

*安卓 0.9 和 0.5 中独立的联系人界面和联系人编缉界面 [Ron Amadeo供图]*
Milestone 5 的一些联系人信息有令人困惑的标签,像电子邮件只被打上“主要的”标签而不是“主电子邮箱”标签。安卓 0.9 用各部分的水平标题纠正了这个错误。而且现在左侧的每个联系人类型都有了<ruby> 手形图标 <rp> ( </rp> <rt> Action icons </rt> <rp> ) </rp></ruby>。
编缉联系人界面如今是个更加繁忙的地方。每个输入框都有删除按钮,特定联系人铃声,一个显示在屏幕上的“更多信息”按钮用来添加输入框,一个是否将通话直接发送到语音信箱的复选框,以及在列表底部的“保存”和“放弃修改”按钮。从功能上来说,相对于旧版本这是个巨大的进步,但它看起来仍然很混乱。
---

[Ron Amadeo](http://arstechnica.com/author/ronamadeo) / Ron 是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。[@RonAmadeo](https://twitter.com/RonAmadeo)
---
via: <http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/4/>
译者:[alim0x](https://github.com/alim0x) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,340 | 如何在 CentOS 7 上安装 Docker | http://www.linuxtechi.com/install-docker-on-centos-7/ | 2014-11-30T20:55:00 | [
"CentOS",
"Docker"
] | https://linux.cn/article-4340-1.html | Docker 是一个开源工具,它可以让创建和管理 **Linux 容器**变得简单。容器就像是轻量级的虚拟机,并且可以以毫秒级的速度来启动或停止。Docker 帮助系统管理员和程序员在容器中开发应用程序,并且可以扩展到成千上万的节点。
容器和 VM(虚拟机)的主要区别是,容器提供了**基于进程的隔离**,而虚拟机提供了资源的完全隔离。虚拟机可能需要一分钟来启动,而容器只需要一秒钟或更短。容器使用宿主操作系统的内核,而虚拟机使用独立的内核。
Docker 的局限性之一是,它只能用在 **64 位**的操作系统上。

在这篇文章中我们将讨论如何在 CentOS 7.x 中安装 docker。
### CentOS 7 中 Docker 的安装
Docker 软件包已经包括在默认的 CentOS-Extras 软件源里。因此想要安装 docker,只需要运行下面的 yum 命令:
```
[root@localhost ~]# yum install docker
```
### 启动 Docker 服务
安装完成后,使用下面的命令来启动 docker 服务,并将其设置为开机启动:
```
[root@localhost ~]# service docker start
[root@localhost ~]# chkconfig docker on
```
(LCTT 译注:此处采用了旧式的 sysv 语法,如采用CentOS 7中支持的新式 systemd 语法,如下:
```
[root@localhost ~]# systemctl start docker.service
[root@localhost ~]# systemctl enable docker.service
```
)
**下载官方的 CentOS 镜像到本地** (LCTT 译注:由于 Docker 被**墙** :-< ,所以请使用 <http://docker.cn> 的[镜像](https://docker.cn/h/how-to-use-docker-official-repositories),感谢 [@马全一](http://weibo.com/genedna) 的镜像。 )
```
[root@localhost ~]# docker pull centos
Pulling repository centos
192178b11d36: Download complete
70441cac1ed5: Download complete
ae0c2d0bdc10: Download complete
511136ea3c5a: Download complete
5b12ef8fd570: Download complete
```
**确认 CentOS 镜像已经被获取:**
```
[root@localhost ~]# docker images centos
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos centos5 192178b11d36 2 weeks ago 466.9 MB
centos centos6 70441cac1ed5 2 weeks ago 215.8 MB
centos centos7 ae0c2d0bdc10 2 weeks ago 224 MB
centos latest ae0c2d0bdc10 2 weeks ago 224 MB
```
**运行一个 Docker 容器:**
```
[root@localhost ~]# docker run -i -t centos /bin/bash
[root@dbf66395436d /]#
```
我们可以看到,CentOS 容器已经被启动,并且我们得到了 bash 提示符。在 docker 命令中我们使用了 “-i 捕获标准输入输出”和 “-t 分配一个终端或控制台”选项。若要断开与容器的连接,输入 exit。
```
[root@cd05639b3f5c /]# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)
[root@cd05639b3f5c /]# exit
exit
[root@localhost ~]#
```
我们还可以搜索基于 Fedora 和 Ubuntu 操作系统的容器。
```
[root@localhost ~]# docker search ubuntu
[root@localhost ~]# docker search fedora
```
**显示当前正在运行容器的列表**

---
via: <http://www.linuxtechi.com/install-docker-on-centos-7/>
作者:[Pradeep Kumar](http://www.linuxtechi.com/author/pradeep/) 译者:[felixonmars](https://github.com/felixonmars) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,341 | 系统之锹sysdig:Linux服务器监控和排障利器 | http://xmodulo.com/monitor-troubleshoot-linux-server-sysdig.html | 2014-11-30T21:31:09 | [
"监控",
"sysdig",
"strace",
"tcpdump",
"lsof"
] | https://linux.cn/article-4341-1.html | 当你需要追踪某个进程产生和接收的系统调用时,首先浮现在你脑海中的是什么?你可能会想到strace,那么你是对的。你会使用什么样的命令行工具来监控原始网络通信呢?如果你想到了tcpdump,你又作出了一个极佳的选择。而如果你碰到必须追踪打开的文件(在Unix意义上:一切皆文件)的需求,可能你会使用lsof。
strace、tcpdump以及lsof,确实是些伟大的工具,它们应该成为每个系统管理员工具集之中的一部分,而这也正是你为什么应该爱上[sysdig](http://www.sysdig.org/)的原因。它是一个强大的开源工具,用于系统级别的勘察和排障,它的创建者在介绍它时称之为“strace+tcpdump+lsof+上面点缀着lua樱桃的绝妙酱汁”。抛开幽默不说,sysdig的最棒特性之一在于,它不仅能分析Linux系统的“现场”状态,也能将该状态保存为转储文件以供离线检查。更重要的是,你可以自定义sysdig的行为,或者甚至通过内建的(你也可以自己编写)名为凿子(chisel)的小脚本增强其功能。单独的凿子可以以脚本指定的各种风格分析sysdig捕获的事件流。

在本教程中,我们将探索sysdig的安装及其基本用法,在Linux上实施系统监控和排障。
### 安装Sysdig
对于本教程,由于为了简便、缩短安装流程以及版本的不可知,我们将选择使用官方网站提供的自动化安装过程。在自动化过程中,安装脚本会自动检测操作系统并安装必需的依赖包。
以root身份运行以下命令来从官方apt/yum仓库安装sysdig:
```
# curl -s https://s3.amazonaws.com/download.draios.com/stable/install-sysdig | bash
```

安装完成后,我们可以通过以下方法调用sysdig来感受一下它:
```
# sysdig
```
我们的屏幕将马上被系统上发生的所有事件填满,对于这些信息,不便于我们做更多操作。要进一步处理,我们可以运行:
```
# sysdig -cl | less
```
来查看可用的凿子列表。

默认有以下类目可用,各个类目中分布有多个内建的凿子。
* CPU Usage:CPU使用量
* Errors:错误
* I/O
* Logs:日志
* Misc:混杂
* Net:网络
* Performance:性能
* Security:安全
* System State:系统状态
要显示指定凿子上的信息(包括详细的命令行用法),运行以下命令:
```
# sysdig -cl [凿子名称]
```
例如,我们可以检查“网络”类目下关于spy\_port凿子的信息:
```
# sysdig -i spy_port
```

凿子可以通过过滤器(可同时应用于实时数据和记录文件)组合,以获取更多有用的输出。
过滤器遵从“类.字段”结构。例如:
* **fd.cip**:客户端IP地址。
* **evt.dir**:事件方向,可以是‘>’用于进入事件,或‘<’用于退出事件。
完整的过滤器列表可以通过以下命令显示:
```
# sysdig -l
```
在本教程剩余部分,我将演示几个sysdig的使用案例。
### Sysdig实例: 服务器性能排障
假定你的服务器发生了性能问题(如,没有回应,或者重大的回应延迟)。你可以使用瓶颈凿子来显示当前10个最慢系统调用的列表。
使用以下命令在存活服务器上进行实时检查。“-c”标识,后跟凿子名称告诉sysdig运行指定的凿子。
```
# sysdig -c bottlenecks
```
或者,你可以离线对服务器实施性能分析。在此种情况下,你可以保存完整的sysdig记录到文件,然后像下面这样针对记录运行瓶颈凿子。
首先,保存sysdige记录(使用Ctrl+c来停止收集):
```
# sysdig -w trace.scap
```
收集完记录后,你可以运行以下命令来检查捕获间隔中最慢的系统调用:
```
# sysdig -r trace.scap -c bottlenecks
```

你需要关注栏#2,#3和#4,这些分别表示执行时间、进程名和PID。
### Sysdig实例: 监控交互用户活动
假定你作为系统管理员想要监控系统中交互的用户活动(如,用户在命令行输入了什么命令,以及用户去了什么目录),这时spy\_user凿子就派上用场了。
让我们首先通过一些额外选项来收集一个sysdig记录。
```
# sysdig -s 4096 -z -w /mnt/sysdig/$(hostname).scap.gz
```
* “-s 4096”告诉sysdig每个事件捕获4096字节。
* “-z” (与“-w”一起使用)为记录文件启用压缩。
* “-w ”保存sysdig记录到指定的文件。
在上面的例子中,我们自定义了基于每个主机的压缩的记录文件的名称。记住,你可以在任何时候按下Ctrl+c来打断sysdig的执行。
在我们收集到了合理数量的数据后,我们可以通过运行以下命令来查看每个用户的交互活动:
```
# sysdig -r /mnt/sysdig/debian.scap.gz -c spy_users
```

上面输出的第一栏表示与指定用户的活动相关进程的PID。
如果你想要定位一个指定的用户,以及只监控该用户的活动又怎么样呢?你可以通过用户名对spy\_users凿子的结果进行过滤:
```
# sysdig -r /mnt/sysdig/debian.scap.gz -c spy_users "user.name=xmodulo"
```

### Sysdig实例: 监控文件I/O
我们可以使用“-p”标识来自定义sysdig记录的输出格式,并指定双引号括起来的想要的字段(如用户名、进程名,以及文件或套接口名称)。在本例中,我们将创建一个记录文件,该文件将只包含在家目录中的写入事件(我们今后可以使用“sysdig -r writetrace.scap.gz”来检测该文件)。
```
# sysdig -p "%user.name %proc.name %fd.name" "evt.type=write and fd.name contains /home/" -z -w writetrace.scap.gz
```

### Sysdig实例: 监控网络I/O
作为服务器排障的一部分,你可能想要监听网络通信,此工作通常由tcpdump做。对于sysdig,可以很容易进行通信嗅探,其风格更为对用户友好。
例如,你可以检查由特定IP地址,特定进程(如apache2)提供的数据(ASCII编码格式):
```
# sysdig -s 4096 -A -c echo_fds fd.cip=192.168.0.100 -r /mnt/sysdig/debian.scap.gz proc.name=apache2
```
如果你想要监控原生数据传输(二进制格式),请把“-A”替换为“-X”:
```
# sysdig -s 4096 -X -c echo_fds fd.cip=192.168.0.100 -r /mnt/sysdig/debian.scap.gz proc.name=apache2
```
要获取更多信息、实例以及案例分析,你可以查阅[项目网站](http://www.sysdig.org/)。相信我,会有着无限可能,但请不要仅仅局限于我所写的这些。安装sysdig,请从今天开始深入挖掘吧!
---
via: <http://xmodulo.com/monitor-troubleshoot-linux-server-sysdig.html>
作者:[Gabriel Cánepa](http://xmodulo.com/author/gabriel) 译者:[GOLinux](https://github.com/GOLinux) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,346 | 20个关于Postfix的面试题 | http://www.linuxtechi.com/postfix-interview-questions-answers/ | 2014-12-01T20:12:00 | [
"邮件服务器",
"postfix",
"面试"
] | https://linux.cn/article-4346-1.html | 
### 问题1:什么是 Postfix,它的默认端口是多少?
答:Postfix 是一个开源的 MTA(邮件传送代理,英文名:Mail Transfer Agent),用于转发 email。相信很多人知道 Sendmail,而 Postfix 是它的替代品。默认端口是25。
### 问题2:Postfix 和 Sendmail 有什么区别?
答:Postfix 使用模块化设计,由多个独立的可执行程序组成;而 Sendmail 被设计成有一个强大的后台进程提供所有服务。
### 问题3:什么是 MTA,它在邮件系统中扮演什么角色?
答:MTA 是 Mail Transfer Agent (邮件传输代理)的缩写。MTA 负责接收和发送邮件、确定发送路径和地址重写(LCTT译注:address rewriting,就是完善发送地址,比如将“username”这个地址重写为“[[email protected]](mailto:[email protected])”)。本地转发就是将邮件发送给 MDA。Qmail、Postix、Sendmail 都是 MTA。
### 问题4:什么是 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。
### 问题6:邮件服务器里 postmaster 的作用是什么?
答:邮件管理者一般就是 postmaster。一个 postmaster 的责任就是保证邮件系统正常工作、更新系统配置、添加/删除邮箱帐号,以及其他工作。每个域中必须存在一个 postmaster 的别名(LCTT译注:postmaster 别名用于接受一些其它服务器/用户对该邮件系统的沟通邮件,如关于垃圾邮件拒收的投诉等,通常都会直接被邮件服务器的管理员所接受。一些系统错误和提示的邮件,也往往以postmaster 作为发件人),用于将邮件发往正确的用户。
### 问题7:Postfix 都有些什么重要的进程?
答:以下是 Postfix 邮件系统里最重要的后台进程列表:
* **master**:这条进程是 Postfix 邮件系统的大脑,它产生所有其他进程。
* **smtpd**:作为服务器端程序处理所有外部连进来的请求。
* **smtp**:作为客户端程序处理所有对外发起连接的请求。
* **qmgr**:它是 Postfix 邮件系统的心脏,处理和控制邮件队列里面的所有消息。
* **local**:这是 Postfix 自有的本地投递代理MDA,就是它负责把邮件保存到邮箱里。
### 问题8:Postfix 服务器的配置文件是什么?
答:有两个主要配置文件:
* **/etc/postfix/main.cf**:这个文件保存全局配置信息,所有进程都会用到,除非这些配置在 master.cf 文件中被重新设置了。
* **/etc/postfix/master.cf**:这个文件保存了额外的进程运行时环境参数,在 main.cf 文件中定义的配置可能会被本文件的配置覆盖掉。
### 问题9:如何将 Postfix 重启以及设为开机启动?
答:使用这个命令重启:service postfix restart;使用这个命令设为开机启动:chkconfig postfix on
### 问题10:怎么查看 Postfix 的邮件队列?
答:Postfix 维护两个队列:未决邮件队列(pending mails queue)和等待邮件队列(deferred mail queue)。等待队列包含了暂时发送失败、需要重新发送的邮件,Postfix 会定期重发(默认5分钟,可自定义设置)。(LCTT译注:其实 Postfix 维护5个队列:输入队列,邮件进入 Postfix 系统的第一站;活动队列,qmgr 将输入队列的邮件移到活动队列;等待队列,保存暂时不能发送出去的邮件;故障队列,保存受损或无法解读的邮件;保留队列,将邮件无限期留在 Postfix 队列系统中。)
列出邮件队列里面所有邮件:
```
# postqueue -p
```
保存邮件队列名单:
```
# postqueue -p > /mnt/queue-backup.txt
```
让 Postfix 马上处理队列:
```
# postqueue -f
```
### 问题11:如何删除邮件队列里面的邮件?
答:以下命令删除所有邮件:
```
# postsuper -d ALL
```
以下命令只删除等待队列中的邮件:
```
# postsuper -d ALL deferred
```
### 问题12:如何通过命令来检查 Postfix 配置信息?
答:使用postconf -n命令可以查看,它会过滤掉配置文件里面被注释掉的配置信息。
### 问题13:实时查看邮件日志要用什么命令?
答:
```
tail -f /var/log/maillog 或 tailf /var/log/maillog
```
### 问题14:如何通过命令行发送测试邮件?
答:参考下面的命令:
```
# echo "Test mail from postfix" | mail -s "Plz ignore" [email protected]
```
### 问题15:什么是“开放邮件转发(Open Relay)”?
答:开放邮件转发是 SMTP 服务器的一项设定,允许因特网上任意的其他用户能通过该服务器转发邮件,而不是直接发送到某个帐号的服务器或只允许授权用户通过它来发送邮件。过去,这项功能在许多邮件服务器中都是默认开启的,但是现在已经不再流行了,因为邮件转发会导致大量垃圾邮件和病毒邮件在网络上肆虐。
### 问题16:什么是 Postfix 上的邮件转发主机?
答:转发主机是 SMTP 的地址,如果在配置文件中有配置,那么所有输入邮件都将被 SMTP 服务器转发。
### 问题17:什么是灰名单?
答:灰名单(LCTT译注:介于白名单和黑名单之间)是一种用于拦截垃圾邮件的技术。一个 MTA 使用灰名单时就会“暂时拒绝”未被识别的发送者发来的所有邮件。如果邮件是正当合理的,发起者会在一段时间后重新发送,然后这份邮件就能被接收。(LCTT译注:灰名单基于这样一个事实,就是大多数的垃圾邮件服务器和僵尸网络的邮件只发送一次,而会忽略要求它们在一定的时间间隔后再次发送的请求。)
### 问题18:邮件系统中 SPF 记录有什么重要作用?
答:SPF 是 Sender Policy Framework 的缩写,用于帮助邮件域的拥有者确认发送方是否来自他们的域,目的是其他邮件系统能够保证发送方在发送邮件时来自经过授权的来源 —— 这种方法可以减小遇到邮件地址欺骗、网络钓鱼和垃圾邮件的风险。
### 问题19:邮件系统中 DKIM 有什么用处?
答:域名密匙是一套电子邮件身份认证系统,用于验证邮件发送方的 DNS 域和邮件的完整性。域名密匙规范采用互联网电子邮件认证技术,建立了一套加强版协议:域名密匙识别邮件(就是 DKIM)。
### 问题20:邮件系统中 ASSP 的规则是什么?
答:ASSP(Anti-Spam SMTP Proxy,反垃圾代理) 是一个网关服务器,安装在你的 MTA 前面,通过自建白名单、自动学习贝叶斯算法、灰名单、DNS 黑名单(DNSBL)、DNS 白名单(DNSWL)、URI黑名单(URIBL)、SPF、SRS、Backscatter、病毒扫描功能、附件阻拦功能、基于发送方等多种方法来反垃圾邮件。
---
via: <http://www.linuxtechi.com/postfix-interview-questions-answers/>
作者:[Pradeep Kumar](http://www.linuxtechi.com/author/pradeep/) 译者:[bazz2](https://github.com/bazz2) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,347 | Linux系统管理员的命令行工具箱目录 | http://xmodulo.com/2014/08/useful-cli-tools-linux-system-admins.html | 2014-12-01T20:37:00 | [
"系统管理员",
"命令行",
"工具"
] | https://linux.cn/article-4347-1.html | 系统管理员(sysadmins)负责日常维护生产系统和服务。其中一个关键任务就是保证功能性服务能24小时工作。为了这个,他们得很小心地计划备份方式,灾难管理策略,定时维护,安全审查,等等。和任意其他管理一样,系统管理员也有他们的必备工具。在正确的时间正确的情况下使用合适的工具,可以帮助维护操作系统的健壮,达到最小的服务中断时间和最大的运行时间。

这篇文章会介绍一些系统管理员日常活动中最常用和有效的命令行工具。如果你想推荐其他没在这里列出来的好用的工具,别忘了在评论区里分享一下。
### 网络工具
1. **ping**:通过ICMP回应/回复报文来检查远端主机的端到端连接性(RTT延时,抖动,丢包)。用来检查系统状态和可连接性很不错。
2. **[hping](http://www.hping.org/)**:网络扫描和检测工具,可以产生ICMP/TCP/UDP ping数据包。常常用于高级端口扫描,防火墙测试,手动MTU路径发现和碎片测试。
3. **traceroute**:通过TTL限定的ICMP/UDP/TCP侦测包来发现从本地主机到远端目标主机之间的第三层转发路径。用来调试网络连接性和路由问题。
4. **mtr**:traceroute的一个变种,能根据运行时统计数据整理出每一跳的包丢失/抖动。用来评估路由路径延时很不错。
5. **[netcat](http://netcat.sourceforge.net/)/[socat](http://www.dest-unreach.org/socat/)**:TCP/IP网络里的瑞士军刀,可以读/写 TCP/UDP 协议字节流。用来调试防火墙策略和服务可用性很不错。
6. **dig**:DNS调试工具,可以生成正向查询,反向查询,搜索域名服务器,检查CNAME,MX和其他DNS记录。可以在侦错的时候查询特定的DNS服务器。
7. **nslookup**:另外一个DNS检查/调试工具。支持所有DNS查询和记录。可以查询特定DNS服务器。
8. **dnsyo**:一个DNS测试工具,通过对全世界1500个不同网络中的大量开放解析器执行DNS查询来测试DNS传输。
9. **lsof**:显示进程打开的文件信息(例如,普通文件,管道或套接字)。用来监视网络连接很不错。
10. **iftop**:一个基于ncurses的命令行界面应用,可以实时监视各个网络物理接口上的网络连接和带宽占用。用来记录霸占带宽的应用、用户、目的地和端口等很不错。
11. **netstat**:一个网络统计工具,可以显示状态以及统计信息,当前网络连接(TCP/UDP端口,IP地址)、路由表、TX/RX traffic以及网络协议。用来做网络相关诊断和性能调试很不错。
12. **[tcpdump](http://www.tcpdump.org/)**:一个常用的基于libpcap抓包库的包侦测工具。可以按伯克利包过滤器格式定义抓包条件。
13. **[tshark](https://www.wireshark.org/docs/man-pages/tshark.html)**:另一个命令行抓包工具,和它的GUI版本Wireshark完全兼容。支持[1000种协议](https://www.wireshark.org/docs/dfref/)而且这个列表还在增加。用来调试、分析和保存实时网络封包信息很不错。
14. **ip**:一个多功能的命令行网络工具,是iproute2包的一部分。可以检查和修改路由表、网络设备状态以及IP隧道设置。用来查看路由表、增加/删除静态路由、配置网络接口、以及调试路由问题很有用。
15. **ifup/ifdown**:用来激活和关闭特定的网络接口。经常用于重启整个网络服务。
16. **[autossh](http://www.harding.motd.ca/autossh/)**:一个能建立SSH连接并在断线后自动重新连接的程序。用来创建长时间保持的穿越严格企业网络的SSH隧道很有用。
17. **iperf**:一个网络测试工具,通过在发送自定义TCP/UDP数据流来衡量主机间双向最大吞吐量。
18. **[elinks](http://elinks.or.cz/)/[lynx](http://lynx.isc.org/)**:为基于命令行的服务器环境下使用的基于文字的网页浏览器。
### 安全工具
1. **[iptables](http://www.netfilter.org/projects/iptables/)**:一个用户空间下的命令行工具,用于配置Linux内核防火墙。可以创建和修改Linux内核空间的网络包接收、转发和发送规则。
2. **[nmap](http://nmap.org/)**:一个常用的为了安全审查目的的端口扫描和网络发现工具。用来在本地网络中找出哪些主机开机并运行起来了以及某台特定主机打开了哪些端口很有用。
3. **[TCP Wrappers](http://en.wikipedia.org/wiki/TCP_Wrapper)**:一个主机端的网络访问控制列表工具,可以过滤进入/出去的网络请求/回复。经常配合iptables一起使用,作为额外一层安全保护。
4. **getfacl/setfacl**:查看和定制文件和目录的访问控制列表,作为传统文件权限的扩展。
5. **cryptsetup**:用于创建和管理LUKS加密磁盘分区。
6. **lynis**:一个命令行的漏洞扫描工具。可以扫描整个Linux系统,并汇报潜在的漏洞以及相关可能解决方案。
7. **maldet**:一个恶意软件扫描命令行工具,可以检测和隔离潜在的感染文件。可以在后台运行长期监视。
8. **[rkhunter](http://rkhunter.sourceforge.net/)/[chkrootkit](http://www.chkrootkit.org/)**:一个命令行工具,可以扫描本地系统里的潜在木马、隐藏后门和可疑利用,并禁用它们。
### 存储工具
1. **fdisk**:一个磁盘分区编辑工具。用于查看、创建和修改本地磁盘或可移动磁盘的分区。
2. **sfdisk**:fdisk的一个变种,能用一种非交互的方式访问或更新磁盘分区表。用来自动化备份和恢复过程中的磁盘分区很有用。
3. **[parted](http://www.gnu.org/software/parted/)**:另一个磁盘分区编辑器,支持超过2TB的磁盘的GPT(GUID分区表)格式。gparted是parted的一个前端GTK+图形界面。
4. **df**:用来查看不同分区或文件路径的已用/可用存储空间和挂载点。还有一个更易用的变种dfc。
5. **du**:用来查看不同文件和目录的当前磁盘占用情况(例如,du -sh \*)。
6. **mkfs**:一个磁盘格式化命令,用来在独立磁盘分区上建立文件系统。有多个文件系统相关的版本:ext2、ext3、ext4、bfs、ntfs、vfat/fat。
7. **fsck**:一个命令行工具,用来检查文件系统错误并尝试可能的修复。通常在启动时自动运行,但是在卸载一个分区后也可以根据需要手动运行。
8. **mount**:用来映射一个物理磁盘分区、网络共享或远程存储到一个本地挂载点。任何对挂载点里的读/写操作都是对应实际存储的实际数据读/写。
9. **mdadm**:一个命令行工具,用来管理物理块设备上的软件RAID设备。可以创建、构造、增长或监视RAID阵列。
10. **lvm**:一套命令行工具集,用来管理卷分组和物理/逻辑卷,可以用最小的停机时间在多个物理磁盘上创建、调整大小、拆分和合并卷。
### 日志访问工具
1. **tail**:用来查看一个(增长中的)日志文件的尾部。有几个变种,包括multitail(多窗口查看)和[ztail](https://hackage.haskell.org/package/ztail)(支持inotify和正则表达式过滤以及颜色)。
2. **logrotate**:一个命令行工具,可以在根据设定的时间段拆分、压缩并通过邮件发送旧的/大的日志文件。用来管理可能产生大量日志文件的繁忙主机很有用。
3. **grep/egrep**:可以通过特定的模式或正则表达式过滤日志内容。变种包括用户更友好的ack和速度更快的ag。
4. **awk**:一个多功能的文本扫描和处理工具。常用于从文本/日志文件中找出特定的列或内容,并输出给其他工具。
5. **sed**:一个文本流编辑工具,可以过滤和改变(例如,删除行/空格、替换/转换单词、增加计数)文本流并通过管道连接到stdout/stderr或者其他工具。
### 备份工具
1. **[rsync](http://rsync.samba.org/)**:一个快速的单向增量备份和镜像工具(LCTT 译注:rsync 应是双向的)。常用于复制一个数据仓库到线下存储,可以选择通过SSH或stunnel的加密连接。
2. **[rdiff-backup](http://www.nongnu.org/rdiff-backup/)**:另一个有效利用带宽的增量备份工具。管理两个连续快照之间的差分。
3. **duplicity**:一个加密的增量备份工具。使用GnuPG加密备份,并通过SSH上传到远程服务器。
### 性能监视工具
1. **top**:一个命令行的进程查看程序。可以监视系统负载、进程状态、CPU和内存占用。有一个更易用的变种htop。
2. **ps**:显示系统所有运行中进程的一个快照。输出可以定制成显示PID、PPID、用户、负载、内存、积累的用户/系统时间、启动时间、以及更多。有一个变种pstree可以用树结构显示进程。
3. **[nethogs](http://nethogs.sourceforge.net/)**:一个带宽监视工具,按进程来分组显示活动网络连接,实时汇报每个进程占用的(上传/下载)带宽。
4. **ngxtop**:一个网页服务器访问日志解析和监视工具,界面受到了top命令启发。它可以实时汇报整理过的页面请求列表,包括频率、大小、HTTP返回值、IP地址,等等。
5. **vmstat**:一个简单的命令行工具,可以显示多个实时系统特征,例如进程数、剩余内存、分页状态、CPU占用、块设备I/O活动、中断/上下文切换统计、等等。
6. **iotop**:一个基于ncurses的I/O监视工具,可以实时排序显示所有运行中进程的磁盘I/O活动。
7. **iostat**:一个命令行工具,可以汇报当前CPU使用情况,以及设备I/O使用情况,这里的I/O使用情况(例如,块传输速度、字节读/写速度)是按设备或分区来汇报的。
### 效率工具
1. **screen**:用来把一个单一的终端拆分成多个持久的虚拟终端,也支持远程用户访问,类似teamviewer的屏幕分享功能。
2. **tmux**:另一个终端复用工具,可以支持多个长期会话,还可以横向/纵向拆分终端。
3. **cheat**:一个简单的命令行工具,可以让你查看多个常用Linux命令的备忘录,就在手边非常方便。内建的备忘录也可以完全定制。
4. **apropos**:用来在帮助手册里查找描述或关键字很有用。
### 包管理工具
1. **apt**:基于Debian系统的事实上的包管理工具,例如Debian、Ubuntu或Backtrack。一个救生圈。
2. **apt-fast**:apt-get的一个支撑应用,可以通过多个并行连接明显提高apt-get的下载速度。
3. **apt-file**:用来查看某个特定文件属于哪个.deb包,或者显示一个特定.deb包里的所有文件。已安装和未安装的包都能支持。
4. **dpkg**:一个用来手动安装.deb包的命令行工具。强烈建议尽可能的使用apt。
5. **yum**:用于基于红帽的系统的自动包管理工具,比如RHEL、CentOS或Fedora。这是另一个救生圈!
6. **rpm**:通常我都是使用 rpm 来配合 yum 使用。有很多有用的参数,比如-q、-f、-l可以分别用来查询、指定文件和路径。
### 硬件工具
1. **lspci**:一个命令行工具,可以显示已安装的PCI设备的各种信息,比如型号名称、设备驱动、设备功能、内存地址、PCI总线地址。
2. **lshw**:一个命令行工具,可以查询和显示不同分类下的硬件配置的详细信息(例如,处理器、内存、主板、网络、存储)。支持多重输出格式:html、xml、json、text。
3. **[inxi](http://code.google.com/p/inxi/)**:一个综合硬件查看工具,可以提供不同硬件模块的总览,例如CPU,显卡,声卡,网卡,温度/风扇传感器,等等。
如果你希望推荐没有列在这里的好用的工具,不要客气,在评论区里分享一下。
---
via: <http://xmodulo.com/2014/08/useful-cli-tools-linux-system-admins.html>
作者:[Sarmed Rahman](http://xmodulo.com/author/sarmed) 译者:[zpl1025](https://github.com/zpl1025) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,348 | 解决八种Linux硬盘问题的技巧 | http://www.cyberciti.biz/datacenter/linux-unix-bsd-osx-cannot-write-to-hard-disk/ | 2014-12-01T21:08:05 | [
"硬盘",
"故障"
] | https://linux.cn/article-4348-1.html | 不能在Linux或者类UNIX系统的硬盘上写入数据?想解决服务器上磁盘损坏的问题吗?想知道你为什么总是在屏幕上看到“磁盘已满”的字眼吗?想学习处理这些问题的办法吗?试试一下这8个解决Linux及UNIX服务器硬盘问题的小贴士吧。

### #1 - 错误: 设备上无剩余空间
当你的类UNIX系统磁盘写满了时你会在屏幕上看到这样的信息。本例中,我运行[fallocate命令](http://www.cyberciti.biz/faq/howto-create-lage-files-with-dd-command/)然后我的系统就会提示磁盘空间已经耗尽:
```
$ fallocate -l 1G test4.img
fallocate: test4.img: fallocate failed: No space left on device
```
第一步是运行df命令来查看一个有分区的文件系统的总磁盘空间和可用空间的信息:
```
$ df
```
或者试试可读性比较强的输出格式:
```
$ df -h
```
部分输出内容:
```
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 117G 54G 57G 49% /
udev 993M 4.0K 993M 1% /dev
tmpfs 201M 264K 200M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1002M 0 1002M 0% /run/shm
/dev/sda1 1.8G 115M 1.6G 7% /boot
/dev/sda7 4.7G 145M 4.4G 4% /tmp
/dev/sda9 9.4G 628M 8.3G 7% /var
/dev/sda8 94G 579M 89G 1% /ftpusers
/dev/sda10 4.0G 4.0G 0 100% /ftpusers/tmp
```
使用df命令输出可以清楚地发现,在 /dev/sda10 分区下总共4.0Gb的空间被全部写满了。
#### 修复磁盘写满的问题
1.[用gzip,bzip2或tar命令压缩未压缩的日志和其它文件](http://www.cyberciti.biz/howto/question/general/compress-file-unix-linux-cheat-sheet.php):
```
gzip /ftpusers/tmp/*.log
bzip2 /ftpusers/tmp/large.file.name
```
2.在类UNIX系统中[用rm命令删除不想要的文件](http://www.cyberciti.biz/faq/howto-linux-unix-delete-remove-file/):
```
rm -rf /ftpusers/tmp/*.bmp
```
3.[用rsync命令移动文件至其它系统或外置硬盘](http://www.cyberciti.biz/faq/linux-unix-bsd-appleosx-rsync-delete-file-after-transfer/):
```
rsync --remove-source-files -azv /ftpusers/tmp/*.mov /mnt/usbdisk/
rsync --remove-source-files -azv /ftpusers/tmp/*.mov server2:/path/to/dest/dir/
```
4.在类UNIX系统中[找出最占磁盘空间的目录或文件](http://www.cyberciti.biz/faq/how-do-i-find-the-largest-filesdirectories-on-a-linuxunixbsd-filesystem/):
```
du -a /ftpusers/tmp | sort -n -r | head -n 10
du -cks * | sort -rn | head
```
5.[清空指定文件](http://www.cyberciti.biz/faq/truncate-large-text-file-in-unix-linux/)。这招对日志文件很有效:
```
truncate -s 0 /ftpusers/ftp.upload.log
### bash/sh等 ##
>/ftpusers/ftp.upload.log
## perl ##
perl -e'truncate "filename", LENGTH'
```
6.在Linux和UNIX中找出并删除显示着但已经被删除的大文件:
```
## 基于Linux/Unix/OSX/BSD等系统 ##
lsof -nP | grep '(deleted)'
## 只基于Linux ##
find /proc/*/fd -ls | grep '(deleted)'
```
清空它:
```
## 基于Linux/Unix/OSX/BSD等所有系统 ##
> "/path/to/the/deleted/file.name"
## 只基于Linux ##
> "/proc/PID-HERE/fd/FD-HERE"
```
### #2 - 文件系统是只读模式吗?
当你尝试新建或保存一个文件时,你可能最终得到诸如以下的错误:
```
$ cat > file
-bash: file: Read-only file system
```
运行mount命令来查看被挂载的文件系统是否处于只读状态:
```
$ mount
$ mount | grep '/ftpusers'
```
在基于Linux的系统中要修复这个问题,只需将这个处于只读状态的文件系统重新挂载即可:
```
# mount -o remount,rw /ftpusers/tmp
```
(LCTT 译注:如果硬盘由于硬件故障而 fallback 到只读模式,建议不要强制变回读写模式,而是赶快替换硬盘)
另外,我是这样[用rw模式重新挂载FreeBSD 9.x服务器的根目录](http://www.cyberciti.biz/faq/howto-freebsd-remount-partition/)的:
```
# mount -o rw /dev/ad0s1a /
```
### #3 - Am I running out of inodes?
有时候,df命令能显示出磁盘有空余的空间但是系统却声称文件系统已经写满了。此时你需要用以下命令来检查能在文件系统中识别文件及其属性的[索引节点](http://www.cyberciti.biz/tips/understanding-unixlinux-filesystem-inodes.html):
```
$ df -i
$ df -i /ftpusers/
```
部分输出内容:
```
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%被使用了,试试看以下的选项:
* 找出不想要的文件并删除它,或者把它移动到其它服务器上。
* 找出不想要的大文件并删除它,或者把它移动到其它服务器上。
(LCTT 译注:如果一个分区存储了太多的小文件,会出现 inode 用完而存储扇区还有空闲的情况,这种情况下要么清除小文件或在不需要独立访问的情况下将它们打包成一个大文件;要么将数据保存好之后重新分区,并设置分区的 -t news 属性,增加 inode 分配)
### #4 - 我的硬盘驱动器宕了吗?
[日志文件中的输入/输出错误(例如 /var/log/messages)](http://www.cyberciti.biz/tips/linux-find-out-if-harddisk-failing.html)说明硬盘出了一些问题并且可能已经失效,你可以用smartctl命令来查看硬盘的错误,这是一个在类UNIX系统下控制和监控硬盘状态的一个命令。语法如下:
```
smartctl -a /dev/DEVICE
# 在Linux服务器下检查 /dev/sda
smartctl -a /dev/sda
```
你也可以用"Disk Utility"这个软件来获得同样的信息。
[](http://www.cyberciti.biz/tips/linux-find-out-if-harddisk-failing.html)
图 01: Gnome磁盘工具(Applications > System Tools > Disk Utility)
>
> **注意**: 不要对S.M.A.R.T.工具期望太高,它在某些状况下无法工作,我们要定期做备份。
>
>
>
### #5 - 我的硬盘驱动器和服务器是不是太热了?
高温会引起服务器低效,所以你需要把服务器和磁盘维持在一个平稳适当的温度,高温甚至能导致服务器宕机或损坏文件系统和磁盘。[用hddtemp或smartctl功能,通过从支持S.M.A.R.T.功能的硬盘上读取数据的方式,从而查出你的Linux或基于UNIX系统上的硬盘温度](http://www.cyberciti.biz/tips/howto-monitor-hard-drive-temperature.html)。只有现代硬驱动器有温度传感器。hddtemp功能也支持从SCSI驱动器读取S.M.A.R.T.信息。hddtemp能作为一个简单的命令行工具或守护程序来从所有服务器中获取信息:
```
hddtemp /dev/DISK
hddtemp /dev/sg0
```
部分输出内容如下:
[](http://www.cyberciti.biz/datacenter/linux-unix-bsd-osx-cannot-write-to-hard-disk/attachment/hddtemp-on-rhel/)
图 02: hddtemp正在运行
你也可以像下面显示的那样使用smartctl命令:
```
smartctl -d ata -A /dev/sda | grep -i temperature
```
#### 我怎么获取CPU的温度
你可以使用Linux硬件监控工具,例如像[用基于Linux系统的lm\_sensor功能来获取CPU温度](http://www.cyberciti.biz/faq/howto-linux-get-sensors-information/):
```
sensors
```
Debian服务器的部分输出内容:
[](http://www.cyberciti.biz/datacenter/linux-unix-bsd-osx-cannot-write-to-hard-disk/attachment/sensors-command-on-debian-server/)
图 03: sensors命令提供了一台Linux计算机的CPU核心温度和其它信息
### #6 - 处理损坏的文件系统
服务器上的文件系统可能会因为硬件重启或一些其它的错误比如坏的扇区而损坏。你可以[用fsck命令来修复损坏的文件系统](http://www.cyberciti.biz/tips/repairing-linux-ext2-or-ext3-file-system.html):
```
umount /ftpusers
fsck -y /dev/sda8
```
来看看[怎么应对Linux文件系统故障](http://www.cyberciti.biz/tips/surviving-a-linux-filesystem-failures.html)的更多信息。
### #7 - 处理Linux中的软阵列
输入以下命令来查看Linux软阵列的最近状态:
```
## 获得 /dev/md0 上磁盘阵列的具体内容 ##
mdadm --detail /dev/md0
## 查看状态 ##
cat /proc/mdstat
watch cat /proc/mdstat
```
部分输出内容:
[](http://www.cyberciti.biz/datacenter/linux-unix-bsd-osx-cannot-write-to-hard-disk/attachment/linux-mdstat-output/)
图 04: 查看Linux软阵列状态命令
你需要把有故障的硬件驱动器更换掉,别删错了。本例中,我更换了 /dev/sdb (RAID 6中的第二个硬件驱动器)。没必要依靠离线存储文件来修复Linux上的磁盘阵列,因为这只在你的服务器支持热插拔硬盘的情况下才能工作:
```
## 从一个md0阵列中删除磁盘 ##
mdadm --manage /dev/md0 --fail /dev/sdb1
mdadm --manage /dev/md0 --remove /dev/sdb1
# 对 /dev/sdbX 的剩余部分做相同操作 ##
# 如果不是热插拔硬盘就执行关机操作 ##
shutdown -h now
## 从 /dev/sda 复制分区表至新的 /dev/sdb 下 ##
sfdisk -d /dev/sda | sfdisk /dev/sdb
fdisk -l
## 添加 ##
mdadm --manage /dev/md0 --add /dev/sdb1
# 对 /dev/sdbX 的剩余部分做相同操作 ##
# 现在md0会再次同步,通过显示屏查看 ##
watch cat /proc/mdstat
```
来看看[加快Linux磁盘阵列同步速度的小贴士](http://www.cyberciti.biz/tips/linux-raid-increase-resync-rebuild-speed.html)来获取更多信息。
### #8 - 处理硬阵列
你可以用samrtctl命令或者供应商特定的命令来查看磁盘阵列和你所管理的磁盘的状态:
```
## SCSI磁盘
smartctl -d scsi --all /dev/sgX
## Adaptec磁盘阵列
/usr/StorMan/arcconf getconfig 1
## 3ware磁盘阵列
tw_cli /c0 show
```
对照供应商特定文档来更换你的故障磁盘。
### 监控磁盘的健康状况
来看看我们先前的教程:
1. [Monitoring hard disk health with smartd under Linux or UNIX operating systems](http://www.cyberciti.biz/tips/monitoring-hard-disk-health-with-smartd-under-linux-or-unix-operating-systems.html)
2. [Shell script to watch the disk space](http://www.cyberciti.biz/tips/shell-script-to-watch-the-disk-space.html)
3. [UNIX get an alert when disk is full](http://www.cyberciti.biz/faq/mac-osx-unix-get-an-alert-when-my-disk-is-full/)
4. [Monitor UNIX / Linux server disk space with a shell scrip](http://bash.cyberciti.biz/monitoring/shell-script-monitor-unix-linux-diskspace/)
5. [Perl script to monitor disk space and send an email](http://www.cyberciti.biz/tips/howto-write-perl-script-to-monitor-disk-space.html)
6. [NAS backup server disk monitoring shell script](http://bash.cyberciti.biz/backup/monitor-nas-server-unix-linux-shell-script/)
### 结论
我希望以上这些小贴士会帮助你改善在基于Linux/Unix服务器上的系统磁盘问题。我还建议执行一个好的备份计划从而有能力从磁盘故障、意外的文件删除操作、文件损坏和服务器完全被破坏等意外情况中恢复:
* [Debian / Ubuntu: Install Duplicity for encrypted backup in cloud](http://www.cyberciti.biz/faq/duplicity-installation-configuration-on-debian-ubuntu-linux/)
* [HowTo: Backup MySQL databases, web server files to a FTP server automatically](http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html)
* [How To Set Red hat & CentOS Linux remote backup / snapshot server](http://www.cyberciti.biz/faq/redhat-cetos-linux-remote-backup-snapshot-server/)
* [Debian / Ubuntu Linux install and configure remote filesystem snapshot with rsnapshot incremental backup utility](http://www.cyberciti.biz/faq/linux-rsnapshot-backup-howto/)
* [Linux Tape backup with mt And tar command tutorial](http://www.cyberciti.biz/faq/linux-tape-backup-with-mt-and-tar-command-howto/)
---
via: <http://www.cyberciti.biz/datacenter/linux-unix-bsd-osx-cannot-write-to-hard-disk/>
作者:[nixCraft](http://www.cyberciti.biz/tips/about-us) 译者:[ZTinoZ](https://github.com/ZTinoZ) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,350 | 使用 UbuTricks 在ubuntu上安装最新游戏和应用 | http://www.ubuntugeek.com/ubutricks-script-to-install-the-latest-versions-of-several-games-and-applications-in-ubuntu.html | 2014-12-02T10:49:00 | [
"UbuTricks",
"Ubuntu",
"安装"
] | https://linux.cn/article-4350-1.html | UbuTricks是一个可以帮助你在ubuntu上安装几个最新版本的游戏和应用的程序。
UbuTricks是一个有简单界面,基于Zenity的图形脚本。虽然早期开发中,它的目标是通过简单的界面操作来安装Ubuntu14.04 及以后发行版上应用程序的更新。
应用程序会自动下载安装。一些更新可能会需要ppa,其它的将会通过编译源代码安装。编译过程可能会需要一些时间,当从ppa或者deb文件安装应该会快一点,取决于你的下载速度。
### 一共有以下几种安装方式:
* PPA - 程序将会从PPA下载安装
* DEB - 程序将会从DEB文件进行安装
* Source - 程序会进行编译安装 (可能需要一点时间)
* Script - 程序会通过开发者提供的脚本进行安装
* Archive - 程序会通过压缩文件安装
* Repository - 程序从仓库安装 (不是PPA)
### 你可以安装的应用程序列表
通过UbuTricks可以安装下面应用的最新版本:
### 游戏
* 0 A.D.
* Battle for Wesnoth (Dev)
* VCMI (Heroes III Engine)
### 文件管理
* PCManFM
### 互联网应用
* Geary
* HexChat
* QupZilla
* QuiteRSS
### 多媒体
* SMPlayer
* Transmageddon
* Kdenlive
* Fotoxx
* jAlbum
* GIMP
* Shutter
* Qmmp
* XBMC
### 办公/电子书/文档
* Calibre
* LibreOffice
### 工具
* Ubuntu Tweak
### 桌面环境
* Cinnamon
### 其他
* Google Earth
* Wine
### 下载,安装Ubuntutricks
你可以从[这里](http://www.tuxarena.com/intro/files/ubutricks.sh)下载ubuntutricks,让它可执行然后双击脚本或者从终端里运行它。
### 截图




---
via: <http://www.ubuntugeek.com/ubutricks-script-to-install-the-latest-versions-of-several-games-and-applications-in-ubuntu.html>
作者:[ruchi](http://www.ubuntugeek.com/author/ubuntufix) 译者:[DoubleShit](https://github.com/DoubleShit) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 200 | OK | # UbuTricks – Script to install the latest versions of several games and applications in Ubuntu
**Sponsored Link**
UbuTricks is a Zenity-based, graphical script with a simple interface. Although early in development, its aim is to create a simple, graphical way of installing updated applications in Ubuntu 14.04 and future releases.
Apps will be downloaded and installed automatically. Some will require a PPA to be added to the repositories. Others will be compiled from source if no PPA is available. The compilation process can take a long time, while installing from a PPA or DEB file should be quick, depending on your download speed.
**The install methods are as follows:**
PPA – the program will be downloaded and installed from a PPA
DEB – the program will be installed from a DEB package
Source – the program will be compiled (may take a long time)
Script – the program will be installed using a script provided by the developer
Archive – the program will be installed from a compressed archive
Repository – the program will be installed from a repository (not PPA)
**List of applications you can install**
The latest versions of the following applications can be installed via UbuTricks:
**Games**
0 A.D.
Battle for Wesnoth (Dev)
VCMI (Heroes III Engine)
**File Managers**
PCManFM
**Internet**
Geary
HexChat
QupZilla
QuiteRSS
**Multimedia**
SMPlayer
Transmageddon
Kdenlive
Fotoxx
jAlbum
GIMP
Shutter
Qmmp
XBMC
**Office/Ebooks/Documents**
Calibre
LibreOffice
**Tools**
Ubuntu Tweak
**Desktop Environments**
Cinnamon
**Other**
Google Earth
Wine
**Download and install Ubuntutricks script**
You can download ubuntutricks script from [here](http://www.tuxarena.com/intro/files/ubutricks.sh) Once downloaded, make it executable and either double-click the script or run it from the terminal.
**Screenshots**
Great script.
User friendly.
Well done. |
4,351 | Qshutdown – 一个先进的关机神器 | http://www.ubuntugeek.com/qshutdown-an-avanced-shutdown-tool.html | 2014-12-02T11:25:00 | [
"关机",
"qshutdown"
] | https://linux.cn/article-4351-1.html | qshutdown是一个QT程序,用于让计算机在指定时间或者在几分钟后关机/重启/挂起/睡眠。对于那些只在特定时间使用计算机工作的人而言,可能很有用。

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”这里\*替换为你的“用户名”或“%组名”。
倒计时最大计数为1440分钟(24小时)。配置文件(和日志文件)位于~/.qshutdown,配置文件为:qshutdown.conf。
对于管理员:
在将qshutdonw.conf中的Lock\_all选项设置为true后,用户将不能修改设置。如果你使用“sudo chown root -R ~/.qshutdown”和“sudo chmod 744 ~/.qshutdown/qshutdown.conf”命令修改qshutdown.conf的权限后,用户将不能修改配置文件。
### Ubuntu中安装Qshutdown
打开终端,然后运行以下命令
```
sudo apt-get install qshutdown
```
### 屏幕截图



---
via: <http://www.ubuntugeek.com/qshutdown-an-avanced-shutdown-tool.html>
作者:[ruchi](http://www.ubuntugeek.com/author/ubuntufix) 译者:[GOLinux](https://github.com/GOLinux) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 200 | OK | # Qshutdown – An avanced shutdown tool
**Sponsored Link**
qshutdown will show it self 3 times as a warning if there are less than 70 seconds left. (if 1 Minute or local time +1 Minute was set it’ll appear only once.)
This program uses qdbus to send a shutdown/reboot/suspend/hibernate request to either the gnome- or kde-session-manager, to HAL or to DeviceKit and if none of these works, the command ’sudo shutdown’ will be used (note that when sending the request to HAL or DeviceKit, or the shutdown command is used, the Session will never be saved. If the shutdown command is used, the program will only be able to shutdown and reboot). So if nothing happens when the shutdown- or reboot-time is reached, it means that one lacks the rights for the shutdown command.
In this case one can do the following:
Post the following in a terminal: "EDITOR:nano sudo -E visudo" and add this line: "* ALL = NOPASSWD:/sbin/shutdown" whereas * replaces the username or %groupname.
Configurationfile qshutdown.conf
The maximum Number of countdown_minutes is 1440 (24 hours).The configurationfile (and logfile) is located at ~/.qshutdown
For admins:
With the option Lock_all in qshutdown.conf set to true the user won’t be able to change any settings. If you change the permissions of qshutdown.conf with "sudo chown root -R ~/.qshutdown" and "sudo chmod 744 ~/.qshutdown/qshutdown.conf", the user won’t be able to change anything in the configurationfile.
**Install Qshutdown in Ubuntu**
Open the terminal and run the following command
sudo apt-get install qshutdown
**Screenshots**
This looks nicely configurable but does it have Unity integration like EasyShutdown?
Can’t get this to work.. When timer ends, the exit-window pops up, asking if I wanna logout/hibernate/reboot or shutdown.. Any workaround for this? |
4,353 | Linux 有问必答:如何从VirtualBox中从主机访问NAT客户机 | http://ask.xmodulo.com/access-nat-guest-from-host-virtualbox.html | 2014-12-02T11:44:41 | [
"VirtualBox",
"NAT",
"端口转发"
] | /article-4353-1.html |
>
> **提问**: 我有一台运行在VirtualBox上的使用NAT的虚拟机,因此虚拟机会被VirtualBox分配一个私有IP地址(10.x.x.x)。如果我想要从主机SSH到虚拟机中,我该怎么做?
>
>
>
VirtualBox对虚拟机支持几种不同的网络方式,其中一种是NAT网络。当虚拟机启用NAT后,VirtualBox会自动在虚拟机和主机之间进行网络翻译,因此你不必在虚拟机和主机之间配置任何东西。这也意味着NAT中的虚拟机对于外部网络以及主机本身是不可见的。这会在你想要从主机访问虚拟机时会产生问题(比如SSH)。
如果你想从VirtualBox的NAT环境的虚拟机,你可以在GUI或者命令行下启用VirtualBox NAT的端口转发。本篇教程将会演示**如何通过启用22端口转发而从主机SSH连接到NAT环境的客户机**。如果你先想要从HTTP访问NAT的客户机,用80端口代替22端口即可。
### 通过GUI配置VirtualBox端口转发
在VirtualBox中选择你想要访问的虚拟机,打开虚拟机的“设置”。点击左侧的“网络”菜单,点击网络适配选项的“高级”。

点击“端口转发”按钮

你会看到一个配置端口转发规则的窗口。点击右上角的“添加”图标。

就会看到像下面那样的转发规则。
* **Name**: SSH (可以是任意唯一名)
* **Protocol**: TCP
* **Host IP**: 127.0.0.1
* **Host Port**: 2222 (任何大于1024未使用的端口)
* **Guest IP**: 虚拟机IP
* **Guest Port**: 22 (SSH 端口)

端口转发的规则会自动在你启动虚拟机的时候启用。为了验证。可以在你启用虚拟机后检查端口2222是否被VirtualBox开启了。
```
$ sudo netstat -nap | grep 2222
```

现在端口转发可以使用了,你可以用下面的命令SSH到虚拟机。
```
$ ssh -p 2222 <login>@127.0.0.1
```
发送到127.0.0.1:2222的登录请求会自动被VirtualBox翻译成10.0.2.15:22,这可以让你SSH到虚拟机中。
### 通过命令行配置VirtualBox端口转发
VirtualBox有一个称为VBoxManage的命令行管理工具。使用命令行工具,你也可以为你的虚拟机设置端口转发。
下面的命令会为IP地址为10.0.2.15的虚拟机设置一个名字为"centos7"的端口转发规则,SSH的端口号为22,映射到本地主机的端口为2222。规则的名字(本例中是SSH)必须是唯一的。
```
$ VBoxManage modifyvm "centos7" --natpf1 "SSH,tcp,127.0.0.1,2222,10.0.2.15,22"
```
规则创建之后,你可以用下面的命令来验证。
```
$ VBoxManage showvminfo "centos7" | grep NIC
```

---
via: <http://ask.xmodulo.com/access-nat-guest-from-host-virtualbox.html>
译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /access-nat-guest-from-host-virtualbox.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275c4f70>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)")) | null |
4,356 | 菜鸟教程:全面学习 pwd 命令 | http://www.tecmint.com/pwd-command-examples/ | 2014-12-02T21:02:00 | [
"pwd",
"命令"
] | https://linux.cn/article-4356-1.html | 对于那些使用Linux命令行的人来说,‘**pwd**‘命令是非常有用的,它告诉你你现在在那个目录,从根目录(**/**)如何到达。特别是对于或许会在目录的切换间容易糊涂的Linux新手而言,‘**pwd**‘ 可以拯救他们。

### 什么是pwd?
‘**pwd**‘ 代表的是‘**Print Working Directory**’(打印当前目录)。如它的名字那样,‘**pwd**’会打印出当前工作目录,或简单的来说就是当前用户所位于的目录。它会打印出以根目录 (**/**)为起点的完整目录名(绝对目录)。这条命令是一条shell内建命令,并且在大多数shell中都可以使用,如bash、Bourne shell,ksh、zsh等等。
#### pwd的基本语法:
```
# pwd [OPTION]
```
#### pwd的选项
| **选项** | **描述** |
| -L (即逻辑路径logical ) | 使用环境中的路径,即使包含了符号链接 |
| -P (即物理路径physical) | 避免所有的符号链接 |
| –help | 显示帮助并退出 |
| –version | 输出版本信息并退出 |
如果同时使用了‘**-L**‘和‘**-P**‘,‘**-L**‘会有更高的优先级。如果没有指定参数,pwd会避开所有的软链接,也就是说会使用‘**-P**‘参数。
pwd的退出状态:
| 0 | 成功 |
| 非零值 | 失败 |
本篇的目的是采用例子让你对‘**pwd**‘有更深入的领悟。
**1.** 打印当前工作目录.
```
avi@tecmint:~$ /bin/pwd
/home/avi
```

*打印工作目录*
**2.** 为文件夹创建一个符号链接(比如说在home目录下创建一个**htm**链接指向**/var/www/html**)。进入新创建的目录并打印出含有以及不含符号链接的目录。
在home目录下创建一个htm链接指向/var/www/html,并进入。
```
avi@tecmint:~$ ln -s /var/www/html/ htm
avi@tecmint:~$ cd htm
```

*创建符号链接*
**3.** 从当前环境中打印目录即使它含有符号链接。
```
avi@tecmint:~$ /bin/pwd -L
/home/avi/htm
```

*打印工作目录*
**4.** 解析符号链接并打印出物理目录。
```
avi@tecmint:~$ /bin/pwd -P
/var/www/html
```

*打印物理工作目录*
**5.** 查看一下“**pwd**”和“**pwd -P**”的输出是否一致,也就是说,如果没有跟上选项,“**pwd**”时候会自动采用**-P**选项。
```
avi@tecmint:~$ /bin/pwd
/var/www/html
```

*检查pwd输出*
**结论:** 上面例子4和5的输出很明显(结果相同),当你“**pwd**”后面不带参数时,pwd会使用“**-P**”选项。
**6.** 打印pwd命令的版本。
```
avi@tecmint:~$ /bin/pwd --version
pwd (GNU coreutils) 8.23
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jim Meyering.
```

*检查pwd命令版本*
**注意:** ‘pwd’ 通常不带选项运行,且没有任何参数
**重要:** 你可能注意到我们刚才运行的都是 “**/bin/pwd**” 而不是 “**pwd**”。
这有什么区别呢?直接使用“**pwd**”意味着使用shell内置的pwd。你的shell可能有不同版本的pwd。具体请参考手册。当你使用的是**/bin/pwd**时,我们调用的是二进制版本的命令。虽然二进制的版本有更多的选项,但是它们两者都能打印当前的目录。
**7.** 打印所有含有可执行pwd的路径
```
avi@tecmint:~$ type -a pwd
pwd is a shell builtin
pwd is /bin/pwd
```

*打印可执行文件路径*
**8.** 存储“**pwd**”命令的值到变量中(比如说:**a** ),并从中打印变量的值(对于观察shell脚本很重要)。
```
avi@tecmint:~$ a=$(pwd)
avi@tecmint:~$ echo "Current working directory is : $a"
Current working directory is : /home/avi
```

*存储pwd的值到变量中*
下面的例子中也可以用**printf**来替代。
**9.** 将工作路径切换到其他地方(比如说 **/home**),并在命令行中显示。通过执行命令(比如说 ‘**ls**‘)来验证一切**OK**。
```
avi@tecmint:~$ cd /home
avi@tecmint:~$ PS1='$pwd> ' [注意例子中的单引号]
> ls
```

*改变当前工作路径*
**10.** 设置多行显示 (就像下面这样),
```
/home
123#Hello#!
```
接着执行命令(比如说 **ls**)来检验一切**OK**。
```
avi@tecmint:~$ PS1='
> $PWD
$ 123#Hello#!
$ '
/home
123#Hello#!
```

*设置多行显示*
**11.** 一下子检查当前工作路径以及先前的工作路径。
```
avi@tecmint:~$ echo “$PWD $OLDPWD”
/home /home/avi
```

*检查当前工作路径*
**12.** pwd文件的绝对路径(以**/**开始)。
```
/bin/pwd
```
**13.** pwd源文件文件的绝对路径(以**/**开始)。
```
/usr/include/pwd.h
```
**13.** pwd手册的绝对路径(以**/**开始)。
```
/usr/share/man/man1/pwd.1.gz
```
**15.** 写一个shell脚本分析home目录下的一个目录(比如**tecmint**)。如果当前目录是**tecmint**就输出“**Well! You are in tecmint directory**”接着输出“**Good Bye**”,不然就在**tecmint**下面创建一个目录并提示你cd进入它。
让我们首先创建一个‘tecmint’目录,在下面创建一个名为‘pwd.sh’的脚本文件。
```
avi@tecmint:~$ mkdir tecmint
avi@tecmint:~$ cd tecmint
avi@tecmint:~$ nano pwd.sh
```
接下来在pwd.sh中加入下面的脚本。
```
#!/bin/bash
x="$(pwd)"
if [ "$x" == "/home/$USER/tecmint" ]
then
{
echo "Well you are in tecmint directory"
echo "Good Bye"
}
else
{
mkdir /home/$USER/tecmint
echo "Created Directory tecmint you may now cd to it"
}
fi
```
给予执行权限并运行。
```
avi@tecmint:~$ chmod 755 pwd.sh
avi@tecmint:~$ ./pwd.sh
Well you are in tecmint directory
Good Bye
```
#### 总结
**pwd**是一个最简单且会广泛用到的命令。掌握好pwd是使用Linux终端的基础。就是这些了。我很快会再带来另外有趣的文章,请不要走开继续关注我们。
---
via: <http://www.tecmint.com/pwd-command-examples/>
作者:[Avishek Kumar](http://www.tecmint.com/author/avishek/) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,360 | 是什么造就了一个优秀的程序员? | http://henrikwarne.com/2014/06/30/what-makes-a-good-programmer/ | 2014-12-03T11:07:10 | [
"程序员",
"编程",
"代码"
] | https://linux.cn/article-4360-1.html | 是什么造就了一个优秀的程序员?首先问问你自己吧,这会是个有趣的问题。它让你反思自己的软件开发技术。这个问题也适合问问你的同事们。它可以带来一些关于如何协同工作的有趣讨论。下面是我认为成为一个优秀程序员必备的五个重要技能。

### 1. 分解问题
编程是为了解决问题,但在你开始写代码前,需要明白如何解决问题。优秀程序员的一项技能是把大的问题逐层分解成一个个更小的部分,直到每一部分都可以很容易解决。但找到解决问题的方式往往并没有那么简单。优秀程序员能找到方法去建立问题模型,这种方法使得输出结果的程序容易解释、实现和测试。
我写过的某些最复杂的程序在局部上都是难懂的,因为代码实现并不能很好地匹配这个问题,也就导致了编写的代码难以理解。当问题很好地建模的时候,我赞同伯尼·科赛尔所说的话(取自著名的[程序员在工作](http://www.amazon.com/review/R2OV0TG7MJGXGL)中的访谈记录):
>
> “……很少有本质上很难的程序。如果你盯着某一块代码,它看起来确实很难;如果你无法理解这段代码应该产生什么结果,这基本上就是暗示它很难被理解了。在这个时候,你不应该卷起袖子,尝试修复代码;你需要只是往回一步,再仔细考虑清楚。当你已经深思熟虑后,你会发现问题变得很简单”。
>
>
>
### 2. 场景分析
优秀开发者能考虑到如何使程序适合多种不同的场景。这项能力既适用于处理程序本身的逻辑,又适用于处理可能会发生的外部和内部事件。为了考虑逻辑上的不同思路,他们问自己这样的问题:如果这个参数为空会发生什么?如果所有条件都为假呢?这个方法在线程上是安全的吗?为了发现软件需要处理的各种类型的事件,他们问自己这样的问题:如果队列占满了会怎样?如果请求收不到响应会怎样?如果在这台服务器重启的同时另外一台服务器也重启了会怎样?
优秀程序员问他们自己:如何发现程序的缺陷?换句话说,他们有能力像测试人员一样思考。相反,缺少经验的程序员通常只考虑正确的路径——在一切都按照预期进行时正常的控制流(当然这也是程序在大部分时候的情况)。当然,异常不可避免要发生,所以需要程序能处理这些情况。
### 3. 命名
编程由大量的命名对象组成:类、方法和变量。当编码完成得很好时,程序也具备了自我描述的能力,也就是说通过阅读源代码可以清楚地明白程序中函数的含义。自描述代码的一个好处就是很自然地产生许多更短的命名方法,而不是少数更长的方法,因为你有更多空间去放置有意义的名字(还有[其它原因](http://henrikwarne.com/2013/08/31/7-ways-more-methods-can-improve-your-program/)解释为什么短小方法更好)。
想出好的名字比它听起来更困难一些。我喜欢这段引用(来自菲尔·卡尔顿):“在计算机科学领域只有两件困难的事情:缓存失效和命名对象。”命名在一定程度上很困难是因为你需要清楚地明白每一个名字究竟要代表什么。有时候命名不是一下子就清晰明了,只有随着软件开发进展才会慢慢显现。因此,重命名和命名一样重要。
命名对象也包含提出要用的概念和这些概念该如何称呼。通过深思熟虑,清楚命名所使用的惯用概念(在程序中和与程序员、非程序员讨论时使用),这使得编写程序变得更加容易。
### 4. 一致性
也许编程中最大的挑战是管理复杂性。保持一致性是处理复杂性的一种方法。它通过允许我们看到对象命名、使用和处理所采用的模式和推理来降低了某些复杂性。有了一致性,我们就无需用脑去记住异常和随机变量。取而代之,我们可以更关注[程序本身的复杂性,而不是偶然产生的复杂性](http://faculty.salisbury.edu/~xswang/Research/Papers/SERelated/no-silver-bullet.pdf)。
保持一致性从整体看来是很重要的。它应用在变量名字和分组、方法命名、模块划分、目录结构、GUI、错误处理、日志输出和文档等很多方面。比如,如果某些变量是的相关,并一起出现(在声明、方法调用或数据库中的列),而且总是以相同的顺序使用它们。那么当其中一个消失或者整体被打乱时,你就会很容易发现。对于一个操作,如果在一个地方叫delete,就不要在另一个地方叫remove:务必使用相同的名字。史蒂夫·麦克奈尔在[代码大全](http://www.amazon.com/review/R269BBARXH1V6R/)中对于使用相反命名有相同的建议。比如,begin和end是相反的,就如同start和stop一样。当使用相反对时不要混用不同对的名字(比如使用begin和stop)。
当修改一段程序时可能会引入非一致性。粗心大意的程序员不会注意到他们添加的代码是否和已有的代码保持一致。优秀程序员会严苛地确保在这些看似很小的细节上都要做到精益求精。他们知道保持一致性对于在软件开发的整个过程中处理复杂性是多么的重要。
### 5. 学习能力
作为一名软件开发者,你需要持续学习。在为软件添加一项新功能前,你必须明白为什么要这么做。在给一个已有程序添加代码前,你通常必须知道已有代码在做什么,以便合适地嵌入新功能。你还需要学习相关系统,以便正确地与它们交互。因此,快速学习的能力使你成为一名更加高效的开发者。
而且,因为软件工程领域的开发速度是如此的快速,所以新的编程语言、工具、技术和框架需要学习层出不穷。这是好还是坏,就看你怎么看。佛瑞德·布鲁克斯把学习能力列为[技能的快乐之一](http://henrikwarne.com/2012/06/02/why-i-love-coding/),对此我深表赞同。学习新事物本身就是令人心满意足的,它也意味着开发者的生活从不无聊。
### 总结
上面所有的技能都是通用的——它们中没有一项是针对某种语言、某个框架或某种技术。如果你拥有它们,你就能快速学习一门新的语言或工具,在新的环境下写出优秀的软件。而且,因为它们在本质上是通用的,所以不会在若干年以后过时。
是什么造就了一个优秀的程序员?以上便是我的观点。你认为造就一个优秀程序员的因素有哪些?在评论里告诉我吧。
---
via: <http://henrikwarne.com/2014/06/30/what-makes-a-good-programmer/>
作者:[Henrik Warne](http://henrikwarne.com/about/) 译者:[KayGuoWhu](https://github.com/KayGuoWhu) 校对:[Caroline](https://github.com/carolinewuyan)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,368 | 当微软离去时 | http://www.linuxinsider.com/story/When-Microsoft-Went-A-Courting-81374.html | 2014-12-03T21:29:24 | [
"微软",
".NET",
"开源"
] | https://linux.cn/article-4368-1.html | 
**开源.Net,“这与Linux无关——它与SaaS相关,也和一位并不偏执和狂热的90后CEO相关,”SoylentNews博主hairyfeet道,“纳德拉很明智,而且意识到了编程语言的价值不在于专利或OS排他性,而在于服务和对语言的支持……越多的平台使用该语言,它就会越好。”**
如果自由和开源软件迷们在过去的那些日子里感到有些许困惑的话,这也许是可以理解的,即便是头昏、头痛以及头晕也算是常见的。
你或许会问,这又是什么新的病症?
好吧,Linux女孩很高兴告诉你,它不是什么病症。不过,然而它并不意味着它很容易治愈。
原因无他,而是微软开源.Net并让它可以在Linux或Mac OS上运行的消息。
是的,你没听错:史蒂夫·鲍尔默曾经可能[称Linux为“癌症”](http://www.linuxinsider.com/perl/story/35697.html),但今天雷蒙德(微软总部,代称微软)有个新发现,曾经不被包容的,但是却转头[“爱”上了Linux](http://linux.cn/article-4056-1.html)!
它让微软看起来很奇怪——它也驱使FOSS迷们聚拢到博客圈的破败的Broken Windows Lounge,而去的人的数量更是空前的。
一杯龙舌兰可以让你不再头疼么?这是现在众多探究的问题之一。
### ‘繁荣的机遇’
“这是个重大的消息,虽然有点过时了,”克里斯·特拉弗斯,一位[博主](http://ledgersmbdev.blogspot.com/),他为[LedgerSMB](http://www.ledgersmb.org/)项目工作,告诉Linux女孩。

“我们生活的世界中,即使没有大的商业公司支持,新的开源编程语言也很兴旺,而闭源的编程语言仅能在大的商业公司的帮助下得到支持,”特拉弗斯说,“例如,Bing闭源杀死了REBOL 2.x。”
“这项运动很明显酝酿已久——一家像微软这样庞大的公司不会有‘突然开源’这种复杂的东西——而我想,在某种程度上,微软一定看到了Sun开源OpenJDK时的一些前兆了。”他暗示道。
同时,“这也为诸如C#和F#这样的语言提供了比当前市场更为兴盛的机会,”特拉弗斯说。
### ‘我仍然不相信你’
“我首先想说,‘谢谢你,微软!’”[Linux Rants](http://linuxrants.com/)博主麦克·斯通开篇说,“我们真的很欣赏你开源.Net并推动它跨平台,这是迈向正确方向的一步!”
“然而,我仍然不相信你。”他补充道。
“我很喜欢微软在考虑开源,但是我没有见到它向GPL迈进,”斯通告诉Linux女孩,“这让我想到了这么个可能性,微软提供了多个平台的软件供你使用,但却会把开发者和它捆绑起来。”
此外,微软不会作出任何保证,保证.Net常年开源,他指出。
“这意味着微软可以退出,并让开发出来的应用程序成为跨平台的Windows专有软件,”他警告道,“我不会相信微软的承诺,我会翘首期盼微软他们的突然而必然的背叛。”
### ‘留心不怀好意的礼物’
该运动明显带有失望的气息,Google+博主阿里桑德罗·埃伯索尔暗示道。
“他们来得太晚了,”埃伯索尔说,“Java已经先下手为强了,当.Net还是Windows/Microsoft专有产品时,Java已经遍布四处了。试着让人采用,希望好运吧。”
此外,“如果它打上GPL烙印来保护代码创建者的话我才会相信它,”他补充道,“一个脆弱的MIT许可证任何时候都是逆天而行的。”
无论如何,“在该公司产生的对FLOSS社区的全部的敌意下,他们会过河拆桥,”埃伯索尔总结道,“底线是:送礼的希腊人也很可畏——仔细留心希腊人不怀好意的礼物……”
### ‘就像猫爱上老鼠’
微软爱上Linux“就像猫爱上老鼠,”博主[罗伯特·伯格森](http://mrpogson.com/)打趣道,“当然,他们会玩玩\*/Linux,但是他们不是我们的朋友。”
所发生的事情是,FOSS和LInux社区已经击溃了“MS自从和IBM达成提供OS的交易后放置在竞争道路入口上的所有障碍,”伯格森说,“MS肯定是在绝望地试着和‘敌人’‘做朋友’,因为它们的位置被侵占了。”
“一切都会好的,”他补充道,“MS仍然可以通过愚蠢地花大量的金钱来制造麻烦,或者他们可以进行常规商业运作并在价格/性能上开展竞争。那不是‘爱’——那是接受现实。”
### 适应或者灭亡
对于微软而言,问题在于“开源开发包对于开发者而言开始变得足够好用了,”参团顾问和[Slashdot](http://slashdot.org/)博主格哈德·麦克。
“在我的最后一份职业中,大多数的程序员想要Eclipse,而不是Visual Studio,即使客户端软件是Windows专用的。用Windows做测试的开发者们迁移到Linux的数量在缓慢增长。”麦克回忆道。
“很要有人想被固定在一个平台中,因此单一平台的语言的份额会越来越少,”他补充道,“微软现在必须在适应与灭亡中作出选择。”
### 这里没有温暖的毛球
驱动此项运动的策略也在于“各种云大量地在Linux上部署,即便在微软自己的Azure云,Linux也被大量部署,”Google+博主凯文·奥布莱恩暗示道。
“纳德拉清楚地指出,他正将微软向云方向推进,因为他几乎不得不如此,以期继续将游戏玩下去。”奥布莱恩坚信。
那就是说,不管怎样,“我都不期待微软变得可爱又善意——他们将做所有他们认为能获得最佳公司利益的事情。”他说。
事实上,“根本没Linux什么事——它只和SaaS相关,也和一位并不偏执和狂热的90后CEO相关,”SoylentNews博主hairyfeet告诉Linux女孩。
“纳德拉很明智,而且意识到了编程语言的价值不在于专利或OS排他性,而在于服务和对语言的支持,”hairyfeet解释道,“考虑到这一点,越多的平台使用该语言,它就会越好,因为那会增加该语言的价值,并且为你的服务带来更多客户。”
### 帝国的没落
总得来说,一切都很明了,那就是“微软帝国正在摇摇欲坠,”Google+博主贡萨洛·维拉斯科 C说。
“我不知道,或者不关心他们为什么会说谎,说他们热爱Linux,”他补充道,“我只希望GNU/Linux社区变得比现今更聪明些(咳,Systemd,咳咳),拒绝微软.Net和其它产生影响的东西。GNU/Linux必须只用FLOSS工具。”
---
via: <http://www.linuxinsider.com/story/When-Microsoft-Went-A-Courting-81374.html>
作者:[Katherine Noyes](http://twitter.com/noyesk) 译者:[GOLinux](https://github.com/GOLinux) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,369 | 如何在 Linux 系统中创建一个云端加密文件系统 | http://xmodulo.com/2014/09/create-cloud-based-encrypted-file-system-linux.html | 2014-12-03T21:49:06 | [
"S3QL",
"文件系统",
"云服务",
"Amazon"
] | https://linux.cn/article-4369-1.html | [Amazon S3](http://aws.amazon.com/s3) 和 [Google Cloud Storage](http://code.google.com/apis/storage/) 之类的商业云存储服务以能承受的价格提供了高可用性、可扩展、无限容量的对象存储服务。为了加速这些云产品的广泛采用,这些提供商为他们的产品通过明确的 API 和 SDK 培养了一个良好的开发者生态系统。而基于云的文件系统便是这些活跃的开发者社区中的典型产品,已经有了好几个开源的实现。
[S3QL](https://bitbucket.org/nikratio/s3ql/) 便是最流行的开源云端文件系统之一。它是一个基于 FUSE 的文件系统,提供了好几个商业或开源的云存储后端,比如 Amazon S3、Google Cloud Storage、Rackspace CloudFiles,还有 OpenStack。作为一个功能完整的文件系统,S3QL 拥有不少强大的功能:最大 2T 的文件大小、压缩、UNIX 属性、加密、基于写入时复制的快照、不可变树、重复数据删除,以及软、硬链接支持等等。写入 S3QL 文件系统任何数据都将首先被本地压缩、加密,之后才会传输到云后端。当你试图从 S3QL 文件系统中取出内容的时候,如果它们不在本地缓存中,相应的对象会从云端下载回来,然后再即时地解密、解压缩。

需要明确的是,S3QL 的确也有它的限制。比如,你不能把同一个 S3FS 文件系统在几个不同的电脑上同时挂载,只能有一台电脑同时访问它。另外,ACL(访问控制列表)也并没有被支持。
在这篇教程中,我将会描述“如何基于 Amazon S3 用 S3QL 配置一个加密文件系统”。作为一个使用范例,我还会说明如何在挂载的 S3QL 文件系统上运行 rsync 备份工具。
### 准备工作
本教程首先需要你创建一个 [Amazon AWS 帐号](http://aws.amazon.com/)(注册是免费的,但是需要一张有效的信用卡)。
然后 [创建一个 AWS access key](http://aws.amazon.com/)(access key ID 和 secret access key),S3QL 使用这些信息来访问你的 AWS 帐号。
之后通过 AWS 管理面板访问 AWS S3,并为 S3QL 创建一个新的空 bucket。

为最佳性能考虑,请选择一个地理上距离你最近的区域。

### 在 Linux 上安装 S3QL
在大多数 Linux 发行版中都有预先编译好的 S3QL 软件包。
#### 对于 Debian、Ubuntu 或 Linux Mint:
```
$ sudo apt-get install s3ql
```
#### 对于 Fedora:
```
$ sudo yum install s3ql
```
对于 Arch Linux,使用 [AUR](https://aur.archlinux.org/packages/s3ql/)。
### 首次配置 S3QL
在 ~/.s3ql 目录中创建 autoinfo2 文件,它是 S3QL 的一个默认的配置文件。这个文件里的信息包括必须的 AWS access key,S3 bucket 名,以及加密口令。这个加密口令将被用来加密一个随机生成的主密钥,而主密钥将被用来实际地加密 S3QL 文件系统数据。
```
$ mkdir ~/.s3ql
$ vi ~/.s3ql/authinfo2
```
---
```
[s3]
storage-url: s3://[bucket-name]
backend-login: [your-access-key-id]
backend-password: [your-secret-access-key]
fs-passphrase: [your-encryption-passphrase]
```
指定的 AWS S3 bucket 需要预先通过 AWS 管理面板来创建。
为了安全起见,让 authinfo2 文件仅对你可访问。
```
$ chmod 600 ~/.s3ql/authinfo2
```
### 创建 S3QL 文件系统
现在你已经准备好可以在 AWS S3 上创建一个 S3QL 文件系统了。
使用 mkfs.s3ql 工具来创建一个新的 S3QL 文件系统。这个命令中的 bucket 名应该与 authinfo2 文件中所指定的相符。使用“--ssl”参数将强制使用 SSL 连接到后端存储服务器。默认情况下,mkfs.s3ql 命令会在 S3QL 文件系统中启用压缩和加密。
```
$ mkfs.s3ql s3://[bucket-name] --ssl
```
你会被要求输入一个加密口令。请输入你在 ~/.s3ql/autoinfo2 中通过“fs-passphrase”指定的那个口令。
如果一个新文件系统被成功创建,你将会看到这样的输出:

### 挂载 S3QL 文件系统
当你创建了一个 S3QL 文件系统之后,下一步便是要挂载它。
首先创建一个本地的挂载点,然后使用 mount.s3ql 命令来挂载 S3QL 文件系统。
```
$ mkdir ~/mnt_s3ql
$ mount.s3ql s3://[bucket-name] ~/mnt_s3ql
```
挂载一个 S3QL 文件系统不需要特权用户,只要确定你对该挂载点有写权限即可。
视情况,你可以使用“--compress”参数来指定一个压缩算法(如 lzma、bzip2、zlib)。在不指定的情况下,lzma 将被默认使用。注意如果你指定了一个自定义的压缩算法,它将只会应用到新创建的数据对象上,并不会影响已经存在的数据对象。
```
$ mount.s3ql --compress bzip2 s3://[bucket-name] ~/mnt_s3ql
```
因为性能原因,S3QL 文件系统维护了一份本地文件缓存,里面包括了最近访问的(部分或全部的)文件。你可以通过“--cachesize”和“--max-cache-entries”选项来自定义文件缓存的大小。
如果想要除你以外的用户访问一个已挂载的 S3QL 文件系统,请使用“--allow-other”选项。
如果你想通过 NFS 导出已挂载的 S3QL 文件系统到其他机器,请使用“--nfs”选项。
运行 mount.s3ql 之后,检查 S3QL 文件系统是否被成功挂载了:
```
$ df ~/mnt_s3ql
$ mount | grep s3ql
```

### 卸载 S3QL 文件系统
想要安全地卸载一个(可能含有未提交数据的)S3QL 文件系统,请使用 umount.s3ql 命令。它将会等待所有数据(包括本地文件系统缓存中的部分)成功传输到后端服务器。取决于等待写的数据的多少,这个过程可能需要一些时间。
```
$ umount.s3ql ~/mnt_s3ql
```
### 查看 S3QL 文件系统统计信息及修复 S3QL 文件系统
若要查看 S3QL 文件系统统计信息,你可以使用 s3qlstat 命令,它将会显示诸如总的数据、元数据大小、重复文件删除率和压缩率等信息。
```
$ s3qlstat ~/mnt_s3ql
```

你可以使用 fsck.s3ql 命令来检查和修复 S3QL 文件系统。与 fsck 命令类似,待检查的文件系统必须首先被卸载。
```
$ fsck.s3ql s3://[bucket-name]
```
### S3QL 使用案例:Rsync 备份
让我用一个流行的使用案例来结束这篇教程:本地文件系统备份。为此,我推荐使用 rsync 增量备份工具,特别是因为 S3QL 提供了一个 rsync 的封装脚本(/usr/lib/s3ql/pcp.py)。这个脚本允许你使用多个 rsync 进程递归地复制目录树到 S3QL 目标。
```
$ /usr/lib/s3ql/pcp.py -h
```

下面这个命令将会使用 4 个并发的 rsync 连接来备份 ~/Documents 里的所有内容到一个 S3QL 文件系统。
```
$ /usr/lib/s3ql/pcp.py -a --quiet --processes=4 ~/Documents ~/mnt_s3ql
```
这些文件将首先被复制到本地文件缓存中,然后在后台再逐步地同步到后端服务器。
若想了解与 S3QL 有关的更多信息,如自动挂载、快照、不可变树,我强烈推荐阅读 [官方用户指南](http://www.rath.org/s3ql-docs/)。欢迎告诉我你对 S3QL 怎么看,以及你对任何其他工具的使用经验。
---
via: <http://xmodulo.com/2014/09/create-cloud-based-encrypted-file-system-linux.html>
作者:[Dan Nanni](http://xmodulo.com/author/nanni) 译者:[felixonmars](https://github.com/felixonmars) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,370 | 怎么样称得上是Linux下优秀的命令行计算器 | http://xmodulo.com/command-line-calculator-linux.html | 2014-12-04T10:07:00 | [
"bc",
"计算器"
] | https://linux.cn/article-4370-1.html | 每个现代的Linux桌面发行版都预装着一个带有图形界面的计算器程序。不过如果你的工作区中全是命令行窗口,那么你一定会在其中的一个命令行窗口中处理一些数字相关的问题。或许你在寻找一款基于命令行的计算器程序。如果是这样的话,[GNU bc](http://www.gnu.org/software/bc/)(“basic calculator”的缩写)会是你不二的选择。当然Linux下有很多基于命令行的计算器应用,我认为GNU bc是功能最强大和最有用的。
在GNU时代之前,bc实际上是一个著名的精密计算语言。它的诞生要追溯到70年代的Unix时期了。最初bc作为一个语法和C语言相似的编程语言而著名。随着时间的改变,最开始的bc演化成POSIX bc,最后变成了今天的GNU bc。

### GNU bc的特性
现在的GNU bc是早期bc经过若干次改进和功能增强的结果。目前它被所有的主流GNU/Linux发行版所收纳。GNU bc支持高精度数字和多种数值类型(例如二进制、十进制、十六进制)的输入输出。
如果你对C语言很熟悉的话,你会发现bc使用了和C语言一样或相似的算术操作符。所支持的操作符包括算术运算符(+, -, \*, /, %, ++, --)、比较运算符(<, >, ==, !=, <=, >=)、逻辑运算符(!, &&, ||)、位运算符(&, |, <sup> ,</sup> ~, <<, >>)和复合赋值运算符(+=, -=, \*=, /=, %=, &=, |=, <sup> =,</sup> &&=, ||=, <<=, >>=)。bc内置了很多有用的函数,像是平方根、正弦、余弦、反正弦、自然对数、指数等。
### 如何使用GNU bc
作为一个基于命令行的计算器,GNU bc的使用没有限制。在本文中,我会向大家介绍bc命令的几个常用的特性。如果你想要更加详细的指导,你可以查阅[官方指南](https://www.gnu.org/software/bc/manual/bc.html)。
如果你没有一个预先写好的bc脚本,那么你可以在交互模式下运行bc。在这种模式下,你输入的以回车结束的任何声明或者表达式会被立刻计算出结果。你需要输入以下命令来进入bc的交互界面。如果想退出bc,你可以输入'quit'并且按回车。
```
$ bc
```

本文下面展示的例子请在bc交互界面中输入。
### 输入表达式
如果想要计算一个算术表达式,我们可以在闪烁的光标处输入该表达式,然后按回车确认。你也可以将该结果存储到一个变量中,然后在其他表达式中使用该变量。

在一个bc的交互界面中,保存着没有个数限制的命令历史记录。使用上方向键来查看之前输入的命令。如果你想限制历史记录保存的命令数量,你可以将一个名为history的特殊变量设置成你希望的数值。该变量默认为-1,也就是“历史记录数量没有限制”。
### 输入输出进制切换
经常会发生的是,你输入一个表达式并且想使用二进制或者十六进制来显示结果。bc允许你在输入输出数字的进制间转换。输入和输出的数系基分别存储在ibase和obase变量中,默认值为10,有效的数值是2到16(或者环境变量BC*BASE*MAX的值)。你只需要更改ibase和obase的值就可以在不同进制之间转换了。下面是一个求两个十六进制/二进制数和的例子:

需要注意的是,我有意地将obase=16放到了ibase=16前面,**反过来则是不可以的**。这个是因为如果我先输入ibase=16,那么随后输入的obase=16中的16会被认为是16进制的数字,也就是十进制的22。当然这个不是我们所期望的。
### 调整精度
在bc中,数字的精度存储在一个名为scale的特殊变量中。该变量表示小数点后数字的个数。scale默认为0,意味着所有的数字和结果以整数形式储存。你可以通过改变scale这个特殊变量的值,来调整数值的精度。
```
scale=4
```

### 使用内置函数
除了简单的算术操作符,GNU bc还通过外部的数学函数库来提供许多高级的数学函数。你可以在命令行界面使用“-l”选项来打开bc。
这里描述了一些内置的函数。
N的二次方根:
```
sqrt(N)
```
X的正弦(X是弧度):
```
s(X)
```
X的余弦(X是弧度):
```
c(X)
```
X的反正弦(返回值是弧度):
```
a(X)
```
X的自然对数:
```
l(X)
```
X的指数对数:
```
e(X)
```
### 当做语言来用
作为一个计算语言,GNU bc支持简单的声明(变量赋值、中断、返回等)、复合语句(if、while、for loop等)和自定义函数。在这里我不会涉及到这些特性的细节,不过你可以通过[官方指南](https://www.gnu.org/software/bc/manual/bc.html)来学习如何使用这些特性。下面是一个简单的函数示例:
```
define dummy(x){
return(x * x);
}
dummy(9)
81
dummy(4)
16
```
### 在非交互界面下使用GNU bc
到目前为止,我们一直在交互界面下使用bc。不过更加流行的使用bc的方法是在没有交互界面的脚本中运行bc。这种情况下,你可以使用echo命令并且借助管道来向bc发送输入内容。例如:
```
$ echo "40*5" | bc
$ echo "scale=4; 10/3" | bc
$ echo "obase=16; ibase=2; 11101101101100010" | bc
```

总结一下,GNU bc是一款强大并且通用的基于命令行的计算器应用,它绝对不会让你失望。它预装在所有的现代Linux发行版中,bc可以让你不用离开命令行就可以进行高效的数学计算。所以,GNU bc一定会是你的最爱。
---
via: <http://xmodulo.com/command-line-calculator-linux.html>
作者:[Dan Nanni](http://xmodulo.com/author/nanni) 译者:[JonathanKang](https://github.com/JonathanKang) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,372 | 在Linux中的使用 ss 命令检查套接字/网络连接 | http://linoxide.com/linux-command/ss-sockets-network-connection/ | 2014-12-04T10:11:15 | [
"netstat",
"ss"
] | /article-4372-1.html | ss是iproute2包的一部分(控制TCP/IP网络和流量的工具)。iproute2的目标是替代先前用于配置网络接口、路由表和管理ARP表的标准Unix网络工具套装(通常称之为“net-tools”)。ss工具用于导出套接字统计,它可以显示与netstat类似的信息,且可以显示更多的TCP和状态信息。因为它直接从内核空间获取信息,所以会更快。ss的操作和netstat很像,所以这让它可以很容易就可以取代netstat。

### 使用和常见选项
ss和netstat很像,默认它会显示已经建立连接的开放的非监听TCP套接字列表。并且你可以用下面的选项过滤输出:
* **-n** - 不要尝试解析服务名。
* **-r** - 尝试解析数字的地址/端口。
* **-a** - 显示所有套接字。
* **-l** - 显示监听套接字。
* **-p** - 显示使用该套接字的进程。
* **-s** - 打印统计数据
* **-t** - 只显示TCP套接字。
* **-u** - 只显示UDP套接字。
* **-d** - 只显示DCCP套接字
* **-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。
* **-o STATUS** - 列出指定状态的套接字
### ss 命令示例
**1.** 显示所有的的TCP端口和使用它们的进程:
```
# ss -tnap
```

**2.** 你可以使用-4 标志来显示IPv4链接,-6标志来显示IPv6链接,比如:
```
# ss -tnap6
```

**3.** 跟上面的行为一样,你只需用u代替t就会显示所有开放的UDP端口。
```
# ss -unap
```

**4.** 你可以使用-s标志来打印各种有用的统计数据:
```
# ss -s
```

**5.** 你可以使用-o标志来检查所有不同状态下的链接,比如显示所有已经建立的连接。
```
# ss -tn -o state established -p
```

---
via: <http://linoxide.com/linux-command/ss-sockets-network-connection/>
作者:[Adrian Dinu](http://linoxide.com/author/adriand/) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='linoxide.com', port=80): Max retries exceeded with url: /linux-command/ss-sockets-network-connection/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7b83275c49d0>, 'Connection to linoxide.com timed out. (connect timeout=10)')) | null |
4,373 | Linux 有问必答:在Linux上如何将文本文件转换成PDF格式 | http://ask.xmodulo.com/convert-text-to-pdf-linux.html | 2014-12-04T16:57:00 | [
"Linux",
"文本",
"PDF"
] | /article-4373-1.html |
>
> **提问**: 我想要将一个纯文本文件转换成PDF文档。在Linux命令行下是否有一个简单的方法将文本文件转换成PDF文件?
>
>
>

当你有一大堆文本文件要维护的时候,把它们转换成PDF文档会好一些。比如,PDF更适合打印,因为PDF文档有预定义布局。除此之外,还可以减少文档被意外修改的风险。
要将文本文件转换成PDF格式,你要按照下面的两步。
### 准备工作
首先你要安装两个需要的包。
在 Debian、Ubuntu 或者 Linux Mint上:
```
$ sudo apt-get install enscript ghostscript
```
在 Fedora、CentOS/RHEL上:
```
$ sudo yum install enscript ghostscript
```
在 Arch Linux上:
```
$ sudo pacman -S enscript ghostscript
```
### 将文本文件转换成PDF格式
准备工作完成之后,按照下面的两步从文本文件生成一个PDF文件
首先,使用enscript命令行工具将文本文件转换成postscript格式。
```
$ enscript -p output.ps input.txt
```
最后将postscript格式文件转换成PDF文件。
```
$ ps2pdf output.ps output.pdf
```
---
via: <http://ask.xmodulo.com/convert-text-to-pdf-linux.html>
译者:[geekpi](https://github.com/geekpi) 校对:[Caroline](https://github.com/carolinewuyan)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /convert-text-to-pdf-linux.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275c4790>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)")) | null |
4,374 | 如何让树莓派默认启动进入图形界面 | http://itsfoss.com/raspberry-pi-gui-boot/ | 2014-12-04T18:04:00 | [
"树莓派",
"图形界面"
] | https://linux.cn/article-4374-1.html | 
我买树莓派已经有一段时间了,但是实话说我几乎还没有用它做过什么事情。自从我的Dell超级本送到Dell服务中心后(已经有数星期了),我再次开始使用树莓派作为替代。
我之前已经写过一篇[在Ubuntu中如何在SD卡上安装Raspbian系统](http://itsfoss.com/tutorial-how-to-install-raspberry-pi-os-raspbian-wheezy/)。我也重装了一次树莓派。第一次启动的时候我漏掉了一件事情就是设置图形界面。这样当我再次启动树莓派的时候,我直接进入了命令行。我该接下来如何运行Respbian图形界面呢?
### 设置Raspbian图形启动
当你第一次安装Raspbian系统时,确实有一些选项需要你来配置,由于匆忙,我没有注意到这些,只是快速完成屏幕上的选项。如果你遇到了和我一样的情况,最终只是进入到了Raspbian操作系统的命令行界面,不要失望,因为设置树莓派以图形界面启动很容易。让我们看看该如何操作。
### 第一步:
当你在命令行时,以默认的用户名和密码登录(如果你没有修改过)。Raspbian的默认用户是pi,默认密码应该是raspberry。
#### 第二步:
当你登录后,运行下面的命令:
```
sudo raspi-config
```
这条命令会打开树莓派的配置,就像我们第一次启动看到的那样。
#### 第三步:
在这个配置界面下, 寻找**Enable Boot to Desktop/Scratch**这个选项。用箭头、tab和/或者回车键的组合来选中它(我忘记使用的是哪些了)。
[](https://camo.githubusercontent.com/08feeaed840a5e0a3105aa90ad66c5b22e53fa74/687474703a2f2f697473666f73732e697473666f73732e6e6574646e612d63646e2e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031342f31312f526173706269616e5f4775695f73657475702e6a7067)
#### 第四步:
下一屏中,选择 **Desktop Login as user ‘Pi’ at the graphical desktop.**
[](https://camo.githubusercontent.com/693560632b9980e6bb51c8d1d51a46332a6e5c6f/687474703a2f2f697473666f73732e697473666f73732e6e6574646e612d63646e2e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031342f31312f526173706269616e5f4775695f73657475705f312e6a7067)
#### 第五步:
接下来你会被要求重启。
[](https://camo.githubusercontent.com/8b06681a02fd1935ecddc009250b536fb172b10d/687474703a2f2f697473666f73732e697473666f73732e6e6574646e612d63646e2e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031342f31312f526173706269616e5f4775695f73657475705f322e6a7067)
下次启动后,你会登录到LXDE桌面环境。接下来你就可以享受树莓派的图形界面了。
[](https://camo.githubusercontent.com/75e996d8394b067582d0a8a31c8ea194ffdc8e2f/687474703a2f2f697473666f73732e697473666f73732e6e6574646e612d63646e2e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031342f31312f726173706269616e2d77656c636f6d652d73637265656e2d6775692e6a706567)
我希望这个教程能够帮助设置你的树莓派默认启动进入图形界面。欢迎在评论区留下你的问题和建议。
---
via: <http://itsfoss.com/raspberry-pi-gui-boot/>
作者:[Abhishek](http://itsfoss.com/author/Abhishek/) 译者:[geekpi](https://github.com/geekpi) 校对:[Caroline](https://github.com/carolinewuyan)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,377 | 如何创建和使用Python CGI脚本 | http://xmodulo.com/create-use-python-cgi-scripts.html | 2014-12-05T10:26:00 | [
"CGI",
"Python"
] | https://linux.cn/article-4377-1.html | 你是否想使用Python语言创建一个网页,或者处理用户从web表单输入的数据?这些任务可以通过Python CGI(公用网关接口)脚本以及一个Apache web服务器实现。当用户请求一个指定URL或者和网页交互(比如点击""提交"按钮)的时候,CGI脚本就会被web服务器启用。CGI脚本调用执行完毕后,它的输出结果就会被web服务器用来创建显示给用户的网页。

### 配置Apache web服务器,让其能运行CGI脚本
在这个教程里,我们假设Apache web服务器已经安装好,并已运行。这篇教程使用的Apache web服务器(版本2.2.15,用于CentOS发行版6.5)运行在本地主机(127.0.0.1),并且监听80端口,如下面的Apache指令指定一样:
```
ServerName 127.0.0.1:80
Listen 80
```
下面举例中的HTML文件存放在web服务器上的/var/www/html目录下,并通过DocumentRoot指令指定(指定网页文件所在目录):
```
DocumentRoot "/var/www/html"
```
现在尝试请求URL:http://localhost/page1.html
这将返回web服务器中下面文件的内容:
```
/var/www/html/page1.html
```
为了启用CGI脚本,我们必须指定CGI脚本在web服务器上的位置,需要用到ScriptAlias指令:
```
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
```
以上指令表明CGI脚本保存在web服务器的/var/www/cgi-bin目录,请求URL里包含/cgi-bin/的将会搜索这个目录下的CGI脚本。
我们必须还要明确CGI脚本在/var/www/cgi-bin目录下有执行权限,还要指定CGI脚本的文件扩展名。使用下面的指令:
```
<Directory "/var/www/cgi-bin">
Options +ExecCGI
AddHandler cgi-script .py
</Directory>
```
下面访问URL:http://localhost/cgi-bin/myscript-1.py
这将会调用web服务器中下面所示脚本:
```
/var/www/cgi-bin/myscript-1.py
```
### 创建一个CGI脚本
在创建一个Python CGI脚本之前,你需要确认你已经安装了Python(这通常是默认安装的,但是安装版本可能会有所不同)。本篇教程使用的脚本是使用Python版本2.6.6编写的。你可以通过下面任意一命令(-V和--version参数将显示所安装Python的版本号)检查Python的版本。
```
$ python -V
$ python --version
```
如果你的Python CGI脚本要用来处理用户输入的数据(从一个web输入表单),那么你将需要导入Python cgi模块。这个模块可以处理用户通过web输入表单输入的数据。你可以在你的脚本中通过下面的语句导入该脚本:
```
import cgi
```
你也必须修改Python CGI脚本的执行权限,以防止web服务器不能调用。可以通过下面的命令增加执行权限:
```
# chmod o+x myscript-1.py
```
### Python CGI例子
涉及到Python CGI脚本的两个方案将会在下面讲述:
* 使用Python脚本创建一个网页
* 读取并显示用户输入的数据,并且在网页上显示结果
注意:Python cgi模块在方案2中是必需的,因为这涉及到用户从web表单输入数据。
### 例子1 :使用Python脚本创建一个网页
对于这个方案,我们将通过创建包含一个单一提交按钮的网页/var/www/html/page1.html开始。
```
<html>
<h1>Test Page 1</h1>
<form name="input" action="/cgi-bin/myscript-1.py" method="get">
<input type="submit" value="Submit">
</form>
</html>
```
当"提交"按钮被点击,/var/www/cgi-bin/myscript-1.py脚本将被调用(通过action参数指定)。通过设置方法参数为"get"来指定一个"GET"请求,服务器将会返回指定的网页。/var/www/html/page1.html在浏览器中的显示情况如下:

/var/www/cgi-bin/myscript-1.py的内容如下:
```
#!/usr/bin/python
print "Content-Type: text/html"
print ""
print "<html>"
print "<h2>CGI Script Output</h2>"
print "<p>This page was generated by a Python CGI script.</p>"
print "</html>"
```
第一行声明表示这是使用 /usr/bin/python命令运行的Python脚本。"Content-Type: text/html"打印语句是必需的,这是为了让web服务器知道接受自CGI脚本的输出类型。其余的语句用来输出HTML格式的其余网页内容。
当"Submit"按钮点击,下面的网页将返回:

这个例子的要点是你可以决定哪些信息可以被CGI脚本返回。这可能包括日志文件的内容,当前登陆用户的列表,或者今天的日期。在你处理时拥有所有python库的可能性是无穷无尽的。
### 例子2:读取并显示用户输入的数据,并将结果显示在网页上
对于这个方案,我们将通过创建一个含有三个输入域和一个提交按钮的网页/var/www/html/page2.html开始。
```
<html>
<h1>Test Page 2</h1>
<form name="input" action="/cgi-bin/myscript-2.py" method="get">
First Name: <input type="text" name="firstName"><br>
Last Name: <input type="text" name="lastName"><br>
Position: <input type="text" name="position"><br>
<input type="submit" value="Submit">
</form>
</html>
```
当"Submit"按钮点击,/var/www/cgi-bin/myscript-2.py脚本将被执行(通过action参数指定)。/var/www//html/page2.html显示在web浏览器中的图片如下所示(注意,三个输入域已经被填写好了):

/var/www/cgi-bin/myscript-2.py的内容如下:
```
#!/usr/bin/python
import cgi
form = cgi.FieldStorage()
print "Content-Type: text/html"
print ""
print "<html>"
print "<h2>CGI Script Output</h2>"
print "<p>"
print "The user entered data are:<br>"
print "<b>First Name:</b> " + form["firstName"].value + "<br>"
print "<b>Last Name:</b> " + form["lastName"].value + "<br>"
print "<b>Position:</b> " + form["position"].value + "<br>"
print "</p>"
print "</html>"
```
正如前面提到,import cgi语句用来确保能够处理用户通过web输入表单输入的数据。web输入表单被封装在一个表单对象中,叫做cgi.FieldStorage对象。一旦开始输出,"Content-Type: text/html"是必需的,因为web服务器需要知道接受自CGI脚本的输出格式。用户输入的数据在包含form["firstName"].value,form["lastName"].value,和 form["position"].value的语句中可以得到。那些中括号中的名称和**/var/www/html/page2.html**文本输入域中定义的名称参数一致。
当网页上的"Submit"按钮被点击,下面的网页将被返回。

这个例子的要点就是你可以很容易地读取并显示用户在web表单上输入的数据。除了以字符串的方式处理数据,你也可以用Python将用户输入的数据转化为可用于数值计算的数字。
### 结论
本教程演示了如何使用Python CGI脚本创建网页并处理用户在网页表单输入的数据。查阅更多关于Apache CGI脚本的信息,点击[这里](http://httpd.apache.org/docs/2.2/howto/cgi.html)。查阅更多关于Python cgi模块的信息,点击[这里](https://docs.python.org/2/library/cgi.html#module-cgi)。
---
via: <http://xmodulo.com/create-use-python-cgi-scripts.html>
作者:[Joshua Reed](http://xmodulo.com/author/joshua) 译者:[su-kaiyao](https://github.com/su-kaiyao) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,378 | 使用 GnuPG 加密签名来验证下载文件的可靠性和完整性 | http://xmodulo.com/verify-authenticity-integrity-downloaded-file.html | 2014-12-05T14:43:00 | [
"签名",
"下载",
"GnuPG"
] | https://linux.cn/article-4378-1.html | 当你从网上下载一个文件后(比如:安装程序、ISO镜像或者一个压缩包),文件可能在不同的情况下发生了损坏,比如:由于线路传输错误、中断的下载、存储硬件错误、文件系统错误等等。除了这些错误,文件还可能在下载前或者下载中的攻击而被有意地篡改了。比如,一个攻破证书颁发机构的攻击者可以实施一个MITM攻击(中间人攻击),欺骗你从HTTPS网站上下载隐藏恶意软件的文件。
要保护你自己免受这些问题的困扰,建议你去验证从网上下载的文件的可靠性和完整性。特别是你下载了一个非常敏感的文件的时候)(比如:操作系统镜像、二进制应用程序、可执行安装包等等),盲目地相信下载的文件不是一个好习惯。

一个快速和简单地验证下载文件的完整性的方法是使用不同的校验工具(比如:md5sum、sha356sum、cksum)来计算和比较校验码(比如:MD5、SHA、CRC)。然而,然而校验容易受到[碰撞攻击](http://en.wikipedia.org/wiki/Collision_attack),而且同样不能用于验证文件的可靠性(比如:拥有者)。
如果你想要同时验证下载文件的可靠性(拥有者)和完整性(内容),你需要依赖于加密签名。本教程中,我会描述如何使用GnuPG(GNU Privacy Guard)来检查文件的可靠性和完整性。
本例中我会验证一个从 <https://onionshare.org> 上下载的磁盘镜像。这个网站中,发行商会提供他们的公钥,还有它用于密钥验证的指纹。

至于下载的文件,发行商也会提供它相关的PGP签名。

### 安装 GnuPG 并且生成一个键对
让我们首先在你的Linux系统上安装GnuPG。
在Debian、Ubuntu和其他Debian衍生版上:
```
$ sudo apt-get install gnupg
```
在Fedora、CentOS或者RHEL上:
```
$ sudo yum install gnupg
```
完成安装后,生成一个本篇中会使用到的键对。
```
$ gpg --gen-key
```

在生成键对期间,你会被要求提供你的姓名和email,还有保护你私钥的密码。你同样也可以选择键对何时过期(默认不会过期)。依赖于你选择的key的大小(在1024和4096位之间),key生成会花上几分钟或者更多,同时它要求收集来自你桌面活动的大量的随机数据。(比如键盘输入、鼠标移动、磁盘访问等等,所以这个时候随便动动鼠标键盘什么的)。
一旦key生成完毕后,公钥和私钥会存储在~/.gnupg目录。

### 与某个文件和拥有者建立信任
验证下载文件的第一步是与任何提供文件下载的人建立信任。出于此,我们下载了这个文件的公钥,并且验证公钥的拥有者是否是他或者她自称的。
在下载完文件拥有者的公钥后:
```
$ wget https://onionshare.org/signing-key.asc
```
使用gpg命令导入公钥到你的keyring中
```
$ gpg --import signing-key.asc
```

一旦拥有者的公钥导入后,他会像下面那样打印出一个key ID(比如:"EBA34B1C")。记住这个key ID。
现在,运行下面的命令检查导入的公钥的指纹:
```
$ gpg --fingerprint EBA34B1C
```

你会看到key的指纹字符串。把这个和网站上显示的指纹做对比。如果匹配,你可以选择信任这个文件拥有者的公钥。
一旦你决定相信这个公钥,你可以通过编辑key来设置信任级别:
```
$ gpg --edit-key EBA34B1C
```
这个命令会显示GPG提示符:

在GPG提示符中输入“trust”,它会让你从1-5之间选择这个key的信任等级。

本例中,我决定分配给它“4”,在这之后,输入“sign”用你自己的私钥签名,接着输入在GPG提示符中输入“save”来完成操作。

要注意的是不需要这样明确地给一个公钥指派信任,通过key的导入隐式地信任往往就够了。
给一个key隐式地分配给“完全”的信任就是任何其他由这个完全信任签名的key X都会被认为是对你有效的。通常上,key验证依赖于一个称之为“[信任网](https://www.gnupg.org/gph/en/manual/x334.html)”的复杂机制。
回到教程,现在让我们检查导入的key列表。
```
$ gpg --list-keys
```

你至少会看到两个key:一个带 depth 0和终极信任("1u"),这就是你自己的key,另外一个带depth 1和完全信任("1f"),这是你之前签名的key。
### 验证文件的可靠性/完整性
一旦你建立了与文件拥有者和他的/她的公钥之间的信任关系,我们需要验证你从拥有者那边下载的文件的可靠性和完整性了。
本例中,文件拥有者分别公布了一个文件和它相关的PGP签名(.asc)。签名所起的作用就是认证(文件)并且在其中加入一个时间戳。
一个典型的签名(\*.asc)看上去像这样。
```
-----BEGIN PGP SIGNATURE-----
iQIcBAABCgAGBQJUJGhsAAoJEP1yCtnro0sc1jUP/ixNY/lKdrcMIAUoqlWKNE8f
sj4SFiwREMew76w66GASDF03fa5zPX6EsS2kucgx8ZsfEiSmN5T0y2P/aSaXwZqF
kywZVEzirKtca5AJ4DBzu6qrt9GgSw6JBJVv1oBJCMNyO+eAj341paR3MudvnyQz
H/N5tc4Qcilzy6M184opGIzy4ipEmMXfLHsd7WJpAyn+tO/z3uhh9NkNuygZpaFr
olpSWPE8revdDJyfMfSmb3ZrFmhLn7FCEltOi+a7SluvrMclizfnbec9rgLJtjo0
CPDZY7tsWmmL0DA3VvpMVqGvkg/Dyhpn2IIDrNaLAlvGQ5aovf+4tjad5IHvyaWx
4Gds93G6Hqvv5RwGx7OR3hgt2o0Y+qFsVDxVnPxerGhXeJXHzSDwLQMpdj9IoSU
Ae/53XXnxqSN6POZcwHiHvbsv0pdlg0Ea0dDAAN0ZeINNyZf1R0tLjWkcgpvGCtv
qkJuYFF9W9cWHraPY2ov5Hs/JZzPcG0eVpnDdzfOOH1gDKADq9A5D2X5QJCulsh9
WwU3X+E43OqIsoRzBucItD9HhZbEH7t8Q0xAqnAkgU3hriZp3dN4cnMfhM6I9hli
EmpSpLKCceMexu2o9QgzGXVm+AGZJe4QkuwAhRIccp5JDMVny61UlKTasjy6co8h
5GBhhYybPEFM+G1BODMd
=c9wo
-----END PGP SIGNATURE-----
```
现在让我们同时下载它的文件和签名:
```
$ wget https://onionshare.org/files/0.6/OnionShare.dmg
$ wget https://onionshare.org/files/0.6/OnionShare.dmg.asc
```
现在验证下载文件的PGP签名。
```
$ gpg --verify OnionShare.dmg.asc OnionShare.dmg
```

如果命令的输出包含了“Good signature from <文件所属者>”,那么下载的.dmg文件就被成功地认证和核实了。如果下载的文件的任何地方在签名后被篡改了,那么验证就会失败。
这时你就可以放心地信任你下载的文件了。
---
via: <http://xmodulo.com/verify-authenticity-integrity-downloaded-file.html>
作者:[Dan Nanni](http://xmodulo.com/author/nanni) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,394 | CentOS Linux 7 发布滚动构建版 | http://lists.centos.org/pipermail/centos-announce/2014-December/020807.html | 2014-12-07T10:40:00 | [
"滚动构建版",
"CentOS"
] | https://linux.cn/article-4394-1.html | CentOS上周五宣布,CentOS Linux 的滚动构建版正式发布!这次发布包括了用于安装介质的CentOS Linux 7 的 ISO和通用的云镜像两种版本。
CentOS Linux 滚动构建版包括了从初始发布时到快照发布之间推送到 [mirror.centos.org](http://mirror.centos.org) 的所有更新。这些更新包括了 CentOS Linux 的安全更新、错误修复、功能增强以及常规更新。使用这个版本安装的机器将包括之前所有已经发布的更新,和使用 yum 更新的没有什么不同。所有的 rpm/yum 库仍旧存储在 [mirror.centos.org](http://mirror.centos.org) 上,位置和内容都没有变化。
我们将在每个月底前发布一个滚动更新版本。每个发布版本的名字都包括一个时间戳和用于区分所包括内容的构建标记。如 20141129\_02 的文件名表示它包括了发布在 [mirror.centos.org](http://mirror.centos.org) 上的截止到 2014年11月29日在内的所有内容,而且是滚动周期中的第二次构建。所有的构建版本都会公开发布到 [buildlogs.centos.org/](http://buildlogs.centos.org/) 上,但是只有通过了 QA 和测试的才会标记为“发布”,并放到 [buildlogs.centos.org/rolling/](http://buildlogs.centos.org/rolling/) 下。我们也会在需要时(用于开发和测试)在不同的时间点上构建临时构建版本,这些临时构建版本不会当成通用发布版本,但是仍然可以公开得到。
因为需要测试这些镜像,所以这些版本的发布时间总是和它们的时间戳(及内容截止时间)有点延迟。我们希望尽可能的自动化这个过程来缩短这个时间差,但是终究还需要一点时间。
每个滚动周期,我们都希望能以滚动方式增加更多的内容。在紧接着的下一个周期(2014/12)我们会发布 CentOS Linux 7 的 Live 镜像的滚动构建版本,然后是 CentOS Linux 6的。
现在我们没有计划在这个滚动发行周期中包括 CentOS 5。
为了便于统一和交流,发布的介质将以其所包括的内容时间为标识,而不是以发布的时间为准。比如这次在12月发布的是2014/11月底的滚动构建版本。
其它的镜像,如容器及厂商特定的镜像,将和主 CentOS Linux 介质的滚动周期同步开始,不过如果需要的话,也许会迭代的更快。特别兴趣小组(Special Interest Groups - <http://wiki.centos.org/SpecialInterestGroup>
)也希望让他们的介质和安装器的发布尽量与滚动时间线同步。
最后,我要强调的是,**滚动发行版可以在出现类似心脏流血、破壳漏洞和狮子狗等重大安全漏洞时尽快提供解决方案**。

---
### CentOS Linux 发行版安装介质:
文件: CentOS-7-x86\_64-DVD-20141129\_02.iso
Sha256校验: 85a46c62b5bfc701678bef7854bb73af4ccfb840dfcbfb2f9b2189e08fe9438c
文件: CentOS-7-x86\_64-Everything-20141129\_02.iso
Sha256校验: f9fdd8b12c9529a1e3bf7628ebee964b2aeb9fd66540de7b369e0fde6f7a4236
文件: CentOS-7-x86\_64-Minimal-20141129\_02.iso
Sha256校验:e1338d13178f1c66c17386b7ced0b1459c677ff9a1cf095ac4db377234cc03fa
以下符号链接总是指向最新的滚动发行版本:
<http://buildlogs.centos.org/rolling/7/isos/x86_64/CentOS-7-x86_64-DVD.iso>
- -> CentOS-7-x86\_64-DVD-20141129\_02.iso
<http://buildlogs.centos.org/rolling/7/isos/x86_64/CentOS-7-x86_64-Everything.iso>
- -> CentOS-7-x86\_64-Everything-20141129\_02.iso
<http://buildlogs.centos.org/rolling/7/isos/x86_64/CentOS-7-x86_64-Minimal.iso>- -> CentOS-7-x86\_64-Minimal-20141129\_02.iso
每次测试通过并发布后,这些符号链接都会指向到最新的滚动发行版本。
### 云和实例镜像:
CentOS Linux 7 通用云镜像包括了 Extras/ 库中的云初始化部分。这个镜像有多种格式及不同的内容。云镜像发布在: <http://cloud.centos.org/centos/7/images/>
文件: CentOS-7-x86\_64-GenericCloud-20141129\_01.qcow2
描述:这是一个基准镜像。
大小: 944 MB
Sha256校验: 7710ffdd497cf00fc72c22a3fa7cc7adb3424d3542521ca8fbe19eba9ded403f
文件: CentOS-7-x86\_64-GenericCloud-20141129\_01.qcow2c
描述:和上面的镜像内容一样,但是通过qemu qcow2 内部压缩设置运行,适合于开发和测试,它的 I/O 性能较低,所以不适合在产品环境中使用。
大小: 399MB
Sha256校验:db42e4fb9565e75f0acbe6b54a5b8822f3f1e9783fb1a553e1552c72ceaff8df
文件: CentOS-7-x86\_64-GenericCloud-20141129\_01.qcow2.xz
描述:这是一个标准的 qcow2 文件,通过 xz 压缩工具运行,适合于产品环境中使用。
大小: 266MB
Sha256校验:9b0b38c48a24164c15c33625972b87835501b6994c3ee894f6b79ce40e7d5e54
文件: CentOS-7-x86\_64-GenericCloud-20141129\_01.raw
描述: 这是一个原始格式的文件,没有使用 qcow2 镜像格式。它可以用“qemu-img convert”转换成其它的格式。
大小: 8GB.
Sha256校验:2e643310bdb3cda775905408dbfe378a5eed04e91db193165178afc5ed5492b8
以下符号链接总是指向最新的滚动发行版本:
<http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2>
- -> CentOS-7-x86\_64-GenericCloud-20141129\_01.qcow2
<http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2c>
- -> CentOS-7-x86\_64-GenericCloud-20141129\_01.qcow2c
<http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2.xz>
- -> CentOS-7-x86\_64-GenericCloud-20141129\_01.qcow2.xz
<http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.raw>
- -> CentOS-7-x86\_64-GenericCloud-20141129\_01.raw
每次测试通过并发布后,这些符号链接都会指向到最新的滚动发行版本。
更多的信息请加入我们的 centos-devel 邮件列表( <http://lists.centos.org/> )。
| 302 | Found | null |
4,398 | Ubuntu 14.10 ‘乌托邦的独角兽’官方 T 恤开始发售 | http://www.omgubuntu.co.uk/2014/12/last-ubuntu-14-10-unicorn-t-shirts-now-available | 2014-12-08T08:46:00 | [
"Ubuntu",
"T恤"
] | https://linux.cn/article-4398-1.html | **Ubuntu 14.10 发布以来,很少能见到随同发布的带有官方吉祥物的 T 恤。不过今天 Canonical 商店终于上架了这件粉丝喜欢的商品。**
现在有两种T恤,一种是‘dusk blue’(男士版本)或者‘hot pink’(女士版本),但是审美与设计的形式是相同的。每种T恤印有由Canonical定制设计的折纸型的‘乌托邦的独角兽’。每件衬衫的背面是Ubuntu的标识以及含有“Utopic Unicorn 14.10”文字,从前到后帮你推广系统-我喜欢!

男士的尺寸有从S到XXL, 女士的尺寸有8-10与14-16,每件T恤在英国的价格是£11,美国的价格是$17.45,欧洲的价格是$17.45。这个价格较往年高一点,与以往一样这是不包括运费和包装费用的价格。

* [购买男士的 Ubuntu 14.10 T恤](http://shop.canonical.com/product_info.php?products_id=1153)
* [购买女士的 Ubuntu 14.10 T恤](http://shop.canonical.com/product_info.php?products_id=1159)
吉祥物 T 恤已经成为自Ubuntu 8.04 Hardy Heron后每个Ubuntu版本发布的传统,虽然它一般在系统发布前发布。
如果你不是特定版本的粉丝,你会发现可以购买的老版本吉祥物商品的数量有限且降价出售。如果你想在你的衬衫上印一条蝾螈,推广穿山甲或者塔尔羊,可以在[出售页面](http://shop.canonical.com/index.php?cPath=29)看看。
---
via: <http://www.omgubuntu.co.uk/2014/12/last-ubuntu-14-10-unicorn-t-shirts-now-available>
作者:[Joey-Elijah Sneddon](https://plus.google.com/117485690627814051450/?rel=author) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,399 | 如何在 Linux 中使用屏幕键盘 | http://xmodulo.com/2014/08/onscreen-virtual-keyboard-linux.html | 2014-12-08T13:09:00 | [
"键盘",
"屏幕键盘"
] | https://linux.cn/article-4399-1.html | 屏幕键盘可以作为实体键盘输入的替代方案。在某些时候,屏幕键盘显得非常需要。 比如, 你的键盘刚好坏了;你的机器太多,没有足够的键盘;你的机器没有多余的接口来连接键盘;你是个残疾人,打字有困难;或者你正在组建基于触摸屏的信息服务站。
屏幕键盘也可以作为一种防范实体键盘记录器的保护手段,键盘记录器会悄悄记录按键来获取密码等敏感信息。一些网上银行页面实际上会强制你使用屏幕键盘来增强交易的安全性。
在 linux 中有几个可用的开源键盘软件, 比如 [GOK (Gnome 的屏幕键盘)](https://developer.gnome.org/gok/),[kvkbd](http://homepage3.nifty.com/tsato/xvkbd/),[onboard](https://launchpad.net/onboard),[Florence](http://florence.sourceforge.net/)。
我会在这个教程中集中讲解 Florence, 告诉你**如何用 Florence 设置一个屏幕键盘**。 Florence 有着布局方案灵活、输入法多样、自动隐藏等特性。作为教程的一部分,我也将会示范**如何只使用鼠标来操作 Ubuntu 桌面**。
### 在 Linux 中安装 Florence 屏幕键盘
幸运的是,Florence 存在于大多数 Linux 发行版的基础仓库中。
在 Debian,Ubuntu 或者 Linux Mint 中:
```
$ sudo apt-get install florence
```
在 Fedora,CentOS 或者 RHEL (CentOS/RHEL 需要[EPEL 仓库](http://xmodulo.com/2013/03/how-to-set-up-epel-repository-on-centos.html)) 中:
```
$ sudo yum install florence
```
在 Mandriva 或者 Mageia 中:
```
$ sudo urpmi florence
```
对于 Archlinux 用户,Florence 存在于 [AUR](https://aur.archlinux.org/packages/florence/) 中。
### 配置和加载屏幕键盘
当你安装好 Florence 之后,你只需要简单的输入以下命令就能加载屏幕键盘:
```
$ florence
```
默认情况下,屏幕键盘总是在其他窗口的顶部,让你能够在任意活动的窗口上进行输入。
在键盘的左侧点击工具按键来改变 Florence 的默认配置。

在 Florence 的 "样式 (style)" 菜单中,你能够自定义键盘样式,启用/取消声音效果。

在“窗口 (window)”菜单中,你能够调整键盘背景透明度、按键不透明度,以及控制键盘比例、工具栏、尺寸和总是置顶等特性。如果你的桌面分辨率不是非常高,透明度调整就显得非常有用,因为屏幕键盘会挡住其他窗口。在这个例子中,我切换到透明键盘,并且设置不透明度为 50%。

在“行为 (behaviour)”菜单中,你能够改变输入方法。Florence 支持几种不同的输入法: 鼠标 (mouse)、触摸屏 (touch screen)、计时器 (timer) 和漫步 (ramble)。鼠标输入是默认输入法。最后的两种输入法不需要按鼠标键。 计时器输入通过将指针滞留在按键上一定时间来触发按键。漫步输入的原理跟**计时器**输入差不多,但是经过训练和灵巧使用,能够比**计时器**输入更加迅速。

在“布局 (layout)”菜单中,你能够改变键盘布局。比如,你能够扩展键盘布局来增加导航键,数字键和功能键。

### 只使用鼠标来操作 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 &
```

重启 Ubuntu 桌面,然后看看你是否能够在登录界面使用屏幕键盘。
启动之后当你看到 GTK+ 欢迎界面时, 点击右上角的人形符号。你会看到“使用屏幕键盘 (On Screen Keyboard)”菜单选项,如下:

点击这个选项,屏幕键盘就会在登录界面弹出。现在你应该能够用屏幕键盘来登录了。

对于 GDM2/GDM3 用户怎么在 GDM2/GDM3 界面上使用屏幕键盘,Florence 官方网页提供了 [文档 (documentation)](http://florence.sourceforge.net/english/how-to.html)。
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
```
这样可以让你在登录到桌面的时候就看到屏幕键盘。

希望这个教程对你有用。与你所看到的一样,Florence 是非常强大的屏幕键盘,可以用于不同目的。请和我分享你使用屏幕键盘的经验。
---
via: <http://xmodulo.com/2014/08/onscreen-virtual-keyboard-linux.html>
作者:[Dan Nanni](http://xmodulo.com/author/nanni) 译者:[forsil](https://github.com/forsil) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,400 | Linux有问必答:如何修复“ImportError: No module named scapy.all” | http://ask.xmodulo.com/importerror-no-module-named-scapy-all.html | 2014-12-08T15:28:00 | [
"Scapy"
] | /article-4400-1.html |
>
> **问题**:当我运行一个Python应用程序时,出现了这个提示消息“ImportError: No module named scapy.all”。我怎样才能修复这个导入错误呢?
>
>
>
[Scapy](http://www.secdev.org/projects/scapy/)是一个用Python写的灵活的数据包生成及嗅探程序。使用Scapy,你可以完成创建任意数据包并发送到网络上、从网络上或转储文件中读取数据包、转换数据包等工作。使用Scapy的通用包处理能力,你可以很容易地完成像SYN扫描、TCP路由跟踪以及OS指纹检测之类的工作。你也可以通过Import,将Scapy整合到其它工具中。
该导入错误表明:你还没有在你的Linux系统上安装Scapy。下面介绍安装方法。

### 安装Scapy到Debian, Ubuntu或Linux Mint
```
$ sudo apt-get install python-scapy
```
### 安装Scapy到Fedora或CentOS/RHEL
在CentOS/RHEL上,你首先需要[启用EPEL仓库](http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html)。
```
$ sudo yum install scapy
```
### 源码安装Scapy
如果你的Linux版本没有提供Scapy包,或者你想要试试最新的Scapy,你可以手工使用源码包安装。
下载[最新版的Scapy](http://scapy.net/),然后按照以下步骤安装。
```
$ unzip scapy-latest.zip
$ cd scapy-2.*
$ sudo python setup.py install
```
---
via: <http://ask.xmodulo.com/importerror-no-module-named-scapy-all.html>
译者:[GOLinux](https://github.com/GOLinux) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /importerror-no-module-named-scapy-all.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275c49a0>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)")) | null |
4,405 | 如何在 Linux 上用 SQL 语句来查询 Apache 日志 | http://xmodulo.com/sql-queries-apache-log-files-linux.html | 2014-12-09T08:26:00 | [
"日志",
"SQL",
"Apache"
] | https://linux.cn/article-4405-1.html | Linux 有一个显著的特点,在正常情况下,你可以通过日志分析系统日志来了解你的系统中发生了什么,或正在发生什么。的确,系统日志是系统管理员在解决系统和应用问题时最需要的第一手资源。我们将在这篇文章中着重讲解 Apache HTTP web server 生成的 Apache access 日志。
这次,我们会通过另类的途径来分析 Apache access 日志,我们使用的工具是 [asql](http://www.steve.org.uk/Software/asql/)。asql 是一个开源的工具,它能够允许使用者使用 SQL 语句来查询日志,从而通过更加友好的格式展现相同的信息。

### Apache 日志背景知识
Apache 有两种日志:
* **Access log**:存放在路径 /var/log/apache2/access.log (Debian) 或者 /var/log/httpd/access\_log (Red Hat)。Access Log 记录所有 Apache web server 执行的请求。
* **Error log**:存放在路径 /var/log/apache2/error.log (Debian) 或者 /var/log/httpd/error\_log (Red Hat)。Error log 记录所有 Apache web server 报告的错误以及错误的情况。Error 情况包括(不限于)403(Forbidden,通常在请求被拒绝访问时被报告),404(Not found,在请求资源不存在时被报告)。
虽然管理员可以通过配置 Apache 的配置文件来自定义 Apache access log 的详细程度,不过在这篇文章中,我们会使用默认的配置,如下:
```
远程 IP - 请求时间 - 请求类型 - 响应代码 - 请求的 URL - 远程的浏览器信息 (也许包含操作系统信息)
```
因此一个典型的 Apache 日志条目就是下面这个样子:
```
192.168.0.101 - - [22/Aug/2014:12:03:36 -0300] "GET /icons/unknown.gif HTTP/1.1" 200 519 "http://192.168.0.10/test/projects/read_json/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0"
```
但是 Apache error log 又是怎么样的呢?因为 error log 条目主要记录 access log 中特殊的请求(你可以自定义),所以你可以通过 access log 来获得关于错误情况的更多信息(example 5 有更多细节)。
此外要提前说明的, access log 是系统级别的日志文件。要分析虚拟主机的日志文件,你需要检查它们相应的配置文件(例如: 在 /etc/apache2/sites-available/[virtual host name] 里(Debian))。
### 在 Linux 上安装 asql
asql 由 Perl 编写,而且需求以下两个 Perl 模块:SQLite 的 DBI 驱动以及 GNU readline。
### 在 Debian, Ubuntu 以及其衍生发行版上安装 asql
使用基于 Debian 发行版上的 aptitude,asql 以及其依赖会被自动安装。
```
# aptitude install asql
```
### 在 Fedora,CentOS,RHEL 上安装 asql
在 CentOS 或 RHEL 上,你需要启用 [EPEL repository](http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html),然后运行以下代码。在 Fedora 中,直接运行以下代码:
```
# sudo yum install perl-DBD-SQLite perl-Term-Readline-Gnu
# wget http://www.steve.org.uk/Software/asql/asql-1.7.tar.gz
# tar xvfvz asql-1.7.tar.gz
# cd asql
# make install
```
### asql 是如何工作的?
从上面代码中的依赖中你就可以看出来,asql 转换未结构化的明文 Apache 日志为结构化的 SQLite 数据库信息。生成的 SQLite 数据库可以接受正常的 SQL 查询语句。数据库可以通过当前以及之前的日志文件生成,其中也包括压缩转换过的日志文件,类似 access.log.X.gz 或者 access\_log.old。
首先,从命令行启动 asql:
```
# asql
```
你会进入 asql 内置的 shell 交互界面。

输入 help 列表可执行的命令:

首先在 asql 中加载所有的 access 日志:
```
asql > load <apache-access-logs 的路径>
```
比如在 Debian 下:
```
asql > load /var/log/apache2/access.*
```
在 CentOS/RHEL 下:
```
asql > load /var/log/httpd/access_log*
```
当 asql 完成对 access 日志的加载后,我们就可以开始数据库查询了。注意一下,加载后生成的数据库是 "temporary" (临时)的,意思就是数据库会在你退出 asql 的时候被清除。如果你想要保留数据库,你必须先将其保存为一个文件。我们会在后面介绍如何这么做(参考 example 3 和 4)。

生成的数据库有一个名为 logs 的表。输入下面的命令列出 logs 表中提供的域:

一个名为 .asql 的隐藏文件,保存于用户的 home 目录下,记录用户在 asql shell 中输入的命令历史。因此你可以使用方向键浏览命令历史,按下 ENTER 来重复执行之前的命令。
### asql 上的示例 SQL 查询
下面是几个使用 asql 针对 Apache 日志文件运行 SQL 查询的示例:
**Example 1**:列出在 2014 年 10 月中请求的来源 / 时间以及 HTTP 状态码。
```
SELECT source, date, status FROM logs WHERE date >= '2014-10-01T00:00:00' ORDER BY source;
```

**Example 2**:从小到大显示单个客户端处理的请求大小(bytes)。
```
SELECT source, SUM(size), AS NUMBER FROM logs GROUP BY source ORDER BY Number DESC;
```

**Example 3**:在当前目录中保存数据库为 [filename]。
```
save [filename]
```

这样做可以避免使用 load 命令对日志的语法分析所占用的处理时间。
**Example 4**:在重新进入 asql 后载入数据库。
```
restore [filename]
```

**Example 5**:返回 access 日志中记录的 error 情况。在这个例子中,我们将显示所有返回 HTTP 状态码为 403(access forbidden)的请求。
```
SELECT source, date, status, request FROM logs WHERE status='403' ORDER BY date
```

这个例子想要表现的是:虽然 asql 只分析 access 日志,我们还是可以通过使用请求的状态域来显示有 error 情况的请求。
### 小结:
我们体验了 asql 如何帮助我们分析 Apache 日志文件,并将结果通过友好的格式输出。虽然你也可以通过使用命令行的工具(例如 cat 与 grep,uniq,sort,wc 等等之间的管道)来实现类似功能,与此比较起来 asql 展示了它如同瑞士军刀一般的强大功能,使我们在自己的需求下能够通过标准 SQL 查询语句来过滤日志。
希望这篇教程能帮助到你们。
请不要拘束地将评论文章,分享文章,提出疑问。
---
via: <http://xmodulo.com/sql-queries-apache-log-files-linux.html>
作者:[Gabriel Cánepa](http://xmodulo.com/author/gabriel) 译者:[ThomazL](https://github.com/ThomazL) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,406 | 同行代码审查(Peer Code Review)实战经验 | http://blog.salsitasoft.com/practical-lessons-in-peer-code-review/ | 2014-12-09T09:10:00 | [
"代码审查",
"Code Review"
] | https://linux.cn/article-4406-1.html | 我有时候会听到我们的团队成员这样议论:
"项目的Code review 只是浪费时间。"
"我没有时间做Code review。"
"我的发布时间延迟了,因为我的同事还没有完成我代码的Code review。"
"你相信我的同事居然要求我对我的代码做修改吗?请跟他们说代码中的一些联系会被打断——如果在我原来代码的基础之上做修改的话。"
(LCTT 译注:Code Review中文可以翻译成代码审查,一般由开发待review的代码的成员以外的团队成员来进行这样的工作。由于是专业术语,没有将Code review用中文代替。)

### 为什么要做Code review?
每个专业软件开发者都有一个重要的目标:持续的提高他们的工作质量。即使你团队中都是一些优秀的程序员,但是你依然不能将你自己与一个有能力的自由职业者区分开来,除非你从团队的角度来工作。Code review是团队工作的一个重要的方面。尤其是:
代码复查者(reviewer)能从他们的角度来发现问题并且提出更好的解决方案。
确保至少你团队的另一个其他成员熟悉你的代码,通过给新员工看有经验的开发者的代码能够某种程度上提高他们的水平。
公开reviewer和被复查者的想法和经验能够促进团队间的知识的分享。
能够鼓励开发者将他们的工作进行的更彻底,因为他们知道他们的代码将被其他的人阅读。
### 在review的过程中的注意点
但是,由于Code review的时间有限,上面所说的目标未必能全部达到。就算只是想要打一个补丁,都要确保意图是正确的。如果只是将变量名改成骆驼拼写法(camelCase),那不算是code review。在开发过程中进行结对编程是有益处的,它能够使两个人得到公平的锻炼。你能够在code review上花许多时间,并且仍然能够比在结对编程中使用更少的时间。
我的感受是,在项目开发的过程中,25%的时间应该花费在code review上。也就是说,如果开发者用两天的时间来开发一个东西,那么复查者应该使用至少四个小时来审查。
当然,只要你的review结果准确的话,具体花了多少时间就显得不是那么的重要。重要的是,你能够理解你看的那些代码。这里的理解并不是指你看懂了这些代码书写的语法,而是你要知道这段代码在整个庞大的应用程序、组件或者库中起着什么样的作用。如果你不理解每一行代码的作用,那么换句话说,你的code review就是没有价值的。这就是为什么好的code review不能很快完成的原因。需要时间来探讨各种各样的代码路径,让它们触发一个特定的函数,来确保第三方的API得到了正确的使用(包括一些边缘测试)。
为了查阅你所审查的代码的缺陷或者是其他问题,你应该确保:
* 所有必要的测试都已经被包含进去。
* 合理的设计文档已经被编写。
再熟练的开发者也不是每次都会记得在他们对代码改动的时候把测试程序和文档更新上去。来自reviewer的一个提醒能够使得测试用例和开发文档不会一直忘了更新。
### 避免code review负担太大
如果你的团队没有强制性的code review,当你的code review记录停留在无法管理的节点上时会很危险。如果你已经两周没有进行code review了,你可以花几天的时间来跟上项目的进度。这意味着你自己的开发工作会被阻断,当你想要处理之前遗留下来的code review的时候。这也会使得你很难再确保code review的质量,因为合理的code review需要长期认真的努力,最终会很难持续几天都保持这样的状态。
由于这个原因,开发者应当每天都完成他们的review任务。一种好办法就是将code review作为你每天的第一件事。在你开始自己的开发工作之前完成所有的code review工作,能够使你从头到尾都集中注意力。有些人可能更喜欢在午休前或午休后或者在傍晚下班前做review。无论你在哪个时间做,都要将code review看作你的工作之一并且不能分心,你要避免:
* 没有足够的时间来处理你的review任务。
* 由于你的code review工作没有做完导致版本的推迟发布。
* 提交不再相关的review,由于代码在你review期间已经改动太大。
* 因为你要在最后一分钟完成他们,以至于review质量太差。
### 书写易于review的代码
有时候review没有按时完成并不都是因为reviewer。如果我的同事使用一周时间在一个大工程中添加了一些乱七八糟的代码,且他们提交的补丁实在是太难以阅读。在一段代码中有太多的东西要浏览。这样会让人难以理解它的作用,自然会拖慢review的进度。
为什么将你的工作划分成一些易于管理的片段很重要有很多原因。我们使用scrum方法论(一种软件开发过程方法),因此对我们来说一个合理的单元就是一个story。通过努力将我们的工作使用story组织起来,并且只是将review提交到我们正在工作的story上,这样,我们写的代码就会更加易于review。你们也可以使用其他的软件开发方法,但是目的是一样的。
书写易于review的代码还有其他先决条件。如果要做一些复杂的架构决策,应该让reviewer事先知道并参与讨论。这会让他们之后review你们的代码更加容易,因为他们知道你们正在试图实现什么功能并且知道你们打算如何来实现。这也避免了开发者需要在reviewer提了一个不同的或者更好的解决方案后大片的重写代码。
项目需要应当在设计文档中详细的描述。这对于一个项目新成员想要快速上手并且理解现有的代码来说非常重要。这从长远角度对于一个reviewer来说也非常有好处。单元测试也有助于reviewer知道一些组件是怎么使用的。
如果你在你的补丁中包含的第三方的代码,记得单独的提交它。当jQuery的9000行代码被插入到了项目代码的中间,毫无疑问会造成难以阅读。
创建易读的review代码的另一个非常重要的措施是添加相应的注释代码。这就要求你事先自己做一下review并且在一些你认为会帮助reviewer进行review的地方加上相应的注释。我发现加上注释相对于你来说往往只需要很短的时间(通常是几分钟),但是对于review来说会节约很多的时间。当然,代码注释还有其他相似的好处,应该在合理的地方使用,但往往对code review来说更重要。事实上,有研究表明,开发者在重读并注释他们代码的过程中,通常会发现很多问题。
### 代码大范围重构的情况
有时候,有必要重构一段代码使其能够作用于多个其他组件。若是一个大型的应用要这样做,会花费几天甚至是更多的时间,结果是生成一个诺大的补丁包。在这种情况下,进行一个标准的code review可能是不切实际的。
最好的方法是增量重构你的代码。找出合理范围内的一部分改变,以此为基础来重构。一旦修改和review完成,进入第二个增量。以此类推,直到整个重构完成。这种方法可能不是在所有的情况下都可行,但是尽管如此,也能避免在重构时出现大量的单片补丁。开发者使用这种方式重构可能会花去更多的时间,但这也使得代码质量更高并且之后的review会更简单。
如果实在是没有条件去通过增量方式重构代码(有人可能会说之前的代码书写并组织的是多么的好),一种解决方案是在重构时进行结对编程来代替code review。
### 解决团队成员之间的纠纷
你的团队中都是一些有能力的专家,在一些案例中,完全有可能因为对一个具体编码问题的意见的不同而产生争论。作为一个开发者,应该保持一个开发的头脑并且时刻准备着妥协,当你的reviewer更想要另一种解决方法时。不要对你的代码持有专有的态度,也不要自己持有审查的意见。因为有人会觉得你应该将一些重复的代码写入一个能够复用的函数中去,这并不意味着这是你的问题。
作为一个reviewer,要灵活。在提出修改建议之前,考虑你的建议是否真的更好或者只是无关紧要。如果你把力气和注意力花在那些原来的代码会明确需要改进的地方会更加成功。你应该说"它或许值得考虑..."或者"一些人建议..."而不是”我的宠物都能写一个比这个更加有效的排序方法"。
如果你真的决定不了,那就询问另一个你及你所审查的人都尊敬的开发者来听一下你意见并给出建议。
---
via: <http://blog.salsitasoft.com/practical-lessons-in-peer-code-review/>
作者:Matt 译者:[john](https://github.com/johnhoow) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,416 | 如何在Linux上构建 RAID 10阵列 | http://xmodulo.com/setup-raid10-linux.html | 2014-12-10T09:18:00 | [
"RAID",
"RAID10"
] | https://linux.cn/article-4416-1.html | RAID 10阵列(又名RAID 1+0 或先镜像后分区)通过结合RAID 0 (读写操作在多个磁盘上同时并行执行)和RAID 1(数据被完全相同地写入到两个或更多的磁盘)两者的特点实现高性能和高容错性的磁盘I/O。
这篇文章会指导你如何使用五块相同的8GB磁盘来组成一个软件RAID 10阵列。因为组成一个RAID 10阵列至少需要4块磁盘(比如,两个镜像各有一对分区组合),而且需要添加一块额外的备用磁盘以防某块主要的磁盘出错。本文也会分享一些工具,在稍后用来分析RAID阵列的性能。
注意RAID 10的优缺点和其它分区方法(在不同大小的磁盘和文件系统上)的内容不在本文讨论范围内。

### Raid 10 阵列如何工作?
如果你需要实现一种支持I/O密集操作(比如数据库、电子邮件或web服务器)的存储解决方案,RAID 10就是你需要的。来看看为什么这么说,请看下图。

上图中的文件由A、B、C、D、E和F六种块组成,每一个RAID 1镜像对(如镜像1和2)在两个磁盘上复制相同的块。在这样的配置下,写操作性能会因为每个块需要写入两次而下降,每个磁盘各一次;而读操作与从单块磁盘中读取相比并未发生改变。不过这种配置的好处是除非一个镜像中有超过一块的磁盘故障,否则都能保持冗余以维持正常的磁盘I/O操作。
RAID 0的分区通过将数据划分到不同的块,然后执行同时将块A写入镜像1、将块B写入镜像2(以此类推)的并行操作以提高整体的读写性能。在另一方面,没有任何一个镜像包含构成主存的数据片的全部信息。这就意味着如果其中一个镜像故障,那么整个RAID 0组件将无法正常工作,数据将遭受不可恢复的损失。
### 建立RAID 10阵列
有两种建立RAID 10阵列的可行方案:复杂法(一步完成)和嵌套法(先创建两个或更多的RAID 1阵列,然后使用它们组成RAID 0)。本文会讲述复杂法创建RAID 10阵列的过程,因为这种方法能够使用偶数或奇数个磁盘去创建阵列,而且能以单个RAID设备的形式被管理,而嵌套法则恰恰相反(只允许偶数个磁盘,必须以嵌套设备的形式被管理,即分开管理RAID 1和RAID 0)。
假设你的机器已经安装mdadm,并运行着相应的守护进程,细节参见[这篇文章](http://xmodulo.com/create-software-raid1-array-mdadm-linux.html)。也假设每个磁盘上已经划分出一个主分区sd[bcdef]1 (LCTT 译注:共计五块磁盘,这里是从sdb - sdf)。使用命令:
```
ls -l /dev | grep sd[bcdef]
```
查看到的输出应该如下所示:

然后使用下面的命令创建一个RAID 10阵列(LCTT 译注:使用了四块磁盘 bcde 创建):
```
# mdadm --create --verbose /dev/md0 --level=10 --raid-devices=4 /dev/sd[bcde]1 --spare-devices=1 /dev/sdf1
```

当阵列创建完毕后(最多花费几分钟),执行命令
```
# mdadm --detail /dev/md0
```
的输出应如下所示:

在更进一步之前需要注意以下事项。
1. **Used Dev Space**表示阵列所使用的每一块磁盘的容量。
2. **Array Size**表示阵列的整体大小。RAID 10阵列的大小通过(N\*C)/M计算,其中N是活跃磁盘的数目,C是每个活跃磁盘的容量,M是每一个镜像中磁盘的数目。在本文的情形下,这个值等于(4\*8GiB)/2 = 16GiB。
3. **Layout**是整个数据布局的详细信息。可能的布局数值如下所示。
---
* **n**(默认选项):代表就近(near)拷贝。一个数据块的多个拷贝在不同磁盘里有相同的偏移量。这种布局提供和RAID 0阵列相似的读写性能。

* **o**代表偏移量(offset)拷贝。块并不是在条带里面复制的,而是整个条带一起复制,但是循环会打乱,所以同一个分区中复制的块会出现在不同的磁盘。因此,一个块的后续拷贝会出现在下一个磁盘中,一个块接着一个块。为了在RAID 10阵列中使用这种布局,在创建阵列的命令中添加--layout=o2选项。

* **f**代表远端(far)拷贝(多个拷贝在不同的磁盘中具有不同的偏移量)。这种布局提供更好的读性能但带来更差的写性能。因此,对于读远远多于写的系统来说是最好的选择。为了在RAID 10阵列中使用这种布局,在创建阵列的命令中添加--layout=f2。

跟在布局选项**n**、**f**和**o**后面的数字代表所需的每一个数据块的副本数目。默认值是2,但可以是2到阵列中磁盘数目之间的某个值。提供足够的副本数目可以最小化单个磁盘上的I/O影响。
1. **Chunk Size**,参考[Linux RAID wiki](https://raid.wiki.kernel.org/)的说明,是写入磁盘的最小数据单元。最佳的chunk大小取决于I/O操作的速率和相关的文件大小。对于大量的写操作,通过设置相对较大的chunk可以得到更低的开销,但对于主要存储小文件的阵列来说更小的chunk性能更好。为了给RAID 10指定一个chunk大小,在创建阵列的命令中添加**--chunk=desired*chunk*size**。
不幸的是,并没有设置一个大小就能适合全局的策略来提高性能,但可以参考下面的一些方案。
* 文件系统:就整体而言,[XFS](http://ask.xmodulo.com/create-mount-xfs-file-system-linux.html)据说是最好的,当然EXT4也是不错的选择。
* 最佳布局:远端布局能提高读性能,但会降低写性能。
* 副本数目:更多的副本能最小化I/O影响,但更多的磁盘需要更大的花费。
* 硬件:在相同的环境下,SSD比传统(机械旋转)磁盘更能带来出性能提升
### 使用DD进行RAID性能测试
下面的基准测试用于检测RAID 10阵列(/dev/md0)的性能。
#### 1. 写操作
往磁盘中写入大小为256MB的单个文件:
```
# dd if=/dev/zero of=/dev/md0 bs=256M count=1 oflag=dsync
```
写入1000次512字节:
```
# dd if=/dev/zero of=/dev/md0 bs=512 count=1000 oflag=dsync
```
使用dsync标记,dd可以绕过文件系统缓存,在RAID阵列上执行同步写。这个选项用于减少RAID性能测试中缓存的影响。
#### 2. 读操作
从阵列中拷贝256KiB\*15000(3.9 GB)大小内容到/dev/null:
```
# dd if=/dev/md0 of=/dev/null bs=256K count=15000
```
### 使用Iozone进行RAID性能测试
[Iozone](http://www.iozone.org/)是一款文件系统基准测试工具,用来测试各种磁盘I/O操作,包括随机读写、顺序读写和重读重写。它支持将结果导出为微软的Excel或LibreOffice的Calc文件。
#### 在CentOS/RHEL 7上安装Iozone
先保证[Repoforge](http://xmodulo.com/how-to-set-up-rpmforge-repoforge-repository-on-centos.html)可用,然后输入:
```
# yum install iozone
```
#### 在Debian 7上安装Iozone
```
# aptitude install iozone3
```
下面的iozone命令会在RAID-10阵列中执行所有测试:
```
# iozone -Ra /dev/md0 -b /tmp/md0.xls
```
* **-R**:往标准输出生成兼容Excel的报告
* **-a**:以全自动模式运行所有的测试,并测试各种记录/文件大小。记录大小范围:4K-16M,文件大小范围:64K-512M。
* **-b /tmp/md0.xls**: 把测试结果存储到一个指定的文件中
希望这篇文章对你有所帮助,如果想到任何想法或建议可能会提升RAID 10的性能,请讲出来。
---
via: <http://xmodulo.com/setup-raid10-linux.html>
作者:[Gabriel Cánepa](http://xmodulo.com/author/gabriel) 译者:[KayGuoWhu](https://github.com/KayGuoWhu) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,427 | Nathive——libre软件图像编辑器 | http://www.ubuntugeek.com/nathive-a-libre-software-image-editor.html | 2014-12-11T20:55:00 | [
"Nathive",
"图像",
"编辑器"
] | https://linux.cn/article-4427-1.html | Nathive是一个libre软件图像编辑器,类似于 Adobe Photoshop、Corel Photo-Paint 或 GIMP,但是侧重于适用性和逻辑性,并为每个用户提供平滑的学习曲线。该项目在 GNOME 桌面环境中运行,并欢迎每个人参与到合作中,分享代码、翻译或想法等方面。
该项目尚处于测试阶段,所以它还是个未完成的工作,还不适用于终端用户。直到现在,开发始终专注于积淀应用的核心功能和创建便捷的开发工具。所以,目前我们将致力于创建新的插件,因为很明显在这方面还很缺乏。
其目的是在不放弃最初的可用性的情况下,逐步将该软件打造成一个专业的图像编辑器。Nathive由基于GTK+的Python脚本写成的,它设计为简洁、轻量,而且易于安装和使用。
### 在 ubuntu 上安装Nathive
你需要从[这里](http://www.nathive.org/download)下载.deb包,然后双击来安装。
### 屏幕截图



---
via: <http://www.ubuntugeek.com/nathive-a-libre-software-image-editor.html>
作者:[ruchi](http://www.ubuntugeek.com/author/ubuntufix) 译者:[GOLinux](https://github.com/GOLinux) 校对:[Caroline](https://github.com/carolinewuyan)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 200 | OK | # Nathive – A libre software image editor
**Sponsored Link**
This project is in beta phase, so it is an incomplete work, unfit for the end user yet. Until now the development was focused in laying down the application core and create easy dev tools, so for now we will focus on create new plugins, because there are obvious lacks yet.
The intention is to achieve a professional image editor progressively without giving up initial usability. Nathive is written from scratch in Python using GTK+, and is designed to be simple, lightweight, and easy to install and use.
**Install Nathive on ubuntu**
You need to download .deb package from [here](http://www.nathive.org/download) .Once you have deb package you can double click to install
**Screenshots** |
4,429 | Linux有问必答——如何在Linux命令行中剪裁图像 | http://ask.xmodulo.com/crop-image-command-line-linux.html | 2014-12-12T11:06:17 | [
"Linux",
"裁剪",
"图像"
] | /article-4429-1.html |
>
> **问题**:我想要去除图像文件中的白色空白,有没有什么便捷的方法能在Linux命令行中对图像文件进行剪裁?
>
>
>
当涉及到在Linux中转换或编辑图像文件时,ImageMagick毫无疑问是最为熟知的一体化软件之一。它包含了一整套命令行工具,用以显示、转换,或复制超过200中类型的光栅或矢量图像文件,所有这一切都在命令行下完成。ImageMagick可以用于多样化的图像编辑工作,如转换文件格式,添加特殊效果,添加文本,以及改变图像(调整大小、旋转、翻转、剪裁)。

如果你想要剪裁映像以去除空白,你可以使用ImageMagick自带的两个命令行工具。如果你还没有安装ImageMagick,请参照[本指南](http://ask.xmodulo.com/install-imagemagick-linux.html)来安装。
在本教程中,让我们来剪裁以下PNG图像。我们想要去除图像右边和底部的边缘,以便让图标居中。
[](https://camo.githubusercontent.com/9d177b6255fca3bf0b6f92ab1c6e52f211127e24/68747470733a2f2f6661726d382e737461746963666c69636b722e636f6d2f373536322f31353638383234323331395f656431396163613361325f7a2e6a7067)
首先,鉴定图像文件的尺寸(宽度和高度)。你可以使用identity命令来完成。
```
$ identify chart.png
```
---
```
chart.png PNG 1500x1000 1500x1000+0+0 8-bit DirectClass 31.7KB 0.000u 0:00.000
```
就像上面显示的那样,输入的图像是1500x1000px。
接下来,确定图像剪裁要做的两件事:(1)剪裁图像开始的位置(2)剪裁矩形区域的大小。
在本实例中,让我们假定图像剪裁从左上角开始,更精确点是在x=20px和y=10px,那样的话,剪裁后的图像尺寸为1200x700px。
用于剪裁图像的工具是convert。使用“-crop”选项后,convert命令会在输入图像中剪裁出一个矩形区域。
```
$ convert chart.png -crop 1200x700+20+10 chart-cropped.png
```
指定输入图像为chart.png,convert命令会将剪裁后的图像存储为chart-cropped.png。
[](https://camo.githubusercontent.com/f158419548fe0ad4ef5dc1cb8c72882cc9fadde9/68747470733a2f2f6661726d382e737461746963666c69636b722e636f6d2f373532372f31353837323237313436315f343031323736653037325f7a2e6a7067)
---
via: <http://ask.xmodulo.com/crop-image-command-line-linux.html>
译者:[GOLinux](https://github.com/GOLinux) 校对:[Caroline](https://github.com/carolinewuyan)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /crop-image-command-line-linux.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275c4070>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)")) | null |
4,445 | 使用条块化I/O管理多个LVM磁盘(第五部分) | http://www.tecmint.com/manage-multiple-lvm-disks-using-striping-io/ | 2014-12-15T16:17:37 | [
"LVM"
] | https://linux.cn/article-4445-1.html | 在本文中,我们将了解逻辑卷是如何通过条块化I/O来写入数据到磁盘的。逻辑卷管理的酷炫特性之一,就是它能通过条块化I/O跨多个磁盘写入数据。

### LVM条块化是什么?
**LVM条块化**是LVM功能之一,该技术会跨多个磁盘写入数据,而不是对单一物理卷持续写入。

*使用条块化I/O管理LVM磁盘*
#### 条块化特性
* 它会改善磁盘性能。
* 避免对单一磁盘的不断的大量写入。
* 使用对多个磁盘的条块化写入,可以减少磁盘填满的几率。
在逻辑卷管理中,如果我们需要创建一个逻辑卷,扩展的卷会完全映射到卷组和物理卷。在此种情形中,如果其中一个**PV**(物理卷)被填满,我们需要从其它物理卷中添加更多扩展。这样,添加更多扩展到PV中后,我们可以指定逻辑卷使用特定的物理卷写入I/O。
假设我们有**四个磁盘**驱动器,分别指向了四个物理卷,如果各个物理卷总计可以达到**100 I/O**,我们卷组就可以获得**400 I/O**。
如果我们不使用**条块化方法**,文件系统将横跨基础物理卷写入。例如,写入一些数据到物理卷达到100 I/O,这些数据只会写入到第一个PV(**sdb1**)。如果我们在写入时使用条块化选项创建逻辑卷,它会分割100 I/O分别写入到四个驱动器中,这就是说每个驱动器中都会接收到25 I/O。
这会在循环过程中完成。如果这些逻辑卷其中任何一个需要扩展,在这种情形下,我们不能添加1个或2个PV,必须添加所有4个pv来扩展逻辑卷大小。这是条块化特性的缺点之一,从中我们可以知道,在创建逻辑卷时,我们需要为所有逻辑卷分配相同的条块大小。
逻辑卷管理有着这些特性,它使我们能够同时在多个pv中条块化数据。如果你对逻辑卷熟悉,你可以去设置逻辑卷条块化。反之,你则必须了解逻辑卷管理的基础知识了,请阅读更基础的文章来了解逻辑卷管理。
#### 我的服务器设置
这里,我使用**CentOS6.5**用作练习。下面这些步骤也适用于RHEL、Oracle Linux以及大多数发行版。
```
操作系统: CentOS 6.5
IP地址: 192.168.0.222
主机名: tecmint.storage.com
```
### 条块化I/O的逻辑卷管理
出于演示目的,我已经准备了4个硬盘驱动器,每个驱动器1GB大小。让我用下面的‘**fdisk**’命令来列给你看看吧。
```
# fdisk -l | grep sd
```

*列出硬盘驱动器*
现在,我们必须为这4个硬盘驱动器**sdb**,**sdc**,**sdd**和**sde**创建分区,我们将用‘**fdisk**’命令来完成该工作。要创建分区,请遵从本文**[第一部分](http://linux.cn/article-3965-1.html)**中**步骤#4**的说明,并在创建分区时确保你已将类型修改为**LVM(8e)**。
```
# pvcreate /dev/sd[b-e]1 -v
```

*在LVM中创建物理卷*
PV创建完成后,你可以使用‘**pvs**’命令将它们列出来。
```
# pvs
```

*验证物理卷*
现在,我们需要使用这4个物理卷来定义卷组。这里,我定义了一个物理扩展大小(PE)为**16MB**,名为**vg\_strip**的卷组。
```
# vgcreate -s 16M vg_strip /dev/sd[b-e]1 -v
```
上面命令中选项的说明:
* **[b-e]1** – 定义硬盘驱动器名称,如sdb1,sdc1,sdd1,sde1。
* **-s** – 定义物理扩展大小。
* **-v** – 详情。
接下来,验证新创建的卷组:
```
# vgs vg_strip
```

*验证卷组*
要获取VG更详细的信息,可以在**vgdisplay**命令中使用‘-v’选项,它将给出**vg\_strip**卷组中所使用的全部物理卷的详细情况。
```
# vgdisplay vg_strip -v
```

*卷组信息*
回到我们的话题,现在在创建逻辑卷时,我们需要定义条块化值,就是数据需要如何使用条块化方法来写入到我们的逻辑卷中。
这里,我创建了一个名为**lv\_tecmint-strp1**,大小为**900MB**的逻辑卷,它需要放到**vg\_strip**卷组中。我定义了4个条块,就是说数据在写入到我的逻辑卷时,需要条块化分散到4个PV中。
```
# lvcreate -L 900M -n lv_tecmint_strp1 -i4 vg_strip
```
* **-L** –逻辑卷大小
* **-n** –逻辑卷名称
* **-i** –条块化

*创建逻辑卷*
在上面的图片中,我们可以看到条块尺寸的默认大小为**64 KB**,如果我们需要自定义条块值,我们可以使用**-I**(大写I)。要确认逻辑卷已经是否已经创建,请使用以下命令。
```
# lvdisplay vg_strip/lv_tecmint_strp1
```

*确认逻辑卷*
现在,接下来的问题是,我们怎样才能知道条块被写入到了4个驱动器。这里,我们可以使用‘**lvdisplay**’和**-m**(显示逻辑卷映射)命令来验证。
```
# lvdisplay vg_strip/lv_tecmint_strp1 -m
```

*检查逻辑卷*
要创建自定义的条块尺寸,我们需要用我们自定义的条块大小**256KB**来创建一个**1GB**大小的逻辑卷。现在,我打算将条块分布到3个PV上。这里,我们可以定义我们想要哪些pv条块化。
```
# lvcreate -L 1G -i3 -I 256 -n lv_tecmint_strp2 vg_strip /dev/sdb1 /dev/sdc1 /dev/sdd1
```

*定义条块大小*
接下来,检查条块大小和条块化的卷。
```
# lvdisplay vg_strip/lv_tecmint_strp2 -m
```

*检查条块大小*
是时候使用设备映射了,我们使用‘**dmsetup**’命令来完成这项工作。它是一个低级别的逻辑卷管理工具,它用于管理使用了设备映射驱动的逻辑设备。
```
# dmsetup deps /dev/vg_strip/lv_tecmint_strp[1-2]
```

*设备映射*
这里,我们可以看到strp1依赖于4个驱动器,strp2依赖于3个设备。
希望你已经明白,我们怎样能让逻辑卷条块化来写入数据。对于此项设置,必须掌握逻辑卷管理基础知识。
在我的下一篇文章中,我将给大家展示怎样在逻辑卷管理中迁移数据。到那时,请静候更新。同时,别忘了对本文提出有价值的建议。
---
via: <http://www.tecmint.com/manage-multiple-lvm-disks-using-striping-io/>
作者:[Babin Lonston](http://www.tecmint.com/author/babinlonston/) 译者:[GOLinux](https://github.com/GOLinux) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,446 | Linux 3.18 新内核带来了什么新东西? | http://www.omgubuntu.co.uk/2014/12/linux-kernel-3-18-released-whats-new | 2014-12-15T16:28:51 | [
"内核",
"3.18"
] | https://linux.cn/article-4446-1.html | 
新的一月意味着新的稳定版Linux内核的发布,前一段时间,Linus Torvalds[宣布Linux 3.18 很快就会发布了](https://lkml.org/lkml/2014/12/7/202)。
Torvalds在Linux内核邮件列表中解释到,由于在3.17中还存在几个令一小部分用户烦心的问题,但是‘**绝不可以在一些人积极解决老问题时其他人无所事事。**’
### Linux 3.18中有什么新的?
Linux 3.18内核主要致力于硬件支持、电源效率、bug修复和可靠性。
如往常一样,这些内容跨度很大,容易让人迷惑 。比如:加密层多重缓冲操作 - 到气冲感知, 就像对雷蛇游戏手柄的支持。
下面我们收集了这个版本的重要的改变。这远远不是所有的,只是选取了一些更相关的内容。
* Nouveau (开源的 Nvidia GPU 驱动) 现在支持基础 DisplayPort 音频
* 对雷蛇游戏手柄的支持,用在Xbox 360上
* Xilinx USB2 外设
* 对Microchip AR1021 i2c、PenMount 6000 touch的触摸屏支持
* 音频编码: Cirrus Logic CS35L32、 Everest ES8328 和 Freescale ES8328
* 音频支持: 通用飞思卡尔声卡, Analog Devices SSM4567音频放大器
* 几个文件系统提升, 包括 Btrfs 和 F2FS
* 现在支持了DCTCP拥塞控制算法
* JIT 编译64位 eBPF程序
* “Tinification” 帮助开发人员编译更精简更小的内核
#### 在Ubuntu上安装 Linux 3.18
虽然声称是稳定版并带来了大量的更新,但不要马上急着升级你的系统。除非你擅长处理监控异常,CPU过热、和其他各种系统报出的异常。
如果你坚持更新,你可以在kernel.org网站上找到源码包。
* [下载Linux内核源码包](https://www.kernel.org/pub/linux/kernel/v3.x/)
这里有一个由Canonical维护的最新Linux内核归档。尽管你可能在其他地方看到过,但是,请注意,这不是针对终端用户的。没有任何保证与支持,你自己承担风险。
* [访问Ubuntu内核主线归档](http://kernel.ubuntu.com/%7Ekernel-ppa/mainline/?C=N;O=D)
---
via: <http://www.omgubuntu.co.uk/2014/12/linux-kernel-3-18-released-whats-new>
作者:[Joey-Elijah Sneddon](https://plus.google.com/117485690627814051450/?rel=author) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,460 | Linux Journal杂志2014读者选择奖揭晓 | http://www.linuxjournal.com/rc2014 | 2014-12-17T09:49:00 | [
"评比"
] | https://linux.cn/article-4460-1.html | 又到了Linux Journal杂志刊发2014读者选择奖的时候了!鉴于去年的形式好评如潮,因此我们仍沿续旧年格式,让你的意见再次得到回响。虽然有些地方我们会稍加评论,不过基本上还是以报道结果为主。以下敬请欣赏本年度读者选择奖名单!
我们希望读者选择奖一年好似一年。如果你对新分类有任何建议,或者有任何评价与反馈,都可以通过以下方式联系我们:<http://www.linuxjournal.com/contact>
如欲了解完整获奖名单,请查阅本杂志2014年12月刊。
### 最佳Linux发行版

虽然本年度基于Debian/Ubuntu的发行版获得最多票数,但“最佳Linux发行版”分类有点类似于“最好吃的比萨”--就算得票垫底,但它仍算是比萨呀!选择Linux不会错的,而投票之五花八门,恰恰呈现出开源世界里的选择多样性。
* Ubuntu 16.5%
* Debian 16.4%
* Linux Mint 11%
* Arch Linux 8.5%
* Fedora 8.3%
* CentOS 6%
* openSUSE 5.3%
* Kubuntu 4.1%
* Gentoo 2.9%
* Slackware 2.7%
* Xubuntu 2.5%
* 其它 2.3%
* Red Hat Enterprise Linux 1.6%
* NixOS 1.4%
* elementary OS 1.3%
* Lubuntu 1.2%
* CrunchBang 1%
* Mageia .7%
* LXLE .4%
* Tails .4%
* Android-x86 .3%
* Bodhi Linux .3%
* Chakra .3%
* Kali Linux .3%
* PCLinuxOS .3%
* SolydK .3%
* Mandriva .1%
* Oracle Linux .1%
### 最佳Linux移动系统
安卓在移动领域是如此的举足轻重,所以我们决定让安卓的各种版本独立参与投票。因此,尽管以下系统本质上属于安卓,但我们仍沿用其名而不改称安卓,因为这样更加一目了然。
* Stock Android 37.1%
* Sailfish OS 27.6%
* CyanogenMod 20.2%
* 其它 3%
* Ubuntu Phone 3%
* Amazon Fire OS 1.5%
* Ubuntu for Android 1.4%
* Replicant .8%
* Tizen .8%
### 最佳Linux智能手机厂商

* Samsung 29%
* Jolla 26.7%
* Nexus 16.5%
* 其它 7.1%\*
* HTC 7%
* LG 5.3%
* Sony 3.7%
* Nokia 1.8%
* Huawei 1.4%
* GeeksPhone 1%
* Amazon .6%
\*在"其它"当中,摩托罗拉获得最多提名,其次是一加。
### 最佳Linux平板

* Google Nexus 7 35.3%
* Google Nexus 10 14.8%
* Samsung Galaxy Tab 14%
* Samsung Galaxy Note 9.8%
* ASUS Transformer Pad 8.4%
* 其它 6.4%
* Kindle Fire HD 4.7%
* ASUS MeMO Pad 2%
* Dell Venue 1.6%
* Acer Iconia One 1.4%
* Samsung Galaxy Note Edge .9%
* Ekoore Python S3 .7%
### 最佳基于Linux的其它配件(不含智能手机或平板)
我们是一群树莓派粉,如假包换!不过说真的,这怎么能怪我们呢?树莓派又出了新款B+,让原本就美妙绝伦的树莓派愈发的标致可人。并非我有未卜先知之功,但我对明年的冠军早就心中有数了。
* Raspberry Pi 71.4%
* BeagleBone Black 8.1%
* 其它 4.3%\*
* Lego Mindstorms Ev3 3.7%
* Moto 360 3.4%
* Cubieboard 1.7%
* Parrot A.R Drone 1.7%
* Samsung Gear S 1.4%
* Yamaha Motif XF8 1.1%
* Nvidia Jetson-K1 Development System .8%
* Cloudsto EVO Ubuntu Linux Mini PC .5%
* VoCore Open Hardware Computer .5%
* LG G Watch .4%
* RaZberry .4%
* VolksPC .4%
* IFC6410 Pico-ITX Board .2%
* JetBox 5300 .1%
\*在“其它”当中,提名最多是Odroid与CuBox。
### 最佳笔记本厂商

本分类原本用于评价哪个厂商对Linux最花心思,不过谢天谢地,如今大多数笔记本运行起Linux来还是相当不错的。因此无需我们将重点放在“嗯,这台能运行Linux”这种问题上面,而可以切切实实地看到精华之作。把眼光放长远些。
* Lenovo 32%
* ASUS 19.3%
* Dell 18.5%
* System76 10.6%
* 其它 7.9%\*
* Acer 4.5%
* ThinkPenguin 1.9%
* LinuxCertified 1.8%
* ZaReason 1.6%
* EmperorLinux 1.5%
* CyberPower .3%
* Eurocom .1%
\*在“其它”当中,提名最多的(依次)是运行Linux的苹果、惠普、东芝以及三星。
### 最佳内容管理系统

* WordPress 34.7%
* Drupal 25.3%
* Joomla! 11.1%
* MediaWiki 10.5%
* 其它 10%\*
* Alfresco 4.3%
* WebGUI 1.3%
* ikiwiki 1.1%
* eZ publish .7%
* Wolf CMS .4%
* Elgg .3%
* Blosxom .2%
\*在“其它”当中,提名最多的(依次)是DokuWiki, Plone, Django 以及 Typo3。
### 最佳对Linux友好的虚拟主机公司

提到虚拟主机,这年头要找到不对Linux友好的公司那是相当之难。事实上,要找到一家提供Windows的主机服务商才是一种挑战。这一类别的冠军(“其它”)就显而易见的说明了这一问题,或许设一个“最差虚拟主机”分类更加有用!
* 其它 22.8%\*
* Amazon 22.5%
* Rackspace 13.1%
* Linode 10.4%
* GoDaddy.com 6.5%
* OVH 5.6%
* DreamHost 5.4%
* 1&1 4.8%
* LAMP Host 2.9%
* Hurricane Electric 2.6%
* Liquid Web .6%
* RimuHosting .6%
* Host Media .5%
* Savvis .5%
* Blacknight Solutions .4%
* Netfirms .4%
* Prgmr .4%
\*在“其它”当中,提名最多的(依次)是Digital Ocean (压倒性优势), Hetzner, BlueHost 以及 WebFaction。
### 最佳浏览器

Firefox显著优势拨得今年的头筹。即使以Chrome加Chromium计算,Firefox仍位居榜首。我们曾经担心,Firefox死忠会悄然流失,不过还好,Firefox依然宝马未老,仍是一款快速、可行以及兼容度极佳的浏览器。
* Firefox 53.8%
* Chrome 26.9%
* Chromium 8.1%
* Iceweasel 4%
* Opera 3%
* 其它 2%
* SeaMonkey .8%
* rekonq .5%
* dwb .4%
* QupZill .4%
* Dillo .2%
### 最佳电邮客户端

如果我没有亲身了解到身边有多少铁杆极客粉的话,我也许会指责Kyle Rankin投票有作弊嫌疑。他的最爱--Mutt电邮客户端并未登顶,但是对于一个没有图形界面的程序来说,获得第三名也算是个比较骄人的成绩了。
* Mozilla Thunderbird 44.4%
* Gmail 24.7%
* Mutt 6.8%
* Evolution 5.5%
* KMail 5.3%
* 其它 3.2%
* Claws Mail 2.2%
* Zimbra 2%
* Alpine 1.8%
* Geary 1.7%
* SeaMonkey 1%
* Opera Mail .9%
* Sylpheed .4%
### 最佳音频编辑工具

* Audacity 69.1%
* FFmpeg 10.8%
* VLC 9.7%
* Ardour 4.9%
* 其它 1.9%
* SoX 1.3%
* Mixxx 1.1%
* LMMS .7%
* Format Junkie .5%
### 最佳音频播放器

VLC登上视频播放器分类的榜首(见下文)应该是毫无悬念的,但让人大跌眼镜的是,它居然在音频播放器分类中也有不俗的成绩。或许它可以考虑成为一站式媒体播放器。不管怎样,我们都乐见其取得好成绩。
* VLC 25.2%
* Amarok 15.3%
* Rhythmbox 10.4%
* Clementine 8.6%
* MPlayer 6.1%
* Spotify 5.9%
* Audacious 5.5%
* Banshee 4.6%
* 其它 4%\*
* XBMC 3.1%
* foobar2000 3%
* Xmms 2.4%
* DeaDBeeF 1.2%
* MOC .9%
* cmus .8%
* Ncmpcpp .8%
* Guayadeque .6%
* Mixxx .4%
* MPC-HC .4%
* Subsonic .4%
* Nightingale .3%
* Decibel Audio Player .2%
\*在"其它"当中,Quod Libet获得最多提名。
### 最佳视频播放器

* VLC 64.7%
* MPlayer 14.5%
* XBMC 6.4%
* Totem 2.7%
* 其它 2.7%\*
* Plex 2%
* Kaffeine 1.9%
* mpv 1.6%
* MythTV 1.6%
* Amarok 1.4%
* Xmms .3%
* Daum Potplayer .2%
* Clementine .1%
\*在“其它”当中,提名最多是SMPlayer。
### 最佳视频编辑器

再次证明了我们的读者群深具极客色彩。我们未指定“非线性编辑器”,因此就转码技术而言,VLC在视频编辑类别中勉强获胜。干得好,VLC,干得好!
* VLC 17.5%
* Kdenlive 16.4%
* Blender 15.1%
* Avidemux 13.2%
* OpenShot 13.2%
* Cinelerra 7.5%
* PiTiVi 4.9%
* LightWorks 4.8%
* 其它 4.7%
* LiVES 1.4%
* Shotcut .6%
* Jahshaka .4%
* Flowblade .4%
### 最佳云存储

* Dropbox 30.5%
* ownCloud 23.6%
* Google Drive 16%
* rsync 8.3%
* 其它 7.5%\*
* Amazon S3 6.6%
* SpiderOak 4.4%
* Box 1.8%
* Copy 1%
* AjaXplorer .3%
Dropbox在这一领域曾经独步天下,几无对手,虽然这次仍为头魁,但优势已经不那么明显了。Dropbox的方便与稳定无可否认,但是将你的宝贵数据托管在ownCloud上,可管可控,也让ownCloud登上第二名的宝座。
\*在“其它”当中,提名最多是 Younited 与 MEGA。当然很多人可能会说“非万不得已时不会选择云存储/我的文件都是存在本地”。
### 最佳Linux游戏

我很少玩游戏,所以每年我都特期待这一类别排名,希望可以从中找到最受欢迎的游戏,以供闲暇之需。看到NetHack排名这么靠前,我倒觉得挺开心的,尤其是在联想到竞争对手后更是心满意足。徘徊在让我们这些老派的龙与地下城玩家痴迷的随机通道确实有点意思。
* Civilization 5 26.5%
* 其它 23.5%\*
* Team Fortress 2 8.7%
* NetHack 8.4%
* X-Plane 10 7.1%
* Dota 6.1%
* Bastion 5.4%
* Scorched 3D 3.7%
* Destiny 3.6%
* Ultima IV 1.9%
* FreeCol 1.8%
* Kpat 1.4%
* FreeOrion 1.1%
* Ryzom .9%
\*在“其它”当中,提名最多的(依次)是Minecraft, 0 A.D., Frozen Bubble, Battle for Wesnoth, Portal 以及 Counter Strike。
### 最佳虚拟方案
我认为与Vagrant的关系大大带动了Oracle旗下VirtualBox的普及。当然,Vagrant也与其它虚拟平台合作,但自从其与VirtualBox无缝结合后,我认为对VirtualBox是极大提升。虚拟化实现系统是如此的高效与可靠,从裸机开始重构系统的方案几近历史。

* Oracle VM VirtualBox 33.4%
* VMware 22.3%
* KVM 21.1%
* XEN 5.7%
* QEMU 5.3%
* OpenStack 4.9%
* 其它 4.2%\*
* OpenVZ 1.7%
* Linux-VServer 1.3%
* Symantec Workspace Virtualization .1%
\*在“其它”当中,提名最多的依次是Docker, ProxMox 与 LXC。
### 最佳监控应用

* Nagios 27.1%
* Wireshark 20.7%
* htop 12.3%
* Zabbix 10.5%
* 其它 8.6%\*
* Zenoss 6.2%
* Munin 3.4%
* PC Monitor 2.8%
* New Relic 1.9%
* Opsview 1.2%
* SaltStack 1%
* NTM (Network Traffic Monitor) .7%
* xosview .7%
* Manage Engine .5%
* FlowViewer .3%
* Circonus .2%
* SysPeek .2%
\*在“其它”当中,提名最多是Icinga 与 OpenNMS。
### 最佳开发运维配置管理工具

Git能拿到本类别第一名倒是蛮有趣的,虽然针对配置文件使用标准版本控制工具当然无可厚非,但我总觉得它应该配合Chef或Puppet一起使用。至少开发运维(DevOps)让我们这些执拗的老派系统管理员象对待代码一样处理配置文件。版本控制真令人难以置信,这一点似乎绝大多数读者均无异议。
* Git 39.4%
* Puppet 17.2%
* Ansible 8.9%
* cron jobs 8.8%
* Subversion 7.6%
* Chef 5%
* SaltStack 5.4%
* 其它 4.6%\*
* CFEngine 3%
\*在“其它”当中,提名最多是 NixOps。
### 最佳编程语言

* Python 30.2%
* C++ 17.8%
* C 16.7%
* Perl 7.1%
* Java 6.9%
* 其它 4.6%
* Ruby 4.3%
* Go 2.4%
* JavaScript 2.4%
* QML 2.2%
* Fortran 1.4%
* Haskell 1.4%
* Lisp 1.2%
* Erlang .6%
* Rust .6%
* D .4%
* Hack .1%
\*在“其它”当中,提名最多的依次是Scala, PHP 以及 Clojure。
### 最佳脚本语言

Python强悍无比,无论在脚本及编程分类都有大量拥趸。对于象我这样懂Bash以及一点PHP皮毛的人来说,很明显在我一头扎进开发过程中,我需要重点突破。敢说空格无用?我--空格来也!
* Python 37.1%
* Bash/Shell scripts 27%
* Perl 11.8%
* PHP 8.4%
* JavaScript 6.7%
* Ruby 4.9%
* 其它 2.1%
* Lua 2%
### 最佳Linux/开源新产品/新项目

Docker无疑是大赢家,当之无愧--游戏规则改变者嘛。 Jolla/Sailfish也小受欢迎,真是令人欣慰。我们爱安卓,不过多个选择不正是我们作为开源鼓手所提倡的一个重要方面吗。
* Docker 28%
* Jolla and Sailfish OS 19%
* LibreOffice 7%
* ownCloud 5%
* Steam 5%
* Zenoss Control Center 5%
* Raspberry Pi 4%
* Git 4%
* Apache Cordova/OpenOffice/Spark/Tika 3%
* Ansible 2%
* Elementary OS 2%
* OpenStack 2%
* Zabbix 2%
* CoreOS 2%
* Firefox OS 2%
* KDE Connect 1%
* NixOS and NixOps 1%
* Open Media Vault 1%
### 你用Linux做过的最酷的事情

这是读者选择奖里我最钟爱的新分类。想象一下你参加某次Linux会议,期间询问人们他们用Linux做过的最酷的事情。这里所做的与之大同小异!这里我们仅列出部分我们比较喜欢的,如欲了解完整列表,请访问:<http://www.linuxjournal.com/rc2014/coolest>。
注:最常见的答案是:“使用它”;“挽救数据/照片/导致Windows 机器罢工的任何东西”;“说服朋友/家人/业务转向使用Linux”;“学习”;“讲授”;“获得工作”;“家庭自动化”;“构建家庭媒体服务器”。下表是我们选出的并非最常见的答案,而是一些比较具体与有个性的答案。
* 在上世纪90年代中期建立procmail垃圾邮件预过滤规则。
* 450-节点计算集群。
* 7.1 通道前置放大器(集成Mopidy音乐播放器)。
* Linux机器人 (参加Eurobot年度比赛)。
* 无意间打印到错误的大陆。
* 视频同步时增加音频通道。
* 使用自已编写的代码分析NASA卫星数据。
* 远程逗着猫玩。
* 通过声音以及移动应用自动控制家里整个灯光设置。
* 窗台植物自动浇水系统。
* 浴室收音机。
* 配制啤酒。
* 创建了一个运行在国际空间站的应用。
* 为某大型收费高速公路系统建立一套实时收费系统。
* 自己装配智能手机。
* 使用树莓派建立基于网络的家庭报警系统。
* 树莓派集群破解加密的办公文档。
* 控制我的Parrot无人机。
* 控制186台风力涡轮机的通信。
* 在Linux下使用Stellarium控制我的米德望远镜。
* 用一台十几年的老笔记本转换卡带式家庭视频的格式。
* 在靠近北极地区创建网状网络。
* 使用无线数据发射器创建海洋环境下的传感器浮标。
* 发现新行星。
* 修复位于美国丹佛的jabber服务器, 而我当时却身在约丹安曼一家酒店大堂。
* 得到一张Linus亲笔签名的Red Hat 5.0 CD。
* 入侵我的咖啡机,在咖啡做好后给我一条消息。
* 给我女儿介绍乐高机器人EV3。
* 监控酒窖温度与湿度,过热或过温时开门。
* 用树莓派代替温泉浴缸上的控制器。
* 使用脚本连接四天每隔15秒开关一次同事的CD托盘。
* 使用LFS系统为一家全国性石油公司迁移ACH自动转帐系统。
* 身在其它城市冲我家里的马桶。
* 远程控制鸡舍门。
* 使用树莓派为16个站点部署基于网络的洒水器控制器(并控制水池与庭院灯光)。
* 链接SSH通道通过三级跳连接家与工作(因网络设置方面的限制)。
* 建立一套系统,监控可再生能源的安装部分:两套固定的太阳能电池阵,一套两轴太阳跟踪太阳能电池阵,以及一台风力涡轮机。生产以及天气数据实时显示在网络站点。
* 还是在“猫”时代,我用电脑每天早上叫醒我女朋友去上班。
* 使用一个Wii摇控器,通过蓝牙将我的笔记本作为红外摄像机,侦测我女儿的旋转木马的运动,以及控制视频游戏。
---
via: <http://www.linuxjournal.com/rc2014>
作者:[Shawn Powers](http://www.linuxjournal.com/users/shawn-powers) 译者:[yupmoon](https://github.com/yupmoon) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,470 | 在 Linux 上使用 eCryptFS 加密文件和目录 | http://xmodulo.com/encrypt-files-directories-ecryptfs-linux.html | 2014-12-18T10:26:00 | [
"文件系统",
"加密",
"eCryptFS"
] | https://linux.cn/article-4470-1.html | 作为罪犯,你需要为自己的身份保密;而作为中情局成员,你同样也需要为自己的身份保密。但是,你却不是他们其中的任何一员,你只是不想其他人查探到你的金融数据、家庭照片、尚未出版的手稿,或者记录着你能发家致富的最初想法的私密笔记。
我时常听到有人告诉我“我只是个微不足道的人,没人会查探我”或者“我没有什么东西要隐藏的。”好吧,告诉你我的想法,即便我没有什么要隐藏的,或者我也可以公开我带着狗的孩子的照片,那我也有权利不这么去做,也有权利来保护我的隐私。
### 加密类型
我们主要有两种加密文件和目录的方法。一种是文件系统级别的加密,在这种加密中,你可以选择性地加密某些文件或者目录(如,/home/alice)。对我而言,这是个十分不错的方法,你不需要为了启用或者测试加密而把所有一切重新安装一遍。然而,文件系统级别的加密也有一些缺点。例如,许多现代应用程序会缓存(部分)文件你硬盘中未加密的部分中,比如交换分区、/tmp和/var文件夹,而这会导致隐私泄漏。
另外一种方式,就是所谓的全盘加密,这意味着整个磁盘都会被加密(可能除了主引导记录外)。全盘加密工作在物理磁盘级别,写入到磁盘的每个比特都会被加密,而从磁盘中读取的任何东西都会在运行中解密。这会阻止任何潜在的对未加密数据的未经授权的访问,并且确保整个文件系统中的所有东西都被加密,包括交换分区或任何临时缓存数据。
### 可用的加密工具
在Linux中要实施加密,有几个可供选择的工具。在本教程中,我打算介绍其中一个:**eCryptFS**,一个用户空间文件系统加密工具。下面提供了一个Linux上可用的加密工具摘要供您参考。
#### 文件系统级别加密
* [EncFS](http://www.arg0.net/encfs):尝试加密的最简单方式之一。EncFS工作在基于FUSE的伪文件系统上,所以你只需要创建一个加密文件夹并将它挂载到某个文件夹就可以工作了。
* [eCryptFS](http://ecryptfs.org/):一个POSIX兼容的加密文件系统,eCryptFS工作方式和EncFS相同,所以你必须挂载它。
#### 磁盘级别加密
* [Loop-AES](http://sourceforge.net/projects/loop-aes/):最古老的磁盘加密方法。它真的很快,并且适用于旧系统(如,2.0内核分支)。
* [DMCrypt](https://code.google.com/p/cryptsetup/wiki/DMCrypt):最常见的磁盘加密方案,支持现代Linux内核。
* [CipherShed](https://ciphershed.org/):已停止的TrueCrypt磁盘加密程序的一个开源分支。
### eCryptFS基础

eCrypFS是一个基于FUSE的用户空间加密文件系统,在Linux内核2.6.19及更高版本中可用(作为encryptfs模块)。eCryptFS加密的伪文件系统是挂载到当前文件系统顶部的。它可以很好地工作在EXT文件系统家族和其它文件系统如JFS、XFS、ReiserFS、Btrfs,甚至是NFS/CIFS共享文件系统上。Ubuntu使用eCryptFS作为加密其家目录的默认方法,ChromeOS也是。在eCryptFS底层,默认使用的是AES算法,但是它也支持其它算法,如blowfish、des3、cast5、cast6。如果你是通过手工创建eCryptFS设置,你可以选择其中一种算法。
就像我所的,Ubuntu让我们在安装过程中选择是否加密/home目录。好吧,这是使用eCryptFS的最简单的一种方法。

Ubuntu提供了一个用户友好的工具集,通过eCryptFS可以让我们的生活更轻松,但是在Ubuntu安装过程中启用eCryptFS只创建了一个指定的预配置的设置。所以,如果默认的设置不适合你的需求,你需要进行手工设置。在本教程中,我将介绍**如何在主流Linux发行版上手工设置eCryptFS**。
### eCryptFS的安装
Debian,Ubuntu或其衍生版:
```
$ sudo apt-get install ecryptfs-utils
```
注意,如果你在Ubuntu安装过程中选择加密家目录,eCryptFS应该已经安装了。
CentOS, RHEL or Fedora:
```
# yum install ecryptfs-utils
```
Arch Linux:
```
$ sudo pacman -S ecryptfs-utils
```
在安装完包后,加载eCryptFS内核模块当然会是一个很好的实践:
```
$ sudo modprobe ecryptfs
```
### 配置eCryptFS
现在,让我们开始加密一些目录,运行eCryptFS配置工具:
```
$ ecryptfs-setup-private
```

它会要求你输入登录密码和挂载密码。登录密码和你常规登录的密码一样,而挂载密码用于派生一个文件加密主密钥。这里留空可以生成一个(复杂的),这样会更安全。登出然后重新登录。
你会注意到,eCryptFS默认在你的家目录中创建了两个目录:Private和.Private。~/.Private目录包含有加密的数据,而你可以在~/Private目录中访问到相应的解密后的数据。在你登录时,~/.Private目录会自动解密并映射到~/Private目录,因此你可以访问它。当你登出时,~/Private目录会自动卸载,而~/Private目录中的内容会加密回到~/.Private目录。
eCryptFS怎么会知道你拥有~/.Private目录,并自动将其解密到~/Private目录而不需要我们输入密码呢?这就是eCryptFS的PAM模块捣的鬼,它为我们提供了这项便利服务。
如果你不想让~/Private目录在登录时自动挂载,只需要在运行ecryptfs-setup-private工具时添加“--noautomount”选项。同样,如果你不想要~/Private目录在登出后自动卸载,也可以自动“--noautoumount”选项。但是,那样后,你需要自己手工挂载或卸载~/Private目录:
```
$ ecryptfs-mount-private ~/.Private ~/Private
$ ecryptfs-umount-private ~/Private
```
你可以来验证一下.Private文件夹是否被挂载,运行:
```
$ mount
```

现在,我们可以开始把任何敏感文件放进~/Private文件夹里头了,它们会在我们登出时自动被加密并锁在~/.Private文件内。
所有这一切看起来是那么得神奇。这主要是ecryptfs-setup-private工具让一切设置变得简单。如果你想要深究一点,对eCryptFS指定的方面进行设置,那么请转到[官方文档](http://ecryptfs.org/documentation.html)。
### 结尾
综上所述,如果你十分关注你的隐私,最好是将基于eCryptFS文件系统级别的加密和全盘加密相结合。切记,只进行文件加密并不能保证你的隐私不受侵犯。
---
via: <http://xmodulo.com/encrypt-files-directories-ecryptfs-linux.html>
作者:[Christopher Valerio](http://xmodulo.com/author/valerio) 译者:[GOLinux](https://github.com/GOLinux) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,471 | 安卓编年史(5):Android 0.9 Beta——嘿,这看起来很眼熟! | http://arstechnica.com/gadgets/2016/10/building-android-a-40000-word-history-of-googles-mobile-os/5/ | 2014-12-18T13:39:00 | [
"Android",
"Android编年史",
"安卓编年史"
] | https://linux.cn/article-4471-1.html | 

*闹钟主屏幕,设置一个闹钟,计算器,以及计算器高级功能 [Ron Amadeo供图]*
安卓 0.9 第一次给我们展现了闹钟和计算器应用程序。闹钟应用的特征是有个扁平的模拟时钟,下方是一排设置的闹钟的滚动列表。不同于其它种类的开关,闹钟使用一个复选框来设置。闹钟可以设置为每周特定几天重复,以及它还有一整个列表的可选的、独特的闹钟铃声。
计算器是一个全黑色的应用,带有有光泽的圆形按钮。通过菜单,可以打开带有高级功能的附加面板。再次强调,一致性不是谷歌的强项所在。按键中的 Pi 键按下的高亮是红色的——在安卓 0.9 的其它地方,按键按下的高亮通常是橙色的。实际上,计算器中用到的所有东西是仅用于计算器的百分百定制设计。

*打开菜单的谷歌地图和新路线界面 [Ron Amadeo供图]*
谷歌地图在安卓 0.9 中真正能够运行——客户端能够连接到谷歌地图服务器并下载地图块。(给予我们地图图像——要记住谷歌地图是个基于云的应用。连最老旧的版本也会下载更为现代的地图块,所以忽略实际的地图块的样子吧。)地图的菜单获得了和浏览器菜单相同的全灰设计待遇,缩放控件也和浏览器的相同。最重要的“我的位置”按钮最终来到了安卓 0.9,这意味着该版本的地图支持 GPS 定位。
路线界面得到了改进。奇怪的聊天气泡附加不对齐的按钮已经被去除,换为更具交互性的书签图标,切换地点按钮移动到了左边,“go”按钮的现在被标记为“获取<ruby> 路线 <rp> ( </rp> <rt> Route </rt> <rp> ) </rp></ruby>”。

*谷歌地图图层选择,搜索历史,新加入的街景视图 [Ron Amadeo供图]*
“<ruby> 图层 <rp> ( </rp> <rt> Layers </rt> <rp> ) </rp></ruby>”被重命名为“<ruby> 地图模式 <rp> ( </rp> <rt> Map Mode </rt> <rp> ) </rp></ruby>”并且变成一个单选列表。一次只能选择一个地图类型——举个例子,你在卫星地图视图下不能查看交通状况。埋藏在菜单中的还有被匆忙放到一起的搜索记录界面。搜索历史看起来只是个概念验证,带着巨大的,模糊的搜索图标填充的搜索项被放置于半透明的背景之上。
街景曾经是个单独的应用(尽管它从没提供给公众),但在 0.9 中它被作为一个地图模式内置于谷歌地图之中。你可以拖拽小<ruby> 街景小人 <rp> ( </rp> <rt> Pegman </rt> <rp> ) </rp></ruby>到地图上,它会显示一个弹出气泡来展示街景的快照。点击快照会启动那个位置的街景。这时,街景除了可滚动的 360 度影像之外不会显示任何东西——在显示界面上根本就没有用户界面(UI)。

*我们第一次见到谷歌地图搜索界面。这些截图展示了搜索栏,搜索结果列表,显示在地图上的搜索结果,以及一个商业页面 [Ron Amadeo供图]*
安卓 0.9 同样第一次给我们展示了信息应用,称为<ruby> “信息” <rp> ( </rp> <rt> Messaging </rt> <rp> ) </rp></ruby>。就像一些早期的安卓设计,信息并不确定它应该是一个暗色系应用还是亮色系应用。第一眼可以看到的屏幕是信息列表,一个极力避免空白的质朴黑色界面,看起来像是建立在设置界面的设计之上。但点击“新信息”或已存在的会话后,你会被带到一个白色以及蓝色的文本信息的滚动列表这里。这两个相连的界面真是没法再更不一样一点了。

*信息应用的会话窗口,附件窗口,会话列表,以及设置 [Ron Amadeo供图]*
信息支持一定范围的附件:你可以附上图片,声音,或者一个幻灯片到你的信息之中。图片和声音可以实时录制或是从手机存储中拉取。另一个奇怪的UI选择是对于附件菜单中的每一项,安卓基本都已经有现成的图标可用,但信息却全部使用了另外定制的设计。
信息是最先带有自己设置界面的应用之一。用户可以请求已读以及送达报告以及设置下载偏好。

*幻灯片制作器。右边图片显示了菜单选项 [Ron Amadeo供图]*
附件选项中的“幻灯片”选项实际上是以一个全功能的幻灯片制作器的形式到来的。你可以添加图片,选择幻灯顺序,添加音乐,修改每张幻灯片的显示时间,以及添加文字。这已经复杂到足够给它一个自己的应用图标了,但令人惊奇的是它被隐藏在信息应用的菜单之中。在纵向模式下这是为数不多的完全无法使用的安卓应用之一——唯一的看图片方式以及控制是在横向显示之中。奇怪的是,纵向模式它仍然能够旋转,但显示输出变得一团糟。

*音乐播放器的主导航页面,歌曲列表,专辑列表,以及“正在播放”界面 [Ron Amadeo供图]*
安卓 0.9 第一次将音乐应用带进了安卓。首屏基本上只是几个将你带到各个功能视图的巨大的,矮胖的导航按钮。在应用底部是一个“正在播放”栏,仅仅包含了音轨名、艺术家,以及一个播放/暂停按钮。歌曲列表仅仅有个最简的无修饰界面,仅仅显示了歌曲名,艺术家,专辑以及时长。艺术家专辑是这个应用中唯一有希望看到色彩的地方。它在专辑视图里显示为一个小快照,在正在播放界面显示为巨大的,四分之一屏的图片。
正如安卓在这个时期的系统绝大多数部分,音乐应用的界面可能没什么值得看的,但功能已经基本齐全。正在播放界面有一个让你拖动歌曲的播放列表按钮,随机播放,重复播放,搜索,以及选择背景声音按钮。

*“相册”的所有相册视图,单个相册视图,以及单张图片视图 [Ron Amadeo供图]*
相册被简单地称为“图片”。初始视图显示你的所有相册。两个默认的相册是“相机”和巨大的合集相册,叫做“全部图片”。每个相册的快照由 2x2 的图片组成,每张图片有个白色的粗边框。
单个相册视图的样子大概是你所希望的:一个可滚动的图片方阵。你不能在单个图片大小的范围内向左右滑动来移动图片,而是应该轻点图片来移动图片。相册同样没有双指捏合缩放,你只能使用按钮来缩放图片。

*图片编缉!这些截图显示了一个打开的菜单,“更多”菜单,截取,以及设置 [Ron Amadeo供图]*
“图片”看起来十分简单,直到你点击菜单按钮并突然看到无数的选项。图片可以截取,旋转,删除,或设置壁纸或联系人图标。就像浏览器一样,所有的这一切通过一个笨拙的二级菜单系统完成。但是,我们为何又将看起来完全不同的菜单练联系到一起?
安卓 0.9 在安卓的第一个商业发行版本公布前仅仅两个月的时候诞生。这些时间只够应用开发者们确认他们的应用能够工作——以及让谷歌在第一个重大发布之前做一些测试和bug修复。
---

[Ron Amadeo](http://arstechnica.com/author/ronamadeo) / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。[@RonAmadeo](https://twitter.com/RonAmadeo)
---
via: <http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/5/>
译者:[alim0x](https://github.com/alim0x) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,472 | 为什么公司需要参与更多开源软件的编写? | http://readwrite.com/2014/08/16/open-source-software-business-zulily-erp-wall-street-journal | 2014-12-18T15:06:00 | [
"开源"
] | https://linux.cn/article-4472-1.html |
>
> 闭门造车是产生不了创新的。
>
>
>

[据华尔街日报称](http://blogs.wsj.com/cio/2014/08/08/zulily-calls-in-house-software-a-differentiator-for-competitive-advantage/),有消息表明,Zulily正在开发更多的内部软件,但实际上根本不是。多年前[Eric Raymond写道](http://oreilly.com/catalog/cathbazpaper/chapter/ch05.html),全世界95%的软件写来用的,而不是售卖。原因很多,但是其中有一个比较突出:正如Zulily的CIO Luke Friang所说,几乎没有一个[非定制]软件解决方案能跟上我们的步伐。
20年前是这样,现在也是这样。
但是有一点是不同的,这也正是华尔街日报完全忽略的地方。而这也正是历史上开发的内部软件始终保持着专有的原因了,因为它是一个公司的核心竞争力。然而今天,越来越多的公司意识到另一面:开源内部软件将会比保持专有获益更多。
这也就是为什么你的公司需要为开源项目做出更多的贡献。记住是更多。
### 不寻常的那些年
我们刚刚经历了一个很不一样的20年,那时很多软件的开发都是为了内部的使用,大多数人的精力都放在由SAP和微软这样的厂商建立的应用广泛的企业级解决方案。
不管怎么说,这都是一个理论。
在实践中,买方花费很少的钱购买license,然后至少付出5倍以上的代价来使软件符合他们的需求。比如说,一个公司可能在一个ERP系统上花费 100,000美元,但是他们还得继续花费500,000来维持软件正常运行。
开源软件甚至是应用程序正式发展起来的原因之一是很多公司可以免费获得一些功能性的产品(或者是以一个相对便宜的费用获得产品), 然后定制为他们所需要的。不管怎样,定制是有必要的,而且开源的根本是使成本更低,或许,这样的定制或许能产生更好的结果。
同时,开发者尽量的减少同类之间的相似之处。作为Redmonk分析师,[Stephen O'Grady认为](http://redmonk.com/sogrady/2010/01/12/roll-your-own/#ixzz3ATBuZsef):
>
> 从最近几年看,主流技术产业都有意避开专业化。运行在定制操作系统上的虚拟设备,已经彻底败给了RHEL和Windowns这些通用的操作系统。 最快20年,任何程序的数据保存都意味着一件事:一个关联的数据库,如果你要做的是企业级应用开发,那么你首先要接触的是Java,等等。
>
>
>
然而,开源的道路上,一些公司也发现,有些销售商不能很好地描述他们所想要的,即便是很好理解的产品类别,如像内容管理系统,他们需要 知道的是产品亮点,而不希望是一个模子刻出来的。
所以顾客没了,他们中有一部分转变成了供应商。
### 自己动手,丰衣足食
这也是常有的事,[O'Grady指出了](http://redmonk.com/sogrady/2010/01/12/roll-your-own/)这一点。2010年,O'Grady发现了一个有趣的现象:“软件提供商正面对着一个强有力的市场竞争者:他们的顾客。”
回想一下今天的高科技,大多数都是开源的,几乎所有的项目一开始都是某些公司的内部项目,或者仅仅是有些开发者的爱好,Linux,Git,Hadoop,Cassandra,MongDB,Android,等等。没有一个项目起初是为了售卖而产生的。
相反,这些项目通常是由一些公司维护,他们使用开源的资源来构建软件并[完善软件](http://en.wikipedia.org/wiki/The_Cathedral_and_the_Bazaar),这主要是一些Web公司。不像以前银行,医院和一些组织开发的软件只供内部使用,他们开源源码。
虽然,[有些公司避免定制软件](http://www.abajournal.com/magazine/article/roll_your_own_software_hidden_dangers_on_the_road_less_traveled/),因为他们不想自己维护它,开源(稍微)减轻了这些发展中公司来维护一个项目的压力。从而为项目发起人均摊项目的开发成本,Yahoo,建立了 Hadoop,但是现在最大的贡献者是Cloudera和Hortonworks。Facebook 建立了 Cassandra,但是现在主要是靠DataStax在维护。等等。
### 现在就走出来吧!
今天,真正的软件创新并不是闭门造车能造出来的,即便是可以,它也不会在那儿,开源项目颠覆了几十年的软件开发传统。
这不仅仅是一个人的一点点力量。
最好的开源项目都[发展得很快](http://readwrite.com/2013/12/12/open-source-innovation),但是这并不意味着别人在乎你的开源代码。[开放你的源码有显著的优缺点](http://readwrite.com/2014/07/07/open-source-software-pros-cons),其中一个很重要的优点是很多伟大的开发者都希望为开源做出贡献:如果你也想找一个伟大的开发者跟你一起,你需要给他们一个开放的源代码来让他们工作。([Netflix](http://techblog.netflix.com/2012/07/open-source-at-netflix-by-ruslan.html)说)
但是,我们没有理由站在一边看,现在正是时候参与开源社区了,而不是把“社区”妖魔化。是的,开源最大的参与者正是你们和你们的公司。 赶紧开始吧。
主要图片来自于Shutterstock. (注:Shutterstock是美国的一家摄影图片网站。)
---
via: <http://readwrite.com/2014/08/16/open-source-software-business-zulily-erp-wall-street-journal>
作者:[Matt Asay](http://readwrite.com/author/matt-asay) 译者:[barney-ro](https://github.com/barney-ro) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,473 | 如何从Ubuntu的声音菜单中移除音乐播放器 | http://www.omgubuntu.co.uk/2014/11/remove-players-ubuntu-sound-menu | 2014-12-18T16:32:00 | [
"Ubuntu",
"音乐播放器"
] | https://linux.cn/article-4473-1.html | 
**自从2010年首次出现,Ubuntu 的声音菜单已经被证明是Unity 桌面上的最流行的独有特性之一。**
把音乐播放器与音量控制程序集成到一个标准的界面里是一种看起来很聪明的做法,这样就不用到处找声音相关的各种程序。人们不禁要问,为什么其它操作系统没有效仿这种做法!
#### 臃肿
尽管它看起来很方便,但是这个小应用当前存在一个问题:很多播放器都堆在一起,像一个组合音响一样。也许你用得着,但是你安装的所有的媒体播放器都挤在这里,这会让人看着很累赘和反感。
我将要打赌,当你读到这里时,一定发现上面的截图看起来很熟悉!不要担心,**dconf-editor**可以解决它。
### 从Ubuntu 声音菜单中移除播放器
#### 第一部分: 基础知识
最快速和最简单地从声音菜单中移除播放器的方法就是卸载相关的应用程序。但这是极端的方式,我的意思是指你也许想要保留应用程序,但是不需要它集成到菜单里面。
只删除播放器但是保留我们需要的应用程序,我们用到一个看起来令人惊讶的工具叫“dconf-editor”。
你可能已经安装了,如果没有安装的话,那么你从Ubuntu软件中心找出。
* [在Ubuntu中点击安装Dconf-Editor](apt://dconf-editor)
一旦安装完毕,找到Unity Dash并打开。打开的时候不要惊慌;你没有到2002年,它确实是这种古老的样子。
使用右侧菜单栏,你需要从导航到 com > canonical > indicator > sound.下面的面板将会出现。

双击“interested-media-players”旁的闭括号,并删除你希望从声音菜单里移除掉的播放器,但需要保留方括号中,且不要删除任何需要保留的逗号或者单引号。
举个例子,我移除掉这些
‘**rhythmbox.desktop**’, ‘**pithos.desktop**’, ‘**clementine.desktop**’,
这样就好留了一行如下:
```
['tomahawk.desktop']
```
现在,当我再打开声音菜单时,我只看到Tomahawk:

#### 第二部分:黑名单
等等!还不能关闭dconf-editor。尽管上面的步骤看起来把事情处理得干净利落,但是一些播放器在打开时会立即重新加载到声音菜单。为了避免重复这个过程,将它们添加到**blacklisted-media-player**中。
记得每个在括号里的播放器都用逗号分隔多个条目。他们也必须在方括号内,所以在退出之前请务必仔细检查。
最终结果如下:

---
via: <http://www.omgubuntu.co.uk/2014/11/remove-players-ubuntu-sound-menu>
作者:[Joey-Elijah Sneddon](https://plus.google.com/117485690627814051450/?rel=author) 译者:[disylee](https://github.com/%E8%AF%91%E8%80%85ID) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,481 | 你值得拥有 —— 25 个 Linux 性能监控工具 | http://linoxide.com/monitoring-2/linux-performance-monitoring-tools/ | 2014-12-19T10:01:00 | [
"性能",
"监控"
] | /article-4481-1.html | 一段时间以来,我们在网上向读者介绍了如何为Linux以及类Linux操作系统配置多种不同的性能监控工具。在这篇文章中我们将罗列一系列使用最频繁的性能监控工具,并对介绍到的每一个工具提供了相应的简介链接,大致将其划分为两类,基于命令行的和提供图形化接口的。
### 基于命令行的性能监控工具
#### 1. dstat - 多类型资源统计工具
该命令整合了**vmstat**,**iostat**和**ifstat**三种命令。同时增加了新的特性和功能可以让你能及时看到各种的资源使用情况,从而能够使你对比和整合不同的资源使用情况。通过不同颜色和区块布局的界面帮助你能够更加清晰容易的获取信息。它也支持将信息数据导出到**cvs**格式文件中,从而用其他应用程序打开,或者导入到数据库中。你可以用该命令来[监控cpu,内存和网络状态随着时间的变化](http://linux.cn/article-3215-1.html)。

#### 2. atop - 相比top更好的ASCII码体验
这个使用**ASCII**码显示方式的命令行工具是一个显示所有进程活动的性能监控工具。它可以展示每日的系统日志以进行长期的进程活动分析,并高亮显示过载的系统使用资源。它包含了CPU,内存,交换空间,磁盘和网络层的度量指标。所有这些功能只需在终端运行**atop**即可。
```
# atop
```
当然你也可以使用[交互界面来显示](http://linoxide.com/monitoring-2/guide-using-linux-atop/)数据并进行排序。

#### 3. Nmon - 类Unix系统的性能监控
Nmon是**Nigel's Monitor**缩写,它最早开发用来作为**AIX**的系统监控工具。如果使用**在线模式**,可以使用光标键在屏幕上操作实时显示在终端上的监控信息。使用**捕捉模式**能够将数据保存为**CSV**格式,方便进一步的处理和图形化展示。

更多的信息参考[使用nmon进行性能监控](http://linoxide.com/monitoring-2/install-nmon-monitor-linux-performance/)的文章。
#### 4. slabtop - 显示内核slab缓存信息
这个应用能够显示**缓存分配器**是如何管理Linux内核中缓存的不同类型的对象。这个命令类似于top命令,区别是它的重点是实时显示内核slab缓存信息。它能够显示按照不同排序条件来排序显示缓存列表。它同时也能够显示一个slab层信息的统计信息的题头。举例如下:
```
# slabtop --sort=a
# slabtop -s b
# slabtop -s c
# slabtop -s l
# slabtop -s v
# slabtop -s n
# slabtop -s o
```
更多的信息参考[监控内核slab缓存](http://linux.cn/article-3702-1.html)的文章。
#### 5. sar - 性能监控和瓶颈检查
**sar** 命令可以将操作系统上所选的累积活动计数器内容信息输出到标准输出上。其基于计数值和时间间隔参数的**审计系统**,会按照指定的时间间隔输出指定次数的监控信息。如果时间间隔参数为设置为0,那么[sar命令将会显示系统从开机到当时时刻的平均统计信息](http://linoxide.com/linux-command/linux-system-performance-monitoring-using-sar-command/)。有用的命令如下:
```
# sar -u 2 3
# sar -u -f /var/log/sa/sa05
# sar -P ALL 1 1
# sar -r 1 3
# sar -W 1 3
```
#### 6. Saidar - 简单的统计监控工具
Saidar是一个**简单**且**轻量**的系统信息监控工具。虽然它无法提供大多性能报表,但是它能够通过一个简单明了的方式显示最有用的系统运行状况数据。你可以很容易地看到[运行时间、平均负载、CPU、内存、进程、磁盘和网络接口](http://linoxide.com/monitoring-2/monitor-linux-saidar-tool/)统计信息。
```
Usage: saidar [-d delay] [-c] [-v] [-h]
-d 设置更新时间(秒)
-c 彩色显示
-v 显示版本号
-h 显示本帮助
```

#### 7. top - 经典的Linux任务管理工具
作为一个广为人知的**Linux**工具,**top**是大多数的类Unix操作系统任务管理器。它可以显示当前正在运行的进程的列表,用户可以按照不同的条件对该列表进行排序。它主要显示了系统进程对**CPU**和内存的使用状况。top可以快速检查是哪个或哪几个进程挂起了你的系统。你可以在[这里](http://linux.cn/article-2352-1.html)看到top使用的例子。 你可以在终端输入top来运行它并进入到交互模式:
```
交互模式的一些快捷操作:
全局命令: <回车/空格> ?, =, A, B, d, G, h, I, k, q, r, s, W, Z
统计区的命令: l, m, t, 1
任务区的命令:
外观: b, x, y, z 内容: c, f, H, o, S, u 大小: #, i, n 排序: <, >, F, O, R
色彩方案: <Ret>, a, B, b, H, M, q, S, T, w, z, 0 - 7
窗口命令: -, _, =, +, A, a, G, g, w
```

#### 8. Sysdig - 系统进程的高级视图
**Sysdig**是一个能够让系统管理员和开发人员以前所未有方式洞察其系统行为的监控工具。其开发团队希望改善系统级的监控方式,通过提供关于**存储,进程,网络和内存**子系统的**统一有序**以及**粒度可见**的方式来进行错误排查,并可以创建系统活动记录文件以便你可以在任何时间轻松分析。
简单例子:
```
# sysdig proc.name=vim
# sysdig -p"%proc.name %fd.name" "evt.type=accept and proc.name!=httpd"
# sysdig evt.type=chdir and user.name=root
# sysdig -l
# sysdig -L
# sysdig -c topprocs_net
# sysdig -c fdcount_by fd.sport "evt.type=accept"
# sysdig -p"%proc.name %fd.name" "evt.type=accept and proc.name!=httpd"
# sysdig -c topprocs_file
# sysdig -c fdcount_by proc.name "fd.type=file"
# sysdig -p "%12user.name %6proc.pid %12proc.name %3fd.num %fd.typechar %fd.name" evt.type=open
# sysdig -c topprocs_cpu
# sysdig -c topprocs_cpu evt.cpu=0
# sysdig -p"%evt.arg.path" "evt.type=chdir and user.name=root"
# sysdig evt.type=open and fd.name contains /etc
```

更多的信息参考:[如何利用sysdig改善系统层次的监控和错误排查](http://linux.cn/article-4341-1.html)。
#### 9. netstat - 显示开放的端口和连接
它是**Linux管理员**使用来显示各种网络信息的工具,如查看什么端口开放和什么网络连接已经建立以及何种进程运行在该连接之上。同时它也显示了不同程序间打开的**Unix套接字**的信息。作为大多数Linux发行版本的一部分,netstat的许多命令在[netstat和它的不同输出](http://linux.cn/article-2434-1.html)中有详细的描述。最为常用的如下:
```
$ netstat | head -20
$ netstat -r
$ netstat -rC
$ netstat -i
$ netstat -ie
$ netstat -s
$ netstat -g
$ netstat -tapn
```
#### 10. tcpdump - 洞察网络封包
**tcpdump**可以用来查看**网络连接**的**封包**内容。它显示了传输过程中封包内容的各种信息。为了使得输出信息更为有用,它允许使用者通过不同的过滤器获取自己想要的信息。可以参照的例子如下:
```
# tcpdump -i eth0 not port 22
# tcpdump -c 10 -i eth0
# tcpdump -ni eth0 -c 10 not port 22
# tcpdump -w aloft.cap -s 0
# tcpdump -r aloft.cap
# tcpdump -i eth0 dst port 80
```
更多的信息可以在[使用topdump捕捉包](http://linoxide.com/linux-how-to/network-traffic-capture-tcp-dump-command/)中找到详细描述。
#### 11. vmstat - 虚拟内存统计信息
**vmstat**是虚拟内存(**virtual memory** statistics)的缩写,作为一个**内存监控**工具,它收集和显示关于**内存**,**进程**,**终端**和**分页**和**I/O阻塞**的概括信息。作为一个开源程序,它可以在大部分Linux发行版本中找到,包括Solaris和FreeBSD。它用来诊断大部分的内存性能问题和其他相关问题。

更多的信息参考[vmstat命令](http://linux.cn/article-2472-1.html)的文章。
#### 12. free - 内存统计信息
free是另一个能够在终端中显示内存和交换空间使用的命令行工具。由于它的简易,它经常用于快速查看内存使用或者是应用于不同的脚本和应用程序中。在这里你可以看到[这个小程序的许多应用](http://linux.cn/article-2443-1.html)。几乎所有的系统管理员日常都会用这个工具。:-)

#### 13. Htop - 更加友好的top
**Htop**基本上是一个top改善版本,它能够以更加多彩的方式显示更多的统计信息,同时允许你采用不同的方式进行排序,它提供了一个**用户友好**的接口。

更多的信息参考我们的文章:“[关于htop和top的比较](http://linux.cn/article-3141-1.html)”。
#### 14. ss - 网络管理的现代替代品
**ss**是**iproute2**包的一部分。iproute2是用来替代一整套标准的**Unix网络**工具组件,它曾经用来完成[网络接口配置,路由表和管理ARP表](http://linux.cn/article-4372-1.html)任务。ss工具用来记录套接字统计信息,它可以显示类似netstat一样的信息,同时也能显示更多TCP和状态信息。一些例子如下:
```
# ss -tnap
# ss -tnap6
# ss -tnap
# ss -s
# ss -tn -o state established -p
```
#### 15. lsof - 列表显示打开的文件
**lsof**命令,意为“**list open files**”, 用于在许多类Unix系统中显示所有打开的文件及打开它们的进程。在大部分Linux发行版和其他类Linux操作系统中系统管理员用它来检查不同的进程打开了哪些文件。
```
# lsof +p process_id
# lsof | less
# lsof –u username
# lsof /etc/passwd
# lsof –i TCP:ftp
# lsof –i TCP:80
```
更多的信息参考我们的文章:[lsof 的使用](http://linux.cn/article-4099-1.html)。
#### 16. iftop - 类似top的了网络连接工具
**iftop**是另一个基于网络信息的类似top的程序。它能够显示当前时刻按照**带宽使用**量或者上传或者下载量排序的**网络连接**状况。它同时提供了下载文件的预估完成时间。

更多的信息参考[Linux流量监控工具:iftop](http://linux.cn/article-1843-1.html)。
#### 17. iperf - 网络性能工具
**iperf**是一个**网络测试**工具,能够创建**TCP**和**UDP**数据连接并在网络上测量它们的**传输性能**。它支持调节关于时间,协议和缓冲等不同的参数。对于每一个测试,它会报告带宽,丢包和其他的一些参数。

如果你想用使用这个工具,可以参考这篇文章: [如何安装和使用iperf](http://linoxide.com/monitoring-2/install-iperf-test-network-speed-bandwidth/)。
#### 18. Smem - 高级内存报表工具
**Smem**是最先进的**Linux**命令行工具之一,它提供关于系统中已经使用的和共享的实际内存大小,试图提供一个更为可靠的当前**内存**使用数据。
```
$ smem -m
$ smem -m -p | grep firefox
$ smem -u -p
$ smem -w -p
```
参考我们的文章:[Smem更多的例子](http://linux.cn/article-4492-1.html)。
### 图形化或基于Web的性能工具
#### 19. Icinga - Nagios的社区分支版本
**Icinga**是一个**开源免费**的网络监控程序,作为Nagios的分支,它继承了前者现有的大部分功能,同时基于这些功能又增加了社区用户要求已久的功能和补丁。

更多信息请参考[安装和配置lcinga文章](http://linoxide.com/monitoring-2/install-configure-icinga-linux/)。
#### 20. Nagios - 最为流行的监控工具
作为在Linux上使用最为广泛和最为流行的**监控方案**,它有一个守护程序用来收集不同进程和远程主机的信息,这些收集到的信息都通过功能强大**的web界面**进行呈现。

你可以在文章“[如何安装nagios](http://linux.cn/article-2436-1.html)”里面**找到更多的信息。**
#### 21. Linux process explorer - Linux下的procexp
**Linux process explorer**是一个Linux下的图形化进程浏览工具。它能够显示不同的进程信息,如进程数,TCP/IP连接和每一个进程的性能指标。作为**Windows**下**procexp**在Linux的替代品,是由**Sysinternals**开发的,其目标是比**top**和**ps**提供更好用户体验。

查看 [linux process explorer 的文章](http://sourceforge.net/projects/procexp/)获取更多信息。
#### 22. Collectl - 性能监控工具
你可以既可以通过交互的方式使用这个**性能监控**工具,也可以用它把**报表**写到磁盘上,并通过web服务器来访问。它以一种**易读易管理**的格式,显示了**CPU,磁盘,内存,网络,网络文件系统,进程,slabs**等统计信息。

更多信息请参看[Collectl的文章](http://linux.cn/article-3154-1.html)。
#### 23. MRTG - 经典网络流量监控图形工具
这是一个采用**rrdtool**的生成图形的流量监控工具。作为**最早**的提供**图形化界面**的流量监控工具,它被广泛应用在类Unix的操作系统中。查看我们关于[如何使用MRTG](http://linoxide.com/tools/multi-router-traffic-grapher/)的文章获取更多关于安装和配置的信息。

#### 24. Monit - 简单易用的监控工具
**Monit**是一个用来**监控进程**,**系统加载**,**文件系统**和**目录文件**等的开源的Linux工具。你能够让它自动化维护和修复,也能够在运行错误的情景下执行特定动作或者发邮件报告提醒系统管理员。

如果你想要用这个工具,你可以查看[如何使用Monit的文章](http://linoxide.com/monitoring-2/monit-linux/)。
#### 25. Munin - 为服务器提供监控和提醒服务
作为一个网络资源监控工具,Munin能够帮助分析资源趋势和查看薄弱环节以及导致产生性能问题的原因。开发此软件的团队希望它能够易用和用户体验友好。该软件是用Perl开发的,并采用rrdtool来绘制图形,使用了web界面进行呈现。开发人员推广此应用时声称当前已有500多个监控插件可以“**即插即用**”。
 更多信息可以在[关于Munin的文章](http://linoxide.com/ubuntu-how-to/install-munin/)中找到。
---
via: <http://linoxide.com/monitoring-2/linux-performance-monitoring-tools/>
作者:[Adrian Dinu](http://linoxide.com/author/adriand/) 译者:[andyxue](https://github.com/andyxue) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='linoxide.com', port=80): Max retries exceeded with url: /monitoring-2/linux-performance-monitoring-tools/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7b83275c57e0>, 'Connection to linoxide.com timed out. (connect timeout=10)')) | null |
4,489 | Shell 脚本基础 - 使用 if 语句进行条件检测 | http://www.linuxtechi.com/shell-scripting-checking-conditions-with-if/ | 2014-12-21T10:31:00 | [
"Shell编程",
"Shell脚本"
] | https://linux.cn/article-4489-1.html | [Bourne Shell](http://en.wikipedia.org/wiki/Bourne_shell) 的 if 语句和大部分编程语言一样 - 检测条件是否真实,如果条件为真,shell 会执行这个 if 语句指定的代码块,如果条件为假,shell 就会跳过 if 代码块,继续执行之后的代码。

### if 语句的语法:
```
if [ 判断条件 ]
then
command1
command2
……..
last_command
fi
```
#### Example:
```
#!/bin/bash
number=150
if [ $number -eq 150 ]
then
echo "Number is 150"
fi
```
#### if-else 语句:
除了标准的 if 语句之外,我们还可以加入 else 代码块来扩展 if 语句。这么做的主要目的是:如果 if 条件为真,执行 if 语句里的代码块,如果 if 条件为假,执行 else 语句里的代码块。
#### 语法:
```
if [ 判断条件 ]
then
command1
command2
……..
last_command
else
command1
command2
……..
last_command
fi
```
#### Example:
```
#!/bin/bash
number=150
if [ $number -gt 250 ]
then
echo "Number is greater"
else
echo "Number is smaller"
fi
```
### If..elif..else..fi 语句 (简写的 else if)
Bourne Shell 的 if 语句语法中,else 语句里的代码块会在 if 条件为假时执行。我们还可以将 if 语句嵌套到一起,来实现多重条件的检测。我们可以使用 elif 语句(else if 的缩写)来构建多重条件的检测。
#### 语法 :
```
if [ 判断条件1 ]
then
command1
command2
……..
last_command
elif [ 判断条件2 ]
then
command1
command2
……..
last_command
else
command1
command2
……..
last_command
fi
```
#### Example :
```
#!/bin/bash
number=150
if [ $number -gt 300 ]
then
echo "Number is greater"
elif [ $number -lt 300 ]
then
echo "Number is Smaller"
else
echo "Number is equal to actual value"
fi
```
### 多重 if 语句 :
If 和 else 语句可以在一个 bash 脚本里相互嵌套。关键词 “fi” 表示里层 if 语句的结束,所有 if 语句必须使用 关键词 “fi” 来结束。
基本 if 语句的**嵌套语法**:
```
if [ 判断条件1 ]
then
command1
command2
……..
last_command
else
if [ 判断条件2 ]
then
command1
command2
……..
last_command
else
command1
command2
……..
last_command
fi
fi
```
#### Example:
```
#!/bin/bash
number=150
if [ $number -eq 150 ]
then
echo "Number is 150"
else
if [ $number -gt 150 ]
then
echo "Number is greater"
else
echo "'Number is smaller"
fi
fi
```
---
via: <http://www.linuxtechi.com/shell-scripting-checking-conditions-with-if/>
作者:[Pradeep Kumar](http://www.linuxtechi.com/author/pradeep/) 译者:[ThomazL](https://github.com/ThomazL) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,490 | Linux 系统中使用 logwatch 监控日志文件 | http://xmodulo.com/monitor-log-file-linux-logwatch.html | 2014-12-21T10:51:56 | [
"logwatch",
"日志"
] | https://linux.cn/article-4490-1.html | Linux 操作系统和许多应用程序会创建特殊的文件来记录它们的运行事件,这些文件通常被称作“日志”。当要了解操作系统或第三方应用程序的行为或进行故障排查时,这些系统日志或特定的应用程序日志文件是必不可少的的工具。但是,日志文件并没有您们所谓的“清晰”或“容易”这种程度的可读性。手工分析原始的日志文件简直是浪费时间,并且单调乏味。出于这个原因,对于系统管理员来说,发现任何一款能把原始的日志文件转换成更人性化的记录摘要的工具,将会受益无穷。

[logwatch](http://sourceforge.net/projects/logwatch/) 是一款用 Perl 语言编写的开源日志解析分析器。它能对原始的日志文件进行解析并转换成结构化格式的文档,也能根据您的使用情况和需求来定制报告。logwatch 的主要目的是生成更易于使用的日志摘要,并不是用来对日志进行实时的处理和监控的。正因为如此,logwatch 通常被设定好时间和频率的自动定时任务来调度运行或者是有需要日志处理的时候从命令行里手动运行。一旦日志报告生成,logwatch 可以通过电子邮件把这报告发送给您,您可以把它保存成文件或者直接显示在屏幕上。
Logwatch 报告的详细程度和报告覆盖范围是完全可定制化的。Logwatch 的日志处理引擎也是可扩展的,从某种意义上来说,如果您想在一个新的应用程序中使用 logwatch 功能的话,只需要为这个应用程序的日志文件编写一个日志处理脚本(使用 Perl 语言),然后挂接到 logwatch 上就行。
logwatch 有一点不好的就是,在它生成的报告中没有详细的时间戳信息,而原来的日志文件中是存在的。您只能知道被记录下来的一段时间之内的特定事件,如果想要知道精确的时间点的信息,就不得不去查看原日志文件了。
### 安装 Logwatch
在 Debian 系统或其派生的系统上:
```
# aptitude install logwatch
```
在基于 Red Hat 的发布系统上:
```
# yum install logwatch
```
### 配置 Logwatch
安装时,主要的配置文件(logwatch.conf)被放到 **/etc/logwatch/conf** 目录中。此文件(默认是空的)定义的设置选项会覆盖掉定义在 /usr/share/logwatch/default.conf/logwatch.conf 文件中的系统级设置。
在命令行中,启动 logwatch, 如果不带参数的话,将会使用 /etc/logwatch/conf/logwatch.conf 文件中定义的选项。但,只要一指定参数,它们就会覆盖 /etc/logwatch/conf/logwatch.conf 文件中的任意默认/自定义设置。
这篇文章里,我们会编辑 /etc/logwatch/conf/logwatch.conf 文件来对一些默认的设置项做些个性化设置。
```
Detail = <Low, Med, High, 或数字>
```
“Detail” 配置指令控制着 logwatch 报告的详细程度。它可以是个正整数,也可以是分别代表着10、5和0数字的 High、Med、Low 几个选项。
```
MailTo = [email protected]
```
如果您让把一份 logwatch 的报告邮件给您,就要使用 “MailTo” 这个配置指令。要把一份报告发送给多个用户,只需要把他们的邮件地址用空格格开,然后配置上去。但是,您需要在 logwatch 运行的服务器上配置好本地邮件传输代理(MTA)如,sendmail、 Postfix 等,这个配置指令项才能起作用。
```
Range = <Yesterday|Today|All>
```
"Range" 配置指令定义了生成 logwatch 报告的时间段信息。这个指令通常可选的值是 Yesterday、Today、All。当作用了“Rang = All”时,“Archive = yes” 这个指令项也必须配置上,那么所有的已存档的日志文件 (比如,/var/log/maillog、/var/log/maillog.X 或 /var/log/maillog.X.gz 文件)都会被处理到。
除了这些通用的 range 值,您也可以使用复杂点的选择值,如下所示:
* Range = "2 hours ago for that hour"
* Range = "-5 days"
* Range = "between -7 days and -3 days"
* Range = "since September 15, 2014"
* Range = "first Friday in October"
* Range = "2014/10/15 12:50:15 for that second"
要使用上面例子中自由形式的 range,您需要从 CPAN(注:Comprehensive Perl Archive Network) 上下载安装 Perl 的 Date::Manip 模块。关于 CPAN 模块的安装说明,请请参阅[此帖](http://xmodulo.com/how-to-install-perl-modules-from-cpan.html) 。
```
Service = <service-name-1>
Service = <service-name-2>
. . .
```
“Service” 选项指定想要监控的一个或多个服务。在 /usr/share/logwatch/scripts/services 目录下列出的服务都能被监控,它们已经涵盖了重要的系统服务(例如:pam,secure,iptables,syslogd 等),也涵盖了一些像 sudo、sshd、http、fail2ban、samba等主流的应用服务。如果您想添加新的服务到列表中,得编写一个相应的日志处理 Perl 脚本,并把它放在这个目录中。
如果这个选项要用来选择特定的服务话,您需要把 /usr/share/logwatch/default.conf/logwatch.conf 文件中的 "Service = All " 这一行注释掉。

```
Format = <text|html>
```
“Format” 配置指令定义了一份 logwatch 报告的格式(比如 text 或者 HTML)。
```
Output = <file|mail|stdout>
```
"Output" 配置指令定义生成的 logwatch 报告要发送的目的地。它能被保存成文件(file),生成电子邮件(mail)或者是直接在屏幕上显示(stdout)。
### 用 Logwatch 来分析日志文件
要弄明白怎么使用 logwatch 来分析日志文件,可以参考下面的 logwatch.conf 文件例子:
```
Detail = High
MailTo = [email protected]
Range = Today
Service = http
Service = postfix
Service = zz-disk_space
Format = html
Output = mail
```
使用这些设置,logwatch 将会处理三个应用服务(http、postfix 和 zz-disk\_space)当天产生的日志,生成一份非常详细的 HTML 格式报告,然后邮件给您。
如果您不想个性化 /etc/logwatch/conf/logwatch.conf,您可以不修改此文件让其默认,然后在命令行里运行如下所示的命令。也会得到同样的输出。
```
# logwatch --detail 10 --mailto [email protected] --range today --service http --service postfix --service zz-disk_space --format html --output mail
```
电子邮件发送的报告样子如图示:

这份电子邮件头部包含指向导航到报告细节的链接,在每个选中的服务细节,也会有“返回顶部”的链接。
接收人很少的情况下您可能会使用电子邮件发送报告这个选项。其它情况下,您可能会把让其生成为 HTML 格式的报告,这样每个想看这份报告的人都可以从网络共享里看到。只需要把上面例子中的配置做些修改就可以实现:
```
Detail = High
Range = Today
Service = http
Service = postfix
Service = zz-disk_space
Format = html
Output = file
Filename = /var/www/html/logs/dev1.html
```
同样的,也可以在命令行中运行如下的命令。
```
# logwatch --detail 10 --range today --service http --service postfix --service zz-disk_space --format html --output file --filename /var/www/html/logs/dev1.html
```
最后,让我们使用 cron 来配置 logwatch 的定时执行任务。下面的例子中,将会在每个工作日的下午 12:15 分运行 logwatch 调度任务。
```
# crontab -e
```
---
```
15 12 * * 1,2,3,4,5 /sbin/logwatch
```
希望这会有所帮助。欢迎到社区发表评论或分享自己的心得和体会!
---
via: <http://xmodulo.com/monitor-log-file-linux-logwatch.html>
作者:[Gabriel Cánepa](http://xmodulo.com/author/gabriel) 译者:[runningwater](https://github.com/runningwater) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,491 | 一些关于Java的句子 | http://www.javacodegeeks.com/2014/11/some-sentences-about-java.html | 2014-12-21T11:07:15 | [
"Java"
] | https://linux.cn/article-4491-1.html | 本文并没有什么新鲜的。我只是收集了一些不太重要的语句,但这些语句可能对初级程序员来说很重要。也就是些无聊的旧东西。
如果以下的这些你都知道的话,那么你比Java的了解已经超过了对一个平常的家庭主妇的了解。我不知道清楚所有的这些是否是有意义的。即使不知道其中的一些特性,你照样也可以成为一个相当不错的Java程序员。然而,本文中许多的新信息可能表明你还有很大的发展空间。
### Java中有四种不同的访问类型(而不是三种)
这四种类型包括:private, package private (包访问权限,无修饰符,又叫default, 译者注)。如果你在类中定义一个元素时并不加任何访问类型修饰符,它将被默认设置为包访问权限(package private),而不是public或者protected。

*Java有四个级别的访问类型。*
从另一方面来说,如果在接口中,你不指定方法的访问修饰符,那么它将是public类型的。你也可以显式地指定它为public类型, 但这并不符合SONAR(一个开源代码质量管理平台,译者注)的代码质量管理思想。

*访问类型是传递的*
>
> 我的“在Java中允许选择性的在接口的方法中写public”的观点是一个技术错误。
>
>
>
同样你也可在接口的字段前写final,甚至是static。这说明这些字段可以是非静态或非final吗?不是的,接口中的字段中总是final和static的。
### Protected和package private是不一样的
Package private(或者default)访问类型可以使得相同包(package)下其他类能够访问这些字段或方法。保护类型(protected)的方法和字段可以被相同包下的类使用(这和package private是一样的),同时它也可以被其他类使用,只要那个类继承了这个包含这些protected方法或字段的类。
### Protected是可传递的
如果有三个包a、b、c,每个包都分别包含A、B、C类,而且B继承A,C继承B,那么C可以访问A中的protected字段和方法。
```
package a;
public class A {
protected void a() {
}
}
package b;
import a.A;
public class B extends A {
protected void b() {
a();
}
}
package c;
import b.B;
public class C extends B {
protected void c() {
a();
}
}
```
### 接口不能定义protected方法
很多人认为可以在接口中定义protected方法。如果你这么做的话,编译器很快就会毫不留情地给你报错。顺便说下,这也就是我为什么认为允许public关键字在接口中是一个技术错误,它会让人觉得还可以写其他访问类型似的。

*private是一种新的public*
如果你还想在一个接口的方法中声明protected方法,你可能还不理解封装的含义。
### 此private非彼private
私有变量和方法在编译单元内是可见的。如果这听起来太神秘的话,换种说法:几乎就是在同一个Java文件中。这比“在它们被定义的类中”听起来好理解些。它们在同一编译单元的类和接口中也是可见的。嵌套类可以看到类中封装的私有字段和方法。然而,当前封闭类也可以看到该类下任何深度下类中的私有方法和字段。
```
package a;
class Private {
private class PrivateInPrivate {
private Object object;
}
Object m() {
return new PrivateInPrivate().object;
}
}
```
后者并不广为人知,事实上也很少有用到。
### Private是类的访问级别而不是对象
如果你可以访问一个变量或方法,那么不管它属于哪个对象你都可以访问它。如果this.a可以访问到,那another.a也可以访问到,只要它们是同一个类的实例。同一个类的实例对象可以随意调用其他实例的变量或方法。不过这样的代码一般都没有意义。现实生活中异常是equals()(由Eclipse生成, 15 - 18行):
```
package a;
public class PrivateIsClass {
private Object object;
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PrivateIsClass other = (PrivateIsClass) obj;
if (object == null) {
if (other.object != null)
return false;
} else if (!object.equals(other.object))
return false;
return true;
}
}
```
### 静态(static)类可能有很多实例

*访问类型不是对象级别的而是类级别的。*
那些不支持有任何实例的类,通常被称为实用工具类。它们只包含静态字段和静态方法以及唯一的不被该类的任何静态方法调用的私有构造函数。在Java 8中也可以有这样的一个野兽(这个词翻译不通,译者注)在接口中实现,因为Java 8的接口可以有静态方法。我不觉得我们应该使用这个特性而不是实用工具类。我也不完全确信我们应该使用实用工具类。
静态类总是在另一个类或接口中。它们是嵌套类。他们是静态的,就像静态方法不能访问类的实例方法和字段一样,静态内部类也不能访问嵌入类的实例方法和字段。这是因为内部类没有嵌入类实例的引用(或者说是指针,如果你喜欢这么叫的话)。内部类(内部类,也即非静态嵌套类, 译者注),而非静态嵌套类, 没有嵌入类的一个实例,它是无法被创建的。每个内部类的实例都具有嵌入类实例的一个引用,因此一个内部类可以访问嵌入类的实例方法和字段。
因为这个原因,要是没有外部类的一个实例,你就不能创建一个内部类。当然,如果是当前对象,也就是this的话,你就可以不需要指定它。在这种情况下你可以使用new, 在这种情况下,也就是this.new的简式。在一个静态的环境中,例如从一个静态方法,你必须指定内部类应该创建哪个封闭类的实例。见第10行:
```
package a;
class Nesting {
static class Nested {}
class Inner {}
void method(){
Inner inner = new Inner();
}
static void staticMethod(){
Inner inner = new Nesting().new Inner();
}
}
```
### 匿名类只能访问final变量

*变量必须是有效的final*
当一个匿名类被定义在一个方法中,它可以访问局部变量如果该变量是final的。但这说的有点模糊。它们不得不声明成final,他们还必须是有效final。这也是Java 8中发布的一些特性。你不需要声明这些变量为final型,但它们仍然必须是有效的final。

*Java 8并不要求final,只要求有效final。*
为什么你需要对一些东西声明final,当它被检查必须是这样的。就像方法的参数。它们也必须是final的。你说这不是Java所必须的吗?嗯,你是对的。这只是一个良好的编程风格所必须的。
---
via: <http://www.javacodegeeks.com/2014/11/some-sentences-about-java.html>
作者:[Peter Verhas](http://www.javacodegeeks.com/author/peter-verhas/) 译者:[a598799539](https://github.com/a598799539) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,492 | 使用 smem 可视化显示Linux内存使用情况 | http://xmodulo.com/visualize-memory-usage-linux.html | 2014-12-21T14:16:00 | [
"smem",
"系统监控",
"内存"
] | https://linux.cn/article-4492-1.html | 物理内存不足对Linux桌面系统和服务器系统的性能影响都很大。当你的计算机变慢时,要做的第一件事就是释放内存。尤其是在多用户环境以及执行关键任务的服务器环境下,内存消耗会变得更加关键,因为多个用户和应用线程会同时竞争更多的内存空间。

如果要监测系统内各种资源的使用情况(比如说CPU或内存),图形化显示是一种高效的方法,通过图形界面可以快速分析各用户和进程的资源消耗情况。本教程将给大家介绍**在linux下图形化分析内存使用情况**的方法,使用到命令行工具是[smem](http://www.selenic.com/smem/).
### 物理内存使用情况: RSS 、 PSS 和 USS
由于Linux使用到了虚拟内存(virtual memory),因此要准确的计算一个进程实际使用的物理内存就不是那么简单。 只知道进程的虚拟内存大小也并没有太大的用处,因为还是无法获取到实际分配的物理内存大小。
* **RSS(Resident set size)**,使用top命令可以查询到,是最常用的内存指标,表示进程占用的物理内存大小。但是,将各进程的RSS值相加,通常会超出整个系统的内存消耗,这是因为RSS中包含了各进程间共享的内存。
* **PSS(Proportional set size)**会更准确一些,它将共享内存的大小进行平均后,再分摊到各进程上去。
* **USS(Unique set size )**是PSS中自己的部分,它只计算了进程独自占用的内存大小,不包含任何共享的部分。
### 安装Smem
smem是一个能够生成多种内存耗用报告的命令行工具,它从/proc文件系统中提取各进程的PSS/USS信息,并进行汇总输出。它还内建了图表的生成能力,所以能够方便地分析整个系统的内存使用情况。
#### 在Debian, Ubuntu 或 Linux Mint 上安装smem
```
$ sudo apt-get install smem
```
#### 在Fedora 或 CentOS/RHEL上安装Smem
在CentOS/RHEL上,你首先得[启用](http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html)EPEL仓库。
```
$ sudo yum install smem python-matplotlib
```
### 使用smem检查内存使用情况
你可以在非特权模式下使用smem,它能够显示当前用户运行的所有进程的内存使用情况,并按照PSS的大小进行排序。
```
$ smem
```

如有你想得到整个系统中所有用户的内存使用情况,就需要使用root权限来运行smem。
```
$ sudo smem
```

也可以按用户维度来输出报告:
```
$ sudo smem -u
```

smem提供了以下选项来对输出结果进行筛选,支持按映射方式(mapping)、进程和用户三个维度的筛选:
* -M <正则表达式>
* -P <正则表达式>
* -U <正则表达式>
想了解smem更多的使用方式,可以查询用户手册(man page)。
### 使用smem图形化显示内存使用情况
图形化的报告使用起来会更加方便快捷。smem支持两种格式的图形显示方式:直方图和饼图。
下面是一些图形化显示的实例。
下面的命令行会基于PSS/RSS值,生成直方图,以用户alice为例。
```
$ sudo smem --bar name -c "pss uss" -U alice
```

这个例子会生成一张饼图,图中显示了系统中各进程的PSS内存使用量:
```
$ sudo smem --pie name -c "pss"
```

概括来说,smem是一个方便易用的内存分析工具。利用smem的格式化输出,你可以对内存使用报告进行自动化分析,并执行一些自动化的处理措施。如果你还知道其他的一些优秀的内存检测工具,请在留言区告诉我。
---
via: <http://xmodulo.com/visualize-memory-usage-linux.html>
作者:[Dan Nanni](http://xmodulo.com/author/nanni) 译者:[coloka](https://github.com/coloka) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,493 | 如何不使用DBCA在Oracle 11中删除数据库 | http://www.unixmen.com/drop-database-oracle-11-without-using-dcba/ | 2014-12-21T15:22:00 | [
"Oracle",
"数据库"
] | https://linux.cn/article-4493-1.html | 本文简短的教程,将会向你展示如何不使用DBCA(数据库配置助手)在Oracle 11中删除数据库。

#### 1- 导入数据库的SID,如果没有定义的话
```
export ORACLE_SID=database
```
#### 2- 以操作系统认证连接数据库
```
[oracle@Oracle11 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Mon Dec 1 17:38:02 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
```
#### 3- 启动数据库实例
```
SQL> startup
ORACLE instance started.
Total System Global Area 3340451840 bytes
Fixed Size 2217952 bytes
Variable Size 1828718624 bytes
Database Buffers 1493172224 bytes
Redo Buffers 16343040 bytes
Database mounted.
Database opened.
```
#### 4- 关闭数据库
```
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
```
#### 5- 启动独占模式
```
SQL> startup mount exclusive restrict
ORACLE instance started.
Total System Global Area 3340451840 bytes
Fixed Size 2217952 bytes
Variable Size 1828718624 bytes
Database Buffers 1493172224 bytes
Redo Buffers 16343040 bytes
Database mounted.
```
#### 6- 删除数据库
```
SQL> drop database;
<br>Database dropped.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
```
完成!
---
via: <http://www.unixmen.com/drop-database-oracle-11-without-using-dcba/>
作者:[M.el Khamlichi](http://www.unixmen.com/author/pirat9/) 译者:[VicYu/Vic020](http://vicyu.net/) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,495 | Pitivi 0.94 切换到 GTK HeaderBar,修复无数 Bugs | http://www.omgubuntu.co.uk/2014/11/pitivi-0-94-header-bar-more-features | 2014-12-21T22:39:00 | [
"Pitivi"
] | https://linux.cn/article-4495-1.html | 我是 [Pitivi 视频编辑器](http://pitivi.org/) 的狂热爱好者。Pitivi 可能不是(至少现在不是)Linux 上可用的、最拉风的、功能完善的、非线性视频编辑器,但是它绝对是最可靠的一个。

自然而然地,我一直在期待这个开源视频编辑器[这次](http://jeff.ecchi.ca/blog/2014/11/02/tricks-or-tracebacks-pitivi-0-94-is-here/)发布的新的 beta 测试版。
Pitivi 0.94 是基于新的 “GStreamer Editing Service”(GES)的第四个发行版本。
开发组成员 Jean-François Fortin Tam(“Nekohayo”)将本次升级描述为 “**...主要作为一个维护版本发布,但是除了对 Bug 的修复之外,还是增加了几个有意思的改进和功能。**”
### 有什么新改进?
有不少有意思的改进!作为 Pitivi 0.94 版本中最明显的变化,Pitivi 添加了如同 GNOME 客户端一般的 GTK HeaderBar 装饰。HeaderBar 整合了桌面窗口栏,标题栏以及工具栏,节省了大块浪费的垂直以及水平的占用空间。
“*当你用过一次后,你就再也不会走了*” Fortin Tam 介绍说。欣赏一下下面这张截图,你肯定会同意的。

*Pitivi 现在使用了 GTK HeaderBar 以及菜单键。(image: Nekohayo)*
那么应用菜单又怎么样呢?别担心,应用菜单遵循了 GNOME 交互界面的标准,看一下自己机器上的应用菜单确认一下吧。
#### Fixes, Fixes, Fixes
这次发布版本还囊括了大量的重要的 bug 修复,包括在 GNOME Shell 之外或基于损坏的 [COGL](http://www.cogl3d.org/about.html) 版本的 Linux 发行版(是的,Ubuntu 也是)运行 Pitivi 所产生的 bug。
其他的:
* 改进首次安装时 UI 部件的位置调整
* 启动时未固定的窗口组件不再随意移位
* 在视频属性中可以记录编辑的效果
* 精简修改标题功能的 UI
* 修复全局撤销/重做
* 重新调试时间轴的 UI 动画
* 移植编辑器到 Python 3
在 [官方发布记录](http://wiki.pitivi.org/wiki/0.94) 里有更多细节。
### 进一步提升
上面这些信息听起来都很不错吧?下一次更新会更好!这不只是一个通常的来自开发者的夸张,如同 Jean François 解释的一般:
>
> “下一次更新(0.95)会运行在令人难以置信的强大的后端上。感谢 Mathieu [Duponchelle] 和 Thibault [Saunier] 在用 NLE(新的为了 GES 的非线性引擎)替代 GNonLin 并修复问题等工作中做出的努力。”
>
>
>
Ubuntu 14.10 带有老的(更容易崩溃)的软件中心,进入 Pitivi 官网下载 [安装包](http://fundraiser.pitivi.org/download-bundles) 来体验最新杰作。
**Pitivi 基金会筹了将近 €20,000,使我们能够向着约定的 1.0 版本迈出一大步。如果你也想早点看到 1.0 版本的到来的话,省下你在星巴克买的格郎德香草奶油咖啡,捐赠我们!**
---
via: <http://www.omgubuntu.co.uk/2014/11/pitivi-0-94-header-bar-more-features>
作者:[Joey-Elijah Sneddon](https://plus.google.com/117485690627814051450/?rel=author) 译者:[ThomazL](https://github.com/ThomazL) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,496 | 5个最佳开源的浏览器安全应用 | http://www.smallbusinesscomputing.com/biztools/5-best-open-source-web-browser-security-apps.html | 2014-12-22T10:41:00 | [
"浏览器",
"AdBlock",
"Privacy Badger"
] | https://linux.cn/article-4496-1.html | 浏览器是现在各种在线服务的入口。电脑安全问题迄今仍未得到解决,技术进步为恶意软件提供了新的途径,感染我们的设备、入侵商业网络。例如,智能手机与平板为恶意软件--及其同伙“[恶意广告](http://www.webopedia.com/TERM/M/malvertising.html)”--带来一片全新天地,它们在其中腾挪作乱。
恶意广告在合法广告与合法网络中注入恶意软件。当然你可能会认为“合法”广告与网络与非法广告与网络之间仅有一线之隔。但是请不要偏题哦。隐私与安全天生就是一对兄弟,保护隐私也就是保护你的安全。
Firefox, Chrome, 以及 Opera 当仁不让属最棒的浏览器:性能最佳、兼容性最好、以及安全性最优。以下五个开源安全应用安装于浏览器后会助你抵御种种威胁。

### 保护隐私: 开源浏览器安全应用
#### 1. [AdBlock](https://getadblock.com/)
广告网络为恶意软件提供了肥沃的土壤。一个广告网络可以覆盖数千站点,因此攻陷一个广告网络就相当于攻陷数千台机器。AdBlock及其衍生品—[AdBlock Plus](https://getadblock.com/), [AdBlock Pro](https://chrome.google.com/webstore/detail/adblock-pro/ocifcklkibdehekfnmflempfgjhbedch?hl=en-US), 与 [AdBlock Edge](https://addons.mozilla.org/en-us/firefox/addon/adblock-edge/)--都是屏蔽广告的优秀工具,可以让那些充斥烦人广告的网站重新还你一片清静。
当然,凡事都有两面性:上述做法损害了依靠广告收入的站点的利益。这些工具一键式白名单功能,对于那些你希望支持的网站,你可以通过白名单功能关闭这些网站的广告屏蔽。(真的,我亲爱的站长们,如果你不希望网站访问者屏蔽你的广告,那么就适可而止,不要让人反感。当然,作为粉丝,也请您支持您喜爱的站点,将它们放到白名单吧。)

*图1:在Ad Blocker中添加其它过滤规则。*
Ad Blocker们不仅能屏蔽广告;它们还能屏蔽网站跟踪爬虫与恶意域名。要打开额外过滤规则,点击ad blocker图标 > 点击**首选项**,转至**过滤规则订阅**标签。点击按纽**添加订阅过滤规则**,然后加入**Easy Privacy + EasyList**规则。加入恶意域名过滤也是个不错的选择;它会屏蔽那些供恶意软件与间谍软件寄生的域名。Adblock可在Firefox, Chrome, Opera, Safari, IE, 以及Android平台下工作。
#### 2. [HTTPS Everywhere](https://www.eff.org/Https-everywhere)
浏览器扩展HTTPS Everywhere可确保在网站HTTPS可用的时候,总是以HTTPS方式连接到站点。HTTPS意味着你的连接是以SSL(安全套接层)方式加密的,SSL协议通常用于加密网站与电子邮件连接。HTTPS Everywhere可在Firefox, Chrome, 及Opera下使用。
安装了HTTPS Everywhere之后,它会询问你是否希望启用SSL检测程序。点击“是”,因为SSL检测程序会提供额外保护,防止中间人攻击与虚假SSL证书攻击。HTTPS Everywhere可在Firefox, Chrome, Opera, Safari, IE, 以及Android平台下工作。
#### 3. [Social Fixer](http://socialfixer.com/)
Social Fixer驯服Facebook。它给了你一把尚方宝剑,你可以用它过滤“动态汇总”,从而只看到你想看的动态、生成按主题分类的标签动态、隐藏不想查看的动态、鼠标悬停图片时显示完整尺寸的图片、禁止影院方式浏览图像,还有其它更多功能。
Social Fixer本身不是安全工具,但它具有两个重要的安全特性:
* 它可以将Facebook网页截图中你的个人资料头像以通用图标代替,并以虚假名字替代你的用户名,从而起到匿名作用。
* 它可以很可靠地屏蔽Facebook游戏,而Facebook游戏正是尽人皆知的麻烦制造者。

*图2: 使用Social Fixer匿名化Facebook网面。*
(LCTT 译注:好吧,这个应用和我等无关~~)
#### 4. [Privacy Badger](https://www.eff.org/privacybadger)
电子前线基金会出品的Privacy Badger是一款优秀的反跟踪与反间谍广告的拦截工具。现在的网页内容来源可谓五花八门:广告服务器、评论服务器、图片工场、第三方登陆服务器,以及其它种种不一而足。
AdBlock也能拦截这些乌七八糟的东西,不过Privacy Badger在此方面更胜一筹。Privacy Badger依靠算法与策略方法而非过滤规则,这样如果拦截出错的话,可以轻易重写,而过滤规则需要专人维护。Privacy Badger在Firefox与Chrome下均可工作。

*图3: Privacy Badger拦截跟踪站点。*
Privacy Badger装好后就能使用了。点击图标,看看它对你浏览的网页都拦截了哪些东西。你可以试试访问Huffingtonpost.com,这是一家不在每一个页面塞满第三方组件誓不罢休的网站(图3)。
滑块显示每个站点的状态:红色表示该站点被彻底拦截,不能设置cookies(缓冲数据),或者向你提供任何内容。黄色意味着第三方域名正试图跟踪,但是它列于Privacy Badger的允许域名的白名单之中。绿色表示第三方目前还未归入跟踪者之列,但是在你访问**若干**网站之后,Privacy Badger会观察其行为,并决定是否将其归为跟踪者。
你也可以根据你的偏好来设置滑块;例如,在我访问的某个网站,我用Privacy Badger拦截了bazaarvoice.com,一些购物网站使用这家站点来托管他们的客户评论。
#### 5. [Disconnect](https://disconnect.me/)
Disconnect是另外一款反跟踪反cookie工具,拥有众多功能。它可在Firefox, Chrome, IE, Safari下工作,并且为iOS与Android平台打造了特殊的版本。Disconnect不但能反跟踪,而且它使用自己的虚拟专用网络(VPN),防止窃听与恶意广告,使你的无线传输(Wi-fi, 3G, 4G)更安全。它可以防止部件劫持,而部件劫持是攻击者用于在需要登陆的网站获得访问权限的技术。通过部件劫持,攻击者无需密码,而只要使用窃取的cookies,就能获得网站访问权限。
Disconnect还有安全搜索功能,可以阻止搜索引擎爱挖数据的癖好,你可以安心无虞地使用你中意的搜索引擎。
想象一下,网页上所有东西都腾空而出,奔你而去。当然这一切都是抽象的且在幕后悄然发生,不象有人正在猛击窗户试图进入你家那么明显罢了。但是,威胁倒是实实在在的,而且数不胜数,所以你必须采取预防措施,来保护自己。
本文作者 Carla Schroder 著有The Book of Audacity, Linux Cookbook, Linux Networking Cookbook等书,并撰写了上百篇Linux指南文章。她曾担任Linux Planet与Linux Today网站总编。
---
via: <http://www.smallbusinesscomputing.com/biztools/5-best-open-source-web-browser-security-apps.html>
作者:[Carla Schroder](http://www.smallbusinesscomputing.com/author/Carla-Schroder-6080.html) 译者:[yupmoon](https://github.com/yupmoon) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,497 | Postfix 技巧和故障排除命令 | http://techarena51.com/index.php/postfix-configuration-and-explanation-of-parameters/ | 2014-12-22T11:12:00 | [
"Postfix"
] | https://linux.cn/article-4497-1.html | 这里是一些我每天用的命令,当然,其他的email管理员也会使用,因此我写下来,以防我忘记。

列出/打印当前邮件队列
```
# postqueue –p
# mailq
```
如果队列太长,可以使用tail管道读取。
```
# mailq | tail
```
清理队列
```
# postqueue -f
```
立即投递某domain.com域名的所有邮件
```
# postqueue -s domain.com
```
删除所有队列
```
# postsuper -d ALL
```
删除指定的消息
```
# postsuper -d messageid
```
重新排队邮件或者重新发送指定邮件
```
#postfix -r msgid
```
查找邮件版本
```
#postconf -d mail_version
mail_version = 2.6.6
```
你也可以查看下面的连接,这个连接有很多例子和不错的可用的解释文档,可以用来配置postfix:[Postfix Configuration](http://www.apricot.net/apricot2004/doc/cd_content/24th%20February%202004/04%20-%20TTF%20Anti%20Spam%20&%20Anti%20Net%20Abuse%20-%20Suresh%20Ramasubramaniam/Devdas%20Bhagat.pdf)
---
via: <http://techarena51.com/index.php/postfix-configuration-and-explanation-of-parameters/>
作者:[Leo G](http://techarena51.com/) 译者:[Vic020](http://www.vicyu.net) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 302 | Moved Temporarily | null |
4,503 | 如何在Linux下使用rsync | http://linoxide.com/how-tos/rsync-copy/ | 2014-12-22T21:05:28 | [
"rsync",
"同步",
"备份"
] | /article-4503-1.html | 对于各种组织和公司,数据对他们是最重要的,即使对于电子商务,数据也是同样重要的。Rsync是一款通过网络备份重要数据的工具/软件。它同样是一个在类Unix和Window系统上通过网络在系统间同步文件夹和文件的网络协议。Rsync可以复制或者显示目录并复制文件。Rsync默认监听TCP 873端口,通过远程shell如rsh和ssh复制文件。Rsync必须在远程和本地系统上都安装。

rsync的主要好处是:
**速度**:最初会在本地和远程之间拷贝所有内容。下次,只会传输发生改变的块或者字节。
**安全**:传输可以通过ssh协议加密数据。
**低带宽**:rsync可以在两端压缩和解压数据块。
语法:
```
#rsysnc [options] source path destination path
```
### 示例: 1 - 启用压缩
```
[root@localhost /]# rsync -zvr /home/aloft/ /backuphomedir
building file list ... done
.bash_logout
.bash_profile
.bashrc
sent 472 bytes received 86 bytes 1116.00 bytes/sec
total size is 324 speedup is 0.58
```
上面的rsync命令使用了-z来启用压缩,-v是可视化,-r是递归。上面在本地的/home/aloft/和/backuphomedir之间同步。
### 示例: 2 - 保留文件和文件夹的属性
```
[root@localhost /]# rsync -azvr /home/aloft/ /backuphomedir
building file list ... done
./
.bash_logout
.bash_profile
.bashrc
sent 514 bytes received 92 bytes 1212.00 bytes/sec
total size is 324 speedup is 0.53
```
上面我们使用了-a选项,它保留了所有人和所属组、时间戳、软链接、权限,并以递归模式运行。
### 示例: 3 - 同步本地到远程主机
```
root@localhost /]# rsync -avz /home/aloft/ [email protected]:192.168.1.4:/share/rsysnctest/
Password:
building file list ... done
./
.bash_logout
.bash_profile
.bashrc
sent 514 bytes received 92 bytes 1212.00 bytes/sec
total size is 324 speedup is 0.53
```
上面的命令允许你在本地和远程机器之间同步。你可以看到,在同步文件到另一个系统时提示你输入密码。在做远程同步时,你需要指定远程系统的用户名和IP或者主机名。
### 示例: 4 - 远程同步到本地
```
[root@localhost /]# rsync -avz [email protected]:192.168.1.4:/share/rsysnctest/ /home/aloft/
Password:
building file list ... done
./
.bash_logout
.bash_profile
.bashrc
sent 514 bytes received 92 bytes 1212.00 bytes/sec
total size is 324 speedup is 0.53
```
上面的命令同步远程文件到本地。
### 示例: 5 - 找出文件间的不同
```
[root@localhost backuphomedir]# rsync -avzi /backuphomedir /home/aloft/
building file list ... done
cd+++++++ backuphomedir/
>f+++++++ backuphomedir/.bash_logout
>f+++++++ backuphomedir/.bash_profile
>f+++++++ backuphomedir/.bashrc
>f+++++++ backuphomedir/abc
>f+++++++ backuphomedir/xyz
sent 650 bytes received 136 bytes 1572.00 bytes/sec
total size is 324 speedup is 0.41
```
上面的命令帮助你找出源地址和目标地址之间文件或者目录的不同。
### 示例: 6 - 备份
rsync命令可以用来备份linux。
你可以在cron中使用rsync安排备份。
```
0 0 * * * /usr/local/sbin/bkpscript &> /dev/null
```
---
```
vi /usr/local/sbin/bkpscript
rsync -avz -e ‘ssh -p2093′ /home/test/ [email protected]:/oracle/data/
```
---
via: <http://linoxide.com/how-tos/rsync-copy/>
作者:[Bobbin Zachariah](http://linoxide.com/author/bobbin/) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='linoxide.com', port=80): Max retries exceeded with url: /how-tos/rsync-copy/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7b83275c40a0>, 'Connection to linoxide.com timed out. (connect timeout=10)')) | null |
4,504 | Linux中使用rsync——文件和目录排除列表 | http://linoxide.com/linux-command/exclude-files-rsync-examples/ | 2014-12-23T11:10:00 | [
"rsync"
] | /article-4504-1.html | **rsync**是一个十分有用,而且十分流行的linux工具。它用于备份和恢复文件,也用于对比和同步文件。我们已经在前面的文章讲述了[如何在Linux下使用rsync](http://linux.cn/article-4503-1.html),而今天我们将增加一些更为有用的rsync使用技巧。

### 排除文件和目录列表
有时候,当我们做大量同步的时候,我们可能想要从同步的文件和目录中排除一个文件和目录的列表。一般来说,像设备文件和某些系统文件,或者像临时文件或者缓存文件这类占据不必要磁盘空间的文件是不合适同步的,这类文件是我们需要排除的。
首先,让我们创建一个名为“excluded”的文件(当然,你想取什么名都可以),然后将我们想要排除的文件夹或文件写入该文件,一行一个。在我们的例子中,如果你想要对根分区进行完整的备份,你应该排除一些在启动时创建的设备目录和放置临时文件的目录,列表看起来像下面这样:

然后,你可以运行以下命令来备份系统:
```
$ sudo rsync -aAXhv --exclude-from=excluded / /mnt/backup
```

### 从命令行排除文件
你也可以从命令行直接排除文件,该方法在你要排除的文件数量较少,并且在你想要将它写成脚本或加到crontab中又不想脚本或cron依赖于另外一个文件运行时十分有用。
例如,如果你想要同步/var到一个备份目录,但是你不想要包含cache和tmp这些通常不会有重要内容的文件夹,你可以使用以下命令:
```
$ sudo rsync -aAXhv --exclude={"/var/cache","/var/tmp"} /var /home/adrian/var
```

该命令易于在脚本或cron中使用,也不会依赖其它文件。
---
via: <http://linoxide.com/linux-command/exclude-files-rsync-examples/>
作者:[Adrian Dinu](http://linoxide.com/author/adriand/) 译者:[GOLinux](https://github.com/GOLinux) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='linoxide.com', port=80): Max retries exceeded with url: /linux-command/exclude-files-rsync-examples/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7b83275c6500>, 'Connection to linoxide.com timed out. (connect timeout=10)')) | null |
4,505 | systemd的运行级别与服务管理命令简介 | http://www.linux.com/learn/tutorials/794615-systemd-runlevels-and-service-management | 2014-12-23T09:35:00 | [
"systemd"
] | https://linux.cn/article-4505-1.html | 
从很久很久以前我们就在使用静态运行级别。而systemd提供了更为动态灵活的机制,来管控你的系统。
在开始介绍systemd命令前,让我们先简单的回顾一下历史。在Linux世界里,有一个很奇怪的现象,一方面Linux和自由软件(FOSS)在不断的向前推进,另一方面人们对这些变化却不断的抱怨。这就是为什么我要在此稍稍提及那些反对systemd所引起的争论的原因,因为我依然记得历史上有不少类似的争论:
* 软件包(Pacakge)是邪恶的,因为真正的Linux用户会从源码构建他所想要的的一切,并严格的管理系统中安装的软件。
* 解析依赖关系的包管理器是邪恶的,真正的Linux用户会手动解决这些该死的依赖关系。
* apt-get总能把事情干好,所以只有Yum是邪恶的。
* Red Hat简直就是Linux中的微软。
* 好样的,Ubuntu!
* 滚蛋吧,Ubuntu!
诸如此类...就像我之前常常说的一样,变化总是让人沮丧。这些该死的变化搅乱了我的工作流程,这可不是一件小事情,任何业务流程的中断,都会直接影响到生产力。但是,我们现在还处于计算机发展的婴儿期,在未来的很长的一段时间内将会持续有快速的变化和发展。想必大家应该都认识一些因循守旧的人,在他们的心里,商品一旦买回家以后就是恒久不变的,就像是买了一把扳手、一套家具或是一个粉红色的火烈鸟草坪装饰品。就是这些人,仍然在坚持使用Windows Vista,甚至还有人在使用运行Windows 95的老破烂机器和CRT显示器。他们不能理解为什么要去换一台新机器。老的还能用啊,不是么?
这让我回忆起了我在维护老电脑上的一项伟大的成就,那台破电脑真的早就该淘汰掉。从前我有个朋友有一台286的老机器,安装了一个极其老的MS-DOS版本。她使用这台电脑来处理一些简单的任务,比如说约会、日记、记账等,我还用BASIC给她写了一个简单的记账软件。她不用关注任何安全更新,是这样么?因为它压根都没有联网。所以我会时不时给她维修一下电脑,更换电阻、电容、电源或者是CMOS电池什么的。它竟然还一直能用。它那袖珍的琥珀CRT显示器变得越来越暗,在使用了20多年后,终于退出了历史舞台。现在我的这位朋友,换了一台运行Linux的老Thinkpad,来干同样的活。
前面的话题有点偏题了,下面抓紧时间开始介绍systemd。
### 运行级别 vs. 状态
SysVInit使用静态的运行级别来构建不同的启动状态,大部分发布版本中提供了以下5个运行级别:
* 单用户模式(Single-user mode)
* 多用户模式,不启动网络服务(Multi-user mode without network services started)
* 多用户模式,启动网络服务(Multi-user mode with network services started)
* 系统关机(System shutdown)
* 系统重启(System reboot)
对于我来说,使用多个运行级别并没有太大的好处,但它们却一直在系统中存在着。 不同于运行级别,systemd可以创建不同的状态,状态提供了灵活的机制来设置启动时的配置项。这些状态是由多个unit文件组成的,状态又叫做启动目标(target)。启动目标有一个清晰的描述性命名,而不是像运行级别那样使用数字。unit文件可以控制服务、设备、套接字和挂载点。参考下/usr/lib/systemd/system/graphical.target,这是CentOS 7默认的启动目标:
```
[Unit]
Description=Graphical Interface
Documentation=man:systemd.special(7)
Requires=multi-user.target
After=multi-user.target
Conflicts=rescue.target
Wants=display-manager.service
AllowIsolate=yes
[Install]
Alias=default.target
```
现在再看看unit文件长什么样? 我来给大家找个例子。 unit文件存放在下面的两个目录下:
* /etc/systemd/system/
* /usr/lib/systemd/system/
我们可以修改第一个目录中的文件来进行自定义配置,而第二个目录中的文件是包安装时保存的备份。**/etc/systemd/system/**的优先级高于**/usr/lib/systemd/system/**。不错,用户优先级高于机器。下面是Apache Web server的unit文件:
```
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/sbin/httpd/ $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
KillSignal=SIGCONT
PrivateTmp=true
[Install]
WantedBy=multi.user.target
```
就算是对于新手而言,上面的文件也是非常简单易懂的。这可比SysVInit的init文件要简单多了,为了便于比较,下面截取了/etc/init.d/apache2的一个片段:
```
SCRIPTNAME="${0##*/}"
SCRIPTNAME="${SCRIPTNAME##[KS][0-9][0-9]}"
if [ -n "$APACHE_CONFDIR" ] ; then
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
DIR_SUFFIX="${APACHE_CONFDIR##/etc/apache2-}"
else
DIR_SUFFIX=
```
整个文件一共有410行。
你可以检查unit文件的依赖关系,我常常被这些复杂的依赖关系给吓到:
```
$ systemctl list-dependencies httpd.service
```
### cgroups
cgroups,或者叫控制组,在Linux内核里已经出现好几年了,但直到systemd的出现才被真正使用起来。[The kernel documentation](https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt)中是这样描述cgroups的:“控制组提供层次化的机制来管理任务组,使用它可以聚合和拆分任务组,并管理任务组后续产生的子任务。”换句话说,它提供了多种有效的方式来控制、限制和分配资源。systemd使用了cgroups,你可以便捷的查看它,使用下面的命令可以展示你系统中的整个cgroup树:
```
$ systemd-cgls
```
你可以使用ps命令来进行查看cgroup树:
```
$ ps xawf -eo pid,user,cgroup,args
```
### 常用命令集
下面的命令行展示了如何为守护进程重新装载配置文件,注意不是systemd服务文件。 使用这个命令能够激活新的配置项,且尽可能少的打断业务进程,下面以Apache为例:
```
# systemctl reload httpd.service
```
重新装载服务文件(service file)需要完全停止和重新启动服务。如果服务挂死了,用下面的命令行可以恢复它:
```
# systemctl restart httpd.service
```
你还可以用一个命令重启所有的守护进程。这个命令会重新装载所有守护进程的unit文件,然后重新生成依赖关系树:
```
# systemctl daemon-reload
```
在非特权模式下,你也可以进行重启、挂起、关机操作:
```
$ systemctl reboot
$ systemctl suspend
$ systemctl poweroff
```
按照惯例,最后给大家介绍一些systemd的学习材料。[Here We Go Again, Another Linux Init: Intro to systemd](http://www.linux.com/learn/tutorials/524577-here-we-go-again-another-linux-init-intro-to-systemd) 和 [Understanding and Using Systemd](http://www.linux.com/learn/tutorials/788613-understanding-and-using-systemd) 是不错的入门材料,这两份文档里会链接到更多其他资源。
---
via: <http://www.linux.com/learn/tutorials/794615-systemd-runlevels-and-service-management>
作者:[Carla Schroder](http://www.linux.com/community/forums/person/3734) 译者:[coloka](https://github.com/coloka) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,524 | 为什么一些古老的编程语言不会消亡? | http://readwrite.com/2014/09/02/programming-language-coding-lifetime | 2014-12-25T10:22:24 | [
"编程语言"
] | https://linux.cn/article-4524-1.html |
>
> 我们钟爱我们已知的。
>
>
>

当今许多知名的编程语言已经都非常古老了。PHP 语言20年、Python 语言23年、HTML 语言21年、Ruby 语言和 JavaScript 语言已经19年,C 语言更是高达42年之久。
这是没人能预料得到的,即使是计算机科学家 [Brian Kernighan](http://en.wikipedia.org/wiki/Brian_Kernighan) 也一样。他是写著第一本关于 C 语言的作者之一,直到今天这本书还在印刷着。(C 语言本身的发明者 [Dennis Ritchie](http://en.wikipedia.org/wiki/Dennis_Ritchie) 是 Kernighan 的合著者,他于 2011 年已辞世。)
“我依稀记得早期跟编辑们的谈话,告诉他们我们已经卖出了5000册左右的量,”最近采访 Kernighan 时他告诉我说。“我们设法做的更好。我没有想到的是在2014年的教科书里学生仍然在使用第一个版本的书。”
关于 C 语言的持久性特别显著的就是 Google 开发出了新的语言 Go,解决同一问题比用 C 语言更有效率。不过,我仍然很难想象 Go 能彻底杀死 C,无论它有多么好。
“大多数语言并不会消失或者至少很大一部分用户承认它们不会消失,”他说。“C 语言仍然在一定的领域独领风骚,所以它很接地气。”
### 编写所熟悉的
为什么某些计算机编程语言要比其它的更流行?因为开发者都选择使用它们。逻辑上来说,这解释已经足够,但还想深入了解为什么开发人员会选择使用它们呢,这就有点棘手了。
分别来自普林斯顿大学和加州大学伯克利分校的研究者 Ari Rabkin 和 Leo Meyerovich 花费了两年时间来研究解决上面的问题。他们的研究报告,[《编程语言使用情况实例分析》](http://asrabkin.bitbucket.org/papers/oopsla13.pdf),记录了对超过 200,000 个 Sourceforge 项目和超过 13,000 个程序员投票结果的分析。
他们主要的发现是什么呢?大多数时候程序员选择的编程语言都是他们所熟悉的。
“这些我们使用的语言还继续存在是因为我们经常使用他们,” Rabkin 告诉我。“例如:天文学家就经常使用 IDL [交互式数据语言]来开发他们的计算机程序,并不是因为它具有什么特殊的亮点功能或其它特点,而是因为用它形成习惯了。他们已经用些语言构建出很优秀的程序了,并且想保持原状。”
换句话说,它部分要归功于这些语言所创立的知名度仍保持较高。当然,这并不意味着流行的语言不会变化。Rabkin 指出我们今天在使用的 C 语言就跟 Kernighan 第一次创建时的一点都不同,那时的 C 编译器跟现代的也不是完全兼容。
“有一个古老的,关于工程师的笑话。工程师被问到哪一种编程语言人们会使用30年,他说,‘我不知道,但它总会被叫做 Fortran’,” Rabkin 说到。“长期存活的语言跟他们在70年代和80年代刚设计出来的时候不太一样了。人们通常都是在上面增加功能,而不会删除功能,因为要保持向后兼容,但有些功能会被修正。”
向后兼容意思就是当语言升级后,程序员不仅可以使用升级语言的新特性,也不用回去重写已经实现的老代码块。老的“遗留代码”的语法规则已经不用了,但舍弃是要花成本的。只要它们存在,我们就有理由相信相关的语言也会存在。
### PHP: 存活长久语言的一个案例学习
遗留代码指的是用过时的源代码编写的程序或部分程序。想想看,一个企业或工程项目的关键程序功能部分是用没人维护的编程语言写出来的。因为它们仍起着作用,用现代的源代码重写非常困难或着代价太高,所以它们不得不保留下来,即使其它部分的代码都变动了,程序员也必须不断折腾以保证它们能正常工作。
任何编程语言,存在了超过几十年时间都具有某种形式的遗留代码问题, PHP 也不例外。PHP 是一个很有趣的例子,因为它的遗留代码跟现在的代码明显不同,支持者或评论家都承认这是一个巨大的进步。
Andi Gutmans 是已经成为 PHP4 的标准编译器的 Zend Engine 的发明者之一。Gutmans 说他和搭档本来是想改进完善 PHP3 的,他们的工作如此成功,以至于 PHP 的原发明者 Rasmus Lerdorf 也加入他们的项目。结果就成为了 PHP4 和他的后续者 PHP5 的编译器。
因此,当今的 PHP 与它的祖先——即最开始的 PHP 是完全不同的。然而,在 Gutmans 看来,在用古老的 PHP 语言版本写的遗留代码的地方一直存在着偏见以至于上升到整个语言的高度。比如 PHP 充满着安全漏洞或没有“集群”功能来支持大规模的计算任务等概念。
“批评 PHP 的人们通常批评的是在 1998 年时候的 PHP 版本,”他说。“这些人都没有与时俱进。当今的 PHP 已经有了很成熟的生态系统了。”
如今,Gutmans 说,他作为一个管理者最重要的事情就是鼓励人们升级到最新版本。“PHP有个很大的社区,足以支持您的遗留代码的问题,”他说。“但总的来说,我们的社区大部分都在 PHP5.3 及以上的。”
问题是,任何语言用户都不会全部升级到最新版本。这就是为什么 Python 用户仍在使用 2000 年发布的 Python 2,而不是使用 2008 年发布的 Python 3 的原因。甚至在六年后,大多数像 Google 这样的用户仍没有升级。这种情况是多种原因造成的,但它使得很多开发者在承担风险。
“任何东西都不会消亡的,”Rabkin 说。“任何语言的遗留代码都会一直存在。重写的代价是非常高昂的,如果它们不出问题就不要去改动。”
### 开发者是稀缺的资源
当然,开发者是不会选择那些仅仅只是为了维护老旧代码的的程序语言的。当谈论到对语言选择的偏好时,Rabkin 和 Meyerovich 发现年龄仅仅只代表个数字。Rabkin 告诉我说:
>
> 有一件事使我们被深深震撼到了。这事最重要的就是我们给人们按年龄分组,然后询问他们知道多少编程语言。我们主观的认为随着年龄的增长知道的会越来越多,但实际上却不是,25岁年龄组和45岁年龄组知道的语言数目是一样的。几个反复询问的问题这里持续不变的。您知道一种语言的几率并不与您的年龄挂钩。
>
>
>
换句话说,不仅仅年长的开发者坚持传统,年轻的程序员也会认可并采用古老的编程语言作为他们的第一们语言。这可能是因为这些语言具有很有趣的开发库及功能特点,也可能是因为在社区里开发者都是喜爱这种开发语言的一伙人。
“在全球程序员关注的语言的数量是有定数的,” Rabkin 说。“如果一们语言表现出足够独特的价值,人们将会学习和使用它。如果是和您交流代码和知识的的某个人分享一门编程语言,您将会学习它。因此,例如,只要那些 Python 库存在、 社区也对 Python 语言很有经验的话,那么 Python 仍将会大行其道。”
研究人员发现关于语言实现的功能,社区是一个巨大的因素。虽然像 Python 和 Ruby 这样的高级语言并没有太大的差别,但,程序员总是容易觉得一种比另一种优越。
“Rails 不一定要用 Ruby 语言编写,但它用了,这就是社区因素在起作用,” Rabkin 说。“例如,复活 Objective-C 语言这件事就是苹果的工程师团队说‘让我们使用它吧,’ 他们就没得选择了。”
通观社会的影响及老旧代码这些问题,我们发现最古老的和最新的计算机语言都有巨大的惰性。Go 语言怎么样才能超越 C 语言呢?如果有合适的人或公司说它超越它就超越。
“它归结为谁传播的更好谁就好,” Rabkin 说。
开始的图片来自 [Blake Patterson](https://www.flickr.com/photos/blakespot/2444037775/)
---
via: <http://readwrite.com/2014/09/02/programming-language-coding-lifetime>
作者:[Lauren Orsini](http://readwrite.com/author/lauren-orsini) 译者:[runningwater](https://github.com/runningwater) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,525 | 让下载更方便 | http://www.linuxlinks.com/article/20140913062041384/DownloadManagers.html | 2014-12-25T10:45:00 | [
"下载管理器",
"uGet",
"DownThemAll!",
"JDownloader",
"FreeRapid Downloader",
"FlashGot"
] | https://linux.cn/article-4525-1.html | 下载管理器是一个电脑程序,专门处理下载文件,优化带宽占用,以及让下载更有条理等任务。有些网页浏览器,例如Firefox,也集成了一个下载管理器作为功能,但是它们的使用方式还是没有专门的下载管理器(或者浏览器插件)那么专业,没有最佳地使用带宽,也没有好用的文件管理功能。
对于那些经常下载的人,使用一个好的下载管理器会更有帮助。它能够最大化下载速度(加速下载),断点续传以及制定下载计划,让下载更安全也更有价值。下载管理器已经没有之前流行了,但是最好的下载管理器还是很实用,包括和浏览器的紧密结合,支持类似YouTube的主流网站,以及更多。
有好几个能在Linux下工作都非常优秀的开源下载管理器,以至于让人无从选择。我整理了一个摘要,是我喜欢的下载管理器,以及Firefox里的一个非常好用的下载插件。这里列出的每一个程序都是开源许可发布的。
### uGet

uGet是一个轻量级,容易使用,功能完备的开源下载管理器。uGet允许用户从不同的源并行下载来加快速度,添加文件到下载序列,暂停或继续下载,提供高级分类管理,和浏览器集成,监控剪贴板,批量下载,支持26种语言,以及其他许多功能。
uGet是一个成熟的软件;持续开发超过了11年。在这段时间里,它发展成一个非常多功能的下载管理器,拥有一套很高价值的功能集,还保持了易用性。
uGet是用C语言开发的,使用了cURL作为底层支持,以及应用库libcurl。uGet有非常好的平台兼容性。它一开始是Linux系统下的项目,但是被移植到在Mac OS X,FreeBSD,Android和Windows平台运行。
#### 功能点:
* 容易使用
* 下载队列可以让下载任务按任意数量或你希望的数量同时进行。
* 断点续传
* 默认分类
* 完美实现的剪贴板监控功能
* 批量下载
* 支持从HTML文件导入下载任务
* 支持通过HTTP,HTTPS,FTP,BitTorrent和Metalink下载
* 多线程下载(也被称为分块下载):每个下载任务支持最多20个线程同时连接,支持自适应的分块管理,意味着如果某个下载块中断了,那么会其他连接会把它捡起来,以时刻保证最佳的下载速度。
* 多镜像下载
* FTP登录和匿名FTP
* 强大的计划任务
* 通过FlashGot和FireFox集成
* Aria2插件
* 多变的主题
* 安静模式
* 键盘快捷键
* 支持命令行/终端控制
* 自动创建目录
* 下载历史管理
* 支持GnuTLS
* 支持26种语言,包括:阿拉伯语,白俄罗斯语,简体中文,繁体中文,捷克语,丹麦语,英语(默认),法语,格鲁吉亚语,德语,匈牙利语,印尼语,意大利语,波兰语,葡萄牙语(巴西),俄语,西班牙语,土耳其语,乌克兰语,以及越南语。
---
* 网站:[ugetdm.com](http://ugetdm.com/)
* 开发人员:C.H. Huang and contributors
* 许可:GNU LGPL 2.1
* 版本:1.10.5
### DownThemAll!

DownThemAll!是一个小巧可靠的、易用的开源下载管理器/加速器,是Firefox的一个组件。它可以让用户下载一个页面上所有链接和图片,还有更多功能。它可以让用户完全控制下载任务,随时分配下载速度以及同时下载的任务数量。通过使用Metalinks或者手动添加镜像的方式,可以同时从不同的服务器下载同一个文件。
DownThemAll会根据你要下载的文件大小,切割成不同的部分,然后并行下载。
#### 功能点:
* 和Firefox的完全集成
* 分块下载,允许用户下载不同的文件块,完成之后再拼接成完整的文件;这样的话当连接到一个缓慢的服务器的时候可以加快下载速度。
* 支持Metalink,允许发送下载文件的多个URL以及它的校验值和其他信息到DTA
* 支持爬虫方式通过一个单独的链接遍历整个网页
* 下载过滤
* 高级重命名选项
* 暂停和继续下载任务
---
* 网站:[addons.mozilla.org/en-US/firefox/addon/downthemall](https://addons.mozilla.org/en-US/firefox/addon/downthemall/)
* 开发人员:Federico Parodi, Stefano Verna, Nils Maier
* 许可:GNU GPL v2
* 版本:2.0.17
---
### JDownloader

JDownloader是一个免费,开源的下载管理工具,拥有一个大型社区的开发者支持,让下载更简单和快捷。用户可以开始,停止或暂停下载,设置带宽限制,自动解压缩包,以及更多功能。它提供了一个容易扩展的框架。
JDownloader简化了从一键下载网站下载文件。它还支持从不同并行资源下载、手势识别、自动文件解压缩以及更多功能。另外,还支持许多“加密链接”网站-所以你只需要复制粘贴“加密的”链接,然后JDownloader会处理剩下的事情。JDownloader还能导入CCF,RSDF和DLC文件。
#### 功能点:
* 一次下载多个文件
* 从多个连接同时下载
* JD有一个自己实现的强大的OCR模块
* 自动解压(包括密码搜索)(RAR压缩包)
* 支持主题
* 支持多国语言
* 大约110个站点以及超过300个解密插件
* 通过JDLiveHeaderScripts重连:(支持1400路由)
* 网页更新
* 集成包管理器支持额外模块(例如,Webinterface,Shutdown)
---
* 网站:[jdownloader.org](http://jdownloader.org/)
* 开发人员:AppWork UG
* 许可:GNU GPL v3
* 版本:0.9.581
---
### FreeRapid Downloader

FreeRapid Downloader是一个易用的开源下载程序,支持从Rapidshare,Youtube,Facebook,Picasa和其他文件分享网站下载。他的下载引擎基于一些插件,所以可以从那些特别的站点下载。
对于需要针对特定文件分享网站的下载管理器用户来说,FreeRapid Downloader是理想的选择。
FreeRapid Downloader使用Java语言编写。需要至少Sun Java 7.0版本才可以运行。
#### 功能点:
* 容易使用
* 支持从不同服务站点并行下载
* 支持断点续传
* 支持通过代理列表下载
* 支持流视频或图片
* 下载历史
* 聪明的剪贴板监控
* 自动检查服务器文件后缀
* 自动关机选项
* 插件自动更新
* 简单验证码识别
* 支持跨平台
* 支持多国语言:英语,保加利亚语,捷克语,芬兰语,葡萄牙语,斯洛伐克语,匈牙利语,简体中文,以及其他
* 支持超过700个站点
---
* 网站:[wordrider.net/freerapid/](http://wordrider.net/freerapid/)
* 开发人员:Vity and contributors
* 许可:GNU GPL v2
* 版本:0.9u4
---
### FlashGot

FlashGot是一个Firefox和Thunderbird的免费组件,旨在通过外置下载管理器来处理单个和大规模(“所有”和“已选”)下载。
FlashGot把所支持的所有下载管理器统一成Firefox中的一个下载管理器。
#### 功能点:
* Linux下支持:Aria, Axel Download Accelerator, cURL, Downloader 4 X, FatRat, GNOME Gwget, FatRat, JDownloader, KDE KGet, pyLoad, SteadyFlow, uGet, wxDFast 和 wxDownload Fast
* 支持图库功能,可以帮助把原来分散在不同页面的系列资源,整合到一个所有媒体库页面中,然后可以轻松迅速地“下载所有”
* FlashGot Link会使用默认下载管理器下载当前鼠标选中的链接
* FlashGot Selection
* FlashGot All
* FlashGot Tabs
* FlashGot Media
* 抓取页面里所有链接
* 抓取所有标签栏的所有链接
* 链接过滤(例如只下载指定类型文件)
* 在网页上抓取点击所产生的所有链接
* 支持从大多数链接保护和文件托管服务器直接和批量下载
* 隐私选项
* 支持国际化
---
* 网站:[flashgot.net](http://flashgot.net/)
* 开发人员:Giorgio Maone
* 许可:GNU GPL v2
* 版本:1.5.6.5
---
via: <http://www.linuxlinks.com/article/20140913062041384/DownloadManagers.html>
作者:Frazer Kline 译者:[zpl1025](https://github.com/zpl1025) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,526 | Linux有问必答:如何在CentOS上安装phpMyAdmin | http://ask.xmodulo.com/install-phpmyadmin-centos.html | 2014-12-25T10:56:13 | [
"phpMyAdmin"
] | /article-4526-1.html |
>
> **问题**:我正在CentOS上运行一个MySQL/MariaDB服务,并且我想要通过网络接口来用phpMyAdmin来管理数据库。在CentOS上安装phpMyAdmin的最佳方法是什么?
>
>
>
phpMyAdmin是一款以PHP为基础,基于Web的MySQL/MariaDB数据库管理工具。虽然已经存在着一些诸如[Adminer](http://xmodulo.com/set-web-based-database-management-system-adminer.html)的轻量级数据库管理工具, 但是phpMyAdmin还是更加广泛应用于网站管理员之中来进行各种MySQL/MariaDB的管理任务。它支持几乎所有MySQL数据库/表的相关操作,比如浏览、创建、复制、删除、重命名、更改,还有MySQL用户/权限管理和数据库导入/导出。以下就是**如何在CentOS 6或7上安装phpMyAdmin**。

### 前提
在CentOS上安装phpMyAdmin,你第一步需要架设一台Web服务器(如Apache或nginx),安装好MySQL/MariaDB数据库和PHP。根据你的偏好和需求,你可以从[LAMP](http://linux.cn/article-1567-1.html)和[LEMP](http://linux.cn/article-4314-1.html)中选择一种安装。
另一个要求是允许在你的CentOS上安装EPEL库。如果你还没设置过请[猛戳这里](http://linux.cn/article-2324-1.html)。
### 在CentOS6或7上安装phpMyAdmin
一旦你设置了EPEL库,你就能轻松地用以下命令安装phpMyAdmin了。
在CentOS 7上:
```
$ sudo yum install phpmyadmin
```
在CentOS 7上:
```
$ sudo yum install phpmyadmin php-mcrypt
```
### 在CentOS 7上配置phpMyAdmin
默认情况下,CentOS 7上的phpMyAdmin只允许从回环地址(127.0.0.1)访问。为了能远程连接,你需要改动它的配置。
用文本编辑器打开phpMyAdmin的配置文件(路径:/etc/httpd/conf.d/phpMyAdmin.conf),找出并注释掉带有"Require ip XXXX"字样的代码行。会有四处这样的代码行,用"Require all granted"取而代之。重新改动过的配置文件如下所示。
```
$ sudo vi /etc/httpd/conf.d/phpMyAdmin.conf
```
---
```
. . . . .
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1
#Require ip ::1
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1
#Require ip ::1
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
. . . . .
```
最后,重启httpd使改动生效。
```
$ sudo systemctl restart httpd
```
### 在CentOS 6上配置phpMyAdmin
默认情况下,CentOS 6上的phpMyAdmin是禁止从每个IP地址访问的。为了能远程连接,你需要改动它的配置。
用文本编辑器打开phpMyAdmin的配置文件(路径:/etc/httpd/conf.d/phpMyAdmin.conf),找出并注释掉"Deny from all"字样的代码行。然后把"Allow from 127.0.0.1"字样的代码行改成"Allow from 0.0.0.0"。重新改动过的配置文件如下所示。
```
$ sudo vi /etc/httpd/conf.d/phpmyadmin.conf
```
---
```
<Directory "/usr/share/phpmyadmin">
Order Deny,Allow
# Deny from all
Allow from 0.0.0.0
</Directory>
```
下一步是将phpMyAdmin的配置文件用blowfish加密工具加密。这一步需要加密cookie里的密码来作为基于cookie的部分认证。
用文本编辑器打开如下路径所示的文件并且用blowfish设置一个随机密码,如下所示。
```
$ sudo vi /usr/share/phpmyadmin/config.inc.php
```
---
```
$cfg['blowfish_secret'] = 'kd5G}d33aXDc50!'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
```
最后,重启httpd使改动生效。
```
$ sudo service httpd restart
```
### 测试phpMyAdmin
测试phpMyAdmin是否设置成功,访问这个页面:http://<web-server-ip-addresss>/phpmyadmin

你应该能通过Web界面来记录下任何MySQL用户(比如root)和管理MySQL/MariaDB的数据库/表。

### 疑难解答
这里有一些在CentOS上安装phpMyAdmin的过程中遇到的一些问题解决方法。
1. 当你在浏览器里尝试连接phpMyAdmin页面的时候,你看到"403 Forbidding"错误:
You don't have permission to access /phpMyAdmin on this server.
发生这种错误是因为phpMyAdmin默认阻止了IP地址远程连接。要修复这种错误,你需要编辑它的配置文件来允许远程连接。具体操作见上。
2. 当你连接phpMyAdmin页面时,你看见"The configuration file now needs a secret passphrase (blowfish\_secret)."信息,并且你无法登录。
要修复这种错误,你需要编辑 /usr/share/phpmyadmin/config.inc.php 这个文件来添加一个随机的blowfish密码,然后重启httpd,如下所示。
```
$cfg['blowfish_secret'] = 'kd5G}d33aXDc50!'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
```
---
```
$ sudo service httpd restart (CentOS 6)
$ sudo systemctl restart httpd (CentOS 7)
```
3. 当你连接phpMyAdmin页面时,你看见"Cannot load mcrypt extension. Please check your PHP configuration"错误信息。
要修复这种错误,要安装下面这个包:
```
$ sudo yum install php-mcrypt
```
然后重启httpd:
```
$ sudo service httpd restart (CentOS 6)
$ sudo systemctl restart httpd (CentOS 7)
```
---
via: <http://ask.xmodulo.com/install-phpmyadmin-centos.html>
译者:[ZTinoZ](https://github.com/ZTinoZ) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /install-phpmyadmin-centos.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275c4dc0>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)")) | null |
4,527 | 十个 SCP 传输命令例子 | http://www.tecmint.com/scp-commands-examples/ | 2014-12-25T14:33:03 | [
"scp",
"ssh",
"ftp"
] | https://linux.cn/article-4527-1.html | Linux系统管理员应该很熟悉**CLI**环境,因为通常在Linux服务器中是不安装**GUI**的。**SSH**可能是Linux系统管理员通过远程方式安全管理服务器的最流行协议。在**SSH**命令中内置了一种叫**SCP**的命令,用来在服务器之间安全传输文件。

以下命令可以解读为:用“**username account**”“**拷贝 source file name**”到“**destination host**”上的“**destination folder**”里。
#### SCP命令的基本语法
```
scp source_file_name username@destination_host:destination_folder
```
**SCP**命令有很多可以使用的参数,这里指的是每次都会用到的参数。
### 用-v参数来提供SCP进程的详细信息
不带参数的基本**SCP**命令会在后台拷贝文件,除非操作完成或者有错误出现,否则用户在界面上是看不到任何提示信息的。你可以用“**-v**”参数来在屏幕上打印出调试信息,这能帮助你调试连接、认证和配置的一些问题。
```
pungki@mint ~/Documents $ scp -v Label.pdf [email protected]:.
```
#### 部分输出
```
Executing: program /usr/bin/ssh host 202.x.x.x, user mrarianto, command scp -v -t .
OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 202.x.x.x [202.x.x.x] port 22.
debug1: Connection established.
debug1: Host '202.x.x.x' is known and matches the RSA host key.
debug1: Found key in /home/pungki/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: Next authentication method: password
[email protected]'s password:
debug1: Authentication succeeded (password).
Authenticated to 202.x.x.x ([202.x.x.x]:22).
Sending file modes: C0770 3760348 Label.pdf
Sink: C0770 3760348 Label.pdf
Label.pdf 100% 3672KB 136.0KB/s 00:27
Transferred: sent 3766304, received 3000 bytes, in 65.2 seconds
Bytes per second: sent 57766.4, received 46.0
debug1: Exit status 0
```
### 从源文件获取修改时间、访问时间和模式
“**-p**”参数会帮到把预计的时间和连接速度会显示在屏幕上。
```
pungki@mint ~/Documents $ scp -p Label.pdf [email protected]:.
```
#### 部分输出
```
[email protected]'s password:
Label.pdf 100% 3672KB 126.6KB/s 00:29
```
### 用-C参数来让文件传输更快
有一个参数能让传输文件更快,就是“**-C**”参数,它的作用是不停压缩所传输的文件。它特别之处在于压缩是在网络传输中进行,当文件传到目标服务器时,它会变回压缩之前的原始大小。
来看看这些命令,我们使用一个**93 Mb**的单一文件来做例子。
```
pungki@mint ~/Documents $ scp -pv messages.log [email protected]:.
```
#### 部分输出
```
Executing: program /usr/bin/ssh host 202.x.x.x, user mrarianto, command scp -v -p -t .
OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 202.x.x.x [202.x.x.x] port 22.
debug1: Connection established.
debug1: identity file /home/pungki/.ssh/id_rsa type -1
debug1: Found key in /home/pungki/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: Trying private key: /home/pungki/.ssh/id_rsa
debug1: Next authentication method: password
[email protected]'s password:
debug1: Authentication succeeded (password).
Authenticated to 202.x.x.x ([202.x.x.x]:22).
debug1: Sending command: scp -v -p -t .
File mtime 1323853868 atime 1380425711
Sending file timestamps: T1323853868 0 1380425711 0
messages.log 100% 93MB 58.6KB/s 27:05
Transferred: sent 97614832, received 25976 bytes, in 1661.3 seconds
Bytes per second: sent 58758.4, received 15.6
debug1: Exit status 0
```
不用“**-C**”参数来拷贝文件,结果用了**1661.3**秒,你可以比较下用了“**-C**”参数之后的结果。
```
pungki@mint ~/Documents $ scp -Cpv messages.log [email protected]:.
```
#### 部分输出
```
Executing: program /usr/bin/ssh host 202.x.x.x, user mrarianto, command scp -v -p -t .
OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 202.x.x.x [202.x.x.x] port 22.
debug1: Connection established.
debug1: identity file /home/pungki/.ssh/id_rsa type -1
debug1: Host '202.x.x.x' is known and matches the RSA host key.
debug1: Found key in /home/pungki/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: Next authentication method: publickey
debug1: Trying private key: /home/pungki/.ssh/id_rsa
debug1: Next authentication method: password
[email protected]'s password:
debug1: Enabling compression at level 6.
debug1: Authentication succeeded (password).
Authenticated to 202.x.x.x ([202.x.x.x]:22).
debug1: channel 0: new [client-session]
debug1: Sending command: scp -v -p -t .
File mtime 1323853868 atime 1380428748
Sending file timestamps: T1323853868 0 1380428748 0
Sink: T1323853868 0 1380428748 0
Sending file modes: C0600 97517300 messages.log
messages.log 100% 93MB 602.7KB/s 02:38
Transferred: sent 8905840, received 15768 bytes, in 162.5 seconds
Bytes per second: sent 54813.9, received 97.0
debug1: Exit status 0
debug1: compress outgoing: raw data 97571111, compressed 8806191, factor 0.09
debug1: compress incoming: raw data 7885, compressed 3821, factor 0.48
```
看到了吧,压缩了文件之后,传输过程在**162.5**秒内就完成了,速度是不用“**-C**”参数的10倍。如果你要通过网络拷贝很多份文件,那么“**-C**”参数能帮你节省掉很多时间。
有一点我们需要注意,这个压缩的方法不是适用于所有文件。当源文件已经被压缩过了,那就没办法再压缩很多了。诸如那些像**.zip**,**.rar**,**pictures**和**.iso**的文件,用“**-C**”参数就没什么意义。
### 选择其它加密算法来加密文件
**SCP**默认是用“**AES-128**”加密算法来加密传输的。如果你想要改用其它加密算法来加密传输,你可以用“**-c**”参数。我们来瞧瞧。
```
pungki@mint ~/Documents $ scp -c 3des Label.pdf [email protected]:.
[email protected]'s password:
Label.pdf 100% 3672KB 282.5KB/s 00:13
```
上述命令是告诉**SCP**用**3des algorithm**来加密文件。要注意这个参数是“**-c**”(小写)而不是“**-C**“(大写)。
### 限制带宽使用
还有一个很有用的参数是“**-l**”参数,它能限制使用带宽。如果你为了拷贝很多文件而去执行了一份自动化脚本又不希望带宽被**SCP**进程耗尽,那这个参数会非常管用。
```
pungki@mint ~/Documents $ scp -l 400 Label.pdf [email protected]:.
[email protected]'s password:
Label.pdf 100% 3672KB 50.3KB/s 01:13
```
在“**-l**”参数后面的这个**400**值意思是我们给**SCP**进程限制了带宽为**50 KB/秒**。有一点要记住,带宽是以**千比特/秒** (**kbps**)表示的,而**8 比特**等于**1 字节**。
因为**SCP**是用**千字节/秒** (**KB/s**)计算的,所以如果你想要限制**SCP**的最大带宽只有**50 KB/s**,你就需要设置成**50 x 8 = 400**。
### 指定端口
通常**SCP**是把**22**作为默认端口。但是为了安全起见SSH 监听端口改成其它端口。比如说,我们想用**2249**端口,这种情况下就要指定端口。命令如下所示。
```
pungki@mint ~/Documents $ scp -P 2249 Label.pdf [email protected]:.
[email protected]'s password:
Label.pdf 100% 3672KB 262.3KB/s 00:14
```
确认一下写的是大写字母“**P**”而不是“**p**“,因为“**p**”已经被用来保留源文件的修改时间和模式(LCTT 译注:和 ssh 命令不同了)。
### 递归拷贝文件和文件夹
有时我们需要拷贝文件夹及其内部的所有**文件**/**子文件夹**,我们如果能用一条命令解决问题那就更好了。**SCP**用“**-r**”参数就能做到。
```
pungki@mint ~/Documents $ scp -r documents [email protected]:.
[email protected]'s password:
Label.pdf 100% 3672KB 282.5KB/s 00:13
scp.txt 100% 10KB 9.8KB/s 00:00
```
拷贝完成后,你会在目标服务器中找到一个名为“**documents**”的文件夹,其中就是所拷贝的所有文件。“**documents**”是系统自动创建的文件夹。
### 禁用进度条和警告/诊断信息
如果你不想从SCP中看到进度条和警告/诊断信息,你可以用“**-q**”参数来静默它们,举例如下。
```
pungki@mint ~/Documents $ scp -q Label.pdf [email protected]:.
[email protected]'s password:
pungki@mint ~/Documents $
```
正如你所看到的,在你输入密码之后,没有任何关于SCP进度的消息反馈。进度完成后,你也看不到任何提示。
### 用SCP通过代理来拷贝文件
代理服务器经常用于办公环境,SCP自然是没有经过代理方面的配置的。当你的环境正在使用代理,那么你就必须要“告诉”SCP与代理关联起来。
场景如下:代理的地址是**10.0.96.6**,端口是8080。该代理还实现了用户认证功能。首先,你需要创建一个“**~/.ssh/config**”文件,其次把以下命令输入进该文件。
```
ProxyCommand /usr/bin/corkscrew 10.0.96.6 8080 %h %p ~/.ssh/proxyauth
```
接着你需要创建一个同样包括以下命令的“**~/.ssh/proxyauth**”文件。
```
myusername:mypassword
```
然后你就可以像往常一样使用SCP了。
请注意corkscrew可能还没有安装在你的系统中。在我的Linux Mint中,我需要首先先用标准Linux Mint安装程序来安装它。
```
$ apt-get install corkscrew
```
对于其它的一些基于yum安装的系统,用户能用以下的命令来安装corkscrew。
```
# yum install corkscrew
```
还有一点就是因为“**~/.ssh/proxyauth**”文件中以明文的格式包含了你的“**用户名**”和“**密码**”,所以请确保该文件只能你来查看。
### 选择不同的ssh\_config文件
对于经常在公司网络和公共网络之间切换的移动用户来说,一直改变SCP的设置显然是很痛苦的。如果我们能放一个保存不同配置的**ssh\_config**文件来匹配我们的需求那就很好了。
#### 以下是一个简单的场景
代理是被用来在公司网络但不是公共网络并且你会定期切换网络时候使用的。
```
pungki@mint ~/Documents $ scp -F /home/pungki/proxy_ssh_config Label.pdf
[email protected]:.
[email protected]'s password:
Label.pdf 100% 3672KB 282.5KB/s 00:13
```
默认情况下每个用户会把“**ssh\_config**”文件放在“**~/.ssh/config**“路径下。用兼容的代理创建一个特定的“**ssh\_config**”文件,能让你切换网络时更加方便容易。
当你处于公司网络时,你可以用“**-F**”参数,当你处于公共网络时,你可以忽略掉“**-F**”参数。
以上就是关于**SCP**的全部内容了,你可以查看**SCP**的**man页面**来获取更多内容,请随意留下您的评论及建议。
---
via: <http://www.tecmint.com/scp-commands-examples/>
作者:[Pungki Arianto](http://www.tecmint.com/author/pungkiarianto/) 译者:[ZTinoZ](https://github.com/ZTinoZ) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,547 | 红帽反驳:“grinch(鬼精灵)”算不上Linux漏洞 | http://www.computerworld.com/article/2861392/security0/the-grinch-isnt-a-linux-vulnerability-red-hat-says.html | 2014-12-29T21:09:00 | [
"grinch",
"安全",
"漏洞"
] | https://linux.cn/article-4547-1.html | 
图片来源:[Natalia Wilson,受Creative Commons许可](http://www.flickr.com/photos/moonrat/4571563485/)
>
> 安全专家表示,Linux处理权限的方式仍有可能导致潜在的误操作。
>
>
>
但红帽对此不以为然,称 Alert Logic 于本周二(译者注:12月16日)公布的 grinch (“鬼精灵”) Linux漏洞根本算不上是安全漏洞。
[红帽于周三发表简报](https://access.redhat.com/articles/1298913) 回应Alert Logic 说法,表示:“(Alert Logic的)这份报告错误地将正常预期动作归为安全问题。”
安全公司Alert Logic于本周二声称“鬼精灵”漏洞其严重性堪比 Heartbleed 臭虫,并称其是 [Linux 系统处理用户权限时的重大设计缺陷](http://www.pcworld.com/article/2860032/this-linux-grinch-could-put-a-hole-in-your-security-stocking.html),恶意攻击者可借此获取机器的root权限。
Alert Logic 称攻击者可以使用第三方Linux 软件框架Policy Kit (Polkit)达到利用“鬼精灵”漏洞的目的。Polkit旨在帮助用户安装与运行软件包,此开源程序由红帽维护。Alert Logic 声称,允许用户安装软件程序的过程中往往需要超级用户权限,如此一来,Polkit也在不经意间或通过其它形式为恶意程序的运行洞开方便之门。
红帽对此不以为意,表示系统就是这么设计的,换句话说,**“鬼精灵”不是臭虫而是一项特性。**
安全监控公司Threat Stack联合创造人 Jen Andre [就此在一篇博客](http://blog.threatstack.com/the-linux-grinch-vulnerability-separating-the-fact-from-the-fud)中写道:“如果你任由用户通过使用那些利用了Policykit的软件,无需密码就可以在系统上安装任何软件,实际上也就绕过了Linux内在授权与访问控制。”
Alert Logic 高级安全研究员 James Staten 在发给国际数据集团新闻社(IDG News Service)的电子邮件中写道,虽然这种行为是设计使然,有意为之,但“鬼精灵”仍然可能被加以利用或修改来攻陷系统。
“现在的问题是表面存在一个薄弱环节,可以被用来攻击系统,如果安装软件包象其它操作一样,比如删除软件包或添加软件源,没有密码不行,那么就不会存在被恶意利用的可能性了。”
不过 Andre 在一次采访中也表示,对那些跃跃欲试的攻击者来说,想利用Polkit还是有一些苛刻限制的。
攻击者需要能够物理访问机器,并且还须通过外设键鼠与机器互动。如果攻击者能够物理访问机器,可以象重启机器进入恢复模式访问数据与程序一样地轻而易举的得手。
Andre表示,不是所有Linux机器都默认安装Polkit -- 事实上,其主要用于拥有桌面图形界面的工作站,在当今运行的Linux机器中占有很小的份额。
换句话说,“鬼精灵”并不具有象[Shellshock](http://www.computerworld.com/article/2687983/shellshock-flaws-roils-linux-server-shops.html)那样广泛的攻击面, 后者存在于Bash shell中,几乎所有发行版无一幸免。
其他安全专家对“鬼精灵”漏洞也不以为然。
系统网络安全协会(SANS Institute)互联网风暴中心(Internet Storm Center)咨询网站的 Johanners Ullrich 在[一篇博文](https://isc.sans.edu/diary/Is+the+polkit+Grinch+Going+to+Steal+your+Christmas/19077)中写道:“某种程度上,与很多Linux系统过分随意的设置相比,这个并算不上多大的漏洞。”
Ullrich 同时还指出,“鬼精灵”漏洞也并非完全“良性”,“可以很容易地加以利用,获得超出Polkit设置预期的权限。”
Andre指出,负责管理运行Polkit桌面Linux机器的管理员要做到心中有数,了解潜在的危险,检查那些程序是靠Polkit来管理的,确保系统无虞。
他还表示,应用开发者与Linux 发行者也应确保正确使用Polkit框架。
原始报告的另一位作者Even Tyler似乎也承认“鬼精灵”并非十分严重。
[在开源安全邮件列表的一封邮件中](http://seclists.org/oss-sec/2014/q4/1078),Bourland 提到攻击者需要借助其它漏洞,连同“鬼精灵”才能发起攻击时,他写道,“鬼精灵”就象个“开启界面的熟练工,但是本身并不能翻多高的浪。”
(Lucian Constantin 对本文也有贡献。)
---
via:<http://www.computerworld.com/article/2861392/security0/the-grinch-isnt-a-linux-vulnerability-red-hat-says.html>
作者:[Joab Jackson](http://www.computerworld.com/author/Joab-Jackson/) 译者:[yupmoon](https://github.com/yupmoon) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,548 | 如何在Ubuntu桌面上使用Steam Music音乐播放器 | http://www.omgubuntu.co.uk/2014/10/use-steam-music-player-linux | 2014-12-29T21:36:49 | [
"Steam Music",
"Steam"
] | https://linux.cn/article-4548-1.html | 
**‘音乐让人们走到一起’ 麦当娜曾这样唱道。但是Steam的新音乐播放器特性能否很好的混搭小资与叛逆?**
如果你曾与世隔绝,充耳不闻,你就会错过与Steam Music的相识。它的特性并不是全新的。从今年的早些时候开始,它就已经以这样或那样的形式进行了测试。
但Steam客户端最近一次在Windows、Mac和Linux上的定期更新中,所有的客户端都能使用它了。你会问为什么一个游戏客户端会添加一个音乐播放器呢?当然是为了让你能一边玩游戏一边一边听你最喜欢的音乐了。
别担心:在游戏的音乐声中再加上你自己的音乐,听起来并不会像你想象的那么糟(哈哈)。Steam会帮你减少或消除游戏的背景音乐,但在混音器中保持效果音的高音量,以便于你能和平时一样听到那些叮,嘭和各种爆炸声。
### 使用Steam Music音乐播放器

*大图模式*
任何使用最新版客户端的人都能使用Steam Music音乐播放器。它是个相当简单的附加程序:它让你能从你的电脑中添加、浏览并播放音乐。
播放器可以以两种方式进入:桌面和(超棒的)Steam大图模式。在两种方式下,控制播放都超级简单。
作为一个Rhythmbox的对手或是Spotify的继承者,把**为玩游戏时放音乐而设计**作为特点一点也不吸引人。事实上,他没有任何可购买音乐的商店,也没有整合Rdio,Grooveshark这类在线服务或是桌面服务。没错,你的多媒体键在Linux的播放器上完全不能用。
Valve说他们“*……计划增加更多的功能以便用户能以新的方式体验Steam Music。我们才刚刚开始。*”
#### Steam Music的重要特性:
* 只能播放MP3文件
* 与游戏中的音乐相融
* 在游戏中可以控制音乐
* 播放器可以在桌面上或在大图模式下运行
* 基于播放列表的播放方式
**它没有整合到Ubuntu的声音菜单里,而且目前也不支持键盘上的多媒体键。**
### 在Ubuntu上使用Steam Music播放器
显然,添加音乐是你播放音乐前的第一件事。在Ubuntu上,默认设置下,Steam会自动添加两个文件夹:Home下的标准Music目录和它自带的Steam Music文件夹。任何可下载的音轨都保存在其中。
注意:目前**Steam Music只能播放MP3文件**。如果你的大部分音乐都是其他文件格式(比如.acc、.m4a等等),这些文件不会被添加也不能被播放。
若想添加其他的文件夹或重新扫描:
* 到**View > Settings > Music**。
* 点击‘**Add**‘将其他位置的文件夹添加到已列出两个文件夹的列表下。
* 点击‘**Start Scanning**’

你还可以在这个对话框中调整其他设置,包括‘scan at start’。如果你经常添加新音乐而且很容易忘记手动启动扫描,请标记此项。你还可以选择当路径变化时是否显示提示,设置默认的音量,还能调整当你打开一个应用软件或语音聊天时的播放状态的改变。
一旦你的音乐源成功的被添加并扫描后,你就可以通过主客户端的**Library > Music**区域浏览你的音乐了。

Steam Music会默认的将音乐按照专辑进行分组。若想按照乐队名进行浏览,你需要点击‘Albums’然后从下拉菜单中选择‘Artists’。

Steam Music是一个以‘队列’方式工作的系统。你可以通过双击浏览器里的音乐或右键单击并选择‘Add to Queue’来把音乐添加到播放队列里。

若想**启动桌面播放器**请点击右上角的音符图标或通过**View > Music Player**菜单。

---
via: <http://www.omgubuntu.co.uk/2014/10/use-steam-music-player-linux>
作者:[Joey-Elijah Sneddon](https://plus.google.com/117485690627814051450/?rel=author) 译者:[H-mudcup](https://github.com/H-mudcup) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,549 | Linux有问必答:如何在Debian下安装闭源软件包 | http://ask.xmodulo.com/install-nonfree-packages-debian.html | 2014-12-29T22:07:09 | [
"Debian",
"闭源",
"软件包"
] | /article-4549-1.html |
>
> **提问**: 我需要在Debian下安装特定的闭源设备驱动。然而, 我无法在Debian中找到并安装软件包。如何在Debian下安装闭源软件包?
>
>
>
Debian是一个拥有[48,000](https://packages.debian.org/stable/allpackages?format=txt.gz)软件包的发行版. 这些软件包被分为三类: main, contrib 和 non-free, 主要是根据许可证要求, 参照[Debian开源软件指南](https://www.debian.org/social_contract.html#guidelines) (DFSG)。

main软件仓库包括符合DFSG的开源软件。contrib也包括符合DFSG的开源软件,但是依赖闭源软件来编译或者执行。non-free包括不符合DFSG的、可再分发的闭源软件。main仓库被认为是Debian项目的一部分,但是contrib和non-free不是。后两者只是为了用户的方便而维护和提供。
如果你想一直能够在Debian上安装闭源软件包,你需要添加contrib和non-free软件仓库。这样做,用文本编辑器打开 /etc/apt/sources.list 添加"contrib non-free""到每个源。
下面是适用于 Debian Wheezy的 /etc/apt/sources.list 例子。
```
deb http://ftp.us.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.us.debian.org/debian/ wheezy main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free
# wheezy-updates, 之前叫做 'volatile'
deb http://ftp.us.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.us.debian.org/debian/ wheezy-updates main contrib non-free
```

修改完源后, 运行下面命令去下载contrib和non-free软件仓库的文件索引。
```
$ sudo apt-get update
```
如果你用 aptitude, 运行下面命令。
```
$ sudo aptitude update
```
现在你在Debian上搜索和安装任何闭源软件包。

---
via: <http://ask.xmodulo.com/install-nonfree-packages-debian.html>
译者:[mtunique](https://github.com/mtunique) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /install-nonfree-packages-debian.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275c4370>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)")) | null |
4,550 | Linux能够提供消费者想要的东西吗? | http://www.techrepublic.com/article/will-linux-ever-be-able-to-give-consumers-what-they-want/ | 2014-12-30T08:15:00 | [
"Linux"
] | https://linux.cn/article-4550-1.html |
>
> 由Jack Wallen提出的新观点,提供消费者想要的东西也许是收获无限成就的关键。
>
>
>

在消费电子的世界里,如果你不能提供购买者想要的东西,那他们就会跑去别家。我们最近在Firefox浏览器上就看过类似的事情。消费者想要的是一个快速而不那么臃肿的软件,而开发者们却走到了另外的方向上。最后,用户都转移到Chrome或Chromium上去了。
Linux需要深深凝视自己的水晶球,仔细体会那场浏览器大战留下的尘埃,然后留意一下这点建议:
>
> 如果你不能提供他们想要的,他们就会离开。
>
>
>
而这种事与愿违的另一个例子是Windows 8。消费者不喜欢那套界面。而微软却坚持使用,因为这是把所有东西搬到Surface平板上所必须的。相同的情况也可能发生在Canonical和Ubuntu Unity身上 -- 尽管它们的目标并不是单一独特地针对平板电脑来设计(所以,整套界面在桌面系统上仍然很实用而且直观)。
一直以来,Linux开发者和设计者们看上去都按照他们自己的想法来做事情。他们过分在意“吃你自家的狗粮”这句话了。以至于他们忘记了一件非常重要的事情:
>
> 没有新用户,他们的“根基”也仅仅只属于他们自己。
>
>
>
换句话说,唱诗班不仅仅是被传道,他们也同时在宣传。让我给你看三个案例来完全掌握这一点。
* 多年以来,一直有在Linux系统中替代活动目录(Active Directory)的需求。我很想把这个名称换成LDAP,但是你真的用过LDAP吗?那就是个噩梦。开发者们也努力了想让LDAP能易用一点,但是没一个做到了。而让我很震惊的是这样一个从多用户环境下发展起来的平台居然没有一个能和AD正面较量的功能。这需要一组开发人员,从头开始建立一个AD的开源替代。这对那些寻求从微软产品迁移的中型企业来说是非常大的福利。但是在这个产品做好之前,他们还不能开始迁移。
* 另一个从微软激发的需求是Exchange/Outlook。是,我也知道许多人都开始用云。但是,事实上中等和大型规模生意仍然依赖于Exchange/Outlook组合,直到能有更好的产品出现。而这将非常有希望发生在开源社区。整个拼图的一小块已经摆好了(虽然还需要一些工作)- 群件客户端,Evolution。如果有人能够从Zimbra拉出一个分支,然后重新设计成可以配合Evolution(甚至Thunderbird)来提供服务实现Exchange的简单替代,那这个游戏就不是这么玩了,而消费者获得的利益将是巨大的。
* 便宜,便宜,还是便宜。这是大多数人都得咽下去的苦药片 - 但是消费者(和生意)就是希望便宜。看看去年一年Chromebook的销量吧。现在,搜索一下Linux笔记本看能不能找到700美元以下的。而只用三分之一的价格,就可以买到一个让你够用的Chromebook(一个使用了Linux内核的平台)。但是因为Linux仍然是一个细分市场,很难降低成本。像红帽那种公司也许可以改变现状。他们也已经推出了服务器硬件。为什么不推出一些和Chromebook有类似定位但是却运行完整Linux环境的低价中档笔记本呢?(请看“[Cloudbook是Linux的未来吗?](http://www.techrepublic.com/article/is-the-cloudbook-the-future-of-linux/)”)其中的关键是这种设备要低成本并且符合普通消费者的要求。不要站在游戏玩家/开发者的角度去思考了,记住普通消费者真正的需求 - 一个网页浏览器,不会有更多了。这是Chromebook为什么可以这么轻松地成功。Google精确地知道消费者想要什么,然后推出相应的产品。而面对Linux,一些公司仍然认为他们吸引买家的唯一途径是高端昂贵的硬件。而有一点讽刺的是,口水战中最经常听到的却是Linux只能在更慢更旧的硬件上运行。
最后,Linux需要看一看乔布斯传(Book Of Jobs),搞清楚如何说服消费者们他们真正要的就是Linux。在公司里和在家里 -- 每个人都可以享受到Linux带来的好处。说真的,开源社区怎么可能做不到这点呢?Linux本身就已经带有很多漂亮的时髦术语标签:稳定性、可靠性、安全性、云、免费 -- 再加上Linux实际已经进入到绝大多数人手中了(只是他们自己还不清楚罢了)。现在是时候让他们知道这一点了。如果你是用Android或者Chromebooks,那么你就在用(某种形式上的)Linux。
搞清楚消费者需求一直以来都是Linux社区的绊脚石。而且我知道 -- 太多的Linux开发都基于某个开发者有个特殊的想法。这意味着这些开发都针对的“微型市场”。是时候了,无论如何,让Linux开发社区能够进行全球性思考了。“一般用户有什么需求,我们怎么满足他们?”让我提几个最基本的点。
一般用户想要:
* 低价
* 设备和服务能无缝衔接
* 直观而现代的设计
* 百分百可靠的浏览器体验
把这四点放在心中,应该可以轻松地以Linux为基础开发出用户实际需要的产品。Google做到了...当然Linux社区也可以参照Google的工作并开发出更好的产品。把这些应用到集成AD这件事上,能开发出Exchange/Outlook的替代或者基于云的群件工具,就会发生一件非常特殊的事 -- 人们会为它买单。
你觉得Linux社区能够提供消费者想要的东西吗?在下边的讨论区里分享一下你的看法。
---
via: <http://www.techrepublic.com/article/will-linux-ever-be-able-to-give-consumers-what-they-want/>
作者:[Jack Wallen](http://www.techrepublic.com/search/?a=jack+wallen) 译者:[zpl1025](https://github.com/zpl1025) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,551 | 2014年会是 "Linux桌面年"吗? | http://news.softpedia.com/news/Was-2014-The-Year-of-Linux-Desktop-467036.shtml | 2014-12-30T11:21:00 | [] | https://linux.cn/article-4551-1.html |
>
> Linux桌面现在终于发出最强音!
>
>
>

**看来Linux在2014年有很多改变,许多用户都表示今年Linux的确有进步,但是仅凭这个就能断定2014年就是"Linux桌面年"吗?**
"Linux桌面年"这句话,在过去几年就被传诵得像句颂歌一样,可以说是在试图用一种比较有意义的方式来标记它的发展进程。此类事情目前还没有发生过,在我们的见证下也从无先例,所以这就不难理解为什么Linux用户会用这个角度去看待这句话。
大多数软件和硬件领域不太会有这种快速的进步,都以较慢的速度发展,但是对于那些在工业领域有更好眼光的人来说,事情就会变得疯狂。即使有可能,针对某一时刻或某一事件还是比较困难的,但是Linux在几年的过程中还是以指数方式迅速发展成长。

### Linux桌面年这句话不可轻言
没有一个比较权威的人和机构能判定Linux桌面年已经到来或者已经过去,所以我们只能尝试根据迄今为止我们所看到的和用户所反映的去推断。有一些人比较保守,改变对他们影响不大,还有一些人则比较激进,永远不知满足。这真的要取决于你的见解了。
点燃这一切的火花似乎就是Linux上的Steam平台,尽管在这变成现实之前我们已经看到了一些Linux游戏已经开始有重要的动作了。在任何情况下,Valve都可能是我们今天所看到的一系列复苏事件的催化剂。

在过去的十年里,Linux桌面以一种缓慢的速度在发展,并没有什么真正的改变。创新肯定是有的,但是市场份额几乎还是保持不变。无论桌面变得多么酷或Linux相比之前的任何一版多出了多少特点,很大程度上还是在原地踏步,包括那些开发商业软件的公司,他们的参与度一直很小,基本上就忽略掉了Linux。

现在,相比过去的十年里,更多的公司表现出了对Linux平台的浓厚兴趣。或许这是一种自然地演变,Valve并没有做什么,但是Linux最终还是达到了一个能被普通用户接受并理解的水平,并不只是因为令人着迷的开源技术。
驱动程序能力强了,游戏工作室就会定期移植游戏,在Linux中我们前所未见的应用和中间件就会开始出现。Linux内核发展达到了难以置信的速度,大多数发行版的安装过程通常都不怎么难,所有这一切都只是冰山一角。

所以,当有人问你2014年是不是Linux桌面年时,你可以说“是的!”,因为Linux桌面完全统治了2014年。
---
via: <http://news.softpedia.com/news/Was-2014-The-Year-of-Linux-Desktop-467036.shtml>
作者:[Silviu Stahie](http://news.softpedia.com/editors/browse/silviu-stahie) 译者:[ZTinoZ](https://github.com/ZTinoZ) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,552 | Attic——删除重复数据的备份程序 | http://www.ubuntugeek.com/attic-deduplicating-backup-program.html | 2014-12-30T10:28:00 | [
"备份",
"Attic"
] | https://linux.cn/article-4552-1.html | Attic是一个Python写的删除重复数据的备份程序,其主要目标是提供一种高效安全的数据备份方式。重复数据消除技术的使用使得Attic适用于日常备份,因为它可以只存储那些修改过的数据。

### Attic特性
#### 空间高效存储
可变块大小重复数据消除技术用于减少检测到的冗余数据存储字节数量。每个文件被分割成若干可变长度组块,只有那些从没见过的组合块会被压缩并添加到仓库中。
#### 可选数据加密
所有数据可以使用256位AES加密进行保护,并使用HMAC-SHA256验证数据完整性和真实性。
#### 离场备份
Attic可以通过SSH将数据存储到安装有Attic的远程主机上。
#### 备份可作为文件系统挂载
备份归档可作为用户空间文件系统挂载,用于便捷地验证和恢复备份。
#### 安装attic到ubuntu 14.10
打开终端并运行以下命令
```
sudo apt-get install attic
```
### 使用Attic
#### 手把手实例教学
在进行备份之前,首先要对仓库进行初始化:
```
$ attic init /somewhere/my-repository.attic
```
将~/src和~/Documents目录备份到名为Monday的归档:
```
$ attic create /somwhere/my-repository.attic::Monday ~/src ~/Documents
```
第二天创建一个新的名为Tuesday的归档:
```
$ attic create --stats /somwhere/my-repository.attic::Tuesday ~/src ~/Documents
```
该备份将更快些,也更小些,因为只有之前从没见过的新数据会被存储。--stats选项会让Attic输出关于新创建的归档的统计数据,比如唯一数据(不和其它归档共享)的数量:
```
归档名:Tuesday
归档指纹:387a5e3f9b0e792e91ce87134b0f4bfe17677d9248cb5337f3fbf3a8e157942a
开始时间: Tue Mar 25 12:00:10 2014
结束时间: Tue Mar 25 12:00:10 2014
持续时间: 0.08 seconds
文件数量: 358
最初大小 压缩后大小 重复数据删除后大小
本归档: 57.16 MB 46.78 MB 151.67 kB
所有归档:114.02 MB 93.46 MB 44.81 MB
```
列出仓库中所有归档:
```
$ attic list /somewhere/my-repository.attic
Monday Mon Mar 24 11:59:35 2014
Tuesday Tue Mar 25 12:00:10 2014
```
列出Monday归档的内容:
```
$ attic list /somewhere/my-repository.attic::Monday
drwxr-xr-x user group 0 Jan 06 15:22 home/user/Documents
-rw-r--r-- user group 7961 Nov 17 2012 home/user/Documents/Important.doc
```
恢复Monday归档:
```
$ attic extract /somwhere/my-repository.attic::Monday
```
通过手动删除Monday归档恢复磁盘空间:
```
$ attic delete /somwhere/my-backup.attic::Monday
```
详情请查阅[Attic文档](https://attic-backup.org/index.html)。
---
via: <http://www.ubuntugeek.com/attic-deduplicating-backup-program.html>
作者:[ruchi](http://www.ubuntugeek.com/author/ubuntufix) 译者:[GOLinux](https://github.com/GOLinux) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 200 | OK | # Attic – Deduplicating backup program
**Sponsored Link**
**Attic Features**
**Space efficient storage**
Variable block size deduplication is used to reduce the number of bytes stored by detecting redundant data. Each file is split into a number of variable length chunks and only chunks that have never been seen before are compressed and added to the repository.
**Optional data encryption**
All data can be protected using 256-bit AES encryption and data integrity and authenticity is verified using HMAC-SHA256.
**Off-site backups**
Attic can store data on any remote host accessible over SSH as long as Attic is installed.
**Backups mountable as filesystems**
Backup archives are mountable as userspace filesystems for easy backup verification and restores.
**Install attic on ubuntu 14.10**
Open the terminal and run the following command
sudo apt-get install attic
**Using Attic**
**A step by step example**
Before a backup can be made a repository has to be initialized:
$ attic init /somewhere/my-repository.attic
Backup the ~/src and ~/Documents directories into an archive called Monday:
$ attic create /somwhere/my-repository.attic::Monday ~/src ~/Documents
The next day create a new archive called Tuesday:
$ attic create --stats /somwhere/my-repository.attic::Tuesday ~/src ~/Documents
This backup will be a lot quicker and a lot smaller since only new never before seen data is stored. The --stats option causes Attic to output statistics about the newly created archive such as the amount of unique data (not shared with other archives):
Archive name: Tuesday
Archive fingerprint: 387a5e3f9b0e792e91ce87134b0f4bfe17677d9248cb5337f3fbf3a8e157942a
Start time: Tue Mar 25 12:00:10 2014
End time: Tue Mar 25 12:00:10 2014
Duration: 0.08 seconds
Number of files: 358
Original size Compressed size Deduplicated size
This archive: 57.16 MB 46.78 MB 151.67 kB
All archives: 114.02 MB 93.46 MB 44.81 MB
List all archives in the repository:
$ attic list /somewhere/my-repository.attic
Monday Mon Mar 24 11:59:35 2014
Tuesday Tue Mar 25 12:00:10 2014
List the contents of the Monday archive:
$ attic list /somewhere/my-repository.attic::Monday
drwxr-xr-x user group 0 Jan 06 15:22 home/user/Documents
-rw-r--r-- user group 7961 Nov 17 2012 home/user/Documents/Important.doc
...
Restore the Monday archive:
$ attic extract /somwhere/my-repository.attic::Monday
Recover disk space by manually deleting the Monday archive:
$ attic delete /somwhere/my-backup.attic::Monday
Check the [Attic Documentation](https://attic-backup.org/index.html) for more details
It works on 14.10, but unfortunately not on 14.04, even though it’s in the repositories. Perhaps I should file a bug. |
4,570 | Ubuntu参考手册14.04 LTS第二版正式发布 | http://news.softpedia.com/news/Second-Edition-of-Ubuntu-Manual-14-04-LTS-Is-Out-468395.shtml | 2015-01-01T11:46:00 | [
"Ubuntu"
] | https://linux.cn/article-4570-1.html |
>
> 初学者可以在手册里获得很有用的信息
>
>
>
### Ubuntu参考手册团队表示第二版手册现在已经发布并且可以免费下载

Ubuntu手册按照惯例会对应相应的LTS发行版本,那么唯一合理的解释就是,现在发布的手册对应于6个月前发布的Ubuntu 14.04 LTS(Trusty Tahr)。与其他书籍一样,特别是大型书籍,手册内容总会出现各种错误或者也许已经和现状不匹配。不过不管怎样,电子书的修正和更新总要方便一些。
你也许会觉得奇怪,一个方便上手的免费操作系统竟然会有一个参考手册,或许一个社区就已经足够了。但是,总是有一些新用户连基本的操作都不懂,因此,有一本可以指明最基本的东西的手册拿在手里总是一个很好不过的事情。
### 这是“Ubuntu 14.04 LTS入门”手册的第二个版本
使用Ubuntu操作系统的用户会发现,它和之前用过的其他操作系统有很大的差异,例如Windows和Max OS X。这很正常,并且你也不是任何时候都可以在网上找到一个特定的功能或者组件的相关资源和信息。有一个可以说明Ubuntu 14.04 LTS基本特性的手册可以提供一些帮助。
“《Ubuntu 14.04 入门 E2》对于Ubuntu操作系统而言,是一个很全面的初学者指南手册。它采用的是开源许可协议,你可以自由下载、阅读、修改以及共享。这个手册可以帮助你熟悉如何处理日常的工作,例如上网、听音乐或者扫描文档等等。尤其值得一提的是,这个文档浅显易懂,适合各个层次的用户。”
“这个快速入门手册可以让你很容易的利用你的计算机做一些事情,而不会陷入技术细节当中。在手册的帮助下,新用户可以很快的熟悉Unity桌面,”更多信息参考[官方网站](http://ubuntu-manual.org/)。
这是该参考手册的第二版,制作手册的团队具有丰富的经验。就算你已经是一个Ubuntu用户,看一看这个手册也没有什么坏处,因为你总能从其中学到一些东西。你可以在Softpedia[下载Ubuntuy参考手册14.04第二版](http://linux.softpedia.com/get/Documentation/Ubuntu-Manual-53530.shtml)。
---
via: <http://news.softpedia.com/news/Second-Edition-of-Ubuntu-Manual-14-04-LTS-Is-Out-468395.shtml>
作者:[Silviu Stahie](http://news.softpedia.com/editors/browse/silviu-stahie) 译者:[zhouj-sh](https://github.com/zhouj-sh) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,571 | 迄今为止最大的RC1——Linux 3.19 RC1 | http://news.softpedia.com/news/Linus-Torvalds-Launches-Linux-kernel-3-19-RC1-One-of-the-Biggest-So-Far-468043.shtml | 2014-12-31T23:08:29 | [
"Linux",
"内核"
] | https://linux.cn/article-4571-1.html |
>
> 新的内核开发周期开始了
>
>
>

**首个内核候选版本在3.19分支上发布了,它看上去像目前最大的一个 RC1。Linus Torvalds很惊奇这么多人提交了,其实不过也很好理解。**
内核开发周期因新的3.19的发布而刷新了。事实是3.18分支才几周前才发布,今天的发布并不是完全在预期中。假期要来了,很多开发者和维护人员可能会休息。一般来说RC版本每周发布一次,但是用户可能会看到一点的延误。
这个版本没有提到在Linux 3.18中确认的回归问题,但是可以确定的是,开发人员仍在努力修复中。另一方面,Linus说这是一个很大的更新,事实上这是目前为止最大的更新。很有可能是许多开发者想要在节日之前推送他们的补丁,因此,下一个RC版本会小一些。
### Linux 3.19 RC1 标志着新的一个周期的开始
发布版本的大小随着更新的频率正在增加。内核的开发周期通常大约8到10周,并且很少多于这个,这给项目一个很好的预测。
[阅读](http://lkml.iu.edu/hypermail/linux/kernel/1412.2/02480.html) Linus Torvalds的发布声明中说:“也就是说,也许没有谁在拖后腿,并且从rc1的大小来看,真的也不能再多了。我不仅觉得下一个版本会有更多的提交,并且这是历史上最大的一个rc1(在提交数量上)。我们有比它大的版本(3.10和3.15的都是由很大的合并窗口产生的),但是这明显这个合并窗口也不小。”
“按照蓝图,这看上去只是一个常规发布。大约三分之二的驱动更新,这剩下的一半是架构的更新(新的nios2补丁还没有优势,它只有ARM一半的性能,新的niso2支持小于整体架构更新的10%)。”
具体关于这个RC的细节可以在官方邮件列表中找到。
#### 下载 Linux 3.19 RC1 源码包:
* [tar.xz (3.18.1 Stable)](https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.1.tar.xz)文件大小 77.2 MB
* [tar.xz (3.19 RC1 Unstable)](https://www.kernel.org/pub/linux/kernel/v3.x/testing/linux-3.19-rc1.tar.xz)
如果你想要测试,需要自己编译。并不建议在生产机器上测试。
---
via: <http://news.softpedia.com/news/Linus-Torvalds-Launches-Linux-kernel-3-19-RC1-One-of-the-Biggest-So-Far-468043.shtml>
作者:[Silviu Stahie](http://news.softpedia.com/editors/browse/silviu-stahie) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,572 | 2014:这一年 systemd 的开发量暴涨 | http://www.phoronix.com/scan.php?page=news_item&px=MTg3NjQ | 2015-01-01T00:03:00 | [
"systemd"
] | https://linux.cn/article-4572-1.html | [在关于 systemd 的争议和内斗](http://www.phoronix.com/scan.php?page=news_item&px=MTg3MzE)越来越多的这一年,systemd 的开发者们仍然保持了不断提交,在为这个项目增加代码上取得巨大成就。
作为昨天的“[systemd 排名前列的开发者](http://www.phoronix.com/scan.php?page=news_item&px=MTg3NTk)”帖子的补充,我今天早上用 GitStats 对 systemd 主干 Git 库进行了统计分析。以下数字说明了这一年 systemd 的增长:

在2014年,Systemd 得到了 4879 个提交,这要比2013年多28%,比2012年多91%。从最近的5000个提交来看,增加了418451行代码,并删除了203010行。

与其他主要成员如 Kay Sievers 和 Tom Gundersen 表现平平相比,Lennart Poettering 这一年一个人就提交了一大堆代码,他以1767个提交荣膺今年的 systemd 开发者的 No.1。其它的主要开发者还有: Tom Gundersen, Zbigniew JÄ™drzejewski-Szmek, Kay Sievers, David Herrmann, 和 Thomas Hindoe Paaboel Andersen.

在这一年的最后, systemd 的代码达到了 719,348 行。
| 301 | Moved Permanently | null |
4,581 | Linux有问必答:如何在Linux上检查SSH的版本 | http://ask.xmodulo.com/check-ssh-protocol-version-linux.html | 2015-01-02T13:14:18 | [
"SSH",
"OpenSSH"
] | /article-4581-1.html |
>
> **Question**:我想到SSH存在1和2两个版本(SSH1和SSH2)。这两者之间有什么不同?还有我该怎么在Linux上检查SSH协议的版本?
>
>
>
安全Shell(SSH)通过加密的安全通信通道来远程登录或者远程执行命令。SSH被设计来替代不安全的明文协议,如telnet、rsh和rlogin。SSH提供了大量需要的特性,如认证、加密、数据完整性、授权和转发/通道。

### SSH1 vs. SSH2
SSH协议规范存在一些小版本的差异,但是有两个主要的大版本:**SSH1** (版本号 1.XX) 和 **SSH2** (版本号 2.00)。
事实上,SSH1和SSH2是两个完全不同互不兼容的协议。SSH2明显地提升了SSH1中的很多方面。首先,SSH是宏设计,几个不同的功能(如:认证、传输、连接)被打包进一个单一的协议,SSH2带来了比SSH1更强大的安全特性,如基于MAC的完整性检查,灵活的会话密钥更新、充分协商的加密算法、公钥证书等等。
SSH2由IETF标准化,且它的实现在业界被广泛部署和接受。由于SSH2对于SSH1的流行和加密优势,许多产品对SSH1放弃了支持。在写这篇文章的时候,OpenSSH仍旧[支持](http://www.openssh.com/specs.html)SSH1和SSH2,然而在所有的现代Linux发行版中,OpenSSH服务器默认禁用了SSH1。
### 检查支持的SSH协议版本
#### 方法一
如果你想检查本地OpenSSH服务器支持的SSH协议版本,你可以参考**/etc/ssh/sshd\_config**这个文件。用文本编辑器打开/etc/ssh/sshd\_config,并且查看"Protocol"字段。
如果如下显示,就代表服务器只支持SSH2。
```
Protocol 2
```
如果如下显示,就代表服务器同时支持SSH1和SSH2。
```
Protocol 1,2
```
#### 方法二
如果因为OpenSSH服务其运行在远端服务器上而你不能访问/etc/ssh/sshd\_config。你可以使用叫ssh的SSH客户端来检查支持的协议。具体说来,就是强制ssh使用特定的SSH协议,接着我么查看SSH服务器的响应。
下面的命令强制ssh使用SSH1:
```
$ ssh -1 user@remote_server
```
下面的命令强制ssh使用SSH2:
```
$ ssh -2 user@remote_server
```
如果远程SSH服务器只支持SSH2,那么第一个带“-1”的选项就会出现像下面的错误信息:
```
Protocol major versions differ: 1 vs. 2
```
如果SSH服务器同时支持SSH1和SSH2,那么两个命令都有效。
### 方法三
另一个检查版本的方法是运行SSH扫描工具,叫做[scanssh](http://www.monkey.org/%7Eprovos/scanssh/)。这个命令行工具在你想要检查一组IP地址或者整个本地网络来升级SSH1兼容的SSH服务器时很有用。
下面是基本的SSH版本扫描语法。
```
$ sudo scanssh -s ssh -n [ports] [IP addresses or CIDR prefix]
```
"-n"选项可以指定扫描的SSH端口。你可以用都好分隔来扫描多个端口,不带这个选项,scanssh会默认扫描22端口。
使用下面的命令来发现192.168.1.0/24本地网络中的SSH服务器,并检查SSH协议v版本:
```
$ sudo scan -s ssh 192.168.1.0/24
```

如果scanssh为特定IP地址报告“SSH-1.XX-XXXX”,这暗示着相关的SSH服务器支持的最低版本是SSH1.如果远程服务器只支持SSH2,scanssh会显示“SSH-2.0-XXXX”。
---
via: <http://ask.xmodulo.com/check-ssh-protocol-version-linux.html>
译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /check-ssh-protocol-version-linux.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275c5570>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)")) | null |
4,582 | 10 个免费的磁盘克隆软件 | http://www.efytimes.com/e1/fullnews.asp?edid=148039 | 2015-01-02T13:32:00 | [
"克隆"
] | https://linux.cn/article-4582-1.html |
>
> 这些克隆软件会读取整个磁盘的数据,将它们转换成一个 .img 文件,之后你可以将它复制到其他硬盘上。
>
>
>
磁盘克隆的意思是说从一个硬盘复制数据到另一个硬盘上。虽然你可以通过简单的复制粘贴来做到这一点,但是你却不能复制隐藏文件和文件夹,以及正在使用中的文件。这便是一个克隆软件可以通过保存一份文件和文件夹的镜像来做到的。克隆软件会读取整个磁盘的数据,将它们转换成一个 .img 文件,之后你可以将它复制到其他硬盘上。现在我们将要向你介绍最优秀的 10 个免费的克隆软件。
### 1. [Clonezilla](http://clonezilla.org/)
Clonezilla 是一个基于 Ubuntu 和 Debian 的 Live CD。它可以像 Windows 里的 Ghost 一样克隆你的磁盘数据和做备份,不过它更有效率。Clonezilla 支持包括 ext2、ext3、ext4、btrfs 和 xfs 在内的很多文件系统。它还支持 BIOS、UEFI、MBR 和 GPT 分区。

### 2. [Redo Backup](http://redobackup.org/)
Redo Backup 是另一个用来方便地克隆磁盘的 Live CD。它是自由和开源的软件,使用 GPL 3 许可协议授权。它的主要功能和特点包括从 CD 引导的简单易用的 GUI、无需安装,可以恢复 Linux 和 Windows 等系统,无需登陆访问文件,以及已删除的文件等。

### 3. [Mondo Rescue](http://www.mondorescue.org/)
Mondo 和其他的软件不大一样,它并不将你的磁盘数据转换为一个 .img 文件,而是将它们转换为一个 .iso 镜像。使用 Mondo,你还可以使用“mindi”——一个由 Mondo Rescue 开发的特别工具——来创建一个自定义的 Live CD,这样你的数据就可以从 Live CD 克隆出来了。它支持大多数 Linux 发行版和 FreeBSD,并使用 GPL 许可协议授权。

### 4. [Partimage](http://www.partimage.org/Main_Page)
这是一个开源的备份软件,默认工作在 Linux 系统下。在大多数发行版中,你都可以从发行版自带的软件包管理工具中安装。如果你没有 Linux 系统,你也可以使用“SystemRescueCd”。它是一个默认包含了 Partimage 的 Live CD,可以为你完成备份工作。Partimage 在克隆硬盘方面的性能非常出色。

### 5. [FSArchiver](http://www.fsarchiver.org/Main_Page)
FSArchiver 是 Partimage 的后续产品,而且它也是一个很好的硬盘克隆工具。它支持克隆 Ext4 和 NTFS 分区、基本的文件属性如所有人、权限、SELinux 之类的扩展属性,以及所有 Linux 文件系统的文件系统属性等。
### 6. [Partclone](http://www.partclone.org/)
Partclone 是一个可以克隆和恢复分区的免费工具。它用 C 语言编写,最早在 2007 年出现,而且支持很多文件系统,包括:ext2、ext3、ext4、xfs、nfs、reiserfs、reiser4、hfs+、btrfs。它的使用十分简便,并且使用 GPL 许可协议授权。
### 7. [doClone](http://doclone.nongnu.org/)
doClone 是一个免费软件项目,被开发用于轻松地克隆 Linux 系统分区。它由 C++ 编写而成,支持多达 12 种不同的文件系统。它能够修复 Grub 引导器,还能通过局域网传输镜像到另一台计算机。它还提供了热同步功能,这意味着你可以在系统正在运行的时候对它进行克隆操作。

### 8. [Macrium Reflect 免费版](http://www.macrium.com/reflectfree.aspx)
Macrium Reflect 免费版被形容为最快的磁盘克隆工具之一,它只支持 Windows 文件系统。它有一个很直观的用户界面。该软件提供了磁盘镜像和克隆操作,还能让你在文件管理器中访问镜像。它允许你创建一个 Linux 应急 CD,并且它与 Windows Vista 和 Windows 7 兼容。

### 9. [DriveImage XML](http://www.runtime.org/driveimage-xml.htm)
DriveImage XML 使用 Microsoft VSS 来创建镜像,十分可靠。使用这个软件,你可以从一个正在使用的磁盘创建“热”镜像。镜像使用 XML 文件保存,这意味着你可以从任何支持的第三方软件访问它们。DriveImage XML 还允许在不重启的情况下从镜像恢复到机器。这个软件与 Windows XP、Windows Server 2003、Vista 以及 7 兼容。

### 10. [Paragon Backup & Recovery 免费版](http://www.paragon-software.com/home/br-free/)
Paragon Backup & Recovery 免费版在管理镜像计划任务方面十分出色。它是一个免费软件,但是仅能用于个人用途。

---
via: <http://www.efytimes.com/e1/fullnews.asp?edid=148039>
作者:Sanchari Banerjee 译者:[felixonmars](https://github.com/felixonmars) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,585 | 一大波有用的 bash 别名和函数 | http://xmodulo.com/useful-bash-aliases-functions.html | 2015-01-03T09:32:00 | [
"命令行",
"别名",
"alias"
] | https://linux.cn/article-4585-1.html | 作为一个命令行探索者,你或许发现你自己一遍又一遍重复同样的命令。如果你总是用ssh进入到同一台电脑,如果你总是将一连串命令连接起来,如果你总是用同样的参数运行一个程序,你也许希望在这种不断的重复中为你的生命节约下几秒钟。
解决方案是使用一个别名(alias)。正如你可能知道的,别名用一种让你的shell记住一个特定的命令并且给它一个新的名字的方式。不管怎么样,别名有一些限制,它只是shell命令的快捷方式,不能传递或者控制其中的参数。所以作为补充,bash 也允许你创建你自己的函数,这可能更长一些和复杂一点,它允许任意数量的参数。
当然,当你有美食时,比如某种汤,你要分享它给大家。我这里有一个列表,列出了一些最有用bash别名和函数的。注意“最有用的”只是个说法,别名的是否有用要看你是否每天都需要在 shell 里面用它。
在你开始你的别名体验之旅前,这里有一个便于使用的小技巧:如果你的别名和原本的命令名字相同,你可以用如下技巧来访问原本的命令(LCTT 译注:你也可以直接原本命令的完整路径来访问它。)
```
\command
```
例如,如果有一个替换了ls命令的别名 ls。如果你想使用原本的ls命令而不是别名,通过调用它:
```
\ls
```

### 提升生产力
这些别名真的很简单并且真的很短,但他们大多数是为了给你的生命节省几秒钟,最终也许为你这一辈子节省出来几年,也许呢。
```
alias ls="ls --color=auto"
```
简单但非常重要。使ls命令带着彩色输出。
```
alias ll="ls --color -al"
```
以彩色的列表方式列出目录里面的全部文件。
```
alias grep='grep --color=auto'
```
类似,只是在grep里输出带上颜色。
```
mcd() { mkdir -p "$1"; cd "$1";}
```
我的最爱之一。创建一个目录并进入该目录里: mcd [目录名]。
```
cls() { cd "$1"; ls;}
```
类似上一个函数,进入一个目录并列出它的的内容:cls[目录名]。
```
backup() { cp "$1"{,.bak};}
```
简单的给文件创建一个备份: backup [文件] 将会在同一个目录下创建 [文件].bak。
```
md5check() { md5sum "$1" | grep "$2";}
```
因为我讨厌通过手工比较文件的md5校验值,这个函数会计算它并进行比较:md5check[文件][校验值]。

```
alias makescript="fc -rnl | head -1 >"
```
很容易用你上一个运行的命令创建一个脚本:makescript [脚本名字.sh]
```
alias genpasswd="strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n'; echo"
```
只是瞬间产生一个强壮的密码。

```
alias c="clear"
```
清除你终端屏幕不能更简单了吧?
```
alias histg="history | grep"
```
快速搜索你的命令输入历史:histg [关键字]
```
alias ..='cd ..'
```
回到上层目录还需要输入 cd 吗?
```
alias ...='cd ../..'
```
自然,去到上两层目录。
```
extract() {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
```
很长,但是也是最有用的。解压任何的文档类型:extract: [压缩文件]
### 系统信息
想尽快地知道关于你的系统一切信息?
```
alias cmount="mount | column -t"
```
按列格式化输出mount信息。

```
alias tree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
```
以树形结构递归地显示目录结构。
```
sbs() { du -b --max-depth 1 | sort -nr | perl -pe 's{([0-9]+)}{sprintf "%.1f%s", $1>=2**30? ($1/2**30, "G"): $1>=2**20? ($1/2**20, "M"): $1>=2**10? ($1/2**10, "K"): ($1, "")}e';}
```
安装文件在磁盘存储的大小排序,显示当前目录的文件列表。
```
alias intercept="sudo strace -ff -e trace=write -e write=1,2 -p"
```
接管某个进程的标准输出和标准错误。注意你需要安装了 strace。
```
alias meminfo='free -m -l -t'
```
查看你还有剩下多少内存。

```
alias ps? = "ps aux | grep"
```
可以很容易地找到某个进程的PID:ps? [名字]。
```
alias volume="amixer get Master | sed '1,4 d' | cut -d [ -f 2 | cut -d ] -f 1"
```
显示当前音量设置。

### 网络
对于所有用在互联网和本地网络的命令,也有一些神奇的别名给它们。
```
alias websiteget="wget --random-wait -r -p -e robots=off -U mozilla"
```
下载整个网站:websiteget [URL]。
```
alias listen="lsof -P -i -n"
```
显示出哪个应用程序连接到网络。

```
alias port='netstat -tulanp'
```
显示出活动的端口。
```
gmail() { curl -u "$1" --silent "https://mail.google.com/mail/feed/atom" | sed -e 's/<\/fullcount.*/\n/' | sed -e 's/.*fullcount>//'}
```
大概的显示你的谷歌邮件里未读邮件的数量:gmail [用户名]
```
alias ipinfo="curl ifconfig.me && curl ifconfig.me/host"
```
获得你的公网IP地址和主机名。
```
getlocation() { lynx -dump http://www.ip-adress.com/ip_tracer/?QRY=$1|grep address|egrep 'city|state|country'|awk '{print $3,$4,$5,$6,$7,$8}'|sed 's\ip address flag \\'|sed 's\My\\';}
```
返回你的当前IP地址的地理位置。
### 也许无用
所以呢,如果一些别名并不是全都具有使用价值?它们可能仍然有趣。
```
kernelgraph() { lsmod | perl -e 'print "digraph \"lsmod\" {";<>;while(<>){@_=split/\s+/; print "\"$_[0]\" -> \"$_\"\n" for split/,/,$_[3]}print "}"' | dot -Tpng | display -;}
```
绘制内核模块依赖曲线图。需要可以查看图片。
```
alias busy="cat /dev/urandom | hexdump -C | grep 'ca fe'"
```
在那些非技术人员的眼里你看起来是总是那么忙和神秘。

最后,这些别名和函数的很大一部分来自于我个人的.bashrc。而那些令人点赞的网站 [alias.sh](http://alias.sh/)和[commandlinefu.com](http://www.commandlinefu.com/commands/browse)我早已在我的帖子[best online tools for Linux](http://xmodulo.com/useful-online-tools-linux.html) 里面介绍过。你可以去看看,如果你愿意,也可以分享下你的。也欢迎你在这里评论,分享一下你的智慧。
做为奖励,这里有我提到的全部别名和函数的纯文本版本,随时可以复制粘贴到你的.bashrc。(如果你已经一行一行的复制到这里了,哈哈,你发现你又浪费了生命的几秒钟~)
```
#Productivity
alias ls="ls --color=auto"
alias ll="ls --color -al"
alias grep='grep --color=auto'
mcd() { mkdir -p "$1"; cd "$1";}
cls() { cd "$1"; ls;}
backup() { cp "$1"{,.bak};}
md5check() { md5sum "$1" | grep "$2";}
alias makescript="fc -rnl | head -1 >"
alias genpasswd="strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n'; echo"
alias c="clear"
alias histg="history | grep"
alias ..='cd ..'
alias ...='cd ../..'
extract() {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
#System info
alias cmount="mount | column -t"
alias tree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
sbs(){ du -b --max-depth 1 | sort -nr | perl -pe 's{([0-9]+)}{sprintf "%.1f%s", $1>=2**30? ($1/2**30, "G"): $1>=2**20? ($1/2**20, "M"): $1>=2**10? ($1/2**10, "K"): ($1, "")}e';}
alias intercept="sudo strace -ff -e trace=write -e write=1,2 -p"
alias meminfo='free -m -l -t'
alias ps?="ps aux | grep"
alias volume="amixer get Master | sed '1,4 d' | cut -d [ -f 2 | cut -d ] -f 1"
#Network
alias websiteget="wget --random-wait -r -p -e robots=off -U mozilla"
alias listen="lsof -P -i -n"
alias port='netstat -tulanp'
gmail() { curl -u "$1" --silent "https://mail.google.com/mail/feed/atom" | sed -e 's/<\/fullcount.*/\n/' | sed -e 's/.*fullcount>//'}
alias ipinfo="curl ifconfig.me && curl ifconfig.me/host"
getlocation() { lynx -dump http://www.ip-adress.com/ip_tracer/?QRY=$1|grep address|egrep 'city|state|country'|awk '{print $3,$4,$5,$6,$7,$8}'|sed 's\ip address flag \\'|sed 's\My\\';}
#Funny
kernelgraph() { lsmod | perl -e 'print "digraph \"lsmod\" {";<>;while(<>){@_=split/\s+/; print "\"$_[0]\" -> \"$_\"\n" for split/,/,$_[3]}print "}"' | dot -Tpng | display -;}
alias busy="cat /dev/urandom | hexdump -C | grep \"ca fe\""
```
---
via: <http://xmodulo.com/useful-bash-aliases-functions.html>
作者:[Adrien Brochard](http://xmodulo.com/author/adrien) 译者:[luoyutiantang](https://github.com/luoyutiantang) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,586 | Linux 上使用 backup-manager 进行系统备份 | http://xmodulo.com/linux-backup-manager.html | 2015-01-03T11:59:00 | [
"备份",
"backup-manager"
] | https://linux.cn/article-4586-1.html | 无论简单与否,我们都有机会去了解这么一件事,那就是备份的重要性从来都不可以被低估。考虑到备份的方法真的多如牛毛,你可能想要知道怎样来有效地为你的系统选择正确的工具和和合适的策略。
在本文中,我将为你介绍[backup-manager](https://github.com/sukria/Backup-Manager),一个简单易用的命令行备份工具,在大多数的Linux发行版的标准软件库中都能见到它的身影。
是什么让备份管理器在众多的备份工具或备份策略中脱颖而出呢?让我来简单介绍一些它的与众不同的特性吧:
* **简单的设计与管理**:配置文件易于读懂和编辑,即便是初学者也很容易上手。
* **一劳永逸**:它在配置好后就可以通过cron周期性运作。
* **支持多种协议远程备份**:无缝整合多种传输协议、应用和云后端(如,FTP,SCP,SSH-GPG,rsync,AWS S3等等)来传输生成的归档包到一组远程主机。
* **支持数据库备份**:包括支持开箱即用备份MySQL/MariaDB和PostgreSQL数据库。
* **支持加密**:备份过程中支持基于GPG文件的加密。
### 在Linux上安装备份管理器
备份管理器的安装是快速而无痛的,因为它就包含在大多数Linux发行版的基础软件库中。
#### Debian,Ubuntu及其衍生版
```
# aptitude install backup-manager
```
在基于Debian的系统中安装时,会提示你输入要存放备份归档文件的目录。如果选择的目录不存在,那么当你首次运行备份管理器时它会自动创建。
选择OK并按回车键。

在下一步中,会询问你要备份的所有目录(用空格分隔)。建议,但不是严格要求,列出同一父目录中的几个子目录,而不要仅仅输入父目录。
你可以跳过该步骤并在以后对配置文件中BM\_TARBALL\_DIRECTORIESb变量进行设置。否则的话,就请尽可能多地添加你想要的目录,然后选择OK:

#### Fedora或CentOS/RHEL
```
# yum install backup-manager
```
在CentOS/RHEL上,在运行以上yum命令前,你将需要先启用[EPEL仓库](http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html)。
### 配置备份管理器
备份管理器的主配置文件是/etc/backup-manager.conf。该文件被划分为几个章节,里面定义了备份方法和相关的变量(或“键值”),这些配置让备份管理器成为一个多样化的工具,可以广泛地应付各种状况。
出于演示目的,我们将考虑以下环境:
* 每周对/etc,/home以及/var/log目录进行一次完整备份(我们将在下面通过cron设置备份的频率)。
* 通过SSH传输.tar.gz备份归档文件到两台不同主机dev1和dev3上指定的目标目录。
* 通过SSH备份本地MySQL数据库到相同目标主机。
用你喜爱的文本编辑器打开/etc/backup-manager.conf文件,并编辑以下变量。如果你愿意,你大可不必理会那些#开头的行。在本文中,它只是用作说明的注释:
```
# Specify the backup method(s) that will be used.
# tarball: takes a list of directories and builds the corresponding tarballs.
# mysql: archives MySQL databases using mysqldump. To restore the database, you # need to use the same tool manually.
export BM_ARCHIVE_METHOD="tarball mysql"
# Where to store the backups.
export BM_REPOSITORY_ROOT="/var/archives"
# The following directive indicates backup-manager to name
# the generated files after the directory that was backed up.
export BM_TARBALL_NAMEFORMAT="long"
# Define the compression type for the generated files.
export BM_TARBALL_FILETYPE="tar.gz"
# List the directories that you want to backup.
export BM_TARBALL_DIRECTORIES="/etc /home /var/log"
# Exclude some subdirectories or file extensions.
export BM_TARBALL_BLACKLIST="/var/log/myotherapp.log *.mp3 *.mp4"
# List the database(s) that you want to backup, separated by spaces.
export BM_MYSQL_DATABASES="mysql mybase wordpress dotclear phpbb2"
# MySQL username.
export BM_MYSQL_ADMINLOGIN="root"
# MySQL password for username.
export BM_MYSQL_ADMINPASS="mypassword"
# Add support for DROP statements (optional).
export BM_MYSQL_SAFEDUMPS="true"
# The hostname or IP address where the database(s) reside.
export BM_MYSQL_HOST="localhost"
# Port where MySQL server is listening.
export BM_MYSQL_PORT="3306"
# Compression type (optional).
export BM_MYSQL_FILETYPE="gzip"
# Do not archive remote hosts, but only localhost.
BM_TARBALL_OVER_SSH="false"
# User account for SSH upload.
export BM_UPLOAD_SSH_USER="root"
# Absolute path of the user's private key for passwordless SSH login.
export BM_UPLOAD_SSH_KEY="/root/.ssh/id_rsa"
# Remote hosts (make sure you have exported your public key to them):
export BM_UPLOAD_SSH_HOSTS="dev1 dev3"
# Remote destination for uploading backups. If it doesn't exist,
# this directory will be created automatically the first time
# backup-manager runs.
export BM_UPLOAD_SSH_DESTINATION="/var/archives/backups/$HOSTNAME"
```
### 运行备份管理器
要手动运行备份管理器,请输入以下命令。你也可以选择添加‘-v’标识以便一步一步详细检查运行过程。
```
# backup-manager
```
BM\_TARBALL\_DIRECTORIES列出的目录将作为tarball备份到BM\_REPOSITORY\_ROOT目录,然后通过SSH传输到BM\_UPLOAD\_SSH\_DESTINATION指定的主机dev1和dev3。

正如你在上面图片中看到的那样,备份管理器在运行的时候创建了一个名为/root/.back-manager\_my.cnf的文件,MySQL密码通过BM\_MYSQL\_ADMINPASS指定。那样,mysqldump可以验证到MySQL服务器,而不必在命令行以明文格式接受密码,那样会有安全风险。
### 通过cron运行备份管理器
一旦决定哪一天是进行每周备份的最佳日子(最佳时间),你可以让cron来为你运行备份管理器。
打开root的crontab文件(注意,你必须以root登录):
```
# crontab -e
```
假定你想要在星期天的上午5:15分运行备份管理器,那么就添加下面这行。
```
15 05 * * 0 /usr/sbin/backup-manager > /dev/null 2>&1
```
### 小结
在本文中,我已经展示了备份管理器这个备份工具是怎样的简单而强大,并且易于使用。在你的备份策略中,你可能还有其它几个选项需要考虑,请参阅手册页或用户手册,里面也包含了几个部署实例和建议。
希望此文对你有所帮助,请在下面随意提问和评论。
---
via: <http://xmodulo.com/linux-backup-manager.html>
作者:[Gabriel Cánepa](http://xmodulo.com/author/gabriel) 译者:[GOLinux](https://github.com/GOLinux) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,607 | IPv6:IPv4犯的错,为什么要我来弥补 | http://www.tecmint.com/ipv4-and-ipv6-comparison/ | 2015-01-07T13:42:00 | [
"IPv4",
"IPv6",
"IP"
] | https://linux.cn/article-4607-1.html | 在过去的十年间,IPv6 本来应该得到很大的发展,但事实上这种好事并没有降临。由此导致了一个结果,那就是大部分人都不了解 IPv6 的一些知识:它是什么,怎么使用,以及,为什么它会存在?

*IPv4 和 IPv6 的区别*
### IPv4 做错了什么?
自从1981年发布了 RFC 791 标准以来我们就一直在使用 **IPv4**。在那个时候,电脑又大又贵还不多见,而 IPv4 号称能提供**40亿条 IP 地址**,在当时看来,这个数字好大好大。不幸的是,这么多的 IP 地址并没有被充分利用起来,地址与地址之间存在间隙。举个例子,一家公司可能有**254(2<sup> 8-2)</sup>**条地址,但只使用其中的25条,剩下的229条被空占着,以备将来之需。于是这些空闲着的地址不能服务于真正需要它们的用户,原因就是网络路由规则的限制。最终的结果是在1981年看起来那个好大好大的数字,在2014年看起来变得好小好小。
互联网工程任务组(**IETF**)在90年代初指出了这个问题,并提供了两套解决方案:无类型域间选路(**CIDR**)以及私有IP地址。在 CIDR 出现之前,你只能选择三种网络地址长度:**24 位** (共16,777,214个可用地址), **20位** (共1,048,574个可用地址)以及**16位** (共65,534个可用地址)。CIDR 出现之后,你可以将一个网络再划分成多个子网。
举个例子,如果你需要**5个 IP 地址**,你的 ISP 会为你提供一个子网,里面的主机地址长度为3位,也就是说你最多能得到**6个地址**(LCTT:抛开子网的网络号,3位主机地址长度可以表示0~7共8个地址,但第0个和第7个有特殊用途,不能被用户使用,所以你最多能得到6个地址)。这种方法让 ISP 能尽最大效率分配 IP 地址。“私有地址”这套解决方案的效果是,你可以自己创建一个网络,里面的主机可以访问外网的主机,但外网的主机很难访问到你创建的那个网络上的主机,因为你的网络是私有的、别人不可见的。你可以创建一个非常大的网络,因为你可以使用16,777,214个主机地址,并且你可以将这个网络分割成更小的子网,方便自己管理。
也许你现在正在使用私有地址。看看你自己的 IP 地址,如果这个地址在这些范围内:**10.0.0.0 – 10.255.255.255**、**172.16.0.0 – 172.31.255.255**或**192.168.0.0 – 192.168.255.255**,就说明你在使用私有地址。这两套方案有效地将“IP 地址用尽”这个灾难延迟了好长时间,但这毕竟只是权宜之计,现在我们正面临最终的审判。
**IPv4** 还有另外一个问题,那就是这个协议的消息头长度可变。如果数据的路由通过软件来实现,这个问题还好说。但现在路由器功能都是由硬件提供的,处理变长消息头对硬件来说是一件困难的事情。一个大的路由器需要处理来自世界各地的大量数据包,这个时候路由器的负载是非常大的。所以很明显,我们需要固定消息头的长度。
在分配 IP 地址的同时,还有一个问题,因特网是美国人发明的(LCTT:这个万恶的资本主义国家占用了大量 IP 地址)。其他国家只得到了 IP 地址的碎片。我们需要重新定制一个架构,让连续的 IP 地址能在地理位置上集中分布,这样一来路由表可以做的更小(LCTT:想想吧,网速肯定更快)。
还有一个问题,这个问题你听起来可能还不大相信,就是 IPv4 配置起来比较困难,而且还不好改变。你可能不会碰到这个问题,因为你的路由器为你做了这些事情,不用你去操心。但是你的 ISP 对此一直是很头疼的。
下一代因特网需要考虑上述的所有问题。
### IPv6 和它的优点
**IETF** 在1995年12月公布了下一代 IP 地址标准,名字叫 IPv6,为什么不是 IPv5?→\_→ 因为某个错误原因,“版本5”这个编号被其他项目用去了。IPv6 的优点如下:
* 128位地址长度(共有3.402823669×10³⁸个地址)
* 其架构下的地址在逻辑上聚合
* 消息头长度固定
* 支持自动配置和修改你的网络。
我们一项一项地分析这些特点:
#### 地址
人们谈到 **IPv6** 时,第一件注意到的事情就是它的地址好多好多。为什么要这么多?因为设计者考虑到地址不能被充分利用起来,我们必须提供足够多的地址,让用户去挥霍,从而达到一些特殊目的。所以如果你想架设自己的 IPv6 网络,你的 ISP 可以给你分配拥有**64位**主机地址长度的网络(可以分配1.844674407×10¹⁹台主机),你想怎么玩就怎么玩。
#### 聚合
有这么多的地址,这些地址可以被稀稀拉拉地分配给主机,从而更高效地路由数据包。算一笔帐啊,你的 ISP 拿到一个**80位**地址长度的网络空间,其中16位是 ISP 的子网地址,剩下64位分给你作为主机地址。这样一来,你的 ISP 可以分配65,534个子网。
然而,这些地址分配不是一成不变地,如果 ISP 想拥有更多的小子网,完全可以做到(当然,土豪 ISP 可能会要求再来一个80位网络空间)。最高的48位地址是相互独立地,也就是说 ISP 与 ISP 之间虽然可能分到相同地80位网络空间,但是这两个空间是相互隔离的,好处就是一个网络空间里面的地址会聚合在一起。
#### 固定的消息头长度
**IPv4** 消息头长度可变,但 **IPv6** 消息头长度被固定为40字节。IPv4 会由于额外的参数导致消息头变长,IPv6 中,如果有额外参数,这些信息会被放到一个紧挨着消息头的地方,不会被路由器处理,当消息到达目的地时,这些额外参数会被软件提取出来。
IPv6 消息头有一个部分叫“flow”,是一个20位伪随机数,用于简化路由器对数据包的路由过程。如果一个数据包存在“flow”,路由器就可以根据这个值作为索引查找路由表,不必慢吞吞地遍历整张路由表来查询路由路径。这个优点使 **IPv6** 更容易被路由。
#### 自动配置
**IPv6** 中,当主机开机时,会检查本地网络,看看有没有其他主机使用了自己的 IP 地址。如果地址没有被使用,就接着查询本地的 IPv6 路由器,找到后就向它请求一个 IPv6 地址。然后这台主机就可以连上互联网了 —— 它有自己的 IP 地址,和自己的默认路由器。
如果这台默认路由器宕机,主机就会接着找其他路由器,作为备用路由器。这个功能在 IPv4 协议里实现起来非常困难。同样地,假如路由器想改变自己的地址,自己改掉就好了。主机会自动搜索路由器,并自动更新路由器地址。路由器会同时保存新老地址,直到所有主机都把自己地路由器地址更新成新地址。
IPv6 自动配置还不是一个完整地解决方案。想要有效地使用互联网,一台主机还需要另外的东西:域名服务器、时间同步服务器、或者还需要一台文件服务器。于是 **dhcp6** 出现了,提供与 dhcp 一样的服务,唯一的区别是 dhcp6 的机器可以在可路由的状态下启动,一个 dhcp 进程可以为大量网络提供服务。
#### 唯一的大问题
如果 IPv6 真的比 IPv4 好那么多,为什么它还没有被广泛使用起来(Google 在**2014年5月份**估计 IPv6 的市场占有率为**4%**)?一个最基本的原因是“先有鸡还是先有蛋”。服务商想让自己的服务器为尽可能多的客户提供服务,这就意味着他们必须部署一个 **IPv4** 地址。
当然,他们可以同时使用 IPv4 和 IPv6 两套地址,但很少有客户会用到 IPv6,并且你还需要对你的软件做一些小修改来适应 IPv6。另外比较头疼的一点是,很多家庭的路由器压根不支持 IPv6。还有就是 ISP 也不愿意支持 IPv6,我问过我的 ISP 这个问题,得到的回答是:只有客户明确指出要部署这个时,他们才会用 IPv6。然后我问了现在有多少人有这个需求,答案是:包括我在内,共有1个。
与这种现实状况呈明显对比的是,所有主流操作系统:Windows、OS X、Linux 都默认支持 IPv6 好多年了。这些操作系统甚至提供软件让 IPv6 的数据包披上 IPv4 的皮来骗过那些会丢弃 IPv6 数据包的主机,从而达到传输数据的目的。
### 总结
IPv4 已经为我们服务了好长时间。但是它的缺陷会在不远的将来遭遇不可克服的困难。IPv6 通过改变地址分配规则、简化数据包路由过程、简化首次加入网络时的配置过程等策略,可以完美解决这个问题。
问题是,大众在接受和使用 IPv6 的过程中进展缓慢,因为改变代价太大了。好消息是所有操作系统都支持 IPv6,所以当你有一天想做出改变,你的电脑只需要改变一点点东西,就能转到全新的架构体系中去。
---
via: <http://www.tecmint.com/ipv4-and-ipv6-comparison/>
作者:[Jeff Silverman](http://www.tecmint.com/author/jeffsilverm/) 译者:[bazz2](https://github.com/bazz2) 校对:[Mr小眼儿](https://github.com/tinyeyeser)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,609 | 想玩 BGP 路由器么?用 CentOS 做一个 | http://xmodulo.com/centos-bgp-router-quagga.html | 2015-01-07T15:45:00 | [
"BGP",
"路由器",
"Quagga"
] | https://linux.cn/article-4609-1.html | 在[之前的教程中](http://linux.cn/article-4232-1.html),我对如何简单地使用Quagga把CentOS系统变成一个不折不扣地OSPF路由器做了一些介绍。Quagga是一个开源路由软件套件。在这个教程中,我将会重点讲讲**如何把一个Linux系统变成一个BGP路由器,还是使用Quagga**,演示如何建立BGP与其它BGP路由器对等。
在我们进入细节之前,一些BGP的背景知识还是必要的。边界网关协议(即BGP)是互联网的域间路由协议的实际标准。在BGP术语中,全球互联网是由成千上万相关联的自治系统(AS)组成,其中每一个AS代表每一个特定运营商提供的一个网络管理域([据说](http://weibo.com/3181671860/BngyXxEUF),美国前总统乔治.布什都有自己的 AS 编号)。

为了使其网络在全球范围内路由可达,每一个AS需要知道如何在英特网中到达其它的AS。这时候就需要BGP出来扮演这个角色了。BGP是一个AS去与相邻的AS交换路由信息的语言。这些路由信息通常被称为BGP线路或者BGP前缀。包括AS号(ASN;全球唯一号码)以及相关的IP地址块。一旦所有的BGP线路被当地的BGP路由表学习和记录,每一个AS将会知道如何到达互联网的任何公网IP。
在不同域(AS)之间路由的能力是BGP被称为外部网关协议(EGP)或者域间协议的主要原因。就如一些路由协议,例如OSPF、IS-IS、RIP和EIGRP都是内部网关协议(IGPs)或者域内路由协议,用于处理一个域内的路由.
### 测试方案
在这个教程中,让我们来使用以下拓扑。

我们假设运营商A想要建立一个BGP来与运营商B对等交换路由。它们的AS号和IP地址空间的细节如下所示:
* **运营商 A**: ASN (100), IP地址空间 (100.100.0.0/22), 分配给BGP路由器eth1网卡的IP地址(100.100.1.1)
* **运营商 B**: ASN (200), IP地址空间 (200.200.0.0/22), 分配给BGP路由器eth1网卡的IP地址(200.200.1.1)
路由器A和路由器B使用100.100.0.0/30子网来连接到对方。从理论上来说,任何子网从运营商那里都是可达的、可互连的。在真实场景中,建议使用掩码为30位的公网IP地址空间来实现运营商A和运营商B之间的连通。
### 在 CentOS中安装Quagga
如果Quagga还没安装好,我们可以使用yum来安装Quagga。
```
# yum install quagga
```
如果你正在使用的是CentOS7系统,你需要应用一下策略来设置SELinux。否则,SElinux将会阻止Zebra守护进程写入它的配置目录。如果你正在使用的是CentOS6,你可以跳过这一步。
```
# setsebool -P zebra_write_config 1
```
Quagga软件套件包含几个守护进程,这些进程可以协同工作。关于BGP路由,我们将把重点放在建立以下2个守护进程。
* **Zebra**:一个核心守护进程用于内核接口和静态路由.
* **BGPd**:一个BGP守护进程.
### 配置日志记录
在Quagga被安装后,下一步就是配置Zebra来管理BGP路由器的网络接口。我们通过创建一个Zebra配置文件和启用日志记录来开始第一步。
```
# cp /usr/share/doc/quagga-XXXXX/zebra.conf.sample /etc/quagga/zebra.conf
```
在CentOS6系统中:
```
# service zebra start
# chkconfig zebra on
```
在CentOS7系统中:
```
# systemctl start zebra
# systemctl enable zebra
```
Quagga提供了一个叫做vtysh特有的命令行工具,你可以输入与路由器厂商(例如Cisco和Juniper)兼容和支持的命令。我们将使用vtysh shell来配置BGP路由在教程的其余部分。
启动vtysh shell 命令,输入:
```
# vtysh
```
提示将被改成该主机名,这表明你是在vtysh shell中。
```
Router-A#
```
现在我们将使用以下命令来为Zebra配置日志文件:
```
Router-A# configure terminal
Router-A(config)# log file /var/log/quagga/quagga.log
Router-A(config)# exit
```
永久保存Zebra配置:
```
Router-A# write
```
在路由器B操作同样的步骤。
### 配置对等的IP地址
下一步,我们将在可用的接口上配置对等的IP地址。
```
Router-A# show interface #显示接口信息
```
---
```
Interface eth0 is up, line protocol detection is disabled
. . . . .
Interface eth1 is up, line protocol detection is disabled
. . . . .
```
配置eth0接口的参数:
```
site-A-RTR# configure terminal
site-A-RTR(config)# interface eth0
site-A-RTR(config-if)# ip address 100.100.0.1/30
site-A-RTR(config-if)# description "to Router-B"
site-A-RTR(config-if)# no shutdown
site-A-RTR(config-if)# exit
```
继续配置eth1接口的参数:
```
site-A-RTR(config)# interface eth1
site-A-RTR(config-if)# ip address 100.100.1.1/24
site-A-RTR(config-if)# description "test ip from provider A network"
site-A-RTR(config-if)# no shutdown
site-A-RTR(config-if)# exit
```
现在确认配置:
```
Router-A# show interface
```
---
```
Interface eth0 is up, line protocol detection is disabled
Description: "to Router-B"
inet 100.100.0.1/30 broadcast 100.100.0.3
Interface eth1 is up, line protocol detection is disabled
Description: "test ip from provider A network"
inet 100.100.1.1/24 broadcast 100.100.1.255
```
---
```
Router-A# show interface description #显示接口描述
```
---
```
Interface Status Protocol Description
eth0 up unknown "to Router-B"
eth1 up unknown "test ip from provider A network"
```
如果一切看起来正常,别忘记保存配置。
```
Router-A# write
```
同样地,在路由器B重复一次配置。
在我们继续下一步之前,确认下彼此的IP是可以ping通的。
```
Router-A# ping 100.100.0.2
```
---
```
PING 100.100.0.2 (100.100.0.2) 56(84) bytes of data.
64 bytes from 100.100.0.2: icmp_seq=1 ttl=64 time=0.616 ms
```
下一步,我们将继续配置BGP对等和前缀设置。
### 配置BGP对等
Quagga守护进程负责BGP的服务叫bgpd。首先我们来准备它的配置文件。
```
# cp /usr/share/doc/quagga-XXXXXXX/bgpd.conf.sample /etc/quagga/bgpd.conf
```
在CentOS6系统中:
```
# service bgpd start
# chkconfig bgpd on
```
在CentOS7中:
```
# systemctl start bgpd
# systemctl enable bgpd
```
现在,让我们来进入Quagga 的shell。
```
# vtysh
```
第一步,我们要确认当前没有已经配置的BGP会话。在一些版本,我们可能会发现一个AS号为7675的BGP会话。由于我们不需要这个会话,所以把它移除。
```
Router-A# show running-config
```
---
```
... ... ...
router bgp 7675
bgp router-id 200.200.1.1
... ... ...
```
我们将移除一些预先配置好的BGP会话,并建立我们所需的会话取而代之。
```
Router-A# configure terminal
Router-A(config)# no router bgp 7675
Router-A(config)# router bgp 100
Router-A(config)# no auto-summary
Router-A(config)# no synchronizaiton
Router-A(config-router)# neighbor 100.100.0.2 remote-as 200
Router-A(config-router)# neighbor 100.100.0.2 description "provider B"
Router-A(config-router)# exit
Router-A(config)# exit
Router-A# write
```
路由器B将用同样的方式来进行配置,以下配置提供作为参考。
```
Router-B# configure terminal
Router-B(config)# no router bgp 7675
Router-B(config)# router bgp 200
Router-B(config)# no auto-summary
Router-B(config)# no synchronizaiton
Router-B(config-router)# neighbor 100.100.0.1 remote-as 100
Router-B(config-router)# neighbor 100.100.0.1 description "provider A"
Router-B(config-router)# exit
Router-B(config)# exit
Router-B# write
```
当相关的路由器都被配置好,两台路由器之间的对等将被建立。现在让我们通过运行下面的命令来确认:
```
Router-A# show ip bgp summary
```

从输出中,我们可以看到"State/PfxRcd"部分。如果对等关闭,输出将会显示"Idle"或者"Active'。请记住,单词'Active'这个词在路由器中总是不好的意思。它意味着路由器正在积极地寻找邻居、前缀或者路由。当对等是up状态,"State/PfxRcd"下的输出状态将会从特殊邻居接收到前缀号。
在这个例子的输出中,BGP对等只是在AS100和AS200之间呈up状态。因此没有前缀被更改,所以最右边列的数值是0。
### 配置前缀通告
正如一开始提到,AS 100将以100.100.0.0/22作为通告,在我们的例子中AS 200将同样以200.200.0.0/22作为通告。这些前缀需要被添加到BGP配置如下。
在路由器-A中:
```
Router-A# configure terminal
Router-A(config)# router bgp 100
Router-A(config)# network 100.100.0.0/22
Router-A(config)# exit
Router-A# write
```
在路由器-B中:
```
Router-B# configure terminal
Router-B(config)# router bgp 200
Router-B(config)# network 200.200.0.0/22
Router-B(config)# exit
Router-B# write
```
在这一点上,两个路由器会根据需要开始通告前缀。
### 测试前缀通告
首先,让我们来确认前缀的数量是否被改变了。
```
Router-A# show ip bgp summary
```

为了查看所接收的更多前缀细节,我们可以使用以下命令,这个命令用于显示邻居100.100.0.2所接收到的前缀总数。
```
Router-A# show ip bgp neighbors 100.100.0.2 advertised-routes
```

查看哪一个前缀是我们从邻居接收到的:
```
Router-A# show ip bgp neighbors 100.100.0.2 routes
```

我们也可以查看所有的BGP路由器:
```
Router-A# show ip bgp
```

以上的命令都可以被用于检查哪个路由器通过BGP在路由器表中被学习到。
```
Router-A# show ip route
```
---
```
代码: K - 内核路由, C - 已链接 , S - 静态 , R - 路由信息协议 , O - 开放式最短路径优先协议,
I - 中间系统到中间系统的路由选择协议, B - 边界网关协议, > - 选择路由, * - FIB 路由
C>* 100.100.0.0/30 is directly connected, eth0
C>* 100.100.1.0/24 is directly connected, eth1
B>* 200.200.0.0/22 [20/0] via 100.100.0.2, eth0, 00:06:45
```
---
```
Router-A# show ip route bgp
```
---
```
B>* 200.200.0.0/22 [20/0] via 100.100.0.2, eth0, 00:08:13
```
BGP学习到的路由也将会在Linux路由表中出现。
```
[root@Router-A~]# ip route
```
---
```
100.100.0.0/30 dev eth0 proto kernel scope link src 100.100.0.1
100.100.1.0/24 dev eth1 proto kernel scope link src 100.100.1.1
200.200.0.0/22 via 100.100.0.2 dev eth0 proto zebra
```
最后,我们将使用ping命令来测试连通。结果将成功ping通。
```
[root@Router-A~]# ping 200.200.1.1 -c 2
```
总而言之,本教程将重点放在如何在CentOS系统中运行一个基本的BGP路由器。这个教程让你开始学习BGP的配置,一些更高级的设置例如设置过滤器、BGP属性调整、本地优先级和预先路径准备等,我将会在后续的教程中覆盖这些主题。
希望这篇教程能给大家一些帮助。
---
via: <http://xmodulo.com/centos-bgp-router-quagga.html>
作者:[Sarmed Rahman](http://xmodulo.com/author/sarmed) 译者:[disylee](https://github.com/disylee) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,621 | 没错,Linux是感染了木马!但,这并非企鹅的末日 | http://www.omgubuntu.co.uk/2014/12/government-spying-turla-linux-trojan-found | 2015-01-09T07:11:00 | [
"Turla",
"木马"
] | https://linux.cn/article-4621-1.html | 
译注:原文标题中Tuxpocalypse是作者造的词,由Tux和apocalypse组合而来。Tux是Linux的LOGO中那只企鹅的名字,apocalypse意为末世、大灾变,这里翻译成企鹅的末日。
你被监视了吗?
带上一箱罐头,挖一个深坑碉堡,准备进入一个完全不同的新世界吧:[一个强大的木马已经在Linux中被发现](https://securelist.com/blog/research/67962/the-penquin-turla-2/)。
没错,迄今为止最牢不可破的计算机世外桃源已经被攻破了,安全专家们都已成惊弓之鸟。
关掉电脑,拔掉键盘,然后再买只猫(忘掉YouTube吧)。企鹅末日已经降临,我们的日子不多了。
我去?这是真的吗?依我看,不一定吧~
### 一次可怕的异常事件!
先声明,**我并没有刻意轻视此次威胁(人们给这个木马起名为‘Turla’)的严重性**,为了避免质疑,我要强调的是,作为Linux用户,我们不应该为此次事件过分担心。
此次发现的木马能够在人们毫无察觉的情况下感染Linux系统,这是非常可怕的。事实上,它的主要工作是搜寻并向外发送各种类型的敏感信息,这一点同样令人感到恐惧。据了解,它已经存在至少4年时间,而且无需root权限就能完成这些工作。呃,这是要把人吓尿的节奏吗?
But - 但是 - 新闻稿里常常这个时候该出现‘but’了 - 要说恐慌正在横扫桌面Linux的粉丝,那就有点断章取义、甚至不着边际了。
对我们中的有些人来说,计算机安全隐患的确是一种新鲜事物,然而我们应该对其审慎对待:对桌面用户来说,Linux仍然是一个天生安全的操作系统。一次瑕疵不应该否定它的一切,我们没有必要慌忙地割断网线。
### 国家资助,目标政府

企鹅和蛇的组合该叫‘企蛇’还是‘蛇鹅’?
‘Turla’木马是一个复杂、高级的持续威胁,四年多来,它以政府、大使馆以及制药公司的系统为目标,其使用的攻击方式所基于的代码[至少在14年前](https://twitter.com/joernchen/status/542060412188262400)就已存在了。
在Windows系统中,安全研究领域来自赛门铁克和卡巴斯基实验室的超级英雄们首先发现了这条黏黏的蛇,他们发现Turla及其组件已经**感染了45个国家的数百台个人电脑**,其中许多都是通过未打补丁的0day漏洞感染的。
*微软,干得漂亮。*
经过卡巴斯基实验室的进一步努力,他们发现,同样的木马出现在了Linux上。
这款木马无需高权限就可以“拦截传入的数据包,在系统中执行传入的命令”,但是它的触角到底有多深,有多少Linux系统被感染,它的完整功能都有哪些,这些目前都暂时还不明朗。
根据它选定的目标,我们推断“Turla”(及其变种)是由某些民族的国家资助的。美国和英国的读者不要想当然以为这些国家就是“那些国家”。不要忘了我们自己的政府也很乐于趟这摊浑水。
### 观点 与 责任
这次的发现从情感上、技术上、伦理上,都是一次严重的失利,但它远没有达到说我们已经进入一个病毒和恶意软件针对桌面自由肆虐的时代。
**Turla 并不是那种用户关注的“我想要你的信用卡”病毒**,那些病毒往往绑定在一个伪造的软件下载链接中。Turla是一种复杂的、经过巧妙处理的、具有高度适应性的威胁,它时刻都具有着特定的目标(因此它绝不仅仅满足于搜集一些卖萌少女的网站账户密码,sorry 绿茶婊们!)。
卡巴斯基实验室是这样介绍的:
>
> “Linux上的Turla模块是一个链接多个静态库的C/C++可执行文件,这大大增加了它的文件体积。但它并没有着重减小自身的文件体积,而是剥离了自身的符号信息,这样就增加了对它逆向分析的难度。它的功能主要包括隐藏网络通信、远程执行任意命令以及远程管理等等。它的大部分代码都基于公开源码。”
>
>
>
不管它的影响和感染率如何,它的技术优势都将不断给那些号称聪明的专家们留下一个又一个问题,就让他们花费大把时间去追踪、分析、解决这些问题吧。
我不是一个计算机安全专家,但我是一个理智的网络脑残粉,要我说,这次事件应该被看做是一个通(jing)报(gao),而并非有些网站所标榜的洪(shi)水(jie)猛(mo)兽(ri)。
在更多细节披露之前,我们都不必恐慌。只需继续计算机领域的安全实践,避免从不信任的网站或PPA源下载运行脚本、app或二进制文件,更不要冒险进入web网络的黑暗领域。
如果你仍然十分担心,你可以前往[卡巴斯基的博客](https://securelist.com/blog/research/67962/the-penquin-turla-2/)查看更多细节,以确定自己是否感染。
---
via: <http://www.omgubuntu.co.uk/2014/12/government-spying-turla-linux-trojan-found>
作者:[Joey-Elijah Sneddon](https://plus.google.com/117485690627814051450/?rel=author) 译者:[Mr小眼儿](http://blog.csdn.net/tinyeyeser) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,622 | 美国海军陆战队要把雷达操作系统从Windows XP换成Linux | http://news.softpedia.com/news/U-S-Marine-Corps-Want-to-Change-OS-for-Radar-System-from-Windows-XP-to-Linux-466756.shtml | 2015-01-09T07:40:00 | [
"操作系统",
"Linux",
"雷达"
] | https://linux.cn/article-4622-1.html | **一个新的雷达系统已经被送回去升级了**






>
> 一谈到稳定性和性能,没什么能真的比得过Linux。这就是为什么美国海军陆战队的领导们已经决定让Northrop Grumman Corp. Electronic Systems把新送到的地面/空中任务导向雷达(G/ATOR)的操作系统从Windows XP换成Linux。
>
>
>
地面/空中任务导向雷达(G/ATOR)系统已经研制了很多年。很可能在这项工程启动的时候Windows XP被认为是合理的选择。但在研制的这段时间,事情发生了变化。微软已经撤销了对Windows XP的支持而且只有极少的几个组织会使用它。操作系统要么升级要么被换掉。在这种情况下,Linux成了合理的选择。特别是当替换的费用很可能远远少于更新的费用。
有个很有趣的地方值得注意一下。地面/空中任务导向雷达(G/ATOR)才刚刚送到美国海军陆战队,但是制造它的公司却还是选择了保留这个过时的操作系统。一定有人注意到的这样一个事实。这是一个糟糕的决定,并且指挥系统已经被告知了可能出现的问题了。
### G/ATOR雷达的软件将是基于Linux的
Unix类系统,比如基于BSD或者基于Linux的操作系统,通常会出现在条件苛刻的领域,或者任何情况下都不允许失败的的技术中。例如,这就是为什么大多数的服务器都运行着Linux。一个雷达系统配上一个几乎不可能崩溃的操作系统看起来非常相配。
“弗吉尼亚州Quantico海军基地海军陆战队系统司令部的官员,在周三宣布了一项与Northrop Grumman Corp. Electronic Systems在林西科姆高地的部分的总经理签订的价值1020万美元的修正合同。这个合同的修改将包括这样一项,把G/ATOR的控制电脑从微软的Windows XP操作系统换成与国防信息局(DISA)兼容的Linux操作系统。”
‘G/ATOR是一个远征三维中短距离多用途雷达系统。这个系统被设计成能够探测拥有低雷达截面的低可观测目标,比如火箭弹,火炮,迫击炮,巡航导弹以及无人机。”这些内容可以在[militaryaerospace.com](http://www.militaryaerospace.com/articles/2014/12/gator-linux-software.html)看到。
这项军用科技,即地面/空中任务导向雷达(G/ATOR),早在2005年就与Northrop Grumman签订了第一次合同。所以不难理解为什么美国海军可能想把这件事快点弄完。这次更换的时间限制还没有被提议。
视频链接:<http://youtu.be/H2ppl4x-eu8>
---
via: <http://news.softpedia.com/news/U-S-Marine-Corps-Want-to-Change-OS-for-Radar-System-from-Windows-XP-to-Linux-466756.shtml>
作者:[Silviu Stahie](http://news.softpedia.com/editors/browse/silviu-stahie) 译者:[H-mudcup](https://github.com/H-mudcup) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,623 | Linux 和类 Unix 系统上5个最佳开源备份工具 | http://www.cyberciti.biz/open-source/awesome-backup-software-for-linux-unix-osx-windows-systems/ | 2015-01-09T08:03:00 | [
"备份"
] | https://linux.cn/article-4623-1.html | 一个好的备份最基本的目的就是为了能够从一些错误中恢复:
* 人为的失误
* 磁盘阵列或是硬盘故障
* 文件系统崩溃
* 数据中心被破坏等等。
所以,我为大家罗列了一些开源的软件备份工具。

### 当为一个企业选择备份工具的时候,你都考虑什么呢?
确定你正在部署的软件具有下面的特性
1. **开源软件** - 你务必要选择那些源码可以免费获得,并且可以修改的软件。确信可以恢复你的数据,即使是软件供应商/项目停止继续维护这个软件,或者是拒绝继续为这个软件提供补丁。
2. **跨平台支持** - 确定备份软件可以很好的运行各种需要部署的桌面操作系统和服务器系统。
3. **数据格式** - 一种开放的数据格式可以让你能够恢复数据,即使是供应商或是项目停止对软件的支持。
4. **自动转换** - 自动转换本来是没什么,除了对于各种备份设备,包括图书馆,近线存储和自动加载,自动转换可以自动完成一些任务,包括加载,挂载和标签备份像磁带这些媒体设备。
5. **备份介质** - 确定你可以备份到磁带,硬盘,DVD 和像 AWS 这样的云存储。
6. **加密数据流** - 确定所有客户端到服务器的传输都被加密,保证在 LAN/WAN/Internet 中传输的安全性。
7. **数据库支持** - 确定备份软件可以备份到数据库,像MySQL 或是 Oracle。
8. **备份可以跨越多个卷** - 备份软件(转储文件时)可以把每个备份文件分成几个部分,允许将每个部分存在于不同的卷。这样可以保证一些数据量很大的备份(像100TB的文件)可以被存储在一些单个容量较小的设备中,比如说像硬盘和磁盘卷。
9. **VSS (卷影复制)** - 这是[微软的卷影复制服务(VSS)](http://technet.microsoft.com/en-us/library/cc785914(v=ws.10).aspx),通过创建数据的快照来备份。确定备份软件支持VSS的MS-Windows 客户端/服务器。
10. **重复数据删除** - 这是一种数据压缩技术,用来消除重复数据的副本(比如,图片)。
11. **许可证和成本** - 确定你对备份软件所用的[许可证了解和明白其使用方式](http://opensource.org/licenses)。
12. **商业支持** - 开源软件可以提供社区支持(像邮件列表和论坛)和专业的支持(如发行版提供额外的付费支持)。你可以使用付费的专业支持为你提供培训和咨询。
13. **报告和警告** - 最后,你必须能够看到备份的报告,当前的工作状态,也能够在备份出错的时候提供警告。
### Bacula - 一个应用于多元化异构网络的客户端服务器备份工具
我个人应用这个软件来管理备份和通过网络来恢复系统,包括Linux, OSX, 和Windows。你可以通过CLI, GUI, 或者Web界面来配置Bacula。

* 操作系统:支持跨平台运行。
* 备份级别:完全,差异,增量,合并。
* 数据格式:支持自定义且完全开放。
* 自动转换:支持。
* 备份介质:支持磁带,磁盘和DVD。
* 加密数据流:支持。
* 数据库:支持MSSQL、PostgreSQL、Oracle 。
* 跨卷备份:支持
* VSS(卷影复制):支持。
* 许可:Affero General Public License v3.0。
* 下载链接:[bacula.org](http://www.bacula.org/)
### Amanda - 又一个客户端服务器备份工具
AMANDA 是 Advanced Maryland Automatic Network Disk Archiver 的缩写。它允许系统管理员创建一个单独的备份服务器来将网络上的其他主机的数据备份到磁带驱动器、硬盘或者是自动换盘器。
* 操作系统:支持跨平台运行。
* 备份级别:完全,差异,增量,合并。
* 数据格式:开放(可以通过tar等工具恢复)。
* 自动转换:支持。
* 备份介质:支持磁带,磁盘和DVD。
* 加密数据流:支持。
* 数据库:支持MSSQL, Oracle。
* 跨卷备份:支持。
* VSS(卷影复制):支持。
* 许可:GPL, LGPL, Apache, Amanda License。
* 下载链接:[amanda.org](http://www.amanda.org/)
### Backupninja - 轻量级备份系统
Backupninja 是一个简单易用的备份系统。你可以简单的拖放一个配置文件到 /etc/backup.d/ 目录来备份到多个主机。

* 操作系统:支持Linux,Unix。
* 备份级别:支持完全,差异备份(rsync + hard 链接)
* 数据格式:开放
* 自动转换:N/A。(注:N/A = Not Applicable)。
* 备份介质:磁盘,DVD,CD,ISO 镜像。
* 加密数据流:支持(ssh)和[通过duplicity远程加密备份](http://www.cyberciti.biz/faq/duplicity-installation-configuration-on-debian-ubuntu-linux/)。
* 数据库:支持MySQL,PostgreSQL,OpenLDAP 和subversion 或trac。
* 跨卷备份:??
* VSS(卷影复制):??
* 许可:GPL
* 下载链接:[riseup.net](https://labs.riseup.net/code/projects/backupninja)
### Backuppc - 高效的客户端服务器备份工具
Backuppc 可以用来备份基于Linux 和Windows 系统的主服务器硬盘。它配备了一个巧妙的池计划来最大限度的减少磁盘储存、磁盘 I/O 和网络I/O。

* 操作系统:支持Linux,Unix 和Windows。
* 备份级别:支持完全和增量备份(rsync +hard 链接和pooling 计划)
* 数据格式:开放。
* 自动转换:N/A。
* 备份介质:磁盘和磁盘阵列。
* 加密数据流:支持。
* 数据库:支持(通过Shell 脚本)
* 跨卷备份:??
* VSS(卷影复制):??
* 许可:GPL。
* 下载链接:[backuppc.sourceforge.net](http://backuppc.sourceforge.net/)
### UrBackup - 最容易配置的客户端服务器系统
UrBackup 是一个非常容易配置的开源客户端服务器备份系统,通过镜像 方式和文件备份的组合完成了数据安全性和快速的恢复。磁盘卷备份可以使用可引导 CD 或U盘,通过Web界面或Windows资源管理器来恢复你的文件(硬恢复)。一个 Web 界面使得配置你自己的备份服务变得非常简单。

* 操作系统:支持Linux,FreeBSD,Unix,Windows 和少数基于NAS 的Linux操作系统,客户端只支持Linux 和Windows 操作系统。
* 备份级别:支持完全和增量备份。
* 数据格式:开放。
* 自动转换:N/A。
* 备份介质:磁盘,磁盘阵列和DVD。
* 加密数据流:支持。
* 数据库:??
* 跨卷备份:??
* VSS(卷影复制):??
* 许可:GPL v3+
* 下载链接:[urbackup.org](http://www.urbackup.org/)
### 其他供你考虑的一些极好用的开源备份软件
Amanda,Bacula 和上面所提到的这些软件功能都很丰富,但是对于一些小的网络或者是单独的服务器来说配置比较复杂。我建议你学习和使用一下的下面这些备份软件:
1. [Rsnapshot](http://www.rsnapshot.org/) - 我建议用这个作为对本地和远程的文件系统快照工具。看看[在Debian 和Ubuntu linux](http://www.cyberciti.biz/faq/linux-rsnapshot-backup-howto/)和[基于CentOS,RHEL 的操作系统](http://www.cyberciti.biz/faq/redhat-cetos-linux-remote-backup-snapshot-server/)怎么设置和使用这个工具。
2. [rdiff-backup](http://www.nongnu.org/rdiff-backup/) - 另一个好用的类Unix 远程增量备份工具。
3. [Burp](http://burp.grke.org/) - Burp 是一个网络备份和恢复程序。它使用了librsync来节省网络流量和节省每个备份占用的空间。它也使用了VSS(卷影复制服务),在备份Windows计算机时进行快照。
4. [Duplicity](http://www.cyberciti.biz/open-source/awesome-backup-software-for-linux-unix-osx-windows-systems/) - 伟大的加密和高效的备份类Unix操作系统。查看如何[安装Duplicity来加密云备份](http://www.cyberciti.biz/faq/duplicity-installation-configuration-on-debian-ubuntu-linux/)来获取更多的信息。
5. [SafeKeep](http://safekeep.sourceforge.net/) - SafeKeep是一个中心化的、易于使用的备份应用程序,结合了镜像和增量备份最佳功能的备份应用程序。
6. [DREBS](https://github.com/dojo4/drebs) - DREBS 是EBS定期快照的工具。它被设计成在EBS快照所连接的EC2主机上运行。
7. 古老的unix 程序,像rsync, tar, cpio, mt 和dump。
### 结论
我希望你会发现这篇有用的文章来备份你的数据。不要忘了验证你的备份和创建多个数据备份。注意,磁盘阵列并不是一个备份解决方案!使用任何一个上面提到的程序来备份你的服务器、桌面和笔记本电脑和私人的移动设备。如果你知道其他任何开源的备份软件我没有提到的,请分享在评论里。
---
via: <http://www.cyberciti.biz/open-source/awesome-backup-software-for-linux-unix-osx-windows-systems/>
作者:[nixCraft](http://www.cyberciti.biz/tips/about-us) 译者:[barney-ro](https://github.com/barney-ro) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,624 | Apple Watch之后,下一个智能手表会是Ubuntu吗? | http://www.omgubuntu.co.uk/2014/09/ubuntu-smartwatch-apple-iwatch | 2015-01-09T09:21:26 | [
"苹果",
"Ubuntu",
"智能手表"
] | https://linux.cn/article-4624-1.html | **苹果借助‘Apple Watch’的发布,证实了其进军穿戴式电子设备市场的长期传言**

Ubuntu智能手表 - 好主意?
拥有一系列稳定功能、硬件解决方案和应用合作伙伴关系的支持,手腕穿戴设备被许多公司预示为“人与技术关系的新篇章”。
它的到来,以及用户兴趣的提升,有可能意味着Ubuntu需要跟进一个为智能手表定制的Ubuntu版本。
### 大的方面还是成功的
苹果在正确的时间加入了快速发展的智能手表行列。手腕穿戴设备功能的界限并不是一成不变。失败的设计、简陋的用户界面以及主流用户使用穿戴技术功能的弱定制化,这些都见证了硬件类产品仍然很脆弱 - 这一因素使得Cupertino把时间花费在Apple Watch上。
>
> ‘分析师说:超过2200万的智能手表将在今年销售’
>
>
>
去年全球范围内可穿戴设备的销售数量(包括健身追踪器)仅仅1000万。今年,分析师希望设备的销量可以超过2200万 - 不包括苹果手表,因为其直到2015年初才开始零售。
其实,我们很容易就可以看出增长的来源。今年九月初柏林举办的IFA 2014展览会,展示了一系列来自主要制造商们的可穿戴设备,包括索尼和华硕。大多数搭载着Google最新发布的安卓穿戴平台。
更成熟的一个表现是:安卓穿戴设备打破了与形式因素保持一致的新奇争论,进而呈现出一致且令人信服的用户方案。和新的苹果手表一样,它紧密地连接在一个现存的智能手机生态系统上。
但Ubuntu手腕穿戴系统是否能与之匹配,成为一个实用案例,目前还不清楚。
#### 目前还没有Ubuntu智能手表的计划
Ubuntu操作系统的通用性将多种设备的严格标准与统一的未来目标联合在一起,Canonical已经将目标指向了智能电视,平板电脑和智能手机。公司自家的显示服务Mir,甚至被用来为所有尺寸的屏幕提供驱动接口(虽然不是公认1.5"的)。
今年年初,Canonical社区负责人Jono Bacon被问到是否有制作Ubuntu智能手表的打算。Bacon提供了他对这个问题的看法:“为[Ubuntu触摸设备]路线增加额外的形式因素只会减缓现有的进度”。
在Ubuntu手机发布两周年之际,我们还是挺赞同他的想法的。
### 除了A面还有B面!
但是并不是没有希望的。在[几个月之后的一次电话采访](http://www.omgubuntu.co.uk/2014/03/ubuntu-tablets-coming-year)中,Ubuntu创始人Mark Shuttleworth提到,可穿戴技术和智能电视、平板电脑、智能手机一样,都在公司计划当中。
>
> “Ubuntu因其在电话中的完美设计变得独一无二,但同时它的设计也能够满足其他生态系统,从穿戴设备到PC机。”
>
>
>
然而这还没得到具体的证实,它更像一个指针,在某个方向给我们提供一个乐观的指引。
#### 不大可能 — 但这就是原因所在
Canonical并不反对利用牢固的专利进军市场。事实上,它恰恰是公司DNA基因的一部分 — 犹如服务器端的RHEL,桌面端的Windows,智能手机上的安卓...
设备上的Ubuntu系统被制作成可以在更小的屏幕上扩展和适配运行,甚至在小如手表一样的屏幕上。当普通的代码基础已经在手机、平板电脑、桌面和TV上准备就绪,在同样的方向上,如果看不到社区的努力是十分令人吃惊的。
但是我之所以不认为它会从Canonical发生,至少目前还没有,是基于今年早些时候Jono Bacon的个人思想得出的结论:时间和努力。
Tim Cook在他的主题演讲中说道:“*我们并没有追随iPhone,也没有缩水用户界面,将其强硬捆绑在你的手腕上。*”这是一个很明显的陈述。为如此小的屏幕设计UI和UX模型、通过交互原则工作、对硬件和输入模式的推崇,这些都不是容易的事。
可穿戴技术仍然是一个新兴的市场。在这个阶段,Canonical可能会在探寻的过程中浪费一些发展、设计和商业上的机会。如果在一些更为紧迫的领域落后了,造成的后果远比眼前利益的损失更严重。
打一场持久战,耐心等待,看哪些努力成功哪些会失败,这是一条更难的路线,但是却更适合Ubuntu,就如同今天它做的一样。在新产品出现之前,Canonical把力量用在现存的产品上是更好的选择(这是一些已经来迟的理论)
想更进一步了解什么是Ubuntu智能手表,点击下面的[视频](https://www.youtube.com/embed/8Zf5dktXzEs?feature=oembed),里面展示了一个交互的Unity主题皮肤Tizen(它已经支持Samsung Galaxy Gear智能手表)。
---
via: <http://www.omgubuntu.co.uk/2014/09/ubuntu-smartwatch-apple-iwatch>
作者:[Joey-Elijah Sneddon](https://plus.google.com/117485690627814051450/?rel=author) 译者:[su-kaiyao](https://github.com/su-kaiyao) 校对:[Mr小眼儿](https://github.com/tinyeyeser)
本文由[LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,625 | Linux有问必答:如何在Linux上安装内核头文件 | http://ask.xmodulo.com/install-kernel-headers-linux.html | 2015-01-09T12:24:00 | [
"内核",
"编译",
"头文件"
] | /article-4625-1.html |
>
> **提问**:我在安装一个设备驱动前先要安装内核头文件。怎样安装合适的内核头文件?
>
>
>
当你在编译一个设备驱动模块时,你需要在系统中安装内核头文件。内核头文件同样在你编译与内核直接链接的用户空间程序时需要。当你在这些情况下安装内核头文件时,你必须确保内核头文件精确地与你当前内核版本匹配(比如:3.13.0-24-generic)。

如果你的内核是发行版自带的内核版本,或者使用默认的包管理器的基础仓库升级的(比如:apt-ger、aptitude或者yum),你也可以使用包管理器来安装内核头文件。另一方面,如果下载的是[kernel源码](https://www.kernel.org/pub/linux/kernel/)并且手动编译的,你可以使用[make命令](https://www.kernel.org/doc/Documentation/kbuild/headers_install.txt)来安装匹配的内核头文件。
现在我们假设你的内核是发行版自带的,让我们看下该如何安装匹配的头文件。
### 在 Debian、Ubuntu 或者 Linux Mint 上安装内核头文件
假设你没有手动编译内核,你可以使用apt-get命令来安装匹配的内核头文件。
首先,使用dpkg-query命令检查是否有可用的内核头文件。
```
$ dpkg-query -s linux-headers-$(uname -r)
```
---
```
dpkg-query: package 'linux-headers-3.11.0-26-generic' is not installed and no information is available
```
接着使用下面的命令安装匹配的内核头文件。
```
$ sudo apt-get install linux-headers-$(uname -r)
```

验证头文件是否成功安装。
```
$ dpkg-query -s linux-headers-$(uname -r)
```
---
```
Package: linux-headers-3.11.0-26-generic
Status: install ok installed
```
Debian、Ubuntu、Linux Mint默认头文件在**/usr/src**下。
### 在 Fedora、CentOS 或者 RHEL 上安装内核头文件
假设你没有手动编译内核,你可以使用yum命令来安装匹配的内核头文件。
首先,用下面的命令检查系统是否已经安装了头文件。如果下面的命令没有任何输出,这就意味着还没有头文件。
```
$ rpm -qa | grep kernel-headers-$(uname -r)
```
接着用yum命令安装头文件。这个命令会自动找出合适的头文件并安装。
```
$ sudo yum install kernel-headers
```

验证包安装的状态。
```
$ rpm -qa | grep kernel-headers-$(uname -r)
```
---
```
kernel-headers-3.10.0-123.9.3.el7.x86_64
```
Fedora、CentOS 或者 RHEL上默认内核头文件的位置是**/usr/include/linux**。
---
via: <http://ask.xmodulo.com/install-kernel-headers-linux.html>
译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /install-kernel-headers-linux.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275c4310>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)")) | null |
4,642 | ChromeOS 对战 Linux : 孰优孰劣,仁者见仁,智者见智 | http://www.datamation.com/open-source/chromeos-vs-linux-the-good-the-bad-and-the-ugly-1.html | 2015-01-12T10:58:00 | [
"ChromeOS",
"Linux"
] | https://linux.cn/article-4642-1.html |
>
> 在 ChromeOS 和 Linux 的斗争过程中,两个桌面环境都有强有弱,这两者到底怎样呢?
>
>
>
只要稍加留意,任何人都会相信,Google 在桌面领域绝不是“玩玩而已”。在近几年,我们见到的 [ChromeOS](http://en.wikipedia.org/wiki/Chrome_OS) 制造的 [Google Chromebook](http://www.google.com/chrome/devices/features/) 相当的轰动。和同期人气火爆的 Amazon 一样,ChromeOS 似乎势不可挡。
在本文中,我们要了解的是 ChromeOS 的概念市场,ChromeOS 怎么影响着Linux 的份额,整个 ChromeOS 对于Linux 社区来说,是好事还是坏事。另外,我将会谈到一些重大问题,以及为什么没人针对这些问题做点什么。

### ChromeOS 并非真正的Linux
每当有朋友问我说 ChromeOS 是否是 Linux 的一个发行版时,我都会这样回答:ChromeOS 之于 Linux 就如同 OS X 之于 BSD。换句话说,我认为,ChromeOS 是 Linux 的一个派生操作系统,运行于 Linux 内核的引擎之下。而这个操作系统的大部分由 Google 的专利代码及软件组成。
尽管 ChromeOS 是利用了 Linux 的内核引擎,但是和现在流行的 Linux 分支版本相比,它仍然有很大的不同。
其实,ChromeOS 的差异化越来越明显的原因,是在于它给终端用户提供的包括 Web 应用在内的 app。因为ChromeOS 的每一个操作都是开始于浏览器窗口,这对于 Linux 用户来说,可能会有很多不一样的感受,但是,对于没有 Linux 经验的用户来说,这与他们使用的旧电脑并没有什么不同。
比方说,每一个以“依赖 Google 产品”为生活方式的人来说,在 ChromeOS 上的感觉将会非常良好,就好像是回家一样,特别是这个人已经接受了 Chrome 浏览器、Google Drive 云存储和Gmail 的话。久而久之,他们使用ChromeOS 也就是很自然的事情了,因为他们很容易接受使用早已习惯的 Chrome 浏览器。
然而,对于 Linux 爱好者来说,这样的约束就立即带来了不适应。因为软件的选择是被限制、被禁锢的,再加上要想玩游戏和 VoIP 是完全不可能的。对不起,因为 [GooglePlus Hangouts](https://plus.google.com/hangouts) 是代替不了VoIP 软件的。甚至这种情况将持续很长一段时间。
### ChromeOS 还是 Linux 桌面
有人断言,ChromeOS 要是想在桌面系统的浪潮中对 Linux 产生影响,只有在 Linux 停下来浮出水面喘气的时候,或者是满足某个非技术用户的时候。
是的,桌面 Linux 对于大多数休闲型的用户来说绝对是一个好东西。然而,它必须有专人帮助你安装操作系统,并且提供“维修”服务,就如同我们在 Windows 和 OS X 阵营看到的一样。但是,令人失望的是,在美国, Linux 恰恰在这个方面很缺乏。所以,我们看到,ChromeOS 正慢慢的走入我们的视线。
我发现 Linux 桌面系统最适合那些能够提供在线技术支持的环境中。比如说:可以在家里操作和处理更新的高级用户、政府和学校的 IT 部门等等。这些环境中,Linux 桌面系统可以被配置给任何技能水平和背景的人使用。
相比之下,ChromeOS 是建立在完全免维护的初衷之下的,因此,不需要第三者的帮忙,你只需要允许更新,然后让他静默完成即可。这在一定程度上可能是由于 ChromeOS 是为某些特定的硬件结构设计的,这与苹果开发自己的PC 电脑也有异曲同工之妙。因为 Google 的 ChromeOS 伴随着其硬件一起提供,大部分情况下都无需担心错误的驱动、适配什么的问题。对于某些人来说,这太好了。
然而有些人则认为这是一个很严重的问题,不过滑稽的是,对 ChomeOS 来说,这些人压根就不在它的目标市场里。简言之,这只是一些狂热的 Linux 爱好者在对 ChomeOS 鸡蛋里挑骨头罢了。要我说,还是停止这些没必要的批评吧。
问题的关键在于:ChromeOS 的市场份额和 Linux 桌面系统在很长的一段时间内是不同的。这个局面可能会在将来被打破,然而在现在,仍然会是两军对峙的局面。
### ChromeOS 的使用率正在增长
不管你对ChromeOS 有怎么样的看法,事实是,ChromeOS 的使用率正在增长。专门针对 ChromeOS 的电脑也一直有发布。最近,戴尔(Dell)也发布了一款针对 ChromeOS 的电脑。命名为 [Dell Chromebox](http://www.pcworld.com/article/2602845/dell-brings-googles-chrome-os-to-desktops.html),这款 ChromeOS 设备将会是对传统设备的又一次冲击。它没有软件光驱,没有反病毒软件,能够提供无缝的幕后自动更新。对于一般的用户,Chromebox 和 Chromebook 正逐渐成为那些工作在 Web 浏览器上的人们的一个可靠选择。
尽管增长速度很快,ChromeOS 设备仍然面临着一个很严峻的问题 - 存储。受限于有限的硬盘大小和严重依赖于云存储,ChromeOS 对于那些需要使用基本的浏览器功能之外的人们来说还不够用。
### ChromeOS 和 Linux 的异同点
以前,我注意到 ChromeOS 和 Linux 桌面系统分别占有着两个完全不同的市场。出现这样的情况是源于 Linux 社区在线下的桌面支持上一直都有着极其糟糕的表现。
是的,偶然的,有些人可能会第一时间发现这个“Linux特点”。但是,并没有一个人接着跟进这些问题,确保得到问题的答案,以让他们得到 Linux 方面更多的帮助。
事实上,线下问题的出现可能是这样的:
* 有些用户偶然的在当地的 Linux 活动中发现了 Linux。
* 他们带回了 DVD/USB 设备,并尝试安装这个操作系统。
* 当然,有些人很幸运的成功完成了安装过程,但是,据我所知大多数的人并没有那么幸运。
* 令人失望的是,这些人只能寄希望于在网上论坛里搜索帮助。他们很难通过主流的计算机网络经验或视频教程解决这些问题。 -于是这些人受够了。后来有很多失望的用户拿着他们的电脑到 Windows 商店来“维修”。除了重装一个 Windows 操作系统,他们很多时候都会听到一句话,“Linux 并不适合你们”,应该尽量避免。
有些人肯定会说,上面的举例肯定夸大其词了。让我来告诉你:这是发生在我身边的真事,而且是经常发生。醒醒吧,Linux 社区的人们,我们的推广模式早已过期无力了。
### 伟大的平台,糟糕的营销和最终结论
如果非要找一个 ChromeOS 和 Linux 桌面系统的共同点,除了它们都使用了 Linux 内核,那就是它们都是伟大的产品却拥有极其差劲的市场营销。对此,Google 认为自己的优势是,它能投入大量的资金在网上构建大面积存储空间。
Google 相信他们拥有“网上的优势”,而线下的问题不是很重要。这真是一个让人难以置信的目光短浅,这也成了Google 最严重的失误之一。而当地的 Linux 零售商则坚信,对于不怎么上网的人,自然不必担心他们会受到 Google巨大的在线存储的诱惑。
我的建议是:Linux 可以通过线下的努力,提供桌面系统,渗透 ChromeOS 市场。这就意味着 Linux 社区需要在节假日筹集资金来出席博览会、商场展览,并且在社区中进行免费的教学课程。这会立即使 Linux 桌面系统走入人们的视线,否则,最终将会是一个 ChromeOS 设备出现在人们的面前。
如果说本地的线下市场并没有像我说的这样,别担心。Linux 桌面系统的市场仍然会像 ChromeOS 一样增长。最坏也能保持现在这种两军对峙的市场局面。
---
via: <http://www.datamation.com/open-source/chromeos-vs-linux-the-good-the-bad-and-the-ugly-1.html>
作者:[Matt Hartley](http://www.datamation.com/author/Matt-Hartley-3080.html) 译者:[barney-ro](https://github.com/barney-ro) 校对:[Mr小眼儿](https://github.com/tinyeyeser)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,649 | Intel 发布一款新的调整 GPU 主频的开源工具 | http://www.phoronix.com/scan.php?page=news_item&px=Intel-Frequency-Tool | 2015-01-12T14:47:00 | [
"Intel",
"GPU"
] | https://linux.cn/article-4649-1.html | Intel 开源技术中心的 Ben Widawsky 发布了一款新的试验性工具,可以在 Linux 下调整 Intel GPU 的主频,名字自然就叫做 intel\_freequency。
Intel HD Graphics 的主频其实已经可以通过 Linux 内核的 sysfs 接口来强制调整,不过使用该工具会更加方便易用。
intel\_frequency 工具支持读取 GPU 的当前/最小/最大主频、设置为不同的主频级别,以及固定最大主频。这个工具并没有提供超出通过 sysfs 所能做到的更高的主频和更多功能。

这个 intel\_frequency 工具可以用于性能测试、检查稳定性问题和调试等等。
目前该工具还没有添加到 Intel GPU 工具包中,不过已经可以通过[补丁](http://lists.freedesktop.org/archives/intel-gfx/2015-January/058217.html)来得到了。
| 301 | Moved Permanently | null |
4,651 | ESR:黑客年暮 | http://esr.ibiblio.org/?p=6485 | 2015-01-12T15:54:00 | [
"黑客",
"ESR"
] | https://linux.cn/article-4651-1.html | 
近来我一直在与某资深开源开发团队中的多个成员缠斗,尽管密切关注我的人们会在读完本文后猜到是哪个组织,但我不会在这里说出这个组织的名字。
怎么让某些人进入 21 世纪就这么难呢?真是的...
我快 56 岁了,也就是大部分年轻人会以为的我将时不时朝他们发出诸如“滚出我的草坪”之类歇斯底里咆哮的年龄。但事实并非如此 —— 我发现,尤其是在技术背景之下,我变得与我的年龄非常不相称。
在我这个年龄的大部分人确实变成了爱发牢骚、墨守成规的老顽固。并且,尴尬的是,偶尔我会成为那个打断谈话的人,我会指出他们某个在 1995 年(或者在某些特殊情况下,1985 年)时很适合的方法... 几十年后的今天就不再是好方法了。
为什么是我?因为年轻人在我的同龄人中很难有什么说服力。如果有人想让那帮老头改变主意,首先他得是自己同龄人中具有较高思想觉悟的佼佼者。即便如此,在与习惯做斗争的过程中,我也比看起来花费了更多的时间。
年轻人犯下无知的错误是可以被原谅的。他们还年轻。年轻意味着缺乏经验,缺乏经验通常会导致片面的判断。我很难原谅那些经历了足够多本该有经验的人,却被*长期的固化思维*蒙蔽,无法发觉近在咫尺的东西。
(补充一下:我真的不是保守党拥护者。那些和我争论政治的,无论保守党还是非保守党都没有注意到这点,我觉得这颇有点嘲讽的意味。)
那么,现在我们来讨论下 GNU 更新日志文件(ChangeLog)这件事。在 1985 年的时候,这是一个不错的主意,甚至可以说是必须的。当时的想法是用单独的更新日志条目来记录多个相关文件的变更情况。用这种方式来对那些存在版本缺失或者非常原始的版本进行版本控制确实不错。当时我也*在场*,所以我知道这些。
不过即使到了 1995 年,甚至 21 世纪早期,许多版本控制系统仍然没有太大改进。也就是说,这些版本控制系统并非对批量文件的变化进行分组再保存到一条记录上,而是对每个变化的文件分别进行记录并保存到不同的地方。CVS,当时被广泛使用的版本控制系统,仅仅是模拟日志变更 —— 并且在这方面表现得很糟糕,导致大多数人不再依赖这个功能。即便如此,更新日志文件的出现依然是必要的。
但随后,版本控制系统 Subversion 于 2003 年发布 beta 版,并于 2004 年发布 1.0 正式版,Subversion 真正实现了更新日志记录功能,得到了人们的广泛认可。它与一年后兴起的分布式版本控制系统(Distributed Version Control System,DVCS)共同引发了主流世界的激烈争论。因为如果你在项目上同时使用了分布式版本控制与更新日志文件记录的功能,它们将会因为争夺相同元数据的控制权而产生不可预料的冲突。
有几种不同的方法可以折衷解决这个问题。一种是继续将更新日志作为代码变更的授权记录。这样一来,你基本上只能得到简陋的、形式上的提交评论数据。
另一种方法是对提交的评论日志进行授权。如果你这样做了,不久后你就会开始思忖为什么自己仍然对所有的日志更新条目进行记录。提交元数据与变化的代码具有更好的相容性,毕竟这才是当初设计它的目的。
(现在,试想有这样一个项目,同样本着把项目做得最好的想法,但两拨人却做出了完全不同的选择。因此你必须同时阅读更新日志和评论日志以了解到底发生了什么。最好在矛盾激化前把问题解决....)
第三种办法是尝试同时使用以上两种方法 —— 在更新日志条目中,以稍微变化后的的格式复制一份评论数据,将其作为评论提交的一部分。这会导致各种你意想不到的问题,最具代表性的就是它不符合“真理的单点性(single point of truth)”原理;只要其中有拷贝文件损坏,或者日志文件条目被修改,这就不再是同步时数据匹配的问题,它将导致在其后参与进来的人试图搞清人们是怎么想的时候变得非常困惑。(LCTT 译注:《[程序员修炼之道](http://book.51cto.com/art/200809/88490.htm)》(The Pragmatic Programmer):任何一个知识点在系统内都应当有一个唯一、明确、权威的表述。根据Brian Kernighan的建议,把这个原则称为“真理的单点性(Single Point of Truth)”或者SPOT原则。)
或者,正如这个*我就不说出具体名字的特定项目*所做的,它的高层开发人员在电子邮件中最近声明说,提交可以包含多个更新日志条目,并且提交的元数据与更新日志是无关的。这导致我们直到现在还得不断进行记录。
当时我读到邮件的时候都要吐了。什么样的傻瓜才会意识不到这是自找麻烦 —— 事实上,在 DVCS 中针对可靠的提交日志有很好的浏览工具,围绕更新日志文件的整个定制措施只会成为负担和拖累。
唉,这是比较特殊的笨蛋:变老的并且思维僵化了的黑客。所有的合理化改革他都会极力反对。他所遵循的行事方法在几十年前是有效的,但现在只能适得其反。如果你试图向他解释这些不仅仅和 git 的摘要信息有关,同时还为了正确适应当前的工具集,以便实现更新日志的去条目化... 呵呵,那你就准备好迎接无法忍受、无法想象的疯狂对话吧。
的确,它成功激怒了我。这样那样的胡言乱语使这个项目变成了很难完成的工作。而且,同样的糟糕还体现在他们吸引年轻开发者的过程中,我认为这是真正的问题。相关 Google+ 社区的人员数量已经达到了 4 位数,他们大部分都是孩子,还没有成长起来。显然外界已经接受了这样的信息:这个项目的开发者都是部落中地位根深蒂固的崇高首领,最好的崇拜方式就是远远的景仰着他们。
这件事给我的最大触动就是每当我要和这些部落首领较量时,我都会想:有一天我也会这样吗?或者更糟的是,我看到的只是如同镜子一般对我自己的真实写照,而我自己却浑然不觉?我的意思是,我所得到的印象来自于他的网站,这个特殊的笨蛋要比我年轻。年轻至少 15 岁呢。
我总是认为自己的思路很清晰。当我和那些比我聪明的人打交道时我不会受挫,我只会因为那些思路跟不上我、看不清事实的人而沮丧。但这种自信也许只是邓宁·克鲁格效应(Dunning-Krueger effect)在我身上的消极影响,我并不确定这意味着什么。很少有什么事情会让我感到害怕;而这件事在让我害怕的事情名单上是名列前茅的。
另一件让人不安的事是当我逐渐变老的时候,这样的矛盾发生得越来越频繁。不知怎的,我希望我的黑客同行们能以更加优雅的姿态老去,即使身体老去也应该保持一颗年轻的心灵。有些人确实是这样;但可惜绝大多数人都不是。真令人悲哀。
我不确定我的职业生涯会不会完美收场。假如我最后成功避免了思维僵化(注意我说的是假如),我想我一定知道其中的部分原因,但我不确定这种模式是否可以被复制 —— 为了达成目的也许得在你的头脑中发生一些复杂的化学反应。尽管如此,无论对错,请听听我给年轻黑客以及其他有志青年的建议。
你们——对的,也包括你——一定无法在你中年老年的时候保持不错的心灵,除非你能很好的控制这点。你必须不断地去磨练你的内心、在你还年轻的时候完成自己的种种心愿,你必须把这些行为养成一种习惯直到你老去。
有种说法是中年人锻炼身体的最佳时机是 30 岁以前。我以为同样的方法,坚持我以上所说的习惯能让你在 56 岁,甚至 65 岁的时候仍然保持灵活的头脑。挑战你的极限,使不断地挑战自己成为一种习惯。立刻离开安乐窝,由此当你以后真正需要它的时候你可以建立起自己的安乐窝。
你必须要清楚的了解这点;还有一个可选择的挑战是你选择一个可以实现的目标并且为了这个目标不断努力。这个月我要学习 Go 语言。不是指围棋,我早就玩儿过了(虽然玩儿的不是太好)。并不是因为工作需要,而是因为我觉得是时候来扩展下我自己了。(LCTT 译注:围棋的英文也是“Go”)
保持这个习惯。永远不要放弃。
---
via: <http://esr.ibiblio.org/?p=6485>
作者:[Eric Raymond](http://esr.ibiblio.org/?author=2) 译者:[Stevearzh](https://github.com/Stevearzh) 校对:[Mr小眼儿](https://github.com/tinyeyeser)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 200 | OK | Lately I’ve been wrestling with various members of an ancient and venerable open-source development group which I am not going to name, though people who regularly follow my adventures will probably guess which one it is by the time I’m done venting.
Why it so *freaking* hard to drag some people into the 21st century? Sigh…
I’m almost 56, an age at which a lot of younger people expect me to issue semi-regular salvos of get-off-my-lawn ranting at them. But no – I find, that, especially in technical contexts, I am far more likely to become impatient with my age peers.
A lot of them really have become grouchy, hidebound old farts. And, alas, it not infrequently falls to me to be the person who barges in and points out that practices well-adapted for 1995 (or, in the particular case I’m thinking of, 1985) are … not good things to hold on to decades later.
Why me? Because the kids have little or no cred with a lot of my age peers. If anyone’s going to get them to change, it has to be someone who *is* their peer in their own perception. Even so, I spend a lot more time than seems just or right fighting inertia.
Young people can be forgiven for lacking a clue. They’re young. Young means little experience, which often leads to unsound judgment. It’s more difficult for me to forgive people who have been around the track often enough that they should have a clue, but are so attached to The Way It’s Always Been Done that they can’t see what is in front of their freaking noses.
(News flash: I really don’t have a conservative temperament. I find it wryly amusing how often both conservatives and non-conservatives who argue politics with me fail to notice this.)
OK, now let’s talk about GNU ChangeLog files. They were a fine idea, a necessary one even, in 1985. The idea was to use a single ChangeLog entry to document a group of related changes to multiple files. This was a reasonable adaptation to absent or extremely primitive version control. I know this because I was *there*.
Even in 1995, or as late as the early 2000s, many version control systems didn’t have changesets. That is, there was no or only weak support for grouping multiple file modifications into a single retrievable object with a comment attached to the object rather than to individual file modifications. CVS, the system in widest use then, only faked changesets – and did it so badly that many people felt they couldn’t rely on that feature. ChangeLog files still made some functional sense.
But then Subversion – with real changesets – achieved wide acceptance through its beta releases around 2003 and its 1.0 in 2004. It should have been obvious then, even before the new wave of DVCSes that began a year later, that there was a culture clash a comin’. Because if your project both has a DVCS and uses the ChangeLog convention, they’re fighting for control of the same metadata.
There are different ways you can adapt. One is to continue to treat the ChangeLogs as the authoritative record of the evolution of the code. In that case, you tend to get stubby or pro-forma commit comments.
Another is to treat the commit comment log as authoritative. If you do that, you soon begin to wonder why you’re still writing ChangeLog entries at all. The commit metadata has better coherence with the code changes, after all – that’s what it’s designed for.
(Now imagine a project in which, with the best of intentions, different people are making opposite choices out of these two. Now you have to read both the ChangeLogs *and* the commit logs to know what’s going on. Friction costs are rising…)
A third is to try to have it both ways – duplicating commit comment data in a slightly different format in a ChangeLog entry that’s part of the commit. This has all the problems you’d expect with a representation in which there is no single point of truth; one copy gets garbled, or the ChangeLog entry gets modified so that it’s no longer in sync with the allegedly matching commit data, and life gets very confusing for anyone who comes along later and tries to figure out what people were thinking.
Or, as a senior dev on a Certain Project I Won’t Name just did in email, declaring that commits can include multiple ChangeLog entries and the commit metadata is *irrelevant* to the Changelogs. Which we still have to write.
My eyes crossed and my gorge rose when I read that. What kind of fool fails to realize that this is begging for trouble – that, actually, the whole edifice of custom around ChangeLog files is just dead weight and friction drag in a DVCS world with good browsing tools for reliable commit logs?
Alas, it’s a very particular kind of fool: a hacker who has grown old and rigid. All the rationalizations he will ever utter fail to hide this. He’s attached to tactics that made sense a decade ago but have become counterproductive ceremonies now. If you tried to explain not just about git summary lines but that the correct adaptation for current toolsets is to scrap ChangeLogs entirely … well, that would be insupportable, inconceivable, and just crazy talk.
Functionally this infuriates me. It is substantially harder to work on that project because of this and related nonsense. And, as badly as it happens to need young developers, that’s a real problem. It has a G+ community well into 4 digits, they’re mostly kids, and they’re not stepping up. Evidently the message has been received on the outside; the devs on this project are ancient mossbacks with inexplicable tribal fixations, and best admired from a good long distance.
What gives this extra emotional edge for me is that whenever I have to butt heads with a mossback, I keep wondering: will I be like this someday? Worse, am I looking in a mirror, already rigidified and not knowing it? I mean, I get the impression from his web presence that this particular specimen is *younger* than me. By a good fifteen years.
I *feel* mentally agile. I don’t get frustrated by people moving faster than I can handle, I get frustrated by people who can’t keep up with me, who can’t see the obvious. But this self-belief could be just a bad case of Dunning-Krueger effect biting me where I least understand it. Very few things terrify me; this possibility is high on the short list.
A separately disconcerting thing is that as I get older this sort of collision is happening more often rather than less. Somehow I expected my hacker peers to age more gracefully, to retain their neotenous flexibility even if they were physically aging. Some do indeed seem to be going that way; too many, alas, are not. It is a sadness.
I’m not sure I have a good finish for this. *If* I’ve escaped mentally rigidifying (and that’s an if) I think I know at least in part why, but I’m very unsure whether it can be generally replicated – you might need to have a wired-in brain chemistry that matches the strategy. Nevertheless, for whatever it’s worth, here is my advice to young hackers and indeed the young of all kinds.
You – yes, even you – cannot count on retaining your mental flexibility into middle and old *unless you work at it*. You have to practice busting out of comfortable mental grooves and regularly checking your assumptions when you’re young, and you have to develop a habit of it that sustains into old age.
It’s said that the best time for a middle-aged person to start (physically) exercising is thirty years ago. I think the same goes for the habits that might (might!) keep you mentally agile at 56, or 65. *Push your envelope.* Develop the regular practice of challenging yourself and exiting your comfort zone now so you’ll have it established when you really need it.
You have to be realistic about this; there’s an optimal-challenge level where you choose an *attainable* goal and work mentally hard for it. This month I’m going to learn go. Not the game, I already play that (though not very well); the programming language. Not because I really need to for a specific project, but because it’s time to stretch myself.
Develop that habit. And *never let it go.*
The problem you’re looking at also goes under the label “Neuroplasticity”. There is at least *some* biological basis for losing this plasticity as we age. There’s also some evidence that it can be re-started (http://www.the-scientist.com/?articles.view/articleNo/41229/title/Turning-Back-the-Brain-s-Clock/).
And of course all of this is incredibly rich coming from a guy who basically uses his GUI to have multiple terminal sessions running :).
>And of course all of this is incredibly rich coming from a guy who basically uses his GUI to have multiple terminal sessions running :).
Did the full-WIMP thing for decades. Now find it superfluous. Well, except for the browser.
This is interesting too:
http://www.zmescience.com/medicine/mind-and-brain/portal-2-cognitive-function-01102014/
Psychologists have done experiments on this. They have found that people tend to do things the way they have done them before, even though superior solutions are presented to them in a rather obvious manner….
A friend of mine, who went through engineering school in the early 70s, told me about a professor who devoted the first week of his introductory courses to teaching the students how to use a slide rule, even though the use of electronic calculators had wiped them out.
@esr – typo?
“Worse, am I looking in a error, ”
=>“Worse, am I looking in amirror, “@LS:
>A friend of mine, who went through engineering school in the early 70s, told me about a professor who devoted the first week of his introductory courses to teaching the students how to use a slide rule, even though the use of electronic calculators had wiped them out.
I’m dealing with this now:
https://plus.google.com/110008887158117796734/posts/RfVNGn3fZs9
This is even funnier if you know who Darren Hart and John Hawley are.
There’s value in learning to use a slide rule, even today: it develops the ability to run quick mental sanity checks on computations.
I can’t see any value in maintaining a change log outside the DVCS commit records.
Here’s a problem for you, ESR – I’m a user. Vaguely technically literate – I know what CVS, Subversion, Mercurial, Git are – but I don’t actually *USE* them. I’ve occasionally downloaded a tarball and done a build with make clean ; make ; make install – but if something goes wrong, I’m off to Google hoping someone else has seen that error and can suggest what I need to adjust to make it work on my distro.
Usually, in said tarball, there is a ChangeLog file – and something similar automagically included as a page on the project’s website. That’s where I go to find out whether I need to upgrade, or if the new version has any features I consider worth worrying about. Some projects the changelog is more technical, some it’s less so – but that changelog seems in general to be aimed more towards the users than the devs. Do you propose dropping something like that, or maintaining it as a separate part of the documentation, or what?
> Do you propose dropping something like that, or maintaining it as a separate part of the documentation, or what?
My projects all have a NEWS file separate from the commit metadata. It’s present specifically to address your kind of question – what’s new, and do I need to upgrade? Even projects that have retained the ChangeLog convention commonly have NEWS files; that’s what to look for.
You’re going to have a blast learning Go (uppercase ;-) ). Expect your Python programming volume to dwindle over the next few months.
“Worse, am I looking in a error, already rigidified and not knowing it?”
Did you mean looking in a mirror? :-D
> This month I’m going to learn go.
May I suggest that you look at Rust after that? In my opinion it’s much more interesting than go, being actually low level enough to replace most of C.
> Usually, in said tarball, there is a ChangeLog file – and something similar automagically included as a page on the project’s website. That’s where I go to find out whether I need to upgrade, or if the new version has any features I consider worth worrying about. Some projects the changelog is more technical, some it’s less so – but that changelog seems in general to be aimed more towards the users than the devs. Do you propose dropping something like that, or maintaining it as a separate part of the documentation, or what?
The GNU ChangeLog format (http://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html) is almost useless for the *user*, who simply drowns in amount of text and unnecessary information (and trying to understand its format).
That’s why good citizen projects have a NEWS or RelNotes file, which describes changes on higher level: not on the level of individual commits but on the level of features added. It is *curated* list of changes.
Compare https://github.com/git/git/blob/master/Documentation/RelNotes/2.1.0.txt with http://git.savannah.gnu.org/gitweb/?p=guile.git;a=blob;f=ChangeLog-2008#l37 (note that Guile no longer uses ChangeLog files). Which one is more useful for the user?
“Jakub Nar?bski” should be “Jakub Nar?bski” (that’s “e ogonek”). Damn you WordPress, no UTF-8 support in this century?
General Semantics. “The map is not the territory.” However, the brain still compares input with past experience (going all the way back to “is this a threat?” survival decisions). It *likes* to have experiences comparable to the input, so it can access past analyses. As we age, there are more experiences to be scanned (it’s not linear, of course), and the acceptable degree of congruence goes down to keep the time factor tolerable. So there’s a tendency to accept “A is like B” — when years ago we wouldn’t have thought that at all.
The weight of experience is helpful as long as we’re presented with situations similar to those encountered before. It can become an obstacle when something new wanders into the input. The new thing may get misfiled, or perhaps rejected because we’ve lost the knack of dealing with newness.
Why should hackers be any *less* prone to the hardening of the cerebral arteries that tends to come with aging? Part of the issue you are dealing with is anger and frustration dealing with it because you think they *should* be less prone by virtue of *being* hackers.
I’m older than you are. I’d like to think I’ve stayed flexible and open to new ideas and better ways to do things. But I don’t assume that any particular group selected on some arbitrary criteria will be less subject to this sort of issue, because they *won’t* be. It’s one of the lessons I’ve learned in the process of growing older.
Old hackers learned to code in whatever languages they used using the development methodologies popular when they were learning. They achieved sufficient proficiency to be able to make useful contributions to things like the project you complain about. There will be an innate “What I do now works. Why should I *change* how I do it?” conservatism. You’ll find this in pretty much any area of human endeavor.
Generally speaking, what we do is done by habit and reflex, with a minimum of conscious thought, and things that require conscious thought get resistance. One of the conclusions I’ve come to lately is that widely trumpeted “freedom of choice” is misleading. What most folks really want is freedom *from* choice, and a reduction in the number of things they must consciously consider and make decisions about. I don’t see hackers as any exception to that tendency.
______
Dennis
You mean NEWS files get updated?
>You mean NEWS files get updated?
Yes. Normally on every release. That’s what they’re for.
If you happen to do a repository pull on one of my projects, you might see an entry at the top of the NEWS tagged “Repository head”. That tells you about recent user-visible changes in the unreleased code.
Using a slide rule: I use my head for that. Saves the energy of carrying around an extra piece of plastic. (Yes, my tongue is somewhat in my cheek here.)
Anyway, I suspect it gets worse:
You – yes, even you – cannot count on retaining your mental flexibility into middle and old unless you work at it. You have to practice busting out of comfortable mental grooves and regularly checking your assumptions when you’re young, and you have to develop a habit of it that sustains into old age.If you’re really that rigidified, I worry it’s possible for you to remain so
while thinking you’re getting out of those comfortable mental grooves. I’ve lost count of the number of people I’ve seen lament that, say, the other side of the political isle is stuck in their old ways and won’t keep an open mind. If I had thought to keep a running tally between “left” and “right” complaints about this over the last 20 years, I highly suspect they’d be within 10% of each other. But then they’ll exhibit closemindedness later in the very same post or comment.Which makes me wonder if
I’mdoing it, too. (Favorite joke of mine is to claim I’m an excellent exemplar of Dunning-Krueger.) I might feel comfortable about my own plasticity if there were an efficient test for it that could be interpreted even by the dumber parts of my brain; until then, I’ll always wonder if, despite thinking I’m trying, I’m actually failing a more alert version of myself.I wonder what Yudkowsky might say about all this.
Hmm, I don’t think changelogs and commit messages fill the exact same role (disclaimer: I don’t know anything about how those people use changelogs, and I don’t have any experience with git summary).
I’m under the impression that a changelog contains an explaination — adressed to the user — of what changed between two versions. The point of each commit message is to describe a commit, a technically meaningful change, for a programmer’s point of view. And a list of commit messages is just a list, it needs to be manually rewritten to summarize as well as possible the end effect of each code change.
Unless I have missed something, my point is that the audience is different, so the content must be different. Therefore, the idea of commiting just an update of several change items seem reasonable to me.
I wouldn’t worry too much about the idea of mental rigidity increasing with age. I’m in my thirties and I have also both been worried by it and used it in not-so-subtle arguments to fake concern about others to highlight their stubbornness. :-)
Learning new programming languages is definitely good for the brain though.
I find that changelog files are a lot more comfortable to read than using repo browser tools (I can use my favorite text editor and all its processing tools), Also, you are assuming you have access to the repo at all.
Would it be feasible to write a changelog builder that works from the DCVS records (and possibly some kind of commenting convention)? Then it’s just another step in the build and release workflow, so long as the DCVS records are reasonable (and that might be a good place to put some kind of reasonableness checker).
An alternative explanation would be that devs of your own age are more willing to argue with you and thus seem more rigid than younger, more docile folks.
>>selected on some arbitrary criteria
It is probable that predisposition to hacking correlates with mental flexibility, and this flexibility continues into old age.
> I wonder what Yudkowsky might say about all this.
I thought the same. Then I thought I should think more.
To do things right, we’d need some way to at least approximate comfort/proficiency with a certain skill or activity. Then we could choose the least comfortable or hardest tasks. In ESR’s case, I’d venture learning a new programming language is par for the course, thus doesn’t count. Artificial constraints could help make the exercise useful, although I can think of none applicable.
@ESR: Here are some random activities that might help you stretch your mind better than learning go. Are you good at:
– origami?
– videogames? (action, adventure et al, strategy OR turn-based games don’t count)
– gardening?
– building stuff? (wood working, electronics, etc.)
I know you’re good at languages, but if it’s been some time since you learned a new one, it might be good to do it. There are some online platforms to facilitate practice.
I know you’re good with music, but if it’s been some time since you learned a new instrument or pieces…
Also — notice how bizarre this can feel on a gut level, I think that means there’s potential — have you tried a new OS lately? Get some stuff done in a Mac OS or Windows machine.
“If you meet Buddha, kill him!”
I think this is the gist of retaining mental flexibility. We just need to make sure not to miss Buddhas that are too holy, too precious, or too familiar.
Just to be contrary, but I suggest that perhaps you are missing the importance of rituals in the social process of group programming. Having a fixed artifact like a change log file is part of the reward of contributing to software. It is your name in lights. It is part of the ceremony, it is part of the social process of closure of your work.
When you graduate from college there is a lot of fuss. You wear funky clothes, get a big, impractical parchment diploma, stand on a stage and have your name called to the crowd’s applause. Surely an emailed, signed transcript, and a searchable database of graduate names would be more practical. But it would be a lot less fun, a lot less enjoyable, and a lot less of the spectacle that many of us enjoy.
Certainly you can view your contributions in an electronic dump of the commit comments, but adding your commits onto a fixed file is like adding yourself to the roll of honor.
And if a little vain preening is the price of all those hours of coding, I don’t think there is anything wrong with that.
>Certainly you can view your contributions in an electronic dump of the commit comments, but adding your commits onto a fixed file is like adding yourself to the roll of honor.
No, no, no. That’s what the AUTHORS and CREDITS and MAINTAINERS files are for.
Seriously. Those are conventional, too.
Re: Go the game
> I already play that (though not very well)
How well is not very well? Have you ever gotten a ranking from somewhere? I usually play on KGS* & I’m ranked 5k there. I’ve been plateaued for the last few years… when I first started playing, I progressed pretty quickly & steadily up to 5k, but I haven’t been able to get any further. I’ve occasionally bumped up to 4k, but haven’t been able to maintain it. This has just been through playing occasionally for fun… I think at this point if I really want to progress any further, I need to do some actual studying.
*: http://www.gokgs.com/
>How well is not very well? Have you ever gotten a ranking from somewhere?
No. How would one go about that?
Heh, I’m 68 and when I run into ChangeLog remnants I regard them with the same curiosity with which I regard trilobite fossils; they are the markers of an ancient period in hacker history. That said, I don’t find young folks all that familiar with tools like git, and even if they use a DVCS they still need training to produce proper commit messages. I think the schools are a little behind in that regard.
My dad retired from electrical engineering at age 92 and managed to keep pretty close to the technical cutting edge in his specialty. However, I don’t think he ever quite adapted to modern design tools as he was accustomed to keep much in his head. He claimed that about 1000 chips was his limit for that. I have no idea what he did with large scale integration. His complaint about the youngsters coming out of schools like MIT was that they didn’t have a feel for hardware or analog signals, but were rather specialized to digital design.
Here’s another argument against CHANGELOGs.
An email I saw recently on a security list that pointed out that having the change log in the tarball of a web app means that it typically in a known place (e.g. http:// mysite.com/drupal/CHANGELOG.txt to pick a vulnerable web app completely at random) that is rarely ACLed against remote access. So that means would be attackers can figure out what version of the web app you are running and hence what attacks you may be vulnerable to.
@Jessica Boxer:
When you are applying for a job, you don’t send them the parchment: the recruiter *does* use a big searchable database and the ceremony is purely superficial.
ChangeLogs are not superficial and this leads to the various problems listed above. Perhaps a solution would be to make the Big Important SPOT the commit comment logs, but keep changelogs around anyway (although this would necessitate a lot of unnecessary duplication).
Even better, when you wind up working with one of those “mossbacks” who still thinks in terms of “lines of code,” and portions out payscales and bonuses accordingly. So the bloatier your code, the more you get paid.
Obviously, if you solved a particularly difficult task with only a few fanfold pages of code, you expended less effort than the guy whose solution required half a box of paper… Billy Bloatus got a gold star, and you went on the slacker watch list.
Yes, I worked for the kind of “real manager” who would only review code printed out on paper, where he’d make illegible notes with different colored pens…
@Lambert: “It is probable that predisposition to hacking correlates with mental flexibility, and this flexibility continues into old age.”
That’s what Eric would like to think. So would I. I just haven’t seen any proof that’s the case, and have seen a fair bit of evidence that it *isn’t*.
Eric is complaining about just that sort of evidence.
______
Dennis
Um, not play troublemaker here, but maybe stretching yourself by learning a new computer language is a bit . . . of a habit? Maybe even a rigid one? In search of cerebral fluidity, try something COMPLETELY new, like, idk, dance or diving.
After a lifetime of writing how-to fact pieces and cultural/political rants, I am now trying fiction. And it’s hard. It takes place at more abstract level. Writing an article, even a polemic, I have a set of facts to guide me. They must be presented in a particular order to make sense. You can’t write a story like that, because it will be both limiting (for you) and boring (for the reader). It took me five years an approximately 900,000 words to lear this.
PS — I’m about eighteen months younger.
>n search of cerebral fluidity, try something COMPLETELY new, like, idk, dance or diving […] After a lifetime of writing how-to fact pieces and cultural/political rants, I am now trying fiction.
Just sold my first fiction recently. That’s too, was a brain-stretching exercise.
Choosing new things to learn for this purpose is always a compromise between the most outttahere thing you could pick and what’s practical given your circumstances.
The fact that C is still considered an acceptable systems programming language — even as we are still dogged to the tune of billions in losses by C-related bugs like Heartbleed, even as study after study confirms that languages which give a shit about safety, like Ada, have a lower overall development cost — is a textbook example of the detrimental effects of set-in-their-ways old hackers controlling things.
Rust is Ada for the 21st century. I second the recommendation to learn it; it is the future.
> I find that changelog files are a lot more comfortable to read than using repo browser tools (I can use my favorite text editor and all its processing tools), Also, you are assuming you have access to the repo at all.
ChangeLogs in GNU ChangeLog format are IMVHO nigh unreadable for an ordinary user. They contain uninteresting information about individual commits – what is important is information about features implemented (i.e. branches merged). That’s why NEWS, or RelNotes, or Changes with curated list of changes are important…
BTW I think nowadays most projects include link to repository and browser interface to repository, anyway.
[My other comment is stuck in the moderation queue because of included 3 URLs]
Seems a good place to ask…
Any progress on your Becoming A Polymath For Dummies project?
>Any progress on your Becoming A Polymath For Dummies project?
Stalled due to press of other work.
I find that the biggest fight is convincing them that “it doesn’t hurt anything by being there” isn’t an acceptable argument and is in fact outright false sometimes like in this case. Once you get it through their head that it’s good to be proactive things usually improve in terms of project philosophy. But again. Hell of a fight.
I don’t think your mossback problem has that much to do with biology. It likely has more to do (consciously or not) with the underlying politics. I will never forget the almost reflexive pushback from some GNU folks to the adoption of DVCS, even after GPLd DVCs were available. The inherent possibilities of decentralization did not sit well with them. There were blog posts (by both young people and old, mind you) featuring handwringing about how if you couldn’t force people to commit to the remote repo then you couldn’t trust them to contribute their changes and thus DVCS were not a good idea for free software. This is the same control-freak mindset that gave us GPLv3, for that matter the same mindset that maintains the the “virality” of the GPL is ‘sine qua non’ for free software… even in 2014, decades after sharing software meant snail mailing *tapes*.
At heart, this is a political stance, not just a case of being set in one’s ways. This resistance to change, is more of a reflex against the loss of control/power. Sad and infuriating to see in people that pride themselves in their rationality.
“Worse, am I looking in a mirror, already rigidified and not knowing it?”
You have wisely arranged it so that there will always be plenty of people to let you know if that ever happens. :)
>>there will always be plenty of people to let you know if that ever happens
Jumping into my 2nd biggest Dunning-Kreugeresq effect -esque fear: that all these people who consider themselves highly rational are actually some kind of crazy cult.
> >How well is not very well? Have you ever gotten a ranking from somewhere?
> No. How would one go about that?
These days it’s really easy to get a ranking on an internet Go server. Just create an account & start playing ranked games. After a few games it will give you an provisional ranking (shown by a ? on the rank), and then after several more games it will give you a more firm ranking, based on your win/lose record & your opponents rankings (and any handicap on the games).
The two most popular Internet Go Servers are KGS (http://www.gokgs.com/) & IGS (http://www.pandanet-igs.com/). More can be found in Sensei’s Library at http://senseis.xmp.net/?GoServers
KGS uses a cross-platform, closed-source Java client (or a commercial Android app). IGS has multiple clients to choose from, including a few open-source ones, and a telnet interface.
There are also somewhat more formal rankings from various national Go associations, but I’m not really familiar w/ them. My understanding is that those rankings are more based on official tournament games.
The different Internet Servers, and the different associations, will tend to give different rankings, as summarized at http://senseis.xmp.net/?RankWorldwideComparison – of particular note, IGS rankings tend to converge significantly slower than KGS rankings, meaning that it’s possible for players to improve faster than the IGS ranking system converges, and so have a lower ranking than they perhaps deserve, until their rate of improvement slows.
I do wonder which format is better for user: single NEWS file, or per-release RelNotes-x.y.z files (with newest release symlinked simply as RelNotes)?
Though this probably depends on length of project history and the development speed.
> No. How would one go about that?
Playing go against other ranked players in a tracked context. Face-to-face that would be at an American Go Association tournament (usgo.org) but imma assume that would burn too much of your time. So, online.
KGS Go Server (yes, it’s one of *those* acronyms) is the place where English-speaking go players benchmark from – when the Australian Go Association entertains guests from overseas we usually synthesize an Australian rank for them from their KGS or IGS rank so as to set playing conditions that yield a good fun game for the visitors – but the standard client for KGS will give you hives. Friendly community though.
IGS Pandanet is the oldest English-speaking go server on the ‘net and has the Telnet access mode to prove it. :) Large population, actuarily and statistically sound ranking system, not so newbie-friendly (but YMMV).
The hungry newcomer is OGS (online-go.com) with about half the population of say KGS and they’re still equilibrating their rating system. On the other hand, it offers correspondence go – one move per day – as well as the real-time stuff, and it runs in the browser. The devs are a little control-freaky and the non-core features are decidedly beta, but they at least understand the concept of a bug tracker and what to do when one’s players fill it up with reports.
On my personal TODO: write a global ranking system for go.
In the case of OpenBSD, I see the ChangeLog as a shorthand summary of the commit logs. When I want to see what happened in the last six months, someone has collated the commit logs and condensed it down into a nice birds eye view. So I believe ChangeLogs still have a role, but it is more for sysadmins and others who are doing an upgrade. Commit logs are more for developers who have to race backwards and find out where a bug or regression crept in.
In the newLisp project, the ChangeLog isn’t GNU format, it fits what Jakub is describing as a NEWS file. Whatever you call it, ChangeLog or NEWS, it is useful to have. I’m ok with dropping GNU format ChangeLog entirely and just having NEWS files.
All living things are creatures of habit. We’re not wired to change easily, nor is it a common phenomenon. Sometimes the best you can hope for is acceptance.
As an aside, I think the biggest source of frustration in the world occurs when someone tries to change someone else and thinks persistence is either effective or virtuous.
Jakub, do you know of any performance comparisons between Marpa and Ragel?
Changelogs along with real version control violates one of the fundamental coding rules – Never, ever put data in two different places (they WILL get out of sync).
We also need to kill autoconfig, libtool, and the rest of those horrors including the ./configure that takes 10 minutes on a 5GHz multicore “looking for strcpy…” and one error restarts the whole thing!
How is scons working out for gpsd?
The only thing I have a difference with “newer” stuff is when it bloats. I deal with embedded. I wrote a QR Code generator that fits on an Arduino. My motorcycle GPS+engine data+timing to bluetooth runs on an ATtiny4313 with 256 BYTES of ram and 4096 bytes of flash. Remember that there will be resource limited systems that still can run Linux – if you don’t bloat it in imitation of Microsoft.
>How is scons working out for gpsd?
In general I’m very pleased with it. Scons productions are more powerful, more readable, an far easier to maintain than a configure/make system.
The dev group is slow and unresponsive, though, and at least one important feature – support for versioned shared libraries – is so badly documented that it’s unusable.
Sometimes i get that feeling of “Am i actually hidebound and don’t realise it?”.
Most recently one of the people I work with was raving about how awesome Node.JS is. My thought was “Javascript is a terrible language why would ANYONE actually sign up to do that on the server?”
I mean JS is so bad that in the space where it has dominance (web scripting) there’s multiple efforts to layer stuff on top to make developing in it less painful. At the same time i do acknowledge that having models you can share between web client and web server is probably useful but…
@Irving: ““If you meet Buddha, kill him!”
I think this is the gist of retaining mental flexibility. We just need to make sure not to miss Buddhas that are too holy, too precious, or too familiar.”
A lot of the areas where mental flexibility is a question tend to be based in things where there is a strong gut-level feeling involved. Programmers have the notion of Religious Argument to describe such areas. The underlying disagreements don’t live on a rational level, and aren’t normally amenable to rational argument, which is why sensible folks recognize when something *is* a Religious Argument and avoid it.
Offhand, if you want to retain mental flexibility, you need to consider things where your gut level response is instantly and strongly negative, then step back and analyze *why* you feel that way. Most moral behavior falls into this category. The moral precepts are soaked up through the skin beginning in early childhood. People behave in a moral fashion by reflex. It simply doesn’t occur to most folks to behave in an immoral manner. Suggest doing so, and the response will be “But that’s WRONG!”. Then say “Yes, but *why* is it wrong?” and watch the fun.
You may assume “Buddhas that are too holy, too precious, or too familiar” are involved.
______
Dennis
@Jakub Narebski
>Damn you WordPress, no UTF-8 support in this century?
I hear you. It recently happened to me.
>>Any progress on your Becoming A Polymath For Dummies project? (Foo Quuxman)
>Stalled due to press of other work.
Take your time. But I’m glad I’m not the only one who’s looking forward for that. ^_^
“The weight of experience is helpful as long as we’re presented with situations similar to those encountered before. It can become an obstacle when something new wanders into the input. The new thing may get misfiled, or perhaps rejected because we’ve lost the knack of dealing with newness.”
Yes, this has been studied in depth. There are two modes of decision-making, called “type 1” and “type 2”. One is carefully-reasoned but slow, the other is fast gut-based but often wrong. It makes sense given our evolutionary history, when you needed to dodge the sabertooth NOW without thinking deeply about it. It doesn’t work so well in a hi-tech civilization.
Check out the following books for more on this:
Thinking Fast and Slow by Daniel Kahneman
Closing the Mind Gap: Making Smarter Decisions in a Hypercomplex World by Ted Cadsby
Predictably Irrational by Dan Ariely
Great example from the middle book:
“You’re out for a walk and run into an old friend. She mentions that she has two children. (a) What are the odds that she has one of each gender? A moment later, a girl runs up behind her, whom your friend introduces as her daughter. (b) What are the odds that your friend’s other child is a boy? (c) Do the odds change if you are told that her daughter is the elder sibling?”
The answers are not what most people believe they are…
“Generally speaking, what we do is done by habit and reflex, with a minimum of conscious thought, and things that require conscious thought get resistance. One of the conclusions I’ve come to lately is that widely trumpeted ‘freedom of choice’ is misleading. What most folks really want is freedom *from* choice, and a reduction in the number of things they must consciously consider and make decisions about.”
And there are good evolutionary reasons for that.
This calls to mind the famous jam study, where consumers offered 24 different types of jam to choose from were less likely to buy one than those offered only 6 choices.
“It is probable that predisposition to hacking correlates with mental flexibility…”
Probably true.
“…and this flexibility continues into old age.”
You assert this, but it does not obviously follow from the prior statement.
@Cathy: “”One of the conclusions I’ve come to lately is that widely trumpeted ‘freedom of choice’ is misleading. What most folks really want is freedom *from* choice, and a reduction in the number of things they must consciously consider and make decisions about.”
And there are good evolutionary reasons for that.”
There are indeed. My understanding is that conscious thought was an evolutionary adaptation to periods of rapid environmental change, where pure reflex was insufficient to insure survival, and the ability to develop new responses to situations was an advantage for species that developed it.
But it was still an overlay on top of much older patterns, and easy to overload till it became ineffective, and actually making a decision became impossible. No surprise people want to simplify their lives.
“This calls to mind the famous jam study, where consumers offered 24 different types of jam to choose from were less likely to buy one than those offered only 6 choices.”
Yes. Smart marketers understand the principle, even if they don’t know of the study. It’s why so much effort is made on branding – if there are 24 varieties of jam and jam is needed, the brand the consumer is familiar with gets the nod by reflex. Even if you’re willing to, you likely don’t have the time when shopping to consider all the alternatives.
______
Dennis
@ Cathy
Good old Devo stated it as early as 1980: “Freedom of choice/ is what you’ve got./ Freedom
fromchoice/ is what you want.” And then there’s this quote attributed to George Bernard Shaw: “Liberty means responsibility. That is why most men dread it.”I’m not attacking you; I’m just saying it’s interesting that cognitive science has come to confirm the previous insights of sloppier thinkers. And I thank you for the book recommendations–I already knew Kahneman’s, and will definitely look up the other two.
@esr:
>Somehow I expected my hacker peers to age more gracefully, to retain their neotenous flexibility even if they were physically aging.
Alas, if I am any indication, and I believe I am, I think you have overestimated their neotenous flexibility in their youth. I’m not a “hacker” in the sense defined in “How to Become a Hacker”, lacking the demonsrated skills and the endorsement of other hackers, but I believe I fit the personality type well. I’ll call myself a hackeroid. I am in my mid-to-late twenties, and compared to my non-hackeroid peers, am very much a grouchy, hidebound old fart, in fact, I’d say I’m more of a grouchy, hidebound old fart than many non-hackeroids a decade or two older than me. And from what I can see other hackeroids my own age are much the same.
To self evaluate, I’d say that I’m above average in mental flexibility when it comes to completely new things, but for old concepts, where I have an idea of How Things Should Work, and an established workflow, I can be very curmudgeonly. If changes are forced upon me, I certainly have the mental capacity to deal with them (once again, I’d say my ability to deal with such a situation is above average), but I *will* drag my feet and gripe about it the whole way. If changes are not forced, I won’t change my workflow until they are (unless I find something really neat and intriguing).
From what I can see, this is a common tendency among hackers and hackeroids of any age and is a driving force behind holy wars and religious issues.
So it’s not implausible that your hacker peers will age *less* gracefully than normal in terms of curmudgeonliness. Even if they age more gracefully, they’re starting from behind.
As for how gracefully *you* might age in this regard, ISTR reading somewhere in your writings that you believe you are psychologically atypical among hackers, in particular being a fair bit more extraverted. This may make you a bit less inclined to old-fartism than other hackers. On the other hand, I am very inclined to old-fartism, but while my behavior is broadly typical of a hackeroid personality, I’m more of an extravert with introverted defense mechanisms than a straight introvert, so you may not be safe.
Jeff Read on 2014-10-29 at 17:09:15 said:
“…even as study after study confirms that languages which give a shit about safety, like Ada, have a lower overall development cost…”
How can a language give a shit about safety? It’s not a thinking, rational being. I’ve heard this same sort of spiel over and over for 20+ years– Java and all the garbage collected languages were going to save us from memory leaks (never mind that memory ain’t the only dynamic resource that needs to be managed), Ada was a safe language, blah blah blah.
It’s not the language. It’s the programmer. It’s easier for a good programmer to write good code in C++ than it is for a good programmer to write good code in Visual Basic, but he can still write relatively good code in VB. It is no harder for a dumbass to write to crap code in Visual Basic than it is for a dumbass to write crap code in C++. Either way, the dumbass is going to write bug ridden, inefficient, insecure trash. The dumbass programmer can and will spell “spaghetti” in any language. No language will ever prevent the dumbass moron programmers– which sadly in my experience is most of them– from writing insecure, inefficient, unmaintainable dreck.
As for change logs, are you kidding me! I’d quit a job that mandated I maintain some stupid file, instead of just using commit messages. I’m sure not going to spend my free time maintaining them.
ahd: I don’t know much about go, but I do know a bit about player ratings from chess. I assume that go’s ratings work similarly.
How do you equate ratings from two different player pools? Are there enough players that use both to draw comparisons?
Jakub: WTH is an (e ogonek)?
That Jeff Read likes authoritarian languages that know better than programmers surprises me not at all, given his love of authoritarian governments that know better than their citizens.
Eric: You know what the answer to a badly-documented feature is…
As for maintaining mental flexibility…my latest project hasn’t involved computing at all. It’s a rusty 1983 Mercedes 380SL that I’ve been working on myself rather than spending thousands of bucks to have someone else fix. It’s been soaking up space in my garage for going on five months while I deal with a rusted-out suspension component (pro tip: if the spring is poking out the bottom, it’s time to replace the part).
I’ve probably – no, definitely – spent more on tools than I have on parts, and some that have no use aside from this specific car. I’ve spent lots of time lying on the ground, scratching my head while I figure out how to do something without pulling the car down off of the cribbing it’s sitting on (but never on top of myself; safety first!). I’ve parked my daily driver outside for all that time, and my roommate has parked outside for the last couple of months; that will have to change very shortly, once the snow flies. It’s been immensely frustrating at times.
But the successes have been worth it. Just tonight, with the help of a co-worker, I got the main rear suspension subframe mounted back on the car. From here, it’s just a matter of reassembly. There’s still work that’ll need doing, but my goal is to have it back together enough to take it for a drive Saturday.
And I’m learning a hell of a lot. That was the goal, and it’s been more successful than I could have ever guessed.
> Yes, this has been studied in depth. There are two modes of decision-making, called “type 1? and “type 2?. One is carefully-reasoned but slow, the other is fast gut-based but often wrong. It makes sense given our evolutionary history, when you needed to dodge the sabertooth NOW without thinking deeply about it. It doesn’t work so well in a hi-tech civilization.
Additionally, from what I have read, gut-based “type 2” decision making gives *better* (not only faster) results in the case of insufficient, partial information.
The research was done by giving tests to people with damaged connection to emotional center of brain (and comparing their response to control group). So much for Spock-like “cold logic” being superior…
@Ted Walther:
> Jakub, do you know of any performance comparisons between Marpa and Ragel?
No, I don’t know any. You can ask on “Marpa Parser” Google group (link from Marpa homepage).
@Jay Maynard:
> Jakub: WTH is an (e ogonek)?
U+0119 (“E with a little tail”), a letter in the Polish alphabet.
That Jay Maynard likes languages that assume the programmer makes no mistakes and fail spectacularly when they do surprises me not at all, given his love of governments that assume humans are rational utility maximizers and fail spectacularly when they turn out not to be.
You’re right about the garbage collection. It’s an obsolete technology. RAII is how you should be managing resources for 90% of cases; the other 10% can be covered with smart pointers or other automatic deallocation systems that don’t rely on nondeterministic GC.
As to Ada being a safe language — virtually all commercial airliner avionics is written in Ada. The fact that airplanes usually don’t suddenly apply hard up elevator and stall and crash or something suggests that Ada is pretty damn safe. Could Boeing and Airbus have written the equivalent avionics code in C or C++? Maybe, if they were really careful and had strenuous code review and verification processes… but if you would but look at the published research on the subject, you will see that Ada projects consistently have lower costs and lower bug counts than do the equivalents in C family languages.
I’m not concerned about dumbass programmers; I’m concerned about good, but still error-prone, ones. All programmers make mistakes — even the good ones. What’s wrong with having assistance from your tooling — including (especially!) your language — to stop you from making bone-headed mistakes before they make it into production code? You can do virtually everything in Ada that you can in C++. All Ada asks is that you be very explicit and yes-I-know-what-I’m-doing about unsafe operations, such as type coercion or pointer aliasing. And when you have to go back and
readthat code (professional programmers do a whole lot more reading than writing of code) — well, I’ve seen both, done professional work with C++ and amateur work with Ada, and I know which one is more readable.I am writing this from a raspberry pi running http://rpitc.blogspot.ro/
a thin client distribution and a fast server.
It works. I didn’t use any remote desktop, just ssh to to the server with -X
and run applications there. Also I can run a browser locally.
There is a bit of lag in character applications (fast more-ing through a text file). Browsing remotely (over ssh) is
ok. Viewing movies from the browser only works if they are smallish. Full screen, 1920×1080 has too much lag. I guess this is because of the ssh. Also viewing pdf-s running evince remotely is too slow. With js in the browser, however, it is pretty fast, certainly usable.
emacs, open-office, inkscape and gimp work adequately.
Thus, for a really cheap thin terminal, 50-100$ (depending on your choice of keyboard,
mouse, case, supply, etc), raspberry-pi may be worth a try.
@Jon Brase: Your old fartism will be temporary. Now that you are in your 20s, it’s a natural reaction to the memories of what a damn fool you were when you were younger. You’ll get over it, and be in a much better position to evaluate new ideas in comparison to the older ones.
BTW, some advice – truly new ideas are *very rare*. “There’s nothing new under the sun.”
@ Jeff Read & Jay Maynard
Please tell me that your argument about programming languages and politics isn’t too serious. (Partial seriousness is acceptable, as there may be insights to be gleaned about mindsets on the libertarian/authoritarian axis.)
Lambert: I think there’s more than a little insight to be gained there. I am quite serious: it speaks to Jeff’s outlook on people and life, and mine (and, in general, those of programmers).
I don’t know for certain what Jeff’s response to the maxim that “C doesn’t prevent you from doing stupid things because it would also prevent you from doing clever things” would be. I would, however, venture a guess that he would disdain the notion that programmers can be trusted to do clever things, and so does not consider that any great loss.
The loss of programming freedom, and the loss of personal freedom, are the same kind of thing. I consider those serious bugs. Jeff does not.
@Jeff Read:
If you did ‘s/Ada/Turbo Pascal/’ the paragraph would still be true and pretty much contain the same content as ‘s/Ada/MFTL’. It does not matter. Why C is still acceptable in systems programming? Because nobody’s going to write an kernel, a boot loader, a device driver, or anything of the sort in Ada or MFTL or Turbo Pascal. That’s why.
> I assume that go’s ratings work similarly.
ratings, yes, mostly mutant variations of Elo. they then map that back to rankings (30 kyu to ninth dan) via some amazingly dodgy heuristics.
> How do you equate ratings from two different player pools?
> Are there enough players that use both to draw comparisons?
in theory there *ought* to be. just. the math is ambiguous about how much overlap you need, but it should be doable. in practice the problem is identifying the overlapping players and federating the various game databases, so no one has yet.
so in practice, we use heuristics to map the rankings from various systems, see the wiki page referenced upthread for an example.
This reminds me of when I tried to convince people to support the standard clipboard copy-paste protocol, a goal I decided to pursue after reading somewhere that my beloved editor was one of the last holdouts: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1765
It actually worked out of the box in v. 24.something. My dotfile is shrinking with each release.
Also I must admit I still haven’t gotten entirely used to the new standard clipboard behaviour.
My take away from your screed is the Dunning-Krueger effect. Thanks.
>I’m almost 56, an age at which a lot of younger people expect me to issue semi-regular salvos of get-off-my-lawn ranting at them. But no – I find, that, especially in technical contexts, I am far more likely to become impatient with my age peers.
Well, you better not! Your role model, Heinlein, always felt like a writer who was raised in the 1950’s, when in fact he was born in 1907. But he just came accross as a textbook 1950’s man who is not too prudish about sex or nudity, can drive long distance, has no problem with flying, and writes in 1979 that the maybe the next society-changing invention is the computer chip. Not someone who was born in the horse and buggy age… If I don’t buy the Expanded Universe, I would have guessed a birthdate of 1940.
Another thing – be aware that certain aspects of world are getting rigid, and it is not your fault. In the kind of libertarian political philosophy you follow, not a whole lot creative and new was written in the last few decades as far as I can tell. (Maybe Hoppe’s works.) So not changing is not your fault in cases where there is not really much out there to keep up with to begin with.
Technology is going proud, but I certain slow-down in the humanities, from political philosophy to sociology. I mean, take the Thomas Piketty craze. Not only that he is not a good economist but even in this vaguely Marxist group a fluff – look at Joan Robinson for a more serious one of the same political leanings. Even though I was born in 1978, I think having todays tech and science but the humanities of about 1980 would not be a huge loss. Philosophy? Two Dogmas of Empiricism, 1951, What It Is Like To Be A Bat?, 1974…
So if even if you feel you are getting rigid in something, maybe it is the world that is not moving around you. I certainly see this outside technological fields.
>> So if even if you feel you are getting rigid in something, maybe it is the world that is not moving around you.
Please explain. Being a rigid old fart feels very different from being a revolutionary in a dead/ossified field.
(Generally relevant quote I just remembered from Einstein about the development of quantum physics: ‘many a young revolutionary becomes an old reactionary.’)
@Jeff Read says “…given his love of governments that assume humans are rational utility maximizers and fail spectacularly when they turn out not to be.”
I think Jay and I are probably in agreement that humans tend *not* to be “rational utility maximizers” especially in areas that don’t concern directly concern themselves, which is why every government made of humans will fail. And all governments are collections of humans. Any government that takes decisions out of the hands of the individual and places it in the hands of another human in the government, counting on that government employed human to “rationally maximize utility” is going to be the spectacular failure.
Not just one incompetent human, but thousands of them, each with their own irrationalities and ulterior motives. Perhaps government is a ‘Bondage&Discipline’ decision-making entity.
“The fact that airplanes usually don’t suddenly apply hard up elevator and stall and crash or something suggests that Ada is pretty damn safe.”
No, it suggests that the programmers using it are good programmers who take care, that it’s well tested code, and that the results of not using the utmost care are completely unacceptable. It’s not the language, it’s the programmers.
“I’m not concerned about dumbass programmers;”
You probably should be. They seem to be writing most of the code out there these days.
“I’m concerned about good, but still error-prone, ones. All programmers make mistakes — even the good ones. What’s wrong with having assistance from your tooling — including (especially!) your language — to stop you from making bone-headed mistakes before they make it into production code?”
I totally agree with all of this. I want all the assistance I can get from my tools– but I want assistance, not hindrance. I want to be enabled to write great code, not prevented from writing bad code.
“And when you have to go back and read that code (professional programmers do a whole lot more reading than writing of code) — well, I’ve seen both, done professional work with C++ and amateur work with Ada, and I know which one is more readable.”
I’ve done professional work with both. I find Ada and the other Pascal derived languages unreadable, even when they’re not spaghetti. They’re full of content free noise, to me. (Why type “end” when ‘}’ is every bit as clear?) This may be a matter of taste, and that’s fine.
While in theory ‘}’ may be as clear as ‘end’, it’s easy to lose in visual noise. It resembles ) more or less closely depending on font. Certainly, you can use matching pairs highlighting in most modern text editors, but space is cheap these days, and dedicating a bit more of it to clarity is a good thing.
Inflexibility can set in at *any* age.
“While alive, the body is soft and pliant
When dead, it is hard and rigid
All living things, grass and trees,
While alive, are soft and supple
When dead, become dry and brittle
Thus that which is hard and stiff
is the follower of death
That which is soft and yielding
is the follower of life”
@Cathy “The answers are not what most people believe they are…”
They’re not? This isn’t like the Monty Hall problem, where there’s exactly one car rather than a 33% chance of a car behind each door (and therefore a 1/27 chance of three cars), and where the host always reveals a goat behind a door the contestant did not choose.
@Tara Li, in my experience using both types of languages (I have extensive experience with C++, perl, VB, and Delphi, plus some with Ada) I have found that I prefer ‘{‘ and ‘}’ and that “begin” and “end” add to the visual noise, rather than clarify. As I said, “This may be a matter of taste, and that’s fine.” YMMV. De gustibus non est disputandum. It’s religious war and I’m sorry I mentioned it.
But I think we can all agree that manularity is evil and locality of reference is good, and thus change logs being manual and breaking locality by removing the message from the associated commit, fail on both points.
I might encounter a programming language that prevents me from writing code so bad I’ll harm myself more than my good code enables me. Without further information, I would tend to prefer that language.
I might encounter a programming language that enables me to write code so good I’ll empower myself more than my coding mistakes hinder me. Without further information, I would tend to prefer that language.
I might encounter a programming language whose features enable me and protect me, but to unknown extents. Without further information, I would prefer to try that language, for as long as I wish, and be able to put it back down again if I wish, without having someone large threaten me, or someone with a big mouth attempting to shame me, if I don’t stop using it.
Most of my programming language encounters – and my governmental encounters – are of the third kind.
>I might encounter a programming language that enables me to write code so good I’ll empower myself more than my coding mistakes hinder me.
My experiences of Python and Lisp have been like that.
Would it be possible to make languages configurable (compiler has a set of options, or something, which allow tweaking how it compiles the code) so that programmers can fine-tune the degree of assistance/hindrance given. (Potential downfall: sections of code tweaked differently interacting badly)
>> I want to be enabled to write great code, not prevented from writing bad code.
A long standing trend among great works is that they break various rules (e.g. Schoenberg and other early 20thC music), but that the maker is skilled enough to know when to break them. Enforcing rules pulls the result towards mediocrity, which, while worse than greatness, is better than what the average suit would produce if told to program in Lisp.
Cathy, I agree with Random832: this problem is defective. I know what it’s trying to get at: 1/3, not 1/2, of two-child families that have at least one daughter have a second one; OTOH, 1/2 of two-child families whose
elderchild is a girl have a second daughter. But as stated, the answers to your questions are just the obvious ones: a) 50%, b) 50%, c) no. When a particular daughter comes up to you, she’s already been distinguished as occupying a particular “slot” among the two children — by being the particular one standing in front of you — the same way that she would be by being identified as the elder daughter.@Jeff Read (or @Rob K, to whom he was replying):
Please help a fellow programmer understand. As a resource management strategy, garbage collection works from the assumption that the lifetime of variables cannot always be deduced from scope information; consider C’s “static” keyword (defining local variables which do not get re-initialized each time, but whose contents persist “indefinitely” between calls) as a example of a language feature which separates scope and lifetime. How does the RAII pattern address managing resources (such as a network socket) that should have indefinite lifetime, but for security reasons also should have the most limited scope possible?
> But I think we can all agree that manularity is evil and locality of reference is good, and thus change logs being manual and breaking locality by removing the message from the associated commit, fail on both points.
The fact that you can’t fix an incorrect statement (or an incomplete one, or a typo) in a commit message without burning down the world is an argument in favor of changelogs.
@Morgan Greywolf:
If you did ‘s/Ada/Turbo Pascal/’ the paragraph would still be true and pretty much contain the same content as ‘s/Ada/MFTL’. It does not matter. Why C is still acceptable in systems programming? Because nobody’s going to write an kernel, a boot loader, a device driver, or anything of the sort in Ada or MFTL or Turbo Pascal. That’s why.There’s another reason too. In order for people to take advantage of all the wonderful safety features of Ada/TP/MFTL/Python/etc, somebody has to write the interpreter/libraries/low-level code that implements those features. What language do those get written in?
Basically, when someone says “Ada is safer than C”, what they’re really saying is, “I’m outsourcing all the hard problems of writing safe code to the person who writes the low-level C code that underlies Ada”. Somebody still has to do it.
I believe there’s a saying: “Humans cannot eliminate the need to use their intelligence, no matter how cleverly they try.”
@Rob K:
(Why type “end” when ‘}’ is every bit as clear?)As a Python enthusiast, I’ll go even further: why type “}” when is every bit as clear?
http://blog.peterdonis.com/rants/delimiters-suck.html
Oops, the “dedent” in “when dedent is every bit as clear” got left out of my last comment. But maybe that makes it even sharper. :-)
>somebody has to write the interpreter/libraries/low-level code that implements those features
Yes, smart people write it, so those less disposed to programming can write better (less bad?) code.
@Peter Donis: “For example, the reviewer applauds the fact that Go doesn’t require semicolons–but then says: Well, actually there are semicolons, but they are discouraged. It works like JavaScript, there is a simple rule that makes the parser insert a semicolon at certain line ends.”
I certainly
hopeit doesn’t work like Javascript, because the way Javascript works is horrifying. “Certain line ends” means “line ends otherwise preceding a syntax error at the beginning of the next line”. EvenVisual Basic(which evolved from all line ends delimiting statements except explicit continuations, to allowing continuations to be implied by an incomplete statement) is better than this, since it doesn’t make the meaning of one line dependent on context provided in the next line.@Random832:
> The fact that you can’t fix an incorrect statement (or an incomplete one, or a typo) in a commit message without burning down the world is an argument in favor of changelogs.
You can change commit message after the fact in Subversion (because svn:log is server-stored separate unversioned property… with all disadvantages that come from retrospective change of published data). You can use git-notes to add comments to commit messages in Git, or even git-replace commit, though enabling it is optional (you must fetch notes and replaces refs from server to see their effect).
Anyway same as you should clean up history when submitting changes, you should clean up commit message when submitting changes. IMVHO the disadvantage cause by violation of SPOT (Single Point Of Truth) principle with GNU-style ChangeLogs is worse than the gain of ability to fix commit messages.
In addition to solving new technical puzzles, I find that reading outside my own political ideology keeps me alert. (I’m 45.) It’s one of the reasons I hang out on this blog, actually: There’s nothing quite like swimming in a libertarian shark tank to keep this liberal on his — fins, I guess.
>There’s nothing quite like swimming in a libertarian shark tank to keep this liberal on his — fins, I guess.
Obligatory: You’re Not a Liberal!
@Daniel Franke:
When a particular daughter comes up to you, she’s already been distinguished as occupying a particular “slot” among the two children — by being the particular one standing in front of you — the same way that she would be by being identified as the elder daughter.I don’t think this is right. In the case of the elder daughter, there is something distinguishable about the “slot”; only one of the two children can occupy it. In the case of the daughter who happens to be standing in front of you, there’s no reason why either child could not occupy that “slot”–it’s just random chance that that particular child happens to occupy it at that time.
Maybe a better way of saying this is that which child occupies the “eldest child” slot is static–it’s fixed for all time by the birth order of the children. But which child occupies the “child standing in front of me” slot is dynamic–it depends on which child happened to run out to see who was talking to mommy. The reasoning that says the chance of the other child being a daughter is 50-50 if the child standing in front of you is a daughter takes a “slot” that is dynamic and applies reasoning that’s only valid if the slot is static.
> Anyway same as you should clean up history when submitting changes, you should clean up commit message when submitting changes.
You should fix all the bugs you introduce, too. If everyone did, we would never have any bugs, right?
The maintenance burden can be solved by (somehow) automatically adding new commits to the end of the changelog – maybe every commit, maybe just every release. The single point of truth issue is solved by recognizing these are two truths: One is what commit message someone actually made when they committed the code, and the other is the accurate description of what actually happened to the code.
“Maybe a better way of saying this is that which child occupies the “eldest child” slot is static–it’s fixed for all time by the birth order of the children. But which child occupies the “child standing in front of me” slot is dynamic–it depends on which child happened to run out to see who was talking to mommy.”
Well, until this changes, it’s equivalent to which one
firstran out. If she goes back in and the other child runs out, then you’ll know the answer for certain so the whole exercise is irrelevant.Peter Donis on 2014-10-30 at 12:45:08 said:Oops, the “dedent” in “when dedent is every bit as clear” got left out of my last comment. But maybe that makes it even sharper. :-)
No I think it just illustrated the reason why delimters are good. I dislike intensely the requirement to have differenig amounts of white space be the only reason somethingnis in a block. There are (IMHO) far too many ways that can accidentally and silently break. e.g. copy/paste removing newlines, replacing spaces with tabs (or vice versa) etc.
P(A)/P(B)=P(A|B)+P(A|~B) (Probability is conserved http://lesswrong.com/lw/ii/conservation_of_expected_evidence)
P(A)=probability other child is female
B=other child is youngest
Given that whether the child shown is older or younger in the exercise has no effect on the other’s gender,
P(A|B)=P(A|~B)
? P(A)/P(B)=2P(A|B)=2P(A|~B)
As there is no prior evidence on the ages of the children, P(B)=0.5
? P(A)=P(A|B)=P(A|~B)
Q.E.D.
(I feel like I have manipulated the expressions (esp. A|B) incorrectly.)
@Random832:
Well, until this changes, it’s equivalent to which one first ran out.Yes, but that just leads to the question: what determines which child first runs out?
The smaller child is the one that runs out first after making leftover sandwiches.
that just leads to the question: what determines which child first runs out?Ah, I see where I was going wrong now. Let me approach this by describing the process that (I believe you and Daniel Franke are implicitly assuming) picks out the child that comes out.
We assume that the mother’s family is a random sample from all families with two children. Given a house with two children, one of the two will see mommy talking to someone outside and come out to see who it is, but it is a random chance (50-50) which one it will be.
The fact that the child that comes out is a girl obviously rules out a family with two boys. However, since it’s a 50-50 chance which of two children will see mommy come out, in a household with a boy and a girl, there is only a 50-50 chance that the girl will be the one that comes out; whereas, in a household with two girls, it’s certain that a girl will come out. So, while there are twice as many households with one boy and one girl, only half of them (on average) will have a girl come out; so the girl that comes out ends up with a 50-50 chance of having a sister.
Now, having made the process explicit, it is, of course, easy to concoct variations on it to support the 1/3 chance of a sister that was my original answer. :-) For example: boys never bother to come out to see who is talking to mommy, but girls always do. So any household that has a girl in it will have a girl come out to see who is talking to mommy. In a household with two girls, whichever one notices first comes out (50-50 chance of either). Now every boy-girl household will be certain to have a girl come out, so the girl that comes out has only a 1/3 chance of having a sister.
Which of these processes is more likely to be instantiated in a real household is left as an exercise for the reader. :-)
>Ah, I see where I was going wrong now. Let me approach this by describing the process that (I believe you and Daniel Franke are implicitly assuming) picks out the child that comes out.
My reasoning was different and simpler. I simply refused to confuse nonreplacement probabilities with replacement ones. If you think observing the first child changes the probability of the second child being the same sex, you’re making exactly the same error as a gambler who, having seen a run of blacks on a roulette wheel, bets heavily on red coming up.
In fact there are some biological effects in play which make the sex of offspring slightly more correlated than a non-replacement model would suggest. But I think the author of the puzzle intended it to be about probability theory, not biology.
Took me a while to figure out what dedent was. I always heard that called “outdent”. :)
> For example: boys never bother to come out to see who is talking to mommy, but girls always do.
If they
alwaysdo, then obviously the other sibling is a boy, evidenced by the fact that he is inside the house.Any probability you might assign to them coming out affects the end result because you have to drop out cases where they both did,
unlessthe process includes never going out if the other sibling has already gone outside.FrancisT: While I do wish Python wasn’t hamstrung by differing number of spaces per tab stop, I do think that syntactically significant indentation is a Good Thing. It takes something you should be doing anyway and makes use of it.
If your block indentation is inconsistent or unclear, it’s likely your thinking about the structure of your program is unclear as well.
I’m definitely losing my mental flexibility. I can no longer reconcile leftist ideas with good intentions. If you want to use the violence of the government against peaceful people, YOU ARE AN EVIL PERSON. No more can I put up with fucking idiots suggesting stupid ideas that will hurt themselves and other people. How could I ever do that??
Jay – That’s one thing I really like about working in Visual Studio.
Whitespace doesn’t
programmaticallymatter at all in any of the .NET languages.But at the same time, the environment essentially pretty-prints all of your code in mostly real time*, making block indentation reflect structure automatically, and thus letting you
seethat your logic, at least the grand structure of it, matches what you think you’re doing.(* Mostly, because it’s not
tooaggressive about re-formatting , which is nice for not causing false positives when mercurial confuses a whitespace change for something meaningful, something it’s too eager to do. In some cases you can end up with new code being indented “properly” for the logic, but the surrounding code still having a legacy indent that’s different.But in those cases one can trivially force a re-format of the code.)
@Russ Nelson:
Which part of that post was sarcasm: was it pro- or anti- left?
Also, the reasoning ‘I disagree with you therefore you are evil’ is not rigidity, but rather plain tribalism.
Jay Maynard on 2014-10-30 at 14:51:19 said:FrancisT: While I do wish Python wasn’t hamstrung by differing number of spaces per tab stop, I do think that syntactically significant indentation is a Good Thing. It takes something you should be doing anyway and makes use of it.
If your block indentation is inconsistent or unclear, it’s likely your thinking about the structure of your program is unclear as well.
I’m not arguing against the requirement for block indentation to be consistent and clear. However I see the requirements in python to be too strict and limiting and the reason why they are strict and limiting is that there is no other block delimiter.
Regardless, it’s much more a characteristic feature of the Left than the Right. Conservatives are empirically much more likely to describe their political opponents as mistaken or even delusional, while liberals tend to describe conservatives as depraved.
@Lambert, oh, no, no, no. I restrict my judgements to areas which I have studied. I don’t judge them because I disagree with them. I disagee with a lot of people on a lot of things, for example the long-run value of rap music (or in its turn, disco). I disagree with people who think that the Drooling Stones are the best rock-n-roll band ever (actually Led Zeppelin is the best), but they’re not evil for thinking with that.
No, I disagree with them because what they want is evil. A higher minimum wage is evil. Centralization of power (whether in government or business) is evil. Obamacare is evil. Impoverishing people because of a chemical is evil, whether that chemical is cannabis or CO2.
Where I think I have lost mental flexibility is that I no longer have the ability to put up with bullshit.
FrancisT,
I dislike intensely the requirement to have differenig amounts of white space be the only reason somethingnis in a block.You can see that. It’s obvious. Try tracking down which brace belongs to which brace, and once you’ve fucked it up, which brace REALLY belongs to which brace. You know how you figure it out? You go look at the indentation.
But once you’ve got the indentation correct, you don’t need the braces. Once you have grown up, and mastered programming, you, too, will not need crutches or braces, my child.
“You know how you figure it out? You go look at the indentation.”
No, I use a tool. Every editor worth anything has had brace matching for a long time. But what happens when the indentation gets messed up, and it’s not clear whether that last line should be in the sub-block or not? And the guy who wrote it got fired a year before you were hired?
@Russ Nelson:
What separates the former case from the latter?
> This month I’m going to learn Go.
May I suggest Rust instead? For getting any actual work done, Go would be better, but for playing with cool programming ideas, Rust is a lot more interesting.
Go feels like a cleaned up C, with some good lightweight concurrency support in the core language.
Rust feels like someone took the best parts of C, Haskell and Erlang and merged it all into one language in a way that actually makes sense. (Well, mostly. It’s a lot cleaner than C++, but I guess that isn’t setting the bar very high.)
>May I suggest Rust instead?
I was already considering that change. I read the Rust guide today and was impressed. It has map. And filter. And closures. And yet, it
compiles!>Rust feels like someone took the best parts of C, Haskell and Erlang and merged it all into one language in a way that actually makes sense.
Or, as I put it on G+, I was all like “Oh, so this is what happens when C has weird sex with Haskell!”
>Did the full-WIMP thing for decades. Now find it superfluous. Well, except for the browser.
Don’t you use the GTK frontend for Emacs? Personally, I’ve become pretty attached to the Zenburn theme; don’t know what it looks like inside a terminal emulator, and would rather not find out. :-P
@Random832:
Any probability you might assign to them coming out affects the end result because you have to drop out cases where they both did, unless the process includes never going out if the other sibling has already gone outside.I meant to include that by saying that, if both siblings are girls, whichever one notices first is the one that goes outside. I should have said “the only one that goes outside”. I agree that, if this assumption is dropped, it makes a difference.
Has anybody written a technical history of version control systems?
Having spent my entire professional software career in the post-git age I am surprised to learn just how primitive some of these early systems were (or, rather, *are*). The idea of version control without changesets is entirely alien me. I would like to learn more about how the field has developed.
>Has anybody written a technical history of version control systems?
I have an incomplete draft of one. Does this surprise you? :-)
@esr:
I simply refused to confuse nonreplacement probabilities with replacement ones.Hm, you’re right, this is a simpler way to get the answer, and I think it generalizes better as well.
> Impoverishing people because of a chemical is evil, whether that chemical is cannabis or CO2.
Do you believe that people have the right to forbid you from blowing excessive amounts of smoke (whether cannabis, tobacco, or from any other substance) into their property?
Do you believe that people have the right to forbid you from blowing excessive amounts of CO2 into their property?
If these answers are different, why?
MMmm…so can a commit contain fixes for more than one bug fix and does the commit metadata matter with respect to the bug fix documentation you still need to do to close out the bug?
We don’t do change logs but our commits do contain the JIRA issue IDs it addresses. Most of the time it’s one issue per commit but sometimes not.
/shrug
The mechanism of change logs seems very much outdated but I don’t think depending on just the commit messages is sufficient either.
So the concept of change logs in a modern development ecosystem lives elsewhere…probably the issue tracker.
@esr
Whether you pick Go or Rust or both, I trust you’ll write of your experiences.
I followed your lead on Python many years ago and it turned out well. But lately I’m beginning to doubt it’s future so there’s more incentive to look around.
Cathy: “You’re out for a walk and run into an old friend. She mentions that she has two children. (a) What are the odds that she has one of each gender? A moment later, a girl runs up behind her, whom your friend introduces as her daughter. (b) What are the odds that your friend’s other child is a boy? (c) Do the odds change if you are told that her daughter is the elder sibling?”
[Interesting back and forth between Random832, Daniel Franke, and Lambert]
esr: “My reasoning was different and simpler. I simply refused to confuse nonreplacement probabilities with replacement ones. If you think observing the first child changes the probability of the second child being the same sex, you’re making exactly the same error as a gambler who, having seen a run of blacks on a roulette wheel, bets heavily on red coming up.”
I didn’t mean to sidetrack the thread with this throwaway problem, but pondering problems like this *is* a good way to stay mentally flexible as we age. :-)
However, I don’t think that Eric’s reasoning is valid here. Let’s put some numbers on this.
We start with 1000 households. Assume that sex probability is exactly 50/50 (ignoring that in real biology this isn’t quite true). 250 of them have two girls, 250 have an older boy and younger girl, 250 have an older girl and younger boy, and 250 have two boys.
Once the girl comes out of the house, we can eliminate the 250 households that have two boys; we know that this house isn’t one of them. So now the possible set from which the house is drawn is 250 households with two girls and 500 households with a boy and a girl. Ergo, the probability that the other child is a boy is 2/3. (This logic here is somewhat similar to the Monty Haul problem, though not identical.)
However, if we know that the girl is the
eldestchild, then we also have to eliminate the 250 households in which the boy is the eldest child. That leaves us with 250 households with two girls, and 250 households with one boy and one girl. Ergo, the probability that the other child is a boy is 1/2.What’s magic about the age of the child? Nothing; it could be any other attribute with 50/50 probability, but it’s state has to be
uncorrelated with the state that determines which child is standing in front of you. It has nothing to do with “static” vs. “dynamic”.The argument about using the “which child comes out to you is random 50/50 and can serve the same purpose as age” doesn’t work, because you always see the one that comes out with 100% probability, so you don’t get any new information.
>> Has anybody written a technical history of version control systems?
> I have an incomplete draft of one. Does this surprise you? :-)
Hmm, perhaps what Eric really need is a a tip jar donation large enough to let him take an extended sabbatical and finish all those incomplete drafts of books, technical histories, and whatever else he keeps mentioning. :-) I’m afraid I am not the one who can finance that…
>I have an incomplete draft of one. Does this surprise you? :-)
Not in the slightest. :-)
I was actually thinking as I typed the question that such a project would be right up your alley.
Any plans to complete the draft?
>I was actually thinking as I typed the question that such a project would be right up your alley.
As indeed it is. There might be a better qualified person to write it out there somewhere, but I am certainly competent to do it.
>Any plans to complete the draft?
If you mean as in “schedule”, no. But it remains on the to-do list.
@Cathy:
So now the possible set from which the house is drawn is 250 households with two girls and 500 households with a boy and a girl. Ergo, the probability that the other child is a boy is 2/3.As Random832 pointed out, this assumes that, if a girl is in the house, she is certain to come out. But what if, in a house with a girl and a boy, there is only a 50-50 chance that the girl will come out (for example, suppose that the first child to spot the person talking to their mother is the only one that comes out, and there is a 50-50 chance for each child in the house to be the first). Then, as I said in an earlier post, while there are twice as many girl-boy households as girl-girl households, only half of the girl-boy households will have a girl come out, so the number of girl-boy households that will have a girl come out is only 250, not 500.
>> Has anybody written a technical history of version control systems?
> I have an incomplete draft of one. Does this surprise you? :-)
Perhaps you could use that to update TAOUP’s section on version control, should you decide to work on a revised edition of that book. (And while you were at it, you could update the section on text editors by acknowledging that Wily has been superseded by plan9port’s version of ACME and, to a lesser extent, by ACME Stand Alone Complex.)
For those still pining away for the fjords of sliderules:
http://www.antiquark.com/sliderule/sim/n909es/virtual-n909-es.html
Yes, this is a browser-based sliderule. Just in case you need to do high end mathematics, but only have an Internet connection!
Rob K:
Well put sir. My I quote you, or just steal it?
> I dislike intensely the requirement to have differenig amounts of white space be
> the only reason somethingnis in a block. There are (IMHO) far too many ways that
> can accidentally and silently break. e.g. copy/paste removing newlines,
> replacing spaces with tabs (or vice versa) etc.
Craftsmen pick their own tools, so fine, whatever, but a copy/paste gone bad can nuke a } just as easy, and:
set tabstop=4
set shiftwidth=4
set expandtab
set smarttab
in your vimrc solve the other problem. Tabs don’t belong in source code anyway :)
while I agree with you….
LET THE HOLY WARS COMMENCE!!!!!!!
@William O. B’Livion “My I quote you, or just steal it?” Yeah, sure, whatever. Ain’t like it’s really original with me.
@Cathy
“You’re out for a walk and run into an old friend. She mentions that she has two children. (a) What are the odds that she has one of each gender? A moment later, a girl runs up behind her, whom your friend introduces as her daughter. (b) What are the odds that your friend’s other child is a boy? (c) Do the odds change if you are told that her daughter is the elder sibling?”
Looks to me as a variant of the Monty Hall problem (three door puzzle):
http://en.wikipedia.org/wiki/Monty_Hall_problem
Any solution that tries to use girl/boy psychology or demographics is cheating ;-)
Btw, keeping mentally agile seems to demand exercising hand-eye coordination and cognitive activities that grow new neural sprouts (i.e., learning new skills, you might try new languages).
http://www.sciencedirect.com/science/article/pii/S0925443911001633
But the evidence is still sparse.
So, ESR is actually younger than I am? (It is a long way from TMNN.) I turned 61 this summer and actually feel somewhat like Eric, in that certain modern developers (old or young) have lost touch with the roots of the OSS/*NIX ethos.
In my younger days I did quite a bit of work writiing code, both professionally and for my own satisifaction. I feel quite lucky that in many cases the two were actually happening at the same time. In 1981 (or thereabouts) I was inventing the predecessor of the “System V Init System.” It was for System IV, a release internal to Bell Labs. We wanted to do all sorts of neat things with it, but a lack of time and computer power/speed meant that we punted certain things to human brain power. [Such as specifying and solving dependencies for service startup. Yeah, I admit to punting it.]
The folks currently re-inventing or maintaining system initialization systems (of all stripes) don’t seem to understand or feel any sort of involvment with or sense of being driven by the needs of the users. It has been said multiple times, in several conversations, that if one doesn’t like the way it is being done, then get off your duff and write code to do it the way you want it. No acceptance of “constructive criticisism” or recognizing the needs of other pieces in the system that might suggest doing things a different and more compatible way.
For me, this is a “been there, done that, have the tee-shirt” sort of thing. You are where you are because the pioneers opened the frontiers and made the roads and infrastructure you’re fixing. But, there “ain’t no respect” (thank you Rodned Dangerfield) and you will be branded as one of those (as ESRs so nicely put it) “mossbacks” with nothing left to contribute.
As it happens, I still dabble in system administration and programming despite my forcible retirement from formal work. I still follow most of the developments as they happen in GNU/Linux land (and in genetics — my 2nd major in college.) Lots of the stuff I write now is for my own amusement, but I’ll clean it up and “do the right things” occasionally and shove it out on the ‘Net for anyone to do whatever with it. That may be to use it as intended, or to adopt the algorithm, or to poke fun at it; I don’t care, as long as it is not ignored.
So to respond to ESRs question about mental inflexibility… As pointed out by several respondents, using one’s brain keeps it more flexible (in the absense of direct pathology.)
I watched my Dad and my GrandDad fall prey to stagnation and strokes, and recall that the strokes came after the stagnation (as it did for my dear Sue.) I feel that to avoid the strokes, I will try to avoid the stagnation. I excercise as I can, and spend lots of time continuing to learn and integrate the science I love. Slowly I am getting up to speed on “the social media stuff” and sharing what I learn and make. That, I hope, will keep me from the petrification of the synapses.
“She mentions that she has two children. (a) What are the odds that she has one of each gender?”
My exploration of this is influenced by the idea that someone with one son and one daughter will always refer to them as “two children”, but someone with two sons or two daughters will sometimes refer to them as “two sons/daughters”.
“A moment later, a girl runs up behind her, whom your friend introduces as her daughter.”
Does she say “This is my daughter, Jane” or “This is my daughter Jane”? The comma implies there is only one daughter. The absence of a comma implies that the name is required to distinguish between members of the class of daughters.
“(c) Do the odds change if you are told that her daughter is the elder sibling?”
“This is Jane, my eldest
child” implies that Jane is a member of a class including both sexes. “This is Jane, my eldest” implies nothing about the other child.>> Has anybody written a technical history of version control systems?
> I have an incomplete draft of one. Does this surprise you? :-)
It would be nice to have timeline of version control systems, similar to Unix timeline (and provenience). David A. Wheeler “The Most Important Software Innovations” (http://www.dwheeler.com/innovation/innovation.html) could probably help start…
@esr
>If you mean as in “schedule”, no. But it remains on the to-do list.
I look forward to it.
For insight on the girl/boy thing, consider the differences between the following scenarios:
Scenario 1: An urn has 100 balls in it, of a known 50/50 mix between white and black. Your first draw was white. You put that ball back in. The balls in the urn are mixed randomly, and you draw a second from the urn. Is your second draw more likely to be white, more likely to be black, or even probability?
Scenario 2: An urn has 100 balls in it, of a known 50/50 mix between white and black. Your first draw was white. You still have that ball in hand. The balls in the urn are mixed randomly, and you draw a second from the urn. Is your second draw more likely to be white, more likely to be black, or even probability?
Scenario 3: An urn has 100 balls in it, of a unknown proportional mix between white and black. Your first draw was white. You still have that ball in hand. The balls in the urn are mixed randomly, and you draw a second from the urn. Is your second draw more likely to be white, more likely to be black, or even probability?
Answers:
Va fpranevb 1, gur bqqf ner rira, orpnhfr unys gur onyyf ner bs rnpu pbybe. Va fpranevb 2, gur zber yvxryl qenj vf oynpx, orpnhfr vg’f svsgl bs gur avargl-avar onyyf yrsg. Va fpranevb 3, gur qenj vf zber yvxryl gb or juvgr, orpnhfr n enaqbz fnzcyr sebz n zvk bs haxabja cebcbegvbaf vf zber yvxryl gb or bs gur zbfg pbzzba pbybe.
Ya know… it doesn’t have the happen. Richard Feynman kept his sense of wonder to the very end. His example gives me hope for my future.
G. Wolfe Woodbury: “certain modern developers (old or young) have lost touch with the roots of the OSS/*NIX ethos.”
That statement assumes that the roots of the UNIX ethos are worth staying in touch with. That is self-evident to Eric and me and you and most of the folks here…but is it to the modern developers you refer to? Or are they consciously throwing it out in favor of…what, exactly?
Would they regard TAOUP as a masterwork of programming wisdom? Or would they regard it as hopelessly outdated and irrelevant to
today’sway of programming?Okay, here is a fairly revolutionary idea (that can be totally bogus, but useful as a mental exercise): does programming have to be entirely about typing text into text files? Like, writing a book, that kind of thing, a bunch of ASCII characters in a text file? What changes could you imagine, even if not very feasible now?
For example the simplest change I could imagine is getting out of ASCII and using Unicode with various special characters having syntactical meanings, for example, invent new operators instead of common keywords. For the sake of simplicity you still type “switch” but the editor changes it to some appropriate Unicode thingie that actually looks like a switch. Stupid idea? I don’t know. If the press of a button could from signs to words and back perhaps it could not do a big harm, so much is sure. Maybe it could help creative thinking.
I mean getting entirely out of text files and into something else could be too radical now, but if it is Unicode text files, how could a programmer with an appropriate editor expand his expressivity by using the Unicode characters, other than naming variables in non-English languages? (That later is not being done, at least most Europeans I know dislike the idea of mixing the built-in English keywords and functions with non-English variable names, it is both aesthetically ugly and harms international teamwork. I was actually cussing out when saw recently variables like Salgsordre, did that guy think only Danes should be allowed touch his code or what? So, let’s scratch non-English variables or stuff like this, and focus on what a programmer could do generally with non-alphanumerical Unicode signs.)
>So, let’s scratch non-English variables or stuff like this, and focus on what a programmer could do generally with non-alphanumerical Unicode signs.
I am doubtful there’s a large win here. One seldom gains by moving to a
more complexnotation; it’s the simple ones with a lot of leverage (bit density) that seem to produce the big wins.> I have an incomplete draft of one. Does this surprise you? :-)
You also have an incomplete draft of TMNN, but I’m not holding my breath.
Shenpen, 101-key keyboards are not great on typing unicode unless you have a big chart of numbers posted next to your keyboard. Reminds me of APL.
G.Wolfe, it would be awesome if you stepped up and said “Yes, /etc/init* is inappropriate for modern systems. I wrote it for a much older less capable system. Here is how to fix it (without throwing it out!) for modern systems.” People really *do* respect age and wisdom. And then you could cobble together the existing fixes (e.g. Perry Metzger’s dependency analysis system for /etc/init.d) and publicize them. And thus may we be saved from the ruin that will be called “the systemd disaster”.
Random, smoke is proven harmful. CO2 is not. There are predictions and guesses and speculation that CO2 may at some time produce harmful warming. Did you know that it was warmer in the 1200’s? To the point where they were growing grapes in England?
Rob K, why do you think that I think Python is perfect? It isn’t. Sure, you *can* screw up the indentation, just like you *can* lose braces or misplace them. The point is not that Python makes you perfect, it is that Python makes you better.
Y’know I see this all the time in discussions of libertarianism and freedom. People seem to think that a libertarian society is supposed to be a utopia, free of problems. No actual libertarian thinks that; only the people who object to it. And we are not foolish enough to think that a statist society is supposed to be a perfect one, so the statists are never put in the position of having to defend war.
“One seldom gains by moving to a more complex notation”
Indeed. That way lies APL: expressive power at the expense of readability. Since programs are read more often than they’re written, this is a net loss.
And for the love of all that’s holy, just say “Fucking
arggghglglgplbtpfl bletch pooey keep away! No! Back off or I’ll argggghhhhhNO!!!!!SHOOT!Die you gravy sucking” to non-ASCII variable names.PIG!!!!> Random, smoke is proven harmful. CO2 is not.
Shouldn’t whether to allow it on a piece of property be up to the property owner, and not to a central authority’s arbitrary judgement on whether it is proven harmful?
Juggling might be an interesting new skill– Eric, I don’t think you’re done much with throwing and catching.
One thing that makes me question Heinlein’s overall mental flexibility is that he was simply wrong about WW3, and so far as I know never discussed what he missed. On the other side, as I recall,
Fridayhad a world that wasn’t heading toward a big war.As for my own mental flexibility, I’ll get back to
Thinking Physics, a book which offers physics problems first, and then the explanations. I was somewhat freaked by the first. It was a very easy given the durations and velocities, figure out the distance problem, but then the explanation said that just plugging numbers into an equation isn’t the best route to understanding. Somehow, this hadn’t occurred to me before, but I think it’s true.You’re Not a Liberal could have been worse, but I stand with Karl Hess, who said that the left and right in the US include each include authoritarian and libertarian aspects. Picking up some abstract trait of a large group of people and assuming they all match it is is a way of making yourself stupid.
Last I heard, the reduction in air and water pollution is a result of government regulation, and something that liberals generally like better than conservatives. No?
> And for the love of all that’s holy, just say “Fucking NO!!!!! arggghglglgplbtpfl bletch pooey keep away! No! Back off or I’ll argggghhhhh SHOOT! Die you gravy sucking PIG!!!!” to non-ASCII variable names.
Why non-ascii? Is any harm done by allowing someone who speaks Spanish (or Chinese) to have variables that are spelled correctly in their own language?
> …other than naming variables in non-English languages? (That later is not being done, at least most Europeans I know dislike the idea of mixing the built-in English keywords and functions with non-English variable names, it is both aesthetically ugly and harms international teamwork. I was actually cussing out when saw recently variables like Salgsordre, did that guy think only Danes should be allowed touch his code or what? So, let’s scratch non-English variables or stuff like this
Why not have a language with keywords and built-in functions in a language other than English? Saying that
allprogramming must be done in English for some reason like a shared language of hacker culture doesn’t seem any more reasonable than saying that all programming must be done in Python (or even, in general, in the imperative/structured/object-oriented hybrid paradigm that languages like Python use and Scheme/Forth/C do not)You could even define a library format where linkage is not done by name, and have a localizable name mapping.
Of course, a localizable
languagewould be too much to ask. Names and keywords are one thing, but conventional object-oriented syntax is biased towards subject-verb-object grammar, the syntax of structured statements like if-then, foreach-in, etc are based on natural English language syntax.Just the opposite, actually. Setting aside the obvious examples of the environmental disasters of communist regimes, in the United States and other industrialized countries, environmental improvements have preceded government action, and it’s quite likely that the government interference actually
slowedthe pace of improvement.The Cuyahoga River is a classic example. Even though the famed incident was a fraud, the river was heavily polluted throughout the first half of the 20th century. Individuals tried to bring claims against the polluters in court but were dismissed on the grounds that state and then federal environmental regulations had preempted the common-law rights to water use and fishing. The EPA is notorious for arbitrary enforcement of environmental regulations, and private parties have essentially no means to push for cleanup on their own. Contrast England, where in the 1960s and 1970s fishing groups successfully obtained judgments and injunctions against polluters who were making rivers unfishable.
I like how Nancy is trying to be Eric’s Minerva.
(Eric, I’m sure Heinlein never wanted to be used as a limitation; you go right ahead and figure out what it’s like to be on the inside of a star! Ahem. Or perhaps you could try stand-up comedy as a brain exercise. You have the public speaking part down, so this shouldn’t be too far a stretch!)
>Or perhaps you could try stand-up comedy as a brain exercise. You have the public speaking part down, so this shouldn’t be too far a stretch!)
No stretch at all, really. I have the brain chemistry of a stand-up comic, and I get it about comic timing and most of the other kinesic tricks they use – I use them when I speak. All I’d have to do is write the jokes. Almost too easy.
@Random832
As someone who became fluent in English 3 years after I started to program: for the love $DEITY lets keep all programming in English and ASCII. Yes, English is an arbitrary choice, but it’s a good shelling point. Yes one could have ones editor display all function and variable names in one’s native language, but 1. translating all this stuff is a useless waste of time and 2. there are so many corner cases where stuff would break that it would be a big pain in the ass.
As for why ASCII only: yes ? is more pretty than <= but I can type in the later without having to look up its unicode code point.
/rant
I have to ask: what the bleep does “TMN” stand for? A brief Google search, trimming out contemporary fuzz, goes back into old pre-WWW Usenet quasi-literature and so Google kinda flakes out. The best I can tell is that it has to do with Netnews and was venerable even in 1989.
>The best I can tell is that it has to do with Netnews and was venerable even in 1989.
It was my attempt to redo netnews better; one of the major features was reliable discussion threading. Time passed it by, but some of the ideas got reused elsewhere.
@shenpen:
There’s scratch, which eschews text for a drag-and-drop, flowchart-esque interface. It is also totally useless for anything other than as a toy to teach kids to program. I doubt anyone with even one iota of Real Programmer-ness would condescend to use such a tool.
Only an utter idiot would propose any theory of property trespass that could be invoked against someone in an irreversible coma in bed on the other side of the world, and expect to be taken seriously. But since that person in the coma is breathing and gasses diffuse, your theory of CO2 trespass would actually qualify as one such.
@Lambert:
> @shenpen:
> There’s scratch, which eschews text for a drag-and-drop, flowchart-esque interface. It is also totally useless for anything other than as a toy to teach kids to program.
Such approach is quite useful in scientific visualization programs such as proprietary AVS (Advanced Visualization System) or open-source VisNow… though both allow defining custom blocks (plugins) in appropriate programming language.
@Random832:
Shouldn’t whether to allow it on a piece of property be up to the property owner, and not to a central authority’s arbitrary judgement on whether it is proven harmful?By this logic, if you don’t like photons reflected from my body being on your property, you should be able to sue me just for being within line of sight of your house.
ISTR David D. Friedman used nearly this exact example in
The Machinery of Freedom.@Paul Brinkley:
Yep, that’s where I got it from. :-)
Yes, I am. More germanely to this thread though (and to your next): Overdependence on fixed linguistic categories inhibits and calcifies the mind. You may want to free yourself from this one.
Random832:
“Do you believe that people have the right to forbid you from blowing excessive amounts of CO2 into their property?”
Hypothetical case: your neighbor sues you because the large number of trees on your thickly-forested property emit oxygen which drifts over to his property. He argues that since oxygen is toxic in high concentrations, he has the right to force you to limit such leakage.
Why is this different from CO2? Discuss.
I’ve seen this episode before. except it was with the word “hacker”. In 99% of the cases in which it might be used, a hacker is someone who breaks into computer systems. That’s what the word means now. Any attempt to “take it back” is bound to be met with the same success as Randal Graves’s attempt to “reclaim” the term “porch monkey”.
Most people who’ve used systemd seem to like it, and concede that it has many, many technical advantages over sysvinit, Upstart, or any other init system that fit their use cases. I’m curious to know why you think systemd is not user-driven.
I’ve seen this episode before. except it was with the word “hacker”. In 99% of the cases in which it might be used, a hacker is someone who breaks into computer systems. That’s what the word means now.You may have seen this in the past, but you clearly haven’t taken a look anytime recently.
Jeff Read proves that he is oblivious, film at 11.
I’ve moved to Arch, which uses systemd, and I’ll say that I’m not a fan. It
works, and it certainly is much faster than traditional sysvinit, but OpenRC had a lot cleaner and more transparent design, and the only downside to it that I saw was that at the time I got my last system up and running on it (~3 years ago), they didn’t have the script metadata in place reliably enough to enable parallel init, which is essentially the only point that makes systemd faster than sysvinit.So, comments from a 25-year-old on various topics of discussion:
-I find that having both {} and indentation is very helpful, precisely because it isn’t a SPOT.
I’ve written Python and C, and had to fix code after leaving it alone, and both end up with similar screw-ups eventually. But in Python, if it’s wrong, the only solution is to guess.
In C, look at the indentation and the brace location becomes clear, and look at the braces and the indentation is clear.
-DVCS logs vs. NEWS vs. ChangeLog vs…:
Sure, NEWS is a nice theory. But fetch your average tarball, and it’s almost guaranteed to be one of a half-dozen 0-byte files.
ChangeLog: Rarely empty, and occasionally actually informative. If it is, it’s usually because someone ignored the GNU standards. Most of the time that it is present and maintained, it looks like someone was trying to do DVCS logs by hand…trying but failing, since you can’t tie explanations to diffs in a tarball. Inadequate for technical use, overkill for the average user.
…And if someone would kill the CamelCase, it would be a Good Thing ;-)
DVCS logs: Don’t happen in a tarball. Great for trying to find what went wrong, sometimes impenetrable when trying to figure out whether to upgrade.
Individual per-release release notes: Whoever perpetrated this should be fired from any position they have had or will have as a release manager/maintainer. If I’m reading that Foobar 51.03.5 was just released, I only want to read one file to figure out what’s changed since Squeeze froze…not half a dozen, and certainly not two dozen files.
I could see this being justified for new major releases in certain projects (for example, Vim 5/6/7, Linux 2.4/2.6/maybe 3.x, and Firefox back during the long-gone Days of Sanity when 3.0 was a major worthwhile change from 2.0 which was a vast improvement on 1.0); of course, these exactly are the projects that won’t do it.
Usually, it’s more like ChangeLog-2.3.38 and all the other files that implies.
-“Kids these days”…rarely understand
moderation.That goes both ways: sometimes you have people who will only grudgingly open a terminal and wouldn’t think of using an editor other than Gedit; sometimes you have people who will uninstall every package that’s over a megabyte, see how many weeks they can go without starting X, build a self-hosting Linux system with only 6 packages (kernel, busybox, musl libc, make, gcc, binutils), or write a “cat” that only cats one file. No, I’m not exaggerating on any of those examples, though I suspect that the guy who uninstalled packages by size didn’t remove anything marked as Essential.
Ah, @idunham just made me realize why I prefer braces: If you screw up your indentation in a language such as Python, you’re likely to end up with syntactically correct but semantically buggy code. If you screw up your braces in a C-like, you’re very likely to introduce a syntax error that will immediately get flagged while you’re still in a mental state to fix the problem cheaply.
And if anyone is wondering who uses tarballs instead of fetching from $VCS these days, the answer seems to be “At least half the people who would consider installing a program from source.”
This is especially likely if $VCS is svn or cvs, but also common for the average autoconfiscated git repository; even “the average linux user” who has make and gcc doesn’t have git, m4, and everything automake needs.
@Jeff Read:
> In 99% of the cases in which it might be used, a hacker is someone who breaks into computer systems.
False. Probably the two most common usages of “hack/hacker” these days (probably 90% of uses between them), are when referring to the practice of using modified clients to gain an unfair advantage in an online game, and when referring to the Facebook equivalent of baggy pantsing.
The knowing facetiousness is starting to spread, but “my account was hacked” is still used predominantly to mean “omfg teh l33t ha><0rz broke into my computer and posted that embarrassing status and there's no way they guessed that my password was 'password'".
Proper tarballs from an autotools-managed project SHOULD NOT require the user to generate the build files, that should be done at the `make dist` stage. At any rate, m4 is a standard part of any Unix installation, even required for POSIX compliance, so it’s a nil point. Also, it’s not expected for the generated autotools files to be part of a VCS :P
@Christopher Smith:
>The knowing facetiousness is starting to spread, but “my account was hacked” is still used predominantly to mean “omfg teh l33t ha><0rz broke into my computer and posted that embarrassing status and there's no way they guessed that my password was 'password'".
Pretty much every Facebook "hacking" I've ever seen involved a computer left completely unlocked and unattended with a Facebook tab open.
@Mike Swanson: Exactly.
I’m referring to why someone would get a tarball instead of fetching from $VCS:
a tarball requires a lot less to build.
As to m4: yes it’s part of POSIX, no it’s not installed by default on a lot of Linux systems (I believe build-essential doesn’t require it).
But GNU m4 isn’t POSIX; even on the *BSDs where m4 is installed, autotools will require GNU m4 specifically–at least NetBSD and OpenBSD use a public domain M4 based on Software Tools “macro”.
Jeff Duntemann wrote this almost 20 years ago; it remains remarkably relevant.
The Love Song of J. Random Hacker, 1995
By Jeff Duntemann, with apologies to T. S. Eliot
(Doctah Kurtz, he dead. A GOTO for the old guy.)
Let us go then, you and I,
For fast Chinese and talk of years gone by
Filled with random jumps and custom cable;
Let us go, recalling joys of FORTH and MUMPS,
The cluttering lumps
Of threaded code in frantic ten-hour hacks
To get that midterm project off our backs:
With code that twisted, doubled-back and bent
And set into cement
But came through with an underwhelming “B”…
Oh, do not ask, “What was it?”
I don’t care what it does, just how it does it.
On the Net the expert systems come and go,
Bragging about how much they know.
Over yellow chad that chattered out from teletype machines,
Over yellow tape that rattled out encoding fever dreams
That curled into the data center trash;
We lingered, inventing novel sort/merge schemes,
Or ways to thwart collisions when we hash–
And seeing that we’d been logged in since late last week
Took one last slug of Jolt and fell asleep.
On the Net the expert systems come and go,
Bragging about how much they know.
No! I am not Bill Gates, nor would I want to be;
I’d rather parse the fish than own the knife;
(Imagine! Having moby bux but chained
to ninety million lusers, what a life…)
Am a flamer, goateed, pallid, overweight,
Willing to pull two shifts, then (hell) a third,
To save a session from a deadlocked state;
At times, (to put it mildly) unrestrained–
Almost, at times, a nerd.
I grow old…I grow old…
dBase II and Wordstar are no longer sold.
Shall I start a BBS? Do I dare to try to teach?
I shall take my palmheld portable and hack upon the beach.
I have heard the networks passing packets, each to each
They have no traffic for the likes of me.
I have seen the Altair live and die
And software startups score on sorry score–
And millions made by men like Mitch Kapor.
We hackers linger by our leading edge
Forgetting what is pending in the cache
Till practice hurtles past us, and we crash.
We’re living in an age of Sharyl Attkisson crying HAX when her backspace key is broken. Facebook baggypantsing counts as “hacking” to the victim, who *suspects* a malicious criminal when they are too blind to their own idiocy.
@Jeff:
>Facebook baggypantsing counts as “hacking” to the victim, who *suspects* a malicious criminal when they are too blind to their own idiocy.
We’re living in an age when people cry “I’m a 1337 h4xx0r!!!!” when they’ve done nothing. Facebook baggypantsing generally counts as hacking to the perpetrator as well as the victim.
@Random832
>Saying that all programming must be done in English for some reason like a shared language of hacker culture doesn’t seem any more reasonable than saying that all programming must be done in Python
For speakers of large languages, Spanish, Chinese, there can be a win in sacrficing international cooperation for the sake of opening the world of programming to those who can’t speak English. I am not entirely convinced of that – generally NOT opening programming to everybody and filtering out the intellectually lazy leads to better code – but I could see the potential at least.
But for the smaller ones, Danish, Polish, Hungarian etc. not – they have to cooperate internationally, can’t reinvent all the wheels, cooperation clearly matters more than ease of entry, and not being strictly English-only leads to this kind of crap where I am in a project involving people from 5 countries and I am figuring out what a database field name “PDF Ordrebekræftigelse” means in Danish with a dictionary, a pizza and a vivid set of Hungarian folk curses. (In a system where the CaptionML property is right beside the Name property so it could be have been done right easily…)
Another thing I “love” is when I have to translate back localized error messages to English but also in a way that to guess the original wording, in order to be able to google it and find out what to do with it. In an age where most solutions are found on PHPBB forums and not in the documentation, at the very least sticking to a few large languages is a must. Localization just makes everything harder for the experts, and easier for the users only – for this reason, it should only be an outermost layer on software, a garment to to peek behind every time it is necessary.
If only there were a way to index on the meaning of a message, as opposed to its phrasing….
A story I remember was how, years ago, IBM worked for a long time on a system that would let programs be written in Arabic. It got killed by opposition from Egyptian programmers who viewed their knowledge of English as job security.
There is a real Scheme-based language in Arabic here: https://github.com/nasser/—
@Jay Maynard
> expressive power at the expense of readability
Is plain, mostly alphanumeric text the currently known most readable form of expression? I mean I do skim books, but… math is not a bad place for a programmer to look for ideas, and why did the language of mathemathics gobble up the Greek alphabet, the sigma notation for summing, the integral notation and whatever else? Is math not supposed to be readable, to those who know math? Would there be anything wrong (not sure what would be the win, but what would be the loss) with an SQL query summing with the sigma notation, typed as sum, but represented as ??
I mean, for humans, the most readable is usually a picture as it can afford to be vague and imprecise and thus convey a whole range of notions. Computers want precision, basically numbers. Is plain text the ideal middle for both?
And finally, how comes programmers tend to like curlies more than BEGIN / END – isn’t there an argument that you get used to it quickly and then the win is not having to read so much?
> Would there be anything wrong (not sure what would be the win, but what would be the loss) with an SQL query summing with the sigma notation, typed as sum, but represented as [what I assume is an uppercase sigma]
Because sigma notation (sum of a function applied to each value in a range), doesn’t actually map exactly to the sum function as found in sql (sum of a function applied to each value in a set). Because sigma notation isn’t a linear sequence of ASCII/Unicode symbols, and so you would need to invent an encoding and display logic. Function notation has the advantage of being general, too. You can just have a list of names for the distinction between scalar functions and aggregate functions in SQL.
Wow. I’ve never cared to see if I can pass the Ideological Turing Test before, but I’m suddenly very tempted to try and reproduce the standard “see, this is why all software should be written by people who have managers who will force them to write proper documentation and then absolutely everything will be wonderful!” rant. Of course, done right, that would be trolling.
Lisp/Scheme dialects that accept λ (example) are probably a Good Thing, if only in an RSI-avoiding way.
Shenpen:
And finally, how comes programmers tend to like curlies more than BEGIN / END – isn’t there an argument that you get used to it quickly and then the win is not having to read so much?The obvious answer is one you hinted at earlier in that very same comment. Symmetry. Which is to say, { } creates a pleasing picture that BEGIN END does not. This was, I claim, the same motivation in some circles to close “if” with “fi”.
A computer does not care about “{ }” as block delimiters any more than it would care about “A B” as delimiters. And it would prefer (so to speak) “{ }” about four times as much as “BEGIN END”.
In general, all symbolic language is a workaround for the peccadilloes of human cognition. Knowing you, I expect this is unsurprising, and I wish I could offer more insight, but there it is.
Or use an editor like Emacs that can change the display of BEGIN/END to { } and now we’ve just defeated any purpose of using the words to begin with ;)
Or use a language like C++ in a class where they’re bored out of their minds and write “pascal.h” just to troll the teacher.
“…how comes programmers tend to like curlies more than BEGIN / END – isn’t there an argument that you get used to it quickly and then the win is not having to read so much?”
“The obvious answer is one you hinted at earlier in that very same comment. Symmetry. Which is to say, { } creates a pleasing picture that BEGIN END does not.”
Bah! Humbug!….Humbug I say!
Back in the 80’s, I read a Byte Magazine article where a prominent programmer commented that, “C is a disease.” It’s so. Most programmers have been infected (including me). One of the most prominent symptoms is a tendency to use as few characters in the program text as possible, reflecting the early C designers/programmers’ poor typing skills and slow serial terminals. C’s preference for all lower case identifiers and keywords, plus the curlies is another result of that.
“C’s preference for all lower case identifiers and keywords, plus the curlies is another result of that.”
That, plus the horrible botch of case sensitivity.
I used to think that UNIX as case-sensitive because of an early design decision to save a few instructions deep in the kernel. DMR himself corrected me on that: it was a deliberate design decision, based on their preferences. Blarg. All I can say about that is that those preferences are a rich source of bugs over the years.
One thing that always struck me when taking CS courses in the mid to late 80s was the bitching about all the typing one had to do for COBOL programs. I had fortunately had proper training in touch typing, so I had no such qualms. And I *loved* COBOL. It practically documented itself! Of course, at the time being highly business oriented, it didn’t have all the beautiful data structures that so many people liked. You didn’t do complex mathematical formulae in it. But there was a purity and beauty to it – as long as you didn’t mind a bit of extra typing.
And while laziness might be a prime programmer virtue – there’s laziness, and then there’s laziness. And the beauty of a program I could just *READ*, instead of having to interpret – ahhh, but I loved COBOL.
I find these two articles all too believable, even if they claim to be April Fool’s jokes.
https://www.gnu.org/fun/jokes/unix-hoax.html ( https://lc.fie.umich.mx/~juan/Chistes/unix )
http://arstechnica.com/civis/viewtopic.php?f=14&t=809449
@Phil it is funnier than that. It is not that documentation does not get written, it is that it does not get _read_ in ever widening circles. First only users, then sysadmins, programmers…
I must admit I am guilty of it myself. It is basically the lack of the former discipline where people could deal with dry, borderline boring stuff. Today I too would not be bothered to learn the specification of a new programming language but instantly go for the more entertaining tutorials. Today I too would no longer learn a human language by memorizing 10 words every day with flashcards or something, but go for the immersion. Today I expect software to be intuitive, and when not answers to be found by Google. This is getting widespread. We are getting lazy. Probably the most embarrassing part was when I had to add a short custom function by code in Microsoft’s lousy excuse for a Report Designer because the standard ones were not enough, and I am not even sure in what programming language I did it. I was mostly just concatenating examples I found online. This is probably my worst horribly-lazy-but-it-worked story so far.
To be fair, these lazy methods work surprisingly well, that is why they are widespread. In way, efficient laziness is cutting with and not against your own grain. But they don’t give the same bragging rights as the lawyer-minded, mathemathician-minded folks of older times had who had the discipline to put up with investing hours and hours into reading and/or memorizing dry and not too entertaining stuff.
And I am now tempted to add a TL;DR section to this comment (Reddit habit) for a bit of a troll value. (Too Long, Didn’t Read: a single.line summary for those who are really lazy.)
Immersion is a much faster and more effective way to learn a new language. Also more fun: in the case of Japanese, having tried both I know I’d rather chat up cute girls in Osaka than memorize a bunch of flashcards. But the didactic benefits of the immersion technique are well characterized.
Language lawyers usually make poor software engineers, and it has always been thus. The folks of older times by and large a) didn’t dedicate hours to memorizing every jot and tittle of a language spec for the hell of it; and b) had much simpler semantics to work with.
Copying and pasting code samples together is lazy, but code samples and tutorials offer us something that language specs cannot: a view of the language as it’s actually used. A superhuman (or sentient AI) could commit the entire C++ spec to memory, and never gain from that entire volume of reading knowledge of fundamental C++ idioms like RAII. (Though they might eventually derive such idioms themselves.) The only way to see how a programming language is used in practice is to read, and read about, code that uses it.
And reading code is a challenge in its own right.
@Ole Laursen
> This reminds me of when I tried to convince people to support the standard clipboard copy-paste protocol, a goal I decided to pursue after reading somewhere that my beloved editor was one of the last holdouts: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1765
Your proposed behavior (I don’t know what got actually implemented, as I don’t use Emacs) doesn’t sound that reasonable to me – there’s no fundamental reason the default paste command, in a non-CUA editor (which doesn’t map it to ctrl-v anyway), should be to paste the clipboard. It would be especially perverse for the default delete commands to cut to the clipboard.
Vim uses a magic register “+ for the clipboard, a different one “* for the selection [PRIMARY/CUT_BUFFER0], and neither interacts with argumentless commands… which use “0, “-, and “1 depending on the command (yanks, short deletes, and line deletes).
> why did the language of mathemathics gobble up the Greek alphabet,
> the sigma notation for summing, the integral notation and whatever else?
Back when that happened, any college-educated mathematician knew Greek; in Britain, it wasn’t *that* long ago that it fell out of high school level education. One Greek letter could represent a word or concept without having to write it out, preventing possible confusion (see: 0xDEADBEEF) and making the equations more compact.
Greek fonts were in every textbook typesetter’s shop. And when you were printing graphics with woodcuts, carving sigma notation was no different than curly borders or flowers.
This all happened long before Babbage, much less electronic computers…
As long as the standard input method for programming is the keyboard, the optimum set of programming symbols will be the subset of symbols easily typed on most or all keyboards. Which, for a mix of technical and historical circumstances, means ASCII or a subset thereof. Any programming language trying to use anything else will automatically limit its own audience to the set of keyboards that can easily handle its symbol set.
Mathematics developed its symbol set when the standard “input method” was handwriting, which is rather less restricted than the keyboard.
The space-cadet keyboard supported Greek character input and had a special “Greek” modifier key. Why Greek input — a vital component of so much technical text — is not more universal, I don’t know. Probably because of the same fucking illiterates who didn’t realize that dashes and hyphens are completely different things, or that double quotes come in matched pairs.
Anyway it probably won’t be of much concern in the near future, when the touch screen becomes most people’s primary mode of input.
Greek input is not more universal because it would have been insane to spend the extra resources to support it in the context of business use in the United States in the 1960s versus the then-substantial resource costs to support it (which is why most typewriters didn’t support it either, though there resources were counted as mechanical complexity). That also being why these character sets didn’t add a whole bunch of characters (like differentiated quotes) that also usually weren’t on typewriters. By the time character set support caught up to handling Greek and a reasonably full set of Latin characters and typographical marks all at once, keyboards had been standardized for decades.
Incidentally, about two minutes’ of actual thought about the question should have been sufficient for even you to figure that out for yourself, Mr. Read. But we all know how much you dislike that activity.
> why did the language of mathemathics gobble up the Greek alphabet,
> the sigma notation for summing, the integral notation and whatever else?
Another reason is that mathematics mostly avoids multicharacter variables, constants, function names, etc. (The only example of multicharacter variables I can think of offhand are subscripts.) So instead math was pushed into using the Greek alphabet, other alphabets, various symbols, and different forms of various letters (upper case, lower case, script…)
I think some symbols are there because they were created at time where math was written by hand. We have \int symbol, and \Sigma for sum, but we have ‘lim’.
Also greek letters are used for subscripts/indices (multi-letter are not possible here), and ‘\mu’ means something different than ‘m’ subscript/superscript.
Maybe we don’t have to ossify into old farts after all:
http://stm.sciencemag.org/content/6/258/258ra140.full
The Unix ethos is a phenomenal red herring; even Linus concedes that it’s not how real software is built. “Write small programs that do one thing and do it well” assumes that the individual process is the fundamental unit of composition. The harsh lesson of the past two decades has been that there is so much crosstalk between functional domains that it makes more sense to build large programs out of available toolkits — libraries and frameworks — using the libraries and frameworks as the fundamental units of abstraction.
As a user-facing example, consider email. Though it grew up in the Unix environment, with its separate MTAs, MDAs, and MUAs, all of which are separate from the editor used to compose the email and any directory services the network may provide, no Unix-based solution has been able to match the flexibility and ease of use afforded by the current standards in email: Outlook and Exchange. Outlook combines an email client with composer, contacts, and calendaring, and Exchange provides server-side support for all these things and integrates with Active Directory.
It’s one of those bloody obvious in hindsight product integrations, like attaching a camera to a cellphone.
As it turns out there is also a lot of crosstalk between bringing the system up and other critical functionality, like monitoring for and responding to hardware, kernel, or service events. So it makes sense to integrate all these functional domains into a single progran, which yields the architecture for systemd.
And there’s even more crosstalk between painting the screen, event handling, and window management in a GUI environment — hence Wayland. (Wayland also is an opportunity to fix longstanding security bugs that are essentially unfixable in an X environment.)
And so on and so forth.
Each of these instances of “throwing out” and replacing existing functionality has a very sound technical basis in light of how shit actually gets done in the modern era. Argumentum ad philosophiae unicis is not a valid counterargument anymore.
>Argumentum ad philosophiae unicis is not a valid counterargument anymore.
No, not if you’re willing to live with horrendous error rates.
Small, simple, and well-modularized is still the only way to keep from repeatedly tripping over our own feet. The central challenge of building large systems isn’t to abandon that wisdom. it’s to get good at
composingsimple components in correct ways.> Small, simple, and well-modularized is still the only way to keep from repeatedly tripping over our own feet. The central challenge of building large systems isn’t to abandon that wisdom. it’s to get good at composing simple components in correct ways.
The idea that a pipe (or other ad hoc data transfer using the filesystem, environment variables, etc) is the best, most “correct”, way of composing two components is the unix philosophy argument to which he was referring.
>The idea that a pipe (or other ad hoc data transfer using the filesystem, environment variables, etc) is the best, most “correct”, way of composing two components is the unix philosophy argument to which he was referring
Anybody who identifies this as “the Unix philosophy” has
utterlyfailed to understand it – mistaken accident for essence.The Unix principle that comes closest to what you wrote above is “use textual data streams for IPC”. This remains excellent advice because textual screams are discoverable and can be self-describing in ways binary RPC cannot. But textual data streams need not be plain old newline-terminated lines passed through pipes. JSON interchange is very much in the Unix spirit. So is HTML, for that matter.
Decomposing large systems into services coupled by discoverable text steams is itself not the end, but the means. The end is to couple loosely – to reduce global complexity and increase options through modularity and swappable components. Until you understand how that deep principle drives relatively superficial design features like pipes and redirection, you don’t grok the Unix philosophy.
I wrote a book about this. You should read it.
ESR, have you seen the recent threads on LWN? Bruce Perens is finally getting involved in the systemd ruckus. The systemd defenders have shown an attitude toward the Unix Philosophy essentially the same as what Random832 just posted. Now that Plan9 is GPL, maybe time to leave Linux behind.
Also this: http://uselessd.darknedgy.net/ProSystemdAntiSystemd/
Some money quotes:
Why pro-systemd and anti-systemd people will never get along
…
a) Proponents are usually part of the modern Desktop Linux bandwagon. They run contemporary mainstream distributions with the latest software, use and contribute to large desktop environment initiatives and related standards like the *kits. They’re not necessarily purely focused on the Linux desktop. They’ll often work on features ostensibly meant for enterprise server management, cloud computing, embedded systems and other needs, but the rhetoric of needing a better desktop and following the example set by Windows and OS X is largely pervasive amongst their ranks. They will decry what they perceive as “integration failures”, “fragmentation” and are generally hostile towards research projects and anything they see as “toy projects”. They are hackers, but their mindset is largely geared towards reducing interface complexity, instead of implementation complexity, and will frequently argue against the alleged pitfalls of too much configurability, while seeing computers as appliances instead of tools.
b) Opponents are a bit more varied in their backgrounds, but they typically hail from more niche distributions like Slackware, Gentoo, CRUX and others. They are largely uninterested in many of the Desktop Linux “advancements”, value configuration, minimalism and care about malleability more than user friendliness. They’re often familiar with many other Unix-like environments besides Linux, though they retain a fondness for the latter. They have their own pet projects and are likely to use, contribute to or at least follow a lot of small projects in the low-level system plumbing area. They can likely name at least a dozen alternatives to the GNU coreutils (I can name about 7, I think), generally favor traditional Unix principles and see computers as tools. These are the people more likely to be sympathetic to things like the suckless philosophy.
…
Many of the more technically competent people with views critical of systemd have been rather quiet in public, for some reason. Likely it’s a realization that the Linux desktop’s direction is inevitable, and thus trying to criticize it is a futile endeavor. There are people who still think GNOME abandoning Sawfish was a mistake, so yes.
The non-desktop people still have their own turf, but they feel threatened by systemd to one degree or another. Still, I personally do not see them dwindling down. What I believe will happen is that they will become even more segregated than they already are from mainstream Linux and that using their software will feel more otherworldly as time goes on.
The new buzzword for this is “microservices”, and while the trend is starting to tip too far (IMO) toward granularity, the principle of bright-line interfaces with clearly defined semantics is invaluable. In my current Java/Spring project, I’m running the “microservices” inside the same container as the Web layer, but those bits are demarcated by interfaces that take command objects and are internally routed as ordinary messages. If it becomes useful at some point to run those components on their own containers, or even reimplement them in other languages, it’ll just be a matter of writing out those command objects as JSON or AMQP messages.
But it presents a performance bottleneck that WILL KILL YOU at scale — and scale almost always comes around sooner than you think.
This is why Google uses protobufs —
for almost everything.But a much faster way to enable communications between components is not even using structured binary streams — it’s passing around pointers to data in core. Most easily done when the components live in the same memory space, hence the decline of the process as the fundamental component from which large systems are made and the rise of the object. But the kdbus mechanism allows this to be done in a standard way even between processes.
Loose coupling can be achieved by writing an interface and encouraging people to develop components that expose that interface. The difference between typed, discoverable, auditable interfaces with well-defined behavior semantics on the one hand and the ad hockery of text stream I/O going into arbitrary processes on the other is exactly akin to the difference between static and dynamic typing. Hint: Static typing leads to more correct, faster, and cheaper to develop code.
>This is why Google uses protobufs — for almost everything.
Let me tell you something I recently learned about protobufs. You flip a switch and it
istextual.Google – which is steeped in Unix culture and understands the design principles I’m talking about very well – did a smart thing. They built their IPC so that they can extract the last few percent (and it is only a few percent) by going to binary. But you damn betcha they build and debug with the switch flipped to “textual”, and protobufs exists precisely because they get it about partitioning into small communicating services.
And many of the others (I can’t vouch for their technical competence) have been literally screaming bloody murder. Debian’s systemd maintainer resigned because he was getting death threats.
It’s enough to make me want to tell everyone to start running systemd-based distros in order to drive home the message that they will
notwin any arguments this way and this isnothow you conduct a debate over the merits of different technologies.Mmmmno, the Google devs I know just use the binary protobuf format, by and large. Using protobufs in either case is a matter of setting the members of a C++, Java, or Python object and calling a serialize method, or calling the deserialize method and reading the members. All the format stuff is handled by the serialization layer — which is a fixed point. If you are debugging higher-level application logic (which you are like 90% of the time), it shouldn’t matter which format is actually used on the wire. If you are debugging the wire protocol itself, having a switch to throw to give you text dumps instead of binary is useful.
But in the case of protobufs it’s not as simple as a switch being thrown. You see, the binary format has features the text format doesn’t, like backward and forward compatibility negotiation and (previously) certain data types. Binary protobufs
areprotobufs; the text format, while a nice-to-have, appears to be a second-class citizen with only limited use cases. This leads me to the conclusion that even when debugging the wire protocol, Google developers strongly prefer the binary format.Once again — the performance advantages of binary are much greater, and the debuggability drawbacks much less, than someone steeped in Unix “truisms” might think, provided one uses a well-documented, well-debugged, and ideally open source serialization/deserialization layer like protobuf.
> The difference between typed, discoverable, auditable interfaces with well-defined behavior semantics on the one hand and the ad hockery of text stream I/O going into arbitrary processes on the other is exactly akin to the difference between static and dynamic typing. Hint: Static typing leads to more correct, faster, and cheaper to develop code.
Dynamic typing leads to faster development, and death of static typing programs by “worse is better” ;-)
On the subject of changelogs and rewriting history (I was prompted to think on this again by @Jakub Narebski’s objection to a recent commit message you made in src), it occurs to me that a lot of the “problems” associated with rewriting history would be alleviated if commits had a persistent index that is not affected by alterations to past commits.
In a DVCS environment, maybe the right way to do this would be a hash of current tree hash + previous tree hash + commit date [the last to keep them unique in the presence of changes that are repeatedly backed out and reapplied] as an alternate ID for a commit. Or maybe it’d be better to just go with a uuid.
Hey Ted Walther, how is it going? Long time no see. It looks like debian is imploding, years after the progressives edged you out of the distro. It’s not the conservative, slow changing, rock pillar battered by the tide but paying it no mind, distro it once was.
Linus has no problem with systemd either. :(
Is there any way to get in contact with you?
(Please ESR let this comment through)
The “bug” (RFP) has been tagged as “won’t fix”
If you aren’t a progressive, the debian people
do not want your software.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=770314
Opensource isn’t about code anymore, it’s
about community and beliving and professing
the correct thing.
How do you feel about this change?
@JOrange They did not directly reject you for politics, they characterized you as “someone who routinely trolls Debian”. Can you produce evidence of them having characterized you as trolling in a situation where you were clearly not trolling?
I’m more curious as to what it means to be “someone who routinely trolls Debian”. How, exactly, do you troll a distro? Or is it shorthand for “we don’t like this person because we don’t”.
The “trolling” they refer to is shorthand for advocacy of non-progressive positions and possibly campaigning against systemd. Alternative viewpoint advocacy is equal to trolling.
They rejected the opensource program because they did not like the author, it’s as simple as that, and they have stated this.
06:51 o11c: why not?
06:52 is it because you don’t like the author
06:52 I think that’s why
06:52 yes
06:52 you’re an asshole
06:52 I don’t like you
> How, exactly, do you troll a distro?
I have no idea about the specifics, but Debian, like many other open-source projects, has its mailing lists, its chatrooms, and its blog comment sections. It might even have newsgroups. All of the preceding are places where trolling is generally recognized to be possible.
@Michael Hipp
No idea what keyword filter I tripped with my last post. The important bit was “I have no idea about the specifics, but Debian, like many other open-source projects, has its mailing lists, its chatrooms, and its blog comment sections. It might even have newsgroups.”
No idea what keyword filter I tripped with my last post. The important bit was “I have no idea about the specifics, but Debian, like many open-source projects, has mailing lists, chatrooms, etc.”
Seriously?
No idea what keyword filter I tripped with my last post. The important bit was “I have no idea about the specifics, but Debian, like many open-source projects, has mailing lists, IRC, etc.”
And now that I know what it was:
> How, exactly, do you troll a distro?
I have no idea about the specifics, but Debian, like many other open-source projects, has its mailing lists, its IRC channels, and its blog comment sections. It might even have newsgroups. All of the preceding are places where trolling is generally recognized to be possible.
(Describing IRC channels generically with an eight-letter word starting with C is apparently a forbidden word)
@Mike Hanover
I can be contacted the same way I always have. Google search is your friend.
If you are the same Mike USA who contacted me before, please leave me alone. I don’t approve of your views advocating violence against women and appointed officials. If you want to make the world a better place, you need a better concept of what “better” is. Perhaps you have matured in the five years since we last talked. I hope so.
@JOrange
Linux started out as progressive from the beginning. Linus Torvald’s parents were members of the Communist Party. Richard Stallman was always progressive, with strong socialist leanings. Expecting the Free Software movement to be something it isn’t, and has never been, is crazy. The Freedom in “Free Software” has its roots in the same “Liberty” that the Jacobins advanced in their reign of terror, 1776. (French Revolution).
The Puritans were also progressives in their day; over the years they evolved into modern day Unitarians, those most Progressive of East Coast WASPs.
@Random832 You can “troll” a distro by trolling on their communication media. There is a fine line between trolling and coming at things from a different point of view. The original Libertarians of the movement are mostly gone, and the remaining SJW in the Free Software movement have low tolerance for people with non-progressive points of view. There are a few small projects of value and worth that ignore your politics as long as you keep them to yourself. I smelled a rat years ago when I was at the various conferences, and people were badmouthing esr, for the most trivial of reasons.
If your views are too different from the groups, they will label you a troll even if you are sincere. If you want to play with progressives on their turf, either be one of them, or don’t cry about the pushback.
Debian isn’t imploding, but it has become irrelevant. The quality has kept going down. Starting in the last year, I notice that simple package installations involve lots of breakage, and mass downgrades or package removals. aptitude is so bad I stick to command line apt-get. At least that lets me catch bad package conflict resolutions before the removals and deletions start.
I feel the decline in Debian is a reflection of two things:
A) The Linux ecosystem itself has been subverted by people who don’t respect the Unix Philosophy or social contract. We’ve had enough time; Linux could have converged a lot closer to Plan9/Inferno/Rio than it has.
I read a statement by Ken Thompson (I think) that Unix was originally envisioned not only as an OS, but an OS that a community could form around. The famous “Unix Room” at Bell Labs. Sounds like fun. Unix the OS started out as a computer game. But somewhere it lost its way, and noone seems to be able to find it. Perhaps QNX and Plan9 came closest. Linux in the beginning came close. Then in 2006 things started breaking. And continued breaking.
B) Debian is largely filled with sysadmins who are repackaging others software. It relies on others to do the hard coding. The recent breakage in Debians crown jewels (apt/dpkg) shows they don’t have the coding muscle to do much other than package what is there. So you can’t blame them for systemd. They have to swallow the pill they are given. Contrast this with OpenBSD: nginx went a direction they didn’t like, so they implement their own web server. Mail server wasn’t to their liking? They made their own. Packet filtering, bgp routing, etc. OpenBSD is smaller and has less resources than Debian, but it has a similar number of packages, and also has a coherent base system.
I don’t like systemd, but Lennart recognized a need for a small base system to build on, and is providing it. Too bad he is dragging Linux into the direction of VMS/NT instead of toward Plan9.
What I would like to see is this:
Linux kernel, grub boot loader
Plan9 userland, including Rio
BeOS things for fast multimedia, audio, video
NeXT things such as display postscript for screen independance, possibly updated to SVG
Plan9 and NeXT have some properties that make Docker almost unecessary.
Probably won’t happen. The “portability” that made Unix popular works against such a software configuration. There are other eco-systems out there that are already portable, and people expect them to run on top of the OS. The competitors are the web browser, essentially a mini-OS on its own these days, very hard to reimplement. Worse, the implementations are in C++, which is a big hairy world of its own.
I suppose if qemu was ported to Plan9, and it ran in a Rio window… no, then there would be the cut and paste problem.
If the web browser was “solved”, extracting it from the C++ world, the rest of the design could probably be whipped up fairly quickly with a small team.
Once an OS bites the C++ bullet, it is just bloat all the way down.
> How, exactly, do you troll a distro?
You say you don’t like systemd, or say you don’t like feminists, or you don’t like transgenders running things, or anything anti-leftist.
Ted Walther;
“If you are the same Mike USA who contacted me before, please leave me alone.”
Well I contacted you through email initially, it is you who wished to talk
via voice chat. You were friendly for awhile. Do you not remember though, that
it was I that no longer wished to talk to you once you showed your dislike
of deuteronomy 22 28-29 in it’s original reading in the original language?
That was some time after the initial contact though, some long time infact
If I can recall correctly.
The idea that a 30 year old w could be as… well you know the rest.
(I’m sure you rember our conversations now)
“I don’t approve of your views advocating violence against women and appointed officials.”
I see your run in with the law has tamed you.
“If you want to make the world a better place, you need a better concept of what “better” is.”
Better is not better for all, it never was and never will be.
I don’t want to make the world a better place. I want it to be better for people like me.
“Perhaps you have matured in the five years since we last talked.”
Nope. I don’t change. I aim for consistency.
“I hope so.”
A man at the bottom of a well hopes for company too.
Opensource billed itself as being all about the code, not *group rights.
And it was that for a long time. As was Free Software. It was a somewhat
(socially)* tough place where men built whatever they wanted. Then there was the purge
and out the door such men were thrown, you included. That should never
be forgiven, nor should they be held to any standard but the original
standard (which they still pretend to profess).
*Debian was legendary for this.
Mike, *sigh*. You can put lipstick on a pig, but it will never fly. Free Software is one movement, Open Source is another, and “Unix” is yet another. They split for a reason. Debian is a Free Software project first, not an “Open Source” project. The SJW have infiltrated everywhere because that is what people want. There are some deep psychological things going on, and you aren’t grasping them.
Your idea of “literal interpretation of the original language” was flawed. You didn’t show any knowledge of Hebrew, or of the context and foundation needed to interpret it. You don’t understand the syncretism of the ancient imperial mythologies (Babylonian, Egyptian, and Hittite) that led to it. If the SJW don’t want you in their club, then make your own.
Since esr has an affinity for Pan, I’m interested in his view of Ea/Enki.
If you still want to talk, read Howard Bloom’s “Lucifer Principle”. Then read up on Calhoun’s rat experiments viz overpopulation. Open Source and Free Software are almost irrelevant compared to the larger societal trends going on right now. The Internet has accelerated the worldwide pace of social change, and united humanity in ways never before experienced. Things are going to get real very soon. They already are. Usually it takes an empire a few hundred years to decline. The Internet is a game-changer; it could happen much faster now.
Yes, Brandon Eich was tossed out on his ear. That is the world we live in. Society is entering Phase 3. Tremble if it ever gets to Phase 4. (as defined by the Calhoun experiments) The Georgia Guidestones begin to look pretty good compared to Phase 4.
>>“I don’t approve of your views advocating violence against women and appointed officials.”
>I see your run in with the law has tamed you.
Even in our first conversations I warned you against advocating violence or any illegal acts. I haven’t changed. I hope your memory is faulty, rather than dishonest.
ESR: Could you revive the opensource movement, where code is what mattered,
not pure ideology. There was a tipping point around 2006 where it became
required to subscribe to the whole progressive menu platter. Could you
bring back the good times some how. The libertarian times as Ted puts it?
>ESR: Could you revive the opensource movement, where code is what mattered,
not pure ideology. There was a tipping point around 2006 where it became
required to subscribe to the whole progressive menu platter.
It never went away. I didn’t experience your “tipping point”.
The SJWs will pass. They overreached and are self-destructing now; the public reaction to #shirtstorm is an index of this.
“Even in our first conversations I warned you against advocating violence or any illegal acts. I haven’t changed. I hope your memory is faulty, rather than dishonest.”
My memory is probably faulty. I lose alot of it when I do months of coding on end (all game coding)
There are just some things that keep, and perhaps false memories are constructed
to fill in the gaps. You sounded defeated in you previous posts but now you sound
more like I remember you.
I really wish the OpenSource movement would come back. That’s what I joined I think,
it was early 2000s. If this, now, is what the Free Software movement is, a big
amaglam of things – of beliefs one has to subscribe to, it’s a shame that it’s
acendant while opensource and unix ideals are suppressed currently. Up untill
the early 2000s I never heard of linux etc, so I don’t think it was the free
software movement that made the big things happen. I never really thought about
it though before, I just released all my stuff GPL v2 or sometimes BSD and
that was that. Right now there some SJW type devs saying I’ve never contributed
anything or suggesting that I just now free’d my music: I’ve done that
the whole time, and I’ve contributed gigabytes of media and years of programming
to free software. But none of that matters because I don’t swallow the rest
of the pill?
Eric S Raymond: Can you please bring back the winning formula and the right guys
to lead it. Opensource, show us the code etc, is the right way, and I can do fine
in that environment. What you believed didn’t matter, freedom of speech reigned,
people weren’t kicked out for opposing special interest groups.
The other thing where “show us the code” is just a slogan…
well anything I do is worthless to them (or just doesn’t exist with a proclamation somehow)
Opensource and Unix are what worked and won the dataserver, won the laptop,
won alot. That’s the pinnacle.
Misogynist Hangover,
You do realize it was a
womanwho coined the term “open source” w.r.t. software, don’t you?If you’re so threatened by women in open source, maybe the shit
youput out just isn’t that good?!>You do realize it was a woman who coined the term “open source” w.r.t. software, don’t you?
While this is true, and Chris Peterson is an old and valued friend of mine who I am always careful to credit about this because she deserves all the respect having coined the term implies and more, it’s actually a bad counter to the misogynist argument.
The particular scum of the earth we are dealing with here are retailing a version of the claim that when women are credited with contributing to open source, or STEM in general, it generally turns out they were doing talk or politics or marketing rather than the actual hard work – and that where they achieve political entry the hard work tends to be devalued in favor of talk/politics/marketing.
You can’t refute this by pointing out that Christine invented the term “open source” because that was, in fact, a talk/politics/marketing move. A brilliant one! It’s more responsive to point out that this doesn’t necessarily pull in a collectivist/left/feminist direction. Christine is a libertarian and she understood the element of implicit decentralist/pro-market subversion in what I was trying to pull off quite well, thank you.
The larger problem is that there is some actual
truthto the misogynist argument. Women have a different statistical distribution of relevant abilities than men do. If you create an artificial requirement that women be represented and rewarded equally to men in any STEM field, youwillnecessarily devalue the things that men are in aggregate better at doing (solitary concentration, math, handling hard logic) in favor of talk/politics/marketing.Of course, the correct answer is to not set up that artificial requirement and let the distribution of men and women in STEM be what the nature of the work demands. But then it will be lopsided, because most women cannot generate the required kind of monomania (and there’s the well-known problem with differential IQ dispersion as well). Idiots and and political shit-stirrers will interpret the natural result as “institutional sexism”, and we’re off to the races again.
Eric,
I was specifically addressing the implication by the scum of the earth that the open source movement is a place where Men are Men and crush code without interference from the womenfolk; whereas the free software movement has been taken over by SJWs and other ne’er do wells in an attempt to turn development into a conflict-free tea party or ice cream social dominated by ineffectual women. I was not speaking to his broader claims about women’s capability, which are just as fallacious.
I recognize that Christine’s cited contribution to open source was marketing and not engineering, but it is sufficient to establish that the open source movement is not like the country club from Stepford Wives, where men gather to be all manly, free from the threat of the women making substantive contributions to society.
“sufficient to establish that the open source movement is not like the country club from Stepford Wives, where men gather to be all manly, free from the threat of the women making substantive contributions to society.”
Saw one woman involved in opensource before the arrival of the geek-feminists.
It was like a country club, it was exactly like that but on the internet. Almost everyone was a male and you could do and say whatever you wanted. There was no interference. And then ~2006 happened.
@Mike Hanover
“Almost everyone was a male and you could do and say whatever you wanted.”
What, no flame wars?
There were more flame wars before the women joined in 2006 or so. You didn’t get banned for them either. There was more freedom. Software like “hotgirls” existed in debian, it was subsequently removed by the women and their supporters. They are about cencorship and pushing through their views. Strangely they all seem to support the systemd takeover in Debian aswell (don’t know why, but they’re totalitarians).
Ted Walther: I’m aware of the history of the old testament. I like the version that we have. You liked it too some years ago, but now you’re beyond it? Is it because things you didn’t like were pointed out (perhaps I helped in that)?
I always wonder why almost no one in the world, no man, can accept those things. Why don’t western men like girls? What’s so good about women? Is it just every dog needs a master (the man being the dog ofcourse) and this taught since birth?
>Is it just every dog needs a master (the man being the dog ofcourse) and this taught since birth?
Stop now. This blog is not a forum for your sick, misogynistic bile. I refrain from banning you only because even a werewolf may have truthful observations to make about matters of fact, but you are skating close to the edge. If you cannot stick to objectively testable claims about what you think has happened in the hacker community, you will be banned.
@Mike Hanover
As you seem to know about these early days. Is it true that women at hacker conferences were invited to “private pillowfight parties”? Or asked to remove clothes for a contest?
http://singlevoice.net/2012/07/12/sexism-redyellow-cards-at-defcon/
Somehow, I never hear such things for conferences I attend. And these are quite technical conferences.
>As you seem to know about these early days. Is it true that women at hacker conferences were invited to “private pillowfight parties”? Or asked to remove clothes for a contest?
First, I laugh at the idea that before 2006 constituted “early days” of the hacker culture. Try before 1986.
Second: why would you imagine anything at Defcon would be relevant? Those people are not hackers, however desperately they might wish to claim the term.
@esr
I should use [sarcasm] tags more often.
I was doinf Fortran on Data General in 1986 (bleh). Not much hacking.
Hackers behaving badly is so endemic that red and yellow “creeper cards” are now regular features at open source conventions. Virtually all the major cons coordinate with the Ada Initiative to define and enforce appropriate standards of conduct. This wouldn’t be necessary if misogyny weren’t so ingrained into the hacker culture. But it is so here we are.
I don’t see what women have to do with systemd. Systemd is part of a broader architectural change in Linux as a whole, a move from Unix primitives like pipes and sockets as the primary process control mechanism to D-Bus. The D-Bus message bus is the central abstraction around which the FOSS ecosystem is built; systemd just brings that flexibility and control to the init system. Women like it presumably for the same reasons most men do: it makes Linux easier to manage and far more flexible.
@Jeff Read :… wouldn’t be necessary if misogyny weren’t so ingrained…”
Jeff … you and the other shrieking SJWs can’t seem to take a breath without including the word “misogyny” in there somewhere. I don’t think the word means what you think it means. I’ve been in and around this technology for most of my 54 years and I’m pretty sure I’ve never met an actual misogynist. Anywhere.
Jeff, people who are fed up with SJWs and other variants of totalitarian leftism always trying to tell us what to think and wanting to impose their will on every facet of our lives aren’t misogynists.
Any why do I waste my time trying to educate those who insist on being willfully ignorant?
Jeff Reed: why should hackers (or anyone) change themselves to your liking? What you are describing is a clear conspiracy (“coordinated with Ada initiative”) to force behavioral change on a targeted group (male hackers). Thank you for confessing.
Nope. You got that one wrong. What DBus is, is a daemon (always running), now required, sitting there, waiting to be exploited. Also an end run around unix permissions.
(And yes it has had exploits allready). The kernel just wasn’t enough of an attack surface.
FOSS didn’t used to use DBus at all. I only noticed it recently when a CD burning program now required it to be running. A CD burning program which worked fine before DBus existed.
Thank’s for taking everything over and making it less secure and turing it to garbage,
you know : all these programs which existed and worked fine before your “we” (whomever that is) injected yourselves and took over.
” a move from Unix primitives like pipes and sockets as the primary process control mechanism to D-Bus. The D-Bus message bus is the central abstraction around which the FOSS ecosystem is built; systemd just brings that flexibility and control to the init system. Women like it presumably for the same reasons most men do: it makes Linux easier to manage and far more flexible.”
> clear conspiracy to force behavioral change
Regardless of the specifics… are you unable to conceive of the
ideaof a form of behavior being immoral?> What DBus is, is a daemon (always running), now required, sitting there, waiting to be exploited. Also an end run around unix permissions.
Couldn’t one say the same about the TCP-IP stack – even down to being an end run around unix permissions – except for the fact that it lives in the kernel rather than being a daemon?
@Michael Hip
“Jeff, people who are fed up with SJWs and other variants of totalitarian leftism always trying to tell us what to think and wanting to impose their will on every facet of our lives aren’t misogynists.”
Neither Jeff nor anyone else here was trying to change how you think, just how people behave in company. And the only facet of your life that is at stake is how you behave around strangers, more precisely, women.
The behavior discussed in the link I gave is well known to drive women away. Not just in liberal US circles, but everywhere in the world during all of history. (actually, men have paid women to subject to it, and they have to pay handsomely)
I can’t speak for anyone in this thread specifically, but purging incorrect thoughts is
preciselywhat the SJW brigade is after, as evidenced by their constant kafkatrapping into the conclusions that (1) all Privileged People are $FOO\ist and (2) even mental $FOO\ism confers moral and, if at all possible, legal culpability. The retreat into holding up implicit-association tests like crosses to vampires makes this blindingly clear.I’m talking about actual documented sexual assault and harassment of women taking place at cons, including inappropriate remarks, being hit on inappropriately, and being groped. I’m not conflating men objecting to SJWism with misogyny, I’m describing actual misogynist behavior as misogyny.
That said, if you are aware of the problems with the way women are treated at public open-source community gatherings, and your main problem is still with the big bad SJWs, then you are — at best– objectively pro-misogynist.
@Christopher Smith
“I can’t speak for anyone in this thread specifically, but purging incorrect thoughts is precisely what the SJW brigade is after,”
What you think other people at other times in other places are trying to do has little to do what Jeff or I are writing now and here. This discussion is rather pointless if you do not answer our writings, but the words of other people we do not even know of.
@Jeff Read “I’m talking about actual documented sexual assault and harassment of women …”
No you’re not. Because both these terms have been co-oped by the SJWs and have become so vague as to be meaningless. According to the feminists, anything they don’t like is assault, harassment, rape, misogyny.
“That said, if you are aware of the problems with the way women are treated at public open-source community gatherings, and your main problem is still with the big bad SJWs, then you are — at best– objectively pro-misogynist.”
Jeff, this is one of the first problems with the shreiking SJWs: they don’t know how to use words correctly. Or more likely, they intentionally misuse them to criminalize everything (see above).
Misogyny means “dislike of, contempt for, or ingrained prejudice against women.” I don’t know anyone like that. I’ve never been to a FOSS conference, but the reports I read of things alleged to have happened and being labelled as misogyny are uniformly not. Unprofessional things happen everywhere, not just at FOSS conferences. Immoral things happen everywhere. Google “slut walk” and get back to me with an explanation of how the cheering of this sickening phenomena squares with what is supposedly happening at FOSS conferences.
I have a deep hatred of feminism and the damage it has done to women and to our civilization and culture. But feminism != women.
Besides, if the shreiking SJWs are so put off by whatever embarrassing behaviors are taking place at FOSS gatherings, why don’t they just start their own conference and show them how it’s done. The innate superiority of it would surely be immediately obvious to everyone would it not.
@Michael Hip
“I have a deep hatred of feminism and the damage it has done to women and to our civilization and culture. ”
I am confused.
Do you mean you hate voting rights for women? Or the right to study and work? The right to own property? Independent living? The right to keep her children after a divorce? The right to have a divorce? Equality before the law?
@Winter “Do you mean you hate voting rights for women? Or the right to study and work? The right to own property? Independent living? The right to keep her children after a divorce? The right to have a divorce? Equality before the law?”
I am confused.
What do any of those things have to do with feminism?
@Michael Hip
They are Feminism. For 90? of women.
@Winter on “They are Feminism. For 90? of women.”
I assume that was supposed to be a percent sign.
Then your assertion is that 90% of women are gullible, confused, illogical, unobservant, mere tools, useful idiots.
I deny that.
@Michael Hip
Feminism
: the belief that men and women should have equal rights and opportunities
: organized activity in support of women’s rights and interests
http://i.word.com/idictionary/feminism
@Winter, @Michael Hipp, I think you’re both being dishonest about your understanding of the other’s usage of the term Feminism, and of the range of meanings that the word can have in general.
@Winter
“Feminism
: the belief that men and women should have equal rights and opportunities
: organized activity in support of women’s rights and interests”
All you’ve done is pointed out that feminism is founded on lies. Perhaps the main lie being its purpose. Surely you don’t think that definition is consistent with what feminists do today?
@Random832 “@Winter, @Michael Hipp, I think you’re both being dishonest about your understanding of the other’s usage of the term Feminism, and of the range of meanings that the word can have in general.”
No, I’m not being dishonest. I am a pragmatist. I judge things by their practical effects. So my definition of feminism is consistent with observation. And worrying about the “range of meaning” would only be giving place to the lie of what feminism claims vs. what it actually does.
Re: Winter
“They are Feminism. For 90% of women.”
Actually, per a Huffington Post poll, only 23% of American women (16% men, 20% overall) identify as feminists. But that same poll shows 82% believe that “men and women should be social, political, and economic equals.”
I would argue that this demonstrates that the term “Feminist” as used by Americans today does not mean “voting rights for women? Or the right to study and work? The right to own property? Independent living? The right to keep her children after a divorce? The right to have a divorce? Equality before the law?”
In the past it did mean that, and I would prefer if it still did. But it doesn’t, and I believe this is largely due to SJWs abusing the term, crying wolf. If being a feminist means being outraged over Matt Taylor’s shirt, then I don’t find it surprising that only a minority of them population identify as feminists.
http://www.huffingtonpost.com/2013/04/16/feminism-poll_n_3094917.html
@Random832
“@Winter, @Michael Hipp, I think you’re both being dishonest about your understanding of the other’s usage of the term Feminism, and of the range of meanings that the word can have in general.”
Then you (or Michael) should be a little more specific. I quoted the dictionary definition. I am totally ignorant about the current political propaganda in the USA (I assume you want to refer to that). I know the meaning of the word “Feminism” in the rest of the world, e.g., Europe, the Arab world, Indonesia, India, South Africa, Japan, China, South America. If you dismiss Feminism as a disaster for the world, you are dismissing the rights of these people too.
@Michael Hip
“All you’ve done is pointed out that feminism is founded on lies. Perhaps the main lie being its purpose. Surely you don’t think that definition is consistent with what feminists do today?”
When I was a young boy, women were fired when they got married, birth control was illegal, women were “discouraged” to drive cars. I have witnessed teachers, up to the university, who mocked female students who wanted to take up a serious study. Some even refused to take female students in their department. Women had to switch career because there was no future in their chosen profession as a woman. I remember the times when abused and raped women were send home by the police.
And what feminists do today?
I’m a girl campaign
http://plan-international.org/girls/
Souad al Shammary in Saudi Arabia
http://www.marietjeschaake.eu/2014/11/written-questions-on-the-case-of-souad-al-shammary-in-saudi-arabia/
End violence
http://www.endvawnow.org/en/articles/185-sexual-harassment.html
So, please be more specific about what it is you are hating if it not the the feminism above.
@Beolach
What distinguishes these people who use the label “Feminism” from those who abuse the term “Liberalism”, “Conservatism”, or “Christian”?
There are people in the States who bomb abortion clinics in the name of Christ. Another bombed a federal daycare center in the name of freedom. Yet another bombed scientists and airlines to protect the American Way.
@Winter “I am totally ignorant about the current political propaganda in the USA”
And I don’t know the current political propaganda in Estonia or Chile, so perhaps we talk past each other. But I thought the nominal topic at hand was the alleged misogyny at (mostly American?) FOSS conferences and their presumed succors the feminists.
“When I was a young boy, women were fired when they got married, birth control was illegal, women were “discouraged” to drive cars. I have witnessed teachers, up to the university, who mocked female students who wanted to take up a serious study. Some even refused to take female students in their department. Women had to switch career because there was no future in their chosen profession as a woman. I remember the times when abused and raped women were send home by the police.”
To my knowledge, none of those things existed in the US in the latter half of the 20th century when most of my opinions formed. So if those are the ills that feminism is supposed to cure, then why do we have so very much of it in a place where it is not needed?
“e.g., Europe, the Arab world, Indonesia, India, South Africa, Japan, China, South America. …
http://plan-international.org/girls/ …
Souad al Shammary in Saudi Arabia …
http://www.marietjeschaake.eu/2014/11/written-questions-on-the-case-of-souad-al-shammary-in-saudi-arabia/ …”
Perhaps it’s just me but it strikes me as odd that you include Europe and Japan in with a list of places/countries where the main struggle is likely more about political liberty than about feminism per se. If you could wave a magic wand, would you give the Chinese feminism or something more like democracy and it’s presumed benefits? Does Saudia Arabia have more need of feminism than it does of a better form of government less beholden to Islam?
Just to be clear, here I speak only of the US and my observations thereof: but in my lifetime I have seen no benefit whatsoever from feminism, but the destruction it has wrought on our government, culture, educational system, institutions, entertainment, industry, and morality is the equivalent of what American bombers did to German cities in late WWII. In the US, the feminists have total air supremacy and leave a trail of destruction in their wake.
BTW, it would be a nice courtesy if you would at least quote my name correctly. It’s German, with two ‘p’s.
Few more flexible words in the English language than “appropriate”. What’s considered generally acceptable
by the attendees–and not by, as Glenn Reynolds puts it, upper-class white academics–varies widely from con to con and even by situation within the con (particular venues, particular times or events, etc.). We have a recent example of when a woman’s kissing another man in front of her husband was considered “appropriate” behavior by all concerned.Furthermore, cons by their nature tend to attract people who are socially clumsy or oblivious on both ends of interactions, and I recall a survey in which the majority of complainants acknowledged that they hadn’t actually expressed their discomfort or disinterest to their “harassers”. It’s perfectly reasonable to insist that attendees stop pursuing someone after being explicitly asked to, but it’s typical othercrime to claim that someone’s feeling uncomfortable is itself an actionable offense.
>We have a recent example of when a woman’s kissing another man in front of her husband was considered “appropriate” behavior by all concerned.
On the other hand, in that same social context some forms of sexual aggression that are relatively OK in some U.S. subcultures – such as, say, pinching a woman’s butt – would be very,
veryfrowned upon. The population of SF conventions is mainly drawn from the college-educated white middle class, which is notably restrained in its sexual behavior. The high incidence of polyamory doesn’t actually change this; when I expressed discomfort about kissing an intoxicated woman I was exhibiting values that the sober husband understood perfectly.@Michael Hipp
Sorry for distorting your name.
Re: Winter
> What distinguishes these people who use the label “Feminism” from those who abuse the term
> “Liberalism”, “Conservatism”, or “Christian”?
In the case of “Liberalism” & “Conservatism”, very little. If I compare the strict dictionary definitions of the terms with how they are commonly used in America, there are significant differences. The differences are perhaps smaller & less negative than with “Feminism”, but I do see the same shifting of meaning happening with both “Liberalism” & “Conservatism”.
“Christian” is actually different, because while there are some instances of people using the term in a way that does not match the strict dictionary definition, the correct (dictionary definition) usage is still much more common.
> There are people in the States who bomb abortion clinics in the name of Christ. Another
> bombed a federal daycare center in the name of freedom. Yet another bombed scientists
> and airlines to protect the American Way.
I don’t think bombings are a useful illustration of people changing the meanings of words – those instances are way too rare & extreme, and so can, should, and are discarded as meaningless outliers that don’t actually affect the common meaning of a word. What I was referring to is more subtle (but “more subtle” relative to bombings isn’t saying much).
Take your list of meanings for “Feminism”: voting, study and work, owning property, independent living, keeping children after a divorce, have a divorce, equality before the law. In America, all of those things are fait accompli (and I’m not interested in arguing this – no, we’re not perfect, but all of those are still already achieved). So, if those are the objectives of “Feminism”, then “Feminists” should be focusing most of their energy on other places in the world where that isn’t the case. From skimming your recent links, this does seem to be your main focus, but frankly I think you’re in the minority.
As I wander through mainstream & social media in the USA, I’m much more likely to see “Feminism” focusing on the USA, with different objectives from what you listed: micro-aggressions, gender pay-gap, under-representation in STEM (due to offensive shirts!), cat-calling, domestic abuse… things that are poorly supported or directly contradicted by facts, or are the natural results of human nature (sexual dimorphism). Even if/when I accept some of these things as valid problems, the scale is vanishingly small, but blown enormously out-of-proportion by “Feminists”.
All I know is – over the past 30+ years of my life, it’s become more and more dangerous to be around a woman. And much as I might be interested in ballet and gymnastics, I’m damned sure not going to go to a recital or meet, as I have no kin folk there, and I have no interest in being accused of being a pedophile.
As for the whole feminist thing, here’s one woman’s take on it – very well documented. http://check-your-privilege-feminists.tumblr.com/post/95979451581/i-dont-understand-how-are-you-not-a-feminist
Jeff Read Said: “I’m talking about actual documented sexual assault and harassment of women taking place at cons, including inappropriate remarks, being hit on inappropriately, ”
In response to Jeff Read:
“including inappropriate remarks”: Nothing wrong with that. Freedom of speech. Freedom to date.
“being hit on inappropriately,”: Nothing wrong with that either aslong as she’s not with another man allready. (Freedom of speech, freedom to attempt to pick up women etc)
You’re all about controling men’s words, thoughts, and actions. If they don’t comply with your programme you eject them. If they STILL don’t comply with your progamme you seek other “sanctions” be it attempting to have the man fired, arrested, or attacking his work or contributions and having them removed so no one else can benefit from them or even know he built anything
(Like the old soviet airbrushing of people out of history)
(PS: how are your “sanctions” against Putin and his friends going? He and his friends do
all the things you complain that hackers do, and they’re proud of it and won’t stop
even if you start a hot war with Russia, AND they export their ideals and help other
countries stand up the the “west” and the “standard of behavior” that you and yours have
pushed on the world)
I’m really rooting for Russia these days. I hope it changes the world: changes it back.
Honestly it’s shocking what they’re doing and so suddenly. I always thought of them
as a bedrock of all things you admire but it looks like they decided to turn around.
Like a shot out of the darkness, coming just at the right time.
Russian Obstructionists :) Bless them.
@Beolach
“As I wander through mainstream & social media in the USA, I’m much more likely to see “Feminism” focusing on the USA, with different objectives from what you listed:”
I consider access to birth control, pay gaps and sexual harassment (M/F) still to be worthwhile subjects for feminists even in the moderns USA. Also the more subtle forces that guide boys and girls away from opportunities and professions they might want to explore warrant attention. And women among the recent and not so recent immigrants could use some help too.
@Mike Hanover
““including inappropriate remarks”: Nothing wrong with that. Freedom of speech. Freedom to date.
“being hit on inappropriately,”: Nothing wrong with that either aslong as she’s not with another man allready. (Freedom of speech, freedom to attempt to pick up women etc)”
So, you would protect gay men who invade a convention to do the same, during all waking hours? Because, my understanding is that if gays would try this in the USA, they would very often find themselves in hospital.
@Mike Hanover
“PS: how are your “sanctions” against Putin and his friends going?”
It seems it is going along fine:
http://www.newrepublic.com/article/120201/russias-ruble-value-collapsing-due-sanctions-stagnation
It is a game that needs a sensitive touch. We do not want Russia to collapse, but the pain must be big enough to deter Putin. Not necessarily drive him out of the Crimea and Eastern Ukraine. An occupied Eastern Ukraine will be a continuous drain on Putin’s reserves. But enough pain to prevent any new adventures towards the Baltic and Kazakhstan.
Note that Putin has destroyed his prospects for a great Eurasian empire that controls the old members of the Soviet Union.
https://alfinnextlevel.wordpress.com/2014/10/27/grand-eurasian-empire-stumbles-at-the-gate/
Birth control in many forms is universally available to women, and now the federal government is mandating zero-dollar insurance coverage for it. No coverage for condoms, by the way.
Studies routinely show that women in the same jobs as men with the same experience as men tend to be paid more, while men make up nearly 95% of on-the-job fatalities, in addition to usually working significantly more hours in salaried jobs than their female counterparts.
Treatment of sexual harassment is, in most cases, so thoroughly stomped on that even in these liberated times I hear more complaints about mysteriously missing Men than I do about harassment. On the other hand, actual real harassment–such as by explicitly blaming men for perceived ills for which they bear no personal responsibility–is accepted as part of the mainstream discourse.
I presume your understanding is also that, as I live in Texas, I ride a horse to work.
@Winter “Also the more subtle forces that guide boys and girls away from opportunities and professions they might want to explore warrant attention.”
Thank you for including “boys” in this. At any other blog you’d probably be banned, as the current policy in the US is that boys are to be drugged, shamed, labelled as rapists, expelled for playing Pop-Tart gun, last on the list for admittance to University, and sanctioned exhibiting even the mildest symptoms of masculinity.
That, Winter, is feminism in the USA.
The only comfort is knowing that it will be a very short-lived phenomenon.
@Christopher Smith
“I presume your understanding is also that, as I live in Texas, I ride a horse to work.”
I am glad to hear that gay-bashing is a thing of the past in the USA.
@Winter
When you listed the lofty items alleged to be the goals of worldwide feminism, did it include establishing arbitrary quotas on boards?
Perhaps this is a French conspiracy to take down the German economic juggernaut :-)
‘Germany to introduce legal quotas for women on company boards’
“Chancellor Angela Merkel’s coalition parties agreed on Tuesday to a draft law that would force Germany’s leading listed companies to allocate 30 percent of the seats on non-executive boards to women from 2016 onward.”
Sorry, forgot the link:
http://www.reuters.com/article/2014/11/25/us-germany-women-quota-idUSKCN0J92JI20141125
“The only comfort is knowing that it will be a very short-lived phenomenon.”
Nope, it will keep getting worse forever. America only goes one way.
@Michael Hipp
“When you listed the lofty items alleged to be the goals of worldwide feminism, did it include establishing arbitrary quotas on boards?”
That was in the news yesterday. What was also in the news this week was the president of Turkey explaining why women should not be allowed to work.
http://www.bbc.com/news/world-europe-30183711
Note that the demographics of Germany require that everyone should be recruited to work the best job they can.
Making sure that everyone has the same opportunities in life is indeed a goal of feminism, with a bias for women. You do not have to come up with the standard argument that “we want the best person for the job”, because there have been countless studies that people are unable to judge others objectively. Even if they want to. So I know institutions have often to be “coaxed” to make them hire women. That was necessary when they refused to hire any women at all, and it still seems to be necessary when they do not hire women in the boards.
Blind auditioning increased hiring of female musicians
http://www.uh.edu/~adkugler/Goldin&Rouse.pdf
Gender bias in science is real
http://blogs.scientificamerican.com/unofficial-prognosis/2012/09/23/study-shows-gender-bias-in-science-is-real-heres-why-it-matters/
This is a fundamental fact about human judgments: It cannot be objective. You find the biases in every field of life. See the large amounts of studies on why we should insist on double blind testing in medicine.
@Winter “What was also in the news this week was the president of Turkey explaining why women should not be allowed to work. http://www.bbc.com/news/world-europe-30183711”
Again, does Turkey need more feminism or just a better form of government less beholden to Islam?
For some odd reason curiosity overcame me and I actually read the article. Did you? I inserted [] comments below.
“”Our religion regards motherhood very highly,” he said. “Feminists don’t understand that, they reject motherhood.” [This is a correct statement.]
He said women needed equal respect rather than equality.[Where is the problem with this statement? Especially given that equality doesn’t exist and never has and never will.]
Mr Erdogan also told the Istanbul meeting that justice was the solution to most of the world’s issues – including racism, anti-Semitism, and “women’s problems”. [A laudable and rather bold statement coming from the leader of an Islamic country.]
”
You desire objectivity. Can you explain how he is objectively wrong?
“Note that the demographics of Germany require that everyone should be recruited to work the best job they can.”
You offer no evidence or justification for this assertion. Is it possibly because feminism has put Germany into a demographic decline? Perhaps this is the trap the Turks wish to avoid.
And I presume you’re doing the standard leftist trick of remaking words, where “recruited” is actually “forced at the barrel of a gun”. Because force is the only tool in the leftist kit.
“Making sure that everyone has the same opportunities in life is indeed a goal of feminism, with a bias for women.”
Earlier you said the goal of feminism was defined as “the belief that men and women should have equal rights and opportunities”. But now it’s “with a bias for women”.
But I see, more leftist changing of words. Now “equal opportunity” is actually “forced outcome”.
“You do not have to come up with the standard argument that “we want the best person for the job”,”
Yes I do, because when posed a question, one should always offer the correct answer.
“… because there have been countless studies that people are unable to judge others objectively.”
And a 30% quota is somehow objective? Isn’t it more correct to say it is “arbitrary”?
” Even if they want to. So I know institutions have often to be “coaxed” to make them hire omen. That was necessary when they refused to hire any women at all, and it still seems to be necessary when they do not hire women in the boards.
Now “coaxed” == “forced at the barrel of a gun”.
Besides, who cares? If some institution wants to ignore more than half of the qualified recruits available to them why shouldn’t they be allowed to? If people want to be stupid shouldn’t they be allowed to be stupid? A better institution that is more objective and open minded could snap up all those that were arbitrarily excluded and put the other to shame. Wouldn’t that be a better outcome that would make a more lasting and powerful impact? Do you not have confidence that the truth would come out in the end?
”
Blind auditioning increased hiring of female musicians
http://www.uh.edu/~adkugler/Goldin&Rouse.pdf
Gender bias in science is real
http://blogs.scientificamerican.com/unofficial-prognosis/2012/09/23/study-shows-gender-bias-in-science-is-real-heres-why-it-matters/
”
Thanks for the links. Looks like an interesting line of query. I didn’t read them for lack of time. But in any event I can’t assign much credibility to them because in 2014 the only objective position is to assume they are a biased study that started with a conclusion and worked backwards. SA is an openly leftist rag (I mourn for her). I might very well be wrong about these two “studies”, but I haven’t the resources to find out one way or the other.
“This is a fundamental fact about human judgments: It cannot be objective. You find the biases in every field of life. See the large amounts of studies on why we should insist on double blind testing in medicine.”
Correct. But where is the plan that is more objective? Pegging things at an arbitrary 30%?
I will note that humans arrived at the very top of the food chain and have conquered most every obstacle in our path without being “objective”. Is there a better way? The burden is on the claimant to “objectively” prove it is better. I don’t think the feminists are up to it.
In any event, where is the person who has ever claimed that humans are objective? I think “rationalizing” is a more correct characterization of humans.
@misconator “Nope, it will keep getting worse forever. America only goes one way.”
True. But different. It’s unlikely the USA will continue much longer. I wager we are headed toward civil war and balkanization. Feminism won’t survive contact with reality.
@Michael Hipp
Erdogan also said:
“Women cannot do all the work done by men, he added, because it was against their “delicate nature”.”
Which is only true for extreme jobs. Not the jobs women want to work in anyway.
@Michael Hipp
““Making sure that everyone has the same opportunities in life is indeed a goal of feminism, with a bias for women.”
Earlier you said the goal of feminism was defined as “the belief that men and women should have equal rights and opportunities”. But now it’s “with a bias for women”.”
Actions are primarily towards helping women. The goal is still the same: Equality.
> “You offer no evidence or justification for this assertion. Is it possibly because feminism has put Germany into a demographic decline? Perhaps this is the trap the Turks wish to avoid.”
Now you are silly. The number of children goes down with income. That is a worldwide trend and not limited to Germany. The USA gets around that by importing massive amounts of immigrants from poor countries.
> “And a 30% quota is somehow objective? Isn’t it more correct to say it is “arbitrary”?”
No, 50% would be equal, but also not justified as there might be shortages due to lags in education. 30% is very reasonable and should be easily reached by any organization making a halfway decent effort.
> “If some institution wants to ignore more than half of the qualified recruits available to them why shouldn’t they be allowed to?”
Boards have a fiduciary duty to hire the best candidate. They fail because they ignore half of humanity and cannot show evidence that this half is unqualified. And they lie to the shareholders because they claim they look for the best candidate.
> “If people want to be stupid shouldn’t they be allowed to be stupid?”
They betray the trust of their shareholders.
> “But in any event I can’t assign much credibility to them because in 2014 the only objective position is to assume they are a biased study that started with a conclusion and worked backwards.”
They have data, you have fantasies. Just search for the subject and you can get as many studies as you like (and more).
@Winter
> Which is only true for extreme jobs. Not the jobs women want to work in anyway.
So you agree with President Erdogan (differing in the details) and acknowledge that men and women are different and therefore not equal. And the real goal is to provide what “women want”.
> Actions are primarily towards helping women. The goal is still the same: Equality.
Equality of what? Opportunity or outcome?
When does “bias” ever lead to “equality”? Is not “bias” the very thing “equality” is supposed to overcome?
On US university campuses women now outnumber men. Yet there are no government mandates to correct this inequality. Because the goal was never equality.
> The number of children goes down with income. That is a worldwide trend and not limited to Germany. The USA gets around that by importing massive amounts of immigrants from poor countries.
The USA is committing suicide. Please don’t follow our lead.
If the number of children is going down, is it really the best policy of government to accelerate the trend? Surely it is understandable that the Turks might not wish to follow the West on this path. (Beyond that I’m unlikely to sympathize with much of the Islamic position, but I do at least have enough intellect to *understand* what their motivations might be and realize those motivations have some arguable merit.)
I suspect that diverging birth/income curves is not an inevitability. Keeping the birth rate at replacement could probably be achieved under the right incentive structure and would require no more force than what the feminists demand.
> 30% is very reasonable and should be easily reached by any organization making a halfway decent effort.
We know it is reasonable because we have the guns and know how to use them. Why should organizations be forced to do this? Their focus should be on whatever is the actual mission of the organization.
You still can’t grasp that what you want isn’t equality, but a certain forced outcome whether beneficial or not.
>Boards have a fiduciary duty to hire the best candidate. They fail because …
> They betray the trust of their shareholders.
This is entirely a problem for the shareholders and no-one else.
> They have data, you have fantasies. Just search for the subject and you can get as many studies as you like (and more).
There is plenty of data available on how frequently these kinds of “studies” are fraudulent, biased, or poorly conceived or executed. Only a fool would take them at face value … especially when they seem to support the leftist totalitarian agenda.
And even if these studies were exactly correct, it still does not explain why “power from the barrel of a gun” is justified to give the women what they want.
“And even if these studies were exactly correct, it still does not explain why “power from the barrel of a gun” is justified to give the women what they want.”
That’s how democracy works.
Men lose all their rights and privileges.
Women + Gay Men = Unbreakable majority.
That’s what happens when you give away the keys to the kingdom.
You end up in a prison, or dead.
@Michael Hipp
Everyone should have the opportunity to explore a proffession that suits them. Erdogan is well known to want to limit the professional possibilities of women (you can look that up yourself). “Delicacy” of women is a very old excuse to deny women a proper job. And the point is that men and women should get a fair chance at entering a profession, not that women should work in equal numbers in jobs that require a man’s muscle power. But you seem to have difficulties with this concept.
You also seem to have missed corporate governace structure and culture in Germany. That is more like Japan than US. The German government has a legal duty to look after this governance.
Going back to the US. Just watch the series Mad Men to get an impression of how a woman’s life was 50 years ago. Freedom and justice have historically been orthogonal to feminism. That you think otherwise is totally attributal to the work of feminists.
Btw, the imbalance of university students is an ongoing concern. As its cause are currently unknown, no one is making a fuss.
And then about birth rates. The only policy that ever worked to increase birth rates in industrialized countries was free, whole day day care for all children and well paid maternity leave (in the old DDR). No one seems to be willing to implement that again.
Do you have any particular reason to believe that a television series, written and produced primarily for entertainment by individuals with strong political leanings, is an accurate representation of life two generations ago?
Your logic is faulty: People make
plentyof fuss when such “imbalances” are unknowns but in the wrong direction, and even when they’re known and attributable to voluntary individual choice but in the wrong direction. If imbalances are in the right direction, it’s irrelevant why; no fuss will be made.@Christopher Smith
“Do you have any particular reason to believe that a television series, written and produced primarily for entertainment by individuals with strong political leanings, is an accurate representation of life two generations ago?”
No. We know from historical material that the situation was worse. Much worse. But the series is more accessible than all the dry archives.
@Christopher Smith
“Your logic is faulty: People make plenty of fuss when such “imbalances” are unknowns but in the wrong direction, and even when they’re known and attributable to voluntary individual choice but in the wrong direction.”
Should we be angry when boys do not want to study?
It used to be that girls were actively discouraged, or even prevented, to study. That is over. Now the girls are entering university in droves. So that was a success. Nobody is doing anything we know that prevents or discourages boys to do the same. Still they don’t go. Why? Whom should we target to change the situation? What should we do?
Anyhow, there is discussion ongoing what to do. At least there is here.
@Winter on 2014-11-28 at 02:20:22 said:
>Everyone should have the opportunity to explore a proffession that suits them.
> women should get a fair chance
Winter, you speak out of both sides of your mouth. You don’t want “opportunity to explore” or “fair chaince” you want to FORCE that a certain number of seats must go to women. That’s force/coercion, not opportunity. Stop being deceptive (or at least stop deceiving yourself).
>Erdogan is well known to want to limit the professional possibilities of women (you can look that up yourself).
Sure. I don’t want that as I don’t want government to have that much power. But I sympathize with their motivations and wonder if – in the long run – they will prove to be the wiser.
>You also seem to have missed corporate governace structure and culture in Germany. The German government has a legal duty to look after this governance.
I know nothing of it. But they seem to have violated a particularly critical principle: that private matters should be settled among the private parties, not with the iron fist of government choosing one side or the other.
>Going back to the US. Just watch the series Mad Men
That you think Hollywood should be considered authoritative doesn’t say much for your intellect or thought processes.
> Freedom and justice have historically been orthogonal to feminism.
No, freedom and justice have always been in opposition to statism (including feminism). Anytime statism is advanced, someone’s freedom and justice are taken away. It’s an iron law.
>The only policy that ever worked to increase birth rates in industrialized countries was free, whole day day care for all children and well paid maternity leave (in the old DDR).
Only because those are the only sorts of policies the western statists are willing to consider. What would happen if incentives were given to families for the mother to stay home? I dunno, and neither do you as such has never been tried and never will under the current “progressive” regimes.
@Michael Hipp
” You don’t want “opportunity to explore” or “fair chaince” you want to FORCE that a certain number of seats must go to women. ”
You are silly. To take your position to extremes, you are saying that forcing slave owners to liberate their slaves is somehow reducing freedom.
Anyhow, you should not argue with me, but with Angela Merkel.
@Michael Hipp
“I know nothing of it.”
So you have absolutely no idea what this is all about? Why bother?
@Michael Hipp
“What would happen if incentives were given to families for the mother to stay home? I dunno, and neither do you as such has never been tried and never will under the current “progressive” regimes.”
That has been done for years in, wait for it, Germany. And it did not work.
@Winter
>To take your position to extremes, you are saying that forcing slave owners to liberate their slaves is somehow reducing freedom.
Winter, you never, ever address the substance of a comment. You always reframe and misdirect. You do not appear willing to engage in honest dialog. In other words, you’re a model leftist. Pour yourself a glass of champagne.
Idiot … how do you think slave owners kept their slaves in the first place … with support from the government.
What does that have to do with government forcing private parties to hire an arbitrary quota of a certain favored people? Do you ever intend to address this?
>Anyhow, you should not argue with me, but with Angela Merkel.
You defended her policy. But if her thinking is as muddled/dishonest as yours I doubt that would very productive either.
>So you have absolutely no idea what this is all about? Why bother?
More dishonesty on your part. Read my comment.
>That has been done for years in, wait for it, Germany. And it did not work.
[citation needed]
But if the governance of Germany is as you describe it then it was likely intended to not work. If I recall, Germany was one of the first in the early 20th century to use women as a tool to win elections; I’m going to guess that would have sabotaged any such effort.
In any event, it should have been obvious I was engaging in a thought experiment. But a leftist must always reframe it as something upon which to heap hate.
@Michael Hipp
> “Idiot … how do you think slave owners kept their slaves in the first place … with support from the government.”
Slavery is much, much older than “States”. I am surprised that you do not know this.
> “What does that have to do with government forcing private parties to hire an arbitrary quota of a certain favored people? Do you ever intend to address this?”
Discrimination based on gender (etc.) is illegal in Germany. So I do not see much problem with the German government upholding the law. Private parties are subject to the law in Germany. Whether this is the best policy to reach that goal is not assured. I still have doubts. But given the inbreeding in German corporate board rooms, some action might very well be justified.
Given the German workforce, it is quite unlikely that these (very big) corporation are unable to find 30% of female candidates that match those from their favorite old-boys network in quality.
> “But if the governance of Germany is as you describe it then it was likely intended to not work.”
That shows you have absolutely no clue about how politics in Germany works. It did not work because:
1) No incentive beats just working in a paid job
2) These incentives are extremely expensive. So they tend to be cut back after a few years.
Here is your citation:
http://www.howtogermany.com/pages/parental_allowance.html
There were even better programs, but they were way to expensive to continuate.
> “In any event, it should have been obvious I was engaging in a thought experiment.”
Why stop at thinking when people have actually done the work and implemented it?
And it was not obvious to me that you did not want real examples to your writings.
@Winter
> Slavery is much, much older than “States”.
Really! Do tell now!
But going back to your point about slavery, do you actually not see a difference between
a) a government that gives freedom and political liberty to people who are otherwise enslaved, vs.
b) a government that forces its citizens to arbitrarily hire people that would not otherwise hire.
Tutorial for you…
a) is a good use of government power … to increase freedom and liberty, whereas
b) is a poor use of government power … to decrease liberty and disturb markets.
> Discrimination based on gender (etc.) is illegal in Germany. So I do not see much problem with the German government upholding the law.
It is also, in theory, illegal here in the US. Except that discrimination to the benefit of the favored groups (e.g. women) is very much legal. They only “uphold the law” in such when it favors leftist causes.
Going back to why I hate feminism, one of the reasons is that it promotes laws that elevate women’s interests and legal rights above those of men. But as a leftist I presume you are very much in favor of this?
> Private parties are subject to the law in Germany. Whether this is the best policy to reach that goal is not assured. I still have doubts. But given the inbreeding in German corporate board rooms, some action might very well be justified.
>Given the German workforce, it is quite unlikely that these (very big) corporation are unable to find 30% of female candidates that match those from their favorite old-boys network in quality.
The egregious machinations of corporations and the elites that run them is hideous to watch, but adopting an arbitrary edict like the 30% quota is a ridiculous attempt at a punitive sort of remedy to a private matter. But western governments long ago seemed to have lost any perspective on what is private and what is public.
And remember you started this line of thinking by claiming that feminism was only about “equality”. Which it is clearly not.
> http://www.howtogermany.com/pages/parental_allowance.html
Thanks, interesting read. I would tend to guess there are cultural factors that overwhelmed the incentive. That, however, does not prove it would not work elsewhere or that there are other types of incentives that would work in various places.
> Why stop at thinking when people have actually done the work and implemented it?
Because a thought experiment is not a research project.
@Michael Hipp
“b) a government that forces its citizens to arbitrarily hire people that would not otherwise hire.”
Do you know the difference between a person (= a member of the species Homo sapiens) and a corporation (= a form of organization where the governing body has a legal duty to the stakeholders)?
The government directive you are so up in arms about is directed towards the boards of corporations who have shown a stark disregard in their legal duties towards the stakeholders. And know that under German law, the legal status of the stakeholders is different than under US law.
We are talking about hired people who “lie and deceive” about their responsibilities.
@Michael Hipp
“And remember you started this line of thinking by claiming that feminism was only about “equality”. Which it is clearly not.”
It clearly is everywhere I have experienced it. And it has always been that way. There are “feminist” who are crooks or mentally disturbed. But you find that everywhere.
I’m curious whether “stakeholders” is the correct term. I have no doubt that Europeans are more accepting of the claim that people who don’t actually have a financial stake in a company (shareholders and creditors) should get to meddle in its operations, but I would have expected Germany to be saner than to define in external parties as ex officio decisionmakers.
@Christopher Smith
“I’m curious whether “stakeholders” is the correct term. I have no doubt that Europeans are more accepting of the claim that people who don’t actually have a financial stake in a company (shareholders and creditors) should get to meddle in its operations,”
http://fic.wharton.upenn.edu/fic/papers/09/0928.pdf
I find it remarkable that people from the US seem to forget employees as stakeholders?
@Winter
>The government directive you are so up in arms about is directed towards the boards of corporations
I noticed it and recognized it for what it is: proof that feminism isn’t about equality.
>We are talking about hired people who “lie and deceive” about their responsibilities.
So they should be fired, and thankfully this is nothing the government need concern itself with. Let the government use its limited resources on matters of more universal importance and for which lesser remedies are not available. Must everything be a “Federal” matter?
> It clearly is everywhere I have experienced it.
Then you are either extraordinarily unobservant or just dishonest. You’ve already been shown how the supposed goals of feminism were long ago conquered, at least here in the US. In US law, women are favored above men in almost every venue. You’ve said it’s illegal to discriminate by sex in Germany. So what is left that can’t be handled as a civil matter where the rare case of actual sexual discrimination pops up.
As another poster commented, feminists in the US are now all about micro-agressions and other fabricated issues. They’re the most prosperous, pampered, coddled and privileged group of people in history, but yet the decibel volume of their complaining goes up every year.
> I find it remarkable that people from the US seem to forget employees as stakeholders?
Because they’re not. They hold no equity position and have no capital at risk, therefore they are not stakeholders.
Like a good leftist, all you’ve done is redefine “stakeholder” to a different meaning that suits your purposes and confuses the issue. You like taking things to extremes … by your definition I am a stakeholder in most every German corporation even if I’ve probably never heard of most of them. Everything is rape. Everyone is a stakeholder.
>> I find it remarkable that people from the US seem to forget employees as stakeholders?
> Because they’re not. They hold no equity position and have no capital at risk, therefore they are not stakeholders.
>Like a good leftist, all you’ve done is redefine “stakeholder” to a different meaning that suits
If wikpedia is anything to go by to get an indication of what a word means, employees count as stakeholders.
http://en.wikipedia.org/wiki/Stakeholder_%28corporate%29
@kn
>If wikpedia is anything to go by …
Thanks. But it’s not. On any topic that is in any way controversial Wikipedia reliably tows the leftist line.
Note the last sentence in that article: “The term has been broadened to include anyone who has an interest in a matter.” So stakeholder is in the eye of the beholder. Not a very useful definition.
Until now I wouldn’t have thought much about “stakeholder” being controversial but I didn’t realize it was being actively abused to warrant more government intrusiveness into private affairs.
Indeed – check Merriam-Webster, and you find that the third, broadest definition of the term is by far the newest (and makes it nearly meaningless unless you’re Dirk Gently or Mentor of Arisia). The earlier definitions make it clear that it’s the people who actually stand to lose (and no, loss of job in this case is not a real loss – you don’t actually lose assets you already have. Modern corporate theory has defined way too many things as assets – even debts have been turned into assets.)
@Michael Hipp
Sorry, but the Germans are very adamant about including employees in the stakeholders category. Whether you agree with them or not. And you will find few admirors of libertarianism in Germany.
Also, the corporation we are talking about are all parts of “keiretsu” s. Their boards are inbred with cross company board memberships. The authorities keep an eye on them, they always have.
> “So what is left that can’t be handled as a civil matter where the rare case of actual sexual discrimination pops up.”
Europeans do not handle public policy by way of the civil courts. When you go to the root of it, civil courts are tyrannical and extremely inefficient in matters of public policy.
In short, Germany is not the US.
@Winter
> Their boards are inbred with cross company board memberships.
This is pretty common in the US also, I saw a lot of it in a former position where I had contact with these VIPs who were on many private and public boards (many of which they had dubious qualifications for). But perhaps it is a matter of degrees.
> Europeans do not handle public policy by way of the civil courts. When you go to the root of it, civil courts are tyrannical and extremely inefficient in matters of public policy.
Well, as before, this would seem to indicate a tendency to define a large swath of private decisions as public policy. Immutable human nature is always to seek more and more power whenever the opportunity presents itself. Humanity has been down this road before and it doesn’t end well.
@Michael Hipp
“Well, as before, this would seem to indicate a tendency to define a large swath of private decisions as public policy.”
Half the population will not be able to realize their potential in life because a number of hired corporate officers simply do not like them. Something they consistently lie about, btw. Sounds like a defensible reason to err on the side of the discriminated and uphold the law. Especially when you are expecting economic problems due to demographic contraction.
@Michael Hipp
” Immutable human nature is always to seek more and more power whenever the opportunity presents itself.”
People hiring clones of themselves is another such part of human nature. This is correctable.
@Winter
>Sounds like a defensible reason to err on the side of …
Only if the default position is “government knows best”. (I do not dispute that Germany has a right to this, I just do not comprehend how anyone can consider it the preferred state of affairs.)
> People hiring clones of themselves is another such part of human nature.
Clones? Why do you state it in the pejorative? That humans tend to trust and prefer in-group tribal members is a perfectly rational and beneficial feature of our human psychology. Does not every group do this; are they all wrong to do so?
> This is correctable.
No, nothing in human nature is “correctable”. With ample force it can be masked for a time, but it always resurfaces. This is colloquially known as “kicking the can down the road” – western societies have done lots of this. Such does not mean it will continue forever.
@Michael Hipp
*Only if the default position is “government knows best””.
That is not how such policies are formulated in Germany. Such things are generally only implemented after everybody and their uncle have been consulted.
“No, nothing in human nature is “correctable”.”
Oh yes. Humans can be nudged towards acceptable behavior. We can eat and drink in civilized manmers, and we can supress urges of verbal abuse. So we can be coaxed to learn to get over our urge to distrust anyone who is not in our own image.
“Oh yes. Humans can be nudged towards acceptable behavior. We can eat and drink in civilized manmers, and we can supress urges of verbal abuse. So we can be coaxed to learn to get over our urge to distrust anyone who is not in our own image.”
I hope a catastrophe hits. There’s no way out of this woman’s world. The women have won over all the earth. They have banned marrying girls everywhere now. Their supporters have “nudged” everyone into acceptable behavior.
The only way to stop such feminist leftism, well talk and debate has only worked in their favor for the last 165 years. Unacceptable behavior must be used to destroy them. They destroy us: their prisons are filled, and police shoot to kill men who do not comply with woman’s laws.
”
2014-11-28 Bartlett, Mark Allan (42) Mississippi (Pearl) Capt. Brian McGairty said Mark Allan Bartlett, 42, was killed after police say he brandished a gun at an officer in a threatening way when police were called out to a domestic disturbance. The officer fired one shot, hitting Bartlett, who died of his injuries.[3]”
They also had a major victory: the career of serial rapist Bill Cosby is now a smouldering ruin, and a huge part of why is because SJWs successfully brought to public consciousness the point of law that all sex without consent is rape — not just forced sex.
And all without a single actual conviction in a court of law! Isn’t *THAT* just wonderful! And I’m curious – how do you have unforced sex without consent?
But hey, now we can ruin people’s lives without worrying about the snail’s pace of the courts!
If you have sex with a woman who is too intoxicated to give informed consent, you have committed rape.
If you have sex with a woman by misrepresenting your identity to her, you have committed rape. This is called a “rape of deception” and is the reason why the movie
Revenge of the Nerdsis problematic from a feminist perspective: Lewis Skolnick does this to Betty Childs, suffers no consequences, and it’s presented as him “getting lucky”.With twenty women having come forward, Cosby’s innocence is becoming increasingly difficult to maintain.
Rape is notoriously difficult to get a conviction for, since the process of acquiring physical evidence (bruises, semen, etc.) is humiliating for the victim and extremely time limited. So yes, the criminal court system
isinadequate in dealing with this crime, and precious little thought is given to countless women over the years whose lives were ruined — or at least severely damaged — by the physical and emotional scars of rape, and who had to endure those scars without hope of justice or recompense.>With twenty women having come forward, Cosby’s innocence is becoming increasingly difficult to maintain.
Actually, twenty is above the threshold where it gets a little
easierto maintain, when someone as famous as Cosby is involved. Likely some of these women are trash angling for reflected celebrity, and one or two are outright delusional. The social and legal risk of lying about rape while female is now so low that any sufficiently unscrupulous woman who has ever been in a room with Cosby alone has to be thinking about jumping on the gravy train. Lost in the resulting noise is whether Cosby ever committed actual rape, which I think is pretty much unknowable.Jeff Read: In the book of Deuteronomy, rape of an unespoused young female child results in the man keeping the girl and paying the father some money. (Deuteronomy 22 28-29 hebrew, read each word).
Rape of a grown woman not belonging to anyone seems to incur no penalty whatsoever: if she’s not someone’s woman, and not a virgin young girl she’s not covered.
I think “we” should go back to Deuteronomy. That is a man’s lawbook. Not this feminist garbage you have forced upon the men of the world everywhere.
“With twenty women having come forward, Cosby’s innocence is becoming increasingly difficult to maintain.”
Good for him. Western women are the enemy of men. Glad he used them for something for himself.
“If you have sex with a woman by misrepresenting your identity to her, you have committed rape. This is called a “rape of deception” and is the reason why the movie Revenge of the Nerds is problematic from a feminist perspective: Lewis Skolnick does this to Betty Childs, suffers no consequences, and it’s presented as him “getting lucky”.”
He should not suffer any consequences. Feminists should be killed. I pray for a war between Russia and the USA to make that dream come true.
>He should not suffer any consequences. Feminists should be killed. I pray for a war between Russia and the USA to make that dream come true.
Last warning. The next outpouring of bile like this will get you permanently banned.
“The social and legal risk of lying about rape while female is now so low that any sufficiently unscrupulous woman who has ever been in a room with Cosby alone has to be thinking about jumping on the gravy train. ”
I doubt they all were even in the same room with him, except through the magic of Technicolor(TM)(R). As you said: what do they got to lose?
> The social and legal risk of lying about rape while female is now so low that any sufficiently unscrupulous woman who has ever been in a room with Cosby alone has to be thinking about jumping on the gravy train.
Your theory doesn’t account for why they should all be targeting Cosby in particular, rather than any randomly selected male celebrity.
>Your theory doesn’t account for why they should all be targeting Cosby in particular, rather than any randomly selected male celebrity.
Tara Li called it. Once the first such accusation has been made, there’s blood in the water.
I didn’t make clear earlier that I think in cases like this the first accuser is the one most likely to be truthful.
The appropriate phrase, Random832, is “chum in the water”.
@Tara Li: His theory “social and legal risk of lying about rape while female is now so low” does not suggest any such concept.
Not only that, but suppose one of the later ones had a plausibly shady encounter with Cosby, but knows she’d never have a chance of making a charge stick, if it were to come to trial, and knows that he knows it. You might think she wouldn’t even bother with the attempt. However, suppose Cosby were to publicly call such an attempt out. It would look to the public like positive evidence that the other claims are supported – why would he jump on this one, and not any of the others? So if Cosby’s lawyer is smart (likely), he’s forced to treat all of the charges largely the same – refuse to respond, and refer to them in total as unfounded.
Which is consistent with his current behavior, from what I’ve seen. |
4,656 | 不重启不当机!Linux内核热补丁的四种技术 | http://www.infoworld.com/article/2851028/linux/four-ways-linux-is-headed-for-no-downtime-kernel-patching.html | 2015-01-13T20:21:00 | [
"内核",
"Ksplice",
"Kgraft",
"Kpatch"
] | https://linux.cn/article-4656-1.html | 
*供图: Shutterstock*
有多种技术在竞争成为实现Linux内核热补丁的最优方案。
没人喜欢重启机器,尤其是涉及到一个内核问题的最新补丁程序。
为达到不重启的目的,目前有3个项目在朝这方面努力,将为大家提供内核升级时打热补丁的机制,这样就可以做到完全不重启机器。
### Ksplice项目
首先要介绍的项目是Ksplice,它是热补丁技术的创始者,并于2008年建立了与项目同名的公司。Ksplice在替换新内核时,不需要预先修改;只需要一个diff文件,列出内核即将接受的修改即可。Ksplice公司免费提供软件,但技术支持是需要收费的,目前能够支持大部分常用的Linux发行版本。
但在2011年[Oracle收购了这家公司](http://www.infoworld.com/article/2622437/open-source-software/oracle-buys-ksplice-for-linux--zero-downtime--tech.html)后,情况发生了变化。 这项功能被合入到Oracle自己的Linux发行版本中,只对Oralcle自己提供技术更新。 这就导致,其他内核hacker们开始寻找替代Ksplice的方法,以避免缴纳Oracle税。
### Kgraft项目
2014年2月,Suse提供了一个很好的解决方案:[Kgraft](http://www.infoworld.com/article/2610749/linux/suse-open-sources-live-updater-for-linux-kernel.html),该内核更新技术以GPLv2/GPLv3混合许可证发布,且Suse不会将其作为一个专有发明封闭起来。Kgraft被[提交](https://lwn.net/Articles/596854/)到Linux内核主线,很有可能被内核主线采用。目前Suse已经把此技术集成到[Suse Linux Enterprise Server 12](http://www.infoworld.com/article/2838421/linux/suse-linux-enterprise-12-goes-light-on-docker-heavy-on-reliability.html)。
Kgraft和Ksplice在工作原理上很相似,都是使用一组diff文件来计算内核中需要修改的部分。但与Ksplice不同的是,Kgraft在做替换时,不需要完全停止内核。 在打补丁时,正在运行的函数可以先使用老版本或新内核中对应的部分,当补丁打完后就可以完全切换新的版本。
### Kpatch项目
Red Hat也提出了他们的内核热补丁技术。同样是在2014年初 -- 与Suse在这方面的工作差不多 -- [Kpatch](https://github.com/dynup/kpatch)的工作原理也和Kgraft相似。
主要的区别点在于,正如Red Hat的Josh Poimboeuf[总结](https://lwn.net/Articles/597123/)的那样,Kpatch并不将内核调用重定向到老版本。相反,它会等待所有函数调用都停止时,再切换到新内核。Red Hat的工程师认为这种方法更为安全,且更容易维护,缺点就是在打补丁的过程中会带来更大的延迟。
和Kgraft一样,Kpatch不仅仅可以在Red Hat的发行版本上使用,同时也被提交到了内核主线,作为一个可能的候选。 坏消息是Red Hat还未将此技术集成到产品中。 它只是被合入到了Red Hat Enterprise Linux 7的技术预览版中。
### ...也许 Kgraft + Kpatch更合适?
Red Hat的工程师Seth Jennings在2014年11月初,提出了[第四种解决方案](http://lkml.iu.edu/hypermail/linux/kernel/1411.0/04020.html)。将Kgraft和Kpatch结合起来, 补丁包用这两种方式都可以。在新的方法中,Jennings提出,“热补丁核心为其他内核模块提供了一个热补丁的注册接口”, 通过这种方法,打补丁的过程 -- 更准确的说,如何处理运行时内核调用 --可以被更加有序的组织起来。
这项新建议也意味着两个方案都还需要更长的时间,才能被linux内核正式采纳。尽管Suse步子迈得更快,并把Kgraft应用到了最新的enterprise版本中。让我们也关注一下Red Hat和Canonical近期是否会跟进。
---
via: <http://www.infoworld.com/article/2851028/linux/four-ways-linux-is-headed-for-no-downtime-kernel-patching.html>
作者:[Serdar Yegulalp](http://www.infoworld.com/author/Serdar-Yegulalp/) 译者:[coloka](https://github.com/coloka) 校对:[tinyeyeser](https://github.com/tinyeyeser)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,657 | Linux上几款好用的字幕编辑器 | http://xmodulo.com/good-subtitle-editor-linux.html | 2015-01-13T20:29:00 | [
"字幕编辑器"
] | https://linux.cn/article-4657-1.html | 如果你经常看国外的大片,你应该会喜欢带字幕版本而不是有国语配音的版本。我在法国长大,童年的记忆里充满了迪斯尼电影。但是这些电影因为有了法语的配音而听起来很怪。如果现在有机会能看原始的版本,我想,对于大多数的人来说,字幕还是必须的。我很高兴能为家人制作字幕。给我带来希望的是,Linux 也不乏有很多花哨、开源的字幕编辑器。总之一句话,文中Linux上字幕编辑器的列表并不详尽,你可以告诉我哪一款是你认为最好的字幕编辑器。
### 1. Gnome Subtitles

当有现有字幕需要快速编辑时,[Gnome Subtitles](http://gnomesubtitles.org/) 是我的一个选择。你可以载入视频,载入字幕文本,然后就可以即刻开始了。我很欣赏其对于易用性和高级特性之间的平衡。它带有一个同步工具以及一个拼写检查工具。最后但同样重要的的一点,这么好用最主要的是因为它的快捷键:当你编辑很多的台词的时候,你最好把你的手放在键盘上,使用其内置的快捷键来移动。
### 2. Aegisub

[Aegisub](http://www.aegisub.org/) 已经是一款高级别的复杂字幕编辑器。仅仅是界面就反映出了一定的学习曲线。但是,除了它吓人的样子以外,Aegisub 是一个非常完整的软件,提供的工具远远超出你能想象的。和Gnome Subtitles 一样,Aegisub也采用了所见即所得(WYSIWYG:what you see is what you get)的处理方式。但是是一个全新的高度:可以再屏幕上任意拖动字幕,也可以在另一边查看音频的频谱,并且可以利用快捷键做任何的事情。除此以外,它还带有一个汉字工具,有一个kalaok模式,并且你可以导入lua 脚本让它自动完成一些任务。我希望你在用之前,先去阅读下它的[指南](http://docs.aegisub.org/3.2/Main_Page/)。
### 3. Gaupol

另一个操作复杂的软件是[Gaupol](http://home.gna.org/gaupol/),不像Aegisub ,Gaupol 很容易上手而且采用了一个和Gnome Subtitles 很像的界面。但是在这些相对简单背后,它拥有很多很必要的工具:快捷键、第三方扩展、拼写检查,甚至是语音识别(由[CMU Sphinx](http://cmusphinx.sourceforge.net/)提供)。这里也提一个缺点,我注意到有时候在测试的时候也,软件会有消极怠工的表现,不是很严重,但是也足以让我更有理由喜欢Gnome Subtitles了。
### 4. Subtitle Editor

[Subtitle Editor](http://home.gna.org/subtitleeditor/)和 Gaupol 很像,但是它的界面有点不太直观,特性也只是稍微的高级一点点。我很欣赏的一点是,它可以定义“关键帧”,而且提供所有的同步选项。然而,多一点的图标,或者是少一点的文字都能提供界面的特性。作为一个值得称赞的字幕编辑器,Subtitle Editor 可以模仿“作家”打字的效果,虽然我不确定它是否特别有用。最后但同样重要的一点,重定义快捷键的功能很实用。
### 5. Jubler

[Jubler](http://www.jubler.org/)是一个用Java编写并有多平台支持的字幕编辑器。我对它的界面印象特别深刻。在上面我确实看出了Java特点的东西,但是,它仍然是经过精心的构造和构思的。像Aegisub 一样,你可以再屏幕上任意的拖动字幕,让你有愉快的体验而不单单是打字。它也可以为字幕自定义一个风格,在另外的一个轨道播放音频,翻译字幕,或者是是做拼写检查。不过,要注意的是,你需要事先安装好媒体播放器并且正确的配置,如果你想完整的使用Jubler。我把这些归功于在[官方页面](http://www.jubler.org/download.html)下载了脚本以后其简便的安装方式。
### 6. Subtitle Composer

[Subtitle Composer](http://sourceforge.net/projects/subcomposer/)被视为“KDE里的字幕作曲家”,它能够唤起对很多传统功能的回忆。伴随着KDE界面,我们充满了期待。我们自然会说到快捷键,我特别喜欢这个功能。除此之外,Subtitle Composer 与上面提到的编辑器最大的不同地方就在于,它可以执行用JavaScript,Python,甚至是Ruby写成的脚本。软件带有几个例子,肯定能够帮助你很好的学习使用这些特性的语法。
最后,不管你是否喜欢,都来为你的家庭编辑几个字幕吧,重新同步整个轨道,或者是一切从头开始,那么Linux 有很好的工具给你。对我来说,快捷键和易用性使得各个工具有差异,想要更高级别的使用体验,脚本和语音识别就成了很便利的一个功能。
你会使用哪个字幕编辑器,为什么?你认为还有没有更好用的字幕编辑器这里没有提到的?在评论里告诉我们吧。
---
via: <http://xmodulo.com/good-subtitle-editor-linux.html>
作者:[Adrien Brochard](http://xmodulo.com/author/adrien) 译者:[barney-ro](https://github.com/barney-ro) 校对:[Caroline](https://github.com/carolinewuyan)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,658 | Linux用户,你们真的了解开源硬件吗? | http://www.datamation.com/open-source/what-linux-users-should-know-about-open-hardware-1.html | 2015-01-14T07:57:00 | [
"开源硬件"
] | https://linux.cn/article-4658-1.html |
>
> Linux用户不了解一点开源硬件制造相关的事情,他们就会经常陷入失望的情绪中。
>
>
>
商业软件和自由软件已经互相纠缠很多年了,但是这俩经常误解对方。这并不奇怪 -- 对一方来说是生意,而另一方只是一种生活方式。但是,这种误解会给人带来痛苦,这也是为什么值得花精力去揭露这里面的内幕。
一个逐渐普遍的现象:对开源硬件的不断尝试,不管是Canonical,Jolla,MakePlayLive,或者其他公司。无论是评论员或是终端用户,通常自由软件用户都会为新的硬件平台发布表现出过分的狂热,然后因为不断延期有所醒悟,直到最终放弃整个产品。
这是一个没有人获益的怪圈,而且常常滋生出不信任 - 都是因为一般的Linux用户根本不知道这些新闻背后发生的事情。
我个人对于把产品推向市场的经验很有限。但是,我还没听说谁能有所突破。推出一个开源硬件或其他产品到市场仍然不仅仅是个残酷的生意,而且严重不利于新进厂商。

### 寻找合作伙伴
不管是数码产品的生产还是分销都被相对较少的一些公司控制着,有时需要数月的预订。利润率也会很低,所以就像那些购买古老情景喜剧的电影工作室一样,生产商一般也希望复制当前热销产品的成功。像Aaron Seigo在谈到他花精力开发Vivaldi平板时告诉我的,生产商更希望能由其他人去承担开发新产品的风险。
不仅如此,他们更希望和那些有现成销售记录的有可能带来长期客户生意的人合作。
而且,一般新加入的厂商所关心的产品只有几千的量。芯片制造商更愿意和苹果或三星这样的公司合作,因为它们的订单很可能是几十上百万的量。
面对这种情形,开源硬件制造者们可能会发现他们在工厂的列表中被淹没了,除非能找到二线或三线厂愿意尝试一下小批量生产新产品。
他们也许还会沦为采购成品组件再自己组装,就像Seigo尝试Vivaldi时那样做的。或者,他们也许可以像Canonical那样做,寻找一些愿意为这个产业冒险的合作伙伴。而就算他们成功了,一般也会比最初天真的预期延迟数个月。
### 磕磕碰碰走向市场
然而,寻找生产商只是第一关。根据树莓派项目的经验,就算开源硬件制造者们只想在他们的产品上运行自由软件,生产商们很可能会以保护商业机密的名义坚持使用专有固件或驱动。
这样必然会引起潜在用户的批评,但是开源硬件制造者没得选,只能折中他们的愿景。寻找其他生产商也不能解决问题,有一个原因是这样做意味着更多延迟,但是更多的是因为完全免授权费的硬件是不存在的。像三星这样的业内巨头对免费硬件没有任何兴趣,而作为新人,开源硬件制造者也没有影响力去要求什么。
更何况,就算有免费硬件,生产商也不能保证会用在下一批生产中。制造者们会轻易地发现他们每次需要生产的时候都要重打一次一模一样的仗。
这些都还不够,这个时候开源硬件制造者们也许已经花了6-12个月时间来讨价还价。等机会终于来了,产业标准却已经变更,于是他们可能为了升级产品规格又要从头来过。
### 短暂而且残忍的货架期
尽管面对这么多困难,一定程度上开放的硬件也终于推出了。还记得寻找生产商时的挑战吗?对于分销商也会有同样的问题 -- 还不只是一次,而是每个地区都要解决。
通常,分销商和生成商一样保守,对于和新人或新点子打交道也很谨慎。就算他们同意一个产品上架,他们也轻易能够决定不鼓励自己的销售代表们做推广,这意味着这个产品会在几个月后很有效率地下架。
当然,在线销售也是可以的。但是同时,硬件还是需要被存放在某个地方,这也会增加成本。而按需生产就算可能的话也将非常昂贵,而且没有组装的元件也需要存放。
### 衡量整件怪事
在这里我只是粗略地概括了一下,但是任何涉足过制造的人会认同我形容为行业标准的东西。而更糟糕的是,开源硬件制造者们通常只有在亲身经历过后才会有所觉悟。不可避免,他们也会犯错,从而带来更多的延迟。
但重点是,一旦你对整个过程有所了解,你对另一个开源硬件进行尝试的新闻的反应就会改变。这个过程意味着,除非哪家公司处于严格的保密模式,对于产品将于六个月内发布的声明会很快会被证实是过期的推测。很可能是12-18个月,而且面对之前提过的那些困难很可能意味着这个产品永远都不会真正发布。
举个例子,就像我写的,人们等待第一代Steam Machines面世,它是一台基于Linux的游戏主机。他们相信Steam Machines能彻底改变Linux和游戏。
作为一个市场分类,Steam Machines也许比其他新产品更有优势,因为参与开发的人员至少有开发软件产品的经验。然而,整整一年过去了Steam Machines的开发成果都还只有原型机,而且直到2015年中都不一定能买到。面对硬件生产的实际情况,就算有一半能见到阳光都是很幸运了。而实际上,能发布2-4台也许更实际。
我做出这个预测并没有考虑个体努力。但是,对硬件生产的理解,比起那些Linux和游戏的黄金年代之类的预言,我估计这个更靠谱。如果我错了也会很开心,但是事实不会改变:让人吃惊的不是如此多的Linux相关硬件产品失败了,而是那些虽然短暂但却成功的产品。
注:本文翻译和校对时,误将“free software”翻译成了“免费软件”,得 [@比尔盖子V](http://weibo.com/biergaizi) 的指正,应该翻译为“自由软件”。有关“免费软件”和“自由软件”的辨析,可以参考如下:
>
> 自由软件的英文为“free software”。“free”在英文中有“自由”(freedom)、“免费”(free of charge)的双重含义,因此![]()自由软件要如何分辨“自由软件”(free software)和“免费软件”(freeware)呢?
>
>
> 自由软件运动的创始人——理查德·斯托曼提供了以下的定义:
>
>
> “free software” is a matter of liberty, not price. To understand the concept, you should think of “free” as in “free speech,” not as in “free beer”,中文译文:自由软件的重点在于自由权,而非价格。要了解其所代表的概念:你应该将“free”想成是“free spech”(言论自由)中的“free”(自由),而不是“free beer”(免费啤酒)中的“free”(免费)。
>
>
> 更精确的说,自由软件代表电脑使用者拥有选择和任何人合作之自由、拥有掌控他们所用的软件之自由。在GNU宣言(GNU Manifesto)中包含了斯托曼在一开始对自由软件使用定义的混淆。——来自百度百科
>
>
>
---
via: <http://www.datamation.com/open-source/what-linux-users-should-know-about-open-hardware-1.html>
作者:[Bruce Byfield](http://www.datamation.com/author/Bruce-Byfield-6030.html) 译者:[zpl1025](https://github.com/zpl1025) 校对:[Mr小眼儿](https://github.com/tinyeyeser)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,659 | 2014年Linux界发生的好事,坏事和丑事 | http://itsfoss.com/biggest-linux-stories-2014/ | 2015-01-14T08:15:00 | [
"2014",
"Linux"
] | https://linux.cn/article-4659-1.html | 
2014年已经过去,现在正是盘点**2014年Linux大事件**的时候。整整一年,我们关注了有关Linux和开源的一些好事,坏事和丑事。让我们来快速回顾一下2014对于Linux是怎样的一年。
好事
--
首先,让我们来看看在2014年对于Linux爱好者发生了什么有积极意义的事。
### Linux上的Netflix

从使用Wine到[使用Chrome的测试功能](http://linux.cn/article-3024-1.html),为了能让Netflix能在Linux上工作,Linux用户曾尝试了各种方法。好消息是Netflix终于在2014年带来了Linux的本地支持。这让所有能使用Netflix的地区的Linux用户的脸上浮现出了微笑。不过,想在[美国以外的地区使用Netflix](http://itsfoss.com/easiest-watch-netflix-hulu-usa/)(或其他官方授权使用Netflix的国家之外)的人还是得靠其他的方法。
### 欧洲国家采用开源/Linux

如果你愿意的话,你可以归功于经济滑坡,但是Linux和开源的采用已经俘虏了欧洲各大城市。我说的可不是个人用户,而是政府和各个官方机构。一整年我们都在听到这样的消息:[法国](http://linux.cn/article-3575-1.html)和[意大利各大城市如何通过改用Linux和开源办公软件节省了数百万欧元](http://linux.cn/article-3602-1.html)。而且这个趋势并没有仅限于意大利和法国,在西班牙、[瑞士](http://itsfoss.com/170-primary-public-schools-geneva-switch-ubuntu/)和[德国](http://itsfoss.com/german-town-gummersbach-completes-switch-open-source/)也能见到。
### Windows 10从Linux获得灵感

即将发行的微软的旗舰操作系统Windows,将被称为Windows 10(没有Windows 9)。并且Windows 10将拥有一大堆的新特性。但是这些“新特性”只在微软的世界里是新的,而且大多是这些新特性已经在Linux的世界里存在了数年。看看这些[Windows 10从Linux复制的特性](http://itsfoss.com/windows-10-inspired-linux/)。
坏事
--
Linux在2014年并不是一帆风顺。某些事件的发生败坏了Linux/开源的形象。
### Heartbleed 心血漏洞

在今年的四月份,检测到[OpenSSL](http://en.wikipedia.org/wiki/OpenSSL)有一个缺陷。这个漏洞被命名为[Heartbleed心血漏洞](http://heartbleed.com/)。他影响了包括Facebook和Google在内的50多万个“安全”网站。这项漏洞可以真正的允许任何人读取系统的内存,并能因此给予用于加密数据流的密匙的访问权限。[xkcd上的漫画以更简单的方式解释了心血漏洞](http://xkcd.com/1354/)。自然,这个漏洞在OpenSSL的更新中被修复了。
### Shellshock 破壳漏洞

好像有个心血漏洞还不够似的,在Bash里的一个缺陷更严重的震撼了Linux世界。这个漏洞被命名为[Shellshock 破壳漏洞](http://itsfoss.com/linux-shellshock-check-fix/)。这个漏洞把Linux往远程攻击的危险深渊又推了一把。这项漏洞是通过黑客的DDoS攻击暴露出来的。升级一下Bash版本应该能修复这个问题。
### Ubuntu Phone和Steam控制台

一个又一个的承诺,一次又一次的期望。但是即使在2014年也没人看见Ubuntu Phone或是Steam游戏控制台。围绕Ubuntu Phone产生了很多激烈的讨论。从2014年二月发行推到九月又推到十二月,(谢天谢地)终于有可能在2015年二月发行。但是Steam控制台还是没有消息。想了解更多请读[Ubuntu Phone说明书,价格和发行日期](http://itsfoss.com/ubuntu-phone-specification-release-date-pricing/)。
丑事
--
是否采用 systemd 的争论变得让人羞耻。
### systemd大论战

用init还是systemd的争吵已经进行了一段时间了。但是在2014年当systemd准备在包括Debian, Ubuntu, OpenSUSE, Arch Linux 和 Fedora几个主流Linux分布中替代init时,事情变得不知廉耻了起来。它是如此的一发不可收拾,以至于它已经不限于boycottsystemd.org这类网站了。Lennart Poettering(systemd的首席开发人员及作者)在一条Google Plus状态上声明,说那些反对systemd的人在“收集比特币来雇杀手杀他”。Lennart还声称开源社区“是个恶心得不能待的地方”。人们吵得越来越离谱以至于把Debian分裂成了一个新的操作系统,称为[Devuan](http://linux.cn/article-4512-1.html)。
还有诡异的事
------
伴随着好事、坏事和丑事而来得是诡异的事,而且没谁能比微软更诡异。
### 微软爱Linux

是的,你没看错。[微软爱Linux](http://linux.cn/article-4056-1.html)。同为微软CEO,Steve Ballmer曾说[Linux是毒瘤](http://www.theregister.co.uk/2001/06/02/ballmer_linux_is_a_cancer/)。当新CEO,Satya Nadella宣称微软爱Linux时,我们透过微软向Linux和开源的靠近,看到了领导层的改变。这份对Linux的爱实际上是微软试图让[Azure](http://azure.microsoft.com/en-us/)成为更好的云平台。为了达成这项目标,需要虚拟化Hyper-V(Azure核心),以便同Linux一起运行。这个绝境让[微软成为Linux内核的第五大贡献者](http://www.zdnet.com/article/top-five-linux-contributor-microsoft/)。
---
via: <http://itsfoss.com/biggest-linux-stories-2014/>
作者:[Abhishek](http://itsfoss.com/author/Abhishek/) 译者:[H-mudcup](https://github.com/H-mudcup) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,660 | Linux有问必答:如何禁止Ubuntu的Apport内部错误报告程序 | http://ask.xmodulo.com/disable-apport-internal-error-reporting-ubuntu.html | 2015-01-14T10:22:00 | [
"Ubuntu",
"错误",
"Apport"
] | /article-4660-1.html |
>
> **问题**:在桌面版Ubuntu中,我经常遇到一些弹窗窗口,警告我Ubuntu发生了内部错误,问我要不要发送错误报告。每次软件崩溃都要烦扰我,我如何才能关掉这个错误报告功能呢?
>
>
>

Ubuntu桌面版预装了Apport,它是一个错误收集系统,会收集软件崩溃、未处理异常和其他,包括程序bug,并为调试目的生成崩溃报告。当一个应用程序崩溃或者出现Bug时候,Apport就会通过弹窗警告用户并且询问用户是否提交崩溃报告。你也许也看到过下面的消息。
* "Sorry, the application XXXX has closed unexpectedly."
* "对不起,应用程序XXXX意外关闭了。"
* "Sorry, Ubuntu XX.XX has experienced an internal error."
* "对不起,Ubuntu XX.XX 发生了一个内部错误。"
* "System program problem detected."
* "检测到系统程序问题。"

也许因为应用一直崩溃,频繁的错误报告会使人心烦。也许你担心Apport会收集和上传你的Ubuntu系统的敏感信息。无论什么原因,你想关掉Apport的错误报告功能。
### 临时关闭Apport错误报告
如果你想要临时关闭Apport,使用下列命令
```
$ sudo service apport stop
```
注意重启Ubuntu系统Apport会继续开启
### 永久关闭Apport错误报告
为了永久关闭Apport,编辑/etc/default/apport,修改下列参数
```
enabled=0
```
重启你的Ubuntu系统,Apport将会自动关闭
如果你再也不会用Apport,有一种简单的方法完全移除它
```
$ sudo apt-get purge apport
```
---
via: <http://ask.xmodulo.com/disable-apport-internal-error-reporting-ubuntu.html>
译者:[VicYu/Vic020](http://www.vicyu.net/) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /disable-apport-internal-error-reporting-ubuntu.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275c52a0>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)")) | null |
4,664 | 网络时间的那些事及 ntpq 详解 | http://nlug.ml1.co.uk/2012/01/ntpq-p-output/831 | 2015-01-14T14:10:28 | [
"ntp",
"ntpq",
"网络时间协议",
"闰秒"
] | https://linux.cn/article-4664-1.html | [Gentoo](http://www.gentoo.org/)(也许其他发行版也是?)中 ["ntpq -p" 的 man page](http://nlug.ml1.co.uk/2012/01/man-ntpq-gentoo-brief-version/853) 只有简短的描述:“*打印出该服务器已知的节点列表和它们的状态概要信息。*”
我还没见到关于这个命令的说明文档,因此这里对此作一个总结,可以补充进 "[man ntpq](http://www.thelinuxblog.com/linux-man-pages/1/ntpq)" man page 中。更多的细节见这里 “[ntpq – 标准 NTP 请求程序](http://www.eecis.udel.edu/%7Emills/ntp/html/ntpq.html)”(原作者),和 [其他关于 man ntpq 的例子](http://linux.die.net/man/8/ntpq).
[NTP](http://www.ntp.org/) 是一个设计用于通过 [udp](http://en.wikipedia.org/wiki/User_Datagram_Protocol) 网络 ([WAN](http://en.wikipedia.org/wiki/Wide_area_network) 或者 [LAN](http://en.wikipedia.org/wiki/Local_area_network)) 来同步计算机时钟的协议。引用 [Wikipedia – NTP](http://en.wikipedia.org/wiki/Network_Time_Protocol):
>
> 网络时间协议(英语:Network Time Protocol,NTP)一种协议和软件实现,用于通过使用有网络延迟的报文交换网络同步计算机系统间的时钟。最初由美国特拉华大学的 David L. Mills 设计,现在仍然由他和志愿者小组维护,它于 1985 年之前开始使用,是因特网中最老的协议之一。
>
>
>
想了解更多有关时间和 NTP 协议的知识,可以参考 “[The NTP FAQ, Time, what Time?](http://www.ntp.org/ntpfaq/NTP-s-time.htm)”和 [RFCs for NTP](http://www.ntp.org/rfc.html)。早期的“Network Time Protocol (Version 3) RFC” ([txt](http://www.ietf.org/rfc/rfc1305.txt), or [pdf](http://www.rfc-editor.org/rfc/rfc1305.pdf), Appendix E, The NTP Timescale and its Chronometry, p70) 包含了对过去 5000 年我们的计时系统的变化和关系的有趣解释。维基百科的文章 [Time](http://en.wikipedia.org/wiki/Time) 和 [Calendar](http://en.wikipedia.org/wiki/Calendar) 提供了更宏观的视角。

命令 "ntpq -q" 输出下面这样的一个表:
```
remote refid st t when poll reach delay offset jitter
==============================================================================
LOCAL(0) .LOCL. 10 l 96h 64 0 0.000 0.000 0.000
*ns2.example.com 10.193.2.20 2 u 936 1024 377 31.234 3.353 3.096
```
### 更多细节
#### 表头
* **remote** – 用于同步的远程节点或服务器。“LOCAL”表示本机 (当没有远程服务器可用时会出现)
* **refid** – 远程的服务器进行同步的更高一级服务器
* **st** – 远程节点或服务器的 [Stratum](http://en.wikipedia.org/wiki/Network_Time_Protocol#Clock_strata)(级别,NTP 时间同步是分层的)
* **t** – 类型 (u: [unicast(单播)](http://en.wikipedia.org/wiki/Unicast) 或 [manycast(选播)](http://www.eecis.udel.edu/%7Emills/ntp/html/manyopt.html#mcst) 客户端, b: [broadcast(广播)](http://en.wikipedia.org/wiki/Broadcasting_%28computing%29) 或 [multicast(多播)](http://en.wikipedia.org/wiki/Multicast) 客户端, l: 本地时钟, s: 对称节点(用于备份), A: 选播服务器, B: 广播服务器, M: 多播服务器, 参见“[Automatic Server Discovery](http://www.eecis.udel.edu/%7Emills/ntp/html/manyopt.html)“)
* **when** – 最后一次同步到现在的时间 (默认单位为秒, “h”表示小时,“d”表示天)
* **poll** – 同步的频率:[rfc5905](http://www.ietf.org/rfc/rfc5905.txt)建议在 NTPv4 中这个值的范围在 4 (16秒) 至 17 (36小时) 之间(即2的指数次秒),然而观察发现这个值的实际大小在一个小的多的范围内 :64 (2<sup> 6</sup> )秒 至 1024 (2<sup> 10</sup> )秒
* **reach** – 一个8位的左移移位寄存器值,用来测试能否和服务器连接,每成功连接一次它的值就会增加,以 [8 进制](http://en.wikipedia.org/wiki/Octal#In_computers)显示
* **delay** – 从本地到远程节点或服务器通信的往返时间(毫秒)
* **offset** – 主机与远程节点或服务器时间源的时间偏移量,offset 越接近于0,主机和 NTP 服务器的时间越接近(以[方均根](http://en.wikipedia.org/wiki/Root_mean_square)表示,单位为毫秒)
* **jitter** – 与远程节点同步的时间源的平均偏差(多个时间样本中的 offset 的偏差,单位是毫秒),这个数值的绝对值越小,主机的时间就越精确
#### 字段的统计代码
表中第一个字符(统计代码)是状态标识(参见 [Peer Status Word](http://www.eecis.udel.edu/%7Emills/ntp/html/decode.html#peer)),包含 " ","x","-","#","+","\*","o":
* " " – 无状态,表示:
+ 没有远程通信的主机
+ "LOCAL" 即本机
+ (未被使用的)高层级服务器
+ 远程主机使用的这台机器作为同步服务器
* “**x**” – 已不再使用
* “**-**” – 已不再使用
* “**#**” – 良好的远程节点或服务器但是未被使用 (不在按同步距离排序的前六个节点中,作为备用节点使用)
* “**+**” – 良好的且优先使用的远程节点或服务器(包含在组合算法中)
* “\*” – 当前作为优先主同步对象的远程节点或服务器
* “**o**” – PPS 节点 (当优先节点是有效时)。实际的系统同步是源于秒脉冲信号(pulse-per-second,PPS),可能通过PPS 时钟驱动或者通过内核接口。
参考 [Clock Select Algorithm](http://www.eecis.udel.edu/%7Emills/ntp/html/select.html).
#### refid
**refid** 有下面这些状态值
* 一个IP地址 – 远程节点或服务器的 [IP 地址](http://en.wikipedia.org/wiki/Ip_address)
* **.LOCL.** – 本机 (当没有远程节点或服务器可用时)
* **.PPS.** – 时间标准中的“[Pulse Per Second](http://en.wikipedia.org/wiki/Pulse_per_second)”(秒脉冲)
* **.IRIG.** – [Inter-Range Instrumentation Group](http://en.wikipedia.org/wiki/Inter-Range_Instrumentation_Group) 时间码
* **.ACTS.** – 美国 [NIST 标准时间](http://en.wikipedia.org/wiki/Standard_time_and_frequency_signal_service) 电话调制器
* **.NIST.** –美国 NIST 标准时间电话调制器
* **.PTB.** – 德国 [PTB](http://www.ptb.de/index_en.html) 时间标准电话调制器
* **.USNO.** – 美国 [USNO 标准时间](http://en.wikipedia.org/wiki/United_States_Naval_Observatory#Time_service) 电话调制器
* **.CHU.** – [CHU](http://en.wikipedia.org/wiki/CHU_%28radio_station%29) ([HF](http://en.wikipedia.org/wiki/High_frequency), Ottawa, ON, Canada) 标准时间无线电接收器
* **.DCFa.** – [DCF77](http://en.wikipedia.org/wiki/DCF77) ([LF](http://en.wikipedia.org/wiki/Low_frequency), Mainflingen, Germany) 标准时间无线电接收器
* **.HBG.** – [HBG](http://en.wikipedia.org/wiki/HBG_%28time_signal%29) (LF Prangins, Switzerland) 标准时间无线电接收器
* **.JJY.** – [JJY](http://en.wikipedia.org/wiki/JJY#Time_standards) (LF Fukushima, Japan) 标准时间无线电接收器
* **.LORC.** – [LORAN](http://en.wikipedia.org/wiki/LORAN#Timing_and_synchronization)-C station ([MF](http://en.wikipedia.org/wiki/Medium_frequency)) 标准时间无线电接收器,注: [不再可用](http://en.wikipedia.org/wiki/LORAN#The_future_of_LORAN) (被 [eLORAN](http://en.wikipedia.org/wiki/LORAN#eLORAN) 废弃)
* **.MSF.** – [MSF](http://en.wikipedia.org/wiki/Time_from_NPL#The_.27MSF_signal.27_and_the_.27Rugby_clock.27) (LF, Anthorn, Great Britain) 标准时间无线电接收器
* **.TDF.** – [TDF](http://en.wikipedia.org/wiki/T%C3%A9l%C3%A9_Distribution_Fran%C3%A7aise) (MF, Allouis, France)标准时间无线电接收器
* **.WWV.** – [WWV](http://en.wikipedia.org/wiki/WWV_%28radio_station%29#Time_signals) (HF, Ft. Collins, CO, America) 标准时间无线电接收器
* **.WWVB.** – [WWVB](http://en.wikipedia.org/wiki/WWVB) (LF, Ft. Collins, CO, America) 标准时间无线电接收器
* **.WWVH.** – [WWVH](http://en.wikipedia.org/wiki/WWVH) (HF, Kauai, HI, America) 标准时间无线电接收器
* **.GOES.** – 美国[静止环境观测卫星](http://en.wikipedia.org/wiki/GOES#Further_reading);
* **.GPS.** – 美国 [GPS](http://en.wikipedia.org/wiki/Gps#Timekeeping);
* **.GAL.** – [伽利略定位系统](http://en.wikipedia.org/wiki/Galileo_%28satellite_navigation%29#The_concept)欧洲 [GNSS](http://en.wikipedia.org/wiki/Gnss);
* **.ACST.** – 选播服务器
* **.AUTH.** – 认证错误
* **.AUTO.** – Autokey (NTP 的一种认证机制)顺序错误
* **.BCST.** – 广播服务器
* **.CRYPT.** – Autokey 协议错误
* **.DENY.** – 服务器拒绝访问;
* **.INIT.** – 关联初始化
* **.MCST.** – 多播服务器
* **.RATE.** – (轮询) 速率超出限定
* **.TIME.** – 关联超时
* **.STEP.** – 间隔时长改变,偏移量比危险阈值小(1000ms) 比间隔时间 (125ms)大
#### 操作要点
一个时间服务器只会报告时间信息而不会从客户端更新时间(单向更新),而一个节点可以更新其他同级节点的时间,结合出一个彼此同意的时间(双向更新)。
[初次启动](http://www.eecis.udel.edu/%7Emills/ntp/html/debug.html)时:
>
> 除非使用 iburst 选项,客户端通常需要花几分钟来和服务器同步。如果客户端在启动时时间与 NTP 服务器的时间差大于 1000 秒,守护进程会退出并在系统日志中记录,让操作者手动设置时间差小于 1000 秒后再重新启动。如果时间差小于 1000 秒,但是大于 128 秒,会自动矫正间隔,并自动重启守护进程。
>
>
> 当第一次启动时,时间频率文件(通常是 ntp.drift 文件,记录时间偏移)不存在,守护进程进入一个特殊模式来矫正频率。当时钟不符合[规范](http://www.ntp.org/ntpfaq/NTP-s-algo-kernel.htm)时这会需要 900 秒。当校正完成后,守护进程创建时间频率文件进入普通模式,并分步校正剩余的偏差。
>
>
>
NTP 0 层(Stratum 0 )的设备如原子钟(铯,铷),GPS 时钟或者其他标准时间的无线电时钟为 1 层(Stratum 1)的时间服务器提供时间信号。NTP 只报告[UTC](http://en.wikipedia.org/wiki/Coordinated_Universal_Time) 时间(统一协调时,Coordinated Universal Time)。客户端程序使用[时区](http://en.wikipedia.org/wiki/Time_zone)从 UTC 导出本地时间。
NTP 协议是高精度的,使用的精度小于纳秒(2的 -32 次方)。主机的时间精度和其他参数(受硬件和操作系统限制)使用命令 “ntpq -c rl” 查看(参见 [rfc1305](http://www.ietf.org/rfc/rfc1305.txt) 通用变量和 [rfc5905](http://www.ietf.org/rfc/rfc5905.txt))。
#### “ntpq -c rl”输出参数
* **precision** 为四舍五入值,且为 2 的幂数。因此精度为 2<sup> precision</sup> (秒)
* **rootdelay** – 与同步网络中主同步服务器的总往返延时。注意这个值可以是正数或者负数,取决于时钟的精度。
* **rootdisp** – 相对于同步网络中主同步服务器的偏差(秒)
* **tc** – NTP 算法 [PLL](http://en.wikipedia.org/wiki/PLL) (phase locked loop,锁相环路) 或 [FLL](http://en.wikipedia.org/wiki/Frequency-locked_loop) (frequency locked loop,锁频回路) 时间常量
* **mintc** – NTP 算法 PLL/FLL 最小时间常亮或“最快响应
* **offset** – 由结合算法得出的系统时钟偏移量(毫秒)
* **frequency** – 系统时钟频率
* **sys\_jitter** – 由结合算法得出的系统时钟平均偏差(毫秒)
* **clk\_jitter** – 硬件时钟平均偏差(毫秒)
* **clk\_wander** – 硬件时钟偏移([PPM](http://en.wikipedia.org/wiki/Parts_per_million) – 百分之一)
Jitter (也叫 timing jitter) 表示短期变化大于10HZ 的频率, wander 表示长期变化大于10HZ 的频率 (Stability 表示系统的频率随时间的变化,和 aging, drift, trends 等是同义词)
#### 操作要点(续)
NTP 软件维护一系列连续更新的频率变化的校正值。对于设置正确的稳定系统,在非拥塞的网络中,现代硬件的 NTP 时钟同步通常与 UTC 标准时间相差在毫秒内。(在千兆 LAN 网络中可以达到何种精度?)
对于 UTC 时间,[闰秒 leap second](http://en.wikipedia.org/wiki/Leap_second) 可以每两年插入一次用于同步地球自传的变化。注意本地时间为[夏令时](http://en.wikipedia.org/wiki/Daylight_saving_time)时时间会有一小时的变化。在重同步之前客户端设备会使用独立的 UTC 时间,除非客户端使用了偏移校准。
#### [闰秒发生时会怎样](http://www.ntp.org/ntpfaq/NTP-s-time.htm#Q-TIME-LEAP-SECOND)
>
> 闰秒发生时,会对当天时间增加或减少一秒。闰秒的调整在 UTC 时间当天的最后一秒。如果增加一秒,UTC 时间会出现 23:59:60。即 23:59:59 到 0:00:00 之间实际上需要 2 秒钟。如果减少一秒,时间会从 23:59:58 跳至 0:00:00 。另见 [The Kernel Discipline](http://www.ntp.org/ntpfaq/NTP-s-algo-kernel.htm).
>
>
>
那么… 间隔阈值(step threshold)的真实值是多少: 125ms 还是 128ms? PLL/FLL tc 的单位是什么 (log2 s? ms?)?在非拥塞的千兆 LAN 中时间节点间的精度能达到多少?
感谢 Camilo M 和 Chris B的评论。 欢迎校正错误和更多细节的探讨。
谢谢 Martin
### 附录
* [NTP 的纪元](http://www.ntp.org/ntpfaq/NTP-s-algo.htm#AEN1895) 从 1900 开始而 UNIX 的从 1970开始.
* [时间校正](http://www.ntp.org/ntpfaq/NTP-s-algo.htm#Q-ACCURATE-CLOCK) 是逐渐进行的,因此时间的完全同步可能会画上几个小时。
* [节点状态](http://www.ntp.org/ntpfaq/NTP-s-trouble.htm#Q-TRB-MON-STATFIL) 可以被记录到 [summarise/plot time offsets and errors](http://www.ntp.org/ntpfaq/NTP-s-trouble.htm#AEN5086)
* [RMS](http://en.wikipedia.org/wiki/Root_mean_square) – 均方根
* [PLL](http://en.wikipedia.org/wiki/PLL) – 锁相环路
* [FLL](http://en.wikipedia.org/wiki/Frequency-locked_loop) – 锁频回路
* [PPM](http://en.wikipedia.org/wiki/Parts_per_million) – 百万分之一,用于描述频率的变化
* [man ntpq (Gentoo 简明版本)](http://nlug.ml1.co.uk/2012/01/man-ntpq-gentoo-brief-version/853)
* [man ntpq (长期维护版本)](http://nlug.ml1.co.uk/2012/01/man-ntpq-long-version/855)
* [man ntpq (Gentoo 长期维护版本)](http://nlug.ml1.co.uk/2012/01/man-ntpq-gentoo-long-version/856)
### 另见
* [ntpq – 标准 NTP 查询程序](http://www.eecis.udel.edu/%7Emills/ntp/html/ntpq.html)
* [The Network Time Protocol (NTP) 分布](http://www.eecis.udel.edu/%7Emills/ntp/html/index.html)
* NTP 的简明[历史](http://www.ntp.org/ntpfaq/NTP-s-def-hist.htm)
* 一个更多细节的简明历史 “Mills, D.L., A brief history of NTP time: confessions of an Internet timekeeper. Submitted for publication; please do not cite or redistribute” ([pdf](http://www.eecis.udel.edu/%7Emills/database/papers/history.pdf))
* [NTP RFC](http://www.ntp.org/rfc.html) 标准文档
* Network Time Protocol (Version 3) RFC – [txt](http://www.ietf.org/rfc/rfc1305.txt), or [pdf](http://www.rfc-editor.org/rfc/rfc1305.pdf). Appendix E, The NTP Timescale and its Chronometry, p70, 包含了对过去 5000 年我们的计时系统的变化和关系的有趣解释。
* 维基百科: [Time](http://en.wikipedia.org/wiki/Time) 和 [Calendar](http://en.wikipedia.org/wiki/Calendar)
* [John Harrison and the Longitude problem](http://www.rmg.co.uk/harrison)
* [Clock of the Long Now](http://longnow.org/clock/) – The 10,000 Year Clock
* John C Taylor – [Chronophage](http://johnctaylor.com/)
* [Orders of magnitude of time](http://en.wikipedia.org/wiki/Orders_of_magnitude_%28time%29)
* [Greenwich Time Signal](http://en.wikipedia.org/wiki/Greenwich_Time_Signal)
### 其他
SNTP (Simple Network Time Protocol, [RFC 4330](http://tools.ietf.org/html/rfc4330),简单网络协议)基本上也是NTP,但是少了一些基于 [RFC 1305](http://tools.ietf.org/html/rfc1305) 实现的 NTP 的一些不再需要的内部算法。
Win32 时间 [Windows Time Service](http://en.wikipedia.org/wiki/Network_Time_Protocol#Microsoft_Windows) 是 SNTP 的非标准实现,没有精度的保证,并假设精度几乎有 1-2 秒的范围。(因为没有系统时间变化校正)
还有一个[PTP (IEEE 1588)](http://www.nist.gov/el/isd/ieee/ieee1588.cfm) Precision Time Protocol(精准时间协议)。见维基百科:[Precision Time Protocol](http://en.wikipedia.org/wiki/IEEE_1588)。软件程序为 [PTPd](http://ptpd.sourceforge.net/)。虫咬的功能是这是一个 [LAN](http://en.wikipedia.org/wiki/Local_area_network) 高精度主从同步系统,精度在毫秒级,使用 [International Atomic Time](http://en.wikipedia.org/wiki/International_Atomic_Time) (TAI, [monotonic](http://en.wikipedia.org/wiki/Monotonic_function),无闰秒)。数据报时间戳需要在网卡中启用。支持 PTP 的网络会对数据报记录时间戳以减少交换机路由器的影响。也可以在不记录时间戳的网络中使用 PTP 但可能应为时间偏差太大而无法同步。因此使用这个需要对网络进行设置。
### 更老的时间同步协议
* DTSS – DEC公司的数字时间同步服务, 被 NTP 所取代。例子: [DTSS VMS C code c2000](http://antinode.info/ftp/dtss_ntp/)。 (哪里有关于 DTSS 的文章或文档吗?)
* [DAYTIME protocol](http://en.wikipedia.org/wiki/DAYTIME),使用 [TCP](http://en.wikipedia.org/wiki/Transmission_Control_Protocol) 或 [UDP](http://en.wikipedia.org/wiki/User_Datagram_Protocol) 13 端口同步
* [ICMP Timestamp](http://en.wikipedia.org/wiki/ICMP_Timestamp) 和 [ICMP Timestamp Reply](http://en.wikipedia.org/wiki/ICMP_Timestamp_Reply),使用 [ICMP](http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol) 协议同步
* [Time Protocol](http://en.wikipedia.org/wiki/Time_Protocol),使用 TCP 或 UDP 37 号端口同步
---
via: <http://nlug.ml1.co.uk/2012/01/ntpq-p-output/831>
作者:Martin L 译者:[Liao](https://github.com/liaosishere) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,667 | Windows和Ubuntu双系统,修复UEFI引导的两种办法 | http://linux.about.com/od/LinuxNewbieDesktopGuide/tp/3-Ways-To-Fix-The-UEFI-Bootloader-When-Dual-Booting-Windows-And-Ubuntu.htm | 2015-01-14T20:59:17 | [
"Windows",
"Ubuntu",
"UEFI"
] | https://linux.cn/article-4667-1.html | 读者在读过我的[安装Ubuntu和Windows 8双系统教程](http://linux.cn/article-3178-1.html)以后,碰到的主要的问题是电脑直接启动到Windows 8而没有出现启动Ubuntu的选项。
这里有两种修复EFI启动引导的方法,使Ubuntu可以正常启动

*将GRUB2设置为启动引导*
### 1. 启用GRUB引导
在安装时,有些地方可能会出问题。
理论上来说,如果你首先安装Ubuntu,那么你需要[关闭快速启动](http://linux.cn/article-3178-1.html#4_3289)。
希望你[按照这个指南创建一个UEFI Ubuntu 启动优盘](http://linux.cn/article-3178-1.html#4_1717)安装正确的UEFI引导程序。
如果你在安装时已经完成了这些事情,那么可能出错的地方就是将GRUB2设置为启动管理器。
可以按照以下几个步骤将GRUB2设置为默认的引导程序:
1. 登录Windows 8
2. 转到桌面
3. 右击开始按钮,选择管理员命令行
4. 输入 mountvol g: /s (这将你的EFI目录结构映射到G盘)
5. 输入 cd g:\EFI
6. 当你输入 dir 列出文件夹内容时,你可以看到一个Ubuntu的文件夹
7. 这里的参数可以是grubx64.efi或者shimx64.efi
8. 运行下列命令将grub64.efi设置为启动引导程序: bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi
9. 重启你的电脑
10. 你将会看到一个包含Ubuntu和Windows选项的GRUB菜单
11. 如果你的电脑仍然直接启动到Windows,重复步骤1到7,但是这次输入: bcdedit /set {bootmgr} path \EFI\ubuntu\shimx64.efi
12. 重启你的电脑
这里你做的事情就是登录Windows管理员命令行,将EFI引导区映射到磁盘上,来查看Ubuntu的引导程序是否安装成功,然后选择grubx64.efi或者shimx64.efi作为引导程序。
那么[grubx64.efi和shimx64.efi有什么区别呢](https://wiki.ubuntu.com/SecurityTeam/SecureBoot)?在安全启动(serureboot)关闭的情况下,你可以使用grubx64.efi。如果安全启动打开则需要选择shimx64.efi。
在我上面的步骤里面,我建议先试一个,然后再试试另外一个。另外一种方法是选择一个,然后根据你选择的引导程序在BIOS中启用或者禁用安全启动。
### 2.使用rEFInd引导Ubuntu和Windows双系统

[rEFInd引导程序](http://www.rodsbooks.com/refind/installing.html#windows)会以图标的方式列出你所有的操作系统。因此,你可以通过点击相应的图标来启动Windows、Ubuntu或者优盘中的操作系统。
[点击这里](http://sourceforge.net/projects/refind/files/0.8.4/refind-bin-0.8.4.zip/download)下载rEFInd for Windows 8。
下载和解压以后,按照以下的步骤安装rEFInd。
1. 返回桌面
2. 右击开始按钮,选择管理员命令行
3. 输入 mountvol g: /s (这将你的EFI目录结构映射到G盘)
4. 进入解压的rEFInd目录。例如: cd c:\users\gary\downloads\refind-bin-0.8.4\refind-bin-0.8.4 。 当你输入 dir 命令,你可以看到一个refind目录
5. 输入如下命令将refind拷贝到EFI引导区 xcopy /E refind g:\EFI\refind\
6. 输入如下命令进入refind文件夹 cd g:\EFI\refind
7. 重命名示例配置文件 rename refind.conf-sample refind.conf
8. 运行如下命令将rEFind设置为引导程序 bcdedit /set {bootmgr} path \EFI\refind\refind\_x64.efi
9. 重启你的电脑
10. 你将会看到一个包含Ubuntu和Windows的图形菜单
这个过程和选择GRUB引导程序十分相似。
简单的说,主要是下载rEFind,解压文件。拷贝文件到EFI引导区,重命名配置文件,然后将rEFind设置为引导程序。
### 概要
希望这篇文章可以解决有些人在安装Ubuntu和Windows 8.1双系统时出现的问题。如果你仍然有问题,可以通过上面的电邮和我进行交流。
---
via: <http://linux.about.com/od/LinuxNewbieDesktopGuide/tp/3-Ways-To-Fix-The-UEFI-Bootloader-When-Dual-Booting-Windows-And-Ubuntu.htm>
作者:[Gary Newell](http://linux.about.com/bio/Gary-Newell-132058.htm) 译者:[zhouj-sh](https://github.com/zhouj-sh) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,668 | 也许是有史以来最好的游戏:NetHack | http://www.linuxvoice.com/nethack/ | 2015-01-15T07:36:00 | [
"nethack",
"游戏"
] | https://linux.cn/article-4668-1.html | **这款游戏非常容易让你上瘾。你可能需要花费一生的时间来掌握它。许多人玩了几十年也没有通关。欢迎来到 NetHack 的世界...**
不管你信不信,在 NetHack 里你见到字母 **D** 的时候你会被吓着。但是当你看见一个 **%** 的时候,你将会欣喜若狂。(忘了说 **^**,你看见它将会更激动)在你寻思我们的脑子是不是烧坏了并准备关闭浏览器标签之前,请给我们一点时间解释:这些符号分别代表龙、食物以及陷阱。欢迎来到 NetHack 的世界,在这里你的想象力需要发挥巨大的作用。
如你所见,NetHack 是一款文字模式的游戏:它仅仅使用标准终端字符集来刻画玩家、敌人、物品还有环境。游戏的图形版是存在的,不过 NetHack 的骨灰级玩家们都倾向于不去使用它们,问题在于假如你使用图形界面,当你通过 SSH 登录到你的古董级的运行着 NetBSD 的 Amiga 3000 上时,你还能进行游戏吗?在某些方面,NetHack 和 Vi 非常相似 - 几乎被移植到了现存的所有的操作系统上,并且依赖都非常少。
那么问题来了,和现代游戏相比如此简陋的画面,是什么造就了 NetHack 如此巨大的吸引力的呢? 事实上,这款地牢探险类神作有着令人难以置信的丰富细节。有太多的东西等着你去发掘:法术释放、怪物战斗以及技巧学习 - 以及随机生成的地牢。有太多的东西等着你去探索,几乎没有哪两局游戏会是完全一样的。许多人玩了几十年也没有通关,每次游戏依然能发现一些以前不知道的秘密。
接下来,我们会向你讲述 NetHack 的历史,给你地牢探险的基本指导,再告诉你一些技巧。免责: 在你继续阅读本文之前,视为你已经自动同意了当你沉溺于 NetHack 以致影响到你的现实生活时,你不会起诉我们。

*NetHack 界面*
### 也许是最古老的仍在开发的游戏里
名非其实,NetHack 并不是一款网络游戏。它只不过是基于一款出现较早的名为 Hack 的地牢探险类游戏开发出来的,而这款 Hack 游戏是 1980 年的游戏 Rogue 的后代。NetHack 在 1987 年发布了第一个版本,并于 2003 年发布了 3.4.3 版本,尽管在这期间一直没有加入新的功能,但各种补丁、插件,以及衍生作品还是在网络上疯狂流传。这使得它可以说是最古老的、拥有众多对游戏乐此不疲的粉丝的游戏。当你访问 [www.reddit.com/r/nethack](http://www.reddit.com/r/nethack) 之后,你就会了解我们的意思了 - 骨灰级的 NetHack 的玩家们仍然聚集在一起讨论新的策略、发现和技巧。偶尔你也可以发现 NetHack 的元老级玩家在历经千辛万苦终于通关之后发出的欢呼。
但怎样才能通关呢?首先,NetHack 被设定在既大又深的地牢中。游戏开始时你在最顶层 - 第 1 层 - 你的目标是不断往下深入直到你找到一个非常宝贵的物品,护身符 Yendor。通常来说 Yendor 在 第 20 层或者更深的地方,但它是可以变化的。随着你在地牢的不断深入,你会遇到各种各样的怪物、陷阱以及 NPC;有些会试图杀掉你,有些会挡在你前进的路上,还有些... 总而言之,在你靠近 TA 们之前你永远不知道 TA 们会怎样。
>
> 要学习的有太多太多,绝大多数物品只有在和其他物品同时使用的情况下才会发挥最好的效果。
>
>
>
使 NetHack 如此引人入胜的原因是游戏中所加入的大量物品。武器、盔甲、附魔书、戒指、宝石 - 要学习的有太多太多,绝大多数物品只有在和其他物品同时使用的情况下才会发挥最好的效果。怪物在死亡后经常会掉落一些有用的物品,以及某些物品如果你不正确使用的话会产生及其不良的作用。你可以在地牢找到商店,里面有许多看似平凡实则非常有用的物品,不过别指望店主能给你详细的描述。你只能靠自己的经验来了解各个物品的用途。有些物品确实没有太大用处,NetHack 中有很多的恶搞元素 - 比如你可以把一块奶油砸到自己的脸上。
不过在你踏入地牢之前,NetHack 会询问你要选择哪种角色进行游戏。你可以为你接下来的地牢之行选择骑士、修道士、巫师,或者卑微的旅者,还有许多其他的角色类型。每种角色都有其独特的优势与弱点,NetHack 的重度玩家喜欢选择那些相对较弱的角色来挑战游戏。你懂的,这样可以向其他玩家炫耀自己的实力。
>
> **情报不会降低游戏的乐趣**
>
>
> 用 NetHack 的说法来讲,“情报员”给指其他玩家提供关于怪物、物品、武器和盔甲信息的玩家。理论上来说,完全可以不借助任何外来信息而通关,但几乎没有几个玩家能做到,游戏实在是太难了。因此使用情报并不会被视为一件糟糕的事情 - 但是一开始由你自己来探索游戏和解决难题,这样才会获得更多的乐趣,只有当你遇到瓶颈的时候再去使用那些情报。
>
>
> 在这里给出一个比较有名的情报站点 [www.statslab.cam.ac.uk/~eva/nethack/spoilerlist.html](http://www.statslab.cam.ac.uk/%7Eeva/nethack/spoilerlist.html),其中的情报被分为了不同的类别。游戏中随机发生的事,比如在喷泉旁饮水可能导致的不同结果,从这里你可以得知已确定的不同结果的发生概率。
>
>
>
### 你的首次地牢之行
NetHack 几乎可以在所有的主流操作系统以及 Linux 发行版上运行,因此你可以通过 "apt-get install nethack" 或者 "yum install nethack" 等适合你用的发行版的命令来安装游戏。安装完毕后,在一个命令行窗口中键入 "nethack" 就可以开始游戏了。游戏开始时系统会询问是否为你随机挑选一位角色 - 但作为一个新手,你最好自己从里面挑选一位比较强的角色。所以,你应该点 "n",然后点 "v" 以选取女武神(Valkyrie),而点 "d" 会选择成为侏儒(dwarf)。
接着 NetHack 上会显示出剧情,说你的神正在寻找护身符 Yendor,你的目标就是找到它并将它带给神。阅读完毕后点击空格键(其他任何时候当你见到屏幕上的 "-More-" 时都可以这样)。接着就让我们出发 - 开始地牢之行吧!
先前已经介绍过了,你的角色用 @ 来表示。你可以看见角色所出房间周围的墙壁,房间里显示“点”的那些地方是你可以移动的空间。首先,你得明白怎样移动角色:h、j、k 以及 l。(是的,和 Vim 中移动光标的操作相同)这些操作分别会使角色向向左、向下、向上以及向右移动。你也可以通过 y、u、b 和 n 来使角色斜向移动。在你熟悉如何控制角色移动前你最好在房间里来回移动你的角色。
NetHack 采用了回合制,因此即使你不进行任何动作,游戏仍然在进行。这是你可以提前计划你的行动。你可以看见一个 "d" 字符或者 "f" 字符在房间里来回移动:这是你的宠物狗/猫,(通常情况下)它们不会伤害你而是帮助你击杀怪物。但是宠物也会被惹怒 - 它们偶尔也会抢在你接近食物或者怪物尸体之前吃掉它们。

*点击 “i” 列出你当前携带的物品清单*
### 门后有什么?
接下来,让我们离开房间。房间四周的墙壁某处会有缝隙,可能是 "+" 号。"+" 号表示一扇关闭的门,这时你应该靠近它然后点击 "o" 来开门。接着系统会询问你开门的方向,假如门在你的左方,就点击 "h"。(如果门被卡住了,就多试几次)然后你就可以看见门后的走廊了,它们由 "#" 号表示,沿着走廊前进直到你找到另一个房间。
地牢之行中你会见到各种各样的物品。某些物品,比如金币(由 "$" 号表示)会被自动捡起来;至于另一些物品,你只能站在上面按下逗号键手动拾起。如果同一位置有多个物品,系统会给你显示一个列表,你只要通过合适的按键选择列表中你想要的物品最后按下 "Enter" 键即可。任何时间你都可以点击 "i" 键在屏幕上列出你当前携带的物品清单。
如果看见了怪物该怎么办?在游戏早期,你可能会遇到的怪物会用符号 "d"、"x" 和 ":" 表示。想要攻击的话,只要简单地朝怪物的方向移动即可。系统会在屏幕顶部通过信息显示来告诉你攻击是否成功 - 以及怪物做出了何种反应。早期的怪物很容易击杀,所以你可以毫不费力地打败他们,但请留意底部状态栏里显示的角色的 HP 值。
>
> 早期的怪物很容易击杀,但请留意角色的 HP 值。
>
>
>
如果怪物死后掉落了一具尸体("%"),你可以点击逗号进行拾取,并点击 "e" 来食用。(在任何时候系统提示你选择一件物品,你都可以从物品列表中点击相应的按键,或者点击 "?" 来查询迷你菜单。)注意!有些尸体是有毒的,这些知识你将在日后的冒险中逐渐学会掌握。
如果你在走廊里行进时遇到了死胡同,你可以点击 "s" 进行搜寻直到找到一扇门。这会花费时间,但是你可以这样加速游戏进程:输入 "10" 并点击 "s" 你将一下搜索 10 次。这将花费游戏中进行 10 次动作的时间,不过如果你正在饥饿状态,你将有可能会被饿死!
通常你可以在地牢顶部找到 "{"(喷泉)以及 "!"(药水)。当你找到喷泉的时候,你可以站在上面并点击 "q" 键开始 “畅饮(quaff)” - 引用后会得到从振奋的到致命的多种效果。当你找到药水的时候,将其拾起并点击 "q" 来饮用。如果你找到一个商店,你可以拾取其中的物品并在离开前点击 "p" 键进行支付。当你负重过大时,你可以点击 "d" 键丢掉一些东西。

*现在已经有带音效的 3D 版 Nethack 了,如:Falcon’s Eye*
>
> **愚蠢的死法**
>
>
> 在 NetHack 玩家中流行着一个缩写词 "YASD" - 又一种愚蠢的死法(Yet Another Stupid Death)。这个缩写词表示了玩家由于自身的的愚蠢或者粗心大意导致了角色的死亡。我们搜集了很多这类死法,但我们最喜欢的是下面这种死法:
>
>
> 我们正在商店浏览商品,这时一条蛇突然从药剂后面跳了出来。在杀死蛇之后,系统弹出一条信息提醒我们角色饥饿值过低了,因此我们顺手食用了蛇的尸体。坏事了!这使得我们的角色失明,导致我们的角色再也不能看见商店里的其他角色及地上的商品了。我们试图离开商店,但在慌乱中却撞在了店主身上并攻击了他。这种做法激怒了店主:他立即向我们的角色使用了火球术。我们试图逃到商店外的走廊上,但却在逃亡的过程中被烧死。
>
>
> 如果你有类似的死法,一定要来我们的论坛告诉我们。不要担心 - 没有人会嘲笑你。经历这样的死法也是你在 NetHack 的世界里不断成长的一部分。哈哈。
>
>
>
### 武装自己
地牢里,尤其是在你击杀怪物后,你可能会发现武器或盔甲。在这里再说一次,点击逗号把它们拾起,接着点击 "w"(小写的)来使用武器或者点击 "W"(大写的)来穿上盔甲。你可以用 "T" 来脱掉盔甲或者 "t" 来取下武器 - 如果你陷入了困境,请确保你总是在使用最好的装备。
在靠近掉在地下的装备之前最好检查一下身上的东西。点击 ";"(分号)后,"Pick an object"(选择一样物品)选项将出现在屏幕顶部。选择该选项,使用移动键直到选中你想要检查的物品,然后点击 ":"(冒号)。接着屏幕顶部将出现这件物品的描述。
因为你的目标是不断深入地牢直到找到护身符 Yendor,所以请随时留意周围的 "<" 和 ">" 符号。这两个符号分别表示向上和向下的楼梯,你可以用与之对应的按键来上楼或下楼。注意!如果你想让宠物跟随你进入下/上一层地牢,下/上楼前请确保你的宠物在你邻近的方格内。若果你想退出,点击 "S"(大写的)来保存进度,输入 #quit 退出游戏。当你再次运行 NetHack 时,系统将会自动读取你上次退出时的游戏进度。
我们就不继续剧透了,地牢深处还有更多的神秘细节、陌生的 NPC 以及不为人知的秘密等着你去发掘。那么,我们再给你点建议:当你遇到了让你困惑不已的物品时,你可以尝试去 NetHack 维基 [http://nethack.wikia.com](http://nethack.wikia.com/) 进行搜索。你也可以在 [www.nethack.org/v343/Guidebook.html](http://www.nethack.org/v343/Guidebook.html) 找到一本非常不错(尽管很长)的指导手册。最后,祝游戏愉快!
---
via: <http://www.linuxvoice.com/nethack/>
作者:[Mike Saunders](http://www.linuxvoice.com/author/mike/) 译者:[Stevearzh](https://github.com/Stevearzh) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 500 | Internal Server Error | null |
4,669 | 一些不起眼但非常有用的 Vim 命令 | http://xmodulo.com/useful-vim-commands.html | 2015-01-15T10:08:00 | [
"vi",
"vim"
] | https://linux.cn/article-4669-1.html | 如果我的[关于这个话题的最新帖子](http://xmodulo.com/turn-vim-full-fledged-ide.html)没有提醒到你的话,那我明确地说,我是一个 Vim 的粉丝。所以在你们中的某些人向我扔石头之前,我先向你们展示一系列“鲜为人知的 Vim 命令”。我的意思是,一些你可能以前没有碰到过的命令,但可能对你来说很有用。作为第二免责声明,我不知道哪些命令是你可能知道的,以及哪些是对你来说有用的。因此这些命令实际上是一些相对少见,但很可能很有用的 Vim 命令。

### 保存文件并退出
说起来有些惭愧,我也是最近才学到这个命令
```
:x
```
和下面的命令是等价的:
```
:wq
```
都是保存当前文件并退出。
(译者注:这两个命令实际上并不完全等价,当文件被修改时两个命令时相同的。但如果未被修改,使用 :x 不会更改文件的修改时间,而使用 :wq 会改变文件的修改时间。)
### 基本计算器
在插入模式下,你可以使用 Ctrl+r 键然后输入 =,再输入一个简单的算式。按 Enter 键,计算结果就会插入到文件中。例如,尝试输入:
```
Ctrl+r '=2+2' ENTER
```

然后计算结果“4 ”会被插入到文件中。
### 查找重复的连续的单词
当你很快地打字时,很有可能会连续输入同一个单词两次,就像 this this。这种错误可能骗过任何一个人,即使是你自己重新阅读一遍也不可避免。幸运的是,有一个简单的正则表达式可以用来预防这个错误。使用搜索命令(默认时 /)然后输入:
```
\(\<\w\+\>\)\_s*\1
```
这会显示所有重复的单词。要达到最好的效果,不要忘记把下面的命令:
```
set hlsearch
```
放到你的 .vimrc 文件中高亮所有的匹配。

### 缩写
一个很可能是最令人印象深刻的窍门是你可以在 Vim 中定义缩写,它可以实时地把你输入的东西替换为另外的东西。语法格式如下:
```
:ab [缩写] [要替换的文字]
```
一个通用的例子是:
```
:ab asap as soon as possible
```
会把你输入的 “asap” 替换为 “as soon as possible”。
### 在你忘记用 root 方式打开文件时的文件保存
这可能是一个在论坛中一直受欢迎的命令。每当你打开一个你没有写入权限的文件(比如系统配置文件)并做了一些修改,Vim 无法通过普通的 “:w” 命令来保存。
你不需要重新以 root 方式打开文件再进行修改,只需要运行:
```
:w !sudo tee %
```
这会直接以 root 方式保存。
### 实时加密文本
如果你不想让别人看懂你的屏幕上的内容,你可以使用一个内置的选项,通过下面的命令使用 [ROT13](https://en.wikipedia.org/wiki/ROT13) 来对文本进行编码:
```
ggVGg?
```

gg 把光标移动到 Vim 缓冲区的第一行,V 进入可视模式,G 把光标移动到缓冲区的最后一行。因此,ggVG 使可视模式覆盖这个当前缓冲区。最后 g? 使用 ROT13 对整个区域进行编码。
注意它可以被映射到一个最常使用的键。它对字母符号也可以很好地工作。要对它进行撤销,最好的方法就是使用撤销命令:u。
### 自动补全
这是另外一个令我感到惭愧的功能,但我发现周围很多人并不知道。Vim 默认有自动补全的功能。的确这个功能是很基本的,并且可以通过插件来增强,但它也很有帮助。方法很简单。Vim 尝试通过已经输入的单词来预测单词的结尾。比如当你在同一个文件中第二次输入 “compiler” 时,仅仅输入 “com” 然后保持在插入模式,按 Ctrl+n 键就可以看到 Vim 为你补全了单词。很简单,但也很有用。
### 比较两个文件的不同
你们中的大多数很可能都知道 vimdiff 命令,它可以使用分离模式打开 Vim 并比较两个文件的不同。语法如下:
```
$ vimdiff [文件1] [文件2]
```
但同样的结果也可以通过下面的 Vim 命令来获得:
```
:diffthis
```
首先在 Vim 中打开原始文件。然后使用分离模式带来第二个文件:
```
:vsp [文件2]
```
最后在第一个缓冲区里输入:
```
:diffthis
```
通过 Ctrl+w 来切换缓冲区并再次输入:
```
:diffthis
```
这样两个文件中不同的部分就会被高亮。
(译者注:可以直接在一个缓冲区里使用命令 :windo diffthis,而不用输入 :diffthis 两次)
要停止比较,使用:
```
:diffoff
```
### 按时间回退文件
Vim 会记录文件的更改,你很容易可以回退到之前某个时间。该命令是相当直观的。比如:
```
:earlier 1m
```
会把文件回退到 1 分钟以前的状态。
注意,你可以使用下面的命令进行相反的转换:
```
:later
```
### 删除标记内部的文字
当我开始使用 Vim 时,一件我总是想很方便做的事情是如何轻松的删除方括号或圆括号里的内容。转到开始的标记,然后使用下面的语法:
```
di[标记]
```
比如,把光标放在开始的圆括号上,使用下面的命令来删除圆括号内的文字:
```
di(
```
如果是方括号或者是引号,则使用:
```
di{
```
和:
```
di"
```
### 删除指定标记前的内容
和删除标记内部有些相似,但目的不同。命令如下:
```
dt[标记]
```
会删除所有光标和标记之间的内容(保持标记不动),如果在同一行有这个标记的话。例如
```
dt.
```
会删除至句子的末尾,但保持 ‘.’ 不动。
### 把 Vim 变为十六进制编辑器
这不是我最喜欢的窍门,但有时会很有趣。你可以把 Vim 和 xxd 功能连起来来把文件转换为十六进制模式。命令如下:
```
:%!xxd
```

类似的,你可以通过下面的命令恢复原来的状态:
```
:%!xxd -r
```
### 把光标下的文字置于屏幕中央
我们所要做的事情如标题所示。如果你想强制滚动屏幕来把光标下的文字置于屏幕的中央,在可视模式中使用命令(译者注:在普通模式中也可以):
```
zz
```
### 跳到上一个/下一个位置
当你编辑一个很大的文件时,经常要做的事是在某处进行修改,然后跳到另外一处。如果你想跳回之前修改的地方,使用命令:
```
Ctrl+o
```
来回到之前修改的地方
类似的:
```
Ctrl+i
```
会回退上面的跳动。
### 把当前文件转化为网页
这会生成一个 HTML 文件来显示文本,并在分开的窗口显示源代码:
```
:%TOhtml
```
(译者注:原文是 :%Tohtml,但在我的电脑上是 :%TOhtml)

很基本但很不错。
总的来说,这一系列命令是在我读了许多论坛主题和 [Vim Tips wiki](http://vim.wikia.com/wiki/Vim_Tips_Wiki)(如果你想学习更多关于编辑器的知识,我非常推荐这篇文章) 之后收集起来的。
如果你还知道哪些非常有用但你认为大多数人并不知道的命令,可以随意在评论中分享出来。就像引言中所说的,一个“鲜为人知但很有用的”命令也许只是你自己的看法,但分享出来总是好的。
---
via: <http://xmodulo.com/useful-vim-commands.html>
作者:[Adrien Brochard](http://xmodulo.com/author/adrien) 译者:[wangjiezhe](https://github.com/wangjiezhe) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,670 | 使用火焰图分析CPU性能回退问题 | http://www.brendangregg.com/blog/2014-11-09/differential-flame-graphs.html | 2015-01-14T22:49:00 | [
"性能",
"分析",
"CPU",
"火焰图"
] | https://linux.cn/article-4670-1.html | 你能快速定位CPU性能回退的问题么? 如果你的工作环境非常复杂且变化快速,那么使用现有的工具是来定位这类问题是很具有挑战性的。当你花掉数周时间把根因找到时,代码已经又变更了好几轮,新的性能问题又冒了出来。
幸亏有了[CPU火焰图](http://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html)(flame graphs),CPU使用率的问题一般都比较好定位。但要处理性能回退问题,就要在修改前后的火焰图之间,不断切换对比,来找出问题所在,这感觉就是像在太阳系中搜寻冥王星。虽然,这种方法可以解决问题,但我觉得应该会有更好的办法。

所以,下面就隆重介绍**红/蓝差分火焰图(red/blue differential flame graphs)**:

上面是一副交互式SVG格式图片([链接](http://www.brendangregg.com/blog/images/2014/zfs-flamegraph-diff.svg))。图中使用了两种颜色来表示状态,**红色表示增长**,**蓝色表示衰减**。
这张火焰图中各火焰的形状和大小都是和第二次抓取的profile文件对应的CPU火焰图是相同的。(其中,y轴表示栈的深度,x轴表示样本的总数,栈帧的宽度表示了profile文件中该函数出现的比例,最顶层表示正在运行的函数,再往下就是调用它的栈)
在下面这个案例展示了,在系统升级后,一个工作载荷的CPU使用率上升了。 下面是对应的CPU火焰图([SVG格式](http://www.brendangregg.com/blog/images/2014/zfs-flamegraph-after.svg))

通常,在标准的火焰图中栈帧和栈塔的颜色是随机选择的。 而在红/蓝差分火焰图中,使用不同的颜色来表示两个profile文件中的差异部分。
在第二个profile中deflate\_slow()函数以及它后续调用的函数运行的次数要比前一次更多,所以在上图中这个栈帧被标为了红色。可以看出问题的原因是ZFS的压缩功能被启用了,而在系统升级前这项功能是关闭的。
这个例子过于简单,我甚至可以不用差分火焰图也能分析出来。但想象一下,如果是在分析一个微小的性能下降,比如说小于5%,而且代码也更加复杂的时候,问题就为那么好处理了。
### 红/蓝差分火焰图
这个事情我已经讨论了好几年了,最终我自己编写了一个我个人认为有价值的实现。它的工作原理是这样的:
1. 抓取修改前的堆栈profile1文件
2. 抓取修改后的堆栈profile2文件
3. 使用profile2来生成火焰图。(这样栈帧的宽度就是以profile2文件为基准的)
4. 使用“2 - 1”的差异来对火焰图重新上色。上色的原则是,如果栈帧在profile2中出现出现的次数更多,则标为红色,否则标为蓝色。色彩是根据修改前后的差异来填充的。
这样做的目的是,同时使用了修改前后的profile文件进行对比,在进行功能验证测试或者评估代码修改对性能的影响时,会非常有用。新的火焰图是基于修改后的profile文件生成(所以栈帧的宽度仍然显示了当前的CPU消耗),通过颜色的对比,就可以了解到系统性能差异的原因。
只有对性能产生直接影响的函数才会标注颜色(比如说,正在运行的函数),它所调用的子函数不会重复标注。
### 生成红/蓝差分火焰图
我已经把一个简单的代码实现推送到github上(见[火焰图](https://github.com/brendangregg/FlameGraph)),其中新增了一个程序脚本,difffolded.pl。为了展示工具是如何工作的,用Linux [perf\_events](http://www.brendangregg.com/perf.html) 来演示一下操作步骤。(你也可以使用其他profiler)
#### 抓取修改前的profile 1文件:
```
# perf record -F 99 -a -g -- sleep 30
# perf script > out.stacks1
```
#### 一段时间后 (或者程序代码修改后), 抓取profile 2文件:
```
# perf record -F 99 -a -g -- sleep 30
# perf script > out.stacks2
```
#### 现在将 profile 文件进行折叠(fold), 再生成差分火焰图:
```
$ git clone --depth 1 http://github.com/brendangregg/FlameGraph
$ cd FlameGraph
$ ./stackcollapse-perf.pl ../out.stacks1 > out.folded1
$ ./stackcollapse-perf.pl ../out.stacks2 > out.folded2
$ ./difffolded.pl out.folded1 out.folded2 | ./flamegraph.pl > diff2.svg
```
difffolded.p只能对“折叠”过的堆栈profile文件进行操作,折叠操作是由前面的stackcollapse系列脚本完成的。(见链接[火焰图](https://github.com/brendangregg/FlameGraph))。 脚本共输出3列数据,其中一列代表折叠的调用栈,另两列为修改前后profile文件的统计数据。
```
func_a;func_b;func_c 31 33
[...]
```
在上面的例子中"func*a()->func*b()->func\_c()" 代表调用栈,这个调用栈在profile1文件中共出现了31次,在profile2文件中共出现了33次。然后,使用flamegraph.pl脚本处理这3列数据,会自动生成一张红/蓝差分火焰图。
### 其他选项
再介绍一些有用的选项:
**difffolded.pl -n**:这个选项会把两个profile文件中的数据规范化,使其能相互匹配上。如果你不这样做,抓取到所有栈的统计值肯定会不相同,因为抓取的时间和CPU负载都不同。这样的话,看上去要么就是一片红(负载增加),要么就是一片蓝(负载下降)。-n选项对第一个profile文件进行了平衡,这样你就可以得到完整红/蓝图谱。
**difffolded.pl -x**: 这个选项会把16进制的地址删掉。 profiler时常会无法将地址转换为符号,这样的话栈里就会有16进制地址。如果这个地址在两个profile文件中不同,这两个栈就会认为是不同的栈,而实际上它们是相同的。遇到这样的问题就用-x选项搞定。
**flamegraph.pl --negate**: 用于颠倒红/蓝配色。 在下面的章节中,会用到这个功能。
### 不足之处
虽然我的红/蓝差分火焰图很有用,但实际上还是有一个问题:如果一个代码执行路径完全消失了,那么在火焰图中就找不到地方来标注蓝色。你只能看到当前的CPU使用情况,而不知道为什么会变成这样。
一个办法是,将对比顺序颠倒,画一个相反的差分火焰图。例如:

上面的火焰图是以修改前的profile文件为基准,颜色表达了将要发生的情况。右边使用蓝色高亮显示的部分,从中可以看出修改后CPU Idle消耗的CPU时间会变少。(其实,我通常会把cpu*idle给过滤掉,使用命令行grep -v cpu*idle)
图中把消失的代码也突显了出来(或者应该是说,没有突显),因为修改前并没有使能压缩功能,所以它没有出现在修改前的profile文件了,也就没有了被表为红色的部分。
下面是对应的命令行:
```
$ ./difffolded.pl out.folded2 out.folded1 | ./flamegraph.pl --negate > diff1.svg
```
这样,把前面生成diff2.svg一并使用,我们就能得到:
* **diff1.svg**: 宽度是以修改前profile文件为基准,颜色表明将要发生的情况
* **diff2.svg**: 宽度是以修改后profile文件为基准,颜色表明已经发生的情况
如果是在做功能验证测试,我会同时生成这两张图。
### CPI 火焰图
这些脚本开始是被使用在[CPI火焰图](http://www.brendangregg.com/blog/2014-10-31/cpi-flame-graphs.html)的分析上。与比较修改前后的profile文件不同,在分析CPI火焰图时,可以分析CPU工作周期与停顿周期的差异变化,这样可以凸显出CPU的工作状态来。
### 其他的差分火焰图
[](http://www.slideshare.net/brendangregg/blazing-performance-with-flame-graphs/167)
也有其他人做过类似的工作。[Robert Mustacchi](http://dtrace.org/blogs/rm)在不久前也做了一些尝试,他使用的方法类似于代码检视时的标色风格:只显示了差异的部分,红色表示新增(上升)的代码路径,蓝色表示删除(下降)的代码路径。一个关键的差别是栈帧的宽度只体现了差异的样本数。右边是一个例子。这个是个很好的主意,但在实际使用中会感觉有点奇怪,因为缺失了完整profile文件的上下文作为背景,这张图显得有些难以理解。
[](https://github.com/corpaul/flamegraphdiff)
Cor-Paul Bezemer也制作了一种差分显示方法[flamegraphdiff](http://corpaul.github.io/flamegraphdiff/),他同时将3张火焰图放在同一张图中,修改前后的标准火焰图各一张,下面再补充了一张差分火焰图,但栈帧宽度也是差异的样本数。 上图是一个[例子](http://corpaul.github.io/flamegraphdiff/demos/dispersy/dispersy_diff.html)。在差分图中将鼠标移到栈帧上,3张图中同一栈帧都会被高亮显示。这种方法中补充了两张标准的火焰图,因此解决了上下文的问题。
我们3人的差分火焰图,都各有所长。三者可以结合起来使用:Cor-Paul方法中上方的两张图,可以用我的diff1.svg 和 diff2.svg。下方的火焰图可以用Robert的方式。为保持一致性,下方的火焰图可以用我的着色方式:蓝->白->红。
火焰图正在广泛传播中,现在很多公司都在使用它。如果大家知道有其他的实现差分火焰图的方式,我也不会感到惊讶。(请在评论中告诉我)
### 结论
如果你遇到了性能回退问题,红/蓝差分火焰图是找到根因的最快方式。这种方式抓取了两张普通的火焰图,然后进行对比,并对差异部分进行标色:红色表示上升,蓝色表示下降。 差分火焰图是以当前(“修改后”)的profile文件作为基准,形状和大小都保持不变。因此你通过色彩的差异就能够很直观的找到差异部分,且可以看出为什么会有这样的差异。
差分火焰图可以应用到项目的每日构建中,这样性能回退的问题就可以及时地被发现和修正。
---
via: <http://www.brendangregg.com/blog/2014-11-09/differential-flame-graphs.html>
作者:[Brendan Gregg](http://www.linux.com/community/forums/person/60160) 译者:[coloka](https://github.com/coloka) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 302 | Found | null |
4,674 | 用Grub启动ISO镜像 | http://xmodulo.com/boot-iso-image-from-grub.htm | 2015-01-15T15:17:25 | [
"ISO",
"Grub",
"启动"
] | https://linux.cn/article-4674-1.html | 如果你想要使用多个Linux发行版,你没有那么多的选择。你要么安装到你的物理机或虚拟机中,要么以live模式从ISO文件启动。第二个选择,对硬盘空间需求较小,只是有点麻烦,因为你需要将ISO文件写入到U盘或CD/DVD中来启动。不过,这里还有另外一个可选的折中方案:把ISO镜像放在硬盘中,然后以live模式来启动。该方案比完全安装更省空间,而且功能也完备,这对于缓慢的虚拟机而言是个不错的替代方案。下面我将介绍怎样使用流行的Grub启动加载器来实现该方案。

很明显,你将需要使用到Grub,这是几乎所有现代Linux发行版都使用的。你也需要你所想用的Linux版本的ISO文件,将它下载到本地磁盘。最后,你需要知道启动分区在哪里,并怎样在Grub中描述。对于此,请使用以下命令:
```
# fdisk -l
```
带有‘\*’的就是启动分区。对于我,就是/dev/sda1,用Grub语言描述就是(hd0,1)。

作为参考,sda2就是(hd0,2),sdb1就是(hd1,1),以此类推。(你明白了吧。)
### 我们需要编辑什么?
首先,打开/etc/default/grub并检查以下行:
```
#GRUB_HIDDEN_TIMEOUT=0
```
需要在此行前添加‘#’进行注释。
保存,然后打开/etc/grub.d/40\_custom。
在该文件中,你将添加启动到ISO的参数。结构如下:
```
menuentry "[Entry's title in the grub screen]" {
set isofile="[path to ISO file]"
loopback loop [boot partition in Grub language]$isofile
[some specific] arguments
}
```
例如,如果你想要从ISO文件启动Ubuntu,那么你就是想要添加如下行到40\_custom文件:
```
menuentry "Ubuntu 14.04 (LTS) Live Desktop amd64" {
set isofile="/boot/ubuntu-14.04-desktop-amd64.iso"
loopback loop (hd0,1)$isofile
linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=${isofile} quiet splash
initrd (loop)/casper/initrd.lz
}
```

如果你想要启动Gparted:
```
menuentry "GParted Live amd64" {
set isofile="/boot/gparted-live-0.18.0-2-amd64.iso"
loopback loop (hd0,1)$isofile
loopback loop $isofile
linux (loop)/live/vmlinuz boot=live config union=aufs noswap noprompt ip=frommedia toram=filesystem.squashfs findiso=${isofile}
initrd (loop)/live/initrd.img
}
```
或者甚至是Fedora:
```
menuentry "Fedora 20 Live Desktop x86_64" {
set isofile="/boot/Fedora-Live-Desktop-x86_64-20-1.iso"
loopback loop (hd0,1)$isofile
loopback loop $isofile
linux (loop)/isolinux/vmlinuz0 root=live:CDLABEL=Fedora-Live-Desktop-x86_64-20-1 rootfstype=auto ro rd.live.image quiet rhgb rd.luks=0 rd.md=0 rd.dm=0 iso-scan/filename=${isofile}
initrd (loop)/isolinux/initrd0.img
}
```
注意,参数可根据发行版进行修改。幸运的是,有许多地方你可以查阅到。我喜欢这个发行版,但是还有很多其它的发行版你可以启动。同时,请注意你放置ISO文件的地方。如果你的家目录被加密或者无法被访问到,你可能更喜欢将这些文件放到像例子中的启动分区。但是,请首先确保启动分区有足够的空间。
最后,不要忘了保存40\_custom文件并使用以下命令来更新grub:
```
# sudo update-grub
```
以便在下次启动时看到修改。

### 接下来做什么?
想要更多东西?好吧,那就修改下参数来玩玩。你可以启动一个ISO文件,并让它持续做一些事情。例如,如果你是个彻头彻尾的妄想症患者,想要有个可以快速清除硬盘的选项,那么可以使用[DBAN](http://www.dban.org/)来进行一些设置。现在,真的要当心啊,因为此设置会清除你的硬盘,而且在启动时也没有恢复选项:
```
menuentry "Darik's Boot and Nuke" {
set isofile="/boot/dban.iso"
loopback loop (hd0,1)$isofile
linux (loop)/dban.bzi nuke="dwipe" silent
}
```
另外一个选择
```
menuentry "Darik's Boot and Nuke" {
set isofile="/boot/dban.iso"
loopback loop (hd0,1)$isofile
linux (loop)/dban.bzi
}
```
可以显示DBAN选项,让你选择清除驱动器。**当心,因为它仍然十分危险**。
小结一下,对于ISO文件和Grub有很多事情可做:从快速live会话到一键毁灭,都可以满足你。之后,你也可以试试启动一些针对隐私方面的发行版,如[Tails](https://tails.boum.org/)。
你认为从Grub启动一个ISO这个主意怎样?这是不是你想要做的呢?为什么呢?请在下面留言。
---
via: <http://xmodulo.com/boot-iso-image-from-grub.html>
作者:[Adrien Brochard](http://xmodulo.com/author/adrien) 译者:[GOLinux](https://github.com/GOLinux) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,676 | Linux有问必答:Linux 中如何安装 7zip | http://ask.xmodulo.com/install-7zip-linux.html | 2015-01-15T22:29:10 | [
"7zip"
] | /article-4676-1.html |
>
> **问题**: 我需要要从 ISO 映像中获取某些文件,为此我想要使用 7zip 程序。那么我应该如何安装 7zip 软件呢,[在 Linux 发布版本上完全安装]?
>
>
>
7zip 是一款开源的归档应用程序,开始是为 Windows 系统而开发的。它能对多种格式的档案文件进行打包或解包处理,除了支持其原生的 7z 格式的文档外,还支持包括 XZ、GZIP、TAR、ZIP 和 BZIP2 等这些格式。 通常,7zip 也用来解压 RAR、DEB、RPM 和 ISO 等格式的文件。除了简单的归档功能,7zip 还具有支持 AES-256 算法加密以及自解压和建立多卷存档功能。在支持 POSIX 标准的系统上(Linux、Unix、BSD),原生的 7zip 程序被移植过来并被命名为 p7zip(“POSIX 7zip” 的简称)。

下面介绍如何在 Linux 中安装 7zip (或 p7zip)。
### 在 Debian、Ubuntu 或 Linux Mint 系统中安装 7zip
在基于的 Debian 的发布系统中存在有三种 7zip 的软件包。
* **p7zip**: 包含 7zr(最小的 7zip 归档工具),仅仅只能处理原生的 7z 格式。
* **p7zip-full**: 包含 7z ,支持 7z、LZMA2、XZ、ZIP、CAB、GZIP、BZIP2、ARJ、TAR、CPIO、RPM、ISO 和 DEB 格式。
* **p7zip-rar**: 包含一个能解压 RAR 文件的插件。
建议安装 p7zip-full 包(不是 p7zip),因为这是最完全的 7zip 程序包,它支持很多归档格式。此外,如果您想处理 RAR 文件话,还需要安装 p7zip-rar 包,做成一个独立的插件包的原因是因为 RAR 是一种专有格式。
```
$ sudo apt-get install p7zip-full p7zip-rar
```
### 在 Fedora 或 CentOS/RHEL 系统中安装 7zip
基于红帽的发布系统上提供了两个 7zip 的软件包。
* **p7zip**: 包含 7za 命令,支持 7z、ZIP、GZIP、CAB、ARJ、BZIP2、TAR、CPIO、RPM 和 DEB 格式。
* **p7zip-plugins**: 包含 7z 命令,额外的插件,它扩展了 7za 命令(例如支持 ISO 格式的抽取)。
在 CentOS/RHEL 系统中,在运行下面命令前您需要确保 [EPEL 资源库](http://linux.cn/article-2324-1.html) 可用,但在 Fedora 系统中就不需要额外的资源库了。
```
$ sudo yum install p7zip p7zip-plugins
```
注意,跟基于 Debian 的发布系统不同的是,基于红帽的发布系统没有提供 RAR 插件,所以您不能使用 7z 命令来抽取解压 RAR 文件。
### 使用 7z 创建或提取归档文件
一旦安装好 7zip 软件后,就可以使用 7z 命令来打包解包各式各样的归档文件了。7z 命令会使用不同的插件来辅助处理对应格式的归档文件。

使用 “a” 选项就可以创建一个归档文件,它可以创建 7z、XZ、GZIP、TAR、 ZIP 和 BZIP2 这几种格式的文件。如果指定的归档文件已经存在的话,它会把文件“附加”到存在的归档中,而不是覆盖原有归档文件。
```
$ 7z a <archive-filename> <list-of-files>
```
使用 “e” 选项可以抽取一个归档文件,抽取出的文件会放在当前目录。抽取支持的格式比创建时支持的格式要多的多,包括 7z、XZ、GZIP、TAR、ZIP、BZIP2、LZMA2、CAB、ARJ、CPIO、RPM、ISO 和 DEB 这些格式。
```
$ 7z e <archive-filename>
```
解包的另外一种方式是使用 “x” 选项。和 “e” 选项不同的是,它使用的是全路径来抽取归档的内容。
```
$ 7z x <archive-filename>
```
要查看归档的文件列表,使用 “l” 选项。
```
$ 7z l <archive-filename>
```
要更新或删除归档文件,分别使用 “u” 和 “d” 选项。
```
$ 7z u <archive-filename> <list-of-files-to-update>
$ 7z d <archive-filename> <list-of-files-to-delete>
```
要测试归档的完整性,使用:
```
$ 7z t <archive-filename>
```
---
via:<http://ask.xmodulo.com/install-7zip-linux.html>
译者:[runningwater](https://github.com/runningwater) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /install-7zip-linux.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275c61d0>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)")) | null |
4,677 | 如何在Ubuntu / CentOS 6.x上安装Bugzilla 4.4 | http://linoxide.com/tools/install-bugzilla-ubuntu-centos/ | 2015-01-16T09:43:00 | [
"Bugzilla"
] | /article-4677-1.html | 这里,我们将展示如何在一台Ubuntu 14.04或CentOS 6.5/7上安装Bugzilla。Bugzilla是一款基于web,用来记录跟踪缺陷数据库的bug跟踪软件,它同时是一款免费及开源软件(FOSS),它的bug跟踪系统允许个人和开发团体有效地记录下他们产品的一些突出问题。尽管是"免费"的,Bugzilla依然有很多其它同类产品所没有的“珍贵”特性。因此,Bugzilla很快就变成了全球范围内数以千计的组织最喜欢的bug管理工具。
Bugzilla对于不同使用场景的适应能力非常强。如今它们应用在各个不同的IT领域,如系统管理中的部署管理、芯片设计及部署的问题跟踪(制造前期和后期),还有为那些诸如Redhat,NASA,Linux-Mandrake和VA Systems这些著名公司提供软硬件bug跟踪。

### 1. 安装依赖程序
安装Bugzilla相当**简单**。这篇文章特别针对Ubuntu 14.04和CentOS 6.5两个版本(不过也适用于更老的版本)。
为了获取并能在Ubuntu或CentOS系统中运行Bugzilla,我们要安装Apache网络服务器(启用SSL),MySQL数据库服务器和一些需要来安装并配置Bugzilla的工具。
要在你的服务器上安装使用Bugzilla,你需要安装好以下程序:
* Perl(5.8.1 或以上)
* MySQL
* Apache2
* Bugzilla
* Perl模块
* 使用apache的Bugzilla
正如我们所提到的本文会阐述Ubuntu 14.04和CentOS 6.5/7两种发行版的安装过程,为此我们会分成两部分来表示。
以下就是在你的Ubuntu 14.04 LTS和CentOS 7机器安装Bugzilla的步骤:
**准备所需的依赖包:**
你需要运行以下命令来安装些必要的包:
**Ubuntu版本:**
```
$ sudo apt-get install apache2 mysql-server libapache2-mod-perl2 libapache2-mod-perl2-dev libapache2-mod-perl2-doc perl postfix make gcc g++
```
**CentOS版本:**
```
$ sudo yum install httpd mod_ssl mysql-server mysql php-mysql gcc perl* mod_perl-devel
```
**注意:请在shell或者终端下运行所有的命令并且确保你用root用户(sudo)操作机器。**
### 2. 启动Apache服务
你已经按照以上步骤安装好了apache服务,那么我们现在需要配置apache服务并运行它。我们需要用sodo或root来敲命令去完成它,我们先切换到root连接。
```
$ sudo -s
```
我们需要在防火墙中打开80端口并保存改动。
```
# iptables -I INPUT -p tcp --dport 80 -j ACCEPT
# service iptables save
```
现在,我们需要启动服务:
CentOS版本:
```
# service httpd start
```
我们来确保Apache会在每次你重启机器的时候一并启动起来:
```
# /sbin/chkconfig httpd on
```
Ubuntu版本:
```
# service apache2 start
```
现在,由于我们已经启动了我们apache的http服务,我们就能在默认的127.0.0.1地址下打开apache服务了。
### 3. 配置MySQL服务器
现在我们需要启动我们的MySQL服务:
CentOS版本:
```
# chkconfig mysqld on
# service start mysqld
```
Ubuntu版本:
```
# service mysql-server start
```

用root用户登录连接MySQL并给Bugzilla创建一个数据库,把你的mysql密码更改成你想要的,稍后配置Bugzilla的时候会用到它。
CentOS 6.5和Ubuntu 14.04 Trusty两个版本:
```
# mysql -u root -p
# password: (You'll need to enter your password)
# mysql > create database bugs;
# mysql > grant all on bugs.* to root@localhost identified by "mypassword";
#mysql > quit
```
**注意:请记住数据库名和mysql的密码,我们稍后会用到它们。**
### 4. 安装并配置Bugzilla
现在,我们所有需要的包已经设置完毕并运行起来了,我们就要配置我们的Bugzilla。
那么,首先我们要下载最新版的Bugzilla包,这里我下载的是4.5.2版本。
使用wget工具在shell或终端上下载:
```
wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-4.5.2.tar.gz
```
你也可以从官方网站进行下载。<http://www.bugzilla.org/download/>
**从下载下来的bugzilla压缩包中提取文件并重命名:**
```
# tar zxvf bugzilla-4.5.2.tar.gz -C /var/www/html/
# cd /var/www/html/
# mv -v bugzilla-4.5.2 bugzilla
```
**注意**:这里,**/var/www/html/bugzilla/**就是**Bugzilla主目录**.
现在,我们来配置buzilla:
```
# cd /var/www/html/bugzilla/
```
./checksetup.pl --check-modules
===============================

检查完成之后,我们会发现缺少了一些组件,我们需要安装它们,用以下命令即可实现:
```
# cd /var/www/html/bugzilla
# perl install-module.pl --all
```
这一步会花掉一点时间去下载安装所有依赖程序,然后再次运行**checksetup.pl --check-modules**命令来验证有没有漏装什么。
现在我们需要运行以下这条命令,它会在/var/www/html/bugzilla路径下自动生成一个名为localconfig的文件。
```
# ./checksetup.pl
```
确认一下你刚才在localconfig文件中所输入的数据库名、用户和密码是否正确。
```
# nano ./localconfig
# checksetup.pl
```

如果一切正常,checksetup.pl现在应该就成功地配置Bugzilla了。
现在我们需要添加Bugzilla至我们的Apache配置文件中。那么,我们需要用文本编辑器打开 /etc/httpd/conf/httpd.conf 文件(CentOS版本)或者 /etc/apache2/apache2.conf 文件(Ubuntu版本):
CentOS版本:
```
# nano /etc/httpd/conf/httpd.conf
```
Ubuntu版本:
```
# nano etc/apache2/apache2.conf
```
现在,我们需要配置Apache服务器,我们要把以下配置添加到配置文件里:
```
<VirtualHost *:80>
DocumentRoot /var/www/html/bugzilla/
</VirtualHost>
<Directory /var/www/html/bugzilla>
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI
DirectoryIndex index.cgi
AllowOverride Limit FileInfo Indexes
</Directory>
```
接着,我们需要编辑 .htaccess 文件并用“#”注释掉顶部“Options -Indexes”这一行。
让我们重启我们的apache服务并测试下我们的安装情况。
CentOS版本:
```
# service httpd restart
```
Ubuntu版本:
```
# service apache2 restart
```

这样,我们的Bugzilla就准备好在我们的Ubuntu 14.04 LTS和CentOS 6.5上获取bug报告了,你就可以通过本地回环地址或你网页浏览器上的IP地址来浏览bugzilla了。
---
via: <http://linoxide.com/tools/install-bugzilla-ubuntu-centos/>
作者:[Arun Pyasi](http://linoxide.com/author/arunp/) 译者:[ZTinoZ](https://github.com/ZTinoZ) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| null | HTTPConnectionPool(host='linoxide.com', port=80): Max retries exceeded with url: /tools/install-bugzilla-ubuntu-centos/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7b83275c6d10>, 'Connection to linoxide.com timed out. (connect timeout=10)')) | null |
4,678 | systemd-nspawn 快速指南 | http://rich0gentoo.wordpress.com/2014/07/14/quick-systemd-nspawn-guide/ | 2015-01-16T07:00:00 | [
"systemd",
"chroot",
"systemd-nspawn"
] | https://linux.cn/article-4678-1.html | 我目前已从 chroot(译者注:chroot可以构建类似沙盒的环境,建议各位同学先了解chroot) 迁移到 systemd-nspawn,同时我写了一篇快速指南。简单的说,我强烈建议正在使用 systemd 的用户从 chroot 转为 systemd-nspawn,因为只要你的内核配置正确的话,它几乎没有什么缺点。
想必在各大发行版中的用户对 chroot 都不陌生,而且我猜想 Gentoo 用户要时不时的使用它。

### chroot 面临的挑战
大多数交互环境下,仅运行chroot还不够。通常还要挂载 /proc, /sys,另外为了确保不会出现类似“丢失 ptys”之类的错误,我们还得 bind(译者注:bind 是 mount 的一个选项) 挂载 /dev。如果你使用 tmpfs,你可能想要以 tmpfs 类型挂载新的 tmp、 var/tmp。接下来你可能还想将其他的挂载点 bind 到 chroot 中。这些都不是特别难,但是一般情况下要写一个脚本来管理它。
现在我按照日常计划执行备份操作,当然有一些不必备份的数据如 tmp 目录,或任何 bind 挂载的内容。当我配置了一个新的 chroot 后就意味着我要更新我的备份配置了,但我经常忘记这点,因为大多数时间里 chroot 挂载点并没有运行。当这些挂载点仍然存在的情况下执行备份的话,那么备份中会多出很多不需要的内容。
当 bind 挂载点包含其他挂载点时(比如挂载时使用 -rbind 选项),这种情况下 systemd 的默认处理方式略有不同。在 bind 挂载中卸载一些东西时,systemd 会将处于 bind 另一边的目录也卸载掉。想像一下,如果我卸载了 chroot 中以 bind 挂载 /dev 的某个目录后,发现主机上的 /dev/pts 与 /dev/shm 也不见了,我肯定会很吃惊。不过好像有其他方法可以避免,但是这不是我们此次讨论的重点。
### Systemd-nspawn 优点
Systemd-nspawn 用于启动一个容器,并且它的最简模式就可以像 chroot 那样运行。默认情况下,它自动配置容器所需的开销如 /dev, /tmp 等等。通过配合一些选项它也可配置其他的 bind 挂载点。当容器退出后,所有的挂载点都会被清除。
容器运行时,从外部看上去没什么变化。事实上,可以从同一个 chroot 产生5个不同的 systemd-nspawn 容器实例,并且除了文件系统(不包括 /dev, /tmp等,只有 /usr,/etc 的改变会传递)外它们之间没有任何联系。你的备份将会忽略 bind 挂载点、tmpfs 及任何挂载在容器中的内容。
它同时具有其它优秀容器的优点,比如 containment - 可以杀死容器内的所有活动但不影响外部,等等。它的安全性并不是无懈可击的-它的作用仅仅是防止意外的错误。
如果你使用的是兼容的 sysvinit(它包含了 systemd,openrc),你可以启动容器。这意味着,你可以在容器中使用 fstab 添加挂载点,运行守护进程等。只需要一个 chroot 的开销,几乎就可以获得虚拟化的所有好处(不需要构建内核等)。在一个看起来像 chroot 的容器中运行systemctl poweroff 看起来很奇怪,但这条命令能够起作用。
注意,如果不做额外配置的话那么容器就会共享主机的网络,所以主机上的容器不要运行 sshd。运行一个分离的网络 namespace 不是太难,为了新的实例可以使用DHCP,分离之后记得绑定接口。
### 操作步骤
让它工作起来是此次讨论中最简短的部分了。
首先系统内核要支持 namespaces 与 devpts:
```
CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
CONFIG_USER_NS=y
CONFIG_PID_NS=y
CONFIG_NET_NS=y
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
```
像 chroot 那样启动 namespace 是非常简单的:
```
systemd-nspawn -D .
```
也可以像 chroot 那样退出。在内部可以运行 mount 并且可以看到默认它已将 /dev 与 /tmp 准备好了。 ”.“就是 chroot 的路径,也就是当前路径。在它内部运行的是 bash。
如果要添加一些 bind 挂载点也非常简便:
```
systemd-nspawn -D . --bind /usr/portage
```
现在,容器中的 /usr/portage 就与主机的对应目录绑定起来了,我们无需 sync /etc。如果想要绑定到指定的路径,只要在原路径后添加 ”:dest“,相当于 chroot 的 root(--bind foo 与 --bind foo:foo是一样的)。
如果容器具有 init 功能并且可以在内部运行,可以通过添加 -b 选项启动它:
```
systemd-nspawn -D . --bind /usr/portage -b
```
可以观察到 init 的运作。关闭容器会自动退出。
如果容器内运行了 systemd ,你可以使用 -h 选项将它的日志重定向到主机的systemd日志:
```
systemd-nspawn -D . --bind /usr/portage -j -b
```
使用 nspawn 注册容器以便它能够在 machinectl 中显示。如此可以方便的在主机上对它进行操作,如启动新的 getty, ssh 连接,关机等。
如果你正在使用 systemd 那么甩开 chroot 拥抱 nspawn 吧。
---
via: <http://rich0gentoo.wordpress.com/2014/07/14/quick-systemd-nspawn-guide/>
作者:[rich0](http://rich0gentoo.wordpress.com/) 译者:[SPccman](https://github.com/SPccman) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,682 | 硬盘监控和分析工具:Smartctl | http://www.linuxtechi.com/smartctl-monitoring-analysis-tool-hard-drive/ | 2015-01-16T16:21:59 | [
"smartctl",
"硬盘"
] | https://linux.cn/article-4682-1.html | **Smartctl**(S.M.A.R.T 自监控,分析和报告技术)是类Unix系统下实施SMART任务命令行套件或工具,它用于打印SMART**自检**和**错误日志**,启用并禁用SMRAT**自动检测**,以及初始化设备自检。
Smartctl对于Linux物理服务器十分有用,在这些服务器上,可以对智能磁盘进行错误检查,并将与**硬件RAID**相关的磁盘信息摘录下来。
在本帖中,我们将讨论smartctl命令的一些实用样例。如果你的Linux上海没有安装smartctl,请按以下步骤来安装。

### 安装 Smartctl
**对于 Ubuntu**
```
$ sudo apt-get install smartmontools
```
**对于 CentOS & RHEL**
```
# yum install smartmontools
```
### 启动Smartctl服务
**对于 Ubuntu**
```
$ sudo /etc/init.d/smartmontools start
```
**对于 CentOS & RHEL**
```
# service smartd start ; chkconfig smartd on
```
### 样例
#### 样例:1 检查磁盘的 Smart 功能是否启用
```
root@linuxtechi:~# smartctl -i /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Momentus 5400.6
Device Model: ST9320325AS
Serial Number: 5VD2V59T
LU WWN Device Id: 5 000c50 020a37ec4
Firmware Version: 0002BSM1
User Capacity: 320,072,933,376 bytes [320 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: 5400 rpm
Device is: In smartctl database [for details use: -P show]
ATA Version is: ATA8-ACS T13/1699-D revision 4
SATA Version is: SATA 2.6, 1.5 Gb/s
Local Time is: Sun Nov 16 12:32:09 2014 IST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
```
这里‘/dev/sdb’是你的硬盘。上面输出中的最后两行显示了SMART功能已启用。
#### 样例:2 启用磁盘的 Smart 功能
```
root@linuxtechi:~# smartctl -s on /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.
```
#### 样例:3 禁用磁盘的 Smart 功能
```
root@linuxtechi:~# smartctl -s off /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Disabled. Use option -s with argument 'on' to enable it.
```
#### 样例:4 显示磁盘的详细 Smart 信息
```
root@linuxtechi:~# smartctl -a /dev/sdb // For IDE drive
root@linuxtechi:~# smartctl -a -d ata /dev/sdb // For SATA drive
```
#### 样例:5 显示磁盘总体健康状况
```
root@linuxtechi:~# smartctl -H /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
Warning: This result is based on an Attribute check.
Please note the following marginal Attributes:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
190 Airflow_Temperature_Cel 0x0022 067 045 045 Old_age Always In_the_past 33 (Min/Max 25/33)
```
#### 样例:6 使用long和short选项测试硬盘
**Long测试**
```
root@linuxtechi:~# smartctl --test=long /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Extended self-test routine immediately in off-line mode".
Drive command "Execute SMART Extended self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 102 minutes for test to complete.
Test will complete after Sun Nov 16 14:29:43 2014
Use smartctl -X to abort test.
```
或者,我们可以重定向测试输出到日志文件,就像下面这样
```
root@linuxtechi:~# smartctl --test=long /dev/sdb > /var/log/long.text
```
**Short测试**
```
root@linuxtechi:~# smartctl --test=short /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Short self-test routine immediately in off-line mode".
Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 1 minutes for test to complete.
Test will complete after Sun Nov 16 12:51:45 2014
Use smartctl -X to abort test.
```
或
```
root@linuxtechi:~# smartctl --test=short /dev/sdb > /var/log/short.text
```
**注意**:short测试将花费最多2分钟,而在long测试中没有时间限制,因为它会读取并验证磁盘的每个段。
#### 样例:7 查看驱动器的自检结果
```
root@linuxtechi:~# smartctl -l selftest /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed: read failure 90% 492 210841222
# 2 Extended offline Completed: read failure 90% 492 210841222
```
#### 样例:8 计算测试时间估值
```
root@linuxtechi:~# smartctl -c /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection: Disabled.
Self-test execution status: ( 121) The previous self-test completed having
the read element of the test failed.
Total time to complete Offline
data collection: ( 0) seconds.
Offline data collection
capabilities: (0x73) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
No Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 1) minutes.
Extended self-test routine
recommended polling time: ( 102) minutes.
Conveyance self-test routine
recommended polling time: ( 2) minutes.
SCT capabilities: (0x103b) SCT Status supported.
SCT Error Recovery Control supported.
SCT Feature Control supported.
SCT Data Table supported.
```
#### 样例:9 显示磁盘错误日志
```
root@linuxtechi:~# smartctl -l error /dev/sdb
Sample Output
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-32-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART Error Log Version: 1
ATA Error Count: 5
CR = Command Register [HEX]
FR = Features Register [HEX]
SC = Sector Count Register [HEX]
SN = Sector Number Register [HEX]
CL = Cylinder Low Register [HEX]
CH = Cylinder High Register [HEX]
DH = Device/Head Register [HEX]
DC = Device Command Register [HEX]
ER = Error register [HEX]
ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
25 da 08 e7 e5 a5 4c 00 00:30:44.515 READ DMA EXT
25 da 08 df e5 a5 4c 00 00:30:44.514 READ DMA EXT
25 da 80 5f e5 a5 4c 00 00:30:44.502 READ DMA EXT
25 da f0 5f e6 a5 4c 00 00:30:44.496 READ DMA EXT
25 da 10 4f e6 a5 4c 00 00:30:44.383 READ DMA EXT
```
---
via: <http://www.linuxtechi.com/smartctl-monitoring-analysis-tool-hard-drive/>
作者:[Pradeep Kumar](http://www.linuxtechi.com/author/pradeep/) 译者:[GOLinux](https://github.com/GOLinux) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
4,683 | 怎样在 Ubuntu 14.10 Server 上安装 Cacti | http://www.ubuntugeek.com/how-to-install-cacti-monitoring-tool-on-ubuntu-14-10-server.html | 2015-01-16T16:48:00 | [
"Cacti",
"RRDTool",
"监控",
"mrtg"
] | https://linux.cn/article-4683-1.html | Cacti 是一个完善的网络监控的图形化解决方案,它被设计用来发挥 RRDTool (一个 Linux 数据存储和绘图工具)的数据存储和绘图的强大功能。Cacti 提供一个快速的轮询器,高级的绘图模版,多种数据获取方法和用户管理功能,并且可以开箱即用。所有的这些都被打包进一个直观,易用的界面,可用于监控简单的 LAN 网络,乃至包含成百上千设备的复杂网络。

### 功能
#### 绘图
没有数量限制的监控图条目(graph item),每个图形可以视情况使用 Cacti 中的 CDEFs (Calculation Define,可以对图形输出结果进行计算)或者数据源。
自动将 GPRINT 条目分组至 AREA,STACK 和 LINE[1-3] 中,来对监控图条目进行快速重排序。
自动填充功能支持整齐排列图形内的说明项。
可以使用 RRDTool 中内置的 CDEF 数学函数对图形数据进行处理。这些 CDEF 函数可以定义在 Cacti 中,并且每一个图形都可以使用它们。
支持所有的 RRDTool 图形类型,包括 AREA,STACK,LINE[1-3],GPRINT,COMMENT,VRULE 和 HRULE。
#### 数据源
数据源可以使用 RRDTool 的 "create" 和 "update" 功能创建。每一个数据源可以用来收集本地或者远程的数据,并将数据输出成图形。
支持包含多个数据源的 RRD 文件,并可以使用存储在本地文件系统中任何位置的 RRD 文件。
可以自定义轮询归档(RRA)设置,用户可以在存储数据时使用非标准的时间间隔(标准时间间隔是5分钟,30分钟,2小时和 1天)。
#### 数据收集
Cacti 包含一个 "data input" 机制,可以让用户定义自定义的脚本用来收集数据。每个脚本可以包含调用参数,每次调用此脚本的创建数据源时必须输入相应的调用参数(如 IP 地址)。
支持 SNMP 功能,可以使用 php-snmp,ucd-snmp 或者 net-snmp。
可以基于索引来使用 SNMP 或者脚本收集数据。例如,可以列出一个服务器上所有网卡接口或者已挂载分区的索引列表。其集成的绘图模版可以用来为主机一键创建图形。
提供了一个基于 PHP 的轮询器执行脚本,可以收集 SNMP数据并更新数据至 RRD 文件中。
#### 模版
绘图模版可以将相同图形分组到为一类。图形中的每一个条目都可以使用模版的默认值或者自定义。
数据源模版可以通过将相同数据源类型分组为一类。数据源中每一个条目都可以使用模版的默认值或者自定义。
主机模版是一组图形和数据源模版,可以用来定义某一类型的主机。创建主机时,它会自动使用相应模版的属性。
#### 图形展示
图形树模式允许用户创建「图形层次结构」并将图形放至树中。这种方法可以方便的管理大量图形。
列表模式将所有图形的链接在一个大列表中展示出来,链接指向用户创建的图形。
预览模式将所有图形在一个大列表中展示出来。这有点类似于 RRDTool/MRTG 的默认视图。
#### 用户管理
用户管理功能允许管理员创建用户并分配给用户访问 Cacti 接口的不同级别的权限。
权限可以为每个用户指定其对每个图形的权限,这适用于主机租用的场景。
每个用户可以保存他自己的图形显示模式。
### 安装
#### 系统准备
在安装 cacti 之前,确保你已经安装了 [Ubuntu 14.10 LAMP server](http://www.ubuntugeek.com/www.ubuntugeek.com/step-by-step-ubuntu-14-10-utopic-unicorn-lamp-server-setup.html)。
#### 在 Ubuntu 14.10 Server 上安装 Cacti
打开终端,运行下面的命令
```
sudo apt-get install cacti-spine
```
上面的命令开始 Cacti 的安装,你会看到下图中 PHP 路径的更改,选择 ok 按回车

选择你想使用的 Web 服务器 (我使用的是 apache2)

Cacti 数据库配置,选 yes

输入数据库管理员账户密码

输入 Cacti 访问数据库的密码

确认密码

现在 Cacti 已经安装了,我们可以开始配置它了。
#### Cacti 配置
在浏览器中访问 http://你的服务器IP/cacti/install/ 来进行初始化设置,点击 next 下一步

选择 New install,点击 next 下一步

下一个界面中,你需要确保所有的路径都是正确的,点击 finish 完成

现在以 admin/admin 登录 Cacti,修改管理员的默认密码


登录 Cacti 之后你会看到类似于下面这样的界面

---
via: <http://www.ubuntugeek.com/how-to-install-cacti-monitoring-tool-on-ubuntu-14-10-server.html>
作者:[ruchi](http://www.ubuntugeek.com/author/ubuntufix) 译者:[Liao](https://github.com/liaoishere) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 200 | OK | # How to install Cacti (Monitoring tool) on ubuntu 14.10 server
**Sponsored Link**
**Features**
**Graphs**
Unlimited number of graph items can be defined for each graph optionally utilizing CDEFs or data sources from within cacti.
Automatic grouping of GPRINT graph items to AREA, STACK, and LINE[1-3] to allow for quick re-sequencing of graph items.
Auto-Padding support to make sure graph legend text lines up.
Graph data can be manipulated using the CDEF math functions built into RRDTool. These CDEF functions can be defined in cacti and can be used globally on each graph.
Support for all of RRDTool's graph item types including AREA, STACK, LINE[1-3], GPRINT, COMMENT, VRULE, and HRULE.
**Data Sources**
Data sources can be created that utilize RRDTool's "create" and "update" functions. Each data source can be used to gather local or remote data and placed on a graph.
Supports RRD files with more than one data source and can use an RRD file stored anywhere on the local file system.
Round robin archive (RRA) settings can be customized giving the user the ability to gather data on non-standard timespans while store varying amounts of data.
**Data Gathering**
Contains a "data input" mechanism which allows users to define custom scripts that can be used to gather data. Each script can contain arguments that must be entered for each data source created using the script (such as an IP address).
Built in SNMP support that can use php-snmp, ucd-snmp, or net-snmp.
Ability to retrieve data using SNMP or a script with an index. An example of this would be populating a list with IP interfaces or mounted partitions on a server. Integration with graph templates can be defined to enable one click graph creation for hosts.
A PHP-based poller is provided to execute scripts, retrieve SNMP data, and update your RRD files.
**Templates**
Graph templates enable common graphs to be grouped together by templating. Every field for a normal graph can be templated or specified on a per-graph basis.
Data source templates enable common data source types to be grouped together by templating. Every field for a normal data source can be templated or specified on a per-data source basis.
Host templates are a group of graph and data source templates that allow you to define common host types. Upon the creation of a host, it will automatically take on the properties of its template.
**Graph Display**
The tree view allows users to create "graph hierarchies" and place graphs on the tree. This is an easy way to manage/organize a large number of graphs.
The list view lists the title of each graph in one large list which links the user to the actual graph.
The preview view displays all of the graphs in one large list format. This is similar to the default view for the 14all cgi script for RRDTool/MRTG.
**User Management**
User based management allows administrators to create users and assign different levels of permissions to the cacti interface.
Permissions can be specified per-graph for each user, making cacti suitable for co location situations.
Each user can keep their own graph settings for varying viewing preferences.
**Preparing your system**
Before installing cacti you need to make sure you have installed [Ubuntu 14.10 LAMP server](http://www.ubuntugeek.com/www.ubuntugeek.com/step-by-step-ubuntu-14-10-utopic-unicorn-lamp-server-setup.html).
**Install Cacti on ubuntu 14.10 server**
Open the terminal and run the following command
sudo apt-get install cacti-spine
The above command starts the cacti installation and you should see the first as php path change select ok and press enter
Now select the webserver you want to use (in my case it is apache2)
Cacti database configurations select yes
Enter database admin user password
Mysql application password for cacti
Now that Cacti is installed, we can start the configuration process on it.
**Configuring cacti**
Point your web browser towards http://YOURSERVERIP/cacti/install/ to start the initial setup and click next
Select new install option and click next
In the following screen you need to make sure you have all the required paths are correct and click on finish
Now login to Cacti with the default admin/admin, and change the password to something more sensible
After login in to Cacti you should see similar to the following screen |
4,692 | 文件轻松比对,伟大而自由的比较软件们 | http://www.linuxlinks.com/article/2014062814400262/FileComparisons.html | 2015-01-18T12:58:00 | [
"文件比较",
"diff"
] | https://linux.cn/article-4692-1.html | 文件比较工具用于比较计算机上的文件的内容,找到他们之间相同与不同之处。比较的结果通常被称为diff。
diff同时也是一个基于控制台的、能输出两个文件之间不同之处的著名的文件比较程序的名字。diff是于二十世纪70年代早期,在Unix操作系统上被开发出来的。diff将会把两个文件之间不同之处的部分进行输出。
Linux拥有很多不错的GUI工具,能使你能清楚的看到两个文件或同一文件不同版本之间的不同之处。这次我从自己最喜欢的GUI比较工具中选出了五个推荐给大家。除了其中的一个,其他的都是开源的。
这些应用程序可以让你更清楚的看到文件或目录的差别,能合并有差异的文件,可以解决冲突并将其输出成一个新的文件或补丁,其也用于那些预览和备注文件改动的产品上(比如,在源代码合并到源文件树之前,要先接受源代码的改变)。因此它们是非常重要的软件开发工具。它们可以帮助开发人员们对文件进行处理,不停的把文件转来转去。这些比较工具不仅仅能用于显示源代码文件中的不同之处;他们还适用于很多种的文本文件。可视化的特性使文件比较变得容易、简单。
---
### Meld

Meld是一个适用于Gnome桌面的、开源的、图形化的文件差异查看和合并的应用程序。它支持2到3个文件的同时比较、递归式的目录比较、处于版本控制(Bazaar, Codeville, CVS, Darcs, Fossil SCM, Git, Mercurial, Monotone, Subversion)之下的目录比较。还能够手动或自动合并文件差异。
Meld的重点在于帮助开发人员比较和合并多个源文件,并在他们最喜欢的版本控制系统下能直观的浏览改动过的地方。
功能包括
* 原地编辑文件,即时更新
* 进行两到三个文件的比较及合并
* 在显示的差异和冲突之间的导航
* 使用插入、改变和冲突这几种标记可视化展示本地和全局的差异
* 内置正则表达式文本过滤器,可以忽略不重要的差异
* 语法高亮度显示(使用可选的gtksourceview)
* 将两到三个目录中的文件逐个进行比较,显示新建,缺失和替换过的文件
* 对任何有冲突或差异的文件直接打开比较界面
* 可以过滤文件或目录以避免以忽略某些差异
* 被改动区域的自动合并模式使合并更容易
* 也有一个简单的文件管理
* 支持多种版本控制系统,包括Git, Mercurial, Bazaar 和 SVN
* 在提交前开启文件比较来检查改动的地方和内容
* 查看文件版本状态
* 还能进行简单的版本控制操作(例如,提交、更新、添加、移动或删除文件)
* 继承自同一文件的两个文件进行自动合并
* 标注并在中间的窗格显示所有有冲突的变更的基础版本
* 显示并合并同一文件的无关的独立修改
* 锁定只读性质的基础文件以避免出错
* 可以整合到已有的命令行界面中,包括gitmergetool
* 国际化支持
* 可视化使文件比较更简单
* 网址: [meldmerge.org](http://meldmerge.org/)
* 开发人员: Kai Willadsen
* 证书: GNU GPL v2
* 版本号: 1.8.5
---
### DiffMerge

DiffMerge是一个可以在Linux、Windows和OS X上运行的,可以可视化文件的比较和合并的应用软件。
功能包括:
* 图形化显示两个文件之间的差别。包括插入行,高亮标注以及对编辑的全面支持
* 图形化显示三个文件之间的差别。(安全的前提下)允许自动合并,并对最终文件可以随意编辑
* 并排显示两个文件夹的比较,显示哪一个文件只存在于其中一个文件夹而不存在于另外的一个文件夹,还能一对一的将完全相同的、等价的或不同的文件配对
* 规则设置和选项让你可以个性化它的外观和行为
* 基于Unicode,可以导入多种编码的字符
* 跨平台工具
* 网址: [sourcegear.com/diffmerge](https://sourcegear.com/diffmerge/)
* 开发人员: SourceGear LLC
* 证书: Licensed for use free of charge (not open source)
* 版本号: 4.2
---
### xxdiff

xxdiff是个开源的图形化的可进行文件、目录比较及合并的工具。
xxdiff可以用于显示两到三个文件或两个目录的差别,还能产生一个合并后的版本。被比较的两到三个文件会并排显示,并将有区别的文字内容用不同颜色高亮显示以便于识别。
这个程序是个非常重要的软件开发工具。他可以图形化的显示两个文件或目录之间的差别,合并有差异的文件,其也用于那些预览和备注文件改动的产品上(比如,在源代码合并到源文件树之前,要先接受源代码的改变)
功能包括:
* 比较两到三个文件,或是两个目录(浅层或递归)
* 横向高亮显示差异
* 交互式的文件合并,可视化的输出和保存
* 可以辅助合并的评论/监管
* 自动合并文件中时不合并 CVS 冲突,并以两个文件显示以便于解决冲突
* 可以用其它的比较程序计算差异:适用于GNU diff、SGI diff和ClearCase的cleardiff,以及所有与这些程序输出相似的文件比较程序。
* 可以使用资源文件实现完全的个性化设置
* 用起来感觉和Rudy Wortel或SGI的xdiff差不多,与桌面系统无关
* 功能和输出可以和脚本轻松集成
* 网址: [furius.ca/xxdiff](http://furius.ca/xxdiff/)
* 开发人员: Martin Blais
* 证书: GNU GPL
* 版本号: 4.0
---
### Diffuse

Diffuse是个开源的图形化工具,可用于合并和比较文本文件。Diffuse能够比较任意数量的文件,并排显示,并提供手动行匹配调整,能直接编辑文件。Diffuse还能从bazaar、CVS、darcs, git, mercurial, monotone, Subversion和GNU RCS 库中获取版本用于比较及合并。
功能包括:
* 比较任意数量的文件,并排显示(多方合并)
* 行匹配可以被用户人工矫正
* 直接编辑文件
* 语法高亮
* 支持Bazaar, CVS, Darcs, Git, Mercurial, Monotone, RCS, Subversion和SVK
* 支持Unicode
* 可无限撤销
* 易用的键盘导航
* 网址: [diffuse.sourceforge.net][]
* 开发人员: Derrick Moser
* 证书: GNU GPL v2
* 版本号: 0.4.7
---
### Kompare

Kompare是个开源的GUI前端程序,可以对不同源文件之间差异的可视化和合并。Kompare可以比较文件或文件夹内容的差异。Kompare支持很多种diff格式,并提供各种选项来设置显示的信息级别。
不论你是个想比较源代码的开发人员,还是只想比较一下研究论文手稿与最终文档的差异,Kompare都是个有用的工具。
Kompare是KDE桌面环境的一部分。
功能包括:
* 比较两个文本文件
* 递归式比较目录
* 显示diff产生的补丁
* 将补丁合并到一个已存在的目录
* 可以让你在编译时更轻松
* 网址: [www.caffeinated.me.uk/kompare/](http://www.caffeinated.me.uk/kompare/)
* 开发者: The Kompare Team
* 证书: GNU GPL
* 版本号: Part of KDE
---
via: <http://www.linuxlinks.com/article/2014062814400262/FileComparisons.html>
作者:Frazer Kline 译者:[H-mudcup](https://github.com/H-mudcup) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
| 301 | Moved Permanently | null |
Subsets and Splits