this post was submitted on 03 Aug 2026
347 points (97.8% liked)

Programmer Humor

32608 readers
710 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 3 years ago
MODERATORS
 

ahh

~$ which cat
you are viewing a single comment's thread
view the rest of the comments
[–] dan@upvote.au 70 points 19 hours ago* (last edited 19 hours ago) (25 children)

cat is misunderstood a lot. The purpose of cat is to combine multiple files together (it's literally short for "concatenate"), like cat *.log to combine all log files together.

If you're just using it for a single file, then you should just redirect the file to stdin. These two command lines behave similarly:

cat foo.txt | some-command
some-command < foo.txt

For head, tail, grep and some other commands, you can just pass in the file name directly as an argument (e.g. grep whatever foo.txt).

[–] lokalhorst@feddit.org 14 points 17 hours ago* (last edited 17 hours ago) (5 children)

If I just want to look at the file, is there a better way than cat foo.txt? I guess I can't just do < foo.txt

You can use less. There are also specialized ones for that purpose like bat.

load more comments (4 replies)
load more comments (23 replies)