4 - Linux Fundamentals Flashcards

1
Q

What part of your computer system is Linux?

A

The OS kernel. Coordinates between hardware, software, users and files.

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

What is User Space

A

Everything that happens outside of the kernel

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

What starts the OS kernel?

A

The bootloader

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

What starts the computer’s bootloader?

A

BIOS/UEFI

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

What is “ring zero”?

A

kernel space

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

Where does the kernel export data about hardware (as virtual files)?

A

/proc/ and /sys/

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

Where does the kernel present the virtual files representing hardware such as HIDs and drive partitions?

A

/dev/

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

What are the two types of device files?

A

Block and Character

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

What Linux command can you use to determine if a device file is a block file or a character file?

A

ls -l

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

Are disk drives in /dev/ more likely to be block devices or character devices?

A

Block devices

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

Are peripherals and serial ports in /dev/ more likely to be block devices or character devices?

A

Character devices

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

Which system can be used to issue device-specific commands to devices?

A

ioctl

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

What is the file path for the root of the Linux virtual file tree?

A

/

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

What is the file path for a user home?

A

/home/username

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

What is the command used to mount a disk?

A

mount

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

What would mkfs.ext4 /dev/sda1 do?

A

Format the disk at sda1 to the ext4 filesystem.

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

What is a Process?

A

A running instance of a program.

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

What is a PID?

A

Process Identifier, the reference for a running process.

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

How many things can a CPU core do at once?

A

one

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

What user account do processes run under?

A

The user who started the process.

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

How can you get a command line if your GUI is broken?

A

Launch a virtual console with CTRL+ALT+F1 (F1 through F6 all work)

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

What does the pwd command do?

A

(Print Working Directory) Prints the current location yur shell is working in.

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

What is the command to change directories?

A

cd followed by an absolute or relative path.

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

What does cd - do?

A

Takes you to the last directory you navigated away from.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What command takes you to the parent directory?
`cd ..`
26
What is the command to create a directory?
`mkdir directoryName`
27
Which command is for moving or renaming files or directories?
`mv`
28
Which command is for removing an empty directory?
`rmdir directoryName`
29
Which command is for removing a file?
`rm fileName`
30
What command means "copy"?
`cp`
31
Which command lists directory contents?
`ls`
32
When you try to run a program, where is Linux looking for the program to run?
The list of directories in the `PATH` environment variable.
33
What does `echo $PATH` do?
Shows the list of directories in your PATH environment variable.
34
What are common paths for executable commands?
`/usr/local/sbin`,`/usr/local/bin`,`/usr/sbin`,`usr/bin`,`/sbin`,`/bin`
35
How do you ask Linux about the location of a command.
`type` followed by the command shows the command's path.
36
"In penetration tests, you will most often receive shell access to a system after a successful exploit, rather than a graphical user interface. Proficiency with the command line is essential for your success as a security professional."
Did you know that?
37
How can you print the contents of an environment variable to the screen?
`echo $VAR`
38
Where are two places system variables can be placed, for use by command line programs?
`/etc/profile` and `~/.profile`
39
Where should you save environment variables to make them available to all sessions regardless of whether a shell has been executed?
`etc/environment`
40
FHS
Filesystem Hierarchy Standard
41
`/bin/`
basic programs
42
`/boot/`
Kali Linux kernel and other files required for its early boot process
43
`/dev/`
device files
44
`/etc/`
configuration files
45
`/home/`
user's personal files
46
`/lib/`
basic libraries
47
`/media/`
mount points for removable drives (usb, dvd)
48
`/mnt/`
temporary mount point
49
`/opt/`
third party extra applications
50
`/root/`
root's personal files
51
`/run/`
volatile runtime storage, doesn't persist across reboots
52
`/sbin/`
system programs
53
`/srv/`
data used by servers hosted on this system
54
`/tmp/`
temporary files, (often emptied at boot)
55
`/usr/`
a parent folder for applications and data
56
`/usr/bin/`
basic programs
57
`/usr/sbin/`
system programs
58
`/usr/lib/`
basic libraries
59
`/usr/share/`
architecture-independent data
60
`/usr/local/`
used by the admin for installing applications without interfering with files handled by `dpkg`
61
`/var/`
variable data handled by services. This includes log files, queues, spools, and caches.
62
`/proc/` and `/sys/`
Used by the kernel for exporting data to user space
63
`~`
`$HOME`
64
What is in your home directory?
dotfiles (application configuration files) and user files
65
What flag do you add to `ls` to show hidden files?
`-a`
66
XDG Base Directory Specification's location for user config files?
`~/.config`
67
XDG Base Directory Specification's location for user cache files?
`~/.cache`
68
XDG Base Directory Specification's location for user application data files?
`~/.local`
69
`cat`
reads a file to the screen
70
`less` or `more`
read files to the screen, with pagination
71
`>`
output into a file
72
`>>`
append a file with output
73
`echo`
print a string or evaluated variable to the terminal
74
How do you search for files?
`find directory criteria` such as `find /etc -name "host*"` (`locate` could also work, but you need to know about `find`)
75
How do you search within files?
`grep expression files` such as `grep "user@example.com" filename.txt`
76
How do you find a process' PID?
`ps aux`
77
What command would you use to send a kill signal to a process?
`kill` such as `kill -s KILL 667288`
78
What do you add to a command to run it in the background?
`&` at the end
79
How do you access a background process?
`fg %job-number`
80
How do you find your background processes?
`jobs`
81
What does CTRL-Z do?
Pauses a job and puts it into the background.
82
How do you resume a paused background job?
`bg %job-number`
83
What are the three user categories for file permissions?
* Owner `u` * Owner Group `g` * Others `o`
84
What are the three types of file rights?
* Read `r` * Write `w` * Execute `x`
85
What are the two rights particular to executable files?
* setuid * setgid `s`
86
Why would a penetration tester look for executables that have the `setuid` permission allowed?
If the software is vulnerable, they may be able to execute commands as root.
87
What does `execute` access mean in the context of a directory?
The user may travel through a directory, even if they don't have permission to read the contents. example: `cd noread/destination`
88
What effect does the `setgid` permission have on a directory?
Files created in the directory will belong to the group that owns the directory, rather than the main group of the user who created the file.
89
What is the `Sticky Bit`?
`t` is a permission for directories that restricts the deletion of files to the files owner, or the owner of the file's parent directory.
90
What command changes the owner of a file?
`chown user file`
91
What command changes the owner group of a file?
`chgrp group file`
92
Which command changes the rights of a file?
`chmod rights file`
93
Which command could you use to change the user and group of a file at the same time?
`chown user:group file`
94
What are the two ways of representing rights?
* symbolic * octal
95
What are the respective octal values for read, write, and execute?
* read = 4 * write = 2 * execute = 1
96
What are the respective octal values of setuid, setgid, and sticky?
* setuid = 4 * setgid = 2 * sticky = 1
97
What is “u=rwx,g+rw,o-r” in octal
773
98
What are the rights “a=rx “ in octal
555
99
What permission results from “chmod 4754 file”
* u = read * g = read, write, execute * o = read, execute * setuid
100
Which command is used to restrict permissions with an octal “mask”
umask
101
What flag on chmod, chown, etc. makes the command recursive?
-R
102
What is the difference between the ‘x’ and ‘X’ user right symbols.
* x is for executing files * X is for traversing directories
103
Which command displays information on memory utilization?
free
104
What option can you add to the `free` command to have the output displayed in more “human readable” units?
`-h`
105
Which options could you append to `free` to display the output in MiB or GiB?
`-m` or `-g`
106
What command will show your disk utilization?
`df` (disk free)
107
Which command displays the identity of the user?
`id`
108
Which command returns a line documenting the kernel name, hostname, kernel release, kernel version, machine type, and the name of the OS?
`uname -a`
109
“the kernel emits messages that it stores in a ____ ______ whenever something interesting happens”
ring buffer
110
How do you display the kernel logs?
`dmesg`
111
What command is for reading the systemd journal?
`journalctl`
112
What do the following `journalctl` options do? * `-r` * `-f` * `-u`
* reverse chronological * continuously * limit messages to those emitted by a specific `systemd` unit
113
What’s a tool that can summarize the data exported by the kernel to `/proc/` and `/sys/`?
* `lspci` for pci devices. * `lsusb` for usb devices. * `lspcmcia` for pcmcia devices.
114
What does `lsdev` list?
Communication resources used by devices.
115
What command is like a combination of: `lspci`, `lsusb`, and `lsdev`
`lshw`
116
Which command would you use to export information you’d want to include in any hardware support problems?
`lshw`
117
Which command can you use to launch a text editor?
`editor`
118
How is `locate` different than `find`?
`locate` searches for files using a database. `find` looks through the file tree for files.
119
What does `time` do?
Measures how long it takes for a command to run
120
What does `updatedb` do?
Updates the database of file locations used by `locate`.
121
What is `zcat` used for?
Displaying the contents of compressed files without decompressing