Bandit Level 8
Bandit Level 8 — find one line in a large text file with grep.
Source: This content is aggregated from overthewire (MIT). Visit the original repository for the latest version.
Level Goal
The password for the next level is stored in the file data.txt next to the word millionth
Commands you may need to solve this level
man, grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd
Study guide
Level map: logged in as bandit7, find the password for bandit8.
What this level teaches
Searching inside files rather than for them: grep, the tool you will use more than any other for log and data analysis.
Key ideas
grep PATTERN FILEprints every line that contains the pattern.- Line-oriented thinking. Unix text tools treat each line as a record; the password is on the same line as the marker word.
- Options like
-i(ignore case),-n(show line numbers) and-r(recurse) turn grep into a general search tool.
How to approach it
- Look at the file’s size first (
ls -l,wc -l). Reading a huge file by eye is the wrong approach. - Search for the marker word named in the Level Goal and read the line that comes back.
Why it matters
Log analysis, code search and threat hunting all begin with grep. Learning it early makes every later level faster.