Skip to main content

Settings

Color Mode

Theme Skin

Background

Appearance preferences are saved in this browser only.

Environment

Current Environment Production

Built with JEKYLL_ENV=production. Changes require deployment.

Quick Links

Theme & Build

Jekyll v3.10.0
Last BuildNov 24, 17:25

Page Location

Page Info

Layout default
Collection wargames
Path _wargames/bandit/bandit3.md
URL /wargames/bandit/bandit3/
Date 2026-04-07

Bandit Level 3

Bandit Level 3 — read a file whose name contains spaces by using quoting, escaping or tab completion.

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 a file called --spaces in this filename-- located in the home directory

Commands you may need to solve this level

ls , cd , cat , file , du , find

Helpful Reading Material

Study guide

Level map: logged in as bandit2, find the password for bandit3.

What this level teaches

How the shell splits a command line into words, and how to keep a filename with spaces together.

Key ideas

  • Word splitting. The shell breaks a command at every space, so cat my file is read as two arguments, my and file.
  • Quoting (single or double quotes) and backslash escaping both tell the shell “treat this as one word”.
  • Tab completion has the shell finish a name for you, inserting the correct escapes automatically.

How to approach it

  1. ls shows the file. Note how its name appears.
  2. Try the three techniques above on a harmless file first, for example one you create yourself in a mktemp -d directory.
  3. Start typing the name and press Tab. Seeing the escapes the shell inserts is the quickest way to understand them.

Why it matters

Spaces and special characters in filenames cause the classic scripting bugs. Always quoting variables in scripts ("$file") comes directly from this lesson.