compsci-missing_semester_2020/_subsections/lesson-01.org

4.9 KiB

Lesson 01 | Course Overview + Shell

Notes

why

  • there are many tools that make life easier for programmers
  • lecture notes and recordings are available online

the shell

  • programs are meant to be integrates with each other through the shell
  • most common shell is Bourne Again Shell (bash)

shell prompt

  • typical shell prompt:

    file:../_share/media/img/lecture01/ex01.png

  • shells can be customized extensibly
  • arguments are seperated by whitespace
  • multiple words can be passed as a single argument via:

    • quotes

      echo "Hello world"
    • escapes

      echo Hello\ world

how does the shell know where programs are

  • via environment variable

    • things that are set whenever you start your shell

      • where is your home directory
      • what is your username
      • what are the PATHs to your programs
  • shells, and bash in particular, are programming languages

paths

PATH environment variable

  • a list seperated by colons (:)
  • when bash is asked to run a program bash will search through the directories in path until it finds the program

absolute vs relative path

  • pwd: print working directory
  • all relative paths are relative to your current working directory
  • absolute path starts with '/'

special directories

  • '.' current directory
  • '..' parent directory

tilde (~)

  • always expands to your home directory

dash (-)

  • toggles to the previous directory you were at

    cd /home/ronny/programs/notes/courses
    cd ../../
    cd -
    pwd

the output will be /home/ronny/programs/notes/courses