mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
commit
be64fb5acc
@ -1,26 +1,26 @@
|
||||
KVM和Xen的性能基准测试
|
||||
性能基准测试:KVM大战Xen
|
||||
================================================================================
|
||||
在上周,我们讨论了 KVM 和 Xen 的性能上一些令人感兴趣的话题后,我打算自己做一些这方面的研究。我能找到的最新的资料,是来自[2013年 Phoronix Haswell 性能评测][1]上的基准测试。当然,还有[2011年的评测][2],由于 Xen 已经被收录进 Kernel 3.0,这些曾经都是热门话题。
|
||||
在上周,我们对 KVM 和 Xen 近几年里在性能上的改进进行了一些有趣的探讨后,我打算自己做一些这方面的小研究。我能找到的最新的资料,是来自[2013年 Phoronix Haswell 性能评测][1]上的基准测试。当然,还有[其它一些2011年的评测][2],不过由于 Xen 被收录进 Kernel 3.0,它们都已被热烈地讨论过。
|
||||
|
||||
2011年的测试提供了[许多很好的基准报表][3],我尽最大努力把它们列出的属性重新测试一遍,但少测了两三个基准测试,原因是它们在未经特定优化的配置后跑出来的数据不是很好,或者它们需要跑很长时间才能得到结果。
|
||||
2011年的测试提供了[许多很好的基准报表][3],在三年后的现在,我尽最大努力把它们列出的属性重新测试一遍。但我删减了其中两三个基准测试,原因是它们在未经特定优化的配置后跑出来的数据不是很好,或者它们需要跑很长时间才能得到结果。
|
||||
|
||||
### 测试环境 ###
|
||||
|
||||
测试环境由两台一模一样的超微服务器组成,都配备一颗[Intel 至强 E3-1220][4](4核,3.10GHz),24G 金士顿 DDR3 内存,4块西数 RE-3 160G 磁盘(组成 RAID10 阵列)。另外 BIOS 也是一模一样。
|
||||
测试环境由两台一模一样的超微服务器组成,分别都配备一颗[Intel 至强 E3-1220][4](4核,3.10GHz),24G 金士顿 DDR3 内存,4块西数 RE-3 160G 磁盘(组成 RAID10 阵列)。另外 BIOS 也是一模一样。
|
||||
|
||||
所有测试项目(即实体机和虚拟机)都在 Fedora 20 (开 SELinux)上进行,并且测试过程中没有跑很多的不相关的服务。这里列一下相关服务的版本:
|
||||
所有测试项目(即实体机和虚拟机)都在 Fedora 20 (开 SELinux)上进行,并且测试过程中几乎没有运行的不相关的服务。这里列一下相关服务的版本:
|
||||
|
||||
- Kernel: 3.14.8
|
||||
- For KVM: qemu-kvm 1.6.2
|
||||
- For Xen: xen 4.3.2
|
||||
|
||||
根文件系统是 XFS,使用默认配置。虚拟机使用 virt-manager 来创建(virt-mamager 也使用默认配置)。虚拟磁盘使用 raw 镜像,容量为 8GB,虚拟4颗 CPU。Xen 虚拟机使用 [PVHVM][5] 建立虚拟磁盘。
|
||||
根文件系统都是使用默认配置的 XFS。虚拟机使用 virt-manager 来创建(virt-mamager 也使用默认配置)。虚拟磁盘使用 raw 镜像,容量为 8GB,虚拟4颗 CPU。Xen 虚拟机使用 [PVHVM][5] 建立虚拟磁盘。
|
||||
|
||||
### 警告 ###
|
||||
### 附加说明 ###
|
||||
|
||||
也许有人会考虑到 Fedora 是红帽公司所有,红帽一直在维护 KVM,而 Xen 则自从[在2009年红帽重新选择 KVM 作为虚拟化产品][6]后,再没得到这个公司的维护。在本测试中这个因素不会对结果产生任何影响,不过可以在心里稍微注意一下。
|
||||
也许有人会考虑到 Fedora 是红帽公司所有,红帽一直在维护 KVM,而 Xen 则自从[在2009年红帽重新选择 KVM 作为虚拟化产品][6]后,再没得到这个公司的重要改进。我将这个因素排除在了测试所考虑的范围之外,不过仍然可以在心里稍微注意一下。
|
||||
|
||||
不考虑资源竞争产生的影响。在大多数虚拟服务器上,你可以跑多个虚拟机,而这些虚拟机会争用 CPU 时间片、磁盘 IO、网络带宽等等资源。在本测试中也不考虑这些因素。一台虚拟机抢到资源少,性能就差,而另一台抢得多,性能就好(LCTT:它们的性能总和,就可以大致当作是 KVM 或 Xen 的性能了)。
|
||||
并且,资源竞争产生的影响也有被严格控制并最小化。在大多数虚拟服务器上,你可以跑多个虚拟机,而这些虚拟机会争用 CPU 时间片、磁盘 IO、网络带宽等等资源。在本测试中也不考虑这些因素。一台虚拟机抢到资源少,性能就差,而另一台抢得多,性能就好(LCTT译注:它们的性能总和,就可以大致当作是 KVM 或 Xen 的性能了)。
|
||||
|
||||
本测试运行在 Intel 的 CPU 上。如果使用的是 AMD 或 ARM,可能有些数据会不一样。
|
||||
|
||||
@ -28,11 +28,11 @@ KVM和Xen的性能基准测试
|
||||
|
||||
本测试使用裸机作为虚拟服务测试的基准设备。在不跑虚拟机的情况下,两台裸机的性能偏差不会大于0.51%
|
||||
|
||||
在所有测试中,KVM 的性能相比宿主机而言下降了1.5%以内,除了两个测试。第一个是 7-zip 压缩,比宿主机慢了 2.79%。第二个就奇怪了,我们搭了一个邮件服务器,用 PostMark 测试其性能,结果表明 KVM 竟比宿主机快了4.11%。然后我在两台服务器中重新跑了几遍 PostMark 测试,结果性能差异基本不变,浮动在1%以内。由于我对 virtio 的内部机制没有很深的理解,我只能在以后再对这个怪现象进行进一步了解。
|
||||
在几乎所有测试中,KVM 的性能相比宿主机而言下降了1.5%以内,只有两项测试例外。第一个是 7-zip 压缩,比宿主机慢了 2.79%。第二个就奇怪了,我们搭了一个邮件服务器,用 PostMark 测试其性能,结果表明 KVM 竟比宿主机快了4.11%。然后我在两台服务器中重新跑了几遍 PostMark 测试,结果性能差异基本不变,浮动都在最初测试结果的1%以内。由于我对 virtio 的内部机制没有很深的理解,我只能在以后再对这个怪现象进行进一步了解。
|
||||
|
||||
Xen 的性能相对宿主机而言差异就比较大了。有3个测试性能下降在2.5%以内,剩下的性能下降率都是 KVM 的2~4倍。PostMark 测试的性能比 KVM 慢了14.41%,这结果令我大吃一惊。重新跑了下测试,性能差还是在14%左右。KVM 表现最好的两个测试:CPU 测试和 MAFFT 对齐测试,是 Xen 表现最差的。
|
||||
Xen 的性能相对宿主机而言差异就比较大了。有3项测试性能下降在2.5%以内,剩下的性能下降率都是 KVM 的2~4倍。PostMark 测试的性能比 KVM 慢了14.41%,这结果令我大吃一惊。重新跑了下测试,性能差还是几乎不变,浮动都在最初结果的2%以内。KVM 表现最好的 CPU 测试:MAFFT 对齐测试,是 Xen 表现倒数第二差的。
|
||||
|
||||
现在奉上一个总结表:
|
||||
现在奉上一个简短得总结表:
|
||||
|
||||
<table id="tablepress-3" class="tablepress tablepress-id-3 dataTable">
|
||||
<thead>
|
||||
@ -67,19 +67,19 @@ Xen 的性能相对宿主机而言差异就比较大了。有3个测试性能下
|
||||
|
||||
### 结论 ###
|
||||
|
||||
基于上面的测试环境,KVM 的性能损耗在2%以内,Xen 则只有3项损耗在2.5%以内,其他几项损耗都在5~7%之间。虽然 KVM 在 PostMark 测试中性能表现优异,但这个测试只是众多测试中的一项,如果想证明 KVM 确实在 I/O 处理方面很强悍,就需要更多测试。
|
||||
基于上面的测试环境,KVM 的性能损耗几乎都在2%以内,Xen 则在十多项测试中有3项损耗在2.5%以内,而其他几项损耗都在5~7%之间。虽然 KVM 在 PostMark 测试中性能表现优异,但这是众多测试中仅有的一项 I/O 测试,如果想证明 KVM 确实在 I/O 处理方面很强悍,就需要更多测试。
|
||||
|
||||
对我来说,我需要深入理解 KVM 和 Xen 在 I/O 处理上为什么会有这么大的差别。并且还需要跑一些压力测试,来证明虚拟机是否真的比宿主机表现得更出色。
|
||||
对我来说,我想要深入了解一下 KVM 和 Xen 在 I/O 方面的处理,以及它们之间为什么会有这么大的差别。我也许还会跑一些有竞争的测试,来看看虚拟机在有压力的条件下是否真的能比宿主机表现得更出色。
|
||||
|
||||
我鼓励读者通过使用[Phoronix 测试套件][8]来进行一些基准测试,你们可以找到一些能模仿你们工作环境的用例。如果你的工作环境是低 CPU 高 I/O,你可以找找套件里面的 I/O 压力测试。另一方面,如果你的工作是音频、视频转码,你可以试试套件里面的 x264 或 mp3 测试。
|
||||
|
||||
更新:[Chris Behrens 指出][9],我忘了提到 Xen 虚拟机类型了。这里补充下,我使用的是 PVHVM 模型(LCTT:目前支持的模型包括 PV、HVM 和 PVHVM),因为在 Xen 4.3 中这个选拥有最好的性能。另外需要注意的是在 Xen 4.4 中可以使用 PVH,但是在 Fedora 20 中还没有使用 Xen 4.4。
|
||||
更新:[Chris Behrens 指出][9],我忘了提到 Xen 虚拟机类型了。这里补充下,我使用的是 PVHVM 模型(LCTT译注:目前支持的模型包括 PV、HVM 和 PVHVM),因为在 Xen 4.3 中这个选拥有最好的性能。另外需要注意的是在 Xen 4.4 中可以使用 PVH,但是在 Fedora 20 中还没有使用 Xen 4.4。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://major.io/2014/06/22/performance-benchmarks-kvm-vs-xen/
|
||||
|
||||
译者:[bazz2](https://github.com/bazz2) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
译者:[bazz2](https://github.com/bazz2) 校对:[ReiNoir](https://github.com/reinoir)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
58
published/20140626 Joy of Programming--Fail Fast.md
Normal file
58
published/20140626 Joy of Programming--Fail Fast.md
Normal file
@ -0,0 +1,58 @@
|
||||
编程的乐趣:快速终止!
|
||||
================================================================================
|
||||
![](http://www.opensourceforu.com/wp-content/uploads/2011/12/fail-350x262.jpg)
|
||||
|
||||
> 当软件出现问题的时候,它应该以一种很容易引起注意的方式马上终止。这种“快速终止”的方式值得借鉴,我们会在这期专栏里谈谈这个重要的概念。
|
||||
|
||||
一开始,“快速终止”看上去是一种会影响可靠性的不好的实践——为什么一个系统在还可以继续运行的时候要崩溃(或者说终止)?对于这个,我们需要理解,快速终止是和Heisenbugs(对于不易复现bug的一种称呼)紧密联系在一起的。
|
||||
|
||||
考虑一下Bohrbugs(对于能够重现的bug的一种称呼),它们在一个给定输入的条件下总是会出现,比如,访问空指针。这类问题很容易测试、复现并修复。而如今,所有有经验的程序员应该都面对过这样的情形:导致崩溃的bug在重启软件后就不再出现了。不管花多少时间或努力去重现问题,那个bug就是跟我们捉迷藏。这种bug被称为Heisenbugs。
|
||||
|
||||
花在寻找、修复和测试Heisenbugs上的努力比起Bohrbugs来说,要高出一个数量级。一种避免Heisenbugs的策略是将它们转化为Bohrbugs。怎么做呢?预测可能导致Heisenbugs的因素,然后尝试将它们变成Bohrbugs。是的,这并不简单,而且也并不是一定可行,但是让我们来看一个能产生效果的特殊例子。
|
||||
|
||||
并发编程是Heisenbugs经常出现的一个典范。我们的例子就是一个Java里和并发相关的问题。在遍历一个Java集合的时候,一般要求只能通过Iterator的方法对集合进行操作,比如remove()方法。而在遍历期间,如果有另一个线程尝试修改底层集合(因为编程时留下的错误),那么底层集合就可能会被破坏(例如,导致不正确的状态)。
|
||||
|
||||
类似这种不正确的状态会导致不确定的错误——假如我们幸运的话(实际上,这很不幸!),程序可以继续执行而不会崩溃,但是却给出错误的结果。这种bug很难重现和修复,因为这一类的程序错误都是不确定的。换句话说,这是个Heisenbug。
|
||||
|
||||
幸运的是,Java Iterators会尝试侦测这种并发修改,并且当发现时,会抛出异常`ConcurrentModificationException`,而不是等到最后再出错——那样也是没有任何迹象的。换句话说,Java Iterators也遵从了“快速终止”的方法。
|
||||
|
||||
如果一个`ConcurrentModificationException`异常在正式版软件中发生了呢?根据在Javadoc里对这个异常的说明,它“只应该被用于侦测bug”。换句话说,`ConcurrentModificationException`只应该在开发阶段监听和修复,而不应该泄漏到正式代码中。
|
||||
|
||||
好吧,如果正式软件确实发生了这个异常,那它当然是软件中的bug,应当报告给开发者并修复。至少,我们能够知道曾经发生过一次针对底层数据结构的并发修改尝试,而这是软件出错的原因(而不是让软件产生错误的结果,或是以其他现象延后出错,这样就很难跟踪到根本原因)。
|
||||
|
||||
“防止崩溃”的途径就意味着开发健壮的代码。一个很好的编写容错代码的例子就是使用断言。很可惜的是,关于断言的使用有大量不必要的公开争论。其中主要的批评点是:它在开发版本中使用,而在发布版中却被关掉的。
|
||||
|
||||
不管怎么样,这个批评是错误的:从来没有说要用断言来替代应该放到发布版软件中的防御式检查代码。例如,断言不应该用来检查传递给函数的参数是否为空。相应的,应该用一个if语句来检查这个参数是否正确,否则的话抛出一个异常,或是提前返回,来适合上下文。然而,断言一般可以用于额外检查代码中所作出的假设,这些假设应该一直为真才正常。例如,用一个语句来检查在进行了入栈操作后,栈应该不是空的(例如,对“不变量”的检查)。
|
||||
|
||||
所以,快速终止,随时中断,那么你就走在开发更加健壮代码的道路上了。
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via:http://www.opensourceforu.com/2011/12/joy-of-programming-fail-fast/
|
||||
|
||||
译者:[zpl1025](https://github.com/zpl1025) 校对:[ReiNoir](https://github.com/reinoir)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:
|
||||
[2]:
|
||||
[3]:
|
||||
[4]:
|
||||
[5]:
|
||||
[6]:
|
||||
[7]:
|
||||
[8]:
|
||||
[9]:
|
||||
[10]:
|
||||
[11]:
|
||||
[12]:
|
||||
[13]:
|
||||
[14]:
|
||||
[15]:
|
||||
[16]:
|
||||
[17]:
|
||||
[18]:
|
||||
[19]:
|
||||
[20]:
|
@ -1,6 +1,6 @@
|
||||
ncdu – 基于Ncurses库的磁盘使用分析器
|
||||
ncdu – 基于ncurses库的磁盘使用分析器
|
||||
================================================================================
|
||||
[Ncdu][1] (NCurses Disk Usage) 是一个基于Ncurses库的du命令浏览器. 它通过众所周知的[du][2]命令,为用户提供一个快速且容易被使用的接口. 它显示磁盘使用的百分比且允许你通过ncurses库去浏览目录.
|
||||
[Ncdu][1] (NCurses Disk Usage) 是一个基于Ncurses库的du命令的界面。它通过大家熟知的[du][2]命令,为用户提供一个快速且容易被使用的界面。它可以显示磁盘使用的百分比,且允许你使用ncurses库的方式在目录之间导航。
|
||||
|
||||
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/07/ncdu-about.png)
|
||||
|
||||
@ -8,37 +8,37 @@ ncdu – 基于Ncurses库的磁盘使用分析器
|
||||
|
||||
ncdu已经被移植到大多数linux发行版本,可从官方资源库中安装.
|
||||
|
||||
Arch / Manajaro and Derivatives:
|
||||
Arch / Manajaro 及其衍生版:
|
||||
|
||||
sudo pacman -S ncdu
|
||||
|
||||
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/07/ncdu.png)
|
||||
|
||||
Ubuntu / Debian / Linux Minut and Derivatives:
|
||||
Ubuntu / Debian / Linux Minut 及其衍生版:
|
||||
|
||||
sudo apt-get install ncdu
|
||||
|
||||
Fedora and Derivatives:
|
||||
Fedora 及其衍生版:
|
||||
|
||||
sudo yum install ncdu
|
||||
|
||||
在[这里][3]检查其他的发行版本.
|
||||
在[这里][3]可以找到其他的发行版。
|
||||
|
||||
### 使用 ncdu ###
|
||||
|
||||
Keys:
|
||||
键盘操作:
|
||||
|
||||
|
||||
- up, k — Move cursor up
|
||||
- down, j – Move cursor down
|
||||
- right/enter — Open selected directory
|
||||
- left, <, h — Open parent directory
|
||||
- n — Sort by name (ascending/descending)
|
||||
- s — Sort by size (ascending/descending)
|
||||
- C – Sort by items (ascending/descending)
|
||||
- d – Delete selected file or directory
|
||||
- t — Toggle dirs before files when sorting
|
||||
- g – Show percentage and/or graph
|
||||
- up, k — 向上移动光标
|
||||
- down, j – 向下移动光标
|
||||
- right/enter — 打开选定的目录
|
||||
- left, <, h — 打开父目录
|
||||
- n — 按文件名排序(升序/降序)
|
||||
- s — 按文件大小排序(升序/降序)
|
||||
- C – 按项目数排序(升序/降序)
|
||||
- d – 删除选定的文件或目录
|
||||
- t — 排序时将目录放在文件前面
|
||||
- g – 以图形方式显示百分比
|
||||
|
||||
为使用ncdu,请打开终端并且运行
|
||||
|
||||
@ -48,7 +48,7 @@ Keys:
|
||||
|
||||
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/07/ncdu-scanning.png)
|
||||
|
||||
当扫描完成后,你能够很容易的查看文件/目录的大小.
|
||||
当扫描完成后,你能够很容易的看到文件/目录的大小.
|
||||
|
||||
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/07/done-scanning.png)
|
||||
|
||||
@ -60,8 +60,8 @@ Keys:
|
||||
|
||||
man ncdu
|
||||
|
||||
**荣誉**: 有两位读者**BasketCase**和**Sama Vim**在阅读[Linux Basics: How To Find Size of Directory Commands][5]之后 向我们推荐Ncdu工具.
|
||||
注:上面这个链接已经做成原文
|
||||
**荣誉**: 有两位读者**BasketCase**和**Sama Vim**在阅读“[Linux基础:如何在命令行中查看目录的大小][5]”之后 向我们推荐了这个Ncdu工具。
|
||||
|
||||
|
||||
Enjoy!
|
||||
|
||||
@ -69,7 +69,7 @@ Enjoy!
|
||||
|
||||
via: http://www.unixmen.com/ncdu-ncurses-disk-usage-analyzer/
|
||||
|
||||
译者:[hunanchenxingyu](https://github.com/hunanchenxingyu) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
译者:[hunanchenxingyu](https://github.com/hunanchenxingyu) 校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
@ -77,4 +77,4 @@ via: http://www.unixmen.com/ncdu-ncurses-disk-usage-analyzer/
|
||||
[2]:http://www.unixmen.com/linux-basics-find-size-directory-commands/
|
||||
[3]:http://dev.yorhel.nl/ncdu
|
||||
[4]:http://dev.yorhel.nl/ncdu/man
|
||||
[5]:http://www.unixmen.com/linux-basics-find-size-directory-commands/
|
||||
[5]:http://linux.cn/article-3473-1.html
|
@ -1,22 +1,22 @@
|
||||
在Ubuntu上显示桌面歌词
|
||||
在 Ubuntu 桌面上显示歌词
|
||||
================================================================================
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/display_lyrics_desktop_Ubuntu.jpeg)
|
||||
|
||||
除了免费的流媒体音乐外,我最喜欢[Spotify][1]的地方就是它的歌词插件了。有时候我听不懂一首歌里面的所有歌词,尤其是rap。[TuneWiki][2]插件在这种情况下就派得上用场了。但TuneWiki仅有支持Windows和iTune的插件,那我们在linux桌面上有什么选择呢?
|
||||
|
||||
如果你使用过Linux桌面一段时间,你也许听过[OSD Lyrics][3]。它是一个显示桌面歌词的小程序。你可以借助一些音乐播放器来使用它,比如Rythmbox,[Banshee][4],[Clementine][5]等等。
|
||||
如果你使用过一段时间Linux桌面,你也许听过[OSD Lyrics][3]。它是一个显示桌面歌词的小程序。你可以借助一些音乐播放器来使用它,比如 Rythmbox,[Banshee][4],[Clementine][5]等等。
|
||||
|
||||
### 在Ubuntu 14.04和Linux mint 17上安装OSD Lyrics ###
|
||||
|
||||
两年以前OSD Lyrics在它的官方仓库中被积极地维护,但现在对它的开发已经停止了。尽管这个PPA已经不可用,但可以通过网络下载OSD Lyrics的安装包。虽然这些安装执行文件最初是为Ubuntu 12.02设计的,但这些文件也能在Ubuntu 14.04上很良好地工作。我们一起看看怎么在UUUUbuntu 14.04和 Linux mint 17上安装OSD Lyrics。
|
||||
两年以前 OSD Lyrics 它的官方仓库还在积极地维护,但现在对它的开发已经停止了。尽管这个PPA已经不可用,但可以通过网络下载OSD Lyrics的安装包。虽然这些安装执行文件最初是为 Ubuntu 12.02 设计的,但这些文件也能在 Ubuntu 14.04 上良好地工作。我们一起看看怎么在 Ubuntu 14.04 和 Linux mint 17 上安装OSD Lyrics。
|
||||
|
||||
[前往下载页下载OSDLyrics][6],根据你是使用[32位还是64位的ubuntu][7]来下载相应的.deb 文件。你会在网页的上方找到这些文件。
|
||||
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/OSD_Lyrics_Download.jpeg)
|
||||
|
||||
下载完成后,通过双击它来使用Ubuntu软件中心来安装。另外,你也可以使用[Gdebi ][8]来快速地安装.deb安装包。
|
||||
下载完成后,双击它通过使用Ubuntu软件中心来安装。另外,你也可以使用[Gdebi ][8]来快速地安装.deb安装包。
|
||||
|
||||
### 怎样在Ububtu和linux mnit 上使用OSD Lyrics使用歌词 ###
|
||||
### 怎样在 Ububtu 和 linux mnit 上使用 OSD Lyrics 显示歌词 ###
|
||||
|
||||
安装完成后,你可以从Unity Dash运行OSD Lyrics :
|
||||
|
||||
@ -26,20 +26,21 @@
|
||||
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/OSD_Lyrics_Default_Player.jpeg)
|
||||
|
||||
有一件事值得注意,那就是OSD Lyrics不像[Shazam][9]等一样,它不是通过音频来寻找歌词,而是通过比如名称,专辑,艺术家等信息来关联音乐文件。所以你得确保你的音乐文件的来源正当,或者是你得保持你的音乐文件的信息是正确和已经更新了的。
|
||||
有一件事值得注意,那就是OSD Lyrics不像[Shazam][9]等软件一样,它不是通过音频来寻找歌词,而是通过比如名称,专辑,艺术家等信息来关联音乐文件。所以你得确保你的音乐文件的来源正当,或者是你得保持你的音乐文件的信息是正确并且是已经更新后的。
|
||||
|
||||
如果OSD Lyrics辨认出了音乐文件,它就会用卡拉OK格式在桌面上显示歌词了:(译者注:OSD Lyrics可以自动在千千静听和虾米歌词站点在线下载歌词,这对我们中文用户来说是个福音)
|
||||
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/Dsiplay_Lyrics_Ubuntu.jpeg)
|
||||
|
||||
OSD Lyrics有大量设置选项,你可以改变歌词字体的种类,大小等等其它许多设置。
|
||||
OSD Lyrics有大量设置选项,你可以改变歌词字体,文字大小等等。
|
||||
|
||||
你认为OSD Lyrics怎么样?你使用其它的一些歌词插件吗?闲余时间请和我们分享你的看法。
|
||||
--------------------------------------------------------------------------------
|
||||
你认为 OSD Lyrics 怎么样?你还使用其它歌词插件吗?欢迎您和我们分享。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://itsfoss.com/display-song-lyrics-desktop-ubuntu-1404/
|
||||
|
||||
译者:[Love-xuan](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
译者:[Love-xuan](https://github.com/Love-xuan) 校对:[Caroline](https://github.com/carolinewuyan)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
@ -51,4 +52,4 @@ via: http://itsfoss.com/display-song-lyrics-desktop-ubuntu-1404/
|
||||
[6]:https://code.google.com/p/osd-lyrics/downloads/list
|
||||
[7]:http://itsfoss.com/how-to-know-ubuntu-unity-version/
|
||||
[8]:http://itsfoss.com/install-deb-files-easily-and-quickly-in-ubuntu-12-10-quick-tip/
|
||||
[9]:http://www.shazam.com/
|
||||
[9]:http://www.shazam.com/
|
@ -1,8 +1,9 @@
|
||||
在linux中怎样使用cp命令合并目录树
|
||||
在 Linux 中怎样使用cp命令合并目录树
|
||||
================================================================================
|
||||
怎样将布局相似的两个目录树合并成新的目录树? 为理解该问题让我们思考下面的例子.
|
||||
|
||||
假设dir1和dir2目录中分别有3个子目录a,b和c.目录布局如下所示:
|
||||
怎样将两个布局相似的目录树合并成一个新的目录树?为理解该问题让我们思考下面的例子.
|
||||
|
||||
假设 dir1 和 dir2 目录中分别有3个子目录a,b和c.目录布局如下所示:
|
||||
|
||||
![Layout of input directories](http://linoxide.com/wp-content/uploads/2014/07/01.merge_dir_layout.png)
|
||||
输入目录布局
|
||||
@ -14,16 +15,14 @@
|
||||
|
||||
### 1. 使用cp命令创建合并: ###
|
||||
|
||||
现在我们将这两个目录合并成一个新的目录,如"merged".完成上述操作最简单的方式就是递归
|
||||
复制目录,如下图所示:
|
||||
现在我们将这两个目录合并成一个名为"merged"新的目录中.完成上述操作最简单的方式就是递归复制目录,如下图所示:
|
||||
|
||||
![Copy directories recursively to create new merge](http://linoxide.com/wp-content/uploads/2014/07/03.merge_cp_recursive.png)
|
||||
递归复制完成新的合并
|
||||
|
||||
#### 1.1 cp命令和替换带来的问题: ####
|
||||
|
||||
这种方式所带来的问题是该合并目录中所创建的文件为原文件的副本,并非原文件本身. 别急, (你可能正在问自己) 如果不是原文件又有什么问题? 为了回答你的问题,考虑下你有很多大文件的情况
|
||||
.那种情形下,复制所有的文件可能消耗数小时.
|
||||
这种方式所带来的问题是该合并目录中所创建的文件为原文件的副本,并非原文件本身.别急, (你可能正在问自己) 如果不是原文件又有什么问题? 要回答你的问题,考虑下你有很多大文件的情况.那种情形下,复制所有的文件可能花费数小时.
|
||||
|
||||
现在让我们回到刚那问题上,且尝试使用mv命令而不是cp命令.
|
||||
|
||||
@ -33,7 +32,7 @@
|
||||
这些目录不能被合并.因此我们不能像这样使用mv命令去合并目录.
|
||||
现在你该怎样将原文件保存到"merged"目录中?
|
||||
|
||||
### 2. 方法: ###
|
||||
### 2. 解决方法: ###
|
||||
|
||||
cp命令有一个非常有用的选项来帮助我们摆脱这种状况.
|
||||
cp命令的-l 或 --link选项能够创建硬链接而非原文件副本.让我们尝试一下.
|
||||
@ -59,7 +58,7 @@ Verify Inodes
|
||||
#### 2.2 清除: ####
|
||||
|
||||
|
||||
正如你所看到的,这些文件的inodes和原文件的一样.现在 那问题已经被解决,且
|
||||
正如你所看到的,这些文件的inodes和原文件的一样.现在问题已经被解决,且
|
||||
原文件已被复制到合并目录中.现在我们能够移除dir1和dir2目录.
|
||||
|
||||
![Remove original directories](http://linoxide.com/wp-content/uploads/2014/07/08.merge_cleanup.png)
|
||||
@ -71,8 +70,8 @@ via: http://linoxide.com/linux-command/merge-directory-trees-linux/
|
||||
|
||||
原文作者:[Raghu][a]
|
||||
|
||||
译者:[hunanchenxingyu](https://github.com/hunanchenxingyu) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
译者:[hunanchenxingyu](https://github.com/hunanchenxingyu) 校对:[Caroline](https://github.com/carolinewuyan)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/raghu/
|
||||
[a]:http://linoxide.com/author/raghu/
|
44
published/20140728 CoreOS Stable Release.md
Normal file
44
published/20140728 CoreOS Stable Release.md
Normal file
@ -0,0 +1,44 @@
|
||||
CoreOS 稳定版发布
|
||||
================================================================================
|
||||
|
||||
随着CoreOS稳定版的发布,我们相信我们已经为SysAdmin节准备好了一个不错的惊喜。从现在起,用户可以在产品环境中运行CoreOS了。这个版本对于想运行CoreOS的用户来说,是最经考验的、最安全的、最可靠的CoreOS版本。这对我们来说,是一个重大的里程碑。自从2013年八月我们第一个alpha版本发布以来,我们做了:
|
||||
|
||||
- 191个发布版本
|
||||
- 通过alpha和beta频道测试了成千上万的服务器
|
||||
- 支持10个以上平台,从裸机到Rackspace和Google云平台的主要镜像
|
||||
|
||||
对我们来说这是一个极为重要的日子,因为我们为了稳定版的发布付出了努力的工作。当然,如果没有社区的帮助,我们完成不了这些工作,感谢你们所有对项目的支持和贡献。
|
||||
|
||||
[CoreOS 367.1.0][2], 这是我们在稳定频道上的第一个版本, 包括以下内容:
|
||||
|
||||
- Linux 3.15.2
|
||||
- Docker 1.0.1
|
||||
- 所有主流的云服务商的支持, 包括 Rackspace Cloud, Amazon EC2 (包括 HVM) 和 Google Compute Engine
|
||||
- 通过 [CoreOS Managed Linux][3] 的商业支持
|
||||
|
||||
如果你还没有阅读我们的[Update Philosophy][4],我们建议您先看看。
|
||||
|
||||
请注意:稳定发布版本为了保持稳定性而不包括etcd和fleet ,此发布版仅针对基本的操作系统和Docker1.0。etcd和fleet的稳定版本支持会在随后的发布版本中。
|
||||
|
||||
如果想开始在产品中运行CoreOS,请确保阅读我们的快速指南“[切换到发布频道][5]”。如果你正在装新的机器,请确保在一开始就把他们建立在你想要的更新频道上。
|
||||
|
||||
最后,感谢社区的支持,我们迫不及待地想听到你们的反馈。对那些在产品环境中运行CoreOS上,希望得到额外支持的用户,请确保查看我们的[Managed Linux][6] 建议,因为我们已经有了一个完整的支持团队,他们正在准备回答你遇到的任何问题。
|
||||
|
||||
SysAdmin节快乐,感谢你们让互联网变得如此令人惊叹。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://coreos.com/blog/stable-release/
|
||||
|
||||
作者:Alex Polvi
|
||||
译者:[lfzark](https://github.com/lfzark)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://sysadminday.com/
|
||||
[2]:https://coreos.com/releases/#367.1.0
|
||||
[3]:https://coreos.com/products/managed-linux/
|
||||
[4]:https://coreos.com/using-coreos/updates/
|
||||
[5]:https://coreos.com/docs/cluster-management/setup/switching-channels/
|
||||
[6]:https://coreos.com/products/managed-linux/
|
65
published/Command Line Tuesdays – Part Five.md
Normal file
65
published/Command Line Tuesdays – Part Five.md
Normal file
@ -0,0 +1,65 @@
|
||||
命令行星期二——第五部分
|
||||
=========================================================
|
||||
对,你也许已经猜到了又是我们相见的时候了。这一次我们将会学习如何使用命令工作。因此,事不宜迟,我们直入正题吧。
|
||||
|
||||
肖茨先生指出,到现在为止,我们学习了一些神奇的命令及其参数和选项,而今天正是我们揭开他们那神秘面纱一角的一天。我们将会学习如下的一些命令及其作用:type, which, help和man。但是在此之前,我么先学习一下——
|
||||
|
||||
###什么是命令?###
|
||||
|
||||
我们可以将**命令**分为四个种类。
|
||||
|
||||
**1)可执行的程序:**命令可以是一个可执行程序。如果你在前面的课程中有遍历过你的系统,这也是你应该做的。你也许已经发现了/user/bin这个目录,你看到很多的像transmission-gtk, deluge-gtk等的名字。对我们新手来说,现在这些可以编译成二进制文件或者用脚本语言编写的可执行程序具体是什么并不太重要。重点是,他们是可执行文件,你可以运行它们。找到/user/bin这个目录,列出里面的文件,随便挑一个去运行它。
|
||||
|
||||
**2)shell内置命令:** bash提供了一系列的shell内置命令,例如,cd命令就是一个shell内置命令。
|
||||
|
||||
**3)shell函数:**内置于系统环境中的小型的shell脚本。现在我们简单的提及一下它,因为在后面的几个星期中我们将要学习它。
|
||||
|
||||
**4)别名:**你可以基于其他命令定义你自己的命令。我们也会在后面的课程中学习到。
|
||||
|
||||
现在,知道我们要处理的命令的哪一类是有意义的。我们可以使用**type**命令查看。
|
||||
|
||||
###type###
|
||||
|
||||
你可以使用**type + command**来查看你要使用的命令属于什么类型。你只要输入type command就可以得到命令类型的输出,如下:
|
||||
|
||||
![type mkdir](https://news.opensuse.org/wp-content/uploads/2014/07/Zaslonska-slika-2014-07-15-091448.png)
|
||||
|
||||
或者
|
||||
|
||||
![type ls](https://news.opensuse.org/wp-content/uploads/2014/07/Zaslonska-slika-2014-07-15-091640.png)
|
||||
|
||||
从上面例子可以看出‘ls’命令实际上是‘\_ls’的别名。(LCTT译注:不同机器上的别名定义可能不同,比如RedHat/Centos系列上,ls实际上是‘ls --color=auto’的别名,而这个‘\_ls’想必是openSUSE上的情况。)
|
||||
|
||||
###which###
|
||||
|
||||
有时(虽然在桌面系统中很少会出现这种情况),在一台机器中存在一个可执行程序的多个版本。为了找到某个可执行程序的准确位置,我们可以使用which命令。which命令只对可执行程序有用。
|
||||
|
||||
![which transmission-gtk](https://news.opensuse.org/wp-content/uploads/2014/07/Zaslonska-slika-2014-07-15-092052.png)
|
||||
|
||||
如今,多数的命令都会附带说明文档,因此,当你在没有网络的的情况下使用命令行时,你不能在论坛或者IRC上提问,但是你又必须要知道某个命令的准确用法。此时你有两种解决方法,第一个是——
|
||||
|
||||
###help###
|
||||
|
||||
help命令对shell内置命令有用(在上面的第二类中我们有提到过)。所以,你可以选择一个shell内置命令为例,如cd,简单的输入help cd即可。你会得到一个有用的页面,去试一下看cd为我们提供了什么功能。该页面列出了该命令的用法和可选项(选项列在方括号中,表明它们是可选的,如果方括号中有垂直分隔符分隔某些选项,则这些选项是互斥的,不要同时使用他们!)
|
||||
|
||||
###--help###
|
||||
|
||||
(LCTT译注:Linux上的命令中,通常单字符参数前使用一个破折号,而多个字符的长参数则使用两个破折号,原文此处用的是“-help”,实际上这种情况很少,所以修正为“--help”)
|
||||
|
||||
help只对shell内置命令有用。但是很多的可执行程序有--help选项。其作用类似于help命令,但是你必须在你要查看帮助的命令后输入 --help。例如,transmission-gtk --help。试一下看在改该可执行程序中有什么可选项可以使用。
|
||||
|
||||
###man###
|
||||
|
||||
多数的可执行程序都提供一个正式发说明文档。你可以使用man命令查看这份说明文档。试一下只输入man program,看有什么输出。在你的系统中随便找一个程序去尝试一下。例如,我们试一下man transmission-gtk。你会打开了一个由目录分割的文件。这个文件包含该程序是什么、做什么和你可以怎样去使用它等的信息。但是这个文件并没有提供使用范例,因为它不是一个指导手册。(LCTT译注,man里面有时候也会带有一些范例,但是往往不会很详细,另外还有一个info命令,通常能得到更多的使用帮助。不过真正理解每个命令的各种用户,还是要多查阅各种资料,并亲自试验才行。)
|
||||
|
||||
这周我们就到先讲这里了。
|
||||
|
||||
我想再花一分钟来感谢大家对本节的建议和贡献。是你们让这个系列的文章变得越来越好,我希望在你们的帮助下,我们这些新用户在夏季结束前可以使用基本的命令行工具。你们是最棒的。像我一样的新用户们,我们都会感到失落,坚持到底,我们的付出总会有回报的!
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
via: https://news.opensuse.org/2014/07/15/command-line-tuesdays-part-five/
|
||||
|
||||
译者:[cvsher](https://github.com/cvsher) 校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
@ -1,3 +1,4 @@
|
||||
nd0104 is translate
|
||||
Time to Upgrade: Ubuntu 13.10 Support Ends Today
|
||||
================================================================================
|
||||
![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/04/upgrade-available.jpg)
|
||||
|
@ -1,3 +1,4 @@
|
||||
[translating by KayGuoWhu]
|
||||
What are useful online tools for Linux
|
||||
================================================================================
|
||||
As you know, GNU Linux is much more than just an OS. There is literally a whole sphere on the Internet dedicated to the penguin OS. If you read this post, you are probably inclined towards reading about Linux online. Among all the pages that you can find on the subject, there are a couple of websites that every Linux adventurer should have in his bookmarks. These websites are more than just tutorials or reviews. They are real tools that you can access from anywhere and share with everyone. So today I shall propose you a non-exhaustive list of sixteen websites that should be in your bookmarks. Some of them can also be useful for Windows or Mac users: that's the extent of their reach.
|
||||
|
137
sources/talk/20140729 Don't Fear The Command Line.md
Normal file
137
sources/talk/20140729 Don't Fear The Command Line.md
Normal file
@ -0,0 +1,137 @@
|
||||
Don't Fear The Command Line
|
||||
================================================================================
|
||||
![](http://a4.files.readwrite.com/image/upload/c_fill,h_900,q_70,w_1600/MTE5NTU2MzIyNTM0NTg5OTYz.jpg)
|
||||
|
||||
> Embrace your computer's most useful tool.
|
||||
|
||||
You've probably seen it in movies, even if you haven't ever called it up on your own computer: a blank screen with a simple text prompt and a cursor, just waiting for you to enter the appropriate arcane commands to do your bidding.
|
||||
|
||||
This is the command line. It's a text-based interface that predates the far more familiar windows, icons and tiles of today's major computer operating systems, from Windows to Mac OS X to Linux.
|
||||
|
||||
The command line is an extremely powerful tool for accessing basic functions of your computer. For most people, it's also a confusing, complicated and seemingly irrelevant distraction. It doesn't have to be.
|
||||
|
||||
### Computers Under Your Command ###
|
||||
|
||||
Typing text instructions and hitting Return to get a computer to do something sounds like a major step back compared to the swipe-and-tap touch-sensitive interfaces of mobile devices. Even a toddler can use an iPad, right? Yet the command line can save you time and aggravation, if you know when to use it.
|
||||
|
||||
If you're serious about learning to code—or just understanding computer technology—you absolutely need to get to know your command line.
|
||||
|
||||
Diving into the command line will teach you a lot about how your computer works and organizes information. You might find that some tasks you perform every day with a mouse are actually faster when you type a command or two instead.
|
||||
|
||||
Most important, you’ll be better prepared to learn [languages like Python][1] and [programs like Git][2] that require some command-line setup. By getting familiar with the command line, you’ll break down barriers that may have kept you from learning to program in the past.
|
||||
|
||||
So here's a quick, basic guide to getting around on the command line. It's focused on Mac OS X's Unix-based environment, simply because that's what I'm familiar with. Linux users probably know the command line well already, although newcomers might also find these tips useful. If you're running a Chromebook, Google has some helpful instructions for getting to its [version of the command line][3], which is similar to Mac and Linux systems. Windows users, unfortunately, are stuck with a command language derived from MS-DOS that just barely overlaps with Unix, so this guide isn't going to be much use to you; you might check out [this dosprompt.info tutorial][4].
|
||||
|
||||
### How To Find Your Way Around ###
|
||||
|
||||
The very first thing you’ll need to do is figure out how to access the command line, which is typically done through a program called a "shell." On any Mac running OS X, you'll need to start the Terminal application. You can do this through the Finder (it's in the Utilities folder under Applications), or just click the magnifying glass in the upper right hand corner of your screen and type “terminal,” then select it from the drop-down.
|
||||
|
||||
![](http://a4.files.readwrite.com/image/upload/c_fit,w_630/MTE4MDAzNDE2ODYxMjc5NzU4.png)
|
||||
|
||||
You’re in, but all you see is a blank box with a space to type prompts. This is the command line! Let’s get to know this window a little bit better.
|
||||
|
||||
Type pwd, which stands for Print Working Directory. In computer parlance, “printing” something has nothing to do with paper. It really just means spitting it out on the screen. The command should result in the computer returning the directory you are currently working in.
|
||||
|
||||
![](http://a4.files.readwrite.com/image/upload/c_fit,w_630/MTIyMzk5Mjg5MDMzMjYyNjA0.png)
|
||||
|
||||
And indeed, /Users/laurenorsini is my home directory. Advanced tip: You can use the tilde symbol (~) as a shortcut for your home directory—it means the same thing as /Users/yourusername. So you can reference your Downloads subdirectory, for instance, as ~/Downloads. (If you look closely at the command prompt above, you'll see a tilde there. That indicates that I'm in my home directory.)
|
||||
|
||||
We don’t want to muddy up our main directory with all our command-line experimenting, so let’s make a new directory with the mkdir command. This is the same as creating a new folder on your desktop operating system. Let's call it "experiments":
|
||||
|
||||
![](http://a4.files.readwrite.com/image/upload/c_fit,w_630/MTE5NDg0MDYxMTMwODUxODU1.png)
|
||||
|
||||
Now we have a new directory. Using the graphic interface, we can visually verify that we actually created a new one. Sure enough, if I open the Finder and go into my home directory—here marked with a little house icon—I now see a folder named “experiments.” I made that on the command line! (The reverse works, too: You can create a folder on your desktop, and see it in the command line. They're just two different ways of looking at the same system.)
|
||||
|
||||
![](http://a5.files.readwrite.com/image/upload/c_fit,w_630/MTE5NTU2MzIyNTM0MzI3ODE5.png)
|
||||
|
||||
Now I need to change directories and enter the ~/experiments directory with the **cd** (change directory) command.
|
||||
|
||||
![](http://a5.files.readwrite.com/image/upload/c_fit,w_630/MTE5NDg0MDYxMTMxMTEzOTk5.png)
|
||||
|
||||
I have my command prompt on the default setting, so it automatically shows where my working directory is. But if yours looks different, here's how to make sure “experiments” is truly your working directory: type **pwd** again. It should tell you that your working directory is “experiments.”
|
||||
|
||||
### Getting Filed Away ###
|
||||
|
||||
I create and edit files on the command line every day that I code. It's faster than using the graphical user interface because I can test out my programs on the command line as soon as I finish editing them. And if I also happen to be pushing things to [GitHub][5] at the same time, well, it's even more convenient.
|
||||
|
||||
Now you have a new directory (also called a repository or folder) on your computer to mess around with. Let's start by creating a new file that contains only the words, "Hello World." There are a lot of ways to do this; here I'm using the echo command.
|
||||
|
||||
Now you have a new directory (also called a repository or folder) on your computer to mess around with. Let's start by creating a new file that contains only the words, "Hello World." There are a [lot of ways][6] to do this; here I'm using the **echo** command.
|
||||
|
||||
![](http://a2.files.readwrite.com/image/upload/c_fit,w_630/MTE5NDg0MDYxMjQxMjgwMDE1.png)
|
||||
|
||||
Oh no! I spelled "newfile" incorrectly. That happens. Let's fix it in two steps. First, I'll create a new file with the correct spelling...
|
||||
|
||||
![](http://a3.files.readwrite.com/image/upload/c_fit,w_630/MTIxNDI3Mjk0MjA5ODAzNzg5.png)
|
||||
|
||||
And then, I'll use the **mv** (move) command to replace my old, misspelled file with my new file. This always takes the form "**mv oldfile newfile**."
|
||||
|
||||
![](http://a1.files.readwrite.com/image/upload/c_fit,w_630/MTIxNDI3Mjk0MjA5NzM4MjUz.png)
|
||||
|
||||
A note about **mv**: like many commands, it's a deceptively powerful one. When we're "moving" newfil.txt into newfile.txt, what we're actually doing is completely overwriting the first file and replacing it with the second. So the text I wrote into newfil.txt is gone forever, replaced by what I wrote into newfile.txt.
|
||||
|
||||
To prove that I only have one file in my directory, I can use **ls** , the list command, to get a list of all the files in this directory.
|
||||
|
||||
![](http://a1.files.readwrite.com/image/upload/c_fit,w_630/MTIxNDI3Mjk0MTA3NTAyMDkz.png)
|
||||
|
||||
See? Just the one. And if I look inside the folder using my computer's graphical user interface, I can see the file there, too.
|
||||
|
||||
![](http://a3.files.readwrite.com/image/upload/c_fit,w_630/MTIyMzk5Mjg5MDM4OTY0MjM2.png)
|
||||
|
||||
But it's just a blank text file. Let's put something inside it using a text editor. On the command line, I tend to use the nano editor since it's simple and it works on just about every type of computer.
|
||||
|
||||
This should immediately bring up a new editing screen right inside your command line window. The basic commands are all laid out for you.
|
||||
|
||||
![](http://a3.files.readwrite.com/image/upload/c_fit,w_630/MTIyMzk5Mjg5MDM5NjE5NTk2.png)
|
||||
|
||||
Write what you want, and then exit with CTRL + X. If it asks you to save and you'd like to, type "Y."
|
||||
|
||||
![](http://a4.files.readwrite.com/image/upload/c_fit,w_630/MTIxNDI3Mjk0MTA4MDkxOTE3.png)
|
||||
|
||||
As you've probably guessed by now, it's possible to also see these changes by using the operating system and navigating to newfile.txt with your mouse. Here you can open and edit the file you've created in any text editor of your choice.
|
||||
|
||||
If you want to delete the file forever, do that with the **rm** (remove) command:
|
||||
|
||||
![](http://a2.files.readwrite.com/image/upload/c_fit,w_630/MTE5NTU2MzIyNTQxMzQwMTcx.png)
|
||||
|
||||
Keep in mind that the **rm** command is very powerful! A [common trick][7] on hacker forums is to convince a command-line newbie to type **rm -rf** / so she ends up deleting her whole computer. The "/" means the very top-level directory of your computer—and everything underneath it. NEVER type that command!
|
||||
|
||||
### Further Reading ###
|
||||
|
||||
This is just the beginning of the endless possibilities of the command line. You can use this tool to control every aspect of your computer, which is what makes it as dangerous as it is powerful. Make sure to always read up on new command-line prompts before you use them, and never blindly input a prompt that a stranger suggests to you online.
|
||||
|
||||
I've outlined the commands I use every day so I can code, but there are a lot more reasons to master the command line than that. If you're looking for a more thorough overview, you might want to try:
|
||||
|
||||
[The Command Line Crash Course][8]. A free, extended course that covers the basics of command line usage.
|
||||
|
||||
[A Command Line Primer For Beginners][9]. Lifehacker’s collection of helpful commands for first time users.
|
||||
|
||||
[Introduction to the Mac OS X Command Line][10]. Online-education site Treehouse covers the very basics in extreme detail.
|
||||
|
||||
Now that you've finished reading, you're better prepared for any code tutorial I've written in the past, since it's impossible to do any of them without typing in some commands. If you're ready to go, I suggest you check out ReadWrite's [Git tutorial][11], which utilizes the command line to introduce you to collaborative coding. Happy computing!
|
||||
|
||||
*Lead photo by [Jason Scott][12]; all other screenshots by Lauren Orsini for ReadWrite*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://readwrite.com/2014/07/18/command-line-tutorial-intro
|
||||
|
||||
作者:[Lauren Orsini][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://readwrite.com/author/lauren-orsini
|
||||
[1]:http://readwrite.com/2014/07/08/what-makes-python-easy-to-learn
|
||||
[2]:http://readwrite.com/2013/09/30/understanding-github-a-journey-for-beginners-part-1
|
||||
[3]:http://www.chromium.org/chromium-os/poking-around-your-chrome-os-device
|
||||
[4]:http://dosprompt.info/
|
||||
[5]:http://www.github.com/
|
||||
[6]:http://www.cyberciti.biz/faq/unix-create-file-from-terminal-window-shell-prompt/
|
||||
[7]:http://www.urbandictionary.com/define.php?term=rm+-rf+%2F
|
||||
[8]:http://cli.learncodethehardway.org/book/
|
||||
[9]:http://lifehacker.com/5633909/who-needs-a-mouse-learn-to-use-the-command-line-for-almost-anything
|
||||
[10]:http://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line
|
||||
[11]:http://readwrite.com/2013/09/30/understanding-github-a-journey-for-beginners-part-1
|
||||
[12]:http://en.wikipedia.org/wiki/Computer_terminal#mediaviewer/File:DEC_VT100_terminal.jpg
|
@ -1,3 +1,5 @@
|
||||
alim0x translating
|
||||
|
||||
The history of Android
|
||||
================================================================================
|
||||
![From left to right: Android 0.9’s home screen, add drawer, and shortcut deletion interfaces.](http://cdn.arstechnica.net/wp-content/uploads/2013/12/09hom2e.png)
|
||||
@ -61,4 +63,4 @@ via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-histor
|
||||
[1]:http://arstechnica.com/information-technology/2008/08/robotripping-hands-on-with-the-android-sdk-beta/
|
||||
[2]:http://www.tat.se/
|
||||
[a]:http://arstechnica.com/author/ronamadeo
|
||||
[t]:https://twitter.com/RonAmadeo
|
||||
[t]:https://twitter.com/RonAmadeo
|
||||
|
@ -1,8 +1,9 @@
|
||||
Get OpenVPN up and running, enjoy your privacy
|
||||
2q1w2007翻译中
|
||||
搭建并运行OpenVPN,享受你的隐私生活
|
||||
================================================================================
|
||||
![](http://parabing.com/assets/uploads/2014/06/openVPN-featured.jpg)
|
||||
|
||||
> We are fanatic supporters of privacy. Not so much because we have super secrets to hide, but because we consider privacy as a basic human right. So we believe that anytime anyone chooses to exercise that right on the net, then they should have unencumbered access to all the necessary tools and services. OpenVPN is such a service and there are also many tools (clients) which allow us to utilize and enjoy that service.
|
||||
> 我们支持保护隐私,不为我们有自己的秘密需要保护,只是我们认为保护隐私应该成为一项基本人权。所以我们坚信无论谁在什么时候行使这项权利,都应该不受拘束的获取必须的工具和服务。OpenVPN就是这样一种服务并且有多种工具(客户端) 来让我们利用并享受这种服务。
|
||||
|
||||
By establishing a connection to an [OpenVPN][1] server, we basically create a secure communications channel between our device and the remote host OpenVPN runs on. Although traffic flowing between these two end-points can be intercepted, it is strongly encrypted and thus practically useless to the interceptor. In addition to the OpenVPN acting as the facilitator of this encrypted channel (or tunnel), we may configure the server to also play the role of our Internet gateway. By doing so, we can for example hook up to any open, inherently insecure WiFi network, then immediately connect to the remote OpenVPN server and start using any Internet-enabled application without worrying of prying eyes or bored administrators. (Note though that we still need to trust any administrator in the vicinity of the OpenVPN server. But more on that towards the end of the post.)
|
||||
|
||||
@ -496,4 +497,4 @@ via: http://parabing.com/2014/06/openvpn-on-ubuntu/
|
||||
[6]:https://itunes.apple.com/us/app/openvpn-connect/id590379981?mt=8
|
||||
[7]:https://play.google.com/store/apps/details?id=net.openvpn.openvpn
|
||||
[8]:http://www.whatip.com/
|
||||
[9]:https://dnsleaktest.com/
|
||||
[9]:https://dnsleaktest.com/
|
||||
|
@ -1,103 +0,0 @@
|
||||
2q1w2007翻译中
|
||||
Wine 1.7.21 (Development Version) Released – Install in RedHat and Debian Based Systems
|
||||
================================================================================
|
||||
Wine, a most popular and powerful open source application for Linux, that used to run Windows based applications and games on Linux Platform without any trouble.
|
||||
|
||||
![Install Wine (Development Version) in Linux](http://www.tecmint.com/wp-content/uploads/2014/05/Install-Wine-Development-Version.png)
|
||||
Install Wine (Development Version) in Linux
|
||||
|
||||
**WineHQ** team, recently announced a new development version of **Wine 1.7.21**. This new development build arrives with a number of new important features and bug fixes.
|
||||
|
||||
Wine team, keep releasing their development builds almost on weekly basis and adding numerous new features and fixes. Each new version brings support for new applications and games, making Wine a most popular and must have tool for every user, who want to run Windows based software in a Linux platform.
|
||||
|
||||
According to the changelog, following key features are added in this release:
|
||||
|
||||
- Added support for critical sections in the C runtime.
|
||||
- The Unicode data updated to Unicode 7.
|
||||
- Implemented support for interlaced PNG encoding.
|
||||
- Added an initial stub for the Package library.
|
||||
- And several bug fixes have been implemented.
|
||||
|
||||
For more in-depth details about this build can be found at the official [changelog][1] page.
|
||||
|
||||
This article guides you how to install most recent development version of **Wine 1.7.21** on **Red Hat** and **Debian** based systems such as CentOS, Fedora, Ubuntu, Linux Mint and other supported distributions.
|
||||
|
||||
### Installing Wine 1.7.21 Development Version in Linux ###
|
||||
|
||||
Unfortunately, there are no official Wine repository available for the **Red Hat** based systems and the only way to install Wine, is to compile it from source. To do this, you need to install some dependency packages such as gcc, flex, bison, libX11-devel freetype-devel and Development Tools, etc. These packages are must required to compile Wine from source. Let’s install them using following **YUM** command.
|
||||
|
||||
#### On RedHat, Fedora and CentOS ####
|
||||
|
||||
# yum -y groupinstall 'Development Tools'
|
||||
# yum -y install flex bison libX11-devel freetype-devel
|
||||
|
||||
Next, download the latest development version of Wine (i.e. **1.7.21**) and extract the source tallball package using the following commands.
|
||||
|
||||
$ cd /tmp
|
||||
$ wget http://citylan.dl.sourceforge.net/project/wine/Source/wine-1.7.21.tar.bz2
|
||||
$ tar -xvf wine-1.7.21.tar.bz2 -C /tmp/
|
||||
|
||||
Now, it’s time to compile and build Wine installer using the following commands as normal user. (**Note**: The installation process might take up-to **15-20** minutes depending upon your internet and hardware speed, during installation it will ask you to enter **root** password.
|
||||
|
||||
**On 32-Bit Systems**
|
||||
|
||||
$ cd wine-1.7.21/
|
||||
$ ./tools/wineinstall
|
||||
|
||||
**On 64-Bit Systems**
|
||||
|
||||
$ cd wine-1.7.21/
|
||||
$ ./configure --enable-win64
|
||||
$ make
|
||||
# make install
|
||||
|
||||
#### On Ubuntu, Debian and Linux Mint ####
|
||||
|
||||
Under **Ubuntu** based systems, you can easily install the latest development build of Wine using the official **PPA**. Open a terminal and run the following commands with sudo privileges.
|
||||
|
||||
$ sudo add-apt-repository ppa:ubuntu-wine/ppa
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install wine 1.7 winetricks
|
||||
|
||||
**Note**: At the time of writing this article, available version was **1.7.20** and the new build not yet updated in official Wine Repository, but the above instructions will install **1.7.21** when they made available.
|
||||
|
||||
Once the installation completes successfully, you can install or run any windows based applications or games using wine as shown below.
|
||||
|
||||
$ wine notepad
|
||||
$ wine notepad.exe
|
||||
$ wine c:\\windows\\notepad.exe
|
||||
|
||||
**Note**: Please remember, this is a development build and cannot be installed or used on production systems. It is advised to use this version only for testing purpose.
|
||||
|
||||
If you’re looking for a most recent stable version of Wine, you can go through our following articles, that describes how to install most latest version on almost all Linux environments.
|
||||
|
||||
- [Install Wine 1.6.2 (Stable) in RHEL, CentOS and Fedora][2]
|
||||
- [Install Wine 1.6.2 (Stable) in Debian, Ubuntu and Mint][3]
|
||||
|
||||
### Reference Links ###
|
||||
|
||||
- [WineHQ Homepage][4]
|
||||
|
||||
----------
|
||||
|
||||
![](http://1.gravatar.com/avatar/7badddbc53297b2e8ed7011cf45df0c0?s=80&d=blank&r=G)
|
||||
|
||||
#### Ravi Saive ####
|
||||
|
||||
Owner at [TecMint.com][5]
|
||||
|
||||
Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/install-wine-in-linux/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.winehq.org/announce/1.7.21
|
||||
[2]:http://www.tecmint.com/install-wine-in-rhel-centos-and-fedora/
|
||||
[3]:http://www.tecmint.com/install-wine-on-ubuntu-and-linux-mint/
|
||||
[4]:http://www.winehq.org/
|
||||
[5]:http://www.tecmint.com/
|
@ -1,3 +1,4 @@
|
||||
[bazz2 hehe]
|
||||
How to use systemd for system administration on Debian
|
||||
================================================================================
|
||||
Soon enough, hardly any Linux user will be able to escape the ever growing grasp that systemd imposes on Linux, unless they manually opt out. systemd has created more technical, emotional, and social issues than any other piece of software as of late. This predominantly came to show in the [heated discussions][1] also dubbed as the 'Init Wars', that occupied parts of the Debian developer body for months. While the Debian Technical Comittee finally decided to include systemd in Debian 8 "Jessie", there were efforts to [supersede the decision][2] by a General Resolution, and even threats to the health of developers in favor of systemd.
|
||||
@ -103,4 +104,4 @@ via: http://xmodulo.com/2014/07/use-systemd-system-administration-debian.html
|
||||
[1]:https://lists.debian.org/debian-devel/2013/10/msg00444.html
|
||||
[2]:https://lists.debian.org/debian-devel/2014/02/msg00316.html
|
||||
[3]:http://0pointer.de/blog/projects/systemd.html
|
||||
[4]:http://www.freedesktop.org/wiki/Software/systemd/
|
||||
[4]:http://www.freedesktop.org/wiki/Software/systemd/
|
||||
|
@ -1,89 +0,0 @@
|
||||
translating by cvsher
|
||||
Command Line Tuesdays – Part Five
|
||||
================================================================================
|
||||
Yes, you’ve guessed what time it is! It’s time to rrrrrrrrummmbleeeee! And this time, we’ll learn how to work with commands. So without further ado, let’s get to business.
|
||||
|
||||
Mr Shotts states that until now, we worked with a few mysterious commands, arguments and options, and today is the day we shed a little light upon that mystery. We’ll learn the following commands and what they do: type, which, help and man. But first, let’s learn…
|
||||
|
||||
### …what are commands? ###
|
||||
|
||||
All great things come in fours, and it’s the same with commands. We can split them up into four categories:
|
||||
|
||||
**1) An executable program:** a command can be an executable program. If you’ve ‘traveled’ across your file system in the previous lessons like you were supposed to, you probably visited the /usr/bin folder. You’ve seen quite a number of familiar names like transmission-gtk, deluge-gtk etc. What’s less important for us novices currently is that programs there can be compiled binaries or programs written in scripting languages. Point is, since they are executable programs, you can run them. Try it. Navigate to it, list the files inside, pick one and run it simply by typing its name.
|
||||
|
||||
**2) A command built into the shell:** bash provides a number of commands internally called shell builtins. The cd command, for example, is a shell builtin, mr Shotts says.
|
||||
|
||||
**3) A shell function:** miniature shell script, built into the environment. For the time being, we’ll just mention it, as it will be covered in the following weeks.
|
||||
|
||||
**4) An alias:** commands you can define yourself, using other commands. Also coming in the following lessons.
|
||||
|
||||
Now, it’s useful to know what type of command we’re dealing with. And we can find out using…
|
||||
|
||||
### …type ###
|
||||
|
||||
You can use **type + command** to inspect what kind of command is the command you’d like to use. You do it by simply typing: type command and you’ll get an output. For example:
|
||||
|
||||
![type mkdir](https://news.opensuse.org/wp-content/uploads/2014/07/Zaslonska-slika-2014-07-15-091448.png)
|
||||
|
||||
or
|
||||
|
||||
![type ls](https://news.opensuse.org/wp-content/uploads/2014/07/Zaslonska-slika-2014-07-15-091640.png)
|
||||
|
||||
…where we can see that the ‘ls’ command is actually an alias of ‘_ls’!
|
||||
|
||||
### which ###
|
||||
|
||||
Sometimes (but rarely on a desktop system, though) there are more versions of one executable installed on a machine. To find out the exact location of a given executable, we can use command which. Additionally, it only works with executable programs.
|
||||
|
||||
![which transmission-gtk](https://news.opensuse.org/wp-content/uploads/2014/07/Zaslonska-slika-2014-07-15-092052.png)
|
||||
|
||||
Now, mostly every command has documentation that comes with it. So you’re somewhere doing your CLI thing, no access to the internet so you can’t bug geekos on the forums or IRC, and you need to find out how to exactly use a command. You can do it two ways. First being…
|
||||
|
||||
### …help ###
|
||||
|
||||
help command works with shell builtins (the second category we have mentioned above). So you can pick a shell builtin, like cd, for example, and simply type help cd. You’ll get a helpful page printed out in your terminal, so go ahead and read what cd has to offer. It shows in what ways you can use the command, what options you can use (it’s in square brackets, which means they are optional! Also, if there’s a vertical separator inside the square brackets, it means the options mentioned are mutually exclusive. Don’t use them together!)
|
||||
|
||||
### –help ###
|
||||
|
||||
help works only for the shell builtins. But most executables work with –help. As far as usage goes, it’s similar to help, but you have to type –help after the command you want to inspect. For example, transmission-gtk –help. Try it out, and see what options you can use with that executable etc.
|
||||
|
||||
### man ###
|
||||
|
||||
Most executables come with a formal documentation page. You can inspect it using the man command. You just enter man program, and see what it prints out. Pick any program on your computer, and try it out. For example, let’s try man transmission-gtk. You get a file opened, split into categories. It gives you information what the program is, what it does, how you can use it etc., but it doesn’t offer examples, as it’s not a tutorial.
|
||||
|
||||
And we’re stoping to a halt there.
|
||||
|
||||
I’d like to take a minute and thank everyone commenting and contributing to this section. You make this series vastly better, and I hope that with your help, us noobs will be able to use the CLI basics by the end of summer (just in time for 13.2 :) ). You guys are the best. Newbie users like me, who are feeling lost, stick with it. It will pay off in the end!
|
||||
|
||||
And I’d also like to add a formal heads up: part six will not come next Tuesday, as I’ll sadly be away, so we’ll see/hear each other in 14 days, on July 29th. And until then…
|
||||
|
||||
### …have a lot of fun! ###
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.opensuse.org/2014/07/15/command-line-tuesdays-part-five/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:
|
||||
[2]:
|
||||
[3]:
|
||||
[4]:
|
||||
[5]:
|
||||
[6]:
|
||||
[7]:
|
||||
[8]:
|
||||
[9]:
|
||||
[10]:
|
||||
[11]:
|
||||
[12]:
|
||||
[13]:
|
||||
[14]:
|
||||
[15]:
|
||||
[16]:
|
||||
[17]:
|
||||
[18]:
|
||||
[19]:
|
||||
[20]:
|
@ -1,3 +1,4 @@
|
||||
nd0104 is translate
|
||||
Install Google Docs on Linux with Grive Tools
|
||||
================================================================================
|
||||
Google Drive is two years old now and Google’s cloud storage solution seems to be still going strong thanks to its integration with Google Docs and Gmail. There’s one thing still missing though: a lack of an official Linux client. Apparently Google has had one floating around their offices for a while now, however it’s not seen the light of day on any Linux system.
|
||||
|
@ -0,0 +1,131 @@
|
||||
10 Useful “Squid Proxy Server” Interview Questions and Answers in Linux
|
||||
================================================================================
|
||||
It’s not only to System Administrator and Network Administrator, who listens the phrase Proxy Server every now and then but we too. Proxy Server is now a corporate culture and is the need of the hour. Proxy server now a days is implemented from small schools, cafeteria to large MNCs. Squid (also known as proxy) is such an application which acts as proxy server and one of the most widely used tool of its kind.
|
||||
|
||||
This Interview article aims at strengthening your base from Interview point on the ground of proxy server and squid.
|
||||
|
||||
![Squid Interview Questions](http://www.tecmint.com/wp-content/uploads/2014/07/Squid-Interview-Questions.png)
|
||||
Squid Interview Questions
|
||||
|
||||
### 1. What do you mean by Proxy Server? What is the use of Proxy Server in Computer Networks? ###
|
||||
|
||||
> **Answer** : A Proxy Server refers to physical machine or Application which acts intermediate between client and resource provider or server. A client seeks for file, page or data from the the proxy server and proxy server manages to get the requested demand of client fulfilled by handling all the complexities in between.
|
||||
|
||||
Proxy servers are the backbone of WWW (World Wide Web). Most of the proxies of today are web proxies. A proxy server handles the complexity in between the Communication of client and Server. Moreover it provides anonymity on the web which simply means your identity and digital footprints are safe. Proxies can be configured to allow which sites client can see and which sites are blocked.
|
||||
|
||||
### 2. What is Squid? ###
|
||||
|
||||
> **Answer** : Squid is an Application software released under GNU/GPL which acts as a proxy server as well as web cache Daemon. Squid primarily supports Protocol like HTTP and FTP however other protocols like HTTPS, SSL,TLS, etc are well supported. The feature web cache Daemon makes web surfing faster by caching web and DNS for frequently visited websites. Squid is known to support all major platforms including Linux, UNIX, Microsoft Windows and Mac.
|
||||
|
||||
### 3. What is the default port of squid and how to change its operating port? ###
|
||||
|
||||
> **Answer** : The default port on which squid runs is 3128. We can change the operating port of squid from default to any custom unused port by editing its configuration file which is located at /etc/squid/squid.conf as suggested below.
|
||||
|
||||
Open ‘/etc/squid/squid.conf’ file and with your choice of editor.
|
||||
|
||||
# nano /etc/squid/squid.conf
|
||||
|
||||
Now change this port to any other unused port. Save the editor and exit.
|
||||
|
||||
http_port 3128
|
||||
|
||||
Restart the squid service as shown below.
|
||||
|
||||
# service squid restart
|
||||
|
||||
### 4. You works for a company the management of which ask you to block certain domains through squid proxy server. What are you going to do? ###
|
||||
|
||||
> **Answer** : Blocking domain is a module which is implemented well in the configuration file. We just need to perform a little manual configuration as suggested below.
|
||||
|
||||
a. Create a file say ‘blacklist’ under directory ‘/etc/squid’.
|
||||
|
||||
# touch /etc/squid/blacklist
|
||||
|
||||
b. Open the file ‘/etc/squid/blacklist’ with nano editor.
|
||||
|
||||
# nano /etc/squid/blacklist
|
||||
|
||||
c. Add all the domains to the file blacklist with one domain per line.
|
||||
|
||||
.facebook.com
|
||||
.twitter.com
|
||||
.gmail.com
|
||||
.yahoo.com
|
||||
...
|
||||
|
||||
d. Save the file and exit. Now open the Squid configuration file from location ‘/etc/squid/squid.conf’.
|
||||
|
||||
# nano /etc/squid/squid.conf
|
||||
|
||||
e. Add the lines below to the Squid configuration file.
|
||||
|
||||
acl BLACKLIST dstdom_regex -i “/etc/squid/blacklist”
|
||||
http_access deny blacklist
|
||||
|
||||
f. Save the configuration file and exit. Restart Squid service to make the changes effective.
|
||||
|
||||
# service squid restart
|
||||
|
||||
### 5. What is Media Range Limitation and partial download in Squid? ###
|
||||
|
||||
> **Answer** : Media Range Limitation is a special feature of squid in which just the required data is requested from the server and not the whole file. This feature is very well implemented in various videos streaming websites like Youtube and Metacafe where a user can click on the middle of progress bar hence whole video need not be fetched except for the requested part.
|
||||
|
||||
The squid’s feature of partial download is implemented well within windows update where downloads are requested in the form of small packets which can be paused. Because of this feature a update downloading windows machine can be restarted without any fear of data loss. Squid makes the Media Range Limitation and Partial Download possible only after storing a copy of whole data in it. Moreover the partial download gets deleted and not cached when user points to another page until Squid is specially configured somehow.
|
||||
|
||||
### 6. What is reverse proxy in squid? ###
|
||||
|
||||
> **Answer** : Reverse proxy is a feature of Squid which is used to accelerate the web surfing for end user. Say the Real server ‘RS’ contains the resource and ‘PS’ is the proxy Server. The client seek some data which is available at RS. It will rely on RS for the specified data for the first time and the copy of that specified data gets stored on PS for configurable amount of time. For every request for that data from now PS becomes the real source. This results in Less traffic, Lesser CPU usages, Lesser web resource utilization and hence lesser load to actual server RS. But RS has no statistics for the total traffic since PS acted as actual server and no Client reached RS. ‘X-Forwarded-For HTTP’ can be used to log the client IP although on RS.
|
||||
|
||||
Technically it is feasible to use single squid server to act both as normal proxy server and reverse proxy server at the same point of time.
|
||||
|
||||
### 7. Since Squid can be used as web-cache Daemon, is it possible to Clear its Cache? How? ###
|
||||
|
||||
> **Answer** : No Doubt! Squid acts as web-cache Daemon which is used to accelerate web surfing still it is possible to clear its cache and that too very easily.
|
||||
|
||||
a. First stop Squid proxy server and delete cache from the location ‘/var/lib/squid/cache’ directory.
|
||||
|
||||
# service squid stop
|
||||
# rm -rf /var/lib/squid/cache/*<
|
||||
|
||||
b. Create Swap directories.
|
||||
|
||||
# squid -z
|
||||
|
||||
### 8. A client approaches you, who is working. They want the web access time be restricted for their children. How will you achieve this scenario? ###
|
||||
|
||||
Say the web access allow time be 4′o clock to 7′o clock in the evening for three hours, sharply form Monday to Friday.
|
||||
|
||||
a. To restrict web access between 4 to 7 from Monday to Friday, open the Squid configuration file.
|
||||
|
||||
# nano /etc/squid/squid.conf
|
||||
|
||||
b. Add the following lines and save the file and exit.
|
||||
|
||||
acl ALLOW_TIME time M T W H F 16:00-19:00
|
||||
shttp_access allow ALLOW_TIME
|
||||
|
||||
c. Restart the Squid Service.
|
||||
|
||||
# service squid restart
|
||||
|
||||
### 9. Squid stores data in which file format? ###
|
||||
|
||||
> **Answer** : Data stored by Squid is in ufs format. Ufs is the old well-known Squid storage format.
|
||||
|
||||
### 10. Where do cache gets stored by squid? ###
|
||||
|
||||
> **Answer** : A squid stores cache in special folder at the location ‘/var/spool/squid’.
|
||||
|
||||
That’s all for now. I’ll be here again with another interesting article soon. Till then stay tuned and connected to Tecmint. Don’t forget to provide us with your valuable feedback the comment section below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/squid-interview-questions/
|
||||
|
||||
作者:[Avishek Kumar][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/avishek/
|
@ -0,0 +1,44 @@
|
||||
How To Easily Install Tor Browser In Ubuntu 14.04 And Linux Mint 17
|
||||
================================================================================
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/Tor_Browser_Ubuntu.jpeg)
|
||||
|
||||
Keeping all the fiasco of [NSA snooping on citizens and governments worldwide][1] in mind, privacy is a growing concern for many. If you too are concerned about your online safety and want to protect yourself from network surveillance, [Tor project][2] is the best option available.
|
||||
|
||||
Tor Project has its own [Tor browser][3] which is based on Firefox and configured to protect users’ privacy and anonymity by using Tor and [Vidalia][4] tools that come bundled with it. Though you can [download Tor browser and install it from the source code][5], we shall see an easier way to install Tor browser in Ubuntu 14.04 and Linux Mint 17.
|
||||
|
||||
### How to install Tor browser in Ubuntu 14.04 and Linux Mint 17 ###
|
||||
|
||||
Thanks to [Webupd8][6], we have a PPA that we can use to install Tor browser in Ubuntu and other Ubuntu based Linux OSes easily (if you are not comfortable installing from source code). Open a terminal (Ctrl+Alt+T) and use the following commands:
|
||||
|
||||
sudo add-apt-repository ppa:webupd8team/tor-browser
|
||||
sudo apt-get update
|
||||
sudo apt-get install tor-browser
|
||||
|
||||
The above PPA should also be valid for Ubuntu 12.04 and other Linux distributions based on it.
|
||||
|
||||
#### Uninstall Tor browser ####
|
||||
|
||||
If you want to uninstall Tor browser, use the following command:
|
||||
|
||||
sudo apt-get remove tor-browser
|
||||
rm -r ~/.tor-browser-en
|
||||
|
||||
I hope this quick test helped you to **easily install Tor browser in Ubuntu 14.04 and Linux Mint 17**. Any questions or suggestions are always welcomed.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://itsfoss.com/install-tar-browser-ubuntu-linux-mint-17/
|
||||
|
||||
作者:[Abhishek][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://itsfoss.com/author/Abhishek/
|
||||
[1]:http://projects.propublica.org/nsa-grid/
|
||||
[2]:https://www.torproject.org/
|
||||
[3]:https://www.torproject.org/projects/torbrowser.html.en
|
||||
[4]:https://www.torproject.org/projects/vidalia.html.en
|
||||
[5]:https://www.torproject.org/projects/torbrowser.html.en#linux
|
||||
[6]:http://www.webupd8.org/
|
@ -0,0 +1,96 @@
|
||||
How to access Linux command cheat sheets from the command line
|
||||
================================================================================
|
||||
The power of Linux command line is its flexibility and versatility. Each Linux command comes with its share of command line options and parameters. Mix and match them, and even chain different commands with pipes and redirects. You get yourself literally hundreds of use cases even with a few basic commands, and it's hard even for seasoned system admins to get used to them all. That's when command line cheat sheets come to our rescue.
|
||||
|
||||
[![](https://farm6.staticflickr.com/5562/14752051134_5a7c3d2aa4_z.jpg)][1]
|
||||
|
||||
I know man pages are still our best friend, but we want to be efficient and strategic by having quick reference cards at our disposal. Your ultimate cheet sheets could be hanging on your office wall with pride, or secretly stored in your hard drive as PDF files, or even be the background image on your desktop.
|
||||
|
||||
Alternatively, use yet(!) another command to access your favorite command line cheat sheets. That is, use [cheat][2]. Which is a command line tool allowing you to access, create or update cheat sheets from the command line. The concept is really simple, yet cheat turns out to be quite useful. This tutorial is about how to use cheat command on Linux. You don't need a cheat sheet for using cheat command. It's that simple.
|
||||
|
||||
### Installing Cheat on Linux ###
|
||||
|
||||
First install Git if you haven't:
|
||||
|
||||
$ sudo apt-get install git (Debian-based system)
|
||||
$ sudo yum install git (RedHat-based system)
|
||||
|
||||
Also install [Python package installer pip[3].
|
||||
|
||||
Finally, install cheat using the following commands.
|
||||
|
||||
$ sudo pip install docopt pygments
|
||||
$ git clone https://github.com/chrisallenlane/cheat.git
|
||||
$ cd cheat
|
||||
$ sudo python setup.py install
|
||||
|
||||
### Configuring Cheat ###
|
||||
|
||||
There is not much to configure for cheat command.
|
||||
|
||||
One thing to recommend is to enable command-line autocompletion. That way, when you look up a cheat sheet, you can use [TAB] key to auto-complete the name of the command you want to check. Here is how to enable autocompletion for bash.
|
||||
|
||||
$ wget https://github.com/chrisallenlane/cheat/raw/master/cheat/autocompletion/cheat.bash
|
||||
$ sudo cp cheat.bash /etc/bash_completion.d/
|
||||
|
||||
They provide autocompletion scripts for other shells such as zsh and fish as well.
|
||||
|
||||
Another thing is to define an EDITOR environment variable. This variable should point to a text editor that you want to use when creating or updating a cheat sheet. For example, if you want to use Vim editor, put the following in ~/.bashrc.
|
||||
|
||||
export EDITOR=/usr/bin/vim
|
||||
|
||||
Log out and log back in to activate autocompletion and updated .bashrc.
|
||||
|
||||
### Basic Usage of Cheat ###
|
||||
|
||||
One cool thing about the cheat command is that it comes with pre-built cheat sheets for more than 90 popular Linux commands. To get a list of available cheat sheets:
|
||||
|
||||
$ cheat -l
|
||||
|
||||
![](https://farm3.staticflickr.com/2932/14754370585_7133cbbc8c_z.jpg)
|
||||
|
||||
To access a cheat sheet of a specific command, simply run cheat with the name of the command:
|
||||
|
||||
$ cheat <command-name>
|
||||
|
||||
![](https://farm4.staticflickr.com/3899/14567722899_8b86c312ca_z.jpg)
|
||||
|
||||
You can search all the cheat sheets that contain a specific keyword by using "-s" option:
|
||||
|
||||
$ cheat -s <keyword>
|
||||
|
||||
In many cases, cheat sheets that are useful to some folks may not that helpful to others. To personalize pre-built cheat sheets, cheat command allows you to create a new cheat sheet or update existing ones. To do so, cheat command can keep local copies of cheat sheets in ~/.cheat directory.
|
||||
|
||||
To take advantage of cheat's editing feature, first make sure that the EDITOR environment variable is set to the full path of your default text editor. Then copy (non-editable) built-in cheat sheets to ~/.cheat directory. You can find where the built-in cheat sheets are by running the following command. Once you know where they are, simply copy them over to ~/.cheat directory.
|
||||
|
||||
$ cheat -d
|
||||
|
||||
----------
|
||||
|
||||
/usr/lib/python2.6/site-packages/cheat/cheatsheets
|
||||
|
||||
----------
|
||||
|
||||
$ cp /usr/lib/python2.6/site-packages/cheat/cheatsheets/* ~/.cheat
|
||||
|
||||
Now you can create or update a cheat sheet by using "-e" option:
|
||||
|
||||
$ cheat -e openssl
|
||||
|
||||
As you can imagine, the cheat's editing feature is very useful to tailor a local cheat sheet repository to meet your needs. If you believe in sharing knowledge, you are more than welcome to contribute your cheat sheets to the cheat command's [official Git repository][4], so everyone can benefit from them.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/2014/07/access-linux-command-cheat-sheets-command-line.html
|
||||
|
||||
作者:[Dan Nanni][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://xmodulo.com/author/nanni
|
||||
[1]:http://xkcd.com/1168/
|
||||
[2]:https://github.com/chrisallenlane/cheat
|
||||
[3]:http://ask.xmodulo.com/install-pip-linux.html
|
||||
[4]:https://github.com/chrisallenlane/cheat
|
131
sources/tech/20140729 How to use awk command in Linux.md
Normal file
131
sources/tech/20140729 How to use awk command in Linux.md
Normal file
@ -0,0 +1,131 @@
|
||||
How to use awk command in Linux
|
||||
================================================================================
|
||||
Text processing is at the heart of Unix. From pipes to the /proc subsystem, the "everything is a file" philosophy pervades the operating system and all of the tools built for it. Because of this, getting comfortable with text-processing is one of the most important skills for an aspiring Linux system administrator, or even any power user, and awk is one of the most powerful text-processing tools available outside general-purpose programming languages.
|
||||
|
||||
The simplest awk task is selecting fields from stdin; if you never learn any more about awk than this, you'll still have at your disposal an extremely useful tool.
|
||||
|
||||
By default, awk separates input lines by whitespace. If you'd like to select the first field from input, you just need to tell awk to print out $1:
|
||||
|
||||
$ echo 'one two three four' | awk '{print $1}'
|
||||
|
||||
> one
|
||||
|
||||
(Yes, the curly-brace syntax is a little weird, but I promise that's about as weird as it gets in this lesson.)
|
||||
|
||||
Can you guess how you'd select the second, third, or fourth fields? That's right, with $2, $3, and $4, respectively.
|
||||
|
||||
$ echo 'one two three four' | awk '{print $3}'
|
||||
|
||||
(Yes, the curly-brace syntax is a little weird, but I promise that's about as weird as it gets in this lesson.)
|
||||
|
||||
Can you guess how you'd select the second, third, or fourth fields? That's right, with $2, $3, and $4, respectively.
|
||||
|
||||
$ echo 'one two three four' | awk '{print $3}'
|
||||
|
||||
> three
|
||||
|
||||
Often when text munging, you need to create a specific format of data, and that covers more than just a single word. The good news is that awk makes it easy to print multiple fields, or even include static strings:
|
||||
|
||||
$ echo 'one two three four' | awk '{print $3,$1}'
|
||||
|
||||
> three one
|
||||
|
||||
----------
|
||||
|
||||
$ echo 'one two three four' | awk '{print "foo:",$3,"| bar:",$1}'
|
||||
|
||||
> foo: three | bar: one
|
||||
|
||||
Ok, but what if your input isn't separated by whitespace? Just pass awk the '-F' flag with your separator:
|
||||
|
||||
$ echo 'one mississippi,two mississippi,three mississippi,four mississippi' | awk -F , '{print $4}'
|
||||
|
||||
> four mississippi
|
||||
|
||||
Occasionally, you may find yourself working with data with a varied number of fields, and you just know you want the *last* one. awk prepopulates the $NF variable with the *number of fields*, so you can use it to grab the last element:
|
||||
|
||||
$ echo 'one two three four' | awk '{print $NF}'
|
||||
|
||||
> four
|
||||
|
||||
You can also do simple math on $NF, in case you need the next-to-last field:
|
||||
|
||||
$ echo 'one two three four' | awk '{print $(NF-1)}'
|
||||
|
||||
> three
|
||||
|
||||
Or even the middle field:
|
||||
|
||||
$ echo 'one two three four' | awk '{print $((NF/2)+1)}'
|
||||
|
||||
> three
|
||||
|
||||
$ echo 'one two three four five' | awk '{print $((NF/2)+1)}'
|
||||
|
||||
> three
|
||||
|
||||
While this is all very useful, you can get away with forcing sed, cut, and grep into a form to get these results, as well (albeit with a lot more work).
|
||||
|
||||
So, I'll leave you with one last introductory feature of awk, maintaining state across lines.
|
||||
|
||||
$ echo -e 'one 1\ntwo 2' | awk '{print $2}'
|
||||
|
||||
> 1
|
||||
>
|
||||
> 2
|
||||
|
||||
$ echo -e 'one 1\ntwo 2' | awk '{sum+=$2} END {print sum}'
|
||||
|
||||
> 3
|
||||
|
||||
(The END indicates that we should only perform the following block **after** we finish processing every line.)
|
||||
|
||||
The case where I've used this is to sum up bytes from web server request logs. Imagine we have an access log that looks like this:
|
||||
|
||||
$ cat requests.log
|
||||
|
||||
> Jul 23 18:57:12 httpd[31950]: "GET /foo/bar HTTP/1.1" 200 344
|
||||
>
|
||||
> Jul 23 18:57:13 httpd[31950]: "GET / HTTP/1.1" 200 9300
|
||||
>
|
||||
> Jul 23 19:01:27 httpd[31950]: "GET / HTTP/1.1" 200 9300
|
||||
>
|
||||
> Jul 23 19:01:55 httpd[31950]: "GET /foo/baz HTTP/1.1" 200 6401
|
||||
>
|
||||
> Jul 23 19:02:31 httpd[31950]: "GET /foo/baz?page=2 HTTP/1.1" 200 6312
|
||||
|
||||
We know the last field is the number of bytes of the response. We've already learned how to extract them using print and $NF:
|
||||
|
||||
$ < requests.log awk '{print $NF}'
|
||||
|
||||
> 344
|
||||
>
|
||||
> 9300
|
||||
>
|
||||
> 9300
|
||||
>
|
||||
> 6401
|
||||
>
|
||||
> 6312
|
||||
|
||||
And so we can sum into a variable to gather the total number of bytes our webserver has served to clients during the timespan of our log:
|
||||
|
||||
$ < requests.log awk '{totalBytes+=$NF} END {print totalBytes}'
|
||||
|
||||
> 31657
|
||||
|
||||
If you're looking for more to do with awk, you can find used copies of [the original awk book][1] for under 15 USD on Amazon. You may also enjoy Eric Pement's [collection of awk one-liners][2].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/2014/07/use-awk-command-linux.html
|
||||
|
||||
作者:[James Pearson][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://xmodulo.com/author/james
|
||||
[1]:http://www.amazon.com/gp/product/020107981X/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=020107981X&linkCode=as2&tag=xmodulo-20&linkId=6NW62B2WBRBXRFJB
|
||||
[2]:http://www.pement.org/awk/awk1line.txt
|
@ -0,0 +1,38 @@
|
||||
Linux FAQs with Answers--How to check which fonts are used in a PDF document
|
||||
================================================================================
|
||||
> **Question**: I would like to know what fonts are used or embedded in a PDF file. Is there a Linux tool which can check which fonts are used in a PDF document?
|
||||
|
||||
To check what fonts are included or used in a PDF file, you can use a command-line utility called pdffonts, which is a PDF font analyzer tool. pdffonts is a part of Poppler PDF utilities package.
|
||||
|
||||
### Install PDF Utilities on Linux ###
|
||||
|
||||
To install Poppler on Debian, Ubuntu or Linux Mint:
|
||||
|
||||
$ sudo apt-get install poppler-utils
|
||||
|
||||
To install PDF Utilities on Fedora, CentOS or RHEL:
|
||||
|
||||
$ sudo yum install poppler-utils
|
||||
|
||||
### Check PDF Fonts ###
|
||||
|
||||
**pdffonts** can list all the fonts used in a PDF document. The basic usage of pdffonts is as follows.
|
||||
|
||||
$ pdffonts doc.pdf
|
||||
|
||||
![](https://farm6.staticflickr.com/5592/14527744387_f8bb671955_z.jpg)
|
||||
|
||||
The **pdffonts** tool shows various information about each font used, such as font name/type, or whether or not a font is embedded, etc.
|
||||
|
||||
In case of a multi-page PDF document, you can limit font scanning for a range of pages with "-f" (first page), and "-l" (last page) options. For example, if you want to find out which fonts are used in pages 5-10 of a document, run this:
|
||||
|
||||
$ pdffonts -f 5 -l 10 doc.pdf
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://ask.xmodulo.com/check-which-fonts-are-used-pdf-document.html
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
@ -0,0 +1,67 @@
|
||||
Use Pushbullet Indicator In Ubuntu To Send Files To Android Or iOS Devices
|
||||
================================================================================
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/Pushbullet_Logog.jpg)
|
||||
|
||||
[Pushbullet][1] is an app available for iOS and Android devices that lets you send files, links, images from your desktop to your mobile device and vice versa. Pushbullet can be used in any OS by installing extensions in Firefox or Chrome.
|
||||
|
||||
If you are not fan of browser extensions and want to use something more of a desktop app for **Pushbullet in Ubuntu 14.04**, you can use **Pushbullet Indicator** developed by [Atareao][2]. Pushbullet Indicator is in development stage at the moment and doesn’t have all the functionality of the official Windows desktop app but it still has enough to get you started.
|
||||
|
||||
### Install Pushbullet Indicator in Ubuntu 14.04 and Linux Mint 17 ###
|
||||
|
||||
Open a terminal and use the following commands:
|
||||
|
||||
sudo add-apt-repository ppa:atareao/atareao
|
||||
sudo apt-get update
|
||||
sudo apt-get install pushbullet-indicator
|
||||
|
||||
The above PPA won’t work on Ubuntu 13.10.
|
||||
|
||||
### Using Pushbullet Indicator in Ubuntu 14.04 and Linux Mint 17 ###
|
||||
|
||||
- Create an account on [Pushbullet][3].
|
||||
- Install the Pushbullet app on your Android or iOS device.
|
||||
- After installing Pushbullet Indicator in Ubuntu or Linux Mint, start it. On the first launch, it will give the option to connect to your Pushbullet account:
|
||||
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/Pushbullet_Indicator_start.png)
|
||||
|
||||
- Once connected, you should also name your device, from the device tab in the above picture. If you want Pushbullet to autostart at each boot, you can choose it do so by going in preference and turn on the Autostart button (shown in the picture above).
|
||||
- Once you are done with this, you will see the Pushbullet indicator in Unity panel.
|
||||
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/Use_Pushbullet_indicator_Ubuntu.jpeg)
|
||||
|
||||
- To send something to your smartphone, click on the indicator and select the device (linked to your Pushbullet account). It’s as simple as that.
|
||||
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/Pushbullet_Indicator_In_Ubuntu.png)
|
||||
|
||||
- You’ll get a notification on the other device of receiving a file. You can access them all from the Pushbullet app.
|
||||
- Android devices can also get notifications for phone calls, text messages and other notifications.
|
||||
- If you send a file from your mobile device to your desktop, you will be notified about it:
|
||||
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/07/Pushbulet_Indicator_Notification.jpeg)
|
||||
|
||||
- The files are not automatically saved to a certain directory. To get the file sent from other device, go to Show last push from the indicator menu, it will show you the last push available. Click on it to download the file to a directory of your choice.
|
||||
|
||||
### Install Nautilus extension for Pushbullet: ###
|
||||
|
||||
Alternatively, you can also install Nautilus extension for Pushbullet to send files directly from right click menu. Use the following command:
|
||||
|
||||
sudo apt-get install nautilus-pushbullet
|
||||
|
||||
You’ll have to authenticate it again after restarting.
|
||||
|
||||
Do share your experience with Pushbullet Indicator in comment section. Ciao ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-includes/images/smilies/icon_smile.gif)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://itsfoss.com/pushbullet-indicator-ubuntu/
|
||||
|
||||
作者:[Abhishek][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://itsfoss.com/author/Abhishek/
|
||||
[1]:https://www.pushbullet.com/
|
||||
[2]:http://www.atareao.es/
|
||||
[3]:https://www.pushbullet.com/
|
199
sources/tech/20140730 How to use variables in shell Scripting.md
Normal file
199
sources/tech/20140730 How to use variables in shell Scripting.md
Normal file
@ -0,0 +1,199 @@
|
||||
How to use variables in shell Scripting
|
||||
================================================================================
|
||||
In every **programming** language **variables** plays an important role , in Linux shell scripting we are using two types of variables : **System Defined Variables** & **User Defined Variables**.
|
||||
|
||||
A variable in a shell script is a means of **referencing** a **numeric** or **character value**. And unlike formal programming languages, a shell script doesn't require you to **declare a type** for your variables
|
||||
|
||||
In this article we will discuss variables, its types and how to set & use variables in shell scripting.
|
||||
|
||||
### System Defined Variables : ###
|
||||
|
||||
These are the variables which are created and maintained by **Operating System(Linux) itself**. Generally these variables are defined in **CAPITAL LETTERS**. We can see these variables by using the command "**$ set**". Some of the system defined variables are given below :
|
||||
|
||||
<table width="100%" cellspacing="1" cellpadding="1">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><strong> System Defined Variables </strong></td>
|
||||
<td><strong> Meaning </strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> BASH=/bin/bash </td>
|
||||
<td> Shell Name </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> BASH_VERSION=4.1.2(1) </td>
|
||||
<td> Bash Version </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> COLUMNS=80 </td>
|
||||
<td> No. of columns for our screen </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> HOME=/home/linuxtechi </td>
|
||||
<td> Home Directory of the User </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> LINES=25 </td>
|
||||
<td> No. of columns for our screen </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> LOGNAME=LinuxTechi </td>
|
||||
<td> LinuxTechi Our logging name </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> OSTYPE=Linux </td>
|
||||
<td> OS type </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> PATH=/usr/bin:/sbin:/bin:/usr/sbin </td>
|
||||
<td> Path Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> PS1=[\u@\h \W]\$ </td>
|
||||
<td> Prompt Settings </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> PWD=/home/linuxtechi </td>
|
||||
<td> Current Working Directory </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> SHELL=/bin/bash </td>
|
||||
<td> Shell Name </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> USERNAME=linuxtechi </td>
|
||||
<td> User name who is currently login to system </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
To Print the value of above variables, use **echo command** as shown below :
|
||||
|
||||
# echo $HOME
|
||||
# echo $USERNAME
|
||||
|
||||
We can tap into these environment variables from within your scripts by using the environment variable's name preceded by a dollar sign. This is demonstrated in the following script:
|
||||
|
||||
$ cat myscript
|
||||
|
||||
#!/bin/bash
|
||||
# display user information from the system.
|
||||
echo “User info for userid: $USER”
|
||||
echo UID: $UID
|
||||
echo HOME: $HOME
|
||||
|
||||
Notice that the **environment variables** in the echo commands are replaced by their current values when the script is run. Also notice that we were able to place the **$USER** system variable within the double quotation marks in the first string, and the shell script was still able to figure out what we meant. There is a **drawback** to using this method, however. Look at what happens in this example:
|
||||
|
||||
$ echo “The cost of the item is $15”
|
||||
The cost of the item is 5
|
||||
|
||||
That is obviously not what was intended. Whenever the script sees a dollar sign within quotes, it assumes you're referencing a variable. In this example the script attempted to display the **variable $1** (which was not defined), and then the number 5. To display an actual dollar sign, you **must precede** it with a **backslash character**:
|
||||
|
||||
$ echo “The cost of the item is \$15”
|
||||
The cost of the item is $15
|
||||
|
||||
That's better. The backslash allowed the shell script to interpret the **dollar sign** as an actual dollar sign, and not a variable.
|
||||
|
||||
### User Defined Variables: ###
|
||||
|
||||
These variables are defined by **users**. A shell script allows us to set and use our **own variables** within the script. Setting variables allows you to **temporarily store data** and use it throughout the script, making the shell script more like a real computer program.
|
||||
|
||||
**User variables** can be any text string of up to **20 letters, digits**, or **an underscore character**. User variables are case sensitive, so the variable Var1 is different from the variable var1. This little rule often gets novice script programmers in trouble.
|
||||
|
||||
Values are assigned to user variables using an **equal sign**. No spaces can appear between the variable, the equal sign, and the value (another trouble spot for novices). Here are a few examples of assigning values to user variables:
|
||||
|
||||
var1=10
|
||||
var2=-57
|
||||
var3=testing
|
||||
var4=“still more testing”
|
||||
|
||||
The shell script **automatically determines the data type** used for the variable value. Variables defined within the shell script maintain their values throughout the life of the shell script but are deleted when the shell script completes.
|
||||
|
||||
Just like system variables, user variables can be referenced using the dollar sign:
|
||||
|
||||
$ cat test3
|
||||
#!/bin/bash
|
||||
# testing variables
|
||||
days=10
|
||||
guest="Katie"
|
||||
echo "$guest checked in $days days ago"
|
||||
days=5
|
||||
guest="Jessica"
|
||||
echo "$guest checked in $days days ago"
|
||||
$
|
||||
|
||||
Running the script produces the following output:
|
||||
|
||||
$ chmod u+x test3
|
||||
$ ./test3
|
||||
Katie checked in 10 days ago
|
||||
Jessica checked in 5 days ago
|
||||
$
|
||||
|
||||
Each time the variable is **referenced**, it produces the value currently assigned to it. It's important to remember that when referencing a variable value you use the **dollar sign**, but when referencing the variable to assign a value to it, you do not use the dollar sign. Here's an example of what I mean:
|
||||
|
||||
$ cat test4
|
||||
#!/bin/bash
|
||||
# assigning a variable value to another variable
|
||||
value1=10
|
||||
value2=$value1
|
||||
echo The resulting value is $value2
|
||||
$
|
||||
|
||||
When you use the **value** of the **value1** variable in the assignment statement, you must still use the dollar sign. This code produces the following output:
|
||||
|
||||
$ chmod u+x test4
|
||||
$ ./test4
|
||||
The resulting value is 10
|
||||
$
|
||||
|
||||
If you forget the dollar sign, and make the value2 assignment line look like:
|
||||
|
||||
value2=value1
|
||||
you get the following output:
|
||||
|
||||
$ ./test4
|
||||
The resulting value is value1
|
||||
$
|
||||
|
||||
Without the dollar sign the **shell interprets** the variable name as a **normal text string**, which is most likely not what you wanted.
|
||||
|
||||
### Use of Backtick symbol (`) in shell variables : ###
|
||||
|
||||
The **backtick allows** you to assign the output of a shell command to a variable. While this doesn't seem like much, it is a major building block in **script programming**.You must surround the entire command line command with backtick characters:
|
||||
|
||||
**testing=`date`**
|
||||
|
||||
The shell runs the command within the **backticks** and assigns the output to the variable testing. Here's an example of creating a variable using the output from a normal shell command:
|
||||
|
||||
$ cat test5
|
||||
#!/bin/bash
|
||||
# using the backtick character
|
||||
testing=`date`
|
||||
echo "The date and time are: " $testing
|
||||
$
|
||||
|
||||
The variable testing receives the output from the date command, and it is used in the echo statement to display it. Running the shell script produces the following output:
|
||||
|
||||
$ chmod u+x test5
|
||||
$ ./test5
|
||||
The date and time are: Mon Jan 31 20:23:25 EDT 2011
|
||||
|
||||
**Note** : In bash you can also use the alternative $(…) syntax in place of backtick (`),which has the advantage of being re-entrant.
|
||||
|
||||
Example :
|
||||
|
||||
$ echo " Today’s date & time is :" $(date)
|
||||
Today’s date & time is : Sun Jul 27 16:26:56 IST 2014
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linuxtechi.com/variables-in-shell-scripting/
|
||||
|
||||
作者:[Pradeep Kumar][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.linuxtechi.com/author/pradeep/
|
@ -1,58 +0,0 @@
|
||||
编程的乐趣:快速出错!
|
||||
================================================================================
|
||||
![](http://www.opensourceforu.com/wp-content/uploads/2011/12/fail-350x262.jpg)
|
||||
|
||||
> 当软件出现问题的时候,它应该以一种能引起注意的方式马上终止。这种“快速出错”的方式值得借鉴,我们会在这期专栏里谈谈这个重要的概念。
|
||||
|
||||
一开始,“快速出错”看上去是一种会影响可靠性的不好的实践-为什么一个系统在还可以继续运行的时候要崩溃(或者说终止)?对于这个,我们需要理解,快速出错是和Heisenbugs(对于不能复现bug的一种称呼)紧密联系在一起的。
|
||||
|
||||
考虑一下Bohrbugs(对于能够重现的bug的一种称呼),它们在给定输入的时候总是会出现,比如,访问空指针。这类问题很容易测试,复现并修复。如今,所有有经验的程序员应该都面对过这样的情形,导致崩溃的bug在重启软件后不再出现了。不管花多少时间或努力去重现问题,那个bug就是跟我们捉迷藏。这种bug被称为Heisenbugs。
|
||||
|
||||
花在寻找,修复和测试Heisenbugs上的努力比起Bohrbugs来说,要高出一个数量级。一种避免Heisenbugs的策略是将它们转化为Bohrbugs。怎么做呢?预测可能导致Heisenbugs的因素,然后尝试将它们变成Bohrbugs。是的,这并不简单,而且也并不是一定就能成功,但是让我们来看一个能产生效果的特殊例子。
|
||||
|
||||
并发编程是Heisenbugs经常出现的一个典范。我们的例子就是一个Java里和并发相关的问题。在遍历一个Java集合的时候,一般要求只能通过Iterator的方法,比如remove()方法。而当遍历的时候,如果有另一个线程尝试修改底层集合(因为编程时留下的错误),那么底层集合就可能会被破坏(例如,导致不正确的状态)。
|
||||
|
||||
类似这种不正确的状态会导致不确定的错误-假如我们幸运的话(实际上,这很不幸!),程序可以继续执行而不会崩溃,但是却给出错误的结果。这种bug很难重现和修复,因为这一类的程序错误都是不确定的。换句话说,这是个Heisenbug。
|
||||
|
||||
幸运的是,Java Iterators会尝试侦测这种并发修改,在发现了以后,会丢出异常`ConcurrentModificationException`,而不是等到最后再出错-那样也是没有任何迹象的。换句话说,Java Iterators也遵从了“快速出错”的方法。
|
||||
|
||||
如果异常`ConcurrentModificationException`在正式软件中发生了呢?根据在Javadoc里对这个异常的说明,它“只应该用于侦测bug”。换句话说,`ConcurrentModificationException`只应该在开发阶段监听和修复,而不应该泄漏到正式代码中。
|
||||
|
||||
好吧,如果正式软件确实发生了这个异常,那它当然是软件中的bug,应当报告给开发者并修复。至少,我们能够知道发生了一次底层数据结构的并发修改,而这是软件出错的原因(而不是让软件产生错误的结果,或是以其他现象延后出错,这样就很难跟踪到根本原因)。
|
||||
|
||||
“安全出错”的方法意味着开发健壮的代码。一个很好的编写安全出错代码的例子就是使用断言。很可惜的是,关于断言的使用有大量不必要的公开争论。其中主要的批评点是:它在开发版本中使用,而在发布版中却被关掉的。
|
||||
|
||||
不管怎么样,这个批评是错误的:从来没有说用断言来替代应该放到发布版软件中的防御式检查代码。例如,断言不应该用来检查传递给函数的参数是否为空。相应的,应该用一个if语句来检查这个参数是否正确,否则的话抛出异常,或是提前返回,来适合上下文。然而,断言一般用于额外检查代码中所做出的假设,它们应该为真才正常。例如,用一个语句来检查在进行了入栈操作后,栈应该不是空的(例如,对“不变量”的检查)。
|
||||
|
||||
所以,快速出错,随时中断,那么你已经走在开发更加健壮代码的道路上了。
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via:http://www.opensourceforu.com/2011/12/joy-of-programming-fail-fast/
|
||||
|
||||
译者:[zpl1025](https://github.com/zpl1025) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:
|
||||
[2]:
|
||||
[3]:
|
||||
[4]:
|
||||
[5]:
|
||||
[6]:
|
||||
[7]:
|
||||
[8]:
|
||||
[9]:
|
||||
[10]:
|
||||
[11]:
|
||||
[12]:
|
||||
[13]:
|
||||
[14]:
|
||||
[15]:
|
||||
[16]:
|
||||
[17]:
|
||||
[18]:
|
||||
[19]:
|
||||
[20]:
|
56
translated/tech/20140528 Install Webmin On Ubuntu 14.04.md
Normal file
56
translated/tech/20140528 Install Webmin On Ubuntu 14.04.md
Normal file
@ -0,0 +1,56 @@
|
||||
在Ubuntu 14.04中安装Webmin
|
||||
================================================================================
|
||||
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/05/webmin-790x586.jpg)
|
||||
|
||||
[Webmin][1]是一款开源的、基于web的、适合Unix/Linux的系统管理工具。使用Webmin,你可以通过任何一款现有的网页浏览器来设置和配置所有的系统服务,比如DNS、DHCP、Apache、NFS和Samba等。因此,你无需记住所有的命令或手动编辑任何的配置文件了。
|
||||
|
||||
### 使用官方仓库在Ubuntu 14.04 LTS上安装Webmin ###
|
||||
|
||||
添加webmin的官方库:
|
||||
|
||||
编辑文件**/etc/apt/sources.list**,
|
||||
|
||||
sudo vi /etc/apt/sources.list
|
||||
|
||||
添加下列行内容:
|
||||
|
||||
deb http://download.webmin.com/download/repository sarge contrib
|
||||
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
|
||||
|
||||
添加GPG密钥:
|
||||
|
||||
sudo wget http://www.webmin.com/jcameron-key.asc
|
||||
sudo apt-key add jcameron-key.asc
|
||||
|
||||
更新软件列表:
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
使用下列命令安装webmin:
|
||||
|
||||
sudo apt-get install webmin
|
||||
|
||||
如果你想远程访问webmin的控制台,则需要设置防火墙允许通过webmin的默认端口“10000”。
|
||||
|
||||
sudo ufw allow 10000
|
||||
|
||||
### 访问Webmin控制台 ###
|
||||
|
||||
打开你的浏览器,转到这个地址**https://ip-address:10000/**。将会出现下面的画面,输入用户名和密码就可以登陆进webmin控制台了。
|
||||
|
||||
![Login to Webmin](http://180016988.r.cdn77.net/wp-content/uploads/2014/05/Login-to-Webmin-Mozilla-Firefox_010.png)
|
||||
|
||||
这是我的Webmin控制面板的样子。
|
||||
|
||||
![Webmin 1.690 on server.unixmen.local (Ubuntu Linux 14.04)](http://180016988.r.cdn77.net/wp-content/uploads/2014/05/Webmin-1.690-on-server.unixmen.local-Ubuntu-Linux-14.04-Mozilla-Firefox_011.png)
|
||||
|
||||
就是这样简单。现在你就可以图形化地管理和配置你的Ubuntu服务器了。欢呼吧!
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.unixmen.com/install-webmin-ubuntu-14-04/
|
||||
|
||||
译者:[KayGuoWhu](https://github.com/KayGuoWhu) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.webmin.com/
|
@ -0,0 +1,105 @@
|
||||
2q1w2007翻译中
|
||||
Wine 1.7.21 (开发者版本) 发布 – 在基于RedHat或Debian的系统上安装
|
||||
================================================================================
|
||||
Wine,Linux上最流行也是最有力的软件, 用来不出问题的在Linux平台上运行Windows程序和游戏。
|
||||
|
||||
![安装Wine(开发者版本)](http://www.tecmint.com/wp-content/uploads/2014/05/Install-Wine-Development-Version.png)
|
||||
|
||||
在Linux上安装Wine(开发者版本)
|
||||
|
||||
**WineHQ** 团队, 最近发布了一个新的开发者版本**Wine 1.7.21**,带来了许多新特性和几个修正。
|
||||
|
||||
Wine的团队, 坚持每周更新开发者版本并带来了许多新特性和修正。 每个新版本都带来对新程序和游戏的支持,这让Wine成为最流行的也是想在Linux平台运行基于Windows的软件的用户的必备工具.
|
||||
|
||||
根据changelog, 该版本有如下关键的新特性:
|
||||
|
||||
- C runtime中添加临界区的支持.
|
||||
- Unicode 升级到 Unicode 7.
|
||||
- 新增交错 PNG 编码支持.
|
||||
- Packager 库初始化 stub
|
||||
- 修改了几个bug.
|
||||
|
||||
更多深度的改变信息在 [changelog][1] .
|
||||
|
||||
这篇文章教你怎么在像CentOS, Fedora, Ubuntu, Linux Mint一样基于**Red Hat**和**Debian**的系统上安装最新的**Wine 1.7.21**。
|
||||
|
||||
### 在Linux安装 Wine 1.7.21 开发者版本 ###
|
||||
|
||||
不幸的, 在基于**Red Hat**的系统上没有官方的 Wine 仓库,所以唯一的安装方式是从源码编译。你需要安装一些依赖的包比如gcc, flex, bison, libX11-devel freetype-devel 和 Development Tools,这些包用来从源码编译Wine。我们可以用**YUM**命令安装他们。
|
||||
|
||||
#### 在 RedHat, Fedora 和 CentOS 上 ####
|
||||
|
||||
# yum -y groupinstall 'Development Tools'
|
||||
# yum -y install flex bison libX11-devel freetype-devel
|
||||
|
||||
接下来,下载最新的开发者版本(即**1.7.21**)并用下面的命令提取出来。
|
||||
|
||||
$ cd /tmp
|
||||
$ wget http://citylan.dl.sourceforge.net/project/wine/Source/wine-1.7.21.tar.bz2
|
||||
$ tar -xvf wine-1.7.21.tar.bz2 -C /tmp/
|
||||
|
||||
现在,是时候以普通用户身份编译并搭建Wine的安装程序了。(**注意**: 根据机器性能和网络速度的不同,安装过程需要 **15-20** 分钟,安装过程中会要求输入 **root** 密码。)
|
||||
|
||||
|
||||
**32位系统上**
|
||||
|
||||
$ cd wine-1.7.21/
|
||||
$ ./tools/wineinstall
|
||||
|
||||
**64位系统上**
|
||||
|
||||
$ cd wine-1.7.21/
|
||||
$ ./configure --enable-win64
|
||||
$ make
|
||||
# make install
|
||||
|
||||
#### 在Ubuntu, Debian 和 Linux Mint 上 ####
|
||||
|
||||
在基于**Ubuntu** 的系统上, 你可以用官方的 **PPA**来轻松安装最新的Wine。打开一个新终端用sudo运行如下命令。
|
||||
|
||||
$ sudo add-apt-repository ppa:ubuntu-wine/ppa
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install wine 1.7 winetricks
|
||||
|
||||
**注意**: 写这篇文章的时候版本是 **1.7.20** 新版本还没上传到仓库,但当新版本可用时上面的命令将安装 **1.7.21** 。
|
||||
|
||||
一旦装完了,你可以以如下方式运行基于Windows的软件和游戏。
|
||||
|
||||
$ wine notepad
|
||||
$ wine notepad.exe
|
||||
$ wine c:\\windows\\notepad.exe
|
||||
|
||||
**注意**: 请记住,这是个开发者版本,不要用在生产环境。 建议此版本只用在测试用途
|
||||
|
||||
如果你想安装最近的稳定版Wine, 请看下面的文章, 在文章里介绍了在几乎所以Linux系统中安装Wine的方法
|
||||
|
||||
- [Install Wine 1.6.2 (Stable) in RHEL, CentOS and Fedora][2]
|
||||
- [Install Wine 1.6.2 (Stable) in Debian, Ubuntu and Mint][3]
|
||||
|
||||
### 参考链接 ###
|
||||
|
||||
- [WineHQ Homepage][4]
|
||||
|
||||
----------
|
||||
|
||||
![](http://1.gravatar.com/avatar/7badddbc53297b2e8ed7011cf45df0c0?s=80&d=blank&r=G)
|
||||
|
||||
#### Ravi Saive ####
|
||||
|
||||
Owner at [TecMint.com][5]
|
||||
|
||||
Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/install-wine-in-linux/
|
||||
|
||||
译者:[2q1w2007](https://github.com/2q1w2007) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.winehq.org/announce/1.7.21
|
||||
[2]:http://www.tecmint.com/install-wine-in-rhel-centos-and-fedora/
|
||||
[3]:http://www.tecmint.com/install-wine-on-ubuntu-and-linux-mint/
|
||||
[4]:http://www.winehq.org/
|
||||
[5]:http://www.tecmint.com/
|
Loading…
Reference in New Issue
Block a user