Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I use the file command in order to verify if file (PATH) is text/ascii file or encrypted file

Because file command have allot of results ( small example in example 1 ) I want to get the all possibilities that we can get from file results

Please advice from where we can find the total list of file results? (relevant for linux/solaris)

Example 1

File command results ( very short list ....)

   ASCII text
   ASCII text, with CRLF, LF line terminators
   ASCII English text
   ASCII English text, with very long lines

   etc....
share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

I recommend using --mime instead of the default output. The MIME will return output like this:

foobar: text/plain; charset=us-ascii

The full list is typically found in the /etc/mime.types file.

share|improve this answer
    
what the add value from (--mime ) , I mean what the extra data that we get by using the ( (--mime ) ? –  yael Jan 7 '13 at 15:28
    
One question if I use the flag (--mime) and I get from file file command the output --> "text" or "text/plain", its mean the file PATH isn’t encrypted file ? –  yael Jan 7 '13 at 15:35
    
so if I get the "text/plain" then its mean that the file isnt encrypted file for sure ? –  yael Jan 7 '13 at 15:46
1  
@yael No, it just means there is no binary data and no other known structure. file cannot detect whether the content is encrypted or not (this is generally near impossible). –  scai Jan 7 '13 at 15:52
    
for solrais (flag --mime ) not defined in file command , so what syntax need for solaris ? –  yael Jan 7 '13 at 15:55
show 2 more comments

EDITED: All of the checks and returns that file does is located in /usr/share/misc/magic

There is no file option to "display all"

share|improve this answer
    
what I need is all Possibilities that file can display on the output - as you know file have allot of Possibilities - but how to know them? or listed them? –  yael Jan 7 '13 at 15:33
1  
less /usr/share/misc/magic –  h3rrmiller Jan 7 '13 at 15:39
    
Here, /usr/share/misc/magic is an empty directory (Ubuntu Linux). –  scai Jan 7 '13 at 15:54
    
file --version should report the version of file as well as the location of the magic file –  h3rrmiller Jan 7 '13 at 15:56
    
@h3rrmiller: man file is more reliable to find the location of the magic file, Solaris & AIX file don't have a --version switch for instance :) –  Mat Jan 7 '13 at 16:40
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.