Created
October 10, 2025 21:15
-
-
Save david-shepard/5c61aa1e6e476e2954baeb6d1eb6d20a to your computer and use it in GitHub Desktop.
Simple SSH script using fzf
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
| # include this in ~/.bashrc or ~/.zshrc | |
| sshf () { | |
| local hosts | |
| hosts=$(grep -E '^Host ' ~/.ssh/config | awk '{print $2}' | grep -v '*' | grep -v '*$' | grep -v 'github') | |
| local selected_host | |
| selected_host=$(echo "$hosts" | fzf --height=50% --reverse --prompt="SSH into: ") | |
| if [ -n "$selected_host" ]; then | |
| ssh "$selected_host" | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment