title | date | tags | |||
---|---|---|---|---|---|
Filtering SSH Host with peco |
2019-08-06 18:00:00 +0900 |
|
Filtering Host from ~/.ssh/config
using peco
, and execute SSH.
You need to install peco.
brew install peco
And define function like this:
# .bashrc or somewhere
function peco-ssh() {
local host=$(grep -iE '^host[[:space:]]+[^*]' $HOME/.ssh/config | sort | peco | awk '{print $2}')
if [[ $host ]]; then
echo "ssh $host"
ssh $host
fi
}
Then call it!