Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Tutorials»How to Change Timezone on CentOS & RHEL-based Systems

    How to Change Timezone on CentOS & RHEL-based Systems

    By RahulFebruary 2, 20233 Mins Read

    Time zones play a crucial role in ensuring that the system clock displays the correct time, particularly in a multi-user environment. Keeping the system time in sync with the right time zone helps to avoid confusion, reduce errors, and enhance the reliability of your systems.

    Advertisement

    In this article, we will cover the steps involved in configuring the time zone in CentOS Steam 9/8 and other RHEL-based systems, which is a popular Linux distribution used in enterprise environments.

    Before we get started, it is important to note that you will need root access to your system to perform the steps outlined in this guide.

    Step 1: View the Current Time Zone

    Before making any changes to the time zone, it’s always a good idea to check the current time zone of your system. You can do this by running the following command in your terminal:

    timedatectl 
    
    How to Change Timezone in Linux
    Check current timezone of system

    The above output showing that the current timezone is set to “Asia/Kolkata” alsoing with the current system time, date, and time zone information.

    Step 2: List Available Time Zones

    The CentOS Steam 9/8 and other RHEL-based system supports a large number of time zones, and you can view a list of all available time zones by running the following command:

    timedatectl list-timezones 
    

    This command will display a list of all the supported time zones, which you can use to determine the correct time zone for your system.

    timedatectl list-timezones | grep "America/N"
    
    How to Change Timezone in Linux
    List available timezones

    In the above output, you will get a long list of available packages. You can also filter the output with grep command.

    How to Change Timezone in Linux
    Search timezone with filter

    Step 3: Change the Time Zone

    To change the time zone in RHEL/CentOS Steam 9/8, you can use the `timedatectl set-timezone` command. For example, to change the time zone to “America/New_York”, you would run the following command:

    timedatectl set-timezone America/New_York 
    

    Its always recommended to use the universal timezone (UTC) for the servers and then manager your applications accordingly. This way its easier to handle application between cross regions and timezones.

    timedatectl set-timezone "UTC" 
    

    The above commands replaces the link for the /etc/localtime file and set them to requested timezone file available udner /usr/share/zoneinfo directory. Which you can also do manaully, instead of using the above commands. For example, to change timezone to the “America/New_York” time zone, you would run the following command:

    ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime 
    

    After running this command, the time zone change will persist across reboots.

    Step 4: Verify the Change

    After changing the time zone, you can verify the change by running the timedatectl command again. The output should display the updated time zone information.

    timedatectl 
    

    You should see the updated timezone.

    How to Change Timezone in Linux
    Check timezone after change

    Conclusion

    In conclusion, configuring the time zone in CentOS Steam 9/8 other RHEL-based systems is a straightforward process that can be performed by following these simple steps. Keeping the system time in sync with the correct time zone helps to enhance the reliability of your systems and avoid confusion.

    date localtime time timezone
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Setting and Getting the Default Timezone in Python

    Converting UTC Date and Time to Local Time in Linux

    What are the difference between SH and BASH

    What are the difference between SH and BASH?

    View 5 Comments

    5 Comments

    1. James M on May 22, 2019 5:15 pm

      Wonderful. I have been looking for this. Too many variations of Linux. Hard to find the commands sometimes.

      Thanks for sharing

      Site added to my list 🙂

      Reply
    2. Larry Ellison on October 27, 2017 4:17 pm

      Dude!!! You are man! Full of balls !

      Reply
    3. vikas sharma on August 28, 2017 1:26 pm

      Hi i have two question
      1. i want to update my server time without NTP
      2. i want to delete specifics files from the server
      for eg :- in my system files from 1 march 2017, i want to delete files only specific period of time,means
      i want my files from date 04.06.2017 till today.but won’t delets files that is store or are older than
      03.06.2017.

      Reply
    4. Hari on July 29, 2017 3:37 pm

      Yes, this worked. Many thanks!

      Reply
    5. Isaac on May 23, 2017 1:06 pm

      Thank You, Sir!

      To check if you have RHEL 6 or 7 to use the awesome timedatectl command you can execute uname – r.
      Else the primitive way is also ok with more than a single step.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Setting and Getting the Default Timezone in Python
    • What is Media Access Control (MAC) Address?
    • What is Cross-Site Scripting (XSS)?
    • What is Content Security Policy (CSP)?
    • A User’s Guide to Understanding Redirection Operators in Bash
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.