News for hackers. Stuff that matters.
Re:GNU nano is my editor of choice by relax88 on Friday August 13, 2021 @06:01PM (#28175144)
It’s not really gatekeeping or snobbery to say that knowing vim is more useful simply because I can log into any Linux machine on the planet and edit a text file without having to install an editor.
Re:GNU nano is my editor of choice by aroman on Friday August 13, 2021 @06:05PM (#28175200)
They probably meant snobbery that vim is superior because it's more capable, not because it's more ubiquitous. Nano is also very widely installed, so the latter point isn't even particularly true.
Re:GNU nano is my editor of choice by brundolf on Friday August 13, 2021 @06:09PM (#28175251)
Every Unix machine (Mac or Linux) that I've ever tried to use nano on has had it preinstalled. I'm sure not all of them have it preinstalled, but it's common at least in mainstream distros
Re:GNU nano is my editor of choice by klyrs on Friday August 13, 2021 @06:24PM (#28175446)
In the late aughts, I found myself at the keyboard of a Solaris system that only had ed. I was there to get the network configured and it didn't have an optical drive, so there was no way but forward.

More recently, I've found myself inside a container which didn't have any editors. I got the job done with echo, head and tail. Delightful.

Re:GNU nano is my editor of choice by trey-jones on Friday August 13, 2021 @06:38PM (#28175641)
Removing vi from your container image is rude, IMO.
Re:GNU nano is my editor of choice by LAC-Tech on Saturday August 14, 2021 @01:31AM (#28178294)
How do you even get a container like that working?

Even alpine based images have a version of vi (it comes with busybox)

Re:GNU nano is my editor of choice by relax88 on Friday August 13, 2021 @06:15PM (#28175326)
If you’ve never logged into a Linux machine without nano installed, then you probably haven’t logged into that many flavours of Linux machine.

I agree this is pretty much a non issue for the average developer, but those of us who work on network infrastructure, as red-team hackers, or do any work on embedded systems can attest to how much of a pain it would be to not know how to use vi/vim.

Re:GNU nano is my editor of choice by koolba on Friday August 13, 2021 @07:04PM (#28175912)
This is even more common in the world of containers where “nice to have just for debugging” get omitted.

You haven’t lived till you have to edit using only sed.

Re:GNU nano is my editor of choice by KronisLV on Friday August 13, 2021 @07:20PM (#28176061)
There is definitely something to be said about having minimalistic container images for security and smaller sizes...

But not having a basic text editor that is probably a few hundred KB feels a bit silly, especially given how many environment dependencies usually get packaged into containers anyways.

That's like not including any sort of a shell in your container and wondering why people are having troubles with debugging.

Personally, i think that just basing container images on something like Alpine, Debian or even Ubuntu images is good enough because those are stripped down enough already for the most part.

Re:GNU nano is my editor of choice by koolba on Friday August 13, 2021 @10:50PM (#28177396)
Of course you add a sane editor after it happens. But that first time…
Re:GNU nano is my editor of choice by trissylegs on Friday August 13, 2021 @07:37PM (#28176208)
I did build a arch Linux install using cat <<EOF, grep and sed. But golly it gets tedious
Re:GNU nano is my editor of choice by relax88 on Friday August 13, 2021 @09:00PM (#28176766)
Sounds like pain, but also a means to getting better at sed.
Re:GNU nano is my editor of choice by bakul on Friday August 13, 2021 @10:16PM (#28177206)
ed.
Re:GNU nano is my editor of choice by correct_horse on Friday August 13, 2021 @06:27PM (#28175494)
Most non-copyleft (permissive free software and proprietary software) tries to stay as far away as possible from the GPLv3 license. Because of this, macOS ships gnu nano 2.0.6 whereas the latest is 5.8. FreeBSD doesn't even have nano installed by default.
Re:GNU nano is my editor of choice by vermaden on Saturday August 14, 2021 @04:12AM (#28178984)
FreeBSD has `/usr/bin/ee` (Easy Editor) so it does not need GNU Nano. But you can install GNU Nano with:

    # pkg install nano
Re:GNU nano is my editor of choice by rcoveson on Friday August 13, 2021 @07:16PM (#28176027)
Here's a good example: The article's author is actually the security team chair of a lightweight Linux distro called Alpine Linux. A base installation of Alpine includes BusyBox vi but no nano.
Re:GNU nano is my editor of choice by babypuncher on Friday August 13, 2021 @06:53PM (#28175809)
I've never worked with distros targeting enterprise, but I've never encountered a distro that didn't include nano.

Even if Vim is "better", I think it's important for all distros to include a text editor that is easy to use out of the box, and nano fits that bill perfectly.

Re:GNU nano is my editor of choice by KronisLV on Friday August 13, 2021 @07:15PM (#28176015)
In my experience, the DEB distributions (Debian, Ubuntu, ...) usually have nano by default, whereas the RPM ones (RHEL, CentOS, Oracle Linux, ...) don't.

That said, i immensely enjoy how small the install size for nano is and how there's no actual work that you need to do to get started with it (unless you need/want customization, like the author of the original article).

Re:GNU nano is my editor of choice by ineedasername on Friday August 13, 2021 @08:28PM (#28176561)
That said, i immensely enjoy how small the install size for nano

I used to install lynx web browser for the same reason, especially because at the time it was the age of countless popups and swf everywhere. I should check to see how it is these days, but I stopped using it when webdev made many pages unusable in it.

Re:GNU nano is my editor of choice by snowwrestler on Friday August 13, 2021 @08:18PM (#28176481)
When I first started working in Linux, it was in Centos and RHEL and I used nano, since it was already installed and easier to understand than vim.

That was about a decade ago though, maybe RHEL has removed nano since then.

Re:GNU nano is my editor of choice by bluedino on Friday August 13, 2021 @06:31PM (#28175550)
Except when it's vi and casual vim users can't figure out why nothing works
Re:GNU nano is my editor of choice by trey-jones on Friday August 13, 2021 @06:37PM (#28175628)
Aren't casual vim users really vi users? I use emacs primarily but years ago created an extremely minimal (~20 lines) .vimrc to be installed by default on every server I work on. Some color, maybe indentation, I don't even know because I usually just use Emacs/TRAMP these days, but I'm nearly 100% sure that every config there works in vi. I would consider myself a casual vim/vi user in that I don't know the differences.
Re:GNU nano is my editor of choice by hn8788 on Friday August 13, 2021 @06:44PM (#28175722)
I may be misremembering, but the biggest differences I remember between vi and vim as a semi-casual user is vi defaults to not supporting arrow keys, and doesn't tell you the mode it's in.
Re:GNU nano is my editor of choice by wahern on Friday August 13, 2021 @07:40PM (#28176219)
I can't remember the last time I used vi and was unable to use arrow keys. That includes typical Linux installations (Vim, Busybox), Solaris (default is Vim, oddly, but I just confirmed arrow keys work in /usr/xpg4/bin/vi), and various BSDs (nvi).

I'm not a power vi user, though. I usually use JOE (thanks/blame to '90s Slackware education), but occasionally vi is more convenient. It wouldn't be nearly as convenient without the arrow keys as I never learned proper typing technique.

Re:GNU nano is my editor of choice by bluedino on Friday August 13, 2021 @09:03PM (#28176785)
Raspbian, for example included vim-tiny
Re:GNU nano is my editor of choice by citrin_ru on Saturday August 14, 2021 @11:54AM (#28181628)
Just tested FreeBSD vi and BusyBox vi - arrows work in both, but I rarely use them (only in insert mode), so can may not notice if they are not supported somewhere. The biggest difference for me is lack of visual mode in vi.
Re:GNU nano is my editor of choice by emef on Friday August 13, 2021 @06:04PM (#28175174)
this is less true these days w/ slim docker images that don't include any editors by default
Re:GNU nano is my editor of choice by dijit on Friday August 13, 2021 @06:10PM (#28175268)
Doesn’t POSIX designate vi as a requirement?

https://ieeexplore.ieee.org/document/6880751

Re:GNU nano is my editor of choice by wahern on Friday August 13, 2021 @08:13PM (#28176457)
vi is specified by POSIX, but (at least currently) it's marked as a User Portability Utilities (UP) extension, which is optional. It is required for XSI conformance, which mandates other extensions like C-Language Development Utilities (CD). But XSI itself is mostly legacy SysV stuff; the more widely supported parts were rolled into POSIX proper and either made a requirement or grouped into their own optional extension.

In general, most utilities and functions primarily used interactively are optional in POSIX.

Re:GNU nano is my editor of choice by privacyking on Friday August 13, 2021 @06:55PM (#28175836)
Not sure, but I've logged into many terminals before and not one of them didn't have vi installed. Have found plenty without nano or vim though.
Re:GNU nano is my editor of choice by yakubin on Friday August 13, 2021 @06:11PM (#28175291)
POSIX doesn't say anything about containers.
Re:GNU nano is my editor of choice by dijit on Friday August 13, 2021 @06:14PM (#28175304)
But your containers may be a bit weird if their environment isn’t POSIX.

Like if you removed the “cd” command or the ability to read environment variables. “Containers” is any definition you want, but surely they’re built to some standard.

PS: I do make “from scratch” images a lot, I know you don’t “need” to have any utilities at all, but I’m fairly certain that a lot of software expects the “OS” to be POSIX.

Re:GNU nano is my editor of choice by yakubin on Friday August 13, 2021 @06:19PM (#28175380)
I don't know what you mean. Linux containers don't contain operating systems. They contain processes. POSIX describes operating systems.

Every Linux process can read environment variables. They are contained in its address space. "cd" is a shell built-in. When there is no shell, there is no "cd". Not providing access to a shell sounds like great security practice tbh. Your applications shouldn't be using it anyway (they should create new processes directly).

Re:GNU nano is my editor of choice by messe on Friday August 13, 2021 @06:38PM (#28175645)
This is just being obtuse for the sake of it. Yes, technically nothing in the notion of a container necessitates that; containers are just a form of namespacing. Have a gold star for understanding that. But the fact is: the vast majority of containers in use are going to be based on some minimal OS image, which is what the commenter was referring to.
Re:GNU nano is my editor of choice by jrockway on Friday August 13, 2021 @08:22PM (#28176516)
People use minimal OS images when they absolutely have to, but the ideal case is just your binary sitting there all alone. (Sometimes you need the tzdata files, SSL certificates, and other support files. But rarely a shell.)
Re:GNU nano is my editor of choice by messe on Friday August 13, 2021 @08:36PM (#28176618)
I agree that the ideal case is just a single binary with minimal supporting data, but people using OS images is certainly the norm not the exception. To suggest otherwise is ludicrous.
Re:GNU nano is my editor of choice by yissp on Friday August 13, 2021 @07:08PM (#28175953)
Most Linux distros aren't 100% posix compliant as far as I know.
Re:GNU nano is my editor of choice by rascul on Saturday August 14, 2021 @01:02AM (#28178114)
Looks like EulerOS is the only one certified (which isn't the same as compliant).

https://www.opengroup.org/openbrand/register/brand3622.htm

Re:GNU nano is my editor of choice by sdljfjafsd on Friday August 13, 2021 @07:20PM (#28176060)
Despite having 7 years of back end experience, I've never learned vim. Is there any other editor that hits these requirement (being able to login to any server to edit text) or does every server engineer need to learn vim?

(I mostly use a mix of sublime, intellij, and vscode to edit text)

Re:GNU nano is my editor of choice by hulug on Friday August 13, 2021 @10:27PM (#28177275)
ed(1)
Re:GNU nano is my editor of choice by ineedasername on Friday August 13, 2021 @08:25PM (#28176536)
That's probably the #1 reason to learn the bare basics of vim even if nano was a daily driver.
Re:GNU nano is my editor of choice by shapefrog on Friday August 13, 2021 @06:58PM (#28175861)
Its not snobbery if it is better
Re:GNU nano is my editor of choice by jakelazaroff on Friday August 13, 2021 @07:07PM (#28175945)
that’s literally what snobbery is
Re:GNU nano is my editor of choice by shapefrog on Saturday August 14, 2021 @05:22AM (#28179304)
snobbery: the character or quality of being a snob.

snob: a person who believes that their tastes in a particular area are superior to those of other people.

Re:GNU nano is my editor of choice by loudtieblahblah on Saturday August 14, 2021 @01:30PM (#28182423)
But Vim is superior in many ways.

Nano is superior in that its easier to use. But it's certainly no where near as powerful as Vim or emacs.

Re:GNU nano is my editor of choice by IncRnd on Saturday August 14, 2021 @02:12PM (#28182771)
That's funny!
Re:GNU nano is my editor of choice by hkt on Friday August 13, 2021 @06:04PM (#28175172)
Is installing an editor really such a hardship?
Re:GNU nano is my editor of choice by yakubin on Friday August 13, 2021 @06:10PM (#28175270)
In "linux embedded", absolutely. You take what's there. At some point I even had a debugging session through TeamViewer connected to a Windows machine which had Terraterm open connected to serial port of a linux box. Unfortunately, there was a lot of spam on the serial port, so even using vi was impossible, because the screen got garbled pretty fast. So I printed the files with cat, worked out a set of sed commands to get those files to the desired state and typed them back in. Crazy. But real.

(Add to that communicating with a guy on-site over notepad.exe. Mr. Robot vibes.)

Re:GNU nano is my editor of choice by orthoxerox on Friday August 13, 2021 @06:42PM (#28175690)
Yes, because your sysadmins won't give you sudo, so you must scp a copy of nano into your home dir. Surprise, it's an AIX server running on Power, so your x86 nano won't run. Does building one from source count as hardship?
Re:GNU nano is my editor of choice by dllthomas on Friday August 13, 2021 @06:10PM (#28175261)
Usually not, sometimes very much so.