[Next] [Previous] [Up] [Top] [Contents]

8.1 Working With Files

8.1.12 file - file type

This program, file, examines the selected file and tries to determine what type of file it is. It does this by reading the first few bytes of the file and comparing them with the table in /etc/magic. It can determine ASCII text files, tar formatted files, compressed files, etc.

Syntax

file [options] [-m magic_file] [-f file_list] file

Common Options

-c check the magic file for errors in format

-f file_list file_list contains a list of files to examine

-h don't follow symbolic links (SVR4 only)

-L follow symbolic links (BSD only)

-m magic_file use magic_file as the magic file instead of /etc/magic

Examples

Below we list the output from the command "file filename" for some representative files.

/etc/magic: ascii text

/usr/local/bin/gzip: Sun demand paged SPARC executable dynamically linked

/usr/bin/cut: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, stripped

source.tar: USTAR tar archive

source.tar.Z: compressed data block compressed 16 bits


Introduction to Unix - 14 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]