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.
Mastering cat by ivantis May 17, 2009
Mastering cat mug front
Get the Mastering cat mug.
See more merch
The word 'flag' as pronounced by people with thick Belfast accents. The term is a perfect encapsulation of the disproportionate and overblown reaction to the removal of the Union Jack (as in 'de fleg') from above City Hall in Belfast. Where previously it had flown for 365 days per year, it is now flown on 17 designated days of the year - in line with many other British cities.

The event caused a portion of the Protestant community ('fleggers') to make international pricks of themselves as they proceeded to wreck the fucking place, claiming it was another erosion of a 'British' identity they perceive to have been under attack since the horrifying spectre of equality reared its head in Northern Ireland.

The word 'fleg' - and indeed 'fleggers' - fittingly describes a section of humanity unconcerned with knowledge, reality or the vagaries of the English language. Like America's tea-baggers they are ruled by instinct, fear and paranoia with a side dish of rampant bigotry and startling ignorance of the world around them.
"Wat de fuck like! The taigs got de fleg took down! Let's wreck de fuckin place! No surrender!"

"De fleg has been took down! Before ye know it there'll be a united Ireland! Attack Short Strand! God Save The Queen!"
Fleg by OnionFleg August 9, 2013
Word of the Day on July 18, 2026
To take something small, that doesn't quite qualify as a theft. Probably from the Danish "skæv" or the Dutch "scheef", both of which are pronounced similarly, meaning "askew, or not quite right'. To change an item's ownership without permission, but only something small and of little worth.
"I skeefed an apple off the neighbor's tree." "I skeefed some chips outta your bag when you looked away." "Don't skeef my chair when I go to the bathroom."
Skeef by kachinaflonk July 16, 2026
Word of the Day on July 17, 2026

Hair spider

A tight, tangled knot of loose hair and lint that forms inside clothing during the clothes dryer cycle. It typically hides inside garments, causing an annoying lump or a phantom tickling sensation against the skin until it is found or falls out onto the floor during folding.
I was folding my clothes and a huge hair spider fell out onto my hand
Hair spider by Kmorsels July 15, 2026
Word of the Day on July 16, 2026
n. A screenshot fabricated by a company to misrepresent the graphics of a game; a combination of the words bullshit and screenshot.

Originated from Penny Arcade, a popular gaming webcomic.
-Have you seen Madden 2006 for the Xbox 360? The graphics are gonna be awesome!
-Dude, the Madden 2006 images they showed at E3 were bullshots. It doesn't look nearly as good as they said.
bullshot by Worker Unit #503,298,545 September 26, 2005
Word of the Day on July 15, 2026

Gayborhood 

N. A neighborhood containing homes, clubs, bars, restaurants, and other places of business and entertainment that cater to homosexuals.
"They've opened up a new club in the Gayborhood called the Male Box."
Gayborhood by Mia Shields January 6, 2006
Word of the Day on July 14, 2026
A small piece of information. Derived from the word ken, used often in the scottish language and is synonymous with knowledge.
Person 1: "Hey I don't get this shit. How do you solve this problem?"
Person 2: "I got that one. Give me some kenlets on this assignment and I'll help you w/ that one."
kenlet by Norma Y. October 8, 2005
Word of the Day on July 13, 2026