Linux and Unix file command
Quick links
About file
Syntax
Examples
Related commands
Linux and Unix main page
Tells you if the object you are looking at is a file or if it is a directory.
file [-c] [-h] [-m mfile] [-f ffile] names
| -c | Check the magic file for format errors. For reasons of efficiency, this validation is normally not carried out. |
| -h | Do not follow symbolic links. |
| -m mfile | Use mfile as an alternate magic file. |
| -f ffile | ffile contains a list of the files to be examined. |
| names | Specifies the directories of files that you want the information about. |
file *
Below is an example of what may appear when running file with a wildcard for all files.
shutdown.htm: HTML document text
si.htm: HTML document text
side0.gif: GIF image data, version 89a, 107 x 18
robots.txt: ASCII text, with CRLF line terminators
routehlp.htm: HTML document text
rss: setgid directory
file *.txt
Below is an example of what may appear when running the above example; running the file command listing any file ending with .txt.
form.txt: news or mail text
friend.txt: news or mail text
ihave.txt: news or mail text
index.txt: ASCII Java program text, with very long lines, with CRLF line terminators
jargon.txt: news or mail text
news.txt: Non-ISO extended-ASCII C program text, with very long lines, with CRLF line terminators
newsdata.txt: Non-ISO extended-ASCII English text, with very long lines, with CRLF line terminators
qad.txt: news or mail text
refrence.txt: news or mail text
robots.txt: ASCII text, with CRLF line terminators
stopwords.txt: ASCII English text, with CRLF line terminators
yhelp.txt: news or mail text
