파일 atime, ctime, mtime
inode에 저장된 파일 속성 중에 ls 명령으로 확인할 수 있는 time에는 아래 3가지가 있다. (위 스크린샷 처럼 stat으로도 조회 가능)
#1. atime (Time of last access)
- 파일에 마지막으로 접근한 시간.
- ls -lu 명령.
#2. ctime (Time of last status change)
- 파일이 마지막으로 변경된 시간.
- ls -lc 명령.
#3. mtime (Time of last modification)
- 파일이 마지막으로 수정된 시간.
- ls -l 명령.
시스템에서 주기적으로 파일이 삭제되는 스크립트가 돌아간다면, atime 등을 갱신해야 될 수 있다.
Access Time을 갱신할 때는 보통 touch 명령을 쓰는데, touch에는 Recursive 옵션이 없기 때문에
$ find [Directory] -exec touch {} \;
$ find . -exec touch {} \;
와 같이 find 명령 등을 써서 access time을 갱신할 수 있다. (해당 디렉터리에 있는 파일을 모두 찾아 touch 명령을 실행)
다만 symbolic link는 그냥 touch로는 access time이 갱신되지 않기 때문에 -h 옵션을 써줘야 한다.
$ touch --help
Mandatory arguments to long options are mandatory for short options too.
-a change only the access time
-c, --no-create do not create any files
-d, --date=STRING parse STRING and use it instead of current time
-f (ignored)
-h, --no-dereference affect each symbolic link instead of any referenced
file (useful only on systems that can change the
timestamps of a symlink)
-m change only the modification time
-r, --reference=FILE use this file's times instead of current time
-t STAMP use [[CC]YY]MMDDhhmm[.ss] instead of current time
--time=WORD change the specified time:
WORD is access, atime, or use: equivalent to -a
WORD is modify or mtime: equivalent to -m
--help display this help and exit
--version output version information and exit
$ find . -exec touch -ah {} \;
물론 중요한 파일은 꼭 2중, 3중 백업!
'Linux > etc' 카테고리의 다른 글
slurm 스케줄러 sbatch 옵션 정리 (0) | 2022.04.17 |
---|---|
conda 명령 정리 (0) | 2021.02.23 |
자주 사용하는 리눅스 명령어 (0) | 2020.02.08 |
댓글
이 글 공유하기
다른 글
-
slurm 스케줄러 sbatch 옵션 정리
slurm 스케줄러 sbatch 옵션 정리
2022.04.17 -
conda 명령 정리
conda 명령 정리
2021.02.23 -
자주 사용하는 리눅스 명령어
자주 사용하는 리눅스 명령어
2020.02.08