Discover how Nmap formats and saves scan results. -oN gives human-readable text, -oX produces XML, -oG creates grepable output, and -oA saves all formats with a shared basename. This helps you tailor data for scripts, reporting, or quick review.

Multiple Choice

What are the differences between -oN, -oX, -oG, and -oA output options in Nmap?

Output options in Nmap specify both the format and where the results go. The normal format is the familiar human-readable text, best for quick reading. XML is a structured, machine-friendly format that’s easy to parse with scripts and programs. The grepable format is a compact, line-oriented text designed for simple extraction with tools like grep, awk, or sed. The all-formats option writes all three formats at once using a single basename, giving you both human-friendly and machine-readable files without needing to run separate scans. So, -oN produces normal text, -oX produces XML, -oG produces grepable text, and -oA outputs all formats. The other descriptions mix up formats (JSON, CSV, HTML) which aren’t produced by these switches, and -oN doesn’t inherently prevent you from creating other outputs if you also specify them.

If you’ve ever spun up a quick network assessment with Nmap, you’ve probably noticed that the tool isn’t just about “scan and done.” It’s a tiny Swiss Army knife that can spit out results in different formats, depending on what you plan to do next. The output switches -oN, -oX, -oG, and -oA are your gateway to making results work for you, not just sit there textually on the screen. Let’s break down what each one does, why you might pick one over another, and how they fit into a natural workflow—without getting lost in the weeds.

A quick map of the formats

Think of Nmap’s output options as choosing the lane you want your results to follow after the scan finishes. Each switch attaches a format to a basename—so you end up with files named something like scan.txt, scan.xml, scan.gnmap, or scan as a collection that includes all of them.

  • -oN: Normal human-readable output

  • -oX: XML output

  • -oG: Grepable output

  • -oA: All formats (a combination of the above, written at once)

What each format actually gives you

Let me explain what you’ll see in each format and why it matters.

  • Normal output (-oN)

This is the old friend you’ve read on the screen during a run. It’s straightforward, readable, and great for quick human scanning. You get host status, open ports, basic service names, and a concise summary. It’s the “can I reach this host and what did I learn from the ports?” snapshot. If you’re jotting notes for a quick whiteboard session or just checking things live, normal output is your familiar companion.

  • XML output (-oX)

XML is a structured, machine-friendly format. It’s not the most visually friendly at first glance, but it’s a dream for automation. If you’re piping results into a script, or feeding them into a larger pipeline, XML makes it possible to parse data consistently, validate it, or feed it into other tools that expect a structured document. Think of XML as the well-behaved data format that plays nicely with software.

  • Grepable output (-oG)

The grepable format is a compact, line-oriented text format designed with extraction in mind. It’s light on noise and easy to filter with traditional text-processing tools like grep, awk, or sed. If you’re trying to drill down into a long scan to pull out, say, all hosts with port 22 open, grepable output helps you do that quickly without wrestling with more verbose formats.

  • All formats (-oA)

This is the “trust me, you’ll want everything” option. It writes all three formats in parallel using a common basename. You get the human-friendly text, the XML, and the grepable file—all at once. It’s incredibly convenient if you’re starting your workflow and you’re not sure which format you’ll need down the line. You can always point the right script or tool at the appropriate file later.

When you’d pick each option in real life

In practice, you don’t choose a single format just for one scan and call it a day. Your choice often depends on what comes next.

  • Quick checks and collaboration

If you’re sharing results with teammates who want a readable summary, or you’re presenting findings in a meeting, -oN is perfectly fine. It gives a clear, digestible view without extra friction.

  • Automation and integration

If your goal is to automate post-scan processing or feed results into another tool, -oX tends to be the most versatile starting point. XML’s structured nature lets scripts parse fields like host, port, service, and state reliably. It’s also widely supported by many security tools and NSE scripts that expect a consistent data model.

  • Lightweight data extraction

If you’re doing quick filtering on a workstation—pulling out a list of hosts with a certain port open, for example—the -oG format shines. It’s easy to pipe into grep-like workflows, do quick comparisons, or plug into dashboards that monitor port exposure over time.

  • Backups and flexibility

-oA is a time-saver when you want to keep a complete, ready-to-use archive of results in multiple formats. It means you don’t have to rerun a scan later just to get a different format. Everything you need is available under one basename.

A few practical tips to get the most out of these options

  • Consistency matters

  • Combine formats thoughtfully

  • Don’t rely on a single format for everything

Consistency matters

If you plan to automate, pick an approach and stick with it for a while. It makes your pipelines predictable. For example, if you’re building a small dashboard, you might standardize on -oX because XML can be parsed cleanly inside your scripts, then optionally generate a human-friendly summary from the XML later for a quick review.

Combine formats thoughtfully

If you don’t want to commit early to a single format, using -oA gives you the best of both worlds without extra runs. From there, you can decide which format to wire into which process. And if you’re curious about something you’ve scanned, you can always refer back to the human-readable -oN or pull data from the XML later.

Don’t rely on a single format

Relying on one format can trip you up if your downstream consumer changes its expectations. For instance, if your parser in a script assumes an XML structure but you only generated -oN, you’ll have to adjust. Keeping a multi-format archive can save you a lot of head-scratching later on.

A quick note on how the outputs behave with multiple runs

It’s tempting to assume that the normal output alone would “disable” other outputs, but that isn’t how it works. Each -o flag writes its own files to disk alongside any existing ones. If you run multiple scans with -oN and -oX, you’ll end up with multiple sets of files named after their respective basenames. If you want to keep things tidy, pick a unique basename for each run, like scan-day1 or project-alpha, then you’ll have a clean trail of results.

A glance at a practical workflow

Let’s walk through a simple, realistic scenario that keeps everything smooth and clear.

  • Step 1: Do a quick discovery pass

Run a fast scan with a readable footprint and capture -oN to share with the team. This gives you a friendly snapshot to discuss in a stand-up or quick review.

  • Step 2: Prepare for automation

Run the same scan with -oX so you’ve got a machine-friendly record ready for parsing. This is especially useful if you’re turning data into a report or feeding it into a monitoring system.

  • Step 3: Enable lightweight data filtering

If you want to do a quick grep-based audit of open SSH on the network, add -oG to your mix — or simply rely on -oA to bundle all of them and pick the right file later.

  • Step 4: Archive for long-term reference

Use -oA to produce a complete, future-proof set of results with one command. You’ll have human-readable notes, XML-based data for automation, and a grepable log for quick offline analysis.

Some common pitfalls to avoid

  • Don’t assume one format covers all you’ll ever need. A little foresight saves time later.

  • Don’t forget to give your files meaningful basenames. A well-chosen name makes your life easier when you return to the data after days or weeks.

  • Don’t overload networks with excessive scanning. The best results come from thoughtful pacing and clear objectives.

A few words on practice and philosophy

The moment you start treating output formats as part of your workflow rather than as an afterthought, you unlock a calmer, more efficient way to work. It’s like writing a research note vs. scribbling ideas on a napkin. The notebook of choices you make here will show up later when you’re trying to build a narrative from the data—telling a story about what’s exposed, what’s quiet, and where the action is.

Tying it all back to everyday tech life

If you’re into scripting, you’ll appreciate the elegance of structured data and readable text existing side by side. It’s the same logic that makes APIs useful: you get something friendly for humans and something machine-friendly for software. And if you’re curious about broader ecosystems, XML shines because it’s a well-supported format across languages and tools. It feels like the old reliable that still plays nicely with modern automation.

In sum: what to remember about -oN, -oX, -oG, and -oA

  • -oN gives you straightforward, human-readable results.

  • -oX provides XML for structured, machine-readable data.

  • -oG offers a compact grepable format for quick extraction with text tools.

  • -oA saves all formats in one go, giving you maximum flexibility.

If you’re building a workflow, start with a clear plan: decide which formats you’ll routinely need, pick a consistent basename strategy, and test how your scripts or dashboards consume the data. You’ll discover that what seems like a small choice—how you export results—can ripple through your entire process, making analysis quicker, collaboration smoother, and data reuse easier.

And hey, if you ever find yourself staring at a CSV or a JSON file and thinking, “Where did this come from in the first place?” remember: the options you choose today are laying the groundwork for how cleanly you can interpret those results tomorrow. It’s not about chasing perfection; it’s about making sense of what you’ve found, then telling the story of what it means for your network—clearly, calmly, and with a little bit of practical swagger.