XK0-005 · Question #168
A Linux administrator looks at the /etc/timezone file and determines the need to change the time zone from California to New York temporarily. Which of the following commands will accomplish this?
The correct answer is C. export TZ=America/New_York. The administrator needs to temporarily change the timezone for the current shell session to New York without affecting the system-wide configuration.
Question
A Linux administrator looks at the /etc/timezone file and determines the need to change the time zone from California to New York temporarily. Which of the following commands will accomplish this?
Options
- Ased -f TZ=America/New_York
- Bcat TZ=America/New_York
- Cexport TZ=America/New_York
- Dprintf TZ=America/New_York
How the community answered
(33 responses)- A6% (2)
- B15% (5)
- C70% (23)
- D9% (3)
Why each option
The administrator needs to temporarily change the timezone for the current shell session to New York without affecting the system-wide configuration.
`sed -f TZ=America/New_York` is syntactically incorrect for setting an environment variable; `sed` is a stream editor used for text transformation based on scripts or expressions.
`cat TZ=America/New_York` would attempt to display the contents of a file named 'TZ=America/New_York', which is not how environment variables are set or modified.
The `TZ` environment variable controls the timezone setting for the current shell session and any processes launched from it. Using `export TZ=America/New_York` temporarily overrides the system's default timezone, ensuring that time-related commands reflect the New York timezone only in that session.
`printf TZ=America/New_York` would simply print the literal string 'TZ=America/New_York' to standard output, without setting any environment variable.
Concept tested: Temporarily setting timezone using environment variables
Source: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_time_using_chrony#s2-setting-the-timezone-manual
Topics
Community Discussion
No community discussion yet for this question.