Isn't less just more?
Solution 1
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.
Solution 2
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 ;-)
Solution 3
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.
Solution 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.
Solution 5
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.
![Zaid](https://i.stack.imgur.com/pN9C5.png?s=256&g=1)
Zaid
Updated on September 17, 2022Comments
-
Zaid almost 2 years
When I do
more filename
andless 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
ismore
and vice versa. Are there any differences between the two?-
Admin over 13 years
less
is more thanmore
, more or less,more
is less thanless
. ;-) -
Admin almost 11 years@AlanHaggaiAlavi - That's quite a tongue twister you have there:D
-
Admin over 4 yearsThis depends on what Unix is being used. On some,
less
andmore
are the same executable, while on others they are different.
-
-
Zaid almost 14 years@jkerian : Text-searching and buffering aside, could you show a practical example of where these two differ in terms of command implementation?
-
David Thornley almost 14 years@Zaid: I could if I could get hold of one of the systems I was using fifteen years ago. It really doesn't matter any more.
-
Warren Young almost 14 yearsThe 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.
-
xenoterracide almost 14 yearsI 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 almost 14 years@jkerian which systems have a more that is the same binary as less? (other than busybox based systems)
-
user455 almost 14 yearsFreeBSD has them hardlinked, for one.
-
geoffc almost 14 yearsAIX defaults to
more
instead ofless
. I alias them to each other since I keep typing less, when on AIX. -
Sergio Acosta almost 14 yearsIn Mac OS X they are also hard-linked.
-
Mark Norgren almost 14 yearsOn Ubuntu 10.04, /bin/less and /bin/more have different file sizes. And
more --help
shows completely different output thenless --help
They are not the same. -
Mark Norgren almost 14 yearsI have a Solaris 10 system here where
more
acts like the old fashionedmore
--- you can't move back a page. And it's the default PAGER. Drives me mad... -
Mark Norgren almost 14 yearsThe file sizes for /bin/more and /bin/less are different, and they each show a single hardlink (The column contains a
1
). -
xenoterracide almost 14 yearsSo 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.
-
invert almost 14 yearsMore or less the correct answer.
-
Troubadour almost 14 yearsWhen
more
is interactive it too can startvi
by pressing v. -
Troubadour almost 14 years@xenoterracide: I can move backwards with
more
on my Mandriva system by pressing b (and no, it's not the same binary asless
). -
Steve Bennett about 12 yearsOn OSX, more calls less, but apparently with different arguments (like quitting when you hit EOF).
-
iProgram almost 9 yearsSometimes
less
ismore
! -
törzsmókus over 6 years
h
: everything you don’t remember ;)