본문 바로가기

Linux38

100MB 이상 쓰는 파일 중 용량 상위 10개 찾는 법 find /SIT -size +100M -exec du -h {} \; |sort -n |head -10 용량 및 경로까지만 나옴 [root@test ~]# find /test -size +100M -exec du -h {} \; |sort -n |head -10 147M /test/aux.txt 831M /test/ls.txt find /SIT -size +100M -exec ls -l {} \; |sort -n |head -10 [root@test ~]# find /test -size +100M -exec ls -l {} \; |sort -n |head -10 -rw-r--r--. 1 root root 153845760 6월 13 13:41 /test/aux.txt -rw-r--r--. 1 root .. 2017. 6. 13.
os에서 gbic 및 port 확인 법 스크립트 #!/bin/bash FCPATH=`ls /sys/class/fc_host/` FCCOUNT=`echo "$FCPATH" |awk -F "host" '{print $2}'` for i in $FCCOUNT; do systool -c fc_host -v host$i | grep -v Class | grep 'Device path' | awk -F= '{print "strings "$2"/sfp"}' systool -c fc_host -v host$i | grep -v Class | grep 'Device path' | awk -F= '{print "strings "$2"/sfp"}' |sh done 2017. 6. 13.
Log Message 특정시간 추출 법 journalctl --since='20XX-XX-XX XX:XX:XX' --until='20XX-XX-XX XX:XX:00' > `echo $HOSTNAME`_log1.txt [root@test ~]# journalctl --since='2017-06-13 11:20:00' --until='2017-06-13 11:30:00' > `echo $HOSTNAME`_log1.txt [root@test ~]# ls anaconda-ks.cfg test_log1.txt [root@test ~]# cat test_log1.txt -- Logs begin at 화 2017-06-13 11:15:01 KST, end at 화 2017-06-13 11:30:18 KST. -- 6월 13 11:22:21 test yum.. 2017. 6. 13.
root가 사용 중인 프로세스 확인 [root@test etc]# ps -ef |grep -v root UID PID PPID C STIME TTY TIME CMD dbus 755 1 0 09:58 ? 00:00:00 /bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation polkitd 854 1 0 09:58 ? 00:00:00 /usr/lib/polkit-1/polkitd --no-debug postfix 1687 1680 0 09:58 ? 00:00:00 pickup -l -t unix -u postfix 1688 1680 0 09:58 ? 00:00:00 qmgr -l -t unix -u 2017. 6. 7.
로그인 된 사용자 확인 법 [root@test etc]# last root pts/0 192.168.10.1 Wed Jun 7 09:59 still logged in root tty1 Wed Jun 7 09:58 still logged in reboot system boot 3.10.0-327.el7.x Wed Jun 7 09:58 - 11:02 (01:04) root pts/2 192.168.10.1 Thu Feb 23 15:13 - crash (103+18:44) root pts/1 192.168.10.101 Thu Feb 23 13:36 - 17:24 (03:47) root pts/0 192.168.10.1 Thu Feb 23 09:55 - crash (104+00:02) reboot system boot 3.10.0-327.. 2017. 6. 7.
perl 명령어 이용하여 vi안에 특정 내용만 변경 perl -pi -e 's/1500/9000/g' /etc/sysconfig/network-scripts/ifcfg-pXpX 1500 인것을 9000 으로 교체 perl -pi -e 's/service/nas/g,s/1500/9000/g' /etc/sysconfig/network-scripts/ifcfg-pXpX 2가지 변경 [root@test network-scripts]# cat ifcfg-p1p1 TYPE=Ethernet BOOTPROTO=dhcp DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV6INIT=yes DEVICE=p1p1 ONBOOT=no MTU=1500 MASTER=test [root@test network-scripts]# perl -pi -e 's/te.. 2017. 6. 7.