IT기술/Linux 77

리눅스 마운트 mount

1. mount -a /etc/fstab 에 있는 파일 시스템 모두 마운트 -t 파일시스템 지정 -o 다른 옵션 명시 ro 읽기 전용, rw 읽기 쓰기 default, remount 파티선 다시 마운트, loop cd-room 등 iso 파일 마운트, noatime 파일 읽기 전까지 accesstime 변경 안됨 2. 마운트 절차 (볼륨 할당 후) 1) 해당 경로에 폴더 생성 mkdir -p /data 2) fstab 추가 vi /etc/fstab test 10.10.10.10:/vol/vol1/web/ /data/web nfs defaults 0 0 3) /etc/fstab 에 있는 파일 시스템 마운트 mount -a 3. 마운트 해제 umount /data/web

IT기술/Linux 2023.05.29

리눅스 기본 - 파일 관련 명령어 ls, ln 등

1. 리스트 보기 ls -l 자세히 -a 숨김 파일 표시 -r 역순 정렬 -t 시간 순 정렬 -S 파일 크기 내림차순 -h 사람이 읽기 쉬운 단위로 2. 심볼릭 링크 지정 ln -s /www/styleguide styleguide 3. 모든 심볼릭 링크 찾기 find {폴더명=검색대상} -type l -printf "%p --> %l\n" find / -type l -printf "%p --> %l\n" 5. 폴더 생성 mkdir -p 하위 폴더도 생성 6. 복사 cp -r 폴더 사용 중일 때 복사 (omitting directory error 시) -p 권한까지 복사 -f 강제 overwrite 7. 용량 보기 df -h 남은 공간 확인 -hs 폴더 총 용량 확인 -h --max-depth=1 1뎁스까..

IT기술/Linux 2023.05.25

리눅스 파일 찾기 find, grep

1. find find / -type f -name oracle-ds.xml -name 'filename*' -type d -mtime +14 (14일 이전) (14일 이전 파일 지우기) find /logs001/temp/full_20* -mtime +14 -exec rm {} \; find /logs001/temp/ORA_Archive/*.arc -mtime +14 -exec rm {} \; - 날짜 기준 삭제 (180일 이전 로그 지우기) find . -name '*.log' -mtime +180 | sort find . -name '*.log' -mtime +180 -delete 2. grep grep -r '10.10.10.10' ./* -r -v grep started server.log* gr..

IT기술/Linux 2023.05.24

리눅스 로그 관리 logrotate, nohup

1. 로그 찾기 (grep) grep started server.log.2022* 2. 로그 관리 (logrotate) 1) 신규 파일 생성 vi /etc/logrotate.d/tomcat vi /etc/logrotate.d/nginx 2) 로그 경로 및 옵션 추가 tomcat 인 경우 /engn001/tomcat/apache-tomcat-7.0.57/logs/catalina.out { copytruncate daily rotate 365 compress missingok dateext } nginx 인 경우 /usr/local/openresty/nginx/logs/*.log { daily size 10M rotate 4 missingok create 644 root root dateext shareds..

IT기술/Linux 2023.05.23

리눅스 모니터링 (top, free)

1. 모니터링 top shift + p cpu 사용률 내림차순 shift + m memory 사용률 내림차순 shift + t 프로세스 돌아가고 있는 시간 순 k kill, k 입력 후 pid 작성 f sort field 선택 화면 -> q 누르면 res 순으로 정렬 a 메모리 사용량에 따라 정렬 b batch 모드로 작동 1 cpu core 별로 사용량 보여줌 2. 메모리 관리 free -m 버퍼, 캐시가 많은 경우 total used free shared buff/cache available Mem: 15589 2849 155 137 12584 10091 Swap: 0 0 0 아래와 같이 정리하려면 total used free shared buff/cache available Mem: 15589 28..

IT기술/Linux 2023.05.22

미들웨어 버전 확인 방법

미들웨어 버전확인 1. bind dns 버전 확인 named -v 2. web 서비스 확인 curl -I localhost 3. apache cd [Apache설치경로]/bin ./httpd -v 4. Tomcat 1) cd [Tomcat설치경로]/bin ./version.sh 2) cd [Tomcat설치경로]/lib java -cp catalina.jar org.apache.catalina.util.ServerInfo 5. MySQL cd [MySQL설치경로]/bin ./mysql --version 6. PHP cd [PHP설치경로]/bin ./php -v 7. JBOSS cd [JBOSS설치경로]/bin ./standalone.sh --version 8. JAVA cd [JAVA설치경로]/bin ./..

IT기술/Linux 2023.05.18

yum 오류 조치 방법

CentOS 6 버전 업데이트 지원이 종료되면서 yum update 등 명령어 사용 시 오류가 발생 * 오류 내용 (32Bit, 64Bit) YumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. Invalid release/repo/arch combination/ removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt Error: Cannot find a valid baseurl for repo: base YumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. I..

IT기술/Linux 2023.05.17

linux 점검 기본

1) cpu 정보 확인 cat /proc/cpuinfo 2) cpu 코어 수 확인 grep -c processor /proc/cpuinfo 2) 물리 CPU 개수 확인 grep "physical id" /proc/cpuinfo | sort -u | wc -l 3) CPU당 물리 코어 수 확인 grep "cpu cores" /proc/cpuinfo | tail -1 4) cpu당 논리 코어 수 확인 grep -c processor /proc/cpuinfo 5) 하이퍼스레딩 확인 (물리, 논리 코어 수) cat /proc/cpuinfo | egrep 'siblings|cpu cores' | head -2 5) ram 확인 cat /proc/meminfo | grep MemTotal dmidecode -t m..

IT기술/Linux 2023.05.16