Learning Linux? Great, me too!
Here’s the Linux Fundamentals 1 Walkthrough from TryHackMe. Let’s take a look at some of the fundamentals of Linux including common commands, the terminal, your prompt and more. There’s lots to love in Linux, as there’s so many flavours or distributions, the possibilities are endless.
I hope you learn something on your Linux journey! Enjoy TryHcakMe’s Linux Fundamentals 1.
Disclaimer, for more TryHackMe walkthroughs, see Linux Fundamentals 2 or Linux Fundamentals 3. For more Linux, see the blog and the Linux Quick Start Guide.
Task 1, 2 and 3
To get started, just read each level and click next once you’ve understood the tasks and content. First up, to answer, what year was the first release of a Linux operating system? Use Wiki to find the first flag, 199*, great work!
Before we go any further, let’s connect using OpenVPN to TryHackMe’s virtual private network. Download your OpenVPN config file, then use sudo openvpn /path/to/file/username.ovpn
to start the connection.
Once connected, you can ssh
into the machine to log in as the user to complete the other levels. Do this using ssh tryhackme@<ip address>
, don’t forget both username and password are both tryhackme
.
Task 4 Running Your First few Commands
Alright, now let’s get familiar with the terminal and use your first few commands, echo
and whoami
. Start with either one and use the screenshot below to assist you.
It’s recommended to type the commands, again and again, to get your muscle memory engaged. The more you type, the faster you get and the better you’ll be at using the commands you learn.
Once you’re comfortable with those commands, tackle the questions in this level/task.
To answer, ‘If we wanted to output the text “TryHackMe”, what would our command be?’ use the following echo T**H***M*
. And for ‘What is the username of who you’re logged in as on your deployed Linux machine?’ use the whoami
command.
Nice work!
Task 5 Interacting With the Filesystem!
Nice, let’s keep going with a few more commands we need to navigate the filesystem. To explain, the filesystem is all the folders and files that are preconfigured and used by you the user and Linux itself.
Start with using the ls
command to list out the contents of the current directory, and try adding -l
and -la
after to see how the one command can be used in different ways. More on these later.
Next, start using cd
for Change Directories, the term directory can be likened to a folder, its something that stores files inside it. You can use cd <location>
for example to get to the topmost folder, or root, use cd /. The forward slash is used in file paths to determine the location, but the topmost level only has / as there’s no other directories above it.
If you get lost, use the ~
to get home, that’s the symbol for your logged-in users home directory, so to do that, use cd ~
. Also, you can manually get there by cd /home/<username>
.
You can also use Print Working Directory to check where you are, so that’s pwd
. Your prompt in modern Terminal Emulator Shells like BASH can include pwd
and whoami
at any given time which is a nice feature to have.
Good work so far, let’s take on the task questions for 5.
- ‘On the Linux machine that you deploy, how many folders are there?’ – use the
ls
command. - ‘Which directory contains a file?’ – you can
ls folder<1,2,3,4>/
to see the contents. - ‘What is the contents of this file?’ – use
cat
to concatentate/display the files contents. - ‘Use the cd command to navigate to this file and find out the new current working directory. What is the path?’ – try use
pwd
for this, but make sure you’vecd folder4/
first.
Task 6 Searching for Files
Good work so far!
Another program/command called grep
which can search through the contents of a file.
For this level’s question, ‘Use grep on “access.log” to find the flag that has a prefix of “THM”. What is the flag?’ follow the screenshot below.
Task 7 An Introduction to Shell Operators
Almost there, let’s talk Shell Operators, symbols that make our lives easier!
Try it out using the echo
command like so, echo hey > welcome
and then cat welcome
. Cool hey? We can send the outputs of a command to another destination rather than just the terminal’s output on the screen.
Let’s do the last set of questions for this room.
- “If we wanted to run a command in the background, what operator would we want to use?’ – you’ve got a few options, go over the operators again if you’re unsure.
- ‘If I wanted to replace the contents of a file named “passwords” with the word “password123”, what would my command be?’ – see the screenshot for help below.
- ‘Now if I wanted to add “tryhackme” to this file named “passwords” but also keep “passwords123”, what would my command be’ – same again, see screenthot.
Well done, that’s it! You passed all the levels in the room!
Great work for making it to the end of TryHackMe’s Linux Fundamentals 1 Room. Stay tuned for lots more Linux content, if you can’t wait, check out Linux Unhatched Cisco Course Review And Notes or Mini Linux Lessons.
If you have any feedback, let me know, thanks.
This is Day 32 and 35 of #100DaysOfHacking, subscribe to my newsletter to see the CyberSec journey! If you like, you can follow my Learning Path too.