83 lines
3.3 KiB
Markdown
83 lines
3.3 KiB
Markdown
# Operating Systems Lab — Module 1 Exercise List
|
|
|
|
## Getting Started
|
|
|
|
Follow these steps before attempting any of the exercises below.
|
|
|
|
### 1. Install Git (if not already installed)
|
|
|
|
```bash
|
|
sudo apt update && sudo apt install -y git
|
|
```
|
|
|
|
To verify the installation:
|
|
|
|
```bash
|
|
git --version
|
|
```
|
|
|
|
### 2. Clone the Repository
|
|
|
|
```bash
|
|
git clone https://gitea.frevinnoh.dev/frevinnoh/sisop_module1_exercise.git
|
|
```
|
|
|
|
### 2. Move into the Lab Directory
|
|
|
|
```bash
|
|
cd sisop_module1_exercise
|
|
```
|
|
|
|
### 3. Explore the Structure
|
|
|
|
Take a moment to look around before you start:
|
|
|
|
```bash
|
|
ls -la
|
|
```
|
|
|
|
You should see the following directories and files:
|
|
|
|
```
|
|
archive/
|
|
config/
|
|
data/
|
|
logs/
|
|
maze/
|
|
scripts/
|
|
README.md
|
|
```
|
|
|
|
### 4. Answer the Questions
|
|
|
|
Work through the exercises in the table below. Some questions require you to create new files or scripts — save them in the locations specified. **Do not delete or modify any provided files unless a question explicitly asks you to.**
|
|
|
|
---
|
|
|
|
## Exercise List
|
|
|
|
| # | Topic | Question |
|
|
|---|-------|----------|
|
|
| 1 | Navigation | Go to the `sisop_module1_playground` directory. List all files in `config/`, including hidden ones. |
|
|
| 2 | Permissions | Find the file `archive/locked.txt`. Change permissions so only the owner can read it. |
|
|
| 3 | Search | Find the line in `logs/app.log` containing `"ERROR"` and save it to `logs/error_only.txt`. |
|
|
| 4 | Count | How many files ending in `.tmp` exist in the `data/` directory? |
|
|
| 5 | Chaining | List all files in `data/` and sort them in reverse alphabetical order. |
|
|
| 6 | I/O Redirection | Create a file `info.txt` containing the current date and your username. |
|
|
| 7 | AWK | Print only the names (Column 2) of all users in `data/users.csv`. |
|
|
| 8 | AWK | In `data/users.csv`, find the total sum of salaries (Column 4). |
|
|
| 9 | AWK | Print the Name and Role of users who have a `"Status"` of `"Active"`. |
|
|
| 10 | Bash | Create a script `scripts/check_dir.sh` that checks if a directory provided as an argument exists. |
|
|
| 11 | Bash | Fix `scripts/hello.sh` so it correctly prints the current date (it currently prints the word `"date"`). |
|
|
| 12 | Bash | Write a loop in a script that creates 5 files named `test_1.txt` to `test_5.txt`. |
|
|
| 13 | Cron | Write a cron expression that runs `scripts/hello.sh` every day at 3:30 AM. |
|
|
| 14 | Cron | List all active cron jobs for the current user. |
|
|
| 15 | Wildcards | Delete all files in `data/` that have the extension `.bak`. |
|
|
| 16 | Disk Usage | Check the total size of the `sisop_module1_playground` directory in human-readable format. |
|
|
| 17 | AWK | In `data/users.csv`, print the name of the person with the highest salary. |
|
|
| 18 | Sed | Replace every occurrence of `"INFO"` with `"LOG"` in `logs/app.log` (output to a new file). |
|
|
| 19 | Processes | Find the Process ID (PID) of your current bash session. |
|
|
| 20 | Archiving | Create a compressed `.tar.gz` archive of the entire `logs/` directory. |
|
|
| 21 | Bash | Write a bash script that: (1) updates and upgrades the system using `apt`, (2) creates a directory called `new_image/` if it does not already exist, and (3) downloads an image from a given URL and saves it into the `new_image/` directory using `wget` or `curl`. |
|
|
| 22 | Search | Inside the `maze/` directory there is a deeply nested file called `secret.txt`. Use a single command to find its full path, then display its contents. |
|