리눅스 파일시간 변경방법



파일 시간을 변경하는 방법입니다.


파일의 시간정보까지 복사하는 명령은 cp -p 옵션을 사용하면 됩니다.



▶ 특정 시간으로 변경 ( touch -t 년월일시분 파일 )


[root@conoha test]# ls -l

total 0

-rw-r--r-- 1 root root 0 Jun 15 14:39 1.txt

-rw-r--r-- 1 root root 0 Jun 15 14:41 2.txt


[root@conoha test]# touch -t 201706010102 2.txt

[root@conoha test]# ls -l

total 0

-rw-r--r-- 1 root root 0 Jun 15 14:39 1.txt

-rw-r--r-- 1 root root 0 Jun  1 01:02 2.txt


지정한 시간으로 파일의 시간이 변경되었습니다.



▶ 특정 파일의 시간과 동일하게 변경 ( touch -r 원본파일 변경할파일 )


[root@conoha test]# touch -r 1.txt 2.txt

[root@conoha test]# ls -l

total 0

-rw-r--r-- 1 root root 0 Jun 15 14:39 1.txt

-rw-r--r-- 1 root root 0 Jun 15 14:39 2.txt



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,