Walkthrough - Learn the Linux Fundamentals Part 1 | TryHackMe

 This blog is a walkthrough for the machine in tryhackme on Linux Fundamentals Part 1.

The machine contains 9 Tasks. Let's discuss and find the solutions for each one of them.

Note: Before reading the solution/walkthrough, please try your best with the machine once.


Task - 1: Introduction

This task contains the introduction of the machine and a welcome note.

It does not contain any question to be answered.


Task - 2: A bit of Background on Linux

This task discusses about where Linux machines have been used and different versions about it.

It has 1 question to be answered.

Q1 -  Research: What year was the first release of a Linux operating system?

Answer is 1991.

It is just a google search away.


Task - 3: Interacting With Your First Linux Machine (In-Browser)

This section gives information on how to connect to the given machine within the browser.

You need to press on the "Start machine" option/button at the top right of the task, to start the machine and connect to it via browser.

Note: In case you can not see your linux machine in the right hand side automatically, press on the Start "Attack Box" button(blue coloured) at the top of the site.

This section does not contain any question to be answered.


Task - 4: Running Your First Few Commands

Two Commands are introduced to you here, echo and whoami

The echo command is just like a print statement in terminal.

The whoami command finds out what user we are currently logged in as.

There are 2 Questions in this part.

Q1 - If we wanted to output the text "TryHackMe", what would our command be?

Solution: To print something in the terminal, we use the echo command.

Example : To print/output OWASP in terminal, we type - echo OWASP

So, similarly to output the text "TryHackMe", we need to type - echo TryHackMe

Q2 - What is the username of who you're logged in as on your deployed Linux machine?

Solution: To see the username that you have currently logged in, you have to use the whoami command in the terminal. The output that you get is the username under which you have logged in.

Here, the user under which we are logged in is tryhackme .


Task - 5: Interacting With The FileSystem

We come across 4 important commands in File Handling in Linux FileSystem: ls, cd, cat, pwd.

In simple words, ls is used to list what all are there in the present directory.

cd is used to change directories in the terminal.

cat command is used to display the contents of a file (not limited to a text file).

pwd(print working directory) is used to know where is the present directory located.

There are 4 questions is this section.

Q1 - On the Linux machine that you deploy, how many folders are there?

Solution: ls is used to print all the contents in the present directory.

There are 4 folders present in the present directory.

 Q2 - Which directory contains a file?

Solution: We need to go and check inside each folder/directory if any file is there or not.

We need to use cd and then do ls, for each folder.

As we can see that only folder4 contains a file, namely note.txt, the answer is folder4.

Q3 - What is the contents of this file?

Solution:  To see the contents of a file, we need to use the cat command.


The contents of the file note.txt is "Hello World!".

Q4 - Use the cd command to navigate to this file and find out the new current working directory. What is the path?

Solution: To see the path of the current directory that we are working on, we use the command pwd(print working directory).


The working directory is /home/tryhackme/folder4 .



Task - 6 : Searching For Files

Here, find and grep are discussed in a bit detailed manner. 

It is highly useful if you read the information given in the site or to use man command to know what different commands are used for.

find searches for files in a directory hierarchy.

grep searches for the given pattern and prints the lines that matches it.

This task has 1 Question.

Q1 - Use grep on "access.log" to find the flag that has a prefix of "THM". What is the flag?

Solution: grep is used to find patterns in the files.


As we can see, the flag that has a prefix of "THM" is "THM{ACCESS}".



Task - 7 : An Introduction to Shell Operators

4 shell operators are introduced here: &, &&, >, >>. 

& operator allows you to execute commands in the background.

&& operator allows you to combine multiple commands together in one line of your terminal.

> operator is a redirector - meaning that you can take the output from a command (such as using cat to output a file) and direct it elsewhere.

>> operator does the same function of the > operator but appends the output rather than replacing (meaning nothing is overwritten).

There are 3 questions in this section to answer.

Q1 - If we wanted to run a command in the background, what operator would we want to use?

Solution: &. It is a direct question.

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

Solution: As we are going to replace and not appending, we should use > operator, and we need to echo the value into the file.

So, the command would be: echo password123 > passwords

Q3 - Now if I wanted to add "tryhackme" to this file named "passwords" but also keep "passwords123", what would my command be

Solution: As we want to append the value to the file, we should use >> operator.

So, the command would be: echo tryhackme >> passwords .


Task - 8 : Conclusion & Summaries

This section contains a congratulations note and a quick recap on what all were used to solve this machine.


Task - 9 : Linux Fundamentals Part 2

This last and final part contains information stating to terminate the machine that we started in the Task 3 and to join the next machine (Linux Fundamentals Part 2).


Connect with me on LinkedIn



2 Comments

  1. png 1500w, https://www.laweekly.com/wp-content/uploads/2021/06/Screen-Shot-2021-06-18-at-11.03. The news and editorial staffs of The Denver Post had no role in this post’s preparation.. Visit: https://www.urineworld.com/

    ReplyDelete
  2. free livescore prediction tips,betting tips jeetwin jeetwin ミスティーノ ミスティーノ starvegad starvegad 879Pick N Parlay | Shootercasino

    ReplyDelete