<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet href="https://sandfox.me/assets/xml/atom.xsl" type="text/xsl media="all"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom">
  <title>Sand Fox (Posts about Linux)</title>
  <id>https://sandfox.me/linux.xml</id>
  <updated>2026-09-02T00:44:46Z</updated>
  <author>
    <name>Anton Smirnov</name>
  </author>
  <link rel="self" type="application/atom+xml" href="https://sandfox.me/linux.xml"/>
  <link rel="alternate" type="text/html" href="https://sandfox.me/linux.html"/>
  <generator uri="https://getnikola.com/">Nikola</generator>
  <entry>
    <title>Count files by extension</title>
    <id>https://sandfox.me/linux/count-by-ext.html</id>
    <updated>2025-07-11T07:23:00+03:00</updated>
    <published>2025-07-11T07:23:00+03:00</published>
    <author>
      <name>Anton Smirnov</name>
    </author>
    <link rel="alternate" type="text/html" href="https://sandfox.me/linux/count-by-ext.html"/>
    <summary type="html">&lt;div&gt;&lt;p&gt;TL;DR:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code bash"&gt;&lt;a id="rest_code_6b0a4d75a9994134974e0eb641ed16c0-1" name="rest_code_6b0a4d75a9994134974e0eb641ed16c0-1" href="https://sandfox.me/linux/count-by-ext.html#rest_code_6b0a4d75a9994134974e0eb641ed16c0-1"&gt;&lt;/a&gt;find&lt;span class="w"&gt; &lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;-type&lt;span class="w"&gt; &lt;/span&gt;f&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;sed&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'s/.*\///; s/^\.//; /\./! s/$/./; s/.*\.//'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;sort&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;uniq&lt;span class="w"&gt; &lt;/span&gt;-c&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;sort&lt;span class="w"&gt; &lt;/span&gt;-nr
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="https://sandfox.me/linux/count-by-ext.html"&gt;Read more…&lt;/a&gt; (1 min remaining to read)&lt;/p&gt;&lt;/div&gt;</summary>
    <category term="find" label="find"/>
    <category term="sed" label="sed"/>
    <category term="sort" label="sort"/>
    <category term="uniq" label="uniq"/>
  </entry>
  <entry>
    <title>Building 32-bit PHP on 64-bit Fedora</title>
    <id>https://sandfox.me/linux/php-32bit.html</id>
    <updated>2023-07-14T05:17:00+03:00</updated>
    <published>2023-07-14T05:17:00+03:00</published>
    <author>
      <name>Anton Smirnov</name>
    </author>
    <link rel="alternate" type="text/html" href="https://sandfox.me/linux/php-32bit.html"/>
    <summary type="html">&lt;div&gt;&lt;p&gt;This is a short howto for people who already know how to compile PHP.&lt;/p&gt;
&lt;p&gt;TL;DR:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code sh"&gt;&lt;a id="rest_code_940b97ab93944ba2a6f7a3d4d944e3fc-1" name="rest_code_940b97ab93944ba2a6f7a3d4d944e3fc-1" href="https://sandfox.me/linux/php-32bit.html#rest_code_940b97ab93944ba2a6f7a3d4d944e3fc-1"&gt;&lt;/a&gt;&lt;span class="nv"&gt;CFLAGS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'-m32'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;PKG_CONFIG_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/lib/pkgconfig&lt;span class="w"&gt; &lt;/span&gt;./configure&lt;span class="w"&gt; &lt;/span&gt;--host&lt;span class="o"&gt;=&lt;/span&gt;i886&lt;span class="w"&gt; &lt;/span&gt;--prefix&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;/Software/php32&lt;span class="w"&gt; &lt;/span&gt;--exec-prefix&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;/Software/php32&lt;span class="w"&gt; &lt;/span&gt;--with-gmp&lt;span class="w"&gt; &lt;/span&gt;--enable-mbstring
&lt;a id="rest_code_940b97ab93944ba2a6f7a3d4d944e3fc-2" name="rest_code_940b97ab93944ba2a6f7a3d4d944e3fc-2" href="https://sandfox.me/linux/php-32bit.html#rest_code_940b97ab93944ba2a6f7a3d4d944e3fc-2"&gt;&lt;/a&gt;make&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;make&lt;span class="w"&gt; &lt;/span&gt;install
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="https://sandfox.me/linux/php-32bit.html"&gt;Read more…&lt;/a&gt; (1 min remaining to read)&lt;/p&gt;&lt;/div&gt;</summary>
    <category term="cross-compilation" label="cross-compilation"/>
    <category term="php" label="php"/>
  </entry>
  <entry>
    <title>Trash Directory for Partition</title>
    <id>https://sandfox.me/linux/partition-trash.html</id>
    <updated>2021-01-09T21:48:00+02:00</updated>
    <published>2021-01-08T12:26:00+02:00</published>
    <author>
      <name>Anton Smirnov</name>
    </author>
    <link rel="alternate" type="text/html" href="https://sandfox.me/linux/partition-trash.html"/>
    <summary type="html">&lt;p&gt;If you have a separate user writable drive mounted, you may have encountered the same problem I had.
If your DE cannot create &lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;.Trash-$uid&lt;/span&gt;&lt;/code&gt;, most DEs will not delete files to the trash at all and KDE will copy deleted files to your home partition.
I find both behaviors frustrating.&lt;/p&gt;
&lt;p&gt;The solution is rather simple: look at the &lt;a class="reference external" href="https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html"&gt;spec&lt;/a&gt; and create the trash directory manually.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code bash"&gt;&lt;a id="rest_code_9a09be8301a741df859c391c23d58c17-1" name="rest_code_9a09be8301a741df859c391c23d58c17-1" href="https://sandfox.me/linux/partition-trash.html#rest_code_9a09be8301a741df859c391c23d58c17-1"&gt;&lt;/a&gt;&lt;span class="c1"&gt;# for example, your drive is mounted to /media/external&lt;/span&gt;
&lt;a id="rest_code_9a09be8301a741df859c391c23d58c17-2" name="rest_code_9a09be8301a741df859c391c23d58c17-2" href="https://sandfox.me/linux/partition-trash.html#rest_code_9a09be8301a741df859c391c23d58c17-2"&gt;&lt;/a&gt;&lt;span class="c1"&gt;# go to the drive root&lt;/span&gt;
&lt;a id="rest_code_9a09be8301a741df859c391c23d58c17-3" name="rest_code_9a09be8301a741df859c391c23d58c17-3" href="https://sandfox.me/linux/partition-trash.html#rest_code_9a09be8301a741df859c391c23d58c17-3"&gt;&lt;/a&gt;&lt;span class="nb"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;/media/external
&lt;a id="rest_code_9a09be8301a741df859c391c23d58c17-4" name="rest_code_9a09be8301a741df859c391c23d58c17-4" href="https://sandfox.me/linux/partition-trash.html#rest_code_9a09be8301a741df859c391c23d58c17-4"&gt;&lt;/a&gt;
&lt;a id="rest_code_9a09be8301a741df859c391c23d58c17-5" name="rest_code_9a09be8301a741df859c391c23d58c17-5" href="https://sandfox.me/linux/partition-trash.html#rest_code_9a09be8301a741df859c391c23d58c17-5"&gt;&lt;/a&gt;&lt;span class="c1"&gt;# create root owned .Trash&lt;/span&gt;
&lt;a id="rest_code_9a09be8301a741df859c391c23d58c17-6" name="rest_code_9a09be8301a741df859c391c23d58c17-6" href="https://sandfox.me/linux/partition-trash.html#rest_code_9a09be8301a741df859c391c23d58c17-6"&gt;&lt;/a&gt;sudo&lt;span class="w"&gt; &lt;/span&gt;mkdir&lt;span class="w"&gt; &lt;/span&gt;.Trash
&lt;a id="rest_code_9a09be8301a741df859c391c23d58c17-7" name="rest_code_9a09be8301a741df859c391c23d58c17-7" href="https://sandfox.me/linux/partition-trash.html#rest_code_9a09be8301a741df859c391c23d58c17-7"&gt;&lt;/a&gt;
&lt;a id="rest_code_9a09be8301a741df859c391c23d58c17-8" name="rest_code_9a09be8301a741df859c391c23d58c17-8" href="https://sandfox.me/linux/partition-trash.html#rest_code_9a09be8301a741df859c391c23d58c17-8"&gt;&lt;/a&gt;&lt;span class="c1"&gt;# make it world writable with a sticky bit&lt;/span&gt;
&lt;a id="rest_code_9a09be8301a741df859c391c23d58c17-9" name="rest_code_9a09be8301a741df859c391c23d58c17-9" href="https://sandfox.me/linux/partition-trash.html#rest_code_9a09be8301a741df859c391c23d58c17-9"&gt;&lt;/a&gt;sudo&lt;span class="w"&gt; &lt;/span&gt;chmod&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1777&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;.Trash
&lt;/pre&gt;&lt;/div&gt;
&lt;aside class="admonition note"&gt;
&lt;p class="admonition-title"&gt;Note&lt;/p&gt;
&lt;p&gt;Sticky bit is used for retaining control over your files in a publicly writable directory.
Only the owner of the file can delete or rename it even if other users have write permission in the parent directory.
This is a typical permission for &lt;code class="docutils literal"&gt;/tmp&lt;/code&gt;. &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Sticky_bit"&gt;Read more&lt;/a&gt;&lt;/p&gt;
&lt;/aside&gt;
&lt;p&gt;Now delete some file from that partition and check that is lands to &lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;.Trash/$uid/files&lt;/span&gt;&lt;/code&gt;.
Your trash directory now works properly.&lt;/p&gt;</summary>
    <category term="trash" label="trash"/>
  </entry>
  <entry>
    <title>RPM5 Lost All Distros</title>
    <id>https://sandfox.me/linux/rpm5.html</id>
    <updated>2019-04-10T17:49:00+03:00</updated>
    <published>2019-04-10T17:49:00+03:00</published>
    <author>
      <name>Anton Smirnov</name>
    </author>
    <link rel="alternate" type="text/html" href="https://sandfox.me/linux/rpm5.html"/>
    <summary type="html">&lt;p&gt;With &lt;a class="reference external" href="https://www.openmandriva.org/"&gt;OpenMandriva Lx&lt;/a&gt; 4 now in beta it seems that &lt;a class="reference external" href="http://rpm5.org/"&gt;RPM5&lt;/a&gt; lost all its main users.
CAOS, Ark and Unity are discontinued, Wind River and OpenMandriva switched to RPMv4&lt;/p&gt;
&lt;p&gt;Interestingly, it's also the end of &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Urpmi"&gt;urpmi&lt;/a&gt; with both Mageia and OpenMandriva switching to dnf.&lt;/p&gt;
&lt;p&gt;It seems rpm world entered a semi-unified state with dnf and zypper,
both libsolv based and partly interoperable&lt;/p&gt;</summary>
    <category term="mandriva" label="mandriva"/>
    <category term="openmandriva" label="openmandriva"/>
    <category term="rpm" label="rpm"/>
    <category term="rpm5" label="rpm5"/>
  </entry>
  <entry>
    <title>What Is Dead May Never Die</title>
    <id>https://sandfox.me/linux/greyjoy.html</id>
    <updated>2016-03-21T16:00:00+03:00</updated>
    <published>2016-03-21T16:00:00+03:00</published>
    <author>
      <name>Anton Smirnov</name>
    </author>
    <link rel="alternate" type="text/html" href="https://sandfox.me/linux/greyjoy.html"/>
    <summary type="html">&lt;div&gt;&lt;p&gt;Let's have some fun with the &lt;a class="reference external" href="https://awoiaf.westeros.org/index.php/Drowned_God"&gt;Drowned God&lt;/a&gt; and &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Unix_signal"&gt;Unix signals&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is a simple program that catches &lt;code class="docutils literal"&gt;SIGINT&lt;/code&gt; and &lt;code class="docutils literal"&gt;SIGTERM&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://sandfox.me/linux/greyjoy.html"&gt;Read more…&lt;/a&gt; (1 min remaining to read)&lt;/p&gt;&lt;/div&gt;</summary>
    <category term="c" label="c"/>
    <category term="fun" label="fun"/>
    <category term="game-of-thrones" label="game of thrones"/>
    <category term="unix-signals" label="unix signals"/>
  </entry>
  <entry>
    <title>systemd in Zabbix</title>
    <id>https://sandfox.me/linux/systemd-zabbix.html</id>
    <updated>2015-01-17T12:00:00Z</updated>
    <published>2015-01-17T12:00:00Z</published>
    <author>
      <name>Anton Smirnov</name>
    </author>
    <link rel="alternate" type="text/html" href="https://sandfox.me/linux/systemd-zabbix.html"/>
    <summary type="html">&lt;p&gt;If you use Zabbix to monitor your servers you may want to monitor
systemd services with it especially if you have some custom services.&lt;/p&gt;
&lt;p&gt;These simple checks were enough for me:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code sh"&gt;&lt;a id="rest_code_7d2fb85c47a6415d9914a3d59b66a0ad-1" name="rest_code_7d2fb85c47a6415d9914a3d59b66a0ad-1" href="https://sandfox.me/linux/systemd-zabbix.html#rest_code_7d2fb85c47a6415d9914a3d59b66a0ad-1"&gt;&lt;/a&gt;systemd.unit.is-active&lt;span class="o"&gt;[&lt;/span&gt;&amp;lt;unit&lt;span class="w"&gt; &lt;/span&gt;name&amp;gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="c1"&gt;# 1 if unit is active, 0 if inactive&lt;/span&gt;
&lt;a id="rest_code_7d2fb85c47a6415d9914a3d59b66a0ad-2" name="rest_code_7d2fb85c47a6415d9914a3d59b66a0ad-2" href="https://sandfox.me/linux/systemd-zabbix.html#rest_code_7d2fb85c47a6415d9914a3d59b66a0ad-2"&gt;&lt;/a&gt;systemd.unit.is-failed&lt;span class="o"&gt;[&lt;/span&gt;&amp;lt;unit&lt;span class="w"&gt; &lt;/span&gt;name&amp;gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="c1"&gt;# 1 if unit if in failed state, 0 if not&lt;/span&gt;
&lt;a id="rest_code_7d2fb85c47a6415d9914a3d59b66a0ad-3" name="rest_code_7d2fb85c47a6415d9914a3d59b66a0ad-3" href="https://sandfox.me/linux/systemd-zabbix.html#rest_code_7d2fb85c47a6415d9914a3d59b66a0ad-3"&gt;&lt;/a&gt;systemd.unit.is-enabled&lt;span class="o"&gt;[&lt;/span&gt;&amp;lt;unit&lt;span class="w"&gt; &lt;/span&gt;name&amp;gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;# 1 if unit is enabled, 0 if not&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It's very simple. Just place &lt;code class="docutils literal"&gt;userparameter_systemd.conf&lt;/code&gt; to your zabbix config dir
(usually &lt;code class="docutils literal"&gt;/etc/zabbix_agentd.conf.d&lt;/code&gt;) with the following content:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code ini"&gt;&lt;a id="rest_code_7de54ea3726045e997875c8317b29be2-1" name="rest_code_7de54ea3726045e997875c8317b29be2-1" href="https://sandfox.me/linux/systemd-zabbix.html#rest_code_7de54ea3726045e997875c8317b29be2-1"&gt;&lt;/a&gt;&lt;span class="c1"&gt;# checks to determine if specified unit is active, failed or enabled&lt;/span&gt;
&lt;a id="rest_code_7de54ea3726045e997875c8317b29be2-2" name="rest_code_7de54ea3726045e997875c8317b29be2-2" href="https://sandfox.me/linux/systemd-zabbix.html#rest_code_7de54ea3726045e997875c8317b29be2-2"&gt;&lt;/a&gt;&lt;span class="na"&gt;UserParameter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;systemd.unit.is-active[*],systemctl is-active --quiet '$1' &amp;amp;&amp;amp; echo 1 || echo 0&lt;/span&gt;
&lt;a id="rest_code_7de54ea3726045e997875c8317b29be2-3" name="rest_code_7de54ea3726045e997875c8317b29be2-3" href="https://sandfox.me/linux/systemd-zabbix.html#rest_code_7de54ea3726045e997875c8317b29be2-3"&gt;&lt;/a&gt;&lt;span class="na"&gt;UserParameter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;systemd.unit.is-failed[*],systemctl is-failed --quiet '$1' &amp;amp;&amp;amp; echo 1 || echo 0&lt;/span&gt;
&lt;a id="rest_code_7de54ea3726045e997875c8317b29be2-4" name="rest_code_7de54ea3726045e997875c8317b29be2-4" href="https://sandfox.me/linux/systemd-zabbix.html#rest_code_7de54ea3726045e997875c8317b29be2-4"&gt;&lt;/a&gt;&lt;span class="na"&gt;UserParameter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;systemd.unit.is-enabled[*],systemctl is-enabled --quiet '$1' &amp;amp;&amp;amp; echo 1 || echo 0&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;</summary>
    <category term="systemd" label="systemd"/>
    <category term="zabbix" label="zabbix"/>
  </entry>
</feed>
