more or less

Unix Tutorial

I’m working hard to finish off the Basic Unix Commands section of this website – want to have every command there documented before I start recording videos about them. more and less are the most recent additions.

Both more and less are basic commands for viewing text files. Quite often they’re used together with cat command (you cat a file and pipe it into more or less), but that’s actually not necessary – you can get the same result by just using more or less on their own.

more command

more command helps you browse text files in Unix and Linux. Instead of throwing complete contents of the possibly large text file into terminal window, more shows you paginated content – fills up the screen and then waits for a key press to show the next screen’s worth of content.

more command showing /etc/lsb-release file

less command

less command continues traditions of a simple text file viewer of the more command (in many ways, less IS more) but does it with a number of key optimisations.

less command showing /etc/lsb-release file

more or less?

more is a much simpler command and will work on a relatively broken system – no complicated terminal emulation, no possibly broken Up/Down key sequences, etc. more will simply keep showing text output into your terminal session without any built-in scroll-back functionality.

less is more flexible but also expects terminal emulation to be operational for arrow-keys navigation to work. The advantage is you have a fully functional scroll-back.

more is great for small files, but it needs to read the complete text file before showing its paginated contents. So for large (hundreds of megabyes) files, less will be much faster as it only reads the part necessary to show on the screen (and reads more as you keep scrolling).

See Also