name: inverse layout: true class: center, middle, inverse --- # Intro to GNU/Linux command line Learning just enough to be dangerous .footnote[Marek Šuppa
Ondrej Jariabka
Adrián Matejov] --- layout: false # Why Linux -- ![:scale 100%](images/1920px-Operating_systems_used_on_top_500_supercomputers.svg.png) [Supercomputer OS family – 1993–2019 systems share according to TOP500](https://en.wikipedia.org/wiki/Usage_share_of_operating_systems#Supercomputers) --- # 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...? --- ![:scale 90%](images/Ken_Thompson_Dennis_Ritchie_at_PDP-11.jpg) Ken Thompson (sitting) and Dennis Ritchie working together at a PDP-11 --- # Unix - one of the first operating systems - Ken Thompson, Dennis Ritchie (and friends) in 1969 - first implemented on DEC PDP-7 - later (1973) re-written in C - great win for portability to other architectures .center[ ![Ken Thompson and Denis Ritchie in 1973](images/Ken_Thompson_and_Dennis_Ritchie--1973.jpg)
.font-small[[Ken Thompson and Denis Ritchie in 1973](https://en.wikipedia.org/wiki/History_of_Unix#/media/File:Ken_Thompson_and_Dennis_Ritchie--1973.jpg)] ] --- # Free Software Foundation and GNU - Richard Stallman founded the GNU (.red[G]NU's .red[N]ot .red[U]nix) project in 1984 - free UNIX clon, various system tools, without the kernel .center[ ![:scale 40%](images/Richard_Stallman_at_LibrePlanet_2019.jpg)
.font-small[[Richard Stallman](https://en.wikipedia.org/wiki/Richard_Stallman#/media/File:Richard_Stallman_at_LibrePlanet_2019.jpg)] ] --- # 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. --- # Linux .left-eq-column[ - Linus Torvalds, 21 year old student of the University of Helsinki - Released Linux (kernel) in 1991 - Linux kernel + GNU = Linux (GNU/Linux system) ] .right-eq-column[ .center[ ![:scale 50%](images/Linus_Torvalds.jpeg)
.font-small[[Linus Torvalds in 2002](https://upload.wikimedia.org/wikipedia/commons/6/69/Linus_Torvalds.jpeg)] ] ] --- # Historical overview -- ![:scale 80%](images/list.png) --- # Text console (terminal) -- ![:scale 80%](images/teletype.jpg) --- # Text console (terminal) - The whole concept comes from ["teleprinters"](https://en.wikipedia.org/wiki/Teleprinter) (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 --- # Remote shell - To connect to a shell at a remote machine we'll generally be using `ssh` "Secure Shell" ```bash $ 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](https://putty.org/) --- # Shell - Whenever you star a shell (remote or not), you'll be welcomed by something on the order of ```bash user@hostname:~$ ``` - `user` will be replaced with the user you run this shell as - `server` 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 -- ```bash user@hostname:~$ command [ENTER] ``` (the `[ENTER]` here means literally pressing the Enter key on the keyboard) --- # Shell Commands The standard command has the following structure ```bash user@hostname:~$ command [flags] [arguments] ``` -- such as for instance ```bash 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 ```bash user@hostname:~$ command -x 123 user@hostname:~$ command --longflag somestring ``` --- # Shell Commands: Examples - The `cal` command prints out a calendar ```bash user@hostname:~$ cal ``` -- - Show three months with the `-3` flag ```bash user@hostname:~$ cal -3 ``` -- - Show the next six months by passing a value to the `-n` flag ```bash user@hostname:~$ cal -n 6 ``` -- - Show the calendar for 2020 by passing it as an argument ```bash user@hostname:~$ cal 2020 ``` -- - Show the first six months of the year 2020 ```bash user@hostname:~$ cal -n 6 2020 ``` --- # 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` - `exit` - exits (finishes the execution of) the shell --- # 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 --- # 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 --- template: inverse # Grading, organization and logistics --- ## Grading - Each lab is worth 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 50% is necessary for the E grade --- ## Organization, logistics - Labs every week, 1630 in **H6** (or online) - Short (40 minute) lecture on some topic + various exercises - Everything organized via Google Classroom - Labs will take place on a remote server, so nothing to install