View Colored Man Pages

I use bash and would like to have colored man pages. I have followed the instructions here:

I’ve tried both methods, but I can’t get any colored man pages?

set the following environment variables using .bashrc

export MANROFFOPT="-c"
export MANPAGER=sh -c 'col -bx | bat -l man -p'

Also ensure you have bat installed. You can check with pacman.


It gave the following error:

─λ nano ~/.bashrc

╭─carl@andersen in ~ took 21s
╰─λ source ~/.bashrc
bash: export: “-c”: not a valid identification name
bash: export: “col -bx | bat -l man -p”: not a valid identification name

╭─carl@andersen in ~ took 5ms
[:red_circle:] × man df
sh: linje 2: syntaksfejl nær uventet udtryk “1”
sh: linje 2: `DF(1) Brugerkommandoer DF(1)’
man: the command completed with status 2: sed -e ‘/[1]$/{ N; /[2]\n[[:space:]]*$/D; }’ | LESS=-ix8RmPm Manual page df(1) ?ltline %lt?L/%L.:byte %bB?s/%s…?e (END):?pB %pB%… (press h for help or q to quit)$PM Manual page df(1) ?ltline %lt?L/%L.:byte %bB?s/%s…?e (END):?pB %pB%… (press h for help or q to quit)$ MAN_PN=df(1) sh
and bat was installed

  1. [:space:] ↩︎

  2. [:space:] ↩︎

my bad forgot the quotes,

change this to ,

export MANPAGER="sh -c 'col -bx | bat -l man -p'"

notice the quotes.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.