View on GitHub

Computer Architecture and Operating Systems

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

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.c
    

    Running:

    ./hello