From 8150c7fb6e0a2768a3ae7b71ed8b76c33f162b54 Mon Sep 17 00:00:00 2001 From: Joshua Levy Date: Tue, 14 Jul 2015 01:45:38 -0700 Subject: [PATCH 1/5] Remove duplicate xargs item. Fixes #194. --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 3a41294..6d9c186 100644 --- a/README.md +++ b/README.md @@ -286,12 +286,6 @@ A few examples of piecing together commands: find . -type f -ls ``` -- Use `xargs` or `parallel` whenever you can. Note you can control how many items execute per line (`-L`) as well as parallelism (`-P`). If you're not sure if it'll do the right thing, use xargs echo first. Also, `-I{}` is handy. Examples: -```sh - find . -name '*.py' | xargs grep some_function - cat hosts | xargs -I{} ssh root@{} hostname -``` - - Say you have a text file, like a web server log, and a certain value that appears on some lines, such as an `acct_id` parameter that is present in the URL. If you want a tally of how many requests for each `acct_id`: ```sh cat access.log | egrep -o 'acct_id=[0-9]+' | cut -d= -f2 | sort | uniq -c | sort -rn From 49c1607e481df40b621136f5f4fad2bc1b0c7aef Mon Sep 17 00:00:00 2001 From: grossws Date: Thu, 9 Jul 2015 12:23:17 +0300 Subject: [PATCH 2/5] Add more info about JDK Add more info about standard tools from OracleJDK/OpenJDK --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6d9c186..e86b42e 100644 --- a/README.md +++ b/README.md @@ -234,6 +234,7 @@ Notes: - To know memory status, run and understand the output of `free` and `vmstat`. In particular, be aware the "cached" value is memory held by the Linux kernel as file cache, so effectively counts toward the "free" value. - Java system debugging is a different kettle of fish, but a simple trick on Oracle's and some other JVMs is that you can run `kill -3 ` and a full stack trace and heap summary (including generational garbage collection details, which can be highly informative) will be dumped to stderr/logs. + Also default JDKs `jps`, `jstat`, `jstack`, `jmap` are quite usefull, take a look at their help. For more advanced cases use something like [SJK by Alexey Rogozin](https://github.com/aragozin/jvm-tools). - Use `mtr` as a better traceroute, to identify network issues. From ea070f5d61ec3820edd66226ae2470c0c5abe18e Mon Sep 17 00:00:00 2001 From: Joshua Levy Date: Tue, 14 Jul 2015 01:50:34 -0700 Subject: [PATCH 3/5] Fix up JDK language. Adjustments to #172 --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index e86b42e..af21393 100644 --- a/README.md +++ b/README.md @@ -233,8 +233,7 @@ Notes: - To know memory status, run and understand the output of `free` and `vmstat`. In particular, be aware the "cached" value is memory held by the Linux kernel as file cache, so effectively counts toward the "free" value. -- Java system debugging is a different kettle of fish, but a simple trick on Oracle's and some other JVMs is that you can run `kill -3 ` and a full stack trace and heap summary (including generational garbage collection details, which can be highly informative) will be dumped to stderr/logs. - Also default JDKs `jps`, `jstat`, `jstack`, `jmap` are quite usefull, take a look at their help. For more advanced cases use something like [SJK by Alexey Rogozin](https://github.com/aragozin/jvm-tools). +- Java system debugging is a different kettle of fish, but a simple trick on Oracle's and some other JVMs is that you can run `kill -3 ` and a full stack trace and heap summary (including generational garbage collection details, which can be highly informative) will be dumped to stderr/logs. The JDK's `jps`, `jstat`, `jstack`, `jmap` are useful. [SJK tools](https://github.com/aragozin/jvm-tools) are more advanced. - Use `mtr` as a better traceroute, to identify network issues. From 3f1d0a9fa0b7e537eb94b62285e4d496f7c91ee3 Mon Sep 17 00:00:00 2001 From: Chunyang Xu Date: Tue, 14 Jul 2015 12:57:33 +0800 Subject: [PATCH 4/5] zh: update translation to the latest --- README-zh.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/README-zh.md b/README-zh.md index e2b5da5..397d5bf 100644 --- a/README-zh.md +++ b/README-zh.md @@ -166,7 +166,7 @@ - 如果你不得不处理 XML,`xmlstarlet` 宝刀未老。 -- 使用 `jq` 处理 JSON。 +- 使用 [`jq`](http://stedolan.github.io/jq/) 处理 JSON。 - Excel 或 CSV 文件的处理,[csvkit](https://github.com/onyxfish/csvkit) 提供了 `in2csv`,`csvcut`,`csvjoin`,`csvgrep` 等工具。 @@ -231,7 +231,7 @@ - 若要了解内存状态,运行并理解 `free` 和 `vmstat` 的输出。尤其注意“cached”的值,它指的是 Linux 内核用来作为文件缓存的内存大小,因此它与空闲内存无关。 -- Java 系统调试则是一件截然不同的事,一个可以用于 Oracle 的 JVM 或其他 JVM 上的调试的小技巧是你可以运行 `kill -3 ` 同时一个完整的栈轨迹和堆概述(包括 GC 的细节)会被保存到标准输出/日志文件。 +- Java 系统调试则是一件截然不同的事,一个可以用于 Oracle 的 JVM 或其他 JVM 上的调试的小技巧是你可以运行 `kill -3 ` 同时一个完整的栈轨迹和堆概述(包括 GC 的细节)会被保存到标准输出/日志文件。JDK 中的 `jps`,`jstat`,`jstack`,`jmap` 很有用。[SJK tools](https://github.com/aragozin/jvm-tools) 更高级. - 使用 `mtr` 去跟踪路由,用于确定网络问题。 @@ -283,12 +283,6 @@ find . -type f -ls ``` -- 尽可能的使用 `xargs` 或 `parallel`。注意到你可以控制每行参数个数(`-L`)和最大并行数(`-P`)。如果你不确定它们是否会按你想的那样工作,先使用 `xargs echo` 查看一下。此外,使用 `-I{}` 会很方便。例如: -```sh - find . -name '*.py' | xargs grep some_function - cat hosts | xargs -I{} ssh root@{} hostname -``` - - 假设你有一个类似于 web 服务器日志文件的文本文件,并且一个确定的值只会出现在某些行上,假设一个 `acct_id` 参数在URI中。如果你想计算出每个 `acct_id` 值有多少次请求,使用如下代码: ```sh cat access.log | egrep -o 'acct_id=[0-9]+' | cut -d= -f2 | sort | uniq -c | sort -rn From 30d6b23b6ed1fd0c31bc50a2be3c97b1623d5674 Mon Sep 17 00:00:00 2001 From: Chunyang Xu Date: Tue, 14 Jul 2015 13:05:16 +0800 Subject: [PATCH 5/5] zh: remove unneeded white spaces --- README-zh.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README-zh.md b/README-zh.md index 397d5bf..9cc0b40 100644 --- a/README-zh.md +++ b/README-zh.md @@ -428,7 +428,7 @@ - `lshw`,`lscpu`,`lspci`,`lsusb` 和 `dmidecode`:查看硬件信息,包括 CPU、BIOS、RAID、显卡、USB设备等 -- `fortune`,`ddate` 和 `sl`: 额,这主要取决于你是否认为蒸汽火车和莫名其妙的名人名言是否“有用” +- `fortune`,`ddate` 和 `sl`:额,这主要取决于你是否认为蒸汽火车和莫名其妙的名人名言是否“有用” ## 仅限 Mac 系统 @@ -442,13 +442,13 @@ - Spotlight: 用 `mdfind` 搜索文件,用 `mdls` 列出元数据(例如照片的 EXIF 信息)。 -- 注意 Mac 系统是基于 BSD UNIX 的,许多命令(例如 `ps`, `ls`, `tail`, `awk`,`sed`)都和 Linux 中有些微的不同,这些极大的被 System V-style Unix 和 GNU 工具影响。你可以通过标题为 "BSD General Commands Manual" 的 man 页面发现这些不同。在有些情况下 GNU 版本的命令也可能被安装(例如 `gawk` 和 `gsed` 对应 GNU 中的 awk 和 sed )。如果要写跨平台的 Bash 脚本,避免使用这些命令(例如,考虑 Python 或者 `perl` )或者经过仔细的测试。 +- 注意 Mac 系统是基于 BSD UNIX 的,许多命令(例如 `ps`,`ls`,`tail`,`awk`,`sed`)都和 Linux 中有些微的不同,这些极大的被 System V-style Unix 和 GNU 工具影响。你可以通过标题为 "BSD General Commands Manual" 的 man 页面发现这些不同。在有些情况下 GNU 版本的命令也可能被安装(例如 `gawk` 和 `gsed` 对应 GNU 中的 awk 和 sed )。如果要写跨平台的 Bash 脚本,避免使用这些命令(例如,考虑 Python 或者 `perl` )或者经过仔细的测试。 ## 更多资源 -- [awesome-shell](https://github.com/alebcay/awesome-shell): 一份精心组织的命令行工具及资源的列表。 -- [Strict mode](http://redsymbol.net/articles/unofficial-bash-strict-mode/): 为了编写更好的脚本文件。 +- [awesome-shell](https://github.com/alebcay/awesome-shell):一份精心组织的命令行工具及资源的列表。 +- [Strict mode](http://redsymbol.net/articles/unofficial-bash-strict-mode/):为了编写更好的脚本文件。 ## 免责声明