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?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 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.
Method 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 😉
Method 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.
Method 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.
Method 5
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.
Method 6
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.
Method 7
At least on systems I’ve used:
moreexits automatically when you reach the end of the filelessrequires you to exit explicitly.
Method 8
Also less can view zipped/compressed file, more can’t do that.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0