this post was submitted on 03 Aug 2026
292 points (97.7% liked)

Programmer Humor

32589 readers
590 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
top 46 comments
sorted by: hot top controversial new old
[–] rumba@lemmy.zip 4 points 3 hours ago (1 children)
[–] Sprocketfree@sh.itjust.works 1 points 2 hours ago (1 children)

I've always wondered what a good use case for tac would be...

[–] rumba@lemmy.zip 1 points 2 hours ago

Reverse chronological order, mostly

tac log.txt |head # would give you newest first

no good for sort because sort already supports -r

no need it for tail on large files because tail already skips to the end.

I do a lot of impromptu bash to sus crap out of logs.

when you're balls deep in

cat log|grep -v foo| rev|cut -f 1-3 -d \ | |rev

Sometimes tac comes in clutch.

[–] TwilightKiddy@scribe.disroot.org 6 points 6 hours ago (1 children)

I always thought it's

head | cat | tail

It, of course, waits for an input, which brings up the one and only question...

Have you fed your cat?

[–] shark_byte@lemmy.zip 1 points 4 hours ago

of course look meow meow so loud

[–] dan@upvote.au 62 points 15 hours ago* (last edited 15 hours ago) (6 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).

[–] ranzispa@mander.xyz 8 points 9 hours ago (1 children)

Fair, but in general I find it way more useful to use cat for piping.

In most cases I'll do something like

cat file | program
cat file | program | grep
cat file | program | grep | cut

This gets more complicated if the file is at the end of the command.

[–] dan@upvote.au 6 points 8 hours ago (1 children)

It wouldn't be at the end, since you'd still be piping into program

program <file | grep | cut
[–] jxk@sh.itjust.works 5 points 8 hours ago (2 children)

And <file program | grep | cut works too

[–] dan@upvote.au 1 points 4 hours ago

Thanks - I didn't know this either!

[–] ranzispa@mander.xyz 2 points 7 hours ago

Oh, thanks! Didn't know that

[–] pedz@lemmy.ca 50 points 14 hours ago (1 children)
[–] shark_byte@lemmy.zip 13 points 14 hours ago (2 children)

awww what's a cat without a head and a tail?

[–] ranzispa@mander.xyz 5 points 9 hours ago

I guess depending on your interpretation of without it could either be "cat" or "a".

[–] MonkderVierte@lemmy.zip 9 points 14 hours ago (1 children)
[–] shark_byte@lemmy.zip 5 points 14 hours ago
[–] eager_eagle@lemmy.world 7 points 9 hours ago (1 children)

I still like doing cat file.txt | grep thing because I often re-run it to find something else like cat file.txt | grep thing2 - and if I do that with grep, the pattern sits awkwardly in the middle instead of at the end

[–] tgt@programming.dev 8 points 9 hours ago

< file.txt grep thing also works.

[–] qqq@lemmy.world 9 points 10 hours ago (1 children)

You'll see cat FILE | all the time because it's just a natural start to a pipeline. You cat FILE to see the content unfiltered before filtering it with further commands.

it’s just a natural start to a pipeline

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

If it 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.

[–] dan@upvote.au 8 points 8 hours ago* (last edited 8 hours ago) (1 children)

Admittedly I still use cat for this.

This also works too, but it's more verbose:

echo "$(<foo.txt)"

It's mentioned in the Bash man pages:

The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).

[–] not_IO@lemmy.blahaj.zone 1 points 1 hour ago

how in the world is this not a useless use of echo and equivalent to <foo.txt

[–] mote@lemmy.ca 14 points 13 hours ago

So close! you have to do cat < foo.txt :-) (/s)

[–] shark_byte@lemmy.zip 12 points 15 hours ago (1 children)

yeah sure but the command is literally written for the humor.

[–] dan@upvote.au 13 points 14 hours ago (2 children)

I know, but I just wanted to mention this since a lot of new Linux users end up using cat this way :)

[–] Grail@multiverse.soulism.net 3 points 7 hours ago

Is there any downside?

[–] shark_byte@lemmy.zip 3 points 14 hours ago

ohhh but it's all humor that's the point of the post.

I mean as a new Linux user, I won't take anything from a humor group seriously.

[–] A_norny_mousse@piefed.zip 20 points 12 hours ago (1 children)

Another all-time favorite:

$ man woman  
No manual entry for woman  
[–] TwilightKiddy@scribe.disroot.org 11 points 6 hours ago
$ touch woman
touch: cannot touch 'woman': Permission denied
[–] Avicenna@programming.dev 3 points 8 hours ago* (last edited 8 hours ago) (1 children)
[–] LedgeDrop@lemmy.zip 6 points 8 hours ago (1 children)
[–] Avicenna@programming.dev 3 points 7 hours ago (1 children)
[–] cypherpunks@lemmy.ml 4 points 7 hours ago (1 children)
[–] Avicenna@programming.dev 2 points 4 hours ago
[–] exu@feditown.com 9 points 11 hours ago (2 children)

I've been using a slightly customized bash-cat for years now. Still makes me smile when I see it

[–] A_norny_mousse@piefed.zip 1 points 4 hours ago* (last edited 4 hours ago)

last commit message: "Shorter Cat with added Tail." 👍

[–] shark_byte@lemmy.zip 4 points 11 hours ago

yeah I just checked it out it's cute

[–] red_tomato@lemmy.world 17 points 14 hours ago (1 children)

tac is a cat but faced the other way

[–] shark_byte@lemmy.zip 9 points 14 hours ago

ohhh let me check it out lol

[–] reader@lemmy.zip 2 points 9 hours ago (1 children)
[–] selarian@lemmy.world 1 points 7 hours ago (1 children)

Be careful now, 2000/2010 Linux terminology can be taken as an insult in 2026. /s

I’m tired of this stupid coddling bullshit with the influx of new Linux users. If you can’t read don’t use Linux. Simple. 😂

[–] piccolo@sh.itjust.works 1 points 1 hour ago

But wheres the manual??

[–] anotherspinelessdem@lemmy.ml 7 points 12 hours ago (1 children)
[–] darth_grunkus@lemmy.world 8 points 8 hours ago* (last edited 8 hours ago)