Level 8: Find the Unique Line

← Back to Guide

Level Goal

The password for the next level is the one line in data.txt that occurs exactly once.

Step-by-Step Solution

1. Exit Level 7 and SSH into Level 8

After obtaining the Level 8 password from data.txt in Level 7, exit the current session:

exit

Then connect as bandit8 using the password acquired:

ssh bandit8@bandit.labs.overthewire.org -p 2220

2. List the Home Directory

Once logged in as bandit8, run:

ls

You will see data.txt listed.

3. Inspect data.txt

To view its contents:

cat data.txt

The file contains many numeric entries. According to the instructions, the password is the one number that appears only once.

4. Extract the Unique Line

To find the unique entry, sort the file and filter out duplicate lines:

sort -n data.txt | uniq -u

This command first sorts the data numerically, then uniq -u outputs only the lines that occur once, revealing the password.

Summary & Key Commands

  • exit : return to your local machine from Level 7.
  • ssh bandit8@bandit.labs.overthewire.org -p 2220 : connect as bandit8.
  • ls : list files; shows data.txt.
  • cat data.txt : view entire file contents.
  • sort -n data.txt | uniq -u : sort numerically and display the line that occurs only once; this line is the password.