tags:

views:

205

answers:

3

Hello,

I normally connect to another server using the terminal using:

ssh [email protected]

However, I have been using emacs a lot now, and I am wondering if I can connect to a remote Red Hat server from within emacs?

Many thanks for any suggestions,

+8  A: 

Tramp mode is your friend. Install it, then use

C-x f RETURN /xx.xx.xx.xx.:~username/some/dir/somefile.txt

and the file will open in your local session. Emacs and Tramp will sync all updates due to your local editing back to the server.

Dirk Eddelbuettel
+1  A: 

If you're interested in running general shell commands and not just editing remote files, take a look at shell-mode. After starting it with M-x shell, you'll get a shell running in a buffer. You can interact with the shell input and output like you would text in any other buffer.

Within shell-mode, you'll be able to run ssh and connect to your remote server just as you would outside emacs.

ataylor
I prefer M-x term for ssh sessions since it allows you to run interactive shell commands like, ahum, vi, less etc. But as stated by Dirk "tramp mode is your friend".
remvee
+2  A: 

I'm a fan of ansi-term-mode (so M-x ansi-term) as a varient which provides a more usefull terminal emulation environment.

Tramp mode, as stated by Dirk is great for editing files, particularly if your connection is fast enough, but if you just need to toggle between a terminal and a buffer quickly, using ansi-term or term or shell all work fine. Particularly if your window manager doesn't support this toggling on a window manager level.

For a lot of things, I just have little bash scripts that I execute with (shell-command "/path/to/shell/script") and they use ssh conventionally. Seems to take care of a lot of the whole "deployment/rsync push" workflow.

tychoish