How to perform port scan on Ubuntu 20.04 Focal Fossa Linux

In this tutorial you will learn how to install the nmap port scanner on Ubuntu 20.04 Focal Fossa Linux and how to perform basic port scanning.

In this tutorial you will learn:

  • How to install namp
  • How to perform basic local and remote port scans
  • How to scan TCP and UDP port

Localhost check for opened ports on Ubuntu 20.04 Server/Desktop

Localhost check for opened ports on Ubuntu 20.04 Server/Desktop

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa
Software nmap
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to perform port scan on Ubuntu 20.04 step by step instructions

Before you begin, make sure that nmap port scanner tool is installed on your Ubuntu 20.04 system. To do so open up a terminal window and execute the following command:

$ sudo apt install nmap

Once the nmap port scanner in installed use the following examples to perform some basic port scanning. For more robust information about the nmap port scanner visit our nmap guide.

  1. Scan remote host 8.8.8.8 for all open port TCP ports:
    $ nmap 8.8.8.8
    
  2. Scan remote host 8.8.8.8 for all TCP and UDP ports:
    $ nmap -sUT 8.8.8.8
    


  3. Scan remote host 8.8.8.8 TCP port 53:
    $ sudo nmap -p 53
    
  4. Scan remote host 8.8.8.8 UDP port 53:
    $ nmap -sU -p 53 8.8.8.8
    
  5. Scan remote host 8.8.8.8 for open TCP and UDP ports:
    $ nmap -sUT --open 8.8.8.8
    
  6. Scan you local Ubuntu system TCP ports:
    $ nmap localhost
    
Port scanning examples on Ubuntu 20.04

Port scanning examples on Ubuntu 20.04