The `ping` Command

The ping command is a tool used to check the availability of a remote host.
It works at the network layer using the ICMP protocol.

In addition to ping, there are several other commands you can use to scan ports.


Telnet

Telnet is a protocol for establishing a connection to a remote host.

To check if a port is open:

telnet [address] [port_number]

Netcat (nc)

Netcat is a tool for working with TCP/UDP connections.

Install it:

sudo apt install netcat

Check a port:

nc -vz [address] [port_number]

Nmap

Nmap is a powerful port scanning tool that can also detect network vulnerabilities.

Install it:

sudo apt install nmap

Check a single port:

nmap -p [port_number] [address]

Check multiple ports in a range:

nmap -p 88-93 google.com

Scan all TCP ports on localhost:

nmap -sT localhost

Example of an nmap report for a more secure host:

nmap -sT server.com
Starting Nmap 4.20 ( http://insecure.org ) at 2009-11-01 12:42 MST
Interesting ports on server.com (192.168.20.35):
Not shown: 1691 closed ports
PORT   STATE SERVICE
25/tcp open  smtp
80/tcp open  http

Detecting the Operating System

nmap can detect the OS used on the target host by analyzing TCP/IP stack characteristics.
Use the -O flag:

sudo nmap -sV -O 192.168.0.101

Scanning Multiple Addresses

nmap 192.168.0.101 192.168.0.102 192.168.0.107

Or:

nmap 192.168.0.101,102,107

Detecting Active Hosts in a Network

nmap -sn 192.168.1.0/24

You can also provide input from a file:

nmap -iL hosts.txt

Port Scanning Examples

Scan a single port:

nmap -p 80 192.168.0.101

Scan a range of ports:

nmap -p 80-1000 192.168.0.101

Scan all ports:

nmap -p "*" 192.168.0.101

Scan specific TCP or UDP ports:

nmap -sT 192.168.0.101

For UDP:

nmap -sU 192.168.0.101

Combined TCP/UDP scan:

nmap -p U:53,79,113,T:21-25,80,443,8080 192.168.0.101

Stealth Scan

nmap -sS 192.168.0.101

Saving Scan Results

nmap 192.168.0.101 > results.txt

Or:

nmap -oN results.txt 192.168.0.101

Excluding Hosts from Scans

nmap 192.168.1.0/24 --exclude 192.168.1.1
nmap 192.168.1.0/24 --exclude 192.168.1.1 192.168.1.3
nmap 192.168.1.0/24 --exclude 192.168.1.1,2,3

Using a file for exclusions:

nmap 192.168.1.0/24 --excludefile exclude.txt

Network Configuration with the ss Command

The ss command is a powerful CLI tool for analyzing and monitoring network statistics in Linux.
It comes with the iproute2 package and is a faster alternative to the older netstat command.

Example: View all HTTP connections (port 80):

ss -at '( sport = :80 )'

View all TCP connections with detailed information:

ss -ntap

🚀 Explore more guides on our blog 👉 blog.1it.pro
📧 Contact us: admin@1it.pro for expert IT guidance.
🌐 Explore more: Visit 1it.pro for top-tier IT solutions.

UA EN RU

Зв'язатися з нами

Telegram Email