Back to all posts
Day 09Tuesday, January 27, 20263 min read

Linux Fundamentals Part 1

linuxlinuxfundamentalscommandlinebashfilesystemgreptryhackmecybersecurityfoundations
View original post

🎯 Goal

Get comfortable navigating and interrogating a Linux system using core terminal commands, instead of blindly copy-pasting.


βœ… What I Did

  • Completed TryHackMe – Linux Fundamentals Part 1
    πŸ‘‰ https://tryhackme.com/room/linuxfundamentalspart1

  • Practiced essential Linux commands:

    • User identification

    • File and directory navigation

    • File content inspection

    • Searching files and strings

    • Basic shell operators

  • Made deliberate mistakes (wrong paths, wrong grep syntax) and corrected them by inspecting the filesystem instead of guessing.


πŸ§ͺ Commands Practiced

Identity & Output

CommandPurpose
whoamiShow current logged-in user
echoOutput text to stdout

tryhackme@linux1:~$ whoami


Navigation & File Discovery

CommandFull Name
lslist
cdchange directory
pwdprint working directory
catconcatenate

ls cd Pictures pwd

  • Learned that directory names with spaces require quotes:

ls "Important Files"


Viewing File Contents

  • Used cat to read text files directly

  • Understood why dumping large files blindly is a bad idea (future: less, head, tail)


Finding Files

  • Located files by name:

find -name passwords.txt

  • Used wildcards:

find -name "*.txt"


Searching File Contents with grep

  • Searched logs for specific strings:

grep 'THM' access.log

  • Learned correct vs incorrect syntax:
    ❌ grep THM* access.log
    βœ… grep 'THM' access.log

Recursive Searching

  • Searched across directories:

grep -R 'THM' /home/tryhackme/


🧠 Shell Operators Learned

OperatorMeaning
&Run command in background
&&Run second command only if first succeeds
>Redirect output (overwrite)
>>Redirect output (append)

Examples:

command1 && command2 echo "log" > file.txt echo "more" >> file.txt


βœ… What Worked

  • Navigating directories logically instead of guessing paths

  • Using ls before cd (basic, but critical)

  • Understanding why grep failed instead of retrying randomly

  • Seeing how small commands chain together into real workflows


❌ What Didn’t

  • Initial misuse of grep wildcards

  • Attempting to cd into directories without confirming they exist

  • Underestimating how strict Linux is with syntax


🧠 Key Takeaways

  • Linux doesn’t forgive assumptions β€” inspect first

  • Wildcards are powerful but dangerous if misunderstood

  • grep is foundational for log analysis and forensics

  • Command-line literacy is non-negotiable in cybersecurity


❓ Questions

  • When should grep be combined with other tools (awk, sed)?

  • What are safe ways to inspect very large files?

  • At what point does scripting replace manual command chains?


πŸ“Œ One-Sentence Summary

Linux becomes manageable the moment you stop guessing and start interrogating the system methodically.