grep

 

1.grep 或條件

[root@node2 nginx]# ps -ef|grep -e nginx -e PID
UID         PID   PPID  C STIME TTY          TIME CMD
root       5399      1  0 04:40 ?        00:00:00 nginx: master process ./nginx
nobody    11750   5399  0 05:49 ?        00:00:00 nginx: worker process
root      11781  11696  0 06:16 pts/0    00:00:00 grep -e nginx -e PID
[root@node2 nginx]# ps -aux|grep -e nginx -e %
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       5399  0.0  0.0  23980  1324 ?        Ss   04:40   0:00 nginx: master process ./nginx
nobody    11750  0.0  0.0  24400  1624 ?        S    05:49   0:00 nginx: worker process
root      11783  0.0  0.0 103324   864 pts/0    S+   06:16   0:00 grep -e nginx -e %

  

同時,ps -ef能夠看父進程ID  PPID  以及完整的command命令 CMDnode

    ps -aux 能夠看進程的CPU佔用率和內存佔用率nginx

 

 2.grep 忽略大小寫

grep -i      i=ignore casebash

3.查找包含「***」 的全部的 .xml 文件spa

grep -R  --include「*。xml」’ 「****」  ./xml

相關文章
相關標籤/搜索