Search Our Database

How to view and update system time zone via CLI for a Linux server

Last updated on |

Introduction

This article guides you through how to view and update the system time zone for a Linux server via the command-line interface (CLI). This is useful for ensuring your server logs, scheduled tasks, and applications reflect the correct local time.

We will use the timedatectl command, which is available on most modern Linux distributions using systemd.

 

Pre-requisites

  • Root or sudo access to your Linux server.
  • SSH access to the server.
  • Your preferred time zone (e.g., Asia/Kuala_Lumpur).

 

Steps to View and Update the System Time Zone

Step 1: Connect to Your Server via SSH

Use an SSH client (e.g., PuTTY or terminal) to log in:

ssh youruser@your.server.ip

 

Step 2: View the Current Time Zone

Check the server’s current time zone and date/time settings:

timedatectl

📌 Note: Look for the Time zone line in the output.

 

Example output:

 

 

Step 3: List All Available Time Zones

To see all valid time zone names, run:

timedatectl list-timezones

 

Example Output:

 

 

You can scroll through the list or filter results by using grep. Example:

timedatectl list-timezones | grep Kuala

 

Example output:

 

Step 4: Set a New Time Zone

Once you have identified your desired time zone, set it using:

sudo timedatectl set-timezone Your/Timezone

Example for Kuala Lumpur:

sudo timedatectl set-timezone Asia/Kuala_Lumpur

 

Step 5: Verify the Change

Run the following command again to confirm:

timedatectl

✅ If the Time zone shows the new value, the update was successful.

 

Example Output:

 

 

Conclusion

By using timedatectl, you can easily check and update the system time zone on a Linux server. This ensures that logs, cron jobs, and other time-sensitive processes run according to your local time settings.

If you require assistance or encounter any issues, please contact our support team at support@ipserverone.com.