Hacker News new | ask | show | jobs
by ovrdrv3 2969 days ago
> Get familiar with a command line text editor (vim, Emacs, nano, …).

Can someone explain to me why it would be beneficial to learn these? Most of the time if you needed to edit some file couldn't you just <fav text editor here> file.*? I am trying to understand this. Thanks

2 comments

Its handy to be able to make changes on remote servers there and then without too much messing about.

E.g if you are connected to a remote server and you need to change a file, how do you do it with say VSCode or Sublime etc? Download it to your machine, edit it, save it, then re-upload? Sure that works for the occasional once-a-month kinda thing, but it is a bit convoluted.

It is much easier and faster to just edit the file there and then on the server. Especially if you are doing multiple changes.

Vi really is very simple - you just need to remember esc, i, x and :wq and that is basically all you need to know to be able to do basic edits a file on pretty much ANY server you'll ever connect to (except perhaps windows or a super-stripped down cloud image).

On KDE you can mount the SSH system as local and use your usual tool set. Or Krusader integrates an editor or passes off to Kate for editing (or kdiff3 for file compare or whatnot).

As long as I have nano or can apt-install it then I'm happy to ssh in and do it that way; but it doesn't seem more convoluted to use GUI tools necessarily.

I'd say mounting a remote filesystem is convoluted when you can just edit with vi :-)
It's one click; it's not my normal way of working but one could make it no click, just needing connected to systems when not working on them (or monitoring) seems unwise.
Thank you for the response! Good to know.
It's useful when working with remote servers that may not have a graphical interface at all. There's rsync and network drives are sometimes an option but it's very convenient to just ssh into a server and edit/view with vim directly.

In the cases of vim/emacs, people who dive deep enough will often find them superior than <previous fav text editor>.

Thank you for your reply!

> In the cases of vim/emacs, people who dive deep enough will often find them superior than <previous fav text editor>.

Yeah after reading so many vim vs. emacs memes I was really surprised when my git commit message opened one of them for the first time. ( I didn't surround the message in quotes or something.)

100% this