查看文件列表
ls
ll
ls -lh
ls -l
查看文件
cat * |grep
# 意思是,在log.txt文件中,查找ERROR字符,并显示ERROR所在行的之后5行
cat log.txt | grep 'ERROR' -A 5
cat log.txt | grep 'ERROR' -B 5 之前5行
cat log.txt | grep 'ERROR' -C 5 前后5行
cat log.txt | grep -v 'ERROR' 排除ERROR所在的行
tail -f * 追踪
tail -n 20 filename
搜索文件
grep -r "[zhangbei.rds.aliyuncs.com](<http://zhangbei.rds.aliyuncs.com/>)" /data
grep: 命令用于搜索文本
-r: 递归地搜索指定目录下的所有文件和子目录
"memcache": 要搜索的词汇或模式,这里是 "memcache"
/path/to/search/directory: 要搜索的目录路径,您需要将其替换为实际的目录路径
编辑文件
# vi
搜索:/
n继续向下 N向上