<rdf:RDF
    xmlns:s='http://snipsnap.org/rdf/snip-schema#'
    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
    xml:base='http://www.stefanrufer.ch/snipsnap/rdf'>
    <s:Snip rdf:about='http://www.stefanrufer.ch/snipsnap/rdf#Virtual+Brain/Linux'
         s:cUser='stefan'
         s:oUser='stefan'
         s:mUser='stefan'>
        <s:name>Virtual Brain/Linux</s:name>
        <s:content>{snip-tree:Virtual Brain/Linux}&#xD;&#xA;&#xD;&#xA;Stuff I forget again and again:&#xD;&#xA;&#xD;&#xA;----&#xD;&#xA;1 Rename files according to their timestamp&#xD;&#xA;&#xD;&#xA;This one-liner renames all images in a directory according to their file modification date. The resulting file names have 8 digits with leading zeroes. Note that it does not distinguish file types - it works just for jpg as it is printed here.&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;i=0; for f in $(ls -lrt | cut -c 52-65); do newname=$(printf %08d $i); echo &quot;mv $f $newname.jpg&quot;; mv $f $newname.jpg; let i=i+1; done&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;And a very neat one that renames according to EXIV timestamps inside JPG images. Really handy to sort your images from different cameras after the holidays:&#xD;&#xA;{code:none}&#xD;&#xA;exiv2 -t -r &apos;%Y-%m-%d_%H%M%S_:basename:&apos; rename *.JPG&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1 Send mail from command line&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;echo &quot;mail content&quot; | mail -s &quot;subject&quot; mail@domain.tld&#xD;&#xA;(echo &quot;mail content&quot;; cat somefile.txt} | mail -s &quot;subject&quot; mail@domain.tld&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;All clear?&#xD;&#xA;&#xD;&#xA;1 What was this || and &amp;&amp; again?&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;if exp; then T; else F; fi&#xD;&#xA;is equal to&#xD;&#xA;exp &amp;&amp; T || F&#xD;&#xA;&#xD;&#xA;other way round doesn&apos;t work :-)&#xD;&#xA;&#xD;&#xA;$ [ X = xxX ] || echo F &amp;&amp; echo T&#xD;&#xA;F&#xD;&#xA;T &#xD;&#xA;}}}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;All clear?&#xD;&#xA;&#xD;&#xA;1 Set editing mode&#xD;&#xA;&#xD;&#xA;For me the &quot;intiutive&quot; editing mode is as emacs behaves:&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;set -o emacs&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1 Filename of a path only&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;basename /usb/bin/su&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;yields: su&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;1 Find biggest subdirectories&#xD;&#xA;&#xD;&#xA;Find all subdirectories of the current dir and get size of each of this directories (including children):&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;find . -type d -maxdepth 1 -exec du -h -s {} \;&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1 Mount ISO image&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;mount -o loop,ro -t iso9660 image.iso /mnt/iso&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1 Rsync using SSH&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;rsync -rtvz -e &apos;ssh -l user&apos; src-dir/ user@host:dest-dir/&#xD;&#xA;{code}&#xD;&#xA;Note that the src-dir is the &quot;master&quot; =&gt; Rsync will not do any two-way syncs but rather push the contents of src-dir to dest-dir. Therefore, take care not to overwrite any data if you try to build a two-way sync as proposed in some newsgroups or articles! (Rather use unison, see below)&#xD;&#xA;Most importat rsync args are:&#xD;&#xA; - a for archive (=rlptgoD)&#xD;&#xA; - D Devices&#xD;&#xA; - g groups&#xD;&#xA; - l symlinks&#xD;&#xA; - n dry run&#xD;&#xA; - o owners&#xD;&#xA; - p permissions&#xD;&#xA; - r recurse&#xD;&#xA; - t times&#xD;&#xA; - v verbose&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;1 unison&#xD;&#xA;&#xD;&#xA;Nice mirroring tool available at http://www.cis.upenn.edu/~bcpierce/unison/ It provides either text or graphical interface for full two-way synchronization of directory trees including conflict resolution and remote operation. And this even without server operation, SSH does the job, very nice!&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;1 Spyder whole Webpage&#xD;&#xA;&#xD;&#xA;Some people like to point and click, but is that nice or what: &#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;wget -m http://foo/[bar/]&#xD;&#xA;&#xD;&#xA;a bit more advanced, but doesn&apos;t really do the trick, because it follows all calendar links, need to disable this.&#xD;&#xA;wget --convert-link --mirror --no-parent --relative --page-requisites --exclude-directories=exec http://www.stefanrufer.ch/snipsnap/space/start&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;1 Get server fingerprint&#xD;&#xA;&#xD;&#xA;If I am asked by ssh whether a server fingerprint is correct - I first need to have the correct fingerprint. Given the situation I can get hold to a console of the machine in question I really trust - here&apos;s how to get the fingerprint (linux machine, pretty much standard config I would say):&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;ssh-keygen -l -f /etc/ssh/ssh_host_key.pub&#xD;&#xA;ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub&#xD;&#xA;ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;1 HTTP/1.1 &#xD;&#xA;&#xD;&#xA;How to get a page from a webserver if connected by telnet? I always forget this HTTP/1.1 syntax:&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;foo@bar &gt; telnet somehost 8080&#xD;&#xA;GET /index.html HTTP/1.1&#xD;&#xA;Host: somehost&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;(or use HEAD, OPTIONS HTTP commands instead)&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;1 Cron&#xD;&#xA;&#xD;&#xA;Fields: minute(s) hour(s) day(s) month(s) weekday(s) command(s) &#xD;&#xA;&#xD;&#xA;The fields are separated by spaces or tabs. The first five are integer patterns and the sixth is the command to be executed. The following table briefly describes each of the fields.&#xD;&#xA;&#xD;&#xA;{table}&#xD;&#xA;Field Value | Description &#xD;&#xA;minute 0-59 | The exact minute that the command sequence executes. &#xD;&#xA;hour 0-23  | The hour of the day that the command sequence executes. &#xD;&#xA;day 1-31 | The day of the month that the command sequence executes. &#xD;&#xA;month 1-12 | The month of the year that the command sequence executes. &#xD;&#xA;weekday 0-6 | The day of the week that the command sequence executes. Sunday=0, Monday = 1, Tuesday = 2, and so forth. &#xD;&#xA;command | The complete command sequence variable that is to be executed.&#xD;&#xA;{table}&#xD;&#xA;&#xD;&#xA;The integer fields can contain patterns like */5 (every five minutes) or 0,8,16 to run at hours 0, 8 and 16.&#xD;&#xA;&#xD;&#xA;You may want to specify MAILTO=foo@bar.com as first line in the crontab file to have the output of a cron run mailed to this address. &#xD;&#xA;&#xD;&#xA;&#xD;&#xA;1 Output redirection&#xD;&#xA;&#xD;&#xA;In order to get all output (stdout and stderr) to a logfile (or /dev/null), redirect e.g. stderr to stdout:&#xD;&#xA;{code:none}&#xD;&#xA;foo-command.sh &gt;&gt; foo-command.log 2&gt;&amp;1&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;1 Backup&#xD;&#xA;&#xD;&#xA;&#xD;&#xA; - (+) Snapshots http://www.mikerubel.org/computers/rsync_snapshots/&#xD;&#xA; - (+) MySQL http://www.linux-fuer-alle.de/doc_show.php?docid=234&amp;amp;catid=4 http://sourceforge.net/projects/automysqlbackup/&#xD;&#xA; - misc http://www.linux-backup.net/Full_Inc/&#xD;&#xA; - simple http://www.xs4all.nl/~voorburg/backup.html&#xD;&#xA; - some theory http://kmself.home.netcom.com/Linux/FAQs/backups.html&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;1 wget&#xD;&#xA;&#xD;&#xA;Most useful: continue canceled downloads:&#xD;&#xA;{code:none}&#xD;&#xA;wget -c URL&#xD;&#xA;{code}&#xD;&#xA;</s:content>
        <s:mTime>2011-10-09 21:37:55.709</s:mTime>
        <s:cTime>2004-09-30 20:03:18.301</s:cTime>
        <s:comments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
        <s:snipLinks>
            <rdf:Bag>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain/Java'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain/Linux/Tomcat Monitoring'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain/SQL'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#My Projects/Hochzeit/Vorstellungen'/>
                <rdf:li>
                    <s:Snip rdf:about='http://www.stefanrufer.ch/snipsnap/rdf#Virtual+Brain/Linux'>
                        <s:attachments
                             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
                    </s:Snip>
                </rdf:li>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#My Projects/Geigenhof Pool'/>
                <rdf:li rdf:resource='#Buch'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain/Java/List Speed'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#stefan/public keys'/>
                <rdf:li rdf:resource='#stefan'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain/Linux/Regexp'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain/Linux/text operations'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#My Projects/Virtual Server/Help Page'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#My Projects/Hochzeit/gaesteliste'/>
                <rdf:li rdf:resource='#adrian'/>
                <rdf:li rdf:resource='#Photos'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#My Projects/Turmfalken CMS'/>
                <rdf:li rdf:resource='#Unternehmungen'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#My Projects/Virtual Server'/>
                <rdf:li rdf:resource='#Motorrad'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#My Projects/dbbuild'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#My Projects/Treberwurstessen'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain/Linux/Mover Filerename Script'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual+Brain/Linux/'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Unternehmungen/Treberwurstessen'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#My Projects'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain/MySQL'/>
                <rdf:li rdf:resource='#weblogs-2006'/>
                <rdf:li rdf:resource='#weblogs-2005'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#My Projects/Hochzeit'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#stefan/mainnav'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Virtual Brain/Linux/Disksize Checking'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Curriculum Vitae'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#Kochen/Gloegg'/>
                <rdf:li rdf:resource='#Links'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#stefan/Snipsnap Things/fortune-calvin'/>
                <rdf:li rdf:resource='http://www.stefanrufer.ch/snipsnap/rdf#My Projects/Hochzeit/Mittel'/>
                <rdf:li rdf:resource='#Kochen'/>
                <rdf:li rdf:resource='#snipsnap-index'/>
            </rdf:Bag>
        </s:snipLinks>
    </s:Snip>
</rdf:RDF>

