If you're using an Ubuntu laptop or desktop, you can press Ctrl + Alt + T
on your keyboard to open a new terminal window. If you're using a remote Ubuntu server, you can connect using SSH to open a new terminal session.
Ubuntu uses tz database timezones. You can use the following command to view timezones available on your system:
timedatectl list-timezones
or consult Wikipedia's list of timezones to choose the timezone you want.
Now let's use the timezone name you selected in the previous step to set the timezone using the timedatectl set-timezone
command with sudo
(administrator privileges). If the command asks you for a password, you can enter your Ubuntu password.
For example, if you selected UTC
:
sudo timedatectl set-timezone UTC
Or if you selected America/Los_Angeles
:
sudo timedatectl set-timezone America/Los_Angeles
You can verify your change by running the timedatectl
command with no arguments and no sudo
:
timedatectl
You should see output similar to the following:
Local time: Mon 2021-02-15 11:44:28 PST Universal time: Mon 2021-02-15 19:44:28 UTC RTC time: Mon 2021-02-15 19:44:29 Time zone: America/Los_Angeles (PST, -0800) System clock synchronized: yes NTP service: active RTC in local TZ: no
You've now set the system timezone on your Ubuntu machine.