Skip to content

Commit 11ee1d7

Browse files
author
Chu Fan
committed
feat: add docs
1 parent 3776e49 commit 11ee1d7

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

docs/manuscript/develop-skill/code-manager/git-info-reset.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
# 修改历史提交信息
44

5+
#### 查看提交日志
6+
7+
```bash
8+
git log
9+
```
510

611
#### rebase到指定结点
712

docs/manuscript/server-end/linux/base-cmd.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,92 @@ cat 1.txt
208208
209209
### echo命令
210210
211+
```bash
212+
# 直接输出文本
213+
echo hello
214+
# 解压使用引号将内容括起来,单引号,双引号均可
215+
echo 'hello'
216+
#使用-e可以识别特殊字符
217+
echo -e "hello\tworld"
218+
```
219+
220+
echo可以配合重定向符将内容输入到文件
221+
- `>` :为重定向符号,表示清除原文件里面的所有内容,然后将内容追加到文件的末尾
222+
- `>>` :为追加重定向符号,即追加内容到文件的尾部(文件的最后一行)。
223+
224+
225+
```bash
226+
## 文本追加到文件中
227+
echo "hello world" >>hello.txt #文件会被自动创建
228+
229+
## test.sh内容
230+
#!/bin/sh
231+
read name
232+
echo "$name It is a test"
233+
234+
## 执行
235+
sh test.sh
236+
OK #标准输入
237+
OK It is a test #输出
238+
239+
## 换行
240+
echo -e "OK! \n" # -e 开启转义
241+
echo "It is a test"
242+
243+
## 不换行
244+
echo -e "OK! \c" # -e 开启转义 \c 不换行
245+
echo "It is a test"
246+
247+
## 显示命令执行结果 执行函数date
248+
echo `date`
249+
250+
```
251+
252+
253+
211254
### grep命令
212255
256+
参考: https://www.cnblogs.com/chentiao/p/16626503.html
257+
258+
- `-i` : 搜索时候忽略大小写
259+
- -n 列出所有的匹配行,显示行号
260+
- -v 反向选择
261+
- -c 只输出匹配行的数量
262+
- -l 只列出符合匹配的文件名,不列出具体的匹配行
263+
- -h 查询多文件时不显示文件名
264+
- -r 递归搜索
265+
- -q 禁止输出任何结果,已退出状态表示搜索是否成功
266+
- --color=auto 将找到的关键字加上颜色显示
267+
- -E, --extended-regexp PATTERN 是一个可扩展的正则表达式(缩写为 ERE)
268+
- -B, --before-context=NUM 打印以文本起始的NUM 行
269+
- -A, --after-context=NUM 打印以文本结尾的NUM 行
270+
271+
272+
```bash
273+
274+
## 删除掉空行,"^$" 表示空行
275+
grep -v "^$" test.txt
276+
277+
## 过滤不包含sbin关键词,并输出行号
278+
grep -n -v "sbin" test.txt
279+
```
280+
213281
### sed命令
214282
283+
sed是Stream Editor(字符流编辑器)的缩写,简称流编辑器。
284+
ed是操作、过滤和转换文本内容的强大工具。sed的常用功能包含对文件实现快速增删改查(增加、删
285+
除、修改、查询),其中查询的功能中最常用的两大功能是过滤(过滤指定字符串)和取行(取出指定
286+
的行)。
287+
288+
```bash
289+
## 格式
290+
sed [选项] [sed内置命令字符] [输入文件]
291+
292+
293+
294+
```
295+
296+
215297
### awk命令
216298
217299

0 commit comments

Comments
 (0)