The UNIX file command, which tells you what is inside a file, is seemingly not available either in Busybox or the system directory of Android.

Is there any way to run file on Android? (via Terminal Emulator, etc)

Preferably without having to be rooted...


You really won't find it because it doesn't exist on Android system not even from a third party Busybox installer. But I achieved to find a solution to compile it so that I can use it on my android terminal. Here's the link http://forum.xda-developers.com/showthread.php?t=1612760

Basically you just have to follow this,

Originally posted by samveen on XDA

After wandering around looking for an android build of the file command, I finally went ahead and compiled it myself.

The attached package contains the file binary (v5.11), the libmagic.so shared library, the associated magic files and the build specific files that I needed (over and above the source) to build it. The paths of the files are relative to '/'.


Note: Add the location of libmagic.so to LD_LIBRARY_PATH to get rid of the "CANNOT LINK EXECUTABLE" error. (I use /data/local/lib)


 $ echo $ LD_LIBRARY_PATH /data/local/lib:/data/local/lib:/data/local/lib:/system/lib:/vendor/lib 
 $ file 

 Usage: - file  [-bchikLlNnprsvz0] [--apple]
                    [--mime-type] [-e testname]
                    [-F separator] [-f namefile] 
                    [-m magicfiles] file ... 

  file -C [-m magicfiles]
  file [--help] 

  $ getprop | grep device [ro.cm.device]: [jordan] [ro.product.device]: [umts_jordan]

Download here: http://forum.xda-developers.com/attachment.php?attachmentid=1022807&d=1335294084


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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