Repository navigation
Usage Examples
Adrian Thomas edited this page Oct 2, 2025
·
6 revisions
Comprehensive examples of symlinkit 2.0 across different scenarios and workflows.
# Link a config file
symlinkit -c ~/dotfiles/.bashrc ~/.bashrc
# Link a directory
symlinkit -c ~/dotfiles/nvim ~/.config/nvim
# Preview first
symlinkit --dry-run -c ~/dotfiles/.zshrc ~/.zshrc# Replace existing file with symlink
symlinkit -o ~/dotfiles/.vimrc ~/.vimrc
# Replace directory
symlinkit -o ~/dotfiles/scripts ~/bin
# Always preview first!
symlinkit --dry-run -o ~/source ~/dest# Merge dotfiles into home config
symlinkit -m ~/dotfiles/.config ~/.config
# Merge scripts into bin
symlinkit -m ~/dotfiles/scripts ~/bin
# Preview all changes
symlinkit --dry-run -m ~/dotfiles ~/.config# Delete single symlink
symlinkit -d ~/.config/nvim
# Delete all symlinks in directory
symlinkit -dr ~/bin
# Preview deletions
symlinkit --dry-run -d ~/.bashrc# These are equivalent
symlinkit -cr ~/dotfiles ~/.config
symlinkit -m ~/dotfiles ~/.config# Overwrite recursively with prompts
symlinkit -or ~/dotfiles/configs ~/.config
# For each conflict, you'll be prompted:
# [s]kip / [o]verwrite / [a]ll overwrite / [c]ancel ># Delete all symlinks in directory
symlinkit -dr ~/old-links
# Interactive prompts for each symlink:
# [d]elete / [a]ll delete / [s]kip / [q]uit ># Link shell configs
symlinkit -o ~/dotfiles/.bashrc ~/.bashrc
symlinkit -o ~/dotfiles/.zshrc ~/.zshrc
symlinkit -o ~/dotfiles/.vimrc ~/.vimrc
# Link config directories
symlinkit -m ~/dotfiles/.config ~/.config# Start with preview
symlinkit --dry-run -m ~/dotfiles/.config ~/.config
# Review output, then apply
symlinkit -m ~/dotfiles/.config ~/.config
# Handle conflicts interactively
# [s]kip / [o]verwrite / [a]ll overwrite / [c]ancel >#!/bin/bash
# dotfiles-setup.sh
DOTFILES="$HOME/dotfiles"
# Link shell configs
symlinkit -o "$DOTFILES/.bashrc" "$HOME/.bashrc"
symlinkit -o "$DOTFILES/.zshrc" "$HOME/.zshrc"
# Link git config
symlinkit -o "$DOTFILES/.gitconfig" "$HOME/.gitconfig"
# Merge config directory
symlinkit -m "$DOTFILES/.config" "$HOME/.config"
# Link scripts
symlinkit -m "$DOTFILES/scripts" "$HOME/bin"# List all symlinks in home directory
symlinkit --list ~/
# List symlinks in system directory
sudo symlinkit --list /usr/local/bin
# Pipe to file for documentation
symlinkit --list ~/ > symlink-audit.txt# Check home directory
symlinkit --broken ~/
# Check system-wide
sudo symlinkit --broken /
# Check specific directory
symlinkit --broken /usr/local/bin#!/bin/bash
# symlink-maintenance.sh
echo "=== Symlink Maintenance ==="
# Find broken links
echo "Checking for broken symlinks..."
symlinkit --broken ~/
# If broken links found, fix them
read -p "Fix broken symlinks? [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
symlinkit --fix-broken ~/
fi
echo "Maintenance complete."# Link scripts to local bin
symlinkit -m ~/projects/my-app/bin ~/bin
# Preview first
symlinkit --dry-run -m ~/projects/my-app/bin ~/bin# Link shared configs across projects
symlinkit -o ~/shared-configs/eslintrc.js ~/project1/.eslintrc.js
symlinkit -o ~/shared-configs/eslintrc.js ~/project2/.eslintrc.js
symlinkit -o ~/shared-configs/eslintrc.js ~/project3/.eslintrc.js#!/bin/bash
# dev-env-setup.sh
PROJECT="$HOME/projects/my-app"
# Link config files
symlinkit -o "$PROJECT/configs/.eslintrc.js" "$PROJECT/.eslintrc.js"
symlinkit -o "$PROJECT/configs/.prettierrc" "$PROJECT/.prettierrc"
# Link scripts
symlinkit -m "$PROJECT/scripts" "$HOME/bin"
echo "Development environment ready!"# Step 1: List all symlinks
symlinkit --list ~/
# Step 2: Check for broken links
symlinkit --broken ~/
# Step 3: Fix broken links if found
symlinkit --fix-broken ~/$ symlinkit --fix-broken ~/
/home/user/.config/deleted -> /old-path (broken)
[d]elete / [a]ll delete / [u]pdate / [s]kip > d
❌ Deleted: /home/user/.config/deleted
/home/user/bin/old-script -> /tmp/removed.sh (broken)
[d]elete / [a]ll delete / [u]pdate / [s]kip > u
Enter new target path:
/home/user/scripts/deploy.sh
✅ Updated: /home/user/bin/old-script -> /home/user/scripts/deploy.sh
Summary: 1 deleted, 1 updated, 0 skipped# BAD: Direct overwrite
symlinkit -o ~/dotfiles/.vimrc ~/.vimrc # RISKY!
# GOOD: Preview then apply
symlinkit --dry-run -o ~/dotfiles/.vimrc ~/.vimrc
# Review output...
symlinkit -o ~/dotfiles/.vimrc ~/.vimrc# Test in temp directory first
mkdir /tmp/test-symlinks
symlinkit -m ~/dotfiles/test /tmp/test-symlinks
# Verify it works
ls -la /tmp/test-symlinks
# Apply to real location
symlinkit -m ~/dotfiles/configs ~/.config
# Clean up test
rm -rf /tmp/test-symlinksBefore:
~/.bashrc (regular file)
~/.vimrc (regular file)
~/.config/nvim/ (regular directory)
Steps:
# 1. Backup current configs
cp ~/.bashrc ~/backup/.bashrc
cp ~/.vimrc ~/backup/.vimrc
cp -r ~/.config/nvim ~/backup/nvim
# 2. Move configs to dotfiles repo
mv ~/.bashrc ~/dotfiles/.bashrc
mv ~/.vimrc ~/dotfiles/.vimrc
mv ~/.config/nvim ~/dotfiles/nvim
# 3. Create symlinks
symlinkit -o ~/dotfiles/.bashrc ~/.bashrc
symlinkit -o ~/dotfiles/.vimrc ~/.vimrc
symlinkit -o ~/dotfiles/nvim ~/.config/nvim
# 4. Verify
symlinkit --list ~/After:
~/.bashrc -> ~/dotfiles/.bashrc
~/.vimrc -> ~/dotfiles/.vimrc
~/.config/nvim -> ~/dotfiles/nvim
#!/bin/bash
# install-dotfiles.sh
set -e
DOTFILES="$HOME/dotfiles"
echo "Installing dotfiles..."
# Clone dotfiles repo
if [[ ! -d "$DOTFILES" ]]; then
git clone https://github.com/username/dotfiles.git "$DOTFILES"
fi
# Link configs
symlinkit -o "$DOTFILES/.bashrc" "$HOME/.bashrc"
symlinkit -o "$DOTFILES/.zshrc" "$HOME/.zshrc"
symlinkit -o "$DOTFILES/.gitconfig" "$HOME/.gitconfig"
# Merge config directory
symlinkit -m "$DOTFILES/.config" "$HOME/.config"
echo "✅ Dotfiles installed successfully!"#!/bin/bash
# cleanup-symlinks.sh
DIR="${1:-$HOME}"
echo "Checking for broken symlinks in $DIR..."
symlinkit --broken "$DIR"
read -p "Remove all broken symlinks? [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Use --fix-broken with 'a' for delete all
echo "a" | symlinkit --fix-broken "$DIR"
echo "✅ Cleanup complete!"
else
echo "Cancelled."
fi# Ensure coreutils is installed
brew install coreutils
# Link Application Support configs
symlinkit -m ~/dotfiles/Library/Application\ Support ~/Library/Application\ Support
# Link LaunchAgents
symlinkit -o ~/dotfiles/LaunchAgents/com.example.plist ~/Library/LaunchAgents/# Link systemd user services
symlinkit -m ~/dotfiles/systemd ~/.config/systemd/user
# Link desktop entries
symlinkit -m ~/dotfiles/applications ~/.local/share/applications# Link Windows configs (if needed)
symlinkit -o ~/dotfiles/.wslconfig /mnt/c/Users/username/.wslconfig
# Link standard Linux configs
symlinkit -m ~/dotfiles/.config ~/.configsymlinkit -o ~/dotfiles/.bashrc ~/.bashrcsymlinkit -m ~/dotfiles/.config ~/.configsymlinkit -o ~/dotfiles/nvim ~/.config/nvimsymlinkit -m ~/dotfiles/scripts ~/binsymlinkit -dr ~/old-links# Error: destination already exists
# Solution: Use overwrite mode
symlinkit -o ~/source ~/dest
# Or: Delete existing first, then create
rm -rf ~/dest
symlinkit -c ~/source ~/dest# Error: Permission denied
# Solution: Use sudo (with caution!)
sudo symlinkit -o ~/source /etc/config# Find what broke
symlinkit --broken ~/
# Fix interactively
symlinkit --fix-broken ~/- Symlink Modes - Detailed explanation of each operation
- Inspection Tools - Using list, broken, and fix-broken
- API Reference - Complete flag reference
Symlinkit Wiki Navigation
Getting Started
Features & Functionality
Development & Contributing