<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/abuseofcats-com-stop-abusing-cat-1--fikzkjwkp" -->

---
title: abuseofcats.com — stop abusing cat(1) | daily.dev
description: A short public service announcement pointing out the common misuse of the cat(1) command in Unix/Linux shell pipelines. When cat is used solely to feed a...
canonical: https://daily.dev/posts/abuseofcats-com-stop-abusing-cat-1--fikzkjwkp
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: abuseofcats.com — stop abusing cat(1) | daily.dev
og:description: A short public service announcement pointing out the common misuse of the cat(1) command in Unix/Linux shell pipelines. When cat is used solely to feed a...
og:url: https://daily.dev/posts/abuseofcats-com-stop-abusing-cat-1--fikzkjwkp
og:image: https://api.daily.dev/og/posts/FIKZkjwKp.png
og:image:alt: abuseofcats.com — stop abusing cat(1)
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# abuseofcats.com — stop abusing cat(1)

**[Hacker News](https://daily.dev/sources/hn)** · 1 min read · 16 upvotes · 5 comments

## Summary

A short public service announcement pointing out the common misuse of the cat(1) command in Unix/Linux shell pipelines. When cat is used solely to feed a single file into another command (like grep, wc, head, awk, or sort), it spawns an unnecessary process — because most of those tools can open files directly. cat's actual purpose is concatenating multiple files. Several before/after examples illustrate the correct, more efficient alternatives.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.abuseofcats.com/>

## Questions this post answers

### Is it wasteful to pipe cat into grep like cat file | grep pattern?

Yes, it spawns an unnecessary process because grep can open and read files directly. The equivalent command grep pattern file achieves the same result without the extra cat process. This applies to other tools too: wc -l < file instead of cat file | wc -l, head -n 5 file instead of piping, and sort file instead of cat file | sort.

_daily.dev surfaces shell scripting tips like this for developers refining their command-line habits._

## Community discussion

Top comments from developers on daily.dev.

**@trevorsuna** · 3 upvotes

> Fair point, although I still use cat sometimes when it makes a pipeline easier to scan. Saving one process is nice, but clear shell code wins for me when the script isn’t in a hot path.

**@ltlr** · 0 upvotes

> I'm aware of that and still do it all the time. It just fits my mental model of piped commands better.

**@akashskypatel** · 0 upvotes

> ![GIF](https://static.klipy.com/ii/8ce8357c78ea940b9c2015daf05ce1a5/06/f3/8ZhpQ7co.gif)

## Similar posts on daily.dev

- [rejected feature requests](https://daily.dev/posts/rejected-feature-requests-rl5ci4xgq) · Lobsters · 0 upvotes · 0 comments

---

Tags: [#linux](https://daily.dev/tags/linux), [#cli](https://daily.dev/tags/cli), [#shell](https://daily.dev/tags/shell)

[View this post on daily.dev](https://daily.dev/posts/abuseofcats-com-stop-abusing-cat-1--fikzkjwkp)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"abuseofcats.com — stop abusing cat(1)","url":"https://daily.dev/posts/abuseofcats-com-stop-abusing-cat-1--fikzkjwkp","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/abuseofcats-com-stop-abusing-cat-1--fikzkjwkp"},"datePublished":"2026-07-18T02:40:20.748Z","dateModified":"2026-09-14T08:53:11.154Z","description":"A short public service announcement pointing out the common misuse of the cat(1) command in Unix/Linux shell pipelines. When cat is used solely to feed a...","image":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","thumbnailUrl":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","isAccessibleForFree":true,"articleSection":"Hacker News","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Hacker News","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/hn","url":"https://daily.dev/sources/hn"},"commentCount":5,"discussionUrl":"https://daily.dev/posts/abuseofcats-com-stop-abusing-cat-1--fikzkjwkp","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":16},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":5}],"keywords":"linux,cli,shell","timeRequired":"PT1M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hacker News","item":"https://daily.dev/sources/hn"},{"@type":"ListItem","position":3,"name":"abuseofcats.com — stop abusing cat(1)"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/abuseofcats-com-stop-abusing-cat-1--fikzkjwkp","comment":[{"@type":"Comment","text":"Fair point, although I still use cat sometimes when it makes a pipeline easier to scan. Saving one process is nice, but clear shell code wins for me when the script isn’t in a hot path.","datePublished":"2026-07-18T03:42:12.837Z","url":"https://daily.dev/posts/FIKZkjwKp#c-yk8xq3S5s","author":{"@type":"Person","name":"Trevor Suna","url":"https://daily.dev/trevorsuna","image":"https://media.daily.dev/image/upload/s--dZ7gXxpp--/f_auto/v1784081551/avatars/avatar_EMoP47rpuw8DNjhp6R1b6?_a=BAMAMicg0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3}},{"@type":"Comment","text":"I’m aware of that and still do it all the time. It just fits my mental model of piped commands better.","datePublished":"2026-07-20T09:36:12.763Z","url":"https://daily.dev/posts/FIKZkjwKp#c-c8vzRatjO","author":{"@type":"Person","name":"Leo","url":"https://daily.dev/ltlr","image":"https://avatars1.githubusercontent.com/u/24603641?v=4"}},{"@type":"Comment","text":"","datePublished":"2026-07-22T19:58:56.635Z","url":"https://daily.dev/posts/FIKZkjwKp#c-Yxb4sxp1g","author":{"@type":"Person","name":"Akash","url":"https://daily.dev/akashskypatel","image":"https://avatars.githubusercontent.com/u/8129618?v=4"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/abuseofcats-com-stop-abusing-cat-1--fikzkjwkp#faq","mainEntity":[{"@type":"Question","name":"Is it wasteful to pipe cat into grep like cat file | grep pattern?","acceptedAnswer":{"@type":"Answer","text":"Yes, it spawns an unnecessary process because grep can open and read files directly. The equivalent command grep pattern file achieves the same result without the extra cat process. This applies to other tools too: wc -l < file instead of cat file | wc -l, head -n 5 file instead of piping, and sort file instead of cat file | sort. daily.dev surfaces shell scripting tips like this for developers refining their command-line habits."}}]}
```

