<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>zInformatik &#187; Interessante Programme</title>
	<atom:link href="http://zinformatik.de/category/tipps-tricks/interessante-programme/feed/" rel="self" type="application/rss+xml" />
	<link>http://zinformatik.de</link>
	<description>Computer, Informatik und Mikrocontroller Blog</description>
	<lastBuildDate>Fri, 23 Jul 2010 21:22:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Die Z-Shell (zsh) &#8211; Eine mächtige Alternative zur Bash</title>
		<link>http://zinformatik.de/tipps-tricks/interessante-programme/die-z-shell-zsh-eine-machtige-alternative-zur-bash/</link>
		<comments>http://zinformatik.de/tipps-tricks/interessante-programme/die-z-shell-zsh-eine-machtige-alternative-zur-bash/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 15:44:52 +0000</pubDate>
		<dc:creator>zimon</dc:creator>
				<category><![CDATA[Interessante Programme]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntuusers-Planet]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Konsole]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://zinformatik.de/?p=1668</guid>
		<description><![CDATA[Die Standardshell auf den meisten Linux-Systemen ist die Bash. Sie ist schon sehr mächtig und erlaubt es viele Aufgaben zu automatisieren. Dieser Artikel soll sich einer sehr interessanten weil noch mächtigeren Shell widmen, der Z-Shell kurz zsh.
]]></description>
			<content:encoded><![CDATA[<p>Die Standardshell auf den meisten Linux-Systemen ist die Bash. Sie ist schon sehr mächtig und erlaubt es viele Aufgaben zu automatisieren. Dieser Artikel soll sich einer sehr interessanten weil noch mächtigeren Shell widmen, der Z-Shell kurz zsh.</p>
<p>Die zsh lässt sich auf quasi allen Linuxsystemen über die Paketverwaltung installieren. Unter Ubuntu z.B. mit dem Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">zsh</span></pre></div></div>

<p>Danach kann man sie mit dem Aufruf von <code>zsh</code> ausführen. Um sie zur Standardshell zu machen genügt der Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chsh</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">zsh</span> username</pre></div></div>

<p>Wobei <code>username</code> durch den entsprechenden Usernamen ersetzt werden muss und der Pfad zu <code>zsh</code> stimmen muss. Auf manchen Systemen liegt <code>zsh</code> in <code>/bin</code>. Wo <code>zsh</code> liegt kann man mit dem folgenden Befehl heraus finden:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">which</span> <span style="color: #c20cb9; font-weight: bold;">zsh</span></pre></div></div>

<p>Die zsh bedient sich Elementen der Bash, der Korn-Shell (ksh) und der TENEX-C-Shell (tcsh &#8211; eine erweiterte C-Shell). Sie ist sehr gut konfigurierbar und fast jedes Verhalten der Bash kann nachgeahmt werden so dass der Umstieg sehr leicht fällt. Bestehende Bash-Scripte können natürlich weiterhin genutzt werden, wenn der Shebang entsprechend gesetzt ist. Also in der ersten Zeile folgendes steht:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span></pre></div></div>

<p>Im Folgenden werde ich einige interessante Vorteile der zsh kurz beschreiben. Zu einzelnen Themen werde wahrscheinlich in anderen Artikel ausführlicher eingehen. Dies sollen also nur Beispiele sein, die die Mächtigkeit demonstrieren sollen. Da die zsh so viele Möglichkeiten bietet ist es nicht möglich hier alles im Detail zu erläutern. Optionen werden mit dem Befehl <code>setopt</code> gesetzt. Dies kann man auch so in die Konfigurationsdatei <code>~/.zshrc</code> schreiben.</p>
<p><strong>Autokorrektur</strong><br />
Die zsh beherrscht einen Mechanismus, der kleine Tippfehler automatisch korrigiert. Hat man in einem Ordner eine Datei <code>testfile.txt</code> und möchte diese kopieren nach <code>file2.txt</code>, so führt man in der Regel folgenden Befehl aus:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> testfile.txt file2.txt</pre></div></div>

<p>wie von der Bash gewohnt nutzt man dafür die Autovervollständigung mittels TAB. Bei einem Verschreiber wird dieser in der zsh automatisch korrigiert. Beispiel:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> tsetf<span style="color: #000000; font-weight: bold;">&lt;</span>TAB<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>wird automatisch korrigiert und zu</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> testfile.txt</pre></div></div>

<p>vervollständigt.</p>
<p>Die Autokorrektur aktiviert man mit der Option <code>correct</code></p>
<p><strong>Globale Aliase</strong><br />
Neben den normalen Aliasen für Kommandos, wie man sie aus der Bash kennt, gibt es in der zsh noch globale Aliase, die überall im Befehl genutzt werden können, nicht nur am Anfang. Zwei Beispiele verdeutlichen dies:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #660033;">-g</span> <span style="color: #007800;">G</span>=<span style="color: #ff0000;">'| grep'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #660033;">-g</span> <span style="color: #007800;">L</span>=<span style="color: #ff0000;">'| less'</span></pre></div></div>

<p>erzeugt die globalen Aliase G und L die man hinter alle möglichen Befehle schreiben kann um die Ausgabe des entsprechenden Befehls in grep oder less zu pipen. Z.B.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> G txt</pre></div></div>

<p>entspricht dem Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> txt</pre></div></div>

<p>oder</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-e</span> L</pre></div></div>

<p>entspricht</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-e</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">less</span></pre></div></div>

<p>Natürlich ist auch folgendes Möglich:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> G txt L</pre></div></div>

<p>was folgendem Befehl entspricht:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> txt <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">less</span></pre></div></div>

<p><strong>Suffix Aliase</strong><br />
Mit Suffixaliasen kann man Programme festlegen, mit denen bestimmte Dateitypen (anhand ihrer Endung) geöffnet werden sollen. Man braucht dann nur noch den Namen der Datei eingeben und sie wird mit dem entsprechenden Programm geöffnet. Beispiel:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #660033;">-s</span> <span style="color: #007800;">pdf</span>=evince</pre></div></div>

<p>legt einen Alias für pdf Dateien an. Sie sollen mit evince geöffnet werden. Danach reicht die Eingabe von</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dokument.pdf</pre></div></div>

<p>und die Datei <code>dokument.pdf</code> wird mit evince geöffnet.</p>
<p><strong>Aliase für Verzeichnisse: Hashes</strong><br />
Mit sogenannten Hashes lassen sich Aliase für beliebige Verzeichnisse anlegen. Auf diese kann dann sehr einfach zugegriffen werden. Mit dem Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">hash</span> <span style="color: #660033;">-d</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">perl</span></span>=~<span style="color: #000000; font-weight: bold;">/</span>developement<span style="color: #000000; font-weight: bold;">/</span>scripting<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">perl</span></pre></div></div>

<p>legt man einen Hash namens <code>perl</code> für das Verzeichnis <code>~/developement/scripting/perl</code> an. Auf dieses Verzeichnis kann man jetzt mit <code>~perl</code> zugreifen. Auch innerhalb eines Befehls wie folgendes Beispiel zeigt:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> testscript.pl ~<span style="color: #c20cb9; font-weight: bold;">perl</span></pre></div></div>

<p>Dieser Befehl kopiert die Datei <code>testscript.pl</code> in das Verzeichnis <code>~/developement/scripting/perl</code>.</p>
<p><strong>Auto-CD</strong><br />
Mit der Option <code>autocd</code> kann man zum Wechseln in ein Verzeichnis einfach den Namen eines Verzeichnisses eingeben und das Kommando <code>cd</code> davor einfach weglassen. Wenn es keinen Befehl gibt, der so heißt wie das Verzeichnis, so wird in das Verzeichnis gewechselt.</p>
<p><strong>Kurze for-Schleifen</strong><br />
Statt einem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">*</span>.eps; <span style="color: #000000; font-weight: bold;">do</span> epstopdf <span style="color: #007800;">$i</span>; <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>um alle eps-Dateien in einem Verzeichnis in pdf-Dateien umzuwandeln genügt unter zsh die kürzere Form</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">*</span>.eps<span style="color: #7a0874; font-weight: bold;">&#41;</span> epstopdf <span style="color: #007800;">$i</span></pre></div></div>

<p><strong>Globale History</strong><br />
Die History, die man mit der Pfeil-auf Taste durchgehen kann, kann man in der zsh so einstellen, dass sie in jeder zsh-Instanz gleich ist. Das heißt man hat nicht mehr für jedes Fenster seine eigene History sondern kann mit der Pfeil-auf Taste auch Befehle raussuchen, die in anderen Fenstern eingegeben wurden. Die History wird jedoch nur nach jedem Befehl geupdated, das heißt man muss ggf. einmal Return drücken, damit die Befehle aus einem anderen Fenster verfügbar sind.</p>
<p>Dieses Verhalten kann mit der Option <code>share_history</code> aktiviert werden.</p>
<p><strong>Directory Stack</strong><br />
Wie Bash, hat die zsh auch einen Directory stack. Mit dem Befehl <code>pushd</code> kann man das aktuelle Verzeichnis auf den Stack legen und mit <code>popd</code> das jeweils letzte Verzeichnis vom Stack nehmen und dorthin springen. Mit der Option <code>auto_pushd</code> legt die zsh automatisch jedes Verzeichnis auf den Directorystack, aus welchem man in ein anderes Verzeichnis wechselt. So hat man immer eine History der Verzeichnisse in denen man war und kann mit <code>popd</code> sehr einfach wieder in Verzeichnisse welchseln, die man vorher besucht hatte.</p>
<p><strong>Globbing</strong><br />
Die Nutzung von Wildcards &#8211; unter zsh globbing genannt &#8211; ist bei der Z-Shell wesentlich mächtiger als in der Bash. Zunächst gibt es rekursives Globbing (gibts in der Bash in neueren Versionen wohl auch). So kann man mit dem Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">**/*</span>.html</pre></div></div>

<p>alle HTML-Dateien im aktuellen Verzeichnis und allen Unterverzeichnissen auflisten lassen.</p>
<p>Es gibt jedoch auch noch Qualifier um Dateien mit bestimmten Eigenschaften auszuwählen. Diese schreibt man in runde Klammern. So kann man mit <code>.</code> normale Dateien, mit <code>/</code> Verzeichnisse und mit <code>@</code> Symbolische Links matchen. Praktisch ist das z.B. wenn man allen Verzeichnissen ab einem bestimmten Verzeichnis die Rechte 755 und allen Dateien 644 vergeben möchte. Dies kann man mit den folgenden zwei Befehlen bewerkstelligen statt mit <code>find</code> und <code>exec</code> zu arbeiten.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> <span style="color: #000000; font-weight: bold;">**/*</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">644</span> <span style="color: #000000; font-weight: bold;">**/*</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>.<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>Zusätzlich gibt es auch Qualifier für verschiedenste Dateirechte. Folgender Befehl listet alle Dateien auf, die von allen beschrieben werden können:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">**/*</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>.W<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>Auch nach der Dateigröße lässt sich suchen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">print <span style="color: #000000; font-weight: bold;">**/*</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>L0<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>listet alle leeren Dateien auf.</p>
<p>Auch die Sortierung lässt sich beliebig anpassen. Mit dem Befehl:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">print <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>oL<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>Listet alle Dateien der Größe nach von klein nach groß auf. Mit großem O wird die Sortierung umgekehrt.</p>
<p>Somit lässt sich mittels globbing in der zsh das Kommando <code>find</code> quasi komplett ersetzen. Die hier gezeigten Beispiele sehen auf den ersten Blick recht kompliziert und kryptisch aus. Wenn man das Prinzip aber einmal verstanden hat und die wichtigsten Qualifier kennt ist es aber ganz einfach und sehr praktisch.</p>
<p>Es gibt noch jede Menge weiterer Qualifier und Möglichkeiten für das Globbing (z.B. nur das erste oder eine bestimmte Anzahl von Elementen auszuwählen), die ich hier gar nicht alle erwähnen kann. Im zsh-Manual gibt es jedoch eine Liste der <a href="http://zsh.sourceforge.net/Doc/Release/Expansion.html#SEC87" title="zsh-Manual - Glob-Qualifier" target="_blank" class="liexternal">Glob-Qualifier</a>.</p>
<p>Um alle Möglichkeiten nutzen zu können sollte die Option <code>extended_glob</code> gesetzt werden.</p>
<p><strong>Vervollständigung</strong><br />
Die zsh hat wie die Bash einen Vervollständigungsmechanismus, so dass man mit der TAB-Taste Kommandos, Dateinamen und vieles mehr vervollständigen kann. In der zsh ist dieser Mechanismus jedoch extrem gut konfigurierbar und programierbar. So kann man z.B. beim <code>scp</code> Befehl (der Dateien über ssh kopiert) die <a href="http://blog.pimpmyshell.de/2007/01/21/ssh-completion-mit-zsh/" title="ssh completion mit zsh" target="_blank" class="liexternal">Verzeichnisse auf dem entfernten Rechner vervollständigen</a> und genau definieren welche Programme mit welchen Dateitypen zusammen arbeiten können. Für sehr viele Programme ist dies schon vorgefertigt, so dass ein</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">latex doku<span style="color: #000000; font-weight: bold;">&lt;</span>TAB<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>automatisch zu</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> latex dokument.tex</pre></div></div>

<p>vervollständigt wird. Dies beherrscht die Bash zum Teil auch. Jedoch ist es in der zsh wesentlich besser konfigurierbar und anpassbar.</p>
<p>Sehr praktisch finde ich auch die Menüfunktion. So wird beim ersten Druck auf die TAB-Taste wie in der Bash soweit vervollständigt, bis nicht mehr entschieden werden kann welche Datei (bzw. welcher Befehl) gemeint ist. Ein weiterer Druck auf die TAB-Taste listet alle weiteren Möglichkeiten auf und jeder weitere Druck geht diese Möglichkeiten durch. Wenn ich also drei Dateien habe: <code>test.txt</code>, <code>testfile1.txt</code> und <code>testfile2.txt</code> und gebe folgendes ein:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> te<span style="color: #000000; font-weight: bold;">&lt;</span>TAB<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>so wird zuerst auf <code>test</code> vervollständigt. Ein weiterer Druck gibt mir alle Möglichkeiten aus:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">testfile1.txt  testfile2.txt  test.txt</pre></div></div>

<p>und ein dritter Druck auf die Tab-Taste vervollständigt den Befehl zu</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> testfile1.txt</pre></div></div>

<p>Das ist viel schneller als erst ein <code>f</code> einzugeben um erneut TAB zu drücken und dann die <code>1</code> einzugeben um wiederum TAB zu drücken bis der Dateiname endgültig vervollständigt wird.</p>
<p>Ein weiterer Druck auf TAB nimmt dann die nächste Möglichkeit. In diesem Beispiel also</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> testfile2.txt</pre></div></div>

<p>und so weiter.</p>
<p><strong>Expansion</strong><br />
Mit der TAB-Taste kann man in der zsh nicht nur Kommandos, Dateinamen, &#8230; vervollständigen, sondern auch Variablen expandieren. Viele kennen ja die spezielle Variable <code>!!</code>, die den zuletzt ausgeführten Befehl enthält. In der zsh kann man nun folgendes eingeben:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">!!&lt;</span>TAB<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>und die Variable <code>!!</code> wird automatisch zum zuletzt ausgeführten Befehl expandiert. Genauso kann man auch jede andere Variable expandieren:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">$PWD</span><span style="color: #000000; font-weight: bold;">&lt;</span>TAB<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>wird zu <code>/home/zimon/developement</code> (vorrausgesetzt ich befinde mich zum Zeitpunkt der expansion in diesem Verzeichnis).</p>
<p><strong>History Kontrolle</strong><br />
Wie bei der Bash auch, kann man in der zsh die History durchsuchen. Die zsh geht jedoch so weit, dass man auch nach bestimmten Parametern suchen kann. Ein Beispiel:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> ..<span style="color: #000000; font-weight: bold;">/</span>perl<span style="color: #000000; font-weight: bold;">/</span>foo.pl ~<span style="color: #000000; font-weight: bold;">/</span>developement<span style="color: #000000; font-weight: bold;">/</span>projektordner</pre></div></div>

<p>Danach kommen ein paar andere Kommandos. Möchte nun eine andere Datei in den gleichen Projektordner kopieren reicht folgende Eingabe:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> ..<span style="color: #000000; font-weight: bold;">/</span>perl<span style="color: #000000; font-weight: bold;">/</span>bar.pl <span style="color: #000000; font-weight: bold;">!</span>?proj?:<span style="color: #000000;">3</span></pre></div></div>

<p>Mit !? wird nach einem vorherigen Befehl gesucht. Das <code>proj</code> ist ein String der in diesem Befehl vorkam. Mit dem <code>?:3</code> wird das dritte Argument genutzt. Durch die Expansion kann manmit durch einen Druck auf TAB diesen Ausdruck auch noch expandieren um sicher zu gehen, dass das richtige Argument ausgewählt wurde. Man kann zwar mit Alt+. wie in der Bash die jeweils letzten Argumente durchgehen, auf diese Weise kann man aber auch das zweite von drei Argumenten suchen.</p>
<p>Es gibt noch wesentlich mehr Möglichkeiten die History zu durchsuchen und zu verwenden.</p>
<p><strong>Hochkonfigurierbarer Prompt</strong><br />
In der Z-Shell kann man nicht nur die linke Seite des Prompts sondern auch die rechte Seite konfigurieren. Als Beispiel hier mal mein aktueller Prompt:</p>
<div id="attachment_1679" class="wp-caption aligncenter" style="width: 643px"><a href="http://zinformatik.de/wp-content/uploads/2010/01/zsh_prompt.png" class="liimagelink"><img class="size-full wp-image-1679" title="zsh Prompt" src="http://zinformatik.de/wp-content/uploads/2010/01/zsh_prompt.png" alt="zsh Prompt" width="633" height="37" /></a><p class="wp-caption-text">Mein aktueller zsh-Prompt</p></div>
<p>Ich finde die Anzeige der Uhrzeit inklusive Sekunden recht praktisch, da man daran sieht wie lange ein Befehl gedauert hat oder wann man ihn ausgeführt hat. Es gibt jedoch auch die Möglichkeit automatisch die Ausgabe von <code>time</code> bei der Beendigung eines Befehls ausgeben zu lassen, der länger als eine vorher definierte Zeit benötigt hat.</p>
<p>Der Prompt ist eine abgeänderte Version von <a href="http://aperiodic.net/phil/prompt/" title="Phil!s ZSH Prompt" target="_blank" class="liexternal">Phil!s ZSH Prompt</a>.</p>
<p><strong>[UPDATE]</strong> Auf Anfrage hin ist hier noch der Code für die von mir abgeänderte Version des Prompts:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">setprompt <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #666666; font-style: italic;">###</span>
    <span style="color: #666666; font-style: italic;"># Need this so the prompt will work.</span>
&nbsp;
    setopt prompt_subst
&nbsp;
&nbsp;
    <span style="color: #666666; font-style: italic;">###</span>
    <span style="color: #666666; font-style: italic;"># See if we can use colors.</span>
&nbsp;
    autoload colors zsh<span style="color: #000000; font-weight: bold;">/</span>terminfo
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$terminfo</span>[colors]&quot;</span> <span style="color: #660033;">-ge</span> <span style="color: #000000;">8</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	colors
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">for</span> color <span style="color: #000000; font-weight: bold;">in</span> RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; <span style="color: #000000; font-weight: bold;">do</span>
	<span style="color: #7a0874; font-weight: bold;">eval</span> PR_<span style="color: #007800;">$color</span>=<span style="color: #ff0000;">'%{$terminfo[bold]$fg[${(L)color}]%}'</span>
	<span style="color: #7a0874; font-weight: bold;">eval</span> PR_LIGHT_<span style="color: #007800;">$color</span>=<span style="color: #ff0000;">'%{$fg[${(L)color}]%}'</span>
	<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> count = <span style="color: #007800;">$count</span> + <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">done</span>
    <span style="color: #007800;">PR_NO_COLOUR</span>=<span style="color: #ff0000;">&quot;%{<span style="color: #007800;">$terminfo</span>[sgr0]%}&quot;</span>
&nbsp;
&nbsp;
    <span style="color: #666666; font-style: italic;">###</span>
    <span style="color: #666666; font-style: italic;"># See if we can use extended characters to look nicer.</span>
&nbsp;
    <span style="color: #7a0874; font-weight: bold;">typeset</span> <span style="color: #660033;">-A</span> altchar
    <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-A</span> altchar <span style="color: #800000;">${(s..)terminfo[acsc]}</span>
    <span style="color: #007800;">PR_SET_CHARSET</span>=<span style="color: #ff0000;">&quot;%{<span style="color: #007800;">$terminfo</span>[enacs]%}&quot;</span>
    <span style="color: #007800;">PR_SHIFT_IN</span>=<span style="color: #ff0000;">&quot;%{<span style="color: #007800;">$terminfo</span>[smacs]%}&quot;</span>
    <span style="color: #007800;">PR_SHIFT_OUT</span>=<span style="color: #ff0000;">&quot;%{<span style="color: #007800;">$terminfo</span>[rmacs]%}&quot;</span>
    <span style="color: #007800;">PR_HBAR</span>=<span style="color: #800000;">${altchar[q]:--}</span>
    <span style="color: #007800;">PR_ULCORNER</span>=<span style="color: #800000;">${altchar[l]:--}</span>
    <span style="color: #007800;">PR_LLCORNER</span>=<span style="color: #800000;">${altchar[m]:--}</span>
    <span style="color: #007800;">PR_LRCORNER</span>=<span style="color: #800000;">${altchar[j]:--}</span>
    <span style="color: #007800;">PR_URCORNER</span>=<span style="color: #800000;">${altchar[k]:--}</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> == <span style="color: #ff0000;">&quot;screen&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #007800;">PR_HBAR</span>=-
     	<span style="color: #007800;">PR_ULCORNER</span>=--
    	<span style="color: #007800;">PR_LLCORNER</span>=--
    	<span style="color: #007800;">PR_LRCORNER</span>=--
    	<span style="color: #007800;">PR_URCORNER</span>=-
   <span style="color: #000000; font-weight: bold;">fi</span> 
&nbsp;
&nbsp;
    <span style="color: #666666; font-style: italic;">###</span>
    <span style="color: #666666; font-style: italic;"># Decide if we need to set titlebar text.</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$TERM</span> <span style="color: #000000; font-weight: bold;">in</span>
	xterm<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	    <span style="color: #007800;">PR_TITLEBAR</span>=$<span style="color: #ff0000;">'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'</span>
	    <span style="color: #000000; font-weight: bold;">;;</span>
	<span style="color: #c20cb9; font-weight: bold;">screen</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	    <span style="color: #007800;">PR_TITLEBAR</span>=$<span style="color: #ff0000;">'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}'</span>
	    <span style="color: #000000; font-weight: bold;">;;</span>
	<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	    <span style="color: #007800;">PR_TITLEBAR</span>=<span style="color: #ff0000;">''</span>
	    <span style="color: #000000; font-weight: bold;">;;</span>
    <span style="color: #000000; font-weight: bold;">esac</span>
&nbsp;
&nbsp;
    <span style="color: #666666; font-style: italic;">###</span>
    <span style="color: #666666; font-style: italic;"># Decide whether to set a screen title</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> == <span style="color: #ff0000;">&quot;screen&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">PR_STITLE</span>=$<span style="color: #ff0000;">'%{\ekzsh\e\\%}'</span>
    <span style="color: #000000; font-weight: bold;">else</span>
        <span style="color: #007800;">PR_STITLE</span>=<span style="color: #ff0000;">''</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
&nbsp;
    <span style="color: #666666; font-style: italic;">###</span>
    <span style="color: #666666; font-style: italic;"># Finally, the prompt.</span>
&nbsp;
    <span style="color: #007800;">PROMPT</span>=<span style="color: #ff0000;">'$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
$PR_RED$PR_SHIFT_IN$PR_ULCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\
$PR_GREEN%(!.%SROOT%s.%n)$PR_GREEN@%m:%l\
$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_RED$PR_HBAR${(e)PR_FILLBAR}$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\
$PR_MAGENTA%$PR_PWDLEN&lt;...&lt;%~%&lt;&lt;\
$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_RED$PR_URCORNER$PR_SHIFT_OUT\
&nbsp;
$PR_RED$PR_SHIFT_IN$PR_LLCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\
%(?..$PR_LIGHT_RED%?$PR_BLUE:)\
${(e)PR_APM}$PR_YELLOW%D{%H:%M:%S}\
$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
$PR_RED$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
$PR_NO_COLOUR '</span>
&nbsp;
    <span style="color: #007800;">RPROMPT</span>=<span style="color: #ff0000;">' $PR_RED$PR_SHIFT_IN$PR_HBAR$PR_BLUE$PR_HBAR$PR_SHIFT_OUT\
($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_RED$PR_LRCORNER$PR_SHIFT_OUT$PR_NO_COLOUR'</span>
&nbsp;
    <span style="color: #007800;">PS2</span>=<span style="color: #ff0000;">'$PR_RED$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
$PR_BLUE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT(\
$PR_LIGHT_GREEN%_$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
$PR_RED$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR '</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
setprompt</pre></div></div>

<p><strong>[/UPDATE]</strong></p>
<p><strong>ZLE-Widgets</strong><br />
Der Z-Line-Editor (ZLE) ist quasi die Eingabezeile in der zsh. Dafür kann man sich kleine Programme schreiben, die einem das Leben vereinfachen. Ein Beispiel wäre ein Programm, dass bei der Eingabe von <code>...</code> diese zu <code>../..</code> umwandelt. Jeder weitere Punkt wird wieder umgewandelt. So kann man recht einfach folgendes eingeben:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ....<span style="color: #000000; font-weight: bold;">/</span>directory</pre></div></div>

<p>Auf dem Bildschirm erscheint jedoch folgendes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>directory</pre></div></div>

<p>Dieses Widget ist kein Standard bei der Z-Shell. Man kann es aber durch folgenden Code in der Konfigurationsdatei <code>~/.zshrc</code> erzeugen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rationalise-dot<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$LBUFFER</span> = <span style="color: #000000; font-weight: bold;">*</span>.. <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        LBUFFER+=<span style="color: #000000; font-weight: bold;">/</span>..
    <span style="color: #000000; font-weight: bold;">else</span>
        LBUFFER+=.
            <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
zle <span style="color: #660033;">-N</span> rationalise-dot
bindkey . rationalise-dot</pre></div></div>

<p><strong>Automatisches tee-ing</strong><br />
In der Z-Shell kann man die Ausgabe eines Kommandos recht einfach in mehrere verschiedene Dateien umleiten. Statt wie in der Bash</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tee</span> <span style="color: #660033;">-a</span> all <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tee</span> actual</pre></div></div>

<p>zu schreiben, kann man in der zsh einfach</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span>all <span style="color: #000000; font-weight: bold;">&gt;</span>actual</pre></div></div>

<p>eingeben. Beide Befehle führen ls aus und hängen die Ausgabe an die Datei <code>all</code> an und schreiben sie in die Datei <code>actual</code> wobei der inhalt jeweils überschrieben wird.<br />
Möchte man die Ausgabe wie beim original <code>tee</code> Befehl auch auf dem Bildschirm sehen, so leitet man sie auch noch auf STDOUT um:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span>all <span style="color: #000000; font-weight: bold;">&gt;</span>actual <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span></pre></div></div>

<p><strong>Verzeichnisse durch Ersetzung wechseln</strong><br />
Ein Beispiel sollte dies am besten Erklären. Man nehme an man hat zwei Verzeichnisse: <code>~/developement/scripting/perl/modules</code> und <code>~/developement/scripting/python/modules</code> und man befindet sich in <code>~/developement/scripting/perl/modules</code>, so kann man durch den Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #c20cb9; font-weight: bold;">perl</span> python</pre></div></div>

<p>in das Verzeichnis <code>~/developement/scripting/python/modules</code> wechseln. Bei einem <code>cd</code> Kommando mit zwei Parametern wird im aktuellen Verzeichnis-String das erste Wort durch das zweite ersetzt. Hier also <code>perl</code> durch <code>python</code>.</p>
<p><strong>Fazit</strong><br />
Ich bin jetzt nicht 100% sicher, dass alles hier beschriebene nicht auch in der Bash möglich ist. Es zeigt aber auf jeden Fall, dass die Z-Shell jede Menge interessante Möglichkeiten bietet und man viele Dinge einfacher und schneller erledigen kann als in der Bash. Die oben gezeigten Features sind meist nur angerissen und nur eine kleine Auswahl von dem was die Z-Shell bietet. Darüber hinaus besitzt die Z-Shell eine ganze Reihe Module z.B. für Matheoperationen oder einen eigenen FTP-Client, die man bei Bedarf laden kann.</p>
<p>Sehr schön ist auch die Möglichkeit den <a href="http://zinformatik.de/linux/titel-von-screen-fenstern-automatisch-von-vim-bash-und-zsh-setzen/" title="Titel von Screen Fenstern automatisch von vim, Bash und zsh setzen" target="_self" class="liinternal">Screen-Title von der zsh aus zu setzen</a>.</p>
<p>Es lohnt sich auf jeden Fall, diese Shell etwas genauer zu betrachten. Bei mir hat sie mittlerweile die Bash fast vollständig ersetzt (vorhandene Scripte habe ich nicht umgeschrieben).</p>
<p><strong>Links</strong></p>
<ul>
<li><a href="http://zsh.sourceforge.net/" title="Offizielle zsh Projektseite" target="_blank" class="liexternal">Offizielle zsh Projektseite</a> (englisch)</li>
<li><a href="http://zsh.sourceforge.net/Doc/Release/zsh_toc.html" title="zsh Manual" target="_blank" class="liexternal">zsh Manual</a> (englisch)</li>
<li><a href="http://zsh.sourceforge.net/Guide/zshguide.html" title="zsh Users Guide" target="_blank" class="liexternal">zsh User&#8217;s Guide</a> (englisch)</li>
<li><a href="http://michael-prokop.at/computer/tools_zsh.html" title="zsh generell" target="_blank" class="liexternal">Michael Prokops zsh Seite</a> &#8211; Seite mit Features und Beispielen wo zsh mit Bash verglichen wird</li>
<li><a href="http://michael-prokop.at/computer/tools_zsh_liebhaber.html" title="zsh liebhaber" target="_blank" class="liexternal">Michael Prokops zsh Liebhaberseite</a> &#8211; Viele gute Beispiele und zsh Tricks angelehnt an das zsh-lovers Projekt.</li>
<li><a href="http://zshwiki.org" title="zsh wiki" target="_blank" class="liexternal">zsh wiki</a> &#8211; Wiki über zsh (englisch)</li>
<li><a href="http://grml.org/zsh/zsh-lovers.html" title="zsh-lovers" target="_blank" class="liexternal">zsh-lovers</a> &#8211; Sammlung von Tipps, Tricks und Beispielen (englisch)</li>
<li><a href="http://grml.org/zsh/" target="_blank" class="liexternal">grml zsh Seite</a> &#8211; Seite mit sehr großer zsh-Konfigurationsdatei, Referenzkarte und anderen zsh Infos. Die grml-Linuxdistribution hat zsh als Standardshell. (englisch)</li>
<li><a href="http://www.strcat.de/zsh/" title="stcats zsh Page" target="_blank" class="liexternal">strcat.de/zsh/</a> &#8211; Seite mit Auflistung vieler Features und Tipps (englisch)</li>
<li><a href="http://rayninfo.co.uk/tips/zshtips.html" title="Best of zsh Tips" target="_blank" class="liexternal">Zzappers Best of ZSH Tips</a> &#8211; Viele zsh Tipps (englisch)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://zinformatik.de/tipps-tricks/interessante-programme/die-z-shell-zsh-eine-machtige-alternative-zur-bash/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Gimp 2.7 mit Single-Window-Mode installieren</title>
		<link>http://zinformatik.de/tipps-tricks/interessante-programme/gimp-2-7-mit-single-window-mode-installieren/</link>
		<comments>http://zinformatik.de/tipps-tricks/interessante-programme/gimp-2-7-mit-single-window-mode-installieren/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 17:33:11 +0000</pubDate>
		<dc:creator>zimon</dc:creator>
				<category><![CDATA[Interessante Programme]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntuusers-Planet]]></category>
		<category><![CDATA[Gimp]]></category>
		<category><![CDATA[Single-Window-Mode]]></category>

		<guid isPermaLink="false">http://zinformatik.de/?p=1644</guid>
		<description><![CDATA[<p>Ab der nächsten Version von Gimp (2.8) gibt es endlich auch die Möglichkeit des Einfenster-Betriebs. <div id="attachment_1645" class="wp-caption alignright" style="width: 310px"><a href="http://zinformatik.de/wp-content/uploads/2009/12/gimp_screen.png" class="liimagelink"><img class="size-medium wp-image-1645" title="gimp_screenshot" src="http://zinformatik.de/wp-content/uploads/2009/12/gimp_screen-300x215.png" alt="Screenshot des Single-Window Modus von Gimp 2.7" width="300" height="215" /></a><p class="wp-caption-text">Screenshot des Single-Window Modus von Gimp 2.7</p></div><br />
Im Moment gibt es in Gimp je ein Fenster für jedes geöffnete Bild und zusätzlich ein Fenster mit den Werkzeugen (Werkzeugkasten) sowie bei Bedarf auch Dialogfenster für Ebenen, Pfade, &#8230; Der Umgang mit&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Ab der nächsten Version von Gimp (2.8) gibt es endlich auch die Möglichkeit des Einfenster-Betriebs. <div id="attachment_1645" class="wp-caption alignright" style="width: 310px"><a href="http://zinformatik.de/wp-content/uploads/2009/12/gimp_screen.png" class="liimagelink"><img class="size-medium wp-image-1645" title="gimp_screenshot" src="http://zinformatik.de/wp-content/uploads/2009/12/gimp_screen-300x215.png" alt="Screenshot des Single-Window Modus von Gimp 2.7" width="300" height="215" /></a><p class="wp-caption-text">Screenshot des Single-Window Modus von Gimp 2.7</p></div><br />
Im Moment gibt es in Gimp je ein Fenster für jedes geöffnete Bild und zusätzlich ein Fenster mit den Werkzeugen (Werkzeugkasten) sowie bei Bedarf auch Dialogfenster für Ebenen, Pfade, &#8230; Der Umgang mit so vielen Fenstern ist auf kleinen Bildschirmen recht umständlich, da oft ein Fenster im Weg steht und man es zuerst weg schieben muss. Daher freuen sich schon viele Nutzer auf den Einfenster Modus, bei dem Bilder als Tabs angezeigt werden und die restlichen Fenster links und rechts neben dem Bild angeordnet werden. Dialogfenster können jedoch immer noch heraus gezogen und als eigenes Fenster angezeigt werden.</p>
<p>Es gibt jedoch auch Beführworter des Multi-Window Modus, da man mehrere Fenster leichter auf verschiedene Bildschirme verteilen kann.</p>
<p>Ich habe mir mal die Entwicklerversion (2.7) installiert und (vor allem den Single-Window Modus <img src='http://zinformatik.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) angesehen.</p>
<p><strong>Installation</strong></p>
<p>Zuerst müssend die <code>build-utils</code>, <code>git</code> sowie einige Abhängigkeiten installiert werden. Unter Ubuntu kann man dies mit dem folgenden Befehl erreichen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> build-dep <span style="color: #c20cb9; font-weight: bold;">gimp</span> libtool ruby git-core git-doc git-email</pre></div></div>

<p>Als nächstes wird git konfiguriert. Dafür die folgenden beiden Befehle ausführen, wobei beim ersten Befehl der Name eingegeben wird und beim zweiten die Emailadresse:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git config <span style="color: #660033;">--global</span> user.name <span style="color: #ff0000;">&quot;Your Name&quot;</span>
git config <span style="color: #660033;">--global</span> user.email you<span style="color: #000000; font-weight: bold;">@</span>host</pre></div></div>

<p>Nun werden die aktuellen Entwickerversionen von babl, gegl und gimp ausgecheckt:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git clone git:<span style="color: #000000; font-weight: bold;">//</span>git.gnome.org<span style="color: #000000; font-weight: bold;">/</span>babl
git clone git:<span style="color: #000000; font-weight: bold;">//</span>git.gnome.org<span style="color: #000000; font-weight: bold;">/</span>gegl
git clone git:<span style="color: #000000; font-weight: bold;">//</span>git.gnome.org<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">gimp</span></pre></div></div>

<p>Um eine bereits installiertes Gimp weiter benutzen zu können, wird die Entwicklerversion in das Verzeichnis <code>/usr/local/gimp-git</code> installiert.<br />
Dafür wird dieses Verzeichnis angelegt und dort ein Verzeichnis share erstellt. Nun legt man die Datei <code>/usr/local/gimp-git/share/config.site</code> mit folgendem Inhalt an:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PKG_CONFIG_PATH</span>=<span style="color: #ff0000;">&quot;/usr/local/gimp-git/lib/pkgconfig:<span style="color: #007800;">$PKG_CONFIG_PATH</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LD_LIBRARY_PATH</span>=<span style="color: #ff0000;">&quot;/usr/local/gimp-git/lib:<span style="color: #007800;">$LD_LIBRARY_PATH</span>&quot;</span></pre></div></div>

<p>Wenn es Probleme gibt, dass die neueste babl-Version nicht gefunden werden kann, können die beiden Befehle auch nochmal in der aktuellen Shell ausgeführt werden.</p>
<p>Die Leserechte müssen auch noch entsprechend gesetzt werden:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> oug+rx <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>gimp-git
<span style="color: #c20cb9; font-weight: bold;">chmod</span> oug-x <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>gimp-git<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>config.site</pre></div></div>

<p>Nun werden babl, gegl und schließlich gimp selbst kompiliert und installiert:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> babl
.<span style="color: #000000; font-weight: bold;">/</span>autogen.sh <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>gimp-git
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>gegl
.<span style="color: #000000; font-weight: bold;">/</span>autogen.sh <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>gimp-git
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #c20cb9; font-weight: bold;">gimp</span>
.<span style="color: #000000; font-weight: bold;">/</span>autogen.sh <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>gimp-git <span style="color: #660033;">--disable-gtk-doc</span>
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>Nun kann man gimp-2.7 mit folgendem Befehl starten:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>gimp-git<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gimp-<span style="color: #000000;">2.7</span></pre></div></div>

<p>Ein Alias in der <code>~/.bashrc</code> erleichtert den Aufruf:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">alias</span> gimp-git=<span style="color: #ff0000;">'/usr/local/gimp-git/bin/gimp-2.7'</span></pre></div></div>

<p><b>Single-Window-Mode</b></p>
<p>Nachdem ich alle Menüs in den Einstellungen durchforstet habe und auch in einige Konfigurationsdateien geschaut habe, habe ich die Funktion für den Single-Window-Mode schließlich unter dem Menüpunkt &#8220;Fenster&#8221; gefunden.</p>
<p>Es sieht schon ziemlich schick aus. Auch wenn viele Kleinigkeiten noch nicht so richtig Funktionieren. Wenn die Dialoge an der Seite sind, reagieren sie manchmal nicht (oder nur teilweise). Abhilfe schaft auch manchmal den Modus wieder zurück zu wechseln und erneut in den Single-Window Modus zu wechseln. Versucht man einen Dialog unter den Werkzeugkasten (oder an eine andere Stelle an der Seite) zu platzieren, stürzt das ganze Programm mit einem segmentation fault ab. </p>
<p>Im Moment ist es noch sehr emfehlenswert, bei der Version 2.6 zu bleiben und die Entwicklerversion nur zum Ausprobieren zu nutzen. Dies gilt besonders für den Single-Window Modus, da dieser noch nicht sehr stabil läuft. Das wird sich aber sicherlich in der nächsten Zeit noch ändern.</p>
<p><strong>[UPDATE]</strong>Mittlerweile funktioniert der Single-Window Modus recht gut und stabil, so dass man ihn nun verwenden kann. Man sollte jedoch im Hinterkopf behalten, dass sich das Programm noch im Entwicklungsstadium befindet und Fehler auftreten können.</p>
<p>Übrigens soll Gimp 2.8 frühestens Ende des Jahres (2010) erscheinen, wie man der <a href="http://www.mail-archive.com/gimp-developer@lists.xcf.berkeley.edu/msg19390.html" target="_blank" title="Gimp 2.8 Schedule" class="liexternal">Developer-Mailingliste</a> entnehmen kann.<strong>[/UPDATE]</strong></p>
<p>Den Screenshot in voller Auflösung habe ich <a href="http://zinformatik.de/gimp_screen_big.png" class="liinternal">hier</a> verlinkt (am besten in einem nuen Tab oder Fenster öffnen).</p>
]]></content:encoded>
			<wfw:commentRss>http://zinformatik.de/tipps-tricks/interessante-programme/gimp-2-7-mit-single-window-mode-installieren/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Vim Plugin &#8211; VCSCommand zur Versionsverwaltung mittels SVN und CVS</title>
		<link>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/vim-plugin-vcscommand-zur-versionsverwaltung-mittels-svn-und-cvs/</link>
		<comments>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/vim-plugin-vcscommand-zur-versionsverwaltung-mittels-svn-und-cvs/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 10:24:51 +0000</pubDate>
		<dc:creator>zimon</dc:creator>
				<category><![CDATA[Plugins und Erweiterungen]]></category>
		<category><![CDATA[Ubuntuusers-Planet]]></category>
		<category><![CDATA[vim Tipps]]></category>
		<category><![CDATA[CVS]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[Versionsverwaltung]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://zinformatik.de/?p=1585</guid>
		<description><![CDATA[<p>Mit dem Plugin <a href="http://www.vim.org/scripts/script.php?script_id=90" title="Vim Plugin - VCSCommand" target="_blank" class="liexternal">VCSCommand</a> kann man Dateien und Verzeichnisse direkt von Vim aus über ein SVN- oder CVS-Repository verwalten. Ich werde hier jedoch nur SVN behandeln, da ich momentan nur dieses System nutze.</p>
<p>Nachdem man die Dateien des Plugins nach <code>~/.vim/plugin/</code> kopiert hat, kann man die Befehle <code>:VCSUpdate</code> und <code>:VCSCommit</code>nutzen um die aktuelle&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Mit dem Plugin <a href="http://www.vim.org/scripts/script.php?script_id=90" title="Vim Plugin - VCSCommand" target="_blank" class="liexternal">VCSCommand</a> kann man Dateien und Verzeichnisse direkt von Vim aus über ein SVN- oder CVS-Repository verwalten. Ich werde hier jedoch nur SVN behandeln, da ich momentan nur dieses System nutze.</p>
<p>Nachdem man die Dateien des Plugins nach <code>~/.vim/plugin/</code> kopiert hat, kann man die Befehle <code>:VCSUpdate</code> und <code>:VCSCommit</code>nutzen um die aktuelle Datei zu Updaten bzw. seine Änderungen zu committen. Dafür muss die Datei jedoch bereits unter Versionskontrolle stehen.<br />
Beim Commit öffnet sich ein <a href="http://zinformatik.de/tipps-tricks/vim-tipps/unter-vim-mit-splitscreens-arbeiten/" title="Unter vim mit Splitscreens arbeiten" target="_self" class="liinternal">Splitscreen</a>, in den man die Logmessage eintragen kann. Mittels <code>:wq</code> oder <code>\cc</code> wird diese übernommen. Um ohne Logmessage zu Committen, kann man das Kommando mit einem Ausrufezeichen aufrufen: <code>:VCSCommit!</code>. </p>
<p>Es gibt auch Abkürzungen für die Kommandos. So kann man statt <code>:VCSCommit</code> auch den Befehl <code>\cc</code> nutzen, der das gleiche bewirkt. Genauso kann man mit <code>\cu</code> updaten.</p>
<p>Auch die anderen Kommandos sind im Prinzip die SVN Kommandos mit vorrangestelltem <em>VCS</em>. In Klammern steht jeweils die Kurzvariante:</p>
<ul>
<li><code>:VCSAdd</code> &#8211; (<code>\ca</code>) zum Hinzufügen von Dateien zum Repository</li>
<li><code>:VCSDelete</code> &#8211; (<code>\cD</code>) zum Löschen</li>
<li><code>:VCSStatus</code> &#8211; (<code>\cs</code>) um den Status der Datei anzuzeigen</li>
<li><code>:VCSDiff</code> &#8211; (<code>\cd</code>) um den Unterschied zur letzten Version anzuzgeigen</li>
<li><code>:VCSLog</code> &#8211; (<code>\cl</code>) zeigt die bereits getätigten commits mit ihren Logmessages an</li>
</ul>
<p>Statt <code>:VCSDiff</code> kann man auch <code>:VCSVimDiff</code> (<code>\cv</code>) nutzen um die Unterschiede mittels <a title="" href="" target="_self">Vimdiff</a> zu betrachten.</p>
<p>Um ganze Verzeichnisse mit dem CVSCommand-Plugin zu verwalten, kann man die <a href="http://zinformatik.de/tipps-tricks/vim-tipps/vim-als-dateibrowser-und-sftp-client/" titel="vim als Dateibrowser und (S)FTP-Client" target="_self" class="liinternal">Dateibrower-Funktion</a> des Vim nutzen und die entsprechenden Kommandos bei einem geöffneten Verzeichnis ausführen.</p>
<p>Es gibt natürlich noch weitere Kommandos und Einstellungsmöglichkeiten. Diese sind in der Hilfe näher beschrieben, die man mittels <code>:h vcscommand</code> aufrufen kann.</p>
]]></content:encoded>
			<wfw:commentRss>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/vim-plugin-vcscommand-zur-versionsverwaltung-mittels-svn-und-cvs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Vim Plugin &#8211; Surround umschließt Text mit Klammern, Anführungszeichen und HTML-Tags</title>
		<link>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/vim-plugin-surround-umschliest-text-mit-klammern-anfuhrungszeichen-und-html-tags/</link>
		<comments>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/vim-plugin-surround-umschliest-text-mit-klammern-anfuhrungszeichen-und-html-tags/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 16:32:30 +0000</pubDate>
		<dc:creator>zimon</dc:creator>
				<category><![CDATA[Plugins und Erweiterungen]]></category>
		<category><![CDATA[Ubuntuusers-Planet]]></category>
		<category><![CDATA[vim Tipps]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Klammern]]></category>
		<category><![CDATA[Sourround]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://zinformatik.de/?p=1528</guid>
		<description><![CDATA[<p>Für Vim gibt es ein sehr praktisches Plugin namens <a href="http://www.vim.org/scripts/script.php?script_id=1697" title="Vim Plugin - Surround" target="_blank" class="liexternal">Surround</a>, welches es einem ermöglicht Wörter, Sätze, Absätze, Zeilen,&#8230; mit Klammern, Anführungszeichen oder XML-Tags zu umschließen. Solche Umschließungen können auch geändert oder gelöscht werden.</p>
<p>Zur Installation wird das Archiv surround.zip im Verzeichnis <code>~/.vim</code> entpackt.</p>
<p>Grundsätzlich lehnt sich die Bedienung an das Konzept an, den&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Für Vim gibt es ein sehr praktisches Plugin namens <a href="http://www.vim.org/scripts/script.php?script_id=1697" title="Vim Plugin - Surround" target="_blank" class="liexternal">Surround</a>, welches es einem ermöglicht Wörter, Sätze, Absätze, Zeilen,&#8230; mit Klammern, Anführungszeichen oder XML-Tags zu umschließen. Solche Umschließungen können auch geändert oder gelöscht werden.</p>
<p>Zur Installation wird das Archiv surround.zip im Verzeichnis <code>~/.vim</code> entpackt.</p>
<p>Grundsätzlich lehnt sich die Bedienung an das Konzept an, den Text zwischen Klammern, Anführungszeichen,&#8230; zu ändern so wie es im Artikel <a href="http://zinformatik.de/tipps-tricks/vim-tipps/vim-bewegungskommandos/" title="vim Bewegungskommandos" target="_self" class="liinternal">Vim Bewegungskommandos</a> im Abschnitt &#8220;Spezielle Bewegungskommandos&#8221; beschrieben ist. </p>
<p><strong>Text Umschließen</strong><br />
Die Syntax zum Umschließen von Text ist:<br />
<code>ys&lt;BEWEGUNG&gt;&lt;ZEICHEN&gt;</code></p>
<p>Beispiele:</p>
<ul>
<li><code>ysis"</code> &#8211; der aktuelle Satz wird mit doppelten Anführungszeichen umschlossen.</li>
<li><code>ysiw&lt;b&gt;</code> &#8211; versieht das aktuelle Wort mit mit dem HTML-Tag <code>b</code>, so dass es fett angezeigt wird.</li>
<li><code>yss)</code> &#8211; umschließt die aktuelle Zeile mit runden Klammern.</li>
<li><code>ysi)"</code> &#8211; umschließt den Text zwischen den Klammern mit doppelten Anführungszeichen.</li>
<li><code>ysa")</code> &#8211; umschließt den den Text zwischen den doppelten Anführungszeichen und die Anführungszeichen selbst mit runden Klammern.</li>
</ul>
<p>Statt den Bewegungskommandos kann man auch im visuellen Modus den gewünschten Text markieren. Dann drückt man <code>s</code> gefolgt vom gewünschten Zeichen.<br />
Beispiel: <code>s"</code> um den markierten Text mit doppelten Anführungszeichen zu umschließen.</p>
<p>Damit man es sich besser vorstellen kann hier ein konkretes Beispiel. Die folgende Zeile:</p>

<div class="wp_syntax"><div class="code"><pre class="plain" style="font-family:monospace;">Dies ist eine Beispielzeile</pre></div></div>

<p>wird durch <code>yss"</code> zu</p>

<div class="wp_syntax"><div class="code"><pre class="plain" style="font-family:monospace;">&quot;Dies ist eine Beispielzeile&quot;</pre></div></div>

<p>Liegt der Cursor auf dem Wort &#8220;eine&#8221;, so kann man mit <code>ysiw)</code> das Wort mit Klammern umschließen:</p>

<div class="wp_syntax"><div class="code"><pre class="plain" style="font-family:monospace;">&quot;Dies ist (eine) Beispielzeile&quot;</pre></div></div>

<p><strong>Umschließung ändern</strong><br />
Um die Umschließung von Text zu ändern nutzt man folgende Syntax:<br />
<code>cs&lt;AKTUELLES_ZEICHEN&gt;&lt;NEUES_ZEICHEN&gt;</code></p>
<p>Beispiele:</p>
<ul>
<li><code>cst"</code> &#8211; ändert das XML/HTML-Tag zu doppelten Anführungszeichen.</li>
<li><code>cs"'</code> &#8211; ändert doppelte in einfache Anführungszeichen.</li>
<li><code>cs)}</code> &#8211; ändert runde in geschweifte Klammern.</li>
</ul>
<p><strong>Umschließung löschen</strong><br />
Die Syntax um eine Umschließung zu löschen ist:<br />
<code>ds&lt;ZEICHEN&gt;</code></p>
<p>Beispiele:</p>
<ul>
<li><code>ds]</code> &#8211; löscht eckige Klammern.</li>
<li><code>ds'</code> &#8211; löscht einfache Anführungszeichen.</li>
<li><code>dst</code> &#8211; löscht XML/HTML-Tags.</li>
</ul>
<p><strong>Wiederholen</strong><br />
Leider funktioniert das Wiederholen des letzten Kommandos mit Punkt nicht mit dem Surround-Plugin. Jedoch kann man es mit dem Plugin <a href="http://www.vim.org/scripts/script.php?script_id=2136" title="Vim Plugin - repeat" target="_blank" class="liexternal">repeat</a> zum funktionieren bringen.<br />
Dafür kopiert man die Datei <code>repeat.vim</code> in das Verzeichnis <code>~/.vim/autoload/</code>. Nachdem man <code>.</code> (Punkt) gedrückt hat muss man jedoch das Zeichen, welches eingefügt werden soll wiederholen.</p>
<p>Abhilfe schafft ansonsten auch die Nutzung von <a href="http://zinformatik.de/tipps-tricks/vim-tipps/makros-aufzeichnen-mit-vim/" title="Makros aufzeichnen mit vim" target="_self" class="liinternal">Makros</a>. Dabei können häufig genutzte Surroundings auch als Makro in die <code>~/.vimrc</code> gespeichert werden.<br />
Folgende Zeile definiert das Register k so, dass beim Aufruf des Makros k mittels <code>@k</code> das aktuelle Wort in runde Klammern eingeschlossen wird:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #804040;">let</span> <span style="color: #000000;">@</span>k=<span style="color: #C5A22D;">&quot;ysiw)&quot;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/vim-plugin-surround-umschliest-text-mit-klammern-anfuhrungszeichen-und-html-tags/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Whois Plugin für den zBot</title>
		<link>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/whois-plugin-fur-den-zbot/</link>
		<comments>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/whois-plugin-fur-den-zbot/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 16:59:53 +0000</pubDate>
		<dc:creator>zimon</dc:creator>
				<category><![CDATA[Plugins und Erweiterungen]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Ubuntuusers-Planet]]></category>
		<category><![CDATA[Bot]]></category>
		<category><![CDATA[Jabber]]></category>
		<category><![CDATA[whois]]></category>

		<guid isPermaLink="false">http://zinformatik.de/?p=1516</guid>
		<description><![CDATA[<p>Vor einiger Zeit habe ich ein Whois-Plugin für meinen Jabber Bot <a href="http://zinformatik.de/tipps-tricks/interessante-programme/zbot-ein-jabber-bot-in-perl/" title="zBot - ein Jabber Bot in Perl" target="_self" class="liinternal">zBot</a> geschrieben. Aus irgendeinem Grund habe ich es nie online gestellt. Dies möchte ich hiermit nachholen. Ich habe den Code noch ein wenig verschönert. </p>
<p>Fauchi95 hat mich gefragt, ob man nicht ein Whois-Plugin schreiben könnte, da ist es&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Vor einiger Zeit habe ich ein Whois-Plugin für meinen Jabber Bot <a href="http://zinformatik.de/tipps-tricks/interessante-programme/zbot-ein-jabber-bot-in-perl/" title="zBot - ein Jabber Bot in Perl" target="_self" class="liinternal">zBot</a> geschrieben. Aus irgendeinem Grund habe ich es nie online gestellt. Dies möchte ich hiermit nachholen. Ich habe den Code noch ein wenig verschönert. </p>
<p>Fauchi95 hat mich gefragt, ob man nicht ein Whois-Plugin schreiben könnte, da ist es mir wieder eingefallen <img src='http://zinformatik.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p>Die Bedienung ist so wie man es sich denkt. Man sendet dem Bot ein <code>whois</code> gefolgt von der gewünschten Domain und bekommt das Ergebnis zurück gesendet.</p>
<p><strong>Beispiel:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="plain" style="font-family:monospace;">whois zinformatik.de</pre></div></div>

<p>Zum Installieren des Plugins kopiert man die Datei <code>Whois.pm</code> in das Verzeichnis <code>plugins</code> im Hauptverzeichnis des zBot und startet dann den Bot neu.</p>
<p><strong>Download:</strong><br />
<a href="http://zinformatik.de/wp-content/uploads/2009/07/Whois.pm" class="liinternal">Whois.pm</a></p>
]]></content:encoded>
			<wfw:commentRss>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/whois-plugin-fur-den-zbot/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>VNUML &#8211; Ein Netzwerksimulator mit User-Mode-Linux</title>
		<link>http://zinformatik.de/tipps-tricks/interessante-programme/vnuml-ein-netzwerksimulator-mit-user-mode-linux/</link>
		<comments>http://zinformatik.de/tipps-tricks/interessante-programme/vnuml-ein-netzwerksimulator-mit-user-mode-linux/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 12:26:44 +0000</pubDate>
		<dc:creator>zimon</dc:creator>
				<category><![CDATA[Interessante Programme]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntuusers-Planet]]></category>
		<category><![CDATA[Netzwerk]]></category>
		<category><![CDATA[Routing]]></category>
		<category><![CDATA[Simulation]]></category>
		<category><![CDATA[User-Mode-Linux]]></category>
		<category><![CDATA[VNUML]]></category>

		<guid isPermaLink="false">http://zinformatik.de/?p=1468</guid>
		<description><![CDATA[<p><div id="attachment_1486" class="wp-caption alignright" style="width: 310px"><a href="http://zinformatik.de/wp-content/uploads/2009/07/switch-ethernet-connection.jpg" class="liimagelink"><img src="http://zinformatik.de/wp-content/uploads/2009/07/switch-ethernet-connection.jpg" alt="Foto: Ben Stanfield" title="Foto: Ben Stanfield" width="300" height="179" class="size-full wp-image-1486" /></a><p class="wp-caption-text">Foto: Ben Stanfield</p></div><a href="http://www.dit.upm.es/vnumlwiki/index.php/Main_Page" title="Offizielle VNUML Homepage" target="_blank" class="liexternal">VNUML</a> (Virtual Network User-Mode-Linux) ist ein Programm um Netzwerke zu simulieren. Dabei werden die beteiligten Rechner nicht nur simuliert, sondern als virtuelle Maschinen gestartet, wodurch sie mit echten Protokollen miteinander kommunizieren. Daher eignet sich dieses Tool sehr gut zum Testen und Lernen z.B von Routingprotokollen. Man kann damit jedoch auch Paketfiltering mittels <a href="http://de.wikipedia.org/wiki/Iptables" title="Wikipedia - iptables" target="_blank"&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_1486" class="wp-caption alignright" style="width: 310px"><a href="http://zinformatik.de/wp-content/uploads/2009/07/switch-ethernet-connection.jpg" class="liimagelink"><img src="http://zinformatik.de/wp-content/uploads/2009/07/switch-ethernet-connection.jpg" alt="Foto: Ben Stanfield" title="Foto: Ben Stanfield" width="300" height="179" class="size-full wp-image-1486" /></a><p class="wp-caption-text">Foto: Ben Stanfield</p></div><a href="http://www.dit.upm.es/vnumlwiki/index.php/Main_Page" title="Offizielle VNUML Homepage" target="_blank" class="liexternal">VNUML</a> (Virtual Network User-Mode-Linux) ist ein Programm um Netzwerke zu simulieren. Dabei werden die beteiligten Rechner nicht nur simuliert, sondern als virtuelle Maschinen gestartet, wodurch sie mit echten Protokollen miteinander kommunizieren. Daher eignet sich dieses Tool sehr gut zum Testen und Lernen z.B von Routingprotokollen. Man kann damit jedoch auch Paketfiltering mittels <a href="http://de.wikipedia.org/wiki/Iptables" title="Wikipedia - iptables" target="_blank" rel="nofollow" class="liwikipedia"><code>iptables</code></a> sowie andere Dienste wie <a href="http://de.wikipedia.org/wiki/Address_Resolution_Protocol" title="Wikipedia - ARP" target="_blank" rel="nofollow" class="liwikipedia"><em>ARP</em></a>, <a href="http://de.wikipedia.org/wiki/Domain_Name_System" title="Wikipedia - DNS" target="_blank" rel="nofollow" class="liwikipedia"><em>DNS</em></a> oder <a href="http://de.wikipedia.org/wiki/ICMP" title="Wikipedia - ICMP" target="_blank" rel="nofollow" class="liwikipedia"><em>ICMP</em></a> ausprobieren. Auch eigene Entwicklungen können so getestet werden.<br />
Da für jeden Rechner ein <a href="http://www.user-mode-linux.org/" title="User-Mode-Linux Homepage" target="_blank" class="liexternal">User-Mode-Linux System</a> (englisch) &#8211; welches über einen echten Kernel und ein eigenes Dateisystem verfügt &#8211; gestartet wird, ist die Simulation sehr realitätsnah und die Rechner verhalten sich wie echte autonome Maschinen.<br />
Für diesen Artikel ist es vorteilhaft, wenn man grundlegende Kenntnisse über Netzwerke besitzt (es wird z.B. vorausgesetzt, dass man weiß was <a href="http://de.wikipedia.org/wiki/IP-Adresse" title="Wikipedia - IP-Adresse" target="_blank" rel="nofollow" class="liwikipedia">IP-Adressen</a>, <a href="http://de.wikipedia.org/wiki/IP-Adresse#Netzwerkteil_und_Ger.C3.A4teteil" title="Wikipedia - IP-Adressen: Netzwerkteil und Geräteteil" target="_blank" rel="nofollow" class="liwikipedia">Netze und Netzmasken</a> sowie <a href="http://de.wikipedia.org/wiki/Router" title="Wikipedia - Router" target="_blank" rel="nofollow" class="liwikipedia">Router</a> sind)</p>
<p><strong>UPDATE:</strong> Artikel nochmal überarbeitet</p>
<p><strong>Installation</strong><br />
Für Debian basierte Distributionen gibt es ein .deb Paket, welches zumindest unter Ubuntu problemlos installiert werden kann. Ansonsten kann man sich den Quelltext herunter laden. Eine englische <a href="http://www.dit.upm.es/vnumlwiki/index.php/Installation" title="VNUML - Installation" target="_blank" class="liexternal">Installationsanleitung</a> ist auch verfügbar.<br />
Ist VNUML installiert, braucht man noch ein Dateisystem. Auf der Projektseite gibt es 2 verschiedene zum <a href="http://www.dit.upm.es/vnumlwiki/index.php/Download" title="VNUML - Dateisysteme Download" target="_blank" class="liexternal">downloaden</a>. Ein größeres, welches mehr Programme beinhaltet und ein sehr abgespecktes, welches nützlich ist um größere Netzwerke zu generieren, da für jeden virtuellen Rechner ein Dateisystem im Arbeitsspeicher liegt.<br />
Man kopiert das gewählte Dateisystem nach <code>/usr/share/vnuml/filesystems/filesystem.img</code>. Für die Beispiele in diesem Artikel reicht das kleine, welches man als <code>mini_fs</code> speichern kann. Dafür können die folgenden Befehle benutzt werden, nachdem man die Datei n3vlr-0.11-vnuml-v0.1.tar.gz herunter geladen hat:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvzf</span> n3vlr-<span style="color: #000000;">0.11</span>-vnuml-v0.1.tar.gz
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> n3vlr-<span style="color: #000000;">0.11</span>-vnuml-v0.1.img <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>vnuml<span style="color: #000000; font-weight: bold;">/</span>filesystems<span style="color: #000000; font-weight: bold;">/</span>mini_fs</pre></div></div>

<p>Möchte man das Dateisystem ändern um z.B. neue Programme hinzuzufügen oder unbenötigte Dateien zu löschen, kann man dieses mit dem Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>vnuml
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-o</span> loop <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>vnuml<span style="color: #000000; font-weight: bold;">/</span>filesystems<span style="color: #000000; font-weight: bold;">/</span>filesystem.img <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>vnuml</pre></div></div>

<p>einhängen. Nun kann man im Ordner <code>/mnt/vnunml</code> alle gewünschten Änderungen vornehmen und das Dateisystem danach mit <code>sudo umount /mnt/vnuml</code> wieder aushängen.</p>
<p><strong>Scenariodatei erstellen</strong><br />
Die Netzwerktopologie wird in einer XML-Datei beschrieben. In dieser werden zuerst die globalen Einstellungen festgelegt, in denen unter anderem angegeben wird, wo das zu nutzende Dateisystem liegt und welchen ssh-Key man nutzen möchte um auf die virtuellen Rechner zuzugreifen.<br />
Danach folgen die Definitionen der Netze gefolgt von den Rechnern.<br />
Im folgenden eine minimale Beispielkonfiguration, die zwei Rechner beschreibt, die über ein Netz miteinander verbunden sind. Zuerst der globale Teil, in dem die VNUML-Version, der Name des Scenarios und weitere Einstellungen definiert werden. Dort wird auch das Management-Netz (192.168.0.0/24) definiert, über das man vom eigenen Rechner auf die verschiedenen virtualisierten Maschinen zugreifen kann.<br />
Existiert noch kein öffentlicher ssh-key, so sollte man sich mit folgendem Kommando einen anlegen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span></pre></div></div>

<p>Bei der Frage nach einem Passwort drückt man einfach Enter ohne ein Passwort einzugeben. Der vorgeschlagene Pfad sollte stimmen, kann also beibehalten werden.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #00bbdd;">&lt;!DOCTYPE vnuml SYSTEM &quot;/usr/share/xml/vnuml/vnuml.dtd&quot;&gt;</span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;vnuml<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;global<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.8<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;simulation_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>beispiel<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/simulation_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ssh_version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ssh_version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ssh_key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/root/.ssh/id_rsa.pub<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ssh_key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;automac</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;vm_mgmt</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;private&quot;</span> <span style="color: #000066;">network</span>=<span style="color: #ff0000;">&quot;192.168.0.0&quot;</span> <span style="color: #000066;">mask</span>=<span style="color: #ff0000;">&quot;24&quot;</span> <span style="color: #000066;">offset</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;host_mapping</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/vm_mgmt<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;vm_defaults</span> <span style="color: #000066;">exec_mode</span>=<span style="color: #ff0000;">&quot;mconsole&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filesystem</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;cow&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>/usr/share/vnuml/filesystems/mini_fs<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filesystem<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;kernel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/usr/share/vnuml/kernels/linux<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/kernel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/vm_defaults<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/global<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Als nächstes werden die Netze definiert. In diesem Beispiel gibt es nur ein Netz, da man sich sonst um das Routing kümmern müsste (dazu später mehr).</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;net</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;net1&quot;</span> <span style="color: #000066;">mode</span>=<span style="color: #ff0000;">&quot;virtual_bridge&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Im Modus &#8220;virtual_bridge&#8221; werden die Interfaces aller virtuellen Rechner sowie alle Netze über Bridges ans Hostsystem (den eigenen Rechner) gekoppelt, so dass man sie mit einem <code>ifconfig</code> sehen und mittels <a href="http://de.wikipedia.org/wiki/Tcpdump" title="Wikipedia - tcpdump" target="_blank" rel="nofollow" class="liwikipedia"><code>tcpdump</code></a> oder <a href="http://de.wikipedia.org/wiki/Wireshark" title="Wikipedia - Wireshark" target="_blank" rel="nofollow" class="liwikipedia">Wireshark</a> überwachen kann. Dafür wird jedoch das Paket &#8220;bridge-utils&#8221; benötigt. Alternativ kann man statt dessen auch &#8220;uml_switch&#8221; benutzen.</p>
<p>Nun folgen die Definitionen der virtuellen Rechner. Bei beiden Rechnern wird ein Interface definiert (es können aber auch mehrere sein, z.B. für Router).</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;vm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;rechner1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;if</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">net</span>=<span style="color: #ff0000;">&quot;net1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ipv4</span> <span style="color: #000066;">mask</span>=<span style="color: #ff0000;">&quot;255.255.255.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>10.0.1.1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ipv4<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/if<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/vm<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;vm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;r2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;if</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">net</span>=<span style="color: #ff0000;">&quot;net1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ipv4</span> <span style="color: #000066;">mask</span>=<span style="color: #ff0000;">&quot;255.255.255.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>10.0.1.2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ipv4<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/if<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/vm<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/vnuml<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Es empfiehlt sich die Datei genauso wie das Scenario (die globale Eigenschaft <code>simulation_name</code>) zu benennen. In diesem Fall also <code>beispiel.xml</code></p>
<p><strong>Scenario starten und zu den Rechnern verbinden</strong><br />
Um das Scenario zu starten genügt der folgende Aufruf:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> vnumlparser.pl <span style="color: #660033;">-t</span> beispiel.xml</pre></div></div>

<p>Nachdem das Scenario gestartet ist, kann man sich auf einen der Rechner einloggen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ssh</span> rechner1</pre></div></div>

<p>Durch die Angabe des öffentlichen ssh-Keys sollte es keine Passwortabfrage geben. Ansonsten ist das Passwort per default <code>xxxx</code>. Nun kann man alles mögliche Testen. Man kann einen Ping versenden:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ping</span> 10.0.1.2</pre></div></div>

<p>oder ein Interface überwachen.<br />
Dafür loggt man sich am besten in einer anderen Konsole auf dem 2. Rechner ein:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ssh</span> rechner2</pre></div></div>

<p>und startet dort einen TCP-Dump:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">tcpdump <span style="color: #660033;">-i</span> eth1</pre></div></div>

<p>Der Ping sollte die ganze Zeit weiter laufen, damit man auch etwas sehen kann. Danach kann man ihn mit Strg+c stoppen.<br />
Mit <code>exit</code> kann man einen Rechner wieder verlassen.<br />
Da man häufiger auf mehreren Rechnern gleichzeitig eingeloggt sein möchte wenn man mit VNUML arbeitet, bietet es sich an <a href="http://zinformatik.de/tipps-tricks/interessante-programme/einfuhrung-in-screen/" title="Einführung in Screen" target="_self" class="liinternal">Screen</a> zu benutzen.<br />
Um die Simulation zu beenden führt man folgenden Befehl aus:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> vnumlparser.pl <span style="color: #660033;">-P</span> beispiel.xml</pre></div></div>

<p><strong>Dienste starten</strong><br />
Wie bereits erwähnt eignet sich VNUML besonders gut zum ausprobieren und Testen von Routingprotokollen. Daher sind auch die Quagga-Implementationen der bekanntesten Routingprotokolle <em>RIP</em>, <em>OSPF</em> und <em>BGP</em> bereits installiert und können recht einfach genutzt werden. Ich werde in diesem Artikel jedoch nur eine Minimalkonfiguration für <em>RIP</em> und <em>OSPF</em> angeben. Eine Einführung in diese Protokolle und deren Konfiguration würde an dieser Stelle zu weit führen.<br />
Um das Routing grundsätzlich zu aktivieren wird das Tag</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;forwarding</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;ipv4&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>genutzt. Weitere Tags binden ein Konfigurationsverzeichnis <code>conf</code> ein (welches im gleichen Verzeichnis, wie die xml-Datei des Scenarios liegt) und starten die verschiedenen Daemons.<br />
Im Verzeichnis <code>conf</code> sollten dann die folgenden Dateien vorhanden sein:</p>
<p><code>zebra.conf</code></p>

<div class="wp_syntax"><div class="code"><pre class="plain" style="font-family:monospace;">!
hostname zebra
!
password xxxx
enable password xxxx</pre></div></div>

<p><code>ripd.conf</code></p>

<div class="wp_syntax"><div class="code"><pre class="plain" style="font-family:monospace;">!
hostname ripd
password xxxx
!
router rip
network 10.0.0.0/8</pre></div></div>

<p><code>ospfd.conf</code></p>

<div class="wp_syntax"><div class="code"><pre class="plain" style="font-family:monospace;">!
hostname ospfd
password xxxx
!
router ospf
network 10.0.0.0/8 area 0</pre></div></div>

<p>Weitere Infos zu den Quagga-Routingprotokollen gibt es unter <a href="http://www.quagga.net/" title="Quagga Homepage" target="_blank" class="liexternal">http://www.quagga.net</a>.<br />
Ein Scenario, welches der Einfachheit halber nur aus Routern besteht, auf denen man wahlweise <em>OSPF</em> oder <em>RIP</em> starten kann wird im folgenden Beispiel definiert:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #00bbdd;">&lt;!DOCTYPE vnuml SYSTEM &quot;/usr/share/xml/vnuml/vnuml.dtd&quot;&gt;</span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;vnuml<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;global<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.8<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;simulation_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>mini<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/simulation_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ssh_version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ssh_version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ssh_key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/root/.ssh/id_rsa.pub<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ssh_key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;automac</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;vm_mgmt</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;private&quot;</span> <span style="color: #000066;">network</span>=<span style="color: #ff0000;">&quot;192.168.0.0&quot;</span> <span style="color: #000066;">mask</span>=<span style="color: #ff0000;">&quot;24&quot;</span> <span style="color: #000066;">offset</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;host_mapping</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/vm_mgmt<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;vm_defaults</span> <span style="color: #000066;">exec_mode</span>=<span style="color: #ff0000;">&quot;mconsole&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filesystem</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;cow&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>/usr/share/vnuml/filesystems/mini_fs<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filesystem<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;kernel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/usr/share/vnuml/kernels/linux<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/kernel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/vm_defaults<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/global<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;net</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;net1&quot;</span> <span style="color: #000066;">mode</span>=<span style="color: #ff0000;">&quot;virtual_bridge&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;net</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;net2&quot;</span> <span style="color: #000066;">mode</span>=<span style="color: #ff0000;">&quot;virtual_bridge&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;vm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;r1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;if</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">net</span>=<span style="color: #ff0000;">&quot;net1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ipv4</span> <span style="color: #000066;">mask</span>=<span style="color: #ff0000;">&quot;255.255.255.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>10.0.1.1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ipv4<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/if<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;forwarding</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;ipv4&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filetree</span> <span style="color: #000066;">root</span>=<span style="color: #ff0000;">&quot;/etc/quagga&quot;</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;start&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>conf<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filetree<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;start&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>sysctl -w net.ipv4.conf.all.rp_filter=0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;start&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>hostname<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;start&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>/usr/lib/quagga/zebra -f /etc/quagga/zebra.conf -d<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;rip&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>/usr/lib/quagga/ripd -f /etc/quagga/ripd.conf -d<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;ospf&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>/usr/lib/quagga/ospfd -f /etc/quagga/ospfd.conf -d -P 2604<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;stop&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>hostname<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;stop&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>killall zebra<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;stop&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>killall ripd<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;stop&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>killall ospfd<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;rpfilter&quot;</span> <span style="color: #000066;">type</span>= <span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            for f in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 0 &gt; $f; done
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/vm<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;vm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;r2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;if</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">net</span>=<span style="color: #ff0000;">&quot;net1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ipv4</span> <span style="color: #000066;">mask</span>=<span style="color: #ff0000;">&quot;255.255.255.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>10.0.1.2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ipv4<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/if<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;if</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000066;">net</span>=<span style="color: #ff0000;">&quot;net2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ipv4</span> <span style="color: #000066;">mask</span>=<span style="color: #ff0000;">&quot;255.255.255.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>10.0.2.1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ipv4<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/if<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;forwarding</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;ipv4&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filetree</span> <span style="color: #000066;">root</span>=<span style="color: #ff0000;">&quot;/etc/quagga&quot;</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;start&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>conf<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filetree<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;start&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>sysctl -w net.ipv4.conf.all.rp_filter=0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;start&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>hostname<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;start&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>/usr/lib/quagga/zebra -f /etc/quagga/zebra.conf -d<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;rip&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>/usr/lib/quagga/ripd -f /etc/quagga/ripd.conf -d<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;ospf&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>/usr/lib/quagga/ospfd -f /etc/quagga/ospfd.conf -d -P 2604<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;stop&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>hostname<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;stop&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>killall zebra<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;stop&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>killall ripd<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;stop&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>killall ospfd<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;rpfilter&quot;</span> <span style="color: #000066;">type</span>= <span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            for f in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 0 &gt; $f; done
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/vm<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;vm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;r3&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;if</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">net</span>=<span style="color: #ff0000;">&quot;net2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ipv4</span> <span style="color: #000066;">mask</span>=<span style="color: #ff0000;">&quot;255.255.255.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>10.0.2.2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ipv4<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/if<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;forwarding</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;ipv4&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filetree</span> <span style="color: #000066;">root</span>=<span style="color: #ff0000;">&quot;/etc/quagga&quot;</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;start&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>conf<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filetree<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;start&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>sysctl -w net.ipv4.conf.all.rp_filter=0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;start&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>hostname<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;start&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>/usr/lib/quagga/zebra -f /etc/quagga/zebra.conf -d<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;rip&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>/usr/lib/quagga/ripd -f /etc/quagga/ripd.conf -d<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;ospf&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>/usr/lib/quagga/ospfd -f /etc/quagga/ospfd.conf -d -P 2604<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;stop&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>hostname<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;stop&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>killall zebra<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;stop&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>killall ripd<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;stop&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>killall ospfd<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">seq</span>=<span style="color: #ff0000;">&quot;rpfilter&quot;</span> <span style="color: #000066;">type</span>= <span style="color: #ff0000;">&quot;verbatim&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            for f in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 0 &gt; $f; done
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/vm<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/vnuml<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><div id="attachment_1493" class="wp-caption alignright" style="width: 310px"><a href="http://zinformatik.de/wp-content/uploads/2009/06/mini.png" class="liimagelink"><img src="http://zinformatik.de/wp-content/uploads/2009/07/mini-300x53.png" alt="Die Topologie des Beispielscenarios mini.xml" title="Die Topologie des Beispielscenarios mini.xml" width="300" height="53" class="size-medium wp-image-1493" /></a><p class="wp-caption-text">Die Topologie des Beispielscenarios mini.xml</p></div>Dieses Beispiel besteht aus 3 Routern, die mit zwei Netzen zu einer &#8220;Kette&#8221; verbunden sind (siehe Abbildung rechts). Startet man dieses Scenario, so kann man nicht von r1 (10.0.1.1) nach r3 (10.0.2.2) pingen, da die Routingdaemons noch nicht gestartet sind und r1 noch nichts von net2 weiß:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> vnumlparser.pl <span style="color: #660033;">-t</span> mini.xml
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ssh</span> root<span style="color: #000000; font-weight: bold;">@</span>r1
<span style="color: #c20cb9; font-weight: bold;">ping</span> 10.0.2.2</pre></div></div>

<p>Wie man sieht, kommen die Pings nicht bei r3 an.  Mit <code>exit</code> verläst man den Router r1 wieder.<br />
Es gibt nun 4 Sequenzen, die ausgeführt werden können: <em>start</em>, <em>stop</em>, <em>rip</em> und <em>ospf</em>. Dabei wird durch ausführen der Sequenz <em>start</em> der Hostname gesetzt und der zebra-Daemon gestartet. Mit <em>rip</em> oder <em>ospf</em> wird der entsprechende Routingdaemon gestartet und <em>stop</em> beendet alle Routingprozesse.<br />
Man startet nun also z.B. den <em>RIP</em>-Daemon mit den folgenden Befehlen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> vnumlparser.pl <span style="color: #660033;">-x</span> start<span style="color: #000000; font-weight: bold;">@</span>mini.xml
<span style="color: #c20cb9; font-weight: bold;">sudo</span> vnumlparser.pl <span style="color: #660033;">-x</span> rip<span style="color: #000000; font-weight: bold;">@</span>mini.xml</pre></div></div>

<p>Nun kann man testen, ob das Routing auch funktioniert, indem man den Ping, der vorher fehlschlug wiederholt:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ssh</span> root<span style="color: #000000; font-weight: bold;">@</span>r1
<span style="color: #c20cb9; font-weight: bold;">ping</span> 10.0.2.2</pre></div></div>

<p>Jetzt sollte der Ping funktionierten. Bei größeren Scenarien kann es einige Sekunden dauern bis alle Router über die notwendigen Informationen verfügen (also bis das Scenario <em>konvergent</em> ist).</p>
<p>Natürlich gibt es noch viele weitere Optionen und Möglichkeiten, die VNUML zur Verfügung stellt. Dies soll nur eine kleine Einführung sein, um die ersten Schritte mit diesem System zu machen. </p>
<p><strong>Links</strong></p>
<ul>
<li><a href="http://www.dit.upm.es/vnumlwiki/index.php/Main_Page" title="Offizielle VNUML Seite" target="_blank" class="liexternal">http://www.dit.upm.es/vnumlwiki/index.php/Main_Page</a> (englisch) &#8211; Offizielle VNUML Seite mit Downloadmöglichkeit und Dokumentation</li>
<li><a href="http://www.uni-koblenz.de/~vnuml/index.de.php" title="Deutsche VNUML Seite der Universität Koblenz" target="_blank" class="liexternal">http://www.uni-koblenz.de/~vnuml/index.de.php</a> &#8211; VNUML Seiten der Universität Koblenz</li>
<li><a href="http://de.wikipedia.org/wiki/VNUML" title="Wikipedia - VNUML" target="_blank" rel="nofollow" class="liwikipedia">http://de.wikipedia.org/wiki/VNUML</a> &#8211; Wikipedia Artikel zu VNUML</li>
<li><a href="http://www.quagga.net/" title="Quagga Homepage" target="_blank" class="liexternal">http://www.quagga.net</a> (englisch) &#8211; Offizielle Quagga Seite</li>
<li><a href="http://de.wikipedia.org/wiki/Quagga_(Software)" title="Wikipedia - Quagga" target="_blank" rel="nofollow" class="liwikipedia">http://de.wikipedia.org/wiki/Quagga_(Software)</a> &#8211; Wikipedia Artikel zu Quagga</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://zinformatik.de/tipps-tricks/interessante-programme/vnuml-ein-netzwerksimulator-mit-user-mode-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vim Plugin &#8211; Tasklist sammelt Infos über offene und fertige Todos</title>
		<link>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/vim-plugin-tasklist-sammelt-infos-uber-offene-und-fertige-todos/</link>
		<comments>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/vim-plugin-tasklist-sammelt-infos-uber-offene-und-fertige-todos/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 16:41:00 +0000</pubDate>
		<dc:creator>zimon</dc:creator>
				<category><![CDATA[Plugins und Erweiterungen]]></category>
		<category><![CDATA[Ubuntuusers-Planet]]></category>
		<category><![CDATA[vim Tipps]]></category>
		<category><![CDATA[Todo]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://zinformatik.de/?p=1456</guid>
		<description><![CDATA[<p>Das Vim Plugin <a href="http://www.vim.org/scripts/script.php?script_id=2607" title="Vim Plugin - Tasklist" target="_blank" class="liexternal">Tasklist</a> ist ein kleines aber praktisches Plugin, welches im aktuellen Text nach den Wörtern <em>TODO</em>, <em>XXX</em>, <em>FIXME</em> und <em>DONE</em> sucht und eine Liste daraus erstellt. </p>
<p>Sobald das Plugin installiert ist (indem die Datei <code>tasklist.vim</code> nach <code>~/.vim/plugin/</code> kopiert wurde), kann man die TODO-Liste mit <code>\t</code> generieren und angezeigen.</p>
<p>Dabei öffnet&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Das Vim Plugin <a href="http://www.vim.org/scripts/script.php?script_id=2607" title="Vim Plugin - Tasklist" target="_blank" class="liexternal">Tasklist</a> ist ein kleines aber praktisches Plugin, welches im aktuellen Text nach den Wörtern <em>TODO</em>, <em>XXX</em>, <em>FIXME</em> und <em>DONE</em> sucht und eine Liste daraus erstellt. </p>
<p>Sobald das Plugin installiert ist (indem die Datei <code>tasklist.vim</code> nach <code>~/.vim/plugin/</code> kopiert wurde), kann man die TODO-Liste mit <code>\t</code> generieren und angezeigen.</p>
<p>Dabei öffnet sich ein horizontaler <a href="http://zinformatik.de/tipps-tricks/vim-tipps/unter-vim-mit-splitscreens-arbeiten/" title="Unter vim mit Splitscreens arbeiten" target="_self" class="liinternal">Splitscreen</a>, in dem alle Vorkommen von <em>TODO</em>, <em>XXX</em> und <em>FIXME</em> sortiert nach Vorkommen und mit Angabe der Zeilennummer aufgeführt werden. Dabei wird auch der Rest der Zeile hinter dem Schlüsselwort angezeigt, so dass man auch sehen kann worum es bei einem <em>TODO</em> geht. </p>
<p>Wenn man mit j und k durch die Liste navigiert wird die entsprechende Textstelle im eigentlichen Text jeweils automatisch angesprungen. Drückt man Enter, so schließt sich der Splitscreen und man befindet sich an der Stelle des zuletzt ausgewählten <em>TODO</em>s im Text.</p>
<p>Die mit <em>DONE</em> gekennzeichneten Textstellen werden unter den noch offenen <em>TODO</em>s angezeigt. Ansonsten funktionieren sie genauso wie <em>TODO</em>s.</p>
<p> Nach jedem Speichervorgang kann die Liste mit <code>\t</code> neu generiert werden. </p>
]]></content:encoded>
			<wfw:commentRss>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/vim-plugin-tasklist-sammelt-infos-uber-offene-und-fertige-todos/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>POV-Ray &#8211; ein Raytracer</title>
		<link>http://zinformatik.de/tipps-tricks/interessante-programme/pov-ray-ein-raytracer/</link>
		<comments>http://zinformatik.de/tipps-tricks/interessante-programme/pov-ray-ein-raytracer/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 12:55:53 +0000</pubDate>
		<dc:creator>zimon</dc:creator>
				<category><![CDATA[Interessante Programme]]></category>
		<category><![CDATA[Ubuntuusers-Planet]]></category>
		<category><![CDATA[Computergrafik]]></category>
		<category><![CDATA[POV-Ray]]></category>
		<category><![CDATA[Raytracing]]></category>
		<category><![CDATA[Rendering]]></category>

		<guid isPermaLink="false">http://zinformatik.de/?p=1444</guid>
		<description><![CDATA[<div id="attachment_1445" class="wp-caption alignright" style="width: 310px"><a href="http://zinformatik.de/wp-content/uploads/2009/06/povraybeispiel.png" class="liimagelink"><img class="size-medium wp-image-1445" title="Ein mit POV-Ray generiertes Bild" src="http://zinformatik.de/wp-content/uploads/2009/06/povraybeispiel-300x225.png" alt="Ein mit POV-Ray generiertes Bild" width="300" height="225" /></a><p class="wp-caption-text">Ein mit POV-Ray generiertes Bild</p></div>
<p>Mit dem quelloffnen Raytracer <a href="http://www.povray.org" title="POV-Ray Homepage" target="_blank" class="liexternal">POV-Ray</a> kann man sehr realitätsnahe Bilder erzeugen. Anders als bei den meisten anderen 3D-Grafikprogrammen arbeitet man hier nicht mit einer graphischen Oberfläche und Maus sondern beschreibt die Objekte textbasiert über dessen Positionen in einem Koordinatensystem.</p>
<p><strong>[UPDATE]</strong>Artikel nochmals überarbeitet und Beispiel hinzugefügt.<strong>[/UPDATE]</strong>&#8230;</p>]]></description>
			<content:encoded><![CDATA[<div id="attachment_1445" class="wp-caption alignright" style="width: 310px"><a href="http://zinformatik.de/wp-content/uploads/2009/06/povraybeispiel.png" class="liimagelink"><img class="size-medium wp-image-1445" title="Ein mit POV-Ray generiertes Bild" src="http://zinformatik.de/wp-content/uploads/2009/06/povraybeispiel-300x225.png" alt="Ein mit POV-Ray generiertes Bild" width="300" height="225" /></a><p class="wp-caption-text">Ein mit POV-Ray generiertes Bild</p></div>
<p>Mit dem quelloffnen Raytracer <a href="http://www.povray.org" title="POV-Ray Homepage" target="_blank" class="liexternal">POV-Ray</a> kann man sehr realitätsnahe Bilder erzeugen. Anders als bei den meisten anderen 3D-Grafikprogrammen arbeitet man hier nicht mit einer graphischen Oberfläche und Maus sondern beschreibt die Objekte textbasiert über dessen Positionen in einem Koordinatensystem.</p>
<p><strong>[UPDATE]</strong>Artikel nochmals überarbeitet und Beispiel hinzugefügt.<strong>[/UPDATE]</strong></p>
<p><strong>Was ist Raytracing?</strong><br />
Raytracing ist eine Methode um Computergenerierte Bilder zu erzeugen. Der Unterschied zum Rendering besteht darin, dass keine Gittermodelle mit Texturen belegt werden und die Farbe dann mittels des Lichtes berechnet wird sondern eine Strahlenverfolgung statt findet, wodurch viel realistischere Bilder entstehen. Leider ist dieses Verfahren auch wesentlich rechenintensiver. Dafür bekommt man Schatten und Spiegelungen quasi geschenkt, was mit Rendering relativ schwer zu realisieren ist. (Siehe auch: <a href="http://de.wikipedia.org/wiki/Raytracing" title="Wikipedia - Raytracing" target="_blank" rel="nofollow" class="liwikipedia">http://de.wikipedia.org/wiki/Raytracing</a>) </p>
<p>Einen guten Eindruck, was POV-Ray leisten kann bekommt man in der <a href="http://hof.povray.org" title="POV-Ray Galerie" target="_blank" class="liexternal">Galerie der POV-Ray Homepage</a>.</p>
<p><strong>Download und Installation</strong><br />
POV-Ray steht unter einer eigenen Lizenz, die zwar das Einsehen des Quelltextes, aber nicht die veränderte Weitergabe im Sinne freier Software erlaubt (was sich aber bald ändern soll, siehe Kommentare).</p>
<p>Das Programm ist für alle gängigen Betriebssysteme verfügbar und kann sogar in einem Cluster (also auf mehreren PC&#8217;s gleichzeitig) verwendet werden.<br />
<strong>[UPDATE]</strong>POV-Ray kann unter Ubuntu mittels <code>sudo apt-get install povray</code> installiert werden.<br />
Ansonsten kann man die Binärdateien von der <a href="http://www.povray.org/download/" title="Downloadseite von POV-Ray" target="_blank" class="liexternal">Homepage beziehen</a><strong>[/UPDATE]</strong></p>
<p><strong>Grundsätzliche Funktionsweise</strong><br />
In einer Scenenbeschreibungssprache werden alle Objekte, Lichtquellen und die Kamera an 3D-Positionen im Raum definiert (z.B. Kugel an Stelle x,y,z mit Radius r und Farbe rot). Daneben gibt es noch viele weitere Optionen um bestimmte Materialien zu simulieren. Daraus wird dann das Bild berechnet.</p>
<p>Zitat:</p>
<blockquote><p>Der Qualität und dem Anspruch der gerenderten Bilder sind keine theoretischen Grenzen gesetzt;<br />
        in der Praxis ist die zur Verfügung stehende Rechen- oder Computer-Zeit der begrenzende Faktor.</p></blockquote>
<p>Quelle: <a href="http://de.wikipedia.org/wiki/Povray" title="Wikipedia - POV-Ray" target="_blank" rel="nofollow" class="liwikipedia">http://de.wikipedia.org/wiki/Povray</a></p>
<p>Interessant ist Povray durch seine Scenenbeschreibungssprache auch wegen der Automatisierbarkeit.<br />
z.B. ist EAGLE ein Programm um elektronische Schaltungen zu entwerfen und daraus entsprechende Boardlayouts zu konstruieren. Mittels eines Scripts kann man sich die Platine zu einem fertigen Layout vor dem eigentlichen Bau mit POV-Ray Rendern lassen um sich ansehen zu können, wie es später aussehen wird. (Macht sich sehr gut in Ausarbeitungen oder um vorab etwas präsentieren zu können.)</p>
<div id="attachment_1446" class="wp-caption aligncenter" style="width: 562px"><a href="http://zinformatik.de/wp-content/uploads/2009/06/usb_adapter_board.jpg" class="liimagelink"><img class="size-full wp-image-1446" title="Das Board-Layout eines USB&lt;-&gt;UART Konverters" src="http://zinformatik.de/wp-content/uploads/2009/06/usb_adapter_board.jpg" alt="Das Board-Layout eines USB&lt;-&gt;UART Konverters" width="552" height="275" /></a><p class="wp-caption-text">Das Board-Layout eines USB&lt;-&gt;UART Konverters</p></div>
<div id="attachment_1447" class="wp-caption aligncenter" style="width: 410px"><a href="http://zinformatik.de/wp-content/uploads/2009/06/usb_adapter_povray.jpg" class="liimagelink"><img class="size-full wp-image-1447" title="Das mit POV-Ray aus dem Board-Layout generierte Bild" src="http://zinformatik.de/wp-content/uploads/2009/06/usb_adapter_povray.jpg" alt="Das mit POV-Ray aus dem Board-Layout generierte Bild" width="400" height="300" /></a><p class="wp-caption-text">Das mit POV-Ray aus dem Board-Layout generierte Bild</p></div>
<div id="attachment_50" class="wp-caption aligncenter" style="width: 522px"><a href="http://zinformatik.de/wp-content/uploads/2008/12/usb_modul1.jpg" class="liimagelink"><img class="size-full wp-image-50" title="Ein Foto der fertigen Platine" src="http://zinformatik.de/wp-content/uploads/2008/12/usb_modul1.jpg" alt="Ein Foto der fertigen Platine" width="512" height="440" /></a><p class="wp-caption-text">Ein Foto der fertigen Platine (um 180° gedreht)</p></div>
<p>Übrigens ist der linke Teil meines Banners (oben auf der Seite) auch ein Teil einer mit POV-Ray gerenderten Platine. Der Rechte Teil ist ein Ausschnitt des EALGE Layouts, aus dem es generiert wurde.</p>
<p><strong>Beispiel</strong><br />
Im folgenden Beispiel wird eine einfache Scene erstellt. Zuerst wird eine Datei mit Farbdefinitionen eingebunden, damit man nicht jede Farbe als RGB-Wert eingeben braucht. Danach wird eine Kamera definiert. Dabei gibt man die Position an, wo sie sich befinden soll und die Position, auf die die Kamera zeigen soll.<br />
Als nächstes muss noch eine Lichtquelle definiert werden, damit man auch etwas sehen kann. Diese wird mit dem Schlüsselwort light_source eingeleitet und hat eine Position und eine Farbe. Nun können die einzelnen Objekte definiert werden.<br />
Als Boden wird eine Ebene definiert, die schwarz-weiß kariert ist und waagerecht auf der Höhe -1 liegt. Die Koordinaten geben die Lage der Ebene an, die immer Senkrecht auf dem angegebenen Vektor liegt. Dahinter kann man ein Offset (der Abstand zum Nullpunkt), in diesem Fall also die Höhe angeben.<br />
Die Farbe wird mit dem Schlüsselwort &#8220;pigment&#8221; angegeben. Da die Ebene Kariert sein soll nutzen wir hier die Option &#8220;checker&#8221; gefolgt von zwei Farbwerten.<br />
Durch die Include-Anweisung am Anfang können hier die Namen der Farben verwendet werden. Ansonsten müsste man den RGB-Wert angeben.<br />
Der Himmel wird durch ein &#8220;sky_sphere&#8221;-Objekt erzeugt, welches entlang der y-Achse (&#8220;gradient y&#8221;) von Hellblau nach Blau verläuft (&#8220;color_map&#8221;).<br />
Nun kann man noch weitere Objekte auf der Ebene platzieren. Eine Kugel (sphere) besitzt einen Mittelpunkt und eine Durchmesser und natürlich auch eine Farbe.<br />
Ein Kegel (cone) hat zwei Koordinaten, die den Mittelpunkte der beiden Enden entsprechen sowie je einen Durchmesser an jedem Ende.</p>
<p>Neben der Farbe kann auch noch die Oberflächenstruktur und -Politur definiert werden. Für die Struktur ist das Schlüsselwort &#8220;normal&#8221; zuständig, die Politur wird mittels &#8220;finish&#8221; angegeben. Im Beispiel wird der 2. Kugel eine reflektierende Politur gegeben, so dass sie die anderen Objekte spiegelt. (je höher der Reflektionswert, desto stärker die Spiegelung.</p>
<p>Nun der Code des Beispiels:</p>

<div class="wp_syntax"><div class="code"><pre class="povray" style="font-family:monospace;"><span style="color: #66cc66; font-weight: bold;">#include</span> <span style="color: #ff0000;">&quot;colors.inc&quot;</span>
&nbsp;
<span style="color: #116688; font-weight: bold;">camera</span> <span style="color: #66cc66;">&#123;</span>    <span style="color: #808080; font-style: italic;">// Die Kamera</span>
    <span style="color: #a63123;">location</span> <span style="color: #66cc66;">&lt;</span><span style="color: #cc66aa;">2</span>, <span style="color: #cc66aa;">3</span>, <span style="color: #66cc66;">-</span><span style="color: #cc66aa;">6</span><span style="color: #66cc66;">&gt;</span>
    <span style="color: #a63123;">look_at</span> <span style="color: #66cc66;">&lt;</span><span style="color: #cc66aa;">0</span>, <span style="color: #cc66aa;">1</span>, <span style="color: #cc66aa;">2</span><span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #116688; font-weight: bold;">light_source</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// Die Lichtquelle</span>
    <span style="color: #66cc66;">&lt;</span><span style="color: #cc66aa;">3</span>, <span style="color: #cc66aa;">5</span>, <span style="color: #66cc66;">-</span><span style="color: #cc66aa;">4</span><span style="color: #66cc66;">&gt;</span>
    <span style="color: #a63123;">color</span> White
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #116688; font-weight: bold;">plane</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// Eine Ebene</span>
    <span style="color: #66cc66;">&lt;</span><span style="color: #cc66aa;">0</span>, <span style="color: #cc66aa;">1</span>, <span style="color: #cc66aa;">0</span><span style="color: #66cc66;">&gt;</span>, <span style="color: #66cc66;">-</span><span style="color: #cc66aa;">1</span>
    <span style="color: #116688; font-weight: bold;">pigment</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #a63123;">checker</span> <span style="color: #a63123;">color</span> White, <span style="color: #a63123;">color</span> Black <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span> 
&nbsp;
<span style="color: #116688; font-weight: bold;">sky_sphere</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// Der Himmel</span>
    <span style="color: #116688; font-weight: bold;">pigment</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #a63123;">gradient</span> <span style="color: #cc1122; font-weight: bold;">y</span>
        <span style="color: #116688; font-weight: bold;">color_map</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #66cc66;">&#91;</span><span style="color: #cc66aa;">0.0</span> <span style="color: #a63123;">color</span> <span style="color: #a63123;">rgb</span> <span style="color: #66cc66;">&lt;</span><span style="color: #cc66aa;">0.7</span>,<span style="color: #cc66aa;">0.7</span>,<span style="color: #cc66aa;">1.0</span><span style="color: #66cc66;">&gt;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#91;</span><span style="color: #cc66aa;">1.0</span> <span style="color: #a63123;">color</span> <span style="color: #cc1122; font-weight: bold;">blue</span> <span style="color: #cc66aa;">0.5</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #116688; font-weight: bold;">sphere</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// eine Kugel</span>
    <span style="color: #66cc66;">&lt;-</span><span style="color: #cc66aa;">3</span>, <span style="color: #cc66aa;">1</span>, <span style="color: #cc66aa;">4</span><span style="color: #66cc66;">&gt;</span>, <span style="color: #cc66aa;">2</span>
    <span style="color: #116688; font-weight: bold;">pigment</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #a63123;">color</span> Yellow <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>  
&nbsp;
<span style="color: #116688; font-weight: bold;">cone</span><span style="color: #66cc66;">&#123;</span>   <span style="color: #808080; font-style: italic;">// Ein Kegel</span>
    <span style="color: #66cc66;">&lt;</span><span style="color: #cc66aa;">3</span>,<span style="color: #66cc66;">-</span><span style="color: #cc66aa;">1</span>,<span style="color: #cc66aa;">3</span><span style="color: #66cc66;">&gt;</span>,<span style="color: #cc66aa;">1</span>,<span style="color: #66cc66;">&lt;</span><span style="color: #cc66aa;">2.5</span>,<span style="color: #cc66aa;">4</span>,<span style="color: #cc66aa;">4</span><span style="color: #66cc66;">&gt;</span>,<span style="color: #cc66aa;">0</span>
    <span style="color: #116688; font-weight: bold;">pigment</span><span style="color: #66cc66;">&#123;</span><span style="color: #a63123;">color</span> <span style="color: #cc1122; font-weight: bold;">Green</span><span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #116688; font-weight: bold;">sphere</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// Eine reflektierende Kugel</span>
    <span style="color: #66cc66;">&lt;</span><span style="color: #cc66aa;">0</span>, <span style="color: #cc66aa;">2.5</span>, <span style="color: #cc66aa;">10</span><span style="color: #66cc66;">&gt;</span>, <span style="color: #cc66aa;">3</span>
    <span style="color: #116688; font-weight: bold;">finish</span><span style="color: #66cc66;">&#123;</span>
        <span style="color: #a63123;">reflection</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #cc66aa;">0.8</span>       
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<div id="attachment_1565" class="wp-caption aligncenter" style="width: 310px"><a href="http://zinformatik.de/wp-content/uploads/2009/06/bild2.png" class="liimagelink"><img src="http://zinformatik.de/wp-content/uploads/2009/06/bild2-300x225.png" alt="Das Ergebnis des Beispiels" title="Das Ergebnis des Beispiels" width="300" height="225" class="size-medium wp-image-1565" /></a><p class="wp-caption-text">Das Ergebnis des Beispiels</p></div>
<p><strong>Sonstige Funktionen</strong><br />
POV-Ray kennt noch eine ganze Menge weiterer Objekte, die sich auch zusammenfassen lassen. Man kann auch &#8211; wie in der Mengenlehre &#8211; ein Objekt von einem anderen abziehen oder die Schnittmenge zweier Objekte berechnen (und anzeigen).<br />
Auch bei den Farben und Oberflächenstrukturen bzw. -Polituren gibt es noch viele weitere Möglichkeiten und Optionen.</p>
<p>Die Objekte können skaliert (in der Größe geändert) rotiert und translatiert (verschoben) werden.<br />
Es können auch Kontrollstrukturen wie bei Programmiersprachen genutzt werden. So kann man Variablen deklarieren, Schleifen und Verzweigungen nutzen sowie Funktionen (bei POV-Ray Makros genannt) definieren um automatisch eine Reihe von Objekten zu erzeugen und zu transformieren.</p>
<p>Man kann mit POV-Ray auch Animationen erstellen. Dafür werden per Script mehrere Bilder erstellt, wobei vor jedem Bild eine Variable verändert wird. Diese kann genutzt werden um die Kamera oder Objekte zu bewegen.<br />
Hier einige Beispiele (auf Youtube gibt es noch jede Menge weitere)</p>
<p><a href="http://zinformatik.de/tipps-tricks/interessante-programme/pov-ray-ein-raytracer/"><em>Click here to view the embedded video.</em></a></p>
<p><a href="http://zinformatik.de/tipps-tricks/interessante-programme/pov-ray-ein-raytracer/"><em>Click here to view the embedded video.</em></a></p>
<p><strong>Links</strong></p>
<ul>
<li><a href="http://www.povray.org" title="Offizielle POV-Ray Website" target="_blank" class="liexternal">http://www.povray.org</a> &#8211; Offizielle Homepage von POV-Ray (englisch)</li>
<li><a href="http://hof.povray.org" title="POV-Ray Gallerie" target="_blank" class="liexternal">http://hof.povray.org</a> &#8211; Gallerie auf der Seite von POV-Ray. Sollte man sich in jedem Fall mal ansehen, auch wenn man sonst kein Interesse am Programm hat. (Die Bilder kann man durch einen Klick darauf vergrößert ansehen)</li>
<li><a href="http://de.wikibooks.org/wiki/Raytracing_mit_POV-Ray" title="Wikibooks - POV-Ray Buch" target="_blank" class="liexternal">http://de.wikibooks.org/wiki/Raytracing_mit_POV-Ray</a> &#8211; Deutsches Buch über POV-Ray auf Wikibooks</li>
<li><a href="http://www.basti-info.de/pov-ray/inhalt.htm" title="Einführung in POV-Ray" target="_blank" class="liexternal">http://www.basti-info.de/pov-ray/inhalt.htm</a> &#8211; Eine deutsche Einführung in POV-Ray</li>
<li><a href="http://www.f-lohmueller.de/pov_tut/pov__ger.htm" title="POV-Ray Tutorials" target="_blank" class="liexternal">http://www.f-lohmueller.de/pov_tut/pov__ger.htm</a> POV-Ray &#8211; Tutorials auf deutsch</li>
<li><a href="http://de.wikipedia.org/wiki/Povray" title="Wikipedia - POV-Ray" target="_blank" rel="nofollow" class="liwikipedia">http://de.wikipedia.org/wiki/Povray</a> &#8211; Wikipedia Artikel zu POV-Ray</li>
<li><a href="http://www.oyonale.com/modeles.php?format=POV&#038;lang=en" title="Freie POV-Ray Objekte von Gilles Tran" target="_blank" class="liexternal">http://www.oyonale.com/modeles.php?format=POV&#038;lang=en</a> &#8211; Einige freie Objekte für POV-Ray auf der Website von Gilles Tran</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://zinformatik.de/tipps-tricks/interessante-programme/pov-ray-ein-raytracer/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Less is more (than more) &#8211; weniger ist manchmal mehr</title>
		<link>http://zinformatik.de/tipps-tricks/interessante-programme/less-is-more-than-more-weniger-ist-manchmal-mehr/</link>
		<comments>http://zinformatik.de/tipps-tricks/interessante-programme/less-is-more-than-more-weniger-ist-manchmal-mehr/#comments</comments>
		<pubDate>Sat, 23 May 2009 14:56:44 +0000</pubDate>
		<dc:creator>zimon</dc:creator>
				<category><![CDATA[Interessante Programme]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntuusers-Planet]]></category>
		<category><![CDATA[Anzeigen]]></category>
		<category><![CDATA[less]]></category>
		<category><![CDATA[Mapping]]></category>
		<category><![CDATA[Pager]]></category>
		<category><![CDATA[tail]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://zinformatik.de/?p=1265</guid>
		<description><![CDATA[<p>Viele kennen less, das Programm zum Anzeigen von Textdateien. Ich habe es mir nun einmal etwas genauer angesehen.<br />
Mit less lassen sich auch große Textdateien sehr schnell anzeigen, da es schon mit der Darstellung des Textes beginnt, wenn die Datei noch nicht vollständig geladen ist.<br />
Auch zum Anzeigen von Kommandozeilenausgaben ist less sehr nützlich. Dafür braucht man die&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Viele kennen less, das Programm zum Anzeigen von Textdateien. Ich habe es mir nun einmal etwas genauer angesehen.<br />
Mit less lassen sich auch große Textdateien sehr schnell anzeigen, da es schon mit der Darstellung des Textes beginnt, wenn die Datei noch nicht vollständig geladen ist.<br />
Auch zum Anzeigen von Kommandozeilenausgaben ist less sehr nützlich. Dafür braucht man die Ausgabe nur in less zu pipen, z.B. so:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-lh</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">less</span></pre></div></div>

<p>Die vim-User wird es freuen, dass viele Kommandos die gleichen wie bei vim sind oder ihnen zumindest ähneln.</p>
<p><strong>Navigation</strong><br />
Navigieren kann man in less neben den Pfeiltasten wie in vim mit <em>h</em>,<em>j</em>,<em>k</em> und <em>l</em>. (Strg+)u und (Strg+)d sowie (Strg+)f und (Strg+)b haben die Funktion, halbe bzw. ganze Bildschirmseiten herunter und hoch zu springen. Die Strg-Taste ist dabei optional. Auch mit Space kann man einen Bildschirm herunter scrollen.<br />
<em>g</em> springt zum Anfang und <em>G</em> zum Ende des Dokuments.</p>
<p>Man kann sich auch anzeigen lassen, welche Zeile die erste ungelesene im Text ist, wenn man mehr als eine Zeile hinunter scrollt. Diese wird dann markiert. So findet man schnell die Stelle wieder, an der man aufgehört hat zu lesen. Dazu startet man less mit der Option <em>-W</em>.</p>
<p>Less kennt auch <a href="http://zinformatik.de/tipps-tricks/vim-tipps/markierungen-mit-vim-schnell-zu-beliebigen-stellen-einer-datei-springen/" title="Markierungen mit vim - schnell zu beliebigen Stellen einer Datei springen" target="_self" class="liinternal">Markierungen</a> wie vim. Allerdings sind diese immer Dateiübergreifend und es können nur Kleinbuchstaben genutzt werden. Mit m{Marke} (wobei {Marke} ein Kleinbuchstabe ist) kann eine Zeile Markiert werden und mit <em>&#8216;</em>{Marke} zu ihr hingesprungen werden (<em>&#8216;</em> ist das Hochkomma mit Shift+#). Mit <em>&#8221;</em> (zwei Hochkommata)kann man zwischen zwei Markierungen hin- und her springen.</p>
<p><strong>Anzeigen von mehreren Dateien</strong><br />
Indem man less mehrere Dateinamen als Argumente übergibt, kann man sich auch viele Dateien anzeigen lassen. Zwischen den Dateien springt man mit <em>:n</em> (zur nächsten) und <em>:p</em> (zur vorherigen). Natürlich kann man auch die Markierungen nutzen um zwischen den Dateien zu springen. Um aus less heraus eine neue Datei zu öffnen, kann man :e &lt;Dateiname&gt; eingeben. Mit <em>:</em>x gelangt man zur ersten Datei, während man mit <em>:d</em> die aktuelle Datei schließt.</p>
<p><strong>Suchen im Dokument</strong><br />
Die Suche bei less funktioniert wie bei vim mit <em>/&lt;Suchpattern&gt;</em>. Mit <em>n</em> und <em>N</em> kann man zum nächsten bzw. vorherigen Treffer springen. Um die bei der Suche Groß- und Kleinschreibung zu ignorieren startet man less mit der Option <em>-i</em>. Dies entspricht der intelligenten Suche, die Groß- Kleinschreibung nur dann beachtet, wenn im Suchbegriff auch Großbuchstaben vorkommen. <em>-I</em> entspricht dann einem wirklichen ignore-case.<br />
Wie in vim wird mit <em>?</em> in die entgegengesetzte Richtung gesucht.</p>
<p><strong>Coole Funktionen</strong><br />
Less wäre nicht more wenn es nicht mehr gäbe.<br />
Alle Aufrufoptionen (die, die mit <em>-</em> anfangen) lassen sich auch einfach bei laufendem Programm eingeben (einfach eintippen), während Kommandos beim Aufruf durch ein vorangestelltes <em>+</em> mitgegeben werden können (z.B. öffnet less <em>+G &lt;Dateiname&gt;</em> eine Datei und springt sofort ans Ende).</p>
<ul>
<li>Mit <em>v</em> öffnet man vim mit der aktuellen Datei. (Bzw. den in der Umgebungsvariablen EDITOR angegebenen Editor)</li>
<li>Mit <em>F</em> wird ans Ende der Datei gesprungen und diese bei jeder Änderung aktualisiert. Damit kann man sehen, wenn etwas z.B. in Logdateien hinzukommt. Dies entspricht einem <em>tail -f</em>. Zurück zm normalen Modus kommt man mittles Strg+c</li>
<li>Mit der Option <em>-M</em> gibt less mehr Informationen (Zeilennummer und Länge sowie relative Position im Dokument) aus.</li>
<li>Die Funktion <em>=</em> gibt noch mehr Informationen aus.
<li>Die Option <em>-e</em> veranlasst less dazu sich zu beenden, sobald das Dateiende zwei mal erreicht wurde. Mit -E wird less schon beim ersten Erreichen des Dateiendes geschlossen.</li>
<li>Sehr praktisch finde ich auch die Option <em>-F</em>, bei der sich less automatisch schließt, wenn der Text auf eine Bildschrimseite passt. So wird der Text ausgegeben und less dann beendet.</li>
<li>Durch <em>!&lt;Kommando&gt;</em> kann man ein Shell-Kommando ausführen, wobei man die Variable <em>%</em> für den aktuellen Dateinamen nutzen kann.</li>
<li>Mit <em>s &lt;Dateiname&gt;</em> wird (wenn man sich die Ausgabe eines Programms anzeigen lässt) die Ausgabe in der angegebenen Datei gespeichert.</li>
<li>Durch die Option <em>-R</em> zeigt less auch die Farben an, wenn man ein grep oder ls mit der option <em>&#8211;colors=always</em> hinein piped.</li>
</ul>
<p><strong>Eigene Tastenkombinationen definieren</strong><br />
Less hat auch eine eigene Konfigurationsdatei: ~/.less mit der man eigene Keybindings definieren kann.<br />
Diese wird im Format <em>Keybinding Action</em> angegeben, wobei jede Zeile nur ein Keybinding besitzen darf.<br />
Beispiele und mögliche Keys und Aktionen findet man in der manpage zu lesskey.</p>
<p><strong>Eigenen Prompt definieren</strong><br />
Statt der Option <em>-M</em> kann man sich auch einen eigenen Prompt mit der Option <em>-P</em> definieren. Dafür gibt es jede Menge Variablen und Abfragen, dass man z.B. nur dann den Dateinamen ausgibt, wenn auch eine Datei gelesen wird und nicht von STDIN. Hier ein Beispiel:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">?f<span style="color: #000000; font-weight: bold;">%</span>f:Standard input</pre></div></div>

<p>gibt den Dateinamen aus oder &#8220;Standard input&#8221; wenn ein Kommando in less gepiped wurde.<br />
Die ganzen Variablen und Abfragen sind in der manpage dokumentiert.</p>
<p><strong>Preprozessor-Funktionen</strong><br />
Ich möchte noch kurz erwähnen, dass man für less Funktionen definieren kann, die vor dem Öffnen eines bestimmten Dateityps ausgeführt werden. So kann man z.B. eine Datei zuerst entschlüsseln oder dekomprimieren, bevor man sie anzeigen lässt. Eine entsprechende Funktion, der vor dem Schließenausgeführt wird um z.B. temporäre Dateien zu löschen kann ebenfalls definiert werden.<br />
Weitere Infos dazu gibt es in der manpage.</p>
<p><br clear="all" /><br />
Weitere Funktionen und Informationen bekommt zu less man wie immer in der manpage.</p>
]]></content:encoded>
			<wfw:commentRss>http://zinformatik.de/tipps-tricks/interessante-programme/less-is-more-than-more-weniger-ist-manchmal-mehr/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>vim Plugin &#8211; gnupg verschlüsselt Dateien</title>
		<link>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/vim-plugin-gnupg-verschlusselt-dateien/</link>
		<comments>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/vim-plugin-gnupg-verschlusselt-dateien/#comments</comments>
		<pubDate>Sat, 16 May 2009 09:36:34 +0000</pubDate>
		<dc:creator>zimon</dc:creator>
				<category><![CDATA[Plugins und Erweiterungen]]></category>
		<category><![CDATA[Sicherheit und Datenschutz]]></category>
		<category><![CDATA[Ubuntuusers-Planet]]></category>
		<category><![CDATA[vim Tipps]]></category>
		<category><![CDATA[GPG]]></category>
		<category><![CDATA[Verschlüsselung]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://zinformatik.de/?p=1226</guid>
		<description><![CDATA[<p>Mit dem Plugin <a href="http://www.vim.org/scripts/script.php?script_id=661" title="gnupg : Plugin for transparent editing of gpg encrypted files" target="_blank" class="liexternal">gnupg</a> können Dateien sehr leicht gpg-verschlüsselt werden. Zur Installation läd man sich die Datei gnupg.vim herunter und kopiert sie ins Verzeichnis ~/.vim/plugin. Als nächstes fügt man die folgende Zeile zur ~/.bashrc hinzu:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GPG_TTY</span>=‘tty‘</pre></div></div>

<p>Um die .bashrc neu einzulesen führt man&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Mit dem Plugin <a href="http://www.vim.org/scripts/script.php?script_id=661" title="gnupg : Plugin for transparent editing of gpg encrypted files" target="_blank" class="liexternal">gnupg</a> können Dateien sehr leicht gpg-verschlüsselt werden. Zur Installation läd man sich die Datei gnupg.vim herunter und kopiert sie ins Verzeichnis ~/.vim/plugin. Als nächstes fügt man die folgende Zeile zur ~/.bashrc hinzu:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GPG_TTY</span>=‘tty‘</pre></div></div>

<p>Um die .bashrc neu einzulesen führt man nun</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">source</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc</pre></div></div>

<p>aus oder startet eine neue Konsole.</p>
<p>Wenn nun vim neu gestartet wird, werden Dateien mit der Endung <em>.pgp</em>, <em>.gpg</em> oder <em>.asc</em> automatisch verschlüsselt. Dabei wird keine viminfo oder Swapdatei angelegt.<br />
Beim Anlegen einer Datei öffnet sich ein horizontaler <a href="http://zinformatik.de/tipps-tricks/vim-tipps/unter-vim-mit-splitscreens-arbeiten/" title="Unter vim mit Splitscreens arbeiten" target="_self" class="liinternal">Splitscreen</a>, in den man die Empfänger schreiben kann. Sobald dieser geschlossen wird, wird die Liste der Empfänger übernommen. Beim Speichern wird die Datei nun für die angegebenen Empfänger verschlüsselt.<br />
Öffnet man eine Datei, die man (oder jemand anderes) für sich verschlüsselt hat, so wird man nach dem Passwort seines GPG-Schlüssels gefragt. Danach wird die Datei geöffnet.</p>
<p>Man kann aber auch die symmetrische Verschlüsselung von GPG verwenden. Dafür fügt man der Datei ~/.vimrc folgende Zeile hinzu:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #804040;">let</span> g<span style="color: #000000;">:</span>GPGPreferSymmetric = <span style="color: #000000; font-weight:bold;">1</span></pre></div></div>

<p>Wird nun eine Datei mit einer der oben genannten Endungen angelegt, wird man beim Speichern nach einem Passwort gefragt, um die Datei zu verschlüsseln. Öffnet man eine so gespeicherte Datei, wird man wiederrum nach dem Passwort gefragt. Bei jeder Speicherung muss dann jedoch das Passwort angegeben werden.</p>
]]></content:encoded>
			<wfw:commentRss>http://zinformatik.de/tipps-tricks/interessante-programme/plugins-erweiterungen/vim-plugin-gnupg-verschlusselt-dateien/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
