Skip to content

Changing the time zone in the Linux shell

Learn how to set a specific time zone for your Linux shell account using the TZ environment variable.

By default, a Linux shell uses the host server’s time zone. If you are in a different time zone, you can override this setting with TZ.

The TZ environment variable affects file and directory timestamps as well as the output of the date command. For example, to set the time zone to California:

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

To make this change permanent for future logins, add the line above to your ~/.bash_profile or ~/.bashrc file.

For a complete list of time zones, visit:
Wikipedia: List of tz database time zones