查看centOS版本:lsb_release -a 查看glibc版本 ldd --version 查看定时任务 crontab -l 服务启动与停止:service servername start(status、stop)
du -h --max-depth=1 ./ 查看当前目录下文件大小
端口占用 :netstat -ntulp |grep 80
历史命令:history num
检查系统日志
dmesg |grep -n --color=auto 'services-name '
grep services-name /var/log/messages*
命令重命名
alias grep='grep --color=auto' //将查找的结果有颜色的显示
type grep //查看命令类型
查找
grep -n 'include' main.cpp //顺序查找include
grep -vn 'include' main.cpp //反向查找include
grep -in 'include' main.cpp //查找include,不分大小写
grep -n t[asd]r main.cp //[] 仅代表某『一个』字符 tar,tsr或tdr
grep -n '[0-9]' regular_express.txt grep -n '[[:digit:]]' regular_express.txt grep -n '[^a-z]oo' regular_express.txt grep -n '[^[:lower:]]oo' regular_express.txt
行首与行尾字符 ^ $
^ 符号,在字符集合符号(括号[])之内与之外是不同的!在 [] 内代表『反向选择』,
在 [] 之外则代表定位在行首的意义
行尾结束为小数点 (.) 的那一行
grep -n '^$' regular_express.txt //找出空白行
任意字符. 和重复字符*
. (小数点):代表『一定有一个任意字符』的意思;
*(星星号):代表『重复前一个字符, 0 到无穷多次』的意思,为组合形态
限定连续 RE 字符范围 {}
grep -n 'o\{2\}' test.txt //查找联系两次重复的‘oo’
grep -n 'go\{2,5\}g' test.txt // 找出 g 后面接 2 到 5 个 o ,然后再接一个 g 的字符串