How to Set or Change Time Zone in Linux – Linux Tips and Tricks

HomeOther ContentHow to Set or Change Time Zone in Linux – Linux Tips and Tricks
How to Set or Change Time Zone in Linux – Linux Tips and Tricks
How to Set or Change Time Zone in Linux – Linux Tips and Tricks
Learn how to set or change the time zone in Linux (using the BASH command).

Changing the Linux system time and date is relatively simple, but changing the time zone is a bit complicated. Let me explain…

Changing the time zone in Linux is a simple process that involves a few simple commands. First, you need to use the “timedatectl” command in the terminal to determine the current time zone. Subsequently, you can change the time zone using the 'timedatectl set-timezone' command, followed by the desired time zone. To illustrate, to change the time zone to "America/Los_Angeles", you would type "timedatectl set-timezone America/Los_Angeles" in the terminal. However, it is essential to note that knowledge of the time zone name is necessary to change it. However, some may prefer to work with numbers. If so, the following video shows how to change the time zone using time difference.

Commands shown in this video

Get system date and time details
timedatectl

Changeg system time zone using zone name
sudo timedatectl set-timezone Europe/Moscow

List of all time zones with -0700
for tz in cat /usr/share/zoneinfo/zone.tab awk '{print 3}'; do TZtz date /"tz %Z %::z/"; does grep — -07:00

First time zone in the list with -0700
for tz in cat /usr/share/zoneinfo/zone.tab awk '{print 3}'; do TZtz date /"tz %Z %::z/"; done grep — -07:00 head -1 cut -f1 -d '"

Change time zone using time difference (-0700)
tzone(for tz in cat /usr/share/zoneinfo/zone.tab awk '{print 3}'; do TZtz date /"tz %Z %::z/"; done grep — -07:00 head -1 cut -f1 -d ' '); sudo timedatectl set-timezone tzone

To disable NTP, use this command.
sudo timedatectl set-ntp false

#linux #ubuntu #redhat #bash

Please take the opportunity to connect and share this video with your friends and family if you find it useful.

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *