nerdexam
CompTIA

XK0-005 · Question #10310

A systems administrator wants to list all local accounts in which the UID is greater than 500. Which of the following commands will give the correct output?

The correct answer is C. awk -F: '$3 > 500 {print $1}' /etc/passwd. The correct command to list all local accounts in which the UID is greater than 500 is: awk -F: '$3 > 500 {print $1}' /etc/passwd This command uses awk to process the /etc/passwd file, which contains information about the local users on the system. The -F: option specifies that…

System Management

Question

A systems administrator wants to list all local accounts in which the UID is greater than 500. Which of the following commands will give the correct output?

Options

  • Afind /etc/passwd -size +500
  • Bcut -d: -f1 /etc/passwd > 500
  • Cawk -F: '$3 > 500 {print $1}' /etc/passwd
  • Dsed '/UID/' /etc/passwd < 500

How the community answered

(21 responses)
  • A
    5% (1)
  • B
    10% (2)
  • C
    81% (17)
  • D
    5% (1)

Explanation

The correct command to list all local accounts in which the UID is greater than 500 is: awk -F: '$3 > 500 {print $1}' /etc/passwd This command uses awk to process the /etc/passwd file, which contains information about the local users on the system. The -F: option specifies that the fields are separated by colons. The $3 refers to the third field, which is the UID. The condition $3 > 500 filters out the users whose UID is greater than 500. The action {print $1} prints the first field, which is the username.

Topics

#awk command#User management#/etc/passwd#Text processing

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice