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.
Sun Sep 4 11:39:46 UTC 2022
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:
timedatectl list-timezones | grep the name of your city
For instance, if you live in Paris, you should enter the command as:
timedatectl list-timezones | grep Paris
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:
timedatectl set-timezone Your Zone
Using our previous example, you will enter the command as:
timedatectl set-timezone Europe/Paris
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:
Sun Sep 4 12:59:17 CEST 2022
This command shows the details of your
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.
timedatectl set-ntp Y
timedatectl set-ntp N
We mentioned this command earlier but included
|grep . Without
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.