How to Set/Change Timezone on Ubuntu 24.04?
Setting or changing the timezone on Ubuntu 24.04 is to ensure that the system clock reflects the correct local time for your location. It is crucial for scheduling tasks, logging events, and performing time-sensitive operations accurately. By considering its significance, this guide will explain different methods to set/change the timezone on Ubuntu 24.04.
How to Set/Change Timezone on Ubuntu 24.04?
Users can set or change the timezone on the Ubuntu system using either the terminal or the graphical user interface (GUI). For this, let’s follow below methods:
- Method 1: Using timedatectl
- Method 2: Using tzselect
- Method 3: Using NTP Time Synchronization
- Method 4: Using System Settings (GUI)
Let’s start with the first one.
Method 1: Set/Change Timezone on Ubuntu 24.04 Using timedatectl
Timestamps in log files are based on the system’s time zone. Accurate timestamps help with debugging and troubleshooting. To set or change the timezone on Ubuntu 24.04 use the “timedatectl” command by following the below-mentioned steps:
Step 1: Check Current Timezone
First, users need to check the current timezone using the “timedatectl” command. Initially, Australia/Sydney is selected as the current time zone as below:
timedatectl
Alternatively, users can use the cat command with the /etc/timezone path:
cat /etc/timezone
Step 2: List Available Timezones
Then, extract the list of available timezones on Ubuntu 24.04 using the “list-timezones” utility:
timedatectl list-timezones
Step 3: Set/Change Specific Timezone
Then, choose the specific timezone from the list and set it using the “set-timezone” utility:
sudo timedatectl set-timezone your_time_zone
In the above syntax, replace “your_time_zone” with the appropriate value from the list. For example, to set the timezone to Pacific Standard Time, use “America/Los_Angeles” as below:
sudo timedatectl set-timezone America/Los_Angeles
It’s important to ensure your system clock is accurate, as many system processes rely on it.
Step 4: Verify Timezone
To verify the change timezone on Ubuntu, use the “timedatectl” command with the “status” utility:
timedatectl status
Users can also confirm Time Zone changes by executing:
cat /etc/timezone
In this way, the timezone is set/changed from “Australia/Sydney” to “America/Los_Angeles”.
Method 2: Set/Change Timezone on Ubuntu 24.04 Using tzselect
The cron daemon relies on the system’s time zone to execute scheduled tasks. If the timezone is incorrect, cron jobs may run at unexpected times. To set or change the timezone on Ubuntu 24.04 using tzselect, follow these steps:
Step 1: Display Timezones List
First, enlist the available timezones on the Ubuntu system using the “tzselect” command:
tzselect
Step 2: Set/Change Timezone
Then, follow the on-screen prompts to select your geographic area. For instance, select “Americas” as a continent and enter its number. Then, choose a country such as “Panama” for the same pattern:
Once you’ve selected your timezone, you’ll be provided with the correct timezone name as below:
For Permanent Change
To make this change permanent, users need to link “/etc/localtime” to the timezone file in “/usr/share/zoneinfo”:
sudo ln -sf /usr/share/zoneinfo/Timezone /etc/localtime
Replace “Timezone” with the one users selected such as “America/New_York” as below:
sudo ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
It updates the system’s timezone setting on Ubuntu 24.04.
Method 3: Set/Change the Timezone on Ubuntu 24.04 Using NTP (Time Synchronization)
To set or change the timezone on Ubuntu 24.04 using time synchronization, follow these steps:
Step 1: Update Package List
First, users need to update the system’s package list with the below command:
sudo apt update
Step 2: Install NTP
Then, install the “ntp” package, which provides the ntpd service for time synchronization:
sudo apt install ntp
Step 3: Stop NTP Service
Once installed, stop the “ntp” service with the “systemctl” command with the “stop” utility for configuration:
sudo systemctl stop ntp
Step 4: Specify NTP Server
Now, open the NTP configuration file in a text editor such as “nano”. Find the section that lists the NTP servers and replace them with servers from your timezone:
sudo nano /etc/ntpsec/ntp.conf
Save and close the file.
Step 5: Restart NTP Services
Restart the “ntp” service to apply changes:
sudo systemctl start ntp
To check if the NTP service is running, use the “systemctl” command with the “status” utility :
systemctl status ntp
Step 6: Set Timezone
Finally, set your timezone by following Method 1:
sudo timedatectl set-timezone Your_Timezone
Replace “Your_Timezone” with the timezone users want to set, for example, “America/New_York” or any desired continent/country.
Note: It’s important to ensure that your system’s timezone is configured correctly, especially if you run servers or applications relying on time-based functions.
Method 4: Set/Change Timezone on Ubuntu 24.04 Using System Settings (GUI)
To change/set the timezone on Ubuntu 24.04 via the GUI, follow these steps:
Step 1: Open System Settings
Search for “Settings” in the “Activities” menu and open it. Or open it by clicking on the top right corner of the screen interface and selecting “Settings”:
Step 2: Navigate to “Date & Time” Section
In the Settings menu, go to the “System” then navigate to the “Date & Time” section as highlighted below:
Step 3: Set Timezone
Here, users find an option to set their time zone automatically or manually. To set the timezone automatically, toggle the “Automatic Time Zone” button and turn it on:
Set/Change Timezone (Manually)
If users choose to set it manually, click on the “Time Zone” to select the new time zone from the dropdown list:
Step 4: Verification
Finally, users can verify from the Time Zone field which is Sydney, Australia:
It’s important to ensure that the system’s timezone is correctly configured for accurate timekeeping and system functions that rely on the date and time.
Conclusion
To set the timezone on Ubuntu 24.04, use the “sudo timedatectl set-timezone your_time_zone” command. Replacing “your_time_zone” with the one from the list. It updates your system’s timezone configuration. Alternatively, use “tzselect” and NTP (Time Synchronization) to configure the timezone on Ubuntu. To set/change the timezone on Ubuntu 24.04 using GUI, click on the “Time Zone” option in the “Date & Time” category of System Settings. Then, search for the desired time zone in the search bar and choose it from the displayed options.
It is recommended to use the “timedatectl” for CLI or “System Settings” for the GUI method.