Your shell can display accents etc because it is probably using UTF-8. Since the file in question is a different encoding, less
more
and cat
are trying to read it as UTF and fail. You can check your current encoding with
echo $LANG
You have two choices, you can either change your default encoding, or change the file to UTF-8. To change your encoding, open a terminal and type
export LANG="fr_FR.ISO-8859"
For example:
$ echo $LANG
en_US.UTF-8
$ cat foo.txt
J'ai mal � la t�te, c'est chiant!
$ export LANG="fr_FR.ISO-8859"
$ xterm <-- open a new terminal
$ cat foo.txt
J'ai mal à la tête, c'est chiant!
If you are using gnome-terminal
or similar, you may need to activate the encoding, for example for terminator
right click and:
For gnome-terminal
:
Your other (better) option is to change the file's encoding:
$ cat foo.txt
J'ai mal � la t�te, c'est chiant!
$ iconv -f ISO-8859-1 -t UTF-8 foo.txt > bar.txt
$ cat bar.txt
J'ai mal à la tête, c'est chiant!
more
more
is an old utility. When the text passed to it is too large to fit on one screen, it pages it. You can scroll down but not up.
Some systems hardlink more
to less
, providing users with a strange hybrid of the two programs that looks like more
and quits at the end of the file like more
but has some less
features such as backwards scrolling. This is a result of less
's more
compatibility mode. You can enable this compatibility mode temporarily with LESS_IS_MORE=1 less ...
.
more
passes raw escape sequences by default. Escape sequences tell your terminal which colors to display.
less
less
was written by a man who was fed up with more
's inability to scroll backwards through a file. He turned less
into an open source project and over time, various individuals added new features to it. less
is massive now. That's why some small embedded systems have more
but not less
. For comparison, less
's source is over 27000 lines long. more
implementations are generally only a little over 2000 lines long.
In order to get less
to pass raw escape sequences, you have to pass it the -r
flag. You can also tell it to only pass ANSI escape characters by passing it the -R
flag.
See less
FAQs for more details: http://www.greenwoodsoftware.com/less/faq.html
most
most
is supposed to be more than less
. It can display multiple files at a time. By default, it truncates long lines instead of wrapping them and provides a left/right scrolling mechanism. most's website has no information about most
's features. Its manpage indicates that it is missing at least a few less
features such as log-file writing (you can use tee
for this though) and external command running.
By default, most
uses strange non-vi-like keybindings. man most | grep '\<vi.?\>'
doesn't return anything so it may be impossible to put most
into a vi-like mode.
most
has the ability to decompress gunzip-compressed files before reading. Its status bar has more information than less
's.
most
passes raw escape sequences by default.
Best Answer
The difference is mostly historical at this point, I believe some systems even have
more
andless
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 improvedmore
that allowed you to scroll around the displayed textThe first line of my
man less
pretty much sums it up: