Learning Linux: My Journey Through OverTheWire Bandit (Levels 0-5)
OverTheWire Bandit: Levels 0 to 5
I am currently learning Linux commands by playing the OverTheWire Bandit wargame. It is a fantastic way to get comfortable with the terminal. In this post, I will cover my notes, tips, and the commands I used to solve levels 0 through 5.
Level 0 -> Level 1
Login:
ssh bandit0@bandit.labs.overthewire.org -p 2220Password: bandit0
Puzzle: The password for the next level is stored in a file called readme located in the home directory.
What I learned:
ls: Used to list files in the current directory.cat readme: Used to display the content of the file.
Level 1 -> Level 2
Login:
ssh bandit1@bandit.labs.overthewire.org -p 2220Password: (Use password found in the readme file)
Puzzle: The password for the next level is stored in a file called - located in the home directory.
What I learned:
- Handling special filenames: In Linux,
-is typically treated as an option flag. To cat a file named-, you can use standard input redirection:
cat < -Alternatively, you can use the path cat ./- to avoid the ambiguity.
Level 2 -> Level 3
Login:
ssh bandit2@bandit.labs.overthewire.org -p 2220Password: (Use password found in level 1)
Puzzle: The password for the next level is stored in a file called --spaces in this filename-- located in the home directory.
What I learned:
- Dealing with spaces: When filenames contain spaces, you must escape them or use quotes. Using the
--separator can help distinguish options from filenames.
cat -- "--spaces in this filename--"Level 3 -> Level 4
Login:
ssh bandit3@bandit.labs.overthewire.org -p 2220Password: (Use password found in level 2)
Puzzle: The password for the next level is stored in a hidden file in the inhere directory.
What I learned:
ls -a: The-aflag is essential to see hidden files (files starting with a.).cd inhere: Navigation command to change the working directory.- Accessing hidden files with spaces:
ls -a
cd inhere
ls -a
cat -- "...Hiding-From-You"Level 4 -> Level 5
Login:
ssh bandit4@bandit.labs.overthewire.org -p 2220Password: (Use password found in level 3)
Puzzle: The password for the next level is stored in the only human-readable file in the inhere directory. (Tip: If your terminal is messed up, try the reset command.)
What I learned:
- Identifying file types: Instead of checking every file manually with
cat, I used a simple bash loop to check the file type of each item.
for i in {0..9}; do file ./-file0$i; doneThis allows you to filter through the data and find the file labeled ASCII text. Once identified:
cat ./-file07Happy coding! I am looking forward to tackling levels 6–10 next.
