The Goal
The password for Level 2 is stored in a file named - in the home directory.
The Problem
Typing cat - does not open a file named -. The shell interprets
- as a convention meaning standard input (stdin), so the terminal waits for
keyboard input rather than reading the file. Something else is needed.
The Solution
Specifying an explicit path bypasses the stdin interpretation. Using cat ./-
tells the shell to look for a file named - in the current directory:
bandit1@bandit:~$ cat ./-
password
Commands Covered
cat ./-, read a file named-by specifying it as an explicit path