<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
        <?xml-stylesheet type="text/css" href="http://blog.spamt.net//styles/feed.css"?>
<title type="html">Shell stuff</title>
<link rel="alternate" type="text/html" href="http://blog.spamt.net/"/>
<link rel="self" type="application/atom+xml" href="http://blog.spamt.net//archives/shell_stuff/index-atom.xml"/>
<updated>2009-12-11T18:26:53+01:00</updated>
<author>
<name>Ulrich Dangel</name>
<uri>http://blog.spamt.net/</uri>
</author>
<id>http://blog.spamt.net//</id>
<generator uri="http://nanoblogger.sourceforge.net" version="3.3">
NanoBlogger
</generator>

<entry>
<title type="html">Access partitions in loopback devices under linux</title>
<author>
<name>Ulrich Dangel</name>
</author>
<link rel="alternate" type="text/html" href="http://blog.spamt.net//archives/2009/12/11/access_partitions_in_loopback_devices_under_linux/index.html"/>
<id>http://blog.spamt.net//archives/2009/12/11/access_partitions_in_loopback_devices_under_linux/index.html</id>
<published>2009-12-11T18:22:55+01:00</published>
<updated>2009-12-11T18:22:55+01:00</updated>
<category term="Shell stuff" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[<p>
Ever needed to access a partition inside a block device not supporting partitions like
/dev/loop or software raid? There exists multiple solutions like specifying the offset
via losetup or patching the kernel. But this is error-prone and not very user friendly.</p>

<p>
    An easy and more user friendly way of supporting partition tables in any block
    device is <b>kpartx</b>. Besides the name, is has nothing to do with kde but is a
    tool from <a href="http://christophe.varoqui.free.fr/">multipath tools</a> to map
    partition tables to the device mapper.
</p>
<p>
After you installed kpartx you can easily create mappings from a block device with <i>
kpartx -a</i> and delete them via <i>kpartx -d</i>. For example:
<pre>
# echo p | fdisk /dev/loop0 
Command (m for help): 
Disk /dev/loop0: 102 MB, 102400000 bytes
255 heads, 63 sectors/track, 12 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

      Device Boot      Start         End      Blocks   Id  System
      /dev/loop0p1               1           5       40131   83  Linux
      /dev/loop0p2               6          12       56227+  83  Linux

# kpartx -a /dev/loop0
# ls /dev/mapper/loop0p*
/dev/mapper/loop0p1  /dev/mapper/loop0p2
# kpartx -d /dev/loop0
# ls /dev/mapper/loop0*
ls: cannot access /dev/mapper/loop0*: No such file or directory
</pre>
</p>
To make a long story short: kpartx is a easy and handy solution for using partitions
from any block device under linux making management of images for virtual machines quite
simple.]]>
</div>
</content>

</entry>
<entry>
<title type="html">Bootstrapping Fedora to directories</title>
<author>
<name>Ulrich Dangel</name>
</author>
<link rel="alternate" type="text/html" href="http://blog.spamt.net//archives/2009/09/18/bootstrapping_fedora_to_directories/index.html"/>
<id>http://blog.spamt.net//archives/2009/09/18/bootstrapping_fedora_to_directories/index.html</id>
<published>2009-09-18T15:50:44+01:00</published>
<updated>2009-09-18T15:50:44+01:00</updated>
<category term="Shell stuff" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[Currently there is some <a href='http://www.lucas-nussbaum.net/blog/?p=385'>discussion</a>
on debian planet about installing Centos/Fedora to an directory under debian.<br>
As mentioned in the <a
href='http://www.lucas-nussbaum.net/blog/?p=385#comment-21968'>comments</a> and another
<a href='http://www.braincells.com/debian/index.cgi/search/item=230'>blog entry</a>
there exist several other simpler solutions.<br>
<p>
<a href='http://et.redhat.com/~rjones/febootstrap/'>febootstrap</a> allows you to
install centos/fedora really easily just like deboostrap.<br>
Example to install centos in directory c5:
<pre>
# febootstrap centos-5 c5 http://mirror.eunet.at/5.3/os/i386/
# .....
# chroot c5 cat /etc/redhat-release   
# CentOS release 5.3 (Final)
</pre>
</p>
<p>
<a href='http://thomas.apestaart.org/projects/mach/'>mach</a> is another more generic
way to bootstrap rpm based distributions to a directory. For an overview of the features
just have a look at the <a
href='http://mach.cvs.sourceforge.net/*checkout*/mach/mach2/README?revision=1.45'>README</a>
Example to install centos:
<pre>
$ mach -r centos-5-i386-os setup base 
</pre>
</p>
<p>
If you just want to install Fedora/Centos into some directory use <a
href='http://et.redhat.com/~rjones/febootstrap/'>febootstrap</a> as it is
quite simple and does the job. <br>
<b>But</b> if you want to rebuild rpms or bootstrap
any other rpm based distribution like SuSE, Yellowdog use <a
href='http://thomas.apestaart.org/projects/mach/'>mach</a>
</p>]]>
</div>
</content>

</entry>
<entry>
<title type="html">Automatic security updates for Debian based systems</title>
<author>
<name>Ulrich Dangel</name>
</author>
<link rel="alternate" type="text/html" href="http://blog.spamt.net//archives/2009/06/20/automatic_security_updates_for_debian_based_systems/index.html"/>
<id>http://blog.spamt.net//archives/2009/06/20/automatic_security_updates_for_debian_based_systems/index.html</id>
<published>2009-06-20T03:38:59+01:00</published>
<updated>2009-06-20T03:38:59+01:00</updated>
<category term="Shell stuff" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[<p>
<a href='https://wiki.ubuntu.com/AutomaticUpdates'>unattend-upgrades</a> is a debian
package providing automatic security upgrades.
</p>
<p>
To use it, just install unattended-upgrades, modify
/etc/apt/apt.conf.d/50unattended-upgrades to your needs like:
<pre>
Unattended-Upgrade::Allowed-Origins { "Debian stable"; };
</pre>
To automatically and unattended install security updates you also have to set 
<pre>
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
</pre>
in /etc/apt/apt.conf or in a file located in /etc/apt/apt.conf.d/ (I use
/etc/apt/apt.conf.d/60security) <br />
For further details have a look at /usr/share/doc/unattended-upgrades/README or <a
href='https://wiki.ubuntu.com/AutomaticUpdates'>https://wiki.ubuntu.com/AutomaticUpdates</a>
</p>
Just setup unattended-upgrades and life becomes more easy as you dont have to remember
to upgrade each of your machines.]]>
</div>
</content>

</entry>
<entry>
<title type="html">One command line interface for multiple RDBMS systems</title>
<author>
<name>Ulrich Dangel</name>
</author>
<link rel="alternate" type="text/html" href="http://blog.spamt.net//archives/2009/06/20/one_command_line_interface_for_multiple_rdbms_systems/index.html"/>
<id>http://blog.spamt.net//archives/2009/06/20/one_command_line_interface_for_multiple_rdbms_systems/index.html</id>
<published>2009-06-20T03:10:56+01:00</published>
<updated>2009-06-20T03:10:56+01:00</updated>
<category term="Shell stuff" />
<category term="Stuff" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[<p>
<a href='http://sqlline.sourceforge.net/'>sqlline</a> a java based console program
allows you to connect to any database with existing jdbc drivers replacing the original programs like mysql, sqlplus or psql.
</p>
<p>
Example to connect to an oracle database with sqlline:<br />
<pre>
$ java -cp ~/path/classpath/classes12.jar:/usr/share/java/sqlline.jar sqlline.SqlLine
sqlline version 1.0.2 by Marc Prud'hommeaux                
sqlline> !connect jdbc:oracle:thin:@hostname:1521:xe USER PASS
Connecting to jdbc:oracle:thin:@hostname:1521:xe
Connected to: Oracle (version Oracle Database 10g Express Edition Release 10.2.0.1.0 -
Production)
2: jdbc:oracle:thin:@hostname:1521:xe> 
</pre>
</p>]]>
</div>
</content>

</entry>
<entry>
<title type="html">Netwerktraffic per Verbindung messen</title>
<author>
<name>Ulrich Dangel</name>
</author>
<link rel="alternate" type="text/html" href="http://blog.spamt.net//archives/2008/11/20/netwerktraffic_per_verbindung_messen/index.html"/>
<id>http://blog.spamt.net//archives/2008/11/20/netwerktraffic_per_verbindung_messen/index.html</id>
<published>2008-11-20T13:52:22+01:00</published>
<updated>2008-11-20T13:52:22+01:00</updated>
<category term="Shell stuff" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[Ab und zu steht man vor dem Problem festzustellen welche Netzwerk Verbindung gerade am meisten Traffic macht. Hier kommt <a href="http://jnettop.kubs.info/wiki/">jnettop</a> ins
Spiel das das ganze sehr komfortabel visualisiert.<br />
Jetzt noch mittels netstat -anp nachschauen welcher Benutzer den Traffic generiert und ihn schimpfen :)<br/>]]>
</div>
</content>

</entry>
<entry>
<title type="html">Dateien umbenennen mit dem Editor</title>
<author>
<name>Ulrich Dangel</name>
</author>
<link rel="alternate" type="text/html" href="http://blog.spamt.net//archives/2008/06/08/dateien_umbenennen_mit_dem_editor/index.html"/>
<id>http://blog.spamt.net//archives/2008/06/08/dateien_umbenennen_mit_dem_editor/index.html</id>
<published>2008-06-08T16:13:16+01:00</published>
<updated>2008-06-08T16:13:16+01:00</updated>
<category term="Shell stuff" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[Wenn man mehrere Dateien schnell umbenennen will gibt es zig verschiedene Tools, z.Bsp. mmv, zmv etc. 
Das Problem das ich mit diesen Tools habe, ist das ich immer vergesse wie die genau Syntax ist, was der Platzhalter ist, etc.<br>
Genau dieses Problem l&ouml;sen die <a href="http://www.nongnu.org/renameutils/">renameutils</a> die das ganze Interatkiv l&ouml;sen. So reicht es einfach 
<pre>
qmv files
</pre>
aufzurufen, und schon geht der editor auf und man kann den Ziel Dateinamen einfach im Editor einstellen, speichern, fertig. Das ganze hat den Vorteil das man sich keine Passende regex ausdenken muss,
sondern einfach die entsprechende Spalte l&ouml;scht, die Datei Namen gross schreibt, o.&auml;.]]>
</div>
</content>

</entry>
<entry>
<title type="html">A new star is born</title>
<author>
<name>Ulrich Dangel</name>
</author>
<link rel="alternate" type="text/html" href="http://blog.spamt.net//archives/2006/12/21/a_new_star_is_born/index.html"/>
<id>http://blog.spamt.net//archives/2006/12/21/a_new_star_is_born/index.html</id>
<published>2006-12-21T18:30:57+01:00</published>
<updated>2006-12-21T18:30:57+01:00</updated>
<category term="Shell stuff" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[<p>... call it <a href="http://www.bewatermyfriend.de/zblog/">zblog</a></p>
Yeah, nach zirc gibt es nun auch den zblog, nanoblogger muss sich warm anziehn :)<br>]]>
</div>
</content>

</entry>
<entry>
<title type="html">Persistent Dirstack f&uuml;r die ZSH</title>
<author>
<name>Ulrich Dangel</name>
</author>
<link rel="alternate" type="text/html" href="http://blog.spamt.net//archives/2006/12/09/persistent_dirstack_f&uumlr_die_zsh/index.html"/>
<id>http://blog.spamt.net//archives/2006/12/09/persistent_dirstack_f&uumlr_die_zsh/index.html</id>
<published>2006-12-09T20:43:56+01:00</published>
<updated>2006-12-09T20:43:56+01:00</updated>
<category term="Shell stuff" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[<p>Wer sich schon immer mal einen persistenten Dirstack f&uuml;r die ZSH gew&uuml;nscht hat, hier
gibts die Losung. Einfach folgendes in die zshrc eintragen:
</p>
<pre>
if [[ -f ~/.zdirs ]] && [[ ${#dirstack[*]} -eq 0 ]]; then
    dirstack=( ${(uf)"$(&lt; ~/.zdirs)"} )
    # "cd -" won't work after login by just setting $OLDPWD, so                         
    cd $dirstack[0] && cd - &gt /dev/null
fi
chpwd() { dirs -pl &gt;! ~/.zdirs }
</pre>
<p> So, das wars, jetzt hat man einen persistenten Dirstack, d.h. nach dem man eine neue Shell startet, kann man auf den gleichen Dirstack zugreifen wie in den anderen schon gestarteten Shells. Weiterhin kann man nach dem starten der shell einfach cd - (geht in das Verzeichniss das in $OLDPWD definiert war) eingeben und landet in dem letzten Verzeichniss in das man gewechselt hat.
</p>
<p><b>So, jetzt sollte das obige halbwegs passen, scheiss html..</b></p>]]>
</div>
</content>

</entry>
<entry>
<title type="html">zsh cd completion</title>
<author>
<name>Ulrich Dangel</name>
</author>
<link rel="alternate" type="text/html" href="http://blog.spamt.net//archives/2006/09/20/zsh_cd_completion/index.html"/>
<id>http://blog.spamt.net//archives/2006/09/20/zsh_cd_completion/index.html</id>
<published>2006-09-20T20:14:22+01:00</published>
<updated>2006-09-20T20:14:22+01:00</updated>
<category term="Shell stuff" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[Ich habe schon l&auml;nger mal von dem auto {push,pop}d feature von der zsh geschw&auml;rmt und habe heute (dank <a href="http://michael-prokop.at">mikap</a>) was neues tolles gefunden:<br>
Wenn man cd -<tab> eingibt bekommt man eine &Uuml;bersicht &uuml;ber die vorherigen Verzeichnisse. Da ich aber faul bin und keine Nr. dr&uuml;cken mag, bietet sich hier nat&uuml;rlich ein
Men&uuml; an. Das kriegt man ganz einfach mit
<pre>
zstyle ':completion:*:*:cd:*:directory-stack' menu yes select
</pre>
So, und nun w&uuml;nsche ich euch allen ein frohliches Men&uuml; benutzen in der Shell ;)]]>
</div>
</content>

</entry>
<entry>
<title type="html">Excludes mit der Bash</title>
<author>
<name>Ulrich Dangel</name>
</author>
<link rel="alternate" type="text/html" href="http://blog.spamt.net//archives/2006/09/09/excludes_mit_der_bash/index.html"/>
<id>http://blog.spamt.net//archives/2006/09/09/excludes_mit_der_bash/index.html</id>
<published>2006-09-09T14:27:27+01:00</published>
<updated>2006-09-09T14:27:27+01:00</updated>
<category term="Shell stuff" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[Es kommt ofters vor, das man in einem Verzeichniss alle Dateien ausser datei1 und datei2 loschen will.<br>
Eine Losung ist, man kopiert die Dateien in ein tmp Verzeichiss, loscht alles, und kopiert sie zur&uuml;ck. Diese Losung ist umst&auml;ndlich, und man muss viel tippen ;)<br>
F&uuml;r die Bash und die zsh gibt es eine sehr einfache Losung f&uuml;r das ganze
<pre>
$ rm !(datei1|datei2) # bash - extglob muss daf&uuml;r an sein
% rm *~datei1~datei2  # zsh 
</pre>
So, und das war f&uuml;r heute mein Ausflug in die bash welt ;)]]>
</div>
</content>

</entry>

</feed>
