Last active
February 26, 2025 11:27
-
-
Save Dazage/4e6c7fb87d7fc8321ce3b8bce9ae8d88 to your computer and use it in GitHub Desktop.
fuzzy find ssh host
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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