nerdexam
LPI

010-100 · Question #13

You enter the command date +%M. Wat does the output show you?

The correct answer is D. the current minute. The date command uses format specifiers to display specific time components. The %M specifier outputs the current minute.

The Power of the Command Line

Question

You enter the command date +%M. Wat does the output show you?

Options

  • Athe current year
  • Bthe current month
  • Cthe current hour
  • Dthe current minute
  • Ethe current second

How the community answered

(46 responses)
  • A
    9% (4)
  • C
    4% (2)
  • D
    85% (39)
  • E
    2% (1)

Why each option

The date command uses format specifiers to display specific time components. The %M specifier outputs the current minute.

Athe current year

The year is represented by %Y (four-digit) or %y (two-digit), not %M.

Bthe current month

The month is represented by %m (numeric) or %B (full name), not %M.

Cthe current hour

The hour is represented by %H (24-hour) or %I (12-hour), not %M.

Dthe current minuteCorrect

In the date command, %M is the format specifier for the current minute (00-59). The format string +%M tells date to output only the minute component of the current time, not the full date or other time fields.

Ethe current second

The second is represented by %S, not %M.

Concept tested: Linux date command format specifiers

Source: https://man7.org/linux/man-pages/man1/date.1.html

Topics

#date command#format specifiers#time output#shell commands

Community Discussion

No community discussion yet for this question.

Full 010-100 Practice