If you’ve ever had a file without an extension lying around your filesystem or a file that says it’s a jpeg but refuses to show itself in a graphics application, the file
command is for you. The command ships with just about every *nix under the sun (including MacOS/OSX).
Basic usage
|
|
For example, on my M1 Macbook Pro (MacOS 12.x) running file
on /bin/bash
produces:
|
|
While on my x86_64 Linux machine the same command produces:
|
|
Some useful switches include:
-z <filename>
- determine the file types of files inside a zipped archive-I <filename>
- determine the mime type of said file
Go forth and conquer!
:P