Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When SSHing to a remote server Eshell doesn't behave very well, e.g:

M-x eshell
ssh server
<tab> *inserts literal tab instead of trying to complete*

Hitting <tab>, for instance, inserts a literal tab. Is there no way to get tab completion, lisp interaction (like find-file blah) etc. over SSH? All the documentation I've read says Eshell is "TRAMP-aware", which I assume meant it could deal with this.

Am I just wrong in my assumption that it would work over SSH, or is something broken?

This is on Emacs 24.0.94 pretest.

share|improve this question
    
Does it help if you do ssh -t -t server? The double -t option forces ssh to allocate a pseudo-terminal even though it isn't running on a tty. –  Fran May 14 '12 at 16:41

1 Answer 1

SSH is actually integrated into Eshell using Tramp-mode, so instead of running the "ssh" command you use cd with a special pathname:

~ $ cd /ssh:user@host.com:~
/ssh:user@host.com:/home/user $ 

Then you should have tab-completion for commands and filenames on the remote server. Tab completion can be laggy though depending on how many alternatives it has to look up remotely and transfer over the network.

If your muscle memory betrays you and you keep typing "ssh", you might want to define an alias in eshell (this will automatically get saved to ~/.emacs.d/eshell/alias)

$ alias ssh 'cd /ssh:$1:~'

Also of note, when Eshell is on a remote server and you hit C-x C-f it will complete filenames on the remote server. They will be automatically loaded into a local buffer and written back over SCP. You can do that without Eshell, too, it's a feature of tramp-mode.

share|improve this answer
    
This works as you describe, but if I do cd /ssh:user@host.com:~ followed by cd / I end up back in my local root directory, presumably because I'm using eshell's cd. However, *cd gives the error cd: external command not found. Do you know of a way to get tab completion AND proper command behaviour, or is eshell the wrong tool for this? –  Gordon Gustafson May 27 at 3:08
    
This solved my problem: C-x C-f user@host.com:~, M-x shell. It's not eshell, but it does give proper cd and tab completion. –  Gordon Gustafson May 27 at 21:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.