<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Bashscripting &amp;mdash; Paul Sutton</title>
    <link>https://personaljournal.ca/paulsutton/tag:Bashscripting</link>
    <description>Personal Blog</description>
    <pubDate>Wed, 13 May 2026 23:26:02 +0000</pubDate>
    <item>
      <title>Weather logging</title>
      <link>https://personaljournal.ca/paulsutton/weather-logging</link>
      <description>&lt;![CDATA[Weather logging&#xA;&#xA;So been experimenting with some of the options for ansiweather, partly as schools   need to teach data logging as part of the national curriculum computing,  however not all schools have the kit required.&#xA;&#xA;As I have this running on a Raspberry Pi,  I thought it may be possible to set one up to log just the location and temperature.  &#xA;&#xA;ansiweather -l paignton -p false -h false  -w false -i false   temponly.txt&#xA;&#xA;so the above will display the location and temperature,   but exclude pressure, humidity, wind and UV index.&#xA;&#xA;now=$(date +&#34;%m%d%Y&#34;)&#xA;echo &#34;Filename : /nas/backup$weather.csv&#34;&#xA;echo $(date &#34;+ %D, %T&#34;), $(ansiweather -l Paignton -a false)     weather$now.csv&#xA;&#xA;Control what is sent to stdout.&#xA;&#xA;now=$(date +&#34;%m%d%Y&#34;)&#xA;echo &#34;Filename : /nas/backup$weather.csv&#34;&#xA;echo $(date &#34;+ %D, %T&#34;), $(ansiweather -l torquay -p false -h false  -w false -i false)     torquay$now.csv&#xA;&#xA;Final script&#xA;&#xA;now=$(date +&#34;%m%d%Y&#34;)&#xA;echo &#34;Filename : /nas/backup$weather.csv&#34;&#xA;echo $(date &#34;+ %D, %T&#34;), $(ansiweather -l torquay -p false -h false  -w false -i false)     torquay$now.csv&#xA;&#xA;Tags&#xA;&#xA;#Bash,#BashScripting,#Logging,#Data&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Weather logging</p>

<p>So been experimenting with some of the options for ansiweather, partly as schools   need to teach data logging as part of the national curriculum computing,  however not all schools have the kit required.</p>

<p>As I have this running on a Raspberry Pi,  I thought it may be possible to set one up to log just the location and temperature.</p>

<pre><code>ansiweather -l paignton -p false -h false  -w false -i false &gt;temponly.txt
</code></pre>

<p>so the above will display the location and temperature,   but exclude pressure, humidity, wind and UV index.</p>

<pre><code>now=$(date +&#34;%m_%d_%Y&#34;)
echo &#34;Filename : /nas/backup_$weather.csv&#34;
echo $(date &#34;+ %D, %T&#34;), $(ansiweather -l Paignton -a false) &gt;&gt; weather_$now.csv
</code></pre>

<p>Control what is sent to stdout.</p>

<pre><code>now=$(date +&#34;%m_%d_%Y&#34;)
echo &#34;Filename : /nas/backup_$weather.csv&#34;
echo $(date &#34;+ %D, %T&#34;), $(ansiweather -l torquay -p false -h false  -w false -i false) &gt;&gt; torquay_$now.csv
</code></pre>

<p>Final script</p>

<pre><code>now=$(date +&#34;%m_%d_%Y&#34;)
echo &#34;Filename : /nas/backup_$weather.csv&#34;
echo $(date &#34;+ %D, %T&#34;), $(ansiweather -l torquay -p false -h false  -w false -i false) &gt;&gt; torquay_$now.csv
</code></pre>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Bash" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bash</span></a>,<a href="/paulsutton/tag:BashScripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">BashScripting</span></a>,<a href="/paulsutton/tag:Logging" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Logging</span></a>,<a href="/paulsutton/tag:Data" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Data</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/weather-logging</guid>
      <pubDate>Fri, 18 Jul 2025 06:52:59 +0000</pubDate>
    </item>
    <item>
      <title>Logging the weather</title>
      <link>https://personaljournal.ca/paulsutton/logging-the-weather</link>
      <description>&lt;![CDATA[Logging the weather&#xA;&#xA;I have modified the script that runs every 10 minutes to record the output from the ansiweather utility,   This still saves the output to a file but adds the current date to the file name.&#xA;&#xA;now=$(date +&#34;%m%d%Y&#34;)&#xA;echo &#34;Filename : /nas/backup$weather.csv&#34;&#xA;echo $(date &#34;+ %D, %T&#34;), $(ansiweather -l Paignton -a false)     weather$now.csv&#xA;&#xA;So the output looks like&#xA;&#xA; Humidity: 71% - Pressure: 1023 hPa&#xA;06/09/25, 14:20:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 1.79 m/s WSW - Humidity: 69% - Pressure: 1024 hPa&#xA;06/09/25, 14:30:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 2.24 m/s SW - Humidity: 70% - Pressure: 1023 hPa&#xA;06/09/25, 14:40:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 3.13 m/s W - Humidity: 69% - Pressure: 1023 hPa&#xA;06/09/25, 14:50:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 1.79 m/s SW - Humidity: 69% - Pressure: 1023 hPa&#xA;06/09/25, 15:00:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 1.79 m/s WSW - Humidity: 71% - Pressure: 1023 hPa&#xA;06/09/25, 15:10:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 1.34 m/s SSW - Humidity: 71% - Pressure: 1024 hPa&#xA;&#xA;As this runs on a headless pi4,  I can login and copy the data files locally before uploading to my gopherspace (Look it up) &#xA;&#xA;gopher://vern.cc/1/~zleap&#xA;&#xA;Tags&#xA;&#xA;#Bash,#BashScripting,#Data,#Logging,#Gopher,#RaspberryPi,&#xA;Weather&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Logging the weather</p>

<p>I have modified the script that runs every 10 minutes to record the output from the ansiweather utility,   This still saves the output to a file but adds the current date to the file name.</p>

<pre><code class="language-bash">now=$(date +&#34;%m_%d_%Y&#34;)
echo &#34;Filename : /nas/backup_$weather.csv&#34;
echo $(date &#34;+ %D, %T&#34;), $(ansiweather -l Paignton -a false) &gt;&gt; weather_$now.csv
</code></pre>

<p>So the output looks like</p>

<pre><code> Humidity: 71% - Pressure: 1023 hPa
06/09/25, 14:20:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 1.79 m/s WSW - Humidity: 69% - Pressure: 1024 hPa
06/09/25, 14:30:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 2.24 m/s SW - Humidity: 70% - Pressure: 1023 hPa
06/09/25, 14:40:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 3.13 m/s W - Humidity: 69% - Pressure: 1023 hPa
06/09/25, 14:50:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 1.79 m/s SW - Humidity: 69% - Pressure: 1023 hPa
06/09/25, 15:00:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 1.79 m/s WSW - Humidity: 71% - Pressure: 1023 hPa
06/09/25, 15:10:01, Weather in Paignton: 18 °C - UVI: 7.03 - Wind: 1.34 m/s SSW - Humidity: 71% - Pressure: 1024 hPa
</code></pre>

<p>As this runs on a headless pi4,  I can login and copy the data files locally before uploading to my gopherspace (<strong>Look it up</strong>)</p>

<pre><code>gopher://vern.cc/1/~zleap
</code></pre>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Bash" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bash</span></a>,<a href="/paulsutton/tag:BashScripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">BashScripting</span></a>,<a href="/paulsutton/tag:Data" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Data</span></a>,<a href="/paulsutton/tag:Logging" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Logging</span></a>,<a href="/paulsutton/tag:Gopher" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Gopher</span></a>,<a href="/paulsutton/tag:RaspberryPi" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">RaspberryPi</span></a>,
<a href="/paulsutton/tag:Weather" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Weather</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/logging-the-weather</guid>
      <pubDate>Mon, 09 Jun 2025 14:23:22 +0000</pubDate>
    </item>
    <item>
      <title>Bash Shortcuts</title>
      <link>https://personaljournal.ca/paulsutton/bash-shortcuts</link>
      <description>&lt;![CDATA[Bash Shortcuts&#xA;&#xA;This question was asked on the Linux Mint Matrix Support recently, I helped by looking up what was needed, and posting this as a reply, As this is also really useful and worth sharing more widely too.&#xA;&#xA;Bash Shortcuts&#xA;&#xA;Chat&#xA;&#xA;I am on the Devon and Cornwall Linux user group mailing list and also their matrix channel as zleap, it is better to ask there, that way others can answer too.&#xA;&#xA;Tags&#xA;&#xA;#Bash,#BashScripting,#Bashscripting,#Keyboard,#Shortcuts&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Bash Shortcuts</p>

<p>This question was asked on the Linux Mint Matrix Support recently, I helped by looking up what was needed, and posting this as a reply, As this is also really useful and worth sharing more widely too.</p>
<ul><li><a href="https://www.howtogeek.com/181/keyboard-shortcuts-for-bash-command-shell-for-ubuntu-debian-suse-redhat-linux-etc/" rel="nofollow">Bash Shortcuts</a></li></ul>

<p><strong>Chat</strong></p>

<p>I am on the <a href="https://www.dcglug.org.uk/" rel="nofollow">Devon and Cornwall Linux user group</a> mailing list and also their <a href="https://matrix.to/#/%23dcglug:matrix.org" rel="nofollow">matrix channel</a> as zleap, it is better to ask there, that way others can answer too.</p>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Bash" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bash</span></a>,<a href="/paulsutton/tag:BashScripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">BashScripting</span></a>,<a href="/paulsutton/tag:Bashscripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bashscripting</span></a>,<a href="/paulsutton/tag:Keyboard" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Keyboard</span></a>,<a href="/paulsutton/tag:Shortcuts" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Shortcuts</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/bash-shortcuts</guid>
      <pubDate>Thu, 15 May 2025 12:00:00 +0000</pubDate>
    </item>
    <item>
      <title>File integrity</title>
      <link>https://personaljournal.ca/paulsutton/file-integrity</link>
      <description>&lt;![CDATA[File integrity&#xA;&#xA;If providing downloadable files, it is important to ensure that the downloaded file is the same as that provided on the host server, this ensures the file has not been tampered with in some way.  The end user needs a way to check what they have downloaded is safe.&#xA;&#xA;One way to do this is to create a file checksum with md5sum&#xA;&#xA;let&#39;s say we have two files&#xA;-rw-rw-r-- 1 psutton psutton  67200 May  3 19:42 jcr.pdf&#xA;-rw-rw-r-- 1 psutton psutton 433231 Apr 28 17:50 southwest1.png&#xA;We want to create a checksum for both files.  To do this we can run&#xA;&#xA;md5sum southwest1.png &#xA;502d4f9dacab9240f2622c032e6ea11f  southwest1.png&#xA;md5sum jcr.pdf &#xA;b98edf4dd0afd0ede8ac6dabce66f522  jcr.pdf&#xA;This sends the checksum to stdout&#xA;&#xA;So need a file to store this&#xA;&#xA;md5sum jcr.pdf southwest1.png   md5sum2&#xA;We can then view the contents if this with&#xA;&#xA;as previously discussed the   directs output to a specified file&#xA;&#xA;cat md5sums&#xA;502d4f9dacab9240f2622c032e6ea11f  southwest1.png&#xA;b98edf4dd0afd0ede8ac6dabce66f522  jcr.pdf&#xA;&#xA;In this example, we listed the files we want to create a checksum for.&#xA;&#xA;If we were to add a 3rd file say tux.png  then we can do this and append the new checksum with&#xA;md5sum tux.png     md5sums&#xA;Then example our new md5sums file&#xA;cat md5sums&#xA;502d4f9dacab9240f2622c032e6ea11f  southwest1.png&#xA;b98edf4dd0afd0ede8ac6dabce66f522  jcr.pdf&#xA;d52cd5e7164eccd6da50e10d5a9c3dbf  tux.png&#xA;&#xA;So now that we have 3 files and a md5sums file,  we can check all the files listed&#xA;&#xA;md5sum -c md5sums&#xA;southwest1.png: OK&#xA;jcr.pdf: OK&#xA;tux.png: OK&#xA;&#xA;Chat&#xA;&#xA;I am on the Devon and Cornwall Linux user group mailing list and also their matrix channel as zleap, it is better to ask there, that way others can answer too.&#xA;&#xA;Tags&#xA;&#xA;#Bash,#BashScripting,#Bashscripting,#md5sums,#md5sum,#file,&#xA;#integrity,#check&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>File integrity</p>

<p>If providing downloadable files, it is important to ensure that the downloaded file is the same as that provided on the host server, this ensures the file has not been tampered with in some way.  The end user needs a way to check what they have downloaded is safe.</p>

<p>One way to do this is to create a file checksum with md5sum</p>

<p>let&#39;s say we have two files</p>

<pre><code>-rw-rw-r-- 1 psutton psutton  67200 May  3 19:42 jcr.pdf
-rw-rw-r-- 1 psutton psutton 433231 Apr 28 17:50 southwest1.png
</code></pre>

<p>We want to create a checksum for both files.  To do this we can run</p>

<pre><code>md5sum southwest1.png 
502d4f9dacab9240f2622c032e6ea11f  southwest1.png
md5sum jcr.pdf 
b98edf4dd0afd0ede8ac6dabce66f522  jcr.pdf
</code></pre>

<p>This sends the checksum to stdout</p>

<p>So need a file to store this</p>

<pre><code>md5sum jcr.pdf southwest1.png &gt; md5sum2
</code></pre>

<p>We can then view the contents if this with</p>

<p><em>as previously discussed the &gt; directs output to a specified file</em></p>

<pre><code>cat md5sums
502d4f9dacab9240f2622c032e6ea11f  southwest1.png
b98edf4dd0afd0ede8ac6dabce66f522  jcr.pdf
</code></pre>

<p>In this example, we listed the files we want to create a checksum for.</p>

<p>If we were to add a 3rd file say tux.png  then we can do this and append the new checksum with</p>

<pre><code>md5sum tux.png &gt;&gt; md5sums
</code></pre>

<p>Then example our new md5sums file</p>

<pre><code>cat md5sums
502d4f9dacab9240f2622c032e6ea11f  southwest1.png
b98edf4dd0afd0ede8ac6dabce66f522  jcr.pdf
d52cd5e7164eccd6da50e10d5a9c3dbf  tux.png
</code></pre>

<p>So now that we have 3 files and a md5sums file,  we can check all the files listed</p>

<pre><code>md5sum -c md5sums
southwest1.png: OK
jcr.pdf: OK
tux.png: OK
</code></pre>

<p><strong>Chat</strong></p>

<p>I am on the <a href="https://www.dcglug.org.uk/" rel="nofollow">Devon and Cornwall Linux user group</a> mailing list and also their <a href="https://matrix.to/#/%23dcglug:matrix.org" rel="nofollow">matrix channel</a> as zleap, it is better to ask there, that way others can answer too.</p>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Bash" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bash</span></a>,<a href="/paulsutton/tag:BashScripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">BashScripting</span></a>,<a href="/paulsutton/tag:Bashscripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bashscripting</span></a>,<a href="/paulsutton/tag:md5sums" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">md5sums</span></a>,<a href="/paulsutton/tag:md5sum" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">md5sum</span></a>,<a href="/paulsutton/tag:file" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">file</span></a>,
<a href="/paulsutton/tag:integrity" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">integrity</span></a>,<a href="/paulsutton/tag:check" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">check</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/file-integrity</guid>
      <pubDate>Thu, 15 May 2025 06:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Fun bash stuff</title>
      <link>https://personaljournal.ca/paulsutton/fun-bash-stuff</link>
      <description>&lt;![CDATA[Fun bash stuff&#xA;&#xA;While these are not bash commands, there are a few fun tools.&#xA;&#xA;One is fortune,  this displays a random quote on the console or terminal.&#xA;&#xA;fortune&#xA;Many pages make a thick book, except for pocket Bibles which are on very&#xA;very thin paper.&#xA;Another is cowsay which takes an argument and prints a picture of a cow (there are options to change how it looks or to other characters)&#xA;&#xA;cowsay hello&#xA; ____&#xA; hello &#xA; -------&#xA;        \   ^^&#xA;         \  (oo)\___&#xA;            ()\       )\/\&#xA;                ||----w |&#xA;                ||     ||&#xA;&#xA;As with other commands these can be combined&#xA;fortune | cowsay&#xA; ____________________________________&#xA;/ I don&#39;t know half of you half as well  \&#xA;| as I should like; and I like less than |&#xA;| half of you half as well as you        |&#xA;| deserve.                               |&#xA;|                                        |&#xA;\ -- J. R. R. Tolkien                    /&#xA; ----------------------------------------&#xA;        \   ^^&#xA;         \  (oo)\___&#xA;            ()\       )\/\&#xA;                ||----w |&#xA;                ||     ||&#xA;&#xA;Options&#xA;cowsay -f tux hello&#xA; _____&#xA; hello &#xA; -------&#xA;   \&#xA;    \&#xA;        .--.&#xA;       |oo |&#xA;       |:/ |&#xA;      //   \ \&#xA;     (|     | )&#xA;    /&#39;\   /`\&#xA;    \)=(/&#xA;&#xA;cowsay -f daemon hello&#xA; ___&#xA; hello &#xA; -------&#xA;   \         ,        ,&#xA;    \       /(        )`&#xA;     \      \ \   / |&#xA;            /-   `-/  &#39;&#xA;           (/\/ \ \   /\&#xA;           / /   | `    \&#xA;           O O   ) /    |&#xA;           -^--&#39;&lt;     &#39;&#xA;          (.)    )   /&#xA;           ./    /&#xA;             `-----&#39; /&#xA;&lt;----.      /    \&#xA;&lt;----|====O)))==) \) /====&#xA;&lt;----&#39;    --&#39; .,&#39; \&#xA;             |        |&#xA;              \       /&#xA;        _____( (  / \___&#xA;      ,&#39;  ,-----&#39;   |        \&#xA;      `--{_______)        \/&#xA;&#xA;Chat&#xA;&#xA;I am on the Devon and Cornwall Linux user group mailing list and also their matrix channel as zleap, it is better to ask there, that way others can answer too.&#xA;&#xA;Tags&#xA;&#xA;#Bash.#BashScripting,#Bashscripting,#Cowsay,#Fortune&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Fun bash stuff</p>

<p>While these are not bash commands, there are a few fun tools.</p>

<p>One is fortune,  this displays a random quote on the console or terminal.</p>

<pre><code>fortune
Many pages make a thick book, except for pocket Bibles which are on very
very thin paper.
</code></pre>

<p>Another is cowsay which takes an argument and prints a picture of a cow (there are options to change how it looks or to other characters)</p>

<pre><code>cowsay hello
 _______
&lt; hello &gt;
 -------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

</code></pre>

<p>As with other commands these can be combined</p>

<pre><code>fortune | cowsay
 ________________________________________
/ I don&#39;t know half of you half as well  \
| as I should like; and I like less than |
| half of you half as well as you        |
| deserve.                               |
|                                        |
\ -- J. R. R. Tolkien                    /
 ----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
</code></pre>

<p>Options</p>

<pre><code>cowsay -f tux hello
 _______
&lt; hello &gt;
 -------
   \
    \
        .--.
       |o_o |
       |:_/ |
      //   \ \
     (|     | )
    /&#39;\_   _/`\
    \___)=(___/

</code></pre>

<pre><code>cowsay -f daemon hello
 _______
&lt; hello &gt;
 -------
   \         ,        ,
    \       /(        )`
     \      \ \___   / |
            /- _  `-/  &#39;
           (/\/ \ \   /\
           / /   | `    \
           O O   ) /    |
           `-^--&#39;`&lt;     &#39;
          (_.)  _  )   /
           `.___/`    /
             `-----&#39; /
&lt;----.     __ / __   \
&lt;----|====O)))==) \) /====
&lt;----&#39;    `--&#39; `.__,&#39; \
             |        |
              \       /
        ______( (_  / \______
      ,&#39;  ,-----&#39;   |        \
      `--{__________)        \/

</code></pre>

<p><strong>Chat</strong></p>

<p>I am on the <a href="https://www.dcglug.org.uk/" rel="nofollow">Devon and Cornwall Linux user group</a> mailing list and also their <a href="https://matrix.to/#/%23dcglug:matrix.org" rel="nofollow">matrix channel</a> as zleap, it is better to ask there, that way others can answer too.</p>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Bash" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bash</span></a>.<a href="/paulsutton/tag:BashScripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">BashScripting</span></a>,<a href="/paulsutton/tag:Bashscripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bashscripting</span></a>,<a href="/paulsutton/tag:Cowsay" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Cowsay</span></a>,<a href="/paulsutton/tag:Fortune" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Fortune</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/fun-bash-stuff</guid>
      <pubDate>Tue, 13 May 2025 07:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Removing users</title>
      <link>https://personaljournal.ca/paulsutton/removing-users</link>
      <description>&lt;![CDATA[Removing users&#xA;&#xA;To remove a user, you can issue the following, as we are no longer setting up a gopher server on the pi, I will just remove the user.  &#xA;&#xA;sudo deluser gopher&#xA;&#xA;Which will remove the user, but not that users /home directory, which for the most part is fine if you want to keep hold of the user account data.&#xA;&#xA;For more information and options,  consult the man page&#xA;&#xA;man deluser&#xA;Chat&#xA;&#xA;I am on the Devon and Cornwall Linux user group mailing list and also their matrix channel as zleap, it is better to ask there, that way others can answer too.&#xA;&#xA;Tags&#xA;&#xA;#Bash,#Bashscripting,#BashScripting#users,#removing&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Removing users</p>

<p>To remove a user, you can issue the following, as we are no longer setting up a gopher server on the pi, I will just remove the user.</p>

<pre><code>sudo deluser gopher
</code></pre>

<p>Which will remove the user, but not that users /home directory, which for the most part is fine if you want to keep hold of the user account data.</p>

<p>For more information and options,  consult the man page</p>

<pre><code>man deluser
</code></pre>

<p><strong>Chat</strong></p>

<p>I am on the <a href="https://www.dcglug.org.uk/" rel="nofollow">Devon and Cornwall Linux user group</a> mailing list and also their <a href="https://matrix.to/#/%23dcglug:matrix.org" rel="nofollow">matrix channel</a> as zleap, it is better to ask there, that way others can answer too.</p>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Bash" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bash</span></a>,<a href="/paulsutton/tag:Bashscripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bashscripting</span></a>,<a href="/paulsutton/tag:BashScripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">BashScripting</span></a><a href="/paulsutton/tag:users" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">users</span></a>,<a href="/paulsutton/tag:removing" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">removing</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/removing-users</guid>
      <pubDate>Wed, 07 May 2025 06:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Bash scripting 24 – firewalls</title>
      <link>https://personaljournal.ca/paulsutton/bash-scripting-24-firewalls</link>
      <description>&lt;![CDATA[Bash scripting 24 – firewalls&#xA;&#xA;I am still experimenting with gopher, however this got me thinking about system security, so I have installed.&#xA;&#xA;If you are not sure what you are doing with this, please consult the man page&#xA;&#xA;man ufw&#xA;&#xA;So this describes ufw as&#xA;&#xA;ufw - program for managing a netfilter firewall&#xA;As I am ssh&#39;d in to the pi, then the firewall needs to be enabled, however, first make sure that that port 22 (or which ever port you are using for ssh) is allowed.   I have to do this as being logged in via ssh, emabling the firewall could block ssh preventing access.&#xA;&#xA;sudo ufw allow 22&#xA;&#xA;Then check the status&#xA;&#xA;sudo ufw status&#xA;Status: active&#xA;&#xA;To                         Action      From&#xA;--                         ------      ----&#xA;22                         ALLOW       Anywhere                  &#xA;22 (v6)                  ALLOW       Anywhere (v6)             &#xA;&#xA;To confirm that port 22 is allowed,  then enable&#xA;&#xA;sudo ufw enable&#xA;&#xA;Links&#xA;&#xA;using UFW&#xA;Port Numbers&#xA;Wikipedia TCP&#xA;Wikipedia UDP&#xA;&#xA;Tags&#xA;&#xA;#Bash,#Bashscripting,#BashScripting#Security,#Firewall&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Bash scripting 24 – firewalls</p>

<p>I am still experimenting with gopher, however this got me thinking about system security, so I have installed.</p>

<p>If you are not sure what you are doing with this, please consult the man page</p>

<pre><code>man ufw
</code></pre>

<p>So this describes ufw as</p>

<pre><code>ufw - program for managing a netfilter firewall
</code></pre>

<p>As I am ssh&#39;d in to the pi, then the firewall needs to be enabled, however, first make sure that that port 22 (or which ever port you are using for ssh) is allowed.   I have to do this as being logged in via ssh, emabling the firewall could block ssh preventing access.</p>

<pre><code>sudo ufw allow 22
</code></pre>

<p>Then check the status</p>

<pre><code>sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22                         ALLOW       Anywhere                  
22 (v6)                  ALLOW       Anywhere (v6)             
</code></pre>

<p>To confirm that port 22 is allowed,  then enable</p>

<pre><code>sudo ufw enable
</code></pre>

<p><strong>Links</strong></p>
<ul><li><a href="https://learnubuntu.com/ufw-commands/" rel="nofollow">using UFW</a></li>
<li><a href="https://www.newtechie.com/2014/07/list-of-common-tcpudp-port-numbers.html" rel="nofollow">Port Numbers</a></li>
<li><a href="https://en.wikipedia.org/wiki/Transmission_Control_Protocol" rel="nofollow">Wikipedia TCP</a></li>
<li><a href="https://en.wikipedia.org/wiki/User_Datagram_Protocol" rel="nofollow">Wikipedia UDP</a></li></ul>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Bash" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bash</span></a>,<a href="/paulsutton/tag:Bashscripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bashscripting</span></a>,<a href="/paulsutton/tag:BashScripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">BashScripting</span></a><a href="/paulsutton/tag:Security" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Security</span></a>,<a href="/paulsutton/tag:Firewall" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Firewall</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/bash-scripting-24-firewalls</guid>
      <pubDate>Tue, 29 Apr 2025 06:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Bash scripting 23 - users</title>
      <link>https://personaljournal.ca/paulsutton/bash-scripting-23-users</link>
      <description>&lt;![CDATA[Bash scripting 23 - users&#xA;&#xA;To add new users to a system, we can use the command.  You will need to have root privileges for this, so you need to prefix with sudo, e.g.  &#xA;&#xA;Permissions, the initial user you create when setting up the pi, has sudo or admin privileges.  Additional users will not. Unless you take steps to give that user those permissions.&#xA;&#xA;sudo useradd user&#xA;&#xA;The rest of the process is interactive,  in this example I am adding the user gopher to the raspberry Pi4 system we are also using for testing cron.&#xA;&#xA;sudo adduser gopher&#xA;Adding user `gopher&#39; ...&#xA;Adding new group `gopher&#39; (1001) ...&#xA;Adding new user gopher&#39; (1001) with group gopher (1001)&#39; ...&#xA;Creating home directory `/home/gopher&#39; ...&#xA;Copying files from `/etc/skel&#39; ...&#xA;New password: &#xA;Retype new password: &#xA;passwd: password updated successfully&#xA;Changing the user information for gopher&#xA;Enter the new value, or press ENTER for the default&#xA;&#x9;Full Name []: Gopher&#xA;&#x9;Room Number []: 0&#xA;&#x9;Work Phone []: 0&#xA;&#x9;Home Phone []: 0&#xA;&#x9;Other []: 0&#xA;Is the information correct? [Y/n] y&#xA;Adding new user gopher&#39; to supplemental / extra groups users&#39; ...&#xA;Adding user gopher&#39; to group users&#39; ...&#xA;&#xA;I can now login to the user gopher on the Raspberry Pi with&#xA;&#xA;$ ssh gopher@192.168.1.202&#xA;gopher@192.168.1.202&#39;s password: &#xA;Linux raspberrypi 6.12.20+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.20-1+rpt1~bpo12+1 (2025-03-19) aarch64&#xA;&#xA;The programs included with the Debian GNU/Linux system are free software;&#xA;the exact distribution terms for each program are described in the&#xA;individual files in /usr/share/doc/*/copyright.&#xA;&#xA;Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent&#xA;permitted by applicable law.&#xA;gopher@raspberrypi:~ $ &#xA;&#xA;To change the password on a GNU/Linux system, use &#xA;passwd&#xA;&#xA;To delete a user, use the userdel command, I am not going into this here, so as with other commands, there is a man page &#xA;&#xA;man userdel&#xA;userdel - delete a user account and related files&#xA;&#xA;Tags&#xA;&#xA;#Bash,#Bashscripting,#BashScripting#users,#adding&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Bash scripting 23 – users</p>

<p>To add new users to a system, we can use the command.  You will need to have root privileges for this, so you need to prefix with sudo, e.g.</p>

<p>**Permissions, the initial user you create when setting up the pi, has sudo or admin privileges.  Additional users will <strong>not</strong>. Unless you take steps to give that user those permissions.**</p>

<pre><code>sudo useradd &lt;user&gt;
</code></pre>

<p>The rest of the process is interactive,  in this example I am adding the user gopher to the raspberry Pi4 system we are also using for testing cron.</p>

<pre><code>sudo adduser gopher
Adding user `gopher&#39; ...
Adding new group `gopher&#39; (1001) ...
Adding new user `gopher&#39; (1001) with group `gopher (1001)&#39; ...
Creating home directory `/home/gopher&#39; ...
Copying files from `/etc/skel&#39; ...
New password: 
Retype new password: 
passwd: password updated successfully
Changing the user information for gopher
Enter the new value, or press ENTER for the default
	Full Name []: Gopher
	Room Number []: 0
	Work Phone []: 0
	Home Phone []: 0
	Other []: 0
Is the information correct? [Y/n] y
Adding new user `gopher&#39; to supplemental / extra groups `users&#39; ...
Adding user `gopher&#39; to group `users&#39; ...
</code></pre>

<p>I can now login to the user gopher on the Raspberry Pi with</p>

<pre><code>$ ssh gopher@192.168.1.202
gopher@192.168.1.202&#39;s password: 
Linux raspberrypi 6.12.20+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.20-1+rpt1~bpo12+1 (2025-03-19) aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
gopher@raspberrypi:~ $ 

</code></pre>

<p>To change the password on a GNU/Linux system, use</p>

<pre><code>passwd
</code></pre>

<p>To delete a user, use the userdel command, I am not going into this here, so as with other commands, there is a man page</p>

<pre><code>man userdel
userdel - delete a user account and related files
</code></pre>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Bash" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bash</span></a>,<a href="/paulsutton/tag:Bashscripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bashscripting</span></a>,<a href="/paulsutton/tag:BashScripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">BashScripting</span></a><a href="/paulsutton/tag:users" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">users</span></a>,<a href="/paulsutton/tag:adding" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">adding</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/bash-scripting-23-users</guid>
      <pubDate>Mon, 28 Apr 2025 06:30:00 +0000</pubDate>
    </item>
    <item>
      <title>Bash scripting 22 - passwords</title>
      <link>https://personaljournal.ca/paulsutton/bash-scripting-22-passwords</link>
      <description>&lt;![CDATA[Bash scripting 22 - passwords&#xA;&#xA;Having a secure password is really important,  but thinking of one can be difficult,  you can use three random words such as&#xA;&#xA;CanBookBoard2024%  &#xA;&#xA;I have added some numbers and a special symbol here as some websites will insist on more than just upper and lower case letters.&#xA;&#xA;Tbankfully bash has a tool for this&#xA;&#xA;apg - generates several random passwords&#xA;&#xA;You can find more information in the man page&#xA;man apg&#xA;&#xA;The example below&#xA;&#xA;apg -m 15 -M SNC&#xA;which produces &#xA;thuhuHersyoywik2&#xA;SindEjpiTrildaf3&#xA;Biabodke0skyudha&#xA;JeKneapFelu5gDom&#xA;neHydishGijcis02&#xA;NefNan2JeymDabas&#xA;So looking at this&#xA;&#xA;-m 15 - tells apg min password length should be 15 characters&#xA;-M SNC&#xA;&#xA;Forces apg to use (you need SNC in capitals to force this)&#xA;special symbols e.g: %^&amp;*&#xA;numerical characters, e.g 1234&#xA;capital letters&#xA;&#xA;Using -M SNC will give the same result.&#xA;&#xA;To change the password on a GNU/Linux system use &#xA;passwd&#xA;&#xA;Tags&#xA;&#xA;#Bash,#Bashscripting,#BashScripting#apg,#Security,#Password,#Generation&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Bash scripting 22 – passwords</p>

<p>Having a secure password is really important,  but thinking of one can be difficult,  you can use three random words such as</p>

<p>CanBookBoard2024%</p>

<p>I have added some numbers and a special symbol here as some websites will insist on more than just upper and lower case letters.</p>

<p>Tbankfully bash has a tool for this</p>

<pre><code>apg - generates several random passwords
</code></pre>

<p>You can find more information in the man page</p>

<pre><code>man apg
</code></pre>

<p>The example below</p>

<pre><code>apg -m 15 -M SNC
</code></pre>

<p>which produces</p>

<pre><code>thuhuHersyoywik2
SindEjpiTrildaf3
Biabodke0skyudha
JeKneapFelu5gDom
neHydishGijcis02
NefNan2JeymDabas
</code></pre>

<p>So looking at this</p>

<p>-m 15 – tells apg min password length should be 15 characters
-M SNC</p>

<p>Forces apg to use (you need SNC in capitals to force this)
* special symbols e.g: %^&amp;*
* numerical characters, e.g 1234
* capital letters</p>

<p>Using -M SNC will give the same result.</p>

<p>To change the password on a GNU/Linux system use</p>

<pre><code>passwd
</code></pre>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Bash" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bash</span></a>,<a href="/paulsutton/tag:Bashscripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bashscripting</span></a>,<a href="/paulsutton/tag:BashScripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">BashScripting</span></a><a href="/paulsutton/tag:apg" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">apg</span></a>,<a href="/paulsutton/tag:Security" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Security</span></a>,<a href="/paulsutton/tag:Password" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Password</span></a>,<a href="/paulsutton/tag:Generation" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Generation</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/bash-scripting-22-passwords</guid>
      <pubDate>Sun, 27 Apr 2025 06:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Bash scripting 21 - cron</title>
      <link>https://personaljournal.ca/paulsutton/bash-scripting-21-cron</link>
      <description>&lt;![CDATA[Bash scripting 21 - cron&#xA;&#xA;One of the important things you need to do as a system admin is run tasks that perform specific tasks on the system.   This is fine when you are sitting in front of the computer, or logged in remotely, but what happens if you need to run a task when you are not there, or you just want to automate the running of these tasks. &#xA;&#xA;You can schedule tasks using the cron command.   There is an easy-to-use tutorial for this at [1].  I am not going to reproduce this here,  but may include some of my own specific use cases in a later post. &#xA;&#xA;Using cron to schedule tasks&#xA;&#xA;According to [1] the following &#xA;&#xA;/5      /home/paul/crontest.sh&#xA;runs every 5 minutes, where as&#xA;/10      /home/paul/crontest.sh&#xA;So putting ls -l in crontest.sh will run that command every 5 or 10 minutes.&#xA;&#xA;However, I am logged into my pi (where I am running this) so the script will run, but I don&#39;t see any output.&#xA;&#xA;If I add in ls -l   dirlist.txt&#xA;&#xA;It will produce a directory listing text file when run, by running ls manually you can see it in the listing.&#xA;&#xA;I have a post on Ansiweather scheduled fora few days,  in the meantime&#xA;&#xA;putting this in the crontest.sh file&#xA;&#xA;echo $(date), $(ansiweather -l Paignton -a false)     weather.csv&#xA;&#xA;It will run at the specified time and append the information to weather.csv which could be a good way to monitor weather over time.&#xA;&#xA;This can be examined with&#xA;&#xA;cat weather.csv &#xA;if you use the watch command&#xA;&#xA;watch cat weather.csv&#xA;the contents of weather.csv will be displayed and updated in real time as the file is appended with new information.&#xA;&#xA;References&#xA;&#xA;https://stackoverflow.com/questions/12786410/run-cron-job-every-n-minutes-plus-offset&#xA;&#xA;Tags&#xA;&#xA;#Bash,#Bashscripting,#Task,#Schedule,#cron,#crontab,#Admin,&#xA;Automation&#xA;&#xA;hr&#xD;&#xA;&#xD;&#xA;table&#xD;&#xA;thead&#xD;&#xA;trtda rel=&#34;me&#34; href=&#34;https://qoto.org/@zleap&#34;Mastodon/a/td&#xD;&#xA;tda href=&#34;https://wiki.ircnow.org/?n=Shelllabs.Intro&#34;ShellLabs/td&#xD;&#xA;tda href=&#34;https://joinmastodon.org/&#34;Join Mastodon/a/td/tr/thead/table&#xD;&#xA;center&#xD;&#xA;AI statement : b Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. /b&#xD;&#xA;/center&#xD;&#xA;&#xD;&#xA;a href=&#34;https://liberapay.com/PaulSutton/donate&#34;img alt=&#34;Donate using Liberapay&#34; src=&#34;https://liberapay.com/assets/widgets/donate.svg&#34;/a&#xD;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Bash scripting 21 – cron</p>

<p>One of the important things you need to do as a system admin is run tasks that perform specific tasks on the system.   This is fine when you are sitting in front of the computer, or logged in remotely, but what happens if you need to run a task when you are not there, or you just want to automate the running of these tasks.</p>

<p>You can schedule tasks using the cron command.   There is an easy-to-use tutorial for this at [1].  I am <strong>not</strong> going to reproduce this here,  but may include some of my own specific use cases in a later post.</p>
<ul><li><a href="https://hostthrive.com/advanced-hosting-techniques/a-beginners-guide-to-using-cron-jobs-for-scheduled-tasks/" rel="nofollow">Using cron to schedule tasks</a></li></ul>

<p>According to [1] the following</p>

<pre><code>*/5  * * * * /home/paul/crontest.sh
</code></pre>

<p>runs every 5 minutes, where as</p>

<pre><code>*/10  * * * * /home/paul/crontest.sh
</code></pre>

<p>So putting ls -l in crontest.sh will run that command every 5 or 10 minutes.</p>

<p>However, I am logged into my pi (where I am running this) so the script will run, but I don&#39;t see any output.</p>

<p>If I add in ls -l &gt; dirlist.txt</p>

<p>It will produce a directory listing text file when run, by running ls manually you can see it in the listing.</p>

<p>I have a post on Ansiweather scheduled fora few days,  in the meantime</p>

<p>putting this in the crontest.sh file</p>

<pre><code>echo $(date), $(ansiweather -l Paignton -a false) &gt;&gt; weather.csv
</code></pre>

<p>It will run at the specified time and append the information to weather.csv which could be a good way to monitor weather over time.</p>

<p>This can be examined with</p>

<pre><code>cat weather.csv 
</code></pre>

<p>if you use the watch command</p>

<pre><code>watch cat weather.csv
</code></pre>

<p>the contents of weather.csv will be displayed and updated in real time as the file is appended with new information.</p>

<p><strong>References</strong></p>
<ol><li><a href="https://stackoverflow.com/questions/12786410/run-cron-job-every-n-minutes-plus-offset" rel="nofollow">https://stackoverflow.com/questions/12786410/run-cron-job-every-n-minutes-plus-offset</a></li></ol>

<p><strong>Tags</strong></p>

<p><a href="/paulsutton/tag:Bash" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bash</span></a>,<a href="/paulsutton/tag:Bashscripting" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Bashscripting</span></a>,<a href="/paulsutton/tag:Task" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Task</span></a>,<a href="/paulsutton/tag:Schedule" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Schedule</span></a>,<a href="/paulsutton/tag:cron" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">cron</span></a>,<a href="/paulsutton/tag:crontab" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">crontab</span></a>,<a href="/paulsutton/tag:Admin" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Admin</span></a>,
<a href="/paulsutton/tag:Automation" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Automation</span></a></p>

<hr>

<p><table>
<thead>
<tr><td><a href="https://qoto.org/@zleap" rel="nofollow">Mastodon</a></td>
<td><a href="https://wiki.ircnow.org/?n=Shelllabs.Intro" rel="nofollow">ShellLabs</td>
<td><a href="https://joinmastodon.org/" rel="nofollow">Join Mastodon</a></td></tr></thead></table>

AI statement : <b> Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity.  Consent CANNOT be assumed, it has to be granted. </b>
</p>

<p><a href="https://liberapay.com/PaulSutton/donate" rel="nofollow"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></p>
]]></content:encoded>
      <guid>https://personaljournal.ca/paulsutton/bash-scripting-21-cron</guid>
      <pubDate>Sat, 26 Apr 2025 06:00:00 +0000</pubDate>
    </item>
  </channel>
</rss>