LFCA: Learn to Manage Time and Date in Linux – Part 6

This article is Part 6 of the LFCA series, here in this part, you will acquaint yourself with the general system administration commands to manage time and date settings in the Linux system.

Time is crucial in any Linux system. Multiple services such as crontab, anacron, backup and restore services depend on accurate time to carry out their tasks as expected.

Linux has 2 types of clocks:

  • Hardware clock – This is the battery-powered clock also referred to as the CMOS clock or RTC ( Real Time Clock). The clock runs independently of the operating system & keeps running even when the system is powered off provided the CMOS battery is present.
  • System clock ( Software clock ) – This is also referred to as the kernel clock. At boot time, the system clock is initialized from the hardware clock and takes over from there.

Usually, there exists a time difference between the two clocks such that they gradually drift from each other. We will come to this later and show you how you can sync these clocks.

For now, we will see how you can check time and date on a Linux system.

Check Time and Date On a Linux System

There are two main utilities used to check time and date on a Linux system. The first is the date command. Without any arguments, it provides quite a bit of information shown

$ date

Friday 26 March 2021 11:15:39 AM IST

To view the date in dd-mm-yy time format only, execute the command:

$ date +"%d-%m-%y"


If you just want to view the current time only and nothing else, use the command:

$ date "+%T"


The timedatectl command is a new utility used in modern Linux systems such as Ubuntu 18.04, RHEL 8 & CentOS 8. It’s a replacement of the date command which was prominent in the old SysVinit systems. It can be used to query and adjust the time on a Linux system.

Without any options, the timedatectl command prints out an array of information such as the local time, UTC time, RTC time, and the timezone to mention a few.

$ timedatectl
Check Time and Date in Linux
Check Time and Date in Linux

How to Set a Timezone on a Linux System

On a Linux system, time is dependent on the timezone that is set. To check the timezone that is configured on your system, issue the command:

$ timedatectl | grep Time
Check Linux System Timezone
Check Linux System Timezone

From the output in the snippet above, I am in the Africa/Nairobi timezone. To view the available timezones, run the command:

$ timedatectl list-timezones
Check Linux Timezones
Check Linux Timezones

Press ENTER to scroll through the whole list of the possible time zones that are available.

Timezones are also defined in the /usr/share/zoneinfo/ path as shown.

$ ls /usr/share/zoneinfo/
View Linux Timezones
View Linux Timezones

There are a couple of ways that you can use to configure the timezone. Using the timedatectl command, you can set the timezone, for instance, to America/Chicago, using the syntax shown.

$ timedatectl set-timezone 'America/Chicago'
Set Linux Timezone
Set Linux Timezone

The other way you can set the timezone is to create a symbolic link from a timezone file in the /usr/share/zoneinfo path to /etc/localtime. For example, to set the local time zone to EST (Eastern Standard Time), issue the command:

$ sudo ln -sf /usr/share/zoneinfo/EST /etc/localtime
Set Local Timezone in Linux
Set Local Timezone in Linux

Set Date and Time on a Linux System

To set time only on a Linux system using the format HH:MM:SS (Hour: Minute: Second ), use the syntax below

$ timedatectl set-time 18:30:45

To set the date only in YY-MM-DD (Year: Month: Day) format, use the syntax:

$ timedatectl set-time 20201020

To set both date and time, run:

$ timedatectl set-time '2020-10-20 18:30:45'

NOTE: Manually setting time and date in this manner is not recommended since you are likely to configure inaccurate time and date settings. In fact, by default, automatic time synchronization is turned on to prevent you from making manual time and date settings.

The most recommended way to set time is by either specifying the time zone that you are in as shown earlier or turning on automatic time synchronization with a remote NTP server.

Set Automatic Time Synchronization using NTP Server

NTP is short for Network Time Protocol, which is an internet protocol that is used to automatically synchronize the system’s time clock with a pool on online NTP servers.

Using the timedatectl command, you can set automatic time synchronization as follows:

$ timedatectl set-ntp true

To disable automatic NTP time synchronization, execute:

$ timedatectl set-ntp false

The timedatectl and date commands are handy command-line tools that can help you check and adjust your time on Linux.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

James Kiarie
This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

1 Comment

Leave a Reply
  1. “The timedatectl command is a new utility used in MODERN Linux systems such as Ubuntu 18.04, RHEL 8 & CentOS 8. It’s a replacement of the date command which was prominent in the OLD SysVinit systems.”

    (emphases mine)

    That statement insinuates that systemd is the new standard and SysVinit, and other non-systemd inits, are totally deprecated, which is very far from the truth. Whether a Linux distro is Modern or OLD is determined by the kernel version it uses, not the version of any of the distro’s components, even if it is the init.

    There still are many MODERN Linux systems, such as Gentoo, PCLinuxOS, Devuan, Artix, and others that use SysVinit, runit, or other inits rather than systemd.

    BTW – Ubuntu 18.04 can in no way be considered MODERN as Ubuntu 21.04 has been already released.

    “There are two main utilities used to check time and date on a Linux system.”

    You should differentiate right up front which command is used by distros using systemd as init and which command is used by distros using non-systemd inits.

    Somehow you did not provide the “date” command options for setting time zone, date & time, and how to sync with NTP servers.


Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.