LX0-104 · Question #47
Which of the following tasks can be accomplished using the command date? (Choose TWO correct answers.)
The correct answer is B. Output date and time in different formats. C. Set the system clock.. The date command can output the current system date and time in various specified formats and also allows an administrator to set the system clock to a desired date and time. It provides direct control over the system's software clock.
Question
Options
- ASynchronize the hardware and system clocks.
- BOutput date and time in different formats.
- CSet the system clock.
- DSet the hardware clock.
- EUpdate the time via NTP.
How the community answered
(30 responses)- B90% (27)
- D7% (2)
- E3% (1)
Why each option
The `date` command can output the current system date and time in various specified formats and also allows an administrator to set the system clock to a desired date and time. It provides direct control over the system's software clock.
The `date` command itself does not synchronize the hardware and system clocks. Tools like `hwclock` are used for that specific task.
The `date` command supports various format specifiers (e.g., `date +%Y-%m-%d`) allowing users to customize the output of the date and time string. This is a core feature of the command for display purposes.
The `date` command, when run with appropriate arguments (e.g., `date -s 'YYYY-MM-DD HH:MM:SS'`), can be used by a privileged user to manually set the system clock (software clock) to a specific date and time.
While `date` sets the system clock, it does not directly set the hardware clock (RTC). `hwclock` is the utility used to read from or write to the hardware clock.
The `date` command is for displaying or manually setting the system clock; it does not have functionality to automatically update the time via Network Time Protocol (NTP). NTP synchronization is handled by services like `ntpd` or `chronyd`.
Concept tested: date command functionality
Source: https://linux.die.net/man/1/date
Topics
Community Discussion
No community discussion yet for this question.