When I do more filename and less filename, it would seem that the resulting terminals are quite similar. I can navigate and search through my files identically (j, Space, /pattern, etc.).

I find it hard to believe that less is more and vice versa. Are there any differences between the two?

  • 36
    less is more than more, more or less, more is less than less. ;-) – Alan Haggai Alavi Jan 20 '11 at 8:02
  • 3
    @AlanHaggaiAlavi - That's quite a tongue twister you have there:D – Kent Pawar Jun 28 '13 at 7:19
  • 3
    @AlanHaggaiAlavi That should be an answer. :) – Tripp Kinetics Oct 26 '15 at 19:43
up vote 51 down vote accepted

The difference is mostly historical at this point, I believe some systems even have more and less hardlinked to the same binary.

Originally, more pretty much only allowed you to move forward in a file, but was pretty decent for buffering output.

less was written as an improved more that allowed you to scroll around the displayed text

The first line of my man less pretty much sums it up:

Less is a program similar to more, but which allows backward 
movement in the file as well as forward movement. 
  • @jkerian : Text-searching and buffering aside, could you show a practical example of where these two differ in terms of command implementation? – Zaid Aug 17 '10 at 21:26
  • 14
    I don't see that it's historical I've never seen a 'more' that allowed you to move in both directions. you can only move forward in more. the historical point would be that more was written before less, meaning 'see more than 1 page' and less's command name is more of a joke on less is more and more is less, basically saying less could do more things. – xenoterracide Aug 17 '10 at 21:55
  • 1
    I have a Solaris 10 system here where more acts like the old fashioned more--- you can't move back a page. And it's the default PAGER. Drives me mad... – Stefan Lasiewski Aug 18 '10 at 4:34
  • 1
    So in other words it's the FreeBSD (maybe all BSD?) based systems... since OS X is based FreeBSD... @Stefan Solaris's default shell without tab completion (enabled?) drove me mad. – xenoterracide Aug 18 '10 at 5:57
  • 6
    More or less the correct answer. – invert Aug 18 '10 at 9:25

less is a lot more than more, for instance you have a lot more functionality:

g: go top of the file
G: go bottom of the file
/: search forward
?: search backward
N: show line number
: goto line
F: similar to tail -f, stop with ctrl+c
S: split lines

And I don't remember more ;-)

  • 3
    h: everything you don’t remember ;) – törzsmókus Feb 19 at 13:19

In addition to the extra features already mentioned in less, it also has a v command which opens the current file in vi at the same position. When you exit vi, you will be back in less with the (possibly updated) file shown.

  • 1
    When more is interactive it too can start vi by pressing v. – Troubadour Aug 20 '10 at 13:48

There are a couple of things that I do all the time in less, that doesn't work in more (at least the versions on the systems I use. One is using G to go to the end of the file, and g to go to the beginning. This is useful for log files, when you are looking for recent entries at the end of the file. The other is search, where less highlights the match, while more just brings you to the section of the file where the match occurs, but doesn't indicate where it is.

Less has a lot more functionality.

You can use v to jump into the current $EDITOR. You can convert to tail -f mode with f as well as all the other tips others offered.

Ubuntu still has distinct less/more bins. At least mine does, or the more command is sending different arguments to less.

In any case, to see the difference, find a file that has more rows than you can see at one time in your terminal. Type cat, then the file name. It will just dump the whole file. Type more, then the file name. If on ubuntu, or at least my version (9.10), you'll see the first screen, then --More--(27%), which means there's more to the file, and you've seen 27% so far. Press space to see the next page. less allows moving line by line, back and forth, plus searching and a whole bunch of other stuff.

Basically, use less. You'll probably never need more for anything. I've used less on huge files and it seems OK. I don't think it does crazy things like load the whole thing into memory (cough Notepad). Showing line numbers could take a while, though, with huge files.

  • 1
    The reason you see this behavior is that one of the parameters a program gets on startup is the name it was called by. If you take the "less" binary and copy or link it to "more", then running it through "more" changes its behavior because it knows it should be running in compatibility mode. There's actually a fair bit of this going on in a modern Unixy system. On some systems, for instance, mv, cp and rm are all the same binary, just changing behavior depending on how it was called. An extreme example of this is the Busybox project, popular in embedded Linuxes. – Warren Young Aug 17 '10 at 21:54
  • The file sizes for /bin/more and /bin/less are different, and they each show a single hardlink (The column contains a 1). – Stefan Lasiewski Aug 18 '10 at 4:36

At least on systems I've used:

  • more exits automatically when you reach the end of the file
  • less requires you to exit explicitly.

Also less can view zipped/compressed file, more can't do that.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.