system wide pager settings for less on ubuntu
- 19 Sep 2017: Post was created (diff)
I wanted system wide default pager settings on my Ubuntu Server 16.04. This makes manual usage of
less, the pager in
man and all other programs that use the
PAGER environment variable for its pager.
Update the system environment in
/etc/environment by appending the following values:
LESS="-iRFX" PAGER="less" MANPAGER="less"
-i option makes less ignore the case of the search string, just how I want it:
Causes searches to ignore case; that is, uppercase and lowercase are considered identical. This option is ignored if any uppercase letters appear in the search pattern; in other words, if a pattern contains uppercase letters, then that search does not ignore case.
-R option causes “raw” control characters containing ANSI color escape sequences to be output in its raw form, e.g. making colors appear. This is very helpful when using git, to avoid git outputting inline raw control chars like in the image below:
-F causes less to automatically exit if the entire file can be displayed on the first screen.
-X prevents less from clearing the screen when exiting, which is important when using the
-F flag and output fits a single screen.
MANPAGER variable specifies what pager
man should use. Actually,
MANPAGER isn’t set, so this may be superflous. In this case it uses the same settings as normal less, where the options of
less are specified at a single place.