Linux - Aliases

Linux - Aliases#

Quick Setup (Apply Aliases to Any Linux Machine):

  1. Open your bash configuration file:
    nano ~/.bashrc
  2. Append the following alias block to the bottom of the file:
    # --- Homelab Linux Aliases ---
    # System Listings
    alias ll='ls -alF'
    alias la='ls -A'
    alias l='ls -CF'
    
    # Docker & Docker Compose
    alias up='docker compose up'
    alias down='docker compose down'
    alias clean='docker system prune --all --volumes'
    
    # 1Password CLI Compose Integration
    alias 1p='op whoami >/dev/null 2>&1 || eval $(op signin); op run --env-file=".env" -- docker compose up'
    
    # Hugo Site Publishing (NAS-Mounted Scripts)
    alias push='bash /mnt/Software/Software/Scripts/Linux/publish-hugo-homelab.sh && tail -f /home/marc/hugo/homelab/logs/publish-hugo-homelab.log'
    alias pushgen='bash /mnt/Software/Software/Scripts/Linux/publish-hugo-gendash.sh && tail -f /home/marc/hugo/gendash/logs/publish-hugo-gendash.log'
    # -----------------------------
  3. Save, exit, and reload the configuration:
    source ~/.bashrc

1. Core Alias Reference#

These aliases are designed to standardise navigation, Docker compose stacks, and Hugo website publishing across Linux servers.

Scripts Management Standard

📜 Scripts Management Process#

Workstation Sync Shortcut: To automatically backup all your scripts and custom terminal aliases configuration (staging and pushing your entire ~/Scripts/ repository):

pushscripts

This will stage all modified files in ~/Scripts/, commit, and push updates directly to GitHub and your NAS (without running Homebrew operations).

Workstation Update Shortcut: To pull down the latest custom scripts and terminal aliases from GitHub on an existing machine (after the first-time setup is complete):

Scripts Management Migration Plan

Scripts Management Migration Plan#

This document is the master architectural migration plan for establishing /Users/marc/Scripts as your primary local master Git repository, linked to git@github.com:marcoue/Scripts.git, with automated mirroring to the UNAS-Pro NAS (/Volumes/Software/Software/Scripts/) and automated pull execution by remote TrueNAS/Linux/Proxmox nodes.


1. Executive Summary & Architecture Goal#

🎯 Primary Master Architecture#

  1. Master Repository: /Users/marc/Scripts on your Mac SSD is your primary master repository for editing, testing, running, and managing all homelab scripts.
  2. GitHub Remote: Linked to git@github.com:marcoue/Scripts.git on branch main.
  3. Automated NAS Mirroring: A Git post-commit hook automatically syncs committed scripts from ~/Scripts/ to /Volumes/Software/Software/Scripts/ on UNAS-Pro.
  4. Remote Server Pull Execution: Remote servers (HP1, HP2, HP3, HP7, HP8, Proxmox, Linux) pull their scripts from UNAS-Pro (Software/Scripts/) on their scheduled runs.

🔄 Data & Deployment Flow#

  [Mac Workstation] (Primary Master Workspace)
   └── ~/Scripts/ (git@github.com:marcoue/Scripts.git)
        ├── MacOS/
        ├── Linux/
        ├── Proxmox/
        └── TrueNAS/
             ├── (git commit)
        [Git post-commit Hook]
             ├── (rsync auto-mirror)
  [UNAS-Pro Master NAS] (Distribution Mirror)
   └── /Volumes/Software/Software/Scripts/
        ├── MacOS/
        ├── Linux/
        ├── Proxmox/
        └── TrueNAS/ (Exposed as Rsync Module: root@10.1.2.2::Software/Scripts/TrueNAS/)
             ├── (Rsync pull on schedule)
  [Remote Nodes: HP1, HP2, HP3, HP7, HP8, Proxmox, Linux]
   └── Local Execution of Version-Controlled Scripts

📂 1.1 Filesystem Standard & Disaster Recovery Protocol#

  1. Standard POSIX Filesystem Path:
    • The destination path /Volumes/Software/Software/Scripts/ (and subfolders MacOS/, Linux/, Proxmox/, TrueNAS/) is a standard, plain-text directory tree residing on the mounted Software SMB share (smb://10.1.2.2/Software). There are zero proprietary databases, hidden hooks, or custom file structures on the NAS.
  2. Mac Auto-Mount Convenience (Login Items):
    • To ensure the SMB share is always available for Git post-commit auto-mirroring, add /Volumes/Software to macOS System Settings > General > Login Items.
  3. macOS Reinstall / Disaster Recovery:
    • Reinstalling or replacing macOS on your Mac Studio has zero effect on UNAS-Pro or TrueNAS servers. The NAS files remain intact, and TrueNAS backup cron jobs continue executing without interruption.
    • To restore your Mac workstation repo after a fresh macOS install:
      # Step 1: Clone master repository from GitHub
      git clone git@github.com:marcoue/Scripts.git ~/Scripts
      
      # Step 2: Re-install 1-line Git post-commit auto-mirror hook
      cat << 'EOF' > ~/Scripts/.git/hooks/post-commit
      #!/usr/bin/env bash
      if [ -d "/Volumes/Software/Software/Scripts" ]; then
          rsync -av --delete --exclude='.git' --exclude='*.log' /Users/marc/Scripts/ /Volumes/Software/Software/Scripts/
      fi
      EOF
      chmod +x ~/Scripts/.git/hooks/post-commit

2. Complete Script Inventory & Mapping#

The following table lists all existing scripts found across your NAS repository (git@github.com:marcoue/Scripts.git) and local Mac folder (~/Scripts/), mapped to their final category subfolders:

Linux - Unattended-Upgrades

Unattended-Upgrades Configuration (VM & LXC)#

Not Used, as a reference only

The objective of this guide is to safely automate software updates across a high-density environment of virtual machines and LXC containers, significantly reducing daily manual maintenance without compromising infrastructure stability. By shifting from a manual execution model to a structured deployment using the native unattended-upgrades utility, the system handles the download, installation, and post-update cleanup of all packages automatically in the background. Rather than allowing unpredictable automated reboots that could disrupt active services or interfere with critical backup windows, this configuration enforces a strict “notify-only” baseline. It leverage a lightweight mail client to alert the administrator immediately when a reboot is pending, combining hands-free patching with complete operational control.

Proxmox - Initial Setup

Proxmox Initial Install & Provisioning#

This guide contains the steps performed immediately after installing Proxmox VE. These steps are designed to be integrated into the ultimate_master_restore.sh script.


1 System Maintenance#

1.1 Update System (Included in Restore script)#

apt update && apt full-upgrade -y
apt autoremove && apt autoclean

2 SSH Configuration#

2.1 Configure SSH Public Key (Included in Restore script)#

Edit authorized keys:

nano ~/.ssh/authorized_keys

Paste SSH keys for [1Password Private note](https://start.1password.com/open/i?a=G7ECSBBRRFHWPDIM7F7J6TWP7I&v=4bxn4d3worhhq7rc6m3usjciia&i=6hoe6ndejfr5evqpatwk2xsatq&h=my.1password.com)

Restart SSH:

Hugo Setup on Ubuntu

1. Install Latest Hugo Extended (Ubuntu amd64)#

Use this script to automatically fetch and install the latest .deb package from GitHub.

#!/usr/bin/env bash

echo "Installing latest Hugo Extended..."

ARCH=$(dpkg --print-architecture)

if [ "$ARCH" != "amd64" ]; then
  echo "This script currently supports amd64 only."
  echo "Detected architecture: $ARCH"
  exit 1
fi

echo "Fetching latest version..."
LATEST=$(curl -s [https://api.github.com/repos/gohugoio/hugo/releases/latest](https://api.github.com/repos/gohugoio/hugo/releases/latest) \
  | grep '"tag_name":' \
  | sed -E 's/.*"v([^"]+)".*/\1/')

if [ -z "$LATEST" ]; then
  echo "Failed to fetch latest version."
  exit 1
fi

echo "Latest version: $LATEST"
FILE="hugo_extended_${LATEST}_linux-amd64.deb"
URL="[https://github.com/gohugoio/hugo/releases/download/v$](https://github.com/gohugoio/hugo/releases/download/v$){LATEST}/${FILE}"

echo "Downloading $FILE..."
wget -q --show-progress "$URL"

if [ ! -f "$FILE" ]; then
  echo "Download failed."
  exit 1
fi

echo "Installing package..."
sudo dpkg -i "$FILE"
sudo apt-get -f install -y

echo "Cleaning up..."
rm -f "$FILE"

echo ""
echo "Installed Hugo version:"
hugo version

echo ""
echo "Done."

2. Install Blowfish Theme#

Commands to initialize your project (e.g., canada2argentina) and install the Blowfish theme as a submodule.

Linux

Linux Initial Setup Guide#


1. Initial System Setup#

Timezone & Updates#

timedatectl set-timezone America/Toronto
apt update && apt full-upgrade -y

Warpification (Terminal UI)#

echo -e '\n# Auto-Warpify\nprintf '\''\eP$f{"hook": "SourcedRcFileForWarp", "value": { "shell": "bash", "uname": "'$(uname)'" }}\x9c'\'' ' >> ~/.bashrc

Essential Package Installation#

For Virtual Machines (Full Suite):

apt install gdebi curl sudo gpg ethtool ngrep lshw lsscsi cifs-utils ncdu etherwake lshw sudo tasksel fail2ban openssh-server qemu-guest-agent unzip smbclient fio iperf3 nmap net-tools apt-transport-https software-properties-common wget duf tldr zip git eza snapd samba glances -y

For LXC Containers (Lightweight):

Linux - Various Command Lines

Linux & Proxmox Command Line Toolbox#


1. Storage & Disk Management#

Clean Up & Space Recovery#

# Purge unused packages and clean cache
apt autoremove --purge && apt autoclean
# Reclaim journal log space (limit to 500MB)
journalctl --vacuum-size=500M

Identify Large Files & Folders#

# List all files with human-readable sizes
ls -lah
# Summary of folder sizes in current directory
du -sh *
# Identify top 10 largest folders on root
sudo du -xh / | sort -rh | head -n 10
# Disk space usage summary (filtered for MB/GB)
du -cha --max-depth=1 / | grep -E "M|G"

Hugo Project Specifics (Size Checks)#

# Find files larger than 25MB in project
find /home/marc/hugo/canada2argentina -type f -size +25M -exec ls -lh {} +
# Count total files in the public build folder
find /home/marc/hugo/canada2argentina/public -type f | wc -l
# List top 25 largest files in project
find /home/marc/hugo/canada2argentina -type f -exec du -h {} + | sort -rh | head -n 25

Disk Health & Partitions#

# Wipe all partitions/signatures from a disk (CAUTION)
sgdisk --zap-all /dev/sdX
# Detailed SMART health report
smartctl -a /dev/sda | less
# Deep scan for bad blocks (Takes a long time)
badblocks -v /dev/sda -s

2. Proxmox & Virtualization#

VM / Container Management#

# Unlock a stuck VM or Container
qm unlock <vmid>
pct unlock <ctid>
# Resize a container disk (Final size, cannot shrink)
pct resize 103 rootfs 16G
# List running LXC containers
pct list | awk 'NR>1'

High Availability (HA) Fixes#

# Disable HA for a specific VM/CT to allow manual fixes
ha-manager set vm:200 --state disabled
ha-manager set ct:103 --state disabled

Repository & Templates#

# Update and list available CT templates
pveam update
pveam available
# List all active apt sources
grep -r '' /etc/apt/sources.list*

Proxmox Boot & Kernel#

# List and pin a specific kernel
proxmox-boot-tool kernel list
proxmox-boot-tool kernel pin 6.8.8-4-pve

3. Networking & Connectivity#

Troubleshooting & Discovery#

# Check DNS resolution
nslookup google.com
nslookup pi.hole
# Check open listening ports
ss -lntu
netstat -plant
# Performance test (Client mode, 8 parallel streams)
iperf3 -c 10.1.1.11 -P8

SSH & Remote Access#

# View real-time system logs for USB/Kernel errors
dmesg -w
dmesg -T | grep usb
# Clear "Remote Host Identification Changed" error
nano ~/.ssh/known_hosts

File Transfers (SCP)#

# Copy local images from Mac to Hugo site on Server
scp -v /Users/marc/Downloads/to_convert/* root@10.1.2.202:/home/marc/hugo/canada2argentina/static/images/
# Backup and transfer a folder between servers
tar -czvf "$(date +%Y-%m-%d_%Hh%M)_PangolinBackup.tar.gz" pangolin/
scp pangolin.tar.gz root@72.11.147.220:/home/marc/docker-compose

4. System & Hardware Info#

RAM & CPU#

# Clear RAM cache (Drop caches)
sync && echo 3 | tee /proc/sys/vm/drop_caches
# Check ZFS ARC summary and free RAM
arc_summary -s arc && free -h

BIOS & Hardware#

# Get BIOS version and serial info
sudo dmidecode -t bios
# List SCSI and PCIe hardware
lsscsi -u
lspci

Legacy iLO3 Fix (Firefox)#

  1. Type about:config in address bar.
  2. Search: security.tls.version.enable-deprecated.
  3. Set to: true.

5. Miscellaneous Utilities#

Permissions & Scripts#

# Make script executable and run
chmod +x ./unifi-9.0.114.sh && ./unifi-9.0.114.sh

Scheduling & Processes#

# Instant test of cron behavior (Sends message to all terminals)
* * * * * echo "Hello from cron" | wall
# Cancel a pending shutdown
shutdown -c
# Print the path of the folder you are in
pwd

Linux Desktop Configuration Guide

Linux Desktop Configuration Guide#


1. Initial System & User Setup#

Privilege Escalation#

# Add user to sudo group
sudo usermod -aG sudo marc
# Activate root account
sudo passwd root

Essential UI Software#

# File Browsers (Dolphin is recommended)
sudo apt install dolphin krusader konqueror -y
# Partition Manager
sudo apt install gparted -y
# Synaptic & GDebi
sudo apt install synaptic gdebi -y

2. Repositories & Package Management#

Enable Non-Free & Backports#

  1. Open the Software app > Top Right Corner > Software Repositories.
  2. Enable Non-Free and Contrib.

Configure Backports Manually:

Ollama & Stable Diffusion AI Guide

Ollama & Stable Diffusion AI Guide#

1 HP1GPU - Docker (Ollama Model Inventory)#

1.1 llama3.2:latest (2.0 GB)#

  • Consuming VM: HP1Docker
  • Services:
    • karakeep (Docker)
    • paperless (Docker)
    • [n8n](n8n.md) (Docker)

1.2 qwen3-vl:8b (6.1 GB)#

  • Consuming VM: HP1Docker
    • Service: paperless-ai (Docker)

1.3 gemma3:12b (8.1 GB)#

  • Consuming VM: HP1GPU
  • Service:
    • open-webui (Docker)

1.4 llama3.2-vision:latest (7.8 GB)#

  • Consuming VM: HP1Docker
  • Service:
    • paperless Inactive (Commented out in compose)

1.5 qwen2.5vl:3b (3.2 GB)#

  • Consuming VM: HP1Docker
  • Service: paperless (Testing)
  • Status: Inactive (Commented out in compose)

1.6 glm-ocr:latest (2.2 GB)#

1.7 gemma4::e4b (9.6 GB)#

1.8 nomic-embed-text:latest (274 MB)#

  • Service: Internal Embeddings / RAG
  • Status: Active (Implicit)

2 Ollama Installation & Network Setup#

2.1 Basic Installation#

# Open firewall port
ufw allow 11434/tcp
# Official Install Script
curl -fsSL [https://ollama.com/install.sh](https://ollama.com/install.sh) | sh

2.2 Enable Local Network Access#

To allow other devices to use the AI, you must change the bind address from 127.0.0.1 to 0.0.0.0.