How to change the time zone in the Linux shell

This article describes how to use the TZ environment variable to set the time zone for a shell account.

Changing the time zone in the Linux shell

By default, the Linux shell uses the host server's time zone. If you are located in a different time zone, you can change this setting by using the TZ environment variable.

A2 Hosting's servers are located in the US Eastern Standard Time (EST) time zone.

The TZ environment variable affects file and directory timestamps, as well as output from the date command. The following example shows how to set the time zone for California using the TZ environment variable:

export TZ="/usr/share/zoneinfo/America/Los_Angeles"

To make the setting take effect for subsequent logins, you can add this line to the ~/.bash_profile file or ~/.bashrc file.

  • To view all of the time zones available on a server, run the tzselect program. You can select time zones based on geographical region and country, and then set the appropriate TZ value in the ~/.bash_profile file or ~/.bashrc file.
  • For a complete list of time zones, please visit

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

Usamos cookies con el fin de personalizar para usted nuestro sitio Web y analizar el uso de éste. Usted acepta esto haciendo clic en “Acepto” o al continuar usando el sitio Web. Hay más información sobre cookies en nuestra política de privacidad.