Table of contents
- Task 1: Introduction
- Task 2 : A Bit of Background on Linux
- Task 3: Interacting With Your First Linux Machine (In-Browser)
- Task 4 : Running Your First few Commands
- Task 5 : Interacting With the Filesystem!
- Task 6 : Searching for Files
- Task 7: An Introduction to Shell Operators
- Task 8: Conclusions & Summaries
- Task 9: Linux Fundamentals Part 2
- Task 10: Conculsion
In this room of tryhackme , you will get to know the basic commands and operators of linux , a overview of linux operating system and how to start a linux machine on tryhackme (THM) . You can join this room with the following link : tryhackme.com/room/linuxfundamentalspart1 So let's do this .
Task 1: Introduction
Linux is a open source operating system which is freely available on internet . An operating system is a software which enables the communication between computer hardware and software . If you are reading this article on pc/laptop , most probably you are using windows or mac operating system and if you are reading this article on your smartphones , most probably you are using android operating system . Linux is also one of those operating system .
Answer the given question below
Let's get started!
Ans. Just click on Submit (no answer needed)
Task 2 : A Bit of Background on Linux
Linux is everywhere . It can be used from computer , smartwatches to cars and refrigerators . Linux is very light weight , open source , secure , stable and flexible . These are the reasons because of which it is very popular operating system . It comes with various distributions available in market like Kali Linux , Ubuntu , Fedora , Arch and many more . It was created by Linus Torvalds in 1991 .
Answer the given question below
Research: What year was the first release of a Linux operating system?
Ans. 1991
Task 3: Interacting With Your First Linux Machine (In-Browser)
You can use linux on tryhackme for practicing different questions or learn new things . All you have to do is click on Start Machine which is available on task 3 .
And Boom ! Your Machine is Started . You will be given a IP Address and termination time of your machine .
The linux distribution on tryhackme is Ubuntu .
Answer the given question below
I've deployed my first Linux machine!
Task 4 : Running Your First few Commands
The two basic commands which are discussed in task 4 is Echo and Whoami.
Echo: In simple words , echo works just like how print command works in different languages . For example if you enter $ echo "hello world" it will print hello world .
Whoami : This command will give you the name of the user with which you are currently logged in . We will see the example of whoami in task 4 questions .
Answer the given question below
If we wanted to output the text "TryHackMe", what would our command be?
Ans . echo TryHackMe
What is the username of who you're logged in as on your deployed Linux machine?
Ans. tryhackme
Task 5 : Interacting With the Filesystem!
The commands which are discussed in task 5 are ls , cd , cat , pwd
ls : The most basic command in linux is ls . It will list all the directories and files of your home directory or any other directory you are in (think directory as a folder). For example : Perform ls command on your machine and see the output .
It gives you all the files and folder which are stored in your machine .
cd : The next command is cd which is change directory . For example you want to move in some directory say folder1 then you will perform a command cd folder1 and now you are in folder1
Notice the change of address when we moved in folder1
cat: Suppose you want to see the content of any file . In that case you will use the command cat . For example : I want to see the content of file1 , in that case I will perform cat file1 .
Now you can see the content of file1.
pwd: pwd stands for print working directory . It will print you the address of the directory you are in .
Answer the given question below
On the Linux machine that you deploy, how many folders are there?
Ans. 4
Which directory contains a file?
In this we need to move in each directory and check if there is a file or not.
Ans . folder4
What is the contents of this file?
Ans. Hello World!
Use the cd command to navigate to this file and find out the new current working directory. What is the path?
Ans. /home/tryhackme/folder4
Task 6 : Searching for Files
In this task , we will discuss about two command find and grep
find : Suppose you want to search a file among 1000 of directories , how will you find it . In this situation , find come into action . find – allows us to search for files or directories that match specific search criteria. Two common options are -type and -name. For -type, we can use d for directories or f for files, for example:
find -type d
find -type f
If you want to search note.txt in your machine you will write find -type f -name note.txt
And suppose you don't know the full name of the file but you know the extension , in that case you can use find -name *.txt
grep : grep allows us to search the content of files . We will see the use of grep command in the questions .
wc helps us to know the number of lines in a file .
Answer the questions below
Use grep on "access.log" to find the flag that has a prefix of "THM". What is the flag?
Ans . THM{ACCESS}
And I still haven't found what I'm looking for!
Ans . No answer needed
Task 7: An Introduction to Shell Operators
In this task , we will discuss about shell operators like & , && , > , >>
& : Suppose you are copying a large file on linux and you also want to do other things while your file is being copied . So you can use & operator to keep using terminal while the file is being copied in background .
&& : You can use this operator where you want combine two or more commands . Note that command 2 will only run if command 1 is successful .
For Example : I want to move in folder4 and print the content of note.txt .
It will first move in folder4 and then print the content of file .
> : This operator is known as output redirector . Suppose you want to store the output of some command in some file so you can use this operator .
As you can see it automatically creates a file with the name you provided .
>> If you want to add another output in the same file , you can use this operator .
As you can see the output is added at the end of file .
Answer the questions below
If we wanted to run a command in the background, what operator would we want to use?
Ans : &
If I wanted to replace the contents of a file named "passwords" with the word "password123", what would my command be?
Ans : echo password123 > passwords
Now if I wanted to add "tryhackme" to this file named "passwords" but also keep "passwords123", what would my command be
Ans: echo tryhackme >> passwords
Now use the deployed Linux machine to put these into practice
Ans. No answer needed
Task 8: Conclusions & Summaries
We have covered some commands of linux with examples . They may seem basic, but they are absolutely essential for mastery of Linux, and we will see them over and over again.
Answer the questions below
I'll have a play around!
Ans. No answer needed
Task 9: Linux Fundamentals Part 2
If you want to learn more commands of linux , please join Linux fundamental part2 with following link :
tryhackme.com/room/linuxfundamentalspart2
Answer the questions below
Terminate the machine deployed in this room from task 3.
Ans . No answer needed
Join Linux Fundamentals Part 2!
Ans. No answer needed
Task 10: Conculsion
I hope you enjoyed this walkthrough . Always maintain your streak and be consistent . If you have any query you can message me on tryhackme . My username is tanya.go . A huge thanks to tryhackme and cmnatic for putting this room together!