OS 기술/Linux
리눅스 파일의 시간 바꾸기
DongT
2023. 7. 15. 02:05
728x90
반응형
테스트 또는 필요시 파일의 시간 변경
파일 mtime 변경 포맷
touch명령의 t옵션 이용 (Y:연도, m:월, d:일, H:시, M:분)
# touch -t YYYYmmddHHMM |
예시) 파일의 날짜를 12월7일 -> 11월30일 변경
# ls -l timelog_20211207_0400.txt -rw-r--r--. 1 root root 840 Dec 7 04:00 timelog_20211207_0400.txt # touch -t 202111300400 timelog_20211207_0400.txt # ls -l timelog_20211207_0400.txt -rw-r--r--. 1 root root 840 Nov 30 04:00 timelog_20211207_0400.txt |
참고))
mtime(modification time)
- 일반적으로 가장 많이 확인
- 파일에 write 되면 변경
- 확인 : # ls -l
ctime(change time)
- 파일의 속성,권한,크기가 바뀌면 변경
- 확인 : # ls -lc
atime(access time)
- 파일에 read 또는 write 되면 변경
- 확인 : # ls -lu
728x90