Force less to display a file as text

less

Sometimes less wrongly recognize file as binary and tries to show hexdump on LHS (usually ones with non-alphanumeric characters but still containing printable ASCII characters). How to force it to recognize it as text?

Best Answer

I think you have (or your distribution has) a LESSOPEN filter set up for less. Try the following to tell less to not use the filter:

less -L my_binary_file

For further exploration, also try echo $LESSOPEN. It probably contains the name of a shell script (/usr/bin/lesspipe for me), which you can read through to see what sort of filters there are. Also try man less, and read the Input Preprocessor section.

Related Question