102-500 practice question 2 of 30

Which command will set the local machine's timezone to UTC?

Full set: 233 questions
Answer options
A: cat UTC > /etc/timezone
B: ln -s /usr/share/zoneinfo/UTC /etc/localtime Correct answer
C: date --timezone=UTC
D: mv /usr/timezone/UTC /etc
Correct Answer:
B. ln -s /usr/share/zoneinfo/UTC /etc/localtime
Explanation

The standard, persistent method for setting the system-wide timezone on most Linux systems is to manage the /etc/localtime file. This file is typically a symbolic link to a specific timezone data file located in the /usr/share/zoneinfo/ directory. The command ln -s /usr/share/zoneinfo/UTC /etc/localtime creates this link, pointing to the file for Coordinated Universal Time (UTC). System services and applications read /etc/localtime to determine the correct local time.

Why Incorrect

A: This command modifies /etc/timezone, a helper file on some systems (like Debian), but it is not the primary or universal mechanism for setting the system time. C: The date command only displays the time in a specified timezone for that single command's execution; it does not change the system's persistent configuration. D: The standard path is /usr/share/zoneinfo, not /usr/timezone. Furthermore, a symbolic link is the correct method, not moving the file.

References

man 5 localtime: "The /etc/localtime file configures the system-wide timezone... It is normally a symbolic link to a file in the timezone database under /usr/share/zoneinfo."

Red Hat Enterprise Linux 9 Documentation, "Configuring basic system settings", Section 3.6. "Configuring the time zone". This section explains that tools like timedatectl manage the /etc/localtime symbolic link.

Arch Linux Wiki, "System time", Section "Time zone". The documentation explicitly states the standard procedure: # ln -sf /usr/share/zoneinfo/Region/City /etc/localtime.

Scroll to Top