File Types in Operating system

The system uses the extension to indicate the type of the file and the type of operations that can be done on that file. Only a file with a .com, .exe, or .sh extension can be executed, for instance. The .com and .exe files are two forms of binary executable files, whereas the .sh file is a shell script containing, in ASCII format, commands to the operating system. Application programs also use extensions to indicate file types in which they are interested.

For example, Java compilers expect source files to have a .java extension, and the Microsoft Word word processor expects its files to end with a .doc or .docx extension. These extensions are not always required, so a user may specify a file without the extension (to save typing), and the application will look for a file with the given name and the extension it expects. Because these extensions are not supported by the operating system, they can be considered “hints” to the applications that operate on them

file typeusual extensionfunction
executableexe, com, bin
or none
ready-to-run machine language program
objectobj, ocompiled, machine
language, not linked
source codec, cc, java, perl,
source code in various
batchbat, shcommands to the command
markupxml, html, textextual data, documents
word processorxml, rtf, docxvarious word-processor
librarylib, a, so, dlllibraries of routines for
print or viewgif, pdf, jpgASCII or binary file in a
format for printing or
archiverar, zip, tarrelated files grouped into
one file, sometimes compressed, for archiving
or storage
multimediampeg, mov, mp3,
mp4, avi
binary file containing
audio or A/V information

The UNIX system uses a crude magic number stored at the beginning of some files to indicate roughly the type of the file—executable program, shell script, PDF file, and so on. Not all files have magic numbers, so system features cannot be based solely on this information. UNIX does not record the name of the creating program, either. UNIX does allow file-name-extension hints, but these extensions are neither enforced nor depended on by the operating system; they are meant mostly to aid users in determining what type of contents the file contains. Extensions can be used or ignored by a given application, but that is up to the application’s programmer

Leave a Comment