About
Reports a path type by inspecting its leading bytes, not the extension. It tells text, images, executables and archives apart, among dozens of formats. Useful when a download arrives unnamed, or a script misbehaves.
Install it
pkg install file
Run this inside Termux. If the package is already present, pkg will say so and
do nothing.
Commands worth knowing
6 of the invocations you will actually reach for. Tap the copy button to put one on your clipboard.
file photo.jpg Report the detected type of one path, such as JPEG image data. file -b photo.jpg Print only the type description, without the leading name and colon. file -i photo.jpg Emit the MIME type rather than a prose description. file -s /dev/block/mmcblk0 Read block and character devices too. Needed for raw disk paths. file -z bundle.zip Look inside compressed archives and describe their contents. file -e soft docs/ Treat symbolic links as the target type, not the link itself. Worked example
Run file -i notes.txt and this is what you should see.
$ file -i notes.txt
notes.txt: text/plain; charset=us-ascii
photo.jpg: image/jpeg
scripts/run.sh: text/x-shellscript; charset=us-ascii Developed by
Ian Darwin .