Re: How to determine file type



mr zali wrote:
  >Hi,
  >
  >I'm try to developed application like GMC. I have a
  >problem with file that have no ext. For example README
  >file. How I want to determine that file are 'text'
  >file or 'binary' file? 

Use the file command:

$ file /usr/bin/dpkg
/usr/bin/dpkg: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically linked (uses shared libs), 
stripped

$ file README.Debian
README.Debian: ASCII English text

file uses a database of file header information which is in the file /etc/magic

-- 
Oliver Elphick                                Oliver Elphick lfix co uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "But where shall wisdom be found? And where is the
      place of understanding? It cannot be gotten for gold,
      neither shall silver be weighed for the price thereof.
      Whence then cometh wisdom? and where is the place of
      understanding? ...Behold the fear of the Lord, that is
      wisdom; and to depart from evil is understanding."    
                                         Job 12,15,20,28





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]