Skip to content

Instantly share code, notes, and snippets.

@Dazage
Last active February 26, 2025 11:27
Show Gist options
  • Save Dazage/4e6c7fb87d7fc8321ce3b8bce9ae8d88 to your computer and use it in GitHub Desktop.
Save Dazage/4e6c7fb87d7fc8321ce3b8bce9ae8d88 to your computer and use it in GitHub Desktop.
fuzzy find ssh host
#!/usr/bin/env bash
# Generate list from ~/.ssh/config
list=$(grep -i "^Host " ~/.ssh/config | awk '{print $2}' | sort -u)
target=$(echo "$list" | fzf --prompt="Select a host: ")
if [[ -n $target ]]; then
echo "Connecting to $target..."
ssh "$target"
else
echo "No host selected."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment