297

I'm now using Arch Linux, and find a command most works like more and less. To understand the differences between them is a confusing problem. The question Isn't less just more? mentions the differences between less and more. Do you know the differences on color performance, shortcuts and ability moving forward and backward?

Hgtcl
  • 3,081

5 Answers5

359

more

more is an old utility. When the text passed to it is too large to fit on one screen, it pages it. You can scroll down but not up.

Some systems hardlink more to less, providing users with a strange hybrid of the two programs that looks like more and quits at the end of the file like more but has some less features such as backwards scrolling. This is a result of less's more compatibility mode. You can enable this compatibility mode temporarily with LESS_IS_MORE=1 less ....

more passes raw escape sequences by default. Escape sequences tell your terminal which colors to display.

less

less was written by a man who was fed up with more's inability to scroll backwards through a file. He turned less into an open source project and over time, various individuals added new features to it. less is massive now. That's why some small embedded systems have more but not less. For comparison, less's source is over 27000 lines long. more implementations are generally only a little over 2000 lines long.

In order to get less to pass raw escape sequences, you have to pass it the -r flag. You can also tell it to only pass ANSI escape characters by passing it the -R flag.

See less FAQs for more details: http://www.greenwoodsoftware.com/less/faq.html

most

most is supposed to be more than less. It can display multiple files at a time. By default, it truncates long lines instead of wrapping them and provides a left/right scrolling mechanism. most's website has no information about most's features. Its manpage indicates that it is missing at least a few less features such as log-file writing (you can use tee for this though) and external command running.

By default, most uses strange non-vi-like keybindings. man most | grep '\<vi.?\>' doesn't return anything so it may be impossible to put most into a vi-like mode.

most has the ability to decompress gunzip-compressed files before reading. Its status bar has more information than less's.

most passes raw escape sequences by default.

joseluisq
  • 153
  • 81
    My head... all these double-entendres... – Wutaz Jun 29 '13 at 17:34
  • 321
    less is more, but more more than more is, so more is less less, so use more less if you want less more. (...) If less is more than more, most is more than less.” —Slackware Linux Essentials – J. A. Corbal Jun 30 '13 at 20:22
  • @AlberteRomero LOL – Barranka Jul 05 '13 at 17:39
  • 12
    @AlberteRomero That's it, more or less, at least most-ly,. LOL I really like the horizonital scroll in most. – Joe Jul 05 '13 at 20:39
  • 3
    @JonasWielicki done: https://unix.stackexchange.com/questions/271251/is-there-any-way-of-changing-most-keybindings-to-something-more-familiar/271252#271252 – kirushik Mar 21 '16 at 13:51
  • 7
    I just tried most because it colours man pages nicely, however I don't think it supports regular expression searches. Also, having to mess around with a ~.mostrc file to get vi-like keybindings leaves me wanting less. Sometimes less is more than most :) – starfry Feb 06 '17 at 09:02
  • 14
    Just wait til you see notquite – vol7ron Jun 22 '17 at 02:04
  • 3
    @J.A.Corbal Fantastic. I was reading this in public and could not stop laughing. No one around me would get it. So I just kept laughing more. – sherrellbc Mar 12 '19 at 00:55
  • 1
    @J.A.Corbal this makes a lot more sense thanks to your code highlighting – Max Coplan Apr 05 '19 at 15:30
  • 1
    re: "most has the ability to decompress gunzip-compressed files before reading" -- you can just use zless or ...|gunzip|less – mpen Jun 07 '20 at 23:22
  • @vol7ron notquite was an interesting project but since has been obsoleted by the ultimately perfected implementation none. – John Smith Dec 02 '20 at 01:30
  • 1
    @startfry most's manual speaks about regular expressions but what they say isn't clear at all and I never found a way to use them in most. And if you like colors, there is a way to do the same with less. – ewen-goisot Mar 18 '21 at 17:27
  • 1
    Waiting for least, which will be more than most. – Seb May 03 '21 at 10:32
59

Short answer:

Just use less and forget about more

Longer version:

more is old utility

You can't browse step wise with more, you can use space to browse page wise, or enter line by line, that is about it.

less is more + more additional features

You can browse page wise, line wise both up and down, search

ott--
  • 856
tifo
  • 601
22

There is one single application whereby I prefer more to less:

To check my LATEST modified log files (in /var/log/), I use ls -AltF | more.

While less deletes the screen after exiting with q, more leaves those files and directories listed by ls on the screen, sparing me memorizing their names for examination.

(Should anybody know a parameter or configuration enabling less to keep it's text after exiting, that would render this post obsolete.)

  • 31
    The parameter you want is -X (long form: --no-init). From less' manpage: Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen. – Jan Warchoł Mar 09 '16 at 10:18
17

Summary

more, less and most are three pagers, we can compare them this way:

less is more than more,
most is more than more, approximately,
less and most are different, none is better.

More

  • more is a very basic pager, where you can configure almost nothing.
  • It uses Vim key bindings by default, and you can't change them.
  • Sometimes you have to use more and can't use another pager instead, for example in long output (like :highlight) in vim, you can do set more, but you can't set less or set most instead. Actually, I'm not sure vim uses the true more because some features like search are missing.
  • It supports colors (it can display 256 colors output where most can't).
  • You will quit easily, sometimes by accident, for example if you search a pattern and it isn't found, more is exited (less and most don't behave that way).

Less

  • less is based on more, with extra features.
  • Shortcuts are also Vim-based but they can be changed (they are changed in a strange way with lesskey).
  • Can edit the file with an editor like Vim (it means you can have more in vim in less).
  • There is an environment variable called LESS_IS_MORE to make less behave mostly like more.

Most

  • most isn't an improvement of less or more, it's a different software with a similar but not identical behavior.
  • It's not always installed by default.
  • Can edit file with an editor too.

Most VS Less

Both less and most have features that the other don't have. I sometimes see, like in this website,

If less is more than more, most is more than less.

Or on this post:

most: less is more than more, most is more than less. Whereas the other pagers can only display one file at a time, most is capable of viewing any number of files

Actually, you can load several files on less with a command like less foo bar: it will display the file foo but you can see bar with the command :n.

What Less can do and Most can't

  • regex search, with /. Actually, most's manual says search routines "use regular expressions", but I'm not sure there is a way to use them (the manual does not explain how).
  • Reverse search direction with N. With most, the only way is to do again the last search with ? and then you can move backward only).
  • Filter, with &: display only matching lines. It's a bit like a grep but you keep the same shortcuts you had before.
  • Vim-like marks: you can mark a position in text for every letter. most has only one mark, so you can lose the most mark by accident (overwrite it with another text position).
  • Half-screen scroll. most only has page-up and page-down. If your screen can see 30 lines and you want to see important stuff on line 20 and line 40 at the same time, it can be done with half-screen scroll, but not with only screen scroll. It can look a bit irrelevant but it's not, after reading lots of manpages, I can see the difference (I also mapped a similar feature in Vim instead of "search letter in line" (default is f and t)).
  • Go to matching () {} [] or any match you want to define.
  • There is more information in less's manual than in most's manual (1102+300 lines vs 270 lines, depends on terminal size).
  • less can display (at least) 256 colors, and most can display only 8 colors.
  • less can also display text formatting like bold, blinking etc. with for example \e[5m, and most can't.

What Most can do and Less can't

  • Split screen vertically (can only cut screen in half and can't resize it, can be done several times).
  • Configure it with a single config file.
  • Binary mode, that looks like xxd.
  • With most, you have colors in manual by default. For less, there is a way to do the same but it's not the default behavior. That's probably a reason why some people think less can't do the same. If you still want most to be your manpager, then do export MANPAGER=most.
qq4
  • 519
11

more, less and most are a terminal pagers or paging programs used to view the contents of text file.

more: more is a very basic,oldest and popular pager. more is originally allowing only forward navigation through a file, though newer implementations do allow for limited backward movement. i.e. more can move forwards and backwards in text files but cannot move backwards in pipes.

less: less is a more advanced pager that allows movement forward and backward, and contains extra functions such as search. less does not have to read the entire input file before starting, so with large input files it starts up faster than text editors like vi.

most: less is more than more, most is more than less. Whereas the other pagers can only display one file at a time, most is capable of viewing any number of files,

Premraj
  • 2,542
  • 2
    most is more than less only for some features like split screen (and display different files in split), but there is also stuff that only less can do like filter (see my comment below) – ewen-goisot Oct 19 '20 at 23:44