Merge pull request #36 from LCTT/master

Update Repo
This commit is contained in:
joeren 2015-05-13 12:06:59 +08:00
commit d83ecb1d47
12 changed files with 1403 additions and 327 deletions

View File

@ -1,18 +1,18 @@
领略一些最著名的 Linux 网络工具
一大波你可能不知道的 Linux 网络工具
================================================================================
在你的系统上使用命令行工具来监控你的网络是非常实用的,并且对于 Linux 用户来说,有着许许多多现成的工具可以使用,如 nethogs, ntopng, nload, iftop, iptraf, bmon, slurm, tcptrack, cbm, netwatch, collectl, trafshow, cacti, etherape, ipband, jnettop, netspeed 以及 speedometer。
如果要在你的系统上监控网络,那么使用命令行工具是非常实用的,并且对于 Linux 用户来说,有着许许多多现成的工具可以使用,如 nethogs, ntopng, nload, iftop, iptraf, bmon, slurm, tcptrack, cbm, netwatch, collectl, trafshow, cacti, etherape, ipband, jnettop, netspeed 以及 speedometer。
鉴于世上有着许多的 Linux 专家和开发者,显然还存在其他的网络监控工具,但在这篇教程中,我不打算将它们所有包括在内。
上面列出的工具都有着自己的独特之处,但归根结底,它们都做着监控网络流量的工作,且并不是只有一种方法来完成这件事。例如 nethogs 可以被用来展示每个进程的带宽使用情况,以防你想知道究竟是哪个应用在消耗了你的整个网络资源; iftop 可以被用来展示每个套接字连接的带宽使用情况,而 像 nload 这类的工具可以帮助你得到有关整个带宽的信息。
上面列出的工具都有着自己的独特之处,但归根结底,它们都做着监控网络流量的工作,只是通过各种不同的方法。例如 nethogs 可以被用来展示每个进程的带宽使用情况,以防你想知道究竟是哪个应用在消耗了你的整个网络资源; iftop 可以被用来展示每个套接字连接的带宽使用情况,而像 nload 这类的工具可以帮助你得到有关整个带宽的信息。
### 1) nethogs ###
nethogs 是一个免费的工具,当要查找哪个 PID (注:即 process identifier进程 ID) 给你的网络流量带来了麻烦时,它是非常方便的。它按每个进程来组带宽,而不是像大多数的工具那样按照每个协议或每个子网来划分流量。它功能丰富,同时支持 IPv4 和 IPv6并且我认为若你想在你的 Linux 主机上确定哪个程序正消耗着你的全部带宽,它是来做这件事的最佳的程序。
nethogs 是一个免费的工具,当要查找哪个 PID (注:即 process identifier进程 ID) 给你的网络流量带来了麻烦时,它是非常方便的。它按每个进程来组带宽,而不是像大多数的工具那样按照每个协议或每个子网来划分流量。它功能丰富,同时支持 IPv4 和 IPv6并且我认为若你想在你的 Linux 主机上确定哪个程序正消耗着你的全部带宽,它是来做这件事的最佳的程序。
一个 Linux 用户可以使用 **nethogs** 来显示每个进程的 TCP 下载和上传速率,使用命令 **nethogs eth0** 来监控一个定的设备,上面的 eth0 是那个你想获取信息的设备的名称,你还可以得到有关正在传输的数据的传输速率信息。
一个 Linux 用户可以使用 **nethogs** 来显示每个进程的 TCP 下载和上传速率,可以使用命令 **nethogs eth0** 来监控一个定的设备,上面的 eth0 是那个你想获取信息的设备的名称,你还可以得到有关正在传输的数据的传输速率信息。
对我而言, nethogs 是非常容易使用的,或许是因为我非常喜欢它以至于我总是在我的 Ubuntu 12.04 LTS 机器中使用它来监控我的网络带宽。
对我而言, nethogs 是非常容易使用的,或许是因为我非常喜欢它以至于我总是在我的 Ubuntu 12.04 LTS 机器中使用它来监控我的网络带宽。
例如要想使用混杂模式来嗅探,可以像下面展示的命令那样使用选项 -p
@ -20,6 +20,8 @@ nethogs 是一个免费的工具,当要查找哪个 PID (注:即 process ide
假如你想更多地了解 nethogs 并深入探索它,那么请毫不犹豫地阅读我们做的关于这个网络带宽监控工具的整个教程。
LCTT 译注:关于 nethogs 的更多信息可以参考https://linux.cn/article-2808-1.html
### 2) nload ###
nload 是一个控制台应用,可以被用来实时地监控网络流量和带宽使用情况,它还通过提供两个简单易懂的图表来对流量进行可视化。这个绝妙的网络监控工具还可以在监控过程中切换被监控的设备,而这可以通过按左右箭头来完成。
@ -28,19 +30,21 @@ nload 是一个控制台应用,可以被用来实时地监控网络流量和
正如你在上面的截图中所看到的那样,由 nload 提供的图表是非常容易理解的。nload 提供了有用的信息,也展示了诸如被传输数据的总量和最小/最大网络速率等信息。
而更酷的是你可以在下面的命令的帮助下运行 nload 这个工具,这个命令是非常的短小且易记的:
而更酷的是你只需要直接运行 nload 这个工具就行,这个命令是非常的短小且易记的:
nload
我很确信的是:我们关于如何使用 nload 的详细教程将帮助到新的 Linux 用户,甚至可以帮助那些正寻找关于 nload 信息的老手。
LCTT 译注:关于 nload 的更新信息可以参考https://linux.cn/article-5114-1.html
### 3) slurm ###
slurm 是另一个 Linux 网络负载监控工具,它以一个不错的 ASCII 图来显示结果,它还支持许多键用以交互,例如 **c** 用来切换到经典模式, **s** 切换到分图模式, **r** 用来重绘屏幕, **L** 用来启用 TX/RXTX发送流量RX接收流量 LED**m** 用来在经典分图模式和大图模式之间进行切换, **q** 退出 slurm。
slurm 是另一个 Linux 网络负载监控工具,它以一个不错的 ASCII 图来显示结果,它还支持许多键用以交互,例如 **c** 用来切换到经典模式, **s** 切换到分图模式, **r** 用来重绘屏幕, **L** 用来启用 TX/RXTX发送流量RX接收流量 **m** 用来在经典分图模式和大图模式之间进行切换, **q** 退出 slurm。
![linux network load monitoring tools](http://blog.linoxide.com/wp-content/uploads/2013/12/slurm2.png)
在网络负载监控工具 slurm 中,还有许多其它的键可用,你可以很容易地使用下面的命令在 man 手册中学习它们。
在网络负载监控工具 slurm 中,还有许多其它的键可用,你可以很容易地使用下面的命令在 man 手册中学习它们。
man slurm
@ -48,11 +52,11 @@ slurm 在 Ubuntu 和 Debian 的官方软件仓库中可以找到,所以使用
sudo apt-get install slurm
我们已经在一个教程中对 slurm 的使用做了介绍,所以请访问相关网页( 注:应该指的是[这篇文章](http://linoxide.com/ubuntu-how-to/monitor-network-load-slurm-tool/) ),并不要忘记和其它使用 Linux 的朋友分享这些知识。
我们已经在一个[教程](http://linoxide.com/ubuntu-how-to/monitor-network-load-slurm-tool/)中对 slurm 的使用做了介绍,不要忘记和其它使用 Linux 的朋友分享这些知识。
### 4) iftop ###
当你想在一个接口上按照主机来展示带宽使用情况时iftop 是一个非常有用的工具。根据 man 手册,**iftop** 在一个已命名的接口或在它可以找到的第一个接口(假如没有任何特殊情况,它就像一个外部的接口)上监听网络流量,并且展示出一个表格来显示当前一对主机间的带宽使用情况。
当你想显示连接到网卡上的各个主机的带宽使用情况时iftop 是一个非常有用的工具。根据 man 手册,**iftop** 在一个指定的接口或在它可以找到的第一个接口(假如没有任何特殊情况,它应该是一个对外的接口)上监听网络流量,并且展示出一个表格来显示当前一对主机间的带宽使用情况。
通过在虚拟终端中使用下面的命令Ubuntu 和 Debian 用户可以在他们的机器中轻易地安装 iftop
@ -61,6 +65,8 @@ slurm 在 Ubuntu 和 Debian 的官方软件仓库中可以找到,所以使用
在你的机器上,可以使用下面的命令通过 yum 来安装 iftop
yum -y install iftop
LCTT 译注:关于 nload 的更多信息请参考https://linux.cn/article-1843-1.html
### 5) collectl ###
@ -69,7 +75,7 @@ collectl 可以被用来收集描述当前系统状态的数据,并且它支
- 记录模式
- 回放模式
**记录模式** 允许从一个正在运行的系统中读取数据,然后将这些数据要么显示在终端中,要么写入一个或多个文件或套接字中。
**记录模式** 允许从一个正在运行的系统中读取数据,然后将这些数据要么显示在终端中,要么写入一个或多个文件或一个套接字中。
**回放模式**
@ -79,13 +85,15 @@ Ubuntu 和 Debian 用户可以在他们的机器上使用他们默认的包管
sudo apt-get install collectl
还可以使用下面的命令来安装 collectl 因为对于这些发行版本(注:这里指的是用 yum 作为包管理器的发行版本),在它们官方的软件仓库中也含有 collectl
还可以使用下面的命令来安装 collectl 因为对于这些发行版本(注:这里指的是用 yum 作为包管理器的发行版本),在它们官方的软件仓库中也含有 collectl
yum install collectl
LCTT 译注:关于 collectl 的更多信息请参考: https://linux.cn/article-3154-1.html
### 6) Netstat ###
Netstat 是一个用来监控**传入和传出的网络数据包统计数据**和接口统计数据的命令行工具。它为传输控制协议 TCP (包括上传和下行),路由表,及一系列的网络接口(网络接口控制器或者软件定义的网络接口) 和网络协议统计数据展示网络连接情况
Netstat 是一个用来监控**传入和传出的网络数据包统计数据**的接口统计数据命令行工具。它会显示 TCP 连接 (包括上传和下行)路由表及一系列的网络接口网卡或者SDN接口和网络协议统计数据
Ubuntu 和 Debian 用户可以在他们的机器上使用默认的包管理器来安装 netstat。Netsta 软件被包括在 net-tools 软件包中,并可以在 shell 或虚拟终端中运行下面的命令来安装它:
@ -107,6 +115,8 @@ CentOS, Fedora, RHEL 用户可以在他们的机器上使用默认的包管理
![man netstat](http://blog.linoxide.com/wp-content/uploads/2015/02/man-netstat.png)
LCTT 译注:关于 netstat 的更多信息请参考https://linux.cn/article-2434-1.html
### 7) Netload ###
netload 命令只展示一个关于当前网络荷载和自从程序运行之后传输数据总的字节数目的简要报告,它没有更多的功能。它是 netdiag 软件的一部分。
@ -115,9 +125,9 @@ netload 命令只展示一个关于当前网络荷载和自从程序运行之后
# yum install netdiag
Netload 在默认仓库中作为 netdiag 的一部分可以被找到,我们可以轻易地使用下面的命令来利用 **apt** 包管理器安装 **netdiag**
Netload 是默认仓库中 netdiag 的一部分,我们可以轻易地使用下面的命令来利用 **apt** 包管理器安装 **netdiag**
$ sudo apt-get install netdiag (注:这里原文为 sudo install netdiag应该加上 apt-get)
$ sudo apt-get install netdiag
为了运行 netload我们需要确保选择了一个正在工作的网络接口的名称如 eth0, eh1, wlan0, mon0等然后在 shell 或虚拟终端中运行下面的命令:
@ -127,21 +137,23 @@ Netload 在默认仓库中作为 netdiag 的一部分可以被找到,我们可
### 8) Nagios ###
Nagios 是一个领先且功能强大的开源监控系统,它使得网络或系统管理员在服务器相关的问题影响到服务器的主要事务之前,鉴定并解决这些问题。 有了 Nagios 系统,管理员便可以在一个单一的窗口中监控远程的 Linux 、Windows 系统、交换机、路由器和打印机等。它显示出重要的警告并指出在你的网络或服务器中是否出现某些故障,这间接地帮助你在问题发生之前,着手执行补救行动。
Nagios 是一个领先且功能强大的开源监控系统,它使得网络或系统管理员可以在服务器的各种问题影响到服务器的主要事务之前,发现并解决这些问题。 有了 Nagios 系统,管理员便可以在一个单一的窗口中监控远程的 Linux 、Windows 系统、交换机、路由器和打印机等。它显示出重要的警告并指出在你的网络或服务器中是否出现某些故障,这可以间接地帮助你在问题发生前就着手执行补救行动。
Nagios 有一个 web 界面,其中有一个图形化的活动监视器。通过浏览网页 http://localhost/nagios/ 或 http://localhost/nagios3/ 便可以登录到这个 web 界面。假如你在远程的机器上进行操作,请使用你的 IP 地址来替换 localhost然后键入用户名和密码我们便会看到如下图所展示的信息
![在 Chromium 浏览器中的 Nagios3](http://blog.linoxide.com/wp-content/uploads/2015/02/nagios3-ubuntu.png)
LCTT 译注:关于 Nagios 的更多信息请参考https://linux.cn/article-2436-1.html
### 9) EtherApe ###
EtherApe 是一个针对 Unix 的图形化网络监控工具,它仿照了 etherman 软件。它具有链路层IP 和 TCP 模式并支持 Ethernet, FDDI, Token Ring, ISDN, PPP, SLIP 及 WLAN 设备等接口,再加上支持一些封装的格式。主机和链接随着流量大小和被着色的协议名称展示而变化。它可以过滤要展示的流量,并可从一个文件或运行的网络中读取数据报
EtherApe 是一个针对 Unix 的图形化网络监控工具,它仿照了 etherman 软件。它支持链路层、IP 和 TCP 等模式,并支持以太网, FDDI, 令牌环, ISDN, PPP, SLIP 及 WLAN 设备等接口,以及一些封装格式。主机和连接随着流量和协议而改变其尺寸和颜色。它可以过滤要展示的流量,并可从一个文件或运行的网络中读取数据包
在 CentOS、Fedora、RHEL 等 Linux 发行版本中安装 etherape 是一件容易的事,因为在它们的官方软件仓库中就可以找到 etherape。我们可以像下面展示的命令那样使用 yum 包管理器来安装它:
yum install etherape
我们可以使用下面的命令在 Ubuntu、Debian 及它们的衍生发行版本中使用 **apt** 包管理器来安装 EtherApe
我们可以使用下面的命令在 Ubuntu、Debian 及它们的衍生发行版本中使用 **apt** 包管理器来安装 EtherApe
sudo apt-get install etherape
@ -149,13 +161,13 @@ EtherApe 是一个针对 Unix 的图形化网络监控工具,它仿照了 ethe
sudo etherape
然后, **etherape****图形用户界面** 便会被执行。接着,在菜单上面的 **捕捉** 选项下,我们可以选择 **模式**(IP,链路层TCP) 和 **接口**。一切设定完毕后,我们需要点击 **开始** 按钮。接着我们便会看到类似下面截图的东西:
然后, **etherape****图形用户界面** 便会被执行。接着,在菜单上面的 **捕捉** 选项下,我们可以选择 **模式**(IP链路层TCP) 和 **接口**。一切设定完毕后,我们需要点击 **开始** 按钮。接着我们便会看到类似下面截图的东西:
![EtherApe](http://blog.linoxide.com/wp-content/uploads/2015/02/etherape.png)
### 10) tcpflow ###
tcpflow 是一个命令行工具,它可以捕捉作为 TCP 连接(流)的部分传输数据,并以一种方便协议分析或除错的方式来存储数据。它重建了实际的数据流并将每个流存储在不同的文件中,以备日后的分析。它理解 TCP 序列号并可以正确地重建数据流,不管是在重发或乱序发送状态下。
tcpflow 是一个命令行工具,它可以捕捉 TCP 连接(流)的部分传输数据,并以一种方便协议分析或除错的方式来存储数据。它重构了实际的数据流并将每个流存储在不同的文件中,以备日后的分析。它能识别 TCP 序列号并可以正确地重构数据流,不管是在重发还是乱序发送状态下。
通过 **apt** 包管理器在 Ubuntu 、Debian 系统中安装 tcpflow 是很容易的,因为默认情况下在官方软件仓库中可以找到它。
@ -175,7 +187,7 @@ tcpflow 是一个命令行工具,它可以捕捉作为 TCP 连接(流)的一
# yum install --nogpgcheck http://pkgs.repoforge.org/tcpflow/tcpflow-0.21-1.2.el6.rf.i686.rpm
我们可以使用 tcpflow 来捕捉全部或部分 tcp 流量并以一种简单的方式把它们写到一个可读文件中。下面的命令执行着我们想要做的事情,但我们需要在一个空目录中运行下面的命令,因为它将创建诸如 x.x.x.x.y-a.a.a.a.z 格式的文件,做完这些之后,只需按 Ctrl-C 便可停止这个命令。
我们可以使用 tcpflow 来捕捉全部或部分 tcp 流量并以一种简单的方式把它们写到一个可读的文件中。下面的命令就可以完成这个事情,但我们需要在一个空目录中运行下面的命令,因为它将创建诸如 x.x.x.x.y-a.a.a.a.z 格式的文件,运行之后,只需按 Ctrl-C 便可停止这个命令。
$ sudo tcpflow -i eth0 port 8000
@ -183,49 +195,51 @@ tcpflow 是一个命令行工具,它可以捕捉作为 TCP 连接(流)的一
### 11) IPTraf ###
[IPTraf][2] 是一个针对 Linux 平台的基于控制台的网络统计应用。它生成一系列的图形,如 TCP 连接包和字节的数目、接口信息和活动指示器、 TCP/UDP 流量故障以及 LAN 状态包和字节的数目
[IPTraf][2] 是一个针对 Linux 平台的基于控制台的网络统计应用。它生成一系列的图形,如 TCP 连接的包/字节计数、接口信息和活动指示器、 TCP/UDP 流量故障以及局域网内设备的包/字节计数
在默认的软件仓库中可以找到 IPTraf所以我们可以使用下面的命令通过 **apt** 包管理器轻松地安装 IPTraf
$ sudo apt-get install iptraf
在默认的软件仓库中可以找到 IPTraf所以我们可以使用下面的命令通过 **yum** 包管理器轻松地安装 IPTraf
我们可以使用下面的命令通过 **yum** 包管理器轻松地安装 IPTraf
# yum install iptraf
我们需要以管理员权限来运行 IPTraf(注:这里原文写错为 TPTraf),并带有一个可用的网络接口名。这里,我们的网络接口名为 wlan2所以我们使用 wlan2 来作为接口的名称
我们需要以管理员权限来运行 IPTraf,并带有一个有效的网络接口名。这里,我们的网络接口名为 wlan2所以我们使用 wlan2 来作为参数
$ sudo iptraf wlan2 (注:这里原文为 sudo iptraf,应该加上 wlan2)
$ sudo iptraf wlan2
![IPTraf](http://blog.linoxide.com/wp-content/uploads/2015/02/iptraf.png)
开始一般的网络接口统计,键入:
开始通常的网络接口统计,键入:
# iptraf -g
为了在一个名为 eth0 的接口设备上看详细的统计信息,使用:
查看接口 eth0 的详细统计信息,使用:
# iptraf -d wlan2 (注:这里的 wlan2 和 上面的 eth0 不一致,下面的几句也是这种情况,请相应地改正)
# iptraf -d eth0
为了看一个名为 eth0 的接口的 TCP 和 UDP 监控,使用:
查看接口 eth0 的 TCP 和 UDP 监控信息,使用:
# iptraf -z wlan2
# iptraf -z eth0
为了展示在一个名为 eth0 的接口上的包的大小和数目,使用:
查看接口 eth0 的包的大小和数目,使用:
# iptraf -z wlan2
# iptraf -z eth0
注意:请将上面的 wlan2 替换为你的接口名称。你可以通过运行`ip link show`命令来检查你的接口。
注意:请将上面的 eth0 替换为你的接口名称。你可以通过运行`ip link show`命令来检查你的接口。
LCTT 译注:关于 iptraf 的更多详细信息请参考https://linux.cn/article-5430-1.html
### 12) Speedometer ###
Speedometer 是一个小巧且简单的工具,它只绘出一幅包含有通过某个给定端口的上行、下行流量的好看的图。
Speedometer 是一个小巧且简单的工具,它只用来绘出一幅包含有通过某个给定端口的上行、下行流量的好看的图。
在默认的软件仓库中可以找到 Speedometer ,所以我们可以使用下面的命令通过 **yum** 包管理器轻松地安装 Speedometer
# yum install speedometer
在默认的软件仓库中可以找到 Speedometer ,所以我们可以使用下面的命令通过 **apt** 包管理器轻松地安装 Speedometer
我们可以使用下面的命令通过 **apt** 包管理器轻松地安装 Speedometer
$ sudo apt-get install speedometer
@ -239,15 +253,15 @@ Speedometer 可以简单地通过在 shell 或虚拟终端中执行下面的命
### 13) Netwatch ###
Netwatch 是 netdiag 工具集里的一部分,并且它也显示当前主机和其他远程主机的连接情况,以及在每个连接中数据传输的速率。
Netwatch 是 netdiag 工具集里的一部分,它也显示当前主机和其他远程主机的连接情况,以及在每个连接中数据传输的速率。
我们可以使用 yum 在 fedora 中安装 Netwatch因为它在 fedora 的默认软件仓库中。但若你运行着 CentOS 或 RHEL 我们需要安装 [rpmforge 软件仓库][3]。
# yum install netwatch
Netwatch 作为 netdiag 的一部分可以在默认的软件仓库中找到,所以我们可以轻松地使用下面的命令来利用 **apt** 包管理器安装 **netdiag**
Netwatch 是 netdiag 的一部分,可以在默认的软件仓库中找到,所以我们可以轻松地使用下面的命令来利用 **apt** 包管理器安装 **netdiag**
$ sudo apt-get install netdiag(注:这里应该加上 apt-get
$ sudo apt-get install netdiag
为了运行 netwatch 我们需要在虚拟终端或 shell 中执行下面的命令:
@ -259,15 +273,15 @@ Netwatch 作为 netdiag 的一部分可以在默认的软件仓库中找到,
### 14) Trafshow ###
Trafshow 同 netwatch 和 pktstat(注:这里原文中多了一个 trafshow)一样,可以报告当前活的连接里使用的协议和每个连接中数据传输的速率。它可以使用 pcap 类型的滤器来筛选出特定的连接。
Trafshow 同 netwatch 和 pktstat 一样,可以报告当前活的连接里使用的协议和每个连接中数据传输的速率。它可以使用 pcap 类型的滤器来筛选出特定的连接。
我们可以使用 yum 在 fedora 中安装 trafshow(注:这里原文为 Netwatch应该为 trafshow),因为它在 fedora 的默认软件仓库中。但若你正运行着 CentOS 或 RHEL 我们需要安装 [rpmforge 软件仓库][4]。
我们可以使用 yum 在 fedora 中安装 trafshow ,因为它在 fedora 的默认软件仓库中。但若你正运行着 CentOS 或 RHEL 我们需要安装 [rpmforge 软件仓库][4]。
# yum install trafshow
Trafshow 在默认仓库中可以找到,所以我们可以轻松地使用下面的命令来利用 **apt** 包管理器安装它:
$ sudo apt-get install trafshow(注:原文少了 apt-get
$ sudo apt-get install trafshow
为了使用 trafshow 来执行监控任务,我们需要在虚拟终端或 shell 中执行下面的命令:
@ -275,7 +289,7 @@ Trafshow 在默认仓库中可以找到,所以我们可以轻松地使用下
![Trafshow](http://blog.linoxide.com/wp-content/uploads/2015/02/trafshow-all.png)
为了特别地监控 tcp 连接,如下面一样添加上 tcp 参数:
为了专门监控 tcp 连接,如下面一样添加上 tcp 参数:
$ sudo trafshow -i wlan2 tcp
@ -285,7 +299,7 @@ Trafshow 在默认仓库中可以找到,所以我们可以轻松地使用下
### 15) Vnstat ###
与大多数的其他工具相比Vnstat 有一点不同。实际上它运行一个后台服务或守护进程,并时刻记录着传输数据的大小。另外,它可以被用来生成一个带有网络使用历史记录的报告。
与大多数的其他工具相比Vnstat 有一点不同。实际上它运行一个后台服务或守护进程,并时刻记录着传输数据的大小。另外,它可以被用来生成一个网络使用历史记录的报告。
我们需要开启 EPEL 软件仓库,然后运行 **yum** 包管理器来安装 vnstat。
@ -301,7 +315,7 @@ Vnstat 在默认软件仓库中可以找到,所以我们可以使用下面的
![vnstat](http://blog.linoxide.com/wp-content/uploads/2015/02/vnstat.png)
为了实时地监控带宽使用情况,使用 -l 选项(实时模式)。然后它将以一种非常精确的方式来展示上行和下行数据所使用的带宽总量,但不会显示任何有关主机连接或进程的内部细节。
为了实时地监控带宽使用情况,使用 -l 选项(live 模式)。然后它将以一种非常精确的方式来展示上行和下行数据所使用的带宽总量,但不会显示任何有关主机连接或进程的内部细节。
$ vnstat -l
@ -313,7 +327,7 @@ Vnstat 在默认软件仓库中可以找到,所以我们可以使用下面的
### 16) tcptrack ###
[tcptrack][5] 可以展示 TCP 连接的状态它在一个给定的网络端口上进行监听。tcptrack 监控它们的状态并展示出一个经过排列且不断更新的有关来源/目标地址、带宽使用情况等信息的列表,这与 **top** 命令的输出非常类似 。
[tcptrack][5] 可以展示 TCP 连接的状态它在一个给定的网络端口上进行监听。tcptrack 监控它们的状态并展示出排序且不断更新的列表,包括来源/目标地址、带宽使用情况等信息,这与 **top** 命令的输出非常类似 。
鉴于 tcptrack 在软件仓库中,我们可以轻松地在 Debian、Ubuntu 系统中从软件仓库使用 **apt** 包管理器来安装 tcptrack。为此我们需要在 shell 或虚拟终端中执行下面的命令:
@ -329,7 +343,7 @@ Vnstat 在默认软件仓库中可以找到,所以我们可以使用下面的
注:这里我们下载了 rpmforge-release 的当前最新版本,即 0.5.3-1你总是可以从 rpmforge 软件仓库中下载其最新版本,并请在上面的命令中替换为你下载的版本。
**tcptrack** 需要以 root 权限或超级用户身份来运行。执行 tcptrack 时,我们需要带上那个我们想监视的网络接口 TCP 连接状况的接口名称。这里我们的接口名称为 wlan2所以如下面这样使用
**tcptrack** 需要以 root 权限或超级用户身份来运行。执行 tcptrack 时,我们需要带上监视的网络接口 TCP 连接状况的接口名称。这里我们的接口名称为 wlan2所以如下面这样使用
sudo tcptrack -i wlan2
@ -345,7 +359,7 @@ Vnstat 在默认软件仓库中可以找到,所以我们可以使用下面的
### 17) CBM ###
CBM 或 Color Bandwidth Meter 可以展示出当前所有网络设备的流量使用情况。这个程序是如此的简单,以至于应该可以从它的名称中看出其功能。CBM 的源代码和新版本可以在 [http://www.isotton.com/utils/cbm/][7] 上找到。
CBM Color Bandwidth Meter 可以展示出当前所有网络设备的流量使用情况。这个程序是如此的简单,以至于可以从它的名称中看出其功能。CBM 的源代码和新版本可以在 [http://www.isotton.com/utils/cbm/][7] 上找到。
鉴于 CBM 已经包含在软件仓库中,我们可以简单地使用 **apt** 包管理器从 Debian、Ubuntu 的软件仓库中安装 CBM。为此我们需要在一个 shell 窗口或虚拟终端中运行下面的命令:
@ -359,7 +373,7 @@ CBM 或 Color Bandwidth Meter 可以展示出当前所有网络设备的流量
### 18) bmon ###
[Bmon][8] 或 Bandwidth Monitoring ,是一个用于调试和实时监控带宽的工具。这个工具能够检索各种输入模块的统计数据。它提供了多种输出方式,包括一个基于 curses 库的界面轻量级的HTML输出以及 ASCII 输出格式。
[Bmon][8] Bandwidth Monitoring ,是一个用于调试和实时监控带宽的工具。这个工具能够检索各种输入模块的统计数据。它提供了多种输出方式,包括一个基于 curses 库的界面轻量级的HTML输出以及 ASCII 输出格式。
bmon 可以在软件仓库中找到,所以我们可以通过使用 apt 包管理器来在 Debian、Ubuntu 中安装它。为此,我们需要在一个 shell 窗口或虚拟终端中运行下面的命令:
@ -373,7 +387,7 @@ bmon 可以在软件仓库中找到,所以我们可以通过使用 apt 包管
### 19) tcpdump ###
[TCPDump][9] 是一个用于网络监控和数据获取的工具。它可以为我们节省很多的时间,并可用来调试网络或服务器 的相关问题。它打印出在某个网络接口上与布尔表达式匹配的数据包所包含的内容的一个描述。
[TCPDump][9] 是一个用于网络监控和数据获取的工具。它可以为我们节省很多的时间,并可用来调试网络或服务器的相关问题。它可以打印出在某个网络接口上与布尔表达式匹配的数据包所包含的内容的一个描述。
tcpdump 可以在 Debian、Ubuntu 的默认软件仓库中找到,我们可以简单地以 sudo 权限使用 apt 包管理器来安装它。为此,我们需要在一个 shell 窗口或虚拟终端中运行下面的命令:
@ -389,7 +403,6 @@ tcpdump 需要以 root 权限或超级用户来运行,我们需要带上我们
![tcpdump](http://blog.linoxide.com/wp-content/uploads/2015/02/tcpdump.png)
假如你只想监视一个特定的端口,则可以运行下面的命令。下面是一个针对 80 端口(网络服务器)的例子:
$ sudo tcpdump -i wlan2 'port 80'
@ -419,14 +432,15 @@ tcpdump 需要以 root 权限或超级用户来运行,我们需要带上我们
### 结论 ###
在第一部分中(注:我认为原文多了 first 这个单词,总之是前后文的内容有些不连贯),我们介绍了一些在 Linux 下的网络负载监控工具,这对于系统管理员甚至是新手来说,都是很有帮助的。在这篇文章中介绍的每一个工具都有其特点,不同的选项等,但最终它们都可以帮助你来监控你的网络流量。
在这篇文章中,我们介绍了一些在 Linux 下的网络负载监控工具,这对于系统管理员甚至是新手来说,都是很有帮助的。在这篇文章中介绍的每一个工具都具有其特点,不同的选项等,但最终它们都可以帮助你来监控你的网络流量。
--------------------------------------------------------------------------------
via: http://linoxide.com/monitoring-2/network-monitoring-tools-linux/
作者:[Bobbin Zachariah][a]
译者:[FSSlc](https://github.com/FSSlc)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -4,7 +4,7 @@
![KVM Management in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/KVM-Management-in-Linux.jpg)
Linux系统的KVM管理
*Linux系统的KVM管理*
在这篇文章里没有什么新的概念,我们只是用命令行工具重复之前所做过的事情,也没有什么前提条件,都是相同的过程,之前的文章我们都讨论过。
@ -31,35 +31,40 @@ Virsh命令行工具是一款管理virsh客户域的用户界面。virsh程序
# virsh pool-define-as Spool1 dir - - - - "/mnt/personal-data/SPool1/"
![Create New Storage Pool](http://www.tecmint.com/wp-content/uploads/2015/02/Create-New-Storage-Pool.png)
创建新存储池
*创建新存储池*
**2. 查看环境中我们所有的存储池,用以下命令。**
# virsh pool-list --all
![List All Storage Pools](http://www.tecmint.com/wp-content/uploads/2015/02/List-All-Storage-Pools.png)
列出所有存储池
*列出所有存储池*
**3. 现在我们来构造存储池了,用以下命令来构造我们刚才定义的存储池。**
# virsh pool-build Spool1
![Build Storage Pool](http://www.tecmint.com/wp-content/uploads/2015/02/Build-Storage-Pool.png)
构造存储池
**4. 用virsh带pool-start的命令来激活并启动我们刚才创建并构造完成的存储池。**
*构造存储池*
**4. 用带pool-start参数的virsh命令来激活并启动我们刚才创建并构造完成的存储池。**
# virsh pool-start Spool1
![Active Storage Pool](http://www.tecmint.com/wp-content/uploads/2015/02/Active-Storage-Pool.png)
激活存储池
*激活存储池*
**5. 查看环境中存储池的状态,用以下命令。**
# virsh pool-list --all
![Check Storage Pool Status](http://www.tecmint.com/wp-content/uploads/2015/02/Check-Storage-Pool-Status.png)
查看存储池状态
*查看存储池状态*
你会发现Spool1的状态变成了已激活。
@ -68,14 +73,16 @@ Virsh命令行工具是一款管理virsh客户域的用户界面。virsh程序
# virsh pool-autostart Spool1
![Configure KVM Storage Pool](http://www.tecmint.com/wp-content/uploads/2015/02/Configure-Storage-Pool.png)
配置KVM存储池
*配置KVM存储池*
**7. 最后来看看我们新的存储池的信息吧。**
# virsh pool-info Spool1
![Check KVM Storage Pool Information](http://www.tecmint.com/wp-content/uploads/2015/02/Check-Storage-Pool-Information.png)
查看KVM存储池信息
*查看KVM存储池信息*
恭喜你Spool1已经准备好待命接下来我们试着创建存储卷来使用它。
@ -90,12 +97,14 @@ Virsh命令行工具是一款管理virsh客户域的用户界面。virsh程序
# qemu-img create -f raw /mnt/personal-data/SPool1/SVol1.img 10G
![Create Storage Volume](http://www.tecmint.com/wp-content/uploads/2015/02/Create-Storage-Volumes.png)
创建存储卷
*创建存储卷*
**9. 通过使用带info的qemu-img命令你可以获取到你的新磁盘映像的一些信息。**
![Check Storage Volume Information](http://www.tecmint.com/wp-content/uploads/2015/02/Check-Storage-Volume-Information.png)
查看存储卷信息
*查看存储卷信息*
**警告**: 不要用qemu-img命令来修改被运行中的虚拟机或任何其它进程所正在使用的映像那样映像会被破坏。
@ -120,15 +129,18 @@ Virsh命令行工具是一款管理virsh客户域的用户界面。virsh程序
# virt-install --name=rhel7 --disk path=/mnt/personal-data/SPool1/SVol1.img --graphics spice --vcpu=1 --ram=1024 --location=/run/media/dos/9e6f605a-f502-4e98-826e-e6376caea288/rhel-server-7.0-x86_64-dvd.iso --network bridge=virbr0
![Create New Virtual Machine](http://www.tecmint.com/wp-content/uploads/2015/02/Create-New-Virtual-Machines.png)
创建新的虚拟机
*创建新的虚拟机*
**11. 你会看到弹出一个virt-vierwer窗口像是在通过它在与虚拟机通信。**
![Booting Virtual Machine](http://www.tecmint.com/wp-content/uploads/2015/02/Booting-Virtual-Machine.jpeg)
虚拟机启动程式
*虚拟机启动程式*
![Installation of Virtual Machine](http://www.tecmint.com/wp-content/uploads/2015/02/Installation-of-Virtual-Machine.jpeg)
虚拟机安装过程
*虚拟机安装过程*
### 结论 ###
@ -143,7 +155,7 @@ via: http://www.tecmint.com/kvm-management-tools-to-manage-virtual-machines/
作者:[Mohammad Dosoukey][a]
译者:[ZTinoZ](https://github.com/ZTinoZ)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,5 +1,6 @@
[已解决] Ubuntu 14.04从待机中唤醒后鼠标键盘出现僵死情况 [快速小贴士]
================================================================================
修复 Ubuntu 14.04 从待机中唤醒后鼠标键盘出现僵死情况
=========
### 问题: ###
当Ubuntu14.04或14.10从睡眠和待机状态恢复时鼠标和键盘出现僵死不能点击也不能输入。解决这种情况是唯一方法就是按关机键强关系统这不仅非常不便且令人恼火。因为在Ubuntu的默认情况中合上笔记本等同于切换到睡眠模式。
@ -12,15 +13,15 @@
sudo apt-get install --reinstall xserver-xorg-input-all
这则贴士源自一个自由开源读者Dev的提问。快试试这篇贴士看看是否对你也有效。在一个类似的问题中你可以[修复Ubuntu登录后无Unity界面、侧边栏和Dash的问题][1]
这则贴士源自一个我们的读者Dev的提问。快试试这篇贴士看看是否对你也有效。在一个类似的问题中你可以[修复Ubuntu登录后无Unity界面、侧边栏和Dash的问题][1]
--------------------------------------------------------------------------------
via: http://itsfoss.com/keyboard-mouse-freeze-suspend/
作者:[Abhishek][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
译者:[martin2011qi](https://github.com/martin2011qi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,12 +1,13 @@
11个Linux终端命令,让你的世界摇滚起来
11个让你吃惊的 Linux 终端命令
================================================================================
我已经用了十年的Linux了通过今天这篇文章我将向大家展示一系列的我希望一开始就有人教导而不是曾在我成长道路上绊住我的Linux命令、工具和花招。
![Linux Keyboard Shortcuts.](http://f.tqn.com/y/linux/1/L/m/J/1/keyboardshortcuts.png)
Linux的快捷键。
我已经用了十年的Linux了通过今天这篇文章我将向大家展示一系列的命令、工具和技巧我希望一开始就有人告诉我这些而不是曾在我成长道路上绊住我。
### 1. 命令行日常系快捷键 ###
![Linux Keyboard Shortcuts.](http://f.tqn.com/y/linux/1/L/m/J/1/keyboardshortcuts.png)
*Linux的快捷键。*
如下的快捷方式非常有用,能够极大的提升你的工作效率:
- CTRL + U - 剪切光标前的内容
@ -16,11 +17,11 @@ Linux的快捷键。
- CTRL + A - 移动光标到行首
- ALT + F - 跳向下一个空格
- ALT + B - 跳回上一个空格
- ALT + Backspace - 删除前一个
- CTRL + W - 剪切光标后一个
- ALT + Backspace - 删除前一个单词
- CTRL + W - 剪切光标后一个单词
- Shift + Insert - 向终端内粘贴文本
那么为了让上内容更易理解来看下面的这行命令。
那么为了让上内容更易理解来看下面的这行命令。
sudo apt-get intall programname
@ -28,7 +29,7 @@ Linux的快捷键。
想象现在光标正在行末我们有很多的方法将她退回单词install并替换它。
我可以按两次ALT+B这样光标就会在如下的位置这里用^代光标的位置)。
我可以按两次ALT+B这样光标就会在如下的位置这里用^代光标的位置)。
sudo apt-get^intall programname
@ -36,32 +37,36 @@ Linux的快捷键。
如果你想将浏览器中的文本复制到终端,可以使用快捷键"shift + insert"。
![](http://f.tqn.com/y/linux/1/L/n/J/1/sudotricks2.png)
### 2. SUDO !! ###
这个命令如果你还不知道我觉得你应该好好感谢我因为如果你不知道那每次你在输入长串命令后看到“permission denied”后一定会痛恼不堪。
![](http://f.tqn.com/y/linux/1/L/n/J/1/sudotricks2.png)
*sudo !!*
如果你还不知道这个命令我觉得你应该好好感谢我因为如果你不知道的话那每次你在输入长串命令后看到“permission denied”后一定会痛恼不堪。
- sudo !!
如何使用sudo !!?很简单。试想你刚输入了如下命令:
如何使用sudo !!很简单。试想你刚输入了如下命令:
apt-get install ranger
一定会出现"Permission denied"除非你的登录了足够高权限的账户。
一定会出现“Permission denied”除非你已经登录了足够高权限的账户。
sudo !!就会用sudo的形式运行上一条命令。所以上一条命令可以看成是这样:
sudo !! 就会用 sudo 的形式运行上一条命令。所以上一条命令就变成了这样:
sudo apt-get install ranger
如果你不知道什么是sudo[戳这里][1]。
![Pause Terminal Applications.](http://f.tqn.com/y/linux/1/L/o/J/1/pauseapps.png)
暂停终端运行的应用程序。
如果你不知道什么是sudo[戳这里][1]。
### 3. 暂停并在后台运行命令 ###
我曾经写过一篇如何在终端后台运行命令的指南。
![Pause Terminal Applications.](http://f.tqn.com/y/linux/1/L/o/J/1/pauseapps.png)
*暂停终端运行的应用程序。*
我曾经写过一篇[如何在终端后台运行命令的指南][13]。
- CTRL + Z - 暂停应用程序
- fg - 重新将程序唤到前台
@ -74,41 +79,42 @@ sudo !!就会用sudo的形式运行上一条命令。所以上一条命令可以
文件编辑到一半你意识到你需要马上在终端输入些命令但是nano在前台运行让你不能输入。
你可能觉得唯一的方法就是保存文件,推出nano运行命令以后在重新打开nano。
你可能觉得唯一的方法就是保存文件,退出 nano运行命令以后在重新打开nano。
其实你只要按CTRL + Z前台的命令就会暂停画面就切回到命令行了。然后你就能运行你想要运行命令等命令运行完后在终端窗口输入“fg”就可以回到先前暂停的任务。
其实你只要按CTRL + Z前台的命令就会暂停画面就切回到命令行了。然后你就能运行你想要运行命令等命令运行完后在终端窗口输入“fg”就可以回到先前暂停的任务。
有一个尝试非常有趣就是用nano打开文件输入一些东西然后暂停会话。再用nano打开另一个文件输入一些什么后再暂停会话。如果你输入“fg”你将回到第二个用nano打开的文件。只有退出nano再输入“fg”你才会回到第一个用nano打开的文件。
![nohup.](http://f.tqn.com/y/linux/1/L/p/J/1/nohup3.png)
nohup.
### 4. 使用nohup在登出SSH会话后仍运行命令 ###
如果你用ssh登录别的机器时[nohup命令]真的非常有用。
![nohup.](http://f.tqn.com/y/linux/1/L/p/J/1/nohup3.png)
*nohup*
如果你用ssh登录别的机器时[nohup命令][2]真的非常有用。
那么怎么使用nohup呢
想象一下你使用ssh远程登录到另一台电脑上你运行了一条非常耗时的命令然后退出了ssh会话不过命令仍在执行。而nohup可以将这一场景变成现实。
举个例子以测试为目的我用[树莓派][3]来下载发行版
举个例子,因为测试的需要,我用我的[树莓派][3]来下载发行版。我绝对不会给我的树莓派外接显示器、键盘或鼠标
我绝对不会给我的树莓派外接显示器、键盘或鼠标。
一般我总是用[SSH] [4]从笔记本电脑连接到树莓派。如果我在不用nohup的情况下使用树莓派下载大型文件那我就必须等待到下载完成后才能登出ssh会话关掉笔记本。如果是这样那我为什么要使用树莓派下文件呢
一般我总是用[SSH][4]从笔记本电脑连接到树莓派。如果我在不用nohup的情况下使用树莓派下载大型文件那我就必须等待到下载完成后才能登出ssh会话关掉笔记本。可如果是这样那我为什么要使用树莓派下文件呢
使用nohup的方法也很简单只需如下例中在nohup后输入要执行的命令即可
nohup wget http://mirror.is.co.za/mirrors/linuxmint.com/iso//stable/17.1/linuxmint-17.1-cinnamon-64bit.iso &
![Schedule tasks with at.](http://f.tqn.com/y/linux/1/L/q/J/1/at.png)
At管理任务日程
### 5. 特定的时间运行Linux命令 ###
![Schedule tasks with at.](http://f.tqn.com/y/linux/1/L/q/J/1/at.png)
*At管理任务日程*
nohup命令在你用SSH连接到服务器并在上面保持执行SSH登出前任务的时候十分有用。
想一下如果你需要在特定的时间执行同一个命令,这种情况该怎么办呢?
想一下如果你需要在特定的时间执行相同的命令,这种情况该怎么办呢?
命令at就能妥善解决这一情况。以下是at使用示例。
@ -116,78 +122,80 @@ At管理任务日程
at> cowsay 'hello'
at> CTRL + D
上面的命令能在周五下午10时38分运行程序[cowsay] [5]。
上面的命令能在周五下午10时38分运行程序[cowsay][5]。
使用的语法就是at后追加日期时间。
使用的语法就是at后追加日期时间。当at>提示符出现后就可以输入你想在那个时间运行的命令了。
当at>提示符出现后就可以输入你想在那个时间运行的命令了
CTRL + D 返回终端
CTRL + D返回终端
还有许多日期和时间的格式都需要你好好翻一翻at的man手册来找到更多的使用方式
还有许多日期和时间的格式都是值得的你好好翻一翻at的man手册来找到更多的使用方式。
![](http://f.tqn.com/y/linux/1/L/l/J/1/manmost.png)
### 6. Man手册 ###
Man手册会为你列出命令和参数的使用大纲教你如何使用她们。
![](http://f.tqn.com/y/linux/1/L/l/J/1/manmost.png)
Man手册看起开沉闷呆板。我思忖她们也不是被设计来娱乐我们的
*彩色man 手册*
不过这不代表你不能做些什么来使她们变得性感点。
Man手册会为你列出命令和参数的使用大纲教你如何使用她们。Man手册看起来沉闷呆板。我思忖她们也不是被设计来娱乐我们的
不过这不代表你不能做些什么来使她们变得漂亮些。
export PAGER=most
你需要 most她会使你的你的man手册的色彩更加绚丽。
你需要安装 most她会使你的你的man手册的色彩更加绚丽。
你可以用下命令给man手册设定指定的行长
你可以用下命令给man手册设定指定的行长
export MANWIDTH=80
最后,如果你有浏览器,你可以使用-H在默认浏览器中打开任意的man页。
最后,如果你有一个可用的浏览器,你可以使用-H在默认浏览器中打开任意的man页。
man -H <command>
注意啦,以上的命令只有在你将默认的浏览器已经设置到环境变量$BROWSER中了之后才效果哟。
注意啦,以上的命令只有在你将默认的浏览器设置到环境变量$BROWSER中了之后才效果哟。
![View Processes With htop.](http://f.tqn.com/y/linux/1/L/r/J/1/nohup2.png)
使用htop查看进程。
### 7. 使用htop查看和管理进程 ###
你用哪个命令找出电脑上正在运行的进程的呢?我敢打赌是‘[ps][6]’并在其后加不同的参数来得到你所想要的不同输出。
![View Processes With htop.](http://f.tqn.com/y/linux/1/L/r/J/1/nohup2.png)
*使用htop查看进程。*
你用哪个命令找出电脑上正在运行的进程的呢?我敢打赌是‘[ps][6]’并在其后加不同的参数来得到你所想要的不同输出。
安装‘[htop][7]’吧!绝对让你相见恨晚。
htop在终端中将进程以列表的方式呈现有点类似于Windows中的任务管理器。
你可以使用功能键的组合来切换排列的方式和展示出来的项。你也可以在htop中直接杀死进程。
htop在终端中将进程以列表的方式呈现有点类似于Windows中的任务管理器。你可以使用功能键的组合来切换排列的方式和展示出来的项。你也可以在htop中直接杀死进程。
在终端中简单的输入htop即可运行。
htop
![Command Line File Manager - Ranger.](http://f.tqn.com/y/linux/1/L/s/J/1/ranger.png)
命令行文件管理 - Ranger.
### 8. 使用ranger浏览文件系统 ###
如果说htop是命令行进程控制的好帮手那么[ranger][8]就是命令行浏览文件系统的好帮手。
![Command Line File Manager - Ranger.](http://f.tqn.com/y/linux/1/L/s/J/1/ranger.png)
*命令行文件管理 - Ranger*
如果说htop是命令行进程控制的好帮手那么[ranger][8]就是命令行浏览文件系统的好帮手。
你在用之前可能需要先安装,不过一旦安装了以后就可以在命令行输入以下命令启动她:
ranger
在命令行窗口中ranger和一些别的文件管理器很像但是她是左右结构的比起上下的来意味着你按左方向键你将前进到上一个文件夹结构而右方向键则会切换到下一个。
在命令行窗口中ranger和一些别的文件管理器很像但是相比上下结构布局,她是左右结构的,这意味着你按左方向键你将前进到上一个文件夹,而右方向键则会切换到下一个。
在使用前ranger的man手册还是值得一读的这样你就可以用快捷键操作ranger了。
![Cancel Linux Shutdown.](http://f.tqn.com/y/linux/1/L/t/J/1/shutdown.png)
Linux取消关机。
### 9. 取消关机 ###
无论是在命令行还是图形用户界面[关机][9]后发现自己不是真的想要关机。
![Cancel Linux Shutdown.](http://f.tqn.com/y/linux/1/L/t/J/1/shutdown.png)
*Linux取消关机。*
无论是在命令行还是图形用户界面[关机][9]后,才发现自己不是真的想要关机。
shutdown -c
@ -197,11 +205,13 @@ Linux取消关机。
- [pkill][10] shutdown
![Kill Hung Processes With XKill.](http://f.tqn.com/y/linux/1/L/u/J/1/killhungprocesses.png)
使用XKill杀死挂起进程。
### 10. 杀死挂起进程的简单方法 ###
![Kill Hung Processes With XKill.](http://f.tqn.com/y/linux/1/L/u/J/1/killhungprocesses.png)
*使用XKill杀死挂起进程。*
想象一下,你正在运行的应用程序不明原因的僵死了。
你可以使用ps -ef来找到该进程后杀掉或者使用htop
@ -214,18 +224,20 @@ Linux取消关机。
那如果整个系统挂掉了怎么办呢?
按住键盘上的altsysrq同时输入
按住键盘上的altsysrq不放,然后慢慢输入以下键
- [REISUB][12]
这样不按电源键你的计算机也能重启了。
![youtube-dl.](http://f.tqn.com/y/linux/1/L/v/J/1/youtubedl2.png)
youtube-dl.
### 11. 下载Youtube视频 ###
一般来说我们大多数人都喜欢看Youtube的视频也会通过钟爱的播放器播放Youtube的流。
![youtube-dl.](http://f.tqn.com/y/linux/1/L/v/J/1/youtubedl2.png)
*youtube-dl.*
一般来说我们大多数人都喜欢看Youtube的视频也会通过钟爱的播放器播放Youtube的流媒体。
如果你需要离线一段时间(比如:从苏格兰南部坐飞机到英格兰南部旅游的这段时间)那么你可能希望下载一些视频到存储设备中,到闲暇时观看。
@ -235,7 +247,7 @@ youtube-dl.
youtube-dl url-to-video
在Youtubu视频页面点击分享链接得到视频的url。只要简单的复制链接在粘帖到命令行就行了要用shift + insert快捷键哟
可以在Youtubu视频页面点击分享链接得到视频的url。只要简单的复制链接在粘帖到命令行就行了要用shift + insert快捷键哟
### 总结 ###
@ -246,8 +258,8 @@ youtube-dl.
via: http://linux.about.com/od/commands/tp/11-Linux-Terminal-Commands-That-Will-Rock-Your-World.htm
作者:[Gary Newell][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
译者:[martin2011qi](https://github.com/martin2011qi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
@ -264,3 +276,4 @@ via: http://linux.about.com/od/commands/tp/11-Linux-Terminal-Commands-That-Will-
[10]:http://linux.about.com/library/cmd/blcmdl1_pkill.htm
[11]:http://linux.about.com/od/funnymanpages/a/funman_xkill.htm
[12]:http://blog.kember.net/articles/reisub-the-gentle-linux-restart/
[13]:http://linux.about.com/od/commands/fl/How-To-Run-Linux-Programs-From-The-Terminal-In-Background-Mode.htm

View File

@ -1,12 +1,12 @@
Linux有问必答--如何使用命令行压缩JPEG图像
Linux有问必答:如何在命令行下压缩JPEG图像
================================================================================
> **问题**: 我有许多数码照相机拍出来的照片。我想在上传到Dropbox之前优化和压缩下JPEG图片。有没有什么简单的方法压缩JPEG图片并不损耗他们的质量
如今拍照设备如智能手机、数码相机拍出来的图片分辨率越来越大。甚至3630万像素的Nikon D800已经冲入市场并且这个趋势根本停不下来。如今的拍照设备不断地提高着照片分辨率使得我们不得不压缩后再上传到有储存限制、带宽限制的云。
事实上这里有一个非常简单的方法压缩JPEG图像。一个叫“jpegoptim”命令行工具可以帮助你“无损”美化JPEG图像所以你可以压缩JPEG图片而不至于牺牲他们的质量。万一你的存储空间和带宽预算真的很少jpegoptim也支持“有损”压缩来调整图像大小。
事实上这里有一个非常简单的方法压缩JPEG图像。一个叫“jpegoptim”命令行工具可以帮助你“无损”美化JPEG图像你可以压缩JPEG图片而不至于牺牲他们的质量。万一你的存储空间和带宽预算真的很少jpegoptim也支持“有损”压缩来调整图像大小。
如果要压缩PNG图像参考[this guideline][1]例子。
如果要压缩PNG图像参考[这个指南][1]的例子。
### 安装jpegoptim ###
@ -34,7 +34,7 @@ CentOS/RHEL安装先开启[EPEL库][2],然后运行下列命令:
注意,原始图像会被压缩后图像覆盖。
如果jpegoptim不能无损美化图像将不会覆盖
如果jpegoptim不能无损美化图像将不会覆盖它:
$ jpegoptim -v photo.jpg
@ -46,21 +46,21 @@ CentOS/RHEL安装先开启[EPEL库][2],然后运行下列命令:
$ jpegoptim -d ./compressed photo.jpg
这样,压缩的图片将会保存在./compressed目录同样的输入文件名)
这样,压缩的图片将会保存在./compressed目录同样的输入文件名)
如果你想要保护文件的创建修改时间,使用"-p"参数。这样压缩后的图片会得到与原始图片相同的日期时间。
$ jpegoptim -d ./compressed -p photo.jpg
如果你只是想获得无损压缩率,使用"-n"参数来模拟压缩,然后它会打印压缩率。
如果你只是想看看无损压缩率而不是真的想压缩它们,使用"-n"参数来模拟压缩,然后它会显示出压缩率。
$ jpegoptim -n photo.jpg
### 有损压缩JPG图像 ###
万一你真的需要要保存在云空间上你可以使用有损压缩JPG图片。
万一你真的需要要保存在云空间上,你可以使用有损压缩JPG图片。
这种情况下,使用"-m<质量>"选项质量数范围0到100。0是最好质量100是最质量)
这种情况下,使用"-m<质量>"选项质量数范围0到100。0是最好质量100是最质量)
例如用50%质量压缩图片:
@ -76,7 +76,7 @@ CentOS/RHEL安装先开启[EPEL库][2],然后运行下列命令:
### 一次压缩多张JPEG图像 ###
最常见的情况是需要压缩一个目录下的多张JPEG图像文件。为了应付这种情况你可以使用接下的脚本。
最常见的情况是需要压缩一个目录下的多张JPEG图像文件。为了应付这种情况你可以使用接下的脚本。
#!/bin/sh
@ -90,11 +90,11 @@ CentOS/RHEL安装先开启[EPEL库][2],然后运行下列命令:
via: http://ask.xmodulo.com/compress-jpeg-images-command-line-linux.html
作者:[Dan Nanni][a]
译者:[VicYu/Vic020](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
译者:[VicYu/Vic020](https://github.com/Vic020)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni
[1]:http://xmodulo.com/how-to-compress-png-files-on-linux.html
[2]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html
[2]:https://linux.cn/article-2324-1.html

View File

@ -1,3 +1,4 @@
Translating by H-mudcup
Synfig Studio 1.0 — Open Source Animation Gets Serious
================================================================================
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/04/synfig-free-animations-750x467.jpg)
@ -38,4 +39,4 @@ via: http://www.omgubuntu.co.uk/2015/04/synfig-studio-new-release-features
[a]:https://plus.google.com/117485690627814051450/?rel=author
[1]:http://sourceforge.net/projects/synfig/files/releases/1.0/linux/synfigstudio_1.0_amd64.deb/download
[2]:http://sourceforge.net/projects/synfig/files/releases/1.0/linux/synfigstudio_1.0_x86.deb/download
[2]:http://sourceforge.net/projects/synfig/files/releases/1.0/linux/synfigstudio_1.0_x86.deb/download

View File

@ -0,0 +1,115 @@
Guake 0.7.0 Released A Drop-Down Terminal for Gnome Desktops
================================================================================
Linux commandline is the best and most powerful thing that fascinates a new user and provides extreme power to experienced users and geeks. For those who work on Server and Production, they are already aware of this fact. It would be interesting to know that Linux console was one of those first features of the kernel that was written by Linus Torvalds way back in the year 1991.
Terminal is a powerful tool that is very reliable as it does not have any movable part. Terminal serves as an intermediate between console and GUI environment. Terminal themselves are GUI application that run on top of a desktop environment. There are a lot of terminal application some of which are Desktop Environment specific and rest are universal. Terminator, Konsole, Gnome-Terminal, Terminology, XFCE terminal, xterm are a few terminal emulators to name.
You may get a list of most widely used Terminal Emulator follow the below link.
- [20 Useful Terminals for Linux][1]
Last day while surfing web, I came across a terminal namely guake which is a terminal for gnome. Though this is not the first time I have learned about Guake. Id known this application nearly one year ago but somehow I could not write on this and later it was out of my mind until I heard it again. So finally the article is here. We will be taking you to Guake features, installation on Debian, Ubuntu and Fedora followed by quick testing.
#### What is Guake? ####
Guake is a Drop Down Terminal for Gnome Environment. Written from scratch mostly in Python and a little in C this application is released under GPLv2+ and is available for Linux and alike systems. Guake is inspired by a console in computer game Quake which slides down from the top by pressing a specially Key (Default is F12) and then slides-up when the same key is pressed.
Important to mention that Guake is not the first of this kind. Yakuake which stands for Yet Another Kuake, a terminal emulator for KDE Desktop Environment and Tilda which is a GTK+ terminal Emulator are also inspired by the same slide up/down console of computer game Quake.
#### Features of Guake ####
- Lightweight
- Simple Easy and Elegant
- Functional
- Powerful
- Good Looking
- Smooth integration of terminal into GUI
- Appears when you call and disappear once you are done by pressing a predefined hot key
- Support for hotkeys, tabs, background transparency makes it a brilliant application, must for every Gnome User.
- Extremely configurable
- Plenty of color palette included, fixed and recognized
- Shortcut for transparency level
- Run a script when Guake starts via Guake Preferences.
- Able to run on more than one monitor
Guake 0.7.0 was released recently, which brings numerous fixes as well as some new features as discussed above. For complete Guake 0.7.0 changelog and source tarball packages can be found [Here][2].
### Installing Guake Terminal in Linux ###
If you are interested in compiling Guake from source you may download the source from the link above, build it yourself before installing.
However Guake is available to be installed on most of the distributions from repository or by adding an additional repository. Here, we will be installing Guake on Debian, Ubuntu, Linux Mint and Fedora systems.
First get the latest software package list from the repository and then install Guake from the default repository as shown below.
---------------- On Debian, Ubuntu and Linux Mint ----------------
$ sudo apt-get update
$ apt-get install guake
----------
---------------- On Fedora 19 Onwards ----------------
# yum update
# yum install guake
After installation, start the Guake from another terminal as:
$ guake
After starting it, use F12 (Default) to roll down and roll up the terminal on your Gnome Desktop.
Seems very beautiful specially the transparent background. Roll down… Roll up… Roll down… Roll up…. run command. Open another tab run command… Roll up… Roll down…
![Guake Terminal in Action](http://www.tecmint.com/wp-content/uploads/2015/05/Guake.png)
Guake Terminal in Action
If your wallpaper or working windows color dont match you may like to change your wallpaper or reduce the transparency of the Guake terminal color.
Next is to look into Guake Properties to edit settings as per requirements. Run Guake Preferences either by running it from Application Menu or by running the below command.
$ guake --preferences
![Guake Terminal Properties](http://www.tecmint.com/wp-content/uploads/2015/05/Guake-Properties.png)
Guake Terminal Properties
Scrolling Properties..
![Guake Scrolling Settings](http://www.tecmint.com/wp-content/uploads/2015/05/Guake-Scrolling.png)
Guake Scrolling Settings
Appearance Properties Here you can modify text and background color as well as tune transparency.
![Appearance Properties](http://www.tecmint.com/wp-content/uploads/2015/05/Appearance-Properties.png)
Appearance Properties
Keyboard Shortcuts Here you may edit and Modify Toggle key for Guage Visibility (default is F12).
![Keyboard Shortcuts](http://www.tecmint.com/wp-content/uploads/2015/05/Keyboard-Shortcuts.png)
Keyboard Shortcuts
Compatibility Setting Perhaps you wont need to edit it.
![Compatibility Setting](http://www.tecmint.com/wp-content/uploads/2015/05/Compatibility-Setting.png)
Compatibility Setting
### Conclusion ###
This Project is not too young and not too old, hence has reached certain level of maturity and is quiet solid and works out of the box. For someone like me who need to switch between GUI and Console very often Guake is a boon. I dont need to manage an extra window, open and close frequently, use tab among a huge pool of opened applications to find terminal or switch to different workspace to manage terminal now all I need is F12.
I think this is a must tool for any Linux user who makes use of GUI and Console at the same time, equally. I am going to recommend it to anyone who want to work on a system where interaction between GUI and Console is smooth and hassle free.
Thats all for now. Let us know if there is any problem in installing and running. We will be here to help you. Also tell us yours experience about Guake. Provide us with your valuable feedback in the comments below. Like and share us and help us get spread.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/install-guake-terminal-ubuntu-mint-fedora/
作者:[Avishek Kumar][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/avishek/
[1]:http://www.tecmint.com/linux-terminal-emulators/
[2]:https://github.com/Guake/guake/releases/tag/0.7.0

View File

@ -0,0 +1,826 @@
45 Zypper Commands to Manage Suse Linux Package Management
================================================================================
SUSE (Software and System Entwicklung (Germany) meaning Software and System Development, in English) Linux lies on top of Linux Kernel brought by Novell. SUSE comes in two pack. One of them is called OpenSUSE, which is freely available (free as in speech as well as free as in wine). It is a community driven project packed with latest application support, the latest stable release of OpenSUSE Linux is 13.2.
The other is SUSE Linux Enterprise which is a commercial Linux Distribution designed specially for enterprise and production. SUSE Linux Enterprise edition comes with a variety of Enterprise Applications and features suited for production environment, the latest stable release of SUSE Linux Enterprise Edition is 12.
You may like to check the detailed installation instruction of SUSE Linux Enterprise Server at:
- [Installation of SUSE Linux Enterprise Server 12][1]
Zypper and YaST are the Package Manager for SUSE Linux, which works on top of RPM.
YaST which stands for Yet another Setup Tool is a tool that works on OpenSUSE and SUSE Enterprise edition to administer, setup and configure SUSE Linux.
Zypper is the command line interface of ZYpp package manager for installing, removing and updating SUSE. ZYpp is the package management engine that powers both Zypper and YaST.
Here in this article we will see Zypper in action, which will be installing, updating, removing and doing every other thing a package manager can do. Here we go…
**Important** : Remember all these command are meant for system wide changes hence must be run as root, else the command will fail.
### Getting Basic Help with Zypper ###
1. Run zypper without any option, will give you a list of all global options and commands.
# zypper
Usage:
zypper [--global-options]
2. To get help on a specific command say in (install), run the below commands.
# zypper help in
OR
# zypper help install
install (in) [options] <capability|rpm_file_uri> ...
Install packages with specified capabilities or RPM files with specified
location. A capability is NAME[.ARCH][OP], where OP is one
of <, <=, =, >=, >.
Command options:
--from <alias|#|URI> Select packages from the specified repository.
-r, --repo <alias|#|URI> Load only the specified repository.
-t, --type Type of package (package, patch, pattern, product, srcpackage).
Default: package.
-n, --name Select packages by plain name, not by capability.
-C, --capability Select packages by capability.
-f, --force Install even if the item is already installed (reinstall),
downgraded or changes vendor or architecture.
--oldpackage Allow to replace a newer item with an older one.
Handy if you are doing a rollback. Unlike --force
it will not enforce a reinstall.
--replacefiles Install the packages even if they replace files from other,
already installed, packages. Default is to treat file conflicts
as an error. --download-as-needed disables the fileconflict check.
......
3. Search for a package (say gnome-desktop) before installing.
# zypper se gnome-desktop
Retrieving repository 'openSUSE-13.2-Debug' metadata ............................................................[done]
Building repository 'openSUSE-13.2-Debug' cache .................................................................[done]
Retrieving repository 'openSUSE-13.2-Non-Oss' metadata ......................................................... [done]
Building repository 'openSUSE-13.2-Non-Oss' cache ...............................................................[done]
Retrieving repository 'openSUSE-13.2-Oss' metadata ..............................................................[done]
Building repository 'openSUSE-13.2-Oss' cache ...................................................................[done]
Retrieving repository 'openSUSE-13.2-Update' metadata ...........................................................[done]
Building repository 'openSUSE-13.2-Update' cache ................................................................[done]
Retrieving repository 'openSUSE-13.2-Update-Non-Oss' metadata ...................................................[done]
Building repository 'openSUSE-13.2-Update-Non-Oss' cache ........................................................[done]
Loading repository data...
Reading installed packages...
S | Name | Summary | Type
--+---------------------------------------+-----------------------------------------------------------+-----------
| gnome-desktop2-lang | Languages for package gnome-desktop2 | package
| gnome-desktop2 | The GNOME Desktop API Library | package
| libgnome-desktop-2-17 | The GNOME Desktop API Library | package
| libgnome-desktop-3-10 | The GNOME Desktop API Library | package
| libgnome-desktop-3-devel | The GNOME Desktop API Library -- Development Files | package
| libgnome-desktop-3_0-common | The GNOME Desktop API Library -- Common data files | package
| gnome-desktop-debugsource | Debug sources for package gnome-desktop | package
| gnome-desktop-sharp2-debugsource | Debug sources for package gnome-desktop-sharp2 | package
| gnome-desktop2-debugsource | Debug sources for package gnome-desktop2 | package
| libgnome-desktop-2-17-debuginfo | Debug information for package libgnome-desktop-2-17 | package
| libgnome-desktop-3-10-debuginfo | Debug information for package libgnome-desktop-3-10 | package
| libgnome-desktop-3_0-common-debuginfo | Debug information for package libgnome-desktop-3_0-common | package
| libgnome-desktop-2-17-debuginfo-32bit | Debug information for package libgnome-desktop-2-17 | package
| libgnome-desktop-3-10-debuginfo-32bit | Debug information for package libgnome-desktop-3-10 | package
| gnome-desktop-sharp2 | Mono bindings for libgnome-desktop | package
| libgnome-desktop-2-devel | The GNOME Desktop API Library -- Development Files | package
| gnome-desktop-lang | Languages for package gnome-desktop | package
| libgnome-desktop-2-17-32bit | The GNOME Desktop API Library | package
| libgnome-desktop-3-10-32bit | The GNOME Desktop API Library | package
| gnome-desktop | The GNOME Desktop API Library | srcpackage
4. Get information on a pattern package (say lamp_server) using following command.
# zypper info -t pattern lamp_server
Loading repository data...
Reading installed packages...
Information for pattern lamp_server:
------------------------------------
Repository: openSUSE-13.2-Update
Name: lamp_server
Version: 20141007-5.1
Arch: x86_64
Vendor: openSUSE
Installed: No
Visible to User: Yes
Summary: Web and LAMP Server
Description:
Software to set up a Web server that is able to serve static, dynamic, and interactive content (like a Web shop). This includes Apache HTTP Server, the database management system MySQL,
and scripting languages such as PHP, Python, Ruby on Rails, or Perl.
Contents:
S | Name | Type | Dependency
--+-------------------------------+---------+-----------
| apache2-mod_php5 | package |
| php5-iconv | package |
i | patterns-openSUSE-base | package |
i | apache2-prefork | package |
| php5-dom | package |
| php5-mysql | package |
i | apache2 | package |
| apache2-example-pages | package |
| mariadb | package |
| apache2-mod_perl | package |
| php5-ctype | package |
| apache2-doc | package |
| yast2-http-server | package |
| patterns-openSUSE-lamp_server | package |
5. To open zypper shell session run the below command.
# zypper shell
OR
# zypper sh
zypper> help
Usage:
zypper [--global-options]
**Note**: On Zypper shell type help to get a list of global options and commands.
### Zypper Repository Management ###
#### Listing Defined Repositories ####
6. Use zypper repos or zypper lr commands to list all the defined repositories.
# zypper repos
OR
# zypper lr
| Alias | Name | Enabled | Refresh
--+---------------------------+------------------------------------+---------+--------
1 | openSUSE-13.2-0 | openSUSE-13.2-0 | Yes | No
2 | repo-debug | openSUSE-13.2-Debug | Yes | Yes
3 | repo-debug-update | openSUSE-13.2-Update-Debug | No | Yes
4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No | Yes
5 | repo-non-oss | openSUSE-13.2-Non-Oss | Yes | Yes
6 | repo-oss | openSUSE-13.2-Oss | Yes | Yes
7 | repo-source | openSUSE-13.2-Source | No | Yes
8 | repo-update | openSUSE-13.2-Update | Yes | Yes
9 | repo-update-non-oss | openSUSE-13.2-Update-Non-Oss | Yes | Yes
7. List zypper URI on the table.
# zypper lr -u
# | Alias | Name | Enabled | Refresh | URI
--+---------------------------+------------------------------------+---------+---------+----------------------------------------------------------------
1 | openSUSE-13.2-0 | openSUSE-13.2-0 | Yes | No | cd:///?devices=/dev/disk/by-id/ata-VBOX_CD-ROM_VB2-01700376
2 | repo-debug | openSUSE-13.2-Debug | Yes | Yes | http://download.opensuse.org/debug/distribution/13.2/repo/oss/
3 | repo-debug-update | openSUSE-13.2-Update-Debug | No | Yes | http://download.opensuse.org/debug/update/13.2/
4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No | Yes | http://download.opensuse.org/debug/update/13.2-non-oss/
5 | repo-non-oss | openSUSE-13.2-Non-Oss | Yes | Yes | http://download.opensuse.org/distribution/13.2/repo/non-oss/
6 | repo-oss | openSUSE-13.2-Oss | Yes | Yes | http://download.opensuse.org/distribution/13.2/repo/oss/
7 | repo-source | openSUSE-13.2-Source | No | Yes | http://download.opensuse.org/source/distribution/13.2/repo/oss/
8 | repo-update | openSUSE-13.2-Update | Yes | Yes | http://download.opensuse.org/update/13.2/
9 | repo-update-non-oss | openSUSE-13.2-Update-Non-Oss | Yes | Yes | http://download.opensuse.org/update/13.2-non-oss/
8. List repository priority and list by priority.
# zypper lr -P
# | Alias | Name | Enabled | Refresh | Priority
--+---------------------------+------------------------------------+---------+---------+---------
1 | openSUSE-13.2-0 | openSUSE-13.2-0 | Yes | No | 99
2 | repo-debug | openSUSE-13.2-Debug | Yes | Yes | 99
3 | repo-debug-update | openSUSE-13.2-Update-Debug | No | Yes | 99
4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No | Yes | 99
5 | repo-non-oss | openSUSE-13.2-Non-Oss | Yes | Yes | 85
6 | repo-oss | openSUSE-13.2-Oss | Yes | Yes | 99
7 | repo-source | openSUSE-13.2-Source | No | Yes | 99
8 | repo-update | openSUSE-13.2-Update | Yes | Yes | 99
9 | repo-update-non-oss | openSUSE-13.2-Update-Non-Oss | Yes | Yes | 99
#### Refreshing Repositories ####
9. Use commands zypper refresh or zypper ref to refresh zypper repositories.
# zypper refresh
OR
# zypper ref
Repository 'openSUSE-13.2-0' is up to date.
Repository 'openSUSE-13.2-Debug' is up to date.
Repository 'openSUSE-13.2-Non-Oss' is up to date.
Repository 'openSUSE-13.2-Oss' is up to date.
Repository 'openSUSE-13.2-Update' is up to date.
Repository 'openSUSE-13.2-Update-Non-Oss' is up to date.
All repositories have been refreshed.
10. To refresh a specific repository say repo-non-oss, type:
# zypper refresh repo-non-oss
Repository 'openSUSE-13.2-Non-Oss' is up to date.
Specified repositories have been refreshed.
11. To force update a repository say repo-non-oss, type:
# zypper ref -f repo-non-oss
Forcing raw metadata refresh
Retrieving repository 'openSUSE-13.2-Non-Oss' metadata ............................................................[done]
Forcing building of repository cache
Building repository 'openSUSE-13.2-Non-Oss' cache ............................................................[done]
Specified repositories have been refreshed.
#### Modifying Repositories ####
Here, we use zypper modifyrepo or zypper mr commands to disable, enable zypper repositories.
12. Before disabling repository, you must know that in Zypper, every repository has its own unique number, that is used to disable or enable a repository.
Lets say you want to disable repository repo-oss, to disable first you need to its number by typing following command.
# zypper lr
# | Alias | Name | Enabled | Refresh
--+---------------------------+------------------------------------+---------+--------
1 | openSUSE-13.2-0 | openSUSE-13.2-0 | Yes | No
2 | repo-debug | openSUSE-13.2-Debug | Yes | Yes
3 | repo-debug-update | openSUSE-13.2-Update-Debug | No | Yes
4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No | Yes
5 | repo-non-oss | openSUSE-13.2-Non-Oss | Yes | Yes
6 | repo-oss | openSUSE-13.2-Oss | No | Yes
7 | repo-source | openSUSE-13.2-Source | No | Yes
8 | repo-update | openSUSE-13.2-Update | Yes | Yes
9 | repo-update-non-oss | openSUSE-13.2-Update-Non-Oss | Yes | Yes
Do you see in the above output, that the repository repo-oss having number 6, to disable this you need to specify number 6 along with following command.
# zypper mr -d 6
Repository 'repo-oss' has been successfully disabled.
13. To enable again same repository repo-oss, which appears at number 6 (as shown in above example).
# zypper mr -e 6
Repository 'repo-oss' has been successfully enabled.
14. Enable auto-refresh and rpm file caching for a repo say repo-non-oss and set its priority to say 85.
# zypper mr -rk -p 85 repo-non-oss
Repository 'repo-non-oss' priority has been left unchanged (85)
Nothing to change for repository 'repo-non-oss'.
15. Disable rpm file caching for all the repositories.
# zypper mr -Ka
RPM files caching has been disabled for repository 'openSUSE-13.2-0'.
RPM files caching has been disabled for repository 'repo-debug'.
RPM files caching has been disabled for repository 'repo-debug-update'.
RPM files caching has been disabled for repository 'repo-debug-update-non-oss'.
RPM files caching has been disabled for repository 'repo-non-oss'.
RPM files caching has been disabled for repository 'repo-oss'.
RPM files caching has been disabled for repository 'repo-source'.
RPM files caching has been disabled for repository 'repo-update'.
RPM files caching has been disabled for repository 'repo-update-non-oss'.
16. Enable rpm file caching for all the repositories.
# zypper mr -ka
RPM files caching has been enabled for repository 'openSUSE-13.2-0'.
RPM files caching has been enabled for repository 'repo-debug'.
RPM files caching has been enabled for repository 'repo-debug-update'.
RPM files caching has been enabled for repository 'repo-debug-update-non-oss'.
RPM files caching has been enabled for repository 'repo-non-oss'.
RPM files caching has been enabled for repository 'repo-oss'.
RPM files caching has been enabled for repository 'repo-source'.
RPM files caching has been enabled for repository 'repo-update'.
RPM files caching has been enabled for repository 'repo-update-non-oss'.
17. Disable rpm file caching for remote repositories.
# zypper mr -Kt
RPM files caching has been disabled for repository 'repo-debug'.
RPM files caching has been disabled for repository 'repo-debug-update'.
RPM files caching has been disabled for repository 'repo-debug-update-non-oss'.
RPM files caching has been disabled for repository 'repo-non-oss'.
RPM files caching has been disabled for repository 'repo-oss'.
RPM files caching has been disabled for repository 'repo-source'.
RPM files caching has been disabled for repository 'repo-update'.
RPM files caching has been disabled for repository 'repo-update-non-oss'.
18. Enable rpm file caching for remote repositories.
# zypper mr -kt
RPM files caching has been enabled for repository 'repo-debug'.
RPM files caching has been enabled for repository 'repo-debug-update'.
RPM files caching has been enabled for repository 'repo-debug-update-non-oss'.
RPM files caching has been enabled for repository 'repo-non-oss'.
RPM files caching has been enabled for repository 'repo-oss'.
RPM files caching has been enabled for repository 'repo-source'.
RPM files caching has been enabled for repository 'repo-update'.
RPM files caching has been enabled for repository 'repo-update-non-oss'.
#### Adding Repositories ####
You may make use of any of the two commands zypper addrepo or zypper ar. You may use repo url or alias to add Repository.
19. Add a repository say “http://download.opensuse.org/update/12.3/”.
# zypper ar http://download.opensuse.org/update/11.1/ update
Adding repository 'update' .............................................................................................................................................................[done]
Repository 'update' successfully added
Enabled : Yes
Autorefresh : No
GPG check : Yes
URI : http://download.opensuse.org/update/11.1/
20. Rename a repository. It will change the alias only. You may use command zypper namerepo or zypper nr. To rename aka change alias of a repo that appears at number 10 (zypper lr) to upd8, run the below command.
# zypper nr 10 upd8
Repository 'update' renamed to 'upd8'.
#### Removing Repositories ####
21. Remove a repository. It will remove the repository from the system. You may use the command zypper removerepo or zypper rr. To remove a repo say upd8, run the below command.
# zypper rr upd8
# Removing repository 'upd8' .........................................................................................[done]
Repository 'upd8' has been removed.
### Package Management using Zypper ###
#### Install a Package with Zypper ####
22. With Zypper, we can install packages based upon capability name. For example, to install a package (say Mozilla Firefox) using capability name.
# zypper in MozillaFirefox
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 128 NEW packages are going to be installed:
adwaita-icon-theme at-spi2-atk-common at-spi2-atk-gtk2 at-spi2-core cantarell-fonts cups-libs desktop-file-utils fontconfig gdk-pixbuf-query-loaders gstreamer gstreamer-fluendo-mp3
gstreamer-plugins-base gtk2-branding-openSUSE gtk2-data gtk2-immodule-amharic gtk2-immodule-inuktitut gtk2-immodule-thai gtk2-immodule-vietnamese gtk2-metatheme-adwaita
gtk2-theming-engine-adwaita gtk2-tools gtk3-data gtk3-metatheme-adwaita gtk3-tools hicolor-icon-theme hicolor-icon-theme-branding-openSUSE libasound2 libatk-1_0-0 libatk-bridge-2_0-0
libatspi0 libcairo2 libcairo-gobject2 libcanberra0 libcanberra-gtk0 libcanberra-gtk2-module libcanberra-gtk3-0 libcanberra-gtk3-module libcanberra-gtk-module-common libcdda_interface0
libcdda_paranoia0 libcolord2 libdrm2 libdrm_intel1 libdrm_nouveau2 libdrm_radeon1 libFLAC8 libfreebl3 libgbm1 libgdk_pixbuf-2_0-0 libgraphite2-3 libgstapp-1_0-0 libgstaudio-1_0-0
libgstpbutils-1_0-0 libgstreamer-1_0-0 libgstriff-1_0-0 libgsttag-1_0-0 libgstvideo-1_0-0 libgthread-2_0-0 libgtk-2_0-0 libgtk-3-0 libharfbuzz0 libjasper1 libjbig2 libjpeg8 libjson-c2
liblcms2-2 libLLVM libltdl7 libnsssharedhelper0 libogg0 liborc-0_4-0 libpackagekit-glib2-18 libpango-1_0-0 libpciaccess0 libpixman-1-0 libpulse0 libsndfile1 libsoftokn3 libspeex1
libsqlite3-0 libstartup-notification-1-0 libtheoradec1 libtheoraenc1 libtiff5 libvisual libvorbis0 libvorbisenc2 libvorbisfile3 libwayland-client0 libwayland-cursor0 libwayland-server0
libX11-xcb1 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xfixes0 libXcomposite1 libXcursor1 libXdamage1 libXevie1
libXfixes3 libXft2 libXi6 libXinerama1 libxkbcommon-0_4_3 libXrandr2 libXrender1 libxshmfence1 libXtst6 libXv1 libXxf86vm1 Mesa Mesa-libEGL1 Mesa-libGL1 Mesa-libglapi0
metatheme-adwaita-common MozillaFirefox MozillaFirefox-branding-openSUSE mozilla-nss mozilla-nss-certs PackageKit-gstreamer-plugin pango-tools sound-theme-freedesktop
The following 10 recommended packages were automatically selected:
gstreamer-fluendo-mp3 gtk2-branding-openSUSE gtk2-data gtk2-immodule-amharic gtk2-immodule-inuktitut gtk2-immodule-thai gtk2-immodule-vietnamese libcanberra0 libpulse0
PackageKit-gstreamer-plugin
128 new packages to install.
Overall download size: 77.2 MiB. Already cached: 0 B After the operation, additional 200.0 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package cantarell-fonts-0.0.16-1.1.noarch (1/128), 74.1 KiB (115.6 KiB unpacked)
Retrieving: cantarell-fonts-0.0.16-1.1.noarch.rpm .........................................................................................................................[done (63.4 KiB/s)]
Retrieving package hicolor-icon-theme-0.13-2.1.2.noarch (2/128), 40.1 KiB ( 50.5 KiB unpacked)
Retrieving: hicolor-icon-theme-0.13-2.1.2.noarch.rpm ...................................................................................................................................[done]
Retrieving package sound-theme-freedesktop-0.8-7.1.2.noarch (3/128), 372.6 KiB (460.3 KiB unpacked)
23. Install a package (say gcc) using version.
# zypper in 'gcc<5.1'
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 13 NEW packages are going to be installed:
cpp cpp48 gcc gcc48 libasan0 libatomic1-gcc49 libcloog-isl4 libgomp1-gcc49 libisl10 libitm1-gcc49 libmpc3 libmpfr4 libtsan0-gcc49
13 new packages to install.
Overall download size: 14.5 MiB. Already cached: 0 B After the operation, additional 49.4 MiB will be used.
Continue? [y/n/? shows all options] (y): y
24. Install a package (say gcc) for architecture (say i586).
# zypper in gcc.i586
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 13 NEW packages are going to be installed:
cpp cpp48 gcc gcc48 libasan0 libatomic1-gcc49 libcloog-isl4 libgomp1-gcc49 libisl10 libitm1-gcc49 libmpc3 libmpfr4 libtsan0-gcc49
13 new packages to install.
Overall download size: 14.5 MiB. Already cached: 0 B After the operation, additional 49.4 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package libasan0-4.8.3+r212056-2.2.4.x86_64 (1/13), 74.2 KiB (166.9 KiB unpacked)
Retrieving: libasan0-4.8.3+r212056-2.2.4.x86_64.rpm .......................................................................................................................[done (79.2 KiB/s)]
Retrieving package libatomic1-gcc49-4.9.0+r211729-2.1.7.x86_64 (2/13), 14.3 KiB ( 26.1 KiB unpacked)
Retrieving: libatomic1-gcc49-4.9.0+r211729-2.1.7.x86_64.rpm ...............................................................................................................[done (55.3 KiB/s)]
25. Install a package (say gcc) for specific architecture (say i586) and specific version (say <5.1),
# zypper in 'gcc.i586<5.1'
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 13 NEW packages are going to be installed:
cpp cpp48 gcc gcc48 libasan0 libatomic1-gcc49 libcloog-isl4 libgomp1-gcc49 libisl10 libitm1-gcc49 libmpc3 libmpfr4 libtsan0-gcc49
13 new packages to install.
Overall download size: 14.4 MiB. Already cached: 129.5 KiB After the operation, additional 49.4 MiB will be used.
Continue? [y/n/? shows all options] (y): y
In cache libasan0-4.8.3+r212056-2.2.4.x86_64.rpm (1/13), 74.2 KiB (166.9 KiB unpacked)
In cache libatomic1-gcc49-4.9.0+r211729-2.1.7.x86_64.rpm (2/13), 14.3 KiB ( 26.1 KiB unpacked)
In cache libgomp1-gcc49-4.9.0+r211729-2.1.7.x86_64.rpm (3/13), 41.1 KiB ( 90.7 KiB unpacked)
26. Install a Package (say libxine) from repository (amarok).
# zypper in amarok upd:libxine1
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 202 NEW packages are going to be installed:
amarok bundle-lang-kde-en clamz cups-libs enscript fontconfig gdk-pixbuf-query-loaders ghostscript-fonts-std gptfdisk gstreamer gstreamer-plugins-base hicolor-icon-theme
hicolor-icon-theme-branding-openSUSE htdig hunspell hunspell-tools icoutils ispell ispell-american kde4-filesystem kdebase4-runtime kdebase4-runtime-branding-openSUSE kdelibs4
kdelibs4-branding-openSUSE kdelibs4-core kdialog libakonadi4 l
.....
27. Install a Package (say git) using name (-n).
# zypper in -n git
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 35 NEW packages are going to be installed:
cvs cvsps fontconfig git git-core git-cvs git-email git-gui gitk git-svn git-web libserf-1-1 libsqlite3-0 libXft2 libXrender1 libXss1 perl-Authen-SASL perl-Clone perl-DBD-SQLite perl-DBI
perl-Error perl-IO-Socket-SSL perl-MLDBM perl-Net-Daemon perl-Net-SMTP-SSL perl-Net-SSLeay perl-Params-Util perl-PlRPC perl-SQL-Statement perl-Term-ReadKey subversion subversion-perl tcl
tk xhost
The following 13 recommended packages were automatically selected:
git-cvs git-email git-gui gitk git-svn git-web perl-Authen-SASL perl-Clone perl-MLDBM perl-Net-Daemon perl-Net-SMTP-SSL perl-PlRPC perl-SQL-Statement
The following package is suggested, but will not be installed:
git-daemon
35 new packages to install.
Overall download size: 15.6 MiB. Already cached: 0 B After the operation, additional 56.7 MiB will be used.
Continue? [y/n/? shows all options] (y): y
28. Install a package using wildcards. For example, install all php5 packages.
# zypper in php5*
Loading repository data...
Reading installed packages...
Resolving package dependencies...
Problem: php5-5.6.1-18.1.x86_64 requires smtp_daemon, but this requirement cannot be provided
uninstallable providers: exim-4.83-3.1.8.x86_64[openSUSE-13.2-0]
postfix-2.11.0-5.2.2.x86_64[openSUSE-13.2-0]
sendmail-8.14.9-2.2.2.x86_64[openSUSE-13.2-0]
exim-4.83-3.1.8.i586[repo-oss]
msmtp-mta-1.4.32-2.1.3.i586[repo-oss]
postfix-2.11.0-5.2.2.i586[repo-oss]
sendmail-8.14.9-2.2.2.i586[repo-oss]
exim-4.83-3.1.8.x86_64[repo-oss]
msmtp-mta-1.4.32-2.1.3.x86_64[repo-oss]
postfix-2.11.0-5.2.2.x86_64[repo-oss]
sendmail-8.14.9-2.2.2.x86_64[repo-oss]
postfix-2.11.3-5.5.1.i586[repo-update]
postfix-2.11.3-5.5.1.x86_64[repo-update]
Solution 1: Following actions will be done:
do not install php5-5.6.1-18.1.x86_64
do not install php5-pear-Auth_SASL-1.0.6-7.1.3.noarch
do not install php5-pear-Horde_Http-2.0.1-6.1.3.noarch
do not install php5-pear-Horde_Image-2.0.1-6.1.3.noarch
do not install php5-pear-Horde_Kolab_Format-2.0.1-6.1.3.noarch
do not install php5-pear-Horde_Ldap-2.0.1-6.1.3.noarch
do not install php5-pear-Horde_Memcache-2.0.1-7.1.3.noarch
do not install php5-pear-Horde_Mime-2.0.2-6.1.3.noarch
do not install php5-pear-Horde_Oauth-2.0.0-6.1.3.noarch
do not install php5-pear-Horde_Pdf-2.0.1-6.1.3.noarch
....
29. Install a Package (say lamp_server) using pattern (group of packages).
# zypper in -t pattern lamp_server
ading repository data...
Reading installed packages...
Resolving package dependencies...
The following 29 NEW packages are going to be installed:
apache2 apache2-doc apache2-example-pages apache2-mod_perl apache2-prefork patterns-openSUSE-lamp_server perl-Data-Dump perl-Encode-Locale perl-File-Listing perl-HTML-Parser
perl-HTML-Tagset perl-HTTP-Cookies perl-HTTP-Daemon perl-HTTP-Date perl-HTTP-Message perl-HTTP-Negotiate perl-IO-HTML perl-IO-Socket-SSL perl-libwww-perl perl-Linux-Pid
perl-LWP-MediaTypes perl-LWP-Protocol-https perl-Net-HTTP perl-Net-SSLeay perl-Tie-IxHash perl-TimeDate perl-URI perl-WWW-RobotRules yast2-http-server
The following NEW pattern is going to be installed:
lamp_server
The following 10 recommended packages were automatically selected:
apache2 apache2-doc apache2-example-pages apache2-mod_perl apache2-prefork perl-Data-Dump perl-IO-Socket-SSL perl-LWP-Protocol-https perl-TimeDate yast2-http-server
29 new packages to install.
Overall download size: 7.2 MiB. Already cached: 1.2 MiB After the operation, additional 34.7 MiB will be used.
Continue? [y/n/? shows all options] (y):
30. Install a Package (say nano) and remove a package (say vi) in one go.
# zypper in nano -vi
Loading repository data...
Reading installed packages...
'-vi' not found in package names. Trying capabilities.
Resolving package dependencies...
The following 2 NEW packages are going to be installed:
nano nano-lang
The following package is going to be REMOVED:
vim
The following recommended package was automatically selected:
nano-lang
2 new packages to install, 1 to remove.
Overall download size: 550.0 KiB. Already cached: 0 B After the operation, 463.3 KiB will be freed.
Continue? [y/n/? shows all options] (y):
...
31. Install a rpm package (say teamviewer).
# zypper in teamviewer*.rpm
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 24 NEW packages are going to be installed:
alsa-oss-32bit fontconfig-32bit libasound2-32bit libexpat1-32bit libfreetype6-32bit libgcc_s1-gcc49-32bit libICE6-32bit libjpeg62-32bit libpng12-0-32bit libpng16-16-32bit libSM6-32bit
libuuid1-32bit libX11-6-32bit libXau6-32bit libxcb1-32bit libXdamage1-32bit libXext6-32bit libXfixes3-32bit libXinerama1-32bit libXrandr2-32bit libXrender1-32bit libXtst6-32bit
libz1-32bit teamviewer
The following recommended package was automatically selected:
alsa-oss-32bit
24 new packages to install.
Overall download size: 41.2 MiB. Already cached: 0 B After the operation, additional 119.7 MiB will be used.
Continue? [y/n/? shows all options] (y):
..
#### Remove a Package with Zypper ####
32. To remove any package, you can use zypper remove or zypper rm commands. For example, to remove a package (say apache2), run:
# zypper remove apache2
Or
# zypper rm apache2
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 2 packages are going to be REMOVED:
apache2 apache2-prefork
2 packages to remove.
After the operation, 4.2 MiB will be freed.
Continue? [y/n/? shows all options] (y): y
(1/2) Removing apache2-2.4.10-19.1 ........................................................................[done]
(2/2) Removing apache2-prefork-2.4.10-19.1 ................................................................[done]
#### Updating Packages using Zypper ####
33. Update all packages. You may use commands zypper update or zypper up.
# zypper up
OR
# zypper update
Loading repository data...
Reading installed packages...
Nothing to do.
34. Update specific packages (say apache2 and openssh).
# zypper up apache2 openssh
Loading repository data...
Reading installed packages...
No update candidate for 'apache2-2.4.10-19.1.x86_64'. The highest available version is already installed.
No update candidate for 'openssh-6.6p1-5.1.3.x86_64'. The highest available version is already installed.
Resolving package dependencies...
Nothing to do.
35. Install a package say (mariadb) if not installed, if installed update it.
# zypper in mariadb
Loading repository data...
Reading installed packages...
'mariadb' is already installed.
No update candidate for 'mariadb-10.0.13-2.6.1.x86_64'. The highest available version is already installed.
Resolving package dependencies...
Nothing to do.
#### Install Source and Build Dependencies ####
You may use zypper source-install or zypper si commands to build packages from source.
36. Install source packages and build their dependencies for a package (say mariadb).
# zypper si mariadb
Reading installed packages...
Loading repository data...
Resolving package dependencies...
The following 36 NEW packages are going to be installed:
autoconf automake bison cmake cpp cpp48 gcc gcc48 gcc48-c++ gcc-c++ libaio-devel libarchive13 libasan0 libatomic1-gcc49 libcloog-isl4 libedit-devel libevent-devel libgomp1-gcc49 libisl10
libitm1-gcc49 libltdl7 libmpc3 libmpfr4 libopenssl-devel libstdc++48-devel libtool libtsan0-gcc49 m4 make ncurses-devel pam-devel readline-devel site-config tack tcpd-devel zlib-devel
The following source package is going to be installed:
mariadb
36 new packages to install, 1 source package.
Overall download size: 71.5 MiB. Already cached: 129.5 KiB After the operation, additional 183.9 MiB will be used.
Continue? [y/n/? shows all options] (y): y
37. Install only the source for a package (say mariadb).
# zypper in -D mariadb
Loading repository data...
Reading installed packages...
'mariadb' is already installed.
No update candidate for 'mariadb-10.0.13-2.6.1.x86_64'. The highest available version is already installed.
Resolving package dependencies...
Nothing to do.
38. Install only the build dependencies for a packages (say mariadb).
# zypper si -d mariadb
Reading installed packages...
Loading repository data...
Resolving package dependencies...
The following 36 NEW packages are going to be installed:
autoconf automake bison cmake cpp cpp48 gcc gcc48 gcc48-c++ gcc-c++ libaio-devel libarchive13 libasan0 libatomic1-gcc49 libcloog-isl4 libedit-devel libevent-devel libgomp1-gcc49 libisl10
libitm1-gcc49 libltdl7 libmpc3 libmpfr4 libopenssl-devel libstdc++48-devel libtool libtsan0-gcc49 m4 make ncurses-devel pam-devel readline-devel site-config tack tcpd-devel zlib-devel
The following package is recommended, but will not be installed due to conflicts or dependency issues:
readline-doc
36 new packages to install.
Overall download size: 33.7 MiB. Already cached: 129.5 KiB After the operation, additional 144.3 MiB will be used.
Continue? [y/n/? shows all options] (y): y
#### Zypper in Scripts and Applications ####
39. Install a Package (say mariadb) without interaction of user.
# zypper --non-interactive in mariadb
Loading repository data...
Reading installed packages...
'mariadb' is already installed.
No update candidate for 'mariadb-10.0.13-2.6.1.x86_64'. The highest available version is already installed.
Resolving package dependencies...
Nothing to do.
40. Remove a Package (say mariadb) without interaction of user.
# zypper --non-interactive rm mariadb
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following package is going to be REMOVED:
mariadb
1 package to remove.
After the operation, 71.8 MiB will be freed.
Continue? [y/n/? shows all options] (y): y
(1/1) Removing mariadb-10.0.13-2.6.1 .............................................................................[done]
41. Output zypper in xml.
# zypper --xmlout
Usage:
zypper [--global-options] <command> [--command-options] [arguments]
Global Options
....
42. Generate quiet output at installation.
# zypper --quiet in mariadb
The following NEW package is going to be installed:
mariadb
1 new package to install.
Overall download size: 0 B. Already cached: 7.8 MiB After the operation, additional 71.8 MiB will be used.
Continue? [y/n/? shows all options] (y):
...
43. Generate quiet output at UN-installation.
# zypper --quiet rm mariadb
44. Auto agree to Licenses/Agreements.
# zypper patch --auto-agree-with-licenses
Loading repository data...
Reading installed packages...
Resolving package dependencies...
Nothing to do.
#### Clean Zypper Cache and View History ####
45. If you want to clean zypper cache only, you can use following command.
# zypper clean
All repositories have been cleaned up.
If you want to clean metadata and package cache at once you may like to pass all/-a with zypper as.
# zypper clean -a
All repositories have been cleaned up.
46. To view logs of any installed, updated or removed packages through zypper, are logged in /var/log/zypp/history. You may cat it to view or may use filter to get a custom output.
# cat /var/log/zypp/history
2015-05-07 15:43:03|install|boost-license1_54_0|1.54.0-10.1.3|noarch||openSUSE-13.2-0|0523b909d2aae5239f9841316dafaf3a37b4f096|
2015-05-07 15:43:03|install|branding-openSUSE|13.2-3.6.1|noarch||openSUSE-13.2-0|6609def94b1987bf3f90a9467f4f7ab8f8d98a5c|
2015-05-07 15:43:03|install|bundle-lang-common-en|13.2-3.3.1|noarch||openSUSE-13.2-0|ca55694e6fdebee6ce37ac7cf3725e2aa6edc342|
2015-05-07 15:43:03|install|insserv-compat|0.1-12.2.2|noarch||openSUSE-13.2-0|6160de7fbf961a279591a83a1550093a581214d9|
2015-05-07 15:43:03|install|libX11-data|1.6.2-5.1.2|noarch||openSUSE-13.2-0|f1cb58364ba9016c1f93b1a383ba12463c56885a|
2015-05-07 15:43:03|install|libnl-config|3.2.25-2.1.2|noarch||openSUSE-13.2-0|aab2ded312a781e93b739b418e3d32fe4e187020|
2015-05-07 15:43:04|install|wireless-regdb|2014.06.13-1.2|noarch||openSUSE-13.2-0|be8cb16f3e92af12b5ceb977e37e13f03c007bd1|
2015-05-07 15:43:04|install|yast2-trans-en_US|3.1.0-2.1|noarch||openSUSE-13.2-0|1865754e5e0ec3c149ac850b340bcca55a3c404d|
2015-05-07 15:43:04|install|yast2-trans-stats|2.19.0-16.1.3|noarch||openSUSE-13.2-0|b107d2b3e702835885b57b04d12d25539f262d1a|
2015-05-07 15:43:04|install|cracklib-dict-full|2.8.12-64.1.2|x86_64||openSUSE-13.2-0|08bd45dbba7ad44e3a4837f730be76f55ad5dcfa|
......
#### Upgrade Suse Using Zypper ####
47. You can use dist-upgrade option with zypper command to upgrade your current Suse Linux to most recent version.
# zypper dist-upgrade
You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Building repository 'openSUSE-13.2-0' cache .....................................................................[done]
Retrieving repository 'openSUSE-13.2-Debug' metadata ............................................................[done]
Building repository 'openSUSE-13.2-Debug' cache .................................................................[done]
Retrieving repository 'openSUSE-13.2-Non-Oss' metadata ..........................................................[done]
Building repository 'openSUSE-13.2-Non-Oss' cache ...............................................................[done]
Thats all for now. Hope this article would help you in managing you SUSE System and Server specially for newbies. If you feel that I left certain commands (Human are erroneous) you may provide us with the feedback in the comments so that we can update the article. Keep Connected, Keep Commenting, Stay tuned. Kudos!
--------------------------------------------------------------------------------
via: http://www.tecmint.com/zypper-commands-to-manage-suse-linux-package-management/
作者:[Avishek Kumar][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/avishek/
[1]:http://www.tecmint.com/installation-of-suse-linux-enterprise-server-12/

View File

@ -0,0 +1,96 @@
A Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM Usage in Linux
================================================================================
The duty of System Administrator is really tough as he/she has to monitor the servers, users, logs, create backup and blah blah blah. For the most repetitive task most of the administrator write a script to automate their day-to-day repetitive task. Here we have written a shell Script that do not aims to automate the task of a typical system admin, but it may be helpful at places and specially for those newbies who can get most of the information they require about their System, Network, Users, Load, Ram, host, Internal IP, External IP, Uptime, etc.
We have taken care of formatting the output (to certain extent). The Script dont contains any Malicious contents and it can be run using Normal user Account. In-fact it is recommended to run this script as user and not as root.
![Linux Server Health Monitoring](http://www.tecmint.com/wp-content/uploads/2015/05/Linux-Health-Monitoring.png)
Shell Script to Monitor Linux System Health
You are free to use/modify/redistribute the below piece of code by giving proper credit to Tecmint and Author. We have tried to customize the output to the extent that nothing other than the required output is generated. We have tried to use those variables which are generally not used by Linux System and are probably free.
#### Minimum System Requirement ####
All you need to have is a working Linux box.
#### Dependency ####
There is no dependency required to use this package for a standard Linux Distribution. Moreover the script dont requires root permission for execution purpose. However if you want to Install it, you need to enter root password once.
#### Security ####
We have taken care to ensure security of the system. Nothing additional package is required/installed. No root access required to run. Moreover code has been released under Apache 2.0 License, that means you are free to edit, modify and re-distribute by keeping Tecmint copyright.
### How Do I Install and Run Script? ###
First, use following [wget command][1] to download the monitor script `"tecmint_monitor.sh"` and make it executable by setting appropriate permissions.
# wget http://tecmint.com/wp-content/scripts/tecmint_monitor.sh
# chmod 755 tecmint_monitor.sh
It is strongly advised to install the script as user and not as root. It will ask for root password and will install the necessary components at required places.
To install `"tecmint_monitor.sh"` script, simple use -i (install) option as shown below.
/tecmint_monitor.sh -i
Enter root password when prompted. If everything goes well you will get a success message like shown below.
Password:
Congratulations! Script Installed, now run monitor Command
After installation, you can run the script by calling command `'monitor'` from any location or user. If you dont like to install it, you need to include the location every-time you want to run it.
# ./Path/to/script/tecmint_monitor.sh
Now run monitor command from anywhere using any user account simply as:
$ monitor
![TecMint Monitor Script in Action](http://www.tecmint.com/wp-content/uploads/2015/05/TecMint-Monitor-Script.gif)
As soon as you run the command you get various System related information which are:
- Internet Connectivity
- OS Type
- OS Name
- OS Version
- Architecture
- Kernel Release
- Hostname
- Internal IP
- External IP
- Name Servers
- Logged In users
- Ram Usages
- Swap Usages
- Disk Usages
- Load Average
- System Uptime
Check the installed version of script using -v (version) switch.
$ monitor -v
tecmint_monitor version 0.1
Designed by Tecmint.com
Released Under Apache 2.0 License
### Conclusion ###
This script is working out of the box on a few machines I have checked. It should work the same for you as well. If you find any bug let us know in the comments. This is not the end. This is the beginning. You can take it to any level from here. If you feel like editing the script and carry it further you are free to do so giving us proper credit and also share the updated script with us so that we can update this article by giving you proper credit.
Dont forget to share your thoughts or your script with us. We will be here to help you. Thank you for all the love you have given us. Keep Connected! Stay tuned.
--------------------------------------------------------------------------------
via: http://www.tecmint.com/linux-server-health-monitoring-script/
作者:[Avishek Kumar][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/avishek/
[1]:http://www.tecmint.com/10-wget-command-examples-in-linux/

View File

@ -0,0 +1,107 @@
How To Run Docker Client Inside Windows OS
================================================================================
Hi everyone, today we'll learn about Docker in Windows Operating System and about the installation of Docker Windows Client in it. Docker Engine uses Linux Specific Kernel features so it cannot use Windows Kernel to run so, the Docker Engine creates a small Virtual Machine running Linux and utilizes its resources and Kernel. The Windows Docker Client uses the virtualized Docker Engine to build, run and manage Docker Containers out of the box. There is an application developed by the Boot2Docker Team called Boot2Docker which creates the virtual machine running a small Linux based on [Tiny Core Linux][1] made specifically to run [Docker][2] containers on Windows. It runs completely from RAM, weighs ~27MB and boots in ~5s (YMMV). So, until the Docker Engine for Windows is developed, we can only run Linux containers in our Windows Machine.
Here is some easy and simple steps which will allow us to install the Docker Client and run containers on top of it.
### 1. Downloading Boot2Docker ###
Now, before we start the installation, we'll need the executable file for Boot2Docker. The latest version of Boot2Docker can be downloaded from [its Github][3]. Here, in this tutorial, we'll download version v1.6.1 from the site. Here, we'll download the file named [docker-install.exe][4] from that page using our favorite Web Browser or Download Manager.
![](http://blog.linoxide.com/wp-content/uploads/2015/05/downloading-boot2docker-installer.png)
### 2. Installing Boot2Docker ###
Now, we'll simply run the installer which will install Windows Docker Client, Git for Windows (MSYS-git), VirtualBox, The Boot2Docker Linux ISO, and the Boot2Docker management tool which are essential for the total functioning of Docker Engine out of the box.
![](http://blog.linoxide.com/wp-content/uploads/2015/05/boot2docker-installer.png)
### 3. Running Boot2Docker ###
![](http://blog.linoxide.com/wp-content/uploads/2015/05/boot2docker-start-icon-e1431322598697.png)
After installing the necessary stuffs, we'll run Boot2Docker by simply running the Boot2Docker Start shortcut from the Desktop. This will ask you to enter an SSH key paraphrase that we'll require in future for authentication. It will start a unix shell already configured to manage Docker running inside the virtual machine.
![](http://blog.linoxide.com/wp-content/uploads/2015/05/starting-boot2docker.png)
Now to check whether it is correctly configured or not, simply run docker version as shown below.
docker version
![](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-version.png)
### 4. Running Docker ###
As **Boot2Docker Start** automatically starts a shell with environment variables correctly set so we can simply start using Docker right away. **Please note that, if we are Boot2Docker as remote Docker Daemon , then do not type the sudo before the docker commands.**
Now, Let's try the **hello-world** example image which will download the hello-world image, executes it and gives an output "Hello from Docker" message.
$ docker run hello-world
![](http://blog.linoxide.com/wp-content/uploads/2015/05/running-hello-world.png)
### 5. Running Docker using Command Prompt (CMD) ###
Now, if you are wanting to get started with Docker using Command Prompt, you can simply launch the command prompt (CMD.exe). As Boot2Docker requires ssh.exe to be in the PATH, therefore we need to include bin folder of the Git installation to the %PATH% environment variable by running the following command in the command prompt.
set PATH=%PATH%;"c:\Program Files (x86)\Git\bin"
![](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-in-cmd.png)
After running the above command, we can run the **boot2docker start** command in the command prompt to start the Boot2Docker VM.
boot2docker start
![](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-cmd-variables.png)
**Note**: If you get an error saying machine does not exist then run **boot2docker init** command in it.
Then copy the instructions for cmd.exe shown in the console to set the environment variables to the console window and we are ready to run docker containers as usual.
### 6. Running Docker using PowerShell ###
In order to run Docker on PowerShell, we simply need to launch a PowerShell window then add ssh.exe to our PATH variable.
$Env:Path = "${Env:Path};c:\Program Files (x86)\Git\bin"
After running the above command, we'll need to run
boot2docker start
![](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-in-powershell.png)
This will print PowerShell commands to set the environment variables to connect Docker running inside VM. We'll simply run those commands in the PowerShell and we are ready to run docker containers as usual.
### 7. Logging with PUTTY ###
Boot2Docker generates and uses the public or private key pair inside %USERPROFILE%\.ssh directory so to login, we'll need use the private key from this same directory. That private key needs to be converted into the PuTTY 's format. We can use puttygen.exe to do that.
We need to open puttygen.exe and load ("File"->"Load" menu) the private key from %USERPROFILE%\.ssh\id_boot2docker then click on "Save Private Key". Then use the saved file to login with PuTTY using docker@127.0.0.1:2022 .
### 8. Boot2Docker Options ###
The Boot2Docker management tool provides several commands as shown below.
$ boot2docker
Usage: boot2docker.exe [<options>] {help|init|up|ssh|save|down|poweroff|reset|restart|config|status|info|ip|shellinit|delete|download|upgrade|version} [<args>]
### Conclusion ###
Using Docker with Docker Windows Client is fun. The Boot2Docker management tool is an awesome application developed which enables every Docker containers to run smoothly as running in Linux host. If you are more curious, the username for the boot2docker default user is docker and the password is tcuser. The latest version of boot2docker sets up a host only network adapter which provides access to the container's ports. Typically, it is 192.168.59.103, but it could get changed by Virtualbox's DHCP implementation. If you have any questions, suggestions, feedback please write them in the comment box below so that we can improve or update our contents. Thank you ! Enjoy :-)
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-how-to/run-docker-client-inside-windows-os/
作者:[Arun Pyasi][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/arunp/
[1]:http://tinycorelinux.net/
[2]:https://www.docker.io/
[3]:https://github.com/boot2docker/windows-installer/releases/latest
[4]:https://github.com/boot2docker/windows-installer/releases/download/v1.6.1/docker-install.exe

View File

@ -0,0 +1,63 @@
Linux FAQs with Answers--How to view torrent file content on Linux
================================================================================
> **Question**: I have a torrent file downloaded from the web. Is there a tool that allows me to view the content of a torrent on Linux? For example, I want to know what files are included inside a torrent.
A torrent file (i.e., a file with **.torrent** extension) is a BitTorrent metadata file which stores information (e.g., tracker URLs, file list, sizes, checksums, creation date) needed by a BitTorrent client to download files shared on BitTorrent peer-to-peer networks. Inside a single torrent file, one or more files can be listed for sharing.
The content of a torrent file is encoded with BEncode, the BitTorrent's data serialization format. Thus to view the content of a torrent file, you need a corresponding decoder.
In fact, any GUI-based BitTorrent client (e.g., Transmission or uTorrent) is equipped with BEncode decoder, so can show to you the content of a torrent file by opening it. However, if you don't want to use any sort of BitTorrent client to check up on a torrent file, you can try a command-line torrent viewer called [dumptorrent][2].
The **dumptorrent** command prints the detailed content of a torrent file (e.g., file names, sizes, tracker URLs, creation date, info hash, etc.) by using a built-in BEncode decoder.
### Install DumpTorrent on Linux ###
To install dumptorrent on Linux, you can build it from the source.
On Debian, Ubuntu or Linux Mint:
$ sudo apt-get install gcc make
$ wget http://downloads.sourceforge.net/project/dumptorrent/dumptorrent/1.2/dumptorrent-1.2.tar.gz
$ tar -xvf dumptorrent-1.2.tar.gz
$ cd dumptorrent-1.2
$ make
$ sudo cp dumptorrent /usr/local/bin
On CentOS, Fedora or RHEL:
$ sudo yum install gcc make
$ wget http://downloads.sourceforge.net/project/dumptorrent/dumptorrent/1.2/dumptorrent-1.2.tar.gz
$ tar -xvf dumptorrent-1.2.tar.gz
$ cd dumptorrent-1.2
$ make
$ sudo cp dumptorrent /usr/local/bin
Make sure that /usr/local/bin is [included][2] in your PATH.
### View the Content of a Torrent ###
To check the content of a torrent, simply run dumptorrent with a torrent file as an argument. This will print a summary of a torrent, including file names, sizes and tracker URL.
$ dumptorrent <torrent-file>
![](https://farm8.staticflickr.com/7729/16816455904_b051e29972_b.jpg)
To view the full content of a torrent, add "-v" option. This will print more detailed information of a torrent, including info-hash, piece length, creation date, creator, and full announce list.
$ dumptorrent -v <torrent-file>
![](https://farm6.staticflickr.com/5331/17438628461_1f6675bd77_b.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/view-torrent-file-content-linux.html
作者:[Dan Nanni][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/nanni
[1]:http://dumptorrent.sourceforge.net/
[2]:http://ask.xmodulo.com/change-path-environment-variable-linux.html

View File

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