LFCS practice question 3 of 35

Which of the following tasks can be accomplished using the command date? (Choose TWO correct answers.)

Full set: 260 questions
Answer options
A: Synchronize the hardware and system clocks.
B: Output date and time in different formats. Correct answer
C: Set the system clock. Correct answer
D: Set the hardware clock.
E: Update the time via NTP.
Correct Answer:
B. Output date and time in different formats.; C. Set the system clock.
Explanation

The date command is a standard utility for displaying and setting the system's date and time. It can format the output in numerous ways using the +FORMAT specifier (e.g., date +"%Y-%m-%d"). With appropriate privileges (typically root), it can also set the system clock using the -s or --set option (e.g., date -s "2 JAN 2023 18:00:00"). It does not, however, interact directly with the hardware clock or manage NTP synchronization, which are handled by other specialized tools like hwclock and chronyd/ntpd.

Why Incorrect

A. Synchronizing the hardware and system clocks is done with hwclock or timedatectl, not date.
D. Setting the hardware clock is the responsibility of the hwclock or timedatectl commands.
E. NTP synchronization is managed by daemons like ntpd or chronyd, not the date command.

References

- date(1) manual page. In the DESCRIPTION section, it states, "Display the current time in the given FORMAT, or set the system date." It details the +FORMAT controls and the -s, --set=STRING option. (Source: GNU Coreutils documentation, available via man date on any standard Linux system).

- Red Hat Enterprise Linux 8 Documentation, "Configuring basic system settings", Section 4.5. "Configuring the date and time". This section describes using timedatectl for most modern tasks but acknowledges the use of date for setting the system time.

Scroll to Top