---
title: "TIL: Debugging Pipelines With the tee Command"
description: tee reads from stdin and writes to stdout and files at the same time. Debug complex shell pipelines and save intermediate data without breaking the chain.
canonical: https://lukeocodes.dev/til-debugging-pipelines-tee
type: article
locale: en_GB
published: 2026-05-26T00:00:00.000Z
modified: 2026-05-26T00:00:00.000Z
authors:
  - Luke Oliff
section: TIL
tags:
  - TIL
  - Engineering
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/til-debugging-pipelines-tee#article
        headline: "TIL: Debugging Pipelines With the tee Command"
        alternativeHeadline: "TIL: Debugging Pipelines With the tee Command"
        description: tee reads from stdin and writes to stdout and files at the same time. Debug complex shell pipelines and save intermediate data without breaking the chain.
        datePublished: 2026-05-26T00:00:00.000Z
        dateModified: 2026-05-26T00:00:00.000Z
        url: https://lukeocodes.dev/til-debugging-pipelines-tee
        mainEntityOfPage: https://lukeocodes.dev/til-debugging-pipelines-tee
        inLanguage: en
        author:
          - "@id": https://lukeocodes.dev/authors/luke#person
        isPartOf:
          "@id": https://lukeocodes.dev/#website
        keywords: TIL, Engineering
        articleSection: TIL
        abstract: How do you see what's happening in the middle of a pipeline without breaking it? tee.
        speakable:
          "@type": SpeakableSpecification
          cssSelector:
            - .post-tldr
            - h1
        image: https://lukeocodes.dev/blog/til-debugging-pipelines-tee/hero.png
        wordCount: 402
        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: "TIL: Debugging Pipelines With the tee Command"
            item: https://lukeocodes.dev/til-debugging-pipelines-tee
---

[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)

# TIL: Debugging Pipelines With the tee Command

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

How do you see what's happening in the middle of a pipeline without breaking it? `tee`.

```bash
curl -s https://api.example.com/v1/models | tee models-raw.json | jq '.data[] | {id, status}'
```

`tee` reads from stdin and writes to stdout AND one or more files. The pipeline keeps running. You get the filtered output AND a saved copy of the raw response.

Instead of rerunning the request or commenting out half the pipe, add `tee filename` wherever you need a snapshot.

## The pattern I use most

For API debugging:

```bash
curl -s "https://api.deepgram.com/v1/projects/$PROJECT_ID/requests?limit=50" \
  -H "Authorization: Token $DEEPGRAM_API_KEY" \
  | tee raw-response.json \
  | jq -r '.requests[] | "\(.created): \(.status) \(.path)"'
```

This saves the full API response to `raw-response.json` while piping a filtered view to stdout. If the output looks wrong, you open the saved file and inspect the full response structure without calling the API again.

The `-a` flag appends instead of overwriting, which is useful for logging across multiple requests in a loop:

```bash
for id in $(cat model-ids.txt); do
  curl -s "https://api.example.com/status/$id" | tee -a status-log.json | jq '.name'
done
```

## Why this beats rerunning

Every API call is a different moment in time. A cached or rate-limited response might not reproduce the same result. Saving the actual response that produced your filtered output gives you a forensic record of exactly what the API returned when you asked.

`tee` has been in Unix since the 1970s. It's in every shell, every CI image, every Docker container. No install step. It's just there.

### FAQ

#### What does the tee command do?

`tee` reads from standard input and writes to standard output and one or more files simultaneously. It splits the data stream so you can inspect intermediate results, log output for later analysis, or duplicate a pipeline without restarting it.

#### When would I use tee instead of redirect?

Use redirect (`>`) when you only need the output saved to a file and don't need to see it on screen. Use `tee` when you want both: the output on screen AND saved to a file. `tee` is for debugging and logging mid-pipeline, not for final output capture.

#### Can tee handle binary data?

Yes. `tee` works at the byte level and handles binary data without corruption. It doesn't interpret the stream, it just copies it. Use it to capture raw audio files mid-pipeline when testing streaming transcription workflows.

[← Newer: What multilingual voice agents cost: latency and complexity](/what-multilingual-voice-agents-cost)

[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)
