put this in your .zshrc and smoke it. function known_host_remove() { sed -i .bak "$1 d" ~/.ssh/known_hosts }