nerdexam
LPI

010-150 · Question #37

Which of the following commands can be used to determine the time of the last login of a given user?

The correct answer is C. last. The last command reads /var/log/wtmp to display a history of user logins, including timestamps, terminal, and session duration.

The Power of the Command Line

Question

Which of the following commands can be used to determine the time of the last login of a given user?

Options

  • Ashowlog
  • Brecent
  • Clast
  • Dhistory
  • Elogin

How the community answered

(28 responses)
  • B
    11% (3)
  • C
    82% (23)
  • D
    4% (1)
  • E
    4% (1)

Why each option

The last command reads /var/log/wtmp to display a history of user logins, including timestamps, terminal, and session duration.

Ashowlog

'showlog' is not a standard Linux command.

Brecent

'recent' is not a standard Linux command for querying login history.

ClastCorrect

The last command reads from the /var/log/wtmp binary log file and outputs a reverse-chronological history of user logins, logouts, and system reboots. It can be filtered by username (e.g., 'last username') to display login times and durations for a specific user, making it the correct tool for determining the last login of a given user.

Dhistory

history displays the shell command history for the current session, not user login timestamps.

Elogin

login is used to initiate a new login session interactively, not to query or display past login records.

Concept tested: last command for querying user login history

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

Topics

#last#login history#user activity#system logs

Community Discussion

No community discussion yet for this question.

Full 010-150 Practice