서버/터미널
terminal. 파일 용량 확인 및 하루 지난 파일 제거 crontab
ttoance
2024. 12. 10. 09:07
반응형
서버 내 용량 조회 시
df -h
현 디렉토리 내 폴더 용량 조회 시
du -sh *
-s : summarize
-h : human-readable
-c : check more than one directory and see the total
하루 지난 파일 제거
# 새벽 3시에 실행
0 3 * * * find /var/log -type f -mtime +1 -exec rm -f {} \;
# 5분마다 실행
*/5 * * * * find /var/log -type f -mtime +1 -exec rm -f {} \;
참고 >
[Linux] 파일 및 디렉토리(directory) 용량 확인하기
[Linux] 파일 및 디렉토리(directory) 용량 확인하기
디스크 별 용량 확인이 필요하면 df -h # disk type 확인 df -Th 특정 파일 또는 디렉토리 용량 확인이 필요하면 du -sh {file or file_path} 상황에 맞게 옵션을 변경 -s : summarize -h : human-readable -c : check more than
aeong-dev.tistory.com
반응형