Linux Fundamentals Part 3
https://tryhackme.com/room/linux3
Task 1 Intro
Read the above.
No answer needed
Deploy the machine attached to this task!
No answer needed
Task 2 [Section 5: Advanced File Operations] - cp
cp duplicates(copies) files. The syntax is cp <file> <destination>
No answer needed
Task 3 [Section 5: Advanced file Operations] - cd && mkdir
Linux allows you to change the location of the current directory through the use of the cd command. The syntax of the cd command is this, cd <directory>
.
This brings us to mkdir, occasionally you'll want to make a new directory to store files in, and that is done using mkdir, the syntax of mkdir is mkdir <directory name>
.
Using relative paths, how would you cd to your home directory.
cd ~
Using absolute paths how would you make a directory called test in /tmp
mkdir /tmp/test
Task 4 [Section 5: Advanced File Operations] ln
The ln syntax is ln source destination
.
The syntax for a symbolic link is the exact same, but it uses the -s flag, so to create a symbolic link, you would run ln -s <file> <destination>
.
How would I link /home/test/testfile to /tmp/test
ln /home/test/testfile /tmp/test
Task 5 [Section 5 - Advanced File Operations]: find
The true power of this command though comes from the parameters you can provide it. You can use find dir -user
, to list every file owned by a specific user; you can use find dir -group
to list every file owned by a specific group.
How do you find files that have specific permissions?
-perm
How would you find all the files in /home
find /home
How would you find all the files owned by paradox on the whole system
find / -user paradox
Task 6 [Section 5: Advanced File Operations] - grep
grep <regular expression> <file>
What flag lists line numbers for every string found?
-n
How would I search for the string boop in the file aaaa in the directory /tmp
grep boop /tmp/aaaa
Task 7 Binary - Shiba3
What is shiba4's password
test1234
Task 8 [Section 6: Miscellaneous]: Intro
Read the above
No answer needed
Task 9 [Section 6: Miscellaneous]: sudo
sudo is Linux's run as administrator button, and the syntax goes sudo <command>
.
How do you specify which user you want to run a command as.
-u
How would I run whoami as user jen?
sudo -u jen whoami
How do you list your current sudo privileges(what commands you can run, who you can run them as etc.)
-l
Task 10 [Section 6: Miscellaneous]: Adding users and groups
The syntax for both of these commands are adduser username
and addgroup groupname
.
How would I add the user test to the group test
sudo usermod -a -G test test
Task 11 [Section 6: Miscellaneous]: nano
nano is a terminal based text editor. The syntax for nano is nano <file you want to write to>
Read the above
No answer needed
Task 12 [Section 6: Miscellaneous]: Basic shell scripting
Read the above
No answer needed
Task 13 [Section 6: Miscellaneous]: Important Files and Directories
/etc/passwd - Stores user information - Often used to see all the users on a system
/etc/shadow - Has all the passwords of these users
/tmp - Every file inside it gets deleted upon shutdown - used for temporary files
/etc/sudoers - Used to control the sudo permissions of every user on the system
/home - The directory where all your downloads, documents etc are.
/root - The root user's home directory
/usr - Where all your software is installed
/bin and /sbin - Used for system critical files
/var - The Linux miscellaneous directory, a myriad of processes store data in /var
$PATH - Stores all the binaries you're able to run
Read the above
No answer needed
Task 14 [Section 6 - Miscellaneous]: Installing packages(apt)
apt install package
Read the above
No answer needed
Task 15 [Section 6: Miscellaneous]: Processes
A list of user created processes can be viewed with the ps
command
To view a list of all system processes, you have to use the -ef
flag
The syntax of kill is kill <PID>
.
Read the above
No answer needed
Last updated
Was this helpful?