LINUX COMMANDS Flashcards

1
Q

LS

A

lists files and folders in a directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

GREP

A

SEARCHES TEXT FILES OR COMMAND OUTPUT

EX: Use grep on “access.log” to find the flag that has a prefix of “THM”. What is the flag?

tryhackme@linux1:~$ grep “THM” access.log
13.127.130.212 - - [04/May/2021:08:35:26 +0000] “GET THM{ACCESS} lang=en HTTP/
1.1” 404 360 “-“ “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

CD

A

cd command in linux known as change directory command. It is used to change current working directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

SHUTDOWN

A

BRINGS DOWN SYSTEM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

PWD

A

This stands for Print Working Directory

DISPLAYS FULL PATH OR WORKING DIRECTORY

EX: /HOME/MARK

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

PASSWD

A

UPDATES CURRENT USER’S PASSWORD

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

MV

A

MOVES OR RENAMES FILES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

CP

A

COPY FILES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

RM

A

PERMANENTLY DELETES FILES
You can simply remove files by using rm. However, you need to provide the -R switch alongside the name of the directory you wish to remove.

ex:
tryhackme@linux2:~$ rm note
tryhackme@linux2:~$ ls
folder1 mydirectory

using -R switch:
tryhackme@linux2:~$ rm -R mydirectory
tryhackme@linux2:~$ ls
folder1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

CHMOD

A

CHANGES PERMISSIONS FOR SPECIFIED FILES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

CHOWN

A

CHANGES OWNERSHIP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

IWCONFIG

A

DISPLAYS AND CONFIGURES WIRELESS NETWORK SETTINGS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

IFCONFIG

A

DISPLAYS AND CONFIGURES NETWORK SETTINGS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

PS

A

LISTS PROCESSES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

SU

A

SWITCHES USER TO SPECIFIED USER ACCOUNT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

SUDO

A

RUNS COMMANDS USING ROOT USER ACCESS

17
Q

APT-GET

A

UPDATES AND MAINTAINS LIST OF SOFTWARE PACKAGES

18
Q

VI

A

STANDARD LINUX TEXT EDITOR

19
Q

DD

A

CREATES AN EXACT(BIT-BY-BIT) COPY OF A STORAGE VOLUME

20
Q

KILL

A

STOPS A SPECIFIED PROCESS

21
Q

echo

A

Output any text that we provide

ex:
tryhackme@linux1:~$ echo “hello Friend!”
hello Friend!

22
Q

whoami

A

Find out what user we’re currently logged in as!

ex:
tryhackme@linux1:~$ whoami
tryhackme

23
Q

cat (concatenate)

A

Outputting the Contents of a File
“Cat” is short for concatenating & is a fantastic way us to output the contents of files (not just text files!)

ex:
tryhackme@linux1:~/Documents$ ls
todo.txt
tryhackme@linux1:~/Documents$ cat todo.txt
Here’s something important for me to do later!

24
Q

touch

A

The touch command takes exactly one argument – the name we want to give the file we create. For example, we can create the file “note” by using touch note. It’s worth noting that touch simply creates a blank file. You would need to use commands like echo or text editors such as nano to add content to the blank file.

ex:
tryhackme@linux2:~$ touch note
tryhackme@linux2:~$ ls
folder1 note

25
Q

mkdir

A

making a folder, which just involves using the mkdir command and again providing the name that we want to assign to the directory. For example, creating the directory “mydirectory” using mkdir mydirectory.

ex:
tryhackme@linux2:~$ mkdir mydirectory
tryhackme@linux2:~$ ls
folder1 mydirectory note

26
Q

file

A

Determining File Type

ex:
tryhackme@linux2:~$ file note
note: ASCII text

27
Q

nano

A

To create or edit a file using nano, we simply use nano filename – replacing “filename” with the name of the file you wish to edit.

ex:
tryhackme@linux3:/tmp# nano myfile

Once we press enter to execute the command, nano will launch! Where we can just begin to start entering or modifying our text. You can navigate each line using the “up” and “down” arrow keys or start a new line using the “Enter” key on your keyboard.

Nano has a few features that are easy to remember & covers the most general things you would want out of a text editor, including:

Searching for text
Copying and Pasting
Jumping to a line number
Finding out what line number you are on

You can use these features of nano by pressing the “Ctrl” key (which is represented as an ^ on Linux) and a corresponding letter. For example, to exit, we would want to press “Ctrl” and “X” to exit Nano.

28
Q

wget

A

This command allows us to download files from the web via HTTP – as if you were accessing the file in your browser. We simply need to provide the address of the resource that we wish to download. For example, if I wanted to download a file named “myfile.txt” onto my machine, assuming I knew the web address it – it would look something like this:
ex:
wget https://assets.tryhackme.com/additional/linux-fundamentals/part3/myfile.txt

29
Q

scp(secure copy)

A

Secure copy, or SCP, is just that – a means of securely copying files. Unlike the regular cp command, this command allows you to transfer files between two computers using the SSH protocol to provide both authentication and encryption

ex: Copy files & directories from your current system to a remote system

Variable Value
The IP address of the remote system 192.168.1.30
User on the remote system ubuntu
Name of the file on the local system important.txt
Name that we wish to store the file as on the remote system transferred.txt

-With this information, let’s craft our scp command (remembering that the format of SCP is just SOURCE and DESTINATION)

And now let’s reverse this and layout the syntax for using scp to copy a file from a remote computer that we’re not logged into:

ex:
Variable Value
IP address of the remote system 192.168.1.30
User on the remote system ubuntu
Name of the file on the remote system documents.txt
Name that we wish to store the file as on our system notes.txt

The command will now look like the following:
command: scp ubuntu@192.168.1.30:/home/ubuntu/documents.txt notes.txt

30
Q

ip address

A

shows IP address information for linux devices