Sugarplum Mary? That's me!
I was just playing with this here terminal and learning some Linux!
It's a great intro to the Bash terminal.
If you get stuck at any point, type
hintmeto get a nudge!
Can you make it to the end?
yes ls ~ cat munchkin_19315479765589239 rm munchkin_19315479765589239 pwd ls -la grep "munchkin" .bash_history env cd workshop grep -i -r "munchkin" . chmod +x lollipop_engine ./lollipop_engine cd electrical mv blown_fuse0 fuse0 ln -s fuse0 fuse1 cp fuse1 fuse2 echo "MUNCHKIN_REPELLENT" >> fuse2 find /opt/munchkin_den -iname "*munchkin*" find /opt/munchkin_den/ -user munchkin find /opt/munchkin_den/ -size +108k -size -110k ps aux| grep -i "munchkin" netstat -tl curl 127.0.0.1:54321/ kill PID exit
Middle of the Courtyard (see map)
All the lollipops on this system have been stolen by munchkins. Capture munchkins by following instructions here and 🍭's will appear in the green bar below. Run the command "hintme" to receive a hint. Type "yes" to begin:
Perform a directory listing of your home directory to find a munchkin and retrieve a lollipop!
lscommand allows you to list the contents of a directory, and
~is the Linux shortcut for your home directory.
Now find the munchkin inside the munchkin.
- There's a file in your home directory called
munchkin_1931547976558923. Let's view it's contents
Great, now remove the munchkin in your home directory.
- Use the
rmcommand to remove the previous file
Print the present working directory using a command.
pwdprints the present working directory in Linux
Good job but it looks like another munchkin hid itself in you home directory. Find the hidden munchkin!
- By default
lsdoes not show hidden files (those with a leading
.). Use the
-aflag to show everything
ls -a ~
Excellent, now find the munchkin in your command history.
grepcommand allows us to search for strings and regex patterns in files
- When using
bash, your command history is stored in
~/.bash_history. Let's search this file for the munchkin
grep "munchkin" ~/.bash_history
Find the munchkin in your environment variables.
- The environment variables of the current shell can be printed with the
Next, head into the workshop.
cdcommand allows us to change directories. Paths can be relative to the present working directory (
workshop) or absolute (
A munchkin is hiding in one of the workshop toolboxes. Use
grepwhile ignoring case to find which toolbox the munchkin is in.
grepwe can ignore case by using the
-iflag, and can search a directory recursively with the
.in this context is a Linux shortcut meaning the current directory.
grep -i -r "munchkin" .
A munchkin is blocking the lollipop_engine from starting. Run the lollipop_engine binary to retrieve this munchkin.
- Linux will not allow an executable file to run unless the execution permission is set. If we run the command
ls -la lollipop_enginewe see that the binary does not have the execution permission. We can add execute permission with
chmod, then can run the binary
chmod +x lollipop_engine ./lollipop_engine
Munchkins have blown the fuses in /home/elf/workshop/electrical. cd into electrical and rename blown_fuse0 to fuse0.
- Files are renamed using the
cd electrical mv blown_fuse0 fuse0
Now, make a symbolic link (symlink) named fuse1 that points to fuse0
- A symbolic link, or symlink for short, is when a file pointers to another file on disk. In Linux they are created with the
lncommand and the
ln -s fuse0 fuse1
Make a copy of fuse1 named fuse2.
- Files are copied using the
cp fuse1 fuse2
We need to make sure munchkins don't come back. Add the characters "MUNCHKIN_REPELLENT" into the file fuse2.
echoallows us to print information to the screen. We can use the redirection operators to send this echoed output to a file, either overwritting the original contents (
>) or appending to it (
echo "MUNCHKIN_REPELLENT" >> fuse2
Find the munchkin somewhere in /opt/munchkin_den.
findcommand allows us to search for files in the filesystem based on properties such as name, size, owner, permissions, etc. The
-inameargument allows us to search by filename and ignore case
find /opt/munchkin_den/ -iname "*munchkin*"
Find the file somewhere in /opt/munchkin_den that is owned by the user munchkin.
-userflag allows us to search by the file's owning user
find /opt/munchkin_den/ -user munchkin
Find the file created by munchkins that is greater than 108 kilobytes and less than 110 kilobytes located somewhere in /opt/munchkin_den.
-sizecan be used to look for a file with an exact size, or a size greater than (preceding
+), or less than (preceding
-) a given value. The flag can be repeated multiple times to set a size range
find /opt/munchkin_den/ -size +108k -size -110k
List running processes to find another munchkin.
- Processes can be listed with the
pscommand with the following flags
ashow processes for all users
udisplay the process's owner
xshow processes not attached to a terminal
ps aux| grep -i "munchkin"
The 14516_munchkin process is listening on a tcp port. Use a command to have the only listening port display to the screen.
sson modern systems) command prints network-related information. We can then use flag
-lto only show listening ports, and
-tto only show TCP ports
The service listening on port 54321 is an HTTP server. Interact with this server to retrieve the last munchkin.
curlcommand can be used to interact with an HTTP(S) server.
Your final task is to stop the 14516_munchkin process to collect the remaining lollipops.
- Processes can be killed with the
killcommand followed by the process ID (pid), which we saw in the second column of the
ps auxoutput. Your pid will likely be different.
Congratulations, you caught all the munchkins and retrieved all the lollipops!
Type "exit" to close...