The file command can be used to display a file type. Let's create an empty file.
The file command will show that foo.txt is an empty file.
~]# file foo.txt foo.txt: empty
Let's append some text to foo.txt.
echo "Hello World" > foo.txt
Now the file command should return the following.
~]# file foo.txt foo.txt: ASCII text
Let's say you have a certificate file, foo.cer, that contains something like this.
-----BEGIN CERTIFICATE----- MIIGhTCCBW2gAwIBAgITFwAS0Zj4+uylATknJgAAABLRmDANBgkqhkiG9w0BAQsF ADBMMRQwEgYKCZImiZPyLGQBGRYEY29ycDEYMBYGCgmSJomT8ixkARkWCHRocml2 ysR4VfQLr+A3zbM59CQjewP40y7oFgrpNuj8Hp1AXud3nsakEYFaGcc= -----END CERTIFICATE-----
Something like this should be returned.
foo.cer: PEM certificate
Let's say you have a binary file foo.file. Attempting to view the content of foo.file will probably return mumbo jumbo, something like this.
~]# cat foo.file h++-://c_+.+h_i+e++.c-+/ce_+e+_-+
The file command should identify foo.file as a data file.
~]# file foo.file foo.file: data