FreeBSD General Commands Manual


Cat - concatenate and print files


cat [-benstuv] [-] [file ...]


The cat utility reads files sequentially, writing them to the standard output. The file operands are processed in command line order. A single dash represents the standard input.

The options are as follows:

    -b Number the non-blank output lines, starting at 1.
    -n Number the output lines, starting at 1.
    -s Squeeze multiple adjacent empty lines, causing the output to be single spaced.
    -t Display non-printing characters (see the -v option), and display tab characters as `^I'.
    -u The -u option guarantees that the output is unbuffered.
    -v Display non-printing characters so they are visible. Control characters print as '^X' for control-X; the delete character (octal 0177) prints as '^?' Non-ASCII characters (with the high bit set) are printed as 'M-' (for meta) followed by the character for the low 7 bits.


The cat utility exits 0 on success, and >0 if an error occurs.


Because of the shell language mechanism used to perform output redirection, the command 'cat file1 file2 > file1' will cause the original data in file1 to be destroyed!


head(1), more(1), pr(1), tail(1), vis(1)

Rob Pike, "UNIX Style, or cat -v Considered Harmful", USENIX Summer Conference Proceedings, 1983.


A cat command appeared in Version 1 AT&T UNIX Dennis Ritchie designed and wrote the first man page. It appears to have been cat(1).

3rd Berkeley Distribution May 2, 1995

As Lister explained to Ace Rimmer about the guy with the broken leg and nice suit, "he doesn't have a name. We just call him Cat." The Cat is the suave sophisticated creature with the pointed teeth and stylish (and usually attention-grabbing) clothes. He was born and raised on the Red Dwarf, a member of a civilization of cat people who evolved from Dave's pet cat. He typically refers to the other crew members as monkeys, he tends to yowl quite a bit and spin around. He sprays everything he can find (modern cats carry around their scent in sprayer bottles). He plays with string as all cats do, and his favorite song was a damaged tape of Robert Hardy reads Tess of the d'Urbervilles. His favorite things are sex (which being the last surviving cat-person is kind of difficult), sleeping (he has to take enough naps he won't have enough energy for his main snooze), and eating (usually immediately after singing a song, "I'm gonna eat you little chickie" or "I'm gonna eat you little fishie"). He is completely self-centered as all cats are and thinks he is the most beautiful creature in existence. In fact, he is so self-centered that when the crew met a pleasure-gelf that would appear to every person as the object they most greatly desire, Cat met himself.

Cat is played by Danny John-Jules, and is the real-life uncle of Baby Lister seen in OUROBOROS. In the American Pilot version, cat was played by Hinton Battle in the first version and Terry Ferrell in the second version (the pilot didn't pass, so there is no American version of Red Dwarf -- sorry).

Note: I didn't realize there was a node called The Cat, but it makes sense. The Cat is referred to in Red Dwarf as both "Cat" and "The Cat". Typically, if they are speaking to him, they call him Cat. If they are talking about him, they call him The Cat. Anyway, check out The Cat for some more info on him.

Abbreviation, stock ticker, domain name, and popular nickname for Caterpillar, Inc. Also, shorthand for any of the numerous construction machines they manufacture (See "Tremors").

casting the runes = C = catatonic

cat [from `catenate' via Unix cat(1)] vt.

1. [techspeak] To spew an entire file to the screen or some other output sink without pause (syn. blast). 2. By extension, to dump large amounts of data at an unprepared target or with no intention of browsing it carefully. Usage: considered silly. Rare outside Unix sites. See also dd, BLT.

Among Unix fans, cat(1) is considered an excellent example of user-interface design, because it delivers the file contents without such verbosity as spacing or headers between the files, and because it does not require the files to consist of lines of text, but works with any sort of data.

Among Unix haters, cat(1) is considered the canonical example of bad user-interface design, because of its woefully unobvious name. It is far more often used to blast a file to standard output than to concatenate two files. The name cat for the former operation is just as unintuitive as, say, LISP's cdr.

Of such oppositions are holy wars made.... See also UUOC.

--The Jargon File version 4.3.1, ed. ESR, autonoded by rescdsk.

One Hell of a nice animal, frequently mistaken for a meatloaf.

Cat is a collection of cartoons by B. Kliban. It is his first book, and the work for which he will be remembered best. Sublimely silly, Kliban's cartoons range from the side-splittingly funny and sharply perceptive to the utterly mystifying.

It's gonna be a great year, mother.
Look at the whiskers on those cats.

Published in 1975 largely thanks to the enthusiasm of the cartoon editor of Playboy (the first magazine to use his cartoons), Cat made B. Kliban an overnight sensation. In the years that followed he published seven wonderful, best-selling books of virtually cat-free cartoons, but it was his cats which really caught the public imagination; before long there were Cat calendars, Cat towels, Cat T-shirts, Cat pillowcases. The Kliban cats became iconic; even if you have never heard the name, you will very likely have seen the cats about the place - rounded, round-eyed, stripey, sometimes wearing sneakers. Some people feel that if it hadn't been for Kliban's cat cartoons there would have been no Garfield, no Heathcliff, no Fat Freddy's Cat; there is no doubting his profound influence on the generation of cartoonists who followed him.

My cat is fat
So now I'll dine
And eat all up
This cat of mine.

Although B. Kliban himself died in 1990 and his cats have fallen from ubiquity, the Kliban Cat industry is still thriving. The official Kliban Cat shop site at sells a huge range of merchandising, including three kinds of calendar for 2002, four different mouse pads, eighteen different fridge magnets and an assortment of golf balls; a quick Google search turns up several more, less-official-looking sites which seem to carry their own range of Kliban Cat merchandising. Since Kliban's death his wife, Judith Kamann Kliban, has continued to work with the B. Kliban®Cats company on the creation of 'new Kliban concepts,' and on the continuing recycling of old ones into new products. is another official Kliban site with galleries, biographies, Flash animations and a recording of the eating mousies song to download.

I leave you with Kliban's concise feline lexicon. Since I cannot reproduce the accompanying cartoon here, I will have to ask you to imagine that there is a large, fat, slightly confused-looking cat just to the right of the list saying:


Cat Words

  1. Now?
  2. Wow
  3. Prowl
  4. Wackawacka*
  5. Crown?
  6. Pert
  7. Prang
  8. Marie?

* Not widely used.

See also:

The name of the cat in Breakfast at Tiffany’s. He hangs around the main character Holly Golightly throughout the movie. She refuses to give “cat” a name because she says he doesn’t belong to anyone.

A little excerpt from the script, right after the cat screeches

Paul AKA Fred: Is he alright? Holly: Sure. Sure, He’s O.K. aren’t you, cat? Poor old cat. Poor slob. Poor slob without a name. I don’t have the right to give him one. We don’t belong to each other. We just took up one day. I don’t want to own anything.

So she just calls him “cat” throughout the movie.


From Larousse Gastronomique :

CAT Chat -- Domestic cat whose edible meat has a flavor halfway between that of rabbit and that of hare. Cat's meat has often been eaten in periods of famine or siege. Legend has it that in the cook-shops the cat is often used in the making of rabbit fricassées. Examination of the bones would easily enable one, in case of doubt, to distinguish between the one animal and the other.

Not from Larousse Gastronomique :

Adding one half teaspoon of curry powder to your cat's food every day for the two weeks prior to preparation adds a subtle yet wonderful flavor to the resulting dish.

cat is one of the simplest UNIX commands that often makes people go 'why?' until they come upon some deeper enlightenment about the underlying nature of UNIX.

At its very basic cat is short for 'concatenate'. When run cat takes the files on the command line and prints them back to standard output in order. If only one file is given as arguments it only prints that one file.

Common to all versions of cat are a few options: benstuv. Some versions (most notably those of GNU and FSF distributions) have some others. For the examples - the following file will be used:

% cat file
This is a file

It has several lines.
And some bell special characters.
This line has 3 spaces after the.   
The line above has one space.

The -b option is one of two options for numbering lines - in different ways. If both are specified as options, this one is used. This option numbers lines that have any content in them (including white space and non-printable characters). Lines that don't are left blank and skipped in counting.

% cat -b file
     1  This is a file

     2  It has several lines.
     3  And some  special characters.
     4  This line has 3 spaces after the.   
     6  The line above has one space.


This option has two functions:

  1. print a '$' at the end of the line
  2. print control characters using the '^' notation
The -e option is at times split into two options in some versions, where -e becomes the equivalent of '-vE' to show non-printing characters and place the '$' at the end of the line as two distinct functions.
% cat -e file
This is a file$
It has several lines.$
And some ^G special characters.$
This line has 3 spaces after the.   $
The line above has one space.$


Similar to the -b option above, the -n option numbers the output lines. However, in this case, all lines are numbered - including those that are blank.

% cat -n file
     1  This is a file
     4  It has several lines.
     5  And some  special characters.
     6  This line has 3 spaces after the.   
     8  The line above has one space.


The -s option is short for 'squeeze'. This option will change multiple instances of a blank line to a single blank line. However the number of times this is blank is lost (if you want to maintain this information, consider the uniq program).

% cat -s file
This is a file

It has several lines.
And some  special characters.
This line has 3 spaces after the.   
The line above has one space.


Similar to the -e option above the -t option prints out control characters with the ^ notation. The -t option doesn't put the '$' at the end of the line and furthermore renders tabs as '^I' while -e (and -v) will print out a tab as a tab rather than its control character equivalent.

% cat -t file
This is a file

It has several lines.
And some ^G special characters.
This line has 3 spaces after the.   
The line above has one space.


The -u is mostly something left over from days of old though still does have occasional use. This option causes the output to be unbuffered. In many cases data being sent is sent in chunks from a buffer rather than as it is generated. This is often better to the network where each chunk of data (big or small) has the same overhead - and one big chunk is preferable to lots of small chunks of data. The output is only noticeable (and maybe not even then) if this was running across a network (rather than local system and one was snooping the traffic.


'-v' is the option that is at the core of '-e' and '-t' above. Without any fuss - the '-v' option prints out the file with control characters with the ^ notation. Not mention above (though still part of it), high ASCII characters are printed out as 'M-#' where '#' is the character for the lower 7 bits (the 'M' stands for 'meta' which is the key used to get these chracters on most UNIX systems).

% cat -v file
This is a file

It has several lines.
And some ^G special characters.
This line has 3 spaces after the.   
The line above has one space.

A special 'file' that may be used my many programs is that of '-'. Specifying '-' as a file instructs the program to read from standard input rather than a named file on the disk. As each line is entered, cat does as it is supposed to. If no files are specified, then standard input is read.

% cat -n - file
     1  abc
     2  def
     3  ghi
     4  This is a file
     7  It has several lines.
     8  And some  special characters.
     9  This line has 3 spaces after the.   
    11  The line above has one space.

On the flip side of the use of cat is what is known as 'cat abuse' in the UNIX world. Many of the regulars of comp.lang.perl often pointed out instances of when cat is used when it doesn't need to be.

An example of this can be seen:

From: Tom Christiansen <>
Subject: Re: Calculating word frequencies within files?
Date: 1997/01/18
Message-ID: <5br1i3$q5l$>
references: <>
content-type: text/plain; charset=ISO-8859-1
organization: Perl Consulting and Training
reply-to: (Tom Christiansen)
newsgroups: comp.lang.perl.misc

 [courtesy cc of this posting sent to cited author via email]

 In comp.lang.perl.misc, (Ed Falk) writes:
:    cat file |

cat abuse.

:    sed -e '/\./d' |  # remove troff directives
:    fmt -1  |         # one word per line
:    sort  |           # group words together
:    uniq -c  |        # produce counts
:    sort -rn          # sort by decreasing frequency.

Tom Christiansen      Perl Consultant, Gamer, Hiker

/* This is the one truly awful dwimmer necessary to conflate C and sed. */
--Larry Wall, from toke.c in the v5.0 perl distribution
In the above example one doesn't need to use cat - instead a of starting with
cat file |
sed -e '/\./d' |
This can be done with
sed -e '/\./d' file |

The kin of cat are head, tail, and more - though countless other programs exist to print files to the standard out (if one is a real glutton for punishment, dd is recommended). In the DOS world, this program is similar to the program type.

"Cat" is also a verb that has nothing to do with boats (see Mr. Webster's entry for the nautical version).

  1. To behave like a cat, generally in terms of stealthy, hedonistic nocturnal activities and sexual promiscuity. The latter may take on a compulsive, joyless edge if the person in question is being particularly catty.

    • Mike catted around for weeks after his breakup with Barbara. He'd slip in and out of the apartment at all hours; sometimes his bed wasn't slept in for days. Once he came home with a black eye he tried to hide with bronzer and refused to explain. I think he was determined to lay every available woman in town just to get back at Barb for dumping him for Sergio.

  2. To be immobilized by one or more housecats due to their cuteness, potential violence, or sheer weight.

    • I was just about to get up from my desk for some lunch when the new kitten jumped up into my lap. She rolled over adorably and gazed up at me with "pet me" eyes. I couldn't bear to move her off my lap. I was hopelessly catted.

    • Bob went to bed with the flu, shivering and miserable. When he awoke in the night, he found himself very hot and completely unable to move. He had a brief panic: had he had a stroke? Was he dying? Then he saw the furry shapes surrounding him. The twins lay across each of his feet; Roscoe lay between his knees. George was under his left arm, Wilma beside his right, and Peaches lay fluffy and huge across his chest. His blanket was weighed down with over 100 pounds of felines; he was well and thoroughly catted.

    • Octavia decided to cat me right after breakfast. She'd been in a bad mood ever since we'd gotten the new puppy, her feline pride and dignity injured beyond repair by the presence of the slobbering, jumping, yapping little creature that everyone felt compelled to ooh and aah over. "I'm sorry, honey, but I'm late for work." I put a hand under her heavy belly to move her off my lap, but she dug all four claws into my jeans, growled low in her throat and stared at me with an expression that clearly said "You will pet me, and pet me now, monkeyboy!"

Cat (?), n. [AS. cat; akin to D. & Dan. kat, Sw. kett, Icel. kottr, G. katze, kater, Ir. Cat, W. cath, Armor. kaz, LL. catus, Bisc. catua, NGr , , Russ. & Pol. cot, Turk. kedi, Ar. qitt; of unknown origin. CF. Ketten.]

1. Zool.

An animal of various species of the genera Felis and Lynx. The domestic cat is Felis domestica. The European wild cat (Felis catus) is much larger than the domestic cat. In the United States the name wild cat is commonly applied to the bay lynx (Lynx rufus) See Wild cat, and Tiger cat.

⇒ The domestic cat includes many varieties named from their place of origin or from some peculiarity; as, the Angora cat; the Maltese cat; the Manx cat.

The word cat is also used to designate other animals, from some fancied resemblance; as, civet cat, fisher cat, catbird, catfish shark, sea cat.

2. Naut. (a)

A strong vessel with a narrow stern, projecting quarters, and deep waist. It is employed in the coal and timber trade.


A strong tackle used to draw an anchor up to the cathead of a ship.



A double tripod (for holding a plate, etc.), having six feet, of which three rest on the ground, in whatever position in is placed.


An old game; (a) The game of tipcat and the implement with which it is played. See Tipcat. (c) A game of ball, called, according to the number of batters, one old cat, two old cat, etc.


A cat o' nine tails. See below.

Angora cat, blind cat, See under Angora, Blind. -- Black cat the fisher. See under Black. -- Cat and dog, like a cat and dog; quarrelsome; inharmonius. "I am sure we have lived a cat and dog life of it." Coleridge. -- Cat block Naut., a heavy iron-strapped block with a large hook, part of the tackle used in drawing an anchor up to the cathead. -- Cat hook Naut., a strong hook attached to a cat block. -- Cat nap, a very short sleep. [Colloq.] -- Cat o' nine tails, an instrument of punishment consisting of nine pieces of knotted line or cord fastened to a handle; -- formerly used to flog offenders on the bare back. -- Cat's cradle, game played, esp. by children, with a string looped on the fingers so, as to resemble small cradle. The string is transferred from the fingers of one to those of another, at each transfer with a change of form. See Cratch, Cratch cradle. -- To let the cat out of the bag, to tell a secret, carelessly or willfully. [Colloq.] -- Bush cat, the serval. See Serval.


© Webster 1913.

Cat (?), v. t. [imp. & p. p. catted; p. pr. & vb. n. Catting.] Naut.

To bring to the cathead; as, to cat an anchor. See Anchor.



© Webster 1913.

Log in or register to write something here or to contact authors.