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.

Mac OS - Aliases Management

Mac OS - Aliases Management#

Quick Restore (Workstation Rebuild):

  1. Clone your scripts: git clone git@github.com:marcoue/Scripts.git ~/Scripts
  2. Run the restore script: source ~/Scripts/MacOS/Aliases/MacOS_Aliases_restore.sh
  3. Retrieve local secrets from your 1Password Homelab Vault under the entry Mac OS .zshrc file and copy them into your local ~/.zshrc (Edit using: nano ~/.zshrc).
  4. Refresh your shell configuration to apply the new tokens: source ~/.zshrc.

Related Recovery Guides: Master Checklist: Mac OS - Recovery | Packages Sync: Mac OS - Brewfile | Repository Standard: Scripts Mangement.

Mac OS - Brewfile

Mac OS - Brewfile#

Daily Sync Shortcuts (Keep Computers Mirrored):

  • Run pushbrew on the machine where you just installed/removed software to scan your system, update the Brewfile, and push it to GitHub.
  • Run pullbrew on your other workstations to pull the update and automatically install/clean up your packages to match.

Quick Restore & Sync (Workstation Rebuild):

  • To Restore (New Computer):
    1. Install Homebrew (if missing): /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    2. Clone scripts: git clone git@github.com:marcoue/Scripts.git ~/Scripts
    3. Reinstall all software: brew bundle --file=~/Scripts/MacOS/Brew/Brewfile
  • To Sync Updates (Ongoing):
    • Pull latest and clean up local packages: pullbrew

Related Recovery Guides: Master Checklist: Mac OS - Recovery | Shortcut Configuration: Mac OS - Aliases Management | Repository Standard: Scripts Mangement.

Mac OS - Recovery

Mac OS - Recovery#


1. Pre-Crash Backup Checklist (Do This Now)#

Ensure these configurations are regularly backed up or pushed to GitHub to prevent data loss.

  • 1.1 Setup Brewfile Versioning: Dump, commit, and push your system package lists.
  • 1.2 Sync Packages & Scripts: Track changes to package lists using pushbrew and script/alias updates using pushscripts.
    • Details: Completed. Use pushbrew for package list updates and pushscripts for codebase updates. See Mac OS - Brewfile.
  • 1.3 Automate MCP Config Pushes: Update the mcp alias to push local configuration commits.
    • Details: Completed. mcp alias now auto-commits and pushes local changes to GitHub (MCP-Config-MacOS).
  • 1.4 Version-Control Custom Aliases: Migrate custom shortcuts out of local configurations.
  • 1.5 Double Check Git Hook Backups: Save a copy of your Git hooks.
    • Details: Completed. The mirror hook is backed up at ~/Scripts/MacOS/post-commit-hook.sh.

2. Workstation Rebuild Checklist (In Case of Crash)#

Follow these steps in order to restore the Mac Studio environment on a fresh macOS installation.

MacOS System Administration & Optimization

macOS System Administration & Optimization#

Workstation Recovery & Rebuild Standard: If you need to rebuild your Mac Studio or synchronize its software and aliases with another Mac, refer to the master checklist at Mac OS - Recovery.


1 Modify Known Hosts#

# Add description
nano ~/.ssh/known_hosts
# To remove a specific host
ssh-keygen -R 10.1.1.14
# Clear the full file
cat /dev/null > ~/.ssh/known_hosts

2 Disk Management & Diagnostics#

2.1 Identify and Verify Disks#

# List all physical and virtual disks
diskutil list
# Verify a specific disk (replace X with disk number)
diskutil verifyDisk /dev/diskX

2.2 SMART Monitoring (via Homebrew)#

# Install smartmontools
brew install smartmontools
# Check health of the primary NVMe drive
smartctl -a /dev/disk0

3 Homebrew Package Manager#

Official site: brew.sh