标签:用户
[root@localhost /]# grep "^[[:space:]]\+" /boot/grub/grub.conf root (hd0,0) kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=UUID=aa5cf6b3-e1b5-4eb2-95e6-e202f2890edf rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet initrd /initramfs-2.6.32-504.el6.x86_64.img
[root@localhost /]# grep "^#[[:space:]]\+[^[:space:]]" /etc/rc.d/rc.sysinit
[root@localhost /]# netstat -tan | grep "LISTEN[[:space:]]*$"tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 :::22 :::* LISTEN tcp 0 0 ::1:631 :::* LISTEN tcp 0 0 ::1:25 :::* LISTEN [root@localhost /]#
[root@localhost /]# grep -E ‘^(\<[a-z]+\>).*\1$‘ /etc/passwdsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltnologin:x:501:501::/home/nologin:/sbin/nologinbash:x:502:502::/home/bash:/bin/bash[root@localhost /]#
[root@localhost /]# grep -E ‘^(root|fedora|user1)‘ /etc/passwdroot:x:0:0:root:/root:/bin/bash[root@localhost /]#
[root@localhost /]# grep -E "[a-z]+\(\)" /etc/rc.d/init.d/functions
[root@localhost network-scripts]# echo /etc/sysconfig/network-scripts | grep -o "[^/]*$"network-scripts [root@localhost network-scripts]# echo /etc/sysconfig/network-scripts | grep -oP "^.*(?=/)"/etc/sysconfig [root@localhost network-scripts]#
8、找出ifconfig命令结果中的1-255之间数字;
[root@localhost ~]# ifconfig | egrep -o "[1-9]{1,2}|2[0-5]{1,2}"
[root@localhost ~]# ifconfig | egrep -o "[1-9]{1,3}\.[1-9]{1,3}\.[1-9]{1,3}\.[1-9]{1,3}" 192.168.1.8192.168.1.255192.168.1.25192.168.253.135192.168.253.255192.168.253.25[root@localhost ~]# 备注:这写法会匹配888.888.888.888之类的数字,但是ifconfig的结果中以点分十进制数字中不会出现此类数字!!偷懒的写法
[root@localhost ~]# cat mail.txt | grep ‘[[:alnum:]]\+@[[:alnum:]]\+\.[[:alnum:]]\+$‘ mfchangs@126.com mfchangs@sina.com mfchangs@qq.com mfchangs100@sina.com [root@localhost ~]# cat mail.txt 123456@adadfmfchangs@126.com mfchangs@sina.com mfchangs@qq.com akjdflajf@qqajdlaflkmfchangs100@sina.com [root@localhost ~]#
[root@localhost ~]# find /var -user root -group mail /var/spool/mail /var/spool/mail/root [root@localhost ~]#
[root@localhost /]# find / -nouser -o -nogroup [root@localhost ~]# find / -nouser -o -nogroup -a -atime 3
[root@localhost ~]# find /etc -perm -222 -ls
[root@localhost ~]# find /etc -type f -size +1M -ls668012 7892 -rw-r--r-- 1 root root 8080653 Jul 4 08:37 /etc/selinux/targeted/modules/active/policy.kern668019 7892 -rw-r--r-- 1 root root 8080653 Jul 4 08:37 /etc/selinux/targeted/policy/policy.24794284 1976 -rw-r--r-- 1 root root 2020885 Jul 4 08:34 /etc/gconf/gconf.xml.defaults/%gconf-tree.xml [root@localhost ~]#
[root@localhost ~]# find /etc/init.d/ -type f -perm -102 -ls663307 0 -rwxrwxrwx 1 root root 0 Jul 9 17:20 /etc/init.d/test.txt
[root@localhost ~]# touch /usr/2.txt[root@localhost ~]# chown test:test /usr/2.txt[root@localhost ~]# find /usr/ -type f ! \( -user root -o -user bin -o -user hadoop \) -ls400099 12 -rwsr-xr-x 1 abrt abrt 10296 Oct 16 2014 /usr/libexec/abrt-action-install-debuginfo-to-abrt-cache395439 0 -rw-r--r-- 1 test test 0 Jul 9 17:29 /usr/2.txt [root@localhost ~]#
[root@localhost ~]# find /etc/ ! -perm +222 -ls
[root@localhost ~]# find /etc/ -type f -ctime -7 -a ! \( -user root -o -user hadoop \) -ls663346 4 -rw-r--r-- 1 test test 2 Jul 9 17:37 /etc/2.txt [root@localhost ~]#
马哥2016全新Linux+Python高端运维班第四周作业
标签:用户
原文地址:http://11907178.blog.51cto.com/11897178/1846002