Crunch Wordlist Generator for Ethical Hacking on Kali Linux

Deepak Prasad
Tested on Kali GNU/Linux Rolling 2026.2 (kali-rolling)
Package crunch 3.6-3.1
Applies to Kali Linux
Lab environment Local Kali workstation — pentest lab setup when you feed lists into SSH brute force or Metasploitable exercises
Privilege Normal user for generation; sudo for package installs
Scope Custom wordlist generation with Crunch on Kali — charset ranges, charset.lst presets, -t patterns, -p permutations, early stop, file splitting, and gzip compression. Does not cover CeWL, Hashcat rules, or GPU cracking workflows.
Related guides Ethical hacking tutorial

Public wordlists such as SecLists and rockyou.txt cover common passwords, but they miss formats your target actually uses. Crunch builds a custom list when you know part of the shape: a prefix, digit run, or a handful of words that might appear together.

This guide walks through Crunch on Kali Linux with real commands and trimmed output from each mode. Every example writes under /tmp/crunch-lab so you can delete the folder when you finish.

IMPORTANT
Generate wordlists only for authorized testing. Use custom lists against lab targets such as Metasploitable 2 or your own VMs. Do not aim large generated lists at production login services without written permission.

What is a wordlist generator in ethical hacking?

The rest of this guide turns partial password knowledge into a file you can pass to Hydra, John the Ripper, or Hashcat. You are not cracking anything inside Crunch itself — you are manufacturing candidates that match a hypothesis about how the password was built.

A wordlist generator enumerates password candidates from rules you specify: length range, character set, fixed pattern, or word order. Crunch is the default CLI generator on many Kali images and ships with preset charsets in /usr/share/crunch/charset.lst.

Crunch is most useful when you have a clue about structure:

  • A company name plus two digits (pass01, pass02, …)
  • Uppercase-only legacy accounts (AAA, AAB, …)
  • A few words that might appear in one passphrase (dog, cat, bird)

Pattern placeholders in -t mode map to character classes:

Symbol Inserts
@ Lowercase letters
, Uppercase letters
% Digits
^ Symbols

Order matters when you mix classes on the command line: lowercase charset, then uppercase, then digits, then symbols. Use + as a placeholder when you skip a class (see the Crunch man page examples).


Install Crunch on Kali Linux

Crunch is preinstalled on many Kali releases, but the walkthrough below assumes you can install or refresh the package before you generate lists.

Install or refresh the package if crunch is missing:

bash
sudo apt update
sudo apt install -y crunch

Confirm the binary responds:

bash
crunch
output
crunch version 3.6

Crunch can create a wordlist based on criteria you specify.  The output from crunch can be sent to the screen, file, or to another program.

Usage: crunch <min> <max> [options]

Version 3.6 on this Kali image matches the crunch 3.6-3.1 package row in the intro table. Crunch is ready — set up a scratch directory next.


Kali lab setup

Point every example at one writable directory so you can inspect files and delete them after the lab. The variable keeps paths short in the commands below.

Create a scratch directory for generated lists:

bash
LAB=/tmp/crunch-lab
mkdir -p "$LAB"

All -o paths below use "$LAB" so you can remove the folder with rm -rf /tmp/crunch-lab when you finish. Feed the resulting files into brute-force tools only on hosts you are authorized to test.


Compare Crunch generation modes

Crunch exposes several generation styles. Use this table to pick a mode before you scale up length or charset size — each section below runs the same lab directory with a different flag set.

Mode Best for Example command shape
Charset range Known alphabet and length bounds crunch 3 3 abc -o file.txt
charset.lst preset Built-in mixed sets from /usr/share/crunch/charset.lst crunch 3 3 -f charset.lst ualpha -o file.txt
Pattern -t Fixed prefix plus digits or symbols crunch 7 7 -t pass@@@ -o file.txt
Permutation -p Few words in unknown order crunch 4 5 -p dog cat bird > file.txt
Early stop -e Stop at a known boundary crunch 4 4 abc -e aaca -o file.txt
Split -b Huge lists split by file size crunch 3 3 0123456789 -b 2kb -o START
Compress -z Smaller files for transfer crunch 3 3 abc -z gzip -o file.txt

Crunch prints the expected line count before it writes. Read that number before you run wide charsets at long lengths — 4 4 on mixed alphanumeric sets can reach millions of lines in seconds.


Generate a charset wordlist

Start with the smallest useful example: three characters from the set abc. That produces 27 lines () so you can verify the file contents before you scale up.

Generate every three-letter combination from a, b, and c:

bash
crunch 3 3 abc -o "$LAB/basic.txt"
output
Crunch will now generate the following number of lines: 27 

crunch: 100% completed generating output

The status line reports 27 lines — small enough to inspect on screen. The file ends at ccc:

bash
wc -l "$LAB/basic.txt"
output
27 /tmp/crunch-lab/basic.txt
bash
tail -3 "$LAB/basic.txt"
output
cca
ccb
ccc

Twenty-seven lines match combinations. For a wider alphabet at length four, hex digits produce 65,536 lines (16⁴):

bash
crunch 4 4 0123456789abcdef -o "$LAB/hex4.txt"
output
Crunch will now generate the following number of lines: 65536 

crunch: 100% completed generating output
bash
wc -l "$LAB/hex4.txt"
output
65536 /tmp/crunch-lab/hex4.txt

Sixty-five thousand lines still fit comfortably on disk. When you need lowercase plus digits at length four, expect a much larger count — estimate with Crunch’s preview line before you commit disk space.


Use charset.lst presets

Kali ships named charsets in /usr/share/crunch/charset.lst so you do not have to type long alphabet strings. The -f flag loads a preset by name.

List preset names:

bash
grep -E '^[^#]' /usr/share/crunch/charset.lst | head -8
output
hex-lower                     = [0123456789abcdef]
hex-upper                     = [0123456789ABCDEF]
numeric                       = [0123456789]
numeric-space                 = [0123456789 ]
symbols14                     = [!@#$%^&*()-_+=]
symbols14-space               = [!@#$%^&*()-_+= ]
symbols-all                   = [!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/]
symbols-all-space             = [!@#$%^&*()-_+=~`[]{}|\:;"'<>,.?/ ]

Generate three-character uppercase words with the ualpha preset:

bash
crunch 3 3 -f /usr/share/crunch/charset.lst ualpha -o "$LAB/ualpha.txt"
output
Crunch will now generate the following number of lines: 17576 

crunch: 100% completed generating output
bash
head -3 "$LAB/ualpha.txt"
output
AAA
AAB
AAC

Seventeen thousand lines come from 26³ uppercase combinations. Pick a preset that matches what you know about the target — lalpha-numeric for lowercase plus digits, numeric for PIN-style lists, and so on.


Build patterned passwords with -t

When the password shape is fixed — a word plus digits, for example — -t fills pattern slots while you hold literal text in place. The pattern length must equal min and max length.

Build pass plus three lowercase letters (passaaa through passzzz):

bash
crunch 7 7 -t pass@@@ -o "$LAB/pattern.txt"
output
Crunch will now generate the following number of lines: 17576 

crunch: 100% completed generating output
bash
head -3 "$LAB/pattern.txt"
output
passaaa
passaab
passaac
bash
tail -2 "$LAB/pattern.txt"
output
passzzy
passzzz

Seventeen thousand lines equal 26³ suffix combinations. For digit suffixes, swap @ for % in the pattern — crunch 7 7 -t pass%%% generates pass000 through pass999.

Mix classes with explicit charset segments and + placeholders when you need symbols or uppercase in specific positions (see man page examples 11–13). Add -d 2@ to limit consecutive duplicate letters when the target policy rejects them.


Permute words with -p

If you suspect a passphrase combines a few known words, -p permutes them without repeating characters inside each token. The -p flag must be the last option on the command line — placing -o after -p breaks parsing.

Permute three lab words and save stdout to a file:

bash
crunch 4 5 -p dog cat bird > "$LAB/perm.txt"
output
Crunch will now generate approximately the following amount of data: 66 bytes
0 MB
0 GB
0 TB
0 PB
Crunch will now generate the following number of lines: 6
bash
cat "$LAB/perm.txt"
output
birdcatdog
birddogcat
catbirddog
catdogbird
dogbirdcat
dogcatbird

Six lines are the 3! orderings of three distinct words. For longer token lists, read tokens from a file with -q filename instead of listing each word on the command line.


Cap or stop output

Full charset products grow quickly. Crunch offers three practical ways to keep output bounded: stop at a string (-e), split with -c and -o START, or pipe through head for a quick sample.

Stop early at a known boundary:

bash
crunch 4 4 abc -e aaca -o "$LAB/early.txt"
output
Crunch will now generate the following number of lines: 7 

crunch: 100% completed generating output
bash
tail -3 "$LAB/early.txt"
output
aabb
aabc
aaca

Seven lines run from aaaa through aaca inclusive. Use -e when you resume a previous session and know the last candidate you already tested.

For a quick cap without -e, preview then trim:

bash
crunch 4 4 0123456789 | head -100 > "$LAB/first100.txt"
bash
wc -l "$LAB/first100.txt"
output
100 /tmp/crunch-lab/first100.txt

The pipe keeps the first 100 numeric strings. For production-sized jobs, -c with -o START splits output into fixed line counts per file (see the Crunch man page example 9).


Split large wordlists with -b

Multi-gigabyte lists are awkward to copy and feed into tools. With -b and -o START, Crunch writes a series of files capped by size — each filename shows the first and last entry in that chunk.

Split three-digit numeric strings into roughly 2 KB files:

bash
cd "$LAB" && crunch 3 3 0123456789 -b 2kb -o START
output
crunch: 100% completed generating output
bash
ls -1 "$LAB"/*.txt | head -4
output
/tmp/crunch-lab/000-499.txt
/tmp/crunch-lab/500-999.txt

Two files cover the full 000999 range at this size threshold. Raise -b to 20mb or 5mib when you generate longer passwords and need fewer fragments.


Compress output with -z

Compressed wordlists save space when you move files between lab machines or archive engagement data. Crunch can gzip, bzip2, lzma, or 7z the output file after generation.

Write a tiny list and gzip it in one step:

bash
crunch 3 3 abc -z gzip -o "$LAB/abc.txt"
output
Crunch will now generate the following number of lines: 27 

crunch: 100% completed generating output
Beginning gzip compression.  Please wait.
abc.txt:	 53.7% -- replaced with abc.txt.gz
bash
zcat "$LAB/abc.txt.gz" | head -5
output
aaa
aab
aac
aba
abb

Crunch replaces the plain file with abc.txt.gz. gzip is the fastest option; bzip2 and 7z trade speed for better compression on very large lists.


Troubleshooting

Symptom Likely cause Fix
strlen(pattern) != min/max Pattern length does not match min and max Set min and max to the pattern length — pass@@@ needs 7 7
-o creates garbage filenames with -p -p must be last Put -o before -p, or redirect stdout: crunch 4 5 -p a b c > out.txt
Disk fills during generation Charset and length too large Read Crunch’s line-count preview; add -e, head, or smaller min/max
-c or -b ignored Flags require -o START Use crunch … -o START -c 6000 or -b 20mb -o START per man page
Empty or missing output file Wrong working directory or rename error Run from "$LAB"; ensure free disk space and write permissions
Unexpected characters in output Charset order wrong Follow lowercase, uppercase, digits, symbols — use + for skipped classes

References


Summary

Crunch turns partial password knowledge into files you can feed into Hydra, John, or Hashcat. In this lab you installed the tool on Kali, wrote charset ranges and charset.lst presets, built patterned lists with -t, permuted short word sets with -p, and managed size with -e, -b, and -z gzip.

The preview line Crunch prints before generation is your safety check — 3 3 abc is twenty-seven lines, but 4 4 on a wide charset can hit tens of thousands in one run. Match the mode to what you actually know about the target: patterns for fixed prefixes, -p for a handful of words, presets when the charset name already matches your hypothesis.

When a custom list recovers a login or hash in your lab, document the candidate format and continue in the SSH brute force walkthrough or John the Ripper guide — only on systems you are authorized to test.


Frequently Asked Questions

1. What is Crunch used for in ethical hacking?

Crunch generates custom password wordlists from character sets, patterns, and word permutations. Pentesters feed those lists into Hydra, John the Ripper, or Hashcat when public lists such as rockyou.txt miss the target password format.

2. Is generating wordlists illegal?

Building wordlists is appropriate when you use them only against systems you own or are explicitly authorized to test. Laws and organizational policies vary, so obtain permission before brute forcing logins or cracking hashes on third-party hosts.

3. When should I use Crunch instead of SecLists or rockyou.txt?

Use SecLists or rockyou for broad coverage first. Switch to Crunch when you know part of the password shape, such as a fixed prefix, digit suffix, or a small set of words in a known order.

4. Why does Crunch ignore my `-o` file when I use `-p`?

The -p permutation option must be the last flag on the command line. Place -o before -p, or redirect stdout to a file after crunch 4 5 -p word1 word2 word3.

5. How do I stop Crunch from filling my disk?

Use -e to stop at a string, pipe through head for a quick cap, or combine -b or -c with -o START to split output into size-limited or line-limited files. Estimate the line count Crunch prints before you run a large min-max range.
Kennedy Muthii

Information Security Analyst

Accomplished professional proficient in Python, ethical hacking, Linux, cybersecurity, and OSINT. With a track record including winning a national cybersecurity contest, launching a startup in Kenya, and holding a degree in information science, he is currently engaged in cutting-edge research in ethical hacking.

  • Python (programming language)
  • Certified Ethical Hacker
  • White Hat (Computer Security)
  • Linux
  • Penetration Testing