nerdexam
CompTIA

220-1002 · Question #682

A user is trying to find a file that contains a specific string on a Linux workstation. The user locates the file and then needs to navigate fo another directory to work with it. Which of the…

The correct answer is A. grep F. cd. Two tasks are required: (1) search file contents for a specific string, and (2) navigate to a different directory. grep (A) is the standard Linux command for searching file contents using patterns or plain strings - for example, 'grep "search term" /path/to/files' returns files…

Hardware

Question

A user is trying to find a file that contains a specific string on a Linux workstation. The user locates the file and then needs to navigate fo another directory to work with it. Which of the following commands should the user enter to accomplish both of these tasks? (Select TWO).

Options

  • Agrep
  • Bchmod
  • C=rm
  • Dpwd
  • Esudo
  • Fcd

How the community answered

(38 responses)
  • A
    92% (35)
  • B
    5% (2)
  • C
    3% (1)

Explanation

Two tasks are required: (1) search file contents for a specific string, and (2) navigate to a different directory. grep (A) is the standard Linux command for searching file contents using patterns or plain strings - for example, 'grep "search term" /path/to/files' returns files and lines that contain the match. cd (F) is the command used to change the current working directory, allowing the user to navigate to the target directory. chmod (B) changes file permissions. rm (C) deletes files. pwd (D) prints the current working directory (useful for orientation but not navigation). sudo (E) elevates privileges but is not a navigation or search command on its own.

Topics

#Linux commands#grep#file search#directory navigation

Community Discussion

No community discussion yet for this question.

Full 220-1002 Practice