To use the nmap
command to scan a single IP address or host, you can use the following syntax:
nmap <IP address or hostname>
For example, to scan the IP address 192.168.1.1, you would use the command:
nmap 192.168.1.1
Or to scan a hostname, for example, “example.com”, you would use the command:
nmap example.com
The nmap
command will return information about the open ports and services on the target host. By default, nmap
will perform a “SYN stealth” scan, which is less likely to be detected by firewalls and intrusion detection systems.
You can also specify the type of scan you want to run using the -sS
, -sT
, -sU
, -sA
, -sW
, -sM
, and -sN
options.
You can also specify the ports you want to scan using the -p
option, for example, to scan only ports 80 and 443 on the host “example.com” you would use the command:
nmap -p 80,443 example.com
You can also use the -oN
option to save the output to a file, for example:
nmap -oN scan_results.txt example.com
This will save the scan results to a file named scan_results.txt
in the current directory.