Multiple Section added
This commit is contained in:
parent
6d60de9b8c
commit
c1021dcca2
@ -4,6 +4,7 @@
|
||||
% load other documents
|
||||
%------------------------------------------
|
||||
\input{Kapitel1/BashKonfiguration}
|
||||
\newpage
|
||||
\input{Kapitel1/ShellGedaechnis}
|
||||
\input{Kapitel1/BefehleMehrzeilig}
|
||||
\newpage
|
||||
|
@ -1,13 +1,224 @@
|
||||
\section{Shell Ged"achnis}
|
||||
%-------------------------------------------------------------------------------
|
||||
% Section: Allgemein
|
||||
%-------------------------------------------------------------------------------
|
||||
\subsection{Allgemein}
|
||||
\begin{justify}
|
||||
Die bereits eingegebenen Befehle werden in der {\ttfamily ~/.bash\_history} gespeichert. Standardm"assig werden die letzten 500 Befehle eingetragen. Mit {\ttfamily uws@tux>echo
|
||||
\$HISTSIZE} kann man sich den Wert anzeigen lassen. M"ochte man mehr Befehle speichern,
|
||||
so kann das mit {\ttfamily uws@tux>export HISTSIZE=700} gemacht werden.\\[1ex]
|
||||
Die Suchfunktion schaltet man mit {\ttfamily [strg+R]} oder {\ttfamily [strg+s]} ein.
|
||||
Der Prompt ver"andert sich nun und den zu suchenden Befehl kann eingegebn werden.
|
||||
Die Bash vervollst"andigt die Eingabe Automatisch. Um weiter zu suchen, einfach die
|
||||
Tastenkombination noch einmal machen. Der gefundene Befehl wird dann mit einem
|
||||
{\ttfamily Enter} abgeschickt oder mit dem dr"ucken der {\ttfamily Esc-Taste} kann
|
||||
man den Befehl noch editieren.\\[1ex]
|
||||
Mit {\ttfamily uws@tux>fc -l -10} werden die 10 letzten Befehle angezeigt.
|
||||
Die bereits eingegebenen Befehle werden in der {\ttfamily ~/.bash\_history} gespeichert. Standardm"assig werden die letzten 500 Befehle eingetragen. Die Suchfunktion schaltet man mit {\ttfamily [strg+R]} oder {\ttfamily [strg+s]} ein. Der Prompt ver"andert sich nun und den zu suchenden Befehl kann eingegebn werden. Die Bash vervollst"andigt die Eingabe Automatisch. Um weiter zu suchen, einfach die Tastenkombination noch einmal machen. Der gefundene Befehl wird dann mit einem {\ttfamily Enter} abgeschickt oder mit dem dr"ucken der {\ttfamily Esc-Taste} kann man den Befehl noch editieren.
|
||||
%-------------------------------------------------------------------------------
|
||||
% Section: Konfiguration
|
||||
%-------------------------------------------------------------------------------
|
||||
\subsection{Konfiguration}
|
||||
Für die Bash History gibt es mehrere Variablen, einige sind in der nächsten Tabelle aufgeführt.
|
||||
\begin{longtable}[l]{p{3cm}p{13cm}}
|
||||
\rowcolor{hellgrau}\multicolumn{1}{l}{\textbf{Variable}} & \multicolumn {1}{l}{\textbf{Beschreibung}} \\
|
||||
\hline
|
||||
\hline
|
||||
\endfirsthead
|
||||
%\multicolumn{2}{c}{{\bfseries \tablename \thetable{} continued from previous page.}} \\
|
||||
\multicolumn{2}{r}{{\bfseries continued from previous page.}} \\
|
||||
\rowcolor{hellgrau}\multicolumn{1}{l}{\textbf{Variable}} & \multicolumn {1}{l}{\textbf{Beschreibung}} \\
|
||||
\hline
|
||||
\hline
|
||||
\endhead
|
||||
%\multicolumn{2}{r}{{\bfseries \tablename \thetable{} Continued on next page}} \\
|
||||
\multicolumn{2}{r}{{\bfseries Continued on next page}} \\
|
||||
\endfoot
|
||||
\caption{Bash History Variablen} \\
|
||||
\endlastfoot
|
||||
HISTFILE & Name und Pfad der Bash History Datei\\
|
||||
HISTFILESIZE & Angabe der maximalen Einträge in der Datei\\
|
||||
HISTSIZE & Angabe der Einträge im History Buffer\\
|
||||
HISTCONTROL & Hiermit kann man steuern, was in der History gespeichert werden soll\\
|
||||
HISTTIMEFORMAT & Angabe des Datums Formats\\
|
||||
\end{longtable}
|
||||
Für die Vatiable HISTCONTROL gibt es folgende Werte:
|
||||
\begin{itemize}
|
||||
\item ignorespace - Ignorieren von Befehlen die am Anfang ein Leerzeichen haben
|
||||
\item ignoredups - Ignorieren von doppelten Kommandos
|
||||
\item ignoreboth - Beide Werte
|
||||
\end{itemize}
|
||||
Bei der Angabe des Datum Formats kann man folgende Werte setzen.
|
||||
\begin{itemize}
|
||||
\item \verb|%|F - Datum
|
||||
\item \verb|%|T - Uhrzeit
|
||||
\end{itemize}
|
||||
Hier ein paar Beispiele.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Beispiele Variablen]
|
||||
uws@tux>grep HIST .bash_history
|
||||
export HISTTIMEFORMAT='%F %T - '
|
||||
|
||||
export HISTCONTROL=ignoreboth
|
||||
|
||||
export HISTSIZE=10000
|
||||
export HISTFILESIZE=10000
|
||||
\end{lstlisting}
|
||||
%-------------------------------------------------------------------------------
|
||||
% Section: Alle Befehle speichern
|
||||
%-------------------------------------------------------------------------------
|
||||
\subsection{Alle Befehle speichern}
|
||||
Es werden in der Bash History nur die Einträge der aktuellen Sitzung gespeichert. Möchte man aus allen Sitzungen die Befehle speichern, so muss die Variabe PROMPT\verb|_|COMMAND gesetzt werden.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Alle Commands]
|
||||
export PROMPT_COMMAND='history -a'
|
||||
\end{lstlisting}
|
||||
\newpage
|
||||
%-------------------------------------------------------------------------------
|
||||
% Section: Navigation
|
||||
%-------------------------------------------------------------------------------
|
||||
\subsection{Navigation}
|
||||
Um mit der Bash History Arbeiten zu können, gibt es folgende Shortcuts dafür.
|
||||
\begin{longtable}[l]{p{5cm}p{11cm}}
|
||||
\rowcolor{hellgrau}\multicolumn{1}{l}{\textbf{Shortcuts}} & \multicolumn {1}{l}{\textbf{Beschreibung}} \\
|
||||
\hline
|
||||
\hline
|
||||
\endfirsthead
|
||||
%\multicolumn{2}{c}{{\bfseries \tablename \thetable{} continued from previous page.}} \\
|
||||
\multicolumn{2}{r}{{\bfseries continued from previous page.}} \\
|
||||
\rowcolor{hellgrau}\multicolumn{1}{l}{\textbf{Shortcuts}} & \multicolumn {1}{l}{\textbf{Beschreibung}} \\
|
||||
\hline
|
||||
\hline
|
||||
\endhead
|
||||
%\multicolumn{2}{r}{{\bfseries \tablename \thetable{} Continued on next page}} \\
|
||||
\multicolumn{2}{r}{{\bfseries Continued on next page}} \\
|
||||
\endfoot
|
||||
\caption{Bash History Shortcuts} \\
|
||||
\endlastfoot
|
||||
\verb|[Strg]+[P]| & Ein Kommndo zurück (analog zu [Pfeil-oben])\\
|
||||
\verb|[Strg]+[N]| & Ein Kommando weiter (analog zu [Pfeil-unten])\\
|
||||
\verb|[Strg]+[R]| & Rückwärtssuche\\
|
||||
\verb|[Strg]+[S]| & Vorwärtssuche\\
|
||||
\verb|[Strg]+[O]| & Führt das gefundene Kommando aus\\
|
||||
\verb|[Strg]+[G]| & Abbruch der Suche\\
|
||||
\verb|[Alt]+[<]| & Zum Anfang der History springen\\
|
||||
\verb|[Alt]+[Umschalt]+[<]| & Zum Ende der History gehen\\
|
||||
\end{longtable}
|
||||
%-------------------------------------------------------------------------------
|
||||
% Section: Bash History expansion
|
||||
%-------------------------------------------------------------------------------
|
||||
\subsection{Bash History Erweiterung}
|
||||
In der nachfolgenden Tabelle sind die Bash History expamsion commands aufgelistet.
|
||||
\begin{longtable}[l]{p{2cm}p{14cm}}
|
||||
\rowcolor{hellgrau}\multicolumn{1}{l}{\textbf{Expansion}} & \multicolumn {1}{l}{\textbf{Beschreibung}} \\
|
||||
\hline
|
||||
\hline
|
||||
\endfirsthead
|
||||
%\multicolumn{2}{c}{{\bfseries \tablename \thetable{} continued from previous page.}} \\
|
||||
\multicolumn{2}{r}{{\bfseries continued from previous page.}} \\
|
||||
\rowcolor{hellgrau}\multicolumn{1}{l}{\textbf{Expansion}} & \multicolumn {1}{l}{\textbf{Beschreibung}} \\
|
||||
\hline
|
||||
\hline
|
||||
\endhead
|
||||
%\multicolumn{2}{r}{{\bfseries \tablename \thetable{} Continued on next page}} \\
|
||||
\multicolumn{2}{r}{{\bfseries Continued on next page}} \\
|
||||
\endfoot
|
||||
\caption{Bash History expansion commands} \\
|
||||
\endlastfoot
|
||||
\verb|!!| & Ausführen des letzten Befehls, wie !-1\\
|
||||
\verb|!N| & Ausführen des N-te Befehls\\
|
||||
\verb|!-N| & Ausführen des neusten N Befehls\\
|
||||
\verb|!:^| & Verwendet das erste Argument des aktuellsten Befehls in dem Bash-Verlauf\\
|
||||
\verb|!:N| & Verwendet das N-te Argument des aktuellsten Befehls in dem Bash-Verlauf\\
|
||||
\verb|!:$| & Verwendet das letzte Argument des aktuellsten Befehls in dem Bash-Verlauf\\
|
||||
\verb|!:*| & Verwendet alle Argumente des letzten Befehls in dem Bash-Verlauf\\
|
||||
\end{longtable}
|
||||
Hier ein paar Beispiele zu den Expansions.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Beispiele Expansion Commands]
|
||||
uws@tux>history
|
||||
1 echo "eins"
|
||||
2 echo "zwei"
|
||||
3 echo "drei"
|
||||
4 echo "vier"
|
||||
5 echo "fuenf"
|
||||
6 echo "sechs"
|
||||
|
||||
uws@tux># Man kann auch einen Befehl vor der Expansion setzten
|
||||
uws@tux># wie z.B. sudo !!
|
||||
uws@tux>!!
|
||||
echo "sechs"
|
||||
sechs
|
||||
|
||||
uws@tux>!3
|
||||
echo "drei"
|
||||
drei
|
||||
|
||||
uws@tux>!-2
|
||||
echo "fuenf"
|
||||
fuenf
|
||||
|
||||
uws@tux>mkdir uws
|
||||
uws@tux>cd !:^
|
||||
cd uws
|
||||
|
||||
uws@tux>mv backup.tar backupold.tar
|
||||
uws@tux>tar -xf !:2
|
||||
tar -xf backupold.tar
|
||||
\end{lstlisting}
|
||||
%-------------------------------------------------------------------------------
|
||||
% Section: Bash History Modifier
|
||||
%-------------------------------------------------------------------------------
|
||||
\subsection{Bash History Modifier}
|
||||
Bash-Verlaufsmodifikatoren ergänzen Bezeichner, indem sie den Inhalt oder die Ausführung des Befehls ändern
|
||||
\begin{longtable}[l]{p{2cm}p{14cm}}
|
||||
\rowcolor{hellgrau}\multicolumn{1}{l}{\textbf{Modifier}} & \multicolumn {1}{l}{\textbf{Beschreibung}} \\
|
||||
\hline
|
||||
\hline
|
||||
\endfirsthead
|
||||
%\multicolumn{2}{c}{{\bfseries \tablename \thetable{} continued from previous page.}} \\
|
||||
\multicolumn{2}{r}{{\bfseries continued from previous page.}} \\
|
||||
\rowcolor{hellgrau}\multicolumn{1}{l}{\textbf{Modifier}} & \multicolumn {1}{l}{\textbf{Beschreibung}} \\
|
||||
\hline
|
||||
\hline
|
||||
\endhead
|
||||
%\multicolumn{2}{r}{{\bfseries \tablename \thetable{} Continued on next page}} \\
|
||||
\multicolumn{2}{r}{{\bfseries Continued on next page}} \\
|
||||
\endfoot
|
||||
\caption{Bash History modifiers} \\
|
||||
\endlastfoot
|
||||
\verb|:h| & Entfernt den nachgestellten Pfad aus einem Befehl. Nützlich, um einen Pfad ohne Dateinamen zu erhalten\\
|
||||
\verb|:t| & Entfernt den führenden Pfad aus einem Befehl. Nützlich, um einen Dateinamen ohne Pfad zu erhalten\\
|
||||
\verb|:r| & Entfernt die Extension vom Dateinamen\\
|
||||
\verb|:s| & Ermöglicht eine String-Ersetzung, vergleichbar mit dem Befehl sed.\\
|
||||
\end{longtable}
|
||||
Hier ein Beispiel für das ersetzen.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Beispiel Modifier]
|
||||
uws@tux>ls /tmp/*.txt
|
||||
Readme.txt
|
||||
|
||||
uws@tux>!:s/txt/log
|
||||
uws@tux>ls /tmp/*.log
|
||||
Datei1.log
|
||||
Datei2.log
|
||||
\end{lstlisting}
|
||||
%-------------------------------------------------------------------------------
|
||||
% Section: History Einträge löschen
|
||||
%-------------------------------------------------------------------------------
|
||||
\subsection{History Einträge löschen}
|
||||
Um alle Einträge aus der History zu entfernen, so gibt man den Parameter \verb|-|c an.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Clear History]
|
||||
uws@tux>history -c
|
||||
\end{lstlisting}
|
||||
%-------------------------------------------------------------------------------
|
||||
% Section: Beispiele
|
||||
%-------------------------------------------------------------------------------
|
||||
\subsection{Beispiele}
|
||||
Hier sind einige Beispiele für die Bash History.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Beispiele Expansion Commands]
|
||||
uws@tux>fc -l 24 26
|
||||
24 pveam available --section system
|
||||
25 pveam download local debian-12-standard_12.7-1_amd64.tar.zst
|
||||
26 pveam download local debian-12-standard_12.7-1_amd64.tar.zst
|
||||
|
||||
uws@tux>fc -l -5
|
||||
|
||||
|
||||
uws@tux>history 2
|
||||
33 fc -l 24 26
|
||||
34 history 2
|
||||
\end{lstlisting}
|
||||
\end{justify}
|
||||
|
@ -3,7 +3,7 @@
|
||||
\begin{justify}
|
||||
Neue Gruppen lassen sich mit dem Befehl {\ttfamily groupadd} anlegen.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Create Group, label=lst:bash]
|
||||
\begin{lstlisting}[captionpos=b, caption=Create Group]
|
||||
root@tux>groupadd <GruppenName>
|
||||
\end{lstlisting}
|
||||
\subsection{"Andern}
|
||||
@ -15,23 +15,24 @@ Eine bestehende Gruppe kann man mit dem Befehl {\ttfamily groupmod} "andern. In
|
||||
\hline
|
||||
-g & "Andern der Group ID.\\
|
||||
-a & Hinzuf"ugen einen Benutzers f"ur die Gruppe.\\
|
||||
-R & L"o"schen eines Benutzers aus der Gruppe.\\
|
||||
-U & Angabe der User\\
|
||||
-R & L"oschen eines Benutzers aus der Gruppe.\\
|
||||
\end{tabular}
|
||||
\caption{Optionen}
|
||||
\end{table}
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Modify Group, label=lst:bash]
|
||||
root@tux>groupmod -a <BenutzerName> <Gruppen>
|
||||
\begin{lstlisting}[captionpos=b, caption=Modify Group]
|
||||
root@tux>groupmod -a -U <BenutzerName> <Gruppen>
|
||||
\end{lstlisting}
|
||||
\subsection{L"oschen}
|
||||
Eine Gruppen kann man mit dem Befehl {\ttfamily groupdel} l"oschen.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Delete Group, label=lst:bash]
|
||||
\begin{lstlisting}[captionpos=b, caption=Delete Group]
|
||||
root@tux>groupdel <GruppenName>
|
||||
\end{lstlisting}
|
||||
\subsection{Anzeigen}
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Delete Group, label=lst:bash]
|
||||
\begin{lstlisting}[captionpos=b, caption=Delete Group]
|
||||
uws@tux>awk -F ':' '{print $1}' /etc/group
|
||||
\end{lstlisting}
|
||||
\end{justify}
|
||||
|
@ -3,6 +3,8 @@
|
||||
% load other documents
|
||||
%------------------------------------------
|
||||
\input{Kapitel10/User}
|
||||
\newpage
|
||||
\input{Kapitel10/Gruppen}
|
||||
\newpage
|
||||
\input{Kapitel10/LogonTime}
|
||||
\include{Kapitel10/UserAngemeldet}
|
||||
|
14
Kapitel12/CodeOSS.tex
Normal file
14
Kapitel12/CodeOSS.tex
Normal file
@ -0,0 +1,14 @@
|
||||
\section{CodeOSS}
|
||||
\begin{justify}
|
||||
Wenn im Editor die Tastenkombination {\ttfamily strg+v} nicht mehr funktioniert, so muss man in der Datei ~/.config/Code - OSS/User/keybinding.json folgendes eintragen.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Keybinding]
|
||||
uws@tux>cat keybinding.json
|
||||
[
|
||||
{
|
||||
"key": "ctrl+v",
|
||||
"command": "-editor.action.clipboardPasteAction"
|
||||
}
|
||||
]
|
||||
\end{lstlisting}
|
||||
\end{justify}
|
12
Kapitel12/CodeOSS.txt
Normal file
12
Kapitel12/CodeOSS.txt
Normal file
@ -0,0 +1,12 @@
|
||||
Im Editor funktioniert die Tastenkombination Strg+v nicht mehr.
|
||||
|
||||
Solution:
|
||||
|
||||
I unbound Ctrl+V from editor.action.clipboardPasteAction in ~/.config/Code - OSS/User/keybinding.json:
|
||||
|
||||
[
|
||||
{
|
||||
"key": "ctrl+v",
|
||||
"command": "-editor.action.clipboardPasteAction"
|
||||
}
|
||||
]
|
@ -15,4 +15,5 @@
|
||||
\include{Kapitel12/Conky}
|
||||
\input{Kapitel12/Youtube}
|
||||
\include{Kapitel12/LsDeluxe}
|
||||
\include{Kapitel12/AsciiArt}
|
||||
\input{Kapitel12/AsciiArt}
|
||||
\input{Kapitel12/CodeOSS}
|
@ -7,3 +7,4 @@
|
||||
\input{Kapitel13/Troubleshooting}
|
||||
\include{Kapitel13/VirtualBox}
|
||||
\include{Kapitel13/HyperV}
|
||||
\include{Kapitel13/Multipass}
|
202
Kapitel13/Multipass.tex
Normal file
202
Kapitel13/Multipass.tex
Normal file
@ -0,0 +1,202 @@
|
||||
\section{Multipass}
|
||||
%------------------------------------------------------------------------------
|
||||
% Subsection: Allgemein
|
||||
%------------------------------------------------------------------------------
|
||||
\subsection{Allgemein}
|
||||
\begin{justify}
|
||||
Mit dem Programm {\ttfamily Multipass} von der Firma Canonical, kann man Ubuntu VMs auf der Maschine einfach erstellen. Hierzu wird als Virtualisierung verschiedene Backends benutzt. Als Backend werden LXD, Libvirt, Qemu/KVM unterstützt. Die VMs werden standardmäßig in dem Verzeichnis \newline {\ttfamily /var/snap/multipass/common/data/multipassd/vault/instances} abgelegt.
|
||||
%------------------------------------------------------------------------------
|
||||
% Subsection: Installation
|
||||
%------------------------------------------------------------------------------
|
||||
\subsection{Installation}
|
||||
Am einfachsten ist es , das Programm aus dem Snap Store zu installieren. Es wird nicht nur das CLI-Command installiert, sonden auch eine einfache GUI.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Installation]
|
||||
uws@tux>sudo snap install multipass
|
||||
\end{lstlisting}
|
||||
%------------------------------------------------------------------------------
|
||||
% Subsection: VMs installieren
|
||||
%------------------------------------------------------------------------------
|
||||
\subsection{VMs installieren}
|
||||
Eine Liste, was alles installierbar ist, erhält man mit dem Befehl {\ttfamily multipass find.}.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=VMs]
|
||||
uws@tux>multipass find
|
||||
Image Aliases Version Description
|
||||
core core16 20200818 Ubuntu Core 16
|
||||
core18 20211124 Ubuntu Core 18
|
||||
core20 20230119 Ubuntu Core 20
|
||||
core22 20230717 Ubuntu Core 22
|
||||
core24 20240603 Ubuntu Core 24
|
||||
20.04 focal 20250127 Ubuntu 20.04 LTS
|
||||
.
|
||||
.
|
||||
\end{lstlisting}
|
||||
Es werden Standardmäßig für jede Instanz 1 CPU, 1 GB RAM und 5 GB am Speicher zugewiesen. Dieses kann man bei dem Installieren der VM ändern. Ohne Angabe der Option {\ttfamily \verb|--|name}, wird automatisch ein Name für die VM vergeben. Die Festplatte wird nicht direkt in der vollen Größe angelegt, sondern wachsend.
|
||||
\begin{longtable}[l]{p{2cm}p{14cm}}
|
||||
\rowcolor{hellgrau}\multicolumn{1}{l}{\textbf{Option}} & \multicolumn {1}{l}{\textbf{Beschreibung}} \\
|
||||
\hline
|
||||
\hline
|
||||
\endfirsthead
|
||||
%\multicolumn{2}{c}{{\bfseries \tablename \thetable{} continued from previous page.}} \\
|
||||
\multicolumn{2}{r}{{\bfseries continued from previous page.}} \\
|
||||
\rowcolor{hellgrau}\multicolumn{1}{l}{\textbf{Option}} & \multicolumn {1}{l}{\textbf{Beschreibung}} \\
|
||||
\hline
|
||||
\hline
|
||||
\endhead
|
||||
%\multicolumn{2}{r}{{\bfseries \tablename \thetable{} Continued on next page}} \\
|
||||
\multicolumn{2}{r}{{\bfseries Continued on next page}} \\
|
||||
\endfoot
|
||||
\caption{Optionen} \\
|
||||
\endlastfoot
|
||||
\verb|-|m & Zuweisung des RAM-Speichers, Angabe in K (Kilobyte), M (Megabyte) oder G (Gigabyte)\\
|
||||
\verb|-|d & Zuweisung des Festplatten-Speichers, Angabe in K (Kilobyte), M (Megabyte) oder G (Gigabyte)\\
|
||||
\verb|-|c & Anzahl der CPU\\
|
||||
\verb|--|name & Name der VM\\
|
||||
\end{longtable}
|
||||
Eine VM kann mit dem Image Namen oder mit dem Alias installiert werden.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=VM installieren]
|
||||
uws@tux>multipass launch 22.04 --name ubuntu-01 [-d 8G]
|
||||
\end{lstlisting}
|
||||
\newpage
|
||||
%------------------------------------------------------------------------------
|
||||
% Subsection: VMs nutzen
|
||||
%------------------------------------------------------------------------------
|
||||
\subsection{VMs nutzen}
|
||||
Auf einer laufender VM kann man mit den Befehlen {\ttfamily shell} oder {\ttfamily exec} zugreifen. Bei dem Befehl Shell wird man in der VM angemeldet und Exec führt einen Befehl in der VM aus.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=VM nutzen]
|
||||
uws@tux>multipass shell ubuntu-01
|
||||
Welcome to Ubuntu 24.04.2 LTS (GNU/Linux 6.8.0-51-generic x86_64)
|
||||
|
||||
* Documentation: https://help.ubuntu.com
|
||||
* Management: https://landscape.canonical.com
|
||||
* Support: https://ubuntu.com/pro
|
||||
|
||||
.
|
||||
.
|
||||
ubuntu@ubuntu-01:~$
|
||||
|
||||
uws@tux>multipass exec ubuntu-01 who
|
||||
ubuntu pts/0 2025-02-16 14:40 (10.80.122.1)
|
||||
|
||||
uws@tux># Sollen Optionen für den Beffehl mit angegeben werden,
|
||||
uws@tux># so müssen vor dem Befehl zwei Striche (--) gesetzt werden.
|
||||
uws@tux>multipass exec ubuntu-01 -- ls -la
|
||||
total 40
|
||||
drwxr-x--- 6 ubuntu ubuntu 4096 Feb 12 14:42 .
|
||||
drwxr-xr-x 3 root root 4096 Feb 12 12:01 ..
|
||||
drwx------ 3 ubuntu ubuntu 4096 Feb 12 13:45 .ansible
|
||||
.
|
||||
.
|
||||
\end{lstlisting}
|
||||
Wurde in einer VM z.B. Software nach installiert und man benötigt dann weitere Maschinen, so kann man mit {\ttfamily clone} die VM Klonen. Die VM darf für das Klonen nicht mehr laufen.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=VM Clone]
|
||||
uws@tux>multipass clone ubuntu-01 --name ubuntu-02
|
||||
Cloned from ubuntu-01 to ubuntu-02.
|
||||
\end{lstlisting}
|
||||
%------------------------------------------------------------------------------
|
||||
% Subsection: Austausch
|
||||
%------------------------------------------------------------------------------
|
||||
\subsection{Daten Austausch}
|
||||
Zwei Möglichkeiten gibt es, mit einer laufenden VM Daten auszutauschen, Entweder wird ein Verzeichnis vom Host zur VM gemounted oder man kopiert die Daten vom Host zur VM. Gibt man den Ziel Mount Point nicht an, so wird dieser in dem Home Verzeichnis des Benutzers Ubuntu angelegt. Wird nur das lokale Verzeichnis /home/uws/Bilder angegeben, so wird in der VM das Verzeichnis /home/ubuntu/Bilder angelegt und verbunden.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Daten Austausch]
|
||||
uws@tux>multipass mount /home/uws/Bilder ubuntu-01
|
||||
|
||||
uws@tux>multipass mount /home/uws/Bilder ubuntu-01:/home/ubuntu/Picture
|
||||
|
||||
uws@tux># Entfernt alle Mount Points
|
||||
uws@tux>multipass umount ubuntu-01
|
||||
uws@tux># Entfernen eines Mount Points
|
||||
uws@tux>multipass umount ubuntu-01:/home/ubuntu/Picture
|
||||
|
||||
uws@tux># Kopieren einer Datei
|
||||
uws@tux>multipass transfer ./main.py ubuntu-01:/home/ubuntu
|
||||
\end{lstlisting}
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
% Subsection: VMs Info
|
||||
%------------------------------------------------------------------------------
|
||||
\subsection{VMs Info}
|
||||
Man kann sich alle laufenden VMs anzeigen lassen oder sich Informationen über eine VM holen.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=VM Info]
|
||||
uws@tux># mit -vvvv eine erweiterte Ausgabe
|
||||
uws@tux>multipass list [-vvvv]
|
||||
Name State IPv4 Image
|
||||
ubuntu-01 Running 10.80.122.178 Ubuntu 24.04 LTS
|
||||
|
||||
uws@tux>ubuntu info ubuntu-01
|
||||
Name: ubuntu-01
|
||||
State: Running
|
||||
Snapshots: 0
|
||||
IPv4: 10.80.122.178
|
||||
Release: Ubuntu 24.04.2 LTS
|
||||
Image hash: 28d2f9df3ac0 (Ubuntu 24.04 LTS)
|
||||
CPU(s): 1
|
||||
Load: 0.00 0.00 0.00
|
||||
Disk usage: 2.3GiB out of 4.8GiB
|
||||
Memory usage: 331.0MiB out of 956.0MiB
|
||||
Mounts: --
|
||||
\end{lstlisting}
|
||||
%------------------------------------------------------------------------------
|
||||
% Subsection: VMs starten / stoppen
|
||||
%------------------------------------------------------------------------------
|
||||
\subsection{VMs starten / stoppen}
|
||||
VMs kann man mit den Vefehlen {\ttfamily start} oder {\ttfamily stop} starten oder stoppen-
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=VM Start / Stop]
|
||||
uws@tux>multipass stop ubuntu-01
|
||||
|
||||
uws@tux>multipass start ubuntu-01
|
||||
\end{lstlisting}
|
||||
%------------------------------------------------------------------------------
|
||||
% Subsection: VMs löschen
|
||||
%------------------------------------------------------------------------------
|
||||
\subsection{VMs löschen}
|
||||
Wird eine VM mit dem Befehl {\ttfamily delete} gelöscht, so wird sie nur deaktiviert. Mit dem Befehl {\ttfamily recover} kann man sie wieder herstellen. Ein endgültiges löschen erfolgt nach dem delete mit {\ttfamily purge}.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=VM löschen2]
|
||||
uws@tux># Deaktivieren einer VM
|
||||
uws@tux>multipass delete ubuntu-01
|
||||
|
||||
uws@tux># Wiederherstellen
|
||||
uws@tux>multipass recover ubuntu-01
|
||||
|
||||
uws@tux># Alle VMs endgültig löschen, die als deleted markiert sind
|
||||
uws@tux>multipass purge
|
||||
\end{lstlisting}
|
||||
\newpage
|
||||
%------------------------------------------------------------------------------
|
||||
% Subsection: VMs Konfiguration
|
||||
%------------------------------------------------------------------------------
|
||||
\subsection{VMs Konfigurieren}
|
||||
Möchte man nach einem erstellen einer VM z.B. die Anzahl der CPU ändern, so kann man das bei einer ausgeschalteten VM machen. Mit dem Befehl {\ttfamily multipass get \verb|--|keys} werden alle existierenden Schlüssel aufgelistet.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=List keys]
|
||||
uws@tux>multipass get --keys
|
||||
client.primary-name
|
||||
local.bridged-network
|
||||
local.driver
|
||||
local.image.mirror
|
||||
local.passphrase
|
||||
local.privileged-mounts
|
||||
local.ubuntu-01.bridged
|
||||
local.ubuntu-01.cpus
|
||||
local.ubuntu-01.disk
|
||||
local.ubuntu-01.memory
|
||||
\end{lstlisting}
|
||||
Einen einzelnen Wert kann man abfragen und neu setzen. Um einen Wert neu zu setzten, muss die VM ausgeschaltet sein, sonst gibt es eine Fehlermeldung.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Werte anzeigen / setzen]
|
||||
uws@tux># Einen Wert abfragen
|
||||
uws@tux>multipass get local.ubuntu-01.cpus
|
||||
1
|
||||
|
||||
uws@tux># Einen Wert neu setzten
|
||||
uws@tux>multipass set local.ubuntu-01.cpus=2
|
||||
\end{lstlisting}
|
||||
\end{justify}
|
@ -77,10 +77,16 @@ begonnen.
|
||||
\begin{lstlisting}[captionpos=b, caption=Blöcke mit offset]
|
||||
uws@tux>sudo dd if=/dev/sda1 of=/dev/sdb1 ibs=2KB obs=2KB skip=50
|
||||
\end{lstlisting}
|
||||
Iso-Image auf einem USB-Stick kopieren.
|
||||
Iso-Image oder Abblid einer Festplatte auf einem externen Datenträger kopieren.
|
||||
\listBash
|
||||
\begin{lstlisting}[captionpos=b, caption=Iso-Image]
|
||||
uws@tux>sudo dd if=/images/manjaro.iso of=/dev/sde bs=1M oflag=sync status=progress
|
||||
uws@tux># Iso-Image auf USB-Stick
|
||||
uws@tux>sudo dd if=/images/manjaro.iso of=/dev/sde bs=1M \
|
||||
oflag=sync status=progress
|
||||
|
||||
uws@tux># Abbild einer Festplatte
|
||||
uws@tux>sudo dd if=/dev/sda of=/run/media/stick/sda.img \
|
||||
bs=1M oflag=sync status=progress
|
||||
\end{lstlisting}
|
||||
Ein Backup von einer Festplatte und die erstellte Datei wird gezippt.
|
||||
\listBash
|
||||
|
BIN
LinuxBook.pdf
BIN
LinuxBook.pdf
Binary file not shown.
1403
LinuxBook.toc
1403
LinuxBook.toc
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user