8 ms·
Another thing that's really nice about Eshell is that it has TRAMP integration. You can just `cat /ssh:remote:~/foo.log` and it will transparently spawn an SSH
by rekado 9y ago
Another thing that's really nice about Eshell is that it has TRAMP integration. You can just `cat /ssh:remote:~/foo.log` and it will transparently spawn an SSH session, run the command on the remote, and print the output.
It's a little like translators on the Hurd.
I don't use Eshell that much anymore (I got used to `M-x shell`), but it really is nice. The only drawback is that everything must go through Emacs buffers, so in some cases performance isn't great.
- throwaway91111 9y agoErr, i may be missing something, but you can do this with ssh anyway: ssh host cat foo.log
- mickeyp 9y agoThen here is a better example: $ find-file /ssh:foo@example.com:/opt/myfile.txt Emacs will open the remote file in a buffer local to your Emacs and you can edit it as though it were a local file. When you save it's saved remotely, etc.
- rekado 9y agoHey mickey, thanks for "Mastering Emacs"! I'm glad I bought it. I recommend it to everyone having trouble making themselves comfortable in Emacs.
- mickeyp 9y agoThank you very much :)
- bjpbakker 9y agoCompletely agree! It came out just after I decided to ditch vim and use emacs. This book has helped me a whole lot with understanding emacs. Thank you vey much for this book Mickey!
- throwanem 9y agoSeconded - I've been using Emacs exclusively since 2009, and still find something worthwhile every time I dip into Mastering Emacs.
- gkya 9y agoAlso when you C-x C-f /ssh:x@y.com:/a/directory, it opens in dired and all the dired operations happen on the remote computer, including visiting files w/ RET. Also, from within that dired buffer, typing M-x shell RET starts a remote shell session. Dired w/ dired-hacks package is my main tool for interacting w/ projects. Also, IIRC, VC mode works nicely w/ tramp too, when editing remote files.
- oblio 9y agoI guess the SSH functionality is provided by ssh itself, or is there some SSH client built in to Emacs?
- mickeyp 9y agoEmacs uses external programs; it supports a multitude of protocols give you this transparent file access.
- auganov 9y agoEven better example, if you do say: $ *npm install whatever in a remote directory, it will actually execute the real thing on the server. So as long as you don't need to use ncurses based program etc. it's a good-enough ssh too. Though quite honestly I much prefer to just start emacs on the server, make 4 eshell windows and have it be my fancy tmux/screen. It feels inelegant when you first do it, but it's very liberating actually.
- rekado 9y agoMaybe that was a poor example. You can use SSH paths like any other local file. cp /ssh:remote.net:~/foo ~/bar cd /ssh:remote.net:~ cat /ssh:remote.net:~/foo ~/bar /ssh:somewhere.org:~/whatever You can easily write your own eshell extensions and they will automatically work for remote and local files alike.
- look_lookatme 9y agoIt's kind of hard to explain how magical working with TRAMP can feel sometimes. If you are conditioned use emacs for everything, like git or project management or file management , these things will work on a remote server as if it were local (with the only caveat being delays as it transfers data). Depending on your setup, you could reasonably dev applications running on a Digital Ocean droplet as easily as if you were editing locally.
- krylon 9y ago> You can just `cat /ssh:remote:~/foo.log` and it will transparently spawn an SSH session, run the command on the remote, and print the output. This is one of the few things Windows does better than Unix, IMHO - transparent access to files on other computers (provided you have a login on that machine and the required permissions and so forth). On Unixoid systems, my main shell is zsh, but at work I have to use Windows, and there I use it a lot.
- rekado 9y agoThe Hurd does this the best in my opinion. It is really flexible and you can just install a translator on any file system node that you control. That translator could do pretty much anything: XML parsing to represent XML as a file tree, FTP listings, SSH access, etc.
- Alanna99 9y agoIm making over $7k a month working part time. I kept hearing other people tell me how much money they can make online so I decided to look into it. Well, it was all true and has totally changed my life. This is what I do, ====http://www.joinmate2.com http://www.joinmate2.com
- krylon 9y agoLinux and FreeBSD (and probably a couple of other systems I am too lazy to check up on right now) have FUSE, which allows a file system driver to run in user space. I think what FUSE allows one to do is similar, but one has to mount the "file system" first. There are some pretty clever drivers out there - I have seen one that took a directory tree of flac files and mounted it as a directory tree where all the flac files have been replaced by mp3 files; when you open one of the mp3 files, the driver performs the conversion transparently. There is one driver, I think, that transparently turns access to files into Google searches, so opening a file named "zebu" will give you a file of search results Google returned for that term. And I would guess there some even more ... special ones out there. But besides the trouble of mounting such a "file system" first, the OS kernel itself has no knowledge of what the driver does. It simply passes back and forth access requests and data (roughly speaking, I have never written one myself). On Windows, many functions in the Win32 API take a parameter that designates a host on which to perform the operation. So the operating system at kernel level has a notion that there are other Windows systems out there it can talk to over the network and send each other commands or data. On Unixoid systems, I sometimes miss this builtin network access which is automatically supported by all applications. OTOH, that opens a large can of worms, given the number of security issues that have come up over the years with Windows' SMB protocol or its RPC mechanism. So maybe the status quo is good. Now that I think of it, Microsoft's Powershell allows something like a translator. They are called Providers, I think. One can access the Windows registry a directory tree-like structure and add or delete values by creating or removing "files". I think it is extensible, too. I vaguely remember that it is possible to traverse the directory tree of a Windows domain.
- mappu 9y agoOn Linux this functionality is usually provided by GVFS or KIO. But if you have authenticated to a network resource under Dolphin (KIO), you can't necessarily edit a file using a GTK+-based editor - or even a Qt one that isn't KIO-aware. I think GVFS has the better design: falling back to symlinks is just less surprising for mixed applications (e.g. can't open a terminal on a KIO smb:// directory) even if you can't map everything perfectly to POSIX semantics.
- JetSpiegel 9y agoThat's just a FUSE implementation away.
- rekado 9y agoSee my comment here: https://news.ycombinator.com/item?id=14829920 https://news.ycombinator.com/item?id=14829920 FUSE may be sufficient for simple cases, but it is much less flexible than the Hurd or even the approximation that Emacs provides (e.g. directly browsing the contents of a remote tarball).