Which is the correct syntax to scan ports in a range from 1 to 20?

Prepare for the Nmap and ZenMap Tests. Access flashcards and multiple choice questions, with hints and explanations for each question. Ensure success in your exam!

Multiple Choice

Which is the correct syntax to scan ports in a range from 1 to 20?

Explanation:
To scan a specific port range in Nmap, you use the -p option followed by a start-end range, and both ends are inclusive. Scanning ports 1 through 20 is done with -p 1-20. Port numbers start at 1; 0 is not a valid port, so -p 0-20 would be inappropriate. Including 21 would extend the range beyond the requested upper bound, and starting at 2 would miss port 1. In general, valid ports go from 1 to 65535, so -p 1-20 correctly targets exactly the first twenty ports.

To scan a specific port range in Nmap, you use the -p option followed by a start-end range, and both ends are inclusive. Scanning ports 1 through 20 is done with -p 1-20. Port numbers start at 1; 0 is not a valid port, so -p 0-20 would be inappropriate. Including 21 would extend the range beyond the requested upper bound, and starting at 2 would miss port 1. In general, valid ports go from 1 to 65535, so -p 1-20 correctly targets exactly the first twenty ports.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy