Previous Section  < Day Day Up >  Next Section

file—determines the type of a file by looking at its contents


file [[ –f ffile ] [ –cl ] [ –m mfile ] filename...


file performs a series of tests on each filename in an attempt to determine what it contains. If the contents of the file appear to be ASCII text, file examines the first 512 bytes and tries to guess its language.

Example A.26.

1   file bin/ls

    /bin/ls:      sparc pure dynamically linked executable

2   file go

    go:      executable shell script

3   file junk

    junk:      English text


EXPLANATION

  1. ls is a binary file dynamically linked when executed.

  2. go is an executable shell script.

  3. junk is a file containing ASCII text.

    Previous Section  < Day Day Up >  Next Section