by carbonlogic | Mar 13, 2025 | blog
Ever found yourself switching between vim and using cat <filename> because vim has syntax highlighting but you want to stay at the prompt?
You can replace the /bin/cat command with a the ‘cat’ command. If you cat a file, it will output its text using the appropriate syntax highlighting by default and will also include line numbers.
In debian, you can install using:
sudo apt install bat-cat
In Alma and Red-hat based systems, just use:
dnf install bat
Here is some sample output of using cat on a file called testphp.php:

More discussion can be found here:
Bat is the better cat
by carbonlogic | Sep 19, 2022 | blog
There is a wonderful bash script to back up PowerDNS zone files, written by the author who posts as ‘msb’, here:
https://stack-source.com/2021/01/25/powerdns-zone-backups/
I am reproducing it here because I found it very useful for keeping text version backups of some of zone files which are stored in a mysql database by powerdns.
I’ve updated the script to make a few modifications. Namely, I would like to store each set of daily backups to a separate folder. Here is my updated script:
#!/bin/bash
# creates dump/export/backup of all DNS zones
today=`date +%Y%m%d`
if [ ! -d /info/backup/zones/$today ]; then
if [ ! -d /info/backup/zones/$today ]; then
mkdir /info/backup/zones/$today
fi
mkdir /info/backup/zones/$today
fi
zones=(`/usr/bin/pdnsutil list-all-zones`)
for z in "${!zones[@]}"
do
/usr/bin/pdnsutil list-zone ${zones[$z]} > "/info/backup/zones/$today/${zones[$z]}-$today.zone"
done
If you compare the two scripts, you can see that I moved the ‘today’ variable higher up in the script so it can be used to create subdirectories for the daily backup when the pdnsutil command is used near the bottom.
When the script is run, it will now create a subdirectory in the backup directory for today’s date and place all the zone files with a timestamp in that directory.
I also chose to remove the find command and place it separately on its own as a cronjob.
Recent Comments