I am a beginner user of emacs so please answer being aware of this.

I use dired to connect to a remote computer and navigate directories.

I sometimes want to go to a shell or terminal on the remote machine. If I type M-x term while in the dired buffer on the remote machine I get a terminal on my local machine not the directory I was viewing in dired. However if I type M-x shell instead (I have to give my remote shell path first) then the shell opens in the same directory I was viewing in dired.

So is it possible to have M-x term open in the current dired directory and furthermore is it possible to switch from shell mode to terminal mode or vice versa while maintaining the current directory? ALso can I set emacs to remember where the remote shell path is so I don't have to enter this?

  • Not super related, but have you tried using eshell?(unix.stackexchange.com/questions/104325/…) You can definitely set up emacs to remember your path. You could setq a variable to hold the path, and a shortcut to call the shell command you prefer. Commented Aug 9, 2018 at 19:07


Your Answer

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

Browse other questions tagged or ask your own question.