So you’re learning Linux aye? Welcome aboard!
Here’s the Linux Fundamentals 2 Walkthrough from TryHackMe. Let’s take a look at some of the fundamentals of Linux including some more commands, ssh, bash scripting and more.
There’s lots to love in Linux, I hope you learn something here on your Linux journey! Enjoy TryHackMe’s Linux Fundamentals 2.
Disclaimer, for more, see Linux Fundamentals 1, Linux Fundamentals 3 and Linux Quick Start Guide. Check out the video guide too:
Task 1 & Task 2 Accessing Your Linux Machine Using SSH
To get started, make sure you’re connected to the TryHackMe VPN. If you’d like to automate this, you can create a small bash script.
Create a new file using a text editor, more on this soon, use
nano tryhackme-openvpn and use the following text and see the screenshot below for help.
#!/bin/bash sudo openvpn /file/path/<username>/Downloads/<your file>.ovpn
Nice, you’ll just have to make the bash script executable using
chmod +x <file name>.ovpn and hit enter. Running
ls -l will show you the difference in permissions, see screenshot below.
Great work, the last step is to
ssh into the Virtual Machin (VM) and you’re good to go!
Think about it like, OpenVPN has connected you to the TryHackMe network, and then SSH is letting you log in as a user on that network, pretty cool. See the screenshot below for more.
Task 3 Introduction to Flags and Switches
Now it’s time for switches, these are like settings or options you can turn on by using a
- followed by either a lowercase, uppercase or phrase.
Switches might seem weird at first, but think about how many settings are in your web browser for example. They’re all behind a settings menu, image if you could access any setting with just a single letter, kinda powerful stuff. Sure, you just need to learn the switches, but once you know them, it’s much faster than accessing setting menus every time.
Try using the
ls command again, but add the switches in the screenshot below.
To learn what switches do what, you can either run the manual page for the command like
man ls or
ls --help sometimes commands allow
Let’s go over the task questions:
- ‘What directional arrow key would we use to navigate down the manual page?’ – to explain, the arrow keys act like the scroll wheel on your mouse, you can cycle through your used commands. Up goes up, so down must go…?
- ‘What flag would we use to display the output in a “human-readable” way?’ – so you can mannually search through the help output, but a easier way is to search through it automatically. You can do this use
ls --help | grep "human"this ‘pipes’ the output from
grepallowing you to search the contents against
"human", pretty cool hey? See below for an example.
Task 4 Filesystem Interaction Continued
Awesome, more filesystem commands, let’s go! You can go ahead and just make new files using
touch <file name> and for folders/directories you can use
mkdir <dir name>.
To delete, use the
rm command, just be careful to note remove the wrong files or directories, see screenshot below.
To copy, use the
cp command, see screenshots.
To move, use the
And if you want to know what type of file a file is, just run the
file command against it.
Nice, let’s go over the tasks questions:
- ‘How would you create the file named “newnote”?’ – you can do this is a few ways, but for this task, use the
- ‘On the deployable machine, what is the file type of “unknown1” in “tryhackme’s” home directory?’ – run the
filecommand agasint it to find out.
- ‘How would we move the file “myfile” to the directory “myfolder”’ – remember, use the move command like this
mv <old directory> <new directory>.
- ‘What are the contents of this file?’ – you can use the
catcommand for this one.
Task 5 Permissions 101 & Task 6 Common Directories
Ah, permissions, it’s very daunting at first, but there’s a method to the madness.
ls -l to see the permissions for the current directories files. You’ll see either a
w or an
x – these stand for read, write and execute. Read means you can see it, write means you can edit it, and execute means you can run it.
To switch users, use the
su command, but to run an application as another user without switching, use
sudo. Note, the
sudo command’s default behaviour runs as root, this is commonly used to allow full authenticated behaviour on a system.
Okay, time for this tasks questions:
- ‘On the deployable machine, who is the owner of “important”?’ – using
ls -lsee the column showing usernames.
- ‘What would the command be to switch to the user “user2”?’ –
suis the command, but how do you switch to
- ‘Output the contents of “important”, what is the flag?’ – once you switch users, use the
catcommand to display the
Next up is Task 6, let’s go straight to the task questions:
- ‘What is the directory path that would we expect logs to be stored in?’ – the
/varhas variable data like logs.
- ‘What root directory is similar to how RAM on a computer works?’ – RAM is volitale, meaning it’s deleted after a system shut down or reboot, similar to a temporary directory.
- ‘Name the home directory of the root user’ – it’s the same name as the user itself.
Nice work, you’ve done Linux Fundamentals 2 from TryHackMe. I hope you enjoyed the room and found this walkthrough helpful, best of luck on your Linux learning journey.
This is Day 33 and 36 of #100DaysOfHacking, subscribe to my newsletter to see the CyberSec journey! If you like, you can follow my Learning Path too.