LINUX FUNDAMENTALS Flashcards

(102 cards)

1
Q

echo

A

output any text we provide
dont need quotes unless text has spaces

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

whoami

A

find out what user we’re currently logged in as

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

ls

A

listing: shows files and folders in current directory

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

cd

A

change directory: moves you into a different folder

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

cat

A

concatenate: displays the ontents of a file in the terminal

“show me what’s inside the file”

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

pwd

A

print working directory: shows full path of the directory you are currently in

“where am i?”

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

directory

A

a folder that organizes files and other folders on a computer.

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

cd .. {cd space ..]

A

move one folder up (parent folder)

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

shell

A

a program that:
- takes commands you type
- passes them to the OS
- shows you the results

*the middleman between you and the OS

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

bash

A

stands for Bourne Again SHell

type of shell. most common shell on linux

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

find -name [filename]

A

find a file whose name you know

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

find -name *.ext

A

find any file with the extension you list

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

grep

A

grep “thing to find” ffile_to_search

allows us to search the contents of files for specific values that we are looking for.

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

ctrl+c

A

‘stop whatever you’re waiting for”
- cancels unfinished command
brings you back to normal prompt

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

&

A

EXECUTE OCMMANDS IN THE BACKGROUND

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

&&

A

This operator allows you to combine multiple commands together in one line of your terminal.

command 2 wll only run if command 1 is successful

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

>

A

send this output into a file. if the file exists, erase it first.

echo hello > notes.txt

^^ replaces entire content of notes.txt with ‘hello’

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

> >

A

append this output onto the end of a file. do not erase the existing file contents first.

syntax:

command_that_outputs_text»_space; filename

eg

echo “hello world!”»_space; notes.txt

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

touch

A

creates a file

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

SSH

A

SSH is a protocol that 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

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

what is an argument and how is it identified?

A

a hyphen and a certain keyword known as flags or switches

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

flag

A

an option you add to a command to change how it behaves

eg ls vs -l[argument]

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

switch

A

command that turns something on or off

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

-a

A

short for –all

flag that means show everything, including hidden files/folders

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
--help
option you add to a command to see how it works
26
what indicates a hidden file/folder?
. at the beginning eg .cache .hiddenfolder
27
man [command]
show the manual about a certain command (documentation)
28
-h
turn into human readable format
29
mkdir
make directory: create a folder
30
cp
copy Copy a file or folder takes two arguments: 1. the name of the existing file 2. the name we wish to assign to the new file when copying cp existingfile cp newfile
31
mv
move move or rename a file/folder mv file1 file2 = merge 2nd file with 1st file (only 1st file remaining) mv filename foldername = move filename to foldername mv oldfilename newfilename = rename file. NOTE: if newfilename exists it will be overwritten (bad)
32
rm
remove remove a file
33
file
determine type of file
34
ssh command
login to a remote machine using username, pw, and ip address ssh username@ip.ad.dre.ss password
35
rm
remove file rm filename
36
rm -R
remove folder rm -R foldername
37
-l
long listing flag shows files and folders in a long, detailed format
38
user vs group
permissions can be so granular, that whilst a user technically owns a file, if the permissions have been set, then a group of users can also have either the same or a different set of permissions to the exact same file without affecting the file owner itself.
39
su
switch user (without loading their full environment) "become another user, but stay in my current setup" takes a couple of switches -l or --login: switches users and loads their full login environment
40
su - su -l
switch user, full login shell
41
su username
switch to specific user (if you don't specify, switches to the root account)
42
su -c
run one command as user
43
su -s
specify shell
44
root
administrator account on any linux. can: - read, change, delete any file - install/remove software - change system settings - create/delete users - start/stop system services
45
/etc
commonplace location to store system files that are used by your operating system.
46
sudo
superuser do lets a normal user run a single command with root (administrator) privileges safer than doing everything as root
47
/var
directory, with "var" being short for variable data, is one of the main root folders found on a Linux install. This folder stores data that is frequently accessed or written by services or applications running on the system
48
/tmp directory
Short for "temporary", the /tmp directory is volatile and is used to store data that is only needed to be accessed once or twice. Similar to the memory on your computer, once the computer is restarted, the contents of this folder are cleared out. don't pput anything here you care about!!!! What's useful for us in pentesting is that any user can write to this folder by default. Meaning once we have access to a machine, it serves as a good place to store things like our enumeration scripts.
49
rwx
read, write, execute - = that permission is not allowed rwx r-x r--
50
nano
nano filename if file doesn't already exist nano will create it opens text editor not always installed
51
VIM
more advanced than nano usually always installed
52
wget
syntax: wget url 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.
53
scp
secure copy transfer files between 2 computers over a network using ssh to provide encryption and authentication syntax: scp source destination requires: - ssh access -username on the remote system - permission to read/write file
54
how to paste from clipboard
ctrl shift v
55
scp: copy a file to a remote machine
scp file.txt user@remote.ip:path/to/destination
56
scp: from a remote machine
scp user@remote.ip:path/to/file . . means "current directory"
57
scp: copy a file (recursive)
recursive = include everything inside scp -r folder user@remote.ip:/path
58
curl
59
python3 -m http.server
starts pythn3 webserver http to turn computer into a server to serve files -m = run a built-un python modujle
60
wget syntax using ip address
wget http://IP.ADDRESS:PORT/FILENAME
61
HTTP port
80
62
https port
443
63
ssh port
22
64
ftp port
21
65
smtp port
25
66
dns port
53
67
usint ports with wget
you know which one to use bc the service/instruction tells you, and if it's not a default port, you must include it explicitly in the url with wget
68
PID
number the system assigns to each running process. increments by 1 systemd is usually 1
69
ps
process status shows processes started by you in this terminal
70
ps aux
shows almost every process on the system a= all users u = user-oriented format x = include background/system processes
71
top
real-time dashboard of running processes shows: cpu usage memory usage pids which processes are hogging resources
72
kernel
core of the OS manages cpu, memory, processes; talks to hardware software compiled into machine code that runs in privileged CPU mode to control hardware & system resources
73
kill
send a message to a process when you just write kill [processnumber] linux assumes: kill -SIGTERM PID (polite process termination)
74
signal
a message from the kernel to a process
75
SIGTERM
syntax: kill -SIGTERM PID terminate the process, but allow it to do some cleanup tasks beforehand (save work, close files, exit safely)
76
SIGKILL
terminate process immediately -- no cleanup kill -SIGKILL PID
77
SIGSTOP
pause a process - stays in memory, can be resumed later kill -SIGSTOP PID
78
namespace
a logical isolation boundary for a process (processes think they're alone)
79
systemd
main process mgr on modern linux systems - PID 1 - starts everything else
80
apache
a web server process (managed by systemd)
81
systemctl
service control tool - used to control services on a linux system that uses systemd syntax: systemctl [option] [service] six options with systemctl: Start Stop Enable = run on boot Disable Restart Status
82
daemon
a background process that runs continuously. start at boot, no user interaction
83
background vs foreground
foreground: process tied to your terminal; blocks other input, owns terminal. your input goes to that process; bash/shell isn't listening. can't type new commands background: process runs behind the scenes; terminal is free to accept new commands
84
Ctrl + Z
pause foreground process. cpu usage = 0 but memory still allocated. memory control returns to bash/shell also a way of "pausing" the execution of a script or command
85
fg
bring prcess to foreground (resume and own terminal)
86
bg
bring a process to the background where it will continue (does not own terminal)
87
jobs
list jobs in current terminal
88
cron
a scheduler. runs commands automatically at a scheduld time/intervals crontab entry format: * * * * * * command [five time fields, then the command)
89
crontabs
crontabs require 6 specific values MIN minute HOUR hour DOM day of month MON month DOW day of week CMD The actual command that will be executed. these also support the wildcard or asterisk (*). If we do not wish to provide a value for that specific field, i.e. we don't care what month, day, or year it is executed -- only that it is executed every 12 hours, we simply just place an asterisk.
90
crontabs -e
edit crontabs where you can select an editor (such as Nano) to edit your crontab.
91
q
exit process table
92
crontab -l
list crontab entries
93
apt
package manager for debian-based linux systems is how you install, update, remove software, and update system safely (think: app store for linux, but text-based)
94
add-apt-repository
sudo add-apt-repository repository_string -benefit: whenever we update our system the repo that contains the software repos we added also gets checked for updates
95
debian
96
sudo apt update
refreshes list of avail software; doesn't install anything
97
sudo apt install packagename
installs a pkg
98
sudo apt remove packagename
removes a package
99
sudo apt upgrade
upgrades installed packages
100
repository
a trusted software source - server that hosts packages that apt knows how to talk to
101
gpg key
gnu privacy guard keys safety check from the developers for non-repudiation
102
less
lets you view large amounts of text without dumping everything onto the screen at once.