awk
awk 指定多个分隔符 awk -F '[;:]'
(使用;
或:
进行分割)
|
|
find
find . -type f -name "*.png" -exec ls -l {} \;
{}
是一个替换符,表示前面找到的内容\;
是exec
的默认结尾标识符
find /sys/devices/virtual/net -name iflink -exec grep -H -w 11 {} \;
grep 增加
-H
选项后,可以显示文件名
如果目录下有软连接的外部文件夹,默认 find 不会显示软连接里的内容,如果需要可以加上-L
,但是注意,如果软连接有循环,则会不停的输出,慎用,比如:
xargs
# xargs -t # 在执行前先打印处要执行的命令
# xargs -I {} # 设置一个符号{}表示管道前面的某一行输出内容,以便后续复杂命令进行替换
# xargs -P `nproc` # 并发数,默认为1,如果置0表示让xargs使用尽可能多的并发数,这里`nproc`是cpu核数
docker ps -q | xargs -t -I {} docker exec {} sh -c "find /sys -name iflink | xargs grep -w 14"
等价于
# 最后的 grep -H 表示查找到内容后显示对应的文件名
docker ps -q | xargs -t -I {} docker exec {} sh -c "find /sys -name iflink | xargs -I {} grep -w 14 {} -H"
grep
或运算:
-E
参数加上|
lsof -i | grep -E 'epc-ims:|IPv6'
与运算:
实际上就是正则.+
表示任意 N 个字符
lsof -i | grep -E "8323.+38911"
lsof
lsof = list open file
|
|
lsof -i tcp
lsof -i udp
lsof -n -i tcp
lsof -c 进程名
lsof -p pid
lsof -r 1
每秒执行一次
curl
自动重定向:
|
|
只显示请求头:
|
|
添加请求头:
|
|