How to Set Time, Timezone and Synchronize System Clock Using timedatectl Command
The timedatectl utility is distributed as part of the systemd
system and service manager and allows you to review and change the
configuration of the system clock. You can use this tool to change the current
date and time, set the time zone, or enable automatic synchronization of the
system clock with a remote server.
1. To display the current
time and date on your system, use timedatectl command from the command line as follows:
~]$ timedatectl
Local time: Mon 2016-09-16 19:30:24 CEST
Universal time: Mon 2016-09-16 17:30:24 UTC
Timezone: Europe/Prague (CEST, +0200)
NTP enabled: no
NTP
synchronized: no
RTC
in local TZ: no
2. To view all available
time zones, run the command below:
timedatectl list-timezones
3. To set your local timezone in Linux, we
will use set-timezone switch as shown
below.
# timedatectl set-timezone
“Asia/Kolkata”
# timedatectl set-time 15:58:30
5.To set date only, we can use set-time switch
along the format of date in YY:MM:DD (Year,
Month, Day).
# timedatectl set-time 2018-11-20
6. To set both date and time:
# timedatectl set-time '2018-11-20 16:14:50'
7. To start
automatic time synchronization with remote NTP server, type the following
command at the terminal.
# timedatectl set-ntp yes
8. To disable NTP time
synchronization, type the following command at the terminal.
# timedatectl set-ntp no
No comments:
Post a Comment