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
Q

What command takes you to the parent directory?

A

cd ..

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

What is the command to create a directory?

A

mkdir directoryName

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

Which command is for moving or renaming files or directories?

A

mv

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

Which command is for removing an empty directory?

A

rmdir directoryName

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

Which command is for removing a file?

A

rm fileName

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

What command means “copy”?

A

cp

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

Which command lists directory contents?

A

ls

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

When you try to run a program, where is Linux looking for the program to run?

A

The list of directories in the PATH environment variable.

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

What does echo $PATH do?

A

Shows the list of directories in your PATH environment variable.

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

What are common paths for executable commands?

A

/usr/local/sbin,/usr/local/bin,/usr/sbin,usr/bin,/sbin,/bin

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

How do you ask Linux about the location of a command.

A

type followed by the command shows the command’s path.

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

“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.”

A

Did you know that?

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

How can you print the contents of an environment variable to the screen?

A

echo $VAR

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

Where are two places system variables can be placed, for use by command line programs?

A

/etc/profile and ~/.profile

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

Where should you save environment variables to make them available to all sessions regardless of whether a shell has been executed?

A

etc/environment

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

FHS

A

Filesystem Hierarchy Standard

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

/bin/

A

basic programs

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

/boot/

A

Kali Linux kernel and other files required for its early boot process

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

/dev/

A

device files

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

/etc/

A

configuration files

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

/home/

A

user’s personal files

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

/lib/

A

basic libraries

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

/media/

A

mount points for removable drives (usb, dvd)

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

/mnt/

A

temporary mount point

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

/opt/

A

third party extra applications

50
Q

/root/

A

root’s personal files

51
Q

/run/

A

volatile runtime storage, doesn’t persist across reboots

52
Q

/sbin/

A

system programs

53
Q

/srv/

A

data used by servers hosted on this system

54
Q

/tmp/

A

temporary files, (often emptied at boot)

55
Q

/usr/

A

a parent folder for applications and data

56
Q

/usr/bin/

A

basic programs

57
Q

/usr/sbin/

A

system programs

58
Q

/usr/lib/

A

basic libraries

59
Q

/usr/share/

A

architecture-independent data

60
Q

/usr/local/

A

used by the admin for installing applications without interfering with files handled by dpkg

61
Q

/var/

A

variable data handled by services. This includes log files, queues, spools, and caches.

62
Q

/proc/ and /sys/

A

Used by the kernel for exporting data to user space

63
Q

~

A

$HOME

64
Q

What is in your home directory?

A

dotfiles (application configuration files) and user files

65
Q

What flag do you add to ls to show hidden files?

A

-a

66
Q

XDG Base Directory Specification’s location for user config files?

A

~/.config

67
Q

XDG Base Directory Specification’s location for user cache files?

A

~/.cache

68
Q

XDG Base Directory Specification’s location for user application data files?

A

~/.local

69
Q

cat

A

reads a file to the screen

70
Q

less or more

A

read files to the screen, with pagination

71
Q

>

A

output into a file

72
Q

>>

A

append a file with output

73
Q

echo

A

print a string or evaluated variable to the terminal

74
Q

How do you search for files?

A

find directory criteria such as find /etc -name "host*"

(locate could also work, but you need to know about find)

75
Q

How do you search within files?

A

grep expression files such as grep "user@example.com" filename.txt

76
Q

How do you find a process’ PID?

A

ps aux

77
Q

What command would you use to send a kill signal to a process?

A

kill such as kill -s KILL 667288

78
Q

What do you add to a command to run it in the background?

A

& at the end

79
Q

How do you access a background process?

A

fg %job-number

80
Q

How do you find your background processes?

A

jobs

81
Q

What does CTRL-Z do?

A

Pauses a job and puts it into the background.

82
Q

How do you resume a paused background job?

A

bg %job-number

83
Q

What are the three user categories for file permissions?

A
  • Owner u
  • Owner Group g
  • Others o
84
Q

What are the three types of file rights?

A
  • Read r
  • Write w
  • Execute x
85
Q

What are the two rights particular to executable files?

A
  • setuid
  • setgid

s

86
Q

Why would a penetration tester look for executables that have the setuid permission allowed?

A

If the software is vulnerable, they may be able to execute commands as root.

87
Q

What does execute access mean in the context of a directory?

A

The user may travel through a directory, even if they don’t have permission to read the contents.

example: cd noread/destination

88
Q

What effect does the setgid permission have on a directory?

A

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
Q

What is the Sticky Bit?

A

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
Q

What command changes the owner of a file?

A

chown user file

91
Q

What command changes the owner group of a file?

A

chgrp group file

92
Q

Which command changes the rights of a file?

A

chmod rights file

93
Q

Which command could you use to change the user and group of a file at the same time?

A

chown user:group file

94
Q

What are the two ways of representing rights?

A
  • symbolic
  • octal
95
Q

What are the respective octal values for read, write, and execute?

A
  • read = 4
  • write = 2
  • execute = 1
96
Q

What are the respective octal values of setuid, setgid, and sticky?

A
  • setuid = 4
  • setgid = 2
  • sticky = 1
97
Q

What is “u=rwx,g+rw,o-r” in octal

A

773

98
Q

What are the rights “a=rx “ in octal

A

555

99
Q

What permission results from “chmod 4754 file”

A
  • u = read
  • g = read, write, execute
  • o = read, execute
  • setuid
100
Q

Which command is used to restrict permissions with an octal “mask”

A

umask

101
Q

What flag on chmod, chown, etc. makes the command recursive?

A

-R

102
Q

What is the difference between the ‘x’ and ‘X’ user right symbols.

A
  • x is for executing files
  • X is for traversing directories
103
Q

Which command displays information on memory utilization?

A

free

104
Q

What option can you add to the free command to have the output displayed in more “human readable” units?

A

-h

105
Q

Which options could you append to free to display the output in MiB or GiB?

A

-m or -g

106
Q

What command will show your disk utilization?

A

df (disk free)

107
Q

Which command displays the identity of the user?

A

id

108
Q

Which command returns a line documenting the kernel name, hostname, kernel release, kernel version, machine type, and the name of the OS?

A

uname -a

109
Q

“the kernel emits messages that it stores in a ____ ______ whenever something interesting happens”

A

ring buffer

110
Q

How do you display the kernel logs?

A

dmesg

111
Q

What command is for reading the systemd journal?

A

journalctl

112
Q

What do the following journalctl options do?

  • -r
  • -f
  • -u
A
  • reverse chronological
  • continuously
  • limit messages to those emitted by a specific systemd unit
113
Q

What’s a tool that can summarize the data exported by the kernel to /proc/ and /sys/?

A
  • lspci for pci devices.
  • lsusb for usb devices.
  • lspcmcia for pcmcia devices.
114
Q

What does lsdev list?

A

Communication resources used by devices.

115
Q

What command is like a combination of: lspci, lsusb, and lsdev

A

lshw

116
Q

Which command would you use to export information you’d want to include in any hardware support problems?

A

lshw

117
Q

Which command can you use to launch a text editor?

A

editor

118
Q

How is locate different than find?

A

locate searches for files using a database. find looks through the file tree for files.

119
Q

What does time do?

A

Measures how long it takes for a command to run

120
Q

What does updatedb do?

A

Updates the database of file locations used by locate.

121
Q

What is zcat used for?

A

Displaying the contents of compressed files without decompressing