<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Cli on tech.notes</title>
    <link>https://newblog.utzer.de/tags/cli/</link>
    <description>Recent content in Cli on tech.notes</description>
    <generator>Hugo</generator>
    <language>de</language>
    <lastBuildDate>Mon, 03 Jul 2023 08:27:56 +0000</lastBuildDate>
    <atom:link href="https://newblog.utzer.de/tags/cli/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>OCR all PDFs in a folder by cron</title>
      <link>https://newblog.utzer.de/2023/07/03/ocr-all-pdfs-in-a-folder-by-cron/</link>
      <pubDate>Mon, 03 Jul 2023 08:27:56 +0000</pubDate>
       <guid isPermaLink="false">https://tech.utzer.de/?p=150</guid> 
      <description>&lt;p&gt;I will not write a long explanation, just this short one.&lt;/p&gt;
&lt;p&gt;The cronjob looks like this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;* * * * * sh -c &amp;#39;flock -n /tmp/my.lockfile /home/user/scripts/ocr_pdf_scan.sh&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This will start sh (a shell, just like bash) and run the command after -c. The command flock will create a lock-file, to prevent that this cron job is started while there is still the previous cron jobs running.&lt;/p&gt;
&lt;p&gt;The cron job runs every minute, so in crontab it has * * * * * (five stars in front of the command).&lt;/p&gt;</description>
    </item>
    <item>
      <title>rename</title>
      <link>https://newblog.utzer.de/2019/04/29/rename/</link>
      <pubDate>Mon, 29 Apr 2019 20:06:29 +0000</pubDate>
       <guid isPermaLink="false">http://tech.utzer.de/?p=79</guid> 
      <description>&lt;p&gt;&amp;hellip; is an easy to use and powerful tool, it can be used to replace part of file name (string1) with some other string. Something one can also do with some &amp;ldquo;sed&amp;rdquo; hack, but this tool is much easier to use, especially for beginners.&lt;/p&gt;
&lt;p&gt;You can get all information needed from &amp;ldquo;rename &amp;ndash;help&amp;rdquo; (here from Linux Mint):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rename --help
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Usage:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rename [ -h|-m|-V ] [ -v ] [ -n ] [ -f ] [ -e|-E perlexpr]*|perlexpr
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [ files ]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Options:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    -v, -verbose
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            Verbose: print names of files successfully renamed.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    -n, -nono
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            No action: print names of files to be renamed, but don&amp;#39;t rename.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    -f, -force
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            Over write: allow existing files to be over-written.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    -h, -help
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            Help: print SYNOPSIS and OPTIONS.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    -m, -man
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            Manual: print manual page.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    -V, -version
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            Version: show version number.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    -e      Expression: code to act on files name.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            May be repeated to build up code (like &amp;#34;perl -e&amp;#34;). If no -e, the
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            first argument is used as code.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    -E      Statement: code to act on files name, as -e but terminated by
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &amp;#39;;&amp;#39;.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I did use this tool rename some files that contained the string &amp;ldquo;www&amp;rdquo;, which I had to replace with &amp;ldquo;web&amp;rdquo;, lets say there were files named like this:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Resize qemu VM disk</title>
      <link>https://newblog.utzer.de/2019/03/16/resize-qemu-vm-disk/</link>
      <pubDate>Sat, 16 Mar 2019 22:48:48 +0000</pubDate>
       <guid isPermaLink="false">http://tech.utzer.de/?p=44</guid> 
      <description>&lt;h4 id=&#34;vm-runterfahren&#34;&gt;VM runterfahren&lt;/h4&gt;
&lt;h4 id=&#34;image-der-vm-vergrössern&#34;&gt;Image der VM vergrössern:&lt;/h4&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-gdscript3&#34; data-lang=&#34;gdscript3&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo qemu&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;img resize &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;lib&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;libvirt&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;images&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;vm_disk&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;img &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;15&lt;/span&gt;GB
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Je nach Setup ist sudo nicht nötig, durch den Befehl wird die Diskimagedatei um 15 GB vergrößert.&lt;/p&gt;
&lt;h4 id=&#34;vm-starten&#34;&gt;VM starten&lt;/h4&gt;
&lt;p&gt;Weiter geht es in der VM auf der Konsole.&lt;/p&gt;
&lt;h4 id=&#34;partitioen-mit-parted-anzeigen-lassen&#34;&gt;Partitioen mit parted anzeigen lassen:&lt;/h4&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;parted -l
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ausgabe so oder ähnlich:&lt;br&gt;
&lt;em&gt;Model: Virtio Block Device (virtblk)&lt;br&gt;
Disk /dev/vda: 53,7GB&lt;br&gt;
Sector size (logical/physical): 512B/512B&lt;br&gt;
Partition Table: msdos&lt;br&gt;
Disk Flags:&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Number Start End Size Type File system Flags&lt;br&gt;
1 1049kB 53,7GB 53,7GB primary btrfs boot&lt;/em&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>explainshell.com</title>
      <link>https://newblog.utzer.de/2019/03/16/explainshell/</link>
      <pubDate>Sat, 16 Mar 2019 21:09:38 +0000</pubDate>
       <guid isPermaLink="false">http://tech.utzer.de/?p=40</guid> 
      <description>&lt;p&gt;Did you know &lt;a href=&#34;https://explainshell.com/&#34;&gt;explainshell.com&lt;/a&gt; yet? Try it, for example with that command from &lt;a href=&#34;https://newblog.utzer.de/2019/03/15/lsof-local-open-ports/&#34;&gt;last time&lt;/a&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo lsof -i -P -n | grep LISTEN
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;this is an amazing web site I use often so see what commands do that I find somewhere. Try it.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
