nerdexam
CompTIA

XK0-005 · Question #365

Joe, a system administrator, realizes that the time zone on a system is different than his local time zone. Joe runs the command export Tz-America .Chicago to resolve this. However the next Joe logs…

The correct answer is C. Add the export Tz=America/Chicage command to the bash_profile file. To persistently set a user's time zone across login sessions, the export TZ=America/Chicago command should be added to the user's ~/.bash_profile file.

System Management

Question

Joe, a system administrator, realizes that the time zone on a system is different than his local time zone. Joe runs the command export Tz-America .Chicago to resolve this. However the next Joe logs in, Joe notices the issue has returned. Which of the following is the BEST way for Joe to fix this issue so the solution persists across logins?

Options

  • ARun the export Tz=/etc/localtime command
  • BSet the correct the zone with the date command.
  • CAdd the export Tz=America/Chicage command to the bash_profile file.
  • DRun the export LC ALL=America/Chicago command

How the community answered

(23 responses)
  • A
    4% (1)
  • B
    4% (1)
  • C
    78% (18)
  • D
    13% (3)

Why each option

To persistently set a user's time zone across login sessions, the `export TZ=America/Chicago` command should be added to the user's `~/.bash_profile` file.

ARun the export Tz=/etc/localtime command

`export TZ=/etc/localtime` attempts to set the `TZ` variable to a file path, which is not the correct format for specifying a time zone name (e.g., `America/Chicago`).

BSet the correct the zone with the date command.

The `date` command displays or sets the system's date and time, but it does not configure the system's default time zone or persistently set the user's `TZ` environment variable.

CAdd the export Tz=America/Chicage command to the bash_profile file.Correct

Environment variables set using the `export` command are only valid for the current shell session. To make an environment variable like `TZ` persistent across all future login sessions, it must be added to a shell initialization script such as `~/.bash_profile` (for login shells), which is executed every time the user logs in, ensuring the time zone is correctly set.

DRun the export LC ALL=America/Chicago command

`LC_ALL` is an environment variable used to set all locale categories (like language, currency), but `TZ` is the correct variable specifically for setting the time zone.

Concept tested: Linux environment variables; Persistent configuration; Timezone settings

Source: https://www.gnu.org/software/bash/manual/bash.html#Bash-Startup-Files

Topics

#Environment Variables#Shell Configuration#User Profiles#Time Zones

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice