I use the Python package rtv as a terminal client to read Reddit. When it gets to a large text box, it calls less display the text. Currently, less wraps the words according to column width, meaning that sometimes you get cut off in the middle of the word. Is there a configuration or tweak that can make it only fold where there is whitespace?


3 Answers 3


I use the unix toolbox for my terminal/bash viewer:

alias v='(fold -s -w75 | nl -bn -w10 | LESS= less -MINRz-4+G:1g)<'
  • What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete. Dec 3, 2018 at 20:25

Put this in your .bashrc or similar configuration file.

export PAGER="/bin/sh -c \"fmt -s -w $(tput cols) - | less\""
  • +1 Nice answer: pipe it through fmt first.
    – mach
    Feb 3, 2020 at 20:44
  • Doesn’t make it on the fly but before calling less; this way less cannot react accordingly on window size changes, and you also cannot switch it on or off. A nice approach nevertheless. Not what I want, though.
    – Alfe
    Jul 3, 2023 at 0:06

One solution is to use the -S (--chop-long-lines) command line option for less. This tells less to truncate lines to the width of the screen. To view the truncated lines that are wider than the terminal, the left and right arrow keys can be used to scroll the window horizontally.

You can enable this behavior by adding -S to the command line or setting the environment variable, LESS, like this in Bash:

$ export LESS='-S'

More on word wrapping can be found in this question: How to turn off word-wrap in less

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .