DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Working with files and directories

Finding out what type of data a file contains

As we saw in ``File and directory attributes'', the system supports numerous different file types. The contents of text files, for example, can be displayed on the screen using such commands as cat, more and pg. Doing this with a binary (or compiled program) file, may cause the screen to lock, as such files usually contain many control characters. (See ``Looking at the contents of a file'' for more on the display commands and on garbling your screen.)

To avoid using an unsuitable command to display the contents of a file, first find out what kind of information a file contains. To do this, use the file(C) command, as follows:

   $ file mbox
   mbox:   ascii text
   $ file tools
   tools:  directory
   $ file /bin/lc
   /bin/lc:        iAPX 486 executable
The file command accepts either a simple filename or a pathname as an argument.

Next topic: Looking at the contents of a file
Previous topic: Managing files

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003