Linux Fundamentals II

Learn how to use SSH, advanced commands, and file system interaction...

SSH (Deploy)

is a protocol between devices in an encrypted form. Using cryptography, any input we send in a human-readable format is encrypted for travelling over a network - where it is then unencrypted once it reaches the remote machine.

SSH allows us to remotely execute commands on another device remotely. Any data sent between the devices is encrypted when it is sent over a network such as the Internet.


Flags & Switches

A majority of commands allow for arguments to be provided. These arguments are identified by a hyphen and a certain keyword known as flags or switches.

Command
Description

ls -a

Displays hidden files

ls --help

Lists the help options (other flags that can be used)

man ls

Gives us the manual pages for the command

rm -R

Removes a directory

ls -lh

Shows the permissions for files (h is to show it in human readable form)


Commands

Command
Full Name
Purpose

touch

Touch

Create file

mkdir

Make directory

Create a folder

cp

Copy

Copy a file or folder

mv

Move

Move a file or folder

rm

Remove

Remove a file or folder

file

File

Determine the type of a file

su

Change user


Common Directories

Directory
Description

/etc

The etc folder (short for etcetera) is a commonplace location to store system files that are used by your operating system.

/var

The var folder (short for variable data) stores data that is frequently accessed or written by service or applications running on the system. For example, log files (/var/log).

/root

The home for the root user.

/tmp

Short for temperorary, the directory is volatile and is used to store data that is only needed to be accessed once or twice. Similar to RAM on a computer.


Answers

Task 3

What directional arrow key would we use to navigate down the manual page? down

What flag would we use to display the output in a “human-readable” way? -h

Task 4

How would you create the file named “newnote”? touch newnote

On the deployable machine, what is the file type of “unknown1” in “tryhackme’s” home directory? ASCII text

How would we move the file “myfile” to the directory “myfolder” mv myfile myfolder

What are the contents of this file? THM{FILESYSTEM}

Task 5

On the deployable machine, who is the owner of “important”? user2

What would the command be to switch to the user “user2”? su user2

Output the contents of “important”, what is the flag? THM{SU_USER2

Task 6

What is the directory path that would we expect logs to be stored in? /var/log

What root directory is similar to how RAM on a computer works? /tmp

Name the home directory of the root user /root


Last updated