| find i grep luoluo(文件,名) |
查找特定文件 |
| grep bible /etc/exports |
在文件exports中查找包含bible的所有行 |
| tail -100 /var/log/apache/access.logIgrep 404 |
在WEB服务器日志文件access.log的后100行中查找包含“404”的行 |
| tail -100 /var/log/apache/access.logIgrep -v googlebot |
在WEB服务器日志文件access.log的后100行中,查找没有被google访问的行 |
| grep -v ^# /etc/apache2/httpd.conf |
在主apache配置文件中,查找所有非注释行 (10)命令 |
| find .-name *.rpm |
在当前目录中查找rpm包 |
| find .I grep page |
在当前目录及其子目录中查找文件名包含page的文件 |
| locate I traceroute |
在系统的任何地方查找文件名包含traceroute的文件 |
| find |
查找文件 |
| find / -name tnsnames.ora |
查找文件 |
| ps -ef I grep redis |
查找redis进程(标准格式) |
| ps aux I grep redis |
查找redis进程(BSD格式) |
| cat error.log I grep -C 5 'nick' |
显示file文件里匹配nick那行以及上下5行 |
| cat error.log I grep -B 5 'nick' |
显示nick及前5行 |
| cat error.log I grep -A 5 'nick' |
显示nick及后5行 |
| less error.log |
分页查看日志,但是中文有乱码 |
| less +100g xx.log |
直接定位到第100行 |
| less +GG xx.log |
定位到最后一行 |
| less fis.log.2018-05-20 I grep 2018052019004984219071028 -A 5 --color=auto |
查找并高亮关键字 |
| tail file |
显示文件file的最后10行 |
| tail -f xxx.log |
滚动输出日志 |
| tail -n 500 file |
显示日志文件最后500行日志 |
| tail +20 file |
显示日志从20行至文件末尾 |