2 - Linux Block Test Flashcards
UNIX
The commercial trademark owned by Bell Labs/AT&T
Unix
The generic name for all UNIX-like OS
Unix-like
Refers to absence of proprietary UNIX source code
Linux
Trademark owned by Linus Torvalds
Examples of Unix OSs
Mac OS X (Apple)
Solaris (Sun, Oracle)
AIX (IBM)
UX (HP)
Theater Battle Management Core Systems (TBMCS, USAF)
Global Command and Control Systems (GCCS, USAF)
Linux Characteristics
Flexibility - Many commands and multiple ways to do things
Multitasking - Perform tasks in parallel (ex: Email and DNS server)
Multi-user - Multiple users can log in at same time
Portable - Runs on many different types of hardware
Case Sensitive
Kernel
Core of OS, interacts w/ hardware
User/OS interaction chain
User<->Shell<->Kernel<->Hardware
Shell Functions
Acts as CLI
Performs I/O redirection
Manages the environment
Performs variable and filename substitution
Common Shells
Bourne Shell (sh) (rewrite of OG UNIX shell)
Bourne Again Shell (bash)
Korn Shell (ksh)
C Shell (csh)
Almquist Shell (ash) (Used in resource-constrained environments)
Z Shell (zsh) (modern, themeable, bash improvement)
Kernel Functions
Manage creation, scheduling, and termination of processes
Manage memory allocation
Manage filesystem
Perform error handling
Manage I/O
Boot Process Phases
BIOS
GRUB 1
GRUB 2
Kernel
BIOS Phase (Boot Process)
POST
Initial hardware setup/config
Boot device selected and boot loader executed
Grand Unified Bootloader (GRUB) Stage 1 (Boot Process)
Small machine code located on MBR
Sole purpose is to locate and load GRUB stage 2
GRUB Stage 2 (Boot Process)
Kernel selection menu is presented
Loads initial RAM disk to memory (initrd) (Mounted as pseudo filesystem) (Used by kernel to load drivers for boot)
Loads kernel from the disk into memory
Kernel Stage (Boot Process)
Initialize/configure memory and hardware
Mounts initrd to load necessary drivers and kernel modules
Mounts root filesystem
Executes /sbin/init
cd
Change directory
~ is shortcut for home
/ is root
- is previous directory
Driver Module
Piece of code that can be added to the kernel at runtime
Loadable Kernel Modules
Add and remove functionality to/from the kernel while the system is running (Ex: Printer drivers)
Device Drivers
Allow programs to communicate with the systems hardware and peripheral devices
Almost every system operation eventually maps to hardware
echo
Display arg(s) to STDOUT followed by newline
-n – Omit trailing newline
-e – Enable escape sequences (characters such as \t need to be in quotes)
Root Directory
/ is top of directory structure
/root is root user’s home directory
Home directories
Root: /root
Everyone else: /home/USERNAME
Can be referenced in CLI w/ ~
Filenames
Letters, numbers, and certain punctuation
Avoid special characters
Special characters must be escaped with \ or filename must be in quotes
File Privileges
Read (r): Read/copy a file
Write (w): Alter the contents
Execute (x): Allows file to execute as a program
User, group, and other
Directory Privileges
Read (r): See what’s inside directory. ls will return nothing without read permission
Write (w): Alter contents of directory. Required to add or remove files/subdirectories. Execute permission must also be set for this to work.
Execute (x): Required to cd into a directory
/etc/passwd
Stores user account info
Field 1– Username
Field 2 – Password placeholder
Field 3 – User ID (UID)
Field 4 – Group ID (GID)
Field 5 – Note (Display Name)
Field 6 – Home Folder
Field 7 – Primary login shell
/etc/group
Stores supplementary group info
Field 1 – Group name
Field 2 – Password placeholder
Field 3 – Group ID (GID)
Field 4 – Users in the group (SUPPLEMENTARY ONLY. Does not show primary group membership)
/etc/shadow
Stores user account password info
Field 1 – User name
Field 2 – Password field
Subfield 1 – Hash method
Subfield 2 – Password salt
Subfield 3 – Hashed PW
Field 3-8 – PW metadata
whatis
Prints one-line man page descriptions
which
Prints command’s executable path
whereis
Locate binary, source, and man pages for command
/proc/PID/cmdline
Command and arguments used to invoke the process
/proc/PID/environ
environment variables
/proc/PID/cwd
current working directory of process
/proc/PID/exe
executable of process
/proc/PID/stat
status info about the process
/proc/PID/fd
folder with entries for each file the process has open, named by file descriptor, which links to the actual files
/proc/cpuinfo
CPU and system architecture info
/proc/meminfo
memory and swap usage
/proc/cmdline
options used to start the kernel
/proc/filesystems
filesystems supported by the kernel
/proc/modules
active kernel modules