October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk2 min

OverTheWire Bandit Level 2 Writeup: Read a Filename With Spaces

Use cat "./--spaces in this filename--" to read Bandit Level 2's file. Quoting preserves the spaces, and ./ prevents the leading hyphens from being parsed as options.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

From the bandit2 home directory, run cat "./--spaces in this filename--". Quoting keeps the spaces in one filename argument, while ./ prevents the leading hyphens from being treated like command options. The file’s output is the credential for Bandit Level 3.

What Bandit Level 2 asks you to read

OverTheWire places the next password in a file named --spaces in this filename-- in the home directory. The two leading hyphens and two trailing hyphens are part of the filename.

Log in as bandit2 and confirm that you are in its home directory before running the command.

The reliable command

  1. Connect to the Bandit server as bandit2.
  2. Run:
cat "./--spaces in this filename--"
  1. Copy the displayed value as the password for the next level. Do not publish that credential; game passwords can change and should be retrieved in your own authorized session.

Why the command works

Quotes preserve the spaces

The shell normally treats unquoted whitespace as an argument separator. Without quotes, the filename would be split into several words before cat runs. Double quotes tell the shell to pass the entire path as one argument; the quote characters themselves are removed during command parsing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

./ handles the leading hyphens

The actual name starts with --, which can look like an option to a command. Prefixing it with ./ turns the argument into an explicit relative path beginning with a dot, so cat receives a path rather than an option-like token.

An equivalent escaping form

You can escape each space instead:

cat ./--spaces in this filename--

Both commands address the same file. Quoting is usually easier to read; backslash escaping makes each protected space visible.

Form What it demonstrates Readability
cat "./--spaces in this filename--" Quotes preserve the complete path as one argument. Concise and generally clearest.
cat ./--spaces in this filename-- Each space is escaped individually. More typing, but explicit.

Why the unquoted attempt fails

cat --spaces in this filename--

This does not represent one filename. The shell splits it at each unquoted space, producing multiple arguments. The initial hyphens can also be interpreted as option syntax. Use a quoted or escaped relative path instead.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Useful checks if you are unsure of the name

The level’s official hints include ls, cd, cat, file, du, and find. You do not need every command to complete the level. From the home directory, ls can show the entry; once the spelling is confirmed, use the quoted cat command above.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common mistakes

  • Leaving out one or both sets of hyphens.
  • Typing the spaces without quotes or backslashes.
  • Omitting ./ and allowing the name to be parsed as an option-like argument.
  • Trying to use a password copied from an old walkthrough instead of reading the current file in your own session.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.