+ - 0:00:00
Notes for current slide
Notes for next slide

Intro to GNU/Linux command line

Learning just enough to be dangerous

Marek Ε uppa
Ondrej Jariabka
AdriΓ‘n Matejov

1 / 59

Grading, organization and logistics

2 / 59

Grading

  • Each lab is worth about 5% of your final grade (there will be some bonuses)
3 / 59

Grading

  • Each lab is worth about 5% of your final grade (there will be some bonuses)

  • You can get at most 50% of the grade in the labs

  • The other 50% comes from the test at the lectures with Dr. Janacek

4 / 59

Grading

  • Each lab is worth about 5% of your final grade (there will be some bonuses)

  • You can get at most 50% of the grade in the labs

  • The other 50% comes from the test at the lectures with Dr. Janacek

  • At least 60% is necessary for the (passing) E grade

5 / 59

Organization, logistics

  • Labs every week, 1630 in H6/some-other-new-room (or online)
6 / 59

Organization, logistics

  • Labs every week, 1630 in H6/some-other-new-room (or online)

  • Short (40 minute) lecture on some topic + various labs

7 / 59

Organization, logistics

  • Labs every week, 1630 in H6/some-other-new-room (or online)

  • Short (40 minute) lecture on some topic + various labs

  • We'll try to organize via MS Teams (of all places...)

8 / 59

Organization, logistics

  • Labs every week, 1630 in H6/some-other-new-room (or online)

  • Short (40 minute) lecture on some topic + various labs

  • We'll try to organize via MS Teams (of all places...)

  • Labs will take place on a remote server, so nothing to install

9 / 59

Organization, logistics

  • Labs every week, 1630 in H6/some-other-new-room (or online)

  • Short (40 minute) lecture on some topic + various labs

  • We'll try to organize via MS Teams (of all places...)

  • Labs will take place on a remote server, so nothing to install

  • You will have 18 hours to finish the labs

10 / 59

Organization, logistics

  • Labs every week, 1630 in H6/some-other-new-room (or online)

  • Short (40 minute) lecture on some topic + various labs

  • We'll try to organize via MS Teams (of all places...)

  • Labs will take place on a remote server, so nothing to install

  • You will have 18 hours to finish the labs

  • Every additional hour after the deadline compounds the decrease of points you can get by 1%

11 / 59

Why even have a course like this?

Well, the goal is to:

12 / 59

Why even have a course like this?

Well, the goal is to:

  • show you the cool things (your) computers are capable of
13 / 59

Why even have a course like this?

Well, the goal is to:

  • show you the cool things (your) computers are capable of

  • get you acquainted with UNIX-like operating systems, the tradition which powers much of modern computing

14 / 59

Why even have a course like this?

Well, the goal is to:

  • show you the cool things (your) computers are capable of

  • get you acquainted with UNIX-like operating systems, the tradition which powers much of modern computing

  • be a fun break from other classes

15 / 59

Why even have a course like this?

Well, the goal is to:

  • show you the cool things (your) computers are capable of

  • get you acquainted with UNIX-like operating systems, the tradition which powers much of modern computing

  • be a fun break from other classes

What you are studying is non-trivial already. It is not our job to punish you for choosing to do that but to give you some practical skills that will let you apply it straight away.

16 / 59

What about ChatGPT (and the like)?

aka the LLM Policy

17 / 59

What about ChatGPT (and the like)?

aka the LLM Policy

MIT did an experiment, in which three student teams were asked to write Fortran code, which none of them knew.

18 / 59

What about ChatGPT (and the like)?

aka the LLM Policy

MIT did an experiment, in which three student teams were asked to write Fortran code, which none of them knew.

  • πŸ₯‡ The team using ChatGPT finished the fastest.

  • πŸ₯ˆ The team using a specific AI coding assistant (Code Llama) came in second.

  • πŸ₯‰ The team using just Google search finished last, breaking down the task into components and solving it the old-fashioned way.

19 / 59

What about ChatGPT (and the like)?

aka the LLM Policy

MIT did an experiment, in which three student teams were asked to write Fortran code, which none of them knew.

  • πŸ₯‡ The team using ChatGPT finished the fastest.

  • πŸ₯ˆ The team using a specific AI coding assistant (Code Llama) came in second.

  • πŸ₯‰ The team using just Google search finished last, breaking down the task into components and solving it the old-fashioned way.

The students were then asked to recall the the solutions from memory

20 / 59

What about ChatGPT (and the like)?

aka the LLM Policy

MIT did an experiment, in which three student teams were asked to write Fortran code, which none of them knew.

  • πŸ₯‡ The team using ChatGPT finished the fastest.

  • πŸ₯ˆ The team using a specific AI coding assistant (Code Llama) came in second.

  • πŸ₯‰ The team using just Google search finished last, breaking down the task into components and solving it the old-fashioned way.

The students were then asked to recall the the solutions from memory

  • πŸ₯‰ The ChatGPT group remembered nothing -- all of the students failed.

  • πŸ₯ˆ Half of the group that used Code Llama passed.

  • πŸ₯‡ The old fashioned group? They all passed.

21 / 59

What about ChatGPT (and the like)?

aka the LLM Policy

MIT did an experiment, in which three student teams were asked to write Fortran code, which none of them knew.

  • πŸ₯‡ The team using ChatGPT finished the fastest.

  • πŸ₯ˆ The team using a specific AI coding assistant (Code Llama) came in second.

  • πŸ₯‰ The team using just Google search finished last, breaking down the task into components and solving it the old-fashioned way.

The students were then asked to recall the the solutions from memory

  • πŸ₯‰ The ChatGPT group remembered nothing -- all of the students failed.

  • πŸ₯ˆ Half of the group that used Code Llama passed.

  • πŸ₯‡ The old fashioned group? They all passed.

Morale of the story: struggling is part of the learning process.

22 / 59

What about ChatGPT (and the like)?

aka the LLM Policy

MIT did an experiment, in which three student teams were asked to write Fortran code, which none of them knew.

  • πŸ₯‡ The team using ChatGPT finished the fastest.

  • πŸ₯ˆ The team using a specific AI coding assistant (Code Llama) came in second.

  • πŸ₯‰ The team using just Google search finished last, breaking down the task into components and solving it the old-fashioned way.

The students were then asked to recall the the solutions from memory

  • πŸ₯‰ The ChatGPT group remembered nothing -- all of the students failed.

  • πŸ₯ˆ Half of the group that used Code Llama passed.

  • πŸ₯‡ The old fashioned group? They all passed.

Morale of the story: struggling is part of the learning process.

You ignore it at your own peril.

The Impact of AI on Computer Science Education

23 / 59

And now onto the real deal...

As in, why even learn about (Linux) Command Line in 2024,
when I want to be a Data Scientist!?!

24 / 59

Why Linux

25 / 59

Because (local) LLMs...

https://github.com/tloen/alpaca-lora/issues/3

27 / 59

A bit of computing history

Interaction with computers was done in various ways:

  • lights and switches
28 / 59

A bit of computing history

Interaction with computers was done in various ways:

  • lights and switches

  • numerical displays

  • textual displays and terminals

    • first Operating Systems
    • punchcards, tapes ..., disks (over 1MB!)
    • command line?
29 / 59

A bit of computing history

Interaction with computers was done in various ways:

  • lights and switches

  • numerical displays

  • textual displays and terminals

    • first Operating Systems
    • punchcards, tapes ..., disks (over 1MB!)
    • command line?
  • graphical display

    • window manager
  • mouse, touchpad, tablet, touch screen

30 / 59

A bit of computing history

Interaction with computers was done in various ways:

  • lights and switches

  • numerical displays

  • textual displays and terminals

    • first Operating Systems
    • punchcards, tapes ..., disks (over 1MB!)
    • command line?
  • graphical display

    • window manager
  • mouse, touchpad, tablet, touch screen

  • voice control, Virtual Reality...?

31 / 59

Ken Thompson (sitting) and Dennis Ritchie working together at a PDP-11

32 / 59

Unix

  • one of the first operating systems

  • Ken Thompson, Dennis Ritchie (and friends) in 1969

    • first implemented on DEC PDP-7
    • at (AT&T's) Bell Labs
  • later (1973) re-written in C

    • great win for portability to other architectures
33 / 59

Free Software Foundation and GNU

  • Richard Stallman founded the GNU (GNU's Not Unix) project in 1984
    • free UNIX clon, various system tools, without the kernel
34 / 59

Freedoms of Free Software

  1. The freedom to run the program as you wish, for any purpose.

  2. The freedom to study how the program works, and change it so it does your computing as you wish.

  3. The freedom to redistribute copies so you can help your neighbor.

  4. The freedom to distribute copies of your modified versions to others.

Note that free does not necessarily need to mean free of charge.

35 / 59

Linux

  • Linus Torvalds, 21 year old student of the University of Helsinki

  • Released Linux (kernel) in 1991

  • Linux kernel + GNU = Linux (GNU/Linux system)

36 / 59

Historical overview

37 / 59

Historical overview

38 / 59

Text console (terminal)

39 / 59

Text console (terminal)

40 / 59

Text console (terminal)

  • The whole concept comes from "teleprinters" (or "teletype" -- tty)
  • input from the keyboard
  • output onto the screen (printer, or any other output device)
41 / 59

Text console (terminal)

  • The whole concept comes from "teleprinters" (or "teletype" -- tty)
  • input from the keyboard
  • output onto the screen (printer, or any other output device)

Interpreter (shell)

  • the application that takes care of the command-line interface
  • receives and manages input and output
  • ensures that the received commands are executed
  • captures (and outputs) their output
  • examples include sh, bash, csh or zsh
42 / 59

Remote shell

  • To connect to a shell at a remote machine we'll generally be using ssh "Secure Shell"
$ ssh user@remote.computer.com
43 / 59

Remote shell

  • To connect to a shell at a remote machine we'll generally be using ssh "Secure Shell"
$ ssh user@remote.computer.com
  • Needs to be executed from a terminal/console application (aka "terminal emulator")

  • Starts an interpreter (shell) on the remote computer and connects the terminal/console to it

44 / 59

Remote shell

  • To connect to a shell at a remote machine we'll generally be using ssh "Secure Shell"
$ ssh user@remote.computer.com
  • Needs to be executed from a terminal/console application (aka "terminal emulator")

  • Starts an interpreter (shell) on the remote computer and connects the terminal/console to it

Windows

  • also has terminal emulators
  • the standard one is called putty
45 / 59

Shell

  • Whenever you star a shell (remote or not), you'll be welcomed by something on the order of
user@hostname:~$
  • user will be replaced with the user you run this shell as

  • hostname will be replaced with the name of the computer this shell is running on

46 / 59

Shell

  • Whenever you star a shell (remote or not), you'll be welcomed by something on the order of
user@hostname:~$
  • user will be replaced with the user you run this shell as

  • hostname will be replaced with the name of the computer this shell is running on

  • $ (and potentially # in case of administrator accounts) denotes a place to enter commands

47 / 59

Shell

  • Whenever you star a shell (remote or not), you'll be welcomed by something on the order of
user@hostname:~$
  • user will be replaced with the user you run this shell as

  • hostname will be replaced with the name of the computer this shell is running on

  • $ (and potentially # in case of administrator accounts) denotes a place to enter commands

user@hostname:~$ command [ENTER]

(the [ENTER] here means literally pressing the Enter key on the keyboard)

48 / 59

Shell Commands

The standard command has the following structure

user@hostname:~$ command [flags] [arguments]
49 / 59

Shell Commands

The standard command has the following structure

user@hostname:~$ command [flags] [arguments]

such as for instance

user@hostname:~$ command -x --longflag

where -x and --longflag are flags. (Long flags start with two dashes --)

50 / 59

Shell Commands

The standard command has the following structure

user@hostname:~$ command [flags] [arguments]

such as for instance

user@hostname:~$ command -x --longflag

where -x and --longflag are flags. (Long flags start with two dashes --)

Flags (or options) can be either boolean (present/not-present) or with some value

user@hostname:~$ command -x 123
user@hostname:~$ command --longflag somestring
51 / 59

Shell Commands: Examples

  • The cal command prints out a calendar
user@hostname:~$ cal
52 / 59

Shell Commands: Examples

  • The cal command prints out a calendar
user@hostname:~$ cal
  • Show three months with the -3 flag
user@hostname:~$ cal -3
53 / 59

Shell Commands: Examples

  • The cal command prints out a calendar
user@hostname:~$ cal
  • Show three months with the -3 flag
user@hostname:~$ cal -3
  • Show the next six months by passing a value to the -n flag
user@hostname:~$ cal -n 6
54 / 59

Shell Commands: Examples

  • The cal command prints out a calendar
user@hostname:~$ cal
  • Show three months with the -3 flag
user@hostname:~$ cal -3
  • Show the next six months by passing a value to the -n flag
user@hostname:~$ cal -n 6
  • Show the calendar for 2024 by passing it as an argument
user@hostname:~$ cal 2024
55 / 59

Shell Commands: Examples

  • The cal command prints out a calendar
user@hostname:~$ cal
  • Show three months with the -3 flag
user@hostname:~$ cal -3
  • Show the next six months by passing a value to the -n flag
user@hostname:~$ cal -n 6
  • Show the calendar for 2024 by passing it as an argument
user@hostname:~$ cal 2024
  • Show the first six months of the year 2024
user@hostname:~$ cal -n 6 2024
56 / 59

Useful commands

  • date

    • prints out the date
  • uname -a

    • shows information about the system (-a means "all information")
  • man command

    • shows a help page for command
    • the program can be exited by pressing q
57 / 59

Useful commands II

  • w

    • info about logged-in users
    • which terminal, what program are they running...
  • who

    • list of logged-in users
  • whoami

    • answers the question "Who am I?"
    • prints out the name of the current user
58 / 59

Useful commands III

  • pwd

    • shows the path to the current directory
  • cd directory

    • changes the working directory of the shell (its position on the disk) to directory
  • cd ..

    • return to one level above in the directory/folder structure on the disk
  • ls

    • lists the contents of the current directory
  • exit

    • exits (finishes the execution of) the shell
59 / 59

Grading, organization and logistics

2 / 59
Paused

Help

Keyboard shortcuts

↑, ←, Pg Up, k Go to previous slide
↓, β†’, Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow