Skip to content

man

man formats and displays the system reference manuals. It provides access to documentation for commands, system calls, library routines, file formats, and other operating system components


Display short description about a command

man -f chmod

Display all related commands from a specific keyword

man -k chmod

Show File System Hierarchy

man hier

Show a manual for any program

man screen

Example 1: Dump all available man pages

man -k . | awk '{print $1}' | sort -u

Example 2: Dump alla vailable man pages (posix friendly)

manpath | tr ':' '\n' |
while read -r p; do
  find "$p" -type f -name '*.[0-9]*' -printf '%f\n'
done | sed 's/\.[^.]*$//' | sort -u

Dump manual page to stdout

man kbdinfo | col -bx

Copy a manual to your clipboard with xsel

man kbdinfo | col -bx | xsel --clipboard

Example 3: Dump all available man pages in a particular section"

find $(man --path | tr ':' ' ') -type f -path '*man2*' -exec basename {} \; | sed 's/\..*//' | sort

Set magenta and lightgreen colors for man

Add below into your ~/.bashrc

export LESS_TERMCAP_mb=$(printf '\e[01;38;5;196m')       # Blinking text (alerts, warnings, critical info) → bright red
export LESS_TERMCAP_md=$(printf '\e[01;38;5;141m')       # Bold text → neon purple
export LESS_TERMCAP_ZI=$(printf '\e[3;38;5;82m')         # Italics → subtle green (if your terminal supports it)
export LESS_TERMCAP_me=$(printf '\e[0m')                 # Reset modes
export LESS_TERMCAP_so=$(printf '\e[38;5;255;48;5;129m') # Standout mode (used for search highlights) → white on dark blue-gray
export LESS_TERMCAP_se=$(printf '\e[0m')                 # Reset modes
export LESS_TERMCAP_us=$(printf '\e[01;38;5;47m')        # Light Green on some matches
export LESS_TERMCAP_ue=$(printf '\e[0m')                 # Reset modes
export LESS_TERMCAP_ZD=$(printf '\e[2;38;5;245m')        # Dim text → subtle gray for less important text
export LESS_TERMCAP_ZB=$(printf '\e[01;04;38;5;201m')    # Bold + underline → neon magenta for headings/subheadings
export LESS_TERMCAP_ZN=$(printf '\e[49m')                # Background defaults / transparent
export LESS_TERMCAP_ZO=$(printf '\e[49m')                # Background defaults / transparent
export LESS_TERMCAP_ZV=$(printf '\e[49m')                # Background defaults / transparent
export LESS='-R'                                         # Ensure ANSI colors are interpreted