Is there a way to use the emacs installed my local computer to access remote files I have in a remote server? I have googled and found out that I should use TrampMode however it is necessary for me to know the exact file path. Isn't there a way for me to open an ssh connection to the remote server and from there open the files with the local emacs in my computer?
There are various ways to do this, but in generally you are going about this problem backwards. Copy your emacs configs to the remote machine and use emacs local to the files you are editing.
The "various ways to do this" would fall into two categories. First would be ways of mounting a remote drive locally through something like sshfs, some fuse file system, samba, nfs, or any number of other mounting systems to bring file level access to your machine. Second would be various programs that allow you to login and browse a remote system, then operate on files by transferring a copy of them to a local temp file, editing it, then transferring it back. Several programs make that process look pretty seamless, but it's a hack.
Or you can open emacs, run eshell, then cd to the remote machine, like:
Now, run shell commands, navigate to the file you want and open it:
I do think that Tramp is what you are looking for. You can use Dired mode to browse the remote directories and look for the file you want.
For example, if I'm looking for some file in
/etc/ on a remote machine
rem, I'd do the following:
- Open emacs
- remove the path already present
/rem:/etc/and hit enter.
You'll get an output like this:
/ssh:rem:/etc: total 1460 drwxr-xr-x 141 root root 12288 Aug 12 06:46 . drwxr-xr-x 23 root root 4096 Jul 18 23:48 .. drwx------ 6 root root 4096 Nov 17 2009 .bzr -rw------- 1 root root 749 Jul 18 23:30 .bzrignore -rwx------ 1 root root 10015 Aug 12 09:17 .etckeeper drwxr-xr-x 3 root root 4096 Aug 6 00:47 .java -rw------- 1 root root 0 Nov 17 2009 .pwd.lock
Then you can use e.g. the arrow keys to find the file you wanted to edit. Hit enter when the cursor is on the file to edit it.