标签:grub2 centos7 centos -o etc 两种 lock egrep 包括
1、显示/proc/meminfo文件中以大小s开头的行(要求:使用两种方法)cat /proc/meminfo | grep -o ‘^S.*‘
egrep "^(s|S)" /proc/meminfo
grep -e "^s" -e "^S" /proc/meminfo
grep "^(s|S)" /proc/meminfo
grep "^[sS]" /proc/meminfo
egrep -v ‘(/bin/bash)$‘ /etc/passwd
getent passwd rpc | cut -d: -f7
egrep -o ‘[0-9]{2,3}‘ /etc/passwd
egrep ‘^[[:space:]]{1,}.*‘ /etc/grub2.cfg
netstat -tan | egrep ‘(LISTEN)[[:space:]]+$‘
cut -d: -f1,3 /etc/passwd
useradd -M bash
useradd -M testbash
useradd -M basher
useradd -M sh
useradd -M -s /sbin/nologin nologin
egrep ‘(^.)\>.\<\1$‘ /etc/passwd
df | grep -o ‘\<[0-9]+%.*‘ | sort -rn
LOGIN_COLOR="\e[1;31m"
LOW_COLOR="\e[0m"
for i in $@;do
echo -e "${i}用户的 UID 是:${LOGIN_COLOR}id $i | cut -d" " -f1 | grep -Eo "[0-9]+"
${LOW_COLOR}"
done
echo -e "系统默认的Shell环境是:${LOGIN_COLOR}echo $SHELL
${LOW_COLOR}"
egrep -o ‘(/[[:lower:]]+)+‘ /etc/rc.d/init.d/functions
echo /etc/rc.d/init.d/functions | egrep -o ‘[^/]+/?$‘
echo /etc/rc.d/init.d/ | egrep -Eo ‘^/.*/$‘
last |egrep "\<root\>" | tr -s " " | cut -d" " -f1,3 |sort -rn | uniq -c
echo 9 | egrep "\b[[:digit:]]{1}\>"
echo 99 | egrep "\b[1-9][[:digit:]]{1}\>"
echo 199 | egrep ‘\b[1][[:digit:]]{1}‘
echo 249 | grep ‘\b2[0-4][[:digit:]]{1}‘
echo 255 | egrep ‘\b25[0-5]‘
ifconfig | egrep -o ‘([[:digit:]]{1,3}.){3}[[:digit:]]‘
echo welcome to magedu linux | tr -d " " | grep -o ‘.‘ | sort | uniq -c | sort -rn
标签:grub2 centos7 centos -o etc 两种 lock egrep 包括
原文地址:https://blog.51cto.com/12980155/2364302