# How to Set Time, Timezone and Synchronize System Clock in Linux

The ‘**timedatectl**‘ command is a new utility for [RHEL-based](https://www.tecmint.com/redhat-based-linux-distributions/ "RedHat-based Linux Distributions") and [Debian-based](https://www.tecmint.com/debian-based-linux-distributions/ "Debian-based Linux Distributions") distributions. It is a part of the ‘**systemd**‘ system and service manager, serving as a replacement for the old traditional [date command](https://www.tecmint.com/change-linux-system-date-and-time/ "date Command in Linux") used in ‘**sysvinit**‘ daemon-based Linux distributions.

The **timedatectl** command allows you to query and change the configuration of the system clock and its settings, you can use this command to set or change the current date, time, and timezone or enable automatic system clock [synchronization with a remote NTP server](https://www.tecmint.com/install-ntp-server-in-centos/).

In this tutorial, am going to take you through the ways you can manage time on your Linux system by setting the **date**, **time**, **timezone,** and **synchronize time with NTP** from the terminal using the new **timedatectl** command.

It is always a good practice to maintain the correct time on your Linux server or system and it can have the following advantages:

- maintain a timely operation of system tasks since most tasks in Linux are controlled by time.
- the correct time for logging events and other information on the system and many more.

## How to Find and Set Local Timezone in Linux

**1.** To display the current time and date on your system, use the **timedatectl** command from the command line as follows:

```
# timedatectl  status
```

<figure aria-describedby="caption-attachment-17226" class="wp-caption aligncenter" id="bkmrk-check-time-and-date">![Check Time and Date](https://www.tecmint.com/wp-content/uploads/2015/11/Check-Time-and-Date.gif)<figcaption class="wp-caption-text" id="bkmrk-check-time-and-date-1">Check Time and Date</figcaption></figure><center id="bkmrk-"></center>In the screencast above, **RTC** time is the hardware clock time.

**2.** The **time** on your Linux system is always managed through the **timezone set** on the system, to view your current timezone, do it as follows:

```
# timedatectl 
OR
# timedatectl | grep Time
```

<figure aria-describedby="caption-attachment-17227" class="wp-caption aligncenter" id="bkmrk-check-linux-time-zon">![Check Linux Time Zone](https://www.tecmint.com/wp-content/uploads/2015/11/Check-Linux-Time-Zone.gif)<figcaption class="wp-caption-text" id="bkmrk-check-linux-time-zon-1">Check Linux Time Zone</figcaption></figure>**3.** To view all available timezones, run the command below:

```
# timedatectl list-timezones
```

<figure aria-describedby="caption-attachment-17228" class="wp-caption aligncenter" id="bkmrk-list-all-timezones-i">![List All Timezones in Linux](https://www.tecmint.com/wp-content/uploads/2015/11/Linux-List-All-Timezones.gif)<figcaption class="wp-caption-text" id="bkmrk-list-all-timezones-i-1">List All Timezones in Linux</figcaption></figure>**4.** To find the local timezone according to your location, run the following command:

```
# timedatectl list-timezones |  egrep  -o "Asia/B.*"
# timedatectl list-timezones |  egrep  -o "Europe/L.*"
# timedatectl list-timezones |  egrep  -o "America/N.*"
```

<figure aria-describedby="caption-attachment-17230" class="wp-caption aligncenter" id="bkmrk-find-local-timezone-">![Find Local Timezone in Linux](https://www.tecmint.com/wp-content/uploads/2015/11/Find-Local-Timezone-in-Linux.gif)<figcaption class="wp-caption-text" id="bkmrk-find-local-timezone--1">Find Local Timezone in Linux</figcaption></figure>**5.** To set your local timezone in Linux, we will use the **set-timezone** switch as shown below.

```
# timedatectl set-timezone "Asia/Kolkata"
```

<figure aria-describedby="caption-attachment-17231" class="wp-caption aligncenter" id="bkmrk-set-local-timezone-i">![Set Local Timezone in Linux](https://www.tecmint.com/wp-content/uploads/2015/11/Set-Local-Timezone-in-Linux.gif)<figcaption class="wp-caption-text" id="bkmrk-set-local-timezone-i-1">Set Local Timezone in Linux</figcaption></figure>It is always recommended to use and set the coordinated universal time, **UTC**.

```
# timedatectl set-timezone UTC
```

<figure aria-describedby="caption-attachment-17232" class="wp-caption aligncenter" id="bkmrk-set-utc-time-in-linu">![Set UTC Time in Linux](https://www.tecmint.com/wp-content/uploads/2015/11/Set-UTC-Time-in-Linux.gif)<figcaption class="wp-caption-text" id="bkmrk-set-utc-time-in-linu-1">Set UTC Time in Linux</figcaption></figure>You need to type the correct name timezone otherwise you may get errors when changing the timezone, in the following example, the timezone “Asia/Kolkata” is not correct therefore causing the error.

<figure aria-describedby="caption-attachment-17233" class="wp-caption aligncenter" id="bkmrk-set-correct-timezone">![Set Correct Timezone in Linux](https://www.tecmint.com/wp-content/uploads/2015/11/Set-Correct-Timezone-in-Linux.gif)<figcaption class="wp-caption-text" id="bkmrk-set-correct-timezone-1">Set Correct Timezone in Linux</figcaption></figure>## How to Set Time and Date in Linux

**6.** You can set the date and time on your system, using the timedatectl command as follows:

### Set Time in Linux

To set time only, we can use a **set-time** switch along with the format of time in **HH:MM:SS** (Hour, Minute, and Seconds).

```
# timedatectl set-time 15:58:30
```

<figure aria-describedby="caption-attachment-17234" class="wp-caption aligncenter" id="bkmrk-set-local-time-in-li">![Set Local Time in Linux](https://www.tecmint.com/wp-content/uploads/2015/11/Set-Local-Time-in-Linux.gif)<figcaption class="wp-caption-text" id="bkmrk-set-local-time-in-li-1">Set Local Time in Linux</figcaption></figure>You may get the below error when setting the date as shown above:

```
Failed to set time: NTP unit is active
```

**7.** The error says that the NTP service is active. You need to disable it using the below command.

```
# systemctl disable --now chronyd
```

### Set Date and Time in Linux

**8.** To set date and time, we can use a **set-time** switch along with the format of date in **YY:MM:DD** (Year, Month, Day) and time in **HH:MM:SS** (Hour, Minute, and Seconds).

```
# timedatectl set-time '2015-11-20 16:14:50'
```

<figure aria-describedby="caption-attachment-17235" class="wp-caption aligncenter" id="bkmrk-set-date-in-linux">![Set Date in Linux](https://www.tecmint.com/wp-content/uploads/2015/11/Set-Date-in-Linux.gif)<figcaption class="wp-caption-text" id="bkmrk-set-date-in-linux-1">Set Date in Linux</figcaption></figure><figure aria-describedby="caption-attachment-17236" class="wp-caption aligncenter" id="bkmrk-set-date-and-time-in-1">![Set Date and Time in Linux](https://www.tecmint.com/wp-content/uploads/2015/11/Set-Date-and-Time-in-Linux.gif)<figcaption class="wp-caption-text" id="bkmrk-set-date-and-time-in-2">Set Date and Time in Linux</figcaption></figure>### How to Find and Set Hardware Clock in Linux

**9.** To set your hardware clock to coordinated universal time, **UTC**, use the **set-local-rtc boolean-value** option as follows:

First Find out if your hardware clock is set to the local timezone:

```
# timedatectl | grep local
```

Set your hardware clock to the local timezone:

```
# timedatectl set-local-rtc 1
```

<figure aria-describedby="caption-attachment-17238" class="wp-caption aligncenter" id="bkmrk-set-hardware-clock-t">![Set Hardware Clock Timezone](https://www.tecmint.com/wp-content/uploads/2015/11/Set-Hardware-Clock-Timezone.gif)<figcaption class="wp-caption-text" id="bkmrk-set-hardware-clock-t-1">Set Hardware Clock Timezone</figcaption></figure>Set your hardware clock to coordinated universal time (UTC):

```
# timedatectl set-local-rtc 0
```

<figure aria-describedby="caption-attachment-17239" class="wp-caption aligncenter" id="bkmrk-set-the-hardware-clo">![Set Hardware Clock to UTC](https://www.tecmint.com/wp-content/uploads/2015/11/Set-Hardware-Clock-to-UTC.gif)<figcaption class="wp-caption-text" id="bkmrk-set-the-hardware-clo-1">Set the Hardware Clock to UTC</figcaption></figure>### Synchronizing Linux System Clock with a Remote NTP Server

**NTP** stands for **Network Time Protocol** is an internet protocol, which is used to synchronize the system clock between computers. The **timedatectl** utility enables you to automatically sync your Linux system clock with a remote group of servers using NTP.

Please note that you must have **NTP** installed on the system to enable automatic time synchronization with NTP servers.

To start automatic time synchronization with a remote NTP server, type the following command at the terminal.

```
# timedatectl set-ntp true
```

To disable NTP time synchronization, type the following command at the terminal.

```
# timedatectl set-ntp false
```