How to Change Timezone on RHEL / CentOS 7 and 8
In this article, I’m going to share how to change timezone on RHEL / CentOS 7 & 8.
Table of Contents
Check Current Timezone
Using these commands we can see the current date & time:
1. Using date
command:
Tue Jan 28 16:09:48 +06 2020
2. Using ls -l /etc/localtime
command:
lrwxrwxrwx 1 root root 32 Jan 27 15:44 /etc/localtime -> ../usr/share/zoneinfo/Asia/Dhaka
3. Using timedatectl command:
Local time: Tue 2020-01-28 16:21:31 +06
Universal time: Tue 2020-01-28 10:21:31 UTC
RTC time: Tue 2020-01-28 10:21:31
Time zone: Asia/Dhaka (+06, +0600)
System clock synchronized: no
NTP service: n/a
RTC in local TZ: no
Available Timezones
To see available time zones, we need to run command like:
# all timezones
timedatectl list-timezones
# timezones of Asia
timedatectl list-timezones | grep Asia
You’ll see the output like:
......
Asia/Dhaka
Asia/Dili
Asia/Dubai
Asia/Dushanbe
Asia/Famagusta
Asia/Gaza
......
Change Timezone
The syntax of changing timezone command is:
sudo timedatectl set-timezone your_timezone
Select your timezone from the list. To set Asia/Dhaka
, run this command:
sudo timedatectl set-timezone Asia/Dhaka
Step 4 : Change Timezone Using Symlink
If your server doesn’t work timedatectl
command, then follow this method. We need to delete localtime first:
sudo rm -rf /etc/localtime
Then set the timezone like this:
sudo ln -s /usr/share/zoneinfo/Asia/Dhaka /etc/localtime
Now check the timezone.
The article is over. Thanks for reading. ?
Comment
Preview may take a few seconds to load.
Markdown Basics
Below you will find some common used markdown syntax. For a deeper dive in Markdown check out this Cheat Sheet
Bold & Italic
Italics *asterisks*
Bold **double asterisks**
Code
Inline Code
`backtick`Code Block```
Three back ticks and then enter your code blocks here.
```
Headers
# This is a Heading 1
## This is a Heading 2
### This is a Heading 3
Quotes
> type a greater than sign and start typing your quote.
Links
You can add links by adding text inside of [] and the link inside of (), like so:
Lists
To add a numbered list you can simply start with a number and a ., like so:
1. The first item in my list
For an unordered list, you can add a dash -, like so:
- The start of my list
Images
You can add images by selecting the image icon, which will upload and add an image to the editor, or you can manually add the image by adding an exclamation !, followed by the alt text inside of [], and the image URL inside of (), like so:
Dividers
To add a divider you can add three dashes or three asterisks:
--- or ***

Comments (0)