If you do not understand then you can see the example for better understanding
Example:- 1
Provides a brief description of the command output file and data type. For example, using the file command to test a text file:
[root@red-hat test]# file file.txt
file.txt: ASCII text
[root@red-hat test]#
Example:-2 - Test multiple files
To test multiple files at once, append the file names to the end of the file command:
[root@red-hat test]# file file.txt index.html sample.png
file.txt: ASCII text
index.html: HTML document, UTF-8 Unicode text, with CRLF line terminators
sample.png: PNG image data, 438 x 300, 8-bit/color RGBA, non-interlaced
[root@red-hat test]#
[root@red-hat test]# file * Desktop: directory Documents: directory Downloads: directory file.txt: ASCII text index.html: HTML document, UTF-8 Unicode text, with CRLF line terminators Music: directory Pictures: directory Public: directory sample.png: PNG image data, 438 x 300, 8-bit/color RGBA, non-interlaced Templates: directory Videos: directory [root@red-hat test]#
To test the contents of that directory, add the path to the directory containing wildcard characters: for example, to test the contents of the example directory, use:
[root@red-hat test]# file test/* test/file1.txt: empty test/file.txt: ASCII text test/index.html: HTML document, UTF-8 Unicode text, with CRLF line terminators test/sample.png: PNG image data, 438 x 300, 8-bit/color RGBA, non-interlaced [root@red-hat test]#
The file command lets you test a subset of files in a directory using regex-style ranges. Select a range by enclosing the values in parentheses. For example, to test files and directories with names in the range [g-z]
[root@red-hat test]# file [g-z]* index.html: HTML document, UTF-8 Unicode text, with CRLF line terminators sample.png: PNG image data, 438 x 300, 8-bit/color RGBA, non-interlaced test: directory [root@red-hat test]#
The file command lets you test a subset of files in a directory using regex-style ranges. Select a range by enclosing the values in parentheses. For example, to test files and directories with names in the range [g-z]
[root@red-hat test]# file [g-z]* [A-Z]* index.html: HTML document, UTF-8 Unicode text, with CRLF line terminators sample.png: PNG image data, 438 x 300, 8-bit/color RGBA, non-interlaced test: directory Desktop: directory Documents: directory Downloads: directory Music: directory Pictures: directory Public: directory Templates: directory Videos: directory [root@red-hat test]#
[root@red-hat test]# file /dev/sr1 /dev/sr1: block special (11/1) [root@red-hat test]#