File (command)

From LQWiki
Jump to: navigation, search

file is a command used to provide an overview of one or more files and identify the contents.


Here is an example from a console session:

tweedleburg:~ # file spider4.tar
spider4.tar: POSIX tar archive (GNU)
tweedleburg:~ # file amadeus.mpg
amadeus.mpg: MPEG sequence, v2, program multiplex
tweedleburg:~ # file tmp
tmp: directory
tweedleburg:~ # file /usr/lib/
/usr/lib/ symbolic link to `'

Also, while it is customary to name shell scripts with a '.sh' extension, it's more economical not to and distro scripts are rarely named that way. 'file' provides a quick overview of what's a script and what's a binary when 'ls' merely displays a bunch of executables.