Prepare for the CompTIA PenTest+ Exam. Enhance your skills with practice questions and detailed explanations. Ace your test and advance your cybersecurity career!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What is the purpose of using the Nmap command "nmap -oG"?

  1. Create a JSON output file

  2. Generate grepable output to a file

  3. Perform a graphical output scan

  4. Save the scan in XML format

The correct answer is: Generate grepable output to a file

Using the Nmap command with the option "nmap -oG" serves the purpose of generating grepable output, which allows users to easily parse the results with text processing tools. This output format is designed to be machine-readable so that data can be quickly searched and filtered using commands like `grep`. This is particularly useful for penetration testers and system administrators who need to sift through scan results efficiently for specific information, like open ports or service details. The grepable format is structured in a way that highlights the most critical elements of the scan, such as IP addresses and their corresponding statuses, making it convenient for scripting and automation. This approach enhances workflow when dealing with large sets of scan results. Options that reference JSON output, graphical scans, or XML formats represent different ways Nmap can present data, but they do not align with the purpose of the "nmap -oG" command. The correct output option facilitates the need for simplicity and speed when analyzing scan data.