<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Raymond P. Burkholder - Things I Do - Bash</title>
    <link>https://blog.raymond.burkholder.net/</link>
    <description>In And Around Technology and The Arts</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.7.2 - http://www.s9y.org/</generator>
    <pubDate>Sun, 03 Dec 2023 18:44:27 GMT</pubDate>

    <image>
        <url>https://blog.raymond.burkholder.net/templates/bulletproof/img/s9y_banner_small.png</url>
        <title>RSS: Raymond P. Burkholder - Things I Do - Bash - In And Around Technology and The Arts</title>
        <link>https://blog.raymond.burkholder.net/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>ls notes</title>
    <link>https://blog.raymond.burkholder.net/index.php?/archives/1253-ls-notes.html</link>
            <category>Bash</category>
    
    <comments>https://blog.raymond.burkholder.net/index.php?/archives/1253-ls-notes.html#comments</comments>
    <wfw:comment>https://blog.raymond.burkholder.net/wfwcomment.php?cid=1253</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=1253</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;b&gt;&lt;pre&gt;ls -srSk ~/Downloads/&lt;/pre&gt;&lt;/b&gt;

&lt;ul&gt;
  &lt;li&gt;s - size in blocks
  &lt;li&gt;r - reverse order (largest at bottom)
  &lt;li&gt;k - 1024 byte block size
  &lt;li&gt;S - sort by size
  &lt;/ul&gt;

&lt;b&gt;&lt;pre&gt;ls -d ~/Downloads/*&lt;/pre&gt;&lt;/b&gt;

&lt;ul&gt;
  &lt;li&gt;Shows path to all files in the directory
  &lt;/ul&gt; 
    </content:encoded>

    <pubDate>Sun, 03 Dec 2023 18:36:14 +0000</pubDate>
    <guid isPermaLink="false">https://blog.raymond.burkholder.net/index.php?/archives/1253-guid.html</guid>
    
</item>
<item>
    <title>Bash Snippets</title>
    <link>https://blog.raymond.burkholder.net/index.php?/archives/1010-Bash-Snippets.html</link>
            <category>Bash</category>
    
    <comments>https://blog.raymond.burkholder.net/index.php?/archives/1010-Bash-Snippets.html#comments</comments>
    <wfw:comment>https://blog.raymond.burkholder.net/wfwcomment.php?cid=1010</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=1010</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;blockquote&gt;
find . -maxdepth 0  -iname &#039;*ansible*&#039; -print0 | xargs -I{} --null mv {} ansible
&lt;/blockquote&gt;

&lt;p&gt;This looks for any file name with mixed case ansible in it (in which the file may have spaces), pipes to xargs which will use mv to move the file to the directory &#039;ansible&#039;. 
    </content:encoded>

    <pubDate>Sat, 20 Jul 2019 14:53:07 +0000</pubDate>
    <guid isPermaLink="false">https://blog.raymond.burkholder.net/index.php?/archives/1010-guid.html</guid>
    
</item>
<item>
    <title>Linux 'date' </title>
    <link>https://blog.raymond.burkholder.net/index.php?/archives/1001-Linux-date.html</link>
            <category>Bash</category>
    
    <comments>https://blog.raymond.burkholder.net/index.php?/archives/1001-Linux-date.html#comments</comments>
    <wfw:comment>https://blog.raymond.burkholder.net/wfwcomment.php?cid=1001</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=1001</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;blockquote&gt;&lt;pre&gt;
$ date
Thu May  9 09:47:03 MDT 2019
$ TZ=Z date -d &#039;2 hours ago&#039; +%FT%TZ
2019-05-09T13:47:04Z
&lt;/pre&gt;&lt;/blockquote&gt; 
    </content:encoded>

    <pubDate>Thu, 09 May 2019 15:46:14 +0000</pubDate>
    <guid isPermaLink="false">https://blog.raymond.burkholder.net/index.php?/archives/1001-guid.html</guid>
    
</item>
<item>
    <title>Bash Links</title>
    <link>https://blog.raymond.burkholder.net/index.php?/archives/917-Bash-Links.html</link>
            <category>Bash</category>
    
    <comments>https://blog.raymond.burkholder.net/index.php?/archives/917-Bash-Links.html#comments</comments>
    <wfw:comment>https://blog.raymond.burkholder.net/wfwcomment.php?cid=917</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=917</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.softpanorama.org/Scripting/Shellorama/Bash_as_command_interpreter/bash_command_history_reuse.shtml&quot; target=_blank&gt;history reuse and bang commands&lt;/a&gt;
  &lt;/ul&gt; 
    </content:encoded>

    <pubDate>Mon, 16 Apr 2018 16:34:11 +0000</pubDate>
    <guid isPermaLink="false">https://blog.raymond.burkholder.net/index.php?/archives/917-guid.html</guid>
    
</item>
<item>
    <title>SystemCtl and JournalCtl</title>
    <link>https://blog.raymond.burkholder.net/index.php?/archives/910-SystemCtl-and-JournalCtl.html</link>
            <category>Bash</category>
    
    <comments>https://blog.raymond.burkholder.net/index.php?/archives/910-SystemCtl-and-JournalCtl.html#comments</comments>
    <wfw:comment>https://blog.raymond.burkholder.net/wfwcomment.php?cid=910</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=910</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;An extract from something in the past:

&lt;p&gt;Use 
&lt;pre&gt;systemctl status .service&lt;/pre&gt; afterwards to ensure that the service is both up, running, and running correctly, or use &lt;pre&gt;journalctl --follow&lt;/pre&gt; in another term window.

&lt;p&gt;If you have bash_completion on your distro, there is tab completion of every switch and every service that is actually installed. systemctl &lt;tab&gt; will show all the commands systemctl --&amp;lt;tab&amp;gt; will show all the long options and systemctl start &amp;lt;tab&amp;gt; will show all installed services etc.

&lt;p&gt;&lt;pre&gt;man systemd.index&lt;/pre&gt; gives an overview of every systemd-related man page, and man systemd.directives gives an index over (almost) all commands, config files, directives etc.

 
    </content:encoded>

    <pubDate>Sat, 24 Mar 2018 18:48:55 +0000</pubDate>
    <guid isPermaLink="false">https://blog.raymond.burkholder.net/index.php?/archives/910-guid.html</guid>
    
</item>
<item>
    <title>Sorting Ipv4 Addresses on the Command Line</title>
    <link>https://blog.raymond.burkholder.net/index.php?/archives/908-Sorting-Ipv4-Addresses-on-the-Command-Line.html</link>
            <category>Bash</category>
    
    <comments>https://blog.raymond.burkholder.net/index.php?/archives/908-Sorting-Ipv4-Addresses-on-the-Command-Line.html#comments</comments>
    <wfw:comment>https://blog.raymond.burkholder.net/wfwcomment.php?cid=908</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=908</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;From a mailing list:

&lt;blockquote&gt;&lt;pre&gt;
&amp;gt;Does anyone have a script that sorts IPv4 addresses?  
&amp;gt;I&#039;ve tried all sorts of tricks with &quot;sort -n -k&quot; etc, but can&#039;t seem to get it right.

With an older sort:
sort -t&#039;.&#039; -n -k1,1 -k2,2 -k3,3 -k4,4

With modern GNU sort, a &quot;version syntax&quot; sort is available:
sort -V 
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;And something else:

&lt;blockquote&gt;
the canonical &quot;sort | uniq -c | sort -nr&quot; so beloved of admins everywhere
&lt;/blockquote&gt; 
    </content:encoded>

    <pubDate>Sat, 24 Mar 2018 13:23:18 +0000</pubDate>
    <guid isPermaLink="false">https://blog.raymond.burkholder.net/index.php?/archives/908-guid.html</guid>
    
</item>
<item>
    <title>Quick hex / decimal conversion using CLI</title>
    <link>https://blog.raymond.burkholder.net/index.php?/archives/864-Quick-hex-decimal-conversion-using-CLI.html</link>
            <category>Bash</category>
    
    <comments>https://blog.raymond.burkholder.net/index.php?/archives/864-Quick-hex-decimal-conversion-using-CLI.html#comments</comments>
    <wfw:comment>https://blog.raymond.burkholder.net/wfwcomment.php?cid=864</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=864</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;Source for this is from &lt;a href=&quot;http://linuxcommando.blogspot.com/2008/04/quick-hex-decimal-conversion-using-cli.html&quot; target=_blank&gt;Quick hex / decimal conversion using CLI&lt;/a&gt;.

&lt;p&gt;Since, one way or another, I have a bash console up somewhere, it would be convenient to perform decimal &lt;-&gt; hexadecimal conversions right there.  

&lt;p&gt;To convert hexadecimal to decimal, a few native ways (the third example requires the bc app installed, and as it isn&#039;t installed by default on stretch or cygwin, I don&#039;t have output):

&lt;blockquote&gt;&lt;pre&gt;
$ echo $((0x2ac))
684

$ printf &#039;%d\n&#039; 0x2ac
684

$ echo &#039;ibase=16;obase=A;15A&#039; | bc
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;To convert the other way around, the printf commands seems to be the most straight-forward:

&lt;blockquote&gt;&lt;pre&gt;
$ printf &#039;%x\n&#039; 684
2ac
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt; To use bc: a) notation for ibase, obase is decimal, b) input number needs to be in upper case, c) some playing around to make ibase/obase convert correctly.

&lt;blockquote&gt;&lt;pre&gt;
$ echo &#039;ibase=10;obase=16;684&#039; | bc
&lt;/pre&gt;&lt;/blockquote&gt;
 
    </content:encoded>

    <pubDate>Wed, 22 Nov 2017 13:16:59 +0000</pubDate>
    <guid isPermaLink="false">https://blog.raymond.burkholder.net/index.php?/archives/864-guid.html</guid>
    
</item>
<item>
    <title>Linux Login Bypass / Password Recovery (needs physical access)</title>
    <link>https://blog.raymond.burkholder.net/index.php?/archives/721-Linux-Login-Bypass-Password-Recovery-needs-physical-access.html</link>
            <category>Bash</category>
    
    <comments>https://blog.raymond.burkholder.net/index.php?/archives/721-Linux-Login-Bypass-Password-Recovery-needs-physical-access.html#comments</comments>
    <wfw:comment>https://blog.raymond.burkholder.net/wfwcomment.php?cid=721</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=721</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;For Debian Stretch:

&lt;ul&gt;
  &lt;li&gt;Reboot computer and enter the grub menu
  &lt;li&gt;&#039;e&#039; to edit the entry, usually the first/default entry
  &lt;li&gt;on the line starting with &#039;linux&#039;, at &#039;ro quiet&#039;, substitute &#039;rw init=/bin/bash&#039;, or for read only access and a different shell, use &#039;ro init=/bin/sh&#039;
  &lt;li&gt;press control-X or F10 to reboot
  &lt;li&gt;direct access to root command line is provided (if forgot to set rw instead of ro, use &#039;mount -n -o rw,remount /&#039; at the command line)
  &lt;li&gt;after making changes, reboot into normal security mode
  &lt;/ul&gt;

&lt;p&gt;With reference to &lt;a href=&quot;https://wiki.archlinux.org/index.php/reset_root_password&quot; target=_blank&gt;archlinunx&lt;/a&gt;.

&lt;p&gt;Alternative is to add &#039;debug-shell.service&#039; to the boot line, F10 to boot, then use ctrl+alt+f9 to reach the debug session 
    </content:encoded>

    <pubDate>Fri, 06 Jan 2017 12:08:06 +0000</pubDate>
    <guid isPermaLink="false">https://blog.raymond.burkholder.net/index.php?/archives/721-guid.html</guid>
    
</item>
<item>
    <title>UUID From Linux Command Line</title>
    <link>https://blog.raymond.burkholder.net/index.php?/archives/665-UUID-From-Linux-Command-Line.html</link>
            <category>Bash</category>
    
    <comments>https://blog.raymond.burkholder.net/index.php?/archives/665-UUID-From-Linux-Command-Line.html#comments</comments>
    <wfw:comment>https://blog.raymond.burkholder.net/wfwcomment.php?cid=665</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=665</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    Need to generate UUIDs in a shell script?  No problem:

&lt;blockquote&gt;&lt;pre&gt;
$ cat /proc/sys/kernel/random/uuid
2252a738-2997-4002-b6fb-2cbb272f8adc
$ cat /proc/sys/kernel/random/uuid
ba65ec83-0698-4788-97fe-822ba7cb72b0
&lt;/pre&gt;&lt;/blockquote&gt; 
    </content:encoded>

    <pubDate>Tue, 05 Jan 2016 15:04:36 +0000</pubDate>
    <guid isPermaLink="false">https://blog.raymond.burkholder.net/index.php?/archives/665-guid.html</guid>
    
</item>
<item>
    <title>Bash: Check for Empty Variable</title>
    <link>https://blog.raymond.burkholder.net/index.php?/archives/657-Bash-Check-for-Empty-Variable.html</link>
            <category>Bash</category>
    
    <comments>https://blog.raymond.burkholder.net/index.php?/archives/657-Bash-Check-for-Empty-Variable.html#comments</comments>
    <wfw:comment>https://blog.raymond.burkholder.net/wfwcomment.php?cid=657</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=657</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;When working with command line substitutions, one way to check for presence (or lack thereof) of a command line variable:

&lt;pre&gt;&lt;blockquote&gt;
if [ &quot;x$1&quot; == &quot;x&quot; ];then
...
fi
&lt;/blockquote&gt;&lt;/pre&gt;

&lt;p&gt;If it matches, then there was no command line variable, as in &#039;x matches x&#039;. 
    </content:encoded>

    <pubDate>Fri, 23 Oct 2015 12:00:00 +0000</pubDate>
    <guid isPermaLink="false">https://blog.raymond.burkholder.net/index.php?/archives/657-guid.html</guid>
    
</item>
<item>
    <title>Bash Shell Environment Variables</title>
    <link>https://blog.raymond.burkholder.net/index.php?/archives/647-Bash-Shell-Environment-Variables.html</link>
            <category>Bash</category>
    
    <comments>https://blog.raymond.burkholder.net/index.php?/archives/647-Bash-Shell-Environment-Variables.html#comments</comments>
    <wfw:comment>https://blog.raymond.burkholder.net/wfwcomment.php?cid=647</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=647</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;Courtesy of &lt;a href=&quot;http://askubuntu.com/questions/275965/how-to-list-all-variables-names-and-their-current-values&quot; target=_blank&gt;StackExchange&lt;/a&gt;, here are some methods of obtaining a list of shell variables.

&lt;p&gt;Print exported environment variables:

&lt;blockquote&gt;
printenv
&lt;/blockquote&gt;

or

&lt;blockquote&gt;
env
&lt;/blockquote&gt;

&lt;p&gt;To show a list of environment variables plus shell variables  (unexported environment variables):

&lt;blockquote&gt;
( set -o posix ; set ) | less
&lt;/blockquote&gt;

&lt;p&gt;In KDE, to see environment variables exported/inherited to the graphic environment:

&lt;blockquote&gt;&lt;pre&gt;
press Alt-F2
run:  xterm -e bash --noprofile --norc
run: env
&lt;/pre&gt;&lt;/blockquote&gt;
 
    </content:encoded>

    <pubDate>Wed, 19 Aug 2015 01:18:53 +0000</pubDate>
    <guid isPermaLink="false">https://blog.raymond.burkholder.net/index.php?/archives/647-guid.html</guid>
    
</item>
<item>
    <title>Bash Script to Large Number of Files</title>
    <link>https://blog.raymond.burkholder.net/index.php?/archives/354-Bash-Script-to-Large-Number-of-Files.html</link>
            <category>Bash</category>
    
    <comments>https://blog.raymond.burkholder.net/index.php?/archives/354-Bash-Script-to-Large-Number-of-Files.html#comments</comments>
    <wfw:comment>https://blog.raymond.burkholder.net/wfwcomment.php?cid=354</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>https://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=354</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;Not knowing any other way to remove a large number of similarily named files from a directory (such as netflow files), and not wanting to do it manually, the following one liner creates something to start with:

&lt;blockquote&gt;&lt;pre&gt;
ls -1 -A ft | sed &quot;s/^/rm ft\//&quot; &gt; d.sh
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;It does a directory listing with one column, and does not include the &#039;.&#039; and &#039;..&#039; 
entries.  It then uses sed (stream editor&gt; to insert a rm command at the 
beginning of each line.  The results are written out to a file for further tweaking. 

&lt;blockquote&gt;&lt;pre&gt;
chmod +x d.sh
&lt;/pre&gt;&lt;/blockquote&gt;
 
&lt;p&gt;will make the script executable. 
    </content:encoded>

    <pubDate>Thu, 07 Feb 2008 15:03:47 +0000</pubDate>
    <guid isPermaLink="false">https://blog.raymond.burkholder.net/index.php?/archives/354-guid.html</guid>
    
</item>

</channel>
</rss>
