Is it possible for less
output to set the tab width to a number X
as it is for cat?
3 Answers
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="-x4"
.
-
1Thanks for your fast response! Didn't find the option. I'll accept your answer as soon as it is possible :)!– polymJul 30, 2014 at 14:32
The 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
-
1
Instead of setting the tab width in command line (before you open less
). You can also set the tab width within less
by typing -x4
-
2This is the answer I really needed. Who always knows how wide they want tabs before they even open the file? Dec 5, 2016 at 19:34
expand
instead ofcat
, like so:expand -4 residuum.txt
.