ahh

~$ which cat

tac

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?

of course look meow meow so loud

whereis cat?

which cat

whatis cat?

man cat

locate cat

rtfm

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. 😂

Another all-time favorite:

$ man woman  
No manual entry for woman  
$ touch woman
touch: cannot touch 'woman': Permission denied

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

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

yeah I just checked it out it's cute

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

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.

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

program <file | grep | cut

And <file program | grep | cut works too

Thanks - I didn't know this either!

Oh, thanks! Didn't know that

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

< file.txt grep thing also works.

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

Also known as cat abuse.

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

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

A kernel?

uhmm no

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.

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

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

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

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

Is there any downside?

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.

man which

tac is a cat but faced the other way

ohhh let me check it out lol

midwest.social

Rules

  1. No porn.
  2. No bigotry, hate speech.
  3. No ads / spamming.
  4. No conspiracies / QAnon / antivaxx sentiment
  5. No zionists
  6. No fascists

Chat Room

Matrix chat room: https://matrix.to/#/#midwestsociallemmy:matrix.org

Communities

Communities from our friends:

Donations

LiberaPay link: https://liberapay.com/seahorse