Commit 45a815ec authored by nilsl's avatar nilsl
Browse files

Merge branch 'master' of gitlab.ethz.ch:thealternative/courses

parents 5271f71f b0a8fb30
Name,percent
Unix,71.4
Windows,28.6
Unix,71.0
Windows,29.0
Name,percent
Apache,40.5
Nginx,31.7
Cloudflare Server,13.2
Microsoft-IIS,7.8
other,5.8
Apache,36.1
Nginx,32.5
Cloudflare Server,16.0
Microsoft-IIS,7.7
other,7.7
# for the slide detailing that cryptography/security should be FOSS
https://en.wikipedia.org/wiki/Kerckhoffs%27s_principle
No preview for this file type
\input{../.style/header}
\title{Free and Open Source Software}
\author{Horea Christian}
\author{Alexander Schoch}
\institute{SSC TheAlternative | ETHZ and UZH}
\DTLloaddb{server}{data/web_servers.csv}
......@@ -340,7 +340,7 @@
\vspace{-0.75em}
\centering\tiny
\DTLpiechart{radius=0.235\textheight,variable=\quantity,innerlabel={\DTLpiepercent\%},outerlabel=\name,cutaway={1-2}}{server}{\name=Name,\quantity=percent}
\caption{Web Server Market Share 2020-02-26 via \href{http://w3techs.com/technologies/overview/web_server/all}{w3techs}}
\caption{Web Server Market Share 2020-10-06 via \href{http://w3techs.com/technologies/overview/web_server/all}{w3techs}}
\end{figure}
\column{0.5\linewidth}
\begin{figure}[htbp]
......@@ -349,7 +349,7 @@
\DTLsetpiesegmentcolor{1}{green!40}
\DTLsetpiesegmentcolor{2}{red!40}
\DTLpiechart{radius=0.265\textheight,variable=\quantity,innerlabel={\DTLpiepercent\%},outerlabel=\name,cutaway={2}}{os}{\name=Name,\quantity=percent}
\caption{Website OS Market Share 2020-02-26 via \href{http://w3techs.com/technologies/overview/operating_system/all}{w3techs}}
\caption{Website OS Market Share 2020-10-06 via \href{http://w3techs.com/technologies/overview/operating_system/all}{w3techs}}
\end{figure}
\end{columns}
\end{frame}
......@@ -436,7 +436,7 @@
\item Come to the next “Linux Days” events:
\textcolor{lg}{\url{http://thealternative.ch/}}
\item Join the next “Stammtisch”:\\
\textcolor{lg}{18:00 Thursday, March 5 - Katholische Hochschulgemeinde Zürich AKI, 2nd floor, Hirschengraben 86, 8001}
\textcolor{lg}{This will not take place due to the coronavirus}
\item Give us feedback!\\
\textcolor{lg}{\url{https://feedback.thealternative.ch/}}
\end{itemize}
......@@ -448,7 +448,7 @@
\end{itemize}
%separate sources from info so it looks nicer
\begin{itemize}
\item \textcolor{lg}{License:} \href{https://creativecommons.org/licenses/by-sa/3.0/}{CC BY-SA 4.0}
\item \textcolor{lg}{License:} \href{https://creativecommons.org/licenses/by-sa/3.0/}{Slides by Alexander Schoch/Christian Horea, CC BY-SA 4.0}
\end{itemize}
\end{frame}
\begin{frame}{References}
......
This is a public repository that contains a collection of our current (and past) LinuxDays courses.
# Downloading the course material
# Courses
Our course material (slides and several guides) are available as PDFs:
- [Free and Open Source Software](https://gitlab.ethz.ch/thealternative/courses/blob/master/FOSS_course/slides.pdf)
- [Introduction to Linux](https://gitlab.ethz.ch/thealternative/courses/blob/master/intro_course/slides.pdf)
- [Install Guide](https://gitlab.ethz.ch/thealternative/courses/blob/master/install_event/installguide_complete.pdf)
- [Console Toolkit Part 1](https://gitlab.ethz.ch/thealternative/courses/blob/master/console_toolkit/console_toolkit_1.pdf)
- [Console Toolkit Part 1&2](https://gitlab.ethz.ch/thealternative/courses/blob/master/console_toolkit/console_toolkit_2.pdf)
- [Console Toolkit Exercises](https://gitlab.ethz.ch/thealternative/courses/blob/master/console_toolkit/exercise_files/exercises.pdf)
- [Bash Course (Slides)](https://gitlab.ethz.ch/thealternative/courses/blob/master/bash_course/pres/pres.pdf)
- [Bash Course (Guide)](https://gitlab.ethz.ch/thealternative/courses/blob/master/bash_course/guide/guide.pdf)
- [Bash Course Exercises](https://gitlab.ethz.ch/thealternative/courses/blob/master/bash_course/exercisesheet/sheet.pdf) and [Solutions](https://gitlab.ethz.ch/thealternative/courses/blob/master/bash_course/exercisesheet/sol.pdf)
This is a public repository that contains a collection of our current (and past) LinuxDays courses.
Introduction:
- [Free and Open Source Software (.pdf)](https://gitlab.ethz.ch/thealternative/courses/blob/master/FOSS_course/slides.pdf)
- [Introduction to Linux (.pdf)](https://gitlab.ethz.ch/thealternative/courses/blob/master/intro_course/slides.pdf)
- [Install Guide](https://thealternative.ch/guides/install.php)
- [Bash Guide](https://thealternative.ch/guides/bash.php)
Console & Bash:
- [Console Toolkit Part 1 (.pdf)](https://gitlab.ethz.ch/thealternative/courses/blob/master/console_toolkit/console_toolkit_1.pdf)
- [Console Toolkit Part 1&2 (.pdf)](https://gitlab.ethz.ch/thealternative/courses/blob/master/console_toolkit/console_toolkit_2.pdf)
- [Console Toolkit Exercises (.pdf)](https://gitlab.ethz.ch/thealternative/courses/blob/master/console_toolkit/exercise_files/exercises.pdf)
- [Bash Course (Slides) (.pdf)](https://gitlab.ethz.ch/thealternative/courses/blob/master/bash_course/pres/pres.pdf)
- [Bash Course (Guide) (.pdf)](https://gitlab.ethz.ch/thealternative/courses/blob/master/bash_course/guide/guide.pdf)
- [Bash Course Exercises (.pdf)](https://gitlab.ethz.ch/thealternative/courses/blob/master/bash_course/exercisesheet/sheet.pdf) and [Solutions](https://gitlab.ethz.ch/thealternative/courses/blob/master/bash_course/exercisesheet/sol.pdf)
Tools:
- [Git](https://thealternative.ch/courses/git/git.html)
# Cloning the repository
......
No preview for this file type
# Welcome to the Bash Workshop!
* If you prefer to work on your own, already know programming or are confident in your abilities, please **sit in the back**.
<!-- -->
* If you prefer guided exercises, are completely new to programming, or want to have your hands held, please **sit in the front**.
* Please turn of your camera for the lecture part of the course, we only have 2GB of RAM on this server
* If there are any technical problems, let me know!
---
author:
- Aline Abler
- Nicolas König
title: Bash Workshop
---
......@@ -78,19 +78,19 @@ title: Bash Workshop
### Meaning of strings
echo Hello World
ls my file
* `echo`, `Hello` and `World` are single strings
* `ls`, `my` and `file` are single strings
* The first string becomes the command, all following become
*arguments*
<!-- -->
echo 'Hello World'
ls 'my file'
* Here, `Hello World` is just one string
* Here, `my file` is just one string
### Repeat after me
### Remember!
\bigtext{Every word is a single argument unless you use quotes.}
......@@ -111,7 +111,7 @@ title: Bash Workshop
[[1==3]]
* Bash's answer:
* Bash's answer:
bash: [[1==3]]: command not found
......@@ -119,7 +119,7 @@ title: Bash Workshop
[[ 1 == 3 ]]
### Repeat after me
### Remember!
\bigtext{If there's brackets, you probably need spaces.}
......@@ -151,7 +151,7 @@ title: Bash Workshop
* What bash sees
0
### Why is that important?
* *&&*, *||*, *if* and *while* all act based on the return value of something
......@@ -207,10 +207,41 @@ becomes
rm "$var"
### Repeat after me:
### Remember!
\bigtext{If there's a dollar, you probably need quotes!}
## Piping
### Glueing programs together
* Pipes allow us to connect different programs
* The output of one program is used as the input for another
### Glueing programs together
du -b
lists the size of all directories within the current one
sort -n
sorts the input numerically. So
du -b | sort -n
gives us a list of all subdirectories sorted by size.
### Glueing programs together
ls -l | cut -d' ' -f3 | sort | uniq
Complicated functionality can be created from very simple programs.
### Remember!
\bigtext{If you want to connect programs, you probably want pipes!}
# What bash is used for
## The whole point of bash
......@@ -252,22 +283,20 @@ becomes
## What happens now?
### Hands on!
#### Guided exercises
* Solve easy exercises in plenum
* Tailored to complete beginners
#### Self-driven exercises
* Self study using a guide
* Try some of our exercises
* Choose the exercises you find interesting! No need to go in order.
#### Guided exercises
* Solve easy exercises in plenum
* Tailored to complete beginners
* Please sit in the front
### Course material
* These slides, exercise sheet and bash guide: \
\soft{http://thealternative.ch}
* Please leave some feedback! \
\soft{http://feedback.thealternative.ch}
<!-- -->
* \soft{Theme by} Christian Horea, [CC BY](https://creativecommons.org/licenses/by/4.0/)
* \soft{Original Presentation by} Aline Abler
No preview for this file type
TEX=latexmk
TEXOPTS=-output-directory=build \
-pdf \
-latexoption=-interaction=nonstopmode \
-latexoption=-file-line-error
# Set PREVIEW=1 to enable preview. Make sure an appropriate viewer is
# configured in $HOME/.latexmkrc.
# Example usage: make PREVIEW=1 opendata
ifdef PREVIEW
PREVIEWOPTS=-pvc
endif
defaul: exercises
# To include the current git revision in the header, write it to 'GIT_TAG'
# file, which the LaTeX source can include.
gitrev:
@printf "r%s.%s" "$$(git rev-list --count HEAD)" "$$(git rev-parse --short HEAD)" > GIT_TAG
# Create build directory if it doesnt exist
builddir:
@[ -d build ] || mkdir build
# All documents need to be compiled twice.
# This is because some necessary information is only available after
# the first compiler run, like \pageref{LastPage}.
exercises: exercises.tex gitrev builddir
@$(TEX) $(TEXOPTS) $(PREVIEWOPTS) $<
mv build/exercises.pdf .
clean:
@rm -rf build/*
% vim: set ft=tex:
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{TheAlternativeCourse}
% packages
\LoadClass[11pt]{scrartcl} % Base class: KOMA script article
\RequirePackage[utf8]{inputenc} % Support for german 'umlaut' (ä, ö, ü)
\RequirePackage{lastpage} % \pageref{LastPage}
\RequirePackage{scrlayer-scrpage} % KOMA Script header/footer package
\RequirePackage{graphicx} % \includegraphics{...}
\RequirePackage[showseconds=false,showzone=false]{datetime2}
\RequirePackage[table]{xcolor}
\RequirePackage[most]{tcolorbox}
\RequirePackage{hyperref}
% helvetica font
% \RequirePackage[scaled]{helvet}
% \RequirePackage[T1]{fontenc}
% \renewcommand\familydefault{\sfdefault}
% header / footer
\KOMAoptions{headsepline,headheight=27.5pt}
\setkomafont{pagehead}{\normalfont\normalcolor} % non-italic header font
\setkomafont{pagefoot}{\normalfont\normalcolor} % non-italic footer font
\newcommand{\builddate}{\footnotesize Revision: \input{GIT_TAG} \\ Build: \DTMNow}
\newcommand{\thealtlogo}{\includegraphics[width=4.5cm]{assets/logo.png}}
\lohead[\thealtlogo]{\thealtlogo}
\rohead[\builddate]{\builddate}
\cofoot[\footnotesize \thepage~/~\pageref{LastPage}]{\thepage~/~\pageref{LastPage}}
\recalctypearea%
\setlength{\voffset}{-1.2cm} % space before header
\setlength{\textheight}{1.15\textheight} % height of text
\definecolor{ldorange}{HTML}{F18A20}
\definecolor{ldblue}{HTML}{254471}
\definecolor{grey1}{HTML}{aaaaaa}
\definecolor{grey2}{HTML}{efefef}
\definecolor{lightblue}{HTML}{d9edfc}
\definecolor{exclamred}{HTML}{db1515}
\colorlet{lightyellow}{yellow!6!white}
\colorlet{darkeryellow}{red!15!yellow!40!white}
\newtcolorbox[auto counter, number within=section]{exercisebox}[2][]{%
colback=lightyellow,
fuzzy shadow={1mm}{-1mm}{0mm}{0.1mm}{black!50!white},
colframe=ldorange,
coltitle=black,
enhanced,
fonttitle=\bfseries,
title=Task~\thetcbcounter: #2,#1}
\newtcolorbox{cmdbox}{%
colback=grey2,
fuzzy shadow={1mm}{-1mm}{0mm}{0.1mm}{black!50!white},
enhanced,
colframe=grey1,
coltitle=black,
enhanced}
\newtcolorbox{tcbhintbox}{%
enhanced,
skin=bicolor,
segmentation at break=true,
boxrule=0.8pt,
left=3.5mm,
top=0.5mm,
bottom=0.5mm,
arc=1pt,
boxsep=2pt,
lefthand ratio=0.06,
sidebyside,
colframe=ldorange,
coltext=black,
colback=darkeryellow,
colbacklower=lightyellow,
}
\newcommand{\hintbox}[1]{%
\begin{tcbhintbox}
\includegraphics[width=8mm]{img/light_bulb.pdf}%
\tcblower%
#1
\end{tcbhintbox}}
\documentclass{TheAlternativeCourse}
\usepackage{menukeys}
\usepackage{tabularx}
\usepackage{float}
\usepackage{caption}
\title{Console Toolkit Exercises}
\date{}
\author{}
\begin{document}
\maketitle
\setlength{\parindent}{0cm}
\setlength{\parskip}{12pt}
\section{Introduction}
Welcome to this exercise session! This is a practical exercise on the Linux
command line. If you have any question about the exercises, feel free to ask
the helpers for assistance.
\subsection*{Difficulty}
The exercises are designed in such a way that you will have to find solutions
by reading the manuals and using search engines. You are expected to come up
with appropriate solutions on your own, there will be no step-by-step guided
exercises!
There will be quite simple exercises for complete beginners at the start,
but there are also some much more difficult ones further into the exercise.
Feel free to skip ahead!
\subsection*{Liability}
By taking part in this exercise, you acknowledge that you alone are responsible
for your computer. TheAlternative and its parent organisation, the Student
Sustainability Commission, will not be held liable for any damages or loss of
data.
\pagebreak
\section{Basics}
To solve some of the exercises, you will need to download some files. Whenever
you see an orange box like below, this means you have a task to solve.
\begin{exercisebox}{Getting the repository}
Open a terminal and enter the following (all on one line): \\
\texttt{curl https://files.project21.ch/LinuxDays-Public/HS18-exercise.zip
-o exercises.zip} \\\\
Then extract the zip archive like this: \\
\texttt{unzip exercises.zip}
\end{exercisebox}
\subsection{Running a command}
To run a command, you just type it into the console and hit enter. Most useful
commands require some arguments. Arguments are given after the name of the
command, separated by spaces. There are also so-called \emph{flags}, which set
some options to alter the behaviour of a command. They have the form
\texttt{-x} (single letter form) or \texttt{--long-option} (long format).
An example of a more involved command:
\begin{cmdbox}
\texttt{ls -l --human-readable \textasciitilde/Downloads}
\end{cmdbox}
\subsection{Getting help}
\texttt{man} is a command you will need throughout the following
exercises. It stands for ``manual'' and shows you what almost any given
command can do and which options are available for it. Almost all commands
provide such a ``manpage'', which is typically written by the developers
themselves.
\begin{exercisebox}{The manual's manual}
The \texttt{man} command itself has its own manpage. Type \texttt{man man}
to access it, use the arrow keys to scroll, and press \keys{q} to exit.
Have a look around, especially at the different section numbers.
What is the section number for system calls?
\end{exercisebox}
An alternative to using the man pages is to try and see if a command has a help
option. This is usually displayed by appending the option \texttt{--help} after
the name of the command, which will often display much shorter and concise
instructions
on how to use a command.
\begin{exercisebox}{The help option}
Look at the help output of \texttt{ls}. What is the flag to see hidden
files?
\end{exercisebox}
\subsection{Navigating directories}
You can navigate your file system in the terminal, just like you could with
a graphical program. Below are the most important commands.
\begin{table}[H]
\centering
\rowcolors{1}{lightblue}{white}
\begin{tcolorbox}[%
enhanced,
width=1.0\linewidth,
fuzzy shadow={1mm}{-1mm}{0mm}{0.1mm}{black!50!white},
tabularx={>{\centering\arraybackslash}l|>{\centering\arraybackslash}X},
title={Commands for navigating directories}]
\textbf{Command} & \textbf{Description} \\
\texttt{pwd} & Display the current working directory. \\
\texttt{tree DIR} & Get a visualization of the directory tree under
\texttt{DIR}. \\
\texttt{ls DIR} & List all files and directories in the current
working directory. \\
\texttt{cd DIR} & Change the current working directory to the given
directory. \\
\end{tcolorbox}%
\label{tab1}
\end{table}
\begin{exercisebox}{Making yourself at home}
Have a look around your home directory and try out the mentioned commands.
You will most likely recognise the layout from your graphical file browser.
Remember you can always return to your home directory by running
\texttt{cd} without any arguments.
\end{exercisebox}
\subsection{Modifying directories}
Just like in graphical programs, you can create and delete directories on the
command line.
\begin{table}[H]
\centering
\rowcolors{1}{lightblue}{white}
\begin{tcolorbox}[%
enhanced,
fuzzy shadow={1mm}{-1mm}{0mm}{0.1mm}{black!50!white},
width=1.0\linewidth,
tabularx={>{\centering\arraybackslash}l|>{\centering\arraybackslash}X},
title={Commands for modifying directories}]
\textbf{Command} & \textbf{Description} \\
\texttt{mkdir DIR} & Create a new directory with the given name. \\
\texttt{rmdir DIR} & Remove a directory. Will not work with
non-empty directories. \\
\texttt{rm -r DIR} & Remove a directory and its contents.
{\color{exclamred}Attention! There is no trashcan on the command
line! Files and directories will be deleted irrevocably.} \\
\texttt{cp -r SOURCE TARGET} & Copy a source directory
(recursively with all its contents) to a target. \\
\texttt{mv SOURCE TARGET} & Move a file or directory.
Also used to rename files/directories. \\
\end{tcolorbox}%
\label{tab2}
\end{table}
\begin{exercisebox}{Creating your first directory}
Create a directory for the following exercises (you can call it
\texttt{console-toolkit}). Change into that directory and create a file
called \texttt{notes}. Then move the exercise file directory you downloaded
in task 2.1 into your newly created directory.
\end{exercisebox}
\subsection{Viewing files}
If you want to view the contents of a text file, you have the following
options:
\begin{table}[H]
\centering
\rowcolors{1}{lightblue}{white}
\begin{tcolorbox}[%
enhanced,
fuzzy shadow={1mm}{-1mm}{0mm}{0.1mm}{black!50!white},
width=1.0\linewidth,
tabularx={>{\centering\arraybackslash}l|>{\centering\arraybackslash}X},
title={Commands for viewing files}]
\textbf{Command} & \textbf{Description} \\
\texttt{cat FILE} & Output a file to the terminal. \\
\texttt{head FILE} & Output the first couple of lines to the terminal. \\
\texttt{tail FILE} & Output the last couple of lines to the terminal. \\
\texttt{less FILE} & Browse a file in a visual viewer. \\
\end{tcolorbox}%
\label{tab3}
\end{table}
\begin{exercisebox}{Log files}
\texttt{tail} is often used to inspect errors log files. Use tail to find the
last three lines of \texttt{dmesg\_log} (in the exercise files).
\end{exercisebox}
\hintbox{\texttt{dmesg} is tool to view the log output of your kernel.}
\subsection{Console tips \& tricks}
There are many small things that can make your life when using the terminal
little bit easier. Following is a table with the most important keyboard
shortcuts you can use to speed up your workflow.
\begin{table}[H]
\centering
\rowcolors{1}{lightblue}{white}
\begin{tcolorbox}[%
enhanced,
fuzzy shadow={1mm}{-1mm}{0mm}{0.1mm}{black!50!white},
width=1.0\linewidth,
tabularx={>{\centering\arraybackslash}l|>{\centering\arraybackslash}X},
title={Terminal keyboard shortcuts}]
\keys{\ctrl}+\keys{w} & Delete one word backwards. \\
\keys{\ctrl}+\keys{u} & Delete the entire line. \\
\keys{\ctrl}+\keys{l} & Clear the terminal. \\
\keys{\ctrl}+\keys{a} & Go to the beginning of the line. \\
\keys{\ctrl}+\keys{e} & Go to the end of the line. \\
\keys{\ctrl}+\keys{c} & Terminate the currently runnig process. \\
\keys{\ctrl}+\keys{d} & Quit the shell. \\
\end{tcolorbox}%
\label{tab4}
\end{table}
\section{Files \& Permissions}
This section introduces you to basic commands related to files. We will first
look at a command that can be used for creating empty files.
The \texttt{touch} command is most frequently used for creating new, empty
files. If you check the manual, you will see that it can also change certain
file timestamps (access and modification times).
\begin{exercisebox}{The magic touch}
Switch to your home directory. Execute \texttt{touch file}. A new file
should have been created. Confirm that this is the case.
\end{exercisebox}
%
We already saw \texttt{cat} in the previous section. Anothe