Use the TIMEDATECTL command to set the time

Source: Internet
Author: User
Tags local time set time time and date timezones egrep

Turn from: https://www.tecmint.com/set-time-timezone-and-synchronize-time-using-timedatectl-command/

1. To display the "current" and "date on" your system, use the Timedatectl command from the commandline as follows:

# Timedatectl  Status

Check Time and Date

In the scrrentcast above, the RTC time:is the hardware clock time.

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

# timedatectl 
OR
# Timedatectl | grep time

Check Linux Time Zone

3. To view all available timezones, run the command below:

# Timedatectl List-timezones

List all timezones in Linux

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.*"

Find local Timezone in Linux

5. To set your local timezone in Linux, we'll use Set-timezone switch as shown below.

# timedatectl Set-timezone "Asia/kolkata"

Set local Timezone in Linux

It is always recommended to with and set the Coordinated Universal Time, UTC.

# Timedatectl Set-timezone UTC

Set UTC time in Linux

You are need to type the correct name timezone the changing of the timezone, in the following exam PLE, the timezone "asia/kalkata" is not correct therefore causing the error.

Set correct Timezone in Linux I to Set time and Date in Linux

6. Can set the date and time on your system with the using the Timedatectl command as follows: set time in Linux

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

# Timedatectl Set-time 15:58:30

Set local time in Linux set Date in Linux

7. 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 20151120

Set Date in Linux

8. To set both date and time:

# timedatectl Set-time ' 16:10:40 2015-11-20 '

Set Date and time in Linux, 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:

The Your hardware clock is set to local timezone:

# Timedatectl | grep Local

Set your hardware clock to local timezone:

# Timedatectl SET-LOCAL-RTC 1

Set Hardware Clock Timezone

Set your hardware clock to Coordinated Universal Time (UTC):

# timedatectl SET-LOCAL-RTC 0

Set hardware Clock to UTC synchronizing Linux System Clock with a Remote NTP Server

NTP stands for Network time Protocol is a Internet Protocol, which are used to synchronize system clock between. The Timedatectl utility enables you-automatically sync your Linux system clock with a remote group of servers using NTP .

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.