Podcast
Questions and Answers
Which component of a Linux system directly communicates with the hardware?
Which component of a Linux system directly communicates with the hardware?
- User Shells
- System Libraries
- Kernel (correct)
- User Processes
What is the role of 'system calls' in the Linux architecture?
What is the role of 'system calls' in the Linux architecture?
- Load kernel modules during boot-up.
- Directly control hardware components.
- Manage graphical user interfaces.
- Enable user space applications to request services from the kernel. (correct)
What is a key characteristic of a monolithic kernel, like the Linux kernel?
What is a key characteristic of a monolithic kernel, like the Linux kernel?
- It is only suitable for embedded systems.
- Most of the OS functionality runs in user space.
- Entire OS functionality runs in the kernel space. (correct)
- It relies heavily on microservices architecture.
Which of the following is a primary benefit of using Security Enhanced Linux (SELinux)?
Which of the following is a primary benefit of using Security Enhanced Linux (SELinux)?
What is the purpose of the 'seccomp' mechanism in the Linux kernel?
What is the purpose of the 'seccomp' mechanism in the Linux kernel?
What is the primary function of the GNU C Library (glibc)?
What is the primary function of the GNU C Library (glibc)?
Which of the following best describes the role of a 'daemon' in Linux?
Which of the following best describes the role of a 'daemon' in Linux?
Why might a system administrator choose NOT to install a GUI on a server?
Why might a system administrator choose NOT to install a GUI on a server?
Which of the following is a valid use case for software libraries?
Which of the following is a valid use case for software libraries?
In the context of Linux desktop environments, what does 'interchangeable' refer to?
In the context of Linux desktop environments, what does 'interchangeable' refer to?
Which command is used to display the current working directory in Linux?
Which command is used to display the current working directory in Linux?
What information is provided by the ls -l
command in Linux?
What information is provided by the ls -l
command in Linux?
What is the purpose of the touch
command in Linux?
What is the purpose of the touch
command in Linux?
In the context of the Linux file system, what is the significance of the /etc
directory?
In the context of the Linux file system, what is the significance of the /etc
directory?
What does the tilde (~) character represent when used in a Linux path?
What does the tilde (~) character represent when used in a Linux path?
Which mode in Vi/Vim is used to execute commands on a file?
Which mode in Vi/Vim is used to execute commands on a file?
How do you save and exit a file in Vi/Vim?
How do you save and exit a file in Vi/Vim?
What is the purpose of the 'i' command in Vi/Vim's command mode?
What is the purpose of the 'i' command in Vi/Vim's command mode?
In Vi/Vim, which command deletes a single character at the cursor?
In Vi/Vim, which command deletes a single character at the cursor?
What is the role of binary code in computer communication?
What is the role of binary code in computer communication?
How do computers represent letters and words in binary format for communication?
How do computers represent letters and words in binary format for communication?
In the decimal numbering system (base 10), how is the number 1234 interpreted?
In the decimal numbering system (base 10), how is the number 1234 interpreted?
What decimal number is represented by the binary number 1001?
What decimal number is represented by the binary number 1001?
How many unique digits are needed to represent numbers in hexadecimal (base 16)?
How many unique digits are needed to represent numbers in hexadecimal (base 16)?
What decimal value is equivalent to the hexadecimal number 7F?
What decimal value is equivalent to the hexadecimal number 7F?
Why is hexadecimal notation often preferred over binary notation when representing numbers in computing?
Why is hexadecimal notation often preferred over binary notation when representing numbers in computing?
Given that 0b1101
is equal to 0xD
in hex, what does 0b1111
equal in hex?
Given that 0b1101
is equal to 0xD
in hex, what does 0b1111
equal in hex?
What is the primary advantage of using hexadecimal notation to represent binary data?
What is the primary advantage of using hexadecimal notation to represent binary data?
How many bits does each digit represent in octal (base 8)?
How many bits does each digit represent in octal (base 8)?
What differentiates ASCII from other encoding standards?
What differentiates ASCII from other encoding standards?
Which of the following is true regarding ASCII encoding?
Which of the following is true regarding ASCII encoding?
According to the ASCII standard, the letter 'A' is represented by the number 65. What is the hexadecimal representation of 'A' according to ASCII?
According to the ASCII standard, the letter 'A' is represented by the number 65. What is the hexadecimal representation of 'A' according to ASCII?
If the lowercase letter 'a' has an ASCII decimal value of 97, what is its binary representation?
If the lowercase letter 'a' has an ASCII decimal value of 97, what is its binary representation?
In ASCII, the letter 'Z' is represented as the decimal number 90. What potential confusion can arise when reading '90' as a Hex character?
In ASCII, the letter 'Z' is represented as the decimal number 90. What potential confusion can arise when reading '90' as a Hex character?
The message 'Attack' is encoded using ASCII. Given that A=65, t=116, a=97, c=99, and k=107, what is the correct sequence of decimal numbers representing 'Attack'?
The message 'Attack' is encoded using ASCII. Given that A=65, t=116, a=97, c=99, and k=107, what is the correct sequence of decimal numbers representing 'Attack'?
Flashcards
Kernel / Kernel Space
Kernel / Kernel Space
The core of the OS that interacts directly with hardware.
User Space
User Space
User shells and processes communicate with hardware via the kernel.
Daemon
Daemon
A type of program that runs in the background.
Software Libraries
Software Libraries
Signup and view all the flashcards
Command Line
Command Line
Signup and view all the flashcards
ls Command
ls Command
Signup and view all the flashcards
pwd Command
pwd Command
Signup and view all the flashcards
whoami Command
whoami Command
Signup and view all the flashcards
man Command
man Command
Signup and view all the flashcards
cat Command
cat Command
Signup and view all the flashcards
touch Command
touch Command
Signup and view all the flashcards
cd Command
cd Command
Signup and view all the flashcards
mkdir Command
mkdir Command
Signup and view all the flashcards
rmdir Command
rmdir Command
Signup and view all the flashcards
/ Root
/ Root
Signup and view all the flashcards
/bin directory
/bin directory
Signup and view all the flashcards
/etc directory
/etc directory
Signup and view all the flashcards
/home directory
/home directory
Signup and view all the flashcards
/var/log directory
/var/log directory
Signup and view all the flashcards
/mnt
/mnt
Signup and view all the flashcards
Relative Reference
Relative Reference
Signup and view all the flashcards
Absolute Reference
Absolute Reference
Signup and view all the flashcards
VI/VIM Command mode
VI/VIM Command mode
Signup and view all the flashcards
VI/VIM Insert mode
VI/VIM Insert mode
Signup and view all the flashcards
Escape Key in VI/VIM
Escape Key in VI/VIM
Signup and view all the flashcards
':wq' Command in VI/VIM
':wq' Command in VI/VIM
Signup and view all the flashcards
':q!' Command in VI/VIM
':q!' Command in VI/VIM
Signup and view all the flashcards
Decimal
Decimal
Signup and view all the flashcards
Binary
Binary
Signup and view all the flashcards
Hexadecimal
Hexadecimal
Signup and view all the flashcards
Octal
Octal
Signup and view all the flashcards
ASCII
ASCII
Signup and view all the flashcards
Study Notes
- SYS100 covers Linux Basics and Binary topics.
Learning Objectives
- Describe the basic components of a Linux System
- Describe the basic folder/path structure of Linux
- Describe the use of VI/VIM for file editing
Linux Architecture
- Hardware components include CPU, RAM, I/O Devices.
- The Kernel/Kernel Space is a special part of the OS which handles memory access and process scheduling and is protected, it can communicate directly to hardware.
- Device drivers, networking components, and other critical components run in the kernel.
- Kernels can be customized, with many devices running small, embedded kernels.
- A minimal Linux installation minimizes system libraries and device drivers, reducing exposure to critical systems.
- Servers may not have access to USB ports unless specific device drivers are installed and configured.
- GUIs can be memory and resource-intensive; critical servers may omit GUIs to conserve resources.
- User shells and processes in User Space communicate through system calls to the kernel.
Linux Kernel
- The Linux kernel is monolithic, written in C & Assembly.
- It is Free and open source.
- Released under the GNU General Public License version 2 (GPLv2).
- Commonly utilized in Android, Smart TVs, and webcams.
- Microkernels and hybrid kernels offer different security implications based on what runs in the OS protected space versus user space.
Linux Kernel Security
- Includes DAC and Superuser controls.
- Extensions include: Namespaces, Linux Security Modules, SELinux, Audit subsystem, Seccomp, and Integrity Management
- Linux has a comprehensive networking stack with support for security protocols, and can be used as a node and a router.
- It has cryptography support for encryption algorithms and operating modes.
- Security Enhanced Linux (SELinux) implements Mandatory Access Control (MAC) for government and military systems.
- Seccomp restricts access to system calls by processes.
- Integrity Management maintains the integrity of files using runtime integrity measurements that use cryptographic hashes.
User Space/Kernel Space
- The GNU C Lib (glibc) provides a mechanism to interact between kernel and user space.
- System calls offer basic read/write interface functions.
- Kernel services provide platform-independent kernel ops code.
- Device drivers are hardware-specific ops.
Daemon
- A daemon is a type of program that runs in the background.
- Daemons look like a "process".
- Daemons are assigned a unique process identification number (PID).
Software Libraries
- Software libraries consist of pre-written code, classes, procedures, scripts, and configuration data.
- Software libraries add functionality and automate functions in programs without requiring the developer to write additional code.
Linux Desktop Environments
- Options include Command Line (TTY/SSH Servers) and GUI.
- Command Line systems are more streamlined.
- GUIs offer point-and-click interaction.
- KDE, GNOME, Unity, and MATE are examples of Desktop Environments, which differ in their GUIs.
Basic Linux Commands
ls
(Directory listing)pwd
(Print Working Directory) shows the current directory.cat
concatenates files and view their contents.whoami
displays the owner of the current login session (shells).Man
accesses manual pages with details about other commands (help file).
LS Expanded
ls -a
include all files including hidden.ls -l
display file RWX permissions, owner (yellow), group (red).ls -l
(the letter, not the number 1) displays additional info including file/directory, size, date, time, owner and group permissions.ls -lh
lists the subdirectories in human readable size (1.6K, etc).ls -r
reverses order.ls -R
list subdirectories recursively.ls --help
displays the help information
File/Folder Commands
touch
creates a file or updates the timestamp.cd
changes the directory.mkdir
makes a directory.rmdir
remove a directory.
Folders
/
is the Root files system./bin
is Binaries/executables/etc
contains the configuration files./home
contains user folders; can be accessed via~
./log
contain the log files./usr
contains the user binaries./mnt
contains the mounts (devices, fileshares, etc.).
Path References
- The Current Folder is
~/sub1
or/home/student/sub1
. - Single dot (.) represents the current folder: such as
./sub2
- Double dot (..) moves up one level: such as
../sub3
.
and..
are called relative references because they are relative to the current folder./home/student/sub1
is the absolute path, starting at the root folder.- The tilde (~) refers to
/home/<current user such as /home/student.
- Sub1 can be referenced as
~/sub1
(Relative Reference) or/home/student/sub1
(Absolute Reference) from the current working directory.
VI/VIM Basics
- VI/VIM is a command line editor.
- Command mode executes commands on a file.
- Insert mode allows text editing in a file.
- Pressing
<Esc>
will return to command mode. - Use
:
(colon) to execute file commands. :x
exits vi.:wq
saves and exits.:q!
exits without saving.
Editing Text
- Arrow keys (or hjkl) move the cursor around the file.
i
inserts text before the cursor.a
appends text after the cursor.o
inserts a line below the cursor.O
inserts a line above the cursor.<Del>
orx
deletes a single character.
Searching
/<text>
searches forward for text.?<text>
searches backward for text.n
finds the next occurrence.N
finds the previous occurrence.- More commands exist, so finding a VI/VIM cheat sheet is recommended.
- VI is typically monochrome, while VIM is colorized (but not always installed).
Communication Basics
- Humans exchange information using letters and words.
- Computers use 0s and 1s, encoded into electronic signals, light, or radio waves to communicate.
Binary Communication
- Letters (and other data) are converted into 0s and 1s for computer communication.
- The process involves turning a letter into a number and then representing that number in 0s and 1s.
Numbering Systems
- Decimal (base 10) is the most familiar numbering system.
- Example: 1,234 is interpreted as 1 thousand (10³), 2 hundreds (10²), 3 tens (10¹), and 4 ones (10⁰).
Numbering Systems: Binary (Base 2)
- Binary uses powers of 2.
- From right to left, columns represent powers of 2.
- 1001 in binary equals 1 eight (2³), 0 fours (2²), 0 twos (2¹), and 1 one (2⁰).
- The binary number may sound like "one-zero-zero-one", and is the number nine.
- Binary uses two digits: 0 and 1.
- A "bit" is a "Blnary digiT".
Digits
- Decimal (base 10) requires ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
- Binary (base 2) requires two digits: 0 and 1.
Numbering Systems: Hex
- Hexadecimal (base 16) would need sixteen digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.
- A=10, B=11, C=12, D=13, E=14, and F=15
Numbering Systems: HEX
- A hexadecimal number such as 7F can be expressed
0x7F
to explicitly show it is in hex. - From right to left, the columns represent powers of 16.
- 7F is 7 sixteens (16¹) plus F ones (16⁰) or 716 + 151 = 112 + 15 = 127.
Numbering Systems
- Hexadecimal condenses four binary bits into one digit.
- Example: 0b1101 = 0xD (hex) = 13 (Decimal), making binary data more digestible for humans.
Binary to Hex Relationship
- 0000 = 0
- 0001 = 1
- 0010 = 2
- 0011 = 3
- 0100 = 4
- 0101 = 5
- 0110 = 6
- 0111 = 7
- 1000 = 8
- 1001 = 9
- 1010 = A
- 1011 = B
- 1100 = C
- 1101 = D
- 1110 = E
- 1111 = F
Octal
- Octal (Base 8) uses the digits 0-7.
- 3 bits of binary map directly to Octal.
- Effectively it is a subset of Hex.
- 000 = 0
- 001 = 1
- 010 = 2
- 011 = 3
- 100 = 4
- 101 = 5
- 110 = 6
- 111 = 7
Summary: Numbering Systems
- Decimal Numbering System (Base 10) are best for humans
- Binary Numbering Systems (Base 2) are best for computers
- Hexadecimal Numbering Systems(Base 16) are used to view binary data in a more compact way.
Communication: Encoding
- Any number can be turned into binary.
- Encoding is the method of encoding letters into a number.
- Many different encodings exist.
Encoding: ASCII
- Arbitrarily, the character-to-number map is 'A' = 65, 't' = 116, 'a' = 97, 'c' = 99, 'k' = 107.
- This is done referencing the ASCII Table.
ASCII Encoding
- ASCII is the American Standard Code for Information Interchange.
- A standard character encoding that assigns numbers to the most common typed characters.
- Consists of the numbers (0-255)
- Does not include less-common characters like those found in the Cyrillic, Greek, Russian, or Chinese alphabets
- Type "man ascii" in a bash session to see the ASCII table
ASCII Chart
- Some key pairings: 64=40=@, 65=41=A, 97=61=a
Possible Confusion
- The letter 'A' maps to the number 65 (0x41).
- The letter 'Z' maps to the number 90 (0x5A).
Putting it Together
- To send the message "Attack at dawn," turn every letter into a number.
- Then, represent every number with 0s and 1s: "A" → 65 or 0100 0001 (0x41), "t"→116 or 0111 0100 (0x74), "a"→ 97 or 0110 0001 (0x61).
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.