Which environment variable should be set in order to change the time zone for the commands run from within the environment variable’s scope? (Specify the variable name only.)

Which environment variable should be set in order to change the time zone for the commands run from within the environment variable’s scope? (Specify the variable name only.)

Answer: TZ

Explanation:

The TZ environment variable is used to change the time zone for the commands run from within the environment variable’s scope. It specifies the name of a time zone as defined in the /usr/share/zoneinfo directory or a custom time zone in the POSIX format12. The TZ variable can be set either globally in a shell profile file or locally in a shell session. For example, to set the time zone to America/New_York for the current shell session, one can use the following command: export TZ=America/New_York

To verify the change, one can use the date command to display the current date and time according to the TZ variable. The TZ variable can also be used to run a single command with a different time zone without affecting the system’s time zone. For example, to run the date command with the Asia/Tokyo time zone, one can use the following syntax: TZ=Asia/Tokyo date

The TZ variable is useful for testing how applications behave in different time zones or for displaying the time in different locations34.

Reference: How to Set or Change the Time Zone in Linux | Linuxize

Linux / UNIX: TZ Environment Variable – nixCraft

Get Current System Time Zone in Linux | Baeldung on Linux

Setting the TZ Environment Variable on Linux | InterSystems Developer

Latest 102-500 Dumps Valid Version with 194 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments