Skip to content

Inspection Tools

Adrian Thomas edited this page Oct 2, 2025 · 3 revisions

Inspection Tools

symlinkit 2.0 provides three powerful tools for analyzing and maintaining symbolic links: List, Broken, and Fix-Broken.


List Mode (--list)

Display all symlinks in a directory.

Usage

# List symlinks with directory prompt
symlinkit --list

# List symlinks in specific directory
symlinkit --list ~/

# List symlinks in current directory
symlinkit --list .

Output Format

/home/user/.bashrc -> /home/user/dotfiles/.bashrc
/home/user/.zshrc -> /home/user/dotfiles/.zshrc
/home/user/.config/nvim -> /home/user/dotfiles/nvim
  • Cyan text: Symlink path
  • Magenta text: Target path
  • Arrow (→): Visual separator

Example

$ symlinkit --list ~/
/home/user/.bashrc -> /home/user/dotfiles/.bashrc
/home/user/.vimrc -> /home/user/dotfiles/.vimrc
/home/user/bin/deploy -> /home/user/scripts/deploy.sh
Found 3 symlinks in /home/user

When to Use

  • Audit existing symlinks
  • Verify symlink setup
  • Document current configuration
  • Troubleshoot symlink issues

Broken Mode (--broken)

Find all broken symlinks (pointing to non-existent targets).

Usage

# Find broken symlinks with directory prompt
symlinkit --broken

# Find broken symlinks in specific directory
symlinkit --broken ~/

# Check current directory
symlinkit --broken .

Output Format

/home/user/.config/old-link -> /nonexistent/path (broken)

Example

$ symlinkit --broken ~/
/home/user/.config/deleted -> /home/user/old-file (broken)
/home/user/bin/old-script -> /tmp/removed.sh (broken)
Found 2 broken symlinks in /home/user

Success Case

$ symlinkit --broken ~/
You're good, no broken symlinks found in /home/user

When to Use

  • Regular maintenance checks
  • After reorganizing files
  • Before deleting directories
  • Troubleshooting missing files

Fix-Broken Mode (--fix-broken)

Interactively repair or remove broken symlinks.

Usage

# Fix broken symlinks with directory prompt
symlinkit --fix-broken

# Fix broken symlinks in specific directory
symlinkit --fix-broken ~/

# Preview changes first
symlinkit --dry-run --fix-broken ~/

Interactive Workflow

For each broken symlink found:

/home/user/.config/old-link -> /nonexistent/path (broken)
[d]elete / [a]ll delete / [u]pdate / [s]kip >

Options

  • d - Delete this broken symlink
  • a - Delete all remaining broken symlinks
  • u - Update symlink with new target path
  • s - Skip this symlink

Update Option Example

[d]elete / [a]ll delete / [u]pdate / [s]kip > u
Enter new target path:
/home/user/dotfiles/newfile.txt
✅ Updated: /home/user/.config/old-link -> /home/user/dotfiles/newfile.txt

Dry Run Mode

Preview what would be deleted without making changes:

$ symlinkit --dry-run --fix-broken ~/
/home/user/.config/deleted -> /old-path (broken)
[d]elete / [a]ll delete / [u]pdate / [s]kip > a
⚠️  Would delete (all): /home/user/.config/deleted
⚠️  Would delete (all): /home/user/bin/old-script
Dry run: no changes applied
Summary: 0 deleted, 0 updated, 0 skipped

Example Session

$ symlinkit --fix-broken ~/

/home/user/.config/deleted -> /old-file (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

When to Use

  • Clean up after file reorganization
  • Remove obsolete symlinks
  • Update symlinks to new locations
  • Maintain symlink integrity

Common Workflows

Regular Maintenance

# Check for broken symlinks
symlinkit --broken ~/

# If broken links found, fix them
symlinkit --fix-broken ~/

After Moving Files

# Find what broke
symlinkit --broken ~/dotfiles

# Update broken links
symlinkit --fix-broken ~/dotfiles

Audit All Symlinks

# List all symlinks
symlinkit --list ~/

# Check for broken ones
symlinkit --broken ~/

# Fix any issues
symlinkit --fix-broken ~/

Tips & Tricks

Check Before Deleting Directories

# See what symlinks point into this directory
symlinkit --list /old/directory

# Find broken links before removing directory
symlinkit --broken ~/

Preview All Changes

# Always use --dry-run for destructive operations
symlinkit --dry-run --fix-broken ~/

Combine with Grep

# Find symlinks to specific target
symlinkit --list ~/ | grep dotfiles

Permission Warnings

If symlinkit encounters directories it can't read:

⚠️  Could not scan all directories due to permissions. No symlinks found in accessible areas.

This is normal for system directories. Use sudo if you need to scan protected areas:

# Scan system directories (use with caution)
sudo symlinkit --list /

# Check system-wide broken symlinks
sudo symlinkit --broken /usr

Next Steps

Symlinkit Wiki Navigation

Getting Started

Features & Functionality

Development & Contributing

Clone this wiki locally