mirror of
https://github.com/LCTT/TranslateProject.git
synced 2026-08-23 04:03:29 +08:00
merged from LCTT
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
使用ARChon环境在Ubuntu上运行Android应用
|
||||
使用 ARChon 运行时环境在 Ubuntu 上运行 Android 应用
|
||||
================================================================================
|
||||
在此之前,我们尝试过在多款安卓应用模拟器工具上运行安卓应用,比如Genymotion、VirtualBox和Android SDK等。但是,有了这套全新的Chrome安卓运行环境,就可以在Chrome浏览器中运行安卓应用了。所以,下面是一些步骤来指导如何使用ARChon运行环境在Ubuntu上安装安卓应用。
|
||||
|
||||
谷歌已经公布了[首批支持原生运行在Chrome OS的安卓应用][1],而使用一个全新的“**安卓运行环境**”扩展程序使其成为可能。如今,一位名为Vlad Filippov的开发者已经找到了一种把安卓应用移植到桌面端Chrome浏览器的方法。他把chromeos-apk脚本和ARChon安卓运行环境扩展程序两者紧密结合在一起,使得安卓应用可以运行在Windows、Max和Linux系统的桌面端Chrome浏览器中。
|
||||
在此之前,我们尝试过在多款安卓应用模拟器工具上运行安卓应用,比如Genymotion、VirtualBox和Android SDK等。但是,有了这套全新的Chrome安卓运行环境,就可以在Chrome浏览器中运行安卓应用了。所以,下面是一些步骤来指导你如何使用ARChon运行时环境在Ubuntu上安装安卓应用。
|
||||
|
||||
应用借助这种运行环境时的性能并不是很好。同样,由于它是官方运行环境的非官方二次开发包,而且运行在Google的Chrome OS之外,因此一些如webcam和speaker等系统集成工具可能需要通过打补丁获得或者根本就没有。
|
||||
谷歌已经公布了[首批支持原生运行在Chrome OS的安卓应用][1],而这个全新的“**安卓运行时环境**”扩展程序使其成为可能。如今,一位名为Vlad Filippov的开发者已经找到了一种把安卓应用移植到桌面端Chrome浏览器的方法。他把chromeos-apk脚本和ARChon安卓运行环境扩展程序两者紧密结合在一起,使得安卓应用可以运行在Windows、Max和Linux系统的桌面端Chrome浏览器中。
|
||||
|
||||
应用借助这种运行环境时的性能并不是很好。同样,由于它是官方运行环境的非官方二次开发包,而且运行在Google的Chrome OS之外,因此一些如摄像头和喇叭等系统内置设备可能需要通过打补丁获得或者根本不支持。
|
||||
|
||||
### 安装Chrome ###
|
||||
|
||||
首先,需要在机器上安装Chrome,版本要求是Chrome 37或者更高。可以从[Chrome浏览器的下载页面][2]下载。
|
||||
|
||||
如果打算安装Dev Channel版本,按照如下操作。
|
||||
如果打算安装开发通道版本,按照如下操作。
|
||||
|
||||
首先,使用这个命令为Google Chrome添加软件源列表:
|
||||
使用这个命令为Google Chrome添加软件源列表:
|
||||
|
||||
$ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
|
||||
$ sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
|
||||
@@ -23,7 +24,8 @@
|
||||
|
||||
$ sudo apt-get update
|
||||
|
||||
现在,就可以安装非稳定版的google chrome,即开发版。
|
||||
现在,就可以安装非稳定版的google chrome,即开发版:
|
||||
|
||||
$ sudo apt-get install google-chrome-unstable
|
||||
|
||||

|
||||
@@ -34,11 +36,11 @@
|
||||
|
||||
**32位** Ubntu发行版:
|
||||
|
||||
- [Download Archron for 32-bit Ubuntu][3]
|
||||
- [下载 32 位版 Ubuntu 上的 Archron][3]
|
||||
|
||||
**64位** Ubntu发行版:
|
||||
|
||||
- [Download Archron for 64-bit Ubuntu][4]
|
||||
- [下载 64 位版 Ubuntu 上的 Archron][4]
|
||||
|
||||
下载好运行环境安装包后,从.zip文件中解压,并将解压得到的目录移动到Home目录。操作命令如下:
|
||||
|
||||
@@ -48,11 +50,11 @@
|
||||
|
||||
$ unzip ARChon-v1.1-x86_32.zip ~/
|
||||
|
||||
接下来是安装运行时环境,首先打开Google Chrome浏览器,在地址栏键入**chrome://extensions**。然后,选中“**开发者模式**”。最后,点击“**载入未打包扩展程序**”,选择刚才放置在**~/Home**下面的文件夹。
|
||||
接下来是安装运行时环境,首先打开Google Chrome浏览器,在地址栏键入**chrome://extensions**。然后,选中“**开发者模式**”。最后,点击“**载入未打包扩展程序**”,选择刚才放置在**~/Home**下面的文件夹。
|
||||
|
||||
### 安装 ChromeOS-APK ###
|
||||
|
||||
如果要用到上面提到的应用,那么手动转换这些APKs无需复杂的操作——只需要安装“[chromeos-apk][5]”命令行JavaScript工具。可以在Node Package Modules(npm)管理器中安装它。为了安装npm和chromeos-apk,在shell或终端中运行下面命令:
|
||||
如果要用到上面提到的那些应用,那么手动转换这些APK无需复杂的操作——只需要安装“[chromeos-apk][5]”命令行JavaScript工具。可以在Node Package Modules(npm)管理器中安装它。为了安装npm和chromeos-apk,在shell或终端中运行下面命令:
|
||||
|
||||
$ sudo apt-get install npm nodejs nodejs-legacy
|
||||
|
||||
@@ -86,7 +88,7 @@
|
||||
|
||||
### 运行安卓Apk ###
|
||||
|
||||
最后,打开chrome浏览器,然后进入chrome://extensions页面,勾选开发者模式。点击“载入未打包扩展程序”按钮,选择文件夹载入刚创建的脚本。
|
||||
最后,打开chrome浏览器,然后进入chrome://extensions页面,勾选开发者模式。点击“载入未打包扩展程序”按钮,选择上面脚本刚创建的文件夹。
|
||||
|
||||
至此,就可以打开Chrome应用启动器运行安卓应用了。
|
||||
|
||||
@@ -100,7 +102,7 @@ via: http://linoxide.com/ubuntu-how-to/android-apps-ubuntu-archon-runtime/
|
||||
|
||||
作者:[Arun Pyasi][a]
|
||||
译者:[KayGuoWhu](https://github.com/KayGuoWhu)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Sleuth Kit -- 一个用来分析磁盘映像和恢复文件的开源取证工具
|
||||
Sleuth Kit:一个用来分析磁盘映像和恢复文件的开源取证工具
|
||||
================================================================================
|
||||
SIFT 是一个由 SANS 公司提供的基于 Ubuntu 的取证发行版本。它包含许多取证工具,如 Sleuth kit/Autopsy 。但 Sleuth kit / Autopsy 可以直接在 Ubuntu 或 Fedora 发行版本上直接安装,而不必下载 SIFT 的整个发行版本。
|
||||
SIFT 是一个由 SANS 公司提供的基于 Ubuntu 的取证发行版。它包含许多取证工具,如 Sleuth kit/Autopsy 。但 Sleuth kit/Autopsy 可以直接在 Ubuntu 或 Fedora 发行版本上直接安装,而不必下载 SIFT 的整个发行版本。
|
||||
|
||||
Sleuth Kit/Autopsy 是一个开源的电子取证调查工具,它被用于从磁盘映像中恢复丢失的文件,基于事件响应的磁盘映像的分析。 Autopsy 工具是 sleuth kit 的一个网页接口,支持 sleuth kit 的所有功能。这个工具在 Windows 和 Linux 平台下都可获取到。
|
||||
Sleuth Kit/Autopsy 是一个开源的电子取证调查工具,它可以用于从磁盘映像中恢复丢失的文件,以及为了特殊事件进行磁盘映像分析。 Autopsy 工具是 sleuth kit 的一个网页接口,支持 sleuth kit 的所有功能。这个工具在 Windows 和 Linux 平台下都可获取到。
|
||||
|
||||
### 安装 Sleuth kit ###
|
||||
|
||||
@@ -38,7 +38,7 @@ Sleuth Kit/Autopsy 是一个开源的电子取证调查工具,它被用于从
|
||||
|
||||
### 安装 Autopsy 工具 ###
|
||||
|
||||
Sleuth kit 已经安装完毕,现在我们将为它安装 autopsy 界面。从 [sleuthkit 的 autopsy 页面][2] 下载 Autopsy 软件。使用下面的命令在虚拟终端下使用 wget 命令来下载它,下图展示了这个过程。
|
||||
Sleuth kit 已经安装完毕,现在我们将为它安装 autopsy 界面。从 [sleuthkit 的 autopsy 页面][2]下载 Autopsy 软件。使用下面的命令在虚拟终端下使用 wget 命令来下载它,下图展示了这个过程。
|
||||
|
||||
# wget http://kaz.dl.sourceforge.net/project/autopsy/autopsy/2.24/autopsy-2.24.tar.gz
|
||||
|
||||
@@ -70,7 +70,7 @@ autopsy 的配置脚本将询问 NSRL (National Software Reference Library) 和
|
||||
|
||||

|
||||
|
||||
在浏览器中键入下面的地址来获取 autopsy 的界面:
|
||||
在浏览器中键入下面的地址来访问 autopsy 的界面:
|
||||
|
||||
http://localhost:9999/autopsy
|
||||
|
||||
@@ -90,7 +90,7 @@ autopsy 的配置脚本将询问 NSRL (National Software Reference Library) 和
|
||||
|
||||

|
||||
|
||||
点击 **增加映像** 按钮来为取证分析添加映像文件。
|
||||
添加主机后,点击 **增加映像** 按钮来为取证分析添加映像文件。
|
||||
|
||||

|
||||
|
||||
@@ -98,11 +98,11 @@ autopsy 的配置脚本将询问 NSRL (National Software Reference Library) 和
|
||||
|
||||

|
||||
|
||||
正如下图中展示的那样,我们已经键入了 Linux 映像文件的路径。在我们这个例子中,映像文件是磁盘的分区。
|
||||
正如下图中展示的那样,我们已经键入了 Linux 映像文件的路径。在我们这个例子中,映像文件类型是磁盘分区。
|
||||
|
||||

|
||||
|
||||
点击 下一步 按钮并在下一页中选择 **计算散列值** 的选项,这在下图中有展示。它也将检测所给映像的文件系统类型。
|
||||
点击“下一步”按钮并在下一页中选择 **计算散列值** 的选项,这在下图中有展示。它也将检测所给映像的文件系统类型。
|
||||
|
||||

|
||||
|
||||
@@ -142,7 +142,7 @@ autopsy 的配置脚本将询问 NSRL (National Software Reference Library) 和
|
||||
|
||||
### 结论 ###
|
||||
|
||||
希望这篇文章能够给那些进入磁盘映像的静态分析领域的新手提供帮助。Autopsy 是 sleuth kit 的网页界面,提供了在 Windows 和 Linux 磁盘映像中进行诸如字符串提取,恢复被删文件,时间线分析,网络浏览历史,关键字搜索和邮件分析等功能。
|
||||
希望这篇文章能够给那些进入磁盘映像静态分析领域的新手提供帮助。Autopsy 是 sleuth kit 的网页界面,提供了在 Windows 和 Linux 磁盘映像中进行诸如字符串提取,恢复被删文件,时间线分析,网络浏览历史,关键字搜索和邮件分析等功能。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@@ -150,7 +150,7 @@ via: http://linoxide.com/ubuntu-how-to/autopsy-sleuth-kit-installation-ubuntu/
|
||||
|
||||
作者:[nido][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/) 荣誉推出
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
### Monit是什么? ###
|
||||
|
||||
[Monit][3]是一个跨平台的用来监控Unix/linux系统(比如Linux、BSD、OSX、Solaris)的工具。Monit特别易于安装,而且非常轻量级(只有500KB大小),并且不依赖任何第三方程序、插件或者库。然而,Monit可以胜任全面监控、进程状态监控、文件系统变动监控、邮件通知和对核心服务的自定义回调等场景。易于安装、轻量级的实现以及强大的功能,让Monit成为一个理想的后备监控工具。
|
||||
[Monit][3]是一个跨平台的用来监控Unix/linux系统(比如Linux、BSD、OSX、Solaris)的工具。Monit特别易于安装,而且非常轻量级(只有500KB大小),并且不依赖任何第三方程序、插件或者库。然而,Monit可以胜任全面监控、进程状态监控、文件系统变动监控、邮件通知和对核心服务的自定义动作等场景。易于安装、轻量级的实现以及强大的功能,让Monit成为一个理想的后备监控工具。
|
||||
|
||||
我已经在一些机器使用Monit几年了,而且我对它的可靠性非常满意。甚至作为全面的监控系统,对任何Linux系统管理员来说Monit也是非常有用和强大的。在这篇教程中,我会展示如何在一个本地服务器部署Monit(作为后备监控系统)来监控常见的服务。在部署过程中,我只会展示我们用到的部分。
|
||||
|
||||
@@ -24,16 +24,16 @@ Fedora或者CentOS/RHEL:
|
||||
|
||||
# yum install monit
|
||||
|
||||
Monit自带一个文档完善的配置文件,其中包含了很多例子。主配置文件在/etc/monit.conf(Fedora/CentOS/RHEL),或者/etc/monit/monitrc(Debian/Ubuntu/Mint)。Monit配置文件有两部分:“Global”(全局)和“Services”(服务)。
|
||||
Monit自带一个文档完善的配置文件,其中包含了很多例子。主配置文件在/etc/monit.conf(Fedora/CentOS/RHEL 中),或者/etc/monit/monitrc(Debian/Ubuntu/Mint 中)。Monit配置文件有两部分:“Global”(全局)和“Services”(服务)。
|
||||
|
||||
### Global Configuration: Web Status Page (全局配置:Web状态页面。LCTT 译注:保留原文是因为和配置文件中的字段对应) ###
|
||||
### Global Configuration: Web Status Page (全局配置:Web状态页面) ###
|
||||
|
||||
Monit可以使用邮件服务来发送通知,也可以使用HTTP/HTTPS页面来展示。我们先使用符合以下要求的web状态页面吧:
|
||||
Monit可以使用邮件服务来发送通知,也可以使用HTTP/HTTPS页面来展示。我们先使用如下配置的web状态页面吧:
|
||||
|
||||
- Monit监听1966端口。
|
||||
- 对web状态页面的访问是通过SSL加密的。
|
||||
- 使用monituser/romania作为用户名/口令登录。
|
||||
- 只允许使用localhost、myhost.mydomain.ro和在局域网内部(192.168.0.0/16)访问。
|
||||
- 只允许通过localhost、myhost.mydomain.ro和在局域网内部(192.168.0.0/16)访问。
|
||||
- Monit使用pem格式的SSL证书。
|
||||
|
||||
之后的步骤,我会使用一个基于Red Hat的系统。在基于Debian的系统中的步骤也是类似的。
|
||||
@@ -99,10 +99,10 @@ Monit可以使用邮件服务来发送通知,也可以使用HTTP/HTTPS页面
|
||||
我们必须定义“idfile”,Monit守护进程的一个独一无二的ID文件;以及“eventqueue”,当monit的邮件因为SMTP或者网络故障发不出去,邮件会暂存在这里;以及确保/var/monit路径是存在的。然后使用下边的配置就可以了。
|
||||
|
||||
set idfile /var/monit/id
|
||||
set eventqueue
|
||||
set eventqueue
|
||||
basedir /var/monit
|
||||
|
||||
### 测试Global Configuration(全局配置) ###
|
||||
### 测试全局配置 ###
|
||||
|
||||
现在“Global”部分就完成了。Monit配置文件看起来像这样:
|
||||
|
||||
@@ -163,11 +163,11 @@ Monit可以使用邮件服务来发送通知,也可以使用HTTP/HTTPS页面
|
||||
|
||||
现在打开一个浏览器窗口,然后访问`https://<monit_host>:1966`。将`<monit_host>`替换成Monit所在机器的机器名或者IP地址。
|
||||
|
||||
如果你使用的是自签名的SSL证书,你会在浏览器中看到一个警告信息。
|
||||
如果你使用的是自签名的SSL证书,你会在浏览器中看到一个警告信息。继续访问即可。
|
||||
|
||||

|
||||
|
||||
你完成登录后,一定要看这个页面。
|
||||
你完成登录后,就会看到这个页面。
|
||||
|
||||

|
||||
|
||||
@@ -209,7 +209,7 @@ Monit可以使用邮件服务来发送通知,也可以使用HTTP/HTTPS页面
|
||||
if failed port 22 protocol ssh then restart
|
||||
if 5 restarts within 5 cycles then timeout
|
||||
|
||||
我们可以这样解释上述配置。我们检查是否存在名为sshd的进程,并且有一个保存pid的文件存在(/var/run/sshd.pid)。如果任何一个不存在,我们就使用启动脚本重启sshd。我们检查是否有进程在监听22端口,并且使用的是SSH协议。如果没有,我们还是重启sshd。如果在最近的5个监控周期(5x120秒)至少重启5次了,sshd就被认为是不能用的,我们就不再检查了。
|
||||
我们可以这样解释上述配置:我们检查是否存在名为sshd的进程,并且有一个保存其pid的文件存在(/var/run/sshd.pid)。如果任何一个不存在,我们就使用启动脚本重启sshd。我们检查是否有进程在监听22端口,并且使用的是SSH协议。如果没有,我们还是重启sshd。如果在最近的5个监控周期(5x120秒)至少重启5次了,sshd就被认为是不能用的,我们就不再检查了。
|
||||
|
||||

|
||||
|
||||
@@ -236,7 +236,7 @@ via: http://xmodulo.com/server-monitoring-system-monit.html
|
||||
|
||||
作者:[Iulian Murgulet][a]
|
||||
译者:[goreliu](https://github.com/goreliu)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
@@ -244,7 +244,7 @@ via: http://xmodulo.com/server-monitoring-system-monit.html
|
||||
[1]:http://xmodulo.com/monitor-common-services-nagios.html
|
||||
[2]:http://xmodulo.com/monitor-linux-servers-snmp-cacti.html
|
||||
[3]:http://mmonit.com/monit/
|
||||
[4]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html
|
||||
[4]:https://linux.cn/article-2324-1.html
|
||||
[5]:http://xmodulo.com/how-to-set-up-rpmforge-repoforge-repository-on-centos.html
|
||||
[6]:http://xmodulo.com/mail-server-ubuntu-debian.html
|
||||
[7]:http://mmonit.com/wiki/Monit/ConfigurationExamples
|
||||
@@ -1,3 +1,4 @@
|
||||
sevenot translating
|
||||
Install Google’s Material Design Inspired GTK And Icon Theme Paper in Linux
|
||||
================================================================================
|
||||

|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
3 Useful Hacks Every Linux User Must Know
|
||||
================================================================================
|
||||
The world of Linux is filled with so much fun and interesting stuffs, the more we go in, the more we find stuffs. In our efforts to bring those little hacks and tips for you that makes you different from others, here we have came up with three little tricks.
|
||||
|
||||
### 1. How to Schedule a Linux Job Without Cron ###
|
||||
|
||||
Scheduling a job/command in Linux is acronym to cron. Whenever we need to schedule a job, we call cron, but do you know we can schedule a job at a later time without corn? You can do it as suggested below..
|
||||
|
||||
Run a command (say date) every 5 sec and write the output to a file (say date.txt). To achieve this scenario, we need to run the below one liner script directly on the command prompt.
|
||||
|
||||
$ while true; do date >> date.txt ; sleep 5 ; done &
|
||||
|
||||
Anatomy of the above one liner script:
|
||||
|
||||
- while true – Ask script to run while the condition is true, it acts as a loop which makes the command to run again-and-again or say in a loop.
|
||||
- do – do perform what follows, ie., execute command or set of commands that lies ahead of do statement.
|
||||
- date >> date.txt – here the output of date command is being written to a file date.txt. Also note that we have used >> and not >.
|
||||
- >> ensures that the file (date.txt) is not overwritten every time the script execute. It just append the changes. Whereas > overwrite the file again and again.
|
||||
- sleep 5 – It ask the shell to keep a time difference of 5 seconds before it executed again. Note the time here is always measured in seconds. Say if you want to execute the command every 6 minutes, you should use (6*60) 360, in succession of sleep.
|
||||
- done – marks the end of while loop.
|
||||
- & – Put the whole process in loop to background.
|
||||
|
||||
Similarly, we can execute any script in the same manner. Here is the command to call a script after certain interval (say 100 sec) and the name of script is `script_name.sh`.
|
||||
|
||||
Also worth mentioning that the script above should be run in the directory where the script to be called lies, else you need to provide full path (`/home/$USER/…/script_name.sh`). The syntax for calling script at above described interval is:
|
||||
|
||||
$ while true; do /bin/sh script_name.sh ; sleep 100 ; done &
|
||||
|
||||
**Conclusion**: The above one liner is not a replacement of Cron, because Cron utility supports a whole lots of options, as compared and is very flexible as well as customizable. However if we want to run certain test cases or I/O benchmark, then the above singe command will serve the purpose.
|
||||
|
||||
Read Also: [11 Linux Cron Job Scheduling Examples][1]
|
||||
|
||||
### 2. How to Clear Terminal without Using ‘clear’ Command ###
|
||||
|
||||
What we do to clear the screen? Well you may think how silly it is to ask such question. Well, we all know it’s ‘clear‘ command. However if we make a habit of using key combination ‘ctrl+l‘ to clear terminal, we will save a lot of time of ours.
|
||||
|
||||
Key combination ‘Ctrl+l‘ has the same effect as ‘clear‘ command. So from next time use ctrl+l to clear your Linux Command Line Interface.
|
||||
|
||||
**Conclusion**: Since ctrl+l is a key combination, so we can not use it inside a script. If we need to clear screen inside a shell script, call command ‘clear’, for all other cases I could think of now, ctrl+l is more than sufficient.
|
||||
|
||||
### 3. Run a command and come back to the current working directory automatically. ###
|
||||
|
||||
Well this is an amazing hack not many people know. You may run a command no matter what it return back to the current directory. All you need to do is to run the command in parentheses i.e., in between `( and )`.
|
||||
|
||||
Let see the example,
|
||||
|
||||
avi@deb:~$ (cd /home/avi/Downloads/)
|
||||
|
||||
#### Sample Output ####
|
||||
|
||||
avi@deb:~
|
||||
|
||||
First it cd to directory Downloads and then again return back to home directory in one go. May be you believe that the command didn’t executed and for some reason one or another it is not throwing error, since there is no change in prompt. Lets do a little more tweak..
|
||||
|
||||
avi@deb:~$ (cd /home/avi/Downloads/ && ls -l)
|
||||
|
||||
#### Sample Output ####
|
||||
|
||||
-rw-r----- 1 avi avi 54272 May 3 18:37 text1.txt
|
||||
-rw-r----- 1 avi avi 54272 May 3 18:37 text2.txt
|
||||
-rw-r----- 1 avi avi 54272 May 3 18:37 text3.txt
|
||||
avi@deb:~$
|
||||
|
||||
So in the above command it first changed the current directory to Downloads and then list the content of that directory before returning back to current directory. Also, it proves that command executed successfully. You may run any sort of command in the parentheses and return back to your current working directory without a hitch.
|
||||
|
||||
That’s all for now, if you know any such Linux hacks or tricks you may share with us via our comment section and don’t forget to share this article with your friends….
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/useful-linux-hacks-commands/
|
||||
|
||||
作者:[Avishek Kumar][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/avishek/
|
||||
[1]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/
|
||||
@@ -1,92 +0,0 @@
|
||||
How to Kill Linux Processes/Unresponsive Applications Using ‘xkill’ Command
|
||||
================================================================================
|
||||
How do we kill a resource/process in Linux? Obviously we find the PID of the resource and then pass the PID to the kill command.
|
||||
|
||||
Speaking more accurately, we can find PID of a resource (say terminal) as:
|
||||
|
||||
$ ps -A | grep -i terminal
|
||||
|
||||
6228 ? 00:00:00 gnome-terminal
|
||||
|
||||
In the above output, the number ‘6228‘ is the PID of process (gnome-terminal), use the kill command to kill the process as shown below.
|
||||
|
||||
$ kill 6228
|
||||
|
||||
The kill command sends a signal to a process, whose PID is passed along with the command.
|
||||
|
||||
Alternatively, we can use pkill command, which kills a process based upon name and other attributes of a process. To kill a process say whose name is terminal, we need to execute:
|
||||
|
||||
$ pkill terminal
|
||||
|
||||
**Note**: The process name length in pkill is limited to 15 characters.
|
||||
|
||||
pkill seems more handy as you can kill a process without have to find out its PID. But if you want to have a better control on your system nothing beats ‘kill‘ command. Using kill you will have better insight of what process you are killing.
|
||||
|
||||
We have already covered a detailed guide on [kill, pkill and killall commands][1].
|
||||
|
||||
For those who are running X server there is another tool called xkill which can kill a process from its X window without passing process name or its PID.
|
||||
|
||||
xkill utility forces X server to close communications to its client which results into killing of client by its X resource. xkill which is a part of X11 utilities is very handy in killing unnecessary windows.
|
||||
|
||||
It support options like connect to specific X Server (-display displayname) using display number when multiple X Servers are running on a host simultaneously and kill all the client (-all, not recommended) with top-level windows on the screen as well as take frame (-frame) into account.
|
||||
|
||||
To get a list of all the clients you may run:
|
||||
|
||||
$ xlsclients
|
||||
|
||||
#### Sample Output ####
|
||||
|
||||
' ' /usr/lib/libreoffice/program/soffice
|
||||
deb gnome-shell
|
||||
deb Docky
|
||||
deb google-chrome-stable
|
||||
deb soffice
|
||||
deb gnome-settings-daemon
|
||||
deb gnome-terminal-server
|
||||
|
||||
If no resource identifier is passed with id, xkill turns the mouse Pointer into special Symbol, similar to ‘X‘. Just click on the window you want to kill and this will kill its communication with server or say the program gets killed.
|
||||
|
||||
$ xkill
|
||||
|
||||

|
||||
|
||||
Kill Process Using xkill
|
||||
|
||||
It is important to notice that xkill do not guarantee that closing its communication will kill/abort it successfully. Most of the application will get killed when it’s communication to server is closed. However a few may still be running.
|
||||
|
||||
Points Needed to be mentioned here:
|
||||
|
||||
- This tool works only when X11 server is running, as xkill is a part of X11 utility.
|
||||
- Don’t confuse with Closing and killing a resource. While killing a resource you may expect it not to exit cleanly.
|
||||
- This is not a replacement of kill utility.
|
||||
|
||||
**Do I need to go to Linux command line to invoke xkill?**
|
||||
|
||||
No, you don’t need to fire xkill from Linux Command Line. You may set a keyboard shortcut and call xkill just by punching same key combination.
|
||||
|
||||
Here is how to setup a keyboard shortcut on a typical gnome3 Desktop Environment.
|
||||
|
||||
Go to Settings –> Select Keyboard, click on ‘+’ and add name and command. Click on the new entry and press the key you want to use as shortcut key combination. I did Ctrl+Alt+Shift+x.
|
||||
|
||||

|
||||
|
||||
Gnome Settings
|
||||
|
||||

|
||||
|
||||
Add Shortcut Key
|
||||
|
||||
The next time you want to kill a X resource just call the key combination (Ctrl+Alt+Shift+x), and you will notice your mouse pointer changed into x. Click on x resource you want to kill and all done!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/kill-processes-unresponsive-programs-in-ubuntu/
|
||||
|
||||
作者:[Avishek Kumar][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/avishek/
|
||||
[1]:http://www.tecmint.com/how-to-kill-a-process-in-linux/
|
||||
@@ -1,3 +1,5 @@
|
||||
Translating by goreliu ...
|
||||
|
||||
11 pointless but awesome Linux terminal tricks
|
||||
================================================================================
|
||||
Here are some great Linux terminal tips and tricks, each one as pointless as it is awesome.
|
||||
@@ -95,7 +97,7 @@ Want your terminal to do that scrolling text, l33t, Matrix-y thing? "cmatrix" is
|
||||
via: http://www.networkworld.com/article/2926630/linux/11-pointless-but-awesome-linux-terminal-tricks.html
|
||||
|
||||
作者:[Bryan Lunduke][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[goreliu](https://github.com/goreliu)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
每个Linux用户都应该知道的3个有用技巧
|
||||
================================================================================
|
||||
Linux世界充满了乐趣,我们越深入进去,就会发现越多有趣的事物。我们会努力给你提供一些小技巧,让你和其他人有所不同,下面就是我们准备的3个小技巧。
|
||||
|
||||
### 1. 如何在不使用Cron的情况调度Linux下的作业 ###
|
||||
在Linux下,调度一个作业/命令可以缩写为Cron。当我们需要调度一个作业时,我们会使用Cron,但你知道我们在不使用Cron的情况也可以调度一个在将来时间运行的作业吗?你可以按照如下建议操作……
|
||||
|
||||
每5秒钟运行一个命令(date)然后将结果写入到一个文件(data.txt)。为了实现这一点,我们可以直接在命令提示符运行如下单行脚本。
|
||||
|
||||
$ while true; do date >> date.txt ; sleep 5 ; done &
|
||||
|
||||
上述脚本的解释:
|
||||
|
||||
- `while true` :让脚本进入一个条件总为真的循环中,也就是制造一个死循环,将里边的命令一遍遍地重复运行。
|
||||
- `do` :`do`是`while`语句中的关键字,它之后的命令会被执行,在它后边可以放置一个或一系列命令。
|
||||
- `date >> date.txt` :运行date命令,并将其输出写入到data.txt文件中。注意我们使用`>>`,而不是`>`。
|
||||
- `>>` :对文件(date.txt)进行追加写的操作,这样每次运行命令后,输出内容会被追加到文件中。如果使用`>`的话,则会一遍遍地覆盖之前的内容。
|
||||
- `sleep 5` :让脚本处于5秒睡眠状态,然后再运行之后的命令。注意这里的时间单位只能用秒。也就是说如果你想让命令每6分钟运行一次,你应该使用`sleep 360`。
|
||||
- `done` :`while`循环语句块结束的标记。
|
||||
- `&` :将整个进程放到后台运行。
|
||||
|
||||
类似地,我们可以这样运行任何脚本。下边的例子是每100秒运行一个名为`script_name.sh`的脚本。
|
||||
|
||||
另外值得一提的是上边的脚本文件必须处于当前目录中,否则需要使用完整路径(`/home/$USER/…/script_name.sh`)。实现如上功能的单行脚本如下:
|
||||
|
||||
$ while true; do /bin/sh script_name.sh ; sleep 100 ; done &
|
||||
|
||||
**总结**:上述的单行脚本并不是Cron的替代品,因为Cron工具支持众多选项,更加灵活,可定制性也更高。然而如果我们想运行某些测试,比如I/O评测,上述的单行脚本也管用。
|
||||
|
||||
还可以参考:[11 Linux Cron Job Scheduling Examples][1]
|
||||
|
||||
### 2. 如何不使用clear命令清空终端的内容 ###
|
||||
|
||||
你如何清空终端的内容?你可能会认为这是一个傻问题。好吧,大家都清楚可以使用`clear`命令。如果养成使用`ctrl + l`快捷键的习惯,我们会节省大量时间。
|
||||
|
||||
`Ctrl + l`快捷键的效果和`clear`命令一样。所以下一次你就可以使用`ctrl + l`来清空终端的内容了。
|
||||
|
||||
**总结**:因为`ctrl + l`是一个快捷键,我们不可以在脚本中使用。所以如果我们需要在脚本中清空屏幕内容,还是需要使用`clear`命令。但我能想到的所有其他情况,`ctrl + l`都更加有效。
|
||||
|
||||
### 3. 运行一个命令,然后自动回到当前的工作目录 ###
|
||||
|
||||
这是一个很多人可能不知道的令人吃惊的技巧。你可能想运行任何一个命令,然后再回到当前目录。你只需要将命令放在一个圆括号里。
|
||||
|
||||
我们来看一个例子:
|
||||
|
||||
avi@deb:~$ (cd /home/avi/Downloads/)
|
||||
|
||||
#### 示例输出 ####
|
||||
|
||||
avi@deb:~
|
||||
|
||||
它首先会cd到Downloads目录,然后又回到了之前的家目录。也许你认为里边的命令根本没有执行,或者是出了某种错误,因为从命令提示符看不出任何变化。让我们简单修改一下这个命令:
|
||||
|
||||
avi@deb:~$ (cd /home/avi/Downloads/ && ls -l)
|
||||
|
||||
#### 示例输出 ####
|
||||
|
||||
-rw-r----- 1 avi avi 54272 May 3 18:37 text1.txt
|
||||
-rw-r----- 1 avi avi 54272 May 3 18:37 text2.txt
|
||||
-rw-r----- 1 avi avi 54272 May 3 18:37 text3.txt
|
||||
avi@deb:~$
|
||||
|
||||
在上述命令中,它首先进入Downloads目录,然后列出文件内容,最后又回到了当前目录。并且它证明了命令成功执行了。你可以在括号中包含任何命令,执行完都会顺利返回到当前目录。
|
||||
|
||||
这就是全部内容了,如果你知道任何类似的Linux技巧,你可以在文章下面的评论框中分享给我们,不要忘记将本文和朋友分享 :)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/useful-linux-hacks-commands/
|
||||
|
||||
作者:[Avishek Kumar][a]
|
||||
译者:[goreliu](https://github.com/goreliu)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/avishek/
|
||||
[1]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/
|
||||
@@ -0,0 +1,93 @@
|
||||
如何使用xkill命令傻点Linux进程/未响应的程序
|
||||
================================================================================
|
||||
我们如何在Linux中杀掉一个资源/进程?很明显我们会找出资源的pid然后用kill命令。
|
||||
|
||||
更准确一点,我们可以找到资源(这里就是terminal)的PID:
|
||||
|
||||
$ ps -A | grep -i terminal
|
||||
|
||||
6228 ? 00:00:00 gnome-terminal
|
||||
|
||||
上面的输出中,‘6288’就是进程(gnome-terminal)的pid, 使用下面的命令来杀掉进程。
|
||||
|
||||
$ kill 6228
|
||||
|
||||
kill命令会发送一个信号给该pid的进程。
|
||||
|
||||
另外一个方法是我们可以使用pkill命令,它可以基于进程的名字或者其他的属性来杀掉进程。同样我们要杀掉一个叫terminal的进程可以这么做:
|
||||
|
||||
$ pkill terminal
|
||||
|
||||
**注意**: pkill命令后面进程名的长度不大于15个字符
|
||||
|
||||
pkill看上去更加容易上手,因为你你不用找出进程的pid。但是如果你要对系统做更好的控制,那么没有什么可以打败'kill'。使用kill命令可以更好地审视你要杀掉的进程。
|
||||
|
||||
我们已经有一篇覆盖了[kill、pkill和killall命令][1]间细节的指导了。
|
||||
|
||||
对于那些运行X Server的人而言,有另外一个工具称为xkill可以将进程从X Window中杀掉而不必传递它的名字或者pid。
|
||||
|
||||
xkill工具强制X server关闭于它客户端之间的联系,这可以让X resource关闭这个客户端。xkill是X11工具集中一个非常容易上手的杀掉无用窗口的工具。
|
||||
|
||||
它支持的选项如在同时运行多个X Server时使用-display选项后面跟上显示号连接到指定的X server,使用-all(并不建议)杀掉所有在屏幕上的所遇顶层窗口,同时将帧(-frame)也计算在内。
|
||||
|
||||
要得到所有的客户端你可以运行:
|
||||
|
||||
$ xlsclients
|
||||
|
||||
#### 示例输出 ####
|
||||
|
||||
' ' /usr/lib/libreoffice/program/soffice
|
||||
deb gnome-shell
|
||||
deb Docky
|
||||
deb google-chrome-stable
|
||||
deb soffice
|
||||
deb gnome-settings-daemon
|
||||
deb gnome-terminal-server
|
||||
|
||||
如果后面没有跟上资源id,xkill会将鼠标指针变成一个特殊符号,类似于“X”。只需在你要杀掉的窗口上点击,它就会杀掉它与server端的通信,这个程序就被杀掉了。
|
||||
|
||||
|
||||
$ xkill
|
||||
|
||||

|
||||
|
||||
使用xkill杀掉进程
|
||||
|
||||
需要注意的是xkill并不能保证它的通信会被成功杀掉/退出。大多数程序会在与服务端的通信被关闭后杀掉。然而仍有少部分会继续运行。
|
||||
|
||||
需要指出的点是:
|
||||
|
||||
- 这个工具只能在X11 server运行的时候才能使用,因为这是X11工具的一部分。
|
||||
- 不要在你杀掉一个资源而它没有完全退出时而困惑。
|
||||
- 这不是kill的替代品
|
||||
|
||||
**我需要在linux命令行中使用xkill么**
|
||||
|
||||
不是,你不必在命令行中运行xkill。你可以设置一个快捷键,并用它来调用xkill。
|
||||
|
||||
下面是如何在典型的gnome3桌面中设置键盘快捷键。
|
||||
|
||||
进入设置-> 选择键盘。点击'+'并添加一个名字和命令。点击点击新条目并按下你想要的组合键。我的是Ctrl+Alt+Shift+x。
|
||||
|
||||

|
||||
|
||||
Gnome 设置
|
||||
|
||||

|
||||
|
||||
添加快捷键
|
||||
|
||||
下次你要杀掉X资源只要用组合键就行了(Ctrl+Alt+Shift+x),你看到你的鼠标变成x了。点击想要杀掉的x资源就行了。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/kill-processes-unresponsive-programs-in-ubuntu/
|
||||
|
||||
作者:[Avishek Kumar][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/avishek/
|
||||
[1]:http://www.tecmint.com/how-to-kill-a-process-in-linux/
|
||||
Reference in New Issue
Block a user