1、找出ifconfig中的ip地址(多方法)
ifconfig| grep "[[:digit:]]\{1,3\}[[:punct:]][[:digit:]]\{1,3\}[[:punct:]][[:digit:]]\{1,3\}[[:punct:]][[:digit:]]\{1,3\}"
ifconfig | grep -o "\(\([[:alnum:]]\{1,3\}\)\.\)\{3\}[[:digit:]]\{1,3\}"
2、找出/etc/passwd中的UID和GID
cat /etc/passwd | grep -E [[:digit:]]\{1,2\}
3、找出/etc/passwd中的1位数 2位数和3位数和四位数
cat /etc/passwd | grep -E "[0-9]\{1,4\}"
4、找到非登录用户
cat /etc/passwd | grep ‘/sbin/nologin’
5、找到系统中所有的侦听端口 LISTEN
netstat -atn | grep LISTEN
6、找出用户名和shell名相同的用户
cat /etc/passwd |grep "^\(.*\):.*\1$"
cat /etc/passwd | grep “^\([[:alpha:]]*\):.*\1$”
grep "^\([[:alpha:]]\{1,\}\):.*\1$" /etc/passwd