cat – Unix and Linux Command with Examples



cat command is one of the basic utility in UNIX operating system to concatenate files.


cat command is used to

  • View the full content of the file in the screen.
  • copy the file
  • append the content of the file to another file


Totally there are 11 options to use with cat command. These options may or may not be available for different versions of UNIX operating systems. Below you can find all the 11 cat command options with example. Here I took a file named cat_example.txt as an example.

-A or –show-all

This option shows all the non-printing characters (^ and M-), TABS as ^I and shows $ at end of the each line. In short, this option equals to -vET options. Both –A and –show-all provides same result.

-A = –show-all = -vET

Example: Tabs are displayed as ^I character and $ is displayed at end of the each line. Mostly ^M (Ctrl+M) occurs when the text file is transferred in the binary mode.

Read More: Find and remove ^M (control+M) characters in unix

-b or –number-nonblank

This option used to display line numbers only in the non-empty lines.


It is equivalent to –vE option. It displays all the non-printing characters (^ and M-) and displays $ at the end of each line

-e = -vE

-E, –show-ends

Displays $ symbol at the end of each line.

-n, –number

Displays line number in all the lines even it is a empty line.

-s, –squeeze-blank

It combines more than one empty lines to one empty line. In the below example, you can see 4th  and 5th empty lines are combined to one empty line.


This option shows all the non-printing characters (^ and M-) and TABS as ^I. It is equivalent to –vT.

-T, –show-tabs

Displays TAB space as ^I in the file.

-v, –show-nonprinting

Displays the non-printing characters (^ and M-) in the files.

– -help

It displays the manual page of cat command which includes usage, options and example of cat command. It just displays the help infirmation and exit.

– -version

Displays version, license and author of cat command. Like –help option, it too displays the version information and exit.

You have any doubts or feedback? Let us know in the comments below.

  • Thanks for the detailed description with examples. Keep going…

    • Thanks JamunaRani…