What I Learned from the Linux Shells Course on TryHackMe
As I continue my journey into cybersecurity and Linux fundamentals, I recently completed the Linux Shells course on TryHackMe. This room gave me a solid understanding of what shells are, how they function, and why they’re a crucial tool in both system administration and ethical hacking.
Here’s a breakdown of what I learned:
🐚 Understanding the Shell
At its core, a shell is a command-line interface that allows users to interact with the Linux operating system. I explored different types of shells, including:
- Bash – the most common shell
- sh – a simpler, older shell
- zsh – more advanced, with added features
- csh/tcsh – shells that use a C-like syntax
Each has its own use cases, and knowing the differences can be key when working in varied environments.
💬 Interactive vs Non-Interactive & Login vs Non-Login Shells
I learned how Linux shells operate differently depending on how they're started:
- Interactive shells are what we typically use in a terminal session.
- Non-interactive shells run scripts or commands in the background.
- Login shells read configuration files like
.bash_profile
. - Non-login shells read
.bashrc
.
This helped me understand why certain environment variables or aliases sometimes don’t load as expected.
🧪 Reverse & Bind Shells
One of the coolest parts of the course was learning how to establish shell connections during exploitation:
- Reverse Shells – where the target connects back to the attacker
- Bind Shells – where the target listens for incoming connections
We used tools like bash
, netcat
, and socat
to set these up—skills that are foundational in penetration testing and CTF challenges.
🔧 Shell Stabilization
After gaining shell access, I learned how to upgrade a limited shell into something more usable. For example:
bash
CopyEdit
python3 -c 'import pty; pty.spawn("/bin/bash")'
This allows for better command-line interaction, such as using arrow keys and tab completion—small upgrades that make a huge difference in post-exploitation.
📜 Scripting Basics
I also dived into basic Bash scripting, including:
- Writing and executing simple scripts
- Using variables, loops, and conditionals
- Making scripts executable with
chmod +x
It was a great intro to automation and the logic behind Linux scripting, which is vital for everything from system tasks to building hacking tools.
💡 Final Takeaways
Completing the Linux Shells course really helped me:
- Understand how different shell types behave
- Handle shell access during hacking scenarios
- Start writing basic shell scripts
- Troubleshoot and upgrade limited shell environments
If you’re getting started in Linux or ethical hacking, I highly recommend this course. It’s clear, hands-on, and full of practical insights.
