Working with Linux CLI
Overview
Room URL: https://tryhackme.com/room/linuxcli-aoc2025-o1fpqkvxti
Difficulty: Easy
Category: Linux Command Line
Date Completed: 12/1/2025
Objectives
- Learn the basics of the Linux command-line interface (CLI)
- Explore its use for personal objectives and IT administration
- Apply your knowledge to unveil the Christmas mysteries
Table of Contents
Introduction
Walk Through
Lessons Learned
Resources
Introduction
With McSkidy potentially compromised and HopSec's attacks escalating, you're thrust into the heart of TBFC's investigation armed only with a command-line interface. While most users panic without a graphical desktop, cybersecurity professionals know that the Linux CLI is far more powerful than any GUI—it's the weapon of choice for defenders and attackers alike. As you navigate McSkidy's home directory and follow cryptic clues left behind, you'll uncover evidence of Sir Carrotbane's malicious Eggstrike campaign that threatens to replace Christmas wishes with an "EASTMAS" invasion. Through mastering essential CLI commands—from basic file listing with ls to powerful log analysis with grep and file discovery with find—you'll learn not just how to operate Linux, but how to think like a SOC analyst hunting for evidence of compromise. This challenge teaches you that Linux isn't intimidating; it's liberating.
Linux Commands
| Command | Syntax | Purpose |
|---|---|---|
| echo | echo "text" |
Display text or output to the terminal |
| ls | ls [directory] |
List files and directories in the current or specified location |
| cat | cat [filename] |
Display the contents of a file to standard output |
| cd | cd [directory] |
Change to a different directory |
| pwd | pwd |
Print the current working directory path |
| ls -la | ls -la [directory] |
List all files including hidden ones (prefixed with .) with detailed information like permissions and ownership |
| grep | grep "search_term" [filename] |
Search for specific text patterns within a file |
| find | find [path] -name [pattern] |
Search for files matching a specific name or pattern in a directory and its subdirectories |
| uptime | uptime |
Display how long the system has been running and current load average |
| ip addr | ip addr |
Check and display the system's IP address configuration |
| ps aux | ps aux |
List all currently running processes on the system |
| sudo su | sudo su |
Switch to the root (administrator) user |
| whoami | whoami |
Display the current logged-in user |
| exit | exit |
Exit the current user session or terminal |
| history | history |
Display the command history for the current user |
CLI Features
| Special Symbol | Name | Purpose | Example |
|---|---|---|---|
| |
Pipe | Send the output from the first command as input to the second command | cat unordered-list.txt | sort | uniq |
> |
Output Redirect (Overwrite) | Redirect command output to a file, overwriting any existing content | some-long-command > /home/mcskidy/output.txt |
>> |
Output Redirect (Append) | Redirect command output to a file, appending to the end of existing content | echo "new line" >> /home/mcskidy/output.txt |
&& |
Logical AND | Execute the second command only if the first command completes successfully | grep "secret" message.txt && echo "Secret found!" |
Walk Through
- First question is what command would you use to list the files in a directory?
ls
- What flag did you see in McSkidy's Guide?
- Upon loggin into McSkidy's dekstop, there is a README.md file in his root directory.
- Used
cat README.txto display the contents of the file.- "For all TBFC members, Yesterday I spotted yet another Eggsploit on our servers. Not sure what it means yet, but Wareville is in danger. To be prepared, I'll write the security guide by tomorrow. As a precaution, I'll also hide the guide from plain view. ~McSkidy"
- Used
cd Documentsto chang directories into McSkidy's documnets folder. - Knowing that there are hidden files, used
ls -lsato view all files in this folder. - Used
cd../to reture to the home directory. - Ran
ls -lsaon all folder to see where to focus next. - The only other folder that had content was the Guides folder
- What command helped you filter logs for failed logins?
- grep
- What flag did you find in the
Eggstrikescript?- Used
cd /hometo move to the directory that has everyone's home folder - Used
find -name *egg*to search everyone's home folder for egg related files (only searches folder McSkidy has access to) - Found file at
/home/socmas/2025/eggstrike.sh cd /home/socmas/2025to move to the folder containing eggstrikecat eggstrike.shto display contents in terminal
- Used
- Which command would you run to switch to the sudo user?
sudo su
- What flag did Sir Carrotbane leave in the root bash history?
- Side quest from McSkidy Documents folder
read-me-please.txt-
su eddi_knappto switch users -
cdto move to eddi_knapp home directory -
ls -lsa Documentsrevealed 2 files- mcskidy_note.txt.gpg
- This file is encrypted with gpg
- notes_on_photos.txt
- Photo notes:
- backup all images weekly
- sync with phone when connected
- organize into 3 folders per year
- Photo notes:
- mcskidy_note.txt.gpg
-
After this I then switched to the Pictures folder using
cd ../Pictures -
Used
ls -lsato view all files in this directory- found a file called
.easter_egg cat .easter_egg- This revealed a passphrase fragment of
c0M1nG- PASSFRAG3 indicates this is the 3rd part of the passphrase
- I used
cd fix_passfrag_backups_20251111162432to explore the folder git log -pover looked the fragment the first couple time viewing this file.- Fragment 2:
1s
- found a file called
-
Passphrase is `3ast3r-1s-c0M1nG
-
Using
ss -tulnI was able to see all of the ports and discoverd that the webserver is running on port8081 -
`openssl enc -d -aes-256-cbc -pbkdf2 -iter 200000 -salt -base64 -in ssl.txt -out decrypted_message.txt -pass pass:'91J6X7R4FQ9TQPM9JX2Q9X2Z'
-
- Used
gpg --out dir.tar.gz -d dir.tar.gz.gpgto decrypt the directory using the flagTHM{w3lcome_2_A0c_2025} - Used
tar -xzf dir.tar.gzto unzip the folder - Hidden Image
sq1.png
Lessons Learned
- Linux CLI Mastery is Essential for Defenders: The command line is not just a tool—it's the foundation of cybersecurity work. Understanding core commands like ls -la (viewing hidden files), grep (searching logs), find (locating malicious artifacts), and cat (reading file contents) transforms you from a bystander into an active investigator. Most servers worldwide run Linux, making CLI proficiency non-negotiable for any security professional. Your ability to chain commands, navigate directories efficiently, and systematically search for evidence demonstrates why experienced security professionals rely entirely on the CLI for investigations.
- Evidence Lives in Logs, Hidden Files, and Command History: Attackers hide their tracks, but they can't erase everything. By combining log analysis with file discovery techniques, you uncovered the Eggstrike malware script that Sir Carrotbane used to compromise the wishlist system. This reinforces critical lessons: always check /var/log/ for failed login attempts, use grep to filter noise from signal, and remember that hidden files (prefixed with .) often contain both legitimate configurations and attacker artifacts. Additionally, bash history (history command and .bash_history files) reveals the commands attackers executed, making it invaluable for forensic analysis and understanding the full scope of a compromise.
- Advanced Techniques Extend Your Investigation Capabilities: Beyond basic CLI commands, mastering user switching (su, sudo su), file encryption/decryption (gpg, openssl), archive manipulation (tar), and network diagnostics (ss -tuln) allows you to recover hidden data and trace attacker movements across multiple user accounts. The ability to piece together fragmented information across multiple systems and encrypted files demonstrates that thorough cybersecurity investigations require both foundational CLI skills and knowledge of specialized security tools.










