Do we still need the cat?

  2017-07-28


What is meant with the cat? In this case I mean the cat command. This command just prints the content of a file.

Here a some use-cases:

  1. cat it to the terminal: This works fine, if you got a short content. If the file is long it’s just annonying. Well, you can see the tail of the cat. Sometimes you may just want to the the head oder the tail of the cat. You also could use less. Sometimes less is more.

  2. pipe the cat: sounds horrible. Just don’t do that. If you would do that, you’re a evil person. Ah! I forgot…it’s about the command. You could pipe, write or append the output of the command to another file.

    1. write to a file: and you got a plain text copy of the cat. If you imagine an image-file, it’s not a exactly copy of the file
    2. append: Got no use case for something like that. Why the hack should someone do that? Please leave a comment.
    3. pipe: Why you should do such evil things? You could just take the file and grep it or whatever you want. Or are you not so sure what you are doing?

Wait! The cat has some awesome killer-features. For example the -T option. That will turn the cat into a big Tiger and err no. But it’s a cool feature that displays TAB characters as ^I. Maybe you could combine this wih some other commands.

And that is an essence of it all. Sometimes a command seems to be obsolete, but in fact you can use this simple command in scripts and/or combine it with other commands.