How To Set the Timezone from Terminal on Linux Ubuntu
Managing the correct timezone on your Ubuntu system is kinda essential — not just for keeping logs straight but also for scheduling stuff and making sure everything runs on time across services. If your clock is out of sync or you’ve moved to a new timezone, this guide helps you sort that out through the terminal. Whether you’re juggling server duties or just trying to fix your desktop, these steps will get your system’s time in line. Sometimes the timezone stuck in place doesn’t update until you do a reboot, but often you can just switch it on the fly, which is pretty neat.
Prerequisites
Before diving in, make sure you’ve got:
- A terminal window open on your Ubuntu machine (Ctrl + Alt + T usually does the trick).
- Admin rights — you’ll need to be able to run commands with sudo.
How to Fix Your Timezone in Ubuntu with the Terminal
Check what timezone you’re currently running
This is useful because sometimes you think you’re set, but nope — your logs or scheduled tasks think otherwise. Just run:
timedatectl
This will show info like local time, universal time, and the current timezone. If it’s wrong, no wonder things feel off.
Find a list of available timezones
On some machines, you might not know exactly what timezone string to use. To look through options, run:
timedatectl list-timezones
It’s a giant list, so you might want to grep or scroll. If you’re in the US, chances are you want America/New_York
, America/Chicago
, or something similar. Just find the one that matches your location.
Set the new timezone
Now that you’ve picked the right string, you can change it without rebooting. The command looks like this:
sudo timedatectl set-timezone your_timezone
Replace your_timezone with the actual string, e.g., sudo timedatectl set-timezone America/Los_Angeles
. After it executes, your system should switch to the new timezone instantly.
Double-check that it worked
Run timedatectl
again and look at the timezone entry. If it reads what you set, bingo — you’re all set. Sometimes, especially on a stubborn machine, the change might not stick immediately or require a reboot, but usually, it’s instant.
Extra Tips & Common Pitfalls
Here’s where things get cluttered. If the timezone change fails, make sure:
- You ran sudo — Ubuntu’s security wants you to confirm you’re allowed to change system settings.
- Your system is synced with NTP servers, especially if you notice your clock keeps drifting back. Run
timedatectl set-ntp true
to enable NTP if needed. - Sometimes, GUI settings or your desktop environment might override terminal changes — check Preferences or Date & Time in your system settings.
And yeah, on some setups, it might be worth restarting services like systemd-timedated
or even rebooting, but most times, it’s enough to just update the setting.
Wrap-up
Getting the time right is one of those little things that’s surprisingly annoying if it’s wrong, but super straightforward once you know the commands. Switching the timezone with timedatectl
is quick, and it usually works on the first try. Just keep an eye on the logs or scheduled tasks afterward in case they’re still off — sometimes they hang onto old settings for a bit. Because of course, Linux has to make it a little more complicated than clicking a dropdown.
Frequently Asked Questions
Why does my timezone suddenly change or behave weirdly?
That can happen if some service or system update resets your timezone, or if your system’s clock isn’t syncing properly with NTP servers. It’s worth checking timedatectl status
and making sure NTP is enabled.
Is it possible to change timezone without rebooting?
Most of the time, yes. Running sudo timedatectl set-timezone
updates it on the fly. But if weird stuff keeps happening, a quick reboot doesn’t hurt either.
How do I switch back to UTC or the default timezone?
Just run the same command with the default, like: sudo timedatectl set-timezone UTC
. Easy.