How to change time zone from command line on RHEL 7 ?

How to change time zone from command line on RHEL 7 ?

Environment

  • Red Hat Enterprise Linux 7

Issue

  • How to change time zone from command line on RHEL 7 ?

Resolution

On RHEL7,there is a different way for us to change time zone.
  1. Find the desired time zone with the below command or we can use the command "tzselect" to find the desired time zone..Let's make "Asia/Shanghai" as an example.
    # timedatectl list-timezones
    
  2. Change the time zone.
    # timedatectl set-timezone Asia/Shanghai
    
  3. Verify the status of time zone.
    # timedatectl status
    

Root Cause

timedatectl is a new feature on RHEL7. It may be used to query and change the system clock and its settings. See more at man timedatectl or Changing the Time Zone

No comments: