Ahmed Elghazaly
5 min readFeb 26, 2023

Linux FundamentalsPart 1 — TryHackMe

#Task1

introduction to Linux: -Welcome to the first part of the “Linux Fundamentals” room series. You’re most likely using a Windows or Mac machine; both are different in visual design and how they operate. Just like Windows, iOS and MacOS, Linux is just another operating system and one of the most popular in the world powering smart cars, android devices, supercomputers, home appliances, enterprise servers, and more.

We’ll be covering some of the history behind Linux and then eventually starting your journey of being a Linux-wizard! This room will have you:

  • Running your very first commands in an interactive Linux machine in your browser
  • Teaching you some essential commands used to interact with the file system.
  • Introduce you to how users and groups work on Linux (and what this means for us as penetration testers)

#Task2

A Bit of Background on Linux:-Where is Linux Used?

It’s fair to say that Linux is a lot more intimidating to approach than Operating System’s (OSs) such as Windows. Both variants have their own advantages and disadvantages. For example, Linux is considerably much more lightweight and you’d be surprised to know that there’s a good chance you’ve used Linux in some form or another every day! Linux powers things such as:

  • Websites that you visit
  • Car entertainment/control panels
  • Point of Sale (PoS) systems such as checkout tills and registers in shops
  • Critical infrastructures such as traffic light controllers or industrial sensors

Flavours of Linux

The name “Linux” is actually an umbrella term for multiple OS’s that are based on UNIX (another operating system). Thanks to UNIX being open-source, variants of Linux comes in all shapes and sizes — suited best for what the system is being used for.

For example, Ubuntu & Debian are some of the more commonplace distributions of Linux because it is so extensible. I.e. you can run Ubuntu as a server (such as websites & web applications) or as a fully-fledged desktop. For this series, we’re going to be using Ubuntu.

Ubuntu Server can run on systems with only 512MB of RAM

Similar to how you have different versions Windows (7, 8 and 10), there are many different versions/distributions of Linux.

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

Answer →1991

#Task3

Interacting With Your First Linux Machine (In-Browser): -I’ve deployed my first Linux machine!

#Task4

Running Your First Few Commands: -In this task we will discuss two commands are →echo, whoami.

1-echo →Output any text that we provide.

2-whomai →Find out what user we’re currently logged in as!

#Task5

Interacting With the Filesystem: -These commands are used to navigate and view files.

ls →list files and directories in the current working directory.

cd → It is used to change the current working directory to a different directory.

cat →It is used to display the contents of a file in the terminal.

pwd →It is used to display the current working directory in the terminal.

In this example, I used cd to navigate to the image file, and then we display what is inside this directory via the ls command.

Here I display the content of the file through the cat command

here I used pwd display the current working directory in the terminal.

Questions:-

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

Answer →4

2-Which directory contains a file?

Answer →folder4

3-What is the contents of this file?

Answer →Hello World

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

Answer →/home/tryhackme/folder4

#Task6

Searching for Files:-Here are the explanations for the find and grep commands in Linux, which are commonly used for searching for files:

1-find → find command is used to search for files and directories in a specified location and perform a particular action on them. The syntax of the find command is as follows: $find [path] [expression].

2-grep →The grep command is used to search for a specified pattern or text in one or more files. The syntax of the grep command is as follows:

$grep [options] pattern [file…]

questions:-

Use grep on “access.log” to find the flag that has a prefix of “THM”. What is the flag?

Answer →THM{ACCESS}

#Task7

An Introduction to Shell Operators:-Linux operators are a fantastic way to power up your knowledge of working with Linux. There are a few important operators that are worth noting. We’ll cover the basics and break them down accordingly to bite-sized chunks.

At an overview, I’m going to be showcasing the following operators:

& →his operator allows you to run commands in the background of your terminal.

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

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

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

Questions:-

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

Answer →&

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

Answer →echo password123 > passwords

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

Answer →echo tryhackme >> passwords

#Task8

To quickly recap, we’ve covered the following:

Understanding why Linux is so commonplace today
Interacting with your first-ever Linux machine!
Ran some of the most fundamental commands
Had an introduction to navigating around the filesystem & how we can use commands like find and grep to make finding data even more efficient!
Power up your commands by learning about some of the important shell operators.

Visit part two of the Linux fundamentals series here! https://tryhackme.com/room/linuxfundamentalspart2

#Task9:-Linux Fundamentals Part 2

Visit part two of the Linux fundamentals series here! https://tryhackme.com/room/linuxfundamentalspart2

My writeup for linux fundamentals part2 click here

Thanks for reading! I hope you learned well from these writeup.