I start a tramp dired session to a remote host with C-x d /ssh:user@host:/ and then start eshell with M-x eshell.

This places me at the dired path on the remote host, however as soon as I try to cd or get path autocompletion my session then changes to my localhost.

Is this the intended functionality? How can I make eshell remain on the remote host?

1 Answer 1


When you apply cd in eshell, it uses the Lisp function eshell/cd. All file names that you give are therefore interpreted like file names in Emacs. Absolute file names, without the remote prefix, correspond to the local file system, therefore.

If you want to navigate on the remote host, use relative file names like cd ../foo. You could use even file name completion in eshell, like cd ../ <TAB>.

  • That works, thanks. It's certainly far from intuitive though. What would be your recommended method for remote shells in Emacs?
    – retrodev
    Commented May 3, 2016 at 13:33
  • Personally, I don't use remote shells. No recommendation therefore. Under the hood, all of them use ssh for connection. Commented May 4, 2016 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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