-w 精准比配
成都创新互联公司专注于金昌企业网站建设,自适应网站建设,星空体育app最新版本(2024已更新)开发。金昌网站建设公司,为金昌等地区提供建站服务。全流程定制网站开发,专业设计,全程项目跟踪,成都创新互联公司专业和态度为您提供的服务把一个目录下,过滤所有*.php文档中含有eval的行 grep -r --include="*.php" 'eval' /data/
grep [-cinvABC]'word'filename
[root@mingming ~]# mkdir grep [root@mingming ~]# cd grep [root@mingming grep]# cp /etc/passwd . [root@mingming grep]# lspasswd [root@mingming grep]# grep nologin passwd bin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinmail:x:8:12:mail:/var/spool/mail:/sbin/nologinuucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologinoperator:x:11:0:operator:/root:/sbin/nologingames:x:12:100:games:/usr/games:/sbin/nologingopher:x:13:30:gopher:/var/gopher:/sbin/nologinftp:x:14:50:FTP User:/var/ftp:/sbin/nologinnobody:x:99:99:Nobody:/:/sbin/nologindbus:x:81:81:System message bus:/:/sbin/nologinvcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologinrpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologinsaslauth:x:499:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologinrpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologinnfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologinhaldaemon:x:68:68:HAL daemon:/:/sbin/nologinsshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
-c行数
[root@mingming grep]# grep -c nologin passwd20
-i不区分大小写
-n显示行数
[root@mingming grep]# grep -n nologin passwd 2:bin:x:1:1:bin:/bin:/sbin/nologin3:daemon:x:2:2:daemon:/sbin:/sbin/nologin4:adm:x:3:4:adm:/var/adm:/sbin/nologin5:lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin9:mail:x:8:12:mail:/var/spool/mail:/sbin/nologin10:uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin11:operator:x:11:0:operator:/root:/sbin/nologin12:games:x:12:100:games:/usr/games:/sbin/nologin13:gopher:x:13:30:gopher:/var/gopher:/sbin/nologin14:ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin15:nobody:x:99:99:Nobody:/:/sbin/nologin16:dbus:x:81:81:System message bus:/:/sbin/nologin17:vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin18:rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin19:saslauth:x:499:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologin20:postfix:x:89:89::/var/spool/postfix:/sbin/nologin21:rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin22:nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin23:haldaemon:x:68:68:HAL daemon:/:/sbin/nologin24:sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
-v取反
[root@mingming grep]# grep -nv nologin passwd 1:root:x:0:0:root:/root:/bin/bash7:sync:x:5:0:sync:/sbin:/bin/sync7:shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown8:halt:x:7:0:halt:/sbin:/sbin/halt25:smbuser1:x:500:500::/home/smbuser1:/bin/bash
-r遍历所有子目录
-A后面跟数字,过滤出符合要求的行以及下面n行
grep -A2 root passwd root:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologin--operator:x:11:0:operator:/root:/sbin/nologingames:x:12:100:games:/usr/games:/sbin/nologingopher:x:13:30:gopher:/var/gopher:/sbin/nologin
-B同上,过滤出符合要求的行以及上面n行
-C同上,过滤出符合要求的行以及上下面n行 grep/egrep示列
[root@mingming grep]# grep '[0-9]'passwd root:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltmail:x:8:12:mail:/var/spool/mail:/sbin/nologinuucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologinoperator:x:11:0:operator:/root:/sbin/nologingames:x:12:100:games:/usr/games:/sbin/nologingopher:x:13:30:gopher:/var/gopher:/sbin/nologinftp:x:14:50:FTP User:/var/ftp:/sbin/nologinnobody:x:99:99:Nobody:/:/sbin/nologindbus:x:81:81:System message bus:/:/sbin/nologinvcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologinrpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologinsaslauth:x:499:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologinrpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologinnfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologinhaldaemon:x:68:68:HAL daemon:/:/sbin/nologinsshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologinsmbuser1:x:500:500::/home/smbuser1:/bin/bash[root@mingming grep]# grep -n '^#' inittab1:# inittab is only used by upstart for the default runlevel.2:#3:# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.4:#6:#7:# Individual runlevels are started by /etc/init/rc.conf8:#9:# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf10:#12:# with configuration in /etc/sysconfig/init.13:#14:# For information on how to write upstart event handlers, or how16:#18:# 0 - halt (Do NOT set initdefault to this)19:# 1 - Single user mode20:# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)21:# 3 - Full multiuser mode22:# 4 - unused23:# 5 - X1124:# 6 - reboot (Do NOT set initdefault to this)25:#[root@mingming grep]# grep -nv '^#' inittab5: System initialization is started by /etc/init/rcS.conf11: Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,15: upstart works, see init(5), init(8), and initctl(8).17: Default runlevel. The runlevels used are:26:id:3:initdefault:
非0-9的过滤出来
[root@mingming grep]# grep '[^0-9]' inittab # inittab is only used by upstart for the default runlevel.## ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.# System initialization is started by /etc/init/rcS.conf## Individual runlevels are started by /etc/init/rc.conf## Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,# with configuration in /etc/sysconfig/init.## For information on how to write upstart event handlers, or how upstart works, see init(5), init(8), and initctl(8).# Default runlevel. The runlevels used are:# 0 - halt (Do NOT set initdefault to this)# 1 - Single user mode# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)# 3 - Full multiuser mode# 4 - unused# 5 - X11# 6 - reboot (Do NOT set initdefault to this)#id:3:initdefault:
[root@mingming grep]# grep 'r.o' passw root:x:0:0:root:/root:/bin/bashhalt:x:7:0:halt:/sbin:/sbin/haltriomail:x:8:12:mail:/var/spool/mail:/sbin/nologinr.ooperator:x:11:0:operator:/root:/sbin/nologin[root@mingming grep]# grep 'r.o' passwdroot:x:0:0:root:/root:/bin/bashoperator:x:11:0:operator:/root:/sbin/nologin[root@mingming grep]# vin passwd-bash: vin: command not found [root@mingming grep]# vim passwd [root@mingming grep]# grep 'r.o' passwd root:x:0:0:root:/root:/bin/bashhalt:x:7:0:halt:/sbin:/sbin/haltriomail:x:8:12:mail:/var/spool/mail:/sbin/nologinr.ooperator:x:11:0:operator:/root:/sbin/nologin[root@mingming grep]# grep 'o*o' passwdroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltriomail:x:8:12:mail:/var/spool/mail:/sbin/nologinr.ouucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologinoperator:x:11:0:operator:/root:/sbin/nologingames:x:12:100:games:/usr/games:/sbin/nologingopher:x:13:30:gopher:/var/gopher:/sbin/nologinftp:x:14:50:FTP User:/var/ftp:/sbin/nologinnobody:x:99:99:Nobody:/:/sbin/nologindbus:x:81:81:System message bus:/:/sbin/nologinvcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologinrpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologinsaslauth:x:499:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologinrpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologinnfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologinhaldaemon:x:68:68:HAL daemon:/:/sbin/nologinsshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologinsmbuser1:x:500:500::/home/smbuser1:/bin/bash[root@mingming grep]# grep '.*' passwdroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltriomail:x:8:12:mail:/var/spool/mail:/sbin/nologinr.ouucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologinoperator:x:11:0:operator:/root:/sbin/nologingames:x:12:100:games:/usr/games:/sbin/nologingopher:x:13:30:gopher:/var/gopher:/sbin/nologinftp:x:14:50:FTP User:/var/ftp:/sbin/nologinnobody:x:99:99:Nobody:/:/sbin/nologindbus:x:81:81:System message bus:/:/sbin/nologinvcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologinrpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologinsaslauth:x:499:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologinrpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologinnfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologinhaldaemon:x:68:68:HAL daemon:/:/sbin/nologinsshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologinsmbuser1:x:500:500::/home/smbuser1:/bin/bash
匹配两个o
[root@mingming grep]# grep 'o\{2\}' passwd root:x:0:0:root:/root:/bin/bashlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinmail:x:8:12:mail:/var/spool/mail:/sbin/nologinr.ouucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologinoperator:x:11:0:operator:/root:/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologin[root@mingming grep]# egrep 'o{2}' passwdroot:x:0:0:root:/root:/bin/bashlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinmail:x:8:12:mail:/var/spool/mail:/sbin/nologinr.ouucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologinoperator:x:11:0:operator:/root:/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologin[root@mingming grep]# grep -E 'o{2}' passwdroot:x:0:0:root:/root:/bin/bashlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinmail:x:8:12:mail:/var/spool/mail:/sbin/nologinr.ouucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologinoperator:x:11:0:operator:/root:/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologin
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
网站栏目:grep-创新互联
标题路径:/article46/dhiihg.html
成都网站建设公司_创新互联,为您提供品牌网站制作、面包屑导航、建站公司、网站策划、标签优化、定制网站
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联