TryHackMe (THM) | Linux Fundamentals Part 1

Task 1: Welcome to Linux Fundamentals

It's me again, "Jumalaw98.”

Welcome to the "Linux-Fundamentals-part1" room series by TryHackMe! This room introduces Linux, an operating system powering various devices worldwide. Here, we'll learn basic commands in the interactive Linux machine provided in the Rooms and understand Linux's importance in cybersecurity.

Task 2: A Bit of Background on Linux

Question: What year was the first release of a Linux operating system?

The first Linux operating system was released in 1991.

Linux was created by Linus Torvalds in 1991. Source: Wikipedia

Task 4: Running Your First Few Commands

Question: If we wanted to output the text "TryHackMe", what would our command be? echo TryHackMe

The echo command is used to display a line of text. Typing echo TryHackMe in the terminal will output the text "TryHackMe".

Question: What is the username of who you're logged in as on your deployed Linux machine? tryhackme

The whoami command shows the current user logged into the terminal session. Running this command will display the username.

Task 5: Interacting With the Filesystem

Question: On the Linux machine that you deploy, how many folders are there?

Solution: There are 4 folders.

Use the ls command to list the contents of the current directory. The output will show the directories present.

Question: Which directory contains a file? folder4

Use ls -LA folder* commands will list all files and directories inside directories that start with "folder" in the current directory, including hidden files (those that start with a dot), but excluding the. (current directory) and .. (parent directory) entries.

Here's a breakdown of the command:

  • ls: The basic command to list directory contents.

  • -L: Follow symbolic links (if any). It means that if a symbolic link points to a directory, it will show the contents of the directory the link points to.

  • -A: Show all files, including hidden files, but excluding . and ...

  • folder*: A pattern (wildcard) that matches all directories (and files) whose names start with "folder".

By listing the contents of each directory using ls and changing directories with cd, you can explore the filesystem and determine which directory contains a file.

Question: What are the contents of this file?

Solution: Use cat to view the file contents.

cat note.txt

Hello World!

The cat command is used to display the contents of a file.

Question: What is the path to the new current working directory?

Let's Use the pwd command to print the working directory.

/home/tryhackme/folder4

Task 6: Searching for Files

Question: Use grep on "access.log" to find the flag that has the prefix "THM". What is the flag?

grep “THM” access.log

The flag is THM{ACCESS}.

The grep command searches through the file access.log for any occurrences of the string "THM". The output will show the line containing the flag.

Task 7: An Introduction to Shell Operators

Question: If we wanted to run a command in the background, what operator would we want to use? &

The & operator allows you to run a command in the background. For example, running command & will execute the command and return control to the terminal immediately.

Question: If I wanted to replace the contents of a file named "passwords" with the word "password123", what would my command be?

echo password123 > passwords

The > operator redirects the output of the echo command to the file passwords, overwriting its contents.

Question: If I wanted to add "tryhackme" to this file named "passwords" but also keep "passwords123", what would my command be?

echo tryhackme >> passwords

The >> operator appends the output of the echo command to the file passwords, preserving its existing contents.

It illustrates the significance of possessing technical skills, analytical thinking, and adaptability, particularly in technical domains. This experience has improved my abilities and confidence in dealing with difficult problems. As I move forward, I plan to use these lessons in the future to approach new challenges with the same level of skill and expertise.

0
Subscribe to my newsletter

Read articles from Lawrence Juma "Jumalaw98" directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Lawrence Juma "Jumalaw98"
Lawrence Juma "Jumalaw98"

Growth mindset in the tech field, Front-end "React Js, Vue Js", Project Manager, Digital Marketer.