CompTIA Linux+ XK0-006 (V8) Practice Question

A system administrator needs to analyze /var/log/secure for failed login attempts. For every line containing "Failed password", the administrator must extract and display only the timestamp (e.g., "Jul 31 10:45:01") and the source IP address from which the attempt originated. A sample log entry is:

Jul 31 10:45:01 server sshd: Failed password for root from 203.0.113.55 port 12345 ssh2

Which of the following commands is the most effective and reliable for this task?

  • grep "Failed password" /var/log/secure | awk '{print $1, $2, $3, $11}'

  • grep "Failed password" /var/log/secure | cut -d' ' -f1-3,11

  • sed -n '/Failed password/p' /var/log/secure

  • awk '/Failed password/ {print $0}' /var/log/secure

CompTIA Linux+ XK0-006 (V8)
System Management
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

Bash, the Crucial Exams Chat Bot
AI Bot