How to change the time in Linux

Linux can adjust the time automatically or we can do it from the terminal or the desktop.

In this post we are going to see how to change the time in Linux. It's not that it's too difficult since most desktops include wizards that allow you to do it with a couple of clicks, but it's a good excuse to learn more about how our computer and operating system work.

In the old days a watch was a luxury item, something that was given as a gift at the age of majority, when you turned 25 in a job or passed on as an inheritance to the eldest son. In fact, it was the first thing my father and his brothers, Galician immigrants, bought as an investment when they began to earn money in Argentina.

However, with the arrival of the Japanese, manufacturing costs became cheaper and soon other devices such as microwaves, VCRs and even coffee makers incorporated this function. When mobile devices became more massive and portable, the classic wristwatch was losing prominence. Today it survives in the form of smartwatches, but in practice they are just an accessory to the phone.

I don't know why operating systems display a clock. I suppose that because the empty space on the bar looked bad and, since it needs a clock for its operation, showing the time was not something too complicated.

How to change the time in Linux

If you have Windows and Linux installed on your computer, you will have noticed that, if you exit Linux and enter Windows, it has a different time than the local one. This is because Linux assumes that the hardware clock is in sync with Coordinated Universal Time, whereas Windows assumes that it is in local time. The latest operating system to be used adjusts the hardware clock according to its needs.

The solution is to make Windows do its calculations based on UTC time or Linux do it with local time. It is much easier to make Linux change since we just have to write the command:
sudo timedatectl set-local-rtc 1

In general, Linux distributions ask you what time zone to use and from then on they will adjust the time automatically.either taking the information from a network time server or doing the corresponding calculations from the time indicated by the universal time server. In the event that the connection to the network time server is not available, developers often include files with instructions so that the system knows how to calculate the variations between summer and winter time.

Different desktops allow you to override automatic synchronization and set it manually.

From the terminal we can adjust the time with the command:
sudo timedatectl set-time hh:mm:ss
For example, to set the time at a quarter to three in the afternoon we do:
sudo timedatectl set-time 14:45:00
To cancel the automatic synchronization of the time with a network server we use the command:
sudo timedatectl set-ntp false
To reactivate it we write the command:
sudo timedatectl set-ntp true
We can see the available time zones with:
timedatectl list-timezones
And switch from one to the other with:
timedatectl set-timezone CONTINENTE/PAÍS
timedatectl set-timezone Continente/País/Ciudad
And in some cases
timedatectl set-timezone Continente/Ciudad/Localidad.
In any case, paste as it appears in the list.
For example:
timedatectl set-timezone America/Indiana/Indianapolis

Linux distributions use Coordinated Universal Time to set the clock to local time.

During the installation process, Linux distributions ask the user what time zone they have to work with.

If you do not want to change the time zone you can see what time it is in another with the command:

TZ=Zona_horaria date Replacing timezone with the name in which it appears in the list. For example:
TZ=America/Indiana/Indianapolis date
To see the time on the hardware clock, use the command:
hwclock -r
We can synchronize the hardware clock with the system clock by typing:
hwclock --systohc

Some applications to see the time

If you don't like the clock that comes with your desktop, in the repositories we have several applications that allow us to see the time. Some of them are:


It may also appear in package managers under the name Clocks. It is an application part of the GNOME project and includes several programs related to time measurement including:

  • Clocks to show the time in different parts of the world.
  • Alarms
  • Counters backwards.
  • Stopwatches

Analog clock

Available in the software center for distributions based on the KDE desktop, This analog clock is added to the desktop and shows the passing of the hours with the position of the hands.


Another title available in the repositories. As indicated by the D in the title sIt is a digital clock that pretends to show the numbers with leds. In addition, it shows the date and allows you to set an alarm.


This repository program shows the time in different areas of the globe. to be able to see it we just have to place the cursor and double click on the city whose schedule we want to see.


An old style digital clock whose appearance can be modified using style sheets. It is available in format Flatpak.


The snap store we get this useful application that calculates dates. Gets results based on start/end time and time range or time range from start and end time and date

How computers measure time

The number of minutes comes from multiplying the 12 phalanges of four fingers multiplied by the other 5

The division of hours into 60 minutes comes from ancient Babylon. It was the most that could be counted using a manual method

Probably the oldest way of measuring time is the position of the sun. The day was the period that elapsed until the sun returned to its position. The first subdivision of the day was made by the Egyptian priests who controlled the moment of the appearance of the constellations, this allowed dividing the night into 12 sub-periods of equal duration.

In the 12th century, sundials appeared, marking the passing of the hours during the day by projecting shadows. The clarity period was also divided into XNUMX hours.

The subdivision of the hour into 60 minutes is the responsibility of the Babylonians. They used a counting system based on the use of the hands. With the thumb of the right hand they were counting, marking each of the phalanges of the other four fingers, when they had to count more than 12 they raised a finger of the left hand. With that they could count up to 60.

Over time, different mechanisms were created to record the passage of time using mechanisms such as the aforementioned shadow, the force of gravity or the speed of consumption of a candle.

Computers have two ways of measuring the passage of time.. One is based on hardware and the other on software.

The real time clock (RTC)

It is powered by a battery and works even when the computer is turned off. We mean the clock in a broad sense since it does not have buttons, needles or led numbers. It is an integrated circuit that is part of the motherboard and is responsible for running the system clock. That circuit has a crystal oscillator based on a piezoelectric crystal.. Each crystal has a crystalline structure made up of a regular and repeating pattern of atoms. By applying a field through the crystal, its crystalline structure is distorted and, by eliminating the field, it returns to the original state, thus generating an electrical signal with a very precise frequency.

system clock

The system clock is based on real time clock information but The person in charge of managing it is the kernel of the operating system. Its job is to configure, schedule, and synchronize tasks, processes, and interruptions.

It is not a clock in the style of the applications that we see on the mobile either, since it does not show the hours or represent the passage of time with numbers.  What it does is record the passage of seconds and microseconds by issuing digital signals.

A problem that must be solved is the lack of synchronization between both clocks (which use different ways of measuring time) with each other and with the real time. For this, when the computer starts, the system clock reads the time from the real-time clock and applies a correction formula. Then, if the computer is connected to the Internet, it determines the real time and synchronizes the system clock so that it reflects the passage of time properly.

You will have noticed in old computers that, if there is no Internet connection, the time, instead of the real one, is just a few minutes after the time you turned it off. That is solved by changing the battery that powers the real time clock.

The hardware clock keeps track of the passage of time when the computer is turned off.

An integrated circuit on the motherboard measures the passage of time by the oscillation of a crystal. With its data, the kernel of the operating system adjusts the system clock.

On modern computers it is possible that the operating system ignore the real-time clock and refer directly to the network time server.

The content of the article adheres to our principles of editorial ethics. To report an error click here.

2 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Manual said

    Hello. So that the dual boot of Windows and Linux always have the same time, what I do is adjust it by entering the bios and with that both systems always mark the same time.

    1.    Diego German Gonzalez said

      Thanks for the tip