
More, less, and a story of typical Unix fossilization - zdw
https://utcc.utoronto.ca/~cks/space/blog/unix/MoreAndUnixFossilization
======
ChuckMcM
Now all we need is someone to modify less to recognize that its standard in is
connected the output of more so that if you type `cat /etc/passwd | more |
less` it could output something which, more or less, looked like the input.

~~~
SixSigma
I hereby award you a "Useless use of cat" award [1]

more < /etc/passwd | less

[http://porkmail.org/era/unix/award.html#cat](http://porkmail.org/era/unix/award.html#cat)

~~~
Infernal
Somehow when I was learning Linux/UNIX 13 years ago, my default way of
grepping for something in a file became `cat foo | grep bar`. I've tried, a
bit, to break this habit, but can never stick with it. The only time it slows
me down is when I'm trying to show someone something and they interrupt to ask
why I do it that way :)

~~~
arbitrage
It's not a bad idiom to use. You can keep retrieving the last command, and
change the grep term quickly with ^w . When the search argument to grep is in
the middle of the line, you can't easily iterate over a bunch of search terms
by hand.

~~~
expression
Did you know you can start the command with the redirection operator?

    
    
        <input-file grep stuff
    

Unless you are concatenating stuff, I see no reason to use cat.

~~~
gpm
What if you just want to view the contents of input-file, unpaged. `<input-
file` doesn't print anything unfortunately (curiously it doesn't error
either).

------
JoachimS
And then, of course, there is most:
[http://www.jedsoft.org/most/](http://www.jedsoft.org/most/)

~~~
iuguy
I have to say that when it comes to pagers, I more or less prefer most.

------
xioxox
One advantage I find of more over less, is that it doesn't clear the terminal
on exit. It's often nice to see what you have looked at above the command
prompt. There is a "-X" option for less, but this also breaks mouse wheel
scrolling.

~~~
rootbear
Those horrid alt-buffer init and exit strings in terminfo and termcap are the
bane of my existence. I almost never want that behavior, particularly when
I've got a relevant section of a man page on the screen and want it to STAY
THERE when I quit out of the pager. I use -X in less, but I really want a more
universal solution, so I use a terminal type that doesn't have those strings,
usually xterm-noapp. But it's not always available.

I'm not sure what you mean about -X and mouse scrolling.

~~~
kerny
Put something like this into your .Xresources:

For URxvt:

! Ctrl-Shift-A will show alternate screen URxvt.keysym.C-S-A:
command:\033[?47h ! Ctrl-Shift-Z will return to regular screen
URxvt.keysym.C-S-Z: command:\033[?47l

For XTerm:

! Ctrl-Shift-Z will toggle alternate screen _VT100_ translations: #override
\n\ Ctrl Shift <KeyPress> z: set-altscreen(toggle)

------
akavel
Interestingly, it occurred to me that NixOS might be in perfect position to
enable painless "gradual migrations" of tooling.

Imagine alternative history of UNIX, where NixOS was invented _really_ long
time ago, _before_ 'less' was created. Now, imagine we're Mark Nudelman and we
want to add fancy features to 'more' (instead of creating a new tool named
'less'). We could do this freely, and all tools depending on peculiarities of
"old more" could be pinned to use a "private" old version of the binary, while
new ones would by default use the "new more". Then, the backwards tools could
be gradually updated, until no one imported the "old more" and it could be
safely removed from the nixpkgs repository. (While any external, non-nixpkgs
package definitions could still backport the "old more" definition should they
really need it.)

Does this reasoning have any holes?

~~~
zeveb
I can imagine, though, that more(1) in that case would eventually fork, so
that some software depended on my-more and others on his-more and still others
on her-more.

And that-other-dude's-more would have a security vulnerability, and no-one
would update it, and we'd all get pwned, oh the embarrassment.

------
taneq
> In a sane world, Unix vendors would have either replaced their version of
> more with the clearly superior less

But that's just the thing - 'less' isn't "clearly superior" to 'more'. It is
(or was, maybe this has changed) heavier weight and offers more functionality
that may not be needed. Having both commands lets script writers use exactly
the tool they need for the job. And it's not like the extra 35KB of keeping
the 'more' binary around is really breaking the bank.

~~~
CJefferson
The problem isn't the 35k, the problem is now we all have to spend a little
bit of extra brain capacity, remembering the difference between 'more' and
'less', and how while you would imagine 'more' is better (based on the
traditional English meaning of the words), actually, 'more' is the lesser
product.

I wonder how many hours have been wasted altogether on people learning, and
misunderstanding, which of more or less they should use?

~~~
oneeyedpigeon
Plus, `more` as a pager command at least makes a tiny bit of sense, but `less`
is a ridiculously obscure command name for beginners.

~~~
Sylos
Display _less_ at once on the screen, and make it scrollable instead, worked
perfectly fine for me as an analogy. I actually find "more" less logical,
because I can't find a similar analogy for it...

~~~
zdkl
Matter of taste, I like the image of scroll to see _more_

------
pmontra
There is another pager, less advanced than more [http://www.unix.com/man-
page/linux/1/pg/](http://www.unix.com/man-page/linux/1/pg/)

~~~
pbhjpbhj
There's "most" pager discussed here a week or so ago, too.

(Incidentally that link returns a blank page for me on FF mobile.)

~~~
pmontra
I missed most, I'll look for it.

The link to pg works on my FF Android. I'm using uBlock origin. Are you using
some other adblocker or add on?

~~~
amavisca
The link is similarly a white screen on Android Chrome for me.

~~~
pmontra
Hopefully this works
[http://man.he.net/?topic=pg&section=all](http://man.he.net/?topic=pg&section=all)

The page source is as simple as it could have been in 1996 :-)

The original link has a broken table layout with some unbalanced </table> and
</tr>. Maybe that breaks rendering on your browsers, but why not on my
Firefox?

~~~
Sylos
For me, not only the page is completely empty, but also the page-source, so I
don't think that it's a rendering problem and rather the server sending a
0-long HTML-file or something like that.

It also finishes loading rather quickly, so it would only make sense that it's
not even downloading anything.

And neither Firefox, nor Lightning Browser (WebView-based), nor CyanogenMod's
Gello Browser (Chromium-based) show any form of error and just happily render
a completely empty page.

Also, I do get the favicon displayed, so at least some form of connection to
the server seems to be possible.

Edit: Just had another idea. It works for me when I tell Firefox to request
the desktop site. So, maybe the server just gets confused by a mobile
useragent-string...?

------
inopinatus
I applaud all distributions that include the simplest tools. Sometimes -
always the worst times - they're the ones that still work.

------
winteriscoming
I prefer less. Incidentally, the other day I was on a CentOS system where I
wanted to paginate a log file and typed in "less". Turns out, unlike more,
less isn't installed by default. Was a bit surprised because I was under the
impression that most Linux systems would have had it in their default install.

~~~
annnnd
Debian doesn't install it by default either - agree, surprising. On another
note, even more surprising is less's behavior with colored output (you have -r
and -R switches, which are almost, but not completely, alike; and in neither
of them does page-up render properly).

~~~
RJIb8RBYxzAMX9u
I was pretty sure this is incorrect for at least Debian 8 / Jessie based on
recollection. And now I'm 100% sure it's false -- _sigh_
[https://www.xkcd.com/386/](https://www.xkcd.com/386/) \-- having just
installed it in a VM with only "standard system utility" selected (it is
selected by default), and verified that less is installed.

~~~
d0mine
I don't see it:

    
    
      $ docker run --rm debian:jessie less -V
      docker: Error response from daemon: Container command 'less' not found or does not exist..
    

while _more_ is present:

    
    
      $ docker run --rm debian:jessie more -V                                                  1 ↵
      more from util-linux 2.25.2

~~~
RJIb8RBYxzAMX9u
[https://github.com/tianon/docker-brew-
debian/blob/c2882c541f...](https://github.com/tianon/docker-brew-
debian/blob/c2882c541f5bd5cfdd28a505a4e635d42c7fd946/jessie/build-command.txt)

It's using debootstrap --variant=minbase, which (from the man page) "...only
includes essential packages and apt." It makes sense that docker would want
only the bare minimum. And to be fair, but getting into nit-picking territory,
minbase is the default _for debootstrap_ , but debootstrap is not the default
method of installing Debian: debian-installer is. So docker's Debian image
doesn't install less, but they're not doing a _default_ install, as in
invoking debian-installer, and keeping the preselected choices as much as
possible.

------
frederikvs
I can see the fossilization, but I don't see what's so typical Unix of that
phenomenon. Windows still includes cmd.exe with all its broken, retarded
features, while it has powershell, which is supposedly (no experience myself)
a little less retarded.

~~~
flukus
cmd.exe starts in a second, powershell takes 5 and then another 10 to actually
be interactive.

So it's still useful to me.

~~~
Zardoz84
Plus who would use these weird script language. Common! Even bash scripting
it's more easy that powershell!

~~~
vertex-four
Err. Bash scripting is awful. Trying to figure out what chain of commands you
need to pull out that one particular piece of data from the output of that
command... I've seen a dozen lines to manage it in some cases before, or
calling out to a script in Awk or Perl. And then it won't work when you update
your system because somebody decided to update a command's output format just
slightly.

Powershell is an object-oriented scripting language along the lines of
something like Python, just with different syntax and more of a focus on
managing services. It also has reasonable syntax for applying one command to
the result of another - the pipe operator. And it's reasonable to use it in
day-to-day usage as a command line.

I've written a Powershell script to change an Exchange server setting we
needed to change ever so often, faster than I could ever write a bash script
to do the same. Under Linux, I'd likely have given up trying to use bash to
edit a config, and just started writing an m4 file which generates the config
as part of a cron job.

------
lazyjones
I preferred 'more' over 'less' only in situations where I just wanted to see
the first couple of many pages of output from something (for example
compilation errors where the root cause is at the beginning and the rest is
meaningless). 'less' would then block user interaction while reading all input
(interruptible with ^G), while 'more' would display the first page immediately
and stop reading from stdin.

For all other use cases, 'less' seemed clearly superior.

------
teknopaul
On thing the article misses on is that, at least in Linux, less is not a line
by line pager, it controls the whole terminal screen area, so for example if
you pipe output to a file that has terminal instructions (bold, color, cursor
moves etc) and try to use less to read the file it will not give such good
output. More just outputs the ctrl chars and lets the terminal emulator deal
with them, so they are visible, Thus highlighting the benefit of simplicity
over cruft.

Sometimes, because more does less, more > less.

~~~
ploxiln
The "-r" option to less will allow the "raw" control characters to pass
through. "less -r" will do what you want.

~~~
therein
That's great to know but you still need to make sure the process generating
the output isn't trying to outsmart you.

For instance ag (silver surfer) needs you to specify `ag --color` otherwise it
will detect you are piping it and disable colors.

And if I remember correctly, grep needs a `grep --color=always` to achieve the
same.

------
sjellis
I've used Linux for a decade-and-a-half, but I've never totally loved the
shell, because of the need to learn this sort of pointless arcana. PowerShell
was a massive step forward, and I had hoped that an Open Source, cross-
platform equivalent would develop so that we could get past the current local
maxima of 1970s-era design.

It's rather weird that the Open Source equivalent of PowerShell is
now...PowerShell. Even if you don't like Microsoft or .NET, if you care about
shells I'd recommend trying out PowerShell Core for an hour or two. It's only
when you use it for a bit that you start to realize that _you can guess
commands based on the rules and actually be right_ and how big an improvement
that actually is, rather than the current UNIX method of having to memorize
more and more obscure trivia in order to get the computer to do what you want.
I'm not sure if PowerShell itself is a long-term answer because of the .NET
and Microsoft dependencies, but it gets lot of things right.

It's time we dropped the "Bash is good enough" arguments. There are now new
Linux users starting every day, and asking them to learn that less is better
than more is not funny.

~~~
rollthehard6
I dunno, I'm a long term *NIX person (Solaris 1994-2011, Linux on and off
1994-2006, Linux mostly 2006-now) I am now involved in more Powershell
scripting on Windows than I have ever done before. I don't see - Get-Content
-Tail 10 FILE as an improvement on - tail -10 FILE

I think when it comes to the combination of intuitive command names and
terseness when required, VMS' DCL is still unsurpassed. Having commands with
sensible names that can the be shortened and a really useable HELP system was
a major plus and I've not seen anything match that since.

~~~
CJefferson
To me, the main advantage of Powershell is filename handling.

I know that if I do everything just right, then my scripts will handle
filenames with spaces/newlines/other crazy characters, but I always mess up
somehow. Nowadays if I ever want a script I'll distribute to people who might
have spaces in directories, I write it in python even if it would be a 4 line
bash script, just to avoid the issue.

~~~
dijit
I've never really had a problem with spaces in path names.

You should be quoting variables when they're used though, there is a shell
style guide put out by google that deals with this stuff.

[https://google.github.io/styleguide/shell.xml?showone=Quotin...](https://google.github.io/styleguide/shell.xml?showone=Quoting#Quoting)

------
digi_owl
Or maybe we are observing an OS that is allowed to evolve with the needs and
wants of its environment, rather than something created by decree.

------
voltagex_
>On Linux, more is part of the util-linux package but its manpage outright
tells you to use less instead

On minimal distros (say, Debian in the minbase configuration), more is more
likely to be included than less. I haven't used any other small distros for a
while but is util-linux normally there instead of other packages (actually, I
wonder why minbase doesn't just use busybox).

~~~
ajdlinux
Not a debootstrap or any sort of Debian developer, but I assume minbase is
expected to be strictly a subset of the packages one would find on a regular
Debian system, which would imply having bash, dash, util-linux and so on,
rather than attempting to use busybox (which is Priority: optional).

------
tambourine_man
I've recently been using Vim as a pager and it's great.

    
    
      :help manpager
    

Suggests

    
    
      export MANPAGER="env MAN_PN=1 vim -M +MANPAGER -"
    

Which doesn't work for me, but this does:

    
    
      export MANPAGER="/bin/sh -c \"col -b | vim -c 'set ft=man ts=8 nomod nolist nonu noma' -\""

------
Annatar
From the article:

 _I am not a fan of Solaris 's long standing refusal to touch anything._

This is what people often deeply misunderstand about traditional UNIX
operating systems: one of Solaris' greatest features, in stark contrast to
GNU/Linux, is the insistence on not breaking backward compatibility. Solaris
has however delivered less(1) as standard since Solaris 8, so there is nothing
stopping one from configuring their PAGER to it. In fact, I do the exact same
thing in my OS builds of Solaris and SmartOS. It's called system engineering.

illumos has the entire GNU userland in /usr/gnu and it's packed with new
features under the hood, but those will almost never be introduced such that
they break someone else's stuff; it's the very advantage differentiator
illumos provides over anyone else! And it's good engineering, adding new
funtionality while not breaking existing one.

~~~
guitarbill
> one of Solaris' greatest features

Features are use-case specific. One person's feature is another person's
bloat. (Personally, I side with the article author on this.)

~~~
Annatar
Do you deliver any software for the platform you use, and if so, do you not
mind when things suddenly stop working?

Or, are you responsible for delivering any services, and if so, do you not
mind when someone else's changes cause you an outage?

Perhaps you have some private automation in place; do you not mind if your
automation breaks because of someone else?

Apropos bloat, illumos is the only operating system codebase which gets faster
and more efficient with every commit. If there are others out there, I have
yet to see such a thing.

~~~
guitarbill
I see this as a necessary consequence of being human. Sometimes, a genius
comes along and gets the design and implementation right for years to come.
Most of the time, people try their best. But nobody can really see into the
future.

I'm happy enough if people say "okay, we didn't get this quite right, but we
learned and we've made it better". And if the new approach isn't compatible,
well okay. The short-term pain is usually worth moving forward in the long-
term.

And when this happens, it's usually not a technical issue anymore, but a
communication issue, which is a way harder problem to solve. If your solution
to the communication problem is technical, i.e. let's always maintain
backwards compatibility, then there's still the issue of communicating what
the new, preferred method is. So I feel that if you have great communication
with the people who care, it shouldn't impact them badly in the first place.

The danger of backwards compatibility is maintenance cost, and stifling new
ideas to solve an existing problem better - people won't bother, because the
effort of making something new would be overshadowed by the effort to retro-
fit old behaviour.

Still though, I get the point of changing stuff just for the sake of change is
bad. I'll ignore the hyperbole about illumos though.

------
SixSigma
On plan9 the "terminal" window pages by itself (it is not a tty) but there is
also p(1) [1] which does even less than more or less.

[1]
[https://swtch.com/plan9port/man/man1/p.html](https://swtch.com/plan9port/man/man1/p.html)

------
josuah
Fortunately, `more` may be a very small piece of software and may not clutter
the /bin too much. Moreover it may already be used by some scripts displaying
long output they want user to read briefly.

But there may be (much) larger softwares superseded by more modern versions,
both present on the os.

------
josuah
Do one thing and do it well, but...

\- If more and less are split in two: more does not page well (no scrollback),
and less does two jobs: paging and blocking the scrolling.

\- If more gets dropped in favor of less: less is a rather good pager, and
serve only its own purpose of paging lines of text in different way.

------
BrandoElFollito
TL;DR: less has better specs and replaced more for non-philosophically
inclined sysads.

------
kyberias
Well, at least Yngwie Malmsteen doesn't agree with this nonsense:
[https://www.youtube.com/watch?v=QHZ48AE3TOI](https://www.youtube.com/watch?v=QHZ48AE3TOI)

------
lmm
I don't believe more is the first Unix pager - doesn't pg predate it? IIRC pg
is the only pager required by POSIX.

~~~
JdeBP
pg and the System 5 side of things are notable by their absence from M.
Siebenmann's article. But pg appeared in System 5 release 2 or (more probably)
3 whereas more was 3.0BSD.

------
xg15
So to sum up, more had more features than more but less features than less.

