- **Epistemic status:** #seedlings Typically, the time zone is set during the installation of the [[Linux]] distribution, but it can easily be changed later. Having the correct timezone is essential for systems that run time sensitive tasks such as cron. The time zone is also utilized on timestamps for user logs. The typical format for time zones is "Region/city" ## Getting the time zone ### Current #### timedatectl To view the current system's time and date, we can run the following command that is a utility included on most modern system-md based [[Linux]] systems. ```shell timedatectl ``` ```output Local time: Fri 2022-02-04 14:15:11 EST Universal time: Fri 2022-02-04 19:15:11 UTC RTC time: Fri 2022-02-04 14:15:11 Time zone: America/New_York (EST, -0500) System clock synchronized: yes NTP service: active RTC in local TZ: yes ``` #### symlink Another way of getting the time zone is to view the path the symlink points: ```shell ls -l /etc/localtime ``` ```output lrwxrwxrwx. 1 root root 38 Jul 18 2021 /etc/localtime -> ../usr/share/zoneinfo/America/New_York ``` ### Available time zones To view all the available time zones, you can run the following command: ```shell timedatectl list-timezones ``` ```output ... America/Araguaina America/Argentina/Buenos_Aires America/Argentina/Catamarca America/Argentina/Cordoba America/Argentina/Jujuy America/Argentina/La_Rioja America/Argentina/Mendoza America/Argentina/Rio_Gallegos America/Argentina/Salta ... ``` ## Updating the time zone ### timedatectl To update the time zone, you can run the following command with root privileges, replacing `<your_time_zone>` with the one you wish: ```shell sudo timedatectl set-timezone <your_time_zone> ``` For example: ```shell sudo timedatectl set-timezone America/New_York ``` ### symlink Another way of changing the timezone is via symlink. The first step is to remove the current symlink or file with root privileges: ```shell sudo rm -rf /etc/localtime ``` The next step is to create the new symlink by replacing the `<region>` and `<city>` with the values you wish: ```shell sudo ln -s /usr/share/zoneinfo/<region>/<city> /etc/localtime ``` For example: ```shell sudo ln -s /usr/share/zoneinfo/America/New_York /etc/localtime ``` --- ## References - “How to Set or Change the Time Zone in Linux,” December 3, 2019. <https://linuxize.com/post/how-to-set-or-change-timezone-in-linux/>.