Set or Change Timezone on CentOS 7
In this tutorial, we will learn how to set or change timezone on CentOS 7. Let’s follow these steps:
Table of Contents
Step 1 : Prerequisites
At first, we need to login to our server via SSH as root. Open your terminal and run this command:
ssh [email protected] -p PORT
Step 1 : Check Current Timezone
Let’s run this command to know the current system’s timezone.
timedatectl
You’ll see the output like this:
Local time: Wed 2019-08-21 23:09:07 +06
Universal time: Wed 2019-08-21 17:09:07 UTC
RTC time: Wed 2019-08-21 17:09:06
Time zone: Asia/Dhaka (+06, +0600)
NTP enabled: n/a
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
Step 3 : Change Timezone
The syntax of changing timezone command is:
sudo timedatectl set-timezone your_desired_time_zone
To see all available time zones, run this command:
timedatectl list-timezones
Output:
......
Asia/Dhaka
Asia/Dili
Asia/Dubai
Asia/Dushanbe
Asia/Famagusta
Asia/Gaza
......
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)