로그파일 내용을 삭제해야할 때가 있다.
파일은 남긴채고 내용만 지워야하는 상황.
특시 Tomcat Log 중 catalina.out 로그를 그대로 방치 할경우에는
무한대로 쌓이기만 한다. 이러 할때에 아래 명령어로 파일내용을 삭제한다.
"cat /dev/null > 파일명" 으로 처리할 수 있다.
logs % ll
total 72
-rw-r----- 1 staff 10K 7 27 17:40 catalina.2020-07-27.log
-rw-r----- 1 staff 11K 7 27 17:40 catalina.out
-rw-r----- 1 staff 0B 7 27 17:36 host-manager.2020-07-27.log
-rw-r----- 1 staff 1.8K 7 27 17:40 localhost.2020-07-27.log
-rw-r----- 1 staff 3.1K 7 27 17:37 localhost_access_log.2020-07-27.txt
-rw-r----- 1 staff 0B 7 27 17:36 manager.2020-07-27.log
-rw-r----- 1 staff 556B 7 27 17:40 pinpoint-web.log
logs %
logs % cat /dev/null > catalina.out
logs %
logs % ll
total 48
-rw-r----- 1 staff 10K 7 27 17:40 catalina.2020-07-27.log
-rw-r----- 1 staff 0B 7 29 08:52 catalina.out
-rw-r----- 1 staff 0B 7 27 17:36 host-manager.2020-07-27.log
-rw-r----- 1 staff 1.8K 7 27 17:40 localhost.2020-07-27.log
-rw-r----- 1 staff 3.1K 7 27 17:37 localhost_access_log.2020-07-27.txt
-rw-r----- 1 staff 0B 7 27 17:36 manager.2020-07-27.log
-rw-r----- 1 staff 556B 7 27 17:40 pinpoint-web.log
logs %
'개발경험 및 메모 > Linux' 카테고리의 다른 글
SCP 파일다운로드(SSH 파일다운로드) (0) | 2020.07.06 |
---|---|
Linux 프로세스의 File Descriptor 개수 확인 (0) | 2020.06.24 |
ERROR : max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] (0) | 2020.02.24 |
[Linux] CentOS 버전확인 (0) | 2020.02.14 |
최근댓글