KD0YTE's Ham Radio, Linux, and other stuff.

pacman usage in arch linux
3rd June 2025

pacman is Arch linux's package manager. similar to apt in debian and dnf in fedora but much more complex as several
operations depend on multiple use flags.

One can go read https://wiki.archlinux.org/title/Pacman on the arch wiki but a quick synopsis is as follows.

pacman -S packagename installs a package (must be run with root priveleges)

pacman -R package name uninstalls a package

pacman -Rs uninstalls the package and its dependancies if not used by other packages.

pacman -Ss search for a package

pacman -Syu upgrade all packages to the very latest

in addition their are a few other useful commands.

paccache -r cleans the package cache of old unneded package versions

pactree packagename lists all dependancies for a package

Tags: linux.
rsync commands
14th May 2025

rsync is a useful tool for copying files to a remote machine using ssh.
simple command to backup a directory is
rsync -a ~/dir1 username@remote_host:destination_directory
if the username is the same on both systems you can omit the username@
if you omit the destination after the : then files are copied to the users home folder.

comand line options
-a archive mode which preserves file permissions
-z will compress the file during transfer to make the transfer faster
-P will show progress and also allows partial transfer so that files that havent been changed won't have to be transferred again.
-an --delete forces rsync to delete the files on the destination before copying the source file. this is not the default behavior of rsync
-v is for verbose output giving information about the transfer as it is happening.
-h gives human readable output on files sizes etc.

Give rsync a try it is quite useful

Tags: linux.
dmidecode for hardware info
16th April 2025

Sometimes you need to discover the specs on the hardware you are running.
For example: cat /proc/cpuinfo will give you detailed info about your cpu
neofetch and fastfetch are quite popular for giving you other specs but
a more powerful command is dmidecode
the command must be run as root or with sudo it has several command line options as follows.

dmidecode -t to see info about your pc
keywords are
bios
system
baseboard
chassis
processor
memory
cache
connector
slot

for example
sudo dmidecode -t processor will show details about your cpu

dmidecode is included with most distributions
lsh is another useful tool but must be installed as an additional package

Tags: linux.
Taskwarrior task manager
12th April 2025

Taskwarrior is a linux command line task manager and reminder app
there are many command line options but the simplest are as follows.

Adding a task:
$ task add "task description"

Listing tasks:
$ task
will output as follows

ID Age Description Urg
1 2min check out obsidian 0
2 1min finish printing spacers 0

Deleting a task
$ task del "task number"

Tags: linux.
wiping a drive in windows
4th April 2025

I don't have many windows tips on this blog as I don't use it a lot
But sometimes you need to help a friend with a problem. One of those problems is how to reset a drive in windows.
Maybe you want to sell it or give it to someone.
The way to do this under windows: open a cmd prompt as administrator
type diskpart enter
then type list disk enter
drives will be listed
C will be labeled as disk 0 other disks will be sequential
Be careful to choose the right one. "Danger Will Robinson"
type select disk 1 (or whatever disk you need to wipe)
then type clean
then type exit and enter twice to get out of the command prompt.
To use the drive in windows use disk manager to initialize the drive.
How secure is the clean procedure?
A greybeard might have a way to recover the data but most folks will not.
There are more secure ways to wipe the drive but it is much more trouble.

Tags: windows.
system.d notes
9th February 2025

System.d can run stop enable or disbles services with the systemctl command

Examples

sudo systemctl start httpd to start apache web service, can also use restart
sudo systemctl stop httpd stops the service
sudo systemctl enable httpd enables it to start at system startup
sudo systemctl disable httpd duisables it
sudo systemctl status httpd tells you if it is running

possible services are in 1 of 3 directories in this order of priority
the /etc/systemd/system directory ,
the /run/systemd/services directory and
the /lib/systemd/system directory.

So ls-l those directories to see units that systemctl can
control.
package managers will install units to /lib/systemd/system

If you write you own units put them in /etc/systemd/system so they wont be overwritten
by package managers.

Tags: linux.
Temps to html
20th September 2024

So in an earlier post I talked about setting up a pi zero to do temp and humidity recording

Today we will take this output and convert it to an html file to post on a local webserver.
We will also automate this process and add an archiving operation in case we want to go back and look at past data

First you will need to install a couple of things on the pi.
1. a webserver. I am using nginx as it is light on resources and the pi zero isnt very fast
2. the pandas python library to do the converting so

sudo apt install nginx python3-pandas

Next make a python script. We will call it csvconv.py
nano csvconv.py

## Python program to convert
## CSV to HTML Table

import pandas as pd

## to read csv file named "temps.csv"
a = pd.read_csv("temps.csv")

## to save as html file
## named as "temps.html"
a.to_html("temps.html")

## assign it to a
## variable (string)
html_file = a.to_html()

press ctrl o to save and ctrl x to quit

next make a bash script to do the html conversion and add some header and footers

nano dohtmltemps.sh

#!/bin/bash

cp ftemp.txt temps.csv
rm temps.html
python csvconv.py

cat gheader.html temps.html gfooter.html > index.html
cp index.html /var/www/html/

ctrl o and ctrl x as before to save

(by default the /var/www/html folder is writable only as root you will need to get around this so the script can write the file.)
(you could chmod +w -R the folder but if you will have this webserver connected to the internet that is a security risk.)

the gheader.html and gfooter.html are simple html snippets to make the page more complete.

make yours as fancy as you like.

next I made a script to run weekly to archive the data for posterity.
nano arctmp.sh

#!/bin/bash

echo ftemp.txt > "ftemp-$(date +"%m-%d-%Y").txt"
echo temps.csv > "temps-$(date +"%m-%d-%Y").csv"

sleep 5
cp ftheader.txt ftemp.txt

This simply appends the date to the file name.

Finally you want to setup cron to record the temp hourly, make the html file nightly and archive the temp data weekly.
crontab -e to edit the crontab

Here is what I have in mine

*/60 * * * * /home/pi/temprec.sh

46 23 * * * /home/pi/dohtmltemps.sh

50 23 * * 0 /home/pi/arctmp.sh

enjoy!

Tags: linux, raspberry pi.
pi power off button
6th September 2024

You can make a shutdown button without the need for a running script by adding this to /boot/config.txt:

dtoverlay=gpio-shutdown

The default pin for the above is pin 5 (GPIO3). which is shorted to ground

If you plan to use I2C then you will need to change the shutdown pin to something else.
For example to change the shutdown pin from the default GPIO 3 to GPIO 26 (physical pin 37), add this to /boot/config.txt

dtoverlay=gpio-shutdown,gpio_pin=26

Tags: raspberry pi.
boot linux mint to the cmd line
30th August 2024

Sometimes you dont want a graphical desktop to load on your PC
This is what you need to do for linux mint
sudo nano /etc/default/grub

change the line that reads "quiet splash" to "text"
save file
This lets you see all the boot messages scrolling by
then to final step to disable the gui boot
sudo systemctl set-default multi-user.target
reboot
if you need to get into the gui desktop for some reason
sudo systemctl start lightdm

Tags: linux.
Swap your home folder to a second drive
6th July 2024

I had a need to move a home folder to a second drive for more space
I found these instructions from Derek Taylor aka DistroTube on youtube

Move Your Home Folder To A Second Drive
By Derek Taylor at February 20, 2020

Make Reinstalling Faster By Having Home On A Second Drive
Note: You may want to drop into tty to perform the following to avoid any weird side effects from doing this within your graphical environment. Also, for this example we will assume that your partition is sdb1 (change this to the id of your drive!). Also, have a backup handy…just in case.

Mount the new partition to /tmp:

sudo mkdir /mnt/tmp
sudo mount /dev/sdb1 /mnt/tmp
Copy your HOME content to the second drive:

sudo rsync -avx /home/ /mnt/tmp
Mount our new HOME partition:

sudo mount /dev/sdb1 /home
If all your data seems to be present on the second drive and new partition, you may delete your old /home directory. To do this, you must first unmount the new /home partition!

sudo umount /home #unmount the new home first!
Then you may delete the original /home:

rm -rf /home/*
Now let’s make your new /home permanent. Get the UUID so we can add it to your fstab:

sudo blkid
Then edit the fstab:

sudo vim /etc/fstab #or nano if you prefer
Add this line at the end of the fstab:

UUID= /home ext4 defaults 0 2
Now reboot and see if it works!

sudo reboot
----------
Copyright © 2020-2021 Derek Taylor (DistroTube)

This content is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License (CC-BY-ND 4.0).

Tags: linux.

RSS feed

Created by Chronicle v4.6