How to Set Timezone on Ubuntu?
Having an accurate timezone is crucial for streamlining processes on a Linux-based or a Debian-based Operating system, especially if you are running VPS Servers or scheduled cron jobs. Moreover, if you are a Linux System Administrator executing pipeline integration (for example, Jenkins), then having the correct timezone becomes all the more important.
This tutorial will illustrate the process of setting the timezone in Ubuntu using different methods. The following is the content of this post:
- Method 1: Use GUi to Set Timezone in Ubuntu
- Method 2: Use the timedatectl Command to Set Timezone in Ubuntu
- Difference Between GUI and timedatectl Command to Set Timezone in Ubuntu
- Method 3: Change Timezone on Old Versions of Ubuntu
- Bonus: How to Find the Current Timezone in Ubuntu?
Let’s get started with the first one!
Method 1: Use GUI to Set Timezone in Ubuntu
In this method, you don’t require any commands or command-line utility to update your timezone. From the Desktop, click on the “Show Applications” Icon:
From the applications menu, search for “Settings” and click on the settings icon:
This will open up the settings of your Ubuntu Installation:
Scroll the left-side navigation panel and click on the “Date & Time” option:
From the Date and Time options, click on the bar that says “Time Zone” to open up the timezone selection map:
Doing this will open up a World Map, from where you can click on the country to set its timezone as your default:
Alternatively, you can also search for a specific country in the search bar to set its timezone as your default:
After that, simply exit from the map, and you have successfully set your timezone in Ubuntu:
Method 2: Use the timedatectl Command to Set Timezone in Ubuntu
In this method, you will use the command line utility “timedatectl” to check and set the timezone of your Ubuntu Installation. To do this, simply open up a terminal (CTRL + ALT + T) and type in the following command:
timedatectl
Running this command will display the following output on the terminal:
To set the timezone using the timedatectl command, you must know the exact name of the continent/city or the correct timezone format. To know this, type the following command in the terminal:
timedatectl list-timezones
Running this command will show a long list of all the available timezone that can be set as your default:
Note: To scroll and find the timezone and format you want, use the Page Up and Page Down keys of the keyboard. Press CTRL + Z to exit from the list.
After that, use the following command template to set the timezone:
timedatectl set-timezone continent/country/city
Suppose you want to set the time zone to Cordoba. Then the command will become:
timedatectl set-timezone America/Argentina/Cordoba
After executing this command, you can verify the change by simply typing in the following command:
timedatectl
This time around, the following will be displayed as the output on the terminal:
You have successfully changed the timezone using the command “timedatectl.”
Filtering Timezone Format from list-timezones Flag
Instead of iterating through the list of timezones to find the correct format, you can also use the grep filtering to quickly find out the timezone format of the continent or the city that you want to select.
To do this, use the following template:
timedatectl list-timezones | grep -i continent/country
Suppose you want to find all the timezones of Asia, then you can choose the following command:
timedatectl list-timezones | grep -i asia
Running this command will produce the following outcome on the terminal:
You can use the same template to find the timezone format of a specific city. For example, find the timezone format of Chicago using the following command:
timedatectl list-timezones | grep -i chicago
This will return the timezone format of Chicago:
Afterward, use the set-timezone flag to set the time zone using the timezone format you just searched:
That is all for changing the timezone on Ubuntu using the timedatectl command.
Difference Between GUI and timedatectl Command for Timezone in Ubuntu
While both of these methods are used to change the timezone of your Ubuntu installation, this doesn’t mean that these methods should be or could be used for every instance of Ubuntu.
The GUI method is best suited for changing the timezone on the Desktop installation of Ubuntu (Non-Server installation). Whereas the command line utility “timedatectl” can be used for Ubuntu Desktop and Ubuntu Server installation.
Affordable VPS Hosting With Dracula Servers
Dracula Servers offers high-performance server hosting at entry-level prices. The plans include Linux VPS, Sneaker Servers, Dedicated Servers & turnkey solutions. If you’re looking for quality self-managed servers with high amounts of RAM and storage, look no further.
Dracula Server Hosting is also Perfect for Hosting Telegram.Forex App with built-in support for MT4 with trade copier. Check the plans for yourself by clicking Here!
Method 3: Change Timezone on Old Versions of Ubuntu
If you are still running an older version of Ubuntu (version 16 or prior), then the above-mentioned commands might not work for you. For such Ubuntu versions, follow the below-given steps:
- Open a terminal and Execute the command “sudo dpkg-reconfigure tzdata”
- Choose your preferred region from the list inside the package configuration window that opens up.
- Select the “OK” option and press the Enter key.
- After that, select the city from the new list that pops up.
- You will receive an output confirmation on the terminal that the timezone has successfully changed.
Bonus: How to Find the Current Timezone in Ubuntu?
To check the current timezone of your Ubuntu Installation, you can use the “timedatectl” command or head inside the “Date & Time” section of the settings applications.
Alternatively, you can also use the “date” to check whether your date is correct according to your preferred time zone. And in case you want to find where the timezone list is maintained in Ubuntu. Then the file path is “/etc/timezone.”
Wrap up
Setting an accurate timezone on your Ubuntu Desktop or especially on your Ubuntu Server installation is quite crucial. There are two main methods of changing the timezone, the GUI method using the settings application and the command-line utility “timedatectl.”
Using the GUI method for Ubuntu Desktop installation and the command-line utility for Ubuntu Server installations is recommended. If these methods don’t work for an older version of Ubuntu, then you will have to change the configuration of the “tzdata” using the command mentioned above.