Is it possible for
less output to set the tab width to a number
X as it is for cat?
Yes, it is possible with
less -x or
less --tabs, e.g.
less -x4 will set the tabwidth to 4.
You can configure defaults with the
LESS environment variable, e.g.
less-specific answer has already been given, but a generic solution (for any pager) is to expand the
tabs (with space characters) with the
expand command before feeding to the pager:
expand -t4 file | pager
Instead of setting the tab width in command line (before you open
less). You can also set the tab width within
less by typing