CompTIA Linux+ (XK0-004) — Question 178
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?
Answer options
- A. sed -f TZ=America/New_York
- B. cat TZ=America/New_York
- C. export TZ=America/New_York
- D. printf TZ=America/New_York
Correct answer: C
Explanation
The correct command is 'export TZ=America/New_York', as it sets the environment variable TZ to the desired time zone, affecting the current session. The other options do not correctly set the time zone; 'sed', 'cat', and 'printf' do not have the functionality required for changing the time zone in this context.