The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

ssh prompt like Xmonad.Prompt.Ssh

asked Apr 1 '14

yhager gravatar image

Is there a way to implement an ssh prompt, similar to Xmonad.Prompt.Ssh (sorry can't post a link)?

The way it works in Xmonad, is that when you press the key binding, you get a prompt, like dmenu, in which you type in a name of a host, and when you press <enter> you get a terminal with ssh to that host.

Very useful when working a lot with remote machines, saves the trouble of openning a shell and calling 'ssh <host>'

I guess one could come up with a script that parses .ssh/config, and calls dmenu on it, but I'm wondering if there's already something like that out there

2 answers

Sort by » oldest newest most voted
2

answered Apr 1 '14

joepd gravatar image

Wrap something like this with a keybind, that should do the trick:

urxvt -e ssh $(awk '{print $1}' ~/.ssh/known_hosts | dmenu -i -nb black -nf red -sb red -sf black -l 12)

Comments

perfect, thanks!

yhager gravatar imageyhager (Apr 1 '14)edit
0

answered Sep 28 '15

yhager gravatar image

I now mostly use .ssh/config, so the following is a better option now:

 bindsym $mod+c exec "urxvt -e ssh $(grep -i ^host ~/.ssh/config|grep -v '\*' |cut -d' ' -f 2-|sed 's/ /\n/g'|sort|uniq |grep -v '^$' | dmenu -i -nb black -nf red -sf black -sb red -l 12)"

Question Tools

1 follower

Stats

Asked: Apr 1 '14

Seen: 239 times

Last updated: Sep 28