Skip to content

Instantly share code, notes, and snippets.

@moreta
Created May 21, 2012 06:57
Show Gist options
  • Save moreta/2760888 to your computer and use it in GitHub Desktop.
Save moreta/2760888 to your computer and use it in GitHub Desktop.
$HOME/.ssh/configに設定しているホストをリストアップ
$ cat known_ssh_hosts.sh
#!/bin/sh
# see : http://d.hatena.ne.jp/youhey/20110112/1294830362
SSH_CONFIG=$HOME/.ssh/config
echo "known hosts:"
if test -f $SSH_CONFIG; then
for i in `grep "^Host " $SSH_CONFIG | sed s/"^Host "// | grep -v "^\*$"`
do
echo " ssh ${i};"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment