Introducing UNIX and Linux |
FilesOverview |
File contentsGiven that you know a file exists, an obvious question is: 'What
does it contain?' A simple answer to this question might be that it
contains a sequence of bytes - but this would not be very helpful.
We need to know what those bytes represent. We could start off by
examining the filename; some UNIX files are required to have a
particular suffix, and this information could indicate their
contents. However, we should note that, for instance, if a file is
to contain a C program, its suffix must be It is not possible to infer from a file's suffix (if indeed it has one) what the contents of the file represent. Indeed, UNIX makes no stipulation of any sort as to what may or may not be stored in a file - a file is merely a sequence of bytes. However, all is not lost. It is possible to make an intelligent
guess as to what a file contains by examining the format of the
data inside it. For instance, if the file contains words that occur
in the C language, one might reasonably guess that the file
contains C source code. Many sorts of data can have their type
inferred from their format, and the command
Don't worry about Worked exampleWhat type of file is
thus We should also ask whether the question 'What does file
|
Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck