2)BASH

Bash History

history    #输入命令历史    =>.bash_history

!num #重新执行history中的第num条命令
!! #重新执行上一条命令
ctrl+r #在历史中搜索命令

Text Searching

grep

grep -air
-e regexp
-f filename
-i        #ignore case
-c        #count
-q        #quiet
-v        #显示不匹配的行
-n        #with line number
-a        #search text in binary file
-r        #read all files under each directory,**recursively**

sed

sed 's/a/b/flag' file    
#file中输出后的内容中的单词a以标记flag规定的方式替换单词b    flag可以是    数字:鄙视将替换第几处模式匹配的地方    g:表示b会替换全文的a    p:仍然打印原来的行    w file:替换后的内容写入file
sed 'addresss/a/b/flag' file
sed '
address{
/s/a/b/flag
/s/c/d/flag
}' file
#address指定替换的行号或区间如sed '2,$s/cat/dog/flag' animal.txt,$代表最后一行
sed '/pattern/s/cat/dog/g' file
#只有匹配pattern的行才进行全文替换
-e '多条命令;使用分号分割'
-f scriptfile	#使用scriptfile中的命令进行处理
-n        #不产生命令输出,只由用户的print语句输出

awk

cat minefile|awk -F ';' '{print $1}'

cut

cut
-f num    #显示第num列的内容
-f num --complement    #显示除第num列以外的内容
-d sign    #以符号sign为划分,默认是空格
-c        #表示字符
-b        #表示字节
1234567890
cut -c2-5 file    #2345    每一行的第2到5个字符
cut -c2- file    #234567890    每一行的第2到末尾的字符
cut -c-5 file    #12345    每一行的开头到第5个的字符    每一行从1号开始

wc

wc testfile           # testfile文件的统计信息  
3 92 598 testfile       # testfile文件的行数为3、单词数92、字节数598 
wc testfile testfile_1 testfile_2   #统计三个文件的信息 
-c     #只显示Bytes数。
-l     #只显示行数。
-w     #只显示字数。

sort

sort -urn
-r    #以递减的顺序
-n    #排序出现次数
-u    #并且不重复

Diff File

diff and vimdiff

diff -c file1 file2
vimdiff file1 file2

计划任务

一次计划任务:at

at [-f filename] time
at 15:20    #新建计划任务
at> touch /home/he/tttt.txt
at> <EOT>                  #按ctrl d 保存
job 3 at Mon May 13 15:20:00 2019
atq           #查看计划任务
3 Mon May 13 15:20:00 2019 a root     #获取任务编号3
atrm 3    #停止3号计划任务
atq

crontab

crontab -l    #查看计划任务
min hour dayofmonth month dayofweek command
-l:list    #列出指定用户的计划任务列表
-e:edit    #编辑指定用户的计划任务列表
-u:user    #指定的用户名,如果不指定,则表示当前用户
-r:remove    #删除指定用户的计划任务列表
posted @ 2020-04-01 21:08  TaiiHu  阅读(111)  评论(0)    收藏  举报