Nmap basic commands to check ports

nmap localhost
nmap xx.xx.xx.xx
nmap -p 1-65535 localhost
nmap -p 80,443

Multiple IP Addresses

nmap -p,2,3,4
nmap -p
nmap  8.8.8.*
nmap -p 8.8.8.* --exclude

Top ports

nmap --top-ports 10

Scan from a text file

nmap -iL list.txt

Save to file

nmap -oN output.txt localhost
nmap -oX output.xml localhost

OS and service detection

nmap -A -T4 localhost

Service and Daemon version

nmap -sV localhost

Linux Process basics

List of processes

systemctl list-unit-files | grep enabled
ps aux | less

Top memory consuming process

ps aux --sort -rss | head -11
ps aux --sort +rss | tail -10
ps aux | sort -nrk 3,3 | head -n 5

Top Process ID’s

ps -eo pmem,pcpu,vsize,pid | sort -k 1 -nr | head -5
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head

Watch processes

watch "ps aux | sort -nrk 3,3 | head -n 5"

CPU info

cat /proc/cpuinfo 

Number of CPU’s

cat /proc/cpuinfo | wc -l

Basic Linux Dig commands

# dig google.com
# dig google.com +short

MX Record

# dig google.com MX

SOA Record for Domain

# dig google.com SOA


# dig google.com TTL

Get only Answers

# dig google.com +nocomments +noquestion +noauthority +noadditional +nostats

Get all DNS Records Types

# dig google.com ANY +noall +answer

DNS Reverse Look-up

dig -x +short

Multiple DNS Records

# dig yahoo.com mx +noall +answer redhat.com ns +noall +answer

Create $HOME/.digrc to configure