Monday, October 31, 2022

how to set date and time, NTP and timezone using timedatectl

How to set date and time, NTP and timezone using timedatectl

timedatectl

 This utility is part of system systemd and service manager.

Output :

# timedatectl
      Local time: Mon 2022-10-31 12:05:43 GMT
  Universal time: Mon 2022-10-31 12:05:43 UTC
        RTC time: Mon 2022-10-31 12:05:43
       Time zone: Europe/London (GMT, +0000)
     NTP enabled: yes
 NTP synchronized: yes
 RTC in local TZ: yes
      DST active: no

This output shows the :
Local time,
universal time,
RTC time,
time zone,
NTP configuration
Daylight Saving Time (DST)

Change the current date and Time :

set the date:

# timedatectl set-time [YYYY-MM-DD]

set the time:

# timedatectl set-time [HH:MM:SS]

 

 To configure your system to use UTC, use the following command:

# timedatectl set-local-rtc yes

 

To configure your system to use UTC, use the following command:

# timedatectl set-local-rtc no

Change Time Zone :

# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
. . . . . . . . 

# timedatectl set-timezone Europe/London

 

Configuring NTP : 

 Use the following command to enable this feature:

# timedatectl set-ntp yes

Use the following command to disable this automatic synchronization over NTP:
# timedatectl set-ntp no


 


0 comments: