Linux - Aliases#

Ubuntu Workstation Configuration#

The Ubuntu workstation keeps Linux aliases in the tracked Scripts repository rather than duplicating them directly in .bashrc:

/home/marc/Scripts/Linux/Aliases/Linux-Aliases.bash

The local /home/marc/.bashrc sources this file. After pulling alias changes, reload the shell with:

source ~/.bashrc

The active workstation aliases are:

Alias or function Purpose
pulllab Safely force-aligns /home/marc/Obsidian/Homelab with origin/main.
pushlab Converts and publishes the Homelab vault to the remote Hugo VM, then backs up the vault to GitHub. Use pushlab --sync-only to skip remote publishing and vault backup.
gitstatus Reports Git repository status under /home/marc.
speed Runs the Linux disk benchmark against $HOME, or another directory selected with SPEED_TARGET_DIR.
pushscripts Commits and pushes Linux script and alias changes to GitHub.
pullscripts Pulls the latest Scripts repository changes from GitHub.

The MacOS aliases and scripts are not sourced or modified by this configuration.

Linux Script Locations#

/home/marc/Scripts/Linux/
├── Aliases/Linux-Aliases.bash
├── git_status.py
├── pull-obsidian-homelab.sh
├── speed_test.sh
└── sync-obsidian-homelab-hugo.sh

pushlab synchronizes the Notes/ directory and assets/icons/ directory. A root-level Images/ directory is optional and is skipped when absent. The Linux script supports both --sync-only and -s.

pulllab refuses to run while Linux Obsidian is open, requires the main branch, displays local changes, asks for confirmation, and then executes the destructive git reset --hard origin/main and git clean -fd alignment.

The Docker-specific aliases 1p and clean are not enabled on this workstation because Docker is not installed. They remain available in this note as reference material for Docker hosts.

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'
    
    # Synology Photos → UNAS-Pro (HP1GPU / HP1Docker)
    alias pushphotos='bash /mnt/Software/Software/Scripts/Linux/HP1_Synology_Photos_Push.sh'
    # -----------------------------
  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.

📋 Alias Descriptions & Prerequisites:#

  • ll / la / l: Standardised listing commands for quick directory navigation.
  • up / down: Shortcuts to run standard Docker Compose builds and stacks.
  • clean: Executes docker system prune --all --volumes to perform a complete cleanup of unused Docker caches and volumes.
  • 1p (Prerequisite: 1Password CLI installed & configured):
    • Automatically authenticates you to the 1Password CLI (op), then boots your Docker Compose stack while securely injecting environment keys defined in 1Password.
  • push / pushgen (Prerequisite: NAS mount /mnt/Software configured):
    • Executes the Hugo publishing scripts mirrored from the Mac Studio and automatically displays the live build logs.
  • pushphotos (HP1GPU and HP1Docker; prerequisite: /mnt/Software, /mnt/HP1Photos, and /mnt/Photos mounts configured):
    • Mirrors the read-only Synology mount /mnt/HP1Photos to the UNAS-Pro Photos mount /mnt/Photos, including deleting destination files that no longer exist on Synology.
    • Excludes Synology metadata, recycle-bin, snapshot, Syncthing, and connection-marker files, and omits directory timestamp updates for CIFS compatibility.
    • Sends a categorized email listing every copied, updated, and deleted file, in addition to retaining the full log on the executing host.
    • Prints each file operation live as COPY, UPDATE, or DELETE in the terminal.

On HP1GPU (10.1.2.231) and HP1Docker (10.1.2.202), pushphotos is installed system-wide in /etc/profile.d/homelab-aliases.sh. Open a new login shell, or run source /etc/profile.d/homelab-aliases.sh, before using it.