> For the complete documentation index, see [llms.txt](https://riteshs4hu.gitbook.io/infosec-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://riteshs4hu.gitbook.io/infosec-notes/reconnaissance/active-reconnaissance-approach/nmap/os-detection.md).

# OS Detection

Nmap’s **OS detection** feature is determining the operating system running on a target system.

Below are various ways to use Nmap’s OS detection feature:

**1. Basic OS Detection**

```bash
nmap -O 192.168.1.1
```

```bash
nmap -vv -sT -O -p- 192.168.1.1/24
```

```bash
nmap -v -O example.com -oA <filename>
```

These commands perform OS detection on the specified target, providing details about the operating system running on the system.

**2. Limit OS Detection**

```bash
nmap -O --osscan-limit 192.168.1.0/24
```

This command scans the network `192.168.1.0/24` and restricts OS detection to **promising targets**. It is particularly useful when scanning a large number of systems, reducing scan time by skipping hosts that are unlikely to return useful results.

**3. Aggressive OS Detection**

```bash
nmap -O --osscan-guess 192.168.1.1
```

This command scans the IP address `192.168.1.1` and aggressively guesses the operating system. This option is helpful when the target system’s OS is hidden or intentionally obfuscated.

**4. Advanced OS Detection**

```bash
nmap -A 192.168.1.1
```

This command enables **OS detection, version detection, script scanning, and traceroute** for the IP address `192.168.1.1`. It is useful for conducting a **comprehensive** analysis of the target system.
