Weird issues with the manual pages

My manual pages has a strange issue when viewing information. It looks like it is displaying variable names for items. Tried reinstalling man-db and running mandb as well as ensuring that i have installed the dependencies. This occurs in multiple shells and terminal emulators.

Here is a sample:

MAN(1)                        Manual pager utils                        MAN(1)

1mNAME0m
       man - an interface to the system reference manuals

1mSYNOPSIS0m
       1mman 22m[4mman24m 4moptions24m] [[4msection24m] 4mpage24m ...] ...
       1mman -k 22m[4mapropos24m 4moptions24m] 4mregexp24m ...
       1mman -K 22m[4mman24m 4moptions24m] [4msection24m] 4mterm24m ...
       1mman -f 22m[4mwhatis24m 4moptions24m] 4mpage24m ...
       1mman -l 22m[4mman24m 4moptions24m] 4mfile24m ...
       1mman -w22m|1m-W 22m[4mman24m 4moptions24m] 4mpage24m ...

1mDESCRIPTION0m
       1mman  22mis  the system's manual pager.  Each 4mpage24m argument given t
o 1mman 22mis
       normally the name of a program, utility or function.  The  4mmanual24m  4
mpage0m
       associated with each of these arguments is then found and displayed.  A
       4msection24m, if provided, will direct 1mman 22mto look only in that  4ms
ection24m  of
       the  manual.   The  default action is to search in all of the available
       4msections24m following a pre-defined order (see 1mDEFAULTS22m), and to s
how only
       the first 4mpage24m found, even if 4mpage24m exists in several 4msections

1mNAME0m
       man - an interface to the system reference manuals

1mSYNOPSIS0m
       1mman 22m[4mman24m 4moptions24m] [[4msection24m] 4mpage24m ...] ...
       1mman -k 22m[4mapropos24m 4moptions24m] 4mregexp24m ...
       1mman -K 22m[4mman24m 4moptions24m] [4msection24m] 4mterm24m ...
       1mman -f 22m[4mwhatis24m 4moptions24m] 4mpage24m ...
       1mman -l 22m[4mman24m 4moptions24m] 4mfile24m ...
       1mman -w22m|1m-W 22m[4mman24m 4moptions24m] 4mpage24m ...

1mDESCRIPTION0m
       1mman  22mis  the system's manual pager.  Each 4mpage24m argument given t
o 1mman 22mis
       normally the name of a program, utility or function.  The  4mmanual24m  4
mpage0m
       associated with each of these arguments is then found and displayed.  A
       4msection24m, if provided, will direct 1mman 22mto look only in that  4ms
ection24m  of
       the  manual.   The  default action is to search in all of the available
       4msections24m following a pre-defined order (see 1mDEFAULTS22m), and to s
how only
       the first 4mpage24m found, even if 4mpage24m exists in several 4msections

Welcome to ask.fedora @javilen

Open a terminal and edit the settings. Click on Hamburger Menu, Preferences, Unnamed, Compatibility and click there on “Reset Compatibility Options to Defaults”.

Close the settings and the terminal. Reopen a new terminal and test the man command again.
I hope this helps :wink:

1 Like

Looks like your terminal emulator doesn’t interpret escape codes. What is the value of your TERM environment variable? You can check it with echo $TERM command.

2 Likes

Based on the statement “My manual pages”, I assume that you copied “/usr/share/man/man1/man.1.gz” and extracted somewhere in HOME to edit the text attributes. In the section NAME, for example, 1m is likely ^[[1m (bold) and 0m is ^[[0m (normal) {see
Invisible Island, CSI Pm m Character Attributes (SGR).} Esc/Ctl sequences, unfortunately, are not interpreted in man pages. For bold text in a man page, use macro .B [see groff_man(7)].

Reinstall if this does actually effect system man pages is the best i can offer.
EDIT: man-pages, not the system

ADDENDUM
Esc/Ctl sequences do work in info (texinfo) - but strangely. To enter bold red text with yellow background: ^[[1m^[[31m^[[43m but not the normal ^[[1;31;43m.

❯ echo $TERM
xterm-256color

I use Alacritty as my terminal emulator although it is still an issue with Gnome’s default terminal.

Only copied the output from the terminal man man. I know my install was initially missing dependencies. Surprisingly, i did have to install groff which was not installed by default. Reinstalling man-pages did not fit it though.

GREP(1)                          User Commands                         GREP(1)

1mNAME0m
       grep, egrep, fgrep - print lines that match patterns

1mSYNOPSIS0m
       1mgrep 22m[4mOPTION24m...] 4mPATTERNS24m [4mFILE24m...]
       1mgrep 22m[4mOPTION24m...] 1m-e 4m22mPATTERNS24m ... [4mFILE24m...]
       1mgrep 22m[4mOPTION24m...] 1m-f 4m22mPATTERN_FILE24m ... [4mFILE24m...]

1mDESCRIPTION0m
       1mgrep  22msearches  for  4mPATTERNS24m  in  each  4mFILE24m.  4mPATTERNS24m is one or more
       patterns separated by newline characters, and  1mgrep  22mprints  each  line
       that  matches a pattern.  Typically 4mPATTERNS24m should be quoted when 1mgrep0m
       is used in a shell command.

       A 4mFILE24m of “1m-22m”  stands  for  standard  input.   If  no  4mFILE24m  is  given,

The reply is confusing. Did you copy and unzip into your own ($HOME) man directory for editing man pages or copy/paste from man man into text file? Also, dependencies to what? Since the system and HOME man pages result in the same (I think based on the reply) problem, the common factor would be the less utility which is the default pager for man. I was able to replicate the image in the reply. To avoid messing with your .bashrc file (if a solution, then put it in), copy/paste the following into a file and save as less_man.

## mb - Start blinking
export LESS_TERMCAP_mb=$'\E[5;32m' # Green
## md - Start bold mode
export LESS_TERMCAP_md=$(printf "%b" "\E[1;38;2;240;230;140m") # khaki
## me - End all mode like so, us, mb, md, and mr
export LESS_TERMCAP_me=$'\E[0m'
## so - Start standout mode
export LESS_TERMCAP_so=$'\E[38;2;255;000;255m' # Bold Magenta1
## se - End standout mode
export LESS_TERMCAP_se=$'\E[0m'

## Underlining (^[[4m) replaced with italics (^[[3m)
## us - Start underlining
#export LESS_TERMCAP_us=$(printf "%b" "\E[4;38;2;30;144;255m") # Dodger Blue
export LESS_TERMCAP_us=$(printf "%b" "\E[1;3;38;2;255;192;203m") # pink
## ue - End underlining
#export LESS_TERMCAP_ue=$'\E[24m'
export LESS_TERMCAP_ue=$'\E[23m'

 ## mr - Start reverse mode
 export LESS_TERMCAP_mr=$'\E[7m'
 ## mh - Start half bright mode
 export LESS_TERMCAP_mh=$'\E[2m'
## ZN - Enter subscript mode
export LESS_TERMCAP_ZN=$(tput ssubm)
## ZV - End subscript mode
export LESS_TERMCAP_ZV=$(tput rsubm)
## ZO - Enter superscript mode
export LESS_TERMCAP_ZO=$(tput ssupm)
## ZW - End superscript mode
export LESS_TERMCAP_ZW=$(tput rsupm)

Now execute

source less_man

and (because I have many differently colored terminals, for consistency)

echo -en “\e]11;grey27\e\\”; man man; echo -en “\e]111\e\\”;

The command-line is only for demonstration so put it in a function or whatever so you only have to execute man man.

I am not editing man pages from “/usr/share/man/man1/man.1.gz”. This is just a display issue when I run man man in the terminal and nothing was moved or copied to a file. As for the dependencies, man would not run due to lacking groff on my default installation. If I where to run man man | cat or man man | less the output would be correct.

I understand that man is supposed to remove these ANSI excape codes however, i am not sure why piping through less would work.

It is the other way around. The man command is putting these ANSI sequences for the terminal to interpret. If the terminal does not interpret those, it is defective or misconfigured.

When piping into some command, the man command will detect that and then does not insert these ANSI sequences.

1 Like

Have you tried as a different user? My last reply was to see if you correctly entered values for the LESS_TERMCAP variables. I used Ctl/Esc sequences (vice tput) since that is what appears in your display. Have you tried man -P more man? What is the result? Have you checked less variables listed in less(1)? For instance, do you have LESS=' -R' set? I believe your problem has to do with less. So cut /paste the following into a maximized terminal. It will over-ride any settings you may have made. To assist,

  • Search with /given will be red text/yellow background

  • ’ → goto mark: a (search for mark a will produce error - blue text on cyan background)

  • m → set mark: a (make mark a - white text on black background)

    echo -en "\e]11;grey27\e\\"; man -P "less -RsJMN --use-color --color=Bc --color=Cg --color=E17.33m --color=Mwk --color=N11 --color=PGk --color=S1.220m -Dd15.17m -Dky -DscG -Du+10.240 --no-histdups --" man; echo -en "\e]111\e\\";
    

Again, I’m using OSC sequences to avoid color saturation.