﻿# Computer Systems

> The practice half of Computer Systems: working in a Unix shell, processes and signals, filters and pipes, then shell scripts – variables, conditions, loops, functions, regular expressions and text processing.

Source: https://laszlonemes.com/university/computer-systems · Author: László Nemes

Számítógépes rendszerek

In the practical sessions we work on a Linux server over SSH. We start with the shell as a tool you type into, and end with shell scripts that solve real text-processing tasks.

Every session has the ideas first, then tasks. The hints show the approach and the few lines that matter, not complete solutions – write the script yourself, that is what the tests check.

`Linux` `Bash` `Shell scripting` `Regular expressions` `PowerShell`

## Requirements

What it takes to complete the practice part. Dates and deadlines are on Canvas.

Theory

**Two theory tests, 10 + 10 points**

Ten questions each on Canvas, during the lecture: one mid-semester, one in the penultimate lecture.

Practical tests

**Unix shell and PowerShell, 20 + 20 points**

Tasks solved with shell commands and scripts. At least 50% is needed on each test.

Assignments

**A shell script and a PowerShell script**

Late submission: −5 points up to one week, −10 points up to two weeks; more than two weeks late fails the course.

Grading

**60 points in total**

0–29: fail (1) · 30–37: pass (2) · 38–45: satisfactory (3) · 46–53: good (4) · 54–60: excellent (5)

Course server

**ssh <neptun-code>@szamrend.inf.elte.hu**

Your Neptun code in lowercase, with your faculty (IIG) password. If you cannot create files, see the disk quota guide below.

## Sessions

Open a session here, or on its own page in a new tab.

- Session 1
  
  **[Unix basics: logging in, files and permissions](https://laszlonemes.com/university/computer-systems/unix-basics)**
  
  Logging in to the course server over SSH, finding your way in the file system with absolute and relative paths, and creating, editing (in vim), copying and deleting files. Ends with permission bits – rwx for user, group and others, in letters and in octal.
- Session 2
  
  **[Processes, signals and filters](https://laszlonemes.com/university/computer-systems/processes-filters)**
  
  Every command becomes a process: find it with ps, move it between foreground and background, end it with the right signal and catch signals with trap. Then filters and pipes – find, grep, sort, tr and wc chained into one-liners.
- Session 3
  
  **[Shell scripts: variables, conditions, loops and regular expressions](https://laszlonemes.com/university/computer-systems/shell-scripts)**
  
  How a bash script is built and run: variables and quoting, arguments, if and the test command, loops, functions, regular expressions and redirection. Ends with a robust script skeleton – check the input, send errors to stderr, exit with a non-zero code.
- Session 4
  
  **[Shell scripting in practice: input, errors, case and pipelines](https://laszlonemes.com/university/computer-systems/shell-practice)**
  
  The pieces of a shell script put together: checking input and failing with stderr and exit codes, case for options and menus, and the cut | sort | uniq -c pipeline. Nine tasks build up from a safe file copy to an interactive menu, solved with filters and with while-read loops.
- Session 5
  
  **[Reading and writing files; line endings](https://laszlonemes.com/university/computer-systems/files-line-endings)**
  
  Redirections, reading a file line by line, and the three things real files break: no newline after the last line, extra empty lines and Windows CRLF line endings – how to see them with cat -et and the one loop pattern that handles them all.
- Session 6
  
  **[Text processing and a key–value store](https://laszlonemes.com/university/computer-systems/text-processing)**
  
  A practice block for the practical test: anchored regular expressions, glob tests, string slicing, tr and sed, arrays – and associative arrays for counting per key, with a worked example on messy data.
- Session 7
  
  **[Practice tasks: from input to output file](https://laszlonemes.com/university/computer-systems/practice-tasks)**
  
  Six tasks in the style of the practical test, from reading a number to finding the most frequent visitor in a CSV-like file, each with a hint and an expected result.

## Guides

Stand-alone pages: references, background reading and fixes for common problems.

- Reading
  
  **[How a computer starts; processes and threads](https://laszlonemes.com/university/computer-systems/boot-processes-threads)**
  
  The boot relay from firmware to your shell, where PID 1 fits in, what a process owns, how fork, copy-on-write and exec run every command you type, and what threads share.
- Troubleshooting
  
  **[Disk quota full on the course server](https://laszlonemes.com/university/computer-systems/disk-quota)**
  
  Cannot save or create files on the server? Check the quota, find the hidden directory that fills it – almost always ~/.cache – delete what is safe, and check again. Plus the fix for a failing graphical login on lab machines.
