LX0-104 · Question #234
Which of the following commands will set the local machine's timezone to UTC?
The correct answer is B. ln -s /usr/share/zoneinfo/UTC /etc/localtime. To permanently configure a Linux system's timezone to UTC, a symbolic link should be created from /etc/localtime to the UTC timezone data file.
Question
Options
- Acat UTC > /etc/timezone
- Bln -s /usr/share/zoneinfo/UTC /etc/localtime
- Cdate --timezone=UTC
- Dmv /usr/timezone/UTC /etc
How the community answered
(18 responses)- A6% (1)
- B89% (16)
- C6% (1)
Why each option
To permanently configure a Linux system's timezone to UTC, a symbolic link should be created from `/etc/localtime` to the `UTC` timezone data file.
While some systems may read `/etc/timezone`, directly writing `UTC` to it is not the universal or most robust method across all Linux distributions and might not update the effective timezone.
In many Linux distributions, setting the system timezone involves creating a symbolic link from `/etc/localtime` to the desired timezone file, such as `/usr/share/zoneinfo/UTC`, which sets the local time to Coordinated Universal Time.
`date --timezone=UTC` only displays the current date and time in UTC format; it does not change the system's persistent timezone setting.
`/usr/timezone` is not a standard directory for timezone files, and moving files to `/etc` in this manner is incorrect for setting the system timezone.
Concept tested: Linux timezone configuration
Source: https://man7.org/linux/man-pages/man5/localtime.5.html
Topics
Community Discussion
No community discussion yet for this question.