Command Line Basics: View Files With cat

August 21, 2009 by
Filed under: command line, HowTo, linux 

Oakley the CatThere are many ways to view files in GNU/Linux. One of the simplest command line tools for viewing files is cat. The cat command, short for concatenate, is actually intended for joining multiple files into one, but it works equally well for viewing text files.

The command is easy to use. Just enter cat filename. For example, information about your computer's cpu is stored in /proc/cpuinfo, so if you want to view this file, just enter

cat /proc/cpuinfo

If you'd like to view the file with line numbers, enter

cat -n /proc/cpuinfo

Like I said, there are more ways to view text files from the command line which I'll cover in the future.

Affiliate Link

Comments

3 Responses to “Command Line Basics: View Files With cat”

  1. Chris says:

    A variant of cat that I picked up recently and can be handy - it turns your cat around and has her face tail first. Try this example:
    tac /proc/cpuinfo

  2. Story added...

    This story has been submitted to fsdaily.com! If you think this story should be read by the free software community, come vote it up and discuss it here:

    http://www.fsdaily.com/Beginner/Command_Line_Basics_View_Files_With_cat

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>