57

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?

4
  • 45
    less is more than more, more or less, more is less than less. ;-) Jan 20, 2011 at 8:02
  • 3
    @AlanHaggaiAlavi - That's quite a tongue twister you have there:D
    – Kent Pawar
    Jun 28, 2013 at 7:19
  • 3
    @AlanHaggaiAlavi That should be an answer. :) Oct 26, 2015 at 19:43
  • This depends on what Unix is being used. On some, less and more are the same executable, while on others they are different.
    – Kusalananda
    Oct 17, 2019 at 10:10

8 Answers 8

61

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. 
14
  • @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, 2010 at 21:26
  • 17
    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. Aug 17, 2010 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... Aug 18, 2010 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. Aug 18, 2010 at 5:57
  • 9
    More or less the correct answer.
    – invert
    Aug 18, 2010 at 9:25
30

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 ;-)

1
  • 8
    h: everything you don’t remember ;) Feb 19, 2018 at 13:19
10

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
  • 1
    When more is interactive it too can start vi by pressing v.
    – Troubadour
    Aug 20, 2010 at 13:48
4

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.

4

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.

2
  • 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. Aug 17, 2010 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). Aug 18, 2010 at 4:36
3

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.

3

At least on systems I've used:

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .