«   2021/05   »
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
05-08 05:43
Notice
Today
9
Total
1,423,023
관리 메뉴

변군이글루

[명령어] timedatectl 명령어 본문

* 리눅스

[명령어] timedatectl 명령어

변군 변군이글루 2021. 4. 26. 10:01

timedatectl 명령어

$ timedatectl --help
timedatectl [OPTIONS...] COMMAND ...

Query or change system time and date settings.

  -h --help                Show this help message
     --version             Show package version
     --no-pager            Do not pipe output into a pager
     --no-ask-password     Do not prompt for password
  -H --host=[USER@]HOST    Operate on remote host
  -M --machine=CONTAINER   Operate on local container
     --adjust-system-clock Adjust system clock when changing local RTC mode

Commands:
  status                   Show current time settings
  set-time TIME            Set system time
  set-timezone ZONE        Set system time zone
  list-timezones           Show known time zones
  set-local-rtc BOOL       Control whether RTC is in local time
  set-ntp BOOL             Control whether NTP is enabled

현재 시간 설정 보기

$ timedatectl
      Local time: 월 2021-04-26 09:15:15 KST
  Universal time: 월 2021-04-26 00:15:15 UTC
        RTC time: 월 2021-04-26 00:15:15
       Time zone: Asia/Seoul (KST, +0900)
     NTP enabled: no
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

Local time: 현재 시간
Universal time: 협정 세계시(UTC)
RTC time: RTC 하드웨어 시간
Time zone: 시간대
NTP enabled: NTP 활성화 여부
NTP synchronized: NTP 동기화 여부
RTC in local TZ: 하드웨어 시계를 현지 시각대로 설정할지 여부
DST active: n/a

 

시스템 타임 존(timezone) 설정

$ timedatectl list-timezones | grep -i seoul
Asia/Seoul

$ timedatectl set-timezone Asia/Seoul

시간(시간/날짜) 수동으로 설정

 - 수동으로 설정 시 'timedatectl set-ntp false' 명령어로 NTP 비활성화 시켜야 함

$ date
2021. 04. 26. (월) 09:18:52 KST

###날짜/시간 모두 설정
$ timedatectl set-time '2021-04-26 10:20:00'

###날짜만 설정
$ timedatectl set-time 2021-04-26

###시간만 설정
$ timedatectl set-time 10:20:00

리눅스 시스템 시간을 원격 NTP 서버와 동기화 설정

###NTP 동기화 활성화
$ timedatectl set-ntp true

$ timedatectl
      Local time: 월 2021-04-26 09:36:13 KST
  Universal time: 월 2021-04-26 00:36:13 UTC
        RTC time: 월 2021-04-26 00:36:13
       Time zone: Asia/Seoul (KST, +0900)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

RTC 하드웨어 시계를 현지 시각대로 설정

$ timedatectl set-local-rtc true

$ timedatectl
      Local time: 월 2021-04-26 09:37:18 KST
  Universal time: 월 2021-04-26 00:37:18 UTC
        RTC time: 월 2021-04-26 09:37:18
       Time zone: Asia/Seoul (KST, +0900)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.

timedatectl man page

 

timedatectl

Name timedatectl — Control the system time and date Synopsis timedatectl [OPTIONS...] {COMMAND} Description timedatectl may be used to query and change the system clock and its settings, and enable or disable time synchronization services. Use systemd-fi

www.freedesktop.org

 

 

 

0 Comments
댓글쓰기 폼