LFCS · 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. Setting the system-wide timezone involves configuring the /etc/localtime file, typically by creating a symbolic link to a timezone definition 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
(24 responses)- A4% (1)
- B92% (22)
- D4% (1)
Why each option
Setting the system-wide timezone involves configuring the `/etc/localtime` file, typically by creating a symbolic link to a timezone definition file.
Simply echoing 'UTC' into `/etc/timezone` might be part of a simpler method on some systems, but it doesn't configure the actual timezone data used by the system comprehensively.
To set the system-wide timezone, a symbolic link is created from the specific timezone data file (e.g., `/usr/share/zoneinfo/UTC`) to `/etc/localtime`. This `localtime` file is then read by applications and services to determine the current local time.
`date --timezone=UTC` will display the current date and time in UTC, but it does not permanently set the system's timezone.
Moving files from `/usr/share/zoneinfo/UTC` to `/etc` is incorrect and would likely break the timezone configuration, as `/etc/localtime` expects a specific file or symlink from `/usr/share/zoneinfo`.
Concept tested: Setting system timezone to UTC
Source: https://man7.org/linux/man-pages/man5/localtime.5.html
Topics
Community Discussion
No community discussion yet for this question.