Skip to content

Linux Primer

Location: Courtyard



See Command Injection


The list of commands that were run in the video, with some explanations, are as follows:


list the contents of the current directory

cat munchkin_19315479765589239

display the contents of the file

rm munchkin_19315479765589239

delete the file


print working directory

ls -a

list the directory but include hidden (dot) files, files beginning with a '.'

history | grep munchkin

history shows the commands that have previously been run
| sends the output of the first command to the input of the second command
grep will only show lines that match the pattern, which is munchkin in this case

env | grep munchkin

env displays the current environment variable settings

cd workshop

cd is change directory


grep -i munchkin toolbox*

-i is a case insensitive search for munchkin in all files in the current directory that start with toolbox

ls -l lollipop_engine

-l is the long listing format and displays the permissions associated with the file

chmod +x lollipop_engine

chmod +x makes the file executable for all users

ls -l lollipop_engine


specify the path to the file that is to be run

cd electrical/

mv blown_fuse0 fuse0

mv moves (renames) a file

ls -l lollipop_engine

ln -s fuse0 fuse1

ln -s creates a symbolic to a file (fuse0) and gives the link a different name (fuse1) from the file that is being linked to

ls -l

cp fuse1 fuse2

copy the file

ls -l

echo "MUNCHKIN_REPELLENT" >> fuse2

echo prints a line of text
>> appends the output of echo, the line of text, to the end of a file|

find /opt/munchkin_den -iname "*munchkin*"

find can be used to search a directory hierarchy for files that match a particular criteria
-iname is a case insensitive search
"*munchkin*" is a wildcard search to find a file that has munchkin somewhere in the name

find /opt/munchkin_den/ -user munchkin

-user match the user that owns the file

find /opt/munchkin_den/ -size +108k -size -110k

-size test the file size and when specified twice both criteria mush be met
in front of the file size + means greater than and - means less than

ps -ef | grep munchkin

ps -ef will display all processes running on the system |

netstat -ant | grep LISTEN

netstat shows network related information on the system
-ant shows all tcp connections and display the result as IP addresses and port number rather than trying resolve the IP addresses to names
grep LISTEN limits the results to just the services that are waiting/listening for an incoming connection such as a web server|

curl http://localhost:54321/

curl can be used to request a web page
localhost:54321 - the web server is running on the local machine (localhost) and on a non-standard port (54321) so the port number has to be specified in the URL

kill 3249

kills the process (3249) if you own the process. The process id is determined from the output of ps -ef