In this article, I will write a write-up for the Linux Shell that covers Interacting With a Shell, Types of Linux Shells, Shell Scripting and Components, The Locker Script and a Practical Exercise at the end.
Who is the facilitator between the user and the OS?
Shell
What is the default shell in most Linux distributions?
Bash
Which command utility is used to list down the contents of a directory?
ls
Which command utility can help you search for anything in a file?
grep
Which shell comes with syntax highlighting as an out-of-the-box feature?
Fish
Which shell does not have auto spell correction?
Bash
Which command displays all the previously executed commands of the current session?
history
What is the shebang used in a Bash script?
#!/bin/bash
Which command gives executable permissions to a script?
chmod +x
Which scripting functionality helps us configure iterative tasks?
loops
What would be the correct PIN to authenticate in the locker script?
7385
Practical Exercise
We have placed a script on the default user directory /home/user
of the attached Ubuntu machine. This script searches for a specific keyword in all the files (with .log extension) in a specific directory.
Note: Some changes are required inside the script file before you execute it. When you open the machine according to the instructions in task #2, you will be able to gain the session as a normal user. However, we recommend you to become the root user in order to search for the flag in all the files of the given directory. To become one, you only need to type the following command and enter the password of the user:
Become Root User
user@ubuntu:~$ sudo su[sudo] password for user:
root@tryhackme:/home/user#
You can make the changes in the script file by keeping in view the following details:
Flag: thm-flag01-script
Directory: /var/log
Hint: Look for empty double quotes " "
inside the script file and fill them. Make sure not to leave any space between them.
Answer the questions below
- Which file has the keyword?
authentication.log
The image below answers the next questions 12 & 13
First you’ll get to **
/home/user
then you’llcd ../..
then you’llcd** /var/log
when you run ls you’ll see a lot of files that end with .log, you can open each with
nano filename.log
but remember the hint of the flag and something about a cat sleeping
- Where is the cat sleeping?
under the table
Thank you for reading my article. Please leave any questions or comments on improving my learning journey and the THM challenges. We can also connect more on LinkedIn or **X**