sodcalculator

10 Tech How-To

How to Set or Change Timezone on Ubuntu

Guide 10-59522 · Updated · Step by step

This guide shows you how to set or change the system timezone on Ubuntu Linux. You’ll learn to check the current timezone, list available zones, and switch to a new one using both the command line and the graphical interface. No special tools are required—everything you need is built into a standard Ubuntu installation.

What You’ll Need

  • A Ubuntu system (desktop or server) where you have sudo or root access
  • Terminal access (Ctrl+Alt+T on desktop, or SSH for servers)
  • An internet connection is only needed if you want to use NTP time synchronization; changing the timezone itself works offline

Step-by-Step

Method 1: Using timedatectl (Recommended)

  1. Open a terminal. Press Ctrl+Alt+T on the desktop, or connect via SSH to a server.
  2. Check your current timezone. Run timedatectl (or timedatectl status). The output shows the local time, universal time, and the current timezone, for example America/New_York.
  3. List available timezones. Run timedatectl list-timezones. This prints a long list of valid zone names like Europe/London or Asia/Tokyo. To filter, pipe to grep: timedatectl list-timezones | grep Europe.
  4. Set the new timezone. Run sudo timedatectl set-timezone Your/Zone, replacing Your/Zone with the exact name from the list. For example: sudo timedatectl set-timezone Europe/Berlin.
  5. Verify the change. Run timedatectl again. The “Time zone” line should now show the new zone, and the local time should reflect it.

Method 2: Using the /etc/localtime Symlink (Legacy)

  1. Open a terminal.
  2. Back up the current setting (optional but safe): sudo cp /etc/localtime /etc/localtime.bak
  3. Remove the existing symlink. Run sudo rm /etc/localtime.
  4. Create a new symlink to the desired zone file in /usr/share/zoneinfo/. For example, for Berlin: sudo ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime.
  5. Verify. Run date to see the new time. This method is older and can confuse some tools, so prefer timedatectl when possible.

Method 3: Using the Graphical Interface (Desktop Only)

  1. Open Settings. Click the system menu (top-right corner) and select the gear icon, or search “Settings” in the activities overview.
  2. Go to Date & Time. In the left sidebar, click Date & Time.
  3. Turn off Automatic Time Zone if it is on (toggle it off). This is needed if you want to pick manually.
  4. Click the timezone field. A map appears. Type your city in the search box or click on the map. The system updates the timezone instantly.
  5. Close Settings. The change is saved automatically.

Common Mistakes

  • Typing the zone name wrong. Timezones are case-sensitive and use forward slashes. europe/berlin fails; Europe/Berlin works.
  • Using abbreviations. Setting EST or PST does not work with timedatectl. You must use the full IANA name like America/New_York.
  • Forgetting sudo. Changing the timezone requires root privileges. Without sudo, you get a “Failed to set time zone” error.
  • Editing /etc/timezone directly. On modern Ubuntu, this file is managed by timedatectl. Manually editing it may be overwritten or ignored.
  • Assuming UTC is wrong. Servers often intentionally run on UTC. Changing it to local time can break log correlation or cron schedules. Only change if you have a reason.

Tips

  • Use tab completion. When typing the zone name in the terminal, press Tab after sudo timedatectl set-timezone to auto-complete the region and city.
  • Set the timezone during installation. If you are installing a new system, you can avoid this step by choosing the correct region during setup.
  • Keep NTP enabled. After changing the timezone, ensure timedatectl shows NTP service: active. This keeps the clock accurate over the internet.
  • Check with multiple commands. Use date, timedatectl, and cat /etc/timezone to confirm the change from different angles.
  • For containers and WSL. In Docker containers or Windows Subsystem for Linux, timedatectl may not work. Use the symlink method or set the TZ environment variable instead.

Troubleshooting

  • “Failed to set time zone: Unit systemd-timedated.service not found.” This happens on minimal systems or containers. Install the required package with sudo apt install systemd-timesyncd, or fall back to the symlink method.
  • Time is still wrong after changing the zone. Check if NTP is overriding your manual setting. Run timedatectl and look at “NTP service”. If it says “active”, run sudo timedatectl set-ntp false, set the timezone, then re-enable NTP with sudo timedatectl set-ntp true.
  • The timezone list is empty or missing entries. The tzdata package may be incomplete. Run sudo apt update && sudo apt install --reinstall tzdata.
  • Applications still show old time. Some long-running processes cache the timezone. Restart the application or the session (log out and back in) to force a reload.
  • Hardware clock is off. If the BIOS clock is set to local time instead of UTC, you may see a discrepancy. Run sudo timedatectl set-local-rtc 0 to tell Ubuntu to treat the hardware clock as UTC (recommended).

Frequently Asked Questions

What is the difference between UTC and GMT?

UTC (Coordinated Universal Time) is the atomic time standard used as the basis for civil time. GMT (Greenwich Mean Time) is a time zone that historically matched UTC. For practical purposes in Ubuntu, they are identical, and the correct zone name is Etc/UTC or Europe/London (which observes daylight saving).

How do I set the timezone without sudo?

You cannot change the system timezone without root privileges. However, you can set the TZ environment variable for your current shell session: export TZ=Asia/Tokyo. This affects only that terminal window and its child processes.

Does changing the timezone affect cron jobs?

Yes. Cron uses the system timezone. After changing it, scheduled jobs will run at the new local time. Check your /etc/crontab and user crontabs to see if any jobs need adjusting.

How do I find my current timezone in a script?

Use cat /etc/timezone (prints just the zone name) or timedatectl show -p Timezone --value (prints the value without extra text). Both work well for scripting.

Is it safe to delete /etc/localtime?

Yes, but only if you immediately replace it with a symlink to a valid zone file. If you leave it missing, many programs will fall back to UTC, and some may error. The timedatectl method handles this automatically.

Why does my Ubuntu server default to UTC?

UTC is the standard for servers because it avoids daylight saving ambiguity and makes logs from multiple machines comparable. It is a deliberate default, not an error. If you need local time for user-facing services, change it as described above.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →