Linux Fundamentals on Hack the Box

Introduction
This module covered the fundamentals of Linux. I needed to understand the Linux architecture as it is an important aspect in the field of cybersecurity. Through this module, I covered the history of Linux, directory structure, navigation using the terminal, and generally boosting my confidence in using Linux machines.
System Information
In this section, I covered the various commands in Linux. Thus, like ID, whoami, pwd, uname, and many more. I also learnt how to log in using the ssh to a remote server.
In this section, I answered the following questions:
Find out the machine hardware name and submit it as the answer.
Ans: - x86_64
What is the path to htb-student's home directory?
Ans: /home/htb-student
What is the path to the htb-student's mail?
Ans: /var/mail/htb-student
Which shell is specified for the htb-student user?
Ans: /bin/bash
A screenshot of various answers.
Navigation
I also went through this section and learn more about navigation in lunux terminal. Using the pwd command to see the current directory using the ls command to see more directories. Mostly when navigating from one directory to another, we use the cd command.
I answered the following questions:
What is the name of the hidden "history" file in the htb-user's home directory?
Ans: .bash_history
What is the index number of the "sudoers" file in the "/etc" directory?
Ans: 147627
A screenshot of the spawn box
Working with Files and Directories
On this module, I covered how to open files, creating, moving, and copying. This is possible using the following commands: vim or nano for opening files, and cp, m,v, and touch for creating a file.
I answered the following questions.
What is the name of the last modified file in the "/var/backups" directory?
Ans: apt.extended_states.0
What is the inode number of the "shadow.bak" file in the "/var/backups" directory?
Ans: 265293
Below is a screenshot for the answers.
Find Files and Directories
I then went on to see how to locate and find the files we want from the terminal. This is made possible by running commands like which, find, and locate. These commands will help us find the desired files and directories in a short time.
I answered the following questions
What is the name of the config file that has been created after 2020-03-03 and is smaller than 28k but larger than 25k?
Ans: 00-mesa-defaults.conf
How many files exist on the system that have the ".bak" extension?
Ans: 4
Submit the full path of the "xxd" binary.
Ans: /usr/bin/xxd
A screenshot of the questions
File Descriptors and Redirections
I then went on to learn about file descriptors in Linux, STDIN (0), STDOUT (1), and STDERR (2), which the system uses to manage input and output. With commands like cat and find, I saw how we can use redirection (>, >>, <, 2>) to control where data goes. For example, 2>/dev/null hides errors, and >> adds output to a file without overwriting it. Using pipes (|), I could pass one command’s output into another, like filtering with grep or counting lines with wc -l. This made working in the terminal much more efficient.
I then answered the following questions.
How many files exist on the system that have the ".log" file extension?
Ans : 32
How many total packages are installed on the target system?
Ans : 737
File System Management
I then went on to learn how file systems are managed in Linux. This includes how data is organized, stored, and maintained on disks using different file system types like ext4, Btrfs, XFS, and NTFS. Each has its own purpose depending on what you need, like speed, data integrity, or compatibility with Windows.
I answered the following questions
How many partitions exist in our Pwnbox? (Format: 0)
Ans : 3
Conclusion
To conclude on this, learning Linux fundamentals has helped me understand how the system works behind the scenes. From navigating directories and managing files to handling disks and mounting storage, I now see how powerful and flexible Linux is. These basics are the foundation for doing more advanced tasks like system administration, scripting, and cybersecurity.
Subscribe to my newsletter
Read articles from John Maina directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
