[TOC]
wc
文件相关命令。
- wc -c filename:显示一个文件的字节数
- wc -m filename:显示一个文件的字符数
- wc -l filename:显示一个文件的行数
- wc -L filename:显示一个文件中的最长行的长度
- wc -w filename:显示一个文件的字数
- wc filename: 输出信息依次是:行数 字数 字节数 文件名称
注意:
- 每行结尾的换行符也算一个字符,空格也算一个字符
- 由于采用UTF-8编码,所以一个汉字被转换为3个字节
- 当使用 -m 选项时,一个汉字作为一个字符计算
shell
Unix shell,一种Unix命令行交互界面,用户通过这个界面访问操作系统内核的服务。
shell script,一种为shell编写的脚本程序。业界所说的 shell 通常都是指 shell 脚本。
shell script 解释器:
- sh is a specification, not an implementation
- bash is a superset of sh with a more elegant syntax and more functionality
- zsh
- ...
遇到的问题,在 jenkins 上执行 shell 时,直接 deploy_service.sh
,报Promission deny
,改成 bash deploy_service.sh
即可,避免了修改权限操作。
ls
- ll -t: 排序,最新修改的显示在最前
- ll -rt: 排序,最新修改的显示在最后
jar
Option | Description |
---|---|
c | Creates a new jar file. |
u | Updates an existing jar file. |
x | Extracts files from an existing jar file. |
t | Lists the contents of a jar file. |
v | Verbose output. This option tells the jar command to display extra information while it works. |
f | Indicates that the jar file is specified as an argument. You almost always want to use this option. |
jar xvf ***.jar:解压指定jar包
unzip
- unzip file.zip
- unzip file.zip -d destination_folder
压测
ab(ApacheBench)
Option | Description |
---|---|
-n | requests Number of requests to perform |
-c | concurrency Number of multiple requests to make |
-p | post File containing data to POST: -p abc.txt
|
-T | content-type Content-type header for POST: -T “application/x-www-form-urlencoded”
|
- 安装:brew install pcre
- ab -n 4000 -c 1000 http://www.example.com/