Linux Fundamentals I

Learn to run some of the first essential commands on an interactive terminal...

Introduction

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.

The first version of linux was released in 1991.


Commands

CommandDescription

echo

Output text

whoami

Find out which user we are currently logged into

ls

List the folder or directories

cd

Change directory

cat

Concatenate the contents of a file

pwd

Print the working directory

clear (ctrl+l)

Clear the screen

find

Finds hidden folder and can specify a parameter with -name (e.g. find -name *.txt)

grep

Searches the contents of files for specific values


An Introduction To Shell Operators

Symbol / OperatorDescription

&

Allows you to run commands in the background of your terminal

&&

Allows you to combine multiple commands together in one line of the terminal and running both commands if the first runs

>

It is a redirector (we can take the output from a command and direct it elsewhere - using cat)

>>

The same function as > but appends the output rather than replacing (nothing is overwritten)


Answers

Task 2

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

Task 4

If we wanted to output the text “TryHackMe”, what would our command be? echo TryHackMe

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

Task 5

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

Which directory contains a file? folder4

What is the contents of this file? Hello World

Use the cd command to navigate to this file and find out the new current working directory. What is the path? /home/tryhackme/folder4

Task 6

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

Task 7

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

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

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


Last updated