How to Change Your Time Zone in Linux in 2 Steps

When you run the date command in your Linux machine, the output will show the day, date, time, and time zone. But if it is your first time setting your Linux machine up, the time zone in the output may not match your time zone.

Linux’s default time zone is UTC (Universal Time Coordinated or Coordinated Universal Time). But if you want, you can change the time zone to match yours by doing the following:

1. Get Your Zone

To get your zone, enter the following command:

For instance, if you live in Paris, you should enter the command as:

Your output will be:

This is your zone; copy it and move to the next step.

2. Set Your Zone

Once you know your zone, run this command:

Using our previous example, you will enter the command as:

After clicking the Enter key, the time zone of your Linux machine will change accordingly.

You may run the date command again to confirm the change. In our case, the output would be:

Some Other timedatectl Commands

This command shows the details of your timedatectlsettings.

The output shows the following:

  • Real-time clock (RTC) time: a digital clock for accurate time keeping/measurements.
  • Time zone
  • Universal time (UTC)
  • Local time
  • NTP service activity: a service that ensures that the system clocks of desktops and servers in a network are synchronized. This service is vital for performance and security. So, if yours is inactive, you should activate it.
  • RTC in local TZ: this basically tells you whether your real-time clock is running in your local time zone or not.

timedatectl show outputs the same thing as timedatectl status but in a form readily parsable by machines.

This command activates or deactivates your NTP service.

For activation:

timedatectl set-ntp Y

For deactivation:

timedatectl set-ntp N

We mentioned this command earlier but included |grep . Without grep , timedatectl list-timezones outputs a list of all known time zones.

timedatectl set-local-rtc Y makes your RTC to run in your local time zone.

timedatectl set-local-rtc N switches your RTC to run in UTC.

That’s all!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store