본문 바로가기
공부/리눅스 서버

[linux] 명령어 모음(작성중)

by kyoung-ho 2022. 3. 3.
반응형

find ./ -name '*.log' -mtime +2 -delete

> 3일치 남겨 두고 삭제 한다. (0일,1일,2일)

 

firewall-cmd --permanent --zone=public --remove-service=dhcpv6-client

firewall-cmd --permanent --zone=public --remove-service=ssh

firewall-cmd --reload

> Centos7 설치 시 기본 설정되어있는 방화벽 정책 삭제.

 

firewall-cmd --permanent --zone=public --add-port=8080/tcp

> 포트만 추가

 

firewall-cmd --permanent --zone=public --add-rich-rule="rule family="ipv4"  source address="192.168.0.0/24"  port protocol="tcp" port="22" accept"

 

firewall-cmd --permanent --zone=public --add-rich-rule="rule family="ipv4"  source address="x.x.x.x/32"  service name=ftp  accept"

 

firewall-cmd --permanent --zone=public --add-rich-rule="rule family="ipv4"  source address="x.x.x.x/32"  port protocol="tcp" port="22" accept" 

 > IP 별로 포트 허용

 

firewall-cmd --reload

 > 정책 적용

 

firewall-cmd --list-all

 > 설정 되어있는 정책 확인

 

nohup tar -zcvf billion.tar.gz billion &

 > nohup.out 결과를 남기며 백그라운드 실행

 

/opt/MegaRAID/MegaCli/MegaCli64 -ShowSummary -aALL

 > dell서버 레이드 정보 요약 확인

 > 디스크 교체 상태표시 -> Degraded -> Optimal (리빌딩 완료 후) 

 

/opt/MegaRAID/MegaCli/MegaCli64 -fwtermlog -dsply -aAll

 > 레이드에 현재 상태를 실시간으로 보여주는 로그출력

 

dmidecode -t 1

 > 서버이름 및 시리얼번호 확인

 

dmidecode -t 17 | grep Part

 > 메모리 타입 확인

 

cat /proc/cpuinfo

 > CPU 정보 확인

 

dmidecode -t processor | grep 'Socket Designation'

 > 물리 CPU 갯수 확인

 

cat /proc/scsi/scsi

 > HDD 정보 확인

 

journalctl --vacuum-time=100d

 > /var/log/journal 시스템 부팅시부터 발생하는 모든 이벤트를 수집해서 바이너리 형태의 저널 데이터로 저장

 > 100일 이상된 자료 삭제

 

du -sh ./* | grep "G" | sort -n -r

 > 용량을 G단위로 나타내는 것들만 내림차순으로 출력하겠다라는 의미

 

MariaDB [(none)]> use mysql;
Database changed
MariaDB [mysql]> grant all privileges on *.* to 'root'@'%' identified by '패스워드';
Query OK, 0 rows affected (0.002 sec)

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.002 sec)

 

yum install psmisc

> killall 설치

 

uniq -c

 > 정렬된 내용에서 중복된 행을 카운트와 함께 출력

 

sort yourfile.txt | uniq -c

 > 파일의 내용 정렬 후 정렬된 내용에서 중복된 행을 카운트와 함께 출력한다.

 

echo -e "apple\nbanana\napple\napple\nbanana" | sort | uniq -c

 > 3 apple

 > 2 banana

 

grep VmSwap /proc/*/status | sort -k 2 -nr

> PID 검색하여 swap 사용중인 프로세스 확인

반응형

댓글