How to Install and Use moar in Linux as a Modern Terminal Pager Alternative to less

When inspecting logs, reading source code, or paging through command outputs in the terminal, the venerable less command has long served as the default tool. However, configuring less with modern conveniences—such as syntax highlighting, intuitive line wrapping, search highlighting, Git diff awareness, and mouse wheel scrolling—often requires complex environment flags and external filter scripts like source-highlight or lesspipe. moar is a modern, standalone pager written in Go that provides syntax highlighting, automatic text search, regex filtering, and smooth mouse scrolling straight out of the box with zero runtime dependencies.

Why Switch from less to moar?

While maintaining compatibility with traditional pager navigation, moar introduces several key productivity improvements:

  • Automatic Syntax Highlighting: Automatically recognises file extensions and applies chroma-powered colour themes without requiring external plugins.
  • Native Git Integration: Automatically highlights additions and deletions when reading unified diffs or piped git log outputs.
  • Mouse and Trackpad Support: Smooth vertical scrolling via the terminal mouse daemon without capturing or breaking clipboard text selection.
  • Smarter Search: Interactive incremental search with case-adaptive sensitivity (smart case), matching results across folded and wrapped lines.
  • Direct Exit on Short Content: Can be configured to print and exit immediately if file content fits within a single terminal viewport.

Step 1: Installing moar on Linux

Because moar is compiled as a static Go binary, installation is fast across all distributions.

Option A: Install via Native Repositories

On Arch Linux and its derivatives:

sudo pacman -S moar

On Alpine Linux (Edge repository):

sudo apk add moar

Option B: Download the Official Pre-Compiled Binary

For Ubuntu, Debian, Fedora, openSUSE, and enterprise Linux installations, download the official release directly from GitHub:

# Download the latest binary archive
curl -LO https://github.com/walles/moar/releases/latest/download/moar-linux-amd64

# Grant execution permissions and install to system path
chmod +x moar-linux-amd64
sudo mv moar-linux-amd64 /usr/local/bin/moar

Option C: Install via Go

If you have Go installed on your system:

go install github.com/walles/moar@latest

Verify that the binary functions properly by checking its version:

moar --version

Step 2: Basic Usage and Reading Files

Opening any text document or source file in moar instantly renders it with line numbers and colour formatting:

# View a script with automatic syntax highlighting
moar app.py

# View system configuration files
moar /etc/fstab

Piping Command Output into moar

Like less, moar accepts standard UNIX input streams:

# Page through journalctl systemd logs
journalctl -b | moar

# Page through long directory listings
ls -la | moar

Step 3: Essential Navigation and Keyboard Shortcuts

Navigation in moar will feel familiar to users of Vim or less:

  • j or Down Arrow: Scroll down by one line.
  • k or Up Arrow: Scroll up by one line.
  • Space or Page Down: Scroll forward by one screen.
  • b or Page Up: Scroll backward by one screen.
  • g: Jump to the beginning of the document.
  • G: Jump to the end of the document.
  • /: Initiate an interactive text search. Type your query and press Enter. Press n to jump to the next occurrence, or N for the previous occurrence.
  • q: Quit the pager cleanly.

Step 4: Customising Colours and Display Settings

moar provides several customisation flags to tune the visual interface to your preferences:

Customising Syntax Highlight Themes

Switch between dark and light themes, or disable colouring when exporting terminal outputs:

# Use a high-contrast solarised theme
moar --style=solarized-dark main.rs

# Disable syntax highlighting entirely
moar --no-colors access.log

Enabling Line Wrapping or Truncation

By default, moar wraps long lines gracefully. If you prefer horizontal scrolling for wide data tables:

moar --no-linewrap database-dump.csv

Step 5: Setting moar as the Default System Pager

To ensure tools like git diff, git log, and man use moar automatically, configure your shell’s PAGER environment variable.

Open your shell configuration file (~/.bashrc or ~/.zshrc):

nano ~/.bashrc

Append the following configuration lines at the bottom of the file:

# Set moar as the primary system pager
export PAGER="moar"

# Optional: Configure default moar flags
export MOAR="--statusbar=bold --no-clear-on-exit"

Save the file and reload your shell environment:

source ~/.bashrc

Configuring Git Specifically

If you wish to retain less for system utilities while using moar exclusively for Git repositories:

git config --global core.pager "moar"

Verifying Terminal Pager Workflows

Test your new configuration by running git diff or opening a system manual page with man systemd. You will notice immediate responsive scrolling, vibrant syntax highlighting, and clean status bar feedback, modernising your command-line reading experience across all Linux workflows.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.