Skip to content

Instantly share code, notes, and snippets.

@david-shepard
Created October 10, 2025 21:15
Show Gist options
  • Select an option

  • Save david-shepard/5c61aa1e6e476e2954baeb6d1eb6d20a to your computer and use it in GitHub Desktop.

Select an option

Save david-shepard/5c61aa1e6e476e2954baeb6d1eb6d20a to your computer and use it in GitHub Desktop.
Simple SSH script using fzf
# 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