Skip to content

Commit

Permalink
更新命令文件 https://github.com/jaywcjlove/linux-command 提交记录(a0dad67d31b4e…
Browse files Browse the repository at this point in the history
…6c0470de5dc6efd82aceebe547d)
  • Loading branch information
Ernest-su committed Apr 26, 2022
1 parent a99bef5 commit e392bad
Show file tree
Hide file tree
Showing 577 changed files with 17,263 additions and 10,059 deletions.
129 changes: 104 additions & 25 deletions app/src/main/assets/cmd/ab.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,118 @@ Apache服务器的性能测试工具

## 补充说明

**ab命令** 是Apache的Web服务器的性能测试工具,它可以测试安装Web服务器每秒种处理的HTTP请求
**ab命令** 是一个测试你 Apache http 服务器的工具,你可以通过这个工具,指定一个单位时间内向 apache 发出的请求数量来看看你的 Apache 和机器配合的性能如何

### 语法
### 语法

```
ab(选项)(参数)
```shell
ab [ -A auth-username:password ] [ -c concurrency ] [ -C cookie-name=value
] [ -d ] [ -e csv-file ] [ -g gnuplot-file ] [ -h ] [ -H custom-header ] [
-i ] [ -k ] [ -n requests ] [ -p POST-file ] [ -P proxy-auth-user‐
name:password ] [ -q ] [ -s ] [ -S ] [ -t timelimit ] [ -T content-type ]
[ -v verbosity] [ -V ] [ -w ] [ -x <table>-attributes ] [ -X proxy[:port]
] [ -y <tr>-attributes ] [ -z <td>-attributes ] [http://]host‐
name[:port]/path
```

### 选项
### 选项

```
-A:指定连接服务器的基本的认证凭据;
-c:指定一次向服务器发出请求数;
-C:添加cookie;
-g:将测试结果输出为“gnuolot”文件;
-h:显示帮助信息;
-H:为请求追加一个额外的头;
-i:使用“head”请求方式;
-k:激活HTTP中的“keepAlive”特性;
-n:指定测试会话使用的请求数;
-p:指定包含数据的文件;
-q:不显示进度百分比;
-T:使用POST数据时,设置内容类型头;
-v:设置详细模式等级;
-w:以HTML表格方式打印结果;
-x:以表格方式输出时,设置表格的属性;
-X:使用指定的代理服务器发送请求;
-y:以表格方式输出时,设置表格属性。
```shell
-A auth-username:password
# 支持基本的验证证书,用户名和密码之间使用"冒号" :
# 分隔开,ab将以明文方式传送过去.不管服务器是不是需要
# ,也就是说你的服务器需要支持401认证.

-c concurrency
# 同时向服务器端发送的请求数目,默认状态下是一次 只执行一个http请求.

-C cookie-name=value
# Add a Cookie: line to the request. The argument is typically in the
# form of a name=value pair. This field is repeatable.

-d # Do not display the "percentage served within XX [ms] table".
# (legacy support).

-e csv-file
# Write a Comma separated value (CSV) file which contains for each
# percentage (from 1% to 100%) the time (in milli seconds) it took to
# serve that percentage of the requests. This is usually more useful
# than the 'gnuplot' file; as the results are already 'binned'.

-g gnuplot-file
# Write all measured values out as a 'gnuplot' or TSV (Tab separate
# values) file. This file can easily be imported into packages like
# Gnuplot, IDL, Mathematica, Igor or even Excell. The labels are on
# the first line of the file.
-h # 显示使用说明
-H custom-header
# 向请求包追加附加的标题字串.此参数应该是有效的标题 行(header
# line)形式,通常使用冒号":"来分隔有效配对 (valid pair)例如 'Accept-
# Encoding: zip/zop;8 bit';

-i # 使用一个 http 头(HEAD) 来替换 GET方法.不可以掺入POST 方法

-k # 允许http KeepAlive ;也就是说执行多个请求在一个 http
# 会话当中,默认是不允许的也就是no KeepAlive啦;)

-n requests
# 执行一次测试会话的时候所发出的请求数目,默认是执行一个单一的请求
# 当然了这样的测试结果也就没什么意义了

-p POST-file
# 测试程序也就是ab,将向Apache server发送带有HTTP POST 的请求.

-P proxy-auth-username:password
# 当需要通过代理测试一台 HTTP 服务器的时候而你的代理
# 又需要用户名密码验证,这时你可以使用这个选项,同样
# 用户名与密码之间使用冒号":"分隔开,ab将之以明文的方式
# 发送出去,当然,前提是你的代理是处于407认证状态的

-q # When processing more than 150 requests, ab outputs a progress count
# on stderr every 10% or 100 requests or so. The -q flag will sup‐
# press these messages.

-s # When compiled in (ab -h will show you) use the SSL protected https
# rather than the http protocol. This feature is experimental and
# very rudimentary. You probably do not want to use it.

-S # Do not display the median and standard deviation values, nor dis‐
# play the warning/error messages when the average and median are
# more than one or two times the standard deviation apart. And de‐
# fault to the min/avg/max values. (legacy support).

-t timelimit
# 设置测试的时间的长短,使用这个选项ab将自动设置
# 测试请求会话数目为50000,然后以你设置的时间为
# 固定周期.默认状态下是没有时限的,也就是直到完成
# 你所设置的请求数目为止.

-T content-type
# 内容类型标头,使用在POST数据的时候.

-v verbosity
# 设置冗余级别,4级打印出每个请求标头的详细信息,
# 3级打印出回应代码(例如,404,200),2级打印出警告 信息和指示消息

-V # 显示版本号并且退出
-w # 打印输出结果到HTML表中. 默认的表是两列n行白底黑框

-x <table>-attributes
# 使用字串来描述表的属性,该属性字串应该插入到<table 这里 >

-X proxy[:port]
# Use a proxy server for the requests.

-y <tr>-attributes
# 用于生成html表格每行的属性名 (<tr>)

-z <td>-attributes
# 用于生成html表格每列的属性名 (<td>)
```

### 参数
### 参数

主机:被测试主机。


<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->

7 changes: 3 additions & 4 deletions app/src/main/assets/cmd/accept.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@ accept

**accept命令** 属于CUPS套件,用于指示打印系统接受发往指定目标打印机的打印任务。

### 语法
### 语法

```
accept(选项)(参数)
```

### 选项
### 选项

```
-E:当连接到服务器时强制加密;
-U:指定连接服务器时使用的用户名;
-h:指定连接服务器名和端口号。
```

### 参数
### 参数

目标:指定目标打印机。


<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->
104 changes: 104 additions & 0 deletions app/src/main/assets/cmd/ack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
ack
===

比grep好用的文本搜索工具

## 安装

```shell
# ubuntu下要安装ack-grep,因为在debian系中,ack这个名字被其他的软件占用了。
sudo apt-get install ack-grep
# alpine Linux-apk软件包管理器 安装 ack
apk install ack
```

## 参数

这些参数在linux上的适用频率是相当高的,尤其是你用vim做为IDE的话

```shell
-c(统计)/ -i(忽略大小)/ -h(不显示名称)/
-l(只显文件名)/ -n(加行号)/ -v(显示不匹配)
```

## 特点

ack官网列出了这工具的5大卖点:

1. 速度非常快,因为它只搜索有意义的东西。
2. 更友好的搜索,忽略那些不是你源码的东西。
3. 为源代码搜索而设计,用更少的击键完成任务。
4. 非常轻便,移植性好。
5. 免费且开源

## 实例

在记忆的时候大体上可以分为这几个部分:

> Searching 代码搜索
> Search output 搜索结果处理
> File presentation 文件展示
> File finding 文件查找
> File inclusion/exclusion 文件过滤
grep常用操作

```shell
grep -r 'hello_world' # 简单用法
grep '^hello_world' . # 简单正则
ls -l | grep .py # 管道用法
```

### Searching

简单的文本搜索,默认是递归的。

```
ack-grep hello
ack-grep -i hello
ack-grep -v hello
ack-grep -w hello
ack-grep -Q 'hello*'
```

### Search File

对搜索结果进行处理,比如只显示一个文件的一个匹配项,或者xxx

```shell
ack-grep --line=1 # 输出所有文件第二行
ack-grep -l 'hello' # 包含的文件名
ack-grep -L 'print' # 非包含文件名
```

### File presentation

输出的结果是以什么方式展示呢,这个部分有几个参数可以练习下

```shell
ack-grep hello --pager='less -R' # 以less形式展示
ack-grep hello --noheading # 不在头上显示文件
ack-grep hello --nocolor # 不对匹配字符着色
```

### File finding
没错,它可以查找文件,以省去你要不断的结合find和grep的麻烦,虽然在linux的思想是一个工具做好一件事。

```shell
ack-grep -f hello.py # 查找全匹配文件
ack-grep -g hello.py$ # 查找正则匹配文件
ack-grep -g hello --sort-files # 查找然后排序
```

### File Inclusion/Exclusion

文件过滤,个人觉得这是一个很不错的功能。如果你曾经在搜索项目源码是不小心命中日志中的某个关键字的话,你会觉得这个有用。

```shell
ack-grep --python hello # 查找所有python文件
ack-grep -G hello.py$ hello # 查找匹配正则的文件
```

## 参考资料

- [ack官网](https://beyondgrep.com/)
Loading

0 comments on commit e392bad

Please sign in to comment.