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...

2 Answers 2


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 https://xdaforums.com/t/tool-file-1-command-for-android-ver-5-11.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


I don't even remember asking this question, but nowadays for using file on Android devices I use either:

  • Termux: https://play.google.com/store/apps/details?id=com.termux
    • A lightweight solution which lets you install and run tools on Android natively, and does not have local root access (unless your device is rooted). file is not installed by default but can be installed with pkg install file. It's also necessary to run termux-setup-storage to give Termux access to your device storage, from where you can find files you want to pass to file
  • Userland: https://play.google.com/store/apps/details?id=tech.ula
    • A much more heavyweight solution that installs a full Linux distro, but with local root access

For simple use cases, Termux works fine for me.

Still I've accepted the other answer as something which can be run natively on Android, although I don't use that personally.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .