7 ms·
I never understood why nano is so popular. It even breaks line breaks by default.
by rhabarba 10y ago
I never understood why nano is so popular. It even breaks line breaks by default.
- JoshTriplett 10y agoIt's a simple modeless editor, with all the keys you need to know to save and exit printed on the bottom two lines. Someone used to notepad on Windows would have little to no trouble using it. That's why Debian installs it as the default text editor.
- noobermin 10y agoAnother good reason: $ ldd /bin/nano linux-vdso.so.1 (0x00007ffc72add000) libmagic.so.1 => /usr/lib64/libmagic.so.1 (0x00007f3eca793000) libncursesw.so.5 => /lib64/libncursesw.so.5 (0x00007f3eca52b000) libc.so.6 => /lib64/libc.so.6 (0x00007f3eca193000) libz.so.1 => /lib64/libz.so.1 (0x00007f3ec9f73000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f3ec9d6b000) /lib64/ld-linux-x86-64.so.2 (0x00007f3eca9bb000) $ ldd /usr/bin/vim linux-vdso.so.1 (0x00007ffd69bfd000) libSM.so.6 => /usr/lib64/libSM.so.6 (0x00007efe2d7d3000) libICE.so.6 => /usr/lib64/libICE.so.6 (0x00007efe2d5b3000) libXt.so.6 => /usr/lib64/libXt.so.6 (0x00007efe2d33b000) libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007efe2cfdb000) libm.so.6 => /lib64/libm.so.6 (0x00007efe2cceb000) libncurses.so.5 => /lib64/libncurses.so.5 (0x00007efe2ca8b000) libacl.so.1 => /lib64/libacl.so.1 (0x00007efe2c87b000) libgpm.so.1 => /lib64/libgpm.so.1 (0x00007efe2c673000) libdl.so.2 => /lib64/libdl.so.2 (0x00007efe2c46b000) libc.so.6 => /lib64/libc.so.6 (0x00007efe2c0d3000) libuuid.so.1 => /lib64/libuuid.so.1 (0x00007efe2becb000) libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007efe2bca3000) libattr.so.1 => /lib64/libattr.so.1 (0x00007efe2ba9b000) /lib64/ld-linux-x86-64.so.2 (0x00007efe2d9e3000) libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007efe2b893000) libXdmcp.so.6 => /usr/lib64/libXdmcp.so.6 (0x00007efe2b68b000) There probably are stripped down versions of vim out there, but this makes nano more reliable in the case of say a corrupted disk where libs are corrupted...less points of failure at least.
- nickysielicki 10y agoI think it's a bit more fair to compare it to vi or nvi $ ldd $(which nvi) /usr/local/bin/nvi: Start End Type Open Ref GrpRef Name 0000047a80c00000 0000047a8106c000 exe 1 0 0 /usr/local/bin/nvi 0000047d4d9f6000 0000047d4de50000 rlib 0 1 0 /usr/lib/libncursesw.so.14.0 0000047c97a14000 0000047c97e20000 rlib 0 1 0 /usr/lib/libutil.so.12.1 0000047ca1ba9000 0000047ca2073000 rlib 0 1 0 /usr/lib/libc.so.88.0 0000047d3bf00000 0000047d3bf00000 rtld 0 1 0 /usr/libexec/ld.so $ ldd $(which vi) /usr/bin/vi: Start End Type Open Ref GrpRef Name 0000106784500000 0000106784956000 exe 1 0 0 /usr/bin/vi 00001069ee8ed000 00001069eed47000 rlib 0 1 0 /usr/lib/libcurses.so.14.0 00001069f097f000 00001069f0d8b000 rlib 0 1 0 /usr/lib/libutil.so.12.1 00001069a8f41000 00001069a940b000 rlib 0 1 0 /usr/lib/libc.so.88.0 0000106a02600000 0000106a02600000 rtld 0 1 0 /usr/libexec/ld.so
- synchronise 10y agoOne thing I found interesting: $ ldd /usr/bin/ne linux-vdso.so.1 => (0x00007ffc22abf000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1c2d4ee000) libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f1c2d2c5000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1c2ceff000) /lib64/ld-linux-x86-64.so.2 (0x00007f1c2d7ff000) For a pretty full featured text editor ne has surprisingly few dependencies.
- bcook 10y agoIs your "vim" actually "gvim"? On ArchLinux I get the following: ldd /usr/bin/vim linux-vdso.so.1 (0x00007ffdcebf9000) libm.so.6 => /usr/lib/libm.so.6 (0x00007f1a49617000) libncursesw.so.6 => /usr/lib/libncursesw.so.6 (0x00007f1a493aa000) libacl.so.1 => /usr/lib/libacl.so.1 (0x00007f1a491a1000) libgpm.so.2 => /usr/lib/libgpm.so.2 (0x00007f1a48f9a000) libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f1a48d96000) libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f1a48b79000) libc.so.6 => /usr/lib/libc.so.6 (0x00007f1a487d8000) /lib64/ld-linux-x86-64.so.2 (0x00007f1a4991b000) libattr.so.1 => /usr/lib/libattr.so.1 (0x00007f1a485d3000)
- justinmk 10y agoHere's neovim: $ ldd $(which nvim) linux-vdso.so.1 => (0x00007fff75590000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f821b0ea000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f821aecc000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f821acc7000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f821a9c1000) libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f821a7be000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f821a3f8000) /lib64/ld-linux-x86-64.so.2 (0x00007f821b301000)
- noobermin 10y agoThis is on gentoo, so it looks like I have X, acl, and gpm use flags set for vim, which are a weak correspondence to configure options. So, I'm assuming you can remove SM,ICE,Xt,X11...gpm,acl,xcb,Xau,Xdcmp from my list. Quite a reduction! I admit. To be fair, nano can remove magic, ncurses which cuts it down to libc, libz for nano, and libm, libattr, libc, and ncurses for vim. I'm assuming you might be able to remove ncurses for vim(?) by configure? I've never built vim by hand. So you might be right, the stripped out version makes a difference.
- paulannesley 10y agoThe ones that ship with OS X 10.11: $ otool -L /usr/bin/nano /usr/bin/nano: /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1225.0.0) $ otool -L /usr/bin/vim /usr/bin/vim: /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
- GFK_of_xmaspast 10y agoIf seems to me that if you're in a situation where you have to worry about working on a corrupted FS where parts of /usr/lib and /lib may or may not be reliable, thats about the time when you say 'screw it' and restore from backups.
- sundarurfriend 10y agoGlad I'm not the only one that thought that. This sounds to me like comparing kitchen cabinets based on "which one might work best when your house is on fire".
- untog 10y agoBecause it's simpler to grasp than vi, at least for newbies. You hit backspace, it deletes a character. You hit enter, it makes a newline. And so on.
- thallian 10y agoExactly what appealed to me in the beginning. Coming from Windows I was lost enough without trying to guess how to get out of vi. Once I got more comfortable with how things work I was confident enough to use it and I would not want to miss it any more.
- girvo 10y ago> I was lost enough without trying to guess how to get out of vi. Oh man, I remember googling that years ago now. That was fun. Now I use Vim and Visual Studio Code for all my editing, but because my Vim is so customized, if I remote into a server I'm more likely to reach for nano instead.
- rhabarba 10y agovi doesn't kill my newlines when on PuTTY.
- digi_owl 10y agoOn that note, i wonder if people should take a long at another of Hishamhm's (Htop, Gobolinux) projects, Dit. Its a terminal editor that uses hotkeys that you more commonly find in GUIs. https://github.com/hishamhm/dit https://github.com/hishamhm/dit
- sbuttgereit 10y agoI think there is a whole tier of both entry level hobbyists and what I'll call lower sophistication professionals, sysadmin types that manage small or mid-sized company IT systems where there are a small handful of low volume Linux servers (or similar) to deal with: basic configs, basic backups, etc. For them, I think nano is as close an analog to what they get in a windowed operating system, while still dealing with the command line. These aren't the types to go run off and learn vi or Emacs because, at the level they're playing at, there's not much advantage. They are in the command line text editor only occasionally for a simple edit here and there. nano is relatively intuitive, vi and Emacs aren't. Moreover, I think it may be under appreciated, especially here on HN, just how many technology professionals are in this category. They know what they know and get by with it. EDIT: I should make clear, that "lower sophistication professionals" don't have anything to be ashamed of nor are they somehow lesser in what's important; I just don't know how to say it in a way that doesn't have a tinge of sounding derogatory. It's not intended.
- joshschreuder 10y agoI fall into this category, I run a HTPC off Lubuntu for performance reasons and because I like to tinker in different technologies, but do dev on Windows in my day to day, and never bothered to learn Vim / Emacs. I stick to Sublime on Windows, and when I need to tinker on my HTPC, I jump into nano, mainly because the command is memorable and the editor is very easy to use.
- rhabarba 10y agoWouldn't it make more sense for them to use joe then? joe comes with preconfigured hotkeys which are more "known" than C-o etc.
- sbuttgereit 10y agoNever heard of it. That same audience is also likely not choosing their editor much of the time. I've found that nano is the default editor often and if it's good enough, why would you mess with it? I know when I search for something that is not a core interest of mine, I go with the first thing that Google shows me that meets my requirements.... I don't overthink that which is mostly unimportant to me.
- deleted 10y ago[deleted]
- InclinedPlane 10y agoI've been using linux/unix for 2 decades and I used pico/nano for ages. It's an intuitive and easy to use editor with on-screen help. For the vast majority of everyday uses it works just fine. And for the rare times when it's not suitable, there are plenty of tricks to working around nano's limitations. The main reason I started learning vim is just because I wanted to, not because I thought I was being held back by nano.
- zhte415 10y agoFrom a user perspective, it has huge critical mass in that short 'how-tos' tutorials invariably include screenshots of nano, as it is probably installed and can be easily used for simple tasks.
- somethingsimple 10y agoAfter years of attempting and failing hard to grasp Vim or Emacs, I've recently switched to nano and I'm very happy with it. Vim and Emacs seem impenetrable to someone coming to them after they've been around for so long. Documentation and code is scattered all around, their concepts are not intuitive and there's so much stuff (modules, modes, whatever) available for both that I just feel paralyzed trying to decide what I need and what I don't. And then there's learning all the crazy key combinations and commands. In contrast, the manpage for nanorc can be read in a few minutes. Keys work as expected and there's a helpful menu at the bottom. Shortcuts are all Ctrl+<something>. It's small, it's fast, and it does what I expect it to do: allow me to painlessly edit text files.
- rhabarba 10y agoProbably I'm just the wrong type of person for nano then. I'm rather happy with Emacs (even with its mediocre performance).
- Retra 10y agoI use Vim all the time, and I don't know how to do squat in it. Press `a` start typing, `:wq!` when done. ... Ok, that's a lie. I also know /, n, N, :noh for searching , dd to delete lines, and [{, ]} for jumping to delimiters.
- somethingsimple 10y agoThat's as much as I know of vim, and I can do those same things in nano :)
- cdmckay 10y agoI think 'a' is actually append. I think 'i' (for insert) is the correct way to start typing.
- marklgr 10y ago> Documentation and code is scattered all around Vim and Emacs both have excellent built-in manuals.
- x0 10y agoI love nano, I've got absolutely no interest in vim or emacs. First things I do with it is set up colour highlighting, make it never break lines, and make it go into the background with ^Z. If I'm ever held back by nano, I've got sublime text and rsub set up on my servers, so I can type "sublime /etc/whatever" on the remote computer, and it will pop up on my home computer.
- rhabarba 10y ago^ Thanks for that trick, I didn't follow ST development too much recently.
- samatman 10y agoI checked email with pine for ten years before succumbing to gmail. Once something's in your muscle memory, there's no reason to shift out. I use Sublime or Spacemacs for Real Editing, Writeroom for distraction free writing. Ten second config file tweak? Doing something to J. Random Remote Server? nano's got my back.
- steve_taylor 10y agoIt's popular because it's a text editor that you don't have to learn how to use. You just use it. I don't understand why, after all these years, people still think they can fool others into believing that they don't understand why others would choose nano over vim.
- digi_owl 10y agoTo borrow from an Arch discussion, it may well be that vi is something of a humblebrag.
- Ayaz 10y agoI never liked nano. The only time I used it for a stretch was when for a year I used a non-GUI, X-less only environment for everything only old ThinkPad running Slackware. I was in University then. That was when I used Pine for email and Slrn for Usenet (and elinks for browser). While I remember using nano to edit emails in Pine (and later moving over to Emacs), I can't remember which editor I used inside Slrn. I am a thorough Vim believer. I have been for a long time. If I ever accidentally find myself on a nix system with nano or pico as the default editor, I exit and install Vim. However, in my almost 15 years using nix of all flavours, I have spent considerable time using Emacs as well, both on the GUI and the command line. Eventually, I gave up Emacs in favour of Vim. I've stuck to it since.
- digi_owl 10y agoIt may well be that you were not using nano but pico. It is part of pine, and i do believe that part of the reason nano got created was that a common question on distro lists etc was "where is pico?!". And checking wikipedia i see that pine's license was at one point changed from a BSD-like to one that restricted third parties from distributing altered versions of pine. Something that naturally riled up the FSF.
- deleted 10y ago[deleted]
- Scarblac 10y agoIt comes installed on servers and isn't a modal editor. Actually mostly the same reason Notepad is still used a lot on Windows.
- tdy721 10y agoJust guessing: you didn't grow up in a GUI world. When I'm ~45 I hope I'll know lots more about vim, until then, we're still cashing checks.
- tdy721 10y agoAhh, also, I like to share the command line with other folks. Nano is the easier one to share. It comes with a manual! (trapped in vi PTSD anyone?, I certainly know one vim command. ":q")
- digi_owl 10y agoWell if i get the history right it started out as a clone of pico, and pico was the editor part of the pine email client. Meaning that the line break behavior kinda makes sense if your primary goal is writing emails, or similar long texts. But for any kind of programming of config file editing it is indeed a problem. Thankfully there is multiple ways to turn the behavior off.