Name

cat — Displays contents of a text file

Synopsis

cat {filename}

Options

filename

File to display

Description

Use to display the contents of a file. The file will be displayed in ASCII text, non printable characters and escape sequences may cause various effects. This is usually only an issue if binary files are displayed.

Example 13.1. Using cat command to display files contents

This example shows the display of two files one text and one binary.

>cat (hd0)/etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
>

This shows the display of part of a binary file and the undesirable effects.

>cat (hd0)/bin/ls
fb..p@VaeM`mLXkZ/.([=+$P*.nqBo      NU^.......!.,.&.>.AI)04RD"
<8 \ WQ J]:G9$..4 .(..44.4.....oo.o........b..b.... . . .P.U..... .. .. .bb...Hl
K ;[.T.  |.*.P. *.+., I|.  ....< i..
. ....8. +...` ...   . nye...  1.U&. nyy....  ...+ ..a.( 2.... c.u., i.0 >. . ..
|....w...4..?.o.....1.p..aP#......T#........e..4..`.e.a.H>.0.U&..nyR.i....i.0...
T.U.o.e.....o. ....H....o.`.H.h. ..ny<.U&..ny......m.A.0..i...L...t..
.0....$...$.....0...k<....g.H.d.n.T.D..&.`.
..
.l.8.x.T.......o...P..
...
..... . ..... .P#..nya....P.U&..nyb......b.a..~.a. .......Uu....u. .x..H.w. ....
P.. .\.0 ..".   ....  1.+.  K.\#..  a...
...".  A". 8+". >I". .". AP#. %T#. &X#. o\#. A. . .u . .!. ..!. !. __#+ _+ o+ .
$!. (!. ,!...0!...4!...8!...<!...@!...D!..H!...L!..P!..!...X!...\!...`!...d!.."R
"..S."..T."..U"..V."..X "..Z$"..[("..\,"..]0"..^4".._8"..`<"..a@"..bD"..cH"..d.a

See also

dumpfile(1).