Skip to main content

Mastering cat

A fictitious (literally, it's not a real book) book about mastering the UNIX/Linux 'cat' command. "Written" by Shlomi Fish, the acclaimed author of 'Mastering rm', and 'Mastering mv'.
O'Reilly Net: Hi Shlomi!

Shlomi Fish: Hi!

O'Reilly Net: So, what has motivated you to write the book?

Shlomi Fish: Well, I realised people use cat so often that they don't take the time to fully investigate it and learn it. For example, many people I worked with believed that cat can only be used to output one file at a time. So to output several files they used something like:

(cat file1.txt ; cat file2.txt ; cat file3.txt) | command

The horror! cat accepts several files as arguments. So you can write it as:

cat file1.txt file2.txt file3.txt | command

This has motivated me to write the book, to make people fully understand the command.

O'Reilly Net: Isn't mastering cat supposed to be quite easy? Does it really necessitates its own book?

Shlomi Fish: Hell no! Mastering cat is not easy at all. In fact, mastering cat is almost as difficult as herding cats.

For example, one case where I found that people truly underestimate the power of cat is in the prefixing a line example. You can do that with:

echo "This would be the first line" | cat - myfile.txt > myfile.txt.new
mv -f myfile.txt.new myfile.txt

But people do not realize that and instead opted to use sed, awk, or even perl (!). It can be taken further, of course. If the prefix is already in its own file, you can simply use cat prefix.txt myfile.txt

Of course, if you want to append the same text to both the start and the end of a file, you can't do that with cat - myfile.txt -. It simply doesn't work that way. So, I end up explaining a lot about UNIX pipeline concepts in the book.

O'Reilly Net: So what else does your book cover?

Well, I cover many things there. Among them are:

1. History of the cat command.

2. Differences between the various cat implementations. (GNU, the BSDs, System V, etc.)

3. cat equivalents in other operating systems (DOS, Win32, VMS, OS/390, etc.)

4. Overview of the GNU cat codebase (for programmers).

I'm also focusing on the various cat flags, which aid in its interactive use. For example the -E/--show-ends flag, that places dollar signs at the end of the lines.

Except for that I'm also covering dog which is a program that provides a superset of the cat program. I should also mention mouse which aimed to provide an even greater superset, and was never released. Rumors say some parts of it are based on code of the leaked Windows 2000 sources.

O'Reilly Net: Your book seems bound to be popular. (for some values of popularity) What can we expect from you next?

Shlomi Fish: Well, I hope many people will buy the book, or read it online so they'll be educated about cat. If you like "Mastering cat", look forward to my next book - "Mastering echo". I expect it to be published next fall.
by ivantis May 17, 2009
mugGet the Mastering cat mug.

Eastern cowboy

to have BMW, a shaven head, a leather jacket and hailing from Poland.
by Darius April 25, 2003
mugGet the Eastern cowboy mug.

Eastern Passage

Pronunciation: 'E-st&rn 'pa-sij
Function: noun
An American slang term for one's anal orifice or opening
Tonight, my boyfriend will pound my Eastern Passage for the first time without using a condom or lube; it's going to hurt.
by Vigilance September 9, 2008
mugGet the Eastern Passage mug.

Eastern Shore

"Eastern Shore"
The eastern part of Maryland across the bay from Baltimore. Starts from Cecil county down to Ocean City. A place of many rednecks and southern folk who all love 2 things and 2 things only, old bay and crabs. Winter is rainy and cold from November to March or maybe April? Summers are long with lots boats on the water tractors in the fields and Pennsylvanians, Jersians, and New yorkers coming to vacation in the hot and humid weather. Rebel and American flags are commonly seen outside or even inside homes as well as some kind of off-road vehicle or boat in the garage or barn adjecant to the residence.
"Have you ever been to the Eastern Shore?" "
Yep! I got fat on crabs for a week straight!"
by shoremafia October 9, 2016
mugGet the Eastern Shore mug.

Eastern Kentucky University

One of the best universities for people who should not be in school. They could save time by skipping this step and going directly to work at McDonald's.
1. -"Did you go to college?"
-"No, I went to Eastern."

2. "Be careful driving by EKU with your windows down. I was driving in that area yesterday and an administrator threw a degree into my back seat."
by Nick S. December 9, 2004
mugGet the Eastern Kentucky University mug.

Eastern Kentucky University

School in Richmond, Kentucky. Home of the Colonels. Has many colleges of such things as business, technology, education, public safety, and arts & sciences. Often considered the red (or in this case marron) headed step child of the University of Kentucky.
I couldn't get into UK so I go to Eastern Kentucky University.
by Andy June 15, 2004
mugGet the Eastern Kentucky University mug.

The Middle Eastern Market Place

A gas/ convenient store located on Charlotte street in Asheville, NC ran by very friendly middle eastern people. You can buy anything from Cheetos, Miller High Life 40's, Knifes, or even some "tobacco" accessories. Another name for it is The Haitian Station.
Q: Ay where did you get this boss ass knife?
A: The Middle Eastern Market Place, the knives are right next to the bowls and damiana.
by ashevillesfavoritecrackhead November 25, 2010
mugGet the The Middle Eastern Market Place mug.

Share this definition

Sign in to vote

We'll email you a link to sign in instantly.

Or

Check your email

We sent a link to

Open your email