A terminal is often the fastest place to inspect a Markdown file. You are already in the repository, the file is plain text, and a command such as less README.md opens it immediately. That is enough when you need to check a heading, copy a command, or search for a phrase. It is not always enough when you need to understand the document as its author intended.
This guide explains the practical options for viewing Markdown from the command line, what a terminal Markdown viewer can render, and when to switch to a browser for diagrams, math, images, or wide tables.
Markdown does not require a special program. It is UTF-8 text, so the standard terminal tools work everywhere:
cat README.md
less README.md
cat prints the whole file and is useful for short notes or scripts. less is better for a long README because it lets you scroll, search with /, jump with g and G, and quit with q.
If you want line numbers while diagnosing a broken block, use:
less -N architecture.md
These commands display Markdown source. You will see characters such as #, backticks, pipes, and link destinations. That is often desirable during editing, but it is different from a rendered document.
The right tool depends on the question you are asking.
| Task | Source in less |
Terminal renderer | Browser renderer |
|---|---|---|---|
| Search for text | Excellent | Good | Good |
| Check exact syntax | Excellent | Limited | Limited |
| Read headings and lists | Acceptable | Good | Good |
| Read wide tables | Difficult | Varies | Good |
| View local images | No | Varies | Good |
| Render Mermaid | No | Usually no | Yes |
| Render LaTeX math | No | Varies | Yes |
| Print or save as PDF | No | No | Yes |
A source view tells you exactly what is in the file. A rendered view tells you what a reader will see. Technical documents usually need both checks.
Several command-line and TUI applications add color, spacing, and formatted headings to Markdown. Their installation commands and supported features change over time, so check the project documentation before choosing one. In general, they fall into three groups.
A pager-style viewer renders one file in the current terminal and lets you scroll through it. This is the closest replacement for less. It is a good fit for READMEs, changelogs, release notes, and documentation that mainly contains prose and code blocks.
A Markdown TUI viewer may add a file browser, link navigation, search, themes, and keyboard shortcuts. It is more useful when you regularly browse a directory of local notes or documentation without leaving the terminal.
Terminal editors can highlight Markdown syntax and may offer a preview through a plugin or a separate browser process. This keeps editing close to the source, but the preview's feature support depends on its Markdown engine.
Before installing a tool, test it with the constructs your real files contain. A beautiful README preview does not prove that Mermaid diagrams, nested tables, task lists, footnotes, or formulas will work.
A Mermaid block is source code for a diagram:
```mermaid
flowchart LR
Source[Markdown source] --> Parser
Parser --> Diagram[Rendered diagram]
```
A basic command-line MD viewer can color that block, but producing the diagram requires a Mermaid parser and a graphical rendering environment. Terminal cells are designed for characters, not an interactive SVG canvas. Some workflows render Mermaid to an image first and then use a terminal image protocol, but that adds dependencies and behaves differently across terminal applications.
For a document containing diagrams, use the terminal to inspect or edit the source, then open the complete Markdown document in a renderer with Mermaid support. The existing guide to a Markdown viewer with Mermaid support explains what to test beyond a single diagram.
Use a short source-to-render loop instead of expecting one program to solve every stage.
less README.md.git diff -- README.md.If you only need to read the formatted file, follow the steps in How to Open an MD File Online. If the file is generated in CI or by a coding agent, the Markdown render verification CLI guide covers a repeatable verification and PDF-export workflow.
Opening a file in a terminal keeps it on your machine. A browser workflow may also process files locally, or it may upload them; check the product's behavior before using confidential material.
Relative images and links deserve a separate check. A source such as  depends on the Markdown file's location. Moving only the .md file breaks that relationship. A terminal viewer may not show the image at all, while a browser preview may expose the missing path immediately. See how local Markdown files handle images and relative links for portable alternatives.
Use cat or less when you want speed, exact source, searching, piping, or remote-server access. Use a terminal Markdown reader when most documents are prose and code and you want a more comfortable reading experience without leaving the shell. Use a browser renderer when the file contains Mermaid, LaTeX, images, complex tables, or anything you intend to print or share.
The terminal remains the best place to work with the source. It does not have to be the final place you judge the rendered document.