How to Use Dirb: Beginner's Guide to Directory Brute-Forcing in Kali Linux
Learn how to use Dirb in Kali Linux: run your first directory scan, pick the right wordlist, and read the results — with a worked example and cheat sheet.
What Is Dirb?
Dirb is a command-line web content scanner that finds hidden directories and files on a web server by sending a request for every word in a wordlist and reporting the paths that do not return a 404 error. It ships pre-installed on Kali Linux, runs one request at a time, and is still the simplest way for a beginner to learn directory brute-forcing on a target they own or are authorized to test.
Dirb was written in C and first released in 2005. It is a legacy tool now — unmaintained and single-threaded — but it remains in Kali Linux because its behavior is simple and predictable: one word, one request, one verdict. That predictability is exactly why it is a good first directory scanner. You learn the workflow on Dirb, and the same workflow carries over to faster tools such as Gobuster and ffuf.
How Dirb decides a path exists
Dirb does not guess. For each word in the wordlist it builds a URL — for example, http://target.com/admin — sends an HTTP GET request, and reads the status code in the response:
| Status code | What it means | Dirb reports it? |
|---|---|---|
| 200 OK | The path exists and is accessible | Yes |
| 301 / 302 Redirect | The path exists but redirects elsewhere | Yes |
| 403 Forbidden | The path exists but access is denied | Yes — a forbidden path still confirms something is there |
| 404 Not Found | The path does not exist | No — filtered out |
That 403 row surprises beginners: a "forbidden" result is still a finding. It tells you a directory or file exists even though you cannot open it, which is useful information during reconnaissance. You can hide 403 results with the -N flag if you only want accessible pages.
How to Use Dirb in 5 Steps
You can run a useful Dirb scan in five steps. The rest of this guide expands each one.
dirb with no arguments: if it prints its usage banner, you are ready.common.txt, which holds about 4,600 common directory and file names. Move to big.txt or a SecLists list only when the quick scan finds nothing.dirb <url> <wordlist>. Add -X for file extensions and -o to save the results.Installing Dirb
Dirb ships pre-installed on Kali Linux. Open a terminal and run:
dirb
With no arguments Dirb prints its usage banner and exits. That banner is your verification: if you see it, Dirb is installed and working.
On other systems, install it from the package manager:
# Debian / Ubuntu / Kali
sudo apt install dirb
# Fedora / RHEL
sudo dnf install dirb
# macOS (Homebrew)
brew install dirb
"dirb: command not found"
If your shell answers dirb: command not found, Dirb is not installed or not on your PATH. On Kali Linux that almost never happens — run sudo apt install dirb and then which dirb to confirm the binary location. If you installed Dirb from source, make sure the directory holding the binary is on your PATH, or call it by its full path.
Dirb Wordlists Explained
A wordlist is the list of directory and file names Dirb tries. The quality of your scan depends more on the wordlist than on any flag, so choose deliberately.
Dirb's own wordlists live in /usr/share/dirb/wordlists/. List them with:
ls /usr/share/dirb/wordlists/
ls /usr/share/dirb/wordlists/vulns/
| Wordlist | What it is | When to use it |
|---|---|---|
common.txt | About 4,600 common directory and file names; the default when you give no wordlist | Every first scan — fast and covers the obvious paths |
big.txt | A much larger list of directory and file names | Deeper scans when common.txt finds nothing |
vulns/ | Small targeted lists for known vulnerable paths (for example Apache, IIS, CGI) | When you already know the server software |
SecLists raft-medium-directories.txt | A large community wordlist from the SecLists project | Thorough discovery on an authorized engagement |
SecLists directory-list-2.3-medium.txt | A large general directory list | Deep scans; slow, so use it last |
| Custom / CeWL lists | Words built from the target's own pages | When you want paths specific to that site |
Start small and grow larger. A quick scan with common.txt takes minutes; the same site with big.txt can take much longer because every extra word is another request, and Dirb sends them one at a time. A custom wordlist built with CeWL — which spiders a site and collects its real words — often beats a bigger generic list, because it contains the names that site actually uses.
Worked Example: Finding Hidden Paths on a Local Lab Server
This example runs entirely on your own machine. Start a small test site on localhost and plant a few files in it:
mkdir -p ~/dirb-lab/admin ~/dirb-lab/.git
echo "admin panel" > ~/dirb-lab/admin/index.html
echo "backup" > ~/dirb-lab/backup.zip
echo "login" > ~/dirb-lab/login.html
cd ~/dirb-lab && python3 -m http.server 8080
Leave that server running in one terminal. In a second terminal, run Dirb against it with the default wordlist:
dirb http://127.0.0.1:8080/ /usr/share/dirb/wordlists/common.txt
Dirb prints a banner, then one line per path it finds. The output below is illustrative — trimmed for readability, with the same format Dirb prints:
---- Scanning URL: http://127.0.0.1:8080/ ----
+ http://127.0.0.1:8080/admin (CODE:200|SIZE:1243)
+ http://127.0.0.1:8080/backup.zip (CODE:200|SIZE:289)
+ http://127.0.0.1:8080/login (CODE:200|SIZE:3102)
+ http://127.0.0.1:8080/.git (CODE:403|SIZE:289)
Read the output line by line:
/admin (CODE:200) — an admin directory exists and is accessible. Open it in a browser and check what it contains./backup.zip (CODE:200) — a backup archive is publicly downloadable. Backups often contain source code, database dumps, or credentials./login (CODE:200) — a login page. Note it for later testing; do not brute-force credentials here./.git (CODE:403) — a Git directory exists but the server refuses to serve it. The 403 still confirms the path exists, and on a real engagement a reachable .git directory can leak the whole repository.Dirb then recurses into each directory it found — it enters /admin/ and scans it with the same wordlist — unless you disable recursion with -r. That recursion is why a small wordlist can still produce a long scan: every directory found adds another full pass.
Finding Files with Extensions
Directories are only half the story. Files such as config.php, backup.bak, and .env are found by appending extensions to each wordlist entry with -X:
dirb http://127.0.0.1:8080/ /usr/share/dirb/wordlists/common.txt -X .php,.html,.bak,.old
With that flag, the word admin is tested as admin, admin.php, admin.html, admin.bak, and admin.old. Each extension multiplies the request count, so keep the extension list short and relevant to the server: .php on a PHP site, .aspx on ASP.NET, .bak, .old, and .zip when hunting backups.
If you have many extensions, put them in a file — one per line — and pass it with -x:
printf '.php
.html
.bak
.old
.zip
' > ~/extensions.txt
dirb http://127.0.0.1:8080/ /usr/share/dirb/wordlists/common.txt -x ~/extensions.txt
Controlling Recursion
Dirb recurses by default: every directory it finds gets scanned again with the same wordlist. That is thorough, but it is also the main reason scans take so long.
| Flag | Behavior |
|---|---|
| (no flag) | Recurse into every directory found |
-r | Do NOT recurse — scan only the top level you gave it |
-R | Interactive recursion — Dirb asks you before entering each directory |
Use -r for a quick first pass or when a site is large:
dirb http://127.0.0.1:8080/ /usr/share/dirb/wordlists/common.txt -r
Use -R when you want control without losing depth: Dirb pauses at each discovered directory and lets you decide whether to enter it. That is useful on a site where one huge directory — a documentation tree, for example — would swallow the whole scan.
A common beginner mistake is reading -r backwards and assuming it turns recursion on. It does the opposite: -r turns recursion off.
Slowing Down and Blending In
Dirb sends requests as fast as its single thread allows, with a default User-Agent that announces itself as Dirb. Two flags make a scan quieter:
# Wait 500 milliseconds between requests
dirb http://127.0.0.1:8080/ /usr/share/dirb/wordlists/common.txt -z 500
# Pretend to be a normal browser
dirb http://127.0.0.1:8080/ /usr/share/dirb/wordlists/common.txt -a "Mozilla/5.0"
# Both together, for a slow, low-profile scan
dirb http://127.0.0.1:8080/ /usr/share/dirb/wordlists/common.txt -z 500 -a "Mozilla/5.0"
The -z delay also protects the target: a flood of requests can slow a small server or trip rate limiting, and on a lab server it keeps the scan from overwhelming the service. Slowing down does not make an unauthorized scan authorized — it only makes an authorized scan politer.
Scanning Behind a Login
Many interesting paths sit behind authentication. Dirb can carry credentials with it:
# HTTP basic authentication (username:password)
dirb http://127.0.0.1:8080/ /usr/share/dirb/wordlists/common.txt -u admin:secret
# Send a session cookie (copy it from your browser's developer tools)
dirb http://127.0.0.1:8080/ /usr/share/dirb/wordlists/common.txt -c "PHPSESSID=abc123"
# Send a custom header, for example a bearer token
dirb http://127.0.0.1:8080/ /usr/share/dirb/wordlists/common.txt -H "Authorization: Bearer abc123"
Log in through the browser first, copy the session cookie from the developer tools, and pass it with -c. That lets Dirb scan the authenticated areas of the application — the admin panel, the user settings pages — that an anonymous scan would never see. Cookies expire, so if a scan suddenly returns 302 redirects to a login page, your session has ended: log in again and take a fresh cookie.
Scanning Through a Proxy
Route Dirb through a proxy with -p so you can watch and modify its traffic — most commonly through Burp Suite:
dirb http://127.0.0.1:8080/ /usr/share/dirb/wordlists/common.txt -p 127.0.0.1:8080
The workflow is: start Burp Suite, make sure its proxy listener is running on 127.0.0.1:8080, then run Dirb with -p 127.0.0.1:8080. Every Dirb request appears in Burp's HTTP history, where you can inspect it, replay an interesting one in Repeater, or send a found path to Intruder for further testing. Note that the proxy port and the lab server port are both 8080 in this example only because they run on different hosts — use a different port for your lab server if Burp already occupies 8080.
Ignoring Response Codes
By default Dirb shows every non-404 response. Sometimes that is too much noise — for example, when a server returns 403 for almost everything. Hide a code with -N:
# Hide forbidden results; show only accessible paths
dirb http://127.0.0.1:8080/ /usr/share/dirb/wordlists/common.txt -N 403
Watch for the opposite problem too: a server that returns 200 for every path, including ones that do not exist, because it serves a custom 404 page with a 200 status. Dirb then reports everything as found, and the giveaway is the SIZE column — every "found" path has the same size, the size of the custom error page. When you see identical sizes on every line, the scan has found nothing real: verify a path in the browser, note the error page size, and treat matching lines as misses.
Saving and Reading Results
Always save results. A scan that runs for an hour and prints to the screen is lost the moment the terminal closes:
dirb http://127.0.0.1:8080/ /usr/share/dirb/wordlists/common.txt -o results.txt
The output file holds the same lines Dirb printed: one per found path, with its status code and size. After the scan, pull out the accessible pages:
grep "CODE:200" results.txt
Then work through the list in a browser. A finding is only useful when you have looked at it: open each path, note what it is, and record the interesting ones — admin panels, backups, configuration files, exposed repositories — in your notes before moving to the next tool.
Dirb Commands Cheat Sheet
| Command | What it does |
|---|---|
dirb http://target.com | Scan with the built-in default wordlist |
dirb http://target.com /usr/share/dirb/wordlists/common.txt | Scan with a named wordlist |
dirb http://target.com /usr/share/dirb/wordlists/big.txt | Deeper scan with the big wordlist |
dirb http://target.com -X .php,.html,.bak | Test file extensions for each word |
dirb http://target.com -x ~/extensions.txt | Read extensions from a file |
dirb http://target.com -r | Disable recursion — top level only |
dirb http://target.com -R | Interactive recursion — ask before entering each directory |
dirb http://target.com -z 500 | Wait 500 ms between requests |
dirb http://target.com -a "Mozilla/5.0" | Use a custom User-Agent |
dirb http://target.com -u admin:secret | HTTP basic authentication |
dirb http://target.com -c "PHPSESSID=abc123" | Send a session cookie |
dirb http://target.com -H "Authorization: Bearer abc123" | Send a custom header |
dirb http://target.com -p 127.0.0.1:8080 | Route through a proxy (Burp Suite) |
dirb http://target.com -N 403 | Ignore 403 responses |
dirb http://target.com -o results.txt | Save results to a file |
dirb http://target.com -S | Silent mode — less output |
dirb http://target.com -w | Do not stop on warnings |
dirb https://target.com | Scan an HTTPS site |
dirb http://target.com/blog/ | Scan a specific path, not the site root |
dirb http://target.com wordlist1.txt wordlist2.txt | Use more than one wordlist |
ls /usr/share/dirb/wordlists/ | List Dirb's built-in wordlists |
Dirb vs Gobuster vs Ffuf vs DirBuster
Dirb is not the only directory scanner on Kali Linux. Pick the tool that fits the job:
| Tool | Speed | Interface | Best for |
|---|---|---|---|
| Dirb | Slow (single-threaded) | Command line, simplest syntax | Learning, small targets, quick checks |
| Gobuster | Fast (multi-threaded, Go) | Command line | Large wordlists, large sites, DNS and vhost modes too |
| Ffuf | Fastest (multi-threaded, Go) | Command line, flexible filtering | Fuzzing parameters and values, not just paths |
| DirBuster | Medium (multi-threaded, Java) | Graphical interface | Beginners who prefer a GUI; unmaintained since version 1.0-RC1 |
The workflow is the same on all four: wordlist in, paths out. Dirb wins on simplicity — no flags are needed to start. Gobuster wins on speed — it finishes in minutes what takes Dirb an hour on a big wordlist. Ffuf wins on flexibility — its FUZZ keyword lets you fuzz any part of a request, not just the path. DirBuster wins only if you want a graphical interface, and it is discontinued, so prefer the command-line tools for real work.
Learn the concepts on Dirb, then switch to Gobuster or ffuf when the job gets big. The findings are the same; only the speed changes.
Troubleshooting Dirb Problems
| Problem | Likely cause | Fix |
|---|---|---|
dirb: command not found | Dirb is not installed | sudo apt install dirb, then which dirb to confirm |
| Every path returns 403 | The server blocks directory listing or requires login | Log in and pass a cookie with -c, or hide 403s with -N 403 |
| Every path returns 200 | Custom 404 page served with a 200 status | Compare the SIZE column — identical sizes mean nothing was really found |
| Scan is very slow | Large wordlist plus default recursion, single thread | Use common.txt, add -r to stop recursion, or switch to Gobuster or ffuf for large jobs |
| No results at all | Wrong URL, wrong wordlist, or the site truly exposes nothing | Check the URL in a browser, try big.txt, add -X extensions |
| Warnings stop the scan | Certificate or connection warnings | Add -w to continue past warnings |
| HTTPS certificate errors | Self-signed certificate on a lab server | Add -w and confirm the URL is correct |
| Proxy connection refused | Burp is not listening on that port | Start Burp and check its proxy listener is on 127.0.0.1:8080 |
| Results file is empty | The scan found nothing, or -o wrote before the scan finished | Wait for the scan to end, then check the file; re-run with a bigger wordlist |
Common Mistakes
common.txt covers the obvious paths only. A clean result with one small list proves nothing — try big.txt or a SecLists list before concluding.-X, Dirb never finds config.php, backup.bak, or .env.-r backwards. -r disables recursion; it does not enable it. Dirb recurses by default.-o.Best Practices
common.txt and no extensions. Expand only when the quick scan finds nothing.-X .php,.html,.bak,.old (or the extensions that fit the server) after the directory pass.-r on large ones, or use -R to choose directory by directory.-o. Results belong in a file, not in scrollback.Is Dirb Legal?
Dirb itself is legal software, and scanning a server you own or a lab you built is completely fine. Scanning a server you do not own, without written permission, can violate computer misuse laws and will almost certainly trigger intrusion detection systems — Dirb's traffic is loud, sequential, and easy to spot in access logs.
The rule is simple: own it, have written authorization for it, or use a lab. Intentionally vulnerable applications such as DVWA, Metasploitable, and OWASP Juice Shop exist precisely so you can practice without touching a real site.
Is Dirb Still Used in 2027?
Yes, with a caveat. Dirb is legacy software — unmaintained since its early releases — and faster tools have replaced it for large engagements. Nobody runs Dirb against a thousand-host scope. But it is still installed on Kali Linux, still appears in labs and exams, and still works fine on small targets, where its simplicity beats the setup cost of faster tools. Learn it here, use Gobuster or ffuf when speed matters, and you will never be stuck without a directory scanner.
Summary
Dirb is a web content scanner that finds hidden directories and files by trying every word in a wordlist and reporting the paths that do not return 404. It ships pre-installed on Kali Linux, runs one request at a time, and recurses into every directory it finds unless you tell it not to with -r. Pick the right wordlist, add extensions with -X, save your results with -o, and verify every finding in a browser. Learn the workflow on Dirb — then use Gobuster or ffuf when the job gets big.
Keep Learning
Knowledge Check
-X do?-r actually do, and why do beginners misread it?Answers: 1. Finding hidden directories and files on a web server using wordlist-based brute-forcing. 2. By checking HTTP response codes: 200, 301/302, and 403 indicate a path exists; 404 is filtered out. 3. It appends file extensions to each wordlist entry. 4. -r disables recursion (Dirb recurses by default); beginners misread it because most tools use -r to mean recursive. 5. /usr/share/dirb/wordlists/; start with common.txt (about 4,600 entries). 6. With -u user:pass for basic auth, or a session cookie with -c. 7. With -p 127.0.0.1:8080 while Burp's proxy listener is running. 8. A 403 confirms the path exists even though access is denied; hide it with -N 403 when you only want accessible pages.
Frequently Asked Questions
Continue Learning
Nikto Commands: Complete Guide to Web Server Scanning in Kali Linux
Nikto commands cheat sheet: install Nikto, run your first web server scan, read the results, tune scans and save reports — with a worked example.
Tools · BeginnerHow to Use FFUF: Beginner's Guide to Fast Web Fuzzing in Kali Linux
Learn how to use FFUF in Kali Linux — directory, subdomain and vhost fuzzing, parameter testing, filters and a worked DVWA example, with a cheat sheet.
Tools · BeginnerHow to Use Gobuster: Beginner's Guide to Directory, DNS & VHost Enumeration in Kali Linux
Learn how to use Gobuster in Kali Linux — dir, DNS and vhost modes, wordlists, and a worked DVWA example, with a cheat sheet and troubleshooting.
Tools · IntermediateHow to Use Metasploit: Beginner's Guide to the Metasploit Framework in Kali Linux
Learn how to use Metasploit in Kali Linux: start msfconsole, search modules, run your first lab exploit, and master Meterpreter with a cheat sheet.
Related Security Tools
DIRB
DIRB is a web content scanner that finds hidden directories, backup files, and other sensitive content on web servers by launching dictionary-based attacks against a target URL. This beginner tutorial shows how to use DIRB in Kali Linux: install it, run your first scan, read the output, switch wordlists, and hand verified findings to the next tool.
Web ApplicationGobuster
Learn how to use Gobuster, the fast Go-based directory and subdomain brute-forcer, with install steps, your first dir scan, wordlist picks, and result filtering — a beginner tutorial for Kali Linux.
Web ApplicationFFUF
Learn how to use FFUF (Fuzz Faster U Fool), the extremely fast open-source web fuzzer written in Go: place the FUZZ keyword where a wordlist entry should go, run your first scan, filter the noise, and discover hidden directories, files, parameters, virtual hosts and API endpoints on targets you have permission to test.
Wireless AttacksWifite
Learn how to use Wifite in Kali Linux with this beginner tutorial: check your WiFi adapter, install Wifite, run your first authorized WiFi audit, capture WPA handshakes and PMKIDs, and crack them with a wordlist. Includes Wifite commands, a worked example, troubleshooting for common errors, and how Wifite compares with Aircrack-ng.