---
title: "Friday fun: bat is cat with syntax highlighting"
description: bat shows file contents with syntax highlighting, line numbers, and a pager. It replaces cat with the same muscle memory and a lot more useful output.
canonical: https://lukeocodes.dev/bat-is-cat-with-syntax-highlighting
type: article
locale: en_GB
published: 2026-05-01T00:00:00.000Z
modified: 2026-05-01T00:00:00.000Z
authors:
  - Luke Oliff
section: TIL
tags:
  - TIL
  - Engineering
  - Open Source
feed: https://lukeocodes.dev/rss.xml
search: https://lukeocodes.dev/search.json?q={query}
schema:
  - "@context": https://schema.org
    "@graph":
      - "@type": Organization
        "@id": https://ably.com/#organization
        name: Ably
        url: https://ably.com
      - "@type": WebSite
        "@id": https://lukeocodes.dev/#website
        url: https://lukeocodes.dev
        name: Luke Oliff
        alternateName: lukeocodes
        inLanguage: en
        publisher:
          "@id": https://lukeocodes.dev/authors/luke#person
        description: Personal blog and writing by Luke Oliff — developer relations, voice AI, developer experience.
        potentialAction:
          - "@type": SearchAction
            target:
              "@type": EntryPoint
              urlTemplate: https://lukeocodes.dev/blog/search?q={search_term_string}
            query-input: required name=search_term_string
      - "@type": Person
        "@id": https://lukeocodes.dev/authors/luke#person
        name: Luke Oliff
        url: https://lukeocodes.dev/authors/luke
        description: Staff engineer and Staff Tech Lead for Developer Experience at Ably. Writing about developer relations, AI, and the voice industry, from the UK.
        mainEntityOfPage: https://lukeocodes.dev/authors/luke
        givenName: Luke
        familyName: Oliff
        image: https://lukeocodes.dev/authors/luke.jpg
        jobTitle: Staff Tech Lead, Developer Experience
        worksFor:
          "@id": https://ably.com/#organization
        sameAs:
          - https://www.linkedin.com/in/lukeocodes
          - https://github.com/lukeocodes
          - https://bsky.app/profile/lukeocodes.dev
          - https://x.com/lukeocodes
          - https://hashnode.com/@lukeocodes
          - https://dev.to/lukeocodes
        knowsAbout:
          - Developer Relations
          - Developer Experience
          - Voice AI
          - Text-to-Speech
          - Answer Engine Optimisation
          - Search Engine Optimisation
          - Open Source
          - Developer Tooling
          - API Design
          - Speech-to-Text
          - Voice Agents
          - Community Building
        knowsLanguage:
          - English
        nationality: British
        alumniOf:
          - "@type": Organization
            name: The Open University
  - "@context": https://schema.org
    "@graph":
      - "@type": Organization
        "@id": https://ably.com/#organization
        name: Ably
        url: https://ably.com
      - "@type": Person
        "@id": https://lukeocodes.dev/authors/luke#person
        name: Luke Oliff
        url: https://lukeocodes.dev/authors/luke
        description: Staff engineer and Staff Tech Lead for Developer Experience at Ably. Writing about developer relations, AI, and the voice industry, from the UK.
        mainEntityOfPage: https://lukeocodes.dev/authors/luke
        givenName: Luke
        familyName: Oliff
        image: https://lukeocodes.dev/authors/luke.jpg
        jobTitle: Staff Tech Lead, Developer Experience
        worksFor:
          "@id": https://ably.com/#organization
        sameAs:
          - https://www.linkedin.com/in/lukeocodes
          - https://github.com/lukeocodes
          - https://bsky.app/profile/lukeocodes.dev
          - https://x.com/lukeocodes
          - https://hashnode.com/@lukeocodes
          - https://dev.to/lukeocodes
        knowsAbout:
          - Developer Relations
          - Developer Experience
          - Voice AI
          - Text-to-Speech
          - Answer Engine Optimisation
          - Search Engine Optimisation
          - Open Source
          - Developer Tooling
          - API Design
          - Speech-to-Text
          - Voice Agents
          - Community Building
        knowsLanguage:
          - English
        nationality: British
        alumniOf:
          - "@type": Organization
            name: The Open University
      - "@type": BlogPosting
        "@id": https://lukeocodes.dev/bat-is-cat-with-syntax-highlighting#article
        headline: "Friday fun: bat is cat with syntax highlighting"
        alternativeHeadline: "Friday fun: bat is cat with syntax highlighting"
        description: bat shows file contents with syntax highlighting, line numbers, and a pager. It replaces cat with the same muscle memory and a lot more useful output.
        datePublished: 2026-05-01T00:00:00.000Z
        dateModified: 2026-05-01T00:00:00.000Z
        url: https://lukeocodes.dev/bat-is-cat-with-syntax-highlighting
        mainEntityOfPage: https://lukeocodes.dev/bat-is-cat-with-syntax-highlighting
        inLanguage: en
        author:
          - "@id": https://lukeocodes.dev/authors/luke#person
        isPartOf:
          "@id": https://lukeocodes.dev/#website
        keywords: TIL, Engineering, Open Source
        articleSection: TIL
        about:
          - "@type": Thing
            name: Open Source
        abstract: I type cat at a terminal at least fifty times a day. It took me three years to realise there was something better.
        speakable:
          "@type": SpeakableSpecification
          cssSelector:
            - .post-tldr
            - h1
        image: https://lukeocodes.dev/blog/bat-is-cat-with-syntax-highlighting/hero.png
        wordCount: 483
        timeRequired: PT3M
        publisher:
          "@id": https://ably.com/#organization
      - "@type": BreadcrumbList
        itemListElement:
          - "@type": ListItem
            position: 1
            name: Home
            item: https://lukeocodes.dev
          - "@type": ListItem
            position: 2
            name: Writing
            item: https://lukeocodes.dev/blog
          - "@type": ListItem
            position: 3
            name: "Friday fun: bat is cat with syntax highlighting"
            item: https://lukeocodes.dev/bat-is-cat-with-syntax-highlighting
---

[Luke Oliff.](/)

- [Blog](/blog)
- [CV](/cv)
- [Uses](/uses)
- [User manual](/user-manual)
- [Living with ADHD](/living-and-working-with-adhd)
- [RSS](/rss.xml)

[Luke Oliff · Writing](/blog)

# Friday fun: bat is cat with syntax highlighting

May 2026 · [TIL](/blog/category/til) · 3 min read · [Luke Oliff](/authors/luke)

I type cat at a terminal at least fifty times a day. It took me three years to realise there was something better.

```bash
# what I used to type
cat package.json

# what I type now
bat package.json
```

Same two words. But bat gives you syntax highlighting, line numbers, a git gutter, and automatic paging for long files. You get all of it without changing your workflow or adding a new command to remember.

## What bat does differently

cat prints file contents to stdout with no formatting. That's fine until you're scanning a JSON file with 200 lines of nested objects and your eyes start crossing.

bat is a drop-in replacement that adds:

- syntax highlighting for 200+ languages and formats
- line numbers in the left gutter
- a git modification marker (shows which lines changed)
- automatic paging with less when the output is longer than your terminal
- theme support (Solarized, Dracula, Monokai, you name it)

```bash
bat --style=plain response.json
```

Pass `--style=plain` when you need to pipe the output. bat detects when stdout is not a TTY and acts like cat automatically, so scripts that use cat keep working.

## Why this matters for API work

At Deepgram I spent a lot of my day looking at JSON responses from the STT API. A raw transcript looks like a blob of text. With bat I could see the structure at a glance, spot the line with the confidence score, and jump straight to it using the line numbers.

```json
{
  "results": {
    "channels": [
      {
        "alternatives": [
          {
            "transcript": "hello world",
            "confidence": 0.98
          }
        ]
      }
    ]
  }
}
```

With cat, that all looks the same. With bat, the keys render in one colour, the strings in another, and the numbers stand out. Your brain processes the shape before you read a single word.

## How to try it

```bash
# macOS
brew install bat

# Linux (most distros)
apt install bat     # or your package manager equivalent

# Windows (scoop)
scoop install bat
```

Set an alias if you want to keep the cat muscle memory while using bat:

```bash
alias cat=bat
```

One line in your .zshrc or .bashrc and you're done.

## FAQ

### What happens when bat is used in a script that expects cat?

bat detects non-TTY output and disables all formatting. A script that pipes cat into grep or jq works the same with bat. No surprises.

### Does bat slow down for large files?

bat pages output through less automatically, so large files start rendering immediately and you scroll through them. cat dumps everything at once, which can slow your terminal down for multi-megabyte files.

### Can I change the colour theme?

Yes. Run `bat --list-themes` to see available options, then set `export BAT_THEME=Dracula` in your shell config. There are dozens of themes matching common editor colour schemes.

[← Newer: 5 habits that reduce voice AI debugging](/5-habits-voice-ai-debugging)

[All posts](/blog) →

## Search this site

`GET https://lukeocodes.dev/search.json?q=<words>` returns matching posts as JSON, each with its page URL and its markdown URL. Add `&limit=<1-50>` for more than 10. How it works: [/blog/search](https://lukeocodes.dev/blog/search.md).

```sh
curl "https://lukeocodes.dev/search.json?q=developer+relations"
```

---

© 2026 Luke Oliff. Posts live at the root of this site.

- [GitHub](https://github.com/lukeocodes)
- [LinkedIn](https://www.linkedin.com/in/lukeocodes)
- [X](https://x.com/lukeocodes)
- [Bluesky](https://bsky.app/profile/lukeocodes.dev)
- [Email](mailto:luke@lukeoliff.com)
- [RSS](/rss.xml)

## Cookies

This site sets one analytics cookie, from Google Analytics, and only in a browser that accepts the cookie banner. A client that does not run scripts sets no cookies, so there is nothing to accept or decline here.

[Cookie policy](/cookies)
