이번 포스트에서는 리눅스 시스템의 날짜와 시간을 설정해보겠습니다.
timedatectl
timedatectl 명령어를 입력하면 현재 시간, 날짜, 타임존 등의 다양한 정보를 확인할 수 있습니다.
ubuntu@ip-172-31-12-184:~$ timedatectl
Local time: Sat 2022-12-31 17:33:13 UTC
Universal time: Sat 2022-12-31 17:33:13 UTC
RTC time: Sat 2022-12-31 17:33:13
Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
list-timezones
timedatectl list-timezones 를 입력하면 각 나라의 도시를 조회할 수 있습니다.
ubuntu@ip-172-31-12-184:~$ timedatectl list-timezones | grep Seoul
Asia/Seoul
이때 timedatectl list-timezones 를 입력하면 조회되는 도시들이 많기 때문에
파이프라인과 grep 을 사용해서 Seoul 을 조회해보겠습니다.
set-timezone
날짜와 시간을 서울로 맞추기 위해 list-timezones 에 등록된 Asia/Seoul 을 입력하면 됩니다.
아래와 같이 sudo 를 통해 root 권한을 잠시 빌려 입력을 합니다.
ubuntu@ip-172-31-12-184:~$ sudo timedatectl set-timezone Asia/Seoul
ubuntu@ip-172-31-12-184:~$ timedatectl
Local time: Sun 2023-01-01 02:38:33 KST
Universal time: Sat 2022-12-31 17:38:33 UTC
RTC time: Sat 2022-12-31 17:38:33
Time zone: Asia/Seoul (KST, +0900)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
timedatectl 을 입력해보면 Local time (현재시간) 이 바뀐것을 알 수 있습니다.
'리눅스' 카테고리의 다른 글
리눅스 - 기본 명령어 정리 (5) (0) | 2023.01.01 |
---|---|
리눅스 - 기본 명령어 정리 (4) (0) | 2023.01.01 |
리눅스 - 기본 명령어 정리 (3) (0) | 2022.12.30 |
리눅스 - 기본 명령어 정리 (2) (0) | 2022.12.30 |
리눅스 - 기본 명령어 정리 (1) (0) | 2022.12.30 |