Linux Basics: System Architecture

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

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?

  • 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?

  • 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)?

<p>Fine-grained Mandatory Access Control (MAC). (A)</p> Signup and view all the answers

What is the purpose of the 'seccomp' mechanism in the Linux kernel?

<p>To restrict the system calls that can be made by a process. (D)</p> Signup and view all the answers

What is the primary function of the GNU C Library (glibc)?

<p>Provide a mechanism for user-space programs to interact with the kernel. (A)</p> Signup and view all the answers

Which of the following best describes the role of a 'daemon' in Linux?

<p>A background process that provides a system-level service. (C)</p> Signup and view all the answers

Why might a system administrator choose NOT to install a GUI on a server?

<p>To improve system security by reducing memory and resource usage. (B)</p> Signup and view all the answers

Which of the following is a valid use case for software libraries?

<p>Automating complex mathematical calculations in a program. (C)</p> Signup and view all the answers

In the context of Linux desktop environments, what does 'interchangeable' refer to?

<p>The graphical user interface and the command line shell. (C)</p> Signup and view all the answers

Which command is used to display the current working directory in Linux?

<p>pwd (A)</p> Signup and view all the answers

What information is provided by the ls -l command in Linux?

<p>A detailed listing including file permissions, owner, and size. (C)</p> Signup and view all the answers

What is the purpose of the touch command in Linux?

<p>To create a new empty file or update an existing file's timestamp. (A)</p> Signup and view all the answers

In the context of the Linux file system, what is the significance of the /etc directory?

<p>It stores essential system configuration files. (C)</p> Signup and view all the answers

What does the tilde (~) character represent when used in a Linux path?

<p>The home directory of the current user. (D)</p> Signup and view all the answers

Which mode in Vi/Vim is used to execute commands on a file?

<p>Command mode (D)</p> Signup and view all the answers

How do you save and exit a file in Vi/Vim?

<p>:wq (B)</p> Signup and view all the answers

What is the purpose of the 'i' command in Vi/Vim's command mode?

<p>To insert text before the cursor. (D)</p> Signup and view all the answers

In Vi/Vim, which command deletes a single character at the cursor?

<p>x (C)</p> Signup and view all the answers

What is the role of binary code in computer communication?

<p>It is the only way computers exchange information. (D)</p> Signup and view all the answers

How do computers represent letters and words in binary format for communication?

<p>By converting them into numbers using an agreed-upon encoding. (A)</p> Signup and view all the answers

In the decimal numbering system (base 10), how is the number 1234 interpreted?

<p>As 1 thousand, 2 hundreds, 3 tens, and 4 ones. (D)</p> Signup and view all the answers

What decimal number is represented by the binary number 1001?

<p>9 (B)</p> Signup and view all the answers

How many unique digits are needed to represent numbers in hexadecimal (base 16)?

<p>16 (D)</p> Signup and view all the answers

What decimal value is equivalent to the hexadecimal number 7F?

<p>127 (A)</p> Signup and view all the answers

Why is hexadecimal notation often preferred over binary notation when representing numbers in computing?

<p>Hexadecimal provides a more compact and human-readable representation of binary data. (D)</p> Signup and view all the answers

Given that 0b1101 is equal to 0xD in hex, what does 0b1111 equal in hex?

<p>0xF (D)</p> Signup and view all the answers

What is the primary advantage of using hexadecimal notation to represent binary data?

<p>It provides a more compact and readable representation. (A)</p> Signup and view all the answers

How many bits does each digit represent in octal (base 8)?

<p>3 bits (C)</p> Signup and view all the answers

What differentiates ASCII from other encoding standards?

<p>It uses a smaller range of numbers to represent common characters. (B)</p> Signup and view all the answers

Which of the following is true regarding ASCII encoding?

<p>ASCII maps characters to numbers. (B)</p> Signup and view all the answers

According to the ASCII standard, the letter 'A' is represented by the number 65. What is the hexadecimal representation of 'A' according to ASCII?

<p>0x41 (B)</p> Signup and view all the answers

If the lowercase letter 'a' has an ASCII decimal value of 97, what is its binary representation?

<p>0110 0001 (A)</p> Signup and view all the answers

In ASCII, the letter 'Z' is represented as the decimal number 90. What potential confusion can arise when reading '90' as a Hex character?

<p>The number 90 may be interpreted as the number 90. (B)</p> Signup and view all the answers

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'?

<p>65, 116, 97, 99, 107 (B)</p> Signup and view all the answers

Flashcards

Kernel / Kernel Space

The core of the OS that interacts directly with hardware.

User Space

User shells and processes communicate with hardware via the kernel.

Daemon

A type of program that runs in the background.

Software Libraries

Pre-written code, classes, and procedures for added functionality.

Signup and view all the flashcards

Command Line

TTY/SSH or Servers accessed through the command line

Signup and view all the flashcards

ls Command

ls lists directory contents.

Signup and view all the flashcards

pwd Command

pwd displays the current working directory.

Signup and view all the flashcards

whoami Command

whoami displays current login username.

Signup and view all the flashcards

man Command

man displays commands manual pages.

Signup and view all the flashcards

cat Command

Concatenates files / output

Signup and view all the flashcards

touch Command

Creates new files or updates timestamps.

Signup and view all the flashcards

cd Command

cd: Changes to a directory in the directory structre.

Signup and view all the flashcards

mkdir Command

mkdir: Create Directory.

Signup and view all the flashcards

rmdir Command

rmdir removes an empty directory.

Signup and view all the flashcards

/ Root

The root directory that contains the file system

Signup and view all the flashcards

/bin directory

Contains essential command binaries.

Signup and view all the flashcards

/etc directory

Contains system-wide configuration files.

Signup and view all the flashcards

/home directory

Stores user-specific files and settings.

Signup and view all the flashcards

/var/log directory

Stores system log files.

Signup and view all the flashcards

/mnt

Special directories that map access to the software

Signup and view all the flashcards

Relative Reference

Path relative to current location.

Signup and view all the flashcards

Absolute Reference

Full path from the root directory.

Signup and view all the flashcards

VI/VIM Command mode

Command mode in VI/VIM executes commands on file.

Signup and view all the flashcards

VI/VIM Insert mode

Insert mode in VI/VIM is for text entry.

Signup and view all the flashcards

Escape Key in VI/VIM

<Esc> returns to command mode.

Signup and view all the flashcards

':wq' Command in VI/VIM

':wq' saves and exits the file in VI/VIM.

Signup and view all the flashcards

':q!' Command in VI/VIM

':q!' exits VI/VIM without saving.

Signup and view all the flashcards

Decimal

This represents base 10, it is the system we use as humans

Signup and view all the flashcards

Binary

A base 2 numbering system.

Signup and view all the flashcards

Hexadecimal

Base-16 numbering system.

Signup and view all the flashcards

Octal

Eight digits as it's base

Signup and view all the flashcards

ASCII

ASCII assigns numbers to common characters.

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> or x 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.

Quiz Team

Related Documents

More Like This

Linux Kernel and Distributions
28 questions
Architecture Android
10 questions

Architecture Android

CrisperDrums1252 avatar
CrisperDrums1252
Use Quizgecko on...
Browser
Browser