From 2a699bbcf16ab81528d7de673aca28133d464be9 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 14:06:37 +0200 Subject: [talks/lbs] Reworded some history slides --- src/talks/linuxgraphy-by-strabo/index.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index ca83fb6..88a011b 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -148,8 +148,8 @@ Some of it's novel ideas include, but are not limited to: #### 1969: Death of Multics and birth of UNIX -Ultimately Multics grew too large and became unusable, unmaintainable and unchangeable. -In the beginning, programming was done mostly by [Bell Labs](https://en.wikipedia.org/wiki/Bell_Labs), with [Ken Thompson](https://en.wikipedia.org/wiki/Ken_Thompson) as one of the developers. +Ultimately Multics grew too large, becaming unusable and unmaintainable. +In the beginning, programming was done mostly by [Bell Labs](https://en.wikipedia.org/wiki/Bell_Labs), with [Ken Thompson](https://en.wikipedia.org/wiki/Ken_Thompson) being one of the developers. &&lineb1 &&ftable @@ -163,7 +163,7 @@ In the beginning, programming was done mostly by [Bell Labs](https://en.wikipedi &&cont Thompson still had some desire to work on operating systems, after Bell Labs pulled out. -The tools he made while rewriting a video game [he made](https://en.wikipedia.org/wiki/Space_Travel_%28video_game%29) on a PDP-7 lead to a whole operating system: UNIX. +The tools he made while rewriting [his own video game](https://en.wikipedia.org/wiki/Space_Travel_%28video_game%29) on a PDP-7 lead to a whole operating system: UNIX. Based, expanded on and improved upon many of Multic's ideas, UNIX became the father of modern OSs. @@ -247,15 +247,15 @@ Thanks to the widely popular [VT100](https://en.wikipedia.org/wiki/VT100), almos Today we don't usually use such specialised hardware, but the names persist with slightly different meanings. -[Virtual Terminal](https://en.wikipedia.org/wiki/Virtual_console) (Console): on some modern UNIX-likes (like Linux), the kernel/OS provide special devices, where a console is directly implemented/simulated with the connected computer and display. Sometimes could be called "tty". +[Virtual Terminal](https://en.wikipedia.org/wiki/Virtual_console) (Console, tty): on some modern UNIX-likes (like Linux), the kernel/OS provides special devices, where a console is directly implemented/simulated with the connected computer and display. - systems that don't provide it usually expose another way to connect a console (now external hardware and/or software is required), like a [serial](https://en.wikipedia.org/wiki/Serial_port) port [Terminal Emulator](https://en.wikipedia.org/wiki/Terminal_emulator): a special program that emulates a virtual terminal (within another display system) -[Pseudoterminal](https://en.wikipedia.org/wiki/Pseudoterminal) (pty): a device that behaves, from the point of a user, like a terminal (emulator), but could do other additional things +[Pseudoterminal](https://en.wikipedia.org/wiki/Pseudoterminal) (pty): a program that sits between a terminal and a shell (or other program), and makes them both think they're directly connected -- ssh, a program to remotely connect to a device's shell, establishes a pseudoterminal. You use your (local) terminal to send and receive text to a remove terminal. +- ssh, a program to remotely connect to a device's shell, establishes a pseudoterminal. Your local terminal thinks it's connected to a local shell and vice versa with the remote shell, however the pty in between handles the true communication. &&/slide -- cgit v1.3.1-26-gb76a From 37b350c5e673faf3a789e943f104256954d043b3 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 14:08:47 +0200 Subject: [talks/lbs] Slight rewording and reformatting of shell slides --- src/talks/linuxgraphy-by-strabo/index.md | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 88a011b..8a5ecc8 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -261,22 +261,30 @@ Today we don't usually use such specialised hardware, but the names persist with -&&slide &&font27 +&&clide + +Most commands are regular programs, which exist somewhere on the system. +When entering a command name, the shell searches for an executable with that name. +Searching the whole drive is very inneficient, so the search is limited to the few directories, listed in a variable called "PATH". + +You can give a full or relative path, and that will be execute directly. -Most commands are regular programs, which exist in any folder (specified inside the variable "PATH"). Each command can be given parameters, separated by spaces, each (by convention) being either text values or options (switches). Options usually start with a hyphen `-` (like `-c` or `-current-time`) and often support abbreviations (`-a -b -c` to `-abc`). Newer conventions also allow start with two hyphens `--` (`--current-time`), though if shown as-is indicate the rest is a string. More rarely you might see `--OPTION=VALUE` or just `OPTION=VALUE`. -UNIX shells always have at least these additional functionalities: +&&/clide -- pipelines: being able to redirect the output from one command to another without limit - ``` - command1 [args...] | command 2 [args...] | ... - ``` + +&&clide + +The first UNIX shell is the [Thompson shell](https://en.wikipedia.org/wiki/Thompson_shell). +With time, other shells appeared, but each introduced it's own unique feature or syntax set. + +However, all of them have in common the two major functionalities of the Thompson shell: - I/O redirection: redirection of input and output, allowing insertion of input from a file or storage of output into a file: @@ -285,7 +293,13 @@ UNIX shells always have at least these additional functionalities: command [args...] > filepath ``` -&&/font &&/slide +- pipelines: being able to redirect the output from one command to another without limit + + ``` + command1 [args...] | command 2 [args...] | ... + ``` + +&&/clide @@ -303,7 +317,7 @@ UNIX shells always have at least these additional functionalities: -&&slide &&font27 +&&slide The main attributes that every inode has are as follows: -- cgit v1.3.1-26-gb76a From 82b260461c19efe67f32e6a216d01663439a0138 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 14:09:32 +0200 Subject: [talks/lbs] Spread out file types info and added text diagrams --- src/talks/linuxgraphy-by-strabo/index.md | 54 +++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 8a5ecc8..0308f51 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -325,14 +325,60 @@ The main attributes that every inode has are as follows: There are 7 main types (but there can exist more, depending on OS): &&lineb1 + **regular**: just a plain old file - + **directory**: as explained, a file containing hard links to other files. Each directory is allowed to appear only once in a single parent. - + **symbolic link**: points to any file (or directory). It contains the (relative) path to that object (as a simple string), so a symlink could even not be valid. + + **directory**: as explained, a file containing hard links to other files. Each directory is allowed to appear *only once* in a single parent. + + **symbolic link**: points to any file (or directory). It contains the (relative) path to that object (as a simple string), so a symlink could even not be valid. + Think of a C++ pointer (pseudocode). + + ``` + symlink /bin/mprog = "/usr/local/bin/mprog"; + exec(/bin/mprog); -> Executes /usr/local/bin/mprog + ``` + +&&/slide + + + +&&slide + + **FIFO special**: aka [named pipe](https://en.wikipedia.org/wiki/Named_pipe), a special type of regular file, where at any moment only one process can read from it and one can write to it. It takes the concept of shell pipes to inter-process communication. + + ``` + [Process] --write-> [FIFO] x-write-- [Process] + [ A ] x--read-- [ ] --read--> [ B ] + ``` + + **block special**: a device which is randomly accessible, like a hard drive or cdrom drive. - + **character special**: devices which are accessed via serial streams of input or output, like keyboards, mice, graphics cards and teletypes + Think of a C++ array (pseudocode): + + ``` + BlockSpecial[438] = 1 ; var = BlockSpecial[438] + ``` + + + **character special**: devices which are accessed via serial streams of input or output, like keyboards, mice, graphics cards and teletypes. + Think of a C++ stream (pseudocode): + + ``` + CharacterSpecial << 1 ; CharacterSpecial >> var + ``` + +&&/slide + + + +&&clide + + **sockets**: file for inter-process communication. Compared to FIFO specials, they can be used by more than two processes, used in both direction and support [file descriptors](https://en.wikipedia.org/wiki/File_descriptor) and packets -&&/font &&/slide + ``` + [Process A] <--read&write--> [Socket 1] + [Process B] <--read&write--> [Socket 1] + ... + + [Process A] --write--> [Socket 1] --read--> [Process B] + \-read--> [Process C] + ``` + +&&/clide -- cgit v1.3.1-26-gb76a From 47510d932f0dad22422feab8f77c6bab99c1e8f4 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 14:10:46 +0200 Subject: [talks/lbs] Slight rewording and reformatting of users and groups slides --- src/talks/linuxgraphy-by-strabo/index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 0308f51..12b9e6c 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -388,9 +388,9 @@ The main attributes that every inode has are as follows: &&lineb3 -A user in UNIX is essentially a small collection of data, most important of it being a unique ID (number), a name (string), a group id (number; files created by the user are in that group) and a password. +A user in UNIX is essentially a small collection of data, most important of it being a **unique ID** (number), a **name** (string), a **group id** (number; files created by the user are in that group) and a **password**. -Groups are also small collections of data, but much simpler, comprised only of a unique ID (number), a name (string) and a list of users that are "in" the group. Their main purpose is to simplify access control. +Groups are also small collections of data, but much simpler, comprised only of a **unique ID** (number), a **name** (string) and a **list of users** that are "in" the group. Their main purpose is to simplify access control. User with ID 0 is called root, it is the "system administrator", all actions made by the system itself are done as that user. Every user has their own "home" folder (under "/home/USERNAME/", except for root, which is "/root/"), in which they store personal files, as well as user-specific configuration files. @@ -402,13 +402,13 @@ Every user has their own "home" folder (under "/home/USERNAME/", except for root &&slide - [file permissions](https://en.wikipedia.org/wiki/File_system_permissions): control the freedom of a user to read (navigate for directories), change and execute files - File permissions are split into three sets: what the owner can do, what group members can do and what anyone else can do. + File permissions are split into three sets: what the **owner** can do, what **group** members can do and what **anyone else** can do. Each set contains a mix of three permissions: **r**ead, **w**rite and e**x**ecute, and each set stores some combination of them. &&lineb1 Each is represented by a bit in the order above (`101` means you *can* read, *cannot* write, *can* execute) and the overall permissions are often shown as a three digit number or character string. Example: `111101100` will be shown as `754` or `rwxr-xr--` -- link count: the amount of hard links that point to the inode. Every directory inode contains (normally) exactly two: one from the parent and one from itself ("."). A file is only deleted where there are no hard links left to it (or when there is only one for a directory). +- link count: the amount of hard links that point to the inode. Every directory inode contains (normally) exactly two: one from the parent and one from itself ("."), though the latter isn't added to the count*^[citation ^needed]* . A file is only deleted where there are no hard links left to it. - User ID of owner, Group ID, file size and timestamps -- cgit v1.3.1-26-gb76a From 53d6dbf0c1095a03f5935810a3e642a1c1c0b7cd Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 14:11:48 +0200 Subject: [talks/lbs] Added slides for memory and process management, restructured kernel slide --- .../img/virtual-memory-by-Ehamberg.png | Bin 0 -> 31668 bytes src/talks/linuxgraphy-by-strabo/index.md | 163 ++++++++++++++++++++- 2 files changed, 160 insertions(+), 3 deletions(-) create mode 100644 src/talks/linuxgraphy-by-strabo/img/virtual-memory-by-Ehamberg.png (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/img/virtual-memory-by-Ehamberg.png b/src/talks/linuxgraphy-by-strabo/img/virtual-memory-by-Ehamberg.png new file mode 100644 index 0000000..0f2880c Binary files /dev/null and b/src/talks/linuxgraphy-by-strabo/img/virtual-memory-by-Ehamberg.png differ diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 12b9e6c..fd6d7e3 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -416,19 +416,176 @@ Every user has their own "home" folder (under "/home/USERNAME/", except for root -&&slide &&font35 +&&slide ## 2.3. Kernel +&&font18 &&lineb1 &&/font + The kernel has the core functionality of the operating system and bridges the gap between programs and hardware. Some important subsystems include scheduling, file, device, process and memory management. To preserve the [everything is a file](https://en.wikipedia.org/wiki/Everything_is_a_file) methodology, devices and processes can be handled as files (inside `/dev` and `/proc`). -They (often, in modern kernels) aren't actual files on a hard drive, but "virtual" files, where operations on them are handled in a different manner than normal by the kernel. +They (most of the time, in modern kernels) aren't actual files on a hard drive, but "virtual" files, where operations on them are handled in a different manner than normal by the kernel. + +&&lineb2 + +&&font35 Linux is **not** an operating system, it is a kernel!!! &&/font + +&&lineb2 + +Two of the important things a kernel does is manage **processes** and **memory**. + +&&/slide + + + +&&slide &&font35 + +### 2.3.1 Processes &&lineb1 -Linux is **not** an operating system, it is a kernel!!! +A program is some collection of code and other data, stored in a file (or uncompiled code). +A process is the program in motion, the program itself *alongside* certain system states. + +The system states include (but are not limited to): + +- the processor state, including the program counter and register values +- memory map, indicating what regions of memory are allocated (to the process) +- [file descriptors](https://en.wikipedia.org/wiki/File_descriptor), unique identifiers for files + + +&&/font &&/slide + + + +&&clide &&font35 + +On a multitasking (multiprocessing) system, which is any modern desktop system, multiple processes are always running "at once". + +In reality, constantly one process is stopped and another is ran, switching between all of them ([context switching](https://en.wikipedia.org/wiki/Context_switch)). +All "waiting" processes are put in a prioritized queue ([run queue](https://en.wikipedia.org/wiki/Run_queue)). + +Stopping is either done by the process itself (more on that later), or by the system when the process has been actively running for too much time. + +&&/font &&/clide + + + +&&clide &&font35 + +All process information is stored in a data structure, called a *process control block* (or process descriptor). +Not to be confused with a [printed circuit board](https://en.wikipedia.org/wiki/Printed_circuit_board)! +A PCB's data can be split into three categories: + +1. **Process identification** - the ID of the process itself, of it's parent process, of it's owner (user), etc. +2. **Process state** - as described, the processor state, etc. + On a context switch, values in register are put into the stopped PCB and then are loaded from the running PCB. +3. **Process control information** - process state, memory map, privileges, etc. + +A process can be **forked**, meaning a new process is created, with the same underlying code (but not process states and ...). + +&&/font &&/clide + + + +&&clide &&font35 + +Typically, there are at least 5 process states: + +- **Created**: This is the initial state given to a new process. In this state, the process awaits a "ready" state. +- **Ready** (Waiting): A process is put in the run queue and awaits being executed ("running" state). +- **Running**: When the process's program is being currently executed by the CPU. The process can run in either *kernel mode*, having access to the kernel and user addresses, or *user mode*, having access only to it's own code and data. +- **Blocked**: When a process cannot continue without external change, usually when waiting for an I/O device. +- **Terminated**: The process has either completed execution or has been killed. The process itself is called a ["zombie process"](https://en.wikipedia.org/wiki/Zombie_process) (until it is removed). + +&&/font &&/clide + + + +&&slide &&font35 + +### 2.3.2 Memory management + +&&lineb2 + +In ye olde days, you would save a bit of memory for the operating system and give all of the rest to the current process ([monoprogramming](https://en.wiktionary.org/wiki/monoprogramming)), which we wait until completion. + +This doesn't allow for context switching (disks are slow) and a blocked state forces the CPU to wait. + +Some bad ideas include: depending on the code of all processes to not use the same addresses, use only [relative addresses](https://en.wikipedia.org/wiki/Position-independent_code) (`-fPIC` option in `gcc`) or use a [table](https://en.wikipedia.org//wiki/Relocation_%28computing%29#Relocation_table) that the kernel fills out with addresses. + +&&/font &&/slide + + + +&&slide &&font35 + +### Virtual memory + +&&lineb2 + +&&fright +![](./img/virtual-memory-by-Ehamberg.png) +&&font18 *Image by [Ehamberg](https://commons.wikimedia.org/wiki/File:Virtual_memory.svg)* &&/font +&&/fright + +A process work with some (sequential) addresses, and the OS (with the help of [hardware](https://en.wikipedia.org/wiki/Memory_management_unit)) translates/maps the process' addresses (logical/[virtual addresses](https://en.wikipedia.org/wiki/Virtual_address_space)) to real ones (physical addresses). + +We simplify memory management for the program, protects each process' address space and is very flexible. + +&&/font &&/slide + + + +&&slide &&font35 + +#### Segmentation (without paging) + +&&lineb2 + +Initially, virtual memory was implemented with segmentation, where a process' memory is divided into segments for code, stack, heap, etc. +Each segment is given a chunk of contiguous memory, which can be resized, and addresses are defined as the base segment (physical) address with an offset. + +In the modern day, segmentation isn't used by itself, since resizing segments could require reordering of memory and [external fragmentation](https://en.wikipedia.org/wiki/Fragmentation_%28computing%29#External_fragmentation), where there simply isn't enough contiguous memory, could occur. + + +&&/font &&/slide + + + +&&slide &&font35 + +#### Paging + +&&lineb3 + +The virtual and physical memory is divided into fixed-sized chunks of consequtive addresses. +A virtual memory chunk is called a **page**, while a physical memory chunk is called a (page) **frame**. +Usually both have the same size of (at least) 4 KiB. + +Every process has a [page table](https://en.wikipedia.org/wiki/Page_table), which maps the process' pages to system frames. +Thus every memory address is translated from it's page location to a frame location. + +&&/font &&/slide + + + +&&slide &&font35 + +Advantages include: + +- elimination of [external fragmentation](https://en.wikipedia.org/wiki/Fragmentation_%28computing%29#External_fragmentation) +- increased flexibility, allowed sharing of memory between processes (useful for shared libraries) +- finding free memory is fast and easy, just use the first free pages you see +- frames can be scattered +- more efficient swapping, moving of memory from RAM to disk and back + +Disadvantages include: + +- longer memory access, because of the page table +- [internal fragmentation](https://en.wikipedia.org/wiki/Fragmentation_%28computing%29#Internal_fragmentation), where one or multiple pages might be partially empty, leaving free space that cannot be used &&/font &&/slide -- cgit v1.3.1-26-gb76a From d501ce32703c04b1ee7f9c61c2a1efa22216bf58 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 14:12:52 +0200 Subject: [talks/lbs] Added kernel slides sources and a message for licensing info on custom assets --- src/talks/linuxgraphy-by-strabo/index.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index fd6d7e3..9ed785c 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -2,6 +2,8 @@ ### Custom assets +*Licensing information in the last slide, at the bottom of the page* + - [UNIX layers image](./img/unix-layers.png) - [UNIX directory tree](./img/unix-dir-tree.png) - [mll-set.sh](./mll-set.sh) @@ -1063,13 +1065,18 @@ Currently there won't be an official recording of the process, you should've bee # Sources All of these contain, at most, small paraphrased sentences in the slides. -They mostly served as personal educational/reference tools. +They served as personal educational and reference tools. - [wikipedia](https://en.wikipedia.org/) and [stackexchange](https://stackexchange.com/) has been used extensively and linked where appropriate. - [CS416 - Operating Systems Design](https://people.cs.rutgers.edu/~pxk/416/index.html) by [Paul Krzyzanowski](https://people.cs.rutgers.edu/~pxk/rutgers/) at [Rutgers State University](https://www.cs.rutgers.edu/) - [Origins and History of UNIX, 1969-1995](https://web.archive.org/web/20220713165958/https://homepage.cs.uri.edu/~thenry/resources/unix_art/ch02s01.html) from [The Art of Unix Programming](https://web.archive.org/web/20220611160552/https://homepage.cs.uri.edu/~thenry/resources/unix_art/index.html) by Eric Steven Raymond - [Ken Thompson interviewed by Brian Kernighan at VCF East 2019](https://www.youtube.com/watch?v=EY6q5dv_B-o) by [Vintage Computer Federation](https://vcfed.org/) - [Hard links and Unix file system nodes](https://teaching.idallen.com/dat2330/04f/notes/links_and_inodes.html) from [DAT 2330 Introduction to Operating Systems](https://teaching.idallen.com/dat2330/04f/) by [Ian D. Allen](http://www.idallen.com/) +- [Virtual Memory, OS Course Notes](https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/9_VirtualMemory.html) by [Dr. John T. Bell](https://www.cs.uic.edu/~jbell/) at [University of Illinois Chicago](https://www.cs.uic.edu), + which is directly based on [Operating System Concepts, 9th Edition](https://archive.org/details/operating-system-concepts-9e) by [Abraham Silberschatz](https://codex.cs.yale.edu/avi/) +- [Chapter 9 Preview - Virtual Memory](http://csapp.cs.cmu.edu/3e/home.html) from [Computer Systems: A Programmer's Perspective](http://csapp.cs.cmu.edu/) by [Randal E. Bryant](http://www.cs.cmu.edu/~bryant) and [David R. O'Hallaron](http://www.cs.cmu.edu/~droh) +- [Memory Management, Lecture Notes](https://www.cse.iitb.ac.in/~mythili/teaching/cs347_autumn2016/notes/07-memory.pdf) by [Mythili Vutukuru](https://www.cse.iitb.ac.in/~mythili/) +- [Paging advantages and disadvantages](http://www.cs.iit.edu/~cs561/cs351/VM/paging%20advantages%20and%20disadvantages.html) by Charles R. Bauer at [Computer Science Departmemnt of Illinois Institute of Technology](http://www.cs.iit.edu/) - [/usr hierarchy](https://www.linuxbase.org/betaspecs/fhs/fhs/ch04.html) from [Filesystem Hierarchy Standard](https://www.linuxbase.org/betaspecs/fhs/fhs/index.html) by [Linux Foundation](https://www.linuxfoundation.org/), Daniel Quinlan, Paul 'Rusty' Russell, Christopher Yeoh - [User & Group Names](https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/usernames.html#FTN.AEN26405) from [Linux Standard Base Core Specification](https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/book1.html) by [Free Standards Group](https://en.wikipedia.org/wiki/Free_Standards_Group) - [Managing User Accounts](https://docstore.mik.ua/orelly/linux/run/ch05_07.htm) from [Running Linux, Third Edition](https://docstore.mik.ua/orelly/linux/run/index.htm) by Matt Welsh, Matthias Kalle Dalheimer, and Lar Kaufman -- cgit v1.3.1-26-gb76a From cc371f76a2ae5a04b11e69015ebaca6891efc097 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 20:39:30 +0200 Subject: [talks/lbs] Added titles to a lot of shell and file system slides --- src/talks/linuxgraphy-by-strabo/index.md | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 9ed785c..75cf951 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -218,8 +218,10 @@ While on the topic of UNIX, we'll only discuss the former. &&slide +### Command-line shells + Command-line shells operate solely with text, usually with only ASCII characters. -There are usually two terms used when talking about connecting to a computer (to the shell), those are "terminal" ("console") and "teleprinter" ("teletype"). +Usually connecting to a computer (to the shell) is said to be done with either a "terminal" ("console") or "teleprinter" ("teletype"). &&table @@ -265,6 +267,8 @@ Today we don't usually use such specialised hardware, but the names persist with &&clide +### Command location and parameters + Most commands are regular programs, which exist somewhere on the system. When entering a command name, the shell searches for an executable with that name. Searching the whole drive is very inneficient, so the search is limited to the few directories, listed in a variable called "PATH". @@ -283,10 +287,10 @@ More rarely you might see `--OPTION=VALUE` or just `OPTION=VALUE`. &&clide -The first UNIX shell is the [Thompson shell](https://en.wikipedia.org/wiki/Thompson_shell). -With time, other shells appeared, but each introduced it's own unique feature or syntax set. +### Thompson shell -However, all of them have in common the two major functionalities of the Thompson shell: +The first UNIX shell is the [Thompson shell](https://en.wikipedia.org/wiki/Thompson_shell). +The two major features that every other shell supports are: - I/O redirection: redirection of input and output, allowing insertion of input from a file or storage of output into a file: @@ -319,9 +323,9 @@ However, all of them have in common the two major functionalities of the Thompso -&&slide +&&clide -The main attributes that every inode has are as follows: +### Attributes of an inode - [file type](https://en.wikipedia.org/wiki/Unix_file_types): Each inode represents some sort of file (data), but a "file" can also be a directory or device, so we need to know how to handle it. There are 7 main types (but there can exist more, depending on OS): @@ -336,7 +340,7 @@ The main attributes that every inode has are as follows: exec(/bin/mprog); -> Executes /usr/local/bin/mprog ``` -&&/slide +&&/clide @@ -475,7 +479,9 @@ Stopping is either done by the process itself (more on that later), or by the sy -&&clide &&font35 +&&slide &&font35 + +#### Process Control Block All process information is stored in a data structure, called a *process control block* (or process descriptor). Not to be confused with a [printed circuit board](https://en.wikipedia.org/wiki/Printed_circuit_board)! @@ -488,13 +494,13 @@ A PCB's data can be split into three categories: A process can be **forked**, meaning a new process is created, with the same underlying code (but not process states and ...). -&&/font &&/clide +&&/font &&/slide &&clide &&font35 -Typically, there are at least 5 process states: +#### Process states - **Created**: This is the initial state given to a new process. In this state, the process awaits a "ready" state. - **Ready** (Waiting): A process is put in the run queue and awaits being executed ("running" state). -- cgit v1.3.1-26-gb76a From afe42033920f4c05748cc85e41010f16fda08867 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 20:40:30 +0200 Subject: [talks/lbs] Added exit status slide to processes --- src/talks/linuxgraphy-by-strabo/index.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 75cf951..9d828b0 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -512,6 +512,20 @@ A process can be **forked**, meaning a new process is created, with the same und +&&clide &&font35 + +#### Exit status + +Every process, before being deleted (and after being in a Terminated state) passes a small number, called the [exit status](https://en.wikipedia.org/wiki/Exit_status) (exit code), to it's parent process. +For all intents and purposes, this number is an 8bit unsigned integer, meaning it's value is between 0 and 256. + +Pretty much universally, an exit code of 0 signifies a successful termination, and anything else specifies some sort of error code. +Different programs specify the meaning of an exit code in different ways, some assign each number to a specific error, other use the bits representing the number as flags. + +&&/font &&/clide + + + &&slide &&font35 ### 2.3.2 Memory management -- cgit v1.3.1-26-gb76a From 2baec5c780378429ee0e5e4d91e873322581eb48 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 20:41:17 +0200 Subject: [talks/lbs] Added variables and data types slides for shells --- src/talks/linuxgraphy-by-strabo/index.md | 127 +++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 9d828b0..f5748c6 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -658,6 +658,133 @@ In summary, it installs bash, coreutils and shadow "packages" (from [http://s.mi ## 3.1. Shells +&&lineb2 + +### Variables and data types + +Before talking about the different features newer shells support, we'll roughly cover variables and data types (mostly [bash](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Parameters) specifics). + +A variable, also called parameter, is created with the syntax (NO spaces between the =): + +``` +name=value +``` + +Where `name` is either a combination of letters (upper and lower case), numbers and the underscore character, which always begins with a letter, or one of select few **positional** and **special** parameters. + +&&/slide + + + +&&slide &&font35 + +#### Positional and special parameters + +[Positional parameters](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Positional-Parameters) are numbers from 1 to N, where each one corresponds to a shell (or function, or script) argument. + +Some of the [special parameters](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Special-Parameters) are: + +- `0`, correspoinding to the shell's or script's name, +- `@` is all positional parameters, separated by spaces +- `#` is the number of positional parameters +- `?` is the last executed (foreground) process +- `$` is process ID of the current shell. + +`value`, without any special surounding characters (more on that later), is treated as a string (but it mustn't have spaces!), however it may also be omitted, in which case it is the empty string `""`. + +&&/font &&/slide + + + +&&slide &&font35 + +#### Data types + +In most shells, there are 3 data types: strings, integers and (one-dimentional) indexed arrays. +[bash has more](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#index-declare), like references and associative arrays, but those aren't universal. + +A value is a **string** when surrounded by single `'` or double `"` quotes, +an **integer** when it isn't surrounded by anything and composed only of digits (if there are letters, it is a string; it's [quite tricky](https://tldp.org/LDP/abs/html/untyped.html) when a value is interpreted as a string or integer) and +an **array** when surrounded by braces `()`, where inside elements are strings or integers, separated by spaces. +An indexed array can also be created by specifying the value at any index: + +``` +name[index]=value +``` + +&&/font &&/slide + + + +&&slide + +#### Mixing types and operations + +``` +name=value +``` + +| Type |Value with| string operation | integer operation | array operation | +|-------|----------|---------------------------------------|---------------------------------------|---------------------------------------------| +|string | |value |0 |value when index is 0, empty string otherwise| +|integer| |empty string, but sometimes value |value |value when index is 0, empty string otherwise| +|array | |operation is done on element at index 0|operation is done on element at index 0|value | + +&&/slide + + + +&&slide + +#### Parameter expansion + +With [parameter expansion](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Parameter-Expansion), actions are done with the general variable (entity) or on strings and arrays values. +Operations on integers are done with [arithmetic expansion](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Arithmetic-Expansion). + +Parameter expansion is started with the character `$` and either a name or curly braces. +Retrieving a value is done with the forms `$name`, `${name}` and `${name[index]}` for arrays. + +Some parameter expansions in bash: + +- `${#parameter}` length of characters +- `${parameter:offset}` and `${parameter:offset:length}` return substring from index offset +- `${parameter/pattern/string}` return a string, where every match on pattern is replaced by string +- `${!name[@]}` a (space separated) sequence of indecies from 0 to length (for defined values) of array name + +&&/slide + + + +&&slide + +#### Arithmetic expansion + +Arithmetic expansions allow evaluation of [arithmetic expressions](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Arithmetic). +They're in the form `$(( expression ))`. + +Some useful expressions are: + +- `++name`, `name++`, `--name`, `name++` postfix and prefix incrementation and decrementation +- `+`, `-`, `*`, `/`, `%` normal arithmetic operators, `**` exponentiation +- `~`, `<<`, `>>`, `&`, `^`, `|` bitwise operators +- `==`, `!=`, `>`, `>=`, `<`, `<=` logical comparison +- `!`, `&&`, `||` logical not, and, or +- `expr ? exprTrue : exprFalse` conditional +- `=`, `+=`, ..., `<<=`, ... assignment operators +- `expr1 , expr2` consequtive expressions and `(expr)` bracing + +Expressions work with both variable names and integers. + +&&/slide + + + +&&clide + +### Bourne shell + +Most modern shells support a lot of the more defying features of the [Bourne Shell](https://en.wikipedia.org/wiki/Bourne_shell), which include: + - [Job control](https://en.wikipedia.org/wiki/Job_control_%28Unix%29): Management of currently running groups of processes + `&`: A process can be ran in the background with an ampersand (&) at the end of the command: -- cgit v1.3.1-26-gb76a From 80d2ff6ad5047e01388a451d0ce3fbe104195b65 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 20:42:17 +0200 Subject: [talks/lbs] Minor formatting modifications to shell slides --- src/talks/linuxgraphy-by-strabo/index.md | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index f5748c6..10b2aea 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -792,24 +792,24 @@ Most modern shells support a lot of the more defying features of the [Bourne She command [args...] & ``` - + `Ctrl+z`: suspend (stop but leave in the background) the currently running (foreground) job + + `Ctrl+z`: suspend the currently running (foreground) job + `bg`: start a suspended job in the background + `fg`: resume the last job to be put in the background and make it the current job with which we're interacting + `jobs`: list all active (background) jobs -&&/slide +&&/clide &&clide -- continuation - + Every job is identified with a Job ID (number), which you can use by prepending a percentage sign. Example, to resume the job with JID 4: +-   + + Every job is identified with a **Job ID** (number), which you can use by prepending a percentage sign. Example, to resume the job with JID 4: ``` fg %4 ``` - + For managing everything, usually there is a job table. + + For managing everything, usually there is a *job table*. Upon shell termination, the shell tells all jobs in that table to terminate and waits for them. `disown`: remove a job from the job table + `kill`: send a signal to the process or job. Then that process will have to handle it accordingly. @@ -819,7 +819,7 @@ Most modern shells support a lot of the more defying features of the [Bourne She -&&slide &&font27 +&&clide &&font27 - [heredoc](https://en.wikipedia.org/wiki/Here_document): File literal, meaning it is a user "string" which is interpreted as a file + start with `<< NAME`, where NAME can be anything you want, it is used to mark the beginning and end of a heredoc. `<<` is also a redirection symbol @@ -837,11 +837,9 @@ Most modern shells support a lot of the more defying features of the [Bourne She - control operators: Control what command is executed, depending on [exit status](https://en.wikipedia.org/wiki/Exit_status) + `expr1 && expr2`: Run expr2, only if expr1 exited successfully + `expr1 || expr2`: Run expr2 if expr1 exited unsuccessfully - + `expr1 ; expr2`: Run expr2 after expr1 finished (no matter how) - + Every program returns an exit status (number) to the shell, zero being a successful closing, and all others indicating failure. - -&&/font &&/slide + + `expr1 ; expr2`: Run expr2 after expr1 (sequential execution) +&&/font &&/clide &&clide &&font27 @@ -855,7 +853,7 @@ Most modern shells support a lot of the more defying features of the [Bourne She cat <<< "Hello World!" ``` - + Standard input, standard output and standard error are all files with which the shell works. + + **Standard input**, **standard output** and **standard error** are all **files** with which the shell works. Typing text in the shell puts it into stdin, command output are put into stdout (and shown to the user) and errors are put into stderr (also shown to the user). Each one of them is numbered from 0 to 2, and you can specify redirection by appending or prepending it to the redirection symbol. * `N>outputfile`: redirects the output from standard stream N into outputfile @@ -892,10 +890,9 @@ Most modern shells support a lot of the more defying features of the [Bourne She &&slide -- [scripting support](https://en.wikipedia.org/wiki/Shell_script): Rather than running a series of commands manually, you can put them all in a file and run that +- [scripting support](https://en.wikipedia.org/wiki/Shell_script): Running commands from top to bottom of a file + `#`: Everything between a # and the end of the line denotes a comment + `#!`: If on the first line of the file, is treated as a [shebang](https://en.wikipedia.org/wiki/Shebang_%28Unix%29), which specifies what interpreter to be used for the script - + Each command (line) is executed in series, from top to bottom - compound commands: Shells also often offer more advanced structured, with which to more easily write complex expressions -- cgit v1.3.1-26-gb76a From 40f158b5e653503bdc9ba8d2d1bb4c355545e583 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 20:42:58 +0200 Subject: [talks/lbs] Added compound commands section to shell slides --- src/talks/linuxgraphy-by-strabo/index.md | 43 +++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 10b2aea..7342ebf 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -894,7 +894,19 @@ Most modern shells support a lot of the more defying features of the [Bourne She + `#`: Everything between a # and the end of the line denotes a comment + `#!`: If on the first line of the file, is treated as a [shebang](https://en.wikipedia.org/wiki/Shebang_%28Unix%29), which specifies what interpreter to be used for the script -- compound commands: Shells also often offer more advanced structured, with which to more easily write complex expressions +- compound commands: Structures for flow control + In all examples, `test-command` is any command (or combination with control operators), and logic is based on exit code. + + + conditional + + ``` + if test-command ; then commands-if-true + elif test-command ; then commands-if-true + else commands-if-true + fi + ``` + + elif statements can appear multiple times, both elif and else are optional &&/slide @@ -902,9 +914,34 @@ Most modern shells support a lot of the more defying features of the [Bourne She &&slide -## 3.2. Files and directories +-   + &&lineb1 -&&lineb1 + ``` + case word in (pattern | ...) commands-if-true ;; ... esac + ``` + + Where the beginning brace can be ommited. + Patterns are according to [bash's pattern matching](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Pattern-Matching) + + + loops + + ``` + while test-command; do commands-if-true; done + ``` + + ``` + for name in words...; do commands-if-true; done + ``` + If `in words...` is ommited, positional arguments are used + +&&/slide + + + +&&slide + +## 3.2. Files and directories - `/bin`: main command programs (binaries), used by users - `/etc`: system configuration files -- cgit v1.3.1-26-gb76a From e69db3a30fc1a7a30389d042a9ae4248802e2517 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 20:43:11 +0200 Subject: [talks/lbs] Added license links --- src/talks/linuxgraphy-by-strabo/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 7342ebf..58553f2 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -1102,9 +1102,9 @@ An open license is a license which allows others to reuse the original work, und For software, such a license is applied to the source code from which the original application was made. Some commonly used ones, with a (NON-LEGALLY BINDING) summary include: -- MIT: the author is not responsible for anything that the code does -- BSD-3-Clause: use the same license (copyleft), the author is not responsible for anything that the code does -- GNU GPL: disclose the original project and use the same license (copyleft) +- [MIT](https://en.wikipedia.org/wiki/MIT_License): the author is not responsible for anything that the code does +- [BSD-3-Clause](https://en.wikipedia.org/wiki/BSD_licenses): use the same license (copyleft), the author is not responsible for anything that the code does +- [GNU GPL](https://en.wikipedia.org/wiki/GNU_General_Public_License): disclose the original project and use the same license ([copyleft](https://en.wikipedia.org/wiki/Copyleft)) This is important, since pretty much everything can be freely modified by anyone (for the better or worse, but generally better). -- cgit v1.3.1-26-gb76a From 2c72ebba73e1479cd1a01ddbc42aa9a544441b45 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 20:43:35 +0200 Subject: [talks/lbs] Demo will now include virtual machine setup --- src/talks/linuxgraphy-by-strabo/index.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 58553f2..543c1f7 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -68,8 +68,8 @@ Today, I'll lay out Linux as it is known to me. 2. Package manager 3. Desktop manager 6. War on distros -&&lineb5 -7. Demo - setup from zero +&&lineb4 +7. Demos - virtual machine and setup from zero &&/cont &&/table @@ -1219,11 +1219,11 @@ Two more uncommon ones are: &&slide &&font35 -# 7. Demo - setup from zero +# 7. Demos - virtual machine and setup from zero -&&lineb3 +&&lineb2 -Now for the best part: we'll be installing a Linux distribution from a laptop running Windows 10! +Now for the best part: we'll be installing a Linux distribution on a virtual machine and then directly on a laptop, running Windows 10! I've chosen to install [Linux Mint](https://linuxmint.com/), since it is generally targeted towards newcomers and will feel familiar enough to Windows users. -- cgit v1.3.1-26-gb76a From 4948ffb74147c88f4c377a493b56300f8fc9bd32 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Feb 2023 20:48:31 +0200 Subject: [talks/lbs] Added sources for pseudoterminals and manuals --- src/talks/linuxgraphy-by-strabo/index.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 543c1f7..a3a5fd3 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -1252,12 +1252,15 @@ They served as personal educational and reference tools. - [CS416 - Operating Systems Design](https://people.cs.rutgers.edu/~pxk/416/index.html) by [Paul Krzyzanowski](https://people.cs.rutgers.edu/~pxk/rutgers/) at [Rutgers State University](https://www.cs.rutgers.edu/) - [Origins and History of UNIX, 1969-1995](https://web.archive.org/web/20220713165958/https://homepage.cs.uri.edu/~thenry/resources/unix_art/ch02s01.html) from [The Art of Unix Programming](https://web.archive.org/web/20220611160552/https://homepage.cs.uri.edu/~thenry/resources/unix_art/index.html) by Eric Steven Raymond - [Ken Thompson interviewed by Brian Kernighan at VCF East 2019](https://www.youtube.com/watch?v=EY6q5dv_B-o) by [Vintage Computer Federation](https://vcfed.org/) +- [Pseudo Terminals presentation](http://www.cs.uah.edu/~kkeen/CS590/Pseudo%20Terminals.ppt) from [CS590](http://www.cs.uah.edu/~kkeen/CS590/) by [Kevin J. Keen](http://www.cs.uah.edu/~kkeen/kkeen.html) at [University of Alabama in Huntsville](https://www.uah.edu/) - [Hard links and Unix file system nodes](https://teaching.idallen.com/dat2330/04f/notes/links_and_inodes.html) from [DAT 2330 Introduction to Operating Systems](https://teaching.idallen.com/dat2330/04f/) by [Ian D. Allen](http://www.idallen.com/) - [Virtual Memory, OS Course Notes](https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/9_VirtualMemory.html) by [Dr. John T. Bell](https://www.cs.uic.edu/~jbell/) at [University of Illinois Chicago](https://www.cs.uic.edu), which is directly based on [Operating System Concepts, 9th Edition](https://archive.org/details/operating-system-concepts-9e) by [Abraham Silberschatz](https://codex.cs.yale.edu/avi/) - [Chapter 9 Preview - Virtual Memory](http://csapp.cs.cmu.edu/3e/home.html) from [Computer Systems: A Programmer's Perspective](http://csapp.cs.cmu.edu/) by [Randal E. Bryant](http://www.cs.cmu.edu/~bryant) and [David R. O'Hallaron](http://www.cs.cmu.edu/~droh) - [Memory Management, Lecture Notes](https://www.cse.iitb.ac.in/~mythili/teaching/cs347_autumn2016/notes/07-memory.pdf) by [Mythili Vutukuru](https://www.cse.iitb.ac.in/~mythili/) - [Paging advantages and disadvantages](http://www.cs.iit.edu/~cs561/cs351/VM/paging%20advantages%20and%20disadvantages.html) by Charles R. Bauer at [Computer Science Departmemnt of Illinois Institute of Technology](http://www.cs.iit.edu/) +- [Bash Reference Manual](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html) by the [GNU project](https://www.gnu.org/) and [ksh manual](https://man.openbsd.org/ksh) by the [OpenBSD project](https://www.openbsd.org/) +- [Manual of the Bourne Shell on Version 7](https://www.in-ulm.de/~mascheck/bourne/v7/), archived by [Sven Mascheck](https://www.in-ulm.de/~mascheck/) - [/usr hierarchy](https://www.linuxbase.org/betaspecs/fhs/fhs/ch04.html) from [Filesystem Hierarchy Standard](https://www.linuxbase.org/betaspecs/fhs/fhs/index.html) by [Linux Foundation](https://www.linuxfoundation.org/), Daniel Quinlan, Paul 'Rusty' Russell, Christopher Yeoh - [User & Group Names](https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/usernames.html#FTN.AEN26405) from [Linux Standard Base Core Specification](https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/book1.html) by [Free Standards Group](https://en.wikipedia.org/wiki/Free_Standards_Group) - [Managing User Accounts](https://docstore.mik.ua/orelly/linux/run/ch05_07.htm) from [Running Linux, Third Edition](https://docstore.mik.ua/orelly/linux/run/index.htm) by Matt Welsh, Matthias Kalle Dalheimer, and Lar Kaufman -- cgit v1.3.1-26-gb76a From fd34fa6d767a6461344682d4fc3f288ef64922d0 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 27 Feb 2023 10:10:39 +0200 Subject: [talks/lbs] Updated information and command on following at home slide --- src/talks/linuxgraphy-by-strabo/index.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index a3a5fd3..5ef6f99 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -643,12 +643,13 @@ Owing to it's size, not everything we need comes out of the box, so I created [a If you want to try it out yourself, after booting up Minimal Linux Live, type out and run: ``` -wget -q https://syndamia.com/talks/linuxgraphy-by-strabo/mll-set.sh && chmod +x mll-set.sh && ./mll-set.sh +wget -q http://unsecure.syndamia.com/mll-set.sh && chmod +x mll-set.sh && ./mll-set.sh ``` -If you get the message `TLS certificate validation not implemented`, ignore it. +You might've noticed that the command above doesn't use the normal [https://syndamia.com/talks/linuxgraphy-by-strabo/mll-set.sh](./mll-set.sh) link. +That is because, out of the box, MLL doesn't really support secure connections (https), so I've made only that file available without it. -In summary, it installs bash, coreutils and shadow "packages" (from [http://s.minos.io/archive/bifrost/x86\_64](http://s.minos.io/archive/bifrost/x86_64)) to /usr/local/bin, creates /etc/passwd, /etc/bashrc and /etc/profile with some values in them and starts bash. +The script, in summary, installs bash, coreutils and shadow "packages" (from [http://s.minos.io/archive/bifrost/x86\_64](http://s.minos.io/archive/bifrost/x86_64)) to /usr/local/bin, creates /etc/passwd, /etc/bashrc and /etc/profile with some values in them and starts bash. &&/font &&/clide -- cgit v1.3.1-26-gb76a From 727e8ebaee7400c080f5fa0e553b55817cba3d42 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 27 Feb 2023 10:53:21 +0200 Subject: [talks/lbs] Reworked files and directories slides, added some examples for files in /etc --- src/talks/linuxgraphy-by-strabo/index.md | 162 ++++++++++++++++++------------- 1 file changed, 97 insertions(+), 65 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 5ef6f99..b944584 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -940,44 +940,41 @@ Most modern shells support a lot of the more defying features of the [Bourne She -&&slide +&&clide &&font35 ## 3.2. Files and directories +- `/dev`: devices +- `/proc`: process information + +&&lineb3 + - `/bin`: main command programs (binaries), used by users -- `/etc`: system configuration files - `/sbin`: command programs, used for the system operation - `/usr`: other system resources + `/usr/bin`: all other user command binaries - + `/usr/lib`: library files - + `/usr/local`: local, system software - + `/usr/share`: architecture independent data, like manuals -- `/var`: variable data, like logs and cache -- `/dev`: devices -- `/home`: home directories of all users -- `/lib`: libraries and kernel modules -- `/mnt`: mounted temporary filesystems -- `/proc`: process information -- `/root`: home directory for the root user -&&/slide +&&/font &&/clide &&slide -### General file system commands +#### Everyday file system commands - `mkdir`: create directories - `rm`: remove a (hardlink to) file or directory -- `shred`: overwrite file contents - `mv`: move file (or directory) to another directory - `cp`: copy a file - `ln`: create hard (or soft, with `-s`) links to files (inodes) - `ls`: list directory contents + +#### Other useful file system commands + +- `shred`: overwrite file contents - `dd`: do many things with files, like modifying and duplicating data across devices and partitions, (basic) data recovery and generating files - `du`: estimate file usage -- `stat`: display status for file system or file system +- `stat`: display status for file or file system - `chwon`: change owner of an inode - `chgrp`: change group of an inode - `chmod`: change file modes @@ -989,17 +986,20 @@ Most modern shells support a lot of the more defying features of the [Bourne She &&slide -### Working with text (files) +#### Everyday text (file) commands - `echo`: prints a given string to standard output - `cat`: sequentially prints files to standard output - `less`: view files with support for scrolling -- `grep`: searches for matches in a file, using simplified regular expressions. Often there is `egrep`, which allows for extended regex and `fgrep` where strings are matched as-is. +- `head`: print the first lines (or characters) of a file +- `tail`: print the last lines (or characters) of a file + +#### Other useful text (file) commands + +- `grep`: searches for matches in a file, using simplified regular expressions. `egrep` for extended regex and `fgrep` for string match (as-is). - `sed`: filter and transform text from files, according to regex - `tr`: translate, map (more than one to one for example) and delete characters - `cut`: remove parts of text from each line -- `head`: print the first lines (or characters) of a file -- `tail`: print the last lines (or characters) of a file - `strings`: find embedded text inside binary files - `truncate`: shrink or extend the size of a file - `wc`: count words inside file @@ -1009,87 +1009,119 @@ Most modern shells support a lot of the more defying features of the [Bourne She -&&slide +&&clide -### Working with devices +#### Device commands - `mount`: bind another file system to a location in the file system - `umount`: remove binding to a file system +- `lsusb`: lists USB devices +- `lspci`: lists PCI devices -&&/slide +#### System information commands +- `date`: display current date and time +- `hostname`: show (or set) the systems hostname (network name) +- `free`: display free memory on the system +&&/clide -&&slide -## 3.3 Common configuration files -&&lineb1 +&&slide -- `/etc/group`: the data for all groups is stored here, in the format +#### User and group management - ``` - GROUPNAME:PASSWORD:GID:USERS... - ``` +- `useradd`: creates a new user (with a password) +- `userdel`: remove a user and all of his files +- `usermod`: modify a user account, including his name and groups +- `passwd`: change password of a user. With `-l` user could be locked (impossible to log in) -- `/etc/passwd`: the data for all users is stored here, in the format +&&lineb1 - ``` - USERNAME:PASSWORD:UID:GID:USERINFO:HOMEDIR:SHELL - ``` +- `groupadd`: create a new group +- `groupdel`: remove a group +- `groupmod`: modify an existing group -- `/etc/shadow`: stores other user data, especially the password as an encrypted string, in the format +&&lineb1 - ``` - USERNAME:PASSWORD:LASTCHANGED:MINBETWEENCHANGES:MAXBETWEENCHANGES:WARNEXPIRE:INACTIVEDAYS:EXPIRE - ``` +- `w`: show who is logged in and what they are doing +- `who`: show who is logged in +- `whomai`: print username +- `login`: establish a new connection to the system &&/slide -&&clide +&&slide -- `/etc/fstab`: mountings of devices to the file system, read on boot by mount -- `/etc/hosts`: list of host names (domain names) and their corresponding IP address, when a DNS server doesn't do the job -- `/etc/bashrc`: global defaults and aliases used by the bash shell +- `/etc`: system configuration files + &&lineb2 -&&/clide + + `/etc/group`: the data for all groups is stored here, in the format + ``` + GROUPNAME:PASSWORD:GID:USERS... + ``` + + `/etc/passwd`: the data for all users is stored here, in the format -&&slide + ``` + USERNAME:PASSWORD:UID:GID:USERINFO:HOMEDIR:SHELL + ``` -## 3.4. System management + + `/etc/shadow`: stores other user data, especially the password as an encrypted string, in the format -- System information - + `date`: display current date and time - + `hostname`: show (or set) the systems hostname (network name) - + `free`: display free memory on the system + ``` + USERNAME:PASSWORD:LASTCHANGED:MINBETWEENCHANGES:MAXBETWEENCHANGES:WARNEXPIRE:INACTIVEDAYS:EXPIRE + ``` &&/slide -&&clide +&&slide &&font27 -- Users and groups - + `useradd`: creates a new user (with a password) - + `userdel`: remove a user and all of his files - + `usermod`: modify a user account, including his name and groups - + `passwd`: change password of a user. With `-l` user could be locked (impossible to log in) - &&lineb1 - + `groupadd`: create a new group - + `groupdel`: remove a group - + `groupmod`: modify an existing group - &&lineb1 - + `w`: show who is logged in and what they are doing - + `who`: show who is logged in - + `whomai`: print username - + `login`: establish a new connection to the system +-   + + `/etc/fstab`: read on boot by mount to setup devices in fs -&&/clide + ``` + # device-spec mount-point fs-type options dump pass + /dev/sda1 / ext4 defaults 1 1 + UUID=123A-456B /boot vfat noauto,noatime 1 2 + LABEL=Vault /mnt/Vault auto nosuid,nodev,nofail 0 0 + ``` + + + `/etc/hosts`: list of host names (domain names) and their corresponding IP address, when a DNS server doesn't do the job + + ``` + # ipaddress domains + 127.0.0.1 localhost mywebsite.com something.else + 62.44.101.138 my.uni + ``` + + + `/etc/bashrc`: global defaults and aliases used by the bash shell + + `/etc/motd`: message of the day (unexecuted text), shown after login but before the shell is ran + +&&/font &&/slide + + + +&&clide &&font35 + +- `/usr`: other system resources + + `/usr/lib`: library files + + `/usr/local`: local, system software + + `/usr/share`: architecture independent data, like manuals +- `/var`: variable data, like logs and cache +- `/home`: home directories of all users +- `/lib`: libraries and kernel modules +- `/mnt`: mounted temporary filesystems +- `/root`: home directory for the root user + +&&/font &&/clide -- cgit v1.3.1-26-gb76a From 80565bff2ab90e097b6e283f8fc5316797caf5b7 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 27 Feb 2023 11:29:17 +0200 Subject: [talks/lbs] Reworked useful OS slides --- src/talks/linuxgraphy-by-strabo/index.md | 102 +++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index b944584..7a56b69 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -1145,21 +1145,21 @@ This is important, since pretty much everything can be freely modified by anyone -&&slide +&&slide &&font35 # 5. What makes up a useful OS -We talked about the modularity of a Linux-based operating system. -Overall, these are the main elements that make up a desktop operating system you might want to use: +A Linux-based operating system is nothing more than the Linux kernel, combined with an assortment of programs. +Overall, the main elements that make up a useful *desktop* operating system (alongside a command-line shell) are: -&&lineb3 +&&lineb1 1. **Bootloader**: load the kernel and operating system 2. **Init system**: well managed way to start everything inside the OS 3. **Package manager**: way to manage our binaries 4. **Desktop manager**: graphical shell -&&/slide +&&/font &&/slide @@ -1167,46 +1167,84 @@ Overall, these are the main elements that make up a desktop operating system you ## 5.1. Bootloader -When a computer boots, it needs to start an operating system, but you can't expect it to know how to boot any operating system. -Skipping over the details, the computer starts a small program called the bootloader, which handles loading the OS. +The computer boot process is a relay race. -On Linux, the most used one is called [GRUB](https://en.wikipedia.org/wiki/GNU_GRUB). -With it you can also specify which kernel to load, with which parameters to load the kernel and which OS to start. +In a "standard" BIOS-MBR boot configuration: + +``` +BIOS -> Master Boot Record -> Active Parition -> Bootloader -> +-> Boot menu (optional) -> Kernel -> Everything else +``` + +- BIOS: a small chip with code that is ran upon power up +- MBR: small amount of space at the very start of the disk, that contains some (bootstrap) code and partition information. The BIOS hands off execution to the bootstrap code. +- Active partition: MBR loads and runs code from the beginning of the partition (boot sector), which starts the bootloader +- Bootloader: the first complex program, which manages kernels, shows a menu, allows for debugging and so on &&/slide -&&slide +&&clide -## 5.2. Init system +The BIOS is baked into the motherboard, the MBR is pretty universal (and it's less than 512 bytes) and the kernel we know and love. + +That leaves us with the need for a bootloader. +On Linux, the most used one is called [GRUB](https://en.wikipedia.org/wiki/GNU_GRUB). -In Minimal Linux Live, the whole system is started by some hard written scripts, this isn't very modular and extensible, that is why we need a special system. +It's config is found in `/etc/default/grub` (which is then fully generated with `grub-mkconfig`) and can be "installed in the partition" with `grub-install`. -Generally, the [init system](https://en.wikipedia.org/wiki/Init) loads a series of services, where each service is just a file that specifies what and how something needs to be ran. +``` +GRUB_DEFAULT=0 +GRUB_TIMEOUT=5 +GRUB_TIMEOUT_STYLE=menu +GRUB_CMDLINE_LINUX="" +GRUB_CMDLINE_LINUX_DEFAULT="" +GRUB_GFXMODE=640x480 +``` + +&&/clide -The most common init systems are + + +&&slide &&font27 + +## 5.2. Init system + +Now we need to load the user stuff, like a network manager, the graphical user interface and so on. +In Minimal Linux Live, this is done by some hard written scripts, which aren't very modular or extensible. + +[Init systems](https://en.wikipedia.org/wiki/Init) use configuration files, called service, to start a program in some way. - [systemd](https://en.wikipedia.org/wiki/Systemd), which also aims to also provide easy system configuration - [openrc](https://en.wikipedia.org/wiki/OpenRC), a simple and modern system -&&/slide +``` +[Unit] +Description=Service +[Service] +Type=simple +User=root +ExecStart=/usr/local/sbin/script.sh +[Install] +WantedBy=multi-user.target +``` +&&/font &&/slide -&&slide + +&&clide ## 5.3. Package manager Running a program is as simple as putting the executable in a nice folder, like `/usr/bin`. -However this process isn't very convenient if you're only using a shell and more tedious if using a graphical shell. - -The solution is to have all programs in one location, where you can download, install and potentially update a program with one simple command, just using the program's name. -Other good features include installing dependencies and checking if a package is tampered with. +However this process isn't very convenient if you're only using a shell and more tedious when using a graphical shell. -There is another "type" of package managers, those similar to `portage`, where packages are actually instructions on how to download and compile a specific version of the program. +The solution is to use a package manager, a single command with which you can download, install and update any program from a variety of (web) sources, just by specifying it's name. +Often a package manager supports installing dependencies and checking for package tampering. -&&/slide +&&/clide @@ -1217,11 +1255,13 @@ There is another "type" of package managers, those similar to `portage`, where p A widow system is your graphical shell: the graphical way to interact with your computer (the kernel). It's main components are: -- **Window manager**: the overall system with which you create, remove, resize, etc. windows. They are generally separated into two types: - + Stacked: this is what you know, a windows are just rectangles floating about, and can be put one over each other - + Tiled: windows take up a predefined (but changeable) portion of the screen -- **Compositor**: windows have an unseen buffer, allowing them to be be processed beforehand. This allows for adding transparency, animation effects and more. -- **Session manager**: application that manages the window managers, allowing to use different managers or for multiple users to start their own graphical sessions. +&&lineb1 + +- **Window manager**: the overall system with which you create, remove, resize and work with windows. They are generally separated into two types: + + *Stacked*: this is what you know, windows are just rectangles floating about, and can be put one over each other + + *Tiled*: windows take up a predefined (but changeable) portion of the screen +- **Compositor**: adds an unseen window buffer, allowing additional processing, before a window is shown. This powers transparency, animation effects and more. +- **Session manager**: graphical application that manages the window managers (outside WMs), think of it as a login window &&/slide @@ -1235,10 +1275,10 @@ A distribution is a complete set of of all applications that we've talked so far Overall, there are five distributions from which 90% of all other distros are based upon: -1. Slackware: as the oldest still maintained distro, it served as inspiration for a lot of other distros. It aims to be as simple and as close to UNIX as possible. -2. Debian (and Ubuntu): it is the most popular distribution (if we also include Ubuntu, since they're so similar). Ubuntu aims to be modern and fancy, while Debian aims to be as stable as possible, which makes it the most popular in server usage. -4. Gentoo: the distribution which defined non-binary software distribution -5. Arch Linux: a very popular and modern distribution with the goal of providing the latest and greatest software. +1. [Slackware](http://www.slackware.com/): as the oldest still maintained distro, it served as inspiration for a lot of other distros. It aims to be as simple and as close to UNIX as possible. +2. [Debian](https://www.debian.org/) (and [Ubuntu](https://ubuntu.com/)): it is the most popular distribution (if we also include Ubuntu, since they're so similar). Ubuntu aims to be modern and fancy, while Debian aims to be as stable as possible, which makes it the most popular in server usage. +4. [Gentoo](https://www.gentoo.org/): the distribution which defined non-binary software distribution +5. [Arch Linux](https://archlinux.org/): a very popular and modern distribution with the goal of providing the latest and greatest software. We haven't touched too much, but Linux distributions aren't limited to desktop or server computers. Two more uncommon ones are: -- cgit v1.3.1-26-gb76a From 481f849e7171f53966b2fb03d163951c4414aa59 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 27 Feb 2023 11:30:51 +0200 Subject: [talks/lbs] Added MBR source --- src/talks/linuxgraphy-by-strabo/index.md | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 7a56b69..bcf578f 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -1337,6 +1337,7 @@ They served as personal educational and reference tools. - [/usr hierarchy](https://www.linuxbase.org/betaspecs/fhs/fhs/ch04.html) from [Filesystem Hierarchy Standard](https://www.linuxbase.org/betaspecs/fhs/fhs/index.html) by [Linux Foundation](https://www.linuxfoundation.org/), Daniel Quinlan, Paul 'Rusty' Russell, Christopher Yeoh - [User & Group Names](https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/usernames.html#FTN.AEN26405) from [Linux Standard Base Core Specification](https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/book1.html) by [Free Standards Group](https://en.wikipedia.org/wiki/Free_Standards_Group) - [Managing User Accounts](https://docstore.mik.ua/orelly/linux/run/ch05_07.htm) from [Running Linux, Third Edition](https://docstore.mik.ua/orelly/linux/run/index.htm) by Matt Welsh, Matthias Kalle Dalheimer, and Lar Kaufman +- [The BIOS/MBR Boot Process](https://neosmart.net/wiki/mbr-boot-process/) by [NeoSmart's Knowledgebase](https://wiki.neosmart.net/) # Licensing -- cgit v1.3.1-26-gb76a From 726f11de956cb0b3137aa8f9663b0accfc55126b Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 27 Feb 2023 18:25:04 +0200 Subject: [talks/lbs] Finished package manager and war on distros slides --- src/talks/linuxgraphy-by-strabo/index.md | 52 ++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index bcf578f..a414952 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -1234,17 +1234,46 @@ WantedBy=multi-user.target -&&clide +&&slide ## 5.3. Package manager -Running a program is as simple as putting the executable in a nice folder, like `/usr/bin`. -However this process isn't very convenient if you're only using a shell and more tedious when using a graphical shell. +&&lineb1 + +Programs are just executable files, usually placed in a specific folder, like `/usr/bin`. -The solution is to use a package manager, a single command with which you can download, install and update any program from a variety of (web) sources, just by specifying it's name. -Often a package manager supports installing dependencies and checking for package tampering. +- MLL comes with ~100 executables (and ~230 after my script) +- my Debian server has ~1000 installed packages +- my current desktop Gentoo setup has ~1500 installed packages +- my old Fedora setups have reached ~3000 packages on multiple occasions -&&/clide +Updating all of them means replacing all of the binaries, means tracking where each one came from, installing a new one might require installing multiple others and so on. + +On modern systems, managing binaries is automated by an application called a package manager. + +&&/slide + + + +&&clide &&font35 + +Additional benefits of package management automation include: + +- checking for package validity (and tampering) +- utilising multiple server mirrors +- automatic dependency management and installation +- version caveats +- (indirectly) improved stability because of maintainer compatibility checks + +&&lineb1 + +``` +apt install PKG +apt remove PKG +apt upgrade +``` + +&&/font &&/clide @@ -1271,20 +1300,19 @@ It's main components are: # 6. War on distros -A distribution is a complete set of of all applications that we've talked so far. +A distribution is a complete set of of all applications that you might use. Overall, there are five distributions from which 90% of all other distros are based upon: 1. [Slackware](http://www.slackware.com/): as the oldest still maintained distro, it served as inspiration for a lot of other distros. It aims to be as simple and as close to UNIX as possible. -2. [Debian](https://www.debian.org/) (and [Ubuntu](https://ubuntu.com/)): it is the most popular distribution (if we also include Ubuntu, since they're so similar). Ubuntu aims to be modern and fancy, while Debian aims to be as stable as possible, which makes it the most popular in server usage. +2. [Debian](https://www.debian.org/) (and [Ubuntu](https://ubuntu.com/)): it is the most popular distribution (if we also include Ubuntu). Ubuntu aims to be modern and fancy, while Debian aims to be as stable as possible, which makes it the most popular in server usage. 4. [Gentoo](https://www.gentoo.org/): the distribution which defined non-binary software distribution 5. [Arch Linux](https://archlinux.org/): a very popular and modern distribution with the goal of providing the latest and greatest software. We haven't touched too much, but Linux distributions aren't limited to desktop or server computers. -Two more uncommon ones are: -1. AOSP: the base of the whole Android operating system -2. OpenWRT: a router operating system +1. [AOSP](https://en.wikipedia.org/wiki/Android_%28operating_system%29#AOSP): the base of the whole Android operating system +2. [OpenWRT](https://en.wikipedia.org/wiki/OpenWrt): a router operating system &&/font &&/slide @@ -1321,7 +1349,7 @@ Currently there won't be an official recording of the process, you should've bee All of these contain, at most, small paraphrased sentences in the slides. They served as personal educational and reference tools. -- [wikipedia](https://en.wikipedia.org/) and [stackexchange](https://stackexchange.com/) has been used extensively and linked where appropriate. +- [wikipedia](https://en.wikipedia.org/) and [stackexchange](https://stackexchange.com/) have been used extensively and linked where appropriate. - [CS416 - Operating Systems Design](https://people.cs.rutgers.edu/~pxk/416/index.html) by [Paul Krzyzanowski](https://people.cs.rutgers.edu/~pxk/rutgers/) at [Rutgers State University](https://www.cs.rutgers.edu/) - [Origins and History of UNIX, 1969-1995](https://web.archive.org/web/20220713165958/https://homepage.cs.uri.edu/~thenry/resources/unix_art/ch02s01.html) from [The Art of Unix Programming](https://web.archive.org/web/20220611160552/https://homepage.cs.uri.edu/~thenry/resources/unix_art/index.html) by Eric Steven Raymond - [Ken Thompson interviewed by Brian Kernighan at VCF East 2019](https://www.youtube.com/watch?v=EY6q5dv_B-o) by [Vintage Computer Federation](https://vcfed.org/) -- cgit v1.3.1-26-gb76a From b5beb795727e80a99e109045d4dc6d173ec71866 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 27 Feb 2023 18:26:59 +0200 Subject: [talks/lbs] Added links to bootloader list --- src/talks/linuxgraphy-by-strabo/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index a414952..1442c3a 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -1176,10 +1176,10 @@ BIOS -> Master Boot Record -> Active Parition -> Bootloader -> -> Boot menu (optional) -> Kernel -> Everything else ``` -- BIOS: a small chip with code that is ran upon power up -- MBR: small amount of space at the very start of the disk, that contains some (bootstrap) code and partition information. The BIOS hands off execution to the bootstrap code. +- [BIOS](https://en.wikipedia.org/wiki/BIOS): a small chip with code that is ran upon power up +- [MBR](https://en.wikipedia.org/wiki/Master_boot_record): small amount of space at the very start of the disk, that contains some (bootstrap) code and partition information. The BIOS hands off execution to the bootstrap code. - Active partition: MBR loads and runs code from the beginning of the partition (boot sector), which starts the bootloader -- Bootloader: the first complex program, which manages kernels, shows a menu, allows for debugging and so on +- [Bootloader](https://en.wikipedia.org/wiki/Bootloader): the first complex program, which manages kernels, shows a menu, allows for debugging and so on &&/slide -- cgit v1.3.1-26-gb76a From 764e6650a754b9258faabc6cdab47b0923651cca Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 27 Feb 2023 19:24:18 +0200 Subject: [talks/lbs] Fixed grammar mistakes and typos --- src/talks/linuxgraphy-by-strabo/index.md | 38 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/talks/linuxgraphy-by-strabo/index.md b/src/talks/linuxgraphy-by-strabo/index.md index 1442c3a..2ad6638 100644 --- a/src/talks/linuxgraphy-by-strabo/index.md +++ b/src/talks/linuxgraphy-by-strabo/index.md @@ -150,7 +150,7 @@ Some of it's novel ideas include, but are not limited to: #### 1969: Death of Multics and birth of UNIX -Ultimately Multics grew too large, becaming unusable and unmaintainable. +Ultimately Multics grew too large, becoming unusable and unmaintainable. In the beginning, programming was done mostly by [Bell Labs](https://en.wikipedia.org/wiki/Bell_Labs), with [Ken Thompson](https://en.wikipedia.org/wiki/Ken_Thompson) being one of the developers. &&lineb1 &&ftable @@ -220,7 +220,7 @@ While on the topic of UNIX, we'll only discuss the former. ### Command-line shells -Command-line shells operate solely with text, usually with only ASCII characters. +Command-line shells operate solely with text, often only with ASCII characters. Usually connecting to a computer (to the shell) is said to be done with either a "terminal" ("console") or "teleprinter" ("teletype"). &&table @@ -271,9 +271,9 @@ Today we don't usually use such specialised hardware, but the names persist with Most commands are regular programs, which exist somewhere on the system. When entering a command name, the shell searches for an executable with that name. -Searching the whole drive is very inneficient, so the search is limited to the few directories, listed in a variable called "PATH". +Searching the whole drive is very inefficient, so the search is limited to the few directories, listed in a variable called "PATH". -You can give a full or relative path, and that will be execute directly. +You can give a full or relative path, and that will be executed directly. Each command can be given parameters, separated by spaces, each (by convention) being either text values or options (switches). @@ -302,7 +302,7 @@ The two major features that every other shell supports are: - pipelines: being able to redirect the output from one command to another without limit ``` - command1 [args...] | command 2 [args...] | ... + command1 [args...] | command2 [args...] | ... ``` &&/clide @@ -332,7 +332,7 @@ The two major features that every other shell supports are: &&lineb1 + **regular**: just a plain old file + **directory**: as explained, a file containing hard links to other files. Each directory is allowed to appear *only once* in a single parent. - + **symbolic link**: points to any file (or directory). It contains the (relative) path to that object (as a simple string), so a symlink could even not be valid. + + **symbolic link**: points to any file (or directory). It contains the (relative) path to that object (as a simple string), so a symlink not could even be valid. Think of a C++ pointer (pseudocode). ``` @@ -373,7 +373,7 @@ The two major features that every other shell supports are: &&clide - + **sockets**: file for inter-process communication. Compared to FIFO specials, they can be used by more than two processes, used in both direction and support [file descriptors](https://en.wikipedia.org/wiki/File_descriptor) and packets + + **sockets**: file for inter-process communication. Compared to FIFO specials, they can be used by more than two processes, used in both directions and support [file descriptors](https://en.wikipedia.org/wiki/File_descriptor) and packets ``` [Process A] <--read&write--> [Socket 1] @@ -414,7 +414,7 @@ Every user has their own "home" folder (under "/home/USERNAME/", except for root Each is represented by a bit in the order above (`101` means you *can* read, *cannot* write, *can* execute) and the overall permissions are often shown as a three digit number or character string. Example: `111101100` will be shown as `754` or `rwxr-xr--` -- link count: the amount of hard links that point to the inode. Every directory inode contains (normally) exactly two: one from the parent and one from itself ("."), though the latter isn't added to the count*^[citation ^needed]* . A file is only deleted where there are no hard links left to it. +- link count: the count of hard links that point to the inode. A file is deleted **only when there are no hard links left to it**. Every directory inode has at least two - one from parent and one from itself ("."), though the latter **isn't** counted. Child and parent directories also **add** to the count. - User ID of owner, Group ID, file size and timestamps @@ -452,7 +452,7 @@ Two of the important things a kernel does is manage **processes** and **memory** &&lineb1 -A program is some collection of code and other data, stored in a file (or uncompiled code). +A program is some collection of code and other data, stored in a file (or noncompiled code). A process is the program in motion, the program itself *alongside* certain system states. The system states include (but are not limited to): @@ -489,7 +489,7 @@ A PCB's data can be split into three categories: 1. **Process identification** - the ID of the process itself, of it's parent process, of it's owner (user), etc. 2. **Process state** - as described, the processor state, etc. - On a context switch, values in register are put into the stopped PCB and then are loaded from the running PCB. + On a context switch, values in registers are put into the stopped PCB and then are loaded from the running PCB. 3. **Process control information** - process state, memory map, privileges, etc. A process can be **forked**, meaning a new process is created, with the same underlying code (but not process states and ...). @@ -553,9 +553,9 @@ Some bad ideas include: depending on the code of all processes to not use the sa &&font18 *Image by [Ehamberg](https://commons.wikimedia.org/wiki/File:Virtual_memory.svg)* &&/font &&/fright -A process work with some (sequential) addresses, and the OS (with the help of [hardware](https://en.wikipedia.org/wiki/Memory_management_unit)) translates/maps the process' addresses (logical/[virtual addresses](https://en.wikipedia.org/wiki/Virtual_address_space)) to real ones (physical addresses). +A program (process) works with some (sequential) addresses, and the OS (with the help of [hardware](https://en.wikipedia.org/wiki/Memory_management_unit)) translates/maps the process' addresses (logical/[virtual addresses](https://en.wikipedia.org/wiki/Virtual_address_space)) to real ones (physical addresses). -We simplify memory management for the program, protects each process' address space and is very flexible. +Simplified memory management for the program, protected address space for each process and improved flexibility. &&/font &&/slide @@ -583,7 +583,7 @@ In the modern day, segmentation isn't used by itself, since resizing segments co &&lineb3 -The virtual and physical memory is divided into fixed-sized chunks of consequtive addresses. +The virtual and physical memory is divided into fixed-sized chunks of consecutive addresses. A virtual memory chunk is called a **page**, while a physical memory chunk is called a (page) **frame**. Usually both have the same size of (at least) 4 KiB. @@ -619,7 +619,7 @@ Disadvantages include: Enough theory, time to have some fun and learn Linux! -We'll be using [Linux Minimal Live](https://ivandavidov.github.io/minimal/#home) (just a bootable ISO) because: +We'll be using [Linux Minimal Live](https://ivandavidov.github.io/minimal/#home) (just a bootable ISO) because it's: - very small, comprised of only the Linux kernel, GNU C library and Busybox - made by a fellow Bulgarian &&bg @@ -685,13 +685,13 @@ Where `name` is either a combination of letters (upper and lower case), numbers Some of the [special parameters](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Special-Parameters) are: -- `0`, correspoinding to the shell's or script's name, +- `0`, corresponding to the shell's or script's name, - `@` is all positional parameters, separated by spaces - `#` is the number of positional parameters - `?` is the last executed (foreground) process - `$` is process ID of the current shell. -`value`, without any special surounding characters (more on that later), is treated as a string (but it mustn't have spaces!), however it may also be omitted, in which case it is the empty string `""`. +`value`, without any special surrounding characters (more on that later), is treated as a string (but it mustn't have spaces!), however it may also be omitted, in which case it is the empty string `""`. &&/font &&/slide @@ -701,7 +701,7 @@ Some of the [special parameters](https://www.gnu.org/savannah-checkouts/gnu/bash #### Data types -In most shells, there are 3 data types: strings, integers and (one-dimentional) indexed arrays. +In most shells, there are 3 data types: strings, integers and (one-dimensional) indexed arrays. [bash has more](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#index-declare), like references and associative arrays, but those aren't universal. A value is a **string** when surrounded by single `'` or double `"` quotes, @@ -750,7 +750,7 @@ Some parameter expansions in bash: - `${#parameter}` length of characters - `${parameter:offset}` and `${parameter:offset:length}` return substring from index offset - `${parameter/pattern/string}` return a string, where every match on pattern is replaced by string -- `${!name[@]}` a (space separated) sequence of indecies from 0 to length (for defined values) of array name +- `${!name[@]}` a (space separated) sequence of indices from 0 to length (for defined values) of array name &&/slide @@ -772,7 +772,7 @@ Some useful expressions are: - `!`, `&&`, `||` logical not, and, or - `expr ? exprTrue : exprFalse` conditional - `=`, `+=`, ..., `<<=`, ... assignment operators -- `expr1 , expr2` consequtive expressions and `(expr)` bracing +- `expr1 , expr2` consecutive expressions and `(expr)` bracing Expressions work with both variable names and integers. -- cgit v1.3.1-26-gb76a