Timezone Change/Updated for Linux/Unix Debian/Fedora/Ubuntu/Centos Change Update Time zone

In Newer Linux Distros This Way Is Easiest and works on newer versions like Ubuntu, Mint, Fedora, Centos, Debian etc.

#if you are missing  timedatectl this in newer distros like Ubuntu/Mint/Debian and are using a container like Docker then do "apt install systemd"

timedatectl set-timezone America/Vancouver

Replace the America/Vancouver with the correct timezone.

To see the list you can just type "timedatectl set-timezone " and hit tab twice.

 

This way should work on all Linux machines, at least RHEL/Debian (Ubuntu) based distros but most likely all and also should work on many Unix style machines I believe.

Many OS's have tools to update the timezone, but most of them (even if command line) require several bloated packages and even Xorg/KDE based packages etc..

Your time zone info file is actually in /etc/localtime if you open this file in vi/vim/pico you'll see it's gibberish (binary code or another encoding).

Anyway that is the information for your timezone.

Note that all timezone information is stored in the following directory:

ls /usr/share/zoneinfo/

Africa      Atlantic   Chile    Eire     Factory  GMT-0      Iceland      Jamaica    Mexico   NZ        posix       ROC        Universal  zone.tab
America     Australia  CST6CDT  EST      GB       GMT+0      Indian       Japan      Mideast  NZ-CHAT   posixrules  ROK        US         Zulu
Antarctica  Brazil     Cuba     EST5EDT  GB-Eire  Greenwich  Iran         Kwajalein  MST      Pacific   PRC         Singapore  UTC
Arctic      Canada     EET      Etc      GMT      Hongkong   iso3166.tab  Libya      MST7MDT  Poland    PST8PDT     Turkey     WET
Asia        CET        Egypt    Europe   GMT0     HST        Israel       MET        Navajo   Portugal  right       UCT        W-SU


Inside one of those subdirectdories will be the file with your zone information.

For example the Pacific Standard time I use is located in: /usr/share/zoneinfo/Canada/Pacific

There are two ways to change your timezone, you can copy the contents of your timezone file into /etc/localtime or remove your localtime file and symlink to the new timezone.

Best Way To Update Timezone

#If you are missing /usr/share/zoneinfo then install the "tzdata" package.

I think to keep the existing format (no symlink and a physical file), this is the best way:


cat /usr/share/zoneinfo/Canada/Pacific > /etc/localtime

This just overwrites/updates your /etc/localtime file.  For more advanced users you could just delete /etc/localtime and instead symlink to that file (same results but different method):

rm /etc/localtime

ln -s /usr/share/zoneinfo/Canada/Pacific /etc/localtime

Now just type date and you'll see your timezone has been updated.

 


Tags:

timezone, updated, linux, unix, debian, fedora, ubuntu, centos, update, zonethis, rhel, distros, os, bloated, packages, xorg, kde, etc, info, localtime, vi, vim, pico, ll, gibberish, binary, encoding, stored, directory, ls, usr, zoneinfo, chile, eire, factory, gmt, iceland, jamaica, nz, posix, roc, universal, tab, australia, cst, cdt, est, gb, japan, mideast, posixrules, rok, zulu, antarctica, brazil, cuba, edt, greenwich, iran, kwajalein, mst, pacific, prc, singapore, utc, arctic, eet, hongkong, iso, libya, mdt, poland, pst, pdt, asia, cet, egypt, hst, israel, navajo, portugal, uct, su, subdirectdories, located, contents, symlink, existing, format, overwrites, updates, advanced, users, delete, method, rm, ln,

Latest Articles

  • python mysql install error: /bin/sh: 1: mysql_config: not found /bin/sh: 1: mariadb_config: not found /bin/sh: 1: mysql_config: not found mysql_config --version
  • FreePBX 17 How To Add a Trunk
  • Docker Container Onboot Policy - How to make sure a container is always running
  • FreePBX 17 How To Add Phones / Extensions and Register
  • Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes. solution
  • Cisco How To Use a Third Party SIP Phone (eg. Avaya, 3CX)
  • Cisco Unified Communication Manager (CUCM) - How To Add Phones
  • pptp / pptpd not working in DD-WRT iptables / router
  • systemd-journald high memory usage solution
  • How to Install FreePBX 17 in Linux Debian Ubuntu Mint Guide
  • How To Install Cisco's CUCM (Cisco Unified Communication Manager) 12 Guide
  • Linux Ubuntu Redhat How To Extract Images from PDF
  • Linux and Windows Dual Boot Issue NIC Won't work After Booting Windows
  • Cisco CME How To Enable ACD hunt groups
  • How to install gns3 on Linux Ubuntu Mint
  • How to convert audio for Asterisk .wav format
  • Using Cisco CME Router with Asterisk as a dial-peer
  • Cisco CME How To Configure SIP Trunk VOIP
  • Virtualbox host Only Network Error Failed to save host network interface parameter - Cannot change gateway IP of host only network
  • Cisco CME and C7200 Router Testing and Learning Environment on Ubuntu 20+ Setup Tutorial Guide