<?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>Linux on Brad's Blog</title><link>https://blog.bjdean.id.au/tags/linux/</link><description>Recent content in Linux on Brad's Blog</description><generator>Hugo -- 0.152.2</generator><language>en-au</language><copyright>Bradley Dean</copyright><lastBuildDate>Thu, 27 Nov 2025 11:34:44 +1100</lastBuildDate><atom:link href="https://blog.bjdean.id.au/tags/linux/index.xml" rel="self" type="application/rss+xml"/><item><title>Understanding Linux Load Averages and Multi-Core Systems</title><link>https://blog.bjdean.id.au/2025/11/understanding-linux-load-averages-and-multi-core-systems/</link><pubDate>Thu, 27 Nov 2025 11:34:44 +1100</pubDate><guid>https://blog.bjdean.id.au/2025/11/understanding-linux-load-averages-and-multi-core-systems/</guid><description>How to interpret load averages on Linux systems and understand what happens when you add more CPU cores</description></item><item><title>explain-strace: Making Strace Output Easier To Read</title><link>https://blog.bjdean.id.au/2025/11/explain-strace-making-strace-output-easier-to-read/</link><pubDate>Thu, 20 Nov 2025 15:14:24 +1100</pubDate><guid>https://blog.bjdean.id.au/2025/11/explain-strace-making-strace-output-easier-to-read/</guid><description>Building a tool to parse and explain strace output with human-readable descriptions</description></item><item><title>Adding a Site to AWStats With Historical Logs</title><link>https://blog.bjdean.id.au/2023/11/adding-a-site-to-awstats-with-historical-logs/</link><pubDate>Mon, 13 Nov 2023 09:57:46 +1100</pubDate><guid>https://blog.bjdean.id.au/2023/11/adding-a-site-to-awstats-with-historical-logs/</guid><description>A quick walkthrough of adding a new site to AWStats and importing archived access logs without disrupting existing sites</description></item><item><title>Increasing / decreasing number of xargs parallel processes (at run time!)</title><link>https://blog.bjdean.id.au/2022/03/increasing-decreasing-number-of-xargs-parallel-processes-at-run-time/</link><pubDate>Fri, 18 Mar 2022 12:38:59 +0000</pubDate><guid>https://blog.bjdean.id.au/2022/03/increasing-decreasing-number-of-xargs-parallel-processes-at-run-time/</guid><description>&lt;p&gt;&lt;a href="https://manpages.debian.org/findutils/xargs.1.en.html"&gt;xargs&lt;/a&gt; makes it very easy to quickly run a set of similar processes in parallel - but did you know when you&amp;rsquo;re half-way through a long list of tasks it&amp;rsquo;s possible to change the number of parallel processes that are being used?
It&amp;rsquo;s there in the &lt;a href="https://manpages.debian.org/findutils/xargs.1.en.html#P"&gt;man page under &amp;ldquo;P max-procs, &amp;ndash;max-procs=max-procs&amp;rdquo;&lt;/a&gt; but it&amp;rsquo;s an easy feature to miss if you don&amp;rsquo;t read all the way through:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;-P max-procs, --max-procs=max-procs
Run up to max-procs processes at a time; the default is 1. If max-procs is 0, xargs will run as many processes as possible at a time. Use the -n option or the -L option with -P; otherwise chances are that only one exec will be done. &amp;lt;strong&amp;gt;While xargs is running, you can send its process a SIGUSR1 signal to increase the number of commands to run simultaneously, or a SIGUSR2 to decrease the number.&amp;lt;/strong&amp;gt; You cannot increase it above an implementation-defined limit (which is shown with --show-limits). You cannot decrease it below 1. xargs never terminates its commands; when asked to decrease, it merely waits for more than one existing command to terminate before starting another.
Please note that it is up to the called processes to properly manage parallel access to shared resources. For example, if more than one of them tries to print to stdout, the output will be produced in an indeterminate order (and very likely mixed up) unless the processes collaborate in some way to prevent this. Using some kind of locking scheme is one way to prevent such problems. In general, using a locking scheme will help ensure correct output but reduce performance. If you don&amp;#39;t want to tolerate the performance difference, simply arrange for each process to produce a separate output file (or otherwise use separate resources).
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;What does that look like? Spin up some slow processes and start with 3-way parallel execution:&lt;/p&gt;</description></item><item><title>stdbuf - Run COMMAND, with modified buffering operations for its standard streams</title><link>https://blog.bjdean.id.au/2020/11/stdbuf-run-command-with-modified-buffering-operations-for-its-standard-streams/</link><pubDate>Wed, 25 Nov 2020 12:18:37 +0000</pubDate><guid>https://blog.bjdean.id.au/2020/11/stdbuf-run-command-with-modified-buffering-operations-for-its-standard-streams/</guid><description>&lt;p&gt;While piping together commands that only output intermittently we run into the pipe buffers created by the &lt;a href="https://manpage.me/index.cgi?q=pipe&amp;amp;sektion=2&amp;amp;apropos=0&amp;amp;manpath=Debian+8.1.0"&gt;pipe() system call&lt;/a&gt; (also see &lt;a href="https://manpage.me/index.cgi?apropos=0&amp;amp;q=pipe&amp;amp;sektion=7&amp;amp;manpath=Debian+8.1.0&amp;amp;arch=default&amp;amp;format=html"&gt;overview of pipes and FIFOs&lt;/a&gt;). This can particularly come into play when stringing together multiple pipes in a row (as there are multiple buffers to pass through).
For example in the command below while &amp;ldquo;tail -f&amp;rdquo; flushes on activity and awk will flush on output but the grep  in the middle ends up with a buffered pipe and so a quiet access.log will result in long delays before updates are shown:&lt;/p&gt;</description></item><item><title>Disk Usage</title><link>https://blog.bjdean.id.au/2020/10/disk-usage/</link><pubDate>Tue, 13 Oct 2020 15:00:05 +0000</pubDate><guid>https://blog.bjdean.id.au/2020/10/disk-usage/</guid><description>&lt;p&gt;To review disk usage recursively - a few different options exist (when scanning manually through with df and du are not enough).&lt;/p&gt;
&lt;p&gt;I have found &lt;a href="http://dev.yorhel.nl/ncdu"&gt;ncdu&lt;/a&gt; to be fast and very easy to use.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve also used &lt;a href="http://packages.debian.org/unstable/utils/durep"&gt;durep&lt;/a&gt; from time to time.&lt;/p&gt;
&lt;p&gt;For a desktop system (or a server with a X server handy) a few options exist. Some support remote scanning, though this can be slow and problematic as a network connection is required for the duration of the scan:&lt;/p&gt;</description></item><item><title>md (software RAID) and lvm (logical volume management)</title><link>https://blog.bjdean.id.au/2020/10/md-software-raid-and-lvm-logical-volume-management/</link><pubDate>Tue, 13 Oct 2020 14:56:52 +0000</pubDate><guid>https://blog.bjdean.id.au/2020/10/md-software-raid-and-lvm-logical-volume-management/</guid><description>&lt;h2 id="md"&gt;md&lt;/h2&gt;
&lt;p&gt;Building a RAID array using mdadm - two primary steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&amp;ldquo;mdadm &amp;ndash;create&amp;rdquo; to build the array using available resources&lt;/li&gt;
&lt;li&gt;&amp;ldquo;mdadm &amp;ndash;detail &amp;ndash;scan&amp;rdquo; to build config string for /etc/mdadm/mdadm.conf&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Simple examples:&lt;/p&gt;
&lt;h3 id="raid6-array"&gt;RAID6 array&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Set up partitions to be used (in this case the whole disk):&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# for x in /dev/sd{b,c,d,e,f}1 ; do fdisk $x ; done
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Create the array (in this case, with one hot-spare):&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# mdadm --create /dev/md0 --level=6 --raid-devices=4 --spare-devices=1 /dev/sd{b,c,d,e,f}1
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Configure the array for reboot (append to the end of /etc/mdadm/mdadm.conf):&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# mdadm --detail --scan
ARRAY /dev/md/0 metadata=1.2 spares=1 name=debian6-vm:0 UUID=9b42abcd:309fabcd:6bfbabcd:298dabcd
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Considerations when setting up the partitions might be that any replacement disks will need to support that same size partition. Unconfirmed but it sounds like it might be a reasonable concern: &amp;ldquo;Enter a value smaller than the free space value minus 2% or the disk size to make sure that when you will later install a new disk in replacement of a failed one, you will have at least the same capacity even if the number of cylinders is different.&amp;rdquo; (&lt;a href="http://www.jerryweb.org/settings/raid/"&gt;http://www.jerryweb.org/settings/raid/&lt;/a&gt;)&lt;/p&gt;</description></item><item><title>Supporting old Debian distros</title><link>https://blog.bjdean.id.au/2020/10/supporting-old-debian-distros/</link><pubDate>Tue, 13 Oct 2020 14:53:26 +0000</pubDate><guid>https://blog.bjdean.id.au/2020/10/supporting-old-debian-distros/</guid><description>&lt;p&gt;For old servers that need to stay that way (for whatever reason) updates are no longer available but you can access the packages that were available for that distro by pointing apt at the archive - for example see lenny:&lt;/p&gt;
&lt;p&gt;Update &lt;code&gt;/etc/apt/sources.list&lt;/code&gt; to use &lt;code&gt;archive.debian.org&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;deb http://archive.debian.org/debian/ lenny main contrib non-free
deb-src http://archive.debian.org/debian/ lenny main contrib non-free
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And for ubuntu:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;deb http://old-releases.ubuntu.com/ubuntu/ natty main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ natty-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ natty-security main restricted universe multiverse
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Also see:&lt;/p&gt;</description></item><item><title>Adding tasks to a background screen</title><link>https://blog.bjdean.id.au/2020/09/adding-tasks-to-a-background-screen/</link><pubDate>Thu, 03 Sep 2020 20:13:41 +0000</pubDate><guid>https://blog.bjdean.id.au/2020/09/adding-tasks-to-a-background-screen/</guid><description>&lt;p&gt;A bunch of processes have failed - and you&amp;rsquo;d like to restart them in a &lt;a href="https://savannah.gnu.org/projects/screen"&gt;screen&lt;/a&gt; session in case you need to rerun them in an interactive shells (for instance to answer prompts from the processes) - lots of &lt;em&gt;Ctrl-A-C &amp;hellip; start command &amp;hellip;. Ctrl-A-S &amp;hellip; name the window &amp;hellip; and repeat&lt;/em&gt; later there has to be an easier way!&lt;/p&gt;
&lt;h2 id="step-1-create-a-background-screen-session-to-hold-the-runs"&gt;Step 1: Create a background screen session to hold the runs&lt;/h2&gt;
&lt;p&gt;This will open a new screen session named &amp;ldquo;ScreenSessionName&amp;rdquo; into the background (so you don&amp;rsquo;t need to &lt;em&gt;Ctrl-A-d&lt;/em&gt;):&lt;/p&gt;</description></item><item><title>LINES and COLUMNS environment magic</title><link>https://blog.bjdean.id.au/2019/12/lines-and-columns-environment-magic/</link><pubDate>Tue, 03 Dec 2019 22:17:07 +0000</pubDate><guid>https://blog.bjdean.id.au/2019/12/lines-and-columns-environment-magic/</guid><description>&lt;p&gt;Ever wondered why you can read the &lt;strong&gt;$LINES&lt;/strong&gt; and &lt;strong&gt;$COLUMNS&lt;/strong&gt; environment variables from your text shell and have them seemingly aware (or indeed, actually aware) of the size of the graphical terminal in which that shell is running?
Enter &lt;strong&gt;SIGWINCH&lt;/strong&gt; - a &lt;a href="https://en.wikipedia.org/wiki/Signal_(IPC)"&gt;signal&lt;/a&gt; sent to processes when a window size changes. This signal causes a process to retrieve it&amp;rsquo;s current window size. For example in linux it is done though an &lt;a href="http://man7.org/linux/man-pages/man4/tty_ioctl.4.html"&gt;ioctl&lt;/a&gt; call in termios.h:&lt;/p&gt;</description></item><item><title>Useful Commands</title><link>https://blog.bjdean.id.au/2019/02/useful-commands/</link><pubDate>Tue, 05 Feb 2019 23:30:40 +0000</pubDate><guid>https://blog.bjdean.id.au/2019/02/useful-commands/</guid><description>&lt;p&gt;A list of commands / references I&amp;rsquo;ve found useful. Also see &lt;a href="http://bjdean.id.au/wiki/System_Admin/nix#head-9e4315f50d02ddf56ac443516721ec7bd70c9838"&gt;my old wiki page&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="stdbuf---run-command-with-modified-buffering-operations-for-its-standard-streams"&gt;stdbuf - Run COMMAND, with modified buffering operations for its standard streams&lt;/h2&gt;
&lt;p&gt;See &lt;a href="https://blog.bjdean.id.au/2020/11/stdbuf-run-command-with-modified-buffering-operations-for-its-standard-streams/"&gt;stdbuf - Run COMMAND, with modified buffering operations for its standard streams&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="tracing-the-dns-glue-record-for-a-domain"&gt;Tracing the DNS glue record for a domain&lt;/h2&gt;
&lt;p&gt;To find the glue records (if any) for a domain use (for example):&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;dig +trace +additional positive-internet.com NS
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will give a full trace on how the NS records for the domain were found, and if they end up using a &lt;a href="https://en.wikipedia.org/w/index.php?title=Glue_record"&gt;glue record&lt;/a&gt; it will be visible (only if +additional is given in the command) - for example in the lookup above we start with the global servers, then find the servers for .com. and then the next response contains the information from the .com. servers as to where to find positive-internet.com. data and this includes glue records:&lt;/p&gt;</description></item></channel></rss>