grep CMD
grep OPTIONS PATTERN file1
* OPTIONS: -i, -l, -v, -r, -n, --color, -A
* PATTERN: * . ^root root$ [abc] [a-c] [^a]//a 만 아니면 되는 한글자
CMD | grep root
# cat /etc/passwd | grep root
# rpm -qa | grep httpd
# ps -ef | grep rsyslogd //프로세서 전체 리스트
# systemctl list-unit-files | grep ssh
# netstat -antup | grep :22
[ 실무예 ] 로그 파일 점검 스크립트
# alias chklog='cat $1 | egrep -i --color "(warn|error|fail|crit|alert|emerg)"'
# vi /root/bin/chklog.sh
find CMD
# find / -name core -type [f|d] (# find / -name "*oracle*" -type f)
# find / -user user01 -group class1
# find / -mtime [-7|7|+7]
# find / -perm [-755|755]
# find / -size [-300M|300M|+300M]
# find / -name core -type f -exec rm -f { } \;
[ 실무예 ] 오래된 로그 파일 삭제 ( find CMD + rm CMD + crontab CMD)
# find /Log_Dir -name "*.log" -type f -mtime +30 -exec rm -f {} \;
[ 실무예 ] 갑자기 파일시스템 풀(full) 난 경우(-mtime)
df CMD + du CMD + find CMD + lsof CMD
# df -k
# du -sk /var
# cd /var ; du -sk * | sort -nr more