Created
July 9, 2018 16:40
-
-
Save innocuo/03bac97e181df280bfd2446efea309e3 to your computer and use it in GitHub Desktop.
Add this to .bash_profile to list all hosts from your .ssh/config file
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
#list all hosts in .ssh/config | |
#if you add an argument, it lists all hosts that contain that word | |
whatssh(){ | |
if [[ $# -eq 0 ]]; then | |
grep -w -i "Host" ~/.ssh/config | sed 's/[Hh]ost//' | |
else | |
grep -i "^Host\s\+.*$1.*$" ~/.ssh/config | sed 's/[Hh]ost//' | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment