Live data from Hacker News

PSA about abuse of cat(1) command. Don't abuse cats

abuseofcats.com

1–10 of 62 posts

Re: PSA about abuse of cat(1) command. Don't abuse cats

#3
> Since 1995, occasional awards for UUOC have been given out, usually by Perl luminary Randal L. Schwartz

http://catb.org/jargon/html/U/UUOC.html

Admittedly its taken me a long time to remember that the file is the last argument to grep, when so many other commands its the first. I'd guess common abuse is due to being easier to type cat x | than to dig up the man page

Re: PSA about abuse of cat(1) command. Don't abuse cats

#6
In this day an age this is still making rounds ? So this is the memory usage of cat on my system:

     VSZ   RSS    SZ CMD
    3252  1608   813 /bin/cat
To me there are far more things to worry about than cat. How about your multi-gig browser for one ?

Now for firefox:

        VSZ    RSS     SZ CMD
    3472212 395968 868053 /usr/lib64/firefox/firefox
Maybe people should be looking at that ? I will not even get into modern Linux Desktops :)

Re: PSA about abuse of cat(1) command. Don't abuse cats

#7
post #3

> Since 1995, occasional awards for UUOC have been given out, usually by Perl luminary Randal L. Schwartz http://catb.org/jargon/html/U/UUOC.html Admittedly its taken me a long time to remember that the file is the last argument to grep, when so many other commands its the first. I'd guess common abuse is due to being easier to type cat x | than to dig up the man page

And also typing cat x to get a quick look at the file, hitting up, then piping that into another command and taking a look, hitting up, piping that result into a third command etc.

Re: PSA about abuse of cat(1) command. Don't abuse cats

#8

[flagged]

Chances are the file stays the same and what Im grepping for changes, so after the first run, it was less work for me not needing to go back as far in the command

    cat file | grep thingone
    cat file | grep thingtwo
Vs

    grep thingone file
    grep thingtwo file

Re: PSA about abuse of cat(1) command. Don't abuse cats

#9

[flagged]

Chances are the file stays the same and what Im grepping for changes, so after the first run, it was less work for me not needing to go back as far in the command cat file | grep thingone cat file | grep thingtwo Vs grep thingone file grep thingtwo file

That's fine. It's fine to do the thing that brings you joy.

Re: PSA about abuse of cat(1) command. Don't abuse cats

#10
Presumably written by someone without much interactive shell experience.

When you're building a pipeline, putting cat first can often be quite convenient. Essentially, it's more composable: it defines the input to the pipeline without committing to a specific tool. For example, you can up-arrow in the shell and change the part after the pipe without having to skip back past the filename.

In fact if you don't start with cat, it's possible you're more of a script kiddie than a software developer.

Post reply on HN