[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/