자주쓰는 CentOS 커맨드 정리

YoungkwanJi·2021년 6월 23일
0
post-thumbnail

프로세스 관련

사용중인 프로세스 확인

lsof -i :{port}
ps -ef | grep {port}

포트 죽이기

kill -9 {PID}

열린 포트 확인

curl -v telnet://{ip}:{port}

해당 방화벽이 오픈되지 않은 경우 trying 상태 지속됨
해당 포트에 실행 중인 서비스가 없을 경우 즉시 Refused됨

방화벽 관련

정의된 방화벽 목록

firewall-cmd --permanent --list-all

방화벽 Open/Close

특정 port 등록/제거

firewall-cmd --permanent --zone=public --add-port={port}/{protocol}
firewall-cmd --permanent --zone=public --remove-port={port}/{protocol}

특정 service 등록/제거

firewall-cmd --permanent --zone=public --add-service={service_name}
firewall-cmd --permanent --zone=public --remove-service={service_name}

방화벽 재시작

firewall-cmd --reload

포트 포워딩

firewall-cmd --permanent --zone=public --add-forward-port=port={포워딩을 추가 할 port}:proto=tcp:toport={포워딩되는 port}:toaddr={포워딩되는 ip}

Open File 설정 관련

Open file Limit

ulimit -Hn / ulimit -Sn

Open file Limit Max

cat /proc/sys/fs/file-max

Open file Limit Count

cat /proc/sys/fs/file-nr

특정 프로세스의 현재 오픈된 파일 갯수

lsof -p {pid} | wc -l

프로세스 별 Open file Limit

prlimit --nofile --output RESOURCE,SOFT,HARD --pid {pid}

프로세스 별 Open file change

prlimit --nofile={max_count} --pid={pid}

ETC

폴더 찾기

find ./ -name {dir_name} -type d

인터페이스 멀티ip 활성/비활성

ifconfig {interface_name}:0 {ip} up
ifconfig {interface_name}:0 {ip} down

특정 포트 동접자 확인

netstat -nap | grep :{port} | grep EST | wc -l
profile
Hello! iOS!

0개의 댓글