How to install Nmap on Ubuntu 22.04 or 20.04 and how to use it

In this tutorial we are going to show you how to simply install Nmap on Ubuntu 22.04 or 20.04 and at the end you will learn how to use some of its commands.

So what is Nmap?

Nmap, short for “Network Mapper,” is a powerful and versatile open-source tool used for network exploration and security auditing.

In simple terms, it helps you discover devices and services running on a computer network, thus creating a map of the network.

Nmap Features and Usages:

  1. Host Discovery:
    • Identify devices on a network.
  2. Port Scanning:
    • Find open ports on a target system to identify running services.
  3. Service Version Detection:
    • Determine the version of services running on open ports.
  4. Operating System Detection:
    • Attempt to identify the operating system of the target.
  5. Scriptable Interaction:
    • Support for scripts to automate tasks such as vulnerability scanning.
  6. Aggressive Scan:
    • Combine multiple scan techniques to gather comprehensive information.
  7. Firewall Detection:
    • Try to detect the presence of a firewall and identify filtering rules.
  8. Interactive Mode:
    • Allow users to interactively specify Nmap options and targets.
  9. Output Options:
    • Generate various output formats for easy analysis.
  10. Timing Options:
    • Adjust the timing and aggressiveness of the scan.

Now that you learned some facts about Nmap, let’s see how to install Nmap on Ubuntu 22.04 or 20.04.

Nmap Installation

Let’s quickly update our Ubuntu like this.

sudo apt update

And now, install Nmap.

sudo apt install nmap

After that is done, you should be able to check Nmap version with the following command.

nmap --version

Beautiful, we have installed Nmap version 7.80!

Do note that the version you are seeing could be different than the one we have here now. Nothing to worry about.

How to use Nmap?

Even although this tutorial is for Ubuntu, Nmap can be used the same way on any other system.

While there is much more to Nmap than what we will show you here, this list should offer you some basics that are more than enough to start your Nmap journey.

We encourage you to dig deeper. This command should show you all the Nmap capabilities in one place.

nmap -h

And here are some basic Nmap commands along with explanations:

  1. Host Discovery:
    • nmap -sn <target>
      Explanation: This command performs a ping scan to discover live hosts on the specified target network. It’s a basic method to determine which devices are online.
  2. Port Scanning:
    • nmap -p <ports> <target>
      Explanation: Conducts a scan on specific ports of the target system to identify which ports are open and potentially running services.
  3. Service Version Detection:
    • nmap -sV <target>
      Explanation: Detects the version of services running on open ports, providing information about the software and its potential vulnerabilities.
  4. Operating System Detection:
    • nmap -O <target>
      Explanation: Attempts to identify the operating system of the target by analyzing various network characteristics.
  5. Scriptable Interaction:
    • nmap --script=<script-name> <target>
      Explanation: Runs a specific Nmap script against the target, enabling users to automate tasks such as vulnerability scanning or information gathering.
  6. Aggressive Scan:
    • nmap -A <target>
      Explanation: Combines various scan techniques, including version detection and OS detection, to gather comprehensive information about the target.
  7. Firewall Detection:
    • nmap -sA <target>
      Explanation: Sends ACK packets to determine if a firewall is in place and tries to identify filtering rules.
  8. Interactive Mode:
    • nmap -i
      Explanation: Activates the interactive mode, allowing users to input Nmap options and targets in an interactive manner.
  9. Output Options:
    • nmap -oN output.txt <target>
      Explanation: Specifies the output format and file for the scan results, making it easier to analyze the findings.
  10. Timing Options:
    • nmap -T<level> <target>
      Explanation: Adjusts the timing and aggressiveness of the scan. Lower values are stealthier, while higher values are faster and more aggressive.

Conclusion

Remember that while Nmap is a valuable tool for network exploration, it should be used responsibly and only on networks that you have permission to scan.

Unauthorized scanning is considered unethical and, in many cases, illegal, so always adhere to ethical hacking practices and respect the privacy and security of others.

In case you need more powerful server for your Nmap adventure, take a look at our Linux KVM VPS offer and decide for yourself. Penetration testing is perfectly fine with us as long as it’s legal and it doesn’t make any trouble for either you or us.

Have any suggestions or need help? Feel free to reach out to us!

Similar Posts