Skip to content
Snippets Groups Projects
Verified Commit fc8a4a8b authored by Jakob Moser's avatar Jakob Moser
Browse files

Linux-Intro hinzufügen

parent d28e4bd4
No related branches found
No related tags found
No related merge requests found
Pipeline #6239 passed
\setbeamercolor{progress bar}{bg=color3!50!black!30,fg=color3}
\setbeamercolor{alerted text}{fg=color3}
\label{sec:Linux}
\section{\texorpdfstring{\faIcon{terminal} Linux Introduction}{Linux Introduction}}
\begin{frame}
\begin{center}
\Huge\faIcon{linux} \\
\vspace{4mm}
\normalsize Who has had anything to do with Linux before?
\end{center}
\end{frame}
\subsection{Overview}
\begin{frame}{What's that?}
\begin{itemize}
\item Open operating system, an alternative to Windows and macOS
\item Many different distributions
\item Popular as a server operating system, use for personal computers is less common
\begin{itemize}
\item Fancied among colis
\end{itemize}
\item Most computers at the institute run linux
\end{itemize}
\end{frame}
\begin{frame}{How do you operate it?}
\begin{itemize}
\item There are graphical user interfaces (as for Windows and macOS)\dots
\item \dots but you can also use merely text-based interfaces
\item The latter is of high importance for remote operation of servers
\end{itemize}
\end{frame}
\begin{frame}{The terminal}
\begin{itemize}
\item Takes getting used to, but is very powerful
\item At the pool: \keys{Alt + F2}, then ``\textit{konsole}" to open it
\item Connecting to the pool from your own device using a ``SSH client"
\item The search engine of your choice will provide you with the most helpful tips
\end{itemize}
\end{frame}
\begin{frame}{Using the pool without being at the pool: SSH}
\textbf{Connecting to linux computers - \structure{ssh} (\structure{s}ecure \structure{sh}ell)}
\begin{itemize}
\item Remote access to a linux terminal from home
\item Optionally with a graphical user interface (not very performant)
\item Using Linux/Mac/Windows 10 at home? Perfect!
\begin{itemize}
\item \texttt{ssh \textless login\textgreater @last.cl.uni-heidelberg.de}
\item \texttt{ssh \textless login\textgreater @ella.cl.uni-heidelberg.de}
\item \texttt{ssh \textless login\textgreater @pool.cl.uni-heidelberg.de -p 2222} (exception!)
\item ...
\end{itemize}
\item For older versions of Windows: \href{https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html}{PuTTY}
\item Recommendation: Try it out, contact us when you have problems
\end{itemize}
\end{frame}
\begin{frame}{Using the pool computers}
\begin{itemize}
\item Set computers to \textbf{standby} (= sleep) if you don't need them
\item Away for a short time: Standby (automatically locks session)
\item Done: Log out, \textbf{then click ``sleep''}
\item Monitor off? Press any key
\item Computer off? Please ignore it (we take care of it)
\item In the deep hours of the night, all PCs will be rebooted
\end{itemize}
\end{frame}
\begin{frame}{Computers, users and data}
\begin{itemize}
\item Many users can use one computer
\item Personal data (home directory) is available at every computer
\item The disk space for your home directory is limited!\\ Get the current status: \alert{quota -s}
\begin{itemize}
\item Space: Soft \textbf{37 GB}, Hard \textbf{42 GB}
\item Amount of files: Soft \textbf{200.000}, Hard \textbf{250.000}
\end{itemize}
\item \textcolor{cwarning}{Suspension}: When violating the quota for too long, your account will be suspended.
\item No problem: just clean up your home directory (don't just move the items to the trash)
\end{itemize}
\end{frame}
\begin{frame}{Claustrophobia: project directories}
\begin{itemize}
\item If you need more disk space when working on a larger software project, don't hesistate to contact us for a project directory
\item Available on every machine (like the home directories)
\end{itemize}
\end{frame}
\subsection{Essentials and Basic Commands}
\begin{frame}[fragile]{The prompt}
\begin{semiverbatim}
moser@pool10:~\$
moser@pool03:~/Desktop\$
moser@ella:/home/students/\$
\end{semiverbatim}
\begin{tabular}{ l l }
\texttt{moser} & Username \\
\texttt{@} & \textit{Separator}\\
\texttt{pool10} & Hostname (e.g. \texttt{pool15} or \texttt{ella})\\
\texttt{:} & \textit{Separator}\\
\texttt{\textasciitilde} & Current working directory\\
\texttt{\$} & \textit{Separator}
\end{tabular}
\end{frame}
\begin{frame}{Linux Path Structure}
\begin{itemize}
\item Within a directory, there can be files and more directories
\item This structure resembles the structure of branches of a tree
\item Each node within this tree can be identified by its \textbf{path}
\item By the way: Linux doesn't care about file extensions. \texttt{diary.txt} could be a \texttt{gif} file too
\end{itemize}
\end{frame}
\begin{frame}{Linux Path Structure}
\includegraphics[width=\textwidth]{../img/baumstruktur.png}
% https://publicdomainvectors.org/en/free-clipart/Barren-tree/49392.html
\end{frame}
\begin{frame}{Paths}
\textbf{Absolute paths}
\begin{itemize}
\item describe the location of a file / directory relative to the root directory \alert{/}
\item are distinct within the system
\item e.g. \alert{/home/students/hfischer/folien/einfuehrung.pdf}
\end{itemize}
\textbf{Relative paths}
\begin{itemize}
\item describe the location of a file / directory relative to the current working location
\item start with a relative anchor (\alert{\textasciitilde} or \alert{.} or \alert{..})
\item \alert{\textasciitilde/folien/einfuehrung.pdf}\\
\alert{./folien/einfuehrung.pdf} (= \alert{folien/einfuehrung.pdf}) \\
\alert{../hfischer/folien/einfuehrung.pdf}\\
\end{itemize}
\end{frame}
\begin{frame}{Paths: Anchors}
All paths start with an anchor:
\begin{tabular}{ l l }
\alert{/} & The root directory \\
\alert{\textasciitilde} & The home directory \\
& (usually \alert{/home/students/\textit{username}}) \\
\alert{.} & The current working directory \\
& (This anchor can be left out most of the time) \\
\alert{..} & The next higher / superior directory
\end{tabular}
\smallskip % Die Leerzeile darüber muss bleiben!
Also important: you have to watch out for case sensitivity!
\end{frame}
\begin{frame}{Commands}
\begin{itemize}
\item You can or must usually place parameters after commands.
\item Example: \texttt{ls -a /home/students/piersig}
\item Note that the command name and any parameters are separated by a space.
\end{itemize}
\end{frame}
\begin{frame}{Navigation}
\textbf{Changing the working directory - \structure{cd} (\structure{c}hange \structure{d}irectory)}\\
\begin{description}[\alert{cd \textless absolute path\textgreater}]
\item[\alert{cd \textless absolute path\textgreater}] changes into the specific absolute path
\item[\alert{cd \textless relative path\textgreater}] changes into the specific relative path
\item[\alert{cd \textasciitilde}] changes into your home directory (abbreviation: \alert{cd})
\item[\alert{cd ..}] changes into the next higher / superior directory
\item[...]
\end{description}
\smaller
\textbf{Examples:}\\
\alert{cd /home/students/moser/} changes into the home directory of the user \textit{moser}\\
\alert{cd Desktop} changes into the subdirectory \textit{Desktop} within the current directory\\
\alert{cd} changes into the home directory of the current user\\
\end{frame}
\begin{frame}{Directory Management}
\textbf{Showing the path of the current working directory - \structure{pwd} (\structure{p}rint \structure{w}orking \structure{d}irectory) }\\[0.5cm]
\textbf{Showing folder content - \structure{ls} (\structure{l}i\structure{s}t directory contents)}
\begin{description}
\item[\alert{ls \textless path\textgreater}] shows the content of a relative/absolute path
\item[\alert{ls}] shows the content of the current directory
\item[\alert{ls -l}] shows the content + other useful information
\item[\alert{ls -la}] shows the content + useful information + hidden files
\end{description}
\textbf{Creating folders - \structure{mkdir} (\structure{m}a\structure{k}e \structure{dir}ectory) }
\begin{description}
\item[\alert{mkdir aFolder}] creates the folder \texttt{aFolder} in the current directory
\item[\alert{mkdir \textasciitilde/aFolder}] creates the folder \texttt{aFolder} in your home directory
\end{description}
\end{frame}
\begin{frame}{File Management I}
\textbf{Copying files - \structure{cp} (\structure{c}o\structure{p}y files and directories)}
\begin{description}
\item[\alert{cp aFile ../aFile}] copies \texttt{aFile} into the superior directory
\item[\alert{cp -r aFolder aFolder2}] copies \texttt{aFolder} (into the same directory)\\[0.5cm]
\end{description}
\textbf{Renaming/Moving files - \structure{mv} (\structure{m}o\structure{v}e/rename files)}:
\begin{description}
\item[\alert{mv -i file1 file2}] renames \texttt{file1} to \texttt{file2} (confirm with \keys{Y})
\item[\alert{mv -i pfad1/file pfad2/file}] moves the file
\end{description}
If you leave out \alert{-i}, files will be overwritten without further question.
Overwritten files are \textbf{\textcolor{cwarning}{gone}}!\\[0.5cm]
\end{frame}
\begin{frame}{File Management II}
\textbf{Deleting files - rm (\structure{r}e\structure{m}ove files or directories)}
\begin{description}
\item[\alert{rm -i \textless file\textgreater}] deletes a file
\item[\alert{rm -i -r \textless directory\textgreater}] deletes a folder with files and subdirectories
\end{description}
Files deleted using \alert{rm} are \textbf{\textcolor{cwarning}{gone}} as well! (not in the trash folder)
And if you leave out \alert{-i}, you won't even be asked if you really want to delete...
\end{frame}
\begin{frame}{Opening and Creating Text Files}
\textbf{Reading text files - \structure{cat}}
\begin{description}
\item[\alert{cat \textless file\textgreater}] prints the content of the file
% \item[\alert{/}] searches for a string $\rightarrow$ \structure{n} shows the next match
% \item[\alert{q}] closes reading view\\[0.5cm]
\end{description}
\textbf{Creating empty files - \structure{touch}}
\begin{description}
\item[\alert{touch \textless file\textgreater}] creates an empty file with the respective name
\end{description}
\end{frame}
\begin{frame}{Editing Text Files}
\textbf{Text editors}
\begin{itemize}
\item There is a variety of text editors available
\item Not every editor is installed on every system by default
\item Common editors: \texttt{nano}, \texttt{vi}, \texttt{vim}, \texttt{emacs}
\item Create a new or edit an existing text file i.e. by using \\
\textbf{\alert{vim \textless file\textgreater}}
\end{itemize}
\textbf{Lifehack: Ouput forwarding using \texttt{\textgreater, \textgreater\textgreater}}
\begin{description}
\item[\alert{echo "Hello" \texttt{ \textgreater\textgreater} hello.txt}] appends ``Hello'' to the contents of \texttt{hello.txt}
\end{description}
\end{frame}
\begin{frame}{In the Footsteps of Gutenberg}
\textbf{Printing files - \structure{lp} (\structure{l}ine \structure{p}rinter devices)}
\begin{description}
\item[\alert{lp -h miller \textless path\textgreater}] sends the file to the pool printer
\item ideally a \texttt{.txt} or \texttt{.pdf} file\\[0.5cm]
\end{description}
\textbf{Checking the print status}
\begin{itemize}
\item Web interface: \structure{\url{http://miller:631/jobs}}
\item Favorable price tag per page: only 0 Euro
\item Quota: 30 pages every week per user
\end{itemize}
\end{frame}
\begin{frame}{Let's just take the file and move it to last}
\textbf{Moving files via the network to other computers - rsync}
\begin{description}
\item[\alert{rsync \textless source\textgreater \hspace{1pt}\textless target\textgreater}] copies the file from the source to the target
\item[\alert{rsync hi.txt hfischer@last.cl.uni-heidelberg.de:\textasciitilde /briefe/}] copies \texttt{hi.txt} from the local working directory to the folder \texttt{briefe} in the home directory of the user \texttt{hfischer} on last
\end{description}
\end{frame}
\begin{frame}{Linux Manual Pages}
\textbf{Help for commands - \structure{man} (\structure{man}ual pager utils)}
\begin{description}
\item[\alert{man \textless command\textgreater}] shows manual page for the specified command
\end{description}
\smaller
\textbf{Examples:}\\
\alert{man man} How, why and whatfore do you use \texttt{man}?
\medskip
\normalsize
If you are still kind of scared by the terminal, have a look at \url{https://linux.die.net/man/} or use a search engine of your choice.
\end{frame}
\begin{frame}{Wildcards}
\textbf{The Asterisk}
\begin{itemize}
\item matches multiple files
\item replaces multiple characters (zero aswell)\\[0.5cm]
\end{itemize}
\textbf{Example: \structure{rm *.txt}}\\
\begin{itemize}
\item \texttt{lel.txt} - deleted
\item \texttt{lel.pdf} - not deleted
\item \texttt{asd.txt} - deleted
\item \texttt{lel.pdf.txt} - deleted
\end{itemize}
Reminder: file extensions are irrelevant to the system
\end{frame}
\begin{frame}{More useful commands}
\begin{description}
\item[\alert{grep}] Searching the content of files
\item[\alert{find}] Searching files (i.e. by name)
\item[\alert{less}] View text file in pager, incl. search functionality
\item[\alert{head}] Printing the first few lines of a file
\item[\alert{tail}] Printing the last few lines of a file
\end{description}
Great sources for more information on a command are (besides \alert{man})
webpages like \href{https://wiki.ubuntuusers.de}{\texttt{wiki.ubuntuusers.de}} or \href{https://www.cyberciti.biz/faq}{\texttt{www.cyberciti.biz/faq}}.
\end{frame}
\subsection{Working with others and over the network}
\begin{frame}{Networks and their users}
\textbf{Computers in the network}
\begin{itemize}
\item{every computer is in the network}
\item{every user can log on to every computer}
\item{every user gets to use the same data}
\item{every user gets to use the same resources}
\end{itemize}
\textbf{Users and groups}
\begin{itemize}
\item each user has its own username and is at least in one group (students/mitarb)
\item e.g.: \alert{schubert} in \alert{students}
\item you can list all groups of a user with the \alert{groups} command
\end{itemize}
\end{frame}
\begin{frame}{Access Rights I}
The UNIX abbreviation for the three access rights:
\begin{description}[r]
\item[\alert{r}]read permission. The permission to read the file’s/folder’s content
\item[\alert{w}]write permission: The permission to change/delete the file/folder
\item[\alert{x}]execution permission (eXecute): The permission to execute the file as a program
\end{description}
\vspace{1.5em}
And for the classes of user and group management:
\begin{description}[r]
\item[\alert{u}] The user who owns the file
\item[\alert{g}] The users who are in the group which owns the file
\item[\alert{o}] Every other user
\end{description}
\end{frame}
\begin{frame}{Access Rights II}
How the access rights for a specific file or folder are set can be checked with \alert{ls -l \textless path\textgreater}.
\\[.5cm]
Two typical entries could look like this:\\
{\color{red}\texttt{ uuugggooo\\}}
\texttt{drwxrwxrwx 160 moser students 5440 Oct 21 21:25 topics\\
-rw-r----- 145 moser students 2670 Mar 18 13:12 cheat}
\\[.5cm]
The first entry is a directory which the user, group und others are able to read, write and execute.
The second entry is not a directory, but a file. The user is allowed to read and write the files, the group may only read the file. Others are not allowed to do anything.
\end{frame}
\begin{frame}{Access Rights III}
\textbf{Changing access rights - \structure{chmod} (\structure{ch}ange \structure{mod}e)}
\begin{description}[Hi] % Das Hi definiert nur, dass die Einrückung zwei Zeichen weit sein soll
\item[\alert{chmod \textless class(es)\textgreater\textbf{+}\textless permissions\textgreater \hspace{1pt} \textless file\textgreater}]\hspace{10cm} Allocates the given rights to the given class
\item[\alert{chmod \textless class(es)\textgreater \textbf{-}\textless permissions\textgreater \hspace{1pt} \textless file\textgreater}]\hspace{10cm} Withdraws the given rights from the given classes
\end{description}
\smaller
\textbf{Examples:}\\
\alert{chmod go-rwx \textless file\textgreater} withdraws the rights to read, write and execute from the users in the group and all others. \\
\alert{chmod u+w \textless file\textgreater} allocates write access to the user\\
\alert{chmod a-w \textless file\textgreater} withdraws the write access from everyone (= \alert{chmod ugo-w})
\normalsize
\textit{file} can always also be a \textit{directory}
\end{frame}
\begin{frame}{Experimenting with Linux and solving the pool test}
\begin{center}
\includegraphics[width=0.8\textwidth]{../img/yalikejazz.png}
\\
\url{https://yalikejazz.cl.uni-heidelberg.de/}
\end{center}
\end{frame}
\begin{frame}{Experimenting with Linux and solving the pool test}
\begin{itemize}
\item Allows you to safely play around with a Linux terminal and practice commands.
\item There are some practice tasks in the style of the tasks that are asked in the pool test.
\item Because the Linux environment is simulated only in the browser not all programs are available. In particular, there is no \texttt{nano}, \texttt{vim} or \texttt{emacs}.
\begin{itemize}
\item If a text editor is necessary, one can use \texttt{vi}. The same keyboard shortcuts apply here as with \texttt{vim}, so especially the complicated methodology for closing the editor: \keys{ESC} + \texttt{:wq} to save and \keys{ESC} + \texttt{:q!} to discard the changes.
\item You do not always need an editor to fill a text file.
\end{itemize}
\end{itemize}
\end{frame}
\setbeamercolor{progress bar}{bg=color3!50!black!30,fg=color3}
\setbeamercolor{alerted text}{fg=color3}
\label{sec:Linux}
\section{\texorpdfstring{\faIcon{terminal} Linux-Einführung}{Linux-Einführung}}
\begin{frame}
\begin{center}
\Huge\faIcon{linux} \\
\vspace{4mm}
\normalsize Wer hat schon mal etwas mit Linux zu tun gehabt?
\end{center}
\end{frame}
\subsection{Überblick}
\begin{frame}{Was ist das?}
\begin{itemize}
\item Freies Betriebssystem, Alternative zu z.B. Windows und macOS
\item Gibt es in vielen Varianten
\item Beliebt als Server-Betriebssystem, auf Privatcomputern seltener
\begin{itemize}
\item Unter Colis aber beliebt
\end{itemize}
\item Am Institut laufen fast alle Computer mit Linux
\end{itemize}
\end{frame}
\begin{frame}{Wie bedient man das?}
\begin{itemize}
\item Es gibt grafische Oberflächen (wie bei Windows und macOS)...
\item ... aber auch rein textbasierte Oberflächen
\item Letztere nutzt man sehr häufig auf Servern
\end{itemize}
\end{frame}
\begin{frame}{Die Konsole}
\begin{itemize}
\item Gewöhnungsbedürftig, kann aber sehr viel
\item Am Institut: \keys{Alt + F2}, dann "`\textit{konsole}"' eingeben, um Konsole zu öffnen (oder im Startmenü suchen)
\item Am eigenen Computer: Verbindung zum Pool aufbauen über einen "`SSH-Client"'
\item Suchmaschine hat auf (fast) alles eine Antwort
\end{itemize}
\end{frame}
\begin{frame}{In den Pool gehen, ohne in den Pool zu gehen: SSH}
\textbf{Mit Linuxrechnern verbinden - \structure{ssh} (\structure{s}ecure \structure{sh}ell)}
\begin{itemize}
\item Remote-Zugriff auf ein Linux-Terminal von zu Hause aus
\item Optional auch mit grafischer Oberfläche (läuft nicht immer flüssig)
\item Linux/Mac/Windows 10 zu Hause? Prima!
\begin{itemize}
\item \texttt{ssh \textless login\textgreater @last.cl.uni-heidelberg.de}
\item \texttt{ssh \textless login\textgreater @ella.cl.uni-heidelberg.de}
\item \texttt{ssh \textless login\textgreater @pool.cl.uni-heidelberg.de -p 2222} (Ausnahme!)
\item ...
\end{itemize}
\item Ansonsten gibt's für Windows z.B. \href{https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html}{PuTTY}
\item Empfehlung: Mal ausprobieren, bei Problemen melden
\end{itemize}
\end{frame}
\begin{frame}{Benutzung der Pool-Rechner}
\begin{itemize}
\item Rechner, wenn ihr sie nicht braucht, auf \textbf{Standby} (= Sleep) schalten
\item Wenn ihr nur kurz weg seid: Standby-Modus (sperrt auch automatisch die Sitzung)
\item Bei Verlassen des Rechners: Abmelden, \textbf{danach "`Sleep"' anklicken}
\item Bildschirm aus? \textbf{Taste drücken}
\item Rechner aus? Ignorieren (wir kümmern uns drum)
\item In den tiefen Stunden der Nacht werden alle Rechner einmal neu gestartet
\end{itemize}
\end{frame}
\begin{frame}{Computer, User und Dateien}
\begin{itemize}
\item Computer, User und Daten sind nicht aneinander gebunden
\item viele User an einem Computer
\item pers\"onliche Daten an allen Computern (Home-Verzeichnisse)
\item Euer Speicherplatz im home-Verzeichnis ist begrenzt!\\ Derzeitigen Stand
abfragen: \alert{quota -s}
\begin{itemize}
\item Speicherplatz: Soft \textbf{37 GB}, Hard \textbf{42 GB}
\item {\lq}Dateien{\rq}: Soft \textbf{200.000}, Hard \textbf{250.000}
\end{itemize}
\item \textcolor{cwarning}{Zugriffssperre}: Wer zu lange über der quota ist, wird gesperrt.
\item Kein Problem: muss man nur aufr\"aumen (nur Papierkorb reicht nicht)
\end{itemize}
\end{frame}
\begin{frame}{Platzangst: Projektverzeichnisse}
\begin{itemize}
\item Für größere Softwareprojekte könnt ihr bei uns um ein Projektverzeichnis bitten
\item Genauso wie die Home-Verzeichnisse auf allen Computern verfügbar
\end{itemize}
\end{frame}
\subsection{Grundlagen und einfache Befehle}
\begin{frame}[fragile]{Der Prompt}
\begin{semiverbatim}
moser@pool10:~\$
moser@pool03:~/Desktop\$
moser@ella:/home/students/\$
\end{semiverbatim}
\begin{tabular}{ l l }
\texttt{moser} & Username \\
\texttt{@} & \textit{Trennsymbol}\\
\texttt{pool10} & Hostname (z.B. \texttt{pool15} oder \texttt{ella})\\
\texttt{:} & \textit{Trennsymbol}\\
\texttt{\textasciitilde} & Aktuelles Verzeichnis\\
\texttt{\$} & \textit{Trennsymbol}
\end{tabular}
\end{frame}
\begin{frame}{Linux Baumstruktur}
\begin{itemize}
\item Innerhalb von Verzeichnissen können neben Dateien weitere Verzeichnisse liegen
\item Ähnelt der Struktur eines Baumes mit vielen Verzweigungen
\item Wo eine Datei liegt, wird anhand ihres \textbf{Pfades} beschrieben
\item Übrigens: Die Endungen von Dateien sind Linux egal. \texttt{tagebuch.txt} kann auch ein \texttt{gif} sein.
\end{itemize}
\end{frame}
\begin{frame}{Linux Baumstruktur}
\includegraphics[width=\textwidth]{../img/baumstruktur.png}
% https://publicdomainvectors.org/en/free-clipart/Barren-tree/49392.html
\end{frame}
\begin{frame}{Pfade}
\textbf{Absolute Pfade}
\begin{itemize}
\item beschreiben den Ort einer Datei vom Wurzelverzeichnis aus \alert{/}
\item sind im System eindeutig
\item z.B. \alert{/home/students/hfischer/folien/einfuehrung.pdf}
\end{itemize}
\textbf{Relative Pfade}
\begin{itemize}
\item beschreiben den Ort abhängig vom aktuellen ``Aufenthaltsort'' oder dem Benutzer
\item beginnen mit einem relativen Anker (\alert{\textasciitilde} oder \alert{.} oder \alert{..})
\item \alert{\textasciitilde/folien/einfuehrung.pdf}\\
\alert{./folien/einfuehrung.pdf} (= \alert{folien/einfuehrung.pdf}) \\
\alert{../hfischer/folien/einfuehrung.pdf}\\
\end{itemize}
\end{frame}
\begin{frame}{Pfade: Anker}
Alle Dateipfade beginnen also mit einem Anker:
\begin{tabular}{ l l }
\alert{/} & Das Wurzelverzeichnis (root-Verzeichnis) \\
\alert{\textasciitilde} & Das eigene Homeverzeichnis. \\
& (normalerweise unter \alert{/home/students/\textit{username}}) \\
\alert{.} & Das aktuelle Verzeichnis. \\
& (Diesen Anker kann man oft weglassen) \\
\alert{..} & Das überliegende Verzeichnis
\end{tabular}
\smallskip % Die Leerzeile darüber muss bleiben!
Wichtig außerdem: Gro{\ss}- und Kleinschreibung macht einen Unterschied!
\end{frame}
\begin{frame}{Befehle}
\begin{itemize}
\item Hinter Befehle kann oder muss man üblicherweise Parameter schreiben.
\item Beispiel: \texttt{ls -a /home/students/piersig}
\item Man beachte, dass Befehlsname und etwaige Parameter jeweils mit einem Leerzeichen voneinander getrennt werden.
\end{itemize}
\end{frame}
\begin{frame}{Navigation im Baum}
\textbf{Verzeichnis wechseln - \structure{cd} (\structure{c}hange \structure{d}irectory)}\\
\begin{description}[\alert{cd \textless absoluter Pfad\textgreater}]
\item[\alert{cd \textless absoluter Pfad\textgreater}] wechselt in den angegebenen absoluten Pfad
\item[\alert{cd \textless relativer Pfad\textgreater}] wechselt in den angegebenen relativen Pfad
\item[\alert{cd \textasciitilde}]wechselt in das eigene Homeverzeichnis (noch kürzer: nur \alert{cd})
\item[\alert{cd ..}]wechselt in das höher gelegene Verzeichnis
\item[...]
\end{description}
\smaller
\textbf{Beispiele:}\\
\alert{cd /home/students/moser/} wechselt ins Home des Users \textit{moser}\\
\alert{cd Desktop} wechselt in das Verzeichnis \textit{Desktop} im aktuellen Verzeichnis\\
\alert{cd} wechselt ins Home-Verzeichnis des eingeloggten users\\
\end{frame}
\begin{frame}{Ordnerverwaltung}
\textbf{aktuellen Pfad anzeigen - \structure{pwd} (\structure{p}rint \structure{w}orking \structure{d}irectory) }\\[0.5cm]
\textbf{Ordnerinhalte anzeigen - \structure{ls} (\structure{l}i\structure{s}t directory contents)}
\begin{description}
\item[\alert{ls \textless Pfad\textgreater}]zeigt Inhalt des entsprechenden Verzeichnisses
\item[\alert{ls}]zeigt Inhalt des aktuellen Verzeichnisses
\item[\alert{ls -l}] zeigt den Inhalt + allerlei n\"utzliche Informationen
\item[\alert{ls -la}] zeigt den Inhalt + Informationen + versteckte Dateien an\\[0.5cm]
\end{description}
\textbf{Ordner erstellen - \structure{mkdir} (\structure{m}a\structure{k}e \structure{dir}ectory) }
\begin{description}
\item[\alert{mkdir einOrdner}]erstellt Ordner \texttt{einOrdner} in aktuellem Verzeichnis
\item[\alert{mkdir \textasciitilde/einOrdner}] erstellt Ordner \texttt{einOrdner} im home Verzeichnis
\end{description}
\end{frame}
\begin{frame}{Dateiverwaltung I}
\textbf{Dateien kopieren - \structure{cp} (\structure{c}o\structure{p}y files and directories)}
\begin{description}
\item[\alert{cp eineDatei ../eineDatei}]kopiert \texttt{eineDatei} in das übergelegene Verzeichnis
\item[\alert{cp -r einOrdner einOrdner2}]kopiert \texttt{einOrdner} (ins selbe Verzeichnis)\\[0.5cm]
\end{description}
\textbf{Dateien verschieben/umbenennen - \structure{mv} (\structure{m}o\structure{v}e/rename files)}:
\begin{description}
\item[\alert{mv -i file1 file2}] benennt die Datei \texttt{file1} in \texttt{file2} um (bestätigen mit \keys{Y})
\item[\alert{mv -i pfad1/file pfad2/file}] verschiebt die Datei
\end{description}
Wenn ihr \alert{-i} weglasst, werden Dateien ggfs. ohne Rückfrage überschrieben. Überschriebene Dateien sind \textbf{\textcolor{cwarning}{weg}}!\\[0.5cm]
\end{frame}
\begin{frame}{Dateiverwaltung II}
\textbf{Dateien löschen - rm (\structure{r}e\structure{m}ove files or directories)}
\begin{description}
\item[\alert{rm -i \textless Datei\textgreater}] löscht eine Datei
\item[\alert{rm -i -r \textless Verzeichnis\textgreater}] löscht ein ganzes Verzeichnis mit Inhalt und Unterordnern
\end{description}
Mit \alert{rm} entfernte Dateien sind auch \textbf{\textcolor{cwarning}{weg}}! (nicht im Papierkorb)
Und wenn ihr \alert{-i} weglasst, gibt es noch nicht mal eine Rückfrage...
\end{frame}
\begin{frame}{Textdateien anschauen und anlegen}
\textbf{Textdateien betrachten - \structure{cat}}
\begin{description}
\item[\alert{cat \textless Dateiname\textgreater}] schreibt den Inhalt einer Textdatei ins Terminal
% \item[\alert{/}] sucht einen Begriff $\rightarrow$ \structure{n} zeigt nächstes Suchergebnis
% \item[\alert{q}] beendet die Leseansicht\\[0.5cm]
\end{description}
\textbf{Leere Dateien anlegen - \structure{touch}}
\begin{description}
\item[\alert{touch \textless Dateiname\textgreater}] legt eine leere Datei mit dem entsprechenden Namen an
\end{description}
\end{frame}
\begin{frame}{Textdateien editieren}
\textbf{Texteditoren}
\begin{itemize}
\item Es gibt eine breite Auswahl an Editoren für das Terminal
\item Natürlich sind nicht unbedingt alle auf jedem System standardmäßig installiert
\item Beliebte Editoren: \texttt{nano}, \texttt{vi}, \texttt{vim}, \texttt{emacs}
\item Neue Datei anlegen oder existierende bearbeiten z.B. mit \\
\textbf{\alert{vim \textless Dateiname\textgreater}}
\end{itemize}
\textbf{Trick 17: Ausgabeweiterleitung mit \texttt{\textgreater, \textgreater\textgreater}}
\begin{description}
\item[\alert{echo "Hallo" \texttt{ \textgreater\textgreater} hallo.txt}] hängt ``Hallo'' an den Inhalt der Datei \texttt{hallo.txt} an
\end{description}
\end{frame}
\begin{frame}{Auf den Spuren Gutenbergs}
\textbf{Dateien drucken - \structure{lp} (\structure{l}ine \structure{p}rinter devices)}
\begin{description}
\item[\alert{lp -h miller \textless Pfad\textgreater}]sendet die Datei zum Standard-Drucker
\item idealerweise \texttt{.txt} oder \texttt{.pdf} Dateien\\[0.5cm]
\end{description}
\textbf{Druck-Status \"uberpr\"ufen}
\begin{itemize}
\item Web-Interface unter \structure{\url{http://miller:631/jobs}}
\item g\"unstiger Seitenpreis von kostenlos Euro
\item Quota: pro User 30 Seiten pro 7 Tage
\end{itemize}
\end{frame}
\begin{frame}{Wir nehmen einfach die Datei und schieben sie auf last}
\textbf{Dateien übers Netzwerk verschieben - rsync}
\begin{description}
\item[\alert{rsync \textless Quelle\textgreater\ \textless Ziel\textgreater}] kopiert die Datei von der Quelle ans Ziel
\item[\alert{rsync hi.txt hfischer@last.cl.uni-heidelberg.de:\textasciitilde /briefe/}] kopiert die Datei \texttt{hi.txt} aus dem lokalen Working Directory auf den Server last in das Home-Verzeichnis des Nutzers in den Unterordner \texttt{briefe}
\end{description}
\end{frame}
\begin{frame}{Linux Manual Pages}
\textbf{Hilfe zu Befehlen - \structure{man} (\structure{man}ual pager utils)}
\begin{description}
\item[\alert{man \textless Befehl\textgreater}]zeigt die Man-Page zum angegebenen Befehl
\end{description}
\smaller
\textbf{Beispiel:}\\
\alert{man man} Wie, wozu und weshalb nutze ich eigentlich \texttt{man}?
\medskip
\normalsize
Wem die Konsole noch zu unheimlich ist, dem sei \url{https://linux.die.net/man/} ans Herz gelegt, oder ihr benutzt eine Suchmaschine.
\end{frame}
\begin{frame}{Wildcards}
\textbf{Der Asterisk}
\begin{itemize}
\item erfasst mehrere Dateien gleichzeitig
\item ersetzt beliebig viele Zeichen (auch null)\\[0.5cm]
\end{itemize}
\textbf{Beispiel: \structure{rm *.txt}}\\
\begin{itemize}
\item \texttt{lel.txt} - wird gelöscht
\item \texttt{lel.pdf} - wird nicht gelöscht
\item \texttt{asd.txt} - wird gelöscht
\item \texttt{lel.pdf.txt} - wird gelöscht
\end{itemize}
Erinnerung: Dateiendungen sind für den User, nicht für das System!
\end{frame}
\begin{frame}{Weitere nützliche Befehle}
\begin{description}
\item[\alert{grep}] Im Inhalt von Dateien suchen
\item[\alert{find}] Dateien suchen (z.B. nach Namen)
\item[\alert{less}] Textdatei in einem Pager ansehen, inklusive Suchfunktion
\item[\alert{head}] Die ersten paar Zeilen einer Datei ausgeben
\item[\alert{tail}] Die letzten paar Zeilen einer Datei ausgeben
\end{description}
Gute Quellen für mehr Informationen zu einem Befehl sind neben \alert{man}
Websites wie \href{https://wiki.ubuntuusers.de}{\texttt{wiki.ubuntuusers.de}} oder \href{https://www.cyberciti.biz/faq}{\texttt{www.cyberciti.biz/faq}}.
\end{frame}
\subsection{Arbeiten im Netzwerk und mit Anderen}
\begin{frame}{Netzwerke und ihre Benutzer}
\textbf{Rechner im Netzwerk}
\begin{itemize}
\item{alle Rechner sind im Netz}
\item{alle User können auf viele Rechner}
\item{allen Usern stehen dieselben Daten zur Verfügung}
\item{allen Usern stehen dieselben Resourcen zur Verfügung}
\end{itemize}
\textbf{User und Gruppen}
\begin{itemize}
\item jeder User hat einen Usernamen und mind. eine Gruppe (students/mitarb)
\item z.B.: \alert{schubert} in \alert{students}
\item alle Gruppen kann man mit dem \alert{groups} Befehl auflisten
\end{itemize}
\end{frame}
\begin{frame}{Zugriffsrechte I}
Die UNIX-Kürzel für drei Zugriffstypen:
\begin{description}[r]
\item[\alert{r}]Leserechte. Erlaubnis, die Datei zu lesen bzw. den Verzeichnisinhalt einzusehen
\item[\alert{w}]Schreibrechte: Erlaubnis, die Datei zu verändern oder gar zu löschen
\item[\alert{x}]Ausführrechte (eXecute): Erlaubnis, die Datei als Programm auszuführen
\end{description}
\vspace{1.5em}
Und für die Klassen der User- und Gruppenverwaltung:
\begin{description}[r]
\item[\alert{u}]Der User, dem die Datei gehört
\item[\alert{g}]Die User, die in der Gruppe sind, der die Datei gehört
\item[\alert{o}]Alle anderen User des Systems
\end{description}
\end{frame}
\begin{frame}{Zugriffsrechte II}
Welche Zugriffsrechte nun für eine Datei oder ein Verzeichnis gesetzt sind, sieht man mit \alert{ls -l \textless Pfad\textgreater}.
\\[.5cm]
Zwei typische Einträge könnten so aussehen:\\
{\color{cwarning}\texttt{ uuugggooo\\}}
\texttt{drwxrwxrwx 160 moser students 5440 Oct 21 21:25 topics\\
-rw-r----- 145 moser students 2670 Mar 18 13:12 cheat}
\\[.5cm]
Die erste Datei ist hier ein Verzeichnis (Directory), das User, Group und Other lesen, verändern und betreten dürfen.
Die zweite Datei ist kein Verzeichnis, nur der User darf lesen und schreiben, die Gruppe darf nur lesen, und die anderen dürfen überhaupt nichts.
\end{frame}
\begin{frame}{Zugriffsrechte III}
\textbf{Dateirechte verändern - \structure{chmod} (\structure{ch}ange \structure{mod}e)}
\begin{description}[Hi] % Das Hi definiert nur, dass die Einrückung zwei Zeichen weit sein soll
\item[\alert{chmod \textless Klasse(n)\textgreater\textbf{+}\textless Rechte\textgreater \hspace{1pt} \textless Datei\textgreater}]\hspace{10cm}Vergibt den angegebenen Klassen die angegebenen Rechte
\item[\alert{chmod \textless Klasse(n)\textgreater \textbf{-}\textless Rechte\textgreater \hspace{1pt} \textless Datei\textgreater}]\hspace{10cm}Entzieht den angegebenen Klassen die angegebenen Rechte
\end{description}
\smaller
\textbf{Beispiele:}\\
\alert{chmod go-rwx \textless Datei\textgreater} entzieht den Usern in der Gruppe und den anderen Lese-, Schreib- und Ausführrechte \\
\alert{chmod u+w \textless Datei\textgreater} gibt dem Besitzer Schreibrechte\\
\alert{chmod a-w \textless Datei\textgreater} entzieht allen die Schreibrechte (= \alert{chmod ugo-w})
\normalsize
\textit{Datei} kann hier immer auch ein \textit{Verzeichnis} sein.
\end{frame}
\begin{frame}{Mit Linux herumspielen und den Pooltest absolvieren}
\begin{center}
\includegraphics[width=0.8\textwidth]{../img/yalikejazz.png}
\\
\url{https://yalikejazz.cl.uni-heidelberg.de/}
\end{center}
\end{frame}
\begin{frame}{Mit Linux herumspielen und den Pooltest absolvieren}
\begin{itemize}
\item Ermöglicht euch, gefahrlos mit einem Linux-Terminal herumzuspielen und Befehle zu üben.
\item Es gibt einige Übungsaufgaben im Stile der Aufgaben, die im Pooltest abgefragt werden.
\item Weil die Linux-Umgebung lediglich im Browser simuliert wird, sind nicht alle üblichen Programme verfügbar. Besonders relevant: es gibt \textbf{kein} \texttt{nano}, \texttt{vim} oder \texttt{emacs}.
\begin{itemize}
\item Falls ein Texteditor nötig ist, kann man \texttt{vi} verwenden. Hier gelten die gleichen Tastenkürzel wie bei \texttt{vim}, also insbesondere die komplizierte Methodik zum Schließen des Editors: \keys{ESC} + \texttt{:wq} zum Speichern und \keys{ESC} + \texttt{:q!} zum Verwerfen der Änderungen.
\item Zum Füllen einer Textdatei braucht es nicht immer einen Editor.
\end{itemize}
\end{itemize}
\end{frame}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment