View on GitHub

Computer Architecture and Operating Systems

Course taught at Faculty of Computer Science of Higher School of Economics

Lecture 1

Operating System Architecture. Linux

Lecture

Slides (PDF, PPTX).

Workshop

Outline

Practice

Before start
  1. Windows users need to download and install Git.
  2. Make sure that VirtualBox with Linux Ubuntu VM is installed and running.
  3. See reference on Git is available here.
Connecting to the running VM
  1. Run terminal in your host operating system (Git Bash for Windows).
  2. Execute the following command:
    ssh acos@localhost -p2022
    
  3. Use the password acos2020.
Linux utility programs and Bash

Unix-based systems (such as Linux and MacOS) provide utility programs to perform various systems tasks. These utilities are via command-line interface. Bash is command-line processor and language used to execute these command. Bash is supported in Linux and MacOS. In Windows, apratial support is implemented in Git Bash. Also, come of the commands are implemented in Terminal of JetBrains IDEs (PyCharm, IntelliJ IDEA, CLion, etc.).

Main Bash commands
  1. man - prints documentation on other commands
  2. pwd - prints current working directory
  3. ls - prints directory contents
  4. cd - changes current directory
  5. mkdir - creates a new directory
  6. file - determines file type
  7. echo - prints messages to the standard output
  8. cp - copies files and folders
  9. mv - renames or moves files or folders
  10. rm - deletes files or folders
  11. su - run a command with substitute user (e.g. root)
  12. exit - causes Bash to exit
  13. uname - print system information
  14. which - locate a command
Installing additional programs in Linux Ubuntu
   acos@acos-vm:~$ su
   root@acos-vm:/home/acos# apt install mc
   root@acos-vm:/home/acos# exit
Creating, editing and viewing source code:
  1. cat - concatnates and prints text files
  2. head - outputs the first part of files
  3. tail - outputs the last part of files
  4. nano - simple console code editor
  5. mcedit - mcedit simple editor from Midnight Commander
  6. vim - Vi IMproved, a programmer’s text editor
Compiling and running programs in C
  1. Use the following commands (work in MacOS too).

    Compiling:

    gcc hello.c -o hello
    

    Running:

    ./hello
    
Using Git and GitHub
  1. Create a public repository at GitHub. Create an account if you do already have it.
  2. Clone the created repository:
    git clone https://github.com/andrewt0301/test.git
    
  3. The repository will be cloned in the test folder. Change the current directory to it:
    cd test
    
  4. See help of using Git:
    git help
    
  5. Set your user name and email for this repository:
    git config user.name Andrei Tatarnikov
    git config user.email andrewt0301@gmail.com
    
  6. Create or copy the hello.c program to this folder.

  7. Check the status of files in the Git repository:
    git status
    
  8. Add the hello.c file to the commit:
    git add hello.c
    
  9. Send the commit to the repository:
    git commit -s -m "hello.c is added"
    
  10. Update the remote repository (GitHub):
    git push origin main
    
  11. Get changes from the remote repository (GitHub):
    git pull
    

Homework

TODO

References